@applica-software-guru/persona-sdk 0.0.1-preview6 → 0.1.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/.eslintrc.cjs +6 -5
- package/.nvmrc +1 -1
- package/.prettierignore +3 -5
- package/.prettierrc +3 -5
- package/README.md +247 -2
- package/bitbucket-pipelines.yml +2 -12
- package/dist/bundle.cjs.js +1 -14
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.es.js +472 -699
- package/dist/bundle.es.js.map +1 -1
- package/dist/index.d.ts +1089 -5
- package/package.json +9 -39
- package/src/agents/agents-api.ts +54 -0
- package/src/agents/types.ts +346 -0
- package/src/auth/api-key-auth.ts +13 -0
- package/src/auth/authentication-provider.ts +4 -0
- package/src/auth/bearer-token-auth.ts +13 -0
- package/src/auth/index.ts +3 -0
- package/src/credentials/credentials-api.ts +40 -0
- package/src/credentials/types.ts +67 -0
- package/src/exceptions.ts +10 -0
- package/src/features/feature-templates-api.ts +41 -0
- package/src/features/features-api.ts +16 -0
- package/src/features/types.ts +25 -0
- package/src/http-api.ts +95 -0
- package/src/index.ts +153 -4
- package/src/knowledges/knowledge-base-documents-api.ts +38 -0
- package/src/knowledges/knowledge-bases-api.ts +47 -0
- package/src/knowledges/types.ts +70 -0
- package/src/missions/missions-api.ts +60 -0
- package/src/missions/types.ts +25 -0
- package/src/paginated.ts +6 -0
- package/src/persona-sdk.ts +81 -0
- package/src/projects/projects-api.ts +55 -0
- package/src/projects/types.ts +42 -0
- package/src/revisions/types.ts +9 -0
- package/src/service-prices/service-prices-api.ts +32 -0
- package/src/service-prices/types.ts +8 -0
- package/src/sessions/sessions-api.ts +55 -0
- package/src/sessions/types.ts +129 -0
- package/src/triggers/trigger-executions-api.ts +27 -0
- package/src/triggers/triggers-api.ts +37 -0
- package/src/triggers/types.ts +50 -0
- package/src/workflows/types.ts +150 -0
- package/src/workflows/workflow-executions-api.ts +27 -0
- package/src/workflows/workflows-api.ts +51 -0
- package/tsconfig.json +20 -28
- package/vite.config.ts +20 -62
- package/dist/bundle.iife.js +0 -15
- package/dist/bundle.iife.js.map +0 -1
- package/dist/bundle.umd.js +0 -15
- package/dist/bundle.umd.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logging.d.ts +0 -18
- package/dist/logging.d.ts.map +0 -1
- package/dist/messages.d.ts +0 -7
- package/dist/messages.d.ts.map +0 -1
- package/dist/protocol/base.d.ts +0 -23
- package/dist/protocol/base.d.ts.map +0 -1
- package/dist/protocol/index.d.ts +0 -5
- package/dist/protocol/index.d.ts.map +0 -1
- package/dist/protocol/rest.d.ts +0 -22
- package/dist/protocol/rest.d.ts.map +0 -1
- package/dist/protocol/webrtc.d.ts +0 -56
- package/dist/protocol/webrtc.d.ts.map +0 -1
- package/dist/protocol/websocket.d.ts +0 -22
- package/dist/protocol/websocket.d.ts.map +0 -1
- package/dist/runtime.d.ts +0 -21
- package/dist/runtime.d.ts.map +0 -1
- package/dist/types.d.ts +0 -79
- package/dist/types.d.ts.map +0 -1
- package/jsconfig.node.json +0 -10
- package/playground/index.html +0 -14
- package/playground/src/app.tsx +0 -10
- package/playground/src/chat.tsx +0 -52
- package/playground/src/components/assistant-ui/assistant-modal.tsx +0 -57
- package/playground/src/components/assistant-ui/markdown-text.tsx +0 -119
- package/playground/src/components/assistant-ui/thread-list.tsx +0 -62
- package/playground/src/components/assistant-ui/thread.tsx +0 -249
- package/playground/src/components/assistant-ui/tool-fallback.tsx +0 -33
- package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +0 -38
- package/playground/src/components/ui/avatar.tsx +0 -35
- package/playground/src/components/ui/button.tsx +0 -43
- package/playground/src/components/ui/tooltip.tsx +0 -32
- package/playground/src/lib/utils.ts +0 -6
- package/playground/src/main.tsx +0 -10
- package/playground/src/styles.css +0 -1
- package/playground/src/vite-env.d.ts +0 -1
- package/preview.sh +0 -13
- package/src/logging.ts +0 -34
- package/src/messages.ts +0 -79
- package/src/protocol/base.ts +0 -55
- package/src/protocol/index.ts +0 -4
- package/src/protocol/rest.ts +0 -66
- package/src/protocol/webrtc.ts +0 -339
- package/src/protocol/websocket.ts +0 -108
- package/src/runtime.tsx +0 -217
- package/src/types.ts +0 -98
- package/tsconfig.node.json +0 -15
package/dist/bundle.es.js
CHANGED
|
@@ -1,748 +1,521 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @license React
|
|
12
|
-
* react-jsx-runtime.development.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/
|
|
19
|
-
return function() {
|
|
20
|
-
function r(s) {
|
|
21
|
-
if (s == null) return null;
|
|
22
|
-
if (typeof s == "function")
|
|
23
|
-
return s.$$typeof === I ? null : s.displayName || s.name || null;
|
|
24
|
-
if (typeof s == "string") return s;
|
|
25
|
-
switch (s) {
|
|
26
|
-
case R:
|
|
27
|
-
return "Fragment";
|
|
28
|
-
case M:
|
|
29
|
-
return "Profiler";
|
|
30
|
-
case $:
|
|
31
|
-
return "StrictMode";
|
|
32
|
-
case y:
|
|
33
|
-
return "Suspense";
|
|
34
|
-
case S:
|
|
35
|
-
return "SuspenseList";
|
|
36
|
-
case P:
|
|
37
|
-
return "Activity";
|
|
38
|
-
}
|
|
39
|
-
if (typeof s == "object")
|
|
40
|
-
switch (typeof s.tag == "number" && console.error(
|
|
41
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
42
|
-
), s.$$typeof) {
|
|
43
|
-
case _:
|
|
44
|
-
return "Portal";
|
|
45
|
-
case W:
|
|
46
|
-
return (s.displayName || "Context") + ".Provider";
|
|
47
|
-
case D:
|
|
48
|
-
return (s._context.displayName || "Context") + ".Consumer";
|
|
49
|
-
case u:
|
|
50
|
-
var a = s.render;
|
|
51
|
-
return s = s.displayName, s || (s = a.displayName || a.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
52
|
-
case T:
|
|
53
|
-
return a = s.displayName || null, a !== null ? a : r(s.type) || "Memo";
|
|
54
|
-
case b:
|
|
55
|
-
a = s._payload, s = s._init;
|
|
56
|
-
try {
|
|
57
|
-
return r(s(a));
|
|
58
|
-
} catch {
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
function t(s) {
|
|
64
|
-
return "" + s;
|
|
65
|
-
}
|
|
66
|
-
function e(s) {
|
|
67
|
-
try {
|
|
68
|
-
t(s);
|
|
69
|
-
var a = !1;
|
|
70
|
-
} catch {
|
|
71
|
-
a = !0;
|
|
72
|
-
}
|
|
73
|
-
if (a) {
|
|
74
|
-
a = console;
|
|
75
|
-
var l = a.error, m = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
76
|
-
return l.call(
|
|
77
|
-
a,
|
|
78
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
79
|
-
m
|
|
80
|
-
), t(s);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function n(s) {
|
|
84
|
-
if (s === R) return "<>";
|
|
85
|
-
if (typeof s == "object" && s !== null && s.$$typeof === b)
|
|
86
|
-
return "<...>";
|
|
87
|
-
try {
|
|
88
|
-
var a = r(s);
|
|
89
|
-
return a ? "<" + a + ">" : "<...>";
|
|
90
|
-
} catch {
|
|
91
|
-
return "<...>";
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function o() {
|
|
95
|
-
var s = A.A;
|
|
96
|
-
return s === null ? null : s.getOwner();
|
|
97
|
-
}
|
|
98
|
-
function c() {
|
|
99
|
-
return Error("react-stack-top-frame");
|
|
100
|
-
}
|
|
101
|
-
function d(s) {
|
|
102
|
-
if (J.call(s, "key")) {
|
|
103
|
-
var a = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
104
|
-
if (a && a.isReactWarning) return !1;
|
|
105
|
-
}
|
|
106
|
-
return s.key !== void 0;
|
|
107
|
-
}
|
|
108
|
-
function g(s, a) {
|
|
109
|
-
function l() {
|
|
110
|
-
B || (B = !0, console.error(
|
|
111
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
112
|
-
a
|
|
113
|
-
));
|
|
114
|
-
}
|
|
115
|
-
l.isReactWarning = !0, Object.defineProperty(s, "key", {
|
|
116
|
-
get: l,
|
|
117
|
-
configurable: !0
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function h() {
|
|
121
|
-
var s = r(this.type);
|
|
122
|
-
return V[s] || (V[s] = !0, console.error(
|
|
123
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
124
|
-
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
125
|
-
}
|
|
126
|
-
function f(s, a, l, m, E, C, L, F) {
|
|
127
|
-
return l = C.ref, s = {
|
|
128
|
-
$$typeof: N,
|
|
129
|
-
type: s,
|
|
130
|
-
key: a,
|
|
131
|
-
props: C,
|
|
132
|
-
_owner: E
|
|
133
|
-
}, (l !== void 0 ? l : null) !== null ? Object.defineProperty(s, "ref", {
|
|
134
|
-
enumerable: !1,
|
|
135
|
-
get: h
|
|
136
|
-
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
137
|
-
configurable: !1,
|
|
138
|
-
enumerable: !1,
|
|
139
|
-
writable: !0,
|
|
140
|
-
value: 0
|
|
141
|
-
}), Object.defineProperty(s, "_debugInfo", {
|
|
142
|
-
configurable: !1,
|
|
143
|
-
enumerable: !1,
|
|
144
|
-
writable: !0,
|
|
145
|
-
value: null
|
|
146
|
-
}), Object.defineProperty(s, "_debugStack", {
|
|
147
|
-
configurable: !1,
|
|
148
|
-
enumerable: !1,
|
|
149
|
-
writable: !0,
|
|
150
|
-
value: L
|
|
151
|
-
}), Object.defineProperty(s, "_debugTask", {
|
|
152
|
-
configurable: !1,
|
|
153
|
-
enumerable: !1,
|
|
154
|
-
writable: !0,
|
|
155
|
-
value: F
|
|
156
|
-
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
157
|
-
}
|
|
158
|
-
function w(s, a, l, m, E, C, L, F) {
|
|
159
|
-
var p = a.children;
|
|
160
|
-
if (p !== void 0)
|
|
161
|
-
if (m)
|
|
162
|
-
if (ae(p)) {
|
|
163
|
-
for (m = 0; m < p.length; m++)
|
|
164
|
-
O(p[m]);
|
|
165
|
-
Object.freeze && Object.freeze(p);
|
|
166
|
-
} else
|
|
167
|
-
console.error(
|
|
168
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
169
|
-
);
|
|
170
|
-
else O(p);
|
|
171
|
-
if (J.call(a, "key")) {
|
|
172
|
-
p = r(s);
|
|
173
|
-
var v = Object.keys(a).filter(function(oe) {
|
|
174
|
-
return oe !== "key";
|
|
175
|
-
});
|
|
176
|
-
m = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", H[p + m] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
177
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
178
|
-
let props = %s;
|
|
179
|
-
<%s {...props} />
|
|
180
|
-
React keys must be passed directly to JSX without using spread:
|
|
181
|
-
let props = %s;
|
|
182
|
-
<%s key={someKey} {...props} />`,
|
|
183
|
-
m,
|
|
184
|
-
p,
|
|
185
|
-
v,
|
|
186
|
-
p
|
|
187
|
-
), H[p + m] = !0);
|
|
188
|
-
}
|
|
189
|
-
if (p = null, l !== void 0 && (e(l), p = "" + l), d(a) && (e(a.key), p = "" + a.key), "key" in a) {
|
|
190
|
-
l = {};
|
|
191
|
-
for (var U in a)
|
|
192
|
-
U !== "key" && (l[U] = a[U]);
|
|
193
|
-
} else l = a;
|
|
194
|
-
return p && g(
|
|
195
|
-
l,
|
|
196
|
-
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
197
|
-
), f(
|
|
198
|
-
s,
|
|
199
|
-
p,
|
|
200
|
-
C,
|
|
201
|
-
E,
|
|
202
|
-
o(),
|
|
203
|
-
l,
|
|
204
|
-
L,
|
|
205
|
-
F
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
function O(s) {
|
|
209
|
-
typeof s == "object" && s !== null && s.$$typeof === N && s._store && (s._store.validated = 1);
|
|
210
|
-
}
|
|
211
|
-
var k = le, N = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), M = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), W = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), I = Symbol.for("react.client.reference"), A = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ae = Array.isArray, z = console.createTask ? console.createTask : function() {
|
|
212
|
-
return null;
|
|
213
|
-
};
|
|
214
|
-
k = {
|
|
215
|
-
"react-stack-bottom-frame": function(s) {
|
|
216
|
-
return s();
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
var B, V = {}, G = k["react-stack-bottom-frame"].bind(
|
|
220
|
-
k,
|
|
221
|
-
c
|
|
222
|
-
)(), X = z(n(c)), H = {};
|
|
223
|
-
x.Fragment = R, x.jsx = function(s, a, l, m, E) {
|
|
224
|
-
var C = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
225
|
-
return w(
|
|
226
|
-
s,
|
|
227
|
-
a,
|
|
228
|
-
l,
|
|
229
|
-
!1,
|
|
230
|
-
m,
|
|
231
|
-
E,
|
|
232
|
-
C ? Error("react-stack-top-frame") : G,
|
|
233
|
-
C ? z(n(s)) : X
|
|
234
|
-
);
|
|
235
|
-
}, x.jsxs = function(s, a, l, m, E) {
|
|
236
|
-
var C = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
237
|
-
return w(
|
|
238
|
-
s,
|
|
239
|
-
a,
|
|
240
|
-
l,
|
|
241
|
-
!0,
|
|
242
|
-
m,
|
|
243
|
-
E,
|
|
244
|
-
C ? Error("react-stack-top-frame") : G,
|
|
245
|
-
C ? z(n(s)) : X
|
|
246
|
-
);
|
|
247
|
-
};
|
|
248
|
-
}(), x;
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var l = (n, t, s) => t in n ? p(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
|
|
3
|
+
var o = (n, t, s) => l(n, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
class c extends Error {
|
|
5
|
+
constructor(s, e) {
|
|
6
|
+
super(`API Error: ${s} - ${e}`);
|
|
7
|
+
o(this, "statusCode");
|
|
8
|
+
o(this, "body");
|
|
9
|
+
this.statusCode = s, this.body = e;
|
|
10
|
+
}
|
|
249
11
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
12
|
+
class d {
|
|
13
|
+
constructor(t) {
|
|
14
|
+
this.apiKey = t;
|
|
15
|
+
}
|
|
16
|
+
applyHeaders(t) {
|
|
17
|
+
t.set("x-persona-apikey", this.apiKey);
|
|
18
|
+
}
|
|
19
|
+
getCredentials() {
|
|
20
|
+
return this.apiKey;
|
|
21
|
+
}
|
|
257
22
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
23
|
+
class a {
|
|
24
|
+
constructor(t, s) {
|
|
25
|
+
o(this, "baseUrl");
|
|
26
|
+
o(this, "authProvider");
|
|
27
|
+
this.baseUrl = t, this.authProvider = typeof s == "string" ? new d(s) : s;
|
|
28
|
+
}
|
|
29
|
+
getBaseUrl() {
|
|
30
|
+
return this.baseUrl;
|
|
31
|
+
}
|
|
32
|
+
getAuthProvider() {
|
|
33
|
+
return this.authProvider;
|
|
34
|
+
}
|
|
35
|
+
buildHeaders() {
|
|
36
|
+
const t = new Headers();
|
|
37
|
+
return t.set("Content-Type", "application/json"), this.authProvider.applyHeaders(t), t;
|
|
38
|
+
}
|
|
39
|
+
buildUrl(t, s) {
|
|
40
|
+
const e = new URL(this.baseUrl + t);
|
|
41
|
+
return s && Object.entries(s).forEach(([r, i]) => {
|
|
42
|
+
i != null && e.searchParams.set(r, String(i));
|
|
43
|
+
}), e.toString();
|
|
44
|
+
}
|
|
45
|
+
async handleResponse(t) {
|
|
46
|
+
if (!t.ok) {
|
|
47
|
+
const e = await t.text();
|
|
48
|
+
throw new c(t.status, e);
|
|
49
|
+
}
|
|
50
|
+
const s = await t.text();
|
|
51
|
+
return s ? JSON.parse(s) : void 0;
|
|
52
|
+
}
|
|
53
|
+
async httpGet(t, s) {
|
|
54
|
+
const e = await fetch(this.buildUrl(t, s), {
|
|
55
|
+
method: "GET",
|
|
56
|
+
headers: this.buildHeaders()
|
|
57
|
+
});
|
|
58
|
+
return this.handleResponse(e);
|
|
59
|
+
}
|
|
60
|
+
async httpPost(t, s) {
|
|
61
|
+
const e = await fetch(this.baseUrl + t, {
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: this.buildHeaders(),
|
|
64
|
+
body: s ? JSON.stringify(s) : void 0
|
|
65
|
+
});
|
|
66
|
+
return this.handleResponse(e);
|
|
67
|
+
}
|
|
68
|
+
async httpPut(t, s) {
|
|
69
|
+
const e = await fetch(this.baseUrl + t, {
|
|
70
|
+
method: "PUT",
|
|
71
|
+
headers: this.buildHeaders(),
|
|
72
|
+
body: JSON.stringify(s)
|
|
73
|
+
});
|
|
74
|
+
return this.handleResponse(e);
|
|
75
|
+
}
|
|
76
|
+
async httpPatch(t, s) {
|
|
77
|
+
const e = await fetch(this.baseUrl + t, {
|
|
78
|
+
method: "PATCH",
|
|
79
|
+
headers: this.buildHeaders(),
|
|
80
|
+
body: JSON.stringify(s)
|
|
81
|
+
});
|
|
82
|
+
return this.handleResponse(e);
|
|
83
|
+
}
|
|
84
|
+
async httpDelete(t) {
|
|
85
|
+
const s = await fetch(this.baseUrl + t, {
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
headers: this.buildHeaders()
|
|
267
88
|
});
|
|
268
|
-
|
|
89
|
+
if (!s.ok) {
|
|
90
|
+
const e = await s.text();
|
|
91
|
+
throw new c(s.status, e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
269
94
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
95
|
+
class y extends a {
|
|
96
|
+
constructor(t, s) {
|
|
97
|
+
super(t, s);
|
|
98
|
+
}
|
|
99
|
+
async list(t, s, e) {
|
|
100
|
+
const r = { page: s, size: e };
|
|
101
|
+
return t && (r.keyword = t), this.httpGet("/projects", r);
|
|
102
|
+
}
|
|
103
|
+
async get(t) {
|
|
104
|
+
return this.httpGet("/projects/" + t);
|
|
105
|
+
}
|
|
106
|
+
async getMine() {
|
|
107
|
+
return this.httpGet("/projects/mine");
|
|
108
|
+
}
|
|
109
|
+
async create(t) {
|
|
110
|
+
return this.httpPost("/projects", t);
|
|
111
|
+
}
|
|
112
|
+
async update(t) {
|
|
113
|
+
return this.httpPut("/projects/" + t.projectId, t);
|
|
114
|
+
}
|
|
115
|
+
async remove(t) {
|
|
116
|
+
await this.httpDelete("/projects/" + t);
|
|
117
|
+
}
|
|
118
|
+
async getSubscription(t) {
|
|
119
|
+
return this.httpGet("/projects/" + t + "/subscription");
|
|
120
|
+
}
|
|
121
|
+
async changeSubscriptionPlan(t, s) {
|
|
122
|
+
return this.httpPost("/projects/" + t + "/subscription/plan", s);
|
|
123
|
+
}
|
|
124
|
+
async addSubscriptionCredits(t, s) {
|
|
125
|
+
return this.httpPost("/projects/" + t + "/subscription/credits", s);
|
|
126
|
+
}
|
|
291
127
|
}
|
|
292
|
-
class
|
|
293
|
-
constructor() {
|
|
294
|
-
|
|
295
|
-
i(this, "messageCallbacks", []);
|
|
128
|
+
class g extends a {
|
|
129
|
+
constructor(t, s) {
|
|
130
|
+
super(t, s);
|
|
296
131
|
}
|
|
297
|
-
|
|
298
|
-
|
|
132
|
+
async list(t, s, e) {
|
|
133
|
+
const r = { page: s, size: e };
|
|
134
|
+
return t && (r.keyword = t), this.httpGet("/agents", r);
|
|
299
135
|
}
|
|
300
|
-
|
|
301
|
-
this.
|
|
136
|
+
async get(t) {
|
|
137
|
+
return this.httpGet("/agents/" + t);
|
|
302
138
|
}
|
|
303
|
-
async
|
|
304
|
-
this.
|
|
139
|
+
async create(t) {
|
|
140
|
+
return this.httpPost("/agents", t);
|
|
305
141
|
}
|
|
306
|
-
async
|
|
307
|
-
this.
|
|
142
|
+
async update(t) {
|
|
143
|
+
return this.httpPut("/agents/" + t.id, t);
|
|
308
144
|
}
|
|
309
|
-
async
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
145
|
+
async remove(t) {
|
|
146
|
+
await this.httpDelete("/agents/" + t);
|
|
147
|
+
}
|
|
148
|
+
async getSynthesizerSupportedVoices(t) {
|
|
149
|
+
return this.httpGet("/values/synthesizers/" + t + "/voices");
|
|
313
150
|
}
|
|
314
|
-
async
|
|
315
|
-
this.
|
|
151
|
+
async listRevisions(t) {
|
|
152
|
+
return this.httpGet("/agents/" + t + "/revisions");
|
|
316
153
|
}
|
|
317
|
-
async
|
|
318
|
-
|
|
319
|
-
this.status = t, e && this.statusChangeCallbacks.forEach((n) => n(t));
|
|
154
|
+
async getRevision(t, s) {
|
|
155
|
+
return this.httpGet("/agents/" + t + "/revisions/" + s);
|
|
320
156
|
}
|
|
321
|
-
|
|
322
|
-
this.
|
|
157
|
+
async rollback(t, s) {
|
|
158
|
+
return this.httpPost("/agents/" + t + "/revisions/" + s + "/rollback", {});
|
|
323
159
|
}
|
|
324
160
|
}
|
|
325
|
-
class
|
|
326
|
-
constructor(e) {
|
|
327
|
-
super();
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
i
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return "
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
return
|
|
340
|
-
}
|
|
341
|
-
async
|
|
342
|
-
return this.
|
|
343
|
-
}
|
|
344
|
-
async
|
|
345
|
-
this.
|
|
346
|
-
}
|
|
347
|
-
async syncSession(e) {
|
|
348
|
-
this.session = e;
|
|
349
|
-
}
|
|
350
|
-
async send(e) {
|
|
351
|
-
const { apiUrl: n, apiKey: o, agentId: c } = this.config, d = this.session ?? "new", g = e, f = await (await fetch(`${n}/agents/${c}/sessions/${d}/messages`, {
|
|
352
|
-
body: JSON.stringify({ userMessage: g }),
|
|
353
|
-
method: "POST",
|
|
354
|
-
headers: {
|
|
355
|
-
"Content-Type": "application/json",
|
|
356
|
-
"x-fox-apikey": o,
|
|
357
|
-
"x-persona-apikey": o
|
|
358
|
-
}
|
|
359
|
-
})).json();
|
|
360
|
-
this.notifyMessages(f.response.messages);
|
|
161
|
+
class w extends a {
|
|
162
|
+
constructor(s, e, r) {
|
|
163
|
+
super(s, e);
|
|
164
|
+
o(this, "knowledgeBaseId");
|
|
165
|
+
this.knowledgeBaseId = r;
|
|
166
|
+
}
|
|
167
|
+
async list(s, e, r) {
|
|
168
|
+
const i = { page: e, size: r };
|
|
169
|
+
return s && (i.keyword = s), this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents", i);
|
|
170
|
+
}
|
|
171
|
+
async upload(s) {
|
|
172
|
+
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", s);
|
|
173
|
+
}
|
|
174
|
+
async get(s) {
|
|
175
|
+
return this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + s);
|
|
176
|
+
}
|
|
177
|
+
async reprocess(s) {
|
|
178
|
+
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", { document_id: s });
|
|
179
|
+
}
|
|
180
|
+
async remove(s) {
|
|
181
|
+
await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + s);
|
|
361
182
|
}
|
|
362
183
|
}
|
|
363
|
-
class
|
|
364
|
-
constructor(
|
|
365
|
-
super();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
(g = this.config.logger) == null || g.debug("Connecting to WebSocket with sessionId:", n);
|
|
389
|
-
const o = encodeURIComponent(this.config.apiKey), c = this.config.agentId, d = `${this.config.webSocketUrl}?sessionCode=${n}&agentId=${c}&apiKey=${o}`;
|
|
390
|
-
return this.setStatus("connecting"), this.webSocket = new WebSocket(d), this.webSocket.addEventListener("open", () => {
|
|
391
|
-
this.setStatus("connected");
|
|
392
|
-
}), this.webSocket.addEventListener("message", (h) => {
|
|
393
|
-
const f = JSON.parse(h.data);
|
|
394
|
-
if (f.type !== "message")
|
|
395
|
-
return;
|
|
396
|
-
const w = f.payload;
|
|
397
|
-
this.notifyMessage(w != null && w.thought ? { role: "assistant", type: "reasoning", text: w.thought } : w);
|
|
398
|
-
}), this.webSocket.addEventListener("close", () => {
|
|
399
|
-
var h;
|
|
400
|
-
this.setStatus("disconnected"), this.webSocket = null, (h = this.config.logger) == null || h.warn("WebSocket connection closed");
|
|
401
|
-
}), this.webSocket.addEventListener("error", (h) => {
|
|
402
|
-
var f;
|
|
403
|
-
this.setStatus("disconnected"), this.webSocket = null, (f = this.config.logger) == null || f.error("WebSocket error", h);
|
|
404
|
-
}), Promise.resolve(n);
|
|
405
|
-
}
|
|
406
|
-
disconnect() {
|
|
407
|
-
var e;
|
|
408
|
-
return (e = this.config.logger) == null || e.debug("Disconnecting WebSocket"), this.webSocket && this.status === "connected" && (this.webSocket.close(), this.setStatus("disconnected"), this.webSocket = null), Promise.resolve();
|
|
409
|
-
}
|
|
410
|
-
send(e) {
|
|
411
|
-
return this.webSocket && this.status === "connected" ? (this.webSocket.send(JSON.stringify({ type: "request", payload: e })), Promise.resolve()) : Promise.reject(new Error("WebSocket is not connected"));
|
|
184
|
+
class m extends a {
|
|
185
|
+
constructor(t, s) {
|
|
186
|
+
super(t, s);
|
|
187
|
+
}
|
|
188
|
+
async list(t, s, e) {
|
|
189
|
+
const r = { page: s, size: e };
|
|
190
|
+
return t && (r.keyword = t), this.httpGet("/knowledge-bases", r);
|
|
191
|
+
}
|
|
192
|
+
async get(t) {
|
|
193
|
+
return this.httpGet("/knowledge-bases/" + t);
|
|
194
|
+
}
|
|
195
|
+
async create(t) {
|
|
196
|
+
return this.httpPost("/knowledge-bases", t);
|
|
197
|
+
}
|
|
198
|
+
async update(t) {
|
|
199
|
+
return this.httpPut("/knowledge-bases/" + t.id, t);
|
|
200
|
+
}
|
|
201
|
+
async remove(t) {
|
|
202
|
+
await this.httpDelete("/knowledge-bases/" + t);
|
|
203
|
+
}
|
|
204
|
+
documents(t) {
|
|
205
|
+
return new w(this.getBaseUrl(), this.getAuthProvider(), t);
|
|
206
|
+
}
|
|
207
|
+
async searchChunks(t, s) {
|
|
208
|
+
return this.httpPost("/knowledge-bases/" + t + "/search", s);
|
|
412
209
|
}
|
|
413
210
|
}
|
|
414
|
-
class
|
|
415
|
-
constructor(t) {
|
|
416
|
-
|
|
417
|
-
i(this, "pc", null);
|
|
418
|
-
i(this, "ws", null);
|
|
419
|
-
i(this, "localStream", null);
|
|
420
|
-
i(this, "remoteStream", new MediaStream());
|
|
421
|
-
i(this, "audioCtx", null);
|
|
422
|
-
i(this, "localAnalyser", null);
|
|
423
|
-
i(this, "remoteAnalyser", null);
|
|
424
|
-
i(this, "analyzerFrame", null);
|
|
425
|
-
i(this, "dataChannel", null);
|
|
426
|
-
i(this, "isConnected", !1);
|
|
427
|
-
i(this, "visualizerCallbacks", []);
|
|
428
|
-
i(this, "messageCallbacks", []);
|
|
429
|
-
this.config = t;
|
|
430
|
-
}
|
|
431
|
-
async connect(t) {
|
|
432
|
-
var e;
|
|
433
|
-
if (!this.isConnected) {
|
|
434
|
-
this.isConnected = !0;
|
|
435
|
-
try {
|
|
436
|
-
this.localStream = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
437
|
-
} catch (n) {
|
|
438
|
-
(e = this.config.logger) == null || e.error("Error accessing microphone:", n);
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
this.pc = new RTCPeerConnection({
|
|
442
|
-
iceServers: this.config.iceServers || [
|
|
443
|
-
{
|
|
444
|
-
urls: "stun:34.38.108.251:3478"
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
urls: "turn:34.38.108.251:3478",
|
|
448
|
-
username: "webrtc",
|
|
449
|
-
credential: "webrtc"
|
|
450
|
-
}
|
|
451
|
-
]
|
|
452
|
-
}), this.localStream.getTracks().forEach((n) => {
|
|
453
|
-
this.pc.addTrack(n, this.localStream);
|
|
454
|
-
}), this.pc.ontrack = (n) => {
|
|
455
|
-
n.streams[0].getTracks().forEach((c) => {
|
|
456
|
-
this.remoteStream.addTrack(c);
|
|
457
|
-
}), this.audioCtx || this._startAnalyzers();
|
|
458
|
-
const o = new Audio();
|
|
459
|
-
o.srcObject = this.remoteStream, o.play().catch((c) => {
|
|
460
|
-
var d;
|
|
461
|
-
(d = this.config.logger) == null || d.error("Error playing remote audio:", c);
|
|
462
|
-
});
|
|
463
|
-
}, this.pc.onicecandidate = (n) => {
|
|
464
|
-
var o;
|
|
465
|
-
n.candidate && ((o = this.ws) == null ? void 0 : o.readyState) === WebSocket.OPEN && this.ws.send(
|
|
466
|
-
JSON.stringify({
|
|
467
|
-
type: "CANDIDATE",
|
|
468
|
-
src: "client",
|
|
469
|
-
payload: { candidate: n.candidate }
|
|
470
|
-
})
|
|
471
|
-
);
|
|
472
|
-
}, this.pc.ondatachannel = (n) => {
|
|
473
|
-
const o = n.channel;
|
|
474
|
-
o.onmessage = (c) => {
|
|
475
|
-
this.messageCallbacks.forEach((d) => {
|
|
476
|
-
d(c);
|
|
477
|
-
});
|
|
478
|
-
};
|
|
479
|
-
}, this.ws = new WebSocket(this.config.webrtcUrl || "wss://persona.applica.guru/api/webrtc"), this.ws.onopen = async () => {
|
|
480
|
-
var d, g;
|
|
481
|
-
const n = await this.pc.createOffer();
|
|
482
|
-
await this.pc.setLocalDescription(n);
|
|
483
|
-
const o = {
|
|
484
|
-
agentId: this.config.agentId,
|
|
485
|
-
sessionCode: t
|
|
486
|
-
};
|
|
487
|
-
(d = this.config.logger) == null || d.debug("Opening connection to WebRTC server: ", o);
|
|
488
|
-
const c = {
|
|
489
|
-
type: "OFFER",
|
|
490
|
-
src: ((g = crypto.randomUUID) == null ? void 0 : g.call(crypto)) || "client_" + Date.now(),
|
|
491
|
-
payload: {
|
|
492
|
-
sdp: {
|
|
493
|
-
sdp: n.sdp,
|
|
494
|
-
type: n.type
|
|
495
|
-
},
|
|
496
|
-
connectionId: (Date.now() % 1e6).toString(),
|
|
497
|
-
metadata: o
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
this.ws.send(JSON.stringify(c));
|
|
501
|
-
}, this.ws.onmessage = async (n) => {
|
|
502
|
-
var c;
|
|
503
|
-
const o = JSON.parse(n.data);
|
|
504
|
-
if (o.type === "ANSWER")
|
|
505
|
-
await this.pc.setRemoteDescription(new RTCSessionDescription(o.payload.sdp));
|
|
506
|
-
else if (o.type === "CANDIDATE")
|
|
507
|
-
try {
|
|
508
|
-
await this.pc.addIceCandidate(new RTCIceCandidate(o.payload.candidate));
|
|
509
|
-
} catch (d) {
|
|
510
|
-
(c = this.config.logger) == null || c.error("Error adding ICE candidate:", d);
|
|
511
|
-
}
|
|
512
|
-
}, this.ws.onclose = () => {
|
|
513
|
-
this._stopAnalyzers();
|
|
514
|
-
};
|
|
515
|
-
}
|
|
211
|
+
class b extends a {
|
|
212
|
+
constructor(t, s) {
|
|
213
|
+
super(t, s);
|
|
516
214
|
}
|
|
517
|
-
async
|
|
518
|
-
|
|
519
|
-
|
|
215
|
+
async list(t, s, e) {
|
|
216
|
+
const r = { page: s, size: e };
|
|
217
|
+
return this.httpGet("/workflows/" + t + "/executions", r);
|
|
520
218
|
}
|
|
521
|
-
|
|
522
|
-
this.
|
|
219
|
+
async get(t, s) {
|
|
220
|
+
return this.httpGet("/workflows/" + t + "/executions/" + s);
|
|
523
221
|
}
|
|
524
|
-
|
|
525
|
-
this.
|
|
222
|
+
async run(t, s) {
|
|
223
|
+
return this.httpPost("/workflows/" + t + "/executions", s);
|
|
526
224
|
}
|
|
527
|
-
|
|
528
|
-
this.
|
|
529
|
-
var e;
|
|
530
|
-
return (e = this.config.logger) == null ? void 0 : e.info("Data channel opened");
|
|
531
|
-
}, this.dataChannel.onmessage = (e) => {
|
|
532
|
-
this.messageCallbacks.forEach((n) => {
|
|
533
|
-
n(e);
|
|
534
|
-
});
|
|
535
|
-
});
|
|
225
|
+
async queue(t, s) {
|
|
226
|
+
return this.httpPost("/workflows/" + t + "/executions/queue", s);
|
|
536
227
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
228
|
+
}
|
|
229
|
+
class P extends a {
|
|
230
|
+
constructor(t, s) {
|
|
231
|
+
super(t, s);
|
|
232
|
+
}
|
|
233
|
+
async list(t, s, e) {
|
|
234
|
+
const r = { page: s, size: e };
|
|
235
|
+
return t && (r.keyword = t), this.httpGet("/workflows", r);
|
|
236
|
+
}
|
|
237
|
+
async create(t) {
|
|
238
|
+
return this.httpPost("/workflows", t);
|
|
239
|
+
}
|
|
240
|
+
async update(t, s) {
|
|
241
|
+
return s.id = t, this.httpPut("/workflows/" + t, s);
|
|
242
|
+
}
|
|
243
|
+
async remove(t) {
|
|
244
|
+
await this.httpDelete("/workflows/" + t);
|
|
245
|
+
}
|
|
246
|
+
async get(t) {
|
|
247
|
+
return this.httpGet("/workflows/" + t);
|
|
248
|
+
}
|
|
249
|
+
executions() {
|
|
250
|
+
return new b(this.getBaseUrl(), this.getAuthProvider());
|
|
251
|
+
}
|
|
252
|
+
async listRevisions(t) {
|
|
253
|
+
return this.httpGet("/workflows/" + t + "/revisions");
|
|
254
|
+
}
|
|
255
|
+
async getRevision(t, s) {
|
|
256
|
+
return this.httpGet("/workflows/" + t + "/revisions/" + s);
|
|
257
|
+
}
|
|
258
|
+
async rollback(t, s) {
|
|
259
|
+
return this.httpPost("/workflows/" + t + "/revisions/" + s + "/rollback", {});
|
|
568
260
|
}
|
|
569
261
|
}
|
|
570
|
-
class
|
|
571
|
-
constructor(
|
|
572
|
-
super();
|
|
573
|
-
i(this, "status");
|
|
574
|
-
i(this, "session");
|
|
575
|
-
i(this, "autostart");
|
|
576
|
-
i(this, "config");
|
|
577
|
-
i(this, "webRTCClient");
|
|
578
|
-
this.config = e, this.status = "disconnected", this.session = null, this.autostart = (e == null ? void 0 : e.autostart) ?? !1, this.webRTCClient = new Se(e), this.webRTCClient.addMessageCallback((n) => {
|
|
579
|
-
var c;
|
|
580
|
-
(c = e.logger) == null || c.debug("Received data message:", n.data);
|
|
581
|
-
const o = JSON.parse(n.data);
|
|
582
|
-
o.type === "message" && this.notifyMessage(o.payload);
|
|
583
|
-
});
|
|
262
|
+
class f extends a {
|
|
263
|
+
constructor(t, s) {
|
|
264
|
+
super(t, s);
|
|
584
265
|
}
|
|
585
|
-
|
|
586
|
-
return "
|
|
266
|
+
async authorize(t, s) {
|
|
267
|
+
return this.httpPost("/credentials/" + t + "/authorize", s);
|
|
587
268
|
}
|
|
588
|
-
|
|
589
|
-
|
|
269
|
+
async handleOAuth2Callback(t, s, e, r) {
|
|
270
|
+
const i = { code: s, state: e };
|
|
271
|
+
return r && (i.scope = r), this.httpGet("/credentials/" + t + "/oauth2/callback", i);
|
|
590
272
|
}
|
|
591
|
-
async
|
|
592
|
-
|
|
273
|
+
async list() {
|
|
274
|
+
return this.httpGet("/credentials");
|
|
593
275
|
}
|
|
594
|
-
async
|
|
595
|
-
|
|
596
|
-
return this.status === "connected" ? Promise.resolve(this.session) : (this.session = e || this.session || "new", this.setStatus("connecting"), (n = this.config.logger) == null || n.debug("Connecting to WebRTC with sessionId:", this.session), await this.webRTCClient.connect(this.session), this.setStatus("connected"), await this.webRTCClient.createDataChannel(), this.session);
|
|
276
|
+
async getByProvider(t) {
|
|
277
|
+
return this.httpGet("/credentials/" + t);
|
|
597
278
|
}
|
|
598
|
-
async
|
|
599
|
-
|
|
600
|
-
if (this.status === "disconnected")
|
|
601
|
-
return (e = this.config.logger) == null || e.warn("Already disconnected"), Promise.resolve();
|
|
602
|
-
await this.webRTCClient.disconnect(), this.setStatus("disconnected"), (o = (n = this.config) == null ? void 0 : n.logger) == null || o.debug("Disconnected from WebRTC");
|
|
279
|
+
async getById(t) {
|
|
280
|
+
return this.httpGet("/credentials/all/" + t);
|
|
603
281
|
}
|
|
604
|
-
|
|
605
|
-
|
|
282
|
+
async remove(t) {
|
|
283
|
+
await this.httpDelete("/credentials/all/" + t);
|
|
606
284
|
}
|
|
607
285
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return I === !0 ? new se({
|
|
635
|
-
webrtcUrl: `${S}://${u}/webrtc`,
|
|
636
|
-
apiKey: c.apiKey,
|
|
637
|
-
agentId: c.agentId,
|
|
638
|
-
logger: e
|
|
639
|
-
}) : new se(I);
|
|
640
|
-
case "websocket":
|
|
641
|
-
const A = t[b];
|
|
642
|
-
return A === !0 ? new te({
|
|
643
|
-
webSocketUrl: `${S}://${u}/websocket`,
|
|
644
|
-
apiKey: c.apiKey,
|
|
645
|
-
agentId: c.agentId,
|
|
646
|
-
logger: e
|
|
647
|
-
}) : new te(A);
|
|
648
|
-
default:
|
|
649
|
-
throw new Error(`Unknown protocol: ${b}`);
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
throw new Error("Invalid protocols configuration");
|
|
654
|
-
}, []);
|
|
655
|
-
fe(() => {
|
|
656
|
-
_.current || (_.current = !0, e == null || e.debug(
|
|
657
|
-
"Initializing protocols: ",
|
|
658
|
-
R.map((u) => u.getName())
|
|
659
|
-
), R.forEach((u) => {
|
|
660
|
-
u.setSession(w), u.clearListeners(), u.addStatusChangeListener((y) => {
|
|
661
|
-
e == null || e.debug(`${u.getName()} has notified new status: ${y}`), k.set(u.getName(), y), N(new Map(k));
|
|
662
|
-
}), u.addMessageListener((y) => {
|
|
663
|
-
f((S) => we([...S, { ...y, protocol: u.getName() }]));
|
|
664
|
-
}), u.autostart && u.status === "disconnected" && (e == null || e.debug(`Connecting to protocol: ${u.getName()}`), u.connect(w));
|
|
665
|
-
}));
|
|
666
|
-
}, [w, R, e, k]);
|
|
667
|
-
const $ = async (u) => {
|
|
668
|
-
var T;
|
|
669
|
-
if (((T = u.content[0]) == null ? void 0 : T.type) !== "text") throw new Error("Only text messages are supported");
|
|
670
|
-
const y = u.content[0].text;
|
|
671
|
-
f((b) => [...b, { role: "user", type: "text", text: y }]), g(!0);
|
|
672
|
-
const S = R.sort((b, P) => P.getPriority() - b.getPriority()).find((b) => b.status === "connected");
|
|
673
|
-
await (S == null ? void 0 : S.send(y)), g(!1);
|
|
674
|
-
}, M = Z(() => (g(!1), f([]), O("new"), Promise.resolve()), []), D = Z(() => Promise.resolve(), []), W = me({
|
|
675
|
-
isRunning: d,
|
|
676
|
-
messages: h,
|
|
677
|
-
convertMessage: ye,
|
|
678
|
-
onNew: $,
|
|
679
|
-
onCancel: M,
|
|
680
|
-
onReload: D
|
|
681
|
-
});
|
|
682
|
-
return /* @__PURE__ */ Y.jsx(q.Provider, { value: { protocols: R, protocolsStatus: k }, children: /* @__PURE__ */ Y.jsx(pe, { runtime: W, children: n }) });
|
|
286
|
+
class k extends a {
|
|
287
|
+
constructor(t, s) {
|
|
288
|
+
super(t, s);
|
|
289
|
+
}
|
|
290
|
+
async list(t, s, e) {
|
|
291
|
+
const r = { page: s, size: e };
|
|
292
|
+
return t && (r.keyword = t), this.httpGet("/features/templates", r);
|
|
293
|
+
}
|
|
294
|
+
async get(t) {
|
|
295
|
+
return this.httpGet("/features/templates/" + t);
|
|
296
|
+
}
|
|
297
|
+
async create(t) {
|
|
298
|
+
return this.httpPost("/features/templates", t);
|
|
299
|
+
}
|
|
300
|
+
async update(t, s) {
|
|
301
|
+
return this.httpPut("/features/templates/" + t, s);
|
|
302
|
+
}
|
|
303
|
+
async patch(t, s) {
|
|
304
|
+
return this.httpPatch("/features/templates/" + t, s);
|
|
305
|
+
}
|
|
306
|
+
async remove(t) {
|
|
307
|
+
await this.httpDelete("/features/templates/" + t);
|
|
308
|
+
}
|
|
309
|
+
async getMcpAvailableTools(t) {
|
|
310
|
+
return this.httpPost("/features/templates/mcp/available-tools", t);
|
|
311
|
+
}
|
|
683
312
|
}
|
|
684
|
-
|
|
685
|
-
|
|
313
|
+
class v {
|
|
314
|
+
constructor(t, s) {
|
|
315
|
+
o(this, "baseUrl");
|
|
316
|
+
o(this, "auth");
|
|
317
|
+
this.baseUrl = t, this.auth = s;
|
|
318
|
+
}
|
|
319
|
+
templates() {
|
|
320
|
+
return new k(this.baseUrl, this.auth);
|
|
321
|
+
}
|
|
686
322
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
323
|
+
class G extends a {
|
|
324
|
+
constructor(t, s) {
|
|
325
|
+
super(t, s);
|
|
326
|
+
}
|
|
327
|
+
async list(t, s, e) {
|
|
328
|
+
const r = { page: s, size: e };
|
|
329
|
+
return this.httpGet("/triggers/" + t + "/executions", r);
|
|
330
|
+
}
|
|
331
|
+
async execute(t, s) {
|
|
332
|
+
return this.httpPost("/triggers/" + t + "/executions", s);
|
|
333
|
+
}
|
|
334
|
+
async get(t) {
|
|
335
|
+
return this.httpGet("/triggers/executions/" + t);
|
|
336
|
+
}
|
|
337
|
+
async remove(t) {
|
|
338
|
+
await this.httpDelete("/triggers/executions/" + t);
|
|
339
|
+
}
|
|
692
340
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
341
|
+
class x extends a {
|
|
342
|
+
constructor(t, s) {
|
|
343
|
+
super(t, s);
|
|
344
|
+
}
|
|
345
|
+
async list(t, s, e) {
|
|
346
|
+
const r = { page: s, size: e };
|
|
347
|
+
return t && (r.keyword = t), this.httpGet("/triggers", r);
|
|
348
|
+
}
|
|
349
|
+
async create(t) {
|
|
350
|
+
return this.httpPost("/triggers", t);
|
|
351
|
+
}
|
|
352
|
+
async update(t, s) {
|
|
353
|
+
return this.httpPut("/triggers/" + t, s);
|
|
354
|
+
}
|
|
355
|
+
async remove(t) {
|
|
356
|
+
await this.httpDelete("/triggers/" + t);
|
|
357
|
+
}
|
|
358
|
+
async get(t) {
|
|
359
|
+
return this.httpGet("/triggers/" + t);
|
|
360
|
+
}
|
|
361
|
+
executions() {
|
|
362
|
+
return new G(this.getBaseUrl(), this.getAuthProvider());
|
|
363
|
+
}
|
|
713
364
|
}
|
|
714
|
-
|
|
715
|
-
|
|
365
|
+
class U extends a {
|
|
366
|
+
constructor(t, s) {
|
|
367
|
+
super(t, s);
|
|
368
|
+
}
|
|
369
|
+
async list(t, s, e) {
|
|
370
|
+
const r = { page: s, size: e };
|
|
371
|
+
return t && (r.keyword = t), this.httpGet("/service-prices", r);
|
|
372
|
+
}
|
|
373
|
+
async get(t) {
|
|
374
|
+
return this.httpGet("/service-prices/" + t);
|
|
375
|
+
}
|
|
376
|
+
async create(t) {
|
|
377
|
+
return this.httpPost("/service-prices", t);
|
|
378
|
+
}
|
|
379
|
+
async update(t, s) {
|
|
380
|
+
return this.httpPut("/service-prices/" + t, s);
|
|
381
|
+
}
|
|
382
|
+
async remove(t) {
|
|
383
|
+
await this.httpDelete("/service-prices/" + t);
|
|
384
|
+
}
|
|
716
385
|
}
|
|
717
|
-
class
|
|
718
|
-
constructor() {
|
|
719
|
-
|
|
386
|
+
class A extends a {
|
|
387
|
+
constructor(t, s) {
|
|
388
|
+
super(t, s);
|
|
720
389
|
}
|
|
721
|
-
|
|
722
|
-
|
|
390
|
+
async list(t, s, e, r, i, u) {
|
|
391
|
+
const h = { page: i, size: u };
|
|
392
|
+
return t && (h.keyword = t), s && (h.status = s), e && (h.agentId = e), r && (h.userId = r), this.httpGet("/sessions", h);
|
|
723
393
|
}
|
|
724
|
-
|
|
725
|
-
|
|
394
|
+
async get(t) {
|
|
395
|
+
return this.httpGet("/sessions/" + t);
|
|
726
396
|
}
|
|
727
|
-
|
|
728
|
-
|
|
397
|
+
async getUsage(t) {
|
|
398
|
+
return this.httpGet("/sessions/" + t + "/usage");
|
|
399
|
+
}
|
|
400
|
+
async generateMessage(t, s) {
|
|
401
|
+
return this.httpPost("/sessions/" + t + "/messages", s);
|
|
402
|
+
}
|
|
403
|
+
async findMessages(t, s, e) {
|
|
404
|
+
const r = {};
|
|
405
|
+
return s !== void 0 && (r.page = s), e !== void 0 && (r.size = e), this.httpGet("/sessions/" + t + "/messages", r);
|
|
406
|
+
}
|
|
407
|
+
async remove(t) {
|
|
408
|
+
await this.httpDelete("/sessions/" + t);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
class B extends a {
|
|
412
|
+
constructor(t, s) {
|
|
413
|
+
super(t, s);
|
|
414
|
+
}
|
|
415
|
+
async list(t, s, e, r) {
|
|
416
|
+
const i = { page: e, size: r };
|
|
417
|
+
return t && (i.projectId = t), s && (i.status = s), this.httpGet("/missions", i);
|
|
418
|
+
}
|
|
419
|
+
async get(t) {
|
|
420
|
+
return this.httpGet("/missions/" + t);
|
|
421
|
+
}
|
|
422
|
+
async create(t) {
|
|
423
|
+
return this.httpPost("/missions", t);
|
|
424
|
+
}
|
|
425
|
+
async update(t, s) {
|
|
426
|
+
return this.httpPut("/missions/" + t, s);
|
|
427
|
+
}
|
|
428
|
+
async remove(t) {
|
|
429
|
+
await this.httpDelete("/missions/" + t);
|
|
430
|
+
}
|
|
431
|
+
async generate(t) {
|
|
432
|
+
return this.httpPost("/missions/" + t + "/generate");
|
|
433
|
+
}
|
|
434
|
+
async execute(t) {
|
|
435
|
+
return this.httpPost("/missions/" + t + "/execute");
|
|
436
|
+
}
|
|
437
|
+
async retry(t) {
|
|
438
|
+
return this.httpPost("/missions/" + t + "/retry");
|
|
439
|
+
}
|
|
440
|
+
async replan(t) {
|
|
441
|
+
return this.httpPost("/missions/" + t + "/replan");
|
|
442
|
+
}
|
|
443
|
+
async sendInstruction(t, s) {
|
|
444
|
+
return this.httpPost("/missions/" + t + "/instructions", { instruction: s });
|
|
445
|
+
}
|
|
446
|
+
async stop(t) {
|
|
447
|
+
return this.httpPost("/missions/" + t + "/stop");
|
|
448
|
+
}
|
|
449
|
+
async resume(t) {
|
|
450
|
+
return this.httpPost("/missions/" + t + "/continue");
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
class S {
|
|
454
|
+
constructor(t, s) {
|
|
455
|
+
o(this, "baseUrl");
|
|
456
|
+
o(this, "workflowsBaseUrl");
|
|
457
|
+
this.baseUrl = t, this.workflowsBaseUrl = s;
|
|
458
|
+
}
|
|
459
|
+
projects(t) {
|
|
460
|
+
return new y(this.baseUrl, t);
|
|
461
|
+
}
|
|
462
|
+
agents(t) {
|
|
463
|
+
return new g(this.baseUrl, t);
|
|
464
|
+
}
|
|
465
|
+
knowledgeBases(t) {
|
|
466
|
+
return new m(this.baseUrl, t);
|
|
467
|
+
}
|
|
468
|
+
workflows(t) {
|
|
469
|
+
return new P(this.workflowsBaseUrl, t);
|
|
470
|
+
}
|
|
471
|
+
credentials(t) {
|
|
472
|
+
return new f(this.baseUrl, t);
|
|
473
|
+
}
|
|
474
|
+
features(t) {
|
|
475
|
+
return new v(this.baseUrl, t);
|
|
476
|
+
}
|
|
477
|
+
triggers(t) {
|
|
478
|
+
return new x(this.baseUrl, t);
|
|
479
|
+
}
|
|
480
|
+
servicePrices(t) {
|
|
481
|
+
return new U(this.baseUrl, t);
|
|
482
|
+
}
|
|
483
|
+
sessions(t) {
|
|
484
|
+
return new A(this.baseUrl, t);
|
|
485
|
+
}
|
|
486
|
+
missions(t) {
|
|
487
|
+
return new B(this.baseUrl, t);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
class j {
|
|
491
|
+
constructor(t) {
|
|
492
|
+
this.token = t;
|
|
729
493
|
}
|
|
730
|
-
|
|
731
|
-
|
|
494
|
+
applyHeaders(t) {
|
|
495
|
+
t.set("Authorization", `Bearer ${this.token}`);
|
|
732
496
|
}
|
|
733
|
-
|
|
734
|
-
|
|
497
|
+
getCredentials() {
|
|
498
|
+
return this.token;
|
|
735
499
|
}
|
|
736
500
|
}
|
|
737
501
|
export {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
502
|
+
g as AgentsApi,
|
|
503
|
+
c as ApiException,
|
|
504
|
+
d as ApiKeyAuthenticationProvider,
|
|
505
|
+
j as BearerTokenAuthenticationProvider,
|
|
506
|
+
f as CredentialsApi,
|
|
507
|
+
k as FeatureTemplatesApi,
|
|
508
|
+
v as FeaturesApi,
|
|
509
|
+
w as KnowledgeBaseDocumentsApi,
|
|
510
|
+
m as KnowledgeBasesApi,
|
|
511
|
+
B as MissionsApi,
|
|
512
|
+
S as PersonaSdk,
|
|
513
|
+
y as ProjectsApi,
|
|
514
|
+
U as ServicePricesApi,
|
|
515
|
+
A as SessionsApi,
|
|
516
|
+
G as TriggerExecutionsApi,
|
|
517
|
+
x as TriggersApi,
|
|
518
|
+
b as WorkflowExecutionsApi,
|
|
519
|
+
P as WorkflowsApi
|
|
747
520
|
};
|
|
748
521
|
//# sourceMappingURL=bundle.es.js.map
|