@docbrasil/api-systemmanager 1.1.82 → 1.1.83
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/api/ai/index.js +2 -2
- package/api/ai/sessions.js +8 -5
- package/api/dispatch.js +24 -0
- package/dist/bundle.cjs +49 -7
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +23 -0
- package/docs/AISession.html +3 -3
- package/docs/Dispatch.html +271 -0
- package/docs/MyndAI.html +1 -1
- package/docs/ai_index.js.html +2 -2
- package/docs/ai_sessions.js.html +8 -5
- package/docs/dispatch.js.html +24 -0
- package/index.js +15 -0
- package/package.json +1 -1
package/doc/api.md
CHANGED
|
@@ -5403,6 +5403,8 @@ Api dispatch manager
|
|
|
5403
5403
|
* [.errorOffline()](#Dispatch+errorOffline)
|
|
5404
5404
|
* [.getContext(url, [session])](#Dispatch+getContext) ⇒ <code>Promise.<object></code>
|
|
5405
5405
|
* [.getClient()](#Dispatch+getClient) ⇒ <code>AxiosInstance</code>
|
|
5406
|
+
* [.setAkamaiBaseUrl(url)](#Dispatch+setAkamaiBaseUrl)
|
|
5407
|
+
* [.getAkamaiClient()](#Dispatch+getAkamaiClient) ⇒ <code>AxiosInstance</code>
|
|
5406
5408
|
|
|
5407
5409
|
<a name="Dispatch+errorOffline"></a>
|
|
5408
5410
|
|
|
@@ -5432,6 +5434,27 @@ Get the Axios client.
|
|
|
5432
5434
|
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
5433
5435
|
**Returns**: <code>AxiosInstance</code> - The Axios client.
|
|
5434
5436
|
**Access**: public
|
|
5437
|
+
<a name="Dispatch+setAkamaiBaseUrl"></a>
|
|
5438
|
+
|
|
5439
|
+
### dispatch.setAkamaiBaseUrl(url)
|
|
5440
|
+
Create a dedicated Axios client for Akamai routes.
|
|
5441
|
+
|
|
5442
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
5443
|
+
**Access**: public
|
|
5444
|
+
|
|
5445
|
+
| Param | Type | Description |
|
|
5446
|
+
| --- | --- | --- |
|
|
5447
|
+
| url | <code>string</code> | The Akamai base URL (e.g., http://localhost:9008 in DEV). |
|
|
5448
|
+
|
|
5449
|
+
<a name="Dispatch+getAkamaiClient"></a>
|
|
5450
|
+
|
|
5451
|
+
### dispatch.getAkamaiClient() ⇒ <code>AxiosInstance</code>
|
|
5452
|
+
Get the Akamai Axios client. Falls back to the default client
|
|
5453
|
+
for backward compatibility (e.g., PROD where NGiNX proxies all routes).
|
|
5454
|
+
|
|
5455
|
+
**Kind**: instance method of [<code>Dispatch</code>](#Dispatch)
|
|
5456
|
+
**Returns**: <code>AxiosInstance</code> - The Akamai client or default client.
|
|
5457
|
+
**Access**: public
|
|
5435
5458
|
<a name="External"></a>
|
|
5436
5459
|
|
|
5437
5460
|
## External
|
package/docs/AISession.html
CHANGED
|
@@ -495,7 +495,7 @@ Use this to create a session with full metadata before triggering execution.
|
|
|
495
495
|
<p class="tag-source">
|
|
496
496
|
<a href="ai_sessions.js.html" class="button">View Source</a>
|
|
497
497
|
<span>
|
|
498
|
-
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#
|
|
498
|
+
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#line183">line 183</a>
|
|
499
499
|
</span>
|
|
500
500
|
</p>
|
|
501
501
|
|
|
@@ -844,7 +844,7 @@ const retData = await api.ai.sessions.create(params, authorization);</code></pre
|
|
|
844
844
|
<p class="tag-source">
|
|
845
845
|
<a href="ai_sessions.js.html" class="button">View Source</a>
|
|
846
846
|
<span>
|
|
847
|
-
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#
|
|
847
|
+
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#line226">line 226</a>
|
|
848
848
|
</span>
|
|
849
849
|
</p>
|
|
850
850
|
|
|
@@ -1133,7 +1133,7 @@ Returns session, execution, activities, pages, triples and summary.
|
|
|
1133
1133
|
<p class="tag-source">
|
|
1134
1134
|
<a href="ai_sessions.js.html" class="button">View Source</a>
|
|
1135
1135
|
<span>
|
|
1136
|
-
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#
|
|
1136
|
+
<a href="ai_sessions.js.html">ai/sessions.js</a>, <a href="ai_sessions.js.html#line73">line 73</a>
|
|
1137
1137
|
</span>
|
|
1138
1138
|
</p>
|
|
1139
1139
|
|
package/docs/Dispatch.html
CHANGED
|
@@ -314,6 +314,129 @@
|
|
|
314
314
|
|
|
315
315
|
|
|
316
316
|
|
|
317
|
+
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div class="member">
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<h4 class="name" id="getAkamaiClient">
|
|
325
|
+
<a class="href-link" href="#getAkamaiClient">#</a>
|
|
326
|
+
|
|
327
|
+
<span class="code-name">
|
|
328
|
+
|
|
329
|
+
getAkamaiClient<span class="signature">()</span><span class="type-signature"> → {AxiosInstance}</span>
|
|
330
|
+
|
|
331
|
+
</span>
|
|
332
|
+
</h4>
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
<div class="description">
|
|
338
|
+
Get the Akamai Axios client. Falls back to the default client
|
|
339
|
+
for backward compatibility (e.g., PROD where NGiNX proxies all routes).
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
<dl class="details">
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
<p class="tag-source">
|
|
388
|
+
<a href="dispatch.js.html" class="button">View Source</a>
|
|
389
|
+
<span>
|
|
390
|
+
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line222">line 222</a>
|
|
391
|
+
</span>
|
|
392
|
+
</p>
|
|
393
|
+
|
|
394
|
+
</dl>
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
<div class='columns method-parameter'>
|
|
414
|
+
<div class="column is-2"><label>Returns:</label></div>
|
|
415
|
+
<div class="column is-10">
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
<div class="columns">
|
|
420
|
+
|
|
421
|
+
<div class='param-desc column is-7'>The Akamai client or default client.</div>
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
<div class='column is-5 has-text-left'>
|
|
425
|
+
<label>Type: </label>
|
|
426
|
+
|
|
427
|
+
<code class="param-type">AxiosInstance</code>
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
317
440
|
|
|
318
441
|
</div>
|
|
319
442
|
|
|
@@ -673,6 +796,154 @@
|
|
|
673
796
|
|
|
674
797
|
|
|
675
798
|
|
|
799
|
+
|
|
800
|
+
</div>
|
|
801
|
+
|
|
802
|
+
<div class="member">
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
<h4 class="name" id="setAkamaiBaseUrl">
|
|
807
|
+
<a class="href-link" href="#setAkamaiBaseUrl">#</a>
|
|
808
|
+
|
|
809
|
+
<span class="code-name">
|
|
810
|
+
|
|
811
|
+
setAkamaiBaseUrl<span class="signature">(url)</span><span class="type-signature"></span>
|
|
812
|
+
|
|
813
|
+
</span>
|
|
814
|
+
</h4>
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
<div class="description">
|
|
820
|
+
Create a dedicated Axios client for Akamai routes.
|
|
821
|
+
</div>
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
<h5>Parameters:</h5>
|
|
833
|
+
|
|
834
|
+
<div class="table-container">
|
|
835
|
+
<table class="params table">
|
|
836
|
+
<thead>
|
|
837
|
+
<tr>
|
|
838
|
+
|
|
839
|
+
<th>Name</th>
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
<th>Type</th>
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
<th class="last">Description</th>
|
|
849
|
+
</tr>
|
|
850
|
+
</thead>
|
|
851
|
+
|
|
852
|
+
<tbody>
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
<tr class="deep-level-0">
|
|
857
|
+
|
|
858
|
+
<td class="name"><code>url</code></td>
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
<td class="type">
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
<code class="param-type">string</code>
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
</td>
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
<td class="description last">The Akamai base URL (e.g., http://localhost:9008 in DEV).</td>
|
|
875
|
+
</tr>
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
</tbody>
|
|
880
|
+
</table>
|
|
881
|
+
</div>
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
<dl class="details">
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
<p class="tag-source">
|
|
920
|
+
<a href="dispatch.js.html" class="button">View Source</a>
|
|
921
|
+
<span>
|
|
922
|
+
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line207">line 207</a>
|
|
923
|
+
</span>
|
|
924
|
+
</p>
|
|
925
|
+
|
|
926
|
+
</dl>
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
676
947
|
|
|
677
948
|
</div>
|
|
678
949
|
|
package/docs/MyndAI.html
CHANGED
|
@@ -632,7 +632,7 @@
|
|
|
632
632
|
<p class="tag-source">
|
|
633
633
|
<a href="ai_index.js.html" class="button">View Source</a>
|
|
634
634
|
<span>
|
|
635
|
-
<a href="ai_index.js.html">ai/index.js</a>, <a href="ai_index.js.html#
|
|
635
|
+
<a href="ai_index.js.html">ai/index.js</a>, <a href="ai_index.js.html#line87">line 87</a>
|
|
636
636
|
</span>
|
|
637
637
|
</p>
|
|
638
638
|
|
package/docs/ai_index.js.html
CHANGED
|
@@ -102,7 +102,6 @@ class MyndAI {
|
|
|
102
102
|
|
|
103
103
|
const self = this;
|
|
104
104
|
self.parent = options.parent;
|
|
105
|
-
self._client = self.parent.dispatch.getClient();
|
|
106
105
|
|
|
107
106
|
self.sessions = new AISession(options);
|
|
108
107
|
}
|
|
@@ -179,7 +178,8 @@ class MyndAI {
|
|
|
179
178
|
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
180
179
|
Joi.assert(params.prompt, Joi.string().required().error(new Error('Provide a prompt')));
|
|
181
180
|
|
|
182
|
-
const
|
|
181
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
182
|
+
const apiCall = client
|
|
183
183
|
.post('/agents/explain', params, self._setHeader(authorization));
|
|
184
184
|
|
|
185
185
|
return self._returnData(await apiCall);
|
package/docs/ai_sessions.js.html
CHANGED
|
@@ -101,7 +101,6 @@ class AISession {
|
|
|
101
101
|
|
|
102
102
|
const self = this;
|
|
103
103
|
self.parent = options.parent;
|
|
104
|
-
self._client = self.parent.dispatch.getClient();
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
/**
|
|
@@ -165,7 +164,8 @@ class AISession {
|
|
|
165
164
|
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
166
165
|
Joi.assert(params.documentId, Joi.string().required().error(new Error('documentId is required')));
|
|
167
166
|
|
|
168
|
-
const
|
|
167
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
168
|
+
const apiCall = client
|
|
169
169
|
.get(`/agents/session/document/${params.documentId}`, self._setHeader(authorization));
|
|
170
170
|
|
|
171
171
|
return self._returnData(await apiCall);
|
|
@@ -227,7 +227,8 @@ class AISession {
|
|
|
227
227
|
|
|
228
228
|
const { documentId, ...payload } = params;
|
|
229
229
|
|
|
230
|
-
const
|
|
230
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
231
|
+
const apiCall = client
|
|
231
232
|
.patch(`/agents/session/document/${documentId}`, payload, self._setHeader(authorization));
|
|
232
233
|
|
|
233
234
|
return self._returnData(await apiCall);
|
|
@@ -273,7 +274,8 @@ class AISession {
|
|
|
273
274
|
Joi.assert(params, Joi.object().required().error(new Error('params is required')));
|
|
274
275
|
Joi.assert(params.agentType, Joi.string().required().error(new Error('agentType is required')));
|
|
275
276
|
|
|
276
|
-
const
|
|
277
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
278
|
+
const apiCall = client
|
|
277
279
|
.post('/agents/create', params, self._setHeader(authorization));
|
|
278
280
|
|
|
279
281
|
return self._returnData(await apiCall);
|
|
@@ -317,7 +319,8 @@ class AISession {
|
|
|
317
319
|
|
|
318
320
|
const { sessionId, ...payload } = params;
|
|
319
321
|
|
|
320
|
-
const
|
|
322
|
+
const client = self.parent.dispatch.getAkamaiClient();
|
|
323
|
+
const apiCall = client
|
|
321
324
|
.post(`/agents/${sessionId}/execute`, payload, self._setHeader(authorization));
|
|
322
325
|
|
|
323
326
|
return self._returnData(await apiCall);
|
package/docs/dispatch.js.html
CHANGED
|
@@ -285,6 +285,30 @@ class Dispatch {
|
|
|
285
285
|
getClient() {
|
|
286
286
|
return this._client;
|
|
287
287
|
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @description Create a dedicated Axios client for Akamai routes.
|
|
291
|
+
* @param {string} url The Akamai base URL (e.g., http://localhost:9008 in DEV).
|
|
292
|
+
* @public
|
|
293
|
+
*/
|
|
294
|
+
setAkamaiBaseUrl(url) {
|
|
295
|
+
Joi.assert(url, Joi.string().required());
|
|
296
|
+
|
|
297
|
+
this._akamaiClient = Axios.create({
|
|
298
|
+
baseURL: url,
|
|
299
|
+
withCredentials: true
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @description Get the Akamai Axios client. Falls back to the default client
|
|
305
|
+
* for backward compatibility (e.g., PROD where NGiNX proxies all routes).
|
|
306
|
+
* @return {AxiosInstance} The Akamai client or default client.
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
getAkamaiClient() {
|
|
310
|
+
return this._akamaiClient || this._client;
|
|
311
|
+
}
|
|
288
312
|
}
|
|
289
313
|
|
|
290
314
|
export default Dispatch;
|
package/index.js
CHANGED
|
@@ -68,6 +68,7 @@ class API {
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
uri: 'http://localhost:8080',
|
|
71
|
+
akamaiUri: null,
|
|
71
72
|
attemptsRetry: 3,
|
|
72
73
|
httpStatusToRetry: [401],
|
|
73
74
|
debug: {success: true, error: true}
|
|
@@ -83,6 +84,20 @@ class API {
|
|
|
83
84
|
self.admin = new Admin({parent: self});
|
|
84
85
|
self.external = new External({parent: self});
|
|
85
86
|
self.ai = new MyndAI({parent: self});
|
|
87
|
+
|
|
88
|
+
// If akamaiUri was provided in options, configure the Akamai client
|
|
89
|
+
if (self.options.akamaiUri) {
|
|
90
|
+
self.dispatch.setAkamaiBaseUrl(self.options.akamaiUri);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @description Set the Akamai base URL for agent/AI routes.
|
|
96
|
+
* @param {string} url The Akamai base URL.
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
setAkamaiBaseUrl(url) {
|
|
100
|
+
this.dispatch.setAkamaiBaseUrl(url);
|
|
86
101
|
}
|
|
87
102
|
}
|
|
88
103
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docbrasil/api-systemmanager",
|
|
3
3
|
"description": "Module API System Manager",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.83",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
|
|
7
7
|
"doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",
|