@applica-software-guru/persona-sdk 0.1.113 → 0.1.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -1
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.es.js +468 -315
- package/dist/bundle.es.js.map +1 -1
- package/dist/index.d.ts +339 -3
- package/package.json +1 -1
- package/src/agents/types.ts +6 -2
- package/src/billing/billing-client.ts +3 -0
- package/src/billing/types.ts +16 -0
- package/src/index.ts +27 -0
- package/src/model-aliases/model-aliases-api.ts +94 -0
- package/src/model-aliases/references.ts +20 -0
- package/src/model-aliases/types.ts +125 -0
- package/src/notifications/notifications-api.ts +42 -0
- package/src/notifications/types.ts +39 -0
- package/src/persona-sdk.ts +14 -0
- package/src/sessions/types.ts +2 -0
- package/src/workflows/channels-api.ts +61 -0
- package/src/workflows/types.ts +45 -0
- package/src/workflows/workflows-api.ts +5 -0
- package/tests/billing-aliases.test.mjs +71 -0
- package/tests/channels-api.test.mjs +55 -0
- package/tests/model-aliases-api.test.mjs +198 -0
- package/tests/notifications-api.test.mjs +88 -0
package/dist/bundle.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var P = (o, t, e) => t in o ? m(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var h = (o, t, e) => P(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
class l extends Error {
|
|
5
|
-
constructor(
|
|
6
|
-
super(`API Error: ${
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.statusCode =
|
|
5
|
+
constructor(e, s) {
|
|
6
|
+
super(`API Error: ${e} - ${s}`);
|
|
7
|
+
h(this, "statusCode");
|
|
8
|
+
h(this, "body");
|
|
9
|
+
this.statusCode = e, this.body = s;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class w {
|
|
13
13
|
constructor(t) {
|
|
14
14
|
this.apiKey = t;
|
|
15
15
|
}
|
|
@@ -21,10 +21,10 @@ class m {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
class c {
|
|
24
|
-
constructor(t,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.baseUrl = t, this.authProvider = typeof
|
|
24
|
+
constructor(t, e) {
|
|
25
|
+
h(this, "baseUrl");
|
|
26
|
+
h(this, "authProvider");
|
|
27
|
+
this.baseUrl = t, this.authProvider = typeof e == "string" ? new w(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 l(t.status,
|
|
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 l(
|
|
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(
|
|
104
|
-
|
|
105
|
-
this.billingBaseUrl = (r ||
|
|
101
|
+
class f extends c {
|
|
102
|
+
constructor(e, s, r) {
|
|
103
|
+
super(e, s);
|
|
104
|
+
h(this, "billingBaseUrl");
|
|
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 l(a.status,
|
|
150
|
+
const p = await a.text();
|
|
151
|
+
throw new l(a.status, p);
|
|
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 b 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 P 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(
|
|
200
|
-
|
|
197
|
+
class v extends c {
|
|
198
|
+
constructor(e, s, r) {
|
|
199
|
+
super(e, s);
|
|
200
|
+
h(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 k 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,94 +238,132 @@ class v extends c {
|
|
|
238
238
|
await this.httpDelete("/knowledge-bases/" + t);
|
|
239
239
|
}
|
|
240
240
|
documents(t) {
|
|
241
|
-
return new
|
|
241
|
+
return new v(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 G 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
|
/** Runs across all workflows in the project (filter by status/workflow/date). */
|
|
265
265
|
async listRuns(t = {}) {
|
|
266
|
-
const { page:
|
|
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,
|
|
270
|
+
async cancel(t, e) {
|
|
271
271
|
return this.httpPost(
|
|
272
|
-
"/workflows/" + t + "/executions/" +
|
|
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,
|
|
277
|
+
async rerun(t, e, s, r = "reuse_outputs") {
|
|
278
278
|
return this.httpPost(
|
|
279
|
-
"/workflows/" + t + "/executions/" +
|
|
280
|
-
{ fromNodeId:
|
|
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,
|
|
284
|
+
async dryRunNode(t, e, s = {}) {
|
|
285
285
|
return this.httpPost(
|
|
286
|
-
"/workflows/" + t + "/nodes/" +
|
|
287
|
-
{ inputs:
|
|
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,
|
|
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/" +
|
|
294
|
+
"/workflows/" + t + "/executions/" + e + "/steps/" + s + "/trace",
|
|
295
295
|
{ page: a, size: i }
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
class
|
|
300
|
-
constructor(t,
|
|
301
|
-
super(t,
|
|
299
|
+
class z 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:
|
|
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,
|
|
309
|
+
async respond(t, e, s) {
|
|
310
310
|
return this.httpPost("/human-tasks/" + t + "/respond", {
|
|
311
|
-
response:
|
|
312
|
-
respondedBy:
|
|
311
|
+
response: e,
|
|
312
|
+
respondedBy: s
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
class
|
|
317
|
-
constructor(t,
|
|
318
|
-
super(t,
|
|
316
|
+
class U extends c {
|
|
317
|
+
constructor(t, e) {
|
|
318
|
+
super(t, e);
|
|
319
|
+
}
|
|
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);
|
|
319
334
|
}
|
|
320
|
-
|
|
321
|
-
|
|
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 x 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,
|
|
328
|
-
return
|
|
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);
|
|
@@ -334,30 +372,33 @@ class k extends c {
|
|
|
334
372
|
return this.httpGet("/workflows/" + t);
|
|
335
373
|
}
|
|
336
374
|
executions() {
|
|
337
|
-
return new
|
|
375
|
+
return new G(this.getBaseUrl(), this.getAuthProvider());
|
|
338
376
|
}
|
|
339
377
|
humanTasks() {
|
|
340
|
-
return new
|
|
378
|
+
return new z(this.getBaseUrl(), this.getAuthProvider());
|
|
379
|
+
}
|
|
380
|
+
channels() {
|
|
381
|
+
return new U(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,
|
|
346
|
-
return this.httpGet("/workflows/" + t + "/revisions/" +
|
|
386
|
+
async getRevision(t, e) {
|
|
387
|
+
return this.httpGet("/workflows/" + t + "/revisions/" + e);
|
|
347
388
|
}
|
|
348
|
-
async rollback(t,
|
|
349
|
-
return this.httpPost("/workflows/" + t + "/revisions/" +
|
|
389
|
+
async rollback(t, e) {
|
|
390
|
+
return this.httpPost("/workflows/" + t + "/revisions/" + e + "/rollback", {});
|
|
350
391
|
}
|
|
351
392
|
}
|
|
352
|
-
class
|
|
353
|
-
constructor(t,
|
|
354
|
-
super(t,
|
|
393
|
+
class S extends c {
|
|
394
|
+
constructor(t, e) {
|
|
395
|
+
super(t, e);
|
|
355
396
|
}
|
|
356
|
-
async authorize(t,
|
|
357
|
-
return this.httpPost("/credentials/" + t + "/authorize",
|
|
397
|
+
async authorize(t, e) {
|
|
398
|
+
return this.httpPost("/credentials/" + t + "/authorize", e);
|
|
358
399
|
}
|
|
359
|
-
async handleOAuth2Callback(t,
|
|
360
|
-
const n = { code:
|
|
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
|
|
377
|
-
constructor(t,
|
|
378
|
-
super(t,
|
|
417
|
+
class T extends c {
|
|
418
|
+
constructor(t, e) {
|
|
419
|
+
super(t, e);
|
|
379
420
|
}
|
|
380
|
-
async list(t,
|
|
381
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
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,
|
|
391
|
-
return this.httpPut("/features/templates/" + t,
|
|
431
|
+
async update(t, e) {
|
|
432
|
+
return this.httpPut("/features/templates/" + t, e);
|
|
392
433
|
}
|
|
393
|
-
async patch(t,
|
|
394
|
-
return this.httpPatch("/features/templates/" + t,
|
|
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,
|
|
400
|
-
const
|
|
401
|
-
return this.httpPost("/features/templates/mcp/available-tools", t,
|
|
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
|
|
405
|
-
constructor(t,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
this.baseUrl = t, this.auth =
|
|
445
|
+
class A {
|
|
446
|
+
constructor(t, e) {
|
|
447
|
+
h(this, "baseUrl");
|
|
448
|
+
h(this, "auth");
|
|
449
|
+
this.baseUrl = t, this.auth = e;
|
|
409
450
|
}
|
|
410
451
|
templates() {
|
|
411
|
-
return new
|
|
452
|
+
return new T(this.baseUrl, this.auth);
|
|
412
453
|
}
|
|
413
454
|
}
|
|
414
|
-
class
|
|
415
|
-
constructor(t,
|
|
416
|
-
super(t,
|
|
455
|
+
class C extends c {
|
|
456
|
+
constructor(t, e) {
|
|
457
|
+
super(t, e);
|
|
417
458
|
}
|
|
418
|
-
async list(t,
|
|
419
|
-
const { page: r, size: n } = this.normalizePageParams(
|
|
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,
|
|
423
|
-
return this.httpPost("/triggers/" + t + "/executions",
|
|
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
|
|
433
|
-
constructor(t,
|
|
434
|
-
super(t,
|
|
473
|
+
class R extends c {
|
|
474
|
+
constructor(t, e) {
|
|
475
|
+
super(t, e);
|
|
435
476
|
}
|
|
436
|
-
async list(t,
|
|
437
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
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,
|
|
444
|
-
return this.httpPut("/triggers/" + t,
|
|
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
|
|
494
|
+
return new C(this.getBaseUrl(), this.getAuthProvider());
|
|
454
495
|
}
|
|
455
496
|
}
|
|
456
|
-
class
|
|
457
|
-
constructor(t,
|
|
458
|
-
super(t,
|
|
497
|
+
class I extends c {
|
|
498
|
+
constructor(t, e) {
|
|
499
|
+
super(t, e);
|
|
459
500
|
}
|
|
460
|
-
async list(t,
|
|
461
|
-
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, ...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,
|
|
474
|
-
return this.httpPut("/service-prices/" + t,
|
|
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
|
|
481
|
-
constructor(t,
|
|
482
|
-
super(t,
|
|
521
|
+
class E extends c {
|
|
522
|
+
constructor(t, e) {
|
|
523
|
+
super(t, e);
|
|
483
524
|
}
|
|
484
|
-
async list(t,
|
|
485
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
486
|
-
return t && (i.projectId = t),
|
|
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,
|
|
495
|
-
return this.httpPut("/markup-rules/" + t,
|
|
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
|
|
502
|
-
constructor(t,
|
|
503
|
-
super(t,
|
|
542
|
+
class B extends c {
|
|
543
|
+
constructor(t, e) {
|
|
544
|
+
super(t, e);
|
|
504
545
|
}
|
|
505
|
-
async list(t,
|
|
506
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
507
|
-
return t && (i.projectId = t),
|
|
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,
|
|
516
|
-
return this.httpPut("/providers/" + t,
|
|
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
|
|
536
|
-
constructor(t,
|
|
537
|
-
super(t,
|
|
576
|
+
class j extends c {
|
|
577
|
+
constructor(t, e) {
|
|
578
|
+
super(t, e);
|
|
538
579
|
}
|
|
539
|
-
async list(t,
|
|
540
|
-
const { page: i, size:
|
|
541
|
-
return t && (
|
|
580
|
+
async list(t, e, s, r, n, a) {
|
|
581
|
+
const { page: i, size: p } = this.normalizePageParams(n, a), u = { page: i, size: p };
|
|
582
|
+
return t && (u.keyword = t), e && (u.status = e), s && (u.agentId = s), r && (u.userId = r), this.httpGet("/sessions", u);
|
|
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,
|
|
550
|
-
return this.httpPost("/sessions/" + t + "/messages",
|
|
590
|
+
async generateMessage(t, e) {
|
|
591
|
+
return this.httpPost("/sessions/" + t + "/messages", e);
|
|
551
592
|
}
|
|
552
|
-
async findMessages(t,
|
|
553
|
-
const { page: r, size: n } = this.normalizePageParams(
|
|
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,
|
|
560
|
-
return this.httpPut("/sessions/" + t + "/name", { name:
|
|
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,
|
|
622
|
+
async steerExecution(t, e) {
|
|
582
623
|
return this.httpPost(
|
|
583
624
|
"/sessions/" + encodeURIComponent(t) + "/steer",
|
|
584
|
-
{ text:
|
|
625
|
+
{ text: e }
|
|
585
626
|
);
|
|
586
627
|
}
|
|
587
628
|
}
|
|
588
|
-
class
|
|
589
|
-
constructor(t,
|
|
590
|
-
super(t,
|
|
629
|
+
class q extends c {
|
|
630
|
+
constructor(t, e) {
|
|
631
|
+
super(t, e);
|
|
591
632
|
}
|
|
592
|
-
async list(t,
|
|
593
|
-
const { page: n, size: a } = this.normalizePageParams(
|
|
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,
|
|
603
|
-
return this.httpPut("/missions/" + t,
|
|
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,
|
|
621
|
-
return this.httpPost("/missions/" + t + "/instructions", { instruction:
|
|
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
|
|
631
|
-
constructor(t,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
this.baseUrl = (t || "https://persona.applica.guru/billing").replace(/\/$/, ""), this.authProvider =
|
|
671
|
+
class O {
|
|
672
|
+
constructor(t, e) {
|
|
673
|
+
h(this, "baseUrl");
|
|
674
|
+
h(this, "authProvider");
|
|
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,
|
|
681
|
+
async request(t, e, s) {
|
|
641
682
|
const r = await fetch(this.baseUrl + t, {
|
|
642
|
-
method:
|
|
683
|
+
method: e,
|
|
643
684
|
headers: this.buildHeaders(),
|
|
644
|
-
body:
|
|
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,
|
|
657
|
-
return this.request("/customers/" + t, "PUT",
|
|
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,
|
|
678
|
-
return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST",
|
|
718
|
+
async changeProjectSubscriptionPlan(t, e) {
|
|
719
|
+
return this.request("/projects/" + t + "/subscription/actions/change-plan", "POST", e);
|
|
679
720
|
}
|
|
680
|
-
async addProjectSubscriptionCredits(t,
|
|
681
|
-
return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST",
|
|
721
|
+
async addProjectSubscriptionCredits(t, e) {
|
|
722
|
+
return this.request("/projects/" + t + "/subscription/actions/add-credits", "POST", e);
|
|
682
723
|
}
|
|
683
|
-
async beginUpgrade(t,
|
|
684
|
-
return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST",
|
|
724
|
+
async beginUpgrade(t, e) {
|
|
725
|
+
return this.request("/customers/" + t + "/subscription/actions/upgrade", "POST", e);
|
|
685
726
|
}
|
|
686
|
-
async downgrade(t,
|
|
687
|
-
return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST",
|
|
727
|
+
async downgrade(t, e) {
|
|
728
|
+
return this.request("/customers/" + t + "/subscription/actions/downgrade", "POST", e);
|
|
688
729
|
}
|
|
689
|
-
async mentorize(t,
|
|
690
|
-
return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST",
|
|
730
|
+
async mentorize(t, e) {
|
|
731
|
+
return this.request("/customers/" + t + "/subscription/actions/mentorize", "POST", e);
|
|
691
732
|
}
|
|
692
|
-
async addCredits(t,
|
|
693
|
-
return this.request("/customers/" + t + "/subscription/credits", "POST", { credits:
|
|
733
|
+
async addCredits(t, e) {
|
|
734
|
+
return this.request("/customers/" + t + "/subscription/credits", "POST", { credits: e });
|
|
694
735
|
}
|
|
695
|
-
async useCredits(t,
|
|
696
|
-
const i = { credits:
|
|
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,
|
|
754
|
+
async listInvoices(t, e, s) {
|
|
714
755
|
const r = [];
|
|
715
|
-
|
|
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,
|
|
763
|
+
async getUsageStats(t, e, s, r) {
|
|
723
764
|
const n = [];
|
|
724
|
-
|
|
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,
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
return this.request("/projects/" + t + "/subscription/usages" +
|
|
769
|
+
async listUsages(t, e, s, r, n, a, i, p) {
|
|
770
|
+
const u = [];
|
|
771
|
+
e && u.push("date_from=" + encodeURIComponent(e)), s && u.push("date_to=" + encodeURIComponent(s)), r != null && r.length && r.forEach((d) => u.push("model=" + encodeURIComponent(d))), n && u.push("session_id=" + encodeURIComponent(n)), a !== void 0 && u.push("page=" + encodeURIComponent(String(a))), i !== void 0 && u.push("size=" + encodeURIComponent(String(i))), p != null && p.length && p.forEach((d) => u.push("alias=" + encodeURIComponent(d)));
|
|
772
|
+
const y = u.length > 0 ? "?" + u.join("&") : "";
|
|
773
|
+
return this.request("/projects/" + t + "/subscription/usages" + y, "GET");
|
|
733
774
|
}
|
|
734
775
|
}
|
|
735
|
-
class
|
|
736
|
-
constructor(t,
|
|
737
|
-
super(t,
|
|
776
|
+
class D 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,57 +832,150 @@ class j extends c {
|
|
|
791
832
|
return this.httpGet("/values/trigger-destination-types");
|
|
792
833
|
}
|
|
793
834
|
}
|
|
794
|
-
class
|
|
795
|
-
constructor(t,
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
835
|
+
class H extends c {
|
|
836
|
+
constructor(t, e) {
|
|
837
|
+
super(t, e);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Aliases visible to the caller (their project's and the global ones). Super admins
|
|
841
|
+
* can pass `projectId` to see another project's view.
|
|
842
|
+
*/
|
|
843
|
+
async list(t, e, s, r) {
|
|
844
|
+
const { page: n, size: a } = this.normalizePageParams(s, r), i = { page: n, size: a };
|
|
845
|
+
return t && (i.projectId = t), e && (i.keyword = e), this.httpGet("/model-aliases", i);
|
|
846
|
+
}
|
|
847
|
+
async get(t) {
|
|
848
|
+
return this.httpGet("/model-aliases/" + t);
|
|
849
|
+
}
|
|
850
|
+
/** Create an alias. Non-super-admins always create in their own project. */
|
|
851
|
+
async create(t) {
|
|
852
|
+
return this.httpPost("/model-aliases", t);
|
|
853
|
+
}
|
|
854
|
+
/** Change target, fallbacks, defaults and description. `name` and the scope are immutable. */
|
|
855
|
+
async update(t, e) {
|
|
856
|
+
return this.httpPut("/model-aliases/" + t, e);
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Delete an alias. Refused with a 409 while agents still reference it: use
|
|
860
|
+
* {@link ModelAliasesApi.inUse} on the error to read which ones.
|
|
861
|
+
*/
|
|
862
|
+
async remove(t) {
|
|
863
|
+
await this.httpDelete("/model-aliases/" + t);
|
|
864
|
+
}
|
|
865
|
+
/** Agents that reference the alias, and in which model slot. */
|
|
866
|
+
async impact(t) {
|
|
867
|
+
return this.httpGet("/model-aliases/" + t + "/impact");
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Run the health check now (registry, announced retirements, credentials). Stores the
|
|
871
|
+
* result in `health` and updates the notifications; it never changes the alias.
|
|
872
|
+
*/
|
|
873
|
+
async check(t) {
|
|
874
|
+
return this.httpPost("/model-aliases/" + t + "/check");
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Replacement and fallback candidates for the alias' target, or for `model` (e.g. a
|
|
878
|
+
* fallback that went missing). A proposal only: nothing is applied.
|
|
879
|
+
*/
|
|
880
|
+
async suggestions(t, e, s) {
|
|
881
|
+
const r = {};
|
|
882
|
+
return e && (r.model = e), s !== void 0 && (r.limit = s), this.httpGet("/model-aliases/" + t + "/suggestions", r);
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* The agents blocking a delete, when `error` is the 409 of {@link ModelAliasesApi.remove};
|
|
886
|
+
* `null` for any other error.
|
|
887
|
+
*/
|
|
888
|
+
static inUse(t) {
|
|
889
|
+
var e, s;
|
|
890
|
+
if (!(t instanceof l) || t.statusCode !== 409) return null;
|
|
891
|
+
try {
|
|
892
|
+
const r = (s = (e = JSON.parse(t.body)) == null ? void 0 : e.detail) == null ? void 0 : s.impact;
|
|
893
|
+
return r && typeof r.total == "number" ? r : null;
|
|
894
|
+
} catch {
|
|
895
|
+
return null;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
class N extends c {
|
|
900
|
+
constructor(t, e) {
|
|
901
|
+
super(t, e);
|
|
902
|
+
}
|
|
903
|
+
async list(t = {}) {
|
|
904
|
+
const { page: e, size: s } = this.normalizePageParams(t.page, t.size), r = { page: e, size: s };
|
|
905
|
+
return t.unreadOnly && (r.unreadOnly = !0), t.includeResolved && (r.includeResolved = !0), t.projectId && (r.projectId = t.projectId), this.httpGet("/notifications", r);
|
|
906
|
+
}
|
|
907
|
+
/** Open, unread notifications: the value of the badge. */
|
|
908
|
+
async unreadCount(t) {
|
|
909
|
+
return (await this.httpGet(
|
|
910
|
+
"/notifications/unread-count",
|
|
911
|
+
t ? { projectId: t } : void 0
|
|
912
|
+
)).count;
|
|
913
|
+
}
|
|
914
|
+
async markRead(t) {
|
|
915
|
+
return this.httpPost("/notifications/" + t + "/read");
|
|
916
|
+
}
|
|
917
|
+
/** Mark as read everything the caller can see. */
|
|
918
|
+
async markAllRead(t) {
|
|
919
|
+
await this.httpPost("/notifications/read-all", void 0, t ? { projectId: t } : void 0);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
class _ {
|
|
923
|
+
constructor(t, e, s) {
|
|
924
|
+
h(this, "baseUrl");
|
|
925
|
+
h(this, "workflowsBaseUrl");
|
|
926
|
+
h(this, "billingBaseUrl");
|
|
927
|
+
this.baseUrl = t, this.workflowsBaseUrl = e, this.billingBaseUrl = s || "https://persona.applica.guru/billing";
|
|
800
928
|
}
|
|
801
929
|
projects(t) {
|
|
802
|
-
return new
|
|
930
|
+
return new f(this.baseUrl, t, this.billingBaseUrl);
|
|
803
931
|
}
|
|
804
932
|
agents(t) {
|
|
805
|
-
return new
|
|
933
|
+
return new b(this.baseUrl, t);
|
|
806
934
|
}
|
|
807
935
|
knowledgeBases(t) {
|
|
808
|
-
return new
|
|
936
|
+
return new k(this.baseUrl, t);
|
|
809
937
|
}
|
|
810
938
|
workflows(t) {
|
|
811
|
-
return new
|
|
939
|
+
return new x(this.workflowsBaseUrl, t);
|
|
812
940
|
}
|
|
813
941
|
credentials(t) {
|
|
814
|
-
return new
|
|
942
|
+
return new S(this.baseUrl, t);
|
|
815
943
|
}
|
|
816
944
|
features(t) {
|
|
817
|
-
return new
|
|
945
|
+
return new A(this.baseUrl, t);
|
|
818
946
|
}
|
|
819
947
|
triggers(t) {
|
|
820
|
-
return new
|
|
948
|
+
return new R(this.baseUrl, t);
|
|
821
949
|
}
|
|
822
950
|
servicePrices(t) {
|
|
823
|
-
return new
|
|
951
|
+
return new I(this.baseUrl, t);
|
|
824
952
|
}
|
|
825
953
|
markupRules(t) {
|
|
826
|
-
return new
|
|
954
|
+
return new E(this.baseUrl, t);
|
|
827
955
|
}
|
|
828
956
|
providers(t) {
|
|
829
|
-
return new
|
|
957
|
+
return new B(this.baseUrl, t);
|
|
830
958
|
}
|
|
831
959
|
sessions(t) {
|
|
832
|
-
return new
|
|
960
|
+
return new j(this.baseUrl, t);
|
|
833
961
|
}
|
|
834
962
|
missions(t) {
|
|
835
|
-
return new
|
|
963
|
+
return new q(this.baseUrl, t);
|
|
836
964
|
}
|
|
837
965
|
billing(t) {
|
|
838
|
-
return new
|
|
966
|
+
return new O(this.billingBaseUrl, t);
|
|
967
|
+
}
|
|
968
|
+
modelAliases(t) {
|
|
969
|
+
return new H(this.baseUrl, t);
|
|
970
|
+
}
|
|
971
|
+
notifications(t) {
|
|
972
|
+
return new N(this.baseUrl, t);
|
|
839
973
|
}
|
|
840
974
|
values(t) {
|
|
841
|
-
return new
|
|
975
|
+
return new D(this.baseUrl, t);
|
|
842
976
|
}
|
|
843
977
|
}
|
|
844
|
-
class
|
|
978
|
+
class L {
|
|
845
979
|
constructor(t) {
|
|
846
980
|
this.token = t;
|
|
847
981
|
}
|
|
@@ -852,29 +986,48 @@ class D {
|
|
|
852
986
|
return this.token;
|
|
853
987
|
}
|
|
854
988
|
}
|
|
989
|
+
const g = "alias:";
|
|
990
|
+
function M(o) {
|
|
991
|
+
return !!o && o.trim().toLowerCase().startsWith(g);
|
|
992
|
+
}
|
|
993
|
+
function $(o) {
|
|
994
|
+
if (!M(o))
|
|
995
|
+
throw new Error(`Not a model alias reference: ${JSON.stringify(o)}`);
|
|
996
|
+
return o.trim().slice(g.length).trim();
|
|
997
|
+
}
|
|
998
|
+
function F(o) {
|
|
999
|
+
return g + o.trim();
|
|
1000
|
+
}
|
|
855
1001
|
export {
|
|
856
|
-
|
|
1002
|
+
g as ALIAS_PREFIX,
|
|
1003
|
+
b as AgentsApi,
|
|
857
1004
|
l as ApiException,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
v as
|
|
867
|
-
|
|
868
|
-
E as
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
j as
|
|
877
|
-
|
|
878
|
-
|
|
1005
|
+
w as ApiKeyAuthenticationProvider,
|
|
1006
|
+
L as BearerTokenAuthenticationProvider,
|
|
1007
|
+
O as BillingClient,
|
|
1008
|
+
U as ChannelsApi,
|
|
1009
|
+
S as CredentialsApi,
|
|
1010
|
+
T as FeatureTemplatesApi,
|
|
1011
|
+
A as FeaturesApi,
|
|
1012
|
+
z as HumanTasksApi,
|
|
1013
|
+
v as KnowledgeBaseDocumentsApi,
|
|
1014
|
+
k as KnowledgeBasesApi,
|
|
1015
|
+
E as MarkupRulesApi,
|
|
1016
|
+
q as MissionsApi,
|
|
1017
|
+
H as ModelAliasesApi,
|
|
1018
|
+
N as NotificationsApi,
|
|
1019
|
+
_ as PersonaSdk,
|
|
1020
|
+
f as ProjectsApi,
|
|
1021
|
+
B as ProvidersApi,
|
|
1022
|
+
I as ServicePricesApi,
|
|
1023
|
+
j as SessionsApi,
|
|
1024
|
+
C as TriggerExecutionsApi,
|
|
1025
|
+
R as TriggersApi,
|
|
1026
|
+
D as ValuesApi,
|
|
1027
|
+
G as WorkflowExecutionsApi,
|
|
1028
|
+
x as WorkflowsApi,
|
|
1029
|
+
$ as aliasNameFromRef,
|
|
1030
|
+
F as aliasRef,
|
|
1031
|
+
M as isAliasRef
|
|
879
1032
|
};
|
|
880
1033
|
//# sourceMappingURL=bundle.es.js.map
|