@arbidocs/sdk 0.5.146 → 0.5.148
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-C2Fm_iTe.d.cts → browser-8ZBWzFtx.d.cts} +245 -33
- package/dist/{browser-Cnw8-hVH.d.ts → browser-DKHZ8Q9X.d.ts} +245 -33
- package/dist/browser.cjs +219 -80
- 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 +215 -81
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +289 -149
- 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 +281 -146
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var fs2 = require('fs');
|
|
4
|
-
var
|
|
4
|
+
var path4 = require('path');
|
|
5
5
|
var os2 = require('os');
|
|
6
6
|
var client = require('@arbidocs/client');
|
|
7
7
|
var child_process = require('child_process');
|
|
@@ -12,7 +12,7 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
12
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
|
|
14
14
|
var fs2__default = /*#__PURE__*/_interopDefault(fs2);
|
|
15
|
-
var
|
|
15
|
+
var path4__default = /*#__PURE__*/_interopDefault(path4);
|
|
16
16
|
var os2__default = /*#__PURE__*/_interopDefault(os2);
|
|
17
17
|
|
|
18
18
|
var __defProp = Object.defineProperty;
|
|
@@ -3719,7 +3719,7 @@ async function authenticatedFetch(options) {
|
|
|
3719
3719
|
const {
|
|
3720
3720
|
baseUrl,
|
|
3721
3721
|
accessToken,
|
|
3722
|
-
path:
|
|
3722
|
+
path: path6,
|
|
3723
3723
|
method,
|
|
3724
3724
|
body,
|
|
3725
3725
|
headers,
|
|
@@ -3728,7 +3728,7 @@ async function authenticatedFetch(options) {
|
|
|
3728
3728
|
} = options;
|
|
3729
3729
|
let res;
|
|
3730
3730
|
try {
|
|
3731
|
-
res = await send(`${baseUrl}${
|
|
3731
|
+
res = await send(`${baseUrl}${path6}`, {
|
|
3732
3732
|
method: method ?? (body ? "POST" : "GET"),
|
|
3733
3733
|
headers: {
|
|
3734
3734
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -3830,13 +3830,13 @@ var FileConfigStore = class {
|
|
|
3830
3830
|
sessionFile;
|
|
3831
3831
|
metadataFile;
|
|
3832
3832
|
constructor(configDir) {
|
|
3833
|
-
const arbiBase = process.env.ARBI_CONFIG_DIR ?? (fs2__default.default.existsSync(
|
|
3833
|
+
const arbiBase = process.env.ARBI_CONFIG_DIR ?? (fs2__default.default.existsSync(path4__default.default.join(process.cwd(), ".arbi", "credentials.json")) ? path4__default.default.join(process.cwd(), ".arbi") : path4__default.default.join(os2__default.default.homedir(), ".arbi"));
|
|
3834
3834
|
const arbiId = process.env.ARBI_ID;
|
|
3835
|
-
this.configDir = configDir ?? (arbiId ?
|
|
3836
|
-
this.configFile =
|
|
3837
|
-
this.credentialsFile =
|
|
3838
|
-
this.sessionFile =
|
|
3839
|
-
this.metadataFile =
|
|
3835
|
+
this.configDir = configDir ?? (arbiId ? path4__default.default.join(arbiBase, arbiId) : arbiBase);
|
|
3836
|
+
this.configFile = path4__default.default.join(this.configDir, "config.json");
|
|
3837
|
+
this.credentialsFile = path4__default.default.join(this.configDir, "credentials.json");
|
|
3838
|
+
this.sessionFile = path4__default.default.join(this.configDir, "session.json");
|
|
3839
|
+
this.metadataFile = path4__default.default.join(this.configDir, "last-metadata.json");
|
|
3840
3840
|
}
|
|
3841
3841
|
ensureConfigDir() {
|
|
3842
3842
|
if (!fs2__default.default.existsSync(this.configDir)) {
|
|
@@ -3984,12 +3984,12 @@ var FileConfigStore = class {
|
|
|
3984
3984
|
return { config: config2, source: "ARBI_SERVER_URL env var" };
|
|
3985
3985
|
}
|
|
3986
3986
|
const dir = searchDir || process.cwd();
|
|
3987
|
-
const dotenvConfig = this.readDotEnvDomain(
|
|
3987
|
+
const dotenvConfig = this.readDotEnvDomain(path4__default.default.join(dir, ".env"));
|
|
3988
3988
|
if (dotenvConfig) {
|
|
3989
3989
|
this.saveConfig(dotenvConfig);
|
|
3990
3990
|
return { config: dotenvConfig, source: ".env file" };
|
|
3991
3991
|
}
|
|
3992
|
-
const publicConfig = this.readPublicConfigDomain(
|
|
3992
|
+
const publicConfig = this.readPublicConfigDomain(path4__default.default.join(dir, "public", "config.json"));
|
|
3993
3993
|
if (publicConfig) {
|
|
3994
3994
|
this.saveConfig(publicConfig);
|
|
3995
3995
|
return { config: publicConfig, source: "public/config.json" };
|
|
@@ -4553,6 +4553,7 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4553
4553
|
let assistantMessageExtId = null;
|
|
4554
4554
|
const agentSteps = [];
|
|
4555
4555
|
let toolCallCount = 0;
|
|
4556
|
+
let agentStepCount = 0;
|
|
4556
4557
|
const errors = [];
|
|
4557
4558
|
const artifacts = [];
|
|
4558
4559
|
let userMessage = null;
|
|
@@ -4632,7 +4633,8 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4632
4633
|
if (item?.type === "function_call" || item?.type === "reasoning") {
|
|
4633
4634
|
const label = formatItemLabel(item);
|
|
4634
4635
|
if (label) agentSteps.push(label);
|
|
4635
|
-
if (item.type === "function_call") toolCallCount += 1;
|
|
4636
|
+
if (item.type === "function_call" && item.name) toolCallCount += 1;
|
|
4637
|
+
if (item.type === "reasoning" && item.arbi?.step !== "goal") agentStepCount += 1;
|
|
4636
4638
|
}
|
|
4637
4639
|
callbacks.onOutputItemDone?.(data);
|
|
4638
4640
|
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
@@ -4800,6 +4802,7 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4800
4802
|
assistantMessageExtId,
|
|
4801
4803
|
agentSteps,
|
|
4802
4804
|
toolCallCount,
|
|
4805
|
+
agentStepCount,
|
|
4803
4806
|
errors,
|
|
4804
4807
|
userMessage,
|
|
4805
4808
|
metadata,
|
|
@@ -4814,7 +4817,8 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4814
4817
|
function formatStreamSummary(result, elapsedTime) {
|
|
4815
4818
|
const parts = [];
|
|
4816
4819
|
if (result.agentSteps.length > 0) {
|
|
4817
|
-
|
|
4820
|
+
const steps = result.agentStepCount > 0 ? result.agentStepCount : result.agentSteps.length;
|
|
4821
|
+
let stepLabel = `${steps} step${steps === 1 ? "" : "s"}`;
|
|
4818
4822
|
if (result.toolCallCount > 0) {
|
|
4819
4823
|
stepLabel += ` (${result.toolCallCount} tool call${result.toolCallCount === 1 ? "" : "s"})`;
|
|
4820
4824
|
}
|
|
@@ -5594,7 +5598,7 @@ async function diagnoseSetup(options) {
|
|
|
5594
5598
|
);
|
|
5595
5599
|
return { ok: false, checks };
|
|
5596
5600
|
}
|
|
5597
|
-
const request = (
|
|
5601
|
+
const request = (path6, authenticated = false) => (options.fetch ?? globalThis.fetch)(`${base.href.replace(/\/$/, "")}${path6}`, {
|
|
5598
5602
|
method: "GET",
|
|
5599
5603
|
credentials: "omit",
|
|
5600
5604
|
redirect: "error",
|
|
@@ -7320,12 +7324,12 @@ async function prepareSecureMail(compose, sender, { requestId, senderPublicKey,
|
|
|
7320
7324
|
async function claimSecureMail(mail, id, fragmentKey, recipientPublicKey) {
|
|
7321
7325
|
const key = client.decodeSecureMailKey(fragmentKey);
|
|
7322
7326
|
try {
|
|
7323
|
-
const
|
|
7324
|
-
const response = await mail(
|
|
7327
|
+
const path6 = `/secure/${encodeURIComponent(id)}`;
|
|
7328
|
+
const response = await mail(path6);
|
|
7325
7329
|
const { raw } = await client.openSecureMail(await response.json(), key);
|
|
7326
7330
|
raw.fill(0);
|
|
7327
7331
|
const claim = await client.secureMailClaim(key, recipientPublicKey);
|
|
7328
|
-
const claimed = await mail(`${
|
|
7332
|
+
const claimed = await mail(`${path6}/claim`, { method: "POST", body: JSON.stringify(claim) });
|
|
7329
7333
|
return await claimed.json();
|
|
7330
7334
|
} finally {
|
|
7331
7335
|
key.fill(0);
|
|
@@ -9703,43 +9707,112 @@ async function confirmSpendLimits(arbi, projectExtId, body) {
|
|
|
9703
9707
|
"Failed to confirm spending limits"
|
|
9704
9708
|
);
|
|
9705
9709
|
}
|
|
9706
|
-
|
|
9710
|
+
|
|
9711
|
+
// src/operations/pages.ts
|
|
9712
|
+
var pages_exports = {};
|
|
9713
|
+
__export(pages_exports, {
|
|
9714
|
+
PagePrivateContentError: () => PagePrivateContentError,
|
|
9715
|
+
createPage: () => createPage,
|
|
9716
|
+
deletePage: () => deletePage,
|
|
9717
|
+
getPage: () => getPage,
|
|
9718
|
+
listPages: () => listPages,
|
|
9719
|
+
sharePage: () => sharePage,
|
|
9720
|
+
updatePage: () => updatePage
|
|
9721
|
+
});
|
|
9722
|
+
var PagePrivateContentError = class extends ArbiApiError {
|
|
9723
|
+
views;
|
|
9724
|
+
documents;
|
|
9725
|
+
constructor(message, views, documents, apiError) {
|
|
9726
|
+
super(message, apiError, 409, { code: "page_uses_private_content" });
|
|
9727
|
+
this.name = "PagePrivateContentError";
|
|
9728
|
+
this.views = views;
|
|
9729
|
+
this.documents = documents;
|
|
9730
|
+
}
|
|
9731
|
+
};
|
|
9707
9732
|
var decoder = new TextDecoder();
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
const
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9733
|
+
function refusal3(result, fallback) {
|
|
9734
|
+
if (!result.error) return null;
|
|
9735
|
+
const detail = result.error.detail;
|
|
9736
|
+
if (result.response?.status === 409 && detail?.code === "page_uses_private_content") {
|
|
9737
|
+
return new PagePrivateContentError(
|
|
9738
|
+
detail.message ?? fallback,
|
|
9739
|
+
detail.views ?? [],
|
|
9740
|
+
detail.documents ?? [],
|
|
9741
|
+
result.error
|
|
9742
|
+
);
|
|
9743
|
+
}
|
|
9744
|
+
return null;
|
|
9745
|
+
}
|
|
9746
|
+
function pageOf(row, keypair) {
|
|
9747
|
+
let legacyJson = null;
|
|
9748
|
+
if (row.sealed && keypair) {
|
|
9716
9749
|
try {
|
|
9717
|
-
|
|
9750
|
+
legacyJson = decoder.decode(client.sealedBoxDecrypt(row.sealed, keypair.secretKey));
|
|
9718
9751
|
} catch {
|
|
9719
9752
|
}
|
|
9720
|
-
|
|
9721
|
-
|
|
9753
|
+
}
|
|
9754
|
+
return {
|
|
9755
|
+
id: row.external_id,
|
|
9756
|
+
workspaceId: row.workspace_id ?? null,
|
|
9757
|
+
shared: row.shared,
|
|
9758
|
+
spec: row.spec ?? null,
|
|
9759
|
+
legacyJson,
|
|
9760
|
+
unreadable: !!row.sealed && legacyJson === null,
|
|
9761
|
+
viewIds: row.view_ids ?? [],
|
|
9762
|
+
documentIds: row.document_ids ?? [],
|
|
9763
|
+
createdBy: row.created_by ?? null,
|
|
9764
|
+
updatedBy: row.updated_by ?? null,
|
|
9765
|
+
createdAt: row.created_at,
|
|
9766
|
+
updatedAt: row.updated_at
|
|
9767
|
+
};
|
|
9722
9768
|
}
|
|
9723
|
-
async function
|
|
9724
|
-
const
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
}),
|
|
9730
|
-
"Failed to
|
|
9731
|
-
)
|
|
9732
|
-
|
|
9733
|
-
|
|
9769
|
+
async function pagesOf(rows, keypair) {
|
|
9770
|
+
const key = rows.some((r2) => r2.sealed) ? await keypair().catch(() => null) : null;
|
|
9771
|
+
return rows.map((r2) => pageOf(r2, key));
|
|
9772
|
+
}
|
|
9773
|
+
async function listPages(arbi, keypair, query2 = {}) {
|
|
9774
|
+
const rows = requireData(
|
|
9775
|
+
await arbi.fetch.GET("/v1/pages", { params: { query: query2 } }),
|
|
9776
|
+
"Failed to load the pages"
|
|
9777
|
+
);
|
|
9778
|
+
return pagesOf(rows, keypair);
|
|
9779
|
+
}
|
|
9780
|
+
async function getPage(arbi, keypair, id) {
|
|
9781
|
+
const row = requireData(
|
|
9782
|
+
await arbi.fetch.GET("/v1/pages/{page_id}", { params: { path: { page_id: id } } }),
|
|
9783
|
+
"Failed to open the page"
|
|
9734
9784
|
);
|
|
9735
|
-
return
|
|
9785
|
+
return (await pagesOf([row], keypair))[0];
|
|
9786
|
+
}
|
|
9787
|
+
async function createPage(arbi, page) {
|
|
9788
|
+
const result = await arbi.fetch.POST("/v1/pages", {
|
|
9789
|
+
body: { spec: page.spec, shared: page.shared ?? false }
|
|
9790
|
+
});
|
|
9791
|
+
const refused = refusal3(result, "The page could not be shared");
|
|
9792
|
+
if (refused) throw refused;
|
|
9793
|
+
return pageOf(requireData(result, "Failed to save the page"), null);
|
|
9794
|
+
}
|
|
9795
|
+
async function updatePage(arbi, id, spec) {
|
|
9796
|
+
const result = await arbi.fetch.PUT("/v1/pages/{page_id}", {
|
|
9797
|
+
params: { path: { page_id: id } },
|
|
9798
|
+
body: { spec }
|
|
9799
|
+
});
|
|
9800
|
+
const refused = refusal3(result, "The page could not be saved");
|
|
9801
|
+
if (refused) throw refused;
|
|
9802
|
+
return pageOf(requireData(result, "Failed to save the page"), null);
|
|
9736
9803
|
}
|
|
9737
|
-
async function
|
|
9804
|
+
async function sharePage(arbi, id) {
|
|
9805
|
+
const result = await arbi.fetch.POST("/v1/pages/{page_id}/share", {
|
|
9806
|
+
params: { path: { page_id: id } }
|
|
9807
|
+
});
|
|
9808
|
+
const refused = refusal3(result, "The page could not be shared");
|
|
9809
|
+
if (refused) throw refused;
|
|
9810
|
+
return pageOf(requireData(result, "Failed to share the page"), null);
|
|
9811
|
+
}
|
|
9812
|
+
async function deletePage(arbi, id) {
|
|
9738
9813
|
requireOk(
|
|
9739
|
-
await arbi.fetch.DELETE("/v1/
|
|
9740
|
-
|
|
9741
|
-
}),
|
|
9742
|
-
"Failed to delete the dashboard"
|
|
9814
|
+
await arbi.fetch.DELETE("/v1/pages/{page_id}", { params: { path: { page_id: id } } }),
|
|
9815
|
+
"Failed to delete the page"
|
|
9743
9816
|
);
|
|
9744
9817
|
}
|
|
9745
9818
|
|
|
@@ -9758,7 +9831,6 @@ __export(work_exports, {
|
|
|
9758
9831
|
listConversationPeople: () => listConversationPeople,
|
|
9759
9832
|
notifyConversation: () => notifyConversation,
|
|
9760
9833
|
planWork: () => planWork,
|
|
9761
|
-
removeConversationPerson: () => removeConversationPerson,
|
|
9762
9834
|
runConversation: () => runConversation,
|
|
9763
9835
|
sendBackStep: () => sendBackStep,
|
|
9764
9836
|
skipStep: () => skipStep,
|
|
@@ -10516,14 +10588,6 @@ async function listConversationPeople(arbi, conversationId) {
|
|
|
10516
10588
|
"Failed to fetch the people of the conversation"
|
|
10517
10589
|
);
|
|
10518
10590
|
}
|
|
10519
|
-
async function removeConversationPerson(arbi, conversationId, userId) {
|
|
10520
|
-
requireOk(
|
|
10521
|
-
await arbi.fetch.DELETE("/v1/conversation/{conversation_ext_id}/people/{user_ext_id}", {
|
|
10522
|
-
params: { path: { conversation_ext_id: conversationId, user_ext_id: userId } }
|
|
10523
|
-
}),
|
|
10524
|
-
"Failed to remove the person from the conversation"
|
|
10525
|
-
);
|
|
10526
|
-
}
|
|
10527
10591
|
async function getActivity(arbi, conversationId) {
|
|
10528
10592
|
return requireData(
|
|
10529
10593
|
await arbi.fetch.GET("/v1/conversation/{conversation_ext_id}/activity", byId(conversationId)),
|
|
@@ -10807,13 +10871,13 @@ async function addDatabaseRows(arbi, databaseId, rows, options = {}) {
|
|
|
10807
10871
|
"Failed to add rows"
|
|
10808
10872
|
);
|
|
10809
10873
|
}
|
|
10810
|
-
async function shareDatabaseRow(arbi, databaseId, rowId
|
|
10874
|
+
async function shareDatabaseRow(arbi, databaseId, rowId) {
|
|
10811
10875
|
return requireData(
|
|
10812
10876
|
await arbi.fetch.POST("/v1/databases/{database_id}/rows/{row_id}/share", {
|
|
10813
10877
|
params: { path: { database_id: databaseId, row_id: rowId } },
|
|
10814
|
-
body: { shared }
|
|
10878
|
+
body: { shared: true }
|
|
10815
10879
|
}),
|
|
10816
|
-
|
|
10880
|
+
"Failed to submit the row"
|
|
10817
10881
|
);
|
|
10818
10882
|
}
|
|
10819
10883
|
async function updateDatabaseRow(arbi, databaseId, rowId, values) {
|
|
@@ -10862,6 +10926,63 @@ async function exportDatabase(arbi, databaseId, format) {
|
|
|
10862
10926
|
);
|
|
10863
10927
|
}
|
|
10864
10928
|
|
|
10929
|
+
// src/operations/views.ts
|
|
10930
|
+
var views_exports = {};
|
|
10931
|
+
__export(views_exports, {
|
|
10932
|
+
DOCUMENTS_VIEW_TARGET: () => DOCUMENTS_VIEW_TARGET,
|
|
10933
|
+
createTableView: () => createTableView,
|
|
10934
|
+
deleteTableView: () => deleteTableView,
|
|
10935
|
+
filterText: () => filterText,
|
|
10936
|
+
getTableView: () => getTableView,
|
|
10937
|
+
listTableViews: () => listTableViews,
|
|
10938
|
+
shareTableView: () => shareTableView,
|
|
10939
|
+
updateTableView: () => updateTableView
|
|
10940
|
+
});
|
|
10941
|
+
var DOCUMENTS_VIEW_TARGET = "documents";
|
|
10942
|
+
var path3 = (viewId) => ({ path: { view_id: viewId } });
|
|
10943
|
+
async function listTableViews(arbi, target) {
|
|
10944
|
+
return requireData(
|
|
10945
|
+
await arbi.fetch.GET("/v1/views", { params: { query: target ? { target } : {} } }),
|
|
10946
|
+
"Failed to list the views"
|
|
10947
|
+
);
|
|
10948
|
+
}
|
|
10949
|
+
async function getTableView(arbi, viewId) {
|
|
10950
|
+
return requireData(
|
|
10951
|
+
await arbi.fetch.GET("/v1/views/{view_id}", { params: path3(viewId) }),
|
|
10952
|
+
"Failed to read the view"
|
|
10953
|
+
);
|
|
10954
|
+
}
|
|
10955
|
+
async function createTableView(arbi, target, spec, options = {}) {
|
|
10956
|
+
return requireData(
|
|
10957
|
+
await arbi.fetch.POST("/v1/views", {
|
|
10958
|
+
body: { target, spec, shared: options.shared ?? false }
|
|
10959
|
+
}),
|
|
10960
|
+
"Failed to save the view"
|
|
10961
|
+
);
|
|
10962
|
+
}
|
|
10963
|
+
async function updateTableView(arbi, viewId, spec) {
|
|
10964
|
+
return requireData(
|
|
10965
|
+
await arbi.fetch.PATCH("/v1/views/{view_id}", { params: path3(viewId), body: { spec } }),
|
|
10966
|
+
"Failed to update the view"
|
|
10967
|
+
);
|
|
10968
|
+
}
|
|
10969
|
+
async function shareTableView(arbi, viewId) {
|
|
10970
|
+
return requireData(
|
|
10971
|
+
await arbi.fetch.POST("/v1/views/{view_id}/share", { params: path3(viewId) }),
|
|
10972
|
+
"Failed to share the view"
|
|
10973
|
+
);
|
|
10974
|
+
}
|
|
10975
|
+
async function deleteTableView(arbi, viewId) {
|
|
10976
|
+
requireOk(
|
|
10977
|
+
await arbi.fetch.DELETE("/v1/views/{view_id}", { params: path3(viewId) }),
|
|
10978
|
+
"Failed to delete the view"
|
|
10979
|
+
);
|
|
10980
|
+
}
|
|
10981
|
+
function filterText(filter) {
|
|
10982
|
+
const value = filter.value;
|
|
10983
|
+
return value === null || value === void 0 || value === "" ? `${filter.column}:${filter.op}` : `${filter.column}:${filter.op}:${String(value)}`;
|
|
10984
|
+
}
|
|
10985
|
+
|
|
10865
10986
|
// src/operations/mail.ts
|
|
10866
10987
|
var mail_exports = {};
|
|
10867
10988
|
__export(mail_exports, {
|
|
@@ -10895,9 +11016,9 @@ __export(mail_exports, {
|
|
|
10895
11016
|
});
|
|
10896
11017
|
var NATIVE_ACCOUNT = "native";
|
|
10897
11018
|
function createMailFetch(auth) {
|
|
10898
|
-
return (
|
|
11019
|
+
return (path6, init = {}) => authenticatedFetch({
|
|
10899
11020
|
...auth,
|
|
10900
|
-
path: `/v1/mail${
|
|
11021
|
+
path: `/v1/mail${path6}`,
|
|
10901
11022
|
method: init.method,
|
|
10902
11023
|
body: init.body,
|
|
10903
11024
|
headers: {
|
|
@@ -11037,8 +11158,8 @@ function getMessage2(mail, messageId2, accountId = NATIVE_ACCOUNT) {
|
|
|
11037
11158
|
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId2)}`));
|
|
11038
11159
|
}
|
|
11039
11160
|
async function downloadAttachment(mail, messageId2, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
11040
|
-
const
|
|
11041
|
-
return new Uint8Array(await (await mail(
|
|
11161
|
+
const path6 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId2)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
11162
|
+
return new Uint8Array(await (await mail(path6)).arrayBuffer());
|
|
11042
11163
|
}
|
|
11043
11164
|
async function updateMessage(mail, messageId2, update, accountId = NATIVE_ACCOUNT) {
|
|
11044
11165
|
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId2)}`, {
|
|
@@ -12894,21 +13015,22 @@ var Arbi = class {
|
|
|
12894
13015
|
*/
|
|
12895
13016
|
me: () => getCurrentUser(this.requireClient())
|
|
12896
13017
|
};
|
|
12897
|
-
// ──
|
|
12898
|
-
|
|
12899
|
-
/** The
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
),
|
|
12910
|
-
remove: (id) => deleteUserDashboard(this.requireClient(), id)
|
|
13018
|
+
// ── Pages (the open workspace's; private until shared) ──
|
|
13019
|
+
pages = {
|
|
13020
|
+
/** The open workspace's pages the user can see, oldest first (with their dashboards from
|
|
13021
|
+
* before pages, opened with their key). */
|
|
13022
|
+
list: (query2) => listPages(this.requireClient(), this.sealedPageKey, query2),
|
|
13023
|
+
get: (id) => getPage(this.requireClient(), this.sealedPageKey, id),
|
|
13024
|
+
/** Create a page, private unless `shared`. */
|
|
13025
|
+
create: (page) => createPage(this.requireClient(), page),
|
|
13026
|
+
/** Replace a page's spec (a dashboard from before pages is placed in the open workspace). */
|
|
13027
|
+
update: (id, spec) => updatePage(this.requireClient(), id, spec),
|
|
13028
|
+
/** Share a page with the workspace (one-way: a shared page stays shared). */
|
|
13029
|
+
share: (id) => sharePage(this.requireClient(), id),
|
|
13030
|
+
remove: (id) => deletePage(this.requireClient(), id)
|
|
12911
13031
|
};
|
|
13032
|
+
/** The user's own key, which opens their dashboards from before pages. */
|
|
13033
|
+
sealedPageKey = async () => (await this.requireChatCrypto()).encryptionKeypair;
|
|
12912
13034
|
// ── Firm ──────────────────────────────────────────────────────────────
|
|
12913
13035
|
firm = {
|
|
12914
13036
|
/** The firm's pooled monthly £ of AI usage (`has_pool` false where there is none). */
|
|
@@ -13318,9 +13440,9 @@ var Arbi = class {
|
|
|
13318
13440
|
await this.requireTargetWorkspace(options?.workspaceId)
|
|
13319
13441
|
),
|
|
13320
13442
|
/**
|
|
13321
|
-
* Patch a conversation: `title`, `shared` (
|
|
13322
|
-
* (`bound_document_ext_id`, `null` unbinds), and the work fields (`description`,
|
|
13323
|
-
* `parent_conversation_ext_id`, `status`, `plan`). The one call behind rename, share
|
|
13443
|
+
* Patch a conversation: `title`, `shared: true` (its creator only; sharing is one-way), its
|
|
13444
|
+
* bound document (`bound_document_ext_id`, `null` unbinds), and the work fields (`description`,
|
|
13445
|
+
* `due_at`, `parent_conversation_ext_id`, `status`, `plan`). The one call behind rename, share
|
|
13324
13446
|
* and attaching a thread to a document.
|
|
13325
13447
|
*/
|
|
13326
13448
|
update: (conversationId, body) => updateConversation(this.requireClient(), conversationId, body),
|
|
@@ -13356,8 +13478,6 @@ var Arbi = class {
|
|
|
13356
13478
|
notify: (conversationId, userIds) => notifyConversation(this.requireClient(), conversationId, userIds),
|
|
13357
13479
|
/** The people a conversation is shared with by name (cc'd or @mentioned). */
|
|
13358
13480
|
people: (conversationId) => listConversationPeople(this.requireClient(), conversationId),
|
|
13359
|
-
/** Take a named person off a conversation (a workspace owner only). */
|
|
13360
|
-
removePerson: (conversationId, userId) => removeConversationPerson(this.requireClient(), conversationId, userId),
|
|
13361
13481
|
/** Draft an editable plan from an objective, in the current workspace or `options.workspaceId`. */
|
|
13362
13482
|
plan: async (body, options) => planWork(
|
|
13363
13483
|
this.requireClient(),
|
|
@@ -13440,11 +13560,11 @@ var Arbi = class {
|
|
|
13440
13560
|
};
|
|
13441
13561
|
/** Authenticated native Word transport, with normal session recovery. */
|
|
13442
13562
|
editor = {
|
|
13443
|
-
request: (
|
|
13563
|
+
request: (path6, options = {}) => this.recovering(async () => {
|
|
13444
13564
|
const { baseUrl, accessToken, fetch: send = globalThis.fetch } = this.getAuthHeaders();
|
|
13445
13565
|
const headers = new Headers(options.headers);
|
|
13446
13566
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
13447
|
-
const response = await send(`${baseUrl}/v1/editor${
|
|
13567
|
+
const response = await send(`${baseUrl}/v1/editor${path6}`, { ...options, headers });
|
|
13448
13568
|
if (!response.ok) {
|
|
13449
13569
|
const body = await response.json().catch(() => null);
|
|
13450
13570
|
throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
|
|
@@ -13467,10 +13587,10 @@ var Arbi = class {
|
|
|
13467
13587
|
* With no token yet (a new tab) the session is restored first; a 401 re-logs in and is sent
|
|
13468
13588
|
* again once.
|
|
13469
13589
|
*/
|
|
13470
|
-
fetch: (
|
|
13471
|
-
const nativeRead =
|
|
13590
|
+
fetch: (path6, init = {}, { nativeUnlocked = false } = {}) => this.recovering(async () => {
|
|
13591
|
+
const nativeRead = path6.startsWith("/accounts/native/") && (init.method ?? "GET").toUpperCase() !== "POST";
|
|
13472
13592
|
if (nativeRead && !nativeUnlocked) await this.mail.unlockNative();
|
|
13473
|
-
return this.mailRequest(
|
|
13593
|
+
return this.mailRequest(path6, init);
|
|
13474
13594
|
}),
|
|
13475
13595
|
/**
|
|
13476
13596
|
* Unlock the signed-in user's native inbox for this server session (see `unlockNativeMail`).
|
|
@@ -13513,7 +13633,7 @@ var Arbi = class {
|
|
|
13513
13633
|
/** The native inbox unlock in flight (`mail.unlockNative`). */
|
|
13514
13634
|
nativeUnlock = null;
|
|
13515
13635
|
/** One request under `/v1/mail` on the session's token (see `mail.fetch`). */
|
|
13516
|
-
async mailRequest(
|
|
13636
|
+
async mailRequest(path6, init) {
|
|
13517
13637
|
const client = this.requireClient();
|
|
13518
13638
|
let token = client.session.getState().accessToken;
|
|
13519
13639
|
if (!token) token = await client.auth.relogin();
|
|
@@ -13523,7 +13643,7 @@ var Arbi = class {
|
|
|
13523
13643
|
const headers = new Headers(init.headers);
|
|
13524
13644
|
headers.set("Authorization", `Bearer ${bearer}`);
|
|
13525
13645
|
if (init.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
|
|
13526
|
-
return send(`${this.options.url}/v1/mail${
|
|
13646
|
+
return send(`${this.options.url}/v1/mail${path6}`, { ...init, headers });
|
|
13527
13647
|
};
|
|
13528
13648
|
let response = await request(token);
|
|
13529
13649
|
if (response.status === 401) {
|
|
@@ -14678,14 +14798,29 @@ var Arbi = class {
|
|
|
14678
14798
|
update: (databaseId, body) => updateDatabase(this.requireClient(), databaseId, body),
|
|
14679
14799
|
delete: (databaseId) => deleteDatabase(this.requireClient(), databaseId),
|
|
14680
14800
|
addRows: (databaseId, rows, options) => addDatabaseRows(this.requireClient(), databaseId, rows, options),
|
|
14681
|
-
/** Submit a draft row
|
|
14682
|
-
shareRow: (databaseId, rowId
|
|
14801
|
+
/** Submit a draft row: share it with the workspace (one-way: it never becomes a draft again). */
|
|
14802
|
+
shareRow: (databaseId, rowId) => shareDatabaseRow(this.requireClient(), databaseId, rowId),
|
|
14683
14803
|
updateRow: (databaseId, rowId, values) => updateDatabaseRow(this.requireClient(), databaseId, rowId, values),
|
|
14684
14804
|
deleteRows: (databaseId, ids) => deleteDatabaseRows(this.requireClient(), databaseId, ids),
|
|
14685
14805
|
import: (file, name) => importDatabase(this.requireClient(), file, name),
|
|
14686
14806
|
importRows: (databaseId, file) => importDatabaseRows(this.requireClient(), databaseId, file),
|
|
14687
14807
|
export: (databaseId, format) => exportDatabase(this.requireClient(), databaseId, format)
|
|
14688
14808
|
};
|
|
14809
|
+
// ── Table views (saved views of a database grid or the document table) ──
|
|
14810
|
+
/**
|
|
14811
|
+
* Saved views: private to their creator until shared with the workspace, for good (sharing is one
|
|
14812
|
+
* way); only a workspace owner deletes a shared view. `target` is a database id or `documents`.
|
|
14813
|
+
*/
|
|
14814
|
+
views = {
|
|
14815
|
+
/** The views the caller can see: of one table, or of every table of the open workspace. */
|
|
14816
|
+
list: (target) => listTableViews(this.requireClient(), target),
|
|
14817
|
+
get: (viewId) => getTableView(this.requireClient(), viewId),
|
|
14818
|
+
create: (target, spec, options) => createTableView(this.requireClient(), target, spec, options),
|
|
14819
|
+
update: (viewId, spec) => updateTableView(this.requireClient(), viewId, spec),
|
|
14820
|
+
/** Share with the workspace (one way: it is never made private again). */
|
|
14821
|
+
share: (viewId) => shareTableView(this.requireClient(), viewId),
|
|
14822
|
+
remove: (viewId) => deleteTableView(this.requireClient(), viewId)
|
|
14823
|
+
};
|
|
14689
14824
|
// ── Workspace facts ─────────────────────────────────────────────────
|
|
14690
14825
|
/**
|
|
14691
14826
|
* Notes. Create, list and search act in the current workspace, or `workspaceId` (opened for this
|
|
@@ -14785,16 +14920,16 @@ function collectFiles(dirPath, baseDir) {
|
|
|
14785
14920
|
const root = baseDir ?? dirPath;
|
|
14786
14921
|
const results = [];
|
|
14787
14922
|
for (const entry of fs2__default.default.readdirSync(dirPath, { withFileTypes: true })) {
|
|
14788
|
-
const fullPath =
|
|
14923
|
+
const fullPath = path4__default.default.join(dirPath, entry.name);
|
|
14789
14924
|
if (entry.isDirectory()) {
|
|
14790
14925
|
results.push(...collectFiles(fullPath, root));
|
|
14791
14926
|
} else if (entry.isFile()) {
|
|
14792
|
-
const ext =
|
|
14927
|
+
const ext = path4__default.default.extname(entry.name).toLowerCase();
|
|
14793
14928
|
if (SUPPORTED_EXTENSIONS.has(ext)) {
|
|
14794
14929
|
const stat = fs2__default.default.statSync(fullPath);
|
|
14795
14930
|
results.push({
|
|
14796
14931
|
absolutePath: fullPath,
|
|
14797
|
-
relativePath:
|
|
14932
|
+
relativePath: path4__default.default.relative(root, fullPath),
|
|
14798
14933
|
size: stat.size
|
|
14799
14934
|
});
|
|
14800
14935
|
}
|
|
@@ -14830,14 +14965,14 @@ function readFileAsBlob(filePath, fileSize, fileName) {
|
|
|
14830
14965
|
}
|
|
14831
14966
|
async function uploadLocalFile(auth, filePath, options) {
|
|
14832
14967
|
const stat = fs2__default.default.statSync(filePath);
|
|
14833
|
-
const fileName =
|
|
14968
|
+
const fileName = path4__default.default.basename(filePath);
|
|
14834
14969
|
const blob = readFileAsBlob(filePath, stat.size, fileName);
|
|
14835
14970
|
const result = await uploadFile(auth, blob, fileName, options);
|
|
14836
14971
|
return { ...result, fileName };
|
|
14837
14972
|
}
|
|
14838
14973
|
async function uploadLocalFilesDirect(arbi, workspaceKey, filePaths, options) {
|
|
14839
14974
|
const files = filePaths.map((fp) => {
|
|
14840
|
-
const resolved =
|
|
14975
|
+
const resolved = path4__default.default.resolve(fp);
|
|
14841
14976
|
const stat = fs2__default.default.statSync(resolved);
|
|
14842
14977
|
if (stat.size > NODE_BUFFER_LIMIT) {
|
|
14843
14978
|
throw new Error(
|
|
@@ -14845,9 +14980,9 @@ async function uploadLocalFilesDirect(arbi, workspaceKey, filePaths, options) {
|
|
|
14845
14980
|
);
|
|
14846
14981
|
}
|
|
14847
14982
|
return {
|
|
14848
|
-
name:
|
|
14983
|
+
name: path4__default.default.basename(resolved),
|
|
14849
14984
|
data: new Uint8Array(fs2__default.default.readFileSync(resolved)),
|
|
14850
|
-
contentType: mimeFromName(
|
|
14985
|
+
contentType: mimeFromName(path4__default.default.basename(resolved))
|
|
14851
14986
|
};
|
|
14852
14987
|
});
|
|
14853
14988
|
return uploadDocumentsDirect(arbi, workspaceKey, files, options);
|
|
@@ -14896,8 +15031,8 @@ async function runGroupedDirectUpload(arbi, workspaceKey, groups, options) {
|
|
|
14896
15031
|
return { doc_ext_ids: allDocIds, skipped: allSkipped, folders };
|
|
14897
15032
|
}
|
|
14898
15033
|
async function uploadLocalDirectoryDirect(arbi, workspaceKey, dirPath, options) {
|
|
14899
|
-
const resolvedDir =
|
|
14900
|
-
const dirName =
|
|
15034
|
+
const resolvedDir = path4__default.default.resolve(dirPath);
|
|
15035
|
+
const dirName = path4__default.default.basename(resolvedDir);
|
|
14901
15036
|
const entries = collectFiles(resolvedDir);
|
|
14902
15037
|
if (entries.length === 0) {
|
|
14903
15038
|
return { doc_ext_ids: [], skipped: [], folders: /* @__PURE__ */ new Map() };
|
|
@@ -14909,9 +15044,9 @@ async function uploadLocalDirectoryDirect(arbi, workspaceKey, dirPath, options)
|
|
|
14909
15044
|
`File ${entry.absolutePath} is ${entry.size} bytes \u2014 direct upload currently loads the full file into memory; skip --s3 for files > 2 GiB.`
|
|
14910
15045
|
);
|
|
14911
15046
|
}
|
|
14912
|
-
const relDir =
|
|
15047
|
+
const relDir = path4__default.default.dirname(entry.relativePath);
|
|
14913
15048
|
const folder = sanitizeFolderPath(relDir === "." ? dirName : `${dirName}/${relDir}`);
|
|
14914
|
-
const name =
|
|
15049
|
+
const name = path4__default.default.basename(entry.relativePath);
|
|
14915
15050
|
if (!buckets.has(folder)) buckets.set(folder, []);
|
|
14916
15051
|
buckets.get(folder).push({
|
|
14917
15052
|
name,
|
|
@@ -14927,11 +15062,11 @@ async function uploadLocalZipDirect(arbi, workspaceKey, zipPath, options) {
|
|
|
14927
15062
|
const JSZip = (await import('jszip')).default;
|
|
14928
15063
|
const zipBuffer = fs2__default.default.readFileSync(zipPath);
|
|
14929
15064
|
const zip = await JSZip.loadAsync(zipBuffer);
|
|
14930
|
-
const zipBaseName =
|
|
15065
|
+
const zipBaseName = path4__default.default.basename(zipPath).replace(/\.zip$/i, "");
|
|
14931
15066
|
const entries = [];
|
|
14932
15067
|
zip.forEach((relativePath, zipEntry) => {
|
|
14933
15068
|
if (zipEntry.dir) return;
|
|
14934
|
-
const ext =
|
|
15069
|
+
const ext = path4__default.default.extname(relativePath).toLowerCase();
|
|
14935
15070
|
if (SUPPORTED_EXTENSIONS.has(ext)) {
|
|
14936
15071
|
entries.push({ zipEntryPath: relativePath, zipEntry });
|
|
14937
15072
|
}
|
|
@@ -14944,8 +15079,8 @@ async function uploadLocalZipDirect(arbi, workspaceKey, zipPath, options) {
|
|
|
14944
15079
|
const buckets = /* @__PURE__ */ new Map();
|
|
14945
15080
|
for (const entry of entries) {
|
|
14946
15081
|
const data = await entry.zipEntry.async("uint8array");
|
|
14947
|
-
const fileName =
|
|
14948
|
-
const relDir =
|
|
15082
|
+
const fileName = path4__default.default.basename(entry.zipEntryPath);
|
|
15083
|
+
const relDir = path4__default.default.dirname(entry.zipEntryPath);
|
|
14949
15084
|
let folder;
|
|
14950
15085
|
if (hasSingleRoot) {
|
|
14951
15086
|
folder = relDir === "." ? zipBaseName : relDir;
|
|
@@ -14970,17 +15105,17 @@ async function uploadLocalArchiveDirect(arbi, workspaceKey, archivePath, options
|
|
|
14970
15105
|
} catch {
|
|
14971
15106
|
throw new Error("7z is not installed. Install p7zip-full to extract archives.");
|
|
14972
15107
|
}
|
|
14973
|
-
const tmpDir = fs2__default.default.mkdtempSync(
|
|
15108
|
+
const tmpDir = fs2__default.default.mkdtempSync(path4__default.default.join(os2__default.default.tmpdir(), "arbi-archive-"));
|
|
14974
15109
|
let uploadDir;
|
|
14975
15110
|
let namedDir;
|
|
14976
15111
|
try {
|
|
14977
|
-
child_process.execSync(`7z x -y -o"${tmpDir}" "${
|
|
15112
|
+
child_process.execSync(`7z x -y -o"${tmpDir}" "${path4__default.default.resolve(archivePath)}"`, { stdio: "ignore" });
|
|
14978
15113
|
const topLevel = fs2__default.default.readdirSync(tmpDir);
|
|
14979
|
-
if (topLevel.length === 1 && fs2__default.default.statSync(
|
|
14980
|
-
uploadDir =
|
|
15114
|
+
if (topLevel.length === 1 && fs2__default.default.statSync(path4__default.default.join(tmpDir, topLevel[0])).isDirectory()) {
|
|
15115
|
+
uploadDir = path4__default.default.join(tmpDir, topLevel[0]);
|
|
14981
15116
|
} else {
|
|
14982
|
-
const baseName =
|
|
14983
|
-
namedDir =
|
|
15117
|
+
const baseName = path4__default.default.basename(archivePath).replace(/\.(7z|rar|zip)$/i, "");
|
|
15118
|
+
namedDir = path4__default.default.join(path4__default.default.dirname(tmpDir), baseName);
|
|
14984
15119
|
fs2__default.default.renameSync(tmpDir, namedDir);
|
|
14985
15120
|
uploadDir = namedDir;
|
|
14986
15121
|
}
|
|
@@ -14995,20 +15130,20 @@ async function uploadLocalArchiveDirect(arbi, workspaceKey, archivePath, options
|
|
|
14995
15130
|
}
|
|
14996
15131
|
}
|
|
14997
15132
|
async function uploadDirectory(auth, dirPath, options) {
|
|
14998
|
-
const resolvedDir =
|
|
14999
|
-
const dirName =
|
|
15133
|
+
const resolvedDir = path4__default.default.resolve(dirPath);
|
|
15134
|
+
const dirName = path4__default.default.basename(resolvedDir);
|
|
15000
15135
|
const entries = collectFiles(resolvedDir);
|
|
15001
15136
|
if (entries.length === 0) {
|
|
15002
15137
|
return { doc_ext_ids: [], skipped: [], folders: /* @__PURE__ */ new Map() };
|
|
15003
15138
|
}
|
|
15004
15139
|
const groups = /* @__PURE__ */ new Map();
|
|
15005
15140
|
for (const entry of entries) {
|
|
15006
|
-
const relDir =
|
|
15141
|
+
const relDir = path4__default.default.dirname(entry.relativePath);
|
|
15007
15142
|
const folder = relDir === "." ? dirName : `${dirName}/${relDir}`;
|
|
15008
15143
|
if (!groups.has(folder)) groups.set(folder, []);
|
|
15009
15144
|
groups.get(folder).push({
|
|
15010
15145
|
absolutePath: entry.absolutePath,
|
|
15011
|
-
name:
|
|
15146
|
+
name: path4__default.default.basename(entry.relativePath),
|
|
15012
15147
|
size: entry.size
|
|
15013
15148
|
});
|
|
15014
15149
|
}
|
|
@@ -15094,11 +15229,11 @@ async function uploadZip(auth, zipPath, options) {
|
|
|
15094
15229
|
const JSZip = (await import('jszip')).default;
|
|
15095
15230
|
const zipBuffer = fs2__default.default.readFileSync(zipPath);
|
|
15096
15231
|
const zip = await JSZip.loadAsync(zipBuffer);
|
|
15097
|
-
const zipBaseName =
|
|
15232
|
+
const zipBaseName = path4__default.default.basename(zipPath).replace(/\.zip$/i, "");
|
|
15098
15233
|
const entries = [];
|
|
15099
15234
|
zip.forEach((relativePath, zipEntry) => {
|
|
15100
15235
|
if (zipEntry.dir) return;
|
|
15101
|
-
const ext =
|
|
15236
|
+
const ext = path4__default.default.extname(relativePath).toLowerCase();
|
|
15102
15237
|
if (SUPPORTED_EXTENSIONS.has(ext)) {
|
|
15103
15238
|
entries.push({ zipEntryPath: relativePath, zipEntry });
|
|
15104
15239
|
}
|
|
@@ -15111,8 +15246,8 @@ async function uploadZip(auth, zipPath, options) {
|
|
|
15111
15246
|
const groups = /* @__PURE__ */ new Map();
|
|
15112
15247
|
for (const entry of entries) {
|
|
15113
15248
|
const data = await entry.zipEntry.async("uint8array");
|
|
15114
|
-
const fileName =
|
|
15115
|
-
const relDir =
|
|
15249
|
+
const fileName = path4__default.default.basename(entry.zipEntryPath);
|
|
15250
|
+
const relDir = path4__default.default.dirname(entry.zipEntryPath);
|
|
15116
15251
|
let folder;
|
|
15117
15252
|
if (hasSingleRoot) {
|
|
15118
15253
|
folder = relDir === "." ? zipBaseName : relDir;
|
|
@@ -15182,9 +15317,9 @@ async function uploadZip(auth, zipPath, options) {
|
|
|
15182
15317
|
return { doc_ext_ids: allDocIds, skipped: allSkipped, folders };
|
|
15183
15318
|
}
|
|
15184
15319
|
function commonParentDir(absolutePaths) {
|
|
15185
|
-
if (absolutePaths.length === 0) return
|
|
15186
|
-
if (absolutePaths.length === 1) return
|
|
15187
|
-
const split = absolutePaths.map((p2) =>
|
|
15320
|
+
if (absolutePaths.length === 0) return path4__default.default.sep;
|
|
15321
|
+
if (absolutePaths.length === 1) return path4__default.default.dirname(absolutePaths[0]);
|
|
15322
|
+
const split = absolutePaths.map((p2) => path4__default.default.dirname(p2).split(path4__default.default.sep));
|
|
15188
15323
|
const minLen = Math.min(...split.map((s2) => s2.length));
|
|
15189
15324
|
const common = [];
|
|
15190
15325
|
for (let i2 = 0; i2 < minLen; i2++) {
|
|
@@ -15192,21 +15327,21 @@ function commonParentDir(absolutePaths) {
|
|
|
15192
15327
|
if (split.every((s2) => s2[i2] === seg)) common.push(seg);
|
|
15193
15328
|
else break;
|
|
15194
15329
|
}
|
|
15195
|
-
const joined = common.join(
|
|
15196
|
-
return joined ||
|
|
15330
|
+
const joined = common.join(path4__default.default.sep);
|
|
15331
|
+
return joined || path4__default.default.sep;
|
|
15197
15332
|
}
|
|
15198
15333
|
function deriveFolder(absolutePath, rootDir, rootBasename) {
|
|
15199
|
-
const parent =
|
|
15200
|
-
const rel =
|
|
15334
|
+
const parent = path4__default.default.dirname(absolutePath);
|
|
15335
|
+
const rel = path4__default.default.relative(rootDir, parent);
|
|
15201
15336
|
let folderPath;
|
|
15202
15337
|
if (rel === "" || rel === ".") {
|
|
15203
15338
|
folderPath = rootBasename;
|
|
15204
15339
|
} else if (rel.startsWith("..")) {
|
|
15205
|
-
folderPath =
|
|
15340
|
+
folderPath = path4__default.default.basename(parent) || rootBasename;
|
|
15206
15341
|
} else {
|
|
15207
|
-
folderPath =
|
|
15342
|
+
folderPath = path4__default.default.join(rootBasename, rel);
|
|
15208
15343
|
}
|
|
15209
|
-
return sanitizeFolderPath(folderPath.split(
|
|
15344
|
+
return sanitizeFolderPath(folderPath.split(path4__default.default.sep).join("/"));
|
|
15210
15345
|
}
|
|
15211
15346
|
function classifySkipReason(reason) {
|
|
15212
15347
|
const lower = reason.toLowerCase();
|
|
@@ -15247,9 +15382,9 @@ async function uploadManifest(auth, paths, options) {
|
|
|
15247
15382
|
if (options?.failFast && o2.status === "error") abortedByFailFast = true;
|
|
15248
15383
|
};
|
|
15249
15384
|
const prepared = [];
|
|
15250
|
-
const absoluteInputs = paths.map((p2) =>
|
|
15251
|
-
const rootDir = options?.rootDir ?
|
|
15252
|
-
const rootBasename =
|
|
15385
|
+
const absoluteInputs = paths.map((p2) => path4__default.default.resolve(p2));
|
|
15386
|
+
const rootDir = options?.rootDir ? path4__default.default.resolve(options.rootDir) : commonParentDir(absoluteInputs);
|
|
15387
|
+
const rootBasename = path4__default.default.basename(rootDir) || "root";
|
|
15253
15388
|
for (let i2 = 0; i2 < paths.length; i2++) {
|
|
15254
15389
|
if (options?.signal?.aborted || abortedByFailFast) {
|
|
15255
15390
|
await emit({
|
|
@@ -15287,7 +15422,7 @@ async function uploadManifest(auth, paths, options) {
|
|
|
15287
15422
|
});
|
|
15288
15423
|
continue;
|
|
15289
15424
|
}
|
|
15290
|
-
const ext =
|
|
15425
|
+
const ext = path4__default.default.extname(abs).toLowerCase();
|
|
15291
15426
|
if (!SUPPORTED_EXTENSIONS.has(ext)) {
|
|
15292
15427
|
await emit({
|
|
15293
15428
|
path: inputPath,
|
|
@@ -15314,7 +15449,7 @@ async function uploadManifest(auth, paths, options) {
|
|
|
15314
15449
|
prepared.push({
|
|
15315
15450
|
inputPath,
|
|
15316
15451
|
absolutePath: abs,
|
|
15317
|
-
basename:
|
|
15452
|
+
basename: path4__default.default.basename(abs),
|
|
15318
15453
|
folder: deriveFolder(abs, rootDir, rootBasename),
|
|
15319
15454
|
size: stat.size
|
|
15320
15455
|
});
|
|
@@ -15469,7 +15604,7 @@ async function uploadManifest(auth, paths, options) {
|
|
|
15469
15604
|
}
|
|
15470
15605
|
function walkSupportedFiles(dirPath) {
|
|
15471
15606
|
const out = [];
|
|
15472
|
-
const resolved =
|
|
15607
|
+
const resolved = path4__default.default.resolve(dirPath);
|
|
15473
15608
|
const stack = [resolved];
|
|
15474
15609
|
while (stack.length > 0) {
|
|
15475
15610
|
const current = stack.pop();
|
|
@@ -15480,11 +15615,11 @@ function walkSupportedFiles(dirPath) {
|
|
|
15480
15615
|
continue;
|
|
15481
15616
|
}
|
|
15482
15617
|
for (const entry of entries) {
|
|
15483
|
-
const full =
|
|
15618
|
+
const full = path4__default.default.join(current, entry.name);
|
|
15484
15619
|
if (entry.isDirectory()) {
|
|
15485
15620
|
stack.push(full);
|
|
15486
15621
|
} else if (entry.isFile()) {
|
|
15487
|
-
const ext =
|
|
15622
|
+
const ext = path4__default.default.extname(entry.name).toLowerCase();
|
|
15488
15623
|
if (SUPPORTED_EXTENSIONS.has(ext)) out.push(full);
|
|
15489
15624
|
}
|
|
15490
15625
|
}
|
|
@@ -15497,16 +15632,16 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
15497
15632
|
} catch {
|
|
15498
15633
|
throw new Error("7z is not installed. Install p7zip-full to extract archives.");
|
|
15499
15634
|
}
|
|
15500
|
-
const tmpDir = fs2__default.default.mkdtempSync(
|
|
15635
|
+
const tmpDir = fs2__default.default.mkdtempSync(path4__default.default.join(os2__default.default.tmpdir(), "arbi-archive-"));
|
|
15501
15636
|
try {
|
|
15502
|
-
child_process.execSync(`7z x -y -o"${tmpDir}" "${
|
|
15637
|
+
child_process.execSync(`7z x -y -o"${tmpDir}" "${path4__default.default.resolve(archivePath)}"`, { stdio: "ignore" });
|
|
15503
15638
|
const topLevel = fs2__default.default.readdirSync(tmpDir);
|
|
15504
15639
|
let uploadDir;
|
|
15505
|
-
if (topLevel.length === 1 && fs2__default.default.statSync(
|
|
15506
|
-
uploadDir =
|
|
15640
|
+
if (topLevel.length === 1 && fs2__default.default.statSync(path4__default.default.join(tmpDir, topLevel[0])).isDirectory()) {
|
|
15641
|
+
uploadDir = path4__default.default.join(tmpDir, topLevel[0]);
|
|
15507
15642
|
} else {
|
|
15508
|
-
const baseName =
|
|
15509
|
-
const namedDir =
|
|
15643
|
+
const baseName = path4__default.default.basename(archivePath).replace(/\.(7z|rar|zip)$/i, "");
|
|
15644
|
+
const namedDir = path4__default.default.join(path4__default.default.dirname(tmpDir), baseName);
|
|
15510
15645
|
fs2__default.default.renameSync(tmpDir, namedDir);
|
|
15511
15646
|
uploadDir = namedDir;
|
|
15512
15647
|
}
|
|
@@ -15522,8 +15657,8 @@ __export(mail_node_exports, {
|
|
|
15522
15657
|
attachmentFromFile: () => attachmentFromFile
|
|
15523
15658
|
});
|
|
15524
15659
|
function attachmentFromFile(filePath) {
|
|
15525
|
-
const resolved =
|
|
15526
|
-
const name =
|
|
15660
|
+
const resolved = path4__default.default.resolve(filePath);
|
|
15661
|
+
const name = path4__default.default.basename(resolved);
|
|
15527
15662
|
return attachmentFromBytes(
|
|
15528
15663
|
name,
|
|
15529
15664
|
mimeFromName(name) || "application/octet-stream",
|
|
@@ -15661,10 +15796,10 @@ function toUuid(input) {
|
|
|
15661
15796
|
].join("-");
|
|
15662
15797
|
}
|
|
15663
15798
|
function loadSkillPrompt() {
|
|
15664
|
-
const here =
|
|
15799
|
+
const here = path4.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
15665
15800
|
const candidates = [
|
|
15666
|
-
|
|
15667
|
-
|
|
15801
|
+
path4.resolve(here, "..", "SKILL.md"),
|
|
15802
|
+
path4.resolve(here, "..", "..", "arbi-cli", "SKILL.md")
|
|
15668
15803
|
];
|
|
15669
15804
|
for (const candidate of candidates) {
|
|
15670
15805
|
try {
|
|
@@ -16582,6 +16717,7 @@ exports.ArbiWorkspaceUnavailableError = ArbiWorkspaceUnavailableError;
|
|
|
16582
16717
|
exports.CallApiError = CallApiError;
|
|
16583
16718
|
exports.ClaudeOrchestrator = ClaudeOrchestrator;
|
|
16584
16719
|
exports.DEFAULT_AI_USD_PER_GBP = DEFAULT_AI_USD_PER_GBP;
|
|
16720
|
+
exports.DOCUMENTS_VIEW_TARGET = DOCUMENTS_VIEW_TARGET;
|
|
16585
16721
|
exports.DOC_TERMINAL_STATUSES = DOC_TERMINAL_STATUSES;
|
|
16586
16722
|
exports.DRIVE_SYNC_VENDORS = DRIVE_SYNC_VENDORS;
|
|
16587
16723
|
exports.DuplicateContactError = DuplicateContactError;
|
|
@@ -16596,6 +16732,7 @@ exports.MICROSOFT_VENDORS = MICROSOFT_VENDORS;
|
|
|
16596
16732
|
exports.OpenClawOrchestrator = OpenClawOrchestrator;
|
|
16597
16733
|
exports.PRESENCE_KINDS = PRESENCE_KINDS;
|
|
16598
16734
|
exports.PROMPT_CONTEXT_CHARS = PROMPT_CONTEXT_CHARS;
|
|
16735
|
+
exports.PagePrivateContentError = PagePrivateContentError;
|
|
16599
16736
|
exports.PlanStepsError = PlanStepsError;
|
|
16600
16737
|
exports.PublicBookingError = PublicBookingError;
|
|
16601
16738
|
exports.ResponseStream = ResponseStream;
|
|
@@ -16657,6 +16794,7 @@ exports.facts = facts_exports;
|
|
|
16657
16794
|
exports.files = files_exports;
|
|
16658
16795
|
exports.filterDocumentTags = filterDocumentTags;
|
|
16659
16796
|
exports.filterSkills = filterSkills;
|
|
16797
|
+
exports.filterText = filterText;
|
|
16660
16798
|
exports.findLeafForTaskMessage = findLeafForTaskMessage;
|
|
16661
16799
|
exports.findMainSiblingLeaf = findMainSiblingLeaf;
|
|
16662
16800
|
exports.findReplyTarget = findReplyTarget;
|
|
@@ -16718,6 +16856,7 @@ exports.mcpTools = mcpTools;
|
|
|
16718
16856
|
exports.mergeAgentSteps = mergeAgentSteps;
|
|
16719
16857
|
exports.modelConnections = model_connections_exports;
|
|
16720
16858
|
exports.notifications = notifications_exports;
|
|
16859
|
+
exports.pages = pages_exports;
|
|
16721
16860
|
exports.parseSSEEvents = parseSSEEvents;
|
|
16722
16861
|
exports.parseSlashCommand = parseSlashCommand;
|
|
16723
16862
|
exports.parseSlashTokenInProgress = parseSlashTokenInProgress;
|
|
@@ -16762,6 +16901,7 @@ exports.tagsOfGroup = tagsOfGroup;
|
|
|
16762
16901
|
exports.topLevelAgentSteps = topLevelAgentSteps;
|
|
16763
16902
|
exports.uploadSkill = uploadSkill;
|
|
16764
16903
|
exports.usdToGbp = usdToGbp;
|
|
16904
|
+
exports.views = views_exports;
|
|
16765
16905
|
exports.work = work_exports;
|
|
16766
16906
|
exports.workflowSteps = workflow_steps_exports;
|
|
16767
16907
|
exports.workflows = workflows_exports;
|