@applica-software-guru/persona-sdk 0.1.113 → 0.1.114

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.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  var g = Object.defineProperty;
2
- var y = (o, t, s) => t in o ? g(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
3
- var u = (o, t, s) => y(o, typeof t != "symbol" ? t + "" : t, s);
2
+ var y = (o, t, e) => t in o ? g(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
4
  class l extends Error {
5
- constructor(s, e) {
6
- super(`API Error: ${s} - ${e}`);
5
+ constructor(e, s) {
6
+ super(`API Error: ${e} - ${s}`);
7
7
  u(this, "statusCode");
8
8
  u(this, "body");
9
- this.statusCode = s, this.body = e;
9
+ this.statusCode = e, this.body = s;
10
10
  }
11
11
  }
12
12
  class m {
@@ -21,10 +21,10 @@ class m {
21
21
  }
22
22
  }
23
23
  class c {
24
- constructor(t, s) {
24
+ constructor(t, e) {
25
25
  u(this, "baseUrl");
26
26
  u(this, "authProvider");
27
- this.baseUrl = t, this.authProvider = typeof s == "string" ? new m(s) : s;
27
+ this.baseUrl = t, this.authProvider = typeof e == "string" ? new m(e) : e;
28
28
  }
29
29
  getBaseUrl() {
30
30
  return this.baseUrl;
@@ -32,117 +32,117 @@ class c {
32
32
  getAuthProvider() {
33
33
  return this.authProvider;
34
34
  }
35
- normalizePageParams(t, s) {
35
+ normalizePageParams(t, e) {
36
36
  return {
37
37
  page: t === void 0 || t < 1 ? 1 : t,
38
- size: s === void 0 || s < 1 ? 20 : s
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, s) {
46
- const e = new URL(this.baseUrl + t);
47
- return s && Object.entries(s).forEach(([r, n]) => {
48
- n != null && e.searchParams.set(r, String(n));
49
- }), e.toString();
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 e = await t.text();
54
- throw new l(t.status, e);
53
+ const s = await t.text();
54
+ throw new l(t.status, s);
55
55
  }
56
- const s = await t.text();
57
- return s ? JSON.parse(s) : void 0;
56
+ const e = await t.text();
57
+ return e ? JSON.parse(e) : void 0;
58
58
  }
59
- async httpGet(t, s) {
60
- const e = await fetch(this.buildUrl(t, s), {
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(e);
64
+ return this.handleResponse(s);
65
65
  }
66
- async httpPost(t, s, e) {
67
- const r = await fetch(this.buildUrl(t, e), {
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: s ? JSON.stringify(s) : void 0
70
+ body: e ? JSON.stringify(e) : void 0
71
71
  });
72
72
  return this.handleResponse(r);
73
73
  }
74
- async httpPut(t, s) {
75
- const e = await fetch(this.baseUrl + t, {
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(s)
78
+ body: JSON.stringify(e)
79
79
  });
80
- return this.handleResponse(e);
80
+ return this.handleResponse(s);
81
81
  }
82
- async httpPatch(t, s) {
83
- const e = await fetch(this.baseUrl + t, {
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(s)
86
+ body: JSON.stringify(e)
87
87
  });
88
- return this.handleResponse(e);
88
+ return this.handleResponse(s);
89
89
  }
90
90
  async httpDelete(t) {
91
- const s = await fetch(this.baseUrl + t, {
91
+ const e = await fetch(this.baseUrl + t, {
92
92
  method: "DELETE",
93
93
  headers: this.buildHeaders()
94
94
  });
95
- if (!s.ok) {
96
- const e = await s.text();
97
- throw new l(s.status, e);
95
+ if (!e.ok) {
96
+ const s = await e.text();
97
+ throw new l(e.status, s);
98
98
  }
99
99
  }
100
100
  }
101
101
  class w extends c {
102
- constructor(s, e, r) {
103
- super(s, e);
102
+ constructor(e, s, r) {
103
+ super(e, s);
104
104
  u(this, "billingBaseUrl");
105
- this.billingBaseUrl = (r || s).replace(/\/$/, "");
105
+ this.billingBaseUrl = (r || e).replace(/\/$/, "");
106
106
  }
107
- async list(s, e, r) {
108
- const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
109
- return s && (i.keyword = s), this.httpGet("/projects", i);
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(s) {
112
- return this.httpGet("/projects/" + s);
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(s) {
118
- return this.httpPost("/projects", s);
117
+ async create(e) {
118
+ return this.httpPost("/projects", e);
119
119
  }
120
- async update(s) {
121
- return this.httpPut("/projects/" + s.projectId, s);
120
+ async update(e) {
121
+ return this.httpPut("/projects/" + e.projectId, e);
122
122
  }
123
- async remove(s) {
124
- await this.httpDelete("/projects/" + s);
123
+ async remove(e) {
124
+ await this.httpDelete("/projects/" + e);
125
125
  }
126
- async duplicate(s, e) {
127
- return this.httpPost("/projects/" + s + "/actions/duplicate", e);
126
+ async duplicate(e, s) {
127
+ return this.httpPost("/projects/" + e + "/actions/duplicate", s);
128
128
  }
129
- async getSubscription(s) {
130
- return this.billingRequest("/projects/" + s + "/subscription", "GET");
129
+ async getSubscription(e) {
130
+ return this.billingRequest("/projects/" + e + "/subscription", "GET");
131
131
  }
132
- async changeSubscriptionPlan(s, e) {
133
- return this.billingRequest("/projects/" + s + "/subscription/actions/change-plan", "POST", e);
132
+ async changeSubscriptionPlan(e, s) {
133
+ return this.billingRequest("/projects/" + e + "/subscription/actions/change-plan", "POST", s);
134
134
  }
135
- async addSubscriptionCredits(s, e) {
136
- return this.billingRequest("/projects/" + s + "/subscription/actions/add-credits", "POST", e);
135
+ async addSubscriptionCredits(e, s) {
136
+ return this.billingRequest("/projects/" + e + "/subscription/actions/add-credits", "POST", s);
137
137
  }
138
- async setInfiniteCredits(s, e) {
139
- return this.billingRequest("/projects/" + s + "/subscription/actions/set-infinite-credits", "POST", e);
138
+ async setInfiniteCredits(e, s) {
139
+ return this.billingRequest("/projects/" + e + "/subscription/actions/set-infinite-credits", "POST", s);
140
140
  }
141
- async billingRequest(s, e, r) {
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 + s, {
145
- method: e,
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
  });
@@ -155,11 +155,11 @@ class w extends c {
155
155
  }
156
156
  }
157
157
  class P extends c {
158
- constructor(t, s) {
159
- super(t, s);
158
+ constructor(t, e) {
159
+ super(t, e);
160
160
  }
161
- async list(t, s, e, r) {
162
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
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 P extends c {
180
180
  async listRevisions(t) {
181
181
  return this.httpGet("/agents/" + t + "/revisions");
182
182
  }
183
- async getRevision(t, s) {
184
- return this.httpGet("/agents/" + t + "/revisions/" + s);
183
+ async getRevision(t, e) {
184
+ return this.httpGet("/agents/" + t + "/revisions/" + e);
185
185
  }
186
- async rollback(t, s) {
187
- return this.httpPost("/agents/" + t + "/revisions/" + s + "/rollback", {});
186
+ async rollback(t, e) {
187
+ return this.httpPost("/agents/" + t + "/revisions/" + e + "/rollback", {});
188
188
  }
189
- async generateSystemInstructions(t, s) {
190
- const e = { prompt: t };
191
- return s && (e.sessionId = s), (await this.httpPost("/agents/system-instructions", e)).instructions;
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
197
  class b extends c {
198
- constructor(s, e, r) {
199
- super(s, e);
198
+ constructor(e, s, r) {
199
+ super(e, s);
200
200
  u(this, "knowledgeBaseId");
201
201
  this.knowledgeBaseId = r;
202
202
  }
203
- async list(s, e, r) {
204
- const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
205
- return s && (i.keyword = s), this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents", i);
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(s) {
208
- return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", s);
207
+ async upload(e) {
208
+ return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", e);
209
209
  }
210
- async get(s) {
211
- return this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + s);
210
+ async get(e) {
211
+ return this.httpGet("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + e);
212
212
  }
213
- async reprocess(s) {
214
- return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", { document_id: s });
213
+ async reprocess(e) {
214
+ return this.httpPost("/knowledge-bases/" + this.knowledgeBaseId + "/documents", { document_id: e });
215
215
  }
216
- async remove(s) {
217
- await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + s);
216
+ async remove(e) {
217
+ await this.httpDelete("/knowledge-bases/" + this.knowledgeBaseId + "/documents/" + e);
218
218
  }
219
219
  }
220
220
  class v extends c {
221
- constructor(t, s) {
222
- super(t, s);
221
+ constructor(t, e) {
222
+ super(t, e);
223
223
  }
224
- async list(t, s, e, r) {
225
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
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) {
@@ -240,92 +240,130 @@ class v extends c {
240
240
  documents(t) {
241
241
  return new b(this.getBaseUrl(), this.getAuthProvider(), t);
242
242
  }
243
- async searchChunks(t, s) {
244
- return this.httpPost("/knowledge-bases/" + t + "/search", s);
243
+ async searchChunks(t, e) {
244
+ return this.httpPost("/knowledge-bases/" + t + "/search", e);
245
245
  }
246
246
  }
247
247
  class f extends c {
248
- constructor(t, s) {
249
- super(t, s);
248
+ constructor(t, e) {
249
+ super(t, e);
250
250
  }
251
- async list(t, s, e) {
252
- const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
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, s) {
256
- return this.httpGet("/workflows/" + t + "/executions/" + s);
255
+ async get(t, e) {
256
+ return this.httpGet("/workflows/" + t + "/executions/" + e);
257
257
  }
258
- async run(t, s) {
259
- return this.httpPost("/workflows/" + t + "/executions", s);
258
+ async run(t, e) {
259
+ return this.httpPost("/workflows/" + t + "/executions", e);
260
260
  }
261
- async queue(t, s) {
262
- return this.httpPost("/workflows/" + t + "/executions/queue", s);
261
+ async queue(t, e) {
262
+ return this.httpPost("/workflows/" + t + "/executions/queue", e);
263
263
  }
264
264
  /** Runs across all workflows in the project (filter by status/workflow/date). */
265
265
  async listRuns(t = {}) {
266
- const { page: s, size: e } = this.normalizePageParams(t.page, t.size), r = { page: s, size: e };
266
+ const { page: e, size: s } = this.normalizePageParams(t.page, t.size), r = { page: e, size: s };
267
267
  return t.status && (r.status = t.status), t.workflowId && (r.workflowId = t.workflowId), t.dateFrom && (r.dateFrom = t.dateFrom), t.dateTo && (r.dateTo = t.dateTo), this.httpGet("/executions", r);
268
268
  }
269
269
  /** Request cancellation of a running/waiting execution (cascades to sub-workflows). */
270
- async cancel(t, s) {
270
+ async cancel(t, e) {
271
271
  return this.httpPost(
272
- "/workflows/" + t + "/executions/" + s + "/cancel",
272
+ "/workflows/" + t + "/executions/" + e + "/cancel",
273
273
  {}
274
274
  );
275
275
  }
276
276
  /** Re-run an execution from a given node. mode: 'reuse_outputs' | 'fresh'. */
277
- async rerun(t, s, e, r = "reuse_outputs") {
277
+ async rerun(t, e, s, r = "reuse_outputs") {
278
278
  return this.httpPost(
279
- "/workflows/" + t + "/executions/" + s + "/rerun",
280
- { fromNodeId: e, mode: r }
279
+ "/workflows/" + t + "/executions/" + e + "/rerun",
280
+ { fromNodeId: s, mode: r }
281
281
  );
282
282
  }
283
283
  /** Execute a single node in isolation with the given inputs (debugging). */
284
- async dryRunNode(t, s, e = {}) {
284
+ async dryRunNode(t, e, s = {}) {
285
285
  return this.httpPost(
286
- "/workflows/" + t + "/nodes/" + s + "/dry-run",
287
- { inputs: e }
286
+ "/workflows/" + t + "/nodes/" + e + "/dry-run",
287
+ { inputs: s }
288
288
  );
289
289
  }
290
290
  /** Normalized action trace of an agent step (reasoning, tool calls, messages). */
291
- async stepTrace(t, s, e, r, n) {
291
+ async stepTrace(t, e, s, r, n) {
292
292
  const { page: a, size: i } = this.normalizePageParams(r, n ?? 200);
293
293
  return this.httpGet(
294
- "/workflows/" + t + "/executions/" + s + "/steps/" + e + "/trace",
294
+ "/workflows/" + t + "/executions/" + e + "/steps/" + s + "/trace",
295
295
  { page: a, size: i }
296
296
  );
297
297
  }
298
298
  }
299
- class G extends c {
300
- constructor(t, s) {
301
- super(t, s);
299
+ class k extends c {
300
+ constructor(t, e) {
301
+ super(t, e);
302
302
  }
303
303
  /** The project's human-task inbox. */
304
304
  async list(t = {}) {
305
- const { page: s, size: e } = this.normalizePageParams(t.page, t.size ?? 50), r = { page: s, size: e };
305
+ const { page: e, size: s } = this.normalizePageParams(t.page, t.size ?? 50), r = { page: e, size: s };
306
306
  return (t.status ?? "pending") && (r.status = t.status ?? "pending"), t.assignee && (r.assignee = t.assignee), t.workflowId && (r.workflowId = t.workflowId), t.executionId && (r.executionId = t.executionId), this.httpGet("/human-tasks", r);
307
307
  }
308
308
  /** Answer a pending human task, resuming the suspended workflow execution. */
309
- async respond(t, s, e) {
309
+ async respond(t, e, s) {
310
310
  return this.httpPost("/human-tasks/" + t + "/respond", {
311
- response: s,
312
- respondedBy: e
311
+ response: e,
312
+ respondedBy: s
313
313
  });
314
314
  }
315
315
  }
316
- class k extends c {
317
- constructor(t, s) {
318
- super(t, s);
316
+ class G extends c {
317
+ constructor(t, e) {
318
+ super(t, e);
319
319
  }
320
- async list(t, s, e, r) {
321
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
320
+ /** The providers enabled on the server (e.g. the Telegram bot). */
321
+ async providers() {
322
+ return this.httpGet("/channels/providers");
323
+ }
324
+ /** The project's channels, with their setup status. */
325
+ async list() {
326
+ return this.httpGet("/channels");
327
+ }
328
+ /** One-shot deep link that links a group to the project. */
329
+ async createLink(t = "telegram") {
330
+ return this.httpPost("/channels/" + t + "/link-token");
331
+ }
332
+ async update(t, e) {
333
+ return this.httpPatch("/channels/" + t, e);
334
+ }
335
+ /** Re-checks the channel setup (the bot can still post in the group). */
336
+ async verify(t) {
337
+ return this.httpPost("/channels/" + t + "/verify");
338
+ }
339
+ async unlink(t) {
340
+ await this.httpDelete("/channels/" + t);
341
+ }
342
+ /** The caller's linked accounts. */
343
+ async myIdentities() {
344
+ return this.httpGet("/channels/identities/me");
345
+ }
346
+ /** One-shot deep link that links the caller's account. */
347
+ async createIdentityLink(t = "telegram") {
348
+ return this.httpPost("/channels/identities/" + t + "/link-token");
349
+ }
350
+ async unlinkIdentity(t = "telegram") {
351
+ await this.httpDelete("/channels/identities/me/" + t);
352
+ }
353
+ }
354
+ class z extends c {
355
+ constructor(t, e) {
356
+ super(t, e);
357
+ }
358
+ async list(t, e, s, r) {
359
+ const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
322
360
  return t && (i.keyword = t), this.httpGet("/workflows", i);
323
361
  }
324
362
  async create(t) {
325
363
  return this.httpPost("/workflows", t);
326
364
  }
327
- async update(t, s) {
328
- return s.id = t, this.httpPut("/workflows/" + t, s);
365
+ async update(t, e) {
366
+ return e.id = t, this.httpPut("/workflows/" + t, e);
329
367
  }
330
368
  async remove(t) {
331
369
  await this.httpDelete("/workflows/" + t);
@@ -337,27 +375,30 @@ class k extends c {
337
375
  return new f(this.getBaseUrl(), this.getAuthProvider());
338
376
  }
339
377
  humanTasks() {
378
+ return new k(this.getBaseUrl(), this.getAuthProvider());
379
+ }
380
+ channels() {
340
381
  return new G(this.getBaseUrl(), this.getAuthProvider());
341
382
  }
342
383
  async listRevisions(t) {
343
384
  return this.httpGet("/workflows/" + t + "/revisions");
344
385
  }
345
- async getRevision(t, s) {
346
- return this.httpGet("/workflows/" + t + "/revisions/" + s);
386
+ async getRevision(t, e) {
387
+ return this.httpGet("/workflows/" + t + "/revisions/" + e);
347
388
  }
348
- async rollback(t, s) {
349
- return this.httpPost("/workflows/" + t + "/revisions/" + s + "/rollback", {});
389
+ async rollback(t, e) {
390
+ return this.httpPost("/workflows/" + t + "/revisions/" + e + "/rollback", {});
350
391
  }
351
392
  }
352
- class z extends c {
353
- constructor(t, s) {
354
- super(t, s);
393
+ class U extends c {
394
+ constructor(t, e) {
395
+ super(t, e);
355
396
  }
356
- async authorize(t, s) {
357
- return this.httpPost("/credentials/" + t + "/authorize", s);
397
+ async authorize(t, e) {
398
+ return this.httpPost("/credentials/" + t + "/authorize", e);
358
399
  }
359
- async handleOAuth2Callback(t, s, e, r) {
360
- const n = { code: s, state: e };
400
+ async handleOAuth2Callback(t, e, s, r) {
401
+ const n = { code: e, state: s };
361
402
  return r && (n.scope = r), this.httpGet("/credentials/" + t + "/oauth2/callback", n);
362
403
  }
363
404
  async list() {
@@ -373,12 +414,12 @@ class z extends c {
373
414
  await this.httpDelete("/credentials/all/" + t);
374
415
  }
375
416
  }
376
- class U extends c {
377
- constructor(t, s) {
378
- super(t, s);
417
+ class x extends c {
418
+ constructor(t, e) {
419
+ super(t, e);
379
420
  }
380
- async list(t, s, e, r) {
381
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
421
+ async list(t, e, s, r) {
422
+ const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
382
423
  return t && (i.keyword = t), this.httpGet("/features/templates", i);
383
424
  }
384
425
  async get(t) {
@@ -387,40 +428,40 @@ class U extends c {
387
428
  async create(t) {
388
429
  return this.httpPost("/features/templates", t);
389
430
  }
390
- async update(t, s) {
391
- return this.httpPut("/features/templates/" + t, s);
431
+ async update(t, e) {
432
+ return this.httpPut("/features/templates/" + t, e);
392
433
  }
393
- async patch(t, s) {
394
- return this.httpPatch("/features/templates/" + t, s);
434
+ async patch(t, e) {
435
+ return this.httpPatch("/features/templates/" + t, e);
395
436
  }
396
437
  async remove(t) {
397
438
  await this.httpDelete("/features/templates/" + t);
398
439
  }
399
- async getMcpAvailableTools(t, s) {
400
- const e = s ? { credentialsId: s } : void 0;
401
- return this.httpPost("/features/templates/mcp/available-tools", t, e);
440
+ async getMcpAvailableTools(t, e) {
441
+ const s = e ? { credentialsId: e } : void 0;
442
+ return this.httpPost("/features/templates/mcp/available-tools", t, s);
402
443
  }
403
444
  }
404
- class x {
405
- constructor(t, s) {
445
+ class S {
446
+ constructor(t, e) {
406
447
  u(this, "baseUrl");
407
448
  u(this, "auth");
408
- this.baseUrl = t, this.auth = s;
449
+ this.baseUrl = t, this.auth = e;
409
450
  }
410
451
  templates() {
411
- return new U(this.baseUrl, this.auth);
452
+ return new x(this.baseUrl, this.auth);
412
453
  }
413
454
  }
414
- class S extends c {
415
- constructor(t, s) {
416
- super(t, s);
455
+ class T extends c {
456
+ constructor(t, e) {
457
+ super(t, e);
417
458
  }
418
- async list(t, s, e) {
419
- const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
459
+ async list(t, e, s) {
460
+ const { page: r, size: n } = this.normalizePageParams(e, s), a = { page: r, size: n };
420
461
  return this.httpGet("/triggers/" + t + "/executions", a);
421
462
  }
422
- async execute(t, s) {
423
- return this.httpPost("/triggers/" + t + "/executions", s);
463
+ async execute(t, e) {
464
+ return this.httpPost("/triggers/" + t + "/executions", e);
424
465
  }
425
466
  async get(t) {
426
467
  return this.httpGet("/triggers/executions/" + t);
@@ -429,19 +470,19 @@ class S extends c {
429
470
  await this.httpDelete("/triggers/executions/" + t);
430
471
  }
431
472
  }
432
- class T extends c {
433
- constructor(t, s) {
434
- super(t, s);
473
+ class A extends c {
474
+ constructor(t, e) {
475
+ super(t, e);
435
476
  }
436
- async list(t, s, e, r) {
437
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
477
+ async list(t, e, s, r) {
478
+ const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
438
479
  return t && (i.keyword = t), this.httpGet("/triggers", i);
439
480
  }
440
481
  async create(t) {
441
482
  return this.httpPost("/triggers", t);
442
483
  }
443
- async update(t, s) {
444
- return this.httpPut("/triggers/" + t, s);
484
+ async update(t, e) {
485
+ return this.httpPut("/triggers/" + t, e);
445
486
  }
446
487
  async remove(t) {
447
488
  await this.httpDelete("/triggers/" + t);
@@ -450,15 +491,15 @@ class T extends c {
450
491
  return this.httpGet("/triggers/" + t);
451
492
  }
452
493
  executions() {
453
- return new S(this.getBaseUrl(), this.getAuthProvider());
494
+ return new T(this.getBaseUrl(), this.getAuthProvider());
454
495
  }
455
496
  }
456
- class A extends c {
457
- constructor(t, s) {
458
- super(t, s);
497
+ class C extends c {
498
+ constructor(t, e) {
499
+ super(t, e);
459
500
  }
460
- async list(t, s, e, r) {
461
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a, ...r };
501
+ async list(t, e, s, r) {
502
+ const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a, ...r };
462
503
  return t && (i.keyword = t), this.httpGet("/service-prices", i);
463
504
  }
464
505
  async getStats(t = {}) {
@@ -470,20 +511,20 @@ class A extends c {
470
511
  async create(t) {
471
512
  return this.httpPost("/service-prices", t);
472
513
  }
473
- async update(t, s) {
474
- return this.httpPut("/service-prices/" + t, s);
514
+ async update(t, e) {
515
+ return this.httpPut("/service-prices/" + t, e);
475
516
  }
476
517
  async remove(t) {
477
518
  await this.httpDelete("/service-prices/" + t);
478
519
  }
479
520
  }
480
- class C extends c {
481
- constructor(t, s) {
482
- super(t, s);
521
+ class I extends c {
522
+ constructor(t, e) {
523
+ super(t, e);
483
524
  }
484
- async list(t, s, e, r) {
485
- const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
486
- return t && (i.projectId = t), s && (i.keyword = s), this.httpGet("/markup-rules", i);
525
+ async list(t, e, s, r) {
526
+ const { page: n, size: a } = this.normalizePageParams(s, r), i = { page: n, size: a };
527
+ return t && (i.projectId = t), e && (i.keyword = e), this.httpGet("/markup-rules", i);
487
528
  }
488
529
  async get(t) {
489
530
  return this.httpGet("/markup-rules/" + t);
@@ -491,20 +532,20 @@ class C extends c {
491
532
  async create(t) {
492
533
  return this.httpPost("/markup-rules", t);
493
534
  }
494
- async update(t, s) {
495
- return this.httpPut("/markup-rules/" + t, s);
535
+ async update(t, e) {
536
+ return this.httpPut("/markup-rules/" + t, e);
496
537
  }
497
538
  async remove(t) {
498
539
  await this.httpDelete("/markup-rules/" + t);
499
540
  }
500
541
  }
501
- class I extends c {
502
- constructor(t, s) {
503
- super(t, s);
542
+ class R extends c {
543
+ constructor(t, e) {
544
+ super(t, e);
504
545
  }
505
- async list(t, s, e, r) {
506
- const { page: n, size: a } = this.normalizePageParams(e, r), i = { page: n, size: a };
507
- return t && (i.projectId = t), s && (i.keyword = s), this.httpGet("/providers", i);
546
+ async list(t, e, s, r) {
547
+ const { page: n, size: a } = this.normalizePageParams(s, r), i = { page: n, size: a };
548
+ return t && (i.projectId = t), e && (i.keyword = e), this.httpGet("/providers", i);
508
549
  }
509
550
  async get(t) {
510
551
  return this.httpGet("/providers/" + t);
@@ -512,8 +553,8 @@ class I extends c {
512
553
  async create(t) {
513
554
  return this.httpPost("/providers", t);
514
555
  }
515
- async update(t, s) {
516
- return this.httpPut("/providers/" + t, s);
556
+ async update(t, e) {
557
+ return this.httpPut("/providers/" + t, e);
517
558
  }
518
559
  async remove(t) {
519
560
  await this.httpDelete("/providers/" + t);
@@ -532,13 +573,13 @@ class I extends c {
532
573
  return this.httpGet("/provider-models", { provider: t });
533
574
  }
534
575
  }
535
- class R extends c {
536
- constructor(t, s) {
537
- super(t, s);
576
+ class B extends c {
577
+ constructor(t, e) {
578
+ super(t, e);
538
579
  }
539
- async list(t, s, e, r, n, a) {
580
+ async list(t, e, s, r, n, a) {
540
581
  const { page: i, size: h } = this.normalizePageParams(n, a), p = { page: i, size: h };
541
- return t && (p.keyword = t), s && (p.status = s), e && (p.agentId = e), r && (p.userId = r), this.httpGet("/sessions", p);
582
+ return t && (p.keyword = t), e && (p.status = e), s && (p.agentId = s), r && (p.userId = r), this.httpGet("/sessions", p);
542
583
  }
543
584
  async get(t) {
544
585
  return this.httpGet("/sessions/" + t);
@@ -546,18 +587,18 @@ class R extends c {
546
587
  async getUsage(t) {
547
588
  return this.httpGet("/sessions/" + t + "/usage");
548
589
  }
549
- async generateMessage(t, s) {
550
- return this.httpPost("/sessions/" + t + "/messages", s);
590
+ async generateMessage(t, e) {
591
+ return this.httpPost("/sessions/" + t + "/messages", e);
551
592
  }
552
- async findMessages(t, s, e) {
553
- const { page: r, size: n } = this.normalizePageParams(s, e), a = { page: r, size: n };
593
+ async findMessages(t, e, s) {
594
+ const { page: r, size: n } = this.normalizePageParams(e, s), a = { page: r, size: n };
554
595
  return this.httpGet("/sessions/" + t + "/messages", a);
555
596
  }
556
597
  async remove(t) {
557
598
  await this.httpDelete("/sessions/" + t);
558
599
  }
559
- async rename(t, s) {
560
- return this.httpPut("/sessions/" + t + "/name", { name: s });
600
+ async rename(t, e) {
601
+ return this.httpPut("/sessions/" + t + "/name", { name: e });
561
602
  }
562
603
  // ─── Agent Execution Lifecycle ────────────────────────────────
563
604
  /**
@@ -578,19 +619,19 @@ class R extends c {
578
619
  /**
579
620
  * Steer a running agent execution by injecting an instruction.
580
621
  */
581
- async steerExecution(t, s) {
622
+ async steerExecution(t, e) {
582
623
  return this.httpPost(
583
624
  "/sessions/" + encodeURIComponent(t) + "/steer",
584
- { text: s }
625
+ { text: e }
585
626
  );
586
627
  }
587
628
  }
588
629
  class E extends c {
589
- constructor(t, s) {
590
- super(t, s);
630
+ constructor(t, e) {
631
+ super(t, e);
591
632
  }
592
- async list(t, s, e, r) {
593
- const { page: n, size: a } = this.normalizePageParams(s, e), i = { page: n, size: a };
633
+ async list(t, e, s, r) {
634
+ const { page: n, size: a } = this.normalizePageParams(e, s), i = { page: n, size: a };
594
635
  return t && (i.keyword = t), r && (i.status = r), this.httpGet("/missions", i);
595
636
  }
596
637
  async get(t) {
@@ -599,8 +640,8 @@ class E extends c {
599
640
  async create(t) {
600
641
  return this.httpPost("/missions", t);
601
642
  }
602
- async update(t, s) {
603
- return this.httpPut("/missions/" + t, s);
643
+ async update(t, e) {
644
+ return this.httpPut("/missions/" + t, e);
604
645
  }
605
646
  async remove(t) {
606
647
  await this.httpDelete("/missions/" + t);
@@ -617,8 +658,8 @@ class E extends c {
617
658
  async replan(t) {
618
659
  return this.httpPost("/missions/" + t + "/replan");
619
660
  }
620
- async sendInstruction(t, s) {
621
- return this.httpPost("/missions/" + t + "/instructions", { instruction: s });
661
+ async sendInstruction(t, e) {
662
+ return this.httpPost("/missions/" + t + "/instructions", { instruction: e });
622
663
  }
623
664
  async stop(t) {
624
665
  return this.httpPost("/missions/" + t + "/stop");
@@ -627,21 +668,21 @@ class E extends c {
627
668
  return this.httpPost("/missions/" + t + "/continue");
628
669
  }
629
670
  }
630
- class B {
631
- constructor(t, s) {
671
+ class j {
672
+ constructor(t, e) {
632
673
  u(this, "baseUrl");
633
674
  u(this, "authProvider");
634
- this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider = s ?? null;
675
+ this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider = e ?? null;
635
676
  }
636
677
  buildHeaders() {
637
678
  const t = new Headers();
638
679
  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;
639
680
  }
640
- async request(t, s, e) {
681
+ async request(t, e, s) {
641
682
  const r = await fetch(this.baseUrl + t, {
642
- method: s,
683
+ method: e,
643
684
  headers: this.buildHeaders(),
644
- body: e ? JSON.stringify(e) : void 0
685
+ body: s ? JSON.stringify(s) : void 0
645
686
  });
646
687
  if (!r.ok) {
647
688
  const a = await r.text();
@@ -653,8 +694,8 @@ class B {
653
694
  async createCustomer(t) {
654
695
  return this.request("/customers", "POST", t);
655
696
  }
656
- async updateCustomer(t, s) {
657
- return this.request("/customers/" + t, "PUT", s);
697
+ async updateCustomer(t, e) {
698
+ return this.request("/customers/" + t, "PUT", e);
658
699
  }
659
700
  async getCustomer(t) {
660
701
  return this.request("/customers/" + t, "GET");
@@ -674,26 +715,26 @@ class B {
674
715
  async getProjectSubscription(t) {
675
716
  return this.request("/projects/" + t + "/subscription", "GET");
676
717
  }
677
- async changeProjectSubscriptionPlan(t, s) {
678
- return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST", s);
718
+ async changeProjectSubscriptionPlan(t, e) {
719
+ return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST", e);
679
720
  }
680
- async addProjectSubscriptionCredits(t, s) {
681
- return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST", s);
721
+ async addProjectSubscriptionCredits(t, e) {
722
+ return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST", e);
682
723
  }
683
- async beginUpgrade(t, s) {
684
- return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST", s);
724
+ async beginUpgrade(t, e) {
725
+ return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST", e);
685
726
  }
686
- async downgrade(t, s) {
687
- return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST", s);
727
+ async downgrade(t, e) {
728
+ return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST", e);
688
729
  }
689
- async mentorize(t, s) {
690
- return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST", s);
730
+ async mentorize(t, e) {
731
+ return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST", e);
691
732
  }
692
- async addCredits(t, s) {
693
- return this.request("/customers/" + t + "/subscription/credits", "POST", { credits: s });
733
+ async addCredits(t, e) {
734
+ return this.request("/customers/" + t + "/subscription/credits", "POST", { credits: e });
694
735
  }
695
- async useCredits(t, s, e, r, n, a) {
696
- const i = { credits: s, services: e };
736
+ async useCredits(t, e, s, r, n, a) {
737
+ const i = { credits: e, services: s };
697
738
  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);
698
739
  }
699
740
  async getCredits(t) {
@@ -710,31 +751,31 @@ class B {
710
751
  return !1;
711
752
  }
712
753
  }
713
- async listInvoices(t, s, e) {
754
+ async listInvoices(t, e, s) {
714
755
  const r = [];
715
- s && r.push("date_from=" + s), e && r.push("date_to=" + e);
756
+ e && r.push("date_from=" + e), s && r.push("date_to=" + s);
716
757
  const n = r.length > 0 ? "?" + r.join("&") : "";
717
758
  return this.request("/customers/" + t + "/invoices" + n, "GET");
718
759
  }
719
760
  async cancelSubscription(t) {
720
761
  return this.request("/customers/" + t + "/subscription/actions/cancel", "POST", {});
721
762
  }
722
- async getUsageStats(t, s, e, r) {
763
+ async getUsageStats(t, e, s, r) {
723
764
  const n = [];
724
- s && n.push("date_from=" + encodeURIComponent(s)), e && n.push("date_to=" + encodeURIComponent(e)), r != null && r.length && r.forEach((i) => n.push("model=" + encodeURIComponent(i)));
765
+ 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)));
725
766
  const a = n.length > 0 ? "?" + n.join("&") : "";
726
767
  return this.request("/projects/" + t + "/subscription/usage-stats" + a, "GET");
727
768
  }
728
- async listUsages(t, s, e, r, n, a, i) {
769
+ async listUsages(t, e, s, r, n, a, i) {
729
770
  const h = [];
730
- s && h.push("date_from=" + encodeURIComponent(s)), e && h.push("date_to=" + encodeURIComponent(e)), r != null && r.length && r.forEach((d) => h.push("model=" + encodeURIComponent(d))), 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)));
771
+ e && h.push("date_from=" + encodeURIComponent(e)), s && h.push("date_to=" + encodeURIComponent(s)), r != null && r.length && r.forEach((d) => h.push("model=" + encodeURIComponent(d))), 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)));
731
772
  const p = h.length > 0 ? "?" + h.join("&") : "";
732
773
  return this.request("/projects/" + t + "/subscription/usages" + p, "GET");
733
774
  }
734
775
  }
735
- class j extends c {
736
- constructor(t, s) {
737
- super(t, s);
776
+ class q extends c {
777
+ constructor(t, e) {
778
+ super(t, e);
738
779
  }
739
780
  async get(t) {
740
781
  return this.httpGet("/values/" + t);
@@ -791,12 +832,12 @@ class j extends c {
791
832
  return this.httpGet("/values/trigger-destination-types");
792
833
  }
793
834
  }
794
- class O {
795
- constructor(t, s, e) {
835
+ class D {
836
+ constructor(t, e, s) {
796
837
  u(this, "baseUrl");
797
838
  u(this, "workflowsBaseUrl");
798
839
  u(this, "billingBaseUrl");
799
- this.baseUrl = t, this.workflowsBaseUrl = s, this.billingBaseUrl = e || "https://persona.applica.guru/billing";
840
+ this.baseUrl = t, this.workflowsBaseUrl = e, this.billingBaseUrl = s || "https://persona.applica.guru/billing";
800
841
  }
801
842
  projects(t) {
802
843
  return new w(this.baseUrl, t, this.billingBaseUrl);
@@ -808,40 +849,40 @@ class O {
808
849
  return new v(this.baseUrl, t);
809
850
  }
810
851
  workflows(t) {
811
- return new k(this.workflowsBaseUrl, t);
852
+ return new z(this.workflowsBaseUrl, t);
812
853
  }
813
854
  credentials(t) {
814
- return new z(this.baseUrl, t);
855
+ return new U(this.baseUrl, t);
815
856
  }
816
857
  features(t) {
817
- return new x(this.baseUrl, t);
858
+ return new S(this.baseUrl, t);
818
859
  }
819
860
  triggers(t) {
820
- return new T(this.baseUrl, t);
861
+ return new A(this.baseUrl, t);
821
862
  }
822
863
  servicePrices(t) {
823
- return new A(this.baseUrl, t);
864
+ return new C(this.baseUrl, t);
824
865
  }
825
866
  markupRules(t) {
826
- return new C(this.baseUrl, t);
867
+ return new I(this.baseUrl, t);
827
868
  }
828
869
  providers(t) {
829
- return new I(this.baseUrl, t);
870
+ return new R(this.baseUrl, t);
830
871
  }
831
872
  sessions(t) {
832
- return new R(this.baseUrl, t);
873
+ return new B(this.baseUrl, t);
833
874
  }
834
875
  missions(t) {
835
876
  return new E(this.baseUrl, t);
836
877
  }
837
878
  billing(t) {
838
- return new B(this.billingBaseUrl, t);
879
+ return new j(this.billingBaseUrl, t);
839
880
  }
840
881
  values(t) {
841
- return new j(this.baseUrl, t);
882
+ return new q(this.baseUrl, t);
842
883
  }
843
884
  }
844
- class D {
885
+ class H {
845
886
  constructor(t) {
846
887
  this.token = t;
847
888
  }
@@ -856,25 +897,26 @@ export {
856
897
  P as AgentsApi,
857
898
  l as ApiException,
858
899
  m as ApiKeyAuthenticationProvider,
859
- D as BearerTokenAuthenticationProvider,
860
- B as BillingClient,
861
- z as CredentialsApi,
862
- U as FeatureTemplatesApi,
863
- x as FeaturesApi,
864
- G as HumanTasksApi,
900
+ H as BearerTokenAuthenticationProvider,
901
+ j as BillingClient,
902
+ G as ChannelsApi,
903
+ U as CredentialsApi,
904
+ x as FeatureTemplatesApi,
905
+ S as FeaturesApi,
906
+ k as HumanTasksApi,
865
907
  b as KnowledgeBaseDocumentsApi,
866
908
  v as KnowledgeBasesApi,
867
- C as MarkupRulesApi,
909
+ I as MarkupRulesApi,
868
910
  E as MissionsApi,
869
- O as PersonaSdk,
911
+ D as PersonaSdk,
870
912
  w as ProjectsApi,
871
- I as ProvidersApi,
872
- A as ServicePricesApi,
873
- R as SessionsApi,
874
- S as TriggerExecutionsApi,
875
- T as TriggersApi,
876
- j as ValuesApi,
913
+ R as ProvidersApi,
914
+ C as ServicePricesApi,
915
+ B as SessionsApi,
916
+ T as TriggerExecutionsApi,
917
+ A as TriggersApi,
918
+ q as ValuesApi,
877
919
  f as WorkflowExecutionsApi,
878
- k as WorkflowsApi
920
+ z as WorkflowsApi
879
921
  };
880
922
  //# sourceMappingURL=bundle.es.js.map