@applica-software-guru/persona-sdk 0.1.34 → 0.1.36
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/bundle.cjs.js +1 -1
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.es.js +266 -260
- package/dist/bundle.es.js.map +1 -1
- package/dist/index.d.ts +26 -0
- package/package.json +1 -1
- package/src/billing/billing-client.ts +21 -0
- package/src/billing/types.ts +25 -0
- package/src/index.ts +2 -0
package/dist/bundle.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var d = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var u = (o, t,
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
super(`API Error: ${
|
|
2
|
+
var y = (o, t, e) => t in o ? d(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var u = (o, t, e) => y(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
class l extends Error {
|
|
5
|
+
constructor(e, s) {
|
|
6
|
+
super(`API Error: ${e} - ${s}`);
|
|
7
7
|
u(this, "statusCode");
|
|
8
8
|
u(this, "body");
|
|
9
|
-
this.statusCode =
|
|
9
|
+
this.statusCode = e, this.body = s;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class m {
|
|
13
13
|
constructor(t) {
|
|
14
14
|
this.apiKey = t;
|
|
15
15
|
}
|
|
@@ -21,10 +21,10 @@ class y {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
class c {
|
|
24
|
-
constructor(t,
|
|
24
|
+
constructor(t, e) {
|
|
25
25
|
u(this, "baseUrl");
|
|
26
26
|
u(this, "authProvider");
|
|
27
|
-
this.baseUrl = t, this.authProvider = typeof
|
|
27
|
+
this.baseUrl = t, this.authProvider = typeof e == "string" ? new m(e) : e;
|
|
28
28
|
}
|
|
29
29
|
getBaseUrl() {
|
|
30
30
|
return this.baseUrl;
|
|
@@ -32,134 +32,134 @@ class c {
|
|
|
32
32
|
getAuthProvider() {
|
|
33
33
|
return this.authProvider;
|
|
34
34
|
}
|
|
35
|
-
normalizePageParams(t,
|
|
35
|
+
normalizePageParams(t, e) {
|
|
36
36
|
return {
|
|
37
37
|
page: t === void 0 || t < 1 ? 1 : t,
|
|
38
|
-
size:
|
|
38
|
+
size: e === void 0 || e < 1 ? 20 : e
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
buildHeaders() {
|
|
42
42
|
const t = new Headers();
|
|
43
43
|
return t.set("Content-Type", "application/json"), this.authProvider.applyHeaders(t), t;
|
|
44
44
|
}
|
|
45
|
-
buildUrl(t,
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
n != null &&
|
|
49
|
-
}),
|
|
45
|
+
buildUrl(t, e) {
|
|
46
|
+
const s = new URL(this.baseUrl + t);
|
|
47
|
+
return e && Object.entries(e).forEach(([r, n]) => {
|
|
48
|
+
n != null && s.searchParams.set(r, String(n));
|
|
49
|
+
}), s.toString();
|
|
50
50
|
}
|
|
51
51
|
async handleResponse(t) {
|
|
52
52
|
if (!t.ok) {
|
|
53
|
-
const
|
|
54
|
-
throw new
|
|
53
|
+
const s = await t.text();
|
|
54
|
+
throw new l(t.status, s);
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
return
|
|
56
|
+
const e = await t.text();
|
|
57
|
+
return e ? JSON.parse(e) : void 0;
|
|
58
58
|
}
|
|
59
|
-
async httpGet(t,
|
|
60
|
-
const
|
|
59
|
+
async httpGet(t, e) {
|
|
60
|
+
const s = await fetch(this.buildUrl(t, e), {
|
|
61
61
|
method: "GET",
|
|
62
62
|
headers: this.buildHeaders()
|
|
63
63
|
});
|
|
64
|
-
return this.handleResponse(
|
|
64
|
+
return this.handleResponse(s);
|
|
65
65
|
}
|
|
66
|
-
async httpPost(t,
|
|
67
|
-
const r = await fetch(this.buildUrl(t,
|
|
66
|
+
async httpPost(t, e, s) {
|
|
67
|
+
const r = await fetch(this.buildUrl(t, s), {
|
|
68
68
|
method: "POST",
|
|
69
69
|
headers: this.buildHeaders(),
|
|
70
|
-
body:
|
|
70
|
+
body: e ? JSON.stringify(e) : void 0
|
|
71
71
|
});
|
|
72
72
|
return this.handleResponse(r);
|
|
73
73
|
}
|
|
74
|
-
async httpPut(t,
|
|
75
|
-
const
|
|
74
|
+
async httpPut(t, e) {
|
|
75
|
+
const s = await fetch(this.baseUrl + t, {
|
|
76
76
|
method: "PUT",
|
|
77
77
|
headers: this.buildHeaders(),
|
|
78
|
-
body: JSON.stringify(
|
|
78
|
+
body: JSON.stringify(e)
|
|
79
79
|
});
|
|
80
|
-
return this.handleResponse(
|
|
80
|
+
return this.handleResponse(s);
|
|
81
81
|
}
|
|
82
|
-
async httpPatch(t,
|
|
83
|
-
const
|
|
82
|
+
async httpPatch(t, e) {
|
|
83
|
+
const s = await fetch(this.baseUrl + t, {
|
|
84
84
|
method: "PATCH",
|
|
85
85
|
headers: this.buildHeaders(),
|
|
86
|
-
body: JSON.stringify(
|
|
86
|
+
body: JSON.stringify(e)
|
|
87
87
|
});
|
|
88
|
-
return this.handleResponse(
|
|
88
|
+
return this.handleResponse(s);
|
|
89
89
|
}
|
|
90
90
|
async httpDelete(t) {
|
|
91
|
-
const
|
|
91
|
+
const e = await fetch(this.baseUrl + t, {
|
|
92
92
|
method: "DELETE",
|
|
93
93
|
headers: this.buildHeaders()
|
|
94
94
|
});
|
|
95
|
-
if (!
|
|
96
|
-
const
|
|
97
|
-
throw new
|
|
95
|
+
if (!e.ok) {
|
|
96
|
+
const s = await e.text();
|
|
97
|
+
throw new l(e.status, s);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
class
|
|
102
|
-
constructor(
|
|
103
|
-
super(
|
|
101
|
+
class w extends c {
|
|
102
|
+
constructor(e, s, r) {
|
|
103
|
+
super(e, s);
|
|
104
104
|
u(this, "billingBaseUrl");
|
|
105
|
-
this.billingBaseUrl = (r ||
|
|
105
|
+
this.billingBaseUrl = (r || e).replace(/\/$/, "");
|
|
106
106
|
}
|
|
107
|
-
async list(
|
|
108
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
109
|
-
return
|
|
107
|
+
async list(e, s, r) {
|
|
108
|
+
const { page: n, size: a } = this.normalizePageParams(s, r), i = { page: n, size: a };
|
|
109
|
+
return e && (i.keyword = e), this.httpGet("/projects", i);
|
|
110
110
|
}
|
|
111
|
-
async get(
|
|
112
|
-
return this.httpGet("/projects/" +
|
|
111
|
+
async get(e) {
|
|
112
|
+
return this.httpGet("/projects/" + e);
|
|
113
113
|
}
|
|
114
114
|
async getMine() {
|
|
115
115
|
return this.httpGet("/projects/mine");
|
|
116
116
|
}
|
|
117
|
-
async create(
|
|
118
|
-
return this.httpPost("/projects",
|
|
117
|
+
async create(e) {
|
|
118
|
+
return this.httpPost("/projects", e);
|
|
119
119
|
}
|
|
120
|
-
async update(
|
|
121
|
-
return this.httpPut("/projects/" +
|
|
120
|
+
async update(e) {
|
|
121
|
+
return this.httpPut("/projects/" + e.projectId, e);
|
|
122
122
|
}
|
|
123
|
-
async remove(
|
|
124
|
-
await this.httpDelete("/projects/" +
|
|
123
|
+
async remove(e) {
|
|
124
|
+
await this.httpDelete("/projects/" + e);
|
|
125
125
|
}
|
|
126
|
-
async duplicate(
|
|
127
|
-
return this.httpPost("/projects/" +
|
|
126
|
+
async duplicate(e, s) {
|
|
127
|
+
return this.httpPost("/projects/" + e + "/actions/duplicate", s);
|
|
128
128
|
}
|
|
129
|
-
async getSubscription(
|
|
130
|
-
return this.billingRequest("/projects/" +
|
|
129
|
+
async getSubscription(e) {
|
|
130
|
+
return this.billingRequest("/projects/" + e + "/subscription", "GET");
|
|
131
131
|
}
|
|
132
|
-
async changeSubscriptionPlan(
|
|
133
|
-
return this.billingRequest("/projects/" +
|
|
132
|
+
async changeSubscriptionPlan(e, s) {
|
|
133
|
+
return this.billingRequest("/projects/" + e + "/subscription/actions/change-plan", "POST", s);
|
|
134
134
|
}
|
|
135
|
-
async addSubscriptionCredits(
|
|
136
|
-
return this.billingRequest("/projects/" +
|
|
135
|
+
async addSubscriptionCredits(e, s) {
|
|
136
|
+
return this.billingRequest("/projects/" + e + "/subscription/actions/add-credits", "POST", s);
|
|
137
137
|
}
|
|
138
|
-
async setInfiniteCredits(
|
|
139
|
-
return this.billingRequest("/projects/" +
|
|
138
|
+
async setInfiniteCredits(e, s) {
|
|
139
|
+
return this.billingRequest("/projects/" + e + "/subscription/actions/set-infinite-credits", "POST", s);
|
|
140
140
|
}
|
|
141
|
-
async billingRequest(
|
|
141
|
+
async billingRequest(e, s, r) {
|
|
142
142
|
const n = new Headers();
|
|
143
143
|
n.set("Content-Type", "application/json"), this.getAuthProvider().applyHeaders(n);
|
|
144
|
-
const a = await fetch(this.billingBaseUrl +
|
|
145
|
-
method:
|
|
144
|
+
const a = await fetch(this.billingBaseUrl + e, {
|
|
145
|
+
method: s,
|
|
146
146
|
headers: n,
|
|
147
147
|
body: r ? JSON.stringify(r) : void 0
|
|
148
148
|
});
|
|
149
149
|
if (!a.ok) {
|
|
150
|
-
const
|
|
151
|
-
throw new
|
|
150
|
+
const h = await a.text();
|
|
151
|
+
throw new l(a.status, h);
|
|
152
152
|
}
|
|
153
153
|
const i = await a.text();
|
|
154
154
|
return i ? JSON.parse(i) : void 0;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
class
|
|
158
|
-
constructor(t,
|
|
159
|
-
super(t,
|
|
157
|
+
class P extends c {
|
|
158
|
+
constructor(t, e) {
|
|
159
|
+
super(t, e);
|
|
160
160
|
}
|
|
161
|
-
async list(t,
|
|
162
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
161
|
+
async list(t, e, s, r) {
|
|
162
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
163
163
|
return t && (i.keyword = t), this.httpGet("/agents", i);
|
|
164
164
|
}
|
|
165
165
|
async get(t) {
|
|
@@ -180,49 +180,49 @@ class w extends c {
|
|
|
180
180
|
async listRevisions(t) {
|
|
181
181
|
return this.httpGet("/agents/" + t + "/revisions");
|
|
182
182
|
}
|
|
183
|
-
async getRevision(t,
|
|
184
|
-
return this.httpGet("/agents/" + t + "/revisions/" +
|
|
183
|
+
async getRevision(t, e) {
|
|
184
|
+
return this.httpGet("/agents/" + t + "/revisions/" + e);
|
|
185
185
|
}
|
|
186
|
-
async rollback(t,
|
|
187
|
-
return this.httpPost("/agents/" + t + "/revisions/" +
|
|
186
|
+
async rollback(t, e) {
|
|
187
|
+
return this.httpPost("/agents/" + t + "/revisions/" + e + "/rollback", {});
|
|
188
188
|
}
|
|
189
|
-
async generateSystemInstructions(t,
|
|
190
|
-
const
|
|
191
|
-
return
|
|
189
|
+
async generateSystemInstructions(t, e) {
|
|
190
|
+
const s = { prompt: t };
|
|
191
|
+
return e && (s.sessionId = e), (await this.httpPost("/agents/system-instructions", s)).instructions;
|
|
192
192
|
}
|
|
193
193
|
async getArchitect() {
|
|
194
194
|
return this.httpGet("/agents/architect");
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
class
|
|
198
|
-
constructor(
|
|
199
|
-
super(
|
|
197
|
+
class b extends c {
|
|
198
|
+
constructor(e, s, r) {
|
|
199
|
+
super(e, s);
|
|
200
200
|
u(this, "knowledgeBaseId");
|
|
201
201
|
this.knowledgeBaseId = r;
|
|
202
202
|
}
|
|
203
|
-
async list(
|
|
204
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
205
|
-
return
|
|
203
|
+
async list(e, s, r) {
|
|
204
|
+
const { page: n, size: a } = this.normalizePageParams(s, r), i = { page: n, size: a };
|
|
205
|
+
return e && (i.keyword = e), this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents", i);
|
|
206
206
|
}
|
|
207
|
-
async upload(
|
|
208
|
-
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents",
|
|
207
|
+
async upload(e) {
|
|
208
|
+
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", e);
|
|
209
209
|
}
|
|
210
|
-
async get(
|
|
211
|
-
return this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" +
|
|
210
|
+
async get(e) {
|
|
211
|
+
return this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + e);
|
|
212
212
|
}
|
|
213
|
-
async reprocess(
|
|
214
|
-
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", { document_id:
|
|
213
|
+
async reprocess(e) {
|
|
214
|
+
return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", { document_id: e });
|
|
215
215
|
}
|
|
216
|
-
async remove(
|
|
217
|
-
await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" +
|
|
216
|
+
async remove(e) {
|
|
217
|
+
await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + e);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
class
|
|
221
|
-
constructor(t,
|
|
222
|
-
super(t,
|
|
220
|
+
class v extends c {
|
|
221
|
+
constructor(t, e) {
|
|
222
|
+
super(t, e);
|
|
223
223
|
}
|
|
224
|
-
async list(t,
|
|
225
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
224
|
+
async list(t, e, s, r) {
|
|
225
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
226
226
|
return t && (i.keyword = t), this.httpGet("/knowledge-bases", i);
|
|
227
227
|
}
|
|
228
228
|
async get(t) {
|
|
@@ -238,43 +238,43 @@ class b extends c {
|
|
|
238
238
|
await this.httpDelete("/knowledge-bases/" + t);
|
|
239
239
|
}
|
|
240
240
|
documents(t) {
|
|
241
|
-
return new
|
|
241
|
+
return new b(this.getBaseUrl(), this.getAuthProvider(), t);
|
|
242
242
|
}
|
|
243
|
-
async searchChunks(t,
|
|
244
|
-
return this.httpPost("/knowledge-bases/" + t + "/search",
|
|
243
|
+
async searchChunks(t, e) {
|
|
244
|
+
return this.httpPost("/knowledge-bases/" + t + "/search", e);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
class
|
|
248
|
-
constructor(t,
|
|
249
|
-
super(t,
|
|
247
|
+
class f extends c {
|
|
248
|
+
constructor(t, e) {
|
|
249
|
+
super(t, e);
|
|
250
250
|
}
|
|
251
|
-
async list(t,
|
|
252
|
-
const { page: r, size: n } = this.normalizePageParams(
|
|
251
|
+
async list(t, e, s) {
|
|
252
|
+
const { page: r, size: n } = this.normalizePageParams(e, s), a = { page: r, size: n };
|
|
253
253
|
return this.httpGet("/workflows/" + t + "/executions", a);
|
|
254
254
|
}
|
|
255
|
-
async get(t,
|
|
256
|
-
return this.httpGet("/workflows/" + t + "/executions/" +
|
|
255
|
+
async get(t, e) {
|
|
256
|
+
return this.httpGet("/workflows/" + t + "/executions/" + e);
|
|
257
257
|
}
|
|
258
|
-
async run(t,
|
|
259
|
-
return this.httpPost("/workflows/" + t + "/executions",
|
|
258
|
+
async run(t, e) {
|
|
259
|
+
return this.httpPost("/workflows/" + t + "/executions", e);
|
|
260
260
|
}
|
|
261
|
-
async queue(t,
|
|
262
|
-
return this.httpPost("/workflows/" + t + "/executions/queue",
|
|
261
|
+
async queue(t, e) {
|
|
262
|
+
return this.httpPost("/workflows/" + t + "/executions/queue", e);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
class
|
|
266
|
-
constructor(t,
|
|
267
|
-
super(t,
|
|
265
|
+
class G extends c {
|
|
266
|
+
constructor(t, e) {
|
|
267
|
+
super(t, e);
|
|
268
268
|
}
|
|
269
|
-
async list(t,
|
|
270
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
269
|
+
async list(t, e, s, r) {
|
|
270
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
271
271
|
return t && (i.keyword = t), this.httpGet("/workflows", i);
|
|
272
272
|
}
|
|
273
273
|
async create(t) {
|
|
274
274
|
return this.httpPost("/workflows", t);
|
|
275
275
|
}
|
|
276
|
-
async update(t,
|
|
277
|
-
return
|
|
276
|
+
async update(t, e) {
|
|
277
|
+
return e.id = t, this.httpPut("/workflows/" + t, e);
|
|
278
278
|
}
|
|
279
279
|
async remove(t) {
|
|
280
280
|
await this.httpDelete("/workflows/" + t);
|
|
@@ -283,27 +283,27 @@ class f extends c {
|
|
|
283
283
|
return this.httpGet("/workflows/" + t);
|
|
284
284
|
}
|
|
285
285
|
executions() {
|
|
286
|
-
return new
|
|
286
|
+
return new f(this.getBaseUrl(), this.getAuthProvider());
|
|
287
287
|
}
|
|
288
288
|
async listRevisions(t) {
|
|
289
289
|
return this.httpGet("/workflows/" + t + "/revisions");
|
|
290
290
|
}
|
|
291
|
-
async getRevision(t,
|
|
292
|
-
return this.httpGet("/workflows/" + t + "/revisions/" +
|
|
291
|
+
async getRevision(t, e) {
|
|
292
|
+
return this.httpGet("/workflows/" + t + "/revisions/" + e);
|
|
293
293
|
}
|
|
294
|
-
async rollback(t,
|
|
295
|
-
return this.httpPost("/workflows/" + t + "/revisions/" +
|
|
294
|
+
async rollback(t, e) {
|
|
295
|
+
return this.httpPost("/workflows/" + t + "/revisions/" + e + "/rollback", {});
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
class
|
|
299
|
-
constructor(t,
|
|
300
|
-
super(t,
|
|
298
|
+
class k extends c {
|
|
299
|
+
constructor(t, e) {
|
|
300
|
+
super(t, e);
|
|
301
301
|
}
|
|
302
|
-
async authorize(t,
|
|
303
|
-
return this.httpPost("/credentials/" + t + "/authorize",
|
|
302
|
+
async authorize(t, e) {
|
|
303
|
+
return this.httpPost("/credentials/" + t + "/authorize", e);
|
|
304
304
|
}
|
|
305
|
-
async handleOAuth2Callback(t,
|
|
306
|
-
const n = { code:
|
|
305
|
+
async handleOAuth2Callback(t, e, s, r) {
|
|
306
|
+
const n = { code: e, state: s };
|
|
307
307
|
return r && (n.scope = r), this.httpGet("/credentials/" + t + "/oauth2/callback", n);
|
|
308
308
|
}
|
|
309
309
|
async list() {
|
|
@@ -319,12 +319,12 @@ class G extends c {
|
|
|
319
319
|
await this.httpDelete("/credentials/all/" + t);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
class
|
|
323
|
-
constructor(t,
|
|
324
|
-
super(t,
|
|
322
|
+
class U extends c {
|
|
323
|
+
constructor(t, e) {
|
|
324
|
+
super(t, e);
|
|
325
325
|
}
|
|
326
|
-
async list(t,
|
|
327
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
326
|
+
async list(t, e, s, r) {
|
|
327
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
328
328
|
return t && (i.keyword = t), this.httpGet("/features/templates", i);
|
|
329
329
|
}
|
|
330
330
|
async get(t) {
|
|
@@ -333,40 +333,40 @@ class k extends c {
|
|
|
333
333
|
async create(t) {
|
|
334
334
|
return this.httpPost("/features/templates", t);
|
|
335
335
|
}
|
|
336
|
-
async update(t,
|
|
337
|
-
return this.httpPut("/features/templates/" + t,
|
|
336
|
+
async update(t, e) {
|
|
337
|
+
return this.httpPut("/features/templates/" + t, e);
|
|
338
338
|
}
|
|
339
|
-
async patch(t,
|
|
340
|
-
return this.httpPatch("/features/templates/" + t,
|
|
339
|
+
async patch(t, e) {
|
|
340
|
+
return this.httpPatch("/features/templates/" + t, e);
|
|
341
341
|
}
|
|
342
342
|
async remove(t) {
|
|
343
343
|
await this.httpDelete("/features/templates/" + t);
|
|
344
344
|
}
|
|
345
|
-
async getMcpAvailableTools(t,
|
|
346
|
-
const
|
|
347
|
-
return this.httpPost("/features/templates/mcp/available-tools", t,
|
|
345
|
+
async getMcpAvailableTools(t, e) {
|
|
346
|
+
const s = e ? { credentialsId: e } : void 0;
|
|
347
|
+
return this.httpPost("/features/templates/mcp/available-tools", t, s);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
class z {
|
|
351
|
-
constructor(t,
|
|
351
|
+
constructor(t, e) {
|
|
352
352
|
u(this, "baseUrl");
|
|
353
353
|
u(this, "auth");
|
|
354
|
-
this.baseUrl = t, this.auth =
|
|
354
|
+
this.baseUrl = t, this.auth = e;
|
|
355
355
|
}
|
|
356
356
|
templates() {
|
|
357
|
-
return new
|
|
357
|
+
return new U(this.baseUrl, this.auth);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
361
|
-
constructor(t,
|
|
362
|
-
super(t,
|
|
360
|
+
class x extends c {
|
|
361
|
+
constructor(t, e) {
|
|
362
|
+
super(t, e);
|
|
363
363
|
}
|
|
364
|
-
async list(t,
|
|
365
|
-
const { page: r, size: n } = this.normalizePageParams(
|
|
364
|
+
async list(t, e, s) {
|
|
365
|
+
const { page: r, size: n } = this.normalizePageParams(e, s), a = { page: r, size: n };
|
|
366
366
|
return this.httpGet("/triggers/" + t + "/executions", a);
|
|
367
367
|
}
|
|
368
|
-
async execute(t,
|
|
369
|
-
return this.httpPost("/triggers/" + t + "/executions",
|
|
368
|
+
async execute(t, e) {
|
|
369
|
+
return this.httpPost("/triggers/" + t + "/executions", e);
|
|
370
370
|
}
|
|
371
371
|
async get(t) {
|
|
372
372
|
return this.httpGet("/triggers/executions/" + t);
|
|
@@ -375,19 +375,19 @@ class U extends c {
|
|
|
375
375
|
await this.httpDelete("/triggers/executions/" + t);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
class
|
|
379
|
-
constructor(t,
|
|
380
|
-
super(t,
|
|
378
|
+
class S extends c {
|
|
379
|
+
constructor(t, e) {
|
|
380
|
+
super(t, e);
|
|
381
381
|
}
|
|
382
|
-
async list(t,
|
|
383
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
382
|
+
async list(t, e, s, r) {
|
|
383
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
384
384
|
return t && (i.keyword = t), this.httpGet("/triggers", i);
|
|
385
385
|
}
|
|
386
386
|
async create(t) {
|
|
387
387
|
return this.httpPost("/triggers", t);
|
|
388
388
|
}
|
|
389
|
-
async update(t,
|
|
390
|
-
return this.httpPut("/triggers/" + t,
|
|
389
|
+
async update(t, e) {
|
|
390
|
+
return this.httpPut("/triggers/" + t, e);
|
|
391
391
|
}
|
|
392
392
|
async remove(t) {
|
|
393
393
|
await this.httpDelete("/triggers/" + t);
|
|
@@ -396,15 +396,15 @@ class x extends c {
|
|
|
396
396
|
return this.httpGet("/triggers/" + t);
|
|
397
397
|
}
|
|
398
398
|
executions() {
|
|
399
|
-
return new
|
|
399
|
+
return new x(this.getBaseUrl(), this.getAuthProvider());
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
class
|
|
403
|
-
constructor(t,
|
|
404
|
-
super(t,
|
|
402
|
+
class T extends c {
|
|
403
|
+
constructor(t, e) {
|
|
404
|
+
super(t, e);
|
|
405
405
|
}
|
|
406
|
-
async list(t,
|
|
407
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
406
|
+
async list(t, e, s, r) {
|
|
407
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
408
408
|
return t && (i.keyword = t), this.httpGet("/service-prices", i);
|
|
409
409
|
}
|
|
410
410
|
async get(t) {
|
|
@@ -413,19 +413,19 @@ class S extends c {
|
|
|
413
413
|
async create(t) {
|
|
414
414
|
return this.httpPost("/service-prices", t);
|
|
415
415
|
}
|
|
416
|
-
async update(t,
|
|
417
|
-
return this.httpPut("/service-prices/" + t,
|
|
416
|
+
async update(t, e) {
|
|
417
|
+
return this.httpPut("/service-prices/" + t, e);
|
|
418
418
|
}
|
|
419
419
|
async remove(t) {
|
|
420
420
|
await this.httpDelete("/service-prices/" + t);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
class
|
|
424
|
-
constructor(t,
|
|
425
|
-
super(t,
|
|
423
|
+
class C extends c {
|
|
424
|
+
constructor(t, e) {
|
|
425
|
+
super(t, e);
|
|
426
426
|
}
|
|
427
|
-
async list(t,
|
|
428
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
427
|
+
async list(t, e, s, r) {
|
|
428
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
|
|
429
429
|
return t && (i.keyword = t), this.httpGet("/known-models", i);
|
|
430
430
|
}
|
|
431
431
|
async get(t) {
|
|
@@ -434,20 +434,20 @@ class T extends c {
|
|
|
434
434
|
async create(t) {
|
|
435
435
|
return this.httpPost("/known-models", t);
|
|
436
436
|
}
|
|
437
|
-
async update(t,
|
|
438
|
-
return this.httpPut("/known-models/" + t,
|
|
437
|
+
async update(t, e) {
|
|
438
|
+
return this.httpPut("/known-models/" + t, e);
|
|
439
439
|
}
|
|
440
440
|
async remove(t) {
|
|
441
441
|
await this.httpDelete("/known-models/" + t);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
class A extends c {
|
|
445
|
-
constructor(t,
|
|
446
|
-
super(t,
|
|
445
|
+
constructor(t, e) {
|
|
446
|
+
super(t, e);
|
|
447
447
|
}
|
|
448
|
-
async list(t,
|
|
449
|
-
const { page: i, size:
|
|
450
|
-
return t && (
|
|
448
|
+
async list(t, e, s, r, n, a) {
|
|
449
|
+
const { page: i, size: h } = this.normalizePageParams(n, a), p = { page: i, size: h };
|
|
450
|
+
return t && (p.keyword = t), e && (p.status = e), s && (p.agentId = s), r && (p.userId = r), this.httpGet("/sessions", p);
|
|
451
451
|
}
|
|
452
452
|
async get(t) {
|
|
453
453
|
return this.httpGet("/sessions/" + t);
|
|
@@ -455,18 +455,18 @@ class A extends c {
|
|
|
455
455
|
async getUsage(t) {
|
|
456
456
|
return this.httpGet("/sessions/" + t + "/usage");
|
|
457
457
|
}
|
|
458
|
-
async generateMessage(t,
|
|
459
|
-
return this.httpPost("/sessions/" + t + "/messages",
|
|
458
|
+
async generateMessage(t, e) {
|
|
459
|
+
return this.httpPost("/sessions/" + t + "/messages", e);
|
|
460
460
|
}
|
|
461
|
-
async findMessages(t,
|
|
462
|
-
const { page: r, size: n } = this.normalizePageParams(
|
|
461
|
+
async findMessages(t, e, s) {
|
|
462
|
+
const { page: r, size: n } = this.normalizePageParams(e, s), a = { page: r, size: n };
|
|
463
463
|
return this.httpGet("/sessions/" + t + "/messages", a);
|
|
464
464
|
}
|
|
465
465
|
async remove(t) {
|
|
466
466
|
await this.httpDelete("/sessions/" + t);
|
|
467
467
|
}
|
|
468
|
-
async rename(t,
|
|
469
|
-
return this.httpPut("/sessions/" + t + "/name", { name:
|
|
468
|
+
async rename(t, e) {
|
|
469
|
+
return this.httpPut("/sessions/" + t + "/name", { name: e });
|
|
470
470
|
}
|
|
471
471
|
// ─── Agent Execution Lifecycle ────────────────────────────────
|
|
472
472
|
/**
|
|
@@ -487,19 +487,19 @@ class A extends c {
|
|
|
487
487
|
/**
|
|
488
488
|
* Steer a running agent execution by injecting an instruction.
|
|
489
489
|
*/
|
|
490
|
-
async steerExecution(t,
|
|
490
|
+
async steerExecution(t, e) {
|
|
491
491
|
return this.httpPost(
|
|
492
492
|
"/sessions/" + encodeURIComponent(t) + "/steer",
|
|
493
|
-
{ text:
|
|
493
|
+
{ text: e }
|
|
494
494
|
);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
class
|
|
498
|
-
constructor(t,
|
|
499
|
-
super(t,
|
|
497
|
+
class E extends c {
|
|
498
|
+
constructor(t, e) {
|
|
499
|
+
super(t, e);
|
|
500
500
|
}
|
|
501
|
-
async list(t,
|
|
502
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
501
|
+
async list(t, e, s, r) {
|
|
502
|
+
const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a };
|
|
503
503
|
return t && (i.keyword = t), r && (i.status = r), this.httpGet("/missions", i);
|
|
504
504
|
}
|
|
505
505
|
async get(t) {
|
|
@@ -508,8 +508,8 @@ class C extends c {
|
|
|
508
508
|
async create(t) {
|
|
509
509
|
return this.httpPost("/missions", t);
|
|
510
510
|
}
|
|
511
|
-
async update(t,
|
|
512
|
-
return this.httpPut("/missions/" + t,
|
|
511
|
+
async update(t, e) {
|
|
512
|
+
return this.httpPut("/missions/" + t, e);
|
|
513
513
|
}
|
|
514
514
|
async remove(t) {
|
|
515
515
|
await this.httpDelete("/missions/" + t);
|
|
@@ -526,8 +526,8 @@ class C extends c {
|
|
|
526
526
|
async replan(t) {
|
|
527
527
|
return this.httpPost("/missions/" + t + "/replan");
|
|
528
528
|
}
|
|
529
|
-
async sendInstruction(t,
|
|
530
|
-
return this.httpPost("/missions/" + t + "/instructions", { instruction:
|
|
529
|
+
async sendInstruction(t, e) {
|
|
530
|
+
return this.httpPost("/missions/" + t + "/instructions", { instruction: e });
|
|
531
531
|
}
|
|
532
532
|
async stop(t) {
|
|
533
533
|
return this.httpPost("/missions/" + t + "/stop");
|
|
@@ -536,25 +536,25 @@ class C extends c {
|
|
|
536
536
|
return this.httpPost("/missions/" + t + "/continue");
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
class
|
|
540
|
-
constructor(t,
|
|
539
|
+
class j {
|
|
540
|
+
constructor(t, e) {
|
|
541
541
|
u(this, "baseUrl");
|
|
542
542
|
u(this, "authProvider");
|
|
543
|
-
this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider =
|
|
543
|
+
this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider = e ?? null;
|
|
544
544
|
}
|
|
545
545
|
buildHeaders() {
|
|
546
546
|
const t = new Headers();
|
|
547
547
|
return t.set("Content-Type", "application/json"), this.authProvider && (typeof this.authProvider == "string" ? t.set("x-persona-apikey", this.authProvider) : this.authProvider.applyHeaders(t)), t;
|
|
548
548
|
}
|
|
549
|
-
async request(t,
|
|
549
|
+
async request(t, e, s) {
|
|
550
550
|
const r = await fetch(this.baseUrl + t, {
|
|
551
|
-
method:
|
|
551
|
+
method: e,
|
|
552
552
|
headers: this.buildHeaders(),
|
|
553
|
-
body:
|
|
553
|
+
body: s ? JSON.stringify(s) : void 0
|
|
554
554
|
});
|
|
555
555
|
if (!r.ok) {
|
|
556
556
|
const a = await r.text();
|
|
557
|
-
throw new
|
|
557
|
+
throw new l(r.status, a);
|
|
558
558
|
}
|
|
559
559
|
const n = await r.text();
|
|
560
560
|
return n ? JSON.parse(n) : void 0;
|
|
@@ -562,8 +562,8 @@ class B {
|
|
|
562
562
|
async createCustomer(t) {
|
|
563
563
|
return this.request("/customers", "POST", t);
|
|
564
564
|
}
|
|
565
|
-
async updateCustomer(t,
|
|
566
|
-
return this.request("/customers/" + t, "PUT",
|
|
565
|
+
async updateCustomer(t, e) {
|
|
566
|
+
return this.request("/customers/" + t, "PUT", e);
|
|
567
567
|
}
|
|
568
568
|
async getCustomer(t) {
|
|
569
569
|
return this.request("/customers/" + t, "GET");
|
|
@@ -583,26 +583,26 @@ class B {
|
|
|
583
583
|
async getProjectSubscription(t) {
|
|
584
584
|
return this.request("/projects/" + t + "/subscription", "GET");
|
|
585
585
|
}
|
|
586
|
-
async changeProjectSubscriptionPlan(t,
|
|
587
|
-
return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST",
|
|
586
|
+
async changeProjectSubscriptionPlan(t, e) {
|
|
587
|
+
return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST", e);
|
|
588
588
|
}
|
|
589
|
-
async addProjectSubscriptionCredits(t,
|
|
590
|
-
return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST",
|
|
589
|
+
async addProjectSubscriptionCredits(t, e) {
|
|
590
|
+
return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST", e);
|
|
591
591
|
}
|
|
592
|
-
async beginUpgrade(t,
|
|
593
|
-
return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST",
|
|
592
|
+
async beginUpgrade(t, e) {
|
|
593
|
+
return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST", e);
|
|
594
594
|
}
|
|
595
|
-
async downgrade(t,
|
|
596
|
-
return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST",
|
|
595
|
+
async downgrade(t, e) {
|
|
596
|
+
return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST", e);
|
|
597
597
|
}
|
|
598
|
-
async mentorize(t,
|
|
599
|
-
return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST",
|
|
598
|
+
async mentorize(t, e) {
|
|
599
|
+
return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST", e);
|
|
600
600
|
}
|
|
601
|
-
async addCredits(t,
|
|
602
|
-
return this.request("/customers/" + t + "/subscription/credits", "POST", { credits:
|
|
601
|
+
async addCredits(t, e) {
|
|
602
|
+
return this.request("/customers/" + t + "/subscription/credits", "POST", { credits: e });
|
|
603
603
|
}
|
|
604
|
-
async useCredits(t,
|
|
605
|
-
const i = { credits:
|
|
604
|
+
async useCredits(t, e, s, r, n, a) {
|
|
605
|
+
const i = { credits: e, services: s };
|
|
606
606
|
return r && (i.referenceId = r), n !== void 0 && (i.totalCost = n), a !== void 0 && (i.totalPrice = a), this.request("/customers/" + t + "/subscription/credits", "DELETE", i);
|
|
607
607
|
}
|
|
608
608
|
async getCredits(t) {
|
|
@@ -619,25 +619,31 @@ class B {
|
|
|
619
619
|
return !1;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
async listInvoices(t,
|
|
622
|
+
async listInvoices(t, e, s) {
|
|
623
623
|
const r = [];
|
|
624
|
-
|
|
624
|
+
e && r.push("date_from=" + e), s && r.push("date_to=" + s);
|
|
625
625
|
const n = r.length > 0 ? "?" + r.join("&") : "";
|
|
626
626
|
return this.request("/customers/" + t + "/invoices" + n, "GET");
|
|
627
627
|
}
|
|
628
628
|
async cancelSubscription(t) {
|
|
629
629
|
return this.request("/customers/" + t + "/subscription/actions/cancel", "POST", {});
|
|
630
630
|
}
|
|
631
|
-
async getUsageStats(t,
|
|
631
|
+
async getUsageStats(t, e, s, r) {
|
|
632
632
|
const n = [];
|
|
633
|
-
|
|
633
|
+
e && n.push("date_from=" + encodeURIComponent(e)), s && n.push("date_to=" + encodeURIComponent(s)), r != null && r.length && r.forEach((i) => n.push("model=" + encodeURIComponent(i)));
|
|
634
634
|
const a = n.length > 0 ? "?" + n.join("&") : "";
|
|
635
635
|
return this.request("/projects/" + t + "/subscription/usage-stats" + a, "GET");
|
|
636
636
|
}
|
|
637
|
+
async listUsages(t, e, s, r, n, a, i) {
|
|
638
|
+
const h = [];
|
|
639
|
+
e && h.push("date_from=" + encodeURIComponent(e)), s && h.push("date_to=" + encodeURIComponent(s)), r != null && r.length && r.forEach((g) => h.push("model=" + encodeURIComponent(g))), n && h.push("session_id=" + encodeURIComponent(n)), a !== void 0 && h.push("page=" + encodeURIComponent(String(a))), i !== void 0 && h.push("size=" + encodeURIComponent(String(i)));
|
|
640
|
+
const p = h.length > 0 ? "?" + h.join("&") : "";
|
|
641
|
+
return this.request("/projects/" + t + "/subscription/usages" + p, "GET");
|
|
642
|
+
}
|
|
637
643
|
}
|
|
638
|
-
class
|
|
639
|
-
constructor(t,
|
|
640
|
-
super(t,
|
|
644
|
+
class q extends c {
|
|
645
|
+
constructor(t, e) {
|
|
646
|
+
super(t, e);
|
|
641
647
|
}
|
|
642
648
|
async get(t) {
|
|
643
649
|
return this.httpGet("/values/" + t);
|
|
@@ -697,51 +703,51 @@ class E extends c {
|
|
|
697
703
|
return this.httpGet("/values/trigger-destination-types");
|
|
698
704
|
}
|
|
699
705
|
}
|
|
700
|
-
class
|
|
701
|
-
constructor(t,
|
|
706
|
+
class R {
|
|
707
|
+
constructor(t, e, s) {
|
|
702
708
|
u(this, "baseUrl");
|
|
703
709
|
u(this, "workflowsBaseUrl");
|
|
704
710
|
u(this, "billingBaseUrl");
|
|
705
|
-
this.baseUrl = t, this.workflowsBaseUrl =
|
|
711
|
+
this.baseUrl = t, this.workflowsBaseUrl = e, this.billingBaseUrl = s || "https://persona.applica.guru/billing";
|
|
706
712
|
}
|
|
707
713
|
projects(t) {
|
|
708
|
-
return new
|
|
714
|
+
return new w(this.baseUrl, t, this.billingBaseUrl);
|
|
709
715
|
}
|
|
710
716
|
agents(t) {
|
|
711
|
-
return new
|
|
717
|
+
return new P(this.baseUrl, t);
|
|
712
718
|
}
|
|
713
719
|
knowledgeBases(t) {
|
|
714
|
-
return new
|
|
720
|
+
return new v(this.baseUrl, t);
|
|
715
721
|
}
|
|
716
722
|
workflows(t) {
|
|
717
|
-
return new
|
|
723
|
+
return new G(this.workflowsBaseUrl, t);
|
|
718
724
|
}
|
|
719
725
|
credentials(t) {
|
|
720
|
-
return new
|
|
726
|
+
return new k(this.baseUrl, t);
|
|
721
727
|
}
|
|
722
728
|
features(t) {
|
|
723
729
|
return new z(this.baseUrl, t);
|
|
724
730
|
}
|
|
725
731
|
triggers(t) {
|
|
726
|
-
return new
|
|
732
|
+
return new S(this.baseUrl, t);
|
|
727
733
|
}
|
|
728
734
|
servicePrices(t) {
|
|
729
|
-
return new
|
|
735
|
+
return new T(this.baseUrl, t);
|
|
730
736
|
}
|
|
731
737
|
knownModels(t) {
|
|
732
|
-
return new
|
|
738
|
+
return new C(this.baseUrl, t);
|
|
733
739
|
}
|
|
734
740
|
sessions(t) {
|
|
735
741
|
return new A(this.baseUrl, t);
|
|
736
742
|
}
|
|
737
743
|
missions(t) {
|
|
738
|
-
return new
|
|
744
|
+
return new E(this.baseUrl, t);
|
|
739
745
|
}
|
|
740
746
|
billing(t) {
|
|
741
|
-
return new
|
|
747
|
+
return new j(this.billingBaseUrl, t);
|
|
742
748
|
}
|
|
743
749
|
values(t) {
|
|
744
|
-
return new
|
|
750
|
+
return new q(this.baseUrl, t);
|
|
745
751
|
}
|
|
746
752
|
}
|
|
747
753
|
class O {
|
|
@@ -756,26 +762,26 @@ class O {
|
|
|
756
762
|
}
|
|
757
763
|
}
|
|
758
764
|
export {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
765
|
+
P as AgentsApi,
|
|
766
|
+
l as ApiException,
|
|
767
|
+
m as ApiKeyAuthenticationProvider,
|
|
762
768
|
O as BearerTokenAuthenticationProvider,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
769
|
+
j as BillingClient,
|
|
770
|
+
k as CredentialsApi,
|
|
771
|
+
U as FeatureTemplatesApi,
|
|
766
772
|
z as FeaturesApi,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
773
|
+
b as KnowledgeBaseDocumentsApi,
|
|
774
|
+
v as KnowledgeBasesApi,
|
|
775
|
+
C as KnownModelsApi,
|
|
776
|
+
E as MissionsApi,
|
|
777
|
+
R as PersonaSdk,
|
|
778
|
+
w as ProjectsApi,
|
|
779
|
+
T as ServicePricesApi,
|
|
774
780
|
A as SessionsApi,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
781
|
+
x as TriggerExecutionsApi,
|
|
782
|
+
S as TriggersApi,
|
|
783
|
+
q as ValuesApi,
|
|
784
|
+
f as WorkflowExecutionsApi,
|
|
785
|
+
G as WorkflowsApi
|
|
780
786
|
};
|
|
781
787
|
//# sourceMappingURL=bundle.es.js.map
|