@arbidocs/sdk 0.5.58 → 0.5.59
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 +27 -5
- package/dist/{browser-BX1E63gK.d.ts → browser-H9ziI77P.d.ts} +2 -0
- package/dist/{browser-ENBx11nT.d.cts → browser-wtQhRmpE.d.cts} +2 -0
- package/dist/browser.cjs +1 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/examples/node-response.mjs +36 -0
- package/package.json +4 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Install @arbidocs/sdk, then set the variables below and run with Node 22+.
|
|
2
|
+
// No IndexedDB polyfill is needed. Credentials stay in this process's memory.
|
|
3
|
+
import { Arbi } from '@arbidocs/sdk'
|
|
4
|
+
|
|
5
|
+
const { ARBI_URL, ARBI_EMAIL, ARBI_PASSWORD, ARBI_WORKSPACE_ID, ARBI_QUESTION } = process.env
|
|
6
|
+
if (!ARBI_URL || !ARBI_EMAIL || !ARBI_PASSWORD || !ARBI_WORKSPACE_ID) {
|
|
7
|
+
throw new Error('Set ARBI_URL, ARBI_EMAIL, ARBI_PASSWORD and ARBI_WORKSPACE_ID.')
|
|
8
|
+
}
|
|
9
|
+
const arbi = new Arbi({ url: ARBI_URL })
|
|
10
|
+
await arbi.login(ARBI_EMAIL, ARBI_PASSWORD)
|
|
11
|
+
// An explicit choice: subsequent operations use this current workspace.
|
|
12
|
+
await arbi.selectWorkspace(ARBI_WORKSPACE_ID)
|
|
13
|
+
const started = await arbi.assistant.startResponse({
|
|
14
|
+
question: ARBI_QUESTION ?? 'What can you help me with?',
|
|
15
|
+
docIds: [],
|
|
16
|
+
})
|
|
17
|
+
if (started.kind === 'acknowledged') {
|
|
18
|
+
console.log('Control request acknowledged.')
|
|
19
|
+
} else {
|
|
20
|
+
const { handle } = started
|
|
21
|
+
const abort = () => handle.detach() // closes this reader; does not cancel server execution
|
|
22
|
+
process.once('SIGINT', abort)
|
|
23
|
+
try {
|
|
24
|
+
const outcome = await handle.outcome
|
|
25
|
+
console.log(handle.snapshot().displayText)
|
|
26
|
+
console.log(`Response ${handle.id}: ${outcome.status}`)
|
|
27
|
+
if (outcome.status === 'disconnected') {
|
|
28
|
+
// Reconcile the accepted response; never blindly submit the same question again.
|
|
29
|
+
const stored = await arbi.assistant.getResponse(handle.id)
|
|
30
|
+
console.log(`Stored status: ${stored.status}`)
|
|
31
|
+
}
|
|
32
|
+
} finally {
|
|
33
|
+
process.removeListener('SIGINT', abort)
|
|
34
|
+
handle.detach()
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.59",
|
|
4
4
|
"description": "Shared operations layer for ARBI — auth, config, SSE, WebSocket, and API operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
-
"dist"
|
|
38
|
+
"dist",
|
|
39
|
+
"examples"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
42
|
"build": "tsup",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"typecheck": "tsc --noEmit"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@arbidocs/client": "0.5.
|
|
48
|
+
"@arbidocs/client": "0.5.59",
|
|
48
49
|
"jszip": "^3.10.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|