@m8t-stack/cli 0.2.125 → 0.2.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +312 -124
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -128,18 +128,18 @@ function parseBrainLink(metadata) {
|
|
|
128
128
|
if (!raw)
|
|
129
129
|
return void 0;
|
|
130
130
|
try {
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
131
|
+
const obj2 = JSON.parse(raw);
|
|
132
|
+
if (!obj2 || typeof obj2.repo !== "string" || obj2.repo.length === 0)
|
|
133
133
|
return void 0;
|
|
134
134
|
return {
|
|
135
|
-
repo:
|
|
136
|
-
branch: typeof
|
|
137
|
-
topology:
|
|
138
|
-
schemaVersion: typeof
|
|
139
|
-
credentialRef: typeof
|
|
140
|
-
...typeof
|
|
141
|
-
...typeof
|
|
142
|
-
...
|
|
135
|
+
repo: obj2.repo,
|
|
136
|
+
branch: typeof obj2.branch === "string" && obj2.branch ? obj2.branch : "main",
|
|
137
|
+
topology: obj2.topology === "shared" ? "shared" : "per-worker",
|
|
138
|
+
schemaVersion: typeof obj2.schemaVersion === "string" && obj2.schemaVersion ? obj2.schemaVersion : "1",
|
|
139
|
+
credentialRef: typeof obj2.credentialRef === "string" ? obj2.credentialRef : "",
|
|
140
|
+
...typeof obj2.installationId === "string" ? { installationId: obj2.installationId } : {},
|
|
141
|
+
...typeof obj2.instanceFolder === "string" ? { instanceFolder: obj2.instanceFolder } : {},
|
|
142
|
+
...obj2.transport === "gateway-mcp-v1" || obj2.transport === "github-mcp" ? { transport: obj2.transport } : {}
|
|
143
143
|
};
|
|
144
144
|
} catch {
|
|
145
145
|
return void 0;
|
|
@@ -342,7 +342,7 @@ function signAppJwt(args) {
|
|
|
342
342
|
const now = Math.floor(Date.now() / 1e3);
|
|
343
343
|
const header = { alg: "RS256", typ: "JWT" };
|
|
344
344
|
const payload = { iat: now - 30, exp: now - 30 + 600, iss: appIdNum };
|
|
345
|
-
const b64url = (
|
|
345
|
+
const b64url = (obj2) => Buffer.from(JSON.stringify(obj2)).toString("base64url");
|
|
346
346
|
const unsigned = `${b64url(header)}.${b64url(payload)}`;
|
|
347
347
|
const sign = createSign("RSA-SHA256");
|
|
348
348
|
sign.update(unsigned);
|
|
@@ -605,8 +605,8 @@ async function runChecksOnce(args) {
|
|
|
605
605
|
checks.installationsListable = { ok: false, error: `HTTP ${String(res.status)}` };
|
|
606
606
|
return { ok: false, transient: isTransientHttpStatus(res.status), checks };
|
|
607
607
|
}
|
|
608
|
-
const
|
|
609
|
-
checks.installationsListable = { ok: true, count:
|
|
608
|
+
const arr2 = await res.json();
|
|
609
|
+
checks.installationsListable = { ok: true, count: arr2.length };
|
|
610
610
|
} catch (e) {
|
|
611
611
|
checks.installationsListable = { ok: false, error: e.message };
|
|
612
612
|
return { ok: false, transient: isTransientErr(e), checks };
|
|
@@ -1454,7 +1454,7 @@ function installFoundryDnsShim() {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
|
|
1456
1456
|
// src/lib/package-version.ts
|
|
1457
|
-
var CLI_VERSION = "0.2.
|
|
1457
|
+
var CLI_VERSION = "0.2.127";
|
|
1458
1458
|
|
|
1459
1459
|
// src/lib/render-error.ts
|
|
1460
1460
|
init_errors();
|
|
@@ -1972,18 +1972,18 @@ function maybeObj(x) {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
return x ?? {};
|
|
1974
1974
|
}
|
|
1975
|
-
function isEmptyObj(
|
|
1976
|
-
if (!
|
|
1975
|
+
function isEmptyObj(obj2) {
|
|
1976
|
+
if (!obj2)
|
|
1977
1977
|
return true;
|
|
1978
|
-
for (const _k in
|
|
1978
|
+
for (const _k in obj2)
|
|
1979
1979
|
return false;
|
|
1980
1980
|
return true;
|
|
1981
1981
|
}
|
|
1982
|
-
function hasOwn(
|
|
1983
|
-
return Object.prototype.hasOwnProperty.call(
|
|
1982
|
+
function hasOwn(obj2, key2) {
|
|
1983
|
+
return Object.prototype.hasOwnProperty.call(obj2, key2);
|
|
1984
1984
|
}
|
|
1985
|
-
function isObj(
|
|
1986
|
-
return
|
|
1985
|
+
function isObj(obj2) {
|
|
1986
|
+
return obj2 != null && typeof obj2 === "object" && !Array.isArray(obj2);
|
|
1987
1987
|
}
|
|
1988
1988
|
var validatePositiveInteger = (name, n) => {
|
|
1989
1989
|
if (typeof n !== "number" || !Number.isInteger(n)) {
|
|
@@ -2234,7 +2234,7 @@ var formatters = {
|
|
|
2234
2234
|
var RFC1738 = "RFC1738";
|
|
2235
2235
|
|
|
2236
2236
|
// ../../node_modules/.pnpm/openai@6.49.0_ws@8.21.1_zod@4.4.3/node_modules/openai/internal/qs/utils.mjs
|
|
2237
|
-
var has = (
|
|
2237
|
+
var has = (obj2, key2) => (has = Object.hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty), has(obj2, key2));
|
|
2238
2238
|
var hex_table = /* @__PURE__ */ (() => {
|
|
2239
2239
|
const array = [];
|
|
2240
2240
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -2243,15 +2243,15 @@ var hex_table = /* @__PURE__ */ (() => {
|
|
|
2243
2243
|
return array;
|
|
2244
2244
|
})();
|
|
2245
2245
|
var limit = 1024;
|
|
2246
|
-
var encode = (
|
|
2247
|
-
if (
|
|
2248
|
-
return
|
|
2246
|
+
var encode = (str5, _defaultEncoder, charset, _kind, format) => {
|
|
2247
|
+
if (str5.length === 0) {
|
|
2248
|
+
return str5;
|
|
2249
2249
|
}
|
|
2250
|
-
let string =
|
|
2251
|
-
if (typeof
|
|
2252
|
-
string = Symbol.prototype.toString.call(
|
|
2253
|
-
} else if (typeof
|
|
2254
|
-
string = String(
|
|
2250
|
+
let string = str5;
|
|
2251
|
+
if (typeof str5 === "symbol") {
|
|
2252
|
+
string = Symbol.prototype.toString.call(str5);
|
|
2253
|
+
} else if (typeof str5 !== "string") {
|
|
2254
|
+
string = String(str5);
|
|
2255
2255
|
}
|
|
2256
2256
|
if (charset === "iso-8859-1") {
|
|
2257
2257
|
return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
@@ -2261,7 +2261,7 @@ var encode = (str4, _defaultEncoder, charset, _kind, format) => {
|
|
|
2261
2261
|
let out = "";
|
|
2262
2262
|
for (let j = 0; j < string.length; j += limit) {
|
|
2263
2263
|
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
2264
|
-
const
|
|
2264
|
+
const arr2 = [];
|
|
2265
2265
|
for (let i = 0; i < segment.length; ++i) {
|
|
2266
2266
|
let c = segment.charCodeAt(i);
|
|
2267
2267
|
if (c === 45 || // -
|
|
@@ -2272,34 +2272,34 @@ var encode = (str4, _defaultEncoder, charset, _kind, format) => {
|
|
|
2272
2272
|
c >= 65 && c <= 90 || // a-z
|
|
2273
2273
|
c >= 97 && c <= 122 || // A-Z
|
|
2274
2274
|
format === RFC1738 && (c === 40 || c === 41)) {
|
|
2275
|
-
|
|
2275
|
+
arr2[arr2.length] = segment.charAt(i);
|
|
2276
2276
|
continue;
|
|
2277
2277
|
}
|
|
2278
2278
|
if (c < 128) {
|
|
2279
|
-
|
|
2279
|
+
arr2[arr2.length] = hex_table[c];
|
|
2280
2280
|
continue;
|
|
2281
2281
|
}
|
|
2282
2282
|
if (c < 2048) {
|
|
2283
|
-
|
|
2283
|
+
arr2[arr2.length] = hex_table[192 | c >> 6] + hex_table[128 | c & 63];
|
|
2284
2284
|
continue;
|
|
2285
2285
|
}
|
|
2286
2286
|
if (c < 55296 || c >= 57344) {
|
|
2287
|
-
|
|
2287
|
+
arr2[arr2.length] = hex_table[224 | c >> 12] + hex_table[128 | c >> 6 & 63] + hex_table[128 | c & 63];
|
|
2288
2288
|
continue;
|
|
2289
2289
|
}
|
|
2290
2290
|
i += 1;
|
|
2291
2291
|
c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
|
|
2292
|
-
|
|
2292
|
+
arr2[arr2.length] = hex_table[240 | c >> 18] + hex_table[128 | c >> 12 & 63] + hex_table[128 | c >> 6 & 63] + hex_table[128 | c & 63];
|
|
2293
2293
|
}
|
|
2294
|
-
out +=
|
|
2294
|
+
out += arr2.join("");
|
|
2295
2295
|
}
|
|
2296
2296
|
return out;
|
|
2297
2297
|
};
|
|
2298
|
-
function is_buffer(
|
|
2299
|
-
if (!
|
|
2298
|
+
function is_buffer(obj2) {
|
|
2299
|
+
if (!obj2 || typeof obj2 !== "object") {
|
|
2300
2300
|
return false;
|
|
2301
2301
|
}
|
|
2302
|
-
return !!(
|
|
2302
|
+
return !!(obj2.constructor && obj2.constructor.isBuffer && obj2.constructor.isBuffer(obj2));
|
|
2303
2303
|
}
|
|
2304
2304
|
function maybe_map(val, fn) {
|
|
2305
2305
|
if (isArray(val)) {
|
|
@@ -2325,8 +2325,8 @@ var array_prefix_generators = {
|
|
|
2325
2325
|
return String(prefix);
|
|
2326
2326
|
}
|
|
2327
2327
|
};
|
|
2328
|
-
var push_to_array = function(
|
|
2329
|
-
Array.prototype.push.apply(
|
|
2328
|
+
var push_to_array = function(arr2, value_or_array) {
|
|
2329
|
+
Array.prototype.push.apply(arr2, isArray(value_or_array) ? value_or_array : [value_or_array]);
|
|
2330
2330
|
};
|
|
2331
2331
|
var toISOString;
|
|
2332
2332
|
var defaults = {
|
|
@@ -2356,7 +2356,7 @@ function is_non_nullish_primitive(v) {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
var sentinel = {};
|
|
2358
2358
|
function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
2359
|
-
let
|
|
2359
|
+
let obj2 = object;
|
|
2360
2360
|
let tmp_sc = sideChannel;
|
|
2361
2361
|
let step = 0;
|
|
2362
2362
|
let find_flag = false;
|
|
@@ -2375,68 +2375,68 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
2375
2375
|
}
|
|
2376
2376
|
}
|
|
2377
2377
|
if (typeof filter === "function") {
|
|
2378
|
-
|
|
2379
|
-
} else if (
|
|
2380
|
-
|
|
2381
|
-
} else if (generateArrayPrefix === "comma" && isArray(
|
|
2382
|
-
|
|
2378
|
+
obj2 = filter(prefix, obj2);
|
|
2379
|
+
} else if (obj2 instanceof Date) {
|
|
2380
|
+
obj2 = serializeDate?.(obj2);
|
|
2381
|
+
} else if (generateArrayPrefix === "comma" && isArray(obj2)) {
|
|
2382
|
+
obj2 = maybe_map(obj2, function(value) {
|
|
2383
2383
|
if (value instanceof Date) {
|
|
2384
2384
|
return serializeDate?.(value);
|
|
2385
2385
|
}
|
|
2386
2386
|
return value;
|
|
2387
2387
|
});
|
|
2388
2388
|
}
|
|
2389
|
-
if (
|
|
2389
|
+
if (obj2 === null) {
|
|
2390
2390
|
if (strictNullHandling) {
|
|
2391
2391
|
return encoder && !encodeValuesOnly ? (
|
|
2392
2392
|
// @ts-expect-error
|
|
2393
2393
|
encoder(prefix, defaults.encoder, charset, "key", format)
|
|
2394
2394
|
) : prefix;
|
|
2395
2395
|
}
|
|
2396
|
-
|
|
2396
|
+
obj2 = "";
|
|
2397
2397
|
}
|
|
2398
|
-
if (is_non_nullish_primitive(
|
|
2398
|
+
if (is_non_nullish_primitive(obj2) || is_buffer(obj2)) {
|
|
2399
2399
|
if (encoder) {
|
|
2400
2400
|
const key_value = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
|
|
2401
2401
|
return [
|
|
2402
2402
|
formatter?.(key_value) + "=" + // @ts-expect-error
|
|
2403
|
-
formatter?.(encoder(
|
|
2403
|
+
formatter?.(encoder(obj2, defaults.encoder, charset, "value", format))
|
|
2404
2404
|
];
|
|
2405
2405
|
}
|
|
2406
|
-
return [formatter?.(prefix) + "=" + formatter?.(String(
|
|
2406
|
+
return [formatter?.(prefix) + "=" + formatter?.(String(obj2))];
|
|
2407
2407
|
}
|
|
2408
2408
|
const values = [];
|
|
2409
|
-
if (typeof
|
|
2409
|
+
if (typeof obj2 === "undefined") {
|
|
2410
2410
|
return values;
|
|
2411
2411
|
}
|
|
2412
2412
|
let obj_keys;
|
|
2413
|
-
if (generateArrayPrefix === "comma" && isArray(
|
|
2413
|
+
if (generateArrayPrefix === "comma" && isArray(obj2)) {
|
|
2414
2414
|
if (encodeValuesOnly && encoder) {
|
|
2415
|
-
|
|
2415
|
+
obj2 = maybe_map(obj2, encoder);
|
|
2416
2416
|
}
|
|
2417
|
-
obj_keys = [{ value:
|
|
2417
|
+
obj_keys = [{ value: obj2.length > 0 ? obj2.join(",") || null : void 0 }];
|
|
2418
2418
|
} else if (isArray(filter)) {
|
|
2419
2419
|
obj_keys = filter;
|
|
2420
2420
|
} else {
|
|
2421
|
-
const keys = Object.keys(
|
|
2421
|
+
const keys = Object.keys(obj2);
|
|
2422
2422
|
obj_keys = sort ? keys.sort(sort) : keys;
|
|
2423
2423
|
}
|
|
2424
2424
|
const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix);
|
|
2425
|
-
const adjusted_prefix = commaRoundTrip && isArray(
|
|
2426
|
-
if (allowEmptyArrays && isArray(
|
|
2425
|
+
const adjusted_prefix = commaRoundTrip && isArray(obj2) && obj2.length === 1 ? encoded_prefix + "[]" : encoded_prefix;
|
|
2426
|
+
if (allowEmptyArrays && isArray(obj2) && obj2.length === 0) {
|
|
2427
2427
|
return adjusted_prefix + "[]";
|
|
2428
2428
|
}
|
|
2429
2429
|
for (let j = 0; j < obj_keys.length; ++j) {
|
|
2430
2430
|
const key2 = obj_keys[j];
|
|
2431
2431
|
const value = (
|
|
2432
2432
|
// @ts-ignore
|
|
2433
|
-
typeof key2 === "object" && typeof key2.value !== "undefined" ? key2.value :
|
|
2433
|
+
typeof key2 === "object" && typeof key2.value !== "undefined" ? key2.value : obj2[key2]
|
|
2434
2434
|
);
|
|
2435
2435
|
if (skipNulls && value === null) {
|
|
2436
2436
|
continue;
|
|
2437
2437
|
}
|
|
2438
2438
|
const encoded_key = allowDots && encodeDotInKeys ? key2.replace(/\./g, "%2E") : key2;
|
|
2439
|
-
const key_prefix = isArray(
|
|
2439
|
+
const key_prefix = isArray(obj2) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjusted_prefix, encoded_key) : adjusted_prefix : adjusted_prefix + (allowDots ? "." + encoded_key : "[" + encoded_key + "]");
|
|
2440
2440
|
sideChannel.set(object, step);
|
|
2441
2441
|
const valueSideChannel = /* @__PURE__ */ new WeakMap();
|
|
2442
2442
|
valueSideChannel.set(sentinel, sideChannel);
|
|
@@ -2450,7 +2450,7 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
2450
2450
|
skipNulls,
|
|
2451
2451
|
encodeDotInKeys,
|
|
2452
2452
|
// @ts-ignore
|
|
2453
|
-
generateArrayPrefix === "comma" && encodeValuesOnly && isArray(
|
|
2453
|
+
generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj2) ? null : encoder,
|
|
2454
2454
|
filter,
|
|
2455
2455
|
sort,
|
|
2456
2456
|
allowDots,
|
|
@@ -2527,25 +2527,25 @@ function normalize_stringify_options(opts = defaults) {
|
|
|
2527
2527
|
};
|
|
2528
2528
|
}
|
|
2529
2529
|
function stringify(object, opts = {}) {
|
|
2530
|
-
let
|
|
2530
|
+
let obj2 = object;
|
|
2531
2531
|
const options = normalize_stringify_options(opts);
|
|
2532
2532
|
let obj_keys;
|
|
2533
2533
|
let filter;
|
|
2534
2534
|
if (typeof options.filter === "function") {
|
|
2535
2535
|
filter = options.filter;
|
|
2536
|
-
|
|
2536
|
+
obj2 = filter("", obj2);
|
|
2537
2537
|
} else if (isArray(options.filter)) {
|
|
2538
2538
|
filter = options.filter;
|
|
2539
2539
|
obj_keys = filter;
|
|
2540
2540
|
}
|
|
2541
2541
|
const keys = [];
|
|
2542
|
-
if (typeof
|
|
2542
|
+
if (typeof obj2 !== "object" || obj2 === null) {
|
|
2543
2543
|
return "";
|
|
2544
2544
|
}
|
|
2545
2545
|
const generateArrayPrefix = array_prefix_generators[options.arrayFormat];
|
|
2546
2546
|
const commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
|
|
2547
2547
|
if (!obj_keys) {
|
|
2548
|
-
obj_keys = Object.keys(
|
|
2548
|
+
obj_keys = Object.keys(obj2);
|
|
2549
2549
|
}
|
|
2550
2550
|
if (options.sort) {
|
|
2551
2551
|
obj_keys.sort(options.sort);
|
|
@@ -2553,11 +2553,11 @@ function stringify(object, opts = {}) {
|
|
|
2553
2553
|
const sideChannel = /* @__PURE__ */ new WeakMap();
|
|
2554
2554
|
for (let i = 0; i < obj_keys.length; ++i) {
|
|
2555
2555
|
const key2 = obj_keys[i];
|
|
2556
|
-
if (options.skipNulls &&
|
|
2556
|
+
if (options.skipNulls && obj2[key2] === null) {
|
|
2557
2557
|
continue;
|
|
2558
2558
|
}
|
|
2559
2559
|
push_to_array(keys, inner_stringify(
|
|
2560
|
-
|
|
2560
|
+
obj2[key2],
|
|
2561
2561
|
key2,
|
|
2562
2562
|
// @ts-expect-error
|
|
2563
2563
|
generateArrayPrefix,
|
|
@@ -2610,9 +2610,9 @@ function concatBytes(buffers) {
|
|
|
2610
2610
|
return output;
|
|
2611
2611
|
}
|
|
2612
2612
|
var encodeUTF8_;
|
|
2613
|
-
function encodeUTF8(
|
|
2613
|
+
function encodeUTF8(str5) {
|
|
2614
2614
|
let encoder;
|
|
2615
|
-
return (encodeUTF8_ ?? (encoder = new globalThis.TextEncoder(), encodeUTF8_ = encoder.encode.bind(encoder)))(
|
|
2615
|
+
return (encodeUTF8_ ?? (encoder = new globalThis.TextEncoder(), encodeUTF8_ = encoder.encode.bind(encoder)))(str5);
|
|
2616
2616
|
}
|
|
2617
2617
|
var decodeUTF8_;
|
|
2618
2618
|
function decodeUTF8(bytes) {
|
|
@@ -3052,12 +3052,12 @@ var SSEDecoder = class {
|
|
|
3052
3052
|
return null;
|
|
3053
3053
|
}
|
|
3054
3054
|
};
|
|
3055
|
-
function partition(
|
|
3056
|
-
const index =
|
|
3055
|
+
function partition(str5, delimiter) {
|
|
3056
|
+
const index = str5.indexOf(delimiter);
|
|
3057
3057
|
if (index !== -1) {
|
|
3058
|
-
return [
|
|
3058
|
+
return [str5.substring(0, index), delimiter, str5.substring(index + delimiter.length)];
|
|
3059
3059
|
}
|
|
3060
|
-
return [
|
|
3060
|
+
return [str5, "", ""];
|
|
3061
3061
|
}
|
|
3062
3062
|
|
|
3063
3063
|
// ../../node_modules/.pnpm/openai@6.49.0_ws@8.21.1_zod@4.4.3/node_modules/openai/internal/parse.mjs
|
|
@@ -3786,8 +3786,8 @@ var APIResource = class {
|
|
|
3786
3786
|
};
|
|
3787
3787
|
|
|
3788
3788
|
// ../../node_modules/.pnpm/openai@6.49.0_ws@8.21.1_zod@4.4.3/node_modules/openai/internal/utils/path.mjs
|
|
3789
|
-
function encodeURIPath(
|
|
3790
|
-
return
|
|
3789
|
+
function encodeURIPath(str5) {
|
|
3790
|
+
return str5.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
3791
3791
|
}
|
|
3792
3792
|
var EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
3793
3793
|
var createPathTagFunction = (pathEncoder = encodeURIPath) => function path47(statics, ...params) {
|
|
@@ -4767,21 +4767,21 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
4767
4767
|
const parseObj = () => {
|
|
4768
4768
|
index++;
|
|
4769
4769
|
skipBlank();
|
|
4770
|
-
const
|
|
4770
|
+
const obj2 = {};
|
|
4771
4771
|
try {
|
|
4772
4772
|
while (jsonString[index] !== "}") {
|
|
4773
4773
|
skipBlank();
|
|
4774
4774
|
if (index >= length && Allow.OBJ & allow)
|
|
4775
|
-
return
|
|
4775
|
+
return obj2;
|
|
4776
4776
|
const key2 = parseStr();
|
|
4777
4777
|
skipBlank();
|
|
4778
4778
|
index++;
|
|
4779
4779
|
try {
|
|
4780
4780
|
const value = parseAny();
|
|
4781
|
-
Object.defineProperty(
|
|
4781
|
+
Object.defineProperty(obj2, key2, { value, writable: true, enumerable: true, configurable: true });
|
|
4782
4782
|
} catch (e) {
|
|
4783
4783
|
if (Allow.OBJ & allow)
|
|
4784
|
-
return
|
|
4784
|
+
return obj2;
|
|
4785
4785
|
else
|
|
4786
4786
|
throw e;
|
|
4787
4787
|
}
|
|
@@ -4791,19 +4791,19 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
4791
4791
|
}
|
|
4792
4792
|
} catch (e) {
|
|
4793
4793
|
if (Allow.OBJ & allow)
|
|
4794
|
-
return
|
|
4794
|
+
return obj2;
|
|
4795
4795
|
else
|
|
4796
4796
|
markPartialJSON("Expected '}' at end of object");
|
|
4797
4797
|
}
|
|
4798
4798
|
index++;
|
|
4799
|
-
return
|
|
4799
|
+
return obj2;
|
|
4800
4800
|
};
|
|
4801
4801
|
const parseArr = () => {
|
|
4802
4802
|
index++;
|
|
4803
|
-
const
|
|
4803
|
+
const arr2 = [];
|
|
4804
4804
|
try {
|
|
4805
4805
|
while (jsonString[index] !== "]") {
|
|
4806
|
-
|
|
4806
|
+
arr2.push(parseAny());
|
|
4807
4807
|
skipBlank();
|
|
4808
4808
|
if (jsonString[index] === ",") {
|
|
4809
4809
|
index++;
|
|
@@ -4811,12 +4811,12 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
4811
4811
|
}
|
|
4812
4812
|
} catch (e) {
|
|
4813
4813
|
if (Allow.ARR & allow) {
|
|
4814
|
-
return
|
|
4814
|
+
return arr2;
|
|
4815
4815
|
}
|
|
4816
4816
|
markPartialJSON("Expected ']' at end of array");
|
|
4817
4817
|
}
|
|
4818
4818
|
index++;
|
|
4819
|
-
return
|
|
4819
|
+
return arr2;
|
|
4820
4820
|
};
|
|
4821
4821
|
const parseNum = () => {
|
|
4822
4822
|
if (index === 0) {
|
|
@@ -5408,7 +5408,7 @@ function isCompleteAudio(audio) {
|
|
|
5408
5408
|
function str(x) {
|
|
5409
5409
|
return JSON.stringify(x);
|
|
5410
5410
|
}
|
|
5411
|
-
function assertIsEmpty(
|
|
5411
|
+
function assertIsEmpty(obj2) {
|
|
5412
5412
|
return;
|
|
5413
5413
|
}
|
|
5414
5414
|
function assertNever(_x) {
|
|
@@ -12349,12 +12349,12 @@ var OpenAI = class {
|
|
|
12349
12349
|
retriesRemaining = maxRetries;
|
|
12350
12350
|
}
|
|
12351
12351
|
await this.prepareOptions(options);
|
|
12352
|
-
const { req:
|
|
12352
|
+
const { req: req3, url, timeout } = await this.buildRequest(options, {
|
|
12353
12353
|
retryCount: maxRetries - retriesRemaining
|
|
12354
12354
|
});
|
|
12355
12355
|
const hasStreamingBody = options.__metadata?.["hasStreamingBody"] === true;
|
|
12356
|
-
await this.prepareRequest(
|
|
12357
|
-
await this._provider?.prepareRequest?.(
|
|
12356
|
+
await this.prepareRequest(req3, { url, options });
|
|
12357
|
+
await this._provider?.prepareRequest?.(req3, { url, options });
|
|
12358
12358
|
const requestLogID = "log_" + (Math.random() * (1 << 24) | 0).toString(16).padStart(6, "0");
|
|
12359
12359
|
const retryLogStr = retryOfRequestLogID === void 0 ? "" : `, retryOf: ${retryOfRequestLogID}`;
|
|
12360
12360
|
const startTime = Date.now();
|
|
@@ -12363,14 +12363,14 @@ var OpenAI = class {
|
|
|
12363
12363
|
method: options.method,
|
|
12364
12364
|
url,
|
|
12365
12365
|
options,
|
|
12366
|
-
headers:
|
|
12366
|
+
headers: req3.headers
|
|
12367
12367
|
}));
|
|
12368
12368
|
if (options.signal?.aborted) {
|
|
12369
12369
|
throw new APIUserAbortError();
|
|
12370
12370
|
}
|
|
12371
12371
|
const security = options.__security ?? { bearerAuth: true };
|
|
12372
12372
|
const controller = new AbortController();
|
|
12373
|
-
const response = await this.fetchWithAuth(url,
|
|
12373
|
+
const response = await this.fetchWithAuth(url, req3, timeout, controller, security).catch(castToError);
|
|
12374
12374
|
const headersTime = Date.now();
|
|
12375
12375
|
if (response instanceof globalThis.Error) {
|
|
12376
12376
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -12408,7 +12408,7 @@ var OpenAI = class {
|
|
|
12408
12408
|
});
|
|
12409
12409
|
}
|
|
12410
12410
|
const specialHeaders = [...response.headers.entries()].filter(([name]) => name === "x-request-id").map(([name, value]) => ", " + name + ": " + JSON.stringify(value)).join("");
|
|
12411
|
-
const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${
|
|
12411
|
+
const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req3.method} ${url} ${response.ok ? "succeeded" : "failed"} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
12412
12412
|
if (!response.ok) {
|
|
12413
12413
|
if (response.status === 401 && this._workloadIdentityAuth && security.bearerAuth && !options.__metadata?.["hasStreamingBody"] && !options.__metadata?.["workloadIdentityTokenRefreshed"]) {
|
|
12414
12414
|
await CancelReadableStream(response.body);
|
|
@@ -12569,7 +12569,7 @@ var OpenAI = class {
|
|
|
12569
12569
|
};
|
|
12570
12570
|
}
|
|
12571
12571
|
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
12572
|
-
const
|
|
12572
|
+
const req3 = {
|
|
12573
12573
|
method,
|
|
12574
12574
|
headers: reqHeaders,
|
|
12575
12575
|
...options.signal && { signal: options.signal },
|
|
@@ -12578,7 +12578,7 @@ var OpenAI = class {
|
|
|
12578
12578
|
...this.fetchOptions ?? {},
|
|
12579
12579
|
...options.fetchOptions ?? {}
|
|
12580
12580
|
};
|
|
12581
|
-
return { req:
|
|
12581
|
+
return { req: req3, url, timeout: options.timeout };
|
|
12582
12582
|
}
|
|
12583
12583
|
async buildHeaders({ options, method, bodyHeaders, retryCount }) {
|
|
12584
12584
|
let idempotencyHeaders = {};
|
|
@@ -13096,18 +13096,18 @@ function translateAzureIdentityError(e) {
|
|
|
13096
13096
|
// src/lib/api-client.ts
|
|
13097
13097
|
var COLD_START_RETRY_DELAY_MS = 1e3;
|
|
13098
13098
|
var COLD_START_RETRY_STATUS_CODES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
13099
|
-
async function apiCall(opts,
|
|
13099
|
+
async function apiCall(opts, req3, notify) {
|
|
13100
13100
|
const token = await getBearerToken(opts.gatewayClientId);
|
|
13101
|
-
const url = `${opts.gatewayUrl}${
|
|
13101
|
+
const url = `${opts.gatewayUrl}${req3.path}`;
|
|
13102
13102
|
const headers = {
|
|
13103
13103
|
authorization: `Bearer ${token}`,
|
|
13104
13104
|
accept: "application/json"
|
|
13105
13105
|
};
|
|
13106
|
-
if (
|
|
13106
|
+
if (req3.body !== void 0) headers["content-type"] = "application/json";
|
|
13107
13107
|
const init = {
|
|
13108
|
-
method:
|
|
13108
|
+
method: req3.method,
|
|
13109
13109
|
headers,
|
|
13110
|
-
body:
|
|
13110
|
+
body: req3.body !== void 0 ? JSON.stringify(req3.body) : void 0
|
|
13111
13111
|
};
|
|
13112
13112
|
let res;
|
|
13113
13113
|
try {
|
|
@@ -14550,9 +14550,9 @@ async function createGitHubApp(args) {
|
|
|
14550
14550
|
server.close();
|
|
14551
14551
|
}, 2500);
|
|
14552
14552
|
};
|
|
14553
|
-
server = createServer((
|
|
14553
|
+
server = createServer((req3, res) => {
|
|
14554
14554
|
void (async () => {
|
|
14555
|
-
const u = new URL(
|
|
14555
|
+
const u = new URL(req3.url ?? "/", base);
|
|
14556
14556
|
if (u.pathname === "/") {
|
|
14557
14557
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
14558
14558
|
res.end(renderManifestForm({ org: args.org, state, redirectUrl, setupUrl, nameSuffix: args.nameSuffix }));
|
|
@@ -16651,11 +16651,11 @@ var REQUIRED_INSTALLATION_PERMISSIONS = [
|
|
|
16651
16651
|
];
|
|
16652
16652
|
var LEVEL_RANK = { read: 1, write: 2, admin: 3 };
|
|
16653
16653
|
function findPermissionGaps(granted) {
|
|
16654
|
-
return REQUIRED_INSTALLATION_PERMISSIONS.flatMap((
|
|
16655
|
-
const have = granted[
|
|
16654
|
+
return REQUIRED_INSTALLATION_PERMISSIONS.flatMap((req3) => {
|
|
16655
|
+
const have = granted[req3.key];
|
|
16656
16656
|
const haveRank = have ? LEVEL_RANK[have] ?? 0 : 0;
|
|
16657
|
-
const needRank = LEVEL_RANK[
|
|
16658
|
-
return haveRank >= needRank ? [] : [{ key:
|
|
16657
|
+
const needRank = LEVEL_RANK[req3.level] ?? 0;
|
|
16658
|
+
return haveRank >= needRank ? [] : [{ key: req3.key, required: req3.level, granted: have ?? null, why: req3.why }];
|
|
16659
16659
|
});
|
|
16660
16660
|
}
|
|
16661
16661
|
function buildPermissionRefusal(args) {
|
|
@@ -19536,11 +19536,11 @@ function fromBuild(raw, fallbackRef) {
|
|
|
19536
19536
|
};
|
|
19537
19537
|
}
|
|
19538
19538
|
var DEV_TAG = "v0.0.0-dev";
|
|
19539
|
-
var PINNED_INSTALLER = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-installer:v0.1.
|
|
19539
|
+
var PINNED_INSTALLER = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-installer:v0.1.92","registry":"ghcr.io/m8t-labs","image":"m8t-installer","tag":"v0.1.92"}', "ghcr.io/m8t-labs/m8t-installer");
|
|
19540
19540
|
var PINNED_CODING_AGENT = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-coding-agent:v0.1.5","registry":"ghcr.io/m8t-labs","image":"m8t-coding-agent","tag":"v0.1.5"}', "ghcr.io/m8t-labs/m8t-coding-agent");
|
|
19541
19541
|
var PINNED_AZURE_EXECUTOR = fromBuild('{"ref":"ghcr.io/m8t-labs/m8t-azure-executor:v0.1.5","registry":"ghcr.io/m8t-labs","image":"m8t-azure-executor","tag":"v0.1.5"}', "ghcr.io/m8t-labs/m8t-azure-executor");
|
|
19542
19542
|
var PINNED_PLATFORM_VERSION = (() => {
|
|
19543
|
-
const raw = "0.
|
|
19543
|
+
const raw = "0.8.0";
|
|
19544
19544
|
return /^\d+\.\d+\.\d+$/.test(raw) ? raw : "";
|
|
19545
19545
|
})();
|
|
19546
19546
|
|
|
@@ -21164,9 +21164,9 @@ That repository is private, so this command is maintainer-side for now.
|
|
|
21164
21164
|
Your installation still updates itself: the auto-update rail applies published releases from the channel without reading this repository.`;
|
|
21165
21165
|
}
|
|
21166
21166
|
function parseTreeResponse(body) {
|
|
21167
|
-
const
|
|
21168
|
-
for (const e of body.tree ?? []) if (e.type === "tree")
|
|
21169
|
-
return { treeShaOf: (p) =>
|
|
21167
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
21168
|
+
for (const e of body.tree ?? []) if (e.type === "tree") map2.set(e.path, e.sha);
|
|
21169
|
+
return { treeShaOf: (p) => map2.get(p.replace(/\/$/, "")) };
|
|
21170
21170
|
}
|
|
21171
21171
|
async function fetchRepoTree(commit, deps = {}) {
|
|
21172
21172
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
@@ -28995,9 +28995,9 @@ function groupIntoConversations(rows, members = []) {
|
|
|
28995
28995
|
const groups = /* @__PURE__ */ new Map();
|
|
28996
28996
|
for (const r of rows) {
|
|
28997
28997
|
const key2 = r.source === "a2a" ? `a2a:${r.delegationId ?? r.eventId}` : r.foundryConversationId ?? `__single__:${r.responseId ?? r.eventId}`;
|
|
28998
|
-
const
|
|
28999
|
-
if (
|
|
29000
|
-
|
|
28998
|
+
const arr2 = groups.get(key2);
|
|
28999
|
+
if (arr2)
|
|
29000
|
+
arr2.push(r);
|
|
29001
29001
|
else
|
|
29002
29002
|
groups.set(key2, [r]);
|
|
29003
29003
|
}
|
|
@@ -29813,9 +29813,9 @@ function groupRows(rows) {
|
|
|
29813
29813
|
const by = /* @__PURE__ */ new Map();
|
|
29814
29814
|
for (const r of rows) {
|
|
29815
29815
|
const k = rowGroupKey(r);
|
|
29816
|
-
const
|
|
29817
|
-
if (
|
|
29818
|
-
|
|
29816
|
+
const arr2 = by.get(k);
|
|
29817
|
+
if (arr2)
|
|
29818
|
+
arr2.push(r);
|
|
29819
29819
|
else
|
|
29820
29820
|
by.set(k, [r]);
|
|
29821
29821
|
}
|
|
@@ -29844,9 +29844,9 @@ async function enrichGroup(trace, g, window2) {
|
|
|
29844
29844
|
if (!respIds.length)
|
|
29845
29845
|
return void 0;
|
|
29846
29846
|
try {
|
|
29847
|
-
const
|
|
29847
|
+
const map2 = await trace.enrich(respIds, { from: window2.from ?? "", to: window2.to });
|
|
29848
29848
|
for (const r of respIds) {
|
|
29849
|
-
const hit =
|
|
29849
|
+
const hit = map2.get(r);
|
|
29850
29850
|
if (hit)
|
|
29851
29851
|
return hit;
|
|
29852
29852
|
}
|
|
@@ -32753,9 +32753,175 @@ import { createHash as createHash7, randomUUID as randomUUID3 } from "crypto";
|
|
|
32753
32753
|
import * as fs32 from "fs/promises";
|
|
32754
32754
|
import * as os13 from "os";
|
|
32755
32755
|
import * as path35 from "path";
|
|
32756
|
-
|
|
32756
|
+
|
|
32757
|
+
// ../../packages/install-contract/src/spec.ts
|
|
32758
|
+
var lit = (value) => ({ kind: "literal", value });
|
|
32759
|
+
var num2 = () => ({ kind: "number" });
|
|
32760
|
+
var str4 = () => ({ kind: "string" });
|
|
32761
|
+
var bool = () => ({ kind: "boolean" });
|
|
32762
|
+
var enom = (...values) => ({ kind: "enum", values });
|
|
32763
|
+
var arr = (items) => ({ kind: "array", items });
|
|
32764
|
+
var map = (values) => ({ kind: "map", values });
|
|
32765
|
+
var obj = (fields) => ({ kind: "object", fields });
|
|
32766
|
+
var nullable = (inner) => ({ kind: "nullable", inner });
|
|
32767
|
+
var req2 = (node, doc) => ({ node, required: true, ...doc ? { doc } : {} });
|
|
32768
|
+
var opt = (node, doc) => ({ node, required: false, ...doc ? { doc } : {} });
|
|
32769
|
+
function validateNode(node, value, path47 = "", opts = {}) {
|
|
32770
|
+
const at = path47 === "" ? "(root)" : path47;
|
|
32771
|
+
switch (node.kind) {
|
|
32772
|
+
case "literal":
|
|
32773
|
+
return value === node.value ? [] : [{ path: at, message: `expected the literal ${String(node.value)}, got ${describe(value)}` }];
|
|
32774
|
+
case "number":
|
|
32775
|
+
return typeof value === "number" && Number.isFinite(value) ? [] : [{ path: at, message: `expected a finite number, got ${describe(value)}` }];
|
|
32776
|
+
case "string":
|
|
32777
|
+
return typeof value === "string" ? [] : [{ path: at, message: `expected a string, got ${describe(value)}` }];
|
|
32778
|
+
case "boolean":
|
|
32779
|
+
return typeof value === "boolean" ? [] : [{ path: at, message: `expected a boolean, got ${describe(value)}` }];
|
|
32780
|
+
case "enum":
|
|
32781
|
+
return typeof value === "string" && node.values.includes(value) ? [] : [{ path: at, message: `expected one of ${node.values.join(" | ")}, got ${describe(value)}` }];
|
|
32782
|
+
case "nullable":
|
|
32783
|
+
return value === null ? [] : validateNode(node.inner, value, path47, opts);
|
|
32784
|
+
case "array": {
|
|
32785
|
+
if (!Array.isArray(value)) return [{ path: at, message: `expected an array, got ${describe(value)}` }];
|
|
32786
|
+
return value.flatMap((v, i) => validateNode(node.items, v, `${path47}[${String(i)}]`, opts));
|
|
32787
|
+
}
|
|
32788
|
+
case "map": {
|
|
32789
|
+
if (!isPlainObject(value)) return [{ path: at, message: `expected an object, got ${describe(value)}` }];
|
|
32790
|
+
return Object.entries(value).flatMap(([k, v]) => validateNode(node.values, v, `${path47}.${k}`, opts));
|
|
32791
|
+
}
|
|
32792
|
+
case "object": {
|
|
32793
|
+
if (!isPlainObject(value)) return [{ path: at, message: `expected an object, got ${describe(value)}` }];
|
|
32794
|
+
const out = [];
|
|
32795
|
+
for (const [name, field] of Object.entries(node.fields)) {
|
|
32796
|
+
const present = Object.prototype.hasOwnProperty.call(value, name);
|
|
32797
|
+
if (!present) {
|
|
32798
|
+
if (field.required) out.push({ path: `${path47}.${name}`, message: "is required but missing" });
|
|
32799
|
+
continue;
|
|
32800
|
+
}
|
|
32801
|
+
out.push(...validateNode(field.node, value[name], `${path47}.${name}`, opts));
|
|
32802
|
+
}
|
|
32803
|
+
if ((opts.unknownFields ?? "reject") === "reject") {
|
|
32804
|
+
for (const name of Object.keys(value)) {
|
|
32805
|
+
if (!Object.prototype.hasOwnProperty.call(node.fields, name)) {
|
|
32806
|
+
out.push({
|
|
32807
|
+
path: `${path47}.${name}`,
|
|
32808
|
+
message: "is not declared by the contract. If the installer legitimately writes it, declare it here and regenerate the schema \u2014 do not widen the object."
|
|
32809
|
+
});
|
|
32810
|
+
}
|
|
32811
|
+
}
|
|
32812
|
+
}
|
|
32813
|
+
return out;
|
|
32814
|
+
}
|
|
32815
|
+
}
|
|
32816
|
+
}
|
|
32817
|
+
function isPlainObject(v) {
|
|
32818
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
32819
|
+
}
|
|
32820
|
+
function describe(v) {
|
|
32821
|
+
if (v === null) return "null";
|
|
32822
|
+
if (Array.isArray(v)) return "an array";
|
|
32823
|
+
return typeof v;
|
|
32824
|
+
}
|
|
32825
|
+
|
|
32826
|
+
// ../../packages/install-contract/src/status-doc.ts
|
|
32827
|
+
var STATUS_SCHEMA_VERSION = 1;
|
|
32757
32828
|
var STATUS_CONTAINER = "status";
|
|
32758
32829
|
var STATUS_BLOB = "status.json";
|
|
32830
|
+
var STATUS_DOC_SPEC = obj({
|
|
32831
|
+
schemaVersion: req2(lit(STATUS_SCHEMA_VERSION), "Always 1 in this version of the contract. A reader that does not recognise the value must refuse the document rather than guess at it."),
|
|
32832
|
+
status: req2(enom("running", "done", "failed"), "The run's state. `done` and `failed` are terminal; nothing writes the document afterwards."),
|
|
32833
|
+
phase: req2(str4(), "The phase name the installer is in. See the phase registry \u2014 the set is open by type but closed in practice, and includes `converge` on the update path."),
|
|
32834
|
+
phaseIndex: req2(num2(), "1-based index of the current phase. NOT monotonic: a restarted container re-runs from phase 1, so this can go backwards mid-install."),
|
|
32835
|
+
phaseTotal: req2(num2(), "Total phases the writer counts, including the terminal `done` emit. Read it from the document, never from a constant \u2014 a container built at another commit may report a different total."),
|
|
32836
|
+
startedAt: opt(str4(), "ISO-8601 UTC. Preserved across a container restart when the prior document was recovered (`hydrate_status`)."),
|
|
32837
|
+
updatedAt: opt(str4(), "ISO-8601 UTC of this write."),
|
|
32838
|
+
detail: opt(str4(), "Human-facing one-liner for the current phase. Installer-authored; safe to show, never parse."),
|
|
32839
|
+
result: opt(
|
|
32840
|
+
obj({
|
|
32841
|
+
gatewayFqdn: opt(str4()),
|
|
32842
|
+
gatewayUrl: opt(str4()),
|
|
32843
|
+
foundryEndpoint: opt(str4()),
|
|
32844
|
+
// `entrypoint.sh` fills this with `jq -c '.created'` from `m8t foundry
|
|
32845
|
+
// create`'s JSON and passes it through `--argjson`. If that command ever
|
|
32846
|
+
// stops carrying `.created`, jq yields the literal `null` and the field
|
|
32847
|
+
// lands as null rather than absent — a cross-binary coupling with no
|
|
32848
|
+
// guard on either side. Tolerated here so one missing key upstream cannot
|
|
32849
|
+
// make an otherwise-good `done` document unreadable.
|
|
32850
|
+
freshVsReused: opt(nullable(map(bool())), "Per-resource: true when this run created it, false when it reused an existing one. Null if the installer could not determine it."),
|
|
32851
|
+
brains: opt(arr(str4())),
|
|
32852
|
+
workers: opt(arr(str4())),
|
|
32853
|
+
stampSeed: opt(str4()),
|
|
32854
|
+
updaterProvision: opt(str4()),
|
|
32855
|
+
platformVersion: opt(str4(), "The release the engine stamped, e.g. `platform-v0.7.8`. Absent when the engine could not resolve one."),
|
|
32856
|
+
telemetryIdentity: opt(str4())
|
|
32857
|
+
}),
|
|
32858
|
+
"Present only on a `done` document."
|
|
32859
|
+
),
|
|
32860
|
+
error: opt(
|
|
32861
|
+
obj({
|
|
32862
|
+
// BOTH optional, and this is not defensive vagueness — the installer's
|
|
32863
|
+
// EXIT trap composes this object with jq and falls back to a literal `{}`
|
|
32864
|
+
// if that jq fails (`... 2>/dev/null || printf '{}'`). That fallback is
|
|
32865
|
+
// the last-resort safety net which guarantees a dead install still
|
|
32866
|
+
// publishes a `failed` document instead of freezing on `running`.
|
|
32867
|
+
// Requiring these fields would make the reader refuse exactly the
|
|
32868
|
+
// document the safety net exists to produce, so a founder whose install
|
|
32869
|
+
// died would see a read error instead of which phase died.
|
|
32870
|
+
phase: opt(str4()),
|
|
32871
|
+
message: opt(str4(), "Free-form, may carry raw az stderr. LOCAL ONLY \u2014 never forward it outward; the wire composes `errorDetail` separately.")
|
|
32872
|
+
}),
|
|
32873
|
+
"Present only on a `failed` document. May be an EMPTY object when the installer's exit trap could not compose it."
|
|
32874
|
+
),
|
|
32875
|
+
history: opt(
|
|
32876
|
+
arr(obj({ phase: req2(str4()), at: req2(str4()), status: req2(str4()) })),
|
|
32877
|
+
"Append-only, one entry per emit. Survives a restart via `hydrate_status`, so a resumed run's history contains the earlier attempt's entries too."
|
|
32878
|
+
),
|
|
32879
|
+
warnings: opt(
|
|
32880
|
+
arr(obj({ phase: req2(str4()), at: req2(str4()), text: req2(str4()) })),
|
|
32881
|
+
"Advisories raised by any phase, accumulated across the run. Written only when at least one exists \u2014 an absent key means none were raised, not that the field is unsupported."
|
|
32882
|
+
)
|
|
32883
|
+
});
|
|
32884
|
+
function parseStatusDoc(raw, opts = {}) {
|
|
32885
|
+
let parsed;
|
|
32886
|
+
try {
|
|
32887
|
+
parsed = JSON.parse(raw.trim());
|
|
32888
|
+
} catch (e) {
|
|
32889
|
+
return { ok: false, rejection: { reason: "not-json", message: e.message } };
|
|
32890
|
+
}
|
|
32891
|
+
const hasVersion = typeof parsed === "object" && parsed !== null && Object.prototype.hasOwnProperty.call(parsed, "schemaVersion");
|
|
32892
|
+
if (!hasVersion) {
|
|
32893
|
+
return { ok: false, rejection: { reason: "missing-schema-version" } };
|
|
32894
|
+
}
|
|
32895
|
+
const version = parsed.schemaVersion;
|
|
32896
|
+
if (version !== STATUS_SCHEMA_VERSION) {
|
|
32897
|
+
return { ok: false, rejection: { reason: "unknown-schema-version", found: version, supported: STATUS_SCHEMA_VERSION } };
|
|
32898
|
+
}
|
|
32899
|
+
const violations = validateNode(STATUS_DOC_SPEC, parsed, "", opts);
|
|
32900
|
+
if (violations.length > 0) return { ok: false, rejection: { reason: "invalid", violations } };
|
|
32901
|
+
return { ok: true, doc: parsed };
|
|
32902
|
+
}
|
|
32903
|
+
function parseStatusDocForReader(raw) {
|
|
32904
|
+
return parseStatusDoc(raw, { unknownFields: "ignore" });
|
|
32905
|
+
}
|
|
32906
|
+
var MAX_EXPLAINED_VIOLATIONS = 3;
|
|
32907
|
+
function explainRejection(r) {
|
|
32908
|
+
switch (r.reason) {
|
|
32909
|
+
case "not-json":
|
|
32910
|
+
return `the installer status document is not valid JSON (${r.message})`;
|
|
32911
|
+
case "missing-schema-version":
|
|
32912
|
+
return "the installer status document has no schemaVersion, so it is truncated or corrupt rather than simply newer";
|
|
32913
|
+
case "unknown-schema-version":
|
|
32914
|
+
return `the installer status document declares schemaVersion ${JSON.stringify(r.found)}, but this build only understands version ${String(r.supported)}. Update the tool that is reading it.`;
|
|
32915
|
+
case "invalid": {
|
|
32916
|
+
const shown = r.violations.slice(0, MAX_EXPLAINED_VIOLATIONS).map((v) => `${v.path} ${v.message}`);
|
|
32917
|
+
const rest = r.violations.length - shown.length;
|
|
32918
|
+
return `the installer status document does not match the contract: ` + shown.join("; ") + (rest > 0 ? ` (and ${String(rest)} more)` : "");
|
|
32919
|
+
}
|
|
32920
|
+
}
|
|
32921
|
+
}
|
|
32922
|
+
|
|
32923
|
+
// src/lib/bootstrap-status.ts
|
|
32924
|
+
init_errors();
|
|
32759
32925
|
function deriveStatusSaName(resourceGroup, subscriptionId) {
|
|
32760
32926
|
const hex = createHash7("sha256").update(resourceGroup + subscriptionId).digest("hex").slice(0, 12);
|
|
32761
32927
|
return `m8tinst${hex}`;
|
|
@@ -32765,6 +32931,7 @@ function statusBlobUrl(saName) {
|
|
|
32765
32931
|
}
|
|
32766
32932
|
async function readStatusBlob(opts) {
|
|
32767
32933
|
let key2;
|
|
32934
|
+
let raw;
|
|
32768
32935
|
try {
|
|
32769
32936
|
key2 = (await runAz([
|
|
32770
32937
|
"storage",
|
|
@@ -32810,8 +32977,7 @@ async function readStatusBlob(opts) {
|
|
|
32810
32977
|
"--no-progress",
|
|
32811
32978
|
"--only-show-errors"
|
|
32812
32979
|
]);
|
|
32813
|
-
|
|
32814
|
-
return JSON.parse(raw.trim());
|
|
32980
|
+
raw = await fs32.readFile(tmpFile, "utf8");
|
|
32815
32981
|
} catch (e) {
|
|
32816
32982
|
throw new LocalCliError({
|
|
32817
32983
|
code: "BOOTSTRAP_STATUS_UNREADABLE",
|
|
@@ -32822,6 +32988,26 @@ async function readStatusBlob(opts) {
|
|
|
32822
32988
|
} finally {
|
|
32823
32989
|
await fs32.rm(tmpFile, { force: true });
|
|
32824
32990
|
}
|
|
32991
|
+
const parsed = parseStatusDocForReader(raw);
|
|
32992
|
+
if (!parsed.ok) {
|
|
32993
|
+
throw new LocalCliError({
|
|
32994
|
+
code: "BOOTSTRAP_STATUS_INVALID",
|
|
32995
|
+
message: `The installer status document could not be read: ${explainRejection(parsed.rejection)}`,
|
|
32996
|
+
hint: hintFor(parsed.rejection.reason)
|
|
32997
|
+
});
|
|
32998
|
+
}
|
|
32999
|
+
return parsed.doc;
|
|
33000
|
+
}
|
|
33001
|
+
function hintFor(reason) {
|
|
33002
|
+
switch (reason) {
|
|
33003
|
+
case "unknown-schema-version":
|
|
33004
|
+
return "The installer wrote a newer status format than this CLI understands. Update the CLI: npm i -g @m8t-stack/cli";
|
|
33005
|
+
case "missing-schema-version":
|
|
33006
|
+
case "not-json":
|
|
33007
|
+
return "The status blob looks truncated or corrupt. Check the installer directly: az container logs -n <aci> -g <rg>.";
|
|
33008
|
+
case "invalid":
|
|
33009
|
+
return "Your CLI may be older than the installer that wrote this. Update it (npm i -g @m8t-stack/cli); if that does not help, check: az container logs -n <aci> -g <rg>.";
|
|
33010
|
+
}
|
|
32825
33011
|
}
|
|
32826
33012
|
|
|
32827
33013
|
// src/lib/bootstrap-state.ts
|
|
@@ -36002,7 +36188,9 @@ function formatStatus(d) {
|
|
|
36002
36188
|
`;
|
|
36003
36189
|
}
|
|
36004
36190
|
if (d.status === "failed" && d.error) {
|
|
36005
|
-
|
|
36191
|
+
const where = d.error.phase ?? d.phase;
|
|
36192
|
+
const why = d.error.message ?? "the installer did not record why \u2014 check the container logs";
|
|
36193
|
+
return colors.error("\u2717 ") + head + ` ${colors.error(`error in ${where}: ${why}`)}
|
|
36006
36194
|
${colors.hint("inspect:")} az container logs
|
|
36007
36195
|
`;
|
|
36008
36196
|
}
|