@docbrasil/api-systemmanager 1.1.80 → 1.1.82

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.
Files changed (86) hide show
  1. package/api/{ai.js → ai/index.js} +3 -0
  2. package/api/ai/sessions.js +243 -0
  3. package/dist/bundle.cjs +240 -0
  4. package/dist/bundle.mjs +1 -1
  5. package/doc/api.md +202 -47
  6. package/docs/AISession.html +2100 -0
  7. package/docs/Admin.html +1 -1
  8. package/docs/AdminDocuments.html +1 -1
  9. package/docs/AdminForm.html +1 -1
  10. package/docs/AdminLists.html +1 -1
  11. package/docs/AdminMessage.html +1 -1
  12. package/docs/AdminNotification.html +1 -1
  13. package/docs/AdminPlugin.html +1 -1
  14. package/docs/AdminPolicy.html +1 -1
  15. package/docs/AdminProcesses.html +1 -1
  16. package/docs/AdminTask.html +1 -1
  17. package/docs/AdminUser.html +1 -1
  18. package/docs/Application.html +1 -1
  19. package/docs/Chart.html +1 -1
  20. package/docs/Dashboard.html +1 -1
  21. package/docs/Datasource.html +1 -1
  22. package/docs/Dispatch.html +1 -1
  23. package/docs/Documents.html +1 -1
  24. package/docs/External.html +1 -1
  25. package/docs/GeoLocation.html +1 -1
  26. package/docs/Help.html +1 -1
  27. package/docs/Kanban.html +1 -1
  28. package/docs/Login.html +1 -1
  29. package/docs/MyTasks.html +1 -1
  30. package/docs/MyndAI.html +5 -5
  31. package/docs/Notification.html +1 -1
  32. package/docs/Organization.html +1 -1
  33. package/docs/Page.html +1 -1
  34. package/docs/Process.html +1 -1
  35. package/docs/Register.html +1 -1
  36. package/docs/Report.html +1 -1
  37. package/docs/Session.html +1 -1
  38. package/docs/Settings.html +1 -1
  39. package/docs/Task.html +1 -1
  40. package/docs/TaskAvailable.html +1 -1
  41. package/docs/Updates.html +1 -1
  42. package/docs/User.html +1 -1
  43. package/docs/Users.html +1 -1
  44. package/docs/admin_doctypes.js.html +1 -1
  45. package/docs/admin_document.js.html +1 -1
  46. package/docs/admin_form.js.html +1 -1
  47. package/docs/admin_index.js.html +1 -1
  48. package/docs/admin_list.js.html +1 -1
  49. package/docs/admin_message.js.html +1 -1
  50. package/docs/admin_notification.js.html +1 -1
  51. package/docs/admin_organization.js.html +1 -1
  52. package/docs/admin_plugin.js.html +1 -1
  53. package/docs/admin_policy.js.html +1 -1
  54. package/docs/admin_processes.js.html +1 -1
  55. package/docs/admin_task.js.html +1 -1
  56. package/docs/admin_user.js.html +1 -1
  57. package/docs/{ai.js.html → ai_index.js.html} +6 -3
  58. package/docs/ai_sessions.js.html +360 -0
  59. package/docs/dispatch.js.html +1 -1
  60. package/docs/external.js.html +1 -1
  61. package/docs/general_geoLocation.js.html +1 -1
  62. package/docs/general_index.js.html +1 -1
  63. package/docs/index.html +1 -1
  64. package/docs/login.js.html +1 -1
  65. package/docs/session.js.html +1 -1
  66. package/docs/user_application.js.html +1 -1
  67. package/docs/user_dashboard.js.html +1 -1
  68. package/docs/user_datasource.js.html +1 -1
  69. package/docs/user_document.js.html +1 -1
  70. package/docs/user_help.js.html +1 -1
  71. package/docs/user_index.js.html +1 -1
  72. package/docs/user_kanban.js.html +1 -1
  73. package/docs/user_my_tasks.js.html +1 -1
  74. package/docs/user_notification.js.html +1 -1
  75. package/docs/user_organization.js.html +1 -1
  76. package/docs/user_page.js.html +1 -1
  77. package/docs/user_process.js.html +1 -1
  78. package/docs/user_register.js.html +1 -1
  79. package/docs/user_settings.js.html +1 -1
  80. package/docs/user_task.js.html +1 -1
  81. package/docs/user_task_available.js.html +1 -1
  82. package/docs/user_updates.js.html +1 -1
  83. package/docs/user_user.js.html +1 -1
  84. package/docs/utils_promises.js.html +1 -1
  85. package/index.js +1 -1
  86. package/package.json +1 -1
