buckyos 0.7.177 → 0.7.183
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/LICENSE +202 -21
- package/NOTICE +35 -0
- package/README.md +4 -0
- package/cli/deno.json +3 -2
- package/cli/dist/cli.mjs +1725 -301
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/aiws.ts +761 -58
- package/cli/modules/aiws_place.ts +383 -0
- package/cli/modules/aiws_schedule.ts +256 -0
- package/cli/modules/pikg.ts +193 -51
- package/cli/runtime/fs_retry.ts +26 -0
- package/cli/runtime/host.ts +18 -0
- package/cli/runtime/host_deno.ts +51 -2
- package/cli/runtime/host_node.ts +48 -3
- package/cli/runtime/node_entry.ts +1 -0
- package/cli/system_bootstrap.ts +1 -0
- package/cli/system_launcher.ts +1 -0
- package/cli/version.ts +1 -1
- package/dist/aicc_client.d.ts +1 -1
- package/dist/aicc_client.d.ts.map +1 -1
- package/dist/aiworkspace_client.d.ts +253 -2
- package/dist/aiworkspace_client.d.ts.map +1 -1
- package/dist/aiws_bind-3b874f77.mjs +2235 -0
- package/dist/aiws_bind-3b874f77.mjs.map +1 -0
- package/dist/aiws_bind-82bace11.js +2 -0
- package/dist/aiws_bind-82bace11.js.map +1 -0
- package/dist/aiws_bind.d.ts +233 -0
- package/dist/aiws_bind.d.ts.map +1 -0
- package/dist/aiws_ext.cjs +1 -1
- package/dist/aiws_ext.cjs.map +1 -1
- package/dist/aiws_ext.d.ts +9 -5
- package/dist/aiws_ext.d.ts.map +1 -1
- package/dist/aiws_ext.mjs +146 -11
- package/dist/aiws_ext.mjs.map +1 -1
- package/dist/aiws_rrule.d.ts +121 -0
- package/dist/aiws_rrule.d.ts.map +1 -0
- package/dist/aiws_schedule.d.ts +324 -0
- package/dist/aiws_schedule.d.ts.map +1 -0
- package/dist/aiws_write-89b5cc2a.js +13 -0
- package/dist/aiws_write-89b5cc2a.js.map +1 -0
- package/dist/{executor_client-bfc8a1e1.mjs → aiws_write-c2de498e.mjs} +724 -285
- package/dist/aiws_write-c2de498e.mjs.map +1 -0
- package/dist/aiws_write.d.ts +178 -0
- package/dist/aiws_write.d.ts.map +1 -0
- package/dist/app-frame.cjs +1 -1
- package/dist/app-frame.cjs.map +1 -1
- package/dist/app-frame.d.ts +1 -0
- package/dist/app-frame.d.ts.map +1 -1
- package/dist/app-frame.mjs +6 -2
- 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 +4 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +112 -21
- package/dist/browser.mjs.map +1 -1
- package/dist/{content_objid-9232bcaf.mjs → content_objid-a2cafba9.mjs} +2 -2
- package/dist/{content_objid-9232bcaf.mjs.map → content_objid-a2cafba9.mjs.map} +1 -1
- package/dist/content_objid-dff803ff.js +2 -0
- package/dist/{content_objid-1aff74b6.js.map → content_objid-dff803ff.js.map} +1 -1
- package/dist/{did_object_client-7fa36f90.mjs → did_object_client-cb2f9aba.mjs} +2 -2
- package/dist/{did_object_client-7fa36f90.mjs.map → did_object_client-cb2f9aba.mjs.map} +1 -1
- 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 +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +113 -22
- 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.cjs.map +1 -1
- package/dist/node.d.ts +5 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.mjs +99 -6
- package/dist/node.mjs.map +1 -1
- package/dist/{object_url-f72c1704.mjs → object_url-376c5222.mjs} +4 -4
- package/dist/{object_url-f72c1704.mjs.map → object_url-376c5222.mjs.map} +1 -1
- 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/dist/xllm.mjs +2 -2
- package/package.json +5 -4
- package/dist/content_objid-1aff74b6.js +0 -2
- package/dist/executor_client-7ce0ddc7.js +0 -13
- package/dist/executor_client-7ce0ddc7.js.map +0 -1
- package/dist/executor_client-bfc8a1e1.mjs.map +0 -1
package/dist/provision.mjs
CHANGED
|
@@ -14209,7 +14209,7 @@ function readJsonObjectOrThrow(filePath) {
|
|
|
14209
14209
|
function jsonPretty(value) {
|
|
14210
14210
|
return JSON.stringify(value, null, 2);
|
|
14211
14211
|
}
|
|
14212
|
-
function commitFile(filePath, content, mode, dirMode) {
|
|
14212
|
+
function commitFile(filePath, content, mode, dirMode, placeholder) {
|
|
14213
14213
|
const fs = requireNode$1("node:fs");
|
|
14214
14214
|
const path = requireNode$1("node:path");
|
|
14215
14215
|
const directory = path.dirname(filePath);
|
|
@@ -14217,15 +14217,23 @@ function commitFile(filePath, content, mode, dirMode) {
|
|
|
14217
14217
|
if (!isWindows()) {
|
|
14218
14218
|
fs.chmodSync(directory, dirMode);
|
|
14219
14219
|
}
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14220
|
+
const assertDestination = () => {
|
|
14221
|
+
if (placeholder !== void 0) {
|
|
14222
|
+
if (readGatewayPlaceholder(filePath) !== placeholder) {
|
|
14223
|
+
throw new Error(`gateway placeholder changed during activation: ${filePath}`);
|
|
14224
|
+
}
|
|
14225
|
+
} else if (lstatOrNull(filePath)) {
|
|
14226
|
+
throw new Error(`refusing to overwrite existing file: ${filePath}`);
|
|
14227
|
+
}
|
|
14228
|
+
};
|
|
14229
|
+
assertDestination();
|
|
14223
14230
|
const temporary = path.join(directory, `.${path.basename(filePath)}.provision-${randomSuffix()}`);
|
|
14224
14231
|
try {
|
|
14225
14232
|
fs.writeFileSync(temporary, content, { mode, flag: "wx" });
|
|
14226
14233
|
if (!isWindows()) {
|
|
14227
14234
|
fs.chmodSync(temporary, mode);
|
|
14228
14235
|
}
|
|
14236
|
+
assertDestination();
|
|
14229
14237
|
fs.renameSync(temporary, filePath);
|
|
14230
14238
|
} finally {
|
|
14231
14239
|
if (lstatOrNull(temporary)) {
|
|
@@ -14474,13 +14482,23 @@ function observeIdentity(nodeIdentityPath, problems) {
|
|
|
14474
14482
|
return { nodeIdentity: null, zoneDid: null, deviceDid: null };
|
|
14475
14483
|
}
|
|
14476
14484
|
}
|
|
14477
|
-
function
|
|
14485
|
+
function readGatewayPlaceholder(gatewayParamsPath) {
|
|
14486
|
+
var _a3;
|
|
14478
14487
|
try {
|
|
14479
|
-
|
|
14488
|
+
if (!((_a3 = lstatOrNull(gatewayParamsPath)) == null ? void 0 : _a3.isFile()))
|
|
14489
|
+
return void 0;
|
|
14490
|
+
const content = requireNode$1("node:fs").readFileSync(gatewayParamsPath, "utf8");
|
|
14491
|
+
const value = JSON.parse(content);
|
|
14492
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => key !== "params"))
|
|
14493
|
+
return void 0;
|
|
14480
14494
|
const params = value.params;
|
|
14481
|
-
|
|
14495
|
+
if (!params || typeof params !== "object" || Array.isArray(params) || params.device_did !== UNACTIVATED_GATEWAY_DEVICE_DID || Object.keys(params).some((key) => key !== "device_did" && key !== "rtcp_port"))
|
|
14496
|
+
return void 0;
|
|
14497
|
+
if (params.rtcp_port !== void 0 && (typeof params.rtcp_port !== "string" || !/^\d+$/.test(params.rtcp_port) || Number(params.rtcp_port) < 1 || Number(params.rtcp_port) > 65535))
|
|
14498
|
+
return void 0;
|
|
14499
|
+
return content;
|
|
14482
14500
|
} catch {
|
|
14483
|
-
return
|
|
14501
|
+
return void 0;
|
|
14484
14502
|
}
|
|
14485
14503
|
}
|
|
14486
14504
|
async function validateActivationMaterials(rootDir, layout, identity, problems) {
|
|
@@ -14675,6 +14693,9 @@ function getXFromJwkSafe(jwk) {
|
|
|
14675
14693
|
}
|
|
14676
14694
|
}
|
|
14677
14695
|
async function inspectActivationRoot(rootDir) {
|
|
14696
|
+
return inspectRoot(rootDir);
|
|
14697
|
+
}
|
|
14698
|
+
async function inspectRoot(rootDir, ignoreOwnLock = false) {
|
|
14678
14699
|
const path = requireNode$1("node:path");
|
|
14679
14700
|
const root = path.resolve(String(rootDir ?? ""));
|
|
14680
14701
|
const observedAt = buckyosGetUnixTimestamp();
|
|
@@ -14707,7 +14728,7 @@ async function inspectActivationRoot(rootDir) {
|
|
|
14707
14728
|
return base("not_installed");
|
|
14708
14729
|
}
|
|
14709
14730
|
const etcDir = path.join(root, "etc");
|
|
14710
|
-
const lock = readLock(path.join(etcDir, ACTIVATION_LOCK_FILE_NAME));
|
|
14731
|
+
const lock = ignoreOwnLock ? null : readLock(path.join(etcDir, ACTIVATION_LOCK_FILE_NAME));
|
|
14711
14732
|
const identity = observeIdentity(path.join(etcDir, "node_identity.json"), problems);
|
|
14712
14733
|
let zoneDid = identity.zoneDid;
|
|
14713
14734
|
let deviceDid = identity.deviceDid;
|
|
@@ -14752,7 +14773,7 @@ async function inspectActivationRoot(rootDir) {
|
|
|
14752
14773
|
}
|
|
14753
14774
|
}
|
|
14754
14775
|
const gatewayEntry = files.find((file) => file.role === "gateway_params");
|
|
14755
|
-
const gatewayPlaceholder = (gatewayEntry == null ? void 0 : gatewayEntry.present) === true &&
|
|
14776
|
+
const gatewayPlaceholder = (gatewayEntry == null ? void 0 : gatewayEntry.present) === true && readGatewayPlaceholder(path.join(etcDir, "node_gateway_params.json")) !== void 0;
|
|
14756
14777
|
if (gatewayEntry && gatewayPlaceholder)
|
|
14757
14778
|
gatewayEntry.present = false;
|
|
14758
14779
|
const markers = files.filter((file) => file.present && file.role !== "dns_records");
|
|
@@ -14839,8 +14860,11 @@ function targetStateProblem(status) {
|
|
|
14839
14860
|
}
|
|
14840
14861
|
}
|
|
14841
14862
|
async function checkOfflineActivation(options) {
|
|
14863
|
+
return checkActivation(options);
|
|
14864
|
+
}
|
|
14865
|
+
async function checkActivation(options, ignoreOwnLock = false) {
|
|
14842
14866
|
const params = normalizeActivationParams(options);
|
|
14843
|
-
const status = await
|
|
14867
|
+
const status = await inspectRoot(params.rootDir, ignoreOwnLock);
|
|
14844
14868
|
const problems = [];
|
|
14845
14869
|
const stateProblem = targetStateProblem(status);
|
|
14846
14870
|
if (stateProblem)
|
|
@@ -15068,18 +15092,20 @@ async function activateOfflineZone(options) {
|
|
|
15068
15092
|
};
|
|
15069
15093
|
let recheck;
|
|
15070
15094
|
try {
|
|
15071
|
-
recheck = await
|
|
15095
|
+
recheck = await checkActivation(options, true);
|
|
15072
15096
|
} catch (error) {
|
|
15073
15097
|
releaseLock();
|
|
15074
15098
|
throw error;
|
|
15075
15099
|
}
|
|
15076
|
-
|
|
15077
|
-
if (recheckProblems.length > 0) {
|
|
15100
|
+
if (!recheck.ready) {
|
|
15078
15101
|
releaseLock();
|
|
15079
|
-
throw precheckError(
|
|
15102
|
+
throw precheckError(recheck);
|
|
15080
15103
|
}
|
|
15104
|
+
const gatewayPlaceholder = readGatewayPlaceholder(layout.gatewayParamsPath);
|
|
15081
15105
|
for (const file of files) {
|
|
15082
15106
|
if (lstatOrNull(file.absolutePath)) {
|
|
15107
|
+
if (file.role === "gateway_params" && gatewayPlaceholder !== void 0)
|
|
15108
|
+
continue;
|
|
15083
15109
|
releaseLock();
|
|
15084
15110
|
throw new ActivationError(
|
|
15085
15111
|
"TARGET_PARTIALLY_ACTIVATED",
|
|
@@ -15123,7 +15149,13 @@ async function activateOfflineZone(options) {
|
|
|
15123
15149
|
for (const file of files) {
|
|
15124
15150
|
const content = fileContent(file, material, deviceKeyPair, params.domain);
|
|
15125
15151
|
try {
|
|
15126
|
-
commitFile(
|
|
15152
|
+
commitFile(
|
|
15153
|
+
file.absolutePath,
|
|
15154
|
+
content,
|
|
15155
|
+
file.mode,
|
|
15156
|
+
file.dirMode,
|
|
15157
|
+
file.role === "gateway_params" ? gatewayPlaceholder : void 0
|
|
15158
|
+
);
|
|
15127
15159
|
} catch (error) {
|
|
15128
15160
|
failCommit(error, file.path);
|
|
15129
15161
|
}
|