@arbidocs/sdk 0.5.110 → 0.5.111
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/dist/{browser-B6lX8DjB.d.cts → browser-DfOuJp9A.d.cts} +24 -0
- package/dist/{browser-CBr3cEes.d.ts → browser-DsLJbT3r.d.ts} +24 -0
- package/dist/browser.cjs +58 -4
- 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 +58 -4
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +58 -4
- 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 +58 -4
- package/dist/index.js.map +1 -1
- package/examples/human-review/package.json +1 -1
- package/examples/react-chat/package.json +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4547,7 +4547,7 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4547
4547
|
});
|
|
4548
4548
|
}
|
|
4549
4549
|
const reader = response.body.getReader();
|
|
4550
|
-
const
|
|
4550
|
+
const decoder2 = new TextDecoder("utf-8");
|
|
4551
4551
|
let sseBuffer = "";
|
|
4552
4552
|
let text2 = "";
|
|
4553
4553
|
let assistantMessageExtId = null;
|
|
@@ -4774,7 +4774,7 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4774
4774
|
const { done, value } = chunk2;
|
|
4775
4775
|
if (done) break;
|
|
4776
4776
|
const { events, remaining } = parseSSEEvents(
|
|
4777
|
-
|
|
4777
|
+
decoder2.decode(value, { stream: true }),
|
|
4778
4778
|
sseBuffer
|
|
4779
4779
|
);
|
|
4780
4780
|
sseBuffer = remaining;
|
|
@@ -6290,12 +6290,12 @@ function consumeResponse(response, controller, cancel, options = {}) {
|
|
|
6290
6290
|
if (controller.signal.aborted) abort();
|
|
6291
6291
|
else if (options.id) bind(options.id);
|
|
6292
6292
|
void (async () => {
|
|
6293
|
-
const
|
|
6293
|
+
const decoder2 = new TextDecoder();
|
|
6294
6294
|
const frames = new ResponseEventDecoder();
|
|
6295
6295
|
try {
|
|
6296
6296
|
while (!finished) {
|
|
6297
6297
|
const { value, done } = await reader.read();
|
|
6298
|
-
for (const frame of frames.push(
|
|
6298
|
+
for (const frame of frames.push(decoder2.decode(value, { stream: !done }), done)) {
|
|
6299
6299
|
process2(frame);
|
|
6300
6300
|
if (options.bufferEvents && bound && !finished && !iteratorClosed && queue.length >= 256)
|
|
6301
6301
|
await new Promise((resolve2) => {
|
|
@@ -9574,6 +9574,45 @@ async function cancelSubscription(arbi, projectExtId) {
|
|
|
9574
9574
|
"Failed to cancel the subscription"
|
|
9575
9575
|
);
|
|
9576
9576
|
}
|
|
9577
|
+
var encoder = new TextEncoder();
|
|
9578
|
+
var decoder = new TextDecoder();
|
|
9579
|
+
var seal = (json2, keypair) => client.sealedBoxEncrypt(Uint8Array.from(encoder.encode(json2)), keypair.publicKey);
|
|
9580
|
+
async function listUserDashboards(arbi, keypair) {
|
|
9581
|
+
const rows = requireData(
|
|
9582
|
+
await arbi.fetch.GET("/v1/user/dashboards"),
|
|
9583
|
+
"Failed to load your dashboards"
|
|
9584
|
+
);
|
|
9585
|
+
return rows.map((row) => {
|
|
9586
|
+
let json2 = null;
|
|
9587
|
+
try {
|
|
9588
|
+
json2 = decoder.decode(client.sealedBoxDecrypt(row.ciphertext, keypair.secretKey));
|
|
9589
|
+
} catch {
|
|
9590
|
+
}
|
|
9591
|
+
return { id: row.external_id, json: json2, updatedAt: row.updated_at };
|
|
9592
|
+
});
|
|
9593
|
+
}
|
|
9594
|
+
async function saveUserDashboard(arbi, keypair, dashboard) {
|
|
9595
|
+
const body = { ciphertext: seal(dashboard.json, keypair) };
|
|
9596
|
+
const row = dashboard.id ? requireData(
|
|
9597
|
+
await arbi.fetch.PUT("/v1/user/dashboards/{dashboard_ext_id}", {
|
|
9598
|
+
params: { path: { dashboard_ext_id: dashboard.id } },
|
|
9599
|
+
body
|
|
9600
|
+
}),
|
|
9601
|
+
"Failed to save the dashboard"
|
|
9602
|
+
) : requireData(
|
|
9603
|
+
await arbi.fetch.POST("/v1/user/dashboards", { body }),
|
|
9604
|
+
"Failed to save the dashboard"
|
|
9605
|
+
);
|
|
9606
|
+
return { id: row.external_id, json: dashboard.json, updatedAt: row.updated_at };
|
|
9607
|
+
}
|
|
9608
|
+
async function deleteUserDashboard(arbi, id) {
|
|
9609
|
+
requireOk(
|
|
9610
|
+
await arbi.fetch.DELETE("/v1/user/dashboards/{dashboard_ext_id}", {
|
|
9611
|
+
params: { path: { dashboard_ext_id: id } }
|
|
9612
|
+
}),
|
|
9613
|
+
"Failed to delete the dashboard"
|
|
9614
|
+
);
|
|
9615
|
+
}
|
|
9577
9616
|
|
|
9578
9617
|
// src/operations/work.ts
|
|
9579
9618
|
var work_exports = {};
|
|
@@ -12698,6 +12737,21 @@ var Arbi = class {
|
|
|
12698
12737
|
*/
|
|
12699
12738
|
me: () => getCurrentUser(this.requireClient())
|
|
12700
12739
|
};
|
|
12740
|
+
// ── Saved Analytics dashboards (the person's own, sealed to their key) ──
|
|
12741
|
+
dashboards = {
|
|
12742
|
+
/** The user's saved dashboards (each spec's JSON), oldest first. */
|
|
12743
|
+
list: async () => listUserDashboards(
|
|
12744
|
+
this.requireClient(),
|
|
12745
|
+
(await this.requireChatCrypto()).encryptionKeypair
|
|
12746
|
+
),
|
|
12747
|
+
/** Save a dashboard's spec JSON (new without `id`, else replaced). */
|
|
12748
|
+
save: async (dashboard) => saveUserDashboard(
|
|
12749
|
+
this.requireClient(),
|
|
12750
|
+
(await this.requireChatCrypto()).encryptionKeypair,
|
|
12751
|
+
dashboard
|
|
12752
|
+
),
|
|
12753
|
+
remove: (id) => deleteUserDashboard(this.requireClient(), id)
|
|
12754
|
+
};
|
|
12701
12755
|
// ── Firm ──────────────────────────────────────────────────────────────
|
|
12702
12756
|
firm = {
|
|
12703
12757
|
/** The firm's pooled monthly £ of AI usage (`has_pool` false where there is none). */
|