@arbidocs/sdk 0.5.72 → 0.5.74
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 +16 -0
- package/dist/{browser-Bf6pRBuP.d.ts → browser-CJ8FI-q-.d.ts} +28 -3
- package/dist/{browser-CA2ecqVP.d.cts → browser-Cy6Noci7.d.cts} +28 -3
- package/dist/browser.cjs +162 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +162 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +162 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +162 -1
- package/dist/index.js.map +1 -1
- package/docs/getting-started.md +12 -0
- package/docs/setup-diagnostics.md +49 -0
- package/examples/human-review/.env.example +7 -0
- package/examples/human-review/README.md +31 -0
- package/examples/human-review/gitignore +2 -0
- package/examples/human-review/index.mjs +83 -0
- package/examples/human-review/package.json +14 -0
- package/examples/react-chat/.env.example +3 -0
- package/examples/react-chat/package.json +3 -5
- package/examples/react-chat/src/App.tsx +2 -2
- package/examples/react-chat/src/styles.css +2 -5
- package/examples/react-chat/vite.config.ts +1 -2
- package/package.json +2 -2
package/docs/getting-started.md
CHANGED
|
@@ -159,3 +159,15 @@ For host integration, use the connected widget described above.
|
|
|
159
159
|
|
|
160
160
|
See the [compatibility table](compatibility.md) before moving an existing OpenAI, Vercel or Claude
|
|
161
161
|
integration. Familiar methods do not imply that every provider's fields or tool protocol are supported.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
## Troubleshooting and human review
|
|
165
|
+
|
|
166
|
+
Use `await arbi.diagnose()` or `arbi doctor --json` before changing configuration. See
|
|
167
|
+
[setup-diagnostics.md](./setup-diagnostics.md) for browser network limitations and workspace checks.
|
|
168
|
+
The package also includes `examples/human-review`: an explicit approve/send-back example that
|
|
169
|
+
keeps the existing `con-` conversation and resumes it across separate invocations.
|
|
170
|
+
|
|
171
|
+
The React starter uses one `@arbidocs/blocks/styles.css` import and ordinary Vite; no Tailwind
|
|
172
|
+
plugin or application stylesheet is required. Customize the Blocks theme tokens and component
|
|
173
|
+
props when desired, starting from the supplied defaults.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Diagnose setup without changing it
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
const report = await arbi.diagnose()
|
|
5
|
+
for (const check of report.checks) {
|
|
6
|
+
console.log(check.check, check.status, check.message, check.hint ?? '')
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
In the CLI, use `arbi doctor` or `arbi doctor --json`. A nonzero exit means at least one check
|
|
11
|
+
needs attention. Doctor reads existing configuration and the cached token; it never silently
|
|
12
|
+
logs in to make the report green. Without a configured deployment, configure the CLI first.
|
|
13
|
+
|
|
14
|
+
Checks cover deployment reachability, the deployment domain used to derive identity keys,
|
|
15
|
+
acceptance of the current session, explicit current-workspace selection and its membership role.
|
|
16
|
+
A proxy may have a different hostname: keep `deploymentDomain` set to the actual deployment's
|
|
17
|
+
domain. A workspace appearing in a list is not proof that its encryption key is currently open,
|
|
18
|
+
or that an agent may execute a task. Temporary grants, expiry and task authorization remain
|
|
19
|
+
separate and enforced by the existing API. Project visibility does not confer workspace access.
|
|
20
|
+
|
|
21
|
+
The function uses raw GET requests. It bypasses the authenticated client's login/retry middleware,
|
|
22
|
+
never opens a workspace and never creates an authorization grant or starts a task. An offline
|
|
23
|
+
unlock without a live token is reported as unverified; diagnosis does not clear the offline identity.
|
|
24
|
+
|
|
25
|
+
Hosts can run the same checks from an existing session, including behind a same-origin proxy:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { diagnoseSetup } from '@arbidocs/sdk/browser'
|
|
29
|
+
const report = await diagnoseSetup({
|
|
30
|
+
url: window.location.origin,
|
|
31
|
+
deploymentDomain: 'your-deployment.example',
|
|
32
|
+
accessToken: session.getState().accessToken,
|
|
33
|
+
workspaceId: session.getState().selectedWorkspaceId,
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
An optional raw `fetch` adapter and `timeoutMs` support hosts and tests. Do not pass a fetch adapter
|
|
38
|
+
that automatically logs in, selects workspaces or grants access. Requests use omitted cookie
|
|
39
|
+
credentials, explicit Bearer authentication only on API checks, and reject redirects.
|
|
40
|
+
|
|
41
|
+
Reports contain fixed messages, HTTP status codes and recognized membership roles. They omit
|
|
42
|
+
credentials, account identities, workspace names, keys, document content and raw server errors.
|
|
43
|
+
They are not telemetry and are not sent anywhere automatically.
|
|
44
|
+
|
|
45
|
+
A browser's `Failed to fetch` cannot reliably distinguish CORS, DNS, TLS, mixed-content and
|
|
46
|
+
private-network denial. The diagnostic points to DevTools instead of claiming a cause it cannot
|
|
47
|
+
observe. Test from the actual browser origin: a successful CLI request does not prove browser
|
|
48
|
+
network policy is satisfied. Configure allowed origins or an appropriate same-origin proxy on
|
|
49
|
+
your deployment; do not disable browser security.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ARBI_URL=https://your-arbi-deployment.example
|
|
2
|
+
ARBI_EMAIL=you@example.com
|
|
3
|
+
ARBI_PASSWORD=replace-locally
|
|
4
|
+
ARBI_WORKSPACE_ID=wrk-replace
|
|
5
|
+
|
|
6
|
+
# Optional when using a proxy: the real deployment hostname used for identity keys.
|
|
7
|
+
# ARBI_DEPLOYMENT_DOMAIN=your-arbi-deployment.example
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Human review with an existing workflow conversation
|
|
2
|
+
|
|
3
|
+
Use Node 22.13+. Run `npm install`, copy `.env.example` to `.env`, and set your account and
|
|
4
|
+
an explicitly chosen workspace. These credentials stay on your machine; this is a Node example.
|
|
5
|
+
Optional `ARBI_DEPLOYMENT_DOMAIN` identifies the real deployment when its API is behind a proxy.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm start -- start
|
|
9
|
+
npm start -- status con-ID
|
|
10
|
+
# Wait until draft is done and review is ready. Read the actual draft above.
|
|
11
|
+
npm start -- send-back con-ID "Make the tone warmer"
|
|
12
|
+
npm start -- status con-ID
|
|
13
|
+
# Review the revised draft, then approve explicitly:
|
|
14
|
+
npm start -- approve con-ID
|
|
15
|
+
npm start -- status con-ID
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Replace `con-ID` with the ID printed by start. Each command can run in a new process: progress
|
|
19
|
+
and revisions live on the server. The same `con-` workflow conversation survives review and
|
|
20
|
+
send-back; each agent answer has its own `msg-` ID. Approval completes the review step using
|
|
21
|
+
the existing API. Sending back reopens the draft and review; it does not create a second run.
|
|
22
|
+
No email is sent and no document is changed by this example.
|
|
23
|
+
|
|
24
|
+
The owner is the reviewer. Existing access checks still apply. `run_now_temp` requests the existing
|
|
25
|
+
per-run authorization mode; it does not create standing agent membership. If the deployment reports
|
|
26
|
+
pending authorization, use its existing explicit authorization flow before proceeding. This example
|
|
27
|
+
never grants access automatically. Unattended execution still needs the platform's existing agent
|
|
28
|
+
identity and permission setup; a browser session alone is not a background worker.
|
|
29
|
+
|
|
30
|
+
For a UI, render `runProgress()` and collect an explicit decision before calling `completeStep()` or
|
|
31
|
+
`sendBackStep()`. Do not automatically approve based on an agent's text.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Arbi, work } from '@arbidocs/sdk'
|
|
2
|
+
|
|
3
|
+
const [command, conversationId, ...words] = process.argv.slice(2)
|
|
4
|
+
if (
|
|
5
|
+
!['start', 'status', 'approve', 'send-back'].includes(command) ||
|
|
6
|
+
(command !== 'start' && !/^con-[\w-]+$/.test(conversationId ?? '')) ||
|
|
7
|
+
(command === 'send-back' && !words.length)
|
|
8
|
+
)
|
|
9
|
+
throw new Error('Use start | status con-ID | approve con-ID | send-back con-ID "revision note"')
|
|
10
|
+
|
|
11
|
+
const { ARBI_URL, ARBI_DEPLOYMENT_DOMAIN, ARBI_EMAIL, ARBI_PASSWORD, ARBI_WORKSPACE_ID } =
|
|
12
|
+
process.env
|
|
13
|
+
if (!ARBI_URL || !ARBI_EMAIL || !ARBI_PASSWORD || !ARBI_WORKSPACE_ID)
|
|
14
|
+
throw new Error('Set ARBI_URL, ARBI_EMAIL, ARBI_PASSWORD and ARBI_WORKSPACE_ID in .env.')
|
|
15
|
+
const arbi = new Arbi({ url: ARBI_URL, deploymentDomain: ARBI_DEPLOYMENT_DOMAIN })
|
|
16
|
+
await arbi.login(ARBI_EMAIL, ARBI_PASSWORD)
|
|
17
|
+
try {
|
|
18
|
+
await arbi.selectWorkspace(ARBI_WORKSPACE_ID)
|
|
19
|
+
if (command === 'start') {
|
|
20
|
+
const run = await arbi.conversations.createWork({
|
|
21
|
+
title: 'Human-reviewed welcome note',
|
|
22
|
+
auth_mode: 'run_now_temp',
|
|
23
|
+
plan: {
|
|
24
|
+
goal: 'Produce a short welcome note approved by its owner.',
|
|
25
|
+
criteria: [],
|
|
26
|
+
documents: [],
|
|
27
|
+
max_passes: 3,
|
|
28
|
+
steps: [
|
|
29
|
+
{
|
|
30
|
+
id: 'draft',
|
|
31
|
+
title: 'Draft',
|
|
32
|
+
kind: 'agent',
|
|
33
|
+
branch: false,
|
|
34
|
+
requires_files: false,
|
|
35
|
+
prompt: 'Draft a two-sentence welcome note for a new colleague. Do not send anything.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'review',
|
|
39
|
+
title: 'Review',
|
|
40
|
+
kind: 'review',
|
|
41
|
+
branch: false,
|
|
42
|
+
requires_files: false,
|
|
43
|
+
assignee: { run_owner: true },
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
console.log(`Created ${run.external_id}. Run: npm start -- status ${run.external_id}`)
|
|
49
|
+
} else {
|
|
50
|
+
// Re-read server state on every invocation. Never create a replacement run to resume.
|
|
51
|
+
const progress = await arbi.conversations.runProgress(conversationId)
|
|
52
|
+
if (command !== 'status') {
|
|
53
|
+
const review = progress.steps.find((step) => step.id === 'review')
|
|
54
|
+
if (review?.phase !== 'ready')
|
|
55
|
+
throw new Error('Review is not ready. Run status and inspect the draft first.')
|
|
56
|
+
if (command === 'approve') await arbi.conversations.completeStep(conversationId, 'review')
|
|
57
|
+
else
|
|
58
|
+
await arbi.conversations.sendBackStep(conversationId, 'review', {
|
|
59
|
+
to: 'draft',
|
|
60
|
+
note: words.join(' '),
|
|
61
|
+
})
|
|
62
|
+
console.log(
|
|
63
|
+
command === 'approve'
|
|
64
|
+
? 'Approved. The existing run continues.'
|
|
65
|
+
: 'Sent back. The draft reruns in the same conversation; review it again when ready.'
|
|
66
|
+
)
|
|
67
|
+
} else {
|
|
68
|
+
for (const step of progress.steps) console.log(`${step.id}: ${step.phase}`)
|
|
69
|
+
const ids = progress.steps.flatMap((step) => (step.responseId ? [step.responseId] : []))
|
|
70
|
+
const answers = await work.getStepAnswers(arbi.getClient(), conversationId, ids)
|
|
71
|
+
for (const [id, text] of Object.entries(answers)) console.log(`\n${id}\n${text}`)
|
|
72
|
+
if (progress.steps.find((step) => step.id === 'review')?.phase === 'ready') {
|
|
73
|
+
console.log(`\nApprove: npm start -- approve ${conversationId}`)
|
|
74
|
+
console.log(`Revise: npm start -- send-back ${conversationId} "Make the tone warmer"`)
|
|
75
|
+
} else
|
|
76
|
+
console.log(
|
|
77
|
+
'Run status again while work is pending; a completed review needs no further decision.'
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} finally {
|
|
82
|
+
await arbi.logout()
|
|
83
|
+
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"preview": "vite preview"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@arbidocs/blocks": "0.5.
|
|
12
|
-
"@arbidocs/react": "0.5.
|
|
11
|
+
"@arbidocs/blocks": "0.5.74",
|
|
12
|
+
"@arbidocs/react": "0.5.74",
|
|
13
13
|
"@tanstack/react-query": "^5.90.5",
|
|
14
14
|
"react": "^19.2.0",
|
|
15
15
|
"react-dom": "^19.2.0"
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"@types/react-dom": "^19.2.2",
|
|
20
20
|
"@vitejs/plugin-react": "^5.1.0",
|
|
21
21
|
"typescript": "^5.9.3",
|
|
22
|
-
"vite": "^7.1.12"
|
|
23
|
-
"@tailwindcss/vite": "^4.1.0",
|
|
24
|
-
"tailwindcss": "^4.1.0"
|
|
22
|
+
"vite": "^7.1.12"
|
|
25
23
|
},
|
|
26
24
|
"engines": {
|
|
27
25
|
"node": ">=22.13.0"
|
|
@@ -3,8 +3,8 @@ const apiUrl = import.meta.env.VITE_ARBI_URL
|
|
|
3
3
|
export function App() {
|
|
4
4
|
if (!apiUrl) return <p>Set VITE_ARBI_URL to your ARBI deployment and restart the app.</p>
|
|
5
5
|
return (
|
|
6
|
-
<main style={{
|
|
7
|
-
<ArbiChat apiUrl={apiUrl} />
|
|
6
|
+
<main style={{ minHeight: '100dvh', display: 'grid', placeItems: 'center', padding: '1rem' }}>
|
|
7
|
+
<ArbiChat apiUrl={apiUrl} deploymentDomain={import.meta.env.VITE_ARBI_DEPLOYMENT_DOMAIN} />
|
|
8
8
|
</main>
|
|
9
9
|
)
|
|
10
10
|
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
@import '@arbidocs/blocks/
|
|
2
|
-
|
|
3
|
-
@import 'tailwindcss';
|
|
4
|
-
@import '@arbidocs/blocks/source.css';
|
|
5
|
-
html, body, #root { height: 100%; margin: 0; }
|
|
1
|
+
@import '@arbidocs/blocks/styles.css';
|
|
2
|
+
html, body, #root { min-height: 100%; margin: 0; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.74",
|
|
4
4
|
"description": "Shared operations layer for ARBI — auth, config, SSE, WebSocket, and API operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typecheck": "tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@arbidocs/client": "0.5.
|
|
49
|
+
"@arbidocs/client": "0.5.74",
|
|
50
50
|
"ajv": "^8.20.0",
|
|
51
51
|
"jszip": "^3.10.1"
|
|
52
52
|
},
|