@arbidocs/client 0.4.167 → 0.4.168
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 +17 -1
- package/dist/index.cjs +566 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +367 -97
- package/dist/index.d.ts +367 -97
- package/dist/index.js +558 -185
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -190,11 +190,21 @@ interface ArbiClientOptions {
|
|
|
190
190
|
baseUrl: string // ARBI API URL (e.g. "https://www.arbidocs.com")
|
|
191
191
|
deploymentDomain: string // Used for deterministic key derivation
|
|
192
192
|
credentials?: RequestCredentials // Default: 'include'. Use 'omit' for Node.js
|
|
193
|
-
|
|
193
|
+
session?: SessionManager // The host's session state; default: in-memory
|
|
194
|
+
persistence?: SessionPersistence // Keys between page loads; default: encrypted IndexedDB
|
|
195
|
+
sso?: SsoTokenSource | null // The SSO provider's token, asked only in SSO mode
|
|
196
|
+
middleware?: Middleware[] // Host middleware, run before the re-login middleware
|
|
197
|
+
reloginExcludePatterns?: string[] // Paths whose 401 never re-logs in
|
|
194
198
|
onReloginSuccess?: (data) => void
|
|
199
|
+
onRetryCloneFailed?: () => void
|
|
195
200
|
}
|
|
196
201
|
```
|
|
197
202
|
|
|
203
|
+
The client owns the session recovery: a 401 re-logs in once for every request that failed
|
|
204
|
+
(single-flight, a 5s cooldown), a 400 "No active workspace" re-opens the workspace, and a re-login
|
|
205
|
+
the server refused ends the session (`session.clear()`, then `auth.onSessionExpired` listeners). A
|
|
206
|
+
login still finishing or an unreachable server leaves the session alone.
|
|
207
|
+
|
|
198
208
|
Returns an `ArbiClient` with these namespaces:
|
|
199
209
|
|
|
200
210
|
| Namespace | Description |
|
|
@@ -225,6 +235,12 @@ await arbi.auth.logout()
|
|
|
225
235
|
|
|
226
236
|
// Re-login using stored private key (auto-called by middleware on 401)
|
|
227
237
|
await arbi.auth.relogin()
|
|
238
|
+
|
|
239
|
+
// "The session could not be recovered": show the sign-in screen
|
|
240
|
+
const off = arbi.auth.onSessionExpired(() => showSignIn())
|
|
241
|
+
|
|
242
|
+
// Seal every workspace key to this server session (before deriving an MCP session from it)
|
|
243
|
+
await arbi.auth.openAllWorkspaces()
|
|
228
244
|
```
|
|
229
245
|
|
|
230
246
|
### Middleware (Auto-Applied)
|