package/doc/api.md CHANGED
@@ -37,6 +37,12 @@
37
37
  <dt><a href="#AdminUser">AdminUser</a></dt>
38
38
  <dd><p>Admin Class for user, permission admin</p>
39
39
  </dd>
40
+ <dt><a href="#MyndAI">MyndAI</a></dt>
41
+ <dd><p>Class using AI</p>
42
+ </dd>
43
+ <dt><a href="#AISession">AISession</a></dt>
44
+ <dd><p>Class for AI Session management</p>
45
+ </dd>
40
46
  <dt><a href="#GeoLocation">GeoLocation</a></dt>
41
47
  <dd><p>General Class for user, permission organization</p>
42
48
  </dd>
@@ -103,9 +109,6 @@
103
109
  <dt><a href="#User">User</a></dt>
104
110
  <dd><p>Class for user, permission user</p>
105
111
  </dd>
106
- <dt><a href="#MyndAI">MyndAI</a></dt>
107
- <dd><p>Class using AI</p>
108
- </dd>
109
112
  <dt><a href="#Dispatch">Dispatch</a></dt>
110
113
  <dd><p>Api dispatch manager</p>
111
114
  </dd>
@@ -1757,6 +1760,202 @@ const params = { orgId: '5edd11c46b6ce9729c2c297c' };
1757
1760
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1758
1761
  const users = await api.admin.user.getOrgUsers(params, session);
