buckyos 0.7.138 → 0.7.142
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/core/app.ts +4 -0
- package/cli/core/auth.ts +2 -3
- package/cli/dist/cli.mjs +547 -127
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/aiws.ts +294 -0
- package/cli/modules/executor.ts +98 -0
- package/cli/version.ts +1 -1
- package/dist/account.d.ts +0 -2
- package/dist/account.d.ts.map +1 -1
- package/dist/aiworkspace_client.d.ts +91 -0
- package/dist/aiworkspace_client.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 +103 -3
- package/dist/app-frame.d.ts.map +1 -1
- package/dist/app-frame.mjs +189 -8
- 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 +18 -15
- 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 +18 -0
- package/dist/content.d.ts.map +1 -1
- package/dist/content.mjs +61 -1
- package/dist/content.mjs.map +1 -1
- package/dist/executor_client-b3ff97ba.js +13 -0
- package/dist/executor_client-b3ff97ba.js.map +1 -0
- package/dist/{ndm_proxy-6b03b9ec.mjs → executor_client-eb372968.mjs} +901 -396
- package/dist/executor_client-eb372968.mjs.map +1 -0
- package/dist/executor_client.d.ts +138 -0
- package/dist/executor_client.d.ts.map +1 -0
- 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 +23 -15
- package/dist/index.mjs.map +1 -1
- package/dist/internal/hash_worker.d.ts +2 -1
- package/dist/internal/hash_worker.d.ts.map +1 -1
- package/dist/internal/tus_client.d.ts +3 -0
- package/dist/internal/tus_client.d.ts.map +1 -1
- package/dist/namelib.d.ts +1 -10
- package/dist/namelib.d.ts.map +1 -1
- package/dist/ndm_client.d.ts +56 -7
- package/dist/ndm_client.d.ts.map +1 -1
- package/dist/ndn_types-08dc9ef1.js +2 -0
- package/dist/ndn_types-08dc9ef1.js.map +1 -0
- package/dist/{ndn_types-ac9c1e48.mjs → ndn_types-bbb1f6a6.mjs} +53 -100
- package/dist/ndn_types-bbb1f6a6.mjs.map +1 -0
- package/dist/nfsp.cjs +1 -1
- package/dist/nfsp.cjs.map +1 -1
- package/dist/nfsp.d.ts +16 -0
- package/dist/nfsp.d.ts.map +1 -1
- package/dist/nfsp.mjs +6 -0
- 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 +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.mjs +18 -15
- package/dist/node.mjs.map +1 -1
- package/dist/provision.cjs +2 -2
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +18 -12
- package/dist/provision.mjs.map +1 -1
- package/dist/provision_activate.d.ts.map +1 -1
- package/dist/runtime.d.ts +3 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/sdk_core.d.ts +4 -0
- package/dist/sdk_core.d.ts.map +1 -1
- package/dist/{tus_client-2b915a81.js → tus_client-65c5fc5e.js} +4 -4
- package/dist/tus_client-65c5fc5e.js.map +1 -0
- package/dist/{tus_client-19baa342.mjs → tus_client-d313689e.mjs} +40 -2
- package/dist/tus_client-d313689e.mjs.map +1 -0
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-hub-client.d.ts +1 -9
- package/dist/verify-hub-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ndm_proxy-67651066.js +0 -13
- package/dist/ndm_proxy-67651066.js.map +0 -1
- package/dist/ndm_proxy-6b03b9ec.mjs.map +0 -1
- package/dist/ndn_types-324121ae.js +0 -2
- package/dist/ndn_types-324121ae.js.map +0 -1
- package/dist/ndn_types-ac9c1e48.mjs.map +0 -1
- package/dist/tus_client-19baa342.mjs.map +0 -1
- package/dist/tus_client-2b915a81.js.map +0 -1
package/cli/dist/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import process from "node:process";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import * as nodePath from "node:path";
|
|
4
4
|
import { resolve as resolve$5, dirname as dirname$3 } from "node:path";
|
|
5
|
-
import { BuckyOSSDK, RuntimeType, buckyos, namelib, VerifyHubClient, createAppInstanceId, parseSessionTokenClaims, ndn, ndm_proxy } from "buckyos/node";
|
|
5
|
+
import { BuckyOSSDK, RuntimeType, buckyos, namelib, VerifyHubClient, createAppInstanceId, parseSessionTokenClaims, ndn, ndm_proxy, ExecutorCommandStream } from "buckyos/node";
|
|
6
6
|
import * as provisionSdk from "buckyos/provision";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { readFile, writeFile, readdir, stat, lstat, realpath, mkdtemp, rename, rm, mkdir, chmod, symlink, copyFile, open } from "node:fs/promises";
|
|
@@ -345,20 +345,20 @@ function validateSchema(value, schema, path) {
|
|
|
345
345
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
346
346
|
throw new UsageError("SCHEMA_VALIDATION_FAILED", `${path} must be an object`);
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const object2 = value;
|
|
349
349
|
for (const required of schema.required ?? []) {
|
|
350
|
-
if (!Object.hasOwn(
|
|
350
|
+
if (!Object.hasOwn(object2, required)) {
|
|
351
351
|
throw new UsageError("SCHEMA_VALIDATION_FAILED", `${path}.${required} is required`);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
if (schema.additionalProperties === false) {
|
|
355
|
-
for (const key of Object.keys(
|
|
355
|
+
for (const key of Object.keys(object2)) {
|
|
356
356
|
if (!Object.hasOwn(schema.properties ?? {}, key)) {
|
|
357
357
|
throw new UsageError("SCHEMA_VALIDATION_FAILED", `${path}.${key} is not allowed`);
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
for (const [key, propertyValue] of Object.entries(
|
|
361
|
+
for (const [key, propertyValue] of Object.entries(object2)) {
|
|
362
362
|
const propertySchema = schema.properties?.[key];
|
|
363
363
|
if (propertySchema)
|
|
364
364
|
validateSchema(propertyValue, propertySchema, `${path}.${key}`);
|
|
@@ -1874,10 +1874,9 @@ class SdkAuthenticationTransport {
|
|
|
1874
1874
|
}),
|
|
1875
1875
|
timeoutMs
|
|
1876
1876
|
);
|
|
1877
|
-
|
|
1878
|
-
if (!normalized.session_token)
|
|
1877
|
+
if (!response.session_token)
|
|
1879
1878
|
throw new Error("verify-hub returned no session token");
|
|
1880
|
-
return
|
|
1879
|
+
return response.session_token;
|
|
1881
1880
|
}
|
|
1882
1881
|
}
|
|
1883
1882
|
function identityAuthTarget(principalKind, subject) {
|
|
@@ -2057,11 +2056,11 @@ function renderText(data) {
|
|
|
2057
2056
|
if (typeof data === "string")
|
|
2058
2057
|
return data;
|
|
2059
2058
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
2060
|
-
const
|
|
2061
|
-
if (typeof
|
|
2062
|
-
return
|
|
2063
|
-
if (typeof
|
|
2064
|
-
return
|
|
2059
|
+
const object2 = data;
|
|
2060
|
+
if (typeof object2.script === "string")
|
|
2061
|
+
return object2.script;
|
|
2062
|
+
if (typeof object2.text === "string")
|
|
2063
|
+
return object2.text;
|
|
2065
2064
|
}
|
|
2066
2065
|
return JSON.stringify(data, null, 2);
|
|
2067
2066
|
}
|
|
@@ -2069,11 +2068,11 @@ function renderTable(data) {
|
|
|
2069
2068
|
if (Array.isArray(data))
|
|
2070
2069
|
return renderRows(data);
|
|
2071
2070
|
if (data && typeof data === "object") {
|
|
2072
|
-
const
|
|
2073
|
-
const arrayEntry = Object.entries(
|
|
2071
|
+
const object2 = data;
|
|
2072
|
+
const arrayEntry = Object.entries(object2).find(([, value]) => Array.isArray(value));
|
|
2074
2073
|
if (arrayEntry)
|
|
2075
2074
|
return renderRows(arrayEntry[1]);
|
|
2076
|
-
const rows = Object.entries(
|
|
2075
|
+
const rows = Object.entries(object2).map(([key, value]) => ({ key, value: displayValue(value) }));
|
|
2077
2076
|
return renderRows(rows);
|
|
2078
2077
|
}
|
|
2079
2078
|
return String(data ?? "");
|
|
@@ -2499,7 +2498,7 @@ function replPrompt(config) {
|
|
|
2499
2498
|
return `buckyos[${profile}|${zone}|${identity}]> `;
|
|
2500
2499
|
}
|
|
2501
2500
|
const EMPTY_INPUT$3 = { type: "object", properties: {}, additionalProperties: false };
|
|
2502
|
-
const OBJECT_OUTPUT$
|
|
2501
|
+
const OBJECT_OUTPUT$d = { type: "object", additionalProperties: true };
|
|
2503
2502
|
function createAuthModule() {
|
|
2504
2503
|
return {
|
|
2505
2504
|
name: "auth",
|
|
@@ -2509,7 +2508,7 @@ function createAuthModule() {
|
|
|
2509
2508
|
verb: "whoami",
|
|
2510
2509
|
summary: "Show the effective principal and application identity",
|
|
2511
2510
|
inputSchema: EMPTY_INPUT$3,
|
|
2512
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2511
|
+
outputSchema: OBJECT_OUTPUT$d,
|
|
2513
2512
|
resultSchemaVersion: 1,
|
|
2514
2513
|
access: { mode: "fixed", level: "read" },
|
|
2515
2514
|
asyncMode: "sync",
|
|
@@ -2527,7 +2526,7 @@ function createAuthModule() {
|
|
|
2527
2526
|
verb: "session-status",
|
|
2528
2527
|
summary: "Show the in-memory session state without exposing credentials",
|
|
2529
2528
|
inputSchema: EMPTY_INPUT$3,
|
|
2530
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2529
|
+
outputSchema: OBJECT_OUTPUT$d,
|
|
2531
2530
|
resultSchemaVersion: 1,
|
|
2532
2531
|
access: { mode: "fixed", level: "read" },
|
|
2533
2532
|
asyncMode: "sync",
|
|
@@ -2548,7 +2547,7 @@ const EMPTY_INPUT$2 = {
|
|
|
2548
2547
|
properties: {},
|
|
2549
2548
|
additionalProperties: false
|
|
2550
2549
|
};
|
|
2551
|
-
const OBJECT_OUTPUT$
|
|
2550
|
+
const OBJECT_OUTPUT$c = { type: "object", additionalProperties: true };
|
|
2552
2551
|
function createCoreModules(registry) {
|
|
2553
2552
|
return [createCommandModule(registry), createConfigModule(), createCompletionModule(registry)];
|
|
2554
2553
|
}
|
|
@@ -2561,7 +2560,7 @@ function createCommandModule(registry) {
|
|
|
2561
2560
|
verb: "list",
|
|
2562
2561
|
summary: "List registered modules and commands",
|
|
2563
2562
|
inputSchema: EMPTY_INPUT$2,
|
|
2564
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2563
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2565
2564
|
resultSchemaVersion: 1,
|
|
2566
2565
|
access: { mode: "fixed", level: "read" },
|
|
2567
2566
|
asyncMode: "sync",
|
|
@@ -2594,7 +2593,7 @@ function createCommandModule(registry) {
|
|
|
2594
2593
|
required: ["target_module", "target_verb"],
|
|
2595
2594
|
additionalProperties: false
|
|
2596
2595
|
},
|
|
2597
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2596
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2598
2597
|
resultSchemaVersion: 1,
|
|
2599
2598
|
access: { mode: "fixed", level: "read" },
|
|
2600
2599
|
asyncMode: "sync",
|
|
@@ -2616,7 +2615,7 @@ function createConfigModule() {
|
|
|
2616
2615
|
verb: "list",
|
|
2617
2616
|
summary: "List the global configuration and available profiles",
|
|
2618
2617
|
inputSchema: EMPTY_INPUT$2,
|
|
2619
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2618
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2620
2619
|
resultSchemaVersion: 1,
|
|
2621
2620
|
access: { mode: "fixed", level: "read" },
|
|
2622
2621
|
asyncMode: "sync",
|
|
@@ -2647,7 +2646,7 @@ function createConfigModule() {
|
|
|
2647
2646
|
},
|
|
2648
2647
|
additionalProperties: false
|
|
2649
2648
|
},
|
|
2650
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2649
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2651
2650
|
resultSchemaVersion: 1,
|
|
2652
2651
|
access: { mode: "fixed", level: "read" },
|
|
2653
2652
|
asyncMode: "sync",
|
|
@@ -2693,7 +2692,7 @@ function createConfigModule() {
|
|
|
2693
2692
|
required: ["key", "value"],
|
|
2694
2693
|
additionalProperties: false
|
|
2695
2694
|
},
|
|
2696
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2695
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2697
2696
|
resultSchemaVersion: 1,
|
|
2698
2697
|
access: { mode: "fixed", level: "write" },
|
|
2699
2698
|
asyncMode: "sync",
|
|
@@ -2733,7 +2732,7 @@ function createConfigModule() {
|
|
|
2733
2732
|
required: ["profile_name"],
|
|
2734
2733
|
additionalProperties: false
|
|
2735
2734
|
},
|
|
2736
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2735
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2737
2736
|
resultSchemaVersion: 1,
|
|
2738
2737
|
access: { mode: "fixed", level: "write" },
|
|
2739
2738
|
asyncMode: "sync",
|
|
@@ -2765,7 +2764,7 @@ function createConfigModule() {
|
|
|
2765
2764
|
properties: { effective: { type: "boolean" } },
|
|
2766
2765
|
additionalProperties: false
|
|
2767
2766
|
},
|
|
2768
|
-
outputSchema: OBJECT_OUTPUT$
|
|
2767
|
+
outputSchema: OBJECT_OUTPUT$c,
|
|
2769
2768
|
resultSchemaVersion: 1,
|
|
2770
2769
|
access: { mode: "fixed", level: "read" },
|
|
2771
2770
|
asyncMode: "sync",
|
|
@@ -3007,7 +3006,7 @@ async function buckyosInfo(ctx) {
|
|
|
3007
3006
|
);
|
|
3008
3007
|
}
|
|
3009
3008
|
const SERVICE_NAME = "system_config";
|
|
3010
|
-
const OBJECT_OUTPUT$
|
|
3009
|
+
const OBJECT_OUTPUT$b = { type: "object", additionalProperties: false };
|
|
3011
3010
|
const KEY_INPUT = {
|
|
3012
3011
|
type: "object",
|
|
3013
3012
|
properties: { key: { type: "string", minLength: 1 } },
|
|
@@ -3025,7 +3024,7 @@ function createSystemConfigModule() {
|
|
|
3025
3024
|
positionals: [{ name: "key", description: "System-config key" }],
|
|
3026
3025
|
inputSchema: KEY_INPUT,
|
|
3027
3026
|
outputSchema: {
|
|
3028
|
-
...OBJECT_OUTPUT$
|
|
3027
|
+
...OBJECT_OUTPUT$b,
|
|
3029
3028
|
properties: {
|
|
3030
3029
|
key: { type: "string" },
|
|
3031
3030
|
value: { type: "string" },
|
|
@@ -3068,7 +3067,7 @@ function createSystemConfigModule() {
|
|
|
3068
3067
|
additionalProperties: false
|
|
3069
3068
|
},
|
|
3070
3069
|
outputSchema: {
|
|
3071
|
-
...OBJECT_OUTPUT$
|
|
3070
|
+
...OBJECT_OUTPUT$b,
|
|
3072
3071
|
properties: {
|
|
3073
3072
|
key: { type: "string" },
|
|
3074
3073
|
items: { type: "array", items: { type: "string" } }
|
|
@@ -3122,7 +3121,7 @@ function setCommand() {
|
|
|
3122
3121
|
additionalProperties: false
|
|
3123
3122
|
},
|
|
3124
3123
|
outputSchema: {
|
|
3125
|
-
...OBJECT_OUTPUT$
|
|
3124
|
+
...OBJECT_OUTPUT$b,
|
|
3126
3125
|
properties: { key: { type: "string" }, updated: { type: "boolean" } },
|
|
3127
3126
|
required: ["key", "updated"]
|
|
3128
3127
|
},
|
|
@@ -3161,7 +3160,7 @@ function setFileCommand() {
|
|
|
3161
3160
|
additionalProperties: false
|
|
3162
3161
|
},
|
|
3163
3162
|
outputSchema: {
|
|
3164
|
-
...OBJECT_OUTPUT$
|
|
3163
|
+
...OBJECT_OUTPUT$b,
|
|
3165
3164
|
properties: { key: { type: "string" }, updated: { type: "boolean" } },
|
|
3166
3165
|
required: ["key", "updated"]
|
|
3167
3166
|
},
|
|
@@ -3198,7 +3197,7 @@ function mutationCommand(options) {
|
|
|
3198
3197
|
additionalProperties: false
|
|
3199
3198
|
},
|
|
3200
3199
|
outputSchema: {
|
|
3201
|
-
...OBJECT_OUTPUT$
|
|
3200
|
+
...OBJECT_OUTPUT$b,
|
|
3202
3201
|
properties: {
|
|
3203
3202
|
key: { type: "string" },
|
|
3204
3203
|
[options.resultProperty]: { type: "boolean" }
|
|
@@ -3240,8 +3239,8 @@ async function readValueFile(path) {
|
|
|
3240
3239
|
function isConfigValue(value) {
|
|
3241
3240
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3242
3241
|
return false;
|
|
3243
|
-
const
|
|
3244
|
-
return typeof
|
|
3242
|
+
const object2 = value;
|
|
3243
|
+
return typeof object2.value === "string" && Number.isSafeInteger(object2.version) && Number(object2.version) >= 0;
|
|
3245
3244
|
}
|
|
3246
3245
|
function invalidResponse$3(method) {
|
|
3247
3246
|
throw new ToolError(
|
|
@@ -3333,7 +3332,7 @@ async function gzipFile(source, destination) {
|
|
|
3333
3332
|
async function readTarGz(bytes, limit) {
|
|
3334
3333
|
const tar = await gunzipBytes(bytes, limit);
|
|
3335
3334
|
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
3336
|
-
const
|
|
3335
|
+
const text2 = (offset2, length) => decoder.decode(tar.subarray(offset2, offset2 + length)).replace(/\0.*$/s, "");
|
|
3337
3336
|
const files = [];
|
|
3338
3337
|
const seen = /* @__PURE__ */ new Set();
|
|
3339
3338
|
let offset = 0;
|
|
@@ -3342,10 +3341,10 @@ async function readTarGz(bytes, limit) {
|
|
|
3342
3341
|
let size;
|
|
3343
3342
|
let mode;
|
|
3344
3343
|
try {
|
|
3345
|
-
const prefix =
|
|
3346
|
-
raw = prefix ? `${prefix}/${
|
|
3347
|
-
size = Number.parseInt(
|
|
3348
|
-
mode = Number.parseInt(
|
|
3344
|
+
const prefix = text2(offset + 257, 6) === "ustar" ? text2(offset + 345, 155) : "";
|
|
3345
|
+
raw = prefix ? `${prefix}/${text2(offset, 100)}` : text2(offset, 100);
|
|
3346
|
+
size = Number.parseInt(text2(offset + 124, 12).trim() || "0", 8);
|
|
3347
|
+
mode = Number.parseInt(text2(offset + 100, 8).trim() || "0", 8);
|
|
3349
3348
|
} catch {
|
|
3350
3349
|
throw invalidZip("payload", "tar header is not valid UTF-8");
|
|
3351
3350
|
}
|
|
@@ -3961,14 +3960,14 @@ function writeString(target, offset, length, value) {
|
|
|
3961
3960
|
target.set(bytes, offset);
|
|
3962
3961
|
}
|
|
3963
3962
|
function writeOctal(target, offset, length, value) {
|
|
3964
|
-
const
|
|
3965
|
-
if (
|
|
3963
|
+
const text2 = value.toString(8).padStart(length - 1, "0");
|
|
3964
|
+
if (text2.length >= length)
|
|
3966
3965
|
throw new UsageError("FILE_TOO_LARGE", "tar field overflows");
|
|
3967
|
-
writeString(target, offset, length, `${
|
|
3966
|
+
writeString(target, offset, length, `${text2}\0`);
|
|
3968
3967
|
}
|
|
3969
3968
|
function writeChecksum(target, value) {
|
|
3970
|
-
const
|
|
3971
|
-
writeString(target, 148, 8, `${
|
|
3969
|
+
const text2 = value.toString(8).padStart(6, "0");
|
|
3970
|
+
writeString(target, 148, 8, `${text2}\0 `);
|
|
3972
3971
|
}
|
|
3973
3972
|
function validateZipEntryName(name) {
|
|
3974
3973
|
if (!name || name.includes("\0") || name.includes("\\") || name.startsWith("/")) {
|
|
@@ -5106,7 +5105,7 @@ function validateContentHandlers(value, permissions) {
|
|
|
5106
5105
|
}
|
|
5107
5106
|
return value;
|
|
5108
5107
|
}
|
|
5109
|
-
const PACKAGE_VERSION = "0.7.
|
|
5108
|
+
const PACKAGE_VERSION = "0.7.142";
|
|
5110
5109
|
const TOOL_VERSION = PACKAGE_VERSION;
|
|
5111
5110
|
const SDK_VERSION = PACKAGE_VERSION;
|
|
5112
5111
|
const PROTOCOL_VERSION = "1";
|
|
@@ -5123,7 +5122,7 @@ const VERSION$1 = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
|
5123
5122
|
const SHA256_ID = /^sha256:[0-9a-f]{64}$/;
|
|
5124
5123
|
const OBJECT_ID = /^(?:appdoc|pkg):[0-9a-f]{64}$/;
|
|
5125
5124
|
const SAFE_GENERATED_FILE = /^[A-Za-z0-9._-]+$/;
|
|
5126
|
-
const OBJECT_OUTPUT$
|
|
5125
|
+
const OBJECT_OUTPUT$a = { type: "object", additionalProperties: true };
|
|
5127
5126
|
const APP_KINDS = ["static-web", "script", "docker", "agent-skills"];
|
|
5128
5127
|
const PATH_KINDS = {
|
|
5129
5128
|
"static-web": { key: "web", category: "web", selectorType: "static" },
|
|
@@ -5166,7 +5165,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5166
5165
|
properties: { meta_dir: { type: "string", minLength: 1 } },
|
|
5167
5166
|
additionalProperties: false
|
|
5168
5167
|
},
|
|
5169
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5168
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5170
5169
|
resultSchemaVersion: 1,
|
|
5171
5170
|
access: { mode: "fixed", level: "read" },
|
|
5172
5171
|
asyncMode: "sync",
|
|
@@ -5213,7 +5212,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5213
5212
|
},
|
|
5214
5213
|
additionalProperties: false
|
|
5215
5214
|
},
|
|
5216
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5215
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5217
5216
|
resultSchemaVersion: 1,
|
|
5218
5217
|
access: { mode: "fixed", level: "write" },
|
|
5219
5218
|
asyncMode: "sync",
|
|
@@ -5238,7 +5237,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5238
5237
|
properties: { meta_dir: { type: "string", minLength: 1 } },
|
|
5239
5238
|
additionalProperties: false
|
|
5240
5239
|
},
|
|
5241
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5240
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5242
5241
|
resultSchemaVersion: 1,
|
|
5243
5242
|
access: { mode: "fixed", level: "write" },
|
|
5244
5243
|
asyncMode: "sync",
|
|
@@ -5259,7 +5258,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5259
5258
|
properties: { dist_dir: { type: "string", minLength: 1 } },
|
|
5260
5259
|
additionalProperties: false
|
|
5261
5260
|
},
|
|
5262
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5261
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5263
5262
|
resultSchemaVersion: 1,
|
|
5264
5263
|
access: { mode: "fixed", level: "write" },
|
|
5265
5264
|
asyncMode: "sync",
|
|
@@ -5279,7 +5278,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5279
5278
|
required: ["pikg_path"],
|
|
5280
5279
|
additionalProperties: false
|
|
5281
5280
|
},
|
|
5282
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5281
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5283
5282
|
resultSchemaVersion: 1,
|
|
5284
5283
|
access: { mode: "fixed", level: "read" },
|
|
5285
5284
|
asyncMode: "sync",
|
|
@@ -5300,7 +5299,7 @@ function createPikgModule(dependencies = {}) {
|
|
|
5300
5299
|
properties: { meta_dir: { type: "string", minLength: 1 } },
|
|
5301
5300
|
additionalProperties: false
|
|
5302
5301
|
},
|
|
5303
|
-
outputSchema: OBJECT_OUTPUT$
|
|
5302
|
+
outputSchema: OBJECT_OUTPUT$a,
|
|
5304
5303
|
resultSchemaVersion: 1,
|
|
5305
5304
|
access: { mode: "fixed", level: "destructive" },
|
|
5306
5305
|
asyncMode: "sync",
|
|
@@ -6394,8 +6393,8 @@ function toPortablePath(path) {
|
|
|
6394
6393
|
return path.split(getHost().path.sep).join("/") || ".";
|
|
6395
6394
|
}
|
|
6396
6395
|
function safeDockerError(bytes) {
|
|
6397
|
-
const
|
|
6398
|
-
return
|
|
6396
|
+
const text2 = new TextDecoder().decode(bytes).trim().replaceAll(/[\r\n]+/g, " ");
|
|
6397
|
+
return text2.slice(0, 500) || "unknown Docker error";
|
|
6399
6398
|
}
|
|
6400
6399
|
async function removeTreeIfExists(path) {
|
|
6401
6400
|
try {
|
|
@@ -6563,7 +6562,7 @@ const CONTROL_PANEL_SERVICE = "control-panel";
|
|
|
6563
6562
|
const PLAN_SCHEMA_VERSION = 4;
|
|
6564
6563
|
const STAGING_RELEASE_TIMEOUT_MS = 5e3;
|
|
6565
6564
|
const ZIP_LOCAL_MAGIC = [80, 75, 3, 4];
|
|
6566
|
-
const OBJECT_OUTPUT$
|
|
6565
|
+
const OBJECT_OUTPUT$9 = { type: "object", additionalProperties: true };
|
|
6567
6566
|
const INSTALL_POLICIES = [
|
|
6568
6567
|
"strict-public",
|
|
6569
6568
|
"normal",
|
|
@@ -6614,7 +6613,7 @@ function cancelCommand$1() {
|
|
|
6614
6613
|
required: ["task_id"],
|
|
6615
6614
|
additionalProperties: false
|
|
6616
6615
|
},
|
|
6617
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6616
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6618
6617
|
resultSchemaVersion: 1,
|
|
6619
6618
|
access: { mode: "fixed", level: "write" },
|
|
6620
6619
|
asyncMode: "sync",
|
|
@@ -6649,7 +6648,7 @@ function fetchCommand(dependencies) {
|
|
|
6649
6648
|
target: { type: "object", additionalProperties: true },
|
|
6650
6649
|
install_params: { type: "object", additionalProperties: true }
|
|
6651
6650
|
}),
|
|
6652
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6651
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6653
6652
|
resultSchemaVersion: 1,
|
|
6654
6653
|
access: { mode: "fixed", level: "read" },
|
|
6655
6654
|
asyncMode: "sync",
|
|
@@ -6666,7 +6665,7 @@ function listCommand$2() {
|
|
|
6666
6665
|
verb: "list",
|
|
6667
6666
|
summary: "List visible installed Apps",
|
|
6668
6667
|
inputSchema: emptyInputSchema(),
|
|
6669
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6668
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6670
6669
|
resultSchemaVersion: 1,
|
|
6671
6670
|
access: { mode: "fixed", level: "read" },
|
|
6672
6671
|
asyncMode: "sync",
|
|
@@ -6724,7 +6723,7 @@ function installCommand(dependencies) {
|
|
|
6724
6723
|
no_wait: { type: "boolean" },
|
|
6725
6724
|
policy: { type: "string", enum: [...INSTALL_POLICIES] }
|
|
6726
6725
|
}),
|
|
6727
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6726
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6728
6727
|
resultSchemaVersion: 1,
|
|
6729
6728
|
access: { mode: "fixed", level: "write" },
|
|
6730
6729
|
asyncMode: "either",
|
|
@@ -6768,7 +6767,7 @@ function upgradeCommand(dependencies) {
|
|
|
6768
6767
|
},
|
|
6769
6768
|
additionalProperties: false
|
|
6770
6769
|
},
|
|
6771
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6770
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6772
6771
|
resultSchemaVersion: 1,
|
|
6773
6772
|
access: { mode: "fixed", level: "write" },
|
|
6774
6773
|
asyncMode: "either",
|
|
@@ -6897,7 +6896,7 @@ function statusCommand$1() {
|
|
|
6897
6896
|
properties: { app_name: { type: "string", minLength: 1 } },
|
|
6898
6897
|
additionalProperties: false
|
|
6899
6898
|
},
|
|
6900
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6899
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6901
6900
|
resultSchemaVersion: 1,
|
|
6902
6901
|
access: { mode: "fixed", level: "read" },
|
|
6903
6902
|
asyncMode: "sync",
|
|
@@ -6968,7 +6967,7 @@ function publishCommand() {
|
|
|
6968
6967
|
required: ["local_dir", "app_doc"],
|
|
6969
6968
|
additionalProperties: false
|
|
6970
6969
|
},
|
|
6971
|
-
outputSchema: OBJECT_OUTPUT$
|
|
6970
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
6972
6971
|
resultSchemaVersion: 1,
|
|
6973
6972
|
access: { mode: "fixed", level: "write" },
|
|
6974
6973
|
asyncMode: "sync",
|
|
@@ -7937,8 +7936,8 @@ async function releaseStaging(ctx, source) {
|
|
|
7937
7936
|
}
|
|
7938
7937
|
}
|
|
7939
7938
|
function expectInspection(value) {
|
|
7940
|
-
const
|
|
7941
|
-
const schemaVersion = expectNumber(
|
|
7939
|
+
const object2 = expectObject$1(value, "apps.inspect response");
|
|
7940
|
+
const schemaVersion = expectNumber(object2, "schema_version");
|
|
7942
7941
|
if (schemaVersion !== PLAN_SCHEMA_VERSION) {
|
|
7943
7942
|
throw new ToolError(
|
|
7944
7943
|
"UNSUPPORTED_SCHEMA_VERSION",
|
|
@@ -7947,9 +7946,9 @@ function expectInspection(value) {
|
|
|
7947
7946
|
}
|
|
7948
7947
|
const inspection = {
|
|
7949
7948
|
schema_version: schemaVersion,
|
|
7950
|
-
plan: expectObject$1(
|
|
7951
|
-
resolution_status: expectObject$1(
|
|
7952
|
-
status: expectObject$1(
|
|
7949
|
+
plan: expectObject$1(object2.plan, "inspection.plan"),
|
|
7950
|
+
resolution_status: expectObject$1(object2.resolution_status, "inspection.resolution_status"),
|
|
7951
|
+
status: expectObject$1(object2.status, "inspection.status")
|
|
7953
7952
|
};
|
|
7954
7953
|
assertPortablePlan(inspection.plan);
|
|
7955
7954
|
if (inspection.status.plan_fingerprint !== inspection.plan.plan_fingerprint) {
|
|
@@ -8094,7 +8093,7 @@ function selectorCommand(options) {
|
|
|
8094
8093
|
required: ["app_name"],
|
|
8095
8094
|
additionalProperties: false
|
|
8096
8095
|
},
|
|
8097
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8096
|
+
outputSchema: OBJECT_OUTPUT$9,
|
|
8098
8097
|
resultSchemaVersion: 1,
|
|
8099
8098
|
access: { mode: "fixed", level: options.access },
|
|
8100
8099
|
asyncMode: options.asyncMode,
|
|
@@ -8169,8 +8168,8 @@ function expectString(value, property) {
|
|
|
8169
8168
|
}
|
|
8170
8169
|
return candidate;
|
|
8171
8170
|
}
|
|
8172
|
-
function expectNumber(
|
|
8173
|
-
const value =
|
|
8171
|
+
function expectNumber(object2, property) {
|
|
8172
|
+
const value = object2[property];
|
|
8174
8173
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
8175
8174
|
throw new ToolError("INVALID_SERVICE_RESPONSE", `${property} must be a non-negative integer`, 9);
|
|
8176
8175
|
}
|
|
@@ -8258,7 +8257,7 @@ function toHex(bytes) {
|
|
|
8258
8257
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
8259
8258
|
}
|
|
8260
8259
|
const CONTROL_PANEL$3 = "control-panel";
|
|
8261
|
-
const OBJECT_OUTPUT$
|
|
8260
|
+
const OBJECT_OUTPUT$8 = { type: "object", additionalProperties: true };
|
|
8262
8261
|
function createDiagnosticModule(dependencies = {}) {
|
|
8263
8262
|
return {
|
|
8264
8263
|
name: "diagnostic",
|
|
@@ -8297,7 +8296,7 @@ function collectCommand() {
|
|
|
8297
8296
|
required: ["services"],
|
|
8298
8297
|
additionalProperties: false
|
|
8299
8298
|
},
|
|
8300
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8299
|
+
outputSchema: OBJECT_OUTPUT$8,
|
|
8301
8300
|
resultSchemaVersion: 1,
|
|
8302
8301
|
access: { mode: "fixed", level: "privileged" },
|
|
8303
8302
|
asyncMode: "task",
|
|
@@ -8351,7 +8350,7 @@ function exportCommand$1(dependencies) {
|
|
|
8351
8350
|
required: ["bundle_id", "path"],
|
|
8352
8351
|
additionalProperties: false
|
|
8353
8352
|
},
|
|
8354
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8353
|
+
outputSchema: OBJECT_OUTPUT$8,
|
|
8355
8354
|
resultSchemaVersion: 1,
|
|
8356
8355
|
access: { mode: "fixed", level: "privileged" },
|
|
8357
8356
|
asyncMode: "sync",
|
|
@@ -8393,7 +8392,7 @@ function compact$2(value) {
|
|
|
8393
8392
|
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
8394
8393
|
}
|
|
8395
8394
|
const CONTROL_PANEL$2 = "control-panel";
|
|
8396
|
-
const OBJECT_OUTPUT$
|
|
8395
|
+
const OBJECT_OUTPUT$7 = { type: "object", additionalProperties: true };
|
|
8397
8396
|
const LOG_LEVELS = ["error", "warning", "info", "debug", "trace"];
|
|
8398
8397
|
function createLogModule(dependencies = {}) {
|
|
8399
8398
|
return {
|
|
@@ -8401,7 +8400,7 @@ function createLogModule(dependencies = {}) {
|
|
|
8401
8400
|
summary: "List services, query, follow, and export redacted system logs",
|
|
8402
8401
|
commands: [
|
|
8403
8402
|
servicesCommand(),
|
|
8404
|
-
queryCommand(),
|
|
8403
|
+
queryCommand$1(),
|
|
8405
8404
|
tailCommand(dependencies),
|
|
8406
8405
|
exportCommand(dependencies)
|
|
8407
8406
|
]
|
|
@@ -8414,7 +8413,7 @@ function servicesCommand() {
|
|
|
8414
8413
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
8415
8414
|
outputSchema: {
|
|
8416
8415
|
type: "object",
|
|
8417
|
-
properties: { services: { type: "array", items: OBJECT_OUTPUT$
|
|
8416
|
+
properties: { services: { type: "array", items: OBJECT_OUTPUT$7 } },
|
|
8418
8417
|
required: ["services"],
|
|
8419
8418
|
additionalProperties: false
|
|
8420
8419
|
},
|
|
@@ -8434,7 +8433,7 @@ function servicesCommand() {
|
|
|
8434
8433
|
}
|
|
8435
8434
|
};
|
|
8436
8435
|
}
|
|
8437
|
-
function queryCommand() {
|
|
8436
|
+
function queryCommand$1() {
|
|
8438
8437
|
return {
|
|
8439
8438
|
verb: "query",
|
|
8440
8439
|
summary: "Query structured redacted log entries",
|
|
@@ -8487,7 +8486,7 @@ function tailCommand(dependencies) {
|
|
|
8487
8486
|
}
|
|
8488
8487
|
],
|
|
8489
8488
|
inputSchema: filterSchema({ from: { type: "string", enum: ["start", "end"] } }),
|
|
8490
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8489
|
+
outputSchema: OBJECT_OUTPUT$7,
|
|
8491
8490
|
resultSchemaVersion: 1,
|
|
8492
8491
|
access: { mode: "fixed", level: "read" },
|
|
8493
8492
|
asyncMode: "stream",
|
|
@@ -8543,7 +8542,7 @@ function exportCommand(dependencies) {
|
|
|
8543
8542
|
...filterSchema({ path: { type: "string", minLength: 1 } }),
|
|
8544
8543
|
required: ["path"]
|
|
8545
8544
|
},
|
|
8546
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8545
|
+
outputSchema: OBJECT_OUTPUT$7,
|
|
8547
8546
|
resultSchemaVersion: 1,
|
|
8548
8547
|
access: { mode: "fixed", level: "read" },
|
|
8549
8548
|
asyncMode: "sync",
|
|
@@ -8695,7 +8694,7 @@ function abortableSleep(milliseconds, signal) {
|
|
|
8695
8694
|
}
|
|
8696
8695
|
const TASK_MANAGER = "task-manager";
|
|
8697
8696
|
const CONTROL_PANEL$1 = "control-panel";
|
|
8698
|
-
const OBJECT_OUTPUT$
|
|
8697
|
+
const OBJECT_OUTPUT$6 = { type: "object", additionalProperties: true };
|
|
8699
8698
|
function createTaskModule() {
|
|
8700
8699
|
return {
|
|
8701
8700
|
name: "task",
|
|
@@ -8798,7 +8797,7 @@ function getCommand$1() {
|
|
|
8798
8797
|
required: ["task_id"],
|
|
8799
8798
|
additionalProperties: false
|
|
8800
8799
|
},
|
|
8801
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8800
|
+
outputSchema: OBJECT_OUTPUT$6,
|
|
8802
8801
|
resultSchemaVersion: 1,
|
|
8803
8802
|
access: { mode: "fixed", level: "read" },
|
|
8804
8803
|
asyncMode: "sync",
|
|
@@ -8839,7 +8838,7 @@ function waitCommand() {
|
|
|
8839
8838
|
summary: "Stream changes until a Task becomes terminal",
|
|
8840
8839
|
positionals: [{ name: "task_id", description: "Opaque Task ID", required: true }],
|
|
8841
8840
|
inputSchema: taskIdSchema(),
|
|
8842
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8841
|
+
outputSchema: OBJECT_OUTPUT$6,
|
|
8843
8842
|
resultSchemaVersion: 1,
|
|
8844
8843
|
access: { mode: "fixed", level: "read" },
|
|
8845
8844
|
asyncMode: "stream",
|
|
@@ -8890,7 +8889,7 @@ function cancelCommand() {
|
|
|
8890
8889
|
required: ["task_id"],
|
|
8891
8890
|
additionalProperties: false
|
|
8892
8891
|
},
|
|
8893
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8892
|
+
outputSchema: OBJECT_OUTPUT$6,
|
|
8894
8893
|
resultSchemaVersion: 1,
|
|
8895
8894
|
access: { mode: "fixed", level: "write" },
|
|
8896
8895
|
asyncMode: "sync",
|
|
@@ -8933,7 +8932,7 @@ function retryCommand() {
|
|
|
8933
8932
|
required: ["task_id"],
|
|
8934
8933
|
additionalProperties: false
|
|
8935
8934
|
},
|
|
8936
|
-
outputSchema: OBJECT_OUTPUT$
|
|
8935
|
+
outputSchema: OBJECT_OUTPUT$6,
|
|
8937
8936
|
resultSchemaVersion: 1,
|
|
8938
8937
|
access: { mode: "fixed", level: "write" },
|
|
8939
8938
|
asyncMode: "either",
|
|
@@ -9007,7 +9006,7 @@ function invalidResponse$1(label) {
|
|
|
9007
9006
|
throw new ToolError("INVALID_SERVICE_RESPONSE", `${label} is invalid`, EXIT_INTERNAL);
|
|
9008
9007
|
}
|
|
9009
9008
|
const sdk = provisionSdk;
|
|
9010
|
-
const OBJECT_OUTPUT$
|
|
9009
|
+
const OBJECT_OUTPUT$5 = { type: "object", additionalProperties: true };
|
|
9011
9010
|
const ROOT_OPTION = {
|
|
9012
9011
|
name: "root",
|
|
9013
9012
|
description: "Installed BuckyOS root on this machine (BUCKYOS_ROOT); read by status/check, written by activate",
|
|
@@ -9091,7 +9090,7 @@ function statusCommand(deps) {
|
|
|
9091
9090
|
additionalProperties: false
|
|
9092
9091
|
},
|
|
9093
9092
|
outputSchema: {
|
|
9094
|
-
...OBJECT_OUTPUT$
|
|
9093
|
+
...OBJECT_OUTPUT$5,
|
|
9095
9094
|
properties: {
|
|
9096
9095
|
root: { type: "string" },
|
|
9097
9096
|
state: {
|
|
@@ -9129,7 +9128,7 @@ function checkCommand(deps) {
|
|
|
9129
9128
|
additionalProperties: false
|
|
9130
9129
|
},
|
|
9131
9130
|
outputSchema: {
|
|
9132
|
-
...OBJECT_OUTPUT$
|
|
9131
|
+
...OBJECT_OUTPUT$5,
|
|
9133
9132
|
properties: {
|
|
9134
9133
|
ready: { type: "boolean" },
|
|
9135
9134
|
root: { type: "string" },
|
|
@@ -9177,7 +9176,7 @@ function activateCommand(deps) {
|
|
|
9177
9176
|
additionalProperties: false
|
|
9178
9177
|
},
|
|
9179
9178
|
outputSchema: {
|
|
9180
|
-
...OBJECT_OUTPUT$
|
|
9179
|
+
...OBJECT_OUTPUT$5,
|
|
9181
9180
|
properties: {
|
|
9182
9181
|
root: { type: "string" },
|
|
9183
9182
|
state: { type: "string", enum: ["configured"] },
|
|
@@ -9239,9 +9238,9 @@ function resolvePath(ctx, value) {
|
|
|
9239
9238
|
const path = getHost().path;
|
|
9240
9239
|
return path.isAbsolute(value) ? path.resolve(value) : path.resolve(ctx.cwd, value);
|
|
9241
9240
|
}
|
|
9242
|
-
async function assertHostAccess(path,
|
|
9241
|
+
async function assertHostAccess(path, operation2) {
|
|
9243
9242
|
try {
|
|
9244
|
-
await getHost().assertAccess(path,
|
|
9243
|
+
await getHost().assertAccess(path, operation2);
|
|
9245
9244
|
} catch (error) {
|
|
9246
9245
|
if (isHostError(error, "PermissionDenied")) {
|
|
9247
9246
|
throw new ToolError(
|
|
@@ -9249,7 +9248,7 @@ async function assertHostAccess(path, operation) {
|
|
|
9249
9248
|
`${error.message}; pass the path on the command line (--root / --owner-key-backup) so the launcher can grant it`,
|
|
9250
9249
|
EXIT_PERMISSION,
|
|
9251
9250
|
false,
|
|
9252
|
-
{ path, operation }
|
|
9251
|
+
{ path, operation: operation2 }
|
|
9253
9252
|
);
|
|
9254
9253
|
}
|
|
9255
9254
|
throw error;
|
|
@@ -9459,7 +9458,7 @@ function inputFingerprint(input) {
|
|
|
9459
9458
|
hash.update(new TextEncoder().encode(JSON.stringify(material)));
|
|
9460
9459
|
return hash.digestHex();
|
|
9461
9460
|
}
|
|
9462
|
-
const OBJECT_OUTPUT$
|
|
9461
|
+
const OBJECT_OUTPUT$4 = { type: "object", additionalProperties: true };
|
|
9463
9462
|
const SKILL_KINDS = ["cmd", "goal"];
|
|
9464
9463
|
const SKILLS_SUB_PKG = "agent_skills";
|
|
9465
9464
|
const SKILL_DIRS = ["cmd_skills", "goal_skills", "tools"];
|
|
@@ -9496,7 +9495,7 @@ function createSkillModule() {
|
|
|
9496
9495
|
required: ["agent_id"],
|
|
9497
9496
|
additionalProperties: false
|
|
9498
9497
|
},
|
|
9499
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9498
|
+
outputSchema: OBJECT_OUTPUT$4,
|
|
9500
9499
|
resultSchemaVersion: 1,
|
|
9501
9500
|
access: { mode: "fixed", level: "read" },
|
|
9502
9501
|
asyncMode: "sync",
|
|
@@ -9535,7 +9534,7 @@ function createSkillModule() {
|
|
|
9535
9534
|
required: ["pikg_path", "agent_id"],
|
|
9536
9535
|
additionalProperties: false
|
|
9537
9536
|
},
|
|
9538
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9537
|
+
outputSchema: OBJECT_OUTPUT$4,
|
|
9539
9538
|
resultSchemaVersion: 1,
|
|
9540
9539
|
access: { mode: "fixed", level: "write" },
|
|
9541
9540
|
asyncMode: "sync",
|
|
@@ -9562,7 +9561,7 @@ function createSkillModule() {
|
|
|
9562
9561
|
required: ["name", "agent_id"],
|
|
9563
9562
|
additionalProperties: false
|
|
9564
9563
|
},
|
|
9565
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9564
|
+
outputSchema: OBJECT_OUTPUT$4,
|
|
9566
9565
|
resultSchemaVersion: 1,
|
|
9567
9566
|
access: { mode: "fixed", level: "destructive" },
|
|
9568
9567
|
asyncMode: "sync",
|
|
@@ -9683,7 +9682,7 @@ function base64(bytes) {
|
|
|
9683
9682
|
return btoa(binary);
|
|
9684
9683
|
}
|
|
9685
9684
|
const CONTROL_PANEL = "control-panel";
|
|
9686
|
-
const OBJECT_OUTPUT$
|
|
9685
|
+
const OBJECT_OUTPUT$3 = { type: "object", additionalProperties: true };
|
|
9687
9686
|
const AGENT_POSITIONAL = {
|
|
9688
9687
|
name: "agent_id",
|
|
9689
9688
|
description: "Agent ID as `agent list` prints it (raw host name, e.g. jarvis.example.zone)"
|
|
@@ -9707,7 +9706,7 @@ function createAgentModule() {
|
|
|
9707
9706
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
9708
9707
|
outputSchema: {
|
|
9709
9708
|
type: "object",
|
|
9710
|
-
properties: { agents: { type: "array", items: OBJECT_OUTPUT$
|
|
9709
|
+
properties: { agents: { type: "array", items: OBJECT_OUTPUT$3 } },
|
|
9711
9710
|
required: ["agents"],
|
|
9712
9711
|
additionalProperties: false
|
|
9713
9712
|
},
|
|
@@ -9733,7 +9732,7 @@ function createAgentModule() {
|
|
|
9733
9732
|
summary: "Get one Agent: profile, settings, install state, template, and runtime",
|
|
9734
9733
|
positionals: [AGENT_POSITIONAL],
|
|
9735
9734
|
inputSchema: AGENT_INPUT,
|
|
9736
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9735
|
+
outputSchema: OBJECT_OUTPUT$3,
|
|
9737
9736
|
resultSchemaVersion: 1,
|
|
9738
9737
|
access: { mode: "fixed", level: "read" },
|
|
9739
9738
|
asyncMode: "sync",
|
|
@@ -9746,7 +9745,7 @@ function createAgentModule() {
|
|
|
9746
9745
|
summary: "Get the public profile (display name, bio, avatar) of an Agent",
|
|
9747
9746
|
positionals: [AGENT_POSITIONAL],
|
|
9748
9747
|
inputSchema: AGENT_INPUT,
|
|
9749
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9748
|
+
outputSchema: OBJECT_OUTPUT$3,
|
|
9750
9749
|
resultSchemaVersion: 1,
|
|
9751
9750
|
access: { mode: "fixed", level: "read" },
|
|
9752
9751
|
asyncMode: "sync",
|
|
@@ -9787,8 +9786,8 @@ function createAgentModule() {
|
|
|
9787
9786
|
type: "object",
|
|
9788
9787
|
properties: {
|
|
9789
9788
|
agent_id: { type: "string" },
|
|
9790
|
-
before: OBJECT_OUTPUT$
|
|
9791
|
-
profile: OBJECT_OUTPUT$
|
|
9789
|
+
before: OBJECT_OUTPUT$3,
|
|
9790
|
+
profile: OBJECT_OUTPUT$3
|
|
9792
9791
|
},
|
|
9793
9792
|
required: ["agent_id", "before", "profile"],
|
|
9794
9793
|
additionalProperties: false
|
|
@@ -9833,7 +9832,7 @@ async function callAgent(ctx, method, params) {
|
|
|
9833
9832
|
}
|
|
9834
9833
|
}
|
|
9835
9834
|
const AICC = "aicc";
|
|
9836
|
-
const OBJECT_OUTPUT$
|
|
9835
|
+
const OBJECT_OUTPUT$2 = { type: "object", additionalProperties: true };
|
|
9837
9836
|
const EMPTY_INPUT = { type: "object", properties: {}, additionalProperties: false };
|
|
9838
9837
|
const RANGES = ["last1d", "last7d", "last30d"];
|
|
9839
9838
|
const GROUPS = [
|
|
@@ -9851,13 +9850,13 @@ function createAiModule() {
|
|
|
9851
9850
|
name: "ai",
|
|
9852
9851
|
summary: "Read AI provider, routing, usage and token quota state of the AICC service",
|
|
9853
9852
|
commands: [
|
|
9854
|
-
readCommand({
|
|
9853
|
+
readCommand$1({
|
|
9855
9854
|
verb: "providers",
|
|
9856
9855
|
summary: "List configured AI provider instances with auth, health, and model inventory",
|
|
9857
9856
|
method: "provider.list",
|
|
9858
9857
|
description: "Credentials are reported only as configured/kind; secrets are never returned."
|
|
9859
9858
|
}),
|
|
9860
|
-
readCommand({
|
|
9859
|
+
readCommand$1({
|
|
9861
9860
|
verb: "routing",
|
|
9862
9861
|
summary: "Get the AICC routing overlay and its settings revision",
|
|
9863
9862
|
method: "routing.get",
|
|
@@ -9881,7 +9880,7 @@ function quotaCommand() {
|
|
|
9881
9880
|
properties: { app: { type: "string", minLength: 1 } },
|
|
9882
9881
|
additionalProperties: false
|
|
9883
9882
|
},
|
|
9884
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9883
|
+
outputSchema: OBJECT_OUTPUT$2,
|
|
9885
9884
|
resultSchemaVersion: 1,
|
|
9886
9885
|
access: { mode: "fixed", level: "read" },
|
|
9887
9886
|
asyncMode: "sync",
|
|
@@ -9893,13 +9892,13 @@ function quotaCommand() {
|
|
|
9893
9892
|
)
|
|
9894
9893
|
};
|
|
9895
9894
|
}
|
|
9896
|
-
function readCommand(options) {
|
|
9895
|
+
function readCommand$1(options) {
|
|
9897
9896
|
return {
|
|
9898
9897
|
verb: options.verb,
|
|
9899
9898
|
summary: options.summary,
|
|
9900
9899
|
description: options.description,
|
|
9901
9900
|
inputSchema: EMPTY_INPUT,
|
|
9902
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9901
|
+
outputSchema: OBJECT_OUTPUT$2,
|
|
9903
9902
|
resultSchemaVersion: 1,
|
|
9904
9903
|
access: { mode: "fixed", level: "read" },
|
|
9905
9904
|
asyncMode: "sync",
|
|
@@ -9951,7 +9950,7 @@ function usageCommand() {
|
|
|
9951
9950
|
},
|
|
9952
9951
|
additionalProperties: false
|
|
9953
9952
|
},
|
|
9954
|
-
outputSchema: OBJECT_OUTPUT$
|
|
9953
|
+
outputSchema: OBJECT_OUTPUT$2,
|
|
9955
9954
|
resultSchemaVersion: 1,
|
|
9956
9955
|
access: { mode: "fixed", level: "read" },
|
|
9957
9956
|
asyncMode: "sync",
|
|
@@ -9996,7 +9995,7 @@ function timeRange(input) {
|
|
|
9996
9995
|
}
|
|
9997
9996
|
return { kind: "explicit", start_time_ms: since, end_time_ms: until ?? Date.now() };
|
|
9998
9997
|
}
|
|
9999
|
-
const OBJECT_OUTPUT = { type: "object", additionalProperties: true };
|
|
9998
|
+
const OBJECT_OUTPUT$1 = { type: "object", additionalProperties: true };
|
|
10000
9999
|
const DAY_MS = 864e5;
|
|
10001
10000
|
const EXPIRES_HELP = "1d, 7d (default), 30d, none, or an RFC 3339 time";
|
|
10002
10001
|
function createShareModule() {
|
|
@@ -10060,10 +10059,10 @@ function gatewayOrigin(endpoint) {
|
|
|
10060
10059
|
function parseExpires(value) {
|
|
10061
10060
|
if (value === void 0)
|
|
10062
10061
|
return void 0;
|
|
10063
|
-
const
|
|
10064
|
-
if (
|
|
10062
|
+
const text2 = String(value).trim().toLowerCase();
|
|
10063
|
+
if (text2 === "none" || text2 === "never")
|
|
10065
10064
|
return null;
|
|
10066
|
-
const days =
|
|
10065
|
+
const days = text2.match(/^(\d+)d$/);
|
|
10067
10066
|
if (days)
|
|
10068
10067
|
return Math.floor((Date.now() + Number(days[1]) * DAY_MS) / 1e3);
|
|
10069
10068
|
const at = parseTimestamp(value, "expires");
|
|
@@ -10107,7 +10106,7 @@ function createCommand() {
|
|
|
10107
10106
|
required: ["path"],
|
|
10108
10107
|
additionalProperties: false
|
|
10109
10108
|
},
|
|
10110
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10109
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10111
10110
|
resultSchemaVersion: 1,
|
|
10112
10111
|
access: { mode: "fixed", level: "write" },
|
|
10113
10112
|
asyncMode: "either",
|
|
@@ -10176,7 +10175,7 @@ function listCommand() {
|
|
|
10176
10175
|
},
|
|
10177
10176
|
additionalProperties: false
|
|
10178
10177
|
},
|
|
10179
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10178
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10180
10179
|
resultSchemaVersion: 1,
|
|
10181
10180
|
access: { mode: "fixed", level: "read" },
|
|
10182
10181
|
asyncMode: "sync",
|
|
@@ -10208,7 +10207,7 @@ function getCommand() {
|
|
|
10208
10207
|
required: ["share_id"],
|
|
10209
10208
|
additionalProperties: false
|
|
10210
10209
|
},
|
|
10211
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10210
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10212
10211
|
resultSchemaVersion: 1,
|
|
10213
10212
|
access: { mode: "fixed", level: "read" },
|
|
10214
10213
|
asyncMode: "sync",
|
|
@@ -10245,7 +10244,7 @@ function updateCommand() {
|
|
|
10245
10244
|
required: ["share_id"],
|
|
10246
10245
|
additionalProperties: false
|
|
10247
10246
|
},
|
|
10248
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10247
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10249
10248
|
resultSchemaVersion: 1,
|
|
10250
10249
|
access: { mode: "fixed", level: "write" },
|
|
10251
10250
|
asyncMode: "sync",
|
|
@@ -10289,7 +10288,7 @@ function stopCommand() {
|
|
|
10289
10288
|
required: ["share_id"],
|
|
10290
10289
|
additionalProperties: false
|
|
10291
10290
|
},
|
|
10292
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10291
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10293
10292
|
resultSchemaVersion: 1,
|
|
10294
10293
|
access: { mode: "fixed", level: "destructive" },
|
|
10295
10294
|
asyncMode: "sync",
|
|
@@ -10321,7 +10320,7 @@ function statsCommand() {
|
|
|
10321
10320
|
},
|
|
10322
10321
|
additionalProperties: false
|
|
10323
10322
|
},
|
|
10324
|
-
outputSchema: OBJECT_OUTPUT,
|
|
10323
|
+
outputSchema: OBJECT_OUTPUT$1,
|
|
10325
10324
|
resultSchemaVersion: 1,
|
|
10326
10325
|
access: { mode: "fixed", level: "read" },
|
|
10327
10326
|
asyncMode: "sync",
|
|
@@ -10340,6 +10339,425 @@ function statsCommand() {
|
|
|
10340
10339
|
}
|
|
10341
10340
|
};
|
|
10342
10341
|
}
|
|
10342
|
+
const text = { type: "string", minLength: 1 };
|
|
10343
|
+
const object = { type: "object", additionalProperties: true };
|
|
10344
|
+
const targetProperties = {
|
|
10345
|
+
executor_id: text,
|
|
10346
|
+
generation: { type: "integer", minimum: 1 },
|
|
10347
|
+
profile_id: text,
|
|
10348
|
+
store_id: text,
|
|
10349
|
+
locator: text
|
|
10350
|
+
};
|
|
10351
|
+
function call(ctx, method, params) {
|
|
10352
|
+
return ctx.clients.call("control-panel", method, params, {
|
|
10353
|
+
traceId: ctx.traceId,
|
|
10354
|
+
signal: ctx.signal,
|
|
10355
|
+
timeoutMs: Math.max(1, (ctx.deadline ?? Date.now() + 3e4) - Date.now())
|
|
10356
|
+
});
|
|
10357
|
+
}
|
|
10358
|
+
function management(verb, method, properties, required, write = false) {
|
|
10359
|
+
return {
|
|
10360
|
+
verb,
|
|
10361
|
+
summary: `Executor ${verb}`,
|
|
10362
|
+
inputSchema: { ...object, properties, required, additionalProperties: false },
|
|
10363
|
+
outputSchema: object,
|
|
10364
|
+
resultSchemaVersion: 1,
|
|
10365
|
+
access: { mode: "fixed", level: write ? "write" : "read" },
|
|
10366
|
+
asyncMode: "sync",
|
|
10367
|
+
requiresSession: true,
|
|
10368
|
+
options: Object.entries(properties).filter(([, schema]) => schema.type !== "object").map(([name, schema]) => ({
|
|
10369
|
+
name: name.replaceAll("_", "-"),
|
|
10370
|
+
property: name,
|
|
10371
|
+
description: name,
|
|
10372
|
+
type: schema.type === "integer" ? "integer" : "string",
|
|
10373
|
+
required: required.includes(name)
|
|
10374
|
+
})),
|
|
10375
|
+
handler: (ctx, input) => call(ctx, method, input)
|
|
10376
|
+
};
|
|
10377
|
+
}
|
|
10378
|
+
function createExecutorModule() {
|
|
10379
|
+
return {
|
|
10380
|
+
name: "executor",
|
|
10381
|
+
summary: "Manage lightweight devices and explicitly target online command/file executors",
|
|
10382
|
+
commands: [
|
|
10383
|
+
management("create", "executor.device.create", { name: text, profiles: object, limits: object, expires_at_ms: { type: "integer" } }, ["name", "profiles"], true),
|
|
10384
|
+
management("list", "executor.device.list", {}, []),
|
|
10385
|
+
management("issue", "executor.device.issue", { executor_id: text, expires_at_ms: { type: "integer" } }, ["executor_id"], true),
|
|
10386
|
+
management("revoke", "executor.device.revoke", { executor_id: text }, ["executor_id"], true),
|
|
10387
|
+
management("delete", "executor.device.delete", { executor_id: text }, ["executor_id"], true),
|
|
10388
|
+
management("online", "executor.online.list", {}, []),
|
|
10389
|
+
operation("exec", { cmd: text, cwd: text, env: object, execution_timeout_ms: { type: "integer", minimum: 1 } }, ["cmd", "cwd"]),
|
|
10390
|
+
operation("read", { path: text }, ["path"]),
|
|
10391
|
+
operation("write", { path: text, content: { type: "string" }, mode: { type: "string", enum: ["replace", "append", "create_new"] } }, ["path", "content"]),
|
|
10392
|
+
operation("edit", { path: text, old_string: text, new_string: { type: "string" } }, ["path", "old_string", "new_string"]),
|
|
10393
|
+
operation("query", { channel: { type: "string", enum: ["stdout", "stderr", "content"] }, offset: { type: "integer", minimum: 0 }, wait_ms: { type: "integer", minimum: 0 } }, []),
|
|
10394
|
+
operation("cancel", {}, [])
|
|
10395
|
+
]
|
|
10396
|
+
};
|
|
10397
|
+
}
|
|
10398
|
+
function operation(verb, extra, required) {
|
|
10399
|
+
const recovery = verb === "query" || verb === "cancel";
|
|
10400
|
+
const properties = { ...targetProperties, ...extra };
|
|
10401
|
+
return {
|
|
10402
|
+
verb,
|
|
10403
|
+
summary: `${verb} on an explicit executor; persist --locator before dispatch and query it after disconnection`,
|
|
10404
|
+
inputSchema: { ...object, properties, required: [...Object.keys(targetProperties), ...required], additionalProperties: false },
|
|
10405
|
+
outputSchema: object,
|
|
10406
|
+
resultSchemaVersion: 1,
|
|
10407
|
+
access: { mode: "fixed", level: ["read", "query"].includes(verb) ? "read" : "write" },
|
|
10408
|
+
asyncMode: "sync",
|
|
10409
|
+
requiresSession: true,
|
|
10410
|
+
options: Object.entries(properties).filter(([, schema]) => schema.type !== "object").map(([name, schema]) => ({
|
|
10411
|
+
name: name.replaceAll("_", "-"),
|
|
10412
|
+
property: name,
|
|
10413
|
+
description: name,
|
|
10414
|
+
type: schema.type === "integer" ? "integer" : "string",
|
|
10415
|
+
required: Object.keys(targetProperties).includes(name) || required.includes(name)
|
|
10416
|
+
})),
|
|
10417
|
+
handler: async (ctx, input) => {
|
|
10418
|
+
const target = { executor_id: String(input.executor_id), generation: Number(input.generation), profile_id: String(input.profile_id), store_id: String(input.store_id) };
|
|
10419
|
+
const path = String(input.locator);
|
|
10420
|
+
const host2 = getHost();
|
|
10421
|
+
let locator;
|
|
10422
|
+
if (recovery)
|
|
10423
|
+
locator = JSON.parse(await host2.readTextFile(path));
|
|
10424
|
+
else {
|
|
10425
|
+
locator = { ...target, op_id: crypto.randomUUID(), run_id: ctx.traceId, call_id: ctx.idempotencyKey ?? crypto.randomUUID() };
|
|
10426
|
+
await host2.writeTextFile(path, JSON.stringify(locator) + "\n", { createNew: true, mode: 384 });
|
|
10427
|
+
}
|
|
10428
|
+
if (!ctx.session)
|
|
10429
|
+
throw new ToolError("AUTH_REQUIRED", "An authenticated App session is required");
|
|
10430
|
+
const { token } = await ctx.session.ensureValid();
|
|
10431
|
+
const route = await call(ctx, "executor.stream.open", { executor_id: target.executor_id, generation: target.generation, profile_id: target.profile_id });
|
|
10432
|
+
const stream = await ExecutorCommandStream.connect(route, target, token, "buckyos-cli", locator.run_id);
|
|
10433
|
+
if (!stream)
|
|
10434
|
+
throw new ToolError("INVALID_SERVICE_RESPONSE", "Executor stream did not initialize");
|
|
10435
|
+
const abort = () => stream.close();
|
|
10436
|
+
ctx.signal.addEventListener("abort", abort, { once: true });
|
|
10437
|
+
try {
|
|
10438
|
+
let reply;
|
|
10439
|
+
if (verb === "exec")
|
|
10440
|
+
reply = await stream.exec(locator, String(input.cmd), String(input.cwd), input.env ?? {}, Number(input.execution_timeout_ms ?? 6e4));
|
|
10441
|
+
else if (verb === "read")
|
|
10442
|
+
reply = await stream.read(locator, String(input.path));
|
|
10443
|
+
else if (verb === "write")
|
|
10444
|
+
reply = await stream.write(locator, String(input.path), new TextEncoder().encode(String(input.content)), input.mode ?? "replace");
|
|
10445
|
+
else if (verb === "edit")
|
|
10446
|
+
reply = await stream.edit(locator, String(input.path), [{ old_string: String(input.old_string), new_string: String(input.new_string) }]);
|
|
10447
|
+
else if (verb === "cancel")
|
|
10448
|
+
reply = await stream.cancel(locator);
|
|
10449
|
+
else
|
|
10450
|
+
reply = await stream.query(locator, input.channel, Number(input.offset ?? 0), Number(input.wait_ms ?? 0));
|
|
10451
|
+
return { locator, reply };
|
|
10452
|
+
} finally {
|
|
10453
|
+
ctx.signal.removeEventListener("abort", abort);
|
|
10454
|
+
stream.close();
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
};
|
|
10458
|
+
}
|
|
10459
|
+
const SERVICE = "aiworkspace";
|
|
10460
|
+
const OBJECT_OUTPUT = { type: "object", additionalProperties: true };
|
|
10461
|
+
const WORKSPACE_OPTION = { name: "workspace", property: "workspace_id", description: "Workspace id (ws_…)", type: "string", required: true };
|
|
10462
|
+
const RUN_OPTION = { name: "run", property: "run_id", description: "Run id (run_…)", type: "string", required: true };
|
|
10463
|
+
const ATTEMPT_OPTION = { name: "attempt", property: "attempt", description: "The attempt number `run-claim` answered", type: "integer", required: true };
|
|
10464
|
+
function workspaceInput(extra, required = []) {
|
|
10465
|
+
return { type: "object", properties: { workspace_id: { type: "string", minLength: 1 }, ...extra }, required: ["workspace_id", ...required], additionalProperties: false };
|
|
10466
|
+
}
|
|
10467
|
+
async function aiws(ctx, method, params) {
|
|
10468
|
+
const result = expectObject$4(await callService(ctx, SERVICE, method, params), method);
|
|
10469
|
+
if (result.ok === false) {
|
|
10470
|
+
const error = expectObject$4(result.error, `${method}.error`);
|
|
10471
|
+
const code = typeof error.code === "string" ? error.code : "AIWS_ERROR";
|
|
10472
|
+
const detail = typeof error.detail === "string" ? error.detail : code;
|
|
10473
|
+
throw new ToolError(code, `${code}${typeof error.sub_code === "string" ? `/${error.sub_code}` : ""}: ${detail}`);
|
|
10474
|
+
}
|
|
10475
|
+
return result;
|
|
10476
|
+
}
|
|
10477
|
+
async function jsonInput(input, textKey, fileKey, label) {
|
|
10478
|
+
const text2 = inputString(input, textKey);
|
|
10479
|
+
const file = inputString(input, fileKey);
|
|
10480
|
+
if (text2 && file)
|
|
10481
|
+
throw new UsageError("AIWS_USAGE", `${textKey} and ${fileKey} are exclusive`);
|
|
10482
|
+
if (file)
|
|
10483
|
+
return JSON.parse(await getHost().readTextFile(file));
|
|
10484
|
+
if (text2)
|
|
10485
|
+
return JSON.parse(text2);
|
|
10486
|
+
throw new UsageError("AIWS_USAGE", `${label}: pass --${textKey.replace(/_/g, "-")} or --${fileKey.replace(/_/g, "-")}`);
|
|
10487
|
+
}
|
|
10488
|
+
const readCommand = {
|
|
10489
|
+
verb: "read",
|
|
10490
|
+
summary: "Read one entity of a workspace (envelope and content)",
|
|
10491
|
+
positionals: [{ name: "entity_id", description: "Entity id", required: true }],
|
|
10492
|
+
options: [WORKSPACE_OPTION, { name: "selector", property: "selector", description: 'Selector JSON, e.g. {"kind":"table_record","record_id":"r1"}', type: "string" }],
|
|
10493
|
+
inputSchema: workspaceInput({ entity_id: { type: "string", minLength: 1 }, selector: { type: "string" } }, ["entity_id"]),
|
|
10494
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10495
|
+
resultSchemaVersion: 1,
|
|
10496
|
+
access: { mode: "fixed", level: "read" },
|
|
10497
|
+
asyncMode: "sync",
|
|
10498
|
+
requiresSession: true,
|
|
10499
|
+
examples: ["buckyos aiws read orders --workspace ws_abc"],
|
|
10500
|
+
handler: (ctx, input) => {
|
|
10501
|
+
const selector = inputString(input, "selector");
|
|
10502
|
+
return aiws(ctx, "doc.read", { workspace_id: requiredInputString(input, "workspace_id"), entity_id: requiredInputString(input, "entity_id"), ...selector ? { selector: JSON.parse(selector) } : {} });
|
|
10503
|
+
}
|
|
10504
|
+
};
|
|
10505
|
+
const queryCommand = {
|
|
10506
|
+
verb: "query",
|
|
10507
|
+
summary: "Query the rows of a table (or through a saved view)",
|
|
10508
|
+
options: [
|
|
10509
|
+
WORKSPACE_OPTION,
|
|
10510
|
+
{ name: "source", property: "source_id", description: "Table entity id", type: "string" },
|
|
10511
|
+
{ name: "view", property: "view_id", description: "Table view (Block) id", type: "string" },
|
|
10512
|
+
{ name: "filter", property: "filter", description: "Filter JSON (README: doc.query)", type: "string" },
|
|
10513
|
+
{ name: "limit", property: "limit", description: "Rows per page (≤ 1000)", type: "integer" },
|
|
10514
|
+
{ name: "cursor", property: "cursor", description: "Continue from a previous page", type: "string" }
|
|
10515
|
+
],
|
|
10516
|
+
inputSchema: workspaceInput({ source_id: { type: "string" }, view_id: { type: "string" }, filter: { type: "string" }, limit: { type: "integer" }, cursor: { type: "string" } }),
|
|
10517
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10518
|
+
resultSchemaVersion: 1,
|
|
10519
|
+
access: { mode: "fixed", level: "read" },
|
|
10520
|
+
asyncMode: "sync",
|
|
10521
|
+
requiresSession: true,
|
|
10522
|
+
examples: ["buckyos aiws query --workspace ws_abc --source orders --limit 100"],
|
|
10523
|
+
handler: (ctx, input) => {
|
|
10524
|
+
const params = { workspace_id: requiredInputString(input, "workspace_id") };
|
|
10525
|
+
for (const key of ["source_id", "view_id", "cursor"]) {
|
|
10526
|
+
const value = inputString(input, key);
|
|
10527
|
+
if (value)
|
|
10528
|
+
params[key] = value;
|
|
10529
|
+
}
|
|
10530
|
+
const filter = inputString(input, "filter");
|
|
10531
|
+
if (filter)
|
|
10532
|
+
params.filter = JSON.parse(filter);
|
|
10533
|
+
if (typeof input.limit === "number")
|
|
10534
|
+
params.limit = input.limit;
|
|
10535
|
+
if (!params.source_id && !params.view_id)
|
|
10536
|
+
throw new UsageError("AIWS_USAGE", "pass --source or --view");
|
|
10537
|
+
return aiws(ctx, "doc.query", params);
|
|
10538
|
+
}
|
|
10539
|
+
};
|
|
10540
|
+
const infoCommand = {
|
|
10541
|
+
verb: "info",
|
|
10542
|
+
summary: "Workspace info: versions, capabilities of the caller, usage, hosted execution configuration",
|
|
10543
|
+
options: [WORKSPACE_OPTION],
|
|
10544
|
+
inputSchema: workspaceInput({}),
|
|
10545
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10546
|
+
resultSchemaVersion: 1,
|
|
10547
|
+
access: { mode: "fixed", level: "read" },
|
|
10548
|
+
asyncMode: "sync",
|
|
10549
|
+
requiresSession: true,
|
|
10550
|
+
examples: ["buckyos aiws info --workspace ws_abc"],
|
|
10551
|
+
handler: (ctx, input) => aiws(ctx, "ws.get_info", { workspace_id: requiredInputString(input, "workspace_id") })
|
|
10552
|
+
};
|
|
10553
|
+
const runGetCommand = {
|
|
10554
|
+
verb: "run-get",
|
|
10555
|
+
summary: "A wish run: state, execution context, the brief an executor starts from, candidate and preview",
|
|
10556
|
+
options: [WORKSPACE_OPTION, RUN_OPTION],
|
|
10557
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 } }, ["run_id"]),
|
|
10558
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10559
|
+
resultSchemaVersion: 1,
|
|
10560
|
+
access: { mode: "fixed", level: "read" },
|
|
10561
|
+
asyncMode: "sync",
|
|
10562
|
+
requiresSession: true,
|
|
10563
|
+
examples: ["buckyos aiws run-get --workspace ws_abc --run run_xyz"],
|
|
10564
|
+
handler: (ctx, input) => aiws(ctx, "proc.get", { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id") })
|
|
10565
|
+
};
|
|
10566
|
+
const runClaimCommand = {
|
|
10567
|
+
verb: "run-claim",
|
|
10568
|
+
summary: "Take a run as its executor: starts an attempt, answers the attempt number, a run token and the lease",
|
|
10569
|
+
options: [WORKSPACE_OPTION, RUN_OPTION, { name: "claim-token", property: "claim_token", description: "The claim token the run was dispatched with (ct_…)", type: "string", required: true, secret: true }],
|
|
10570
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, claim_token: { type: "string", minLength: 1 } }, ["run_id", "claim_token"]),
|
|
10571
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10572
|
+
resultSchemaVersion: 1,
|
|
10573
|
+
access: { mode: "fixed", level: "write" },
|
|
10574
|
+
asyncMode: "sync",
|
|
10575
|
+
requiresSession: true,
|
|
10576
|
+
examples: ["buckyos aiws run-claim --workspace ws_abc --run run_xyz --claim-token ct_…"],
|
|
10577
|
+
handler: (ctx, input) => aiws(ctx, "proc.claim", {
|
|
10578
|
+
workspace_id: requiredInputString(input, "workspace_id"),
|
|
10579
|
+
run_id: requiredInputString(input, "run_id"),
|
|
10580
|
+
claim_token: requiredInputString(input, "claim_token"),
|
|
10581
|
+
executor: { kind: "agent", principal: ctx.principal.id }
|
|
10582
|
+
})
|
|
10583
|
+
};
|
|
10584
|
+
const runHeartbeatCommand = {
|
|
10585
|
+
verb: "run-heartbeat",
|
|
10586
|
+
summary: "Keep the lease of a claimed run alive (every minute while working); optionally report progress",
|
|
10587
|
+
options: [WORKSPACE_OPTION, RUN_OPTION, ATTEMPT_OPTION, { name: "phase", property: "phase", description: 'A short progress phase, e.g. "reading inputs"', type: "string" }],
|
|
10588
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, attempt: { type: "integer", minimum: 1 }, phase: { type: "string" } }, ["run_id", "attempt"]),
|
|
10589
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10590
|
+
resultSchemaVersion: 1,
|
|
10591
|
+
access: { mode: "fixed", level: "write" },
|
|
10592
|
+
asyncMode: "sync",
|
|
10593
|
+
requiresSession: true,
|
|
10594
|
+
examples: ['buckyos aiws run-heartbeat --workspace ws_abc --run run_xyz --attempt 1 --phase "reading inputs"'],
|
|
10595
|
+
handler: (ctx, input) => {
|
|
10596
|
+
const phase = inputString(input, "phase");
|
|
10597
|
+
return aiws(ctx, "proc.heartbeat", { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id"), attempt: input.attempt, ...phase ? { progress: { phase } } : {} });
|
|
10598
|
+
}
|
|
10599
|
+
};
|
|
10600
|
+
const runFilesCommand = {
|
|
10601
|
+
verb: "run-files",
|
|
10602
|
+
summary: "Write the stage of a claimed run into a directory: the snapshot (context/), request.json, the Renderer catalog and the program host (lib/)",
|
|
10603
|
+
description: "Run the program there the way the service does: `deno run -A lib/run.js` reads program/main.js and writes output/.aiws/results.json.",
|
|
10604
|
+
options: [WORKSPACE_OPTION, RUN_OPTION, ATTEMPT_OPTION, { name: "dir", property: "dir", description: "Directory to write into (created)", type: "string", required: true }],
|
|
10605
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, attempt: { type: "integer", minimum: 1 }, dir: { type: "string", minLength: 1 } }, ["run_id", "attempt", "dir"]),
|
|
10606
|
+
outputSchema: { type: "object", properties: { dir: { type: "string" }, files: { type: "array", items: { type: "string" } } }, required: ["dir", "files"], additionalProperties: true },
|
|
10607
|
+
resultSchemaVersion: 1,
|
|
10608
|
+
access: { mode: "fixed", level: "read" },
|
|
10609
|
+
asyncMode: "sync",
|
|
10610
|
+
requiresSession: true,
|
|
10611
|
+
examples: ["buckyos aiws run-files --workspace ws_abc --run run_xyz --attempt 1 --dir work"],
|
|
10612
|
+
handler: async (ctx, input) => {
|
|
10613
|
+
const result = await aiws(ctx, "proc.files", { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id"), attempt: input.attempt });
|
|
10614
|
+
const dir = requiredInputString(input, "dir");
|
|
10615
|
+
const host2 = getHost();
|
|
10616
|
+
const written = [];
|
|
10617
|
+
for (const [path, file] of Object.entries(expectObject$4(result.files, "proc.files.files"))) {
|
|
10618
|
+
const f = expectObject$4(file, path);
|
|
10619
|
+
if (typeof f.text !== "string" && typeof f.base64 !== "string")
|
|
10620
|
+
continue;
|
|
10621
|
+
const target = `${dir}/${path}`;
|
|
10622
|
+
await host2.mkdir(target.slice(0, target.lastIndexOf("/")), { recursive: true });
|
|
10623
|
+
if (typeof f.text === "string")
|
|
10624
|
+
await host2.writeTextFile(target, f.text);
|
|
10625
|
+
else
|
|
10626
|
+
await host2.writeFile(target, Uint8Array.from(atob(f.base64), (c) => c.charCodeAt(0)));
|
|
10627
|
+
written.push(path);
|
|
10628
|
+
}
|
|
10629
|
+
await host2.mkdir(`${dir}/output`, { recursive: true });
|
|
10630
|
+
await host2.mkdir(`${dir}/program`, { recursive: true });
|
|
10631
|
+
return { dir, files: written };
|
|
10632
|
+
}
|
|
10633
|
+
};
|
|
10634
|
+
const runToolCommand = {
|
|
10635
|
+
verb: "run-tool",
|
|
10636
|
+
summary: "Call one stage tool of a claimed run (ws_profile, ws_read, ws_query, submit_analysis, put_result, check_results, finish, …): the service answers as it answers the model",
|
|
10637
|
+
options: [WORKSPACE_OPTION, RUN_OPTION, ATTEMPT_OPTION, { name: "name", property: "name", description: "Tool name (the claim answered the list, with their argument schemas)", type: "string", required: true }, { name: "args", property: "args", description: "Arguments JSON", type: "string" }, { name: "args-file", property: "args_file", description: "Path of a JSON file holding the arguments", type: "string" }],
|
|
10638
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, attempt: { type: "integer", minimum: 1 }, name: { type: "string", minLength: 1 }, args: { type: "string" }, args_file: { type: "string" } }, ["run_id", "attempt", "name"]),
|
|
10639
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10640
|
+
resultSchemaVersion: 1,
|
|
10641
|
+
access: { mode: "fixed", level: "write" },
|
|
10642
|
+
asyncMode: "sync",
|
|
10643
|
+
requiresSession: true,
|
|
10644
|
+
examples: [`buckyos aiws run-tool --workspace ws_abc --run run_xyz --attempt 1 --name ws_profile --args '{"target":"@B1"}'`, `buckyos aiws run-tool --workspace ws_abc --run run_xyz --attempt 1 --name finish --args '{"summary":"done"}'`],
|
|
10645
|
+
handler: async (ctx, input) => {
|
|
10646
|
+
const args = inputString(input, "args") || inputString(input, "args_file") ? await jsonInput(input, "args", "args_file", "arguments") : {};
|
|
10647
|
+
return aiws(ctx, "proc.tool", { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id"), attempt: input.attempt, name: requiredInputString(input, "name"), args });
|
|
10648
|
+
}
|
|
10649
|
+
};
|
|
10650
|
+
const runProgramCommand = {
|
|
10651
|
+
verb: "run-program",
|
|
10652
|
+
summary: "Hand in a program run: the program source, what lib/run.js wrote to output/.aiws/results.json, the files under output/ and the log; the service validates it like its own run_program",
|
|
10653
|
+
options: [
|
|
10654
|
+
WORKSPACE_OPTION,
|
|
10655
|
+
RUN_OPTION,
|
|
10656
|
+
ATTEMPT_OPTION,
|
|
10657
|
+
{ name: "dir", property: "dir", description: "The stage directory written by run-files (program/main.js, output/)", type: "string", required: true },
|
|
10658
|
+
{ name: "log-file", property: "log_file", description: "Path of the program log to attach (stdout/stderr of deno run)", type: "string" }
|
|
10659
|
+
],
|
|
10660
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, attempt: { type: "integer", minimum: 1 }, dir: { type: "string", minLength: 1 }, log_file: { type: "string" } }, ["run_id", "attempt", "dir"]),
|
|
10661
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10662
|
+
resultSchemaVersion: 1,
|
|
10663
|
+
access: { mode: "fixed", level: "write" },
|
|
10664
|
+
asyncMode: "sync",
|
|
10665
|
+
requiresSession: true,
|
|
10666
|
+
examples: ["buckyos aiws run-program --workspace ws_abc --run run_xyz --attempt 1 --dir work --log-file work/run.log"],
|
|
10667
|
+
handler: async (ctx, input) => {
|
|
10668
|
+
const dir = requiredInputString(input, "dir");
|
|
10669
|
+
const host2 = getHost();
|
|
10670
|
+
const source = await host2.readTextFile(`${dir}/program/main.js`);
|
|
10671
|
+
let results = null;
|
|
10672
|
+
try {
|
|
10673
|
+
results = JSON.parse(await host2.readTextFile(`${dir}/output/.aiws/results.json`));
|
|
10674
|
+
} catch {
|
|
10675
|
+
results = null;
|
|
10676
|
+
}
|
|
10677
|
+
const logFile = inputString(input, "log_file");
|
|
10678
|
+
const log = logFile ? await host2.readTextFile(logFile).catch(() => "") : "";
|
|
10679
|
+
const files = {};
|
|
10680
|
+
const walk = async (rel) => {
|
|
10681
|
+
for (const entry of await host2.readDir(`${dir}/output${rel ? `/${rel}` : ""}`)) {
|
|
10682
|
+
const name = rel ? `${rel}/${entry.name}` : entry.name;
|
|
10683
|
+
if (name === ".aiws" || name.startsWith(".aiws/"))
|
|
10684
|
+
continue;
|
|
10685
|
+
if (entry.isDirectory)
|
|
10686
|
+
await walk(name);
|
|
10687
|
+
else {
|
|
10688
|
+
const bytes = await host2.readFile(`${dir}/output/${name}`);
|
|
10689
|
+
let text2 = null;
|
|
10690
|
+
try {
|
|
10691
|
+
text2 = bytes.includes(0) ? null : new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
10692
|
+
} catch {
|
|
10693
|
+
text2 = null;
|
|
10694
|
+
}
|
|
10695
|
+
files[`output/${name}`] = text2 ?? { base64: btoa(Array.from(bytes, (b) => String.fromCharCode(b)).join("")) };
|
|
10696
|
+
}
|
|
10697
|
+
}
|
|
10698
|
+
};
|
|
10699
|
+
await walk("");
|
|
10700
|
+
return aiws(ctx, "proc.program", { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id"), attempt: input.attempt, source, results, log, files });
|
|
10701
|
+
}
|
|
10702
|
+
};
|
|
10703
|
+
const runReportCommand = {
|
|
10704
|
+
verb: "run-report",
|
|
10705
|
+
summary: "End a claimed run: --finished after the stage tools accepted the work (submit_analysis / finish), or the candidate itself (results / analysis), or a failure",
|
|
10706
|
+
description: "The service validates and plans what is reported; the user confirms it in the workspace. A superseded attempt or a cancelled run gets RUN_REVOKED.",
|
|
10707
|
+
options: [
|
|
10708
|
+
WORKSPACE_OPTION,
|
|
10709
|
+
RUN_OPTION,
|
|
10710
|
+
ATTEMPT_OPTION,
|
|
10711
|
+
{ name: "finished", property: "finished", description: "The stage is done: what the tools collected becomes the candidate", type: "boolean" },
|
|
10712
|
+
{ name: "results", property: "results", description: "Results JSON array (execute runs): [{ name, type, title?, content, config? }]", type: "string" },
|
|
10713
|
+
{ name: "results-file", property: "results_file", description: "Path of a JSON file holding the results array", type: "string" },
|
|
10714
|
+
{ name: "analysis", property: "analysis", description: "Analysis JSON (analyze runs, wish.analysis.v2)", type: "string" },
|
|
10715
|
+
{ name: "analysis-file", property: "analysis_file", description: "Path of a JSON file holding the analysis", type: "string" },
|
|
10716
|
+
{ name: "summary", property: "summary", description: "One paragraph on what was done", type: "string" },
|
|
10717
|
+
{ name: "warning", property: "warnings", description: "A warning for the user (repeatable)", type: "string" },
|
|
10718
|
+
{ name: "error", property: "error", description: "Report a failure instead: its reason", type: "string" }
|
|
10719
|
+
],
|
|
10720
|
+
inputSchema: workspaceInput({ run_id: { type: "string", minLength: 1 }, attempt: { type: "integer", minimum: 1 }, finished: { type: "boolean" }, results: { type: "string" }, results_file: { type: "string" }, analysis: { type: "string" }, analysis_file: { type: "string" }, summary: { type: "string" }, warnings: { type: "string" }, error: { type: "string" } }, ["run_id", "attempt"]),
|
|
10721
|
+
outputSchema: OBJECT_OUTPUT,
|
|
10722
|
+
resultSchemaVersion: 1,
|
|
10723
|
+
access: { mode: "fixed", level: "write" },
|
|
10724
|
+
asyncMode: "sync",
|
|
10725
|
+
requiresSession: true,
|
|
10726
|
+
examples: [
|
|
10727
|
+
"buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --finished",
|
|
10728
|
+
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --results-file out/results.json --summary "monthly totals and a commentary"',
|
|
10729
|
+
"buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --analysis-file out/analysis.json",
|
|
10730
|
+
'buckyos aiws run-report --workspace ws_abc --run run_xyz --attempt 1 --error "the input table is empty"'
|
|
10731
|
+
],
|
|
10732
|
+
handler: async (ctx, input) => {
|
|
10733
|
+
const params = { workspace_id: requiredInputString(input, "workspace_id"), run_id: requiredInputString(input, "run_id"), attempt: input.attempt };
|
|
10734
|
+
const error = inputString(input, "error");
|
|
10735
|
+
if (error) {
|
|
10736
|
+
params.error = { code: "EXECUTOR_FAILED", detail: error };
|
|
10737
|
+
} else if (input.finished === true) {
|
|
10738
|
+
params.finished = true;
|
|
10739
|
+
} else if (inputString(input, "analysis") || inputString(input, "analysis_file")) {
|
|
10740
|
+
params.analysis = await jsonInput(input, "analysis", "analysis_file", "an analysis");
|
|
10741
|
+
} else {
|
|
10742
|
+
params.results = await jsonInput(input, "results", "results_file", "results");
|
|
10743
|
+
params.read_set = [];
|
|
10744
|
+
}
|
|
10745
|
+
const summary2 = inputString(input, "summary");
|
|
10746
|
+
if (summary2)
|
|
10747
|
+
params.summary = summary2;
|
|
10748
|
+
const warning = inputString(input, "warnings");
|
|
10749
|
+
if (warning)
|
|
10750
|
+
params.warnings = [warning];
|
|
10751
|
+
return aiws(ctx, "proc.report", params);
|
|
10752
|
+
}
|
|
10753
|
+
};
|
|
10754
|
+
function createAiwsModule() {
|
|
10755
|
+
return {
|
|
10756
|
+
name: "aiws",
|
|
10757
|
+
summary: "AI Workspace: read a workspace, and execute wish runs as their executor (claim, heartbeat, report)",
|
|
10758
|
+
commands: [infoCommand, readCommand, queryCommand, runGetCommand, runClaimCommand, runHeartbeatCommand, runFilesCommand, runToolCommand, runProgramCommand, runReportCommand]
|
|
10759
|
+
};
|
|
10760
|
+
}
|
|
10343
10761
|
const VERSION = TOOL_VERSION;
|
|
10344
10762
|
class BuckyOSToolApplication {
|
|
10345
10763
|
#environment;
|
|
@@ -10707,6 +11125,8 @@ function createRegistry(pikgDependencies, appDependencies, logDependencies, diag
|
|
|
10707
11125
|
registry.register(createAgentModule());
|
|
10708
11126
|
registry.register(createAiModule());
|
|
10709
11127
|
registry.register(createShareModule());
|
|
11128
|
+
registry.register(createExecutorModule());
|
|
11129
|
+
registry.register(createAiwsModule());
|
|
10710
11130
|
return registry;
|
|
10711
11131
|
}
|
|
10712
11132
|
function assertNoSessionOptions(global, command) {
|
|
@@ -10812,8 +11232,8 @@ async function runCli(host2, argv) {
|
|
|
10812
11232
|
installHost(host2);
|
|
10813
11233
|
return await new BuckyOSToolApplication().run(argv);
|
|
10814
11234
|
}
|
|
10815
|
-
async function assertPathAccess(policy2, path, realPath, candidate,
|
|
10816
|
-
const roots =
|
|
11235
|
+
async function assertPathAccess(policy2, path, realPath, candidate, operation2, resolveLinks = true) {
|
|
11236
|
+
const roots = operation2 === "read" ? policy2.readPaths : policy2.writePaths;
|
|
10817
11237
|
const absolute = path.resolve(candidate);
|
|
10818
11238
|
const physicalRoots = [];
|
|
10819
11239
|
for (const root of roots) {
|
|
@@ -10827,7 +11247,7 @@ async function assertPathAccess(policy2, path, realPath, candidate, operation, r
|
|
|
10827
11247
|
if (!insideAny(absolute, roots, path) && !insideAny(absolute, physicalRoots, path)) {
|
|
10828
11248
|
throw new HostError(
|
|
10829
11249
|
"PermissionDenied",
|
|
10830
|
-
`${
|
|
11250
|
+
`${operation2} access is outside ${policy2.name}: ${absolute}`,
|
|
10831
11251
|
absolute
|
|
10832
11252
|
);
|
|
10833
11253
|
}
|
|
@@ -10838,7 +11258,7 @@ async function assertPathAccess(policy2, path, realPath, candidate, operation, r
|
|
|
10838
11258
|
if (!insideAny(physical, physicalRoots, path)) {
|
|
10839
11259
|
throw new HostError(
|
|
10840
11260
|
"PermissionDenied",
|
|
10841
|
-
`${
|
|
11261
|
+
`${operation2} access escapes ${policy2.name}: ${absolute}`,
|
|
10842
11262
|
absolute
|
|
10843
11263
|
);
|
|
10844
11264
|
}
|
|
@@ -11034,8 +11454,8 @@ class NodeHost {
|
|
|
11034
11454
|
throw translateNodeError(error, path);
|
|
11035
11455
|
}
|
|
11036
11456
|
}
|
|
11037
|
-
async assertAccess(path,
|
|
11038
|
-
await this.assertPath(path,
|
|
11457
|
+
async assertAccess(path, operation2) {
|
|
11458
|
+
await this.assertPath(path, operation2);
|
|
11039
11459
|
}
|
|
11040
11460
|
createHash(_algorithm) {
|
|
11041
11461
|
const hash = createHash("sha256");
|
|
@@ -11162,7 +11582,7 @@ class NodeHost {
|
|
|
11162
11582
|
throw new HostError("PermissionDenied", `subprocess is not allowed: ${command}`);
|
|
11163
11583
|
}
|
|
11164
11584
|
}
|
|
11165
|
-
async assertPath(candidate,
|
|
11585
|
+
async assertPath(candidate, operation2, resolveLinks = true) {
|
|
11166
11586
|
await assertPathAccess(
|
|
11167
11587
|
this.policy,
|
|
11168
11588
|
nodePath,
|
|
@@ -11174,7 +11594,7 @@ class NodeHost {
|
|
|
11174
11594
|
}
|
|
11175
11595
|
},
|
|
11176
11596
|
candidate,
|
|
11177
|
-
|
|
11597
|
+
operation2,
|
|
11178
11598
|
resolveLinks
|
|
11179
11599
|
);
|
|
11180
11600
|
}
|