@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/dist/index.cjs
CHANGED
|
@@ -5181,6 +5181,158 @@ function buildChunkLookup(tools) {
|
|
|
5181
5181
|
return lookup;
|
|
5182
5182
|
}
|
|
5183
5183
|
|
|
5184
|
+
// src/diagnostics.ts
|
|
5185
|
+
async function diagnoseSetup(options) {
|
|
5186
|
+
const checks = [];
|
|
5187
|
+
const add = (check, status, message, hint) => checks.push({ check, status, message, ...hint ? { hint } : {} });
|
|
5188
|
+
let base;
|
|
5189
|
+
try {
|
|
5190
|
+
base = new URL(options.url);
|
|
5191
|
+
if (!["http:", "https:"].includes(base.protocol) || base.username || base.password || base.search || base.hash)
|
|
5192
|
+
throw new Error("Invalid API URL");
|
|
5193
|
+
} catch {
|
|
5194
|
+
add(
|
|
5195
|
+
"connection",
|
|
5196
|
+
"error",
|
|
5197
|
+
"Invalid API URL.",
|
|
5198
|
+
"Use an absolute HTTP(S) API URL without credentials, query or fragment."
|
|
5199
|
+
);
|
|
5200
|
+
return { ok: false, checks };
|
|
5201
|
+
}
|
|
5202
|
+
const request = (path5, authenticated = false) => (options.fetch ?? globalThis.fetch)(`${base.href.replace(/\/$/, "")}${path5}`, {
|
|
5203
|
+
method: "GET",
|
|
5204
|
+
credentials: "omit",
|
|
5205
|
+
redirect: "error",
|
|
5206
|
+
cache: "no-store",
|
|
5207
|
+
headers: authenticated && options.accessToken ? { Authorization: `Bearer ${options.accessToken}` } : {},
|
|
5208
|
+
signal: AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
5209
|
+
});
|
|
5210
|
+
try {
|
|
5211
|
+
const config = await request("/config.json");
|
|
5212
|
+
if (!config.ok) {
|
|
5213
|
+
add(
|
|
5214
|
+
"connection",
|
|
5215
|
+
"error",
|
|
5216
|
+
`Deployment configuration returned HTTP ${config.status}.`,
|
|
5217
|
+
"Check the API base URL and proxy routing."
|
|
5218
|
+
);
|
|
5219
|
+
} else {
|
|
5220
|
+
const body = await config.json();
|
|
5221
|
+
add("connection", "ok", "Deployment configuration is reachable.");
|
|
5222
|
+
const domain = body?.deployment?.domain;
|
|
5223
|
+
if (typeof domain !== "string" || !domain) {
|
|
5224
|
+
add(
|
|
5225
|
+
"deployment",
|
|
5226
|
+
"warning",
|
|
5227
|
+
"The deployment did not advertise its key-derivation domain.",
|
|
5228
|
+
"Confirm deploymentDomain with the deployment owner, especially when using a proxy."
|
|
5229
|
+
);
|
|
5230
|
+
} else if (domain !== (options.deploymentDomain ?? base.hostname)) {
|
|
5231
|
+
add(
|
|
5232
|
+
"deployment",
|
|
5233
|
+
"error",
|
|
5234
|
+
"The configured key-derivation domain differs from the deployment.",
|
|
5235
|
+
"Set deploymentDomain to the deployment\u2019s domain; a proxy hostname is not the key-derivation domain."
|
|
5236
|
+
);
|
|
5237
|
+
} else add("deployment", "ok", "The key-derivation domain matches the deployment.");
|
|
5238
|
+
}
|
|
5239
|
+
} catch {
|
|
5240
|
+
add(
|
|
5241
|
+
"connection",
|
|
5242
|
+
"error",
|
|
5243
|
+
"Could not read deployment configuration.",
|
|
5244
|
+
"Check DNS, TLS, proxy routing and connectivity. In a browser, inspect DevTools for CORS, mixed-content or private-network denial; fetch alone cannot distinguish them."
|
|
5245
|
+
);
|
|
5246
|
+
}
|
|
5247
|
+
if (!options.accessToken) {
|
|
5248
|
+
add(
|
|
5249
|
+
"authentication",
|
|
5250
|
+
"warning",
|
|
5251
|
+
"No live session token is available.",
|
|
5252
|
+
"Sign in explicitly when online. An offline-unlocked identity is not a verified server session."
|
|
5253
|
+
);
|
|
5254
|
+
add("workspace", "skipped", "Workspace access was not checked.");
|
|
5255
|
+
add("permissions", "skipped", "Permissions were not checked.");
|
|
5256
|
+
} else {
|
|
5257
|
+
let authenticated = false;
|
|
5258
|
+
try {
|
|
5259
|
+
const user = await request("/v1/user/me", true);
|
|
5260
|
+
if (!user.ok) {
|
|
5261
|
+
add(
|
|
5262
|
+
"authentication",
|
|
5263
|
+
"error",
|
|
5264
|
+
`Session check returned HTTP ${user.status}.`,
|
|
5265
|
+
user.status === 401 ? "Sign in explicitly to renew the session." : "Check deployment access and account permissions."
|
|
5266
|
+
);
|
|
5267
|
+
add("workspace", "skipped", "Workspace access was not checked.");
|
|
5268
|
+
add("permissions", "skipped", "Permissions were not checked.");
|
|
5269
|
+
} else {
|
|
5270
|
+
const profile = await user.json();
|
|
5271
|
+
authenticated = true;
|
|
5272
|
+
add("authentication", "ok", "The server accepts the current session.");
|
|
5273
|
+
if (!options.workspaceId) {
|
|
5274
|
+
add(
|
|
5275
|
+
"workspace",
|
|
5276
|
+
"warning",
|
|
5277
|
+
"No current workspace is selected.",
|
|
5278
|
+
"Choose a workspace explicitly before reading documents or starting work."
|
|
5279
|
+
);
|
|
5280
|
+
add("permissions", "skipped", "Select a workspace to check membership.");
|
|
5281
|
+
} else {
|
|
5282
|
+
const response = await request("/v1/user/workspaces", true);
|
|
5283
|
+
if (!response.ok) {
|
|
5284
|
+
add(
|
|
5285
|
+
"workspace",
|
|
5286
|
+
"error",
|
|
5287
|
+
`Workspace membership check returned HTTP ${response.status}.`,
|
|
5288
|
+
"Check current account access; diagnosis does not switch workspaces or grant access."
|
|
5289
|
+
);
|
|
5290
|
+
add("permissions", "skipped", "Membership could not be verified.");
|
|
5291
|
+
} else {
|
|
5292
|
+
const workspaces = await response.json();
|
|
5293
|
+
const workspace = Array.isArray(workspaces) ? workspaces.find((w2) => w2.external_id === options.workspaceId) : void 0;
|
|
5294
|
+
if (!workspace) {
|
|
5295
|
+
add(
|
|
5296
|
+
"workspace",
|
|
5297
|
+
"error",
|
|
5298
|
+
"The selected workspace is not in this account\u2019s workspace list.",
|
|
5299
|
+
"Choose an accessible workspace explicitly. Project visibility does not imply workspace access."
|
|
5300
|
+
);
|
|
5301
|
+
add("permissions", "skipped", "Workspace permissions could not be verified.");
|
|
5302
|
+
} else {
|
|
5303
|
+
add(
|
|
5304
|
+
"workspace",
|
|
5305
|
+
"ok",
|
|
5306
|
+
"The selected workspace appears in the account\u2019s workspace list."
|
|
5307
|
+
);
|
|
5308
|
+
const member = workspace.users?.find(
|
|
5309
|
+
(entry) => entry.user?.external_id === profile.external_id
|
|
5310
|
+
);
|
|
5311
|
+
const role = ["owner", "collaborator", "guest"].includes(member?.role) ? member.role : null;
|
|
5312
|
+
add(
|
|
5313
|
+
"permissions",
|
|
5314
|
+
role ? "ok" : "warning",
|
|
5315
|
+
role ? `Workspace membership role: ${role}.` : "No direct membership role was reported.",
|
|
5316
|
+
"This is a membership check, not proof of a live workspace key or authorization for an agent task. Temporary grants, expiry and execution permissions remain enforced by the API."
|
|
5317
|
+
);
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
} catch {
|
|
5323
|
+
add(
|
|
5324
|
+
authenticated ? "workspace" : "authentication",
|
|
5325
|
+
"error",
|
|
5326
|
+
authenticated ? "The workspace membership check could not finish." : "The session check could not finish.",
|
|
5327
|
+
"Check connectivity and browser network policy. No login, workspace switch or grant was attempted."
|
|
5328
|
+
);
|
|
5329
|
+
if (authenticated)
|
|
5330
|
+
add("permissions", "skipped", "Workspace membership could not be verified.");
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
return { ok: checks.every((c2) => c2.status === "ok"), checks };
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5184
5336
|
// src/operations/responses.ts
|
|
5185
5337
|
var responses_exports = {};
|
|
5186
5338
|
__export(responses_exports, {
|
|
@@ -12127,6 +12279,15 @@ var Arbi = class {
|
|
|
12127
12279
|
get session() {
|
|
12128
12280
|
return this.client?.session ?? null;
|
|
12129
12281
|
}
|
|
12282
|
+
/** Read-only setup checks; never signs in, opens a workspace or grants access. */
|
|
12283
|
+
diagnose() {
|
|
12284
|
+
return diagnoseSetup({
|
|
12285
|
+
url: this.options.url,
|
|
12286
|
+
deploymentDomain: this.options.deploymentDomain,
|
|
12287
|
+
accessToken: this.client?.session.getState().accessToken,
|
|
12288
|
+
workspaceId: this.currentWorkspaceId
|
|
12289
|
+
});
|
|
12290
|
+
}
|
|
12130
12291
|
/** Get the underlying ArbiClient (throws if not initialized). */
|
|
12131
12292
|
getClient() {
|
|
12132
12293
|
return this.requireClient();
|
|
@@ -15766,6 +15927,7 @@ exports.createIndexAssigner = createIndexAssigner;
|
|
|
15766
15927
|
exports.databases = databases_exports;
|
|
15767
15928
|
exports.defaultKindForFormat = defaultKindForFormat;
|
|
15768
15929
|
exports.deviceFlow = device_flow_exports;
|
|
15930
|
+
exports.diagnoseSetup = diagnoseSetup;
|
|
15769
15931
|
exports.doctags = doctags_exports;
|
|
15770
15932
|
exports.documentTools = documentTools;
|
|
15771
15933
|
exports.documents = documents_exports;
|