buckyos 0.7.175 → 0.7.180
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/cli/dist/cli.mjs +147 -41
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/pikg.ts +193 -51
- package/cli/runtime/fs_retry.ts +26 -0
- package/cli/runtime/host_deno.ts +17 -2
- package/cli/runtime/host_node.ts +16 -2
- package/cli/version.ts +1 -1
- package/dist/aiworkspace_client.d.ts +36 -2
- package/dist/aiworkspace_client.d.ts.map +1 -1
- package/dist/app-frame.cjs +1 -1
- package/dist/app-frame.cjs.map +1 -1
- package/dist/app-frame.d.ts +57 -1
- package/dist/app-frame.d.ts.map +1 -1
- package/dist/app-frame.mjs +291 -6
- package/dist/app-frame.mjs.map +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +2 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +16 -2
- package/dist/browser.mjs.map +1 -1
- package/dist/content.cjs +1 -1
- package/dist/content.cjs.map +1 -1
- package/dist/content.d.ts +77 -0
- package/dist/content.d.ts.map +1 -1
- package/dist/content.mjs +65 -0
- package/dist/content.mjs.map +1 -1
- package/dist/content_objid-1aff74b6.js +2 -0
- package/dist/content_objid-1aff74b6.js.map +1 -0
- package/dist/content_objid-9232bcaf.mjs +29 -0
- package/dist/content_objid-9232bcaf.mjs.map +1 -0
- package/dist/content_objid.d.ts +15 -0
- package/dist/content_objid.d.ts.map +1 -0
- package/dist/executor_client-7ce0ddc7.js +13 -0
- package/dist/executor_client-7ce0ddc7.js.map +1 -0
- package/dist/{executor_client-c620d25c.mjs → executor_client-bfc8a1e1.mjs} +77 -6
- package/dist/executor_client-bfc8a1e1.mjs.map +1 -0
- package/dist/executor_client.d.ts +1 -1
- package/dist/executor_client.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/dist/nfsp.cjs.map +1 -1
- package/dist/nfsp.d.ts +2 -1
- package/dist/nfsp.d.ts.map +1 -1
- package/dist/nfsp.mjs.map +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +2 -2
- package/dist/provision.cjs +1 -1
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +48 -16
- package/dist/provision.mjs.map +1 -1
- package/dist/provision_activate.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/executor_client-c620d25c.mjs.map +0 -1
- package/dist/executor_client-d4439d54.js +0 -13
- package/dist/executor_client-d4439d54.js.map +0 -1
|
@@ -209,9 +209,70 @@ function parseAiwsReferenceUrl(url) {
|
|
|
209
209
|
reference.version = JSON.parse(parsed.query.version);
|
|
210
210
|
return reference;
|
|
211
211
|
}
|
|
212
|
+
const AIWS_COMMIT_PART_BYTES = 6 * 1024 * 1024;
|
|
213
|
+
const AIWS_COMMIT_MAX_BYTES = 32 * 1024 * 1024;
|
|
214
|
+
const AIWS_COMMIT_MAX_OPERATIONS = 5e4;
|
|
215
|
+
const utf8 = new TextEncoder();
|
|
216
|
+
function jsonBytes(value) {
|
|
217
|
+
const text = JSON.stringify(value);
|
|
218
|
+
return text.length + (/[^\x00-\x7f]/.test(text) ? utf8.encode(text).length - text.length : 0);
|
|
219
|
+
}
|
|
220
|
+
function splitCommitOperations(operations, partBytes = AIWS_COMMIT_PART_BYTES) {
|
|
221
|
+
const parts = [];
|
|
222
|
+
let current = [];
|
|
223
|
+
let size = 2;
|
|
224
|
+
for (const op of operations) {
|
|
225
|
+
const bytes2 = jsonBytes(op) + 1;
|
|
226
|
+
if (current.length > 0 && size + bytes2 > partBytes) {
|
|
227
|
+
parts.push(current);
|
|
228
|
+
current = [];
|
|
229
|
+
size = 2;
|
|
230
|
+
}
|
|
231
|
+
current.push(op);
|
|
232
|
+
size += bytes2;
|
|
233
|
+
}
|
|
234
|
+
if (current.length > 0 || parts.length === 0)
|
|
235
|
+
parts.push(current);
|
|
236
|
+
return parts;
|
|
237
|
+
}
|
|
238
|
+
function commitOverLimit(operations) {
|
|
239
|
+
if (operations.length > AIWS_COMMIT_MAX_OPERATIONS)
|
|
240
|
+
return { limit: "operations", value: operations.length, max: AIWS_COMMIT_MAX_OPERATIONS };
|
|
241
|
+
let bytes2 = 2;
|
|
242
|
+
for (const op of operations)
|
|
243
|
+
bytes2 += jsonBytes(op) + 1;
|
|
244
|
+
return bytes2 + 4096 > AIWS_COMMIT_MAX_BYTES ? { limit: "bytes", value: bytes2, max: AIWS_COMMIT_MAX_BYTES } : null;
|
|
245
|
+
}
|
|
246
|
+
async function commitWithParts(call, request, options = {}) {
|
|
247
|
+
var _a2, _b2;
|
|
248
|
+
const method = options.method ?? "doc.commit";
|
|
249
|
+
const operations = Array.isArray(request.operations) ? request.operations : [];
|
|
250
|
+
const parts = splitCommitOperations(operations, options.partBytes ?? AIWS_COMMIT_PART_BYTES);
|
|
251
|
+
if (parts.length <= 1)
|
|
252
|
+
return await call(method, request);
|
|
253
|
+
const { workspace_id, epoch, idempotency_key } = request;
|
|
254
|
+
for (let attempt2 = 0; ; attempt2++) {
|
|
255
|
+
const staged = [];
|
|
256
|
+
for (let part = 0; part < parts.length - 1; part++) {
|
|
257
|
+
(_a2 = options.onPart) == null ? void 0 : _a2.call(options, part + 1, parts.length);
|
|
258
|
+
const held = await call("doc.stage", { workspace_id, epoch, idempotency_key, part, operations: parts[part] });
|
|
259
|
+
if (!held || held.ok === false || typeof held.digest !== "string") {
|
|
260
|
+
const error = (held == null ? void 0 : held.error) ?? { code: "STORAGE_IO_ERROR", retryable: true, detail: "doc.stage returned no digest" };
|
|
261
|
+
return { status: "rejected", code: error.code, retryable: error.retryable, detail: error.detail, ...error.sub_code ? { sub_code: error.sub_code } : {}, errors: [error] };
|
|
262
|
+
}
|
|
263
|
+
staged.push(held.digest);
|
|
264
|
+
}
|
|
265
|
+
(_b2 = options.onPart) == null ? void 0 : _b2.call(options, parts.length, parts.length);
|
|
266
|
+
const result = await call(method, { ...request, staged, operations: parts[parts.length - 1] });
|
|
267
|
+
if (attempt2 === 0 && (result == null ? void 0 : result.status) === "rejected" && result.sub_code === "STAGED_PARTS_MISSING")
|
|
268
|
+
continue;
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
212
272
|
class AiWorkspaceClient {
|
|
213
273
|
constructor(rpcClient) {
|
|
214
274
|
this.rpcClient = rpcClient;
|
|
275
|
+
this.raw = (method, params) => this.rpcClient.call(method, params);
|
|
215
276
|
}
|
|
216
277
|
async call(method, params) {
|
|
217
278
|
const raw = await this.rpcClient.call(method, params);
|
|
@@ -249,11 +310,12 @@ class AiWorkspaceClient {
|
|
|
249
310
|
return this.call("doc.outline", { workspace_id });
|
|
250
311
|
}
|
|
251
312
|
prepare(workspace_id, request) {
|
|
252
|
-
return this.
|
|
313
|
+
return commitWithParts(this.raw, { workspace_id, ...request }, { method: "doc.prepare" });
|
|
253
314
|
}
|
|
254
|
-
/** The three-state commit result (`status: accepted | conflict | rejected`), never thrown.
|
|
255
|
-
|
|
256
|
-
|
|
315
|
+
/** The three-state commit result (`status: accepted | conflict | rejected`), never thrown. One call per Commit
|
|
316
|
+
* whatever its size (up to `AIWS_COMMIT_MAX_BYTES` / `AIWS_COMMIT_MAX_OPERATIONS`): a large one is sent in parts. */
|
|
317
|
+
commit(workspace_id, request, options = {}) {
|
|
318
|
+
return commitWithParts(this.raw, { workspace_id, ...request }, options);
|
|
257
319
|
}
|
|
258
320
|
getSubmission(workspace_id, epoch, idempotency_key) {
|
|
259
321
|
return this.call("doc.get_submission", { workspace_id, epoch, idempotency_key });
|
|
@@ -31708,6 +31770,13 @@ export {
|
|
|
31708
31770
|
parseAppInstanceId as c7,
|
|
31709
31771
|
BNS_EVM_DEFAULT_GAS_LIMIT as c8,
|
|
31710
31772
|
BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as c9,
|
|
31773
|
+
splitCommitOperations as cA,
|
|
31774
|
+
commitOverLimit as cB,
|
|
31775
|
+
commitWithParts as cC,
|
|
31776
|
+
AiWorkspaceClient as cD,
|
|
31777
|
+
importFiles as cE,
|
|
31778
|
+
ensureUploaded as cF,
|
|
31779
|
+
releaseImportSession as cG,
|
|
31711
31780
|
BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as ca,
|
|
31712
31781
|
BNS_MAX_INLINE_DOCUMENT_BYTES as cb,
|
|
31713
31782
|
BNS_DNS_TXT_DEFAULT_TTL as cc,
|
|
@@ -31731,7 +31800,9 @@ export {
|
|
|
31731
31800
|
AiwsFailure as cu,
|
|
31732
31801
|
aiwsReferenceUrl as cv,
|
|
31733
31802
|
parseAiwsReferenceUrl as cw,
|
|
31734
|
-
|
|
31803
|
+
AIWS_COMMIT_PART_BYTES as cx,
|
|
31804
|
+
AIWS_COMMIT_MAX_BYTES as cy,
|
|
31805
|
+
AIWS_COMMIT_MAX_OPERATIONS as cz,
|
|
31735
31806
|
ndm_proxy as d,
|
|
31736
31807
|
bucket_client as e,
|
|
31737
31808
|
BS_SERVICE_TASK_MANAGER as f,
|
|
@@ -31756,4 +31827,4 @@ export {
|
|
|
31756
31827
|
NOTIFY_CHOICE_CONTROL_ID as y,
|
|
31757
31828
|
NOTIFY_TEXT_CONTROL_ID as z
|
|
31758
31829
|
};
|
|
31759
|
-
//# sourceMappingURL=executor_client-
|
|
31830
|
+
//# sourceMappingURL=executor_client-bfc8a1e1.mjs.map
|