1759
1762
  ```
1763
+ <a name="MyndAI"></a>
1764
+
1765
+ ## MyndAI
1766
+ Class using AI
1767
+
1768
+ **Kind**: global class
1769
+ <a name="MyndAI+explain"></a>
1770
+
1771
+ ### myndAI.explain(params) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code> \| <code>number</code>
1772
+ Create new document
1773
+
1774
+ **Kind**: instance method of [<code>MyndAI</code>](#MyndAI)
1775
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success true|false for success<code>object</code> - data.result the result of the AI call<code>string</code> - data.result.response The actual text response according the prompt<code>number</code> - data.result.tokens The quantity of token used in this request
1776
+ **Access**: public
1777
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1778
+
1779
+ | Param | Type | Default | Description |
1780
+ | --- | --- | --- | --- |
1781
+ | params | <code>object</code> | | Object for add new document |
1782
+ | params.model | <code>string</code> | | The model to use for the explain |
1783
+ | params.context | <code>object</code> | | The context to apply to a prompt |
1784
+ | params.text | <code>string</code> | | The text to add to the prompt |
1785
+ | params.medias | <code>array.&lt;object&gt;</code> | | Medias to add (PDF, Image, Video, Audio) |
1786
+ | params.medias.type | <code>string</code> | | can be base64 | document |
1787
+ | params.medias.mime | <code>string</code> | | the mime type of the media |
1788
+ | params.medias.base64 | <code>string</code> | | the base64 of the image (in the case the type is base64) |
1789
+ | params.medias.document | <code>string</code> | | the document path for the image (in the case the type is document) |
1790
+ | params.prompt | <code>string</code> | | The actual prompt with context and text to apply to |
1791
+ | params.json | <code>boolean</code> | <code>false</code> | If we return in json format or not |
1792
+
1793
+ **Example**
1794
+ ```js
1795
+ const API = require('@docbrasil/api-systemmanager');
1796
+ const api = new API();
1797
+ const authorization = '...';
1798
+ const params = {
1799
+ model: 'model-name',
1800
+ context: { name: 'Some name' },
1801
+ text: 'Say hello to the world',
1802
+ medias: ['...'],
1803
+ prompt: 'Write a story about {{name}} with the following theme: {{text}}',
1804
+ };
1805
+ const retData = await api.ai.explain(params, authorization);
1806
+ ```
1807
+ <a name="AISession"></a>
1808
+
1809
+ ## AISession
1810
+ Class for AI Session management
1811
+
1812
+ **Kind**: global class
1813
+
1814
+ * [AISession](#AISession)
1815
+ * [.getByDocument(params, authorization)](#AISession+getByDocument) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code>
1816
+ * [.updateData(params, authorization)](#AISession+updateData) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1817
+ * [.create(params, authorization)](#AISession+create) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code>
1818
+ * [.execute(params, authorization)](#AISession+execute) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code>
1819
+
1820
+ <a name="AISession+getByDocument"></a>
1821
+
1822
+ ### aiSession.getByDocument(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code>
1823
+ Get full session data by document ID.
1824
+ Returns session, execution, activities, pages, triples and summary.
1825
+
1826
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1827
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The full session data<code>object</code> - data.session The session object<code>object</code> - data.execution The latest execution or null<code>array.&lt;object&gt;</code> - data.activities Activity log entries<code>array.&lt;object&gt;</code> - data.pages Extracted page objects<code>array.&lt;object&gt;</code> - data.triples Ontology triple objects<code>object</code> - data.summary Document summary or null
1828
+ **Access**: public
1829
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1830
+
1831
+ | Param | Type | Description |
1832
+ | --- | --- | --- |
1833
+ | params | <code>object</code> | Parameters |
1834
+ | params.documentId | <code>string</code> | The document ID to look up the session for |
1835
+ | authorization | <code>string</code> | Authorization token |
1836
+
1837
+ **Example**
1838
+ ```js
1839
+ const API = require('@docbrasil/api-systemmanager');
1840
+ const api = new API();
1841
+ const authorization = '...';
1842
+ const params = { documentId: 'doc-123' };
1843
+ const retData = await api.ai.sessions.getByDocument(params, authorization);
1844
+ ```
1845
+ <a name="AISession+updateData"></a>
1846
+
1847
+ ### aiSession.updateData(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>array.&lt;object&gt;</code> \| <code>object</code> \| <code>object</code>
1848
+ Update session document data (pages, triples, summary).
1849
+ Used by Scarface to push corrections or enrichments for a document.
1850
+
1851
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1852
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The update results<code>array.&lt;object&gt;</code> - data.pages Page update results [{pageNumber, updated}]<code>object</code> - data.triples Triple insert results {added: number}<code>object</code> - data.summary Applied summary updates
1853
+ **Access**: public
1854
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1855
+
1856
+ | Param | Type | Description |
1857
+ | --- | --- | --- |
1858
+ | params | <code>object</code> | Parameters |
1859
+ | params.documentId | <code>string</code> | The document ID |
1860
+ | [params.pages] | <code>array.&lt;object&gt;</code> | Page updates |
1861
+ | params.pages.pageNumber | <code>number</code> | 1-based page number |
1862
+ | [params.pages.markdown] | <code>string</code> | Updated markdown text |
1863
+ | [params.pages.entities] | <code>array.&lt;object&gt;</code> | Updated entities |
1864
+ | [params.triples] | <code>array.&lt;object&gt;</code> | New triples to add |
1865
+ | params.triples.pageNumber | <code>number</code> | Source page number |
1866
+ | params.triples.subject | <code>string</code> | Subject entity text |
1867
+ | params.triples.predicate | <code>string</code> | Relationship predicate |
1868
+ | params.triples.object | <code>string</code> | Object entity text |
1869
+ | [params.summary] | <code>object</code> | Summary field updates |
1870
+ | [params.summary.documentName] | <code>string</code> | Document name |
1871
+ | [params.summary.entityCount] | <code>number</code> | Total entity count |
1872
+ | [params.summary.tripleCount] | <code>number</code> | Total triple count |
1873
+ | authorization | <code>string</code> | Authorization token |
1874
+
1875
+ **Example**
1876
+ ```js
1877
+ const API = require('@docbrasil/api-systemmanager');
1878
+ const api = new API();
1879
+ const authorization = '...';
1880
+ const params = {
1881
+ documentId: 'doc-123',
1882
+ pages: [
1883
+ { pageNumber: 1, markdown: '# Updated page content' }
1884
+ ],
1885
+ summary: {
1886
+ documentName: 'Patient Report.pdf',
1887
+ entityCount: 42,
1888
+ tripleCount: 15
1889
+ }
1890
+ };
1891
+ const retData = await api.ai.sessions.updateData(params, authorization);
1892
+ ```
1893
+ <a name="AISession+create"></a>
1894
+
1895
+ ### aiSession.create(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code>
1896
+ Create a new agent session.
1897
+ Use this to create a session with full metadata before triggering execution.
1898
+
1899
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1900
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The created session<code>string</code> - data.sessionId The session ID<code>string</code> - data.status The session status
1901
+ **Access**: public
1902
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1903
+
1904
+ | Param | Type | Description |
1905
+ | --- | --- | --- |
1906
+ | params | <code>object</code> | Parameters |
1907
+ | params.agentType | <code>string</code> | The agent type (e.g., 'doc-rlm-ingest') |
1908
+ | [params.config] | <code>object</code> | Agent configuration options |
1909
+ | [params.metadata] | <code>object</code> | Session metadata (documentId, pipelineVariant, analysisMode, etc.) |
1910
+ | authorization | <code>string</code> | Authorization token |
1911
+
1912
+ **Example**
1913
+ ```js
1914
+ const API = require('@docbrasil/api-systemmanager');
1915
+ const api = new API();
1916
+ const authorization = '...';
1917
+ const params = {
1918
+ agentType: 'doc-rlm-ingest',
1919
+ metadata: {
1920
+ documentId: 'doc-123',
1921
+ documentName: 'Patient Report.pdf',
1922
+ pipelineVariant: 'A',
1923
+ analysisMode: 'full'
1924
+ }
1925
+ };
1926
+ const retData = await api.ai.sessions.create(params, authorization);
1927
+ ```
1928
+ <a name="AISession+execute"></a>
1929
+
1930
+ ### aiSession.execute(params, authorization) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>string</code> \| <code>string</code>
1931
+ Start execution on an existing agent session.
1932
+
1933
+ **Kind**: instance method of [<code>AISession</code>](#AISession)
1934
+ **Returns**: <code>Promise.&lt;object&gt;</code> - data The execution data<code>string</code> - data.executionId The execution ID<code>string</code> - data.status The execution status
1935
+ **Access**: public
1936
+ **Author**: Myndware <augusto.pissarra@myndware.com>
1937
+
1938
+ | Param | Type | Description |
1939
+ | --- | --- | --- |
1940
+ | params | <code>object</code> | Parameters |
1941
+ | params.sessionId | <code>string</code> | The session ID to execute |
1942
+ | [params.input] | <code>object</code> | Execution input (documentId, options, etc.) |
1943
+ | authorization | <code>string</code> | Authorization token |
1944
+
1945
+ **Example**
1946
+ ```js
1947
+ const API = require('@docbrasil/api-systemmanager');
1948
+ const api = new API();
1949
+ const authorization = '...';
1950
+ const params = {
1951
+ sessionId: 'session-abc-123',
1952
+ input: {
1953
+ documentId: 'doc-123',
1954
+ options: { pipelineVariant: 'A', analysisMode: 'full' }
1955
+ }
1956
+ };
1957
+ const retData = await api.ai.sessions.execute(params, authorization);
1958
+ ```
1760
1959
  <a name="GeoLocation"></a>
1761
1960
 
1762
1961
  ## GeoLocation
@@ -5193,50 +5392,6 @@ const orgIds: ['616eccaaa9360a05293b10fe'];
5193
5392
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
5194
5393
  const jwtToken = await api.user.getChartTags(orgIds, session);
5195
5394
  ```
5196
- <a name="MyndAI"></a>
5197
-
5198
- ## MyndAI
5199
- Class using AI
5200
-
5201
- **Kind**: global class
5202
- <a name="MyndAI+explain"></a>
5203
-
5204
- ### myndAI.explain(params) ⇒ <code>Promise.&lt;object&gt;</code> \| <code>boolean</code> \| <code>object</code> \| <code>string</code> \| <code>number</code>
5205
- Create new document
5206
-
5207
- **Kind**: instance method of [<code>MyndAI</code>](#MyndAI)
5208
- **Returns**: <code>Promise.&lt;object&gt;</code> - data<code>boolean</code> - data.success true|false for success<code>object</code> - data.result the result of the AI call<code>string</code> - data.result.response The actual text response according the prompt<code>number</code> - data.result.tokens The quantity of token used in this request
5209
- **Access**: public
5210
- **Author**: Myndware <augusto.pissarra@myndware.com>
5211
-
5212
- | Param | Type | Default | Description |
5213
- | --- | --- | --- | --- |
5214
- | params | <code>object</code> | | Object for add new document |
5215
- | params.model | <code>string</code> | | The model to use for the explain |
5216
- | params.context | <code>object</code> | | The context to apply to a prompt |
5217
- | params.text | <code>string</code> | | The text to add to the prompt |
5218
- | params.medias | <code>array.&lt;object&gt;</code> | | Medias to add (PDF, Image, Video, Audio) |
5219
- | params.medias.type | <code>string</code> | | can be base64 | document |
5220
- | params.medias.mime | <code>string</code> | | the mime type of the media |
5221
- | params.medias.base64 | <code>string</code> | | the base64 of the image (in the case the type is base64) |
5222
- | params.medias.document | <code>string</code> | | the document path for the image (in the case the type is document) |
5223
- | params.prompt | <code>string</code> | | The actual prompt with context and text to apply to |
5224
- | params.json | <code>boolean</code> | <code>false</code> | If we return in json format or not |
5225
-
5226
- **Example**
5227
- ```js
5228
- const API = require('@docbrasil/api-systemmanager');
5229
- const api = new API();
5230
- const authorization = '...';
5231
- const params = {
5232
- model: 'model-name',
5233
- context: { name: 'Some name' },
5234
- text: 'Say hello to the world',
5235
- medias: ['...'],
5236
- prompt: 'Write a story about {{name}} with the following theme: {{text}}',
5237
- };
5238
- const retData = await api.ai.explain(params, authorization);
5239
- ```
5240
5395
  <a name="Dispatch"></a>
5241
5396
 
5242
5397
  ## Dispatch