@alfe.ai/gateway 0.0.44 → 0.0.46
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/health.js +1277 -27
- package/dist/src/index.d.ts +12 -0
- package/package.json +3 -3
package/dist/health.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as logger$1 } from "./logger.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import { mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { mkdir, readFile, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
4
4
|
import { execFile, execSync, spawn } from "node:child_process";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
@@ -88,6 +88,8 @@ const ID_PREFIXES = {
|
|
|
88
88
|
identityTag: "itg",
|
|
89
89
|
identityAlias: "ial",
|
|
90
90
|
identityVerification: "ivf",
|
|
91
|
+
role: "role",
|
|
92
|
+
directGrant: "dgr",
|
|
91
93
|
attachment: "att",
|
|
92
94
|
run: "run",
|
|
93
95
|
request: "req",
|
|
@@ -384,6 +386,14 @@ var AuthService = class {
|
|
|
384
386
|
body: JSON.stringify({ code })
|
|
385
387
|
});
|
|
386
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Fetch the caller's current permission list as enforced by the gateway.
|
|
391
|
+
* UI permission providers should call this on mount and refetch on
|
|
392
|
+
* Clerk org switch to stay in sync with sub-tenant permission changes.
|
|
393
|
+
*/
|
|
394
|
+
getMyPermissions() {
|
|
395
|
+
return this.client.request(`${this.prefix}/me/permissions`);
|
|
396
|
+
}
|
|
387
397
|
getSubscriptionStatus() {
|
|
388
398
|
return this.client.request(`${this.prefix}/subscription`);
|
|
389
399
|
}
|
|
@@ -694,6 +704,9 @@ function mergeDefs(...defs) {
|
|
|
694
704
|
function esc(str) {
|
|
695
705
|
return JSON.stringify(str);
|
|
696
706
|
}
|
|
707
|
+
function slugify(input) {
|
|
708
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
709
|
+
}
|
|
697
710
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
698
711
|
function isObject$1(data) {
|
|
699
712
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
@@ -1078,8 +1091,63 @@ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1078
1091
|
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1079
1092
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1080
1093
|
};
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
1096
|
+
const cuid = /^[cC][^\s-]{8,}$/;
|
|
1097
|
+
const cuid2 = /^[0-9a-z]+$/;
|
|
1098
|
+
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
1099
|
+
const xid = /^[0-9a-vA-V]{20}$/;
|
|
1100
|
+
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
1101
|
+
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1102
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
1103
|
+
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
1104
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
1105
|
+
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
1106
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
1107
|
+
*
|
|
1108
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
1109
|
+
const uuid = (version) => {
|
|
1110
|
+
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
1111
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
1112
|
+
};
|
|
1113
|
+
/** Practical email validation */
|
|
1114
|
+
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1115
|
+
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
1116
|
+
function emoji() {
|
|
1117
|
+
return new RegExp(_emoji$1, "u");
|
|
1118
|
+
}
|
|
1119
|
+
const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1120
|
+
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
1121
|
+
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
1122
|
+
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1123
|
+
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
1124
|
+
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
1125
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
1126
|
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
1127
|
+
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
1128
|
+
function timeSource(args) {
|
|
1129
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1130
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1131
|
+
}
|
|
1132
|
+
function time$1(args) {
|
|
1133
|
+
return new RegExp(`^${timeSource(args)}$`);
|
|
1134
|
+
}
|
|
1135
|
+
function datetime$1(args) {
|
|
1136
|
+
const time = timeSource({ precision: args.precision });
|
|
1137
|
+
const opts = ["Z"];
|
|
1138
|
+
if (args.local) opts.push("");
|
|
1139
|
+
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1140
|
+
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
1141
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
1142
|
+
}
|
|
1143
|
+
const string$1 = (params) => {
|
|
1144
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1145
|
+
return new RegExp(`^${regex}$`);
|
|
1146
|
+
};
|
|
1081
1147
|
const integer = /^-?\d+$/;
|
|
1082
1148
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
1149
|
+
const lowercase = /^[^A-Z]*$/;
|
|
1150
|
+
const uppercase = /^[^a-z]*$/;
|
|
1083
1151
|
//#endregion
|
|
1084
1152
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
1085
1153
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -1315,6 +1383,123 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
1315
1383
|
});
|
|
1316
1384
|
};
|
|
1317
1385
|
});
|
|
1386
|
+
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1387
|
+
var _a, _b;
|
|
1388
|
+
$ZodCheck.init(inst, def);
|
|
1389
|
+
inst._zod.onattach.push((inst) => {
|
|
1390
|
+
const bag = inst._zod.bag;
|
|
1391
|
+
bag.format = def.format;
|
|
1392
|
+
if (def.pattern) {
|
|
1393
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1394
|
+
bag.patterns.add(def.pattern);
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1398
|
+
def.pattern.lastIndex = 0;
|
|
1399
|
+
if (def.pattern.test(payload.value)) return;
|
|
1400
|
+
payload.issues.push({
|
|
1401
|
+
origin: "string",
|
|
1402
|
+
code: "invalid_format",
|
|
1403
|
+
format: def.format,
|
|
1404
|
+
input: payload.value,
|
|
1405
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
1406
|
+
inst,
|
|
1407
|
+
continue: !def.abort
|
|
1408
|
+
});
|
|
1409
|
+
});
|
|
1410
|
+
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
1411
|
+
});
|
|
1412
|
+
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
1413
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1414
|
+
inst._zod.check = (payload) => {
|
|
1415
|
+
def.pattern.lastIndex = 0;
|
|
1416
|
+
if (def.pattern.test(payload.value)) return;
|
|
1417
|
+
payload.issues.push({
|
|
1418
|
+
origin: "string",
|
|
1419
|
+
code: "invalid_format",
|
|
1420
|
+
format: "regex",
|
|
1421
|
+
input: payload.value,
|
|
1422
|
+
pattern: def.pattern.toString(),
|
|
1423
|
+
inst,
|
|
1424
|
+
continue: !def.abort
|
|
1425
|
+
});
|
|
1426
|
+
};
|
|
1427
|
+
});
|
|
1428
|
+
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
1429
|
+
def.pattern ?? (def.pattern = lowercase);
|
|
1430
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1431
|
+
});
|
|
1432
|
+
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
1433
|
+
def.pattern ?? (def.pattern = uppercase);
|
|
1434
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1435
|
+
});
|
|
1436
|
+
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1437
|
+
$ZodCheck.init(inst, def);
|
|
1438
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
1439
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1440
|
+
def.pattern = pattern;
|
|
1441
|
+
inst._zod.onattach.push((inst) => {
|
|
1442
|
+
const bag = inst._zod.bag;
|
|
1443
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1444
|
+
bag.patterns.add(pattern);
|
|
1445
|
+
});
|
|
1446
|
+
inst._zod.check = (payload) => {
|
|
1447
|
+
if (payload.value.includes(def.includes, def.position)) return;
|
|
1448
|
+
payload.issues.push({
|
|
1449
|
+
origin: "string",
|
|
1450
|
+
code: "invalid_format",
|
|
1451
|
+
format: "includes",
|
|
1452
|
+
includes: def.includes,
|
|
1453
|
+
input: payload.value,
|
|
1454
|
+
inst,
|
|
1455
|
+
continue: !def.abort
|
|
1456
|
+
});
|
|
1457
|
+
};
|
|
1458
|
+
});
|
|
1459
|
+
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
1460
|
+
$ZodCheck.init(inst, def);
|
|
1461
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1462
|
+
def.pattern ?? (def.pattern = pattern);
|
|
1463
|
+
inst._zod.onattach.push((inst) => {
|
|
1464
|
+
const bag = inst._zod.bag;
|
|
1465
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1466
|
+
bag.patterns.add(pattern);
|
|
1467
|
+
});
|
|
1468
|
+
inst._zod.check = (payload) => {
|
|
1469
|
+
if (payload.value.startsWith(def.prefix)) return;
|
|
1470
|
+
payload.issues.push({
|
|
1471
|
+
origin: "string",
|
|
1472
|
+
code: "invalid_format",
|
|
1473
|
+
format: "starts_with",
|
|
1474
|
+
prefix: def.prefix,
|
|
1475
|
+
input: payload.value,
|
|
1476
|
+
inst,
|
|
1477
|
+
continue: !def.abort
|
|
1478
|
+
});
|
|
1479
|
+
};
|
|
1480
|
+
});
|
|
1481
|
+
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
1482
|
+
$ZodCheck.init(inst, def);
|
|
1483
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1484
|
+
def.pattern ?? (def.pattern = pattern);
|
|
1485
|
+
inst._zod.onattach.push((inst) => {
|
|
1486
|
+
const bag = inst._zod.bag;
|
|
1487
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1488
|
+
bag.patterns.add(pattern);
|
|
1489
|
+
});
|
|
1490
|
+
inst._zod.check = (payload) => {
|
|
1491
|
+
if (payload.value.endsWith(def.suffix)) return;
|
|
1492
|
+
payload.issues.push({
|
|
1493
|
+
origin: "string",
|
|
1494
|
+
code: "invalid_format",
|
|
1495
|
+
format: "ends_with",
|
|
1496
|
+
suffix: def.suffix,
|
|
1497
|
+
input: payload.value,
|
|
1498
|
+
inst,
|
|
1499
|
+
continue: !def.abort
|
|
1500
|
+
});
|
|
1501
|
+
};
|
|
1502
|
+
});
|
|
1318
1503
|
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1319
1504
|
$ZodCheck.init(inst, def);
|
|
1320
1505
|
inst._zod.check = (payload) => {
|
|
@@ -1449,6 +1634,268 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1449
1634
|
version: 1
|
|
1450
1635
|
}));
|
|
1451
1636
|
});
|
|
1637
|
+
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1638
|
+
$ZodType.init(inst, def);
|
|
1639
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
1640
|
+
inst._zod.parse = (payload, _) => {
|
|
1641
|
+
if (def.coerce) try {
|
|
1642
|
+
payload.value = String(payload.value);
|
|
1643
|
+
} catch (_) {}
|
|
1644
|
+
if (typeof payload.value === "string") return payload;
|
|
1645
|
+
payload.issues.push({
|
|
1646
|
+
expected: "string",
|
|
1647
|
+
code: "invalid_type",
|
|
1648
|
+
input: payload.value,
|
|
1649
|
+
inst
|
|
1650
|
+
});
|
|
1651
|
+
return payload;
|
|
1652
|
+
};
|
|
1653
|
+
});
|
|
1654
|
+
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
1655
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1656
|
+
$ZodString.init(inst, def);
|
|
1657
|
+
});
|
|
1658
|
+
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
1659
|
+
def.pattern ?? (def.pattern = guid);
|
|
1660
|
+
$ZodStringFormat.init(inst, def);
|
|
1661
|
+
});
|
|
1662
|
+
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
1663
|
+
if (def.version) {
|
|
1664
|
+
const v = {
|
|
1665
|
+
v1: 1,
|
|
1666
|
+
v2: 2,
|
|
1667
|
+
v3: 3,
|
|
1668
|
+
v4: 4,
|
|
1669
|
+
v5: 5,
|
|
1670
|
+
v6: 6,
|
|
1671
|
+
v7: 7,
|
|
1672
|
+
v8: 8
|
|
1673
|
+
}[def.version];
|
|
1674
|
+
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1675
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
1676
|
+
} else def.pattern ?? (def.pattern = uuid());
|
|
1677
|
+
$ZodStringFormat.init(inst, def);
|
|
1678
|
+
});
|
|
1679
|
+
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
1680
|
+
def.pattern ?? (def.pattern = email);
|
|
1681
|
+
$ZodStringFormat.init(inst, def);
|
|
1682
|
+
});
|
|
1683
|
+
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1684
|
+
$ZodStringFormat.init(inst, def);
|
|
1685
|
+
inst._zod.check = (payload) => {
|
|
1686
|
+
try {
|
|
1687
|
+
const trimmed = payload.value.trim();
|
|
1688
|
+
const url = new URL(trimmed);
|
|
1689
|
+
if (def.hostname) {
|
|
1690
|
+
def.hostname.lastIndex = 0;
|
|
1691
|
+
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1692
|
+
code: "invalid_format",
|
|
1693
|
+
format: "url",
|
|
1694
|
+
note: "Invalid hostname",
|
|
1695
|
+
pattern: def.hostname.source,
|
|
1696
|
+
input: payload.value,
|
|
1697
|
+
inst,
|
|
1698
|
+
continue: !def.abort
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
if (def.protocol) {
|
|
1702
|
+
def.protocol.lastIndex = 0;
|
|
1703
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
1704
|
+
code: "invalid_format",
|
|
1705
|
+
format: "url",
|
|
1706
|
+
note: "Invalid protocol",
|
|
1707
|
+
pattern: def.protocol.source,
|
|
1708
|
+
input: payload.value,
|
|
1709
|
+
inst,
|
|
1710
|
+
continue: !def.abort
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
if (def.normalize) payload.value = url.href;
|
|
1714
|
+
else payload.value = trimmed;
|
|
1715
|
+
return;
|
|
1716
|
+
} catch (_) {
|
|
1717
|
+
payload.issues.push({
|
|
1718
|
+
code: "invalid_format",
|
|
1719
|
+
format: "url",
|
|
1720
|
+
input: payload.value,
|
|
1721
|
+
inst,
|
|
1722
|
+
continue: !def.abort
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
});
|
|
1727
|
+
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
1728
|
+
def.pattern ?? (def.pattern = emoji());
|
|
1729
|
+
$ZodStringFormat.init(inst, def);
|
|
1730
|
+
});
|
|
1731
|
+
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
1732
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
1733
|
+
$ZodStringFormat.init(inst, def);
|
|
1734
|
+
});
|
|
1735
|
+
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
1736
|
+
def.pattern ?? (def.pattern = cuid);
|
|
1737
|
+
$ZodStringFormat.init(inst, def);
|
|
1738
|
+
});
|
|
1739
|
+
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
1740
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
1741
|
+
$ZodStringFormat.init(inst, def);
|
|
1742
|
+
});
|
|
1743
|
+
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
1744
|
+
def.pattern ?? (def.pattern = ulid);
|
|
1745
|
+
$ZodStringFormat.init(inst, def);
|
|
1746
|
+
});
|
|
1747
|
+
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
1748
|
+
def.pattern ?? (def.pattern = xid);
|
|
1749
|
+
$ZodStringFormat.init(inst, def);
|
|
1750
|
+
});
|
|
1751
|
+
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
1752
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
1753
|
+
$ZodStringFormat.init(inst, def);
|
|
1754
|
+
});
|
|
1755
|
+
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1756
|
+
def.pattern ?? (def.pattern = datetime$1(def));
|
|
1757
|
+
$ZodStringFormat.init(inst, def);
|
|
1758
|
+
});
|
|
1759
|
+
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
1760
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1761
|
+
$ZodStringFormat.init(inst, def);
|
|
1762
|
+
});
|
|
1763
|
+
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
1764
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1765
|
+
$ZodStringFormat.init(inst, def);
|
|
1766
|
+
});
|
|
1767
|
+
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
1768
|
+
def.pattern ?? (def.pattern = duration$1);
|
|
1769
|
+
$ZodStringFormat.init(inst, def);
|
|
1770
|
+
});
|
|
1771
|
+
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
1772
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
1773
|
+
$ZodStringFormat.init(inst, def);
|
|
1774
|
+
inst._zod.bag.format = `ipv4`;
|
|
1775
|
+
});
|
|
1776
|
+
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1777
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
1778
|
+
$ZodStringFormat.init(inst, def);
|
|
1779
|
+
inst._zod.bag.format = `ipv6`;
|
|
1780
|
+
inst._zod.check = (payload) => {
|
|
1781
|
+
try {
|
|
1782
|
+
new URL(`http://[${payload.value}]`);
|
|
1783
|
+
} catch {
|
|
1784
|
+
payload.issues.push({
|
|
1785
|
+
code: "invalid_format",
|
|
1786
|
+
format: "ipv6",
|
|
1787
|
+
input: payload.value,
|
|
1788
|
+
inst,
|
|
1789
|
+
continue: !def.abort
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1793
|
+
});
|
|
1794
|
+
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1795
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
1796
|
+
$ZodStringFormat.init(inst, def);
|
|
1797
|
+
});
|
|
1798
|
+
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1799
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
1800
|
+
$ZodStringFormat.init(inst, def);
|
|
1801
|
+
inst._zod.check = (payload) => {
|
|
1802
|
+
const parts = payload.value.split("/");
|
|
1803
|
+
try {
|
|
1804
|
+
if (parts.length !== 2) throw new Error();
|
|
1805
|
+
const [address, prefix] = parts;
|
|
1806
|
+
if (!prefix) throw new Error();
|
|
1807
|
+
const prefixNum = Number(prefix);
|
|
1808
|
+
if (`${prefixNum}` !== prefix) throw new Error();
|
|
1809
|
+
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
1810
|
+
new URL(`http://[${address}]`);
|
|
1811
|
+
} catch {
|
|
1812
|
+
payload.issues.push({
|
|
1813
|
+
code: "invalid_format",
|
|
1814
|
+
format: "cidrv6",
|
|
1815
|
+
input: payload.value,
|
|
1816
|
+
inst,
|
|
1817
|
+
continue: !def.abort
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
});
|
|
1822
|
+
function isValidBase64(data) {
|
|
1823
|
+
if (data === "") return true;
|
|
1824
|
+
if (data.length % 4 !== 0) return false;
|
|
1825
|
+
try {
|
|
1826
|
+
atob(data);
|
|
1827
|
+
return true;
|
|
1828
|
+
} catch {
|
|
1829
|
+
return false;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
1833
|
+
def.pattern ?? (def.pattern = base64);
|
|
1834
|
+
$ZodStringFormat.init(inst, def);
|
|
1835
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
1836
|
+
inst._zod.check = (payload) => {
|
|
1837
|
+
if (isValidBase64(payload.value)) return;
|
|
1838
|
+
payload.issues.push({
|
|
1839
|
+
code: "invalid_format",
|
|
1840
|
+
format: "base64",
|
|
1841
|
+
input: payload.value,
|
|
1842
|
+
inst,
|
|
1843
|
+
continue: !def.abort
|
|
1844
|
+
});
|
|
1845
|
+
};
|
|
1846
|
+
});
|
|
1847
|
+
function isValidBase64URL(data) {
|
|
1848
|
+
if (!base64url.test(data)) return false;
|
|
1849
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1850
|
+
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
1851
|
+
}
|
|
1852
|
+
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1853
|
+
def.pattern ?? (def.pattern = base64url);
|
|
1854
|
+
$ZodStringFormat.init(inst, def);
|
|
1855
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
1856
|
+
inst._zod.check = (payload) => {
|
|
1857
|
+
if (isValidBase64URL(payload.value)) return;
|
|
1858
|
+
payload.issues.push({
|
|
1859
|
+
code: "invalid_format",
|
|
1860
|
+
format: "base64url",
|
|
1861
|
+
input: payload.value,
|
|
1862
|
+
inst,
|
|
1863
|
+
continue: !def.abort
|
|
1864
|
+
});
|
|
1865
|
+
};
|
|
1866
|
+
});
|
|
1867
|
+
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
1868
|
+
def.pattern ?? (def.pattern = e164);
|
|
1869
|
+
$ZodStringFormat.init(inst, def);
|
|
1870
|
+
});
|
|
1871
|
+
function isValidJWT(token, algorithm = null) {
|
|
1872
|
+
try {
|
|
1873
|
+
const tokensParts = token.split(".");
|
|
1874
|
+
if (tokensParts.length !== 3) return false;
|
|
1875
|
+
const [header] = tokensParts;
|
|
1876
|
+
if (!header) return false;
|
|
1877
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
1878
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
1879
|
+
if (!parsedHeader.alg) return false;
|
|
1880
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
1881
|
+
return true;
|
|
1882
|
+
} catch {
|
|
1883
|
+
return false;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
1887
|
+
$ZodStringFormat.init(inst, def);
|
|
1888
|
+
inst._zod.check = (payload) => {
|
|
1889
|
+
if (isValidJWT(payload.value, def.alg)) return;
|
|
1890
|
+
payload.issues.push({
|
|
1891
|
+
code: "invalid_format",
|
|
1892
|
+
format: "jwt",
|
|
1893
|
+
input: payload.value,
|
|
1894
|
+
inst,
|
|
1895
|
+
continue: !def.abort
|
|
1896
|
+
});
|
|
1897
|
+
};
|
|
1898
|
+
});
|
|
1452
1899
|
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1453
1900
|
$ZodType.init(inst, def);
|
|
1454
1901
|
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
@@ -2165,6 +2612,276 @@ const globalRegistry = globalThis.__zod_globalRegistry;
|
|
|
2165
2612
|
//#endregion
|
|
2166
2613
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2167
2614
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2615
|
+
function _string(Class, params) {
|
|
2616
|
+
return new Class({
|
|
2617
|
+
type: "string",
|
|
2618
|
+
...normalizeParams(params)
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2622
|
+
function _email(Class, params) {
|
|
2623
|
+
return new Class({
|
|
2624
|
+
type: "string",
|
|
2625
|
+
format: "email",
|
|
2626
|
+
check: "string_format",
|
|
2627
|
+
abort: false,
|
|
2628
|
+
...normalizeParams(params)
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2632
|
+
function _guid(Class, params) {
|
|
2633
|
+
return new Class({
|
|
2634
|
+
type: "string",
|
|
2635
|
+
format: "guid",
|
|
2636
|
+
check: "string_format",
|
|
2637
|
+
abort: false,
|
|
2638
|
+
...normalizeParams(params)
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2642
|
+
function _uuid(Class, params) {
|
|
2643
|
+
return new Class({
|
|
2644
|
+
type: "string",
|
|
2645
|
+
format: "uuid",
|
|
2646
|
+
check: "string_format",
|
|
2647
|
+
abort: false,
|
|
2648
|
+
...normalizeParams(params)
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2652
|
+
function _uuidv4(Class, params) {
|
|
2653
|
+
return new Class({
|
|
2654
|
+
type: "string",
|
|
2655
|
+
format: "uuid",
|
|
2656
|
+
check: "string_format",
|
|
2657
|
+
abort: false,
|
|
2658
|
+
version: "v4",
|
|
2659
|
+
...normalizeParams(params)
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2663
|
+
function _uuidv6(Class, params) {
|
|
2664
|
+
return new Class({
|
|
2665
|
+
type: "string",
|
|
2666
|
+
format: "uuid",
|
|
2667
|
+
check: "string_format",
|
|
2668
|
+
abort: false,
|
|
2669
|
+
version: "v6",
|
|
2670
|
+
...normalizeParams(params)
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2674
|
+
function _uuidv7(Class, params) {
|
|
2675
|
+
return new Class({
|
|
2676
|
+
type: "string",
|
|
2677
|
+
format: "uuid",
|
|
2678
|
+
check: "string_format",
|
|
2679
|
+
abort: false,
|
|
2680
|
+
version: "v7",
|
|
2681
|
+
...normalizeParams(params)
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2685
|
+
function _url(Class, params) {
|
|
2686
|
+
return new Class({
|
|
2687
|
+
type: "string",
|
|
2688
|
+
format: "url",
|
|
2689
|
+
check: "string_format",
|
|
2690
|
+
abort: false,
|
|
2691
|
+
...normalizeParams(params)
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2695
|
+
function _emoji(Class, params) {
|
|
2696
|
+
return new Class({
|
|
2697
|
+
type: "string",
|
|
2698
|
+
format: "emoji",
|
|
2699
|
+
check: "string_format",
|
|
2700
|
+
abort: false,
|
|
2701
|
+
...normalizeParams(params)
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2705
|
+
function _nanoid(Class, params) {
|
|
2706
|
+
return new Class({
|
|
2707
|
+
type: "string",
|
|
2708
|
+
format: "nanoid",
|
|
2709
|
+
check: "string_format",
|
|
2710
|
+
abort: false,
|
|
2711
|
+
...normalizeParams(params)
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2715
|
+
function _cuid(Class, params) {
|
|
2716
|
+
return new Class({
|
|
2717
|
+
type: "string",
|
|
2718
|
+
format: "cuid",
|
|
2719
|
+
check: "string_format",
|
|
2720
|
+
abort: false,
|
|
2721
|
+
...normalizeParams(params)
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2725
|
+
function _cuid2(Class, params) {
|
|
2726
|
+
return new Class({
|
|
2727
|
+
type: "string",
|
|
2728
|
+
format: "cuid2",
|
|
2729
|
+
check: "string_format",
|
|
2730
|
+
abort: false,
|
|
2731
|
+
...normalizeParams(params)
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2735
|
+
function _ulid(Class, params) {
|
|
2736
|
+
return new Class({
|
|
2737
|
+
type: "string",
|
|
2738
|
+
format: "ulid",
|
|
2739
|
+
check: "string_format",
|
|
2740
|
+
abort: false,
|
|
2741
|
+
...normalizeParams(params)
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2744
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2745
|
+
function _xid(Class, params) {
|
|
2746
|
+
return new Class({
|
|
2747
|
+
type: "string",
|
|
2748
|
+
format: "xid",
|
|
2749
|
+
check: "string_format",
|
|
2750
|
+
abort: false,
|
|
2751
|
+
...normalizeParams(params)
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2755
|
+
function _ksuid(Class, params) {
|
|
2756
|
+
return new Class({
|
|
2757
|
+
type: "string",
|
|
2758
|
+
format: "ksuid",
|
|
2759
|
+
check: "string_format",
|
|
2760
|
+
abort: false,
|
|
2761
|
+
...normalizeParams(params)
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2765
|
+
function _ipv4(Class, params) {
|
|
2766
|
+
return new Class({
|
|
2767
|
+
type: "string",
|
|
2768
|
+
format: "ipv4",
|
|
2769
|
+
check: "string_format",
|
|
2770
|
+
abort: false,
|
|
2771
|
+
...normalizeParams(params)
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2775
|
+
function _ipv6(Class, params) {
|
|
2776
|
+
return new Class({
|
|
2777
|
+
type: "string",
|
|
2778
|
+
format: "ipv6",
|
|
2779
|
+
check: "string_format",
|
|
2780
|
+
abort: false,
|
|
2781
|
+
...normalizeParams(params)
|
|
2782
|
+
});
|
|
2783
|
+
}
|
|
2784
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2785
|
+
function _cidrv4(Class, params) {
|
|
2786
|
+
return new Class({
|
|
2787
|
+
type: "string",
|
|
2788
|
+
format: "cidrv4",
|
|
2789
|
+
check: "string_format",
|
|
2790
|
+
abort: false,
|
|
2791
|
+
...normalizeParams(params)
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2795
|
+
function _cidrv6(Class, params) {
|
|
2796
|
+
return new Class({
|
|
2797
|
+
type: "string",
|
|
2798
|
+
format: "cidrv6",
|
|
2799
|
+
check: "string_format",
|
|
2800
|
+
abort: false,
|
|
2801
|
+
...normalizeParams(params)
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2805
|
+
function _base64(Class, params) {
|
|
2806
|
+
return new Class({
|
|
2807
|
+
type: "string",
|
|
2808
|
+
format: "base64",
|
|
2809
|
+
check: "string_format",
|
|
2810
|
+
abort: false,
|
|
2811
|
+
...normalizeParams(params)
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2815
|
+
function _base64url(Class, params) {
|
|
2816
|
+
return new Class({
|
|
2817
|
+
type: "string",
|
|
2818
|
+
format: "base64url",
|
|
2819
|
+
check: "string_format",
|
|
2820
|
+
abort: false,
|
|
2821
|
+
...normalizeParams(params)
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2825
|
+
function _e164(Class, params) {
|
|
2826
|
+
return new Class({
|
|
2827
|
+
type: "string",
|
|
2828
|
+
format: "e164",
|
|
2829
|
+
check: "string_format",
|
|
2830
|
+
abort: false,
|
|
2831
|
+
...normalizeParams(params)
|
|
2832
|
+
});
|
|
2833
|
+
}
|
|
2834
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2835
|
+
function _jwt(Class, params) {
|
|
2836
|
+
return new Class({
|
|
2837
|
+
type: "string",
|
|
2838
|
+
format: "jwt",
|
|
2839
|
+
check: "string_format",
|
|
2840
|
+
abort: false,
|
|
2841
|
+
...normalizeParams(params)
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2845
|
+
function _isoDateTime(Class, params) {
|
|
2846
|
+
return new Class({
|
|
2847
|
+
type: "string",
|
|
2848
|
+
format: "datetime",
|
|
2849
|
+
check: "string_format",
|
|
2850
|
+
offset: false,
|
|
2851
|
+
local: false,
|
|
2852
|
+
precision: null,
|
|
2853
|
+
...normalizeParams(params)
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2857
|
+
function _isoDate(Class, params) {
|
|
2858
|
+
return new Class({
|
|
2859
|
+
type: "string",
|
|
2860
|
+
format: "date",
|
|
2861
|
+
check: "string_format",
|
|
2862
|
+
...normalizeParams(params)
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2866
|
+
function _isoTime(Class, params) {
|
|
2867
|
+
return new Class({
|
|
2868
|
+
type: "string",
|
|
2869
|
+
format: "time",
|
|
2870
|
+
check: "string_format",
|
|
2871
|
+
precision: null,
|
|
2872
|
+
...normalizeParams(params)
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2876
|
+
function _isoDuration(Class, params) {
|
|
2877
|
+
return new Class({
|
|
2878
|
+
type: "string",
|
|
2879
|
+
format: "duration",
|
|
2880
|
+
check: "string_format",
|
|
2881
|
+
...normalizeParams(params)
|
|
2882
|
+
});
|
|
2883
|
+
}
|
|
2884
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2168
2885
|
function _number(Class, params) {
|
|
2169
2886
|
return new Class({
|
|
2170
2887
|
type: "number",
|
|
@@ -2262,6 +2979,58 @@ function _length(length, params) {
|
|
|
2262
2979
|
});
|
|
2263
2980
|
}
|
|
2264
2981
|
/* @__NO_SIDE_EFFECTS__ */
|
|
2982
|
+
function _regex(pattern, params) {
|
|
2983
|
+
return new $ZodCheckRegex({
|
|
2984
|
+
check: "string_format",
|
|
2985
|
+
format: "regex",
|
|
2986
|
+
...normalizeParams(params),
|
|
2987
|
+
pattern
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2991
|
+
function _lowercase(params) {
|
|
2992
|
+
return new $ZodCheckLowerCase({
|
|
2993
|
+
check: "string_format",
|
|
2994
|
+
format: "lowercase",
|
|
2995
|
+
...normalizeParams(params)
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2999
|
+
function _uppercase(params) {
|
|
3000
|
+
return new $ZodCheckUpperCase({
|
|
3001
|
+
check: "string_format",
|
|
3002
|
+
format: "uppercase",
|
|
3003
|
+
...normalizeParams(params)
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3007
|
+
function _includes(includes, params) {
|
|
3008
|
+
return new $ZodCheckIncludes({
|
|
3009
|
+
check: "string_format",
|
|
3010
|
+
format: "includes",
|
|
3011
|
+
...normalizeParams(params),
|
|
3012
|
+
includes
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3016
|
+
function _startsWith(prefix, params) {
|
|
3017
|
+
return new $ZodCheckStartsWith({
|
|
3018
|
+
check: "string_format",
|
|
3019
|
+
format: "starts_with",
|
|
3020
|
+
...normalizeParams(params),
|
|
3021
|
+
prefix
|
|
3022
|
+
});
|
|
3023
|
+
}
|
|
3024
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3025
|
+
function _endsWith(suffix, params) {
|
|
3026
|
+
return new $ZodCheckEndsWith({
|
|
3027
|
+
check: "string_format",
|
|
3028
|
+
format: "ends_with",
|
|
3029
|
+
...normalizeParams(params),
|
|
3030
|
+
suffix
|
|
3031
|
+
});
|
|
3032
|
+
}
|
|
3033
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2265
3034
|
function _overwrite(tx) {
|
|
2266
3035
|
return new $ZodCheckOverwrite({
|
|
2267
3036
|
check: "overwrite",
|
|
@@ -2269,6 +3038,26 @@ function _overwrite(tx) {
|
|
|
2269
3038
|
});
|
|
2270
3039
|
}
|
|
2271
3040
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3041
|
+
function _normalize(form) {
|
|
3042
|
+
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
3043
|
+
}
|
|
3044
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3045
|
+
function _trim() {
|
|
3046
|
+
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
3047
|
+
}
|
|
3048
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3049
|
+
function _toLowerCase() {
|
|
3050
|
+
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
3051
|
+
}
|
|
3052
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3053
|
+
function _toUpperCase() {
|
|
3054
|
+
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
3055
|
+
}
|
|
3056
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
3057
|
+
function _slugify() {
|
|
3058
|
+
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
3059
|
+
}
|
|
3060
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2272
3061
|
function _array(Class, element, params) {
|
|
2273
3062
|
return new Class({
|
|
2274
3063
|
type: "array",
|
|
@@ -2600,6 +3389,34 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
2600
3389
|
};
|
|
2601
3390
|
//#endregion
|
|
2602
3391
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
3392
|
+
const formatMap = {
|
|
3393
|
+
guid: "uuid",
|
|
3394
|
+
url: "uri",
|
|
3395
|
+
datetime: "date-time",
|
|
3396
|
+
json_string: "json-string",
|
|
3397
|
+
regex: ""
|
|
3398
|
+
};
|
|
3399
|
+
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3400
|
+
const json = _json;
|
|
3401
|
+
json.type = "string";
|
|
3402
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3403
|
+
if (typeof minimum === "number") json.minLength = minimum;
|
|
3404
|
+
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3405
|
+
if (format) {
|
|
3406
|
+
json.format = formatMap[format] ?? format;
|
|
3407
|
+
if (json.format === "") delete json.format;
|
|
3408
|
+
if (format === "time") delete json.format;
|
|
3409
|
+
}
|
|
3410
|
+
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3411
|
+
if (patterns && patterns.size > 0) {
|
|
3412
|
+
const regexes = [...patterns];
|
|
3413
|
+
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
3414
|
+
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
3415
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3416
|
+
pattern: regex.source
|
|
3417
|
+
}))];
|
|
3418
|
+
}
|
|
3419
|
+
};
|
|
2603
3420
|
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
2604
3421
|
const json = _json;
|
|
2605
3422
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
@@ -2781,6 +3598,36 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
2781
3598
|
seen.ref = def.innerType;
|
|
2782
3599
|
};
|
|
2783
3600
|
//#endregion
|
|
3601
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
3602
|
+
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3603
|
+
$ZodISODateTime.init(inst, def);
|
|
3604
|
+
ZodStringFormat.init(inst, def);
|
|
3605
|
+
});
|
|
3606
|
+
function datetime(params) {
|
|
3607
|
+
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
3608
|
+
}
|
|
3609
|
+
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
3610
|
+
$ZodISODate.init(inst, def);
|
|
3611
|
+
ZodStringFormat.init(inst, def);
|
|
3612
|
+
});
|
|
3613
|
+
function date(params) {
|
|
3614
|
+
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
3615
|
+
}
|
|
3616
|
+
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
3617
|
+
$ZodISOTime.init(inst, def);
|
|
3618
|
+
ZodStringFormat.init(inst, def);
|
|
3619
|
+
});
|
|
3620
|
+
function time(params) {
|
|
3621
|
+
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
3622
|
+
}
|
|
3623
|
+
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
3624
|
+
$ZodISODuration.init(inst, def);
|
|
3625
|
+
ZodStringFormat.init(inst, def);
|
|
3626
|
+
});
|
|
3627
|
+
function duration(params) {
|
|
3628
|
+
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
3629
|
+
}
|
|
3630
|
+
//#endregion
|
|
2784
3631
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
2785
3632
|
const initializer = (inst, issues) => {
|
|
2786
3633
|
$ZodError.init(inst, issues);
|
|
@@ -2895,6 +3742,145 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
2895
3742
|
inst.apply = (fn) => fn(inst);
|
|
2896
3743
|
return inst;
|
|
2897
3744
|
});
|
|
3745
|
+
/** @internal */
|
|
3746
|
+
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
3747
|
+
$ZodString.init(inst, def);
|
|
3748
|
+
ZodType.init(inst, def);
|
|
3749
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3750
|
+
const bag = inst._zod.bag;
|
|
3751
|
+
inst.format = bag.format ?? null;
|
|
3752
|
+
inst.minLength = bag.minimum ?? null;
|
|
3753
|
+
inst.maxLength = bag.maximum ?? null;
|
|
3754
|
+
inst.regex = (...args) => inst.check(/* @__PURE__ */ _regex(...args));
|
|
3755
|
+
inst.includes = (...args) => inst.check(/* @__PURE__ */ _includes(...args));
|
|
3756
|
+
inst.startsWith = (...args) => inst.check(/* @__PURE__ */ _startsWith(...args));
|
|
3757
|
+
inst.endsWith = (...args) => inst.check(/* @__PURE__ */ _endsWith(...args));
|
|
3758
|
+
inst.min = (...args) => inst.check(/* @__PURE__ */ _minLength(...args));
|
|
3759
|
+
inst.max = (...args) => inst.check(/* @__PURE__ */ _maxLength(...args));
|
|
3760
|
+
inst.length = (...args) => inst.check(/* @__PURE__ */ _length(...args));
|
|
3761
|
+
inst.nonempty = (...args) => inst.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
3762
|
+
inst.lowercase = (params) => inst.check(/* @__PURE__ */ _lowercase(params));
|
|
3763
|
+
inst.uppercase = (params) => inst.check(/* @__PURE__ */ _uppercase(params));
|
|
3764
|
+
inst.trim = () => inst.check(/* @__PURE__ */ _trim());
|
|
3765
|
+
inst.normalize = (...args) => inst.check(/* @__PURE__ */ _normalize(...args));
|
|
3766
|
+
inst.toLowerCase = () => inst.check(/* @__PURE__ */ _toLowerCase());
|
|
3767
|
+
inst.toUpperCase = () => inst.check(/* @__PURE__ */ _toUpperCase());
|
|
3768
|
+
inst.slugify = () => inst.check(/* @__PURE__ */ _slugify());
|
|
3769
|
+
});
|
|
3770
|
+
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
3771
|
+
$ZodString.init(inst, def);
|
|
3772
|
+
_ZodString.init(inst, def);
|
|
3773
|
+
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
3774
|
+
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
3775
|
+
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
3776
|
+
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
3777
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3778
|
+
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
3779
|
+
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
3780
|
+
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
3781
|
+
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
3782
|
+
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
3783
|
+
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
3784
|
+
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
3785
|
+
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
3786
|
+
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
3787
|
+
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
3788
|
+
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
3789
|
+
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
3790
|
+
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
3791
|
+
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
3792
|
+
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
3793
|
+
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
3794
|
+
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
3795
|
+
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
3796
|
+
inst.datetime = (params) => inst.check(datetime(params));
|
|
3797
|
+
inst.date = (params) => inst.check(date(params));
|
|
3798
|
+
inst.time = (params) => inst.check(time(params));
|
|
3799
|
+
inst.duration = (params) => inst.check(duration(params));
|
|
3800
|
+
});
|
|
3801
|
+
function string(params) {
|
|
3802
|
+
return /* @__PURE__ */ _string(ZodString, params);
|
|
3803
|
+
}
|
|
3804
|
+
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
3805
|
+
$ZodStringFormat.init(inst, def);
|
|
3806
|
+
_ZodString.init(inst, def);
|
|
3807
|
+
});
|
|
3808
|
+
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
3809
|
+
$ZodEmail.init(inst, def);
|
|
3810
|
+
ZodStringFormat.init(inst, def);
|
|
3811
|
+
});
|
|
3812
|
+
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
3813
|
+
$ZodGUID.init(inst, def);
|
|
3814
|
+
ZodStringFormat.init(inst, def);
|
|
3815
|
+
});
|
|
3816
|
+
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
3817
|
+
$ZodUUID.init(inst, def);
|
|
3818
|
+
ZodStringFormat.init(inst, def);
|
|
3819
|
+
});
|
|
3820
|
+
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
3821
|
+
$ZodURL.init(inst, def);
|
|
3822
|
+
ZodStringFormat.init(inst, def);
|
|
3823
|
+
});
|
|
3824
|
+
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
3825
|
+
$ZodEmoji.init(inst, def);
|
|
3826
|
+
ZodStringFormat.init(inst, def);
|
|
3827
|
+
});
|
|
3828
|
+
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
3829
|
+
$ZodNanoID.init(inst, def);
|
|
3830
|
+
ZodStringFormat.init(inst, def);
|
|
3831
|
+
});
|
|
3832
|
+
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
3833
|
+
$ZodCUID.init(inst, def);
|
|
3834
|
+
ZodStringFormat.init(inst, def);
|
|
3835
|
+
});
|
|
3836
|
+
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
3837
|
+
$ZodCUID2.init(inst, def);
|
|
3838
|
+
ZodStringFormat.init(inst, def);
|
|
3839
|
+
});
|
|
3840
|
+
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
3841
|
+
$ZodULID.init(inst, def);
|
|
3842
|
+
ZodStringFormat.init(inst, def);
|
|
3843
|
+
});
|
|
3844
|
+
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
3845
|
+
$ZodXID.init(inst, def);
|
|
3846
|
+
ZodStringFormat.init(inst, def);
|
|
3847
|
+
});
|
|
3848
|
+
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
3849
|
+
$ZodKSUID.init(inst, def);
|
|
3850
|
+
ZodStringFormat.init(inst, def);
|
|
3851
|
+
});
|
|
3852
|
+
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
3853
|
+
$ZodIPv4.init(inst, def);
|
|
3854
|
+
ZodStringFormat.init(inst, def);
|
|
3855
|
+
});
|
|
3856
|
+
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
3857
|
+
$ZodIPv6.init(inst, def);
|
|
3858
|
+
ZodStringFormat.init(inst, def);
|
|
3859
|
+
});
|
|
3860
|
+
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
3861
|
+
$ZodCIDRv4.init(inst, def);
|
|
3862
|
+
ZodStringFormat.init(inst, def);
|
|
3863
|
+
});
|
|
3864
|
+
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
3865
|
+
$ZodCIDRv6.init(inst, def);
|
|
3866
|
+
ZodStringFormat.init(inst, def);
|
|
3867
|
+
});
|
|
3868
|
+
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
3869
|
+
$ZodBase64.init(inst, def);
|
|
3870
|
+
ZodStringFormat.init(inst, def);
|
|
3871
|
+
});
|
|
3872
|
+
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
3873
|
+
$ZodBase64URL.init(inst, def);
|
|
3874
|
+
ZodStringFormat.init(inst, def);
|
|
3875
|
+
});
|
|
3876
|
+
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
3877
|
+
$ZodE164.init(inst, def);
|
|
3878
|
+
ZodStringFormat.init(inst, def);
|
|
3879
|
+
});
|
|
3880
|
+
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
3881
|
+
$ZodJWT.init(inst, def);
|
|
3882
|
+
ZodStringFormat.init(inst, def);
|
|
3883
|
+
});
|
|
2898
3884
|
const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
2899
3885
|
$ZodNumber.init(inst, def);
|
|
2900
3886
|
ZodType.init(inst, def);
|
|
@@ -3257,6 +4243,12 @@ enumValues({
|
|
|
3257
4243
|
Year: "year"
|
|
3258
4244
|
});
|
|
3259
4245
|
object({ gracePeriodDays: number().int().positive().optional() });
|
|
4246
|
+
enumValues({
|
|
4247
|
+
ManagedHosting: "managed-hosting",
|
|
4248
|
+
PlatformTier: "platform-tier",
|
|
4249
|
+
Integration: "integration",
|
|
4250
|
+
Other: "other"
|
|
4251
|
+
});
|
|
3260
4252
|
enumValues({
|
|
3261
4253
|
Free: "free",
|
|
3262
4254
|
Personal: "personal",
|
|
@@ -3285,6 +4277,7 @@ enumValues({
|
|
|
3285
4277
|
Failing: "failing",
|
|
3286
4278
|
Failed: "failed",
|
|
3287
4279
|
BillingSuspended: "billing_suspended",
|
|
4280
|
+
Waitlisted: "waitlisted",
|
|
3288
4281
|
Deleted: "deleted"
|
|
3289
4282
|
});
|
|
3290
4283
|
enumValues({
|
|
@@ -3295,16 +4288,16 @@ enumValues({
|
|
|
3295
4288
|
OpenClaw: "openclaw",
|
|
3296
4289
|
NanoClaw: "nanoclaw"
|
|
3297
4290
|
});
|
|
3298
|
-
enumValues({
|
|
3299
|
-
Public: "public",
|
|
3300
|
-
Hidden: "hidden"
|
|
3301
|
-
});
|
|
3302
4291
|
enumValues({
|
|
3303
4292
|
Org: "org",
|
|
3304
4293
|
Team: "team",
|
|
3305
4294
|
Project: "project",
|
|
3306
4295
|
Agent: "agent"
|
|
3307
4296
|
});
|
|
4297
|
+
enumValues({
|
|
4298
|
+
Public: "public",
|
|
4299
|
+
Hidden: "hidden"
|
|
4300
|
+
});
|
|
3308
4301
|
enumValues({
|
|
3309
4302
|
Active: "active",
|
|
3310
4303
|
Removed: "removed"
|
|
@@ -3437,13 +4430,17 @@ const OpenAIModel = {
|
|
|
3437
4430
|
GPT54Mini: "gpt-5.4-mini",
|
|
3438
4431
|
GPT54Nano: "gpt-5.4-nano",
|
|
3439
4432
|
GPT54Pro: "gpt-5.4-pro",
|
|
4433
|
+
GPT55: "gpt-5.5",
|
|
3440
4434
|
O3Mini: "o3-mini",
|
|
3441
|
-
O4Mini: "o4-mini"
|
|
4435
|
+
O4Mini: "o4-mini",
|
|
4436
|
+
TextEmbedding3Small: "text-embedding-3-small"
|
|
3442
4437
|
};
|
|
3443
4438
|
const OPENAI_MODELS = enumValues(OpenAIModel);
|
|
3444
4439
|
const DeepSeekModel = {
|
|
3445
4440
|
Chat: "deepseek-chat",
|
|
3446
|
-
Reasoner: "deepseek-reasoner"
|
|
4441
|
+
Reasoner: "deepseek-reasoner",
|
|
4442
|
+
V4Flash: "deepseek-v4-flash",
|
|
4443
|
+
V4Pro: "deepseek-v4-pro"
|
|
3447
4444
|
};
|
|
3448
4445
|
const DEEPSEEK_MODELS = enumValues(DeepSeekModel);
|
|
3449
4446
|
const GoogleModel = {
|
|
@@ -3493,18 +4490,9 @@ _enum(MINIMAX_MODELS);
|
|
|
3493
4490
|
_enum(MISTRAL_MODELS);
|
|
3494
4491
|
_enum(XAI_MODELS);
|
|
3495
4492
|
_enum(ZHIPU_MODELS);
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
...DEEPSEEK_MODELS,
|
|
3500
|
-
...GOOGLE_MODELS,
|
|
3501
|
-
...MINIMAX_MODELS,
|
|
3502
|
-
...MISTRAL_MODELS,
|
|
3503
|
-
...XAI_MODELS,
|
|
3504
|
-
...ZHIPU_MODELS
|
|
3505
|
-
]);
|
|
3506
|
-
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.O3Mini, OpenAIModel.O4Mini, DeepSeekModel.Chat, DeepSeekModel.Reasoner, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
3507
|
-
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.O3Mini, OpenAIModel.O4Mini, DeepSeekModel.Chat, DeepSeekModel.Reasoner, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4493
|
+
string().min(1);
|
|
4494
|
+
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
4495
|
+
AnthropicModel.Opus, AnthropicModel.Sonnet, AnthropicModel.Haiku, OpenAIModel.GPT4o, OpenAIModel.GPT4oMini, OpenAIModel.O3, OpenAIModel.GPT41, OpenAIModel.GPT41Mini, OpenAIModel.GPT41Nano, OpenAIModel.GPT54, OpenAIModel.GPT54Mini, OpenAIModel.GPT54Nano, OpenAIModel.GPT54Pro, OpenAIModel.GPT55, OpenAIModel.O3Mini, OpenAIModel.O4Mini, OpenAIModel.TextEmbedding3Small, DeepSeekModel.Chat, DeepSeekModel.Reasoner, DeepSeekModel.V4Flash, DeepSeekModel.V4Pro, GoogleModel.Gemini25Pro, GoogleModel.Gemini25Flash, GoogleModel.Gemini25FlashLite, GoogleModel.Gemini20Flash, MiniMaxModel.M27, MiniMaxModel.M25, MistralModel.Large, MistralModel.Small, MistralModel.Codestral, XAIModel.Grok4, XAIModel.Grok41Fast, ZhipuModel.GLM51, ZhipuModel.GLM51Air;
|
|
3508
4496
|
enumValues({
|
|
3509
4497
|
PendingChallenge: "pending_challenge",
|
|
3510
4498
|
Creating: "creating",
|
|
@@ -3702,6 +4690,17 @@ function deriveGatewayWsUrl(apiEndpoint) {
|
|
|
3702
4690
|
* [runtimes.openclaw]
|
|
3703
4691
|
* workspace = "~/.openclaw"
|
|
3704
4692
|
*/
|
|
4693
|
+
/**
|
|
4694
|
+
* Derive the agent workspace path from the runtime's home dir.
|
|
4695
|
+
*
|
|
4696
|
+
* For openclaw, the agent CWD is `${home}/workspace` (matches OpenClaw's
|
|
4697
|
+
* `agents.defaults.workspace` default — see OpenClaw README "Agent workspace
|
|
4698
|
+
* + skills"). For other runtimes, default to home itself.
|
|
4699
|
+
*/
|
|
4700
|
+
function deriveAgentWorkspace(runtime, home) {
|
|
4701
|
+
if (runtime === "openclaw") return join(home, "workspace");
|
|
4702
|
+
return home;
|
|
4703
|
+
}
|
|
3705
4704
|
async function loadRuntimeConfigs() {
|
|
3706
4705
|
const configPath = join(ALFE_DIR, "config.toml");
|
|
3707
4706
|
if (!existsSync(configPath)) return {};
|
|
@@ -3709,7 +4708,13 @@ async function loadRuntimeConfigs() {
|
|
|
3709
4708
|
const runtimes = parse(await readFile(configPath, "utf-8")).runtimes;
|
|
3710
4709
|
if (!runtimes) return {};
|
|
3711
4710
|
const result = {};
|
|
3712
|
-
for (const [name, cfg] of Object.entries(runtimes)) if (typeof cfg.workspace === "string")
|
|
4711
|
+
for (const [name, cfg] of Object.entries(runtimes)) if (typeof cfg.workspace === "string") {
|
|
4712
|
+
const workspace = cfg.workspace.startsWith("~/") ? join(homedir(), cfg.workspace.slice(2)) : cfg.workspace;
|
|
4713
|
+
result[name] = {
|
|
4714
|
+
workspace,
|
|
4715
|
+
agentWorkspace: deriveAgentWorkspace(name, workspace)
|
|
4716
|
+
};
|
|
4717
|
+
}
|
|
3713
4718
|
return result;
|
|
3714
4719
|
} catch {
|
|
3715
4720
|
return {};
|
|
@@ -3755,7 +4760,13 @@ async function loadManagedConfig() {
|
|
|
3755
4760
|
agentId: identity.agentId,
|
|
3756
4761
|
orgId: identity.orgId,
|
|
3757
4762
|
runtime: identity.runtime,
|
|
3758
|
-
runtimes: identity.runtime === "openclaw" ?
|
|
4763
|
+
runtimes: identity.runtime === "openclaw" ? (() => {
|
|
4764
|
+
const home = join(homedir(), ".openclaw");
|
|
4765
|
+
return { openclaw: {
|
|
4766
|
+
workspace: home,
|
|
4767
|
+
agentWorkspace: deriveAgentWorkspace("openclaw", home)
|
|
4768
|
+
} };
|
|
4769
|
+
})() : {},
|
|
3759
4770
|
autoStartRuntime: true
|
|
3760
4771
|
};
|
|
3761
4772
|
}
|
|
@@ -4819,7 +5830,7 @@ var IPCServer = class {
|
|
|
4819
5830
|
else this.sendResponse(conn, createIPCError(request.id, "NO_HANDLER", `No handler for method: ${request.method}`));
|
|
4820
5831
|
}
|
|
4821
5832
|
handleRegister(conn, request) {
|
|
4822
|
-
const { name, version, protocolVersion, capabilities } = request.params;
|
|
5833
|
+
const { name, version, protocolVersion, capabilities, pid } = request.params;
|
|
4823
5834
|
if (!name || !version) {
|
|
4824
5835
|
this.sendResponse(conn, createIPCError(request.id, "INVALID_REGISTER", "name and version are required"));
|
|
4825
5836
|
return;
|
|
@@ -4829,14 +5840,29 @@ var IPCServer = class {
|
|
|
4829
5840
|
return;
|
|
4830
5841
|
}
|
|
4831
5842
|
const staleIds = [];
|
|
4832
|
-
for (const [existingId, existing] of this.connections) if (existingId !== conn.id && existing.info?.name === name) {
|
|
5843
|
+
for (const [existingId, existing] of this.connections) if (existingId !== conn.id && existing.info?.name === name) if (pid != null && existing.info.pid === pid) {
|
|
4833
5844
|
logger$1.info({
|
|
4834
5845
|
staleConnId: existingId,
|
|
4835
5846
|
newConnId: conn.id,
|
|
4836
|
-
plugin: name
|
|
4837
|
-
|
|
5847
|
+
plugin: name,
|
|
5848
|
+
pid
|
|
5849
|
+
}, "IPC: closing stale duplicate connection (same PID)");
|
|
4838
5850
|
existing.socket.destroy();
|
|
4839
5851
|
staleIds.push(existingId);
|
|
5852
|
+
} else {
|
|
5853
|
+
logger$1.info({
|
|
5854
|
+
staleConnId: existingId,
|
|
5855
|
+
newConnId: conn.id,
|
|
5856
|
+
plugin: name,
|
|
5857
|
+
oldPid: existing.info.pid,
|
|
5858
|
+
newPid: pid
|
|
5859
|
+
}, "IPC: replacing connection from different process");
|
|
5860
|
+
this.sendEvent(existing, "plugin.replaced", {
|
|
5861
|
+
reason: "Another process registered with the same plugin name",
|
|
5862
|
+
replacedBy: conn.id
|
|
5863
|
+
});
|
|
5864
|
+
existing.socket.end();
|
|
5865
|
+
staleIds.push(existingId);
|
|
4840
5866
|
}
|
|
4841
5867
|
for (const id of staleIds) this.connections.delete(id);
|
|
4842
5868
|
conn.info = {
|
|
@@ -4844,6 +5870,7 @@ var IPCServer = class {
|
|
|
4844
5870
|
version,
|
|
4845
5871
|
protocolVersion: protocolVersion ?? 1,
|
|
4846
5872
|
capabilities: capabilities ?? [],
|
|
5873
|
+
pid: pid ?? null,
|
|
4847
5874
|
connectedAt: Date.now(),
|
|
4848
5875
|
lastSeen: Date.now()
|
|
4849
5876
|
};
|
|
@@ -20612,6 +21639,166 @@ var CommandRegistry = class {
|
|
|
20612
21639
|
}
|
|
20613
21640
|
};
|
|
20614
21641
|
//#endregion
|
|
21642
|
+
//#region src/pairing-approval.ts
|
|
21643
|
+
/**
|
|
21644
|
+
* Pairing approval poller — auto-approves pending OpenClaw scope-upgrade
|
|
21645
|
+
* requests for already-paired local devices.
|
|
21646
|
+
*
|
|
21647
|
+
* OpenClaw's gateway requires manual `openclaw devices approve <id>` when a
|
|
21648
|
+
* paired device reconnects requesting broader scopes than currently approved.
|
|
21649
|
+
* On managed agents, all gateway clients are local and trusted by definition,
|
|
21650
|
+
* so the manual step is friction. This poller closes the gap on the Alfe side.
|
|
21651
|
+
*
|
|
21652
|
+
* Behaviour:
|
|
21653
|
+
* 1. Read `<stateDir>/devices/pending.json` (OpenClaw's on-disk pairing state)
|
|
21654
|
+
* 2. For each pending request that:
|
|
21655
|
+
* - Has `isRepair === true` (already-paired device, just upgrading scope)
|
|
21656
|
+
* - Has loopback or absent `remoteIp` (local connection)
|
|
21657
|
+
* …call `openclaw devices approve <requestId>`. The CLI's built-in
|
|
21658
|
+
* loopback fallback (devices-cli.ts:approvePairingWithFallback) bypasses
|
|
21659
|
+
* the gateway when needed and uses `callerScopes: ["operator.admin"]`.
|
|
21660
|
+
* 3. Skip iteration if `pending.json` mtime hasn't changed (cheap fast path)
|
|
21661
|
+
*/
|
|
21662
|
+
const execFileAsync$1 = promisify(execFile);
|
|
21663
|
+
const APPROVE_TIMEOUT_MS = 1e4;
|
|
21664
|
+
function resolveStateDir(override) {
|
|
21665
|
+
if (override) return override;
|
|
21666
|
+
const fromEnv = process.env.OPENCLAW_STATE_DIR?.trim();
|
|
21667
|
+
if (fromEnv) return fromEnv;
|
|
21668
|
+
return join(homedir(), ".openclaw");
|
|
21669
|
+
}
|
|
21670
|
+
function isLoopback(ip) {
|
|
21671
|
+
if (!ip) return true;
|
|
21672
|
+
const trimmed = ip.trim();
|
|
21673
|
+
if (!trimmed) return true;
|
|
21674
|
+
return trimmed === "127.0.0.1" || trimmed === "::1" || trimmed.startsWith("127.") || trimmed === "localhost";
|
|
21675
|
+
}
|
|
21676
|
+
async function readPendingState(pendingPath) {
|
|
21677
|
+
try {
|
|
21678
|
+
const raw = await readFile(pendingPath, "utf-8");
|
|
21679
|
+
const parsed = JSON.parse(raw);
|
|
21680
|
+
if (typeof parsed !== "object" || parsed === null) return {};
|
|
21681
|
+
return parsed;
|
|
21682
|
+
} catch (err) {
|
|
21683
|
+
if (err.code === "ENOENT") return null;
|
|
21684
|
+
throw err;
|
|
21685
|
+
}
|
|
21686
|
+
}
|
|
21687
|
+
async function readMtime(pendingPath) {
|
|
21688
|
+
try {
|
|
21689
|
+
return (await stat(pendingPath)).mtimeMs;
|
|
21690
|
+
} catch (err) {
|
|
21691
|
+
if (err.code === "ENOENT") return null;
|
|
21692
|
+
throw err;
|
|
21693
|
+
}
|
|
21694
|
+
}
|
|
21695
|
+
/**
|
|
21696
|
+
* One sweep over pending.json. Approves eligible requests.
|
|
21697
|
+
* Exported for testing.
|
|
21698
|
+
*/
|
|
21699
|
+
async function approvePendingScopeUpgrades(opts) {
|
|
21700
|
+
const state = await readPendingState(join(opts.stateDir, "devices", "pending.json"));
|
|
21701
|
+
if (state === null) return {
|
|
21702
|
+
approved: [],
|
|
21703
|
+
skipped: 0,
|
|
21704
|
+
errors: 0
|
|
21705
|
+
};
|
|
21706
|
+
const approved = [];
|
|
21707
|
+
let skipped = 0;
|
|
21708
|
+
let errors = 0;
|
|
21709
|
+
for (const req of Object.values(state)) {
|
|
21710
|
+
if (typeof req.requestId !== "string" || req.requestId.length === 0) {
|
|
21711
|
+
skipped += 1;
|
|
21712
|
+
continue;
|
|
21713
|
+
}
|
|
21714
|
+
if (!req.isRepair) {
|
|
21715
|
+
skipped += 1;
|
|
21716
|
+
continue;
|
|
21717
|
+
}
|
|
21718
|
+
if (!isLoopback(req.remoteIp)) {
|
|
21719
|
+
skipped += 1;
|
|
21720
|
+
continue;
|
|
21721
|
+
}
|
|
21722
|
+
try {
|
|
21723
|
+
await opts.exec("openclaw", [
|
|
21724
|
+
"devices",
|
|
21725
|
+
"approve",
|
|
21726
|
+
req.requestId
|
|
21727
|
+
], { timeout: APPROVE_TIMEOUT_MS });
|
|
21728
|
+
opts.log.info({
|
|
21729
|
+
requestId: req.requestId,
|
|
21730
|
+
deviceId: req.deviceId,
|
|
21731
|
+
scopes: req.scopes,
|
|
21732
|
+
role: req.role
|
|
21733
|
+
}, "Auto-approved pending OpenClaw scope-upgrade for local device");
|
|
21734
|
+
approved.push(req.requestId);
|
|
21735
|
+
} catch (err) {
|
|
21736
|
+
errors += 1;
|
|
21737
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
21738
|
+
opts.log.warn({
|
|
21739
|
+
requestId: req.requestId,
|
|
21740
|
+
deviceId: req.deviceId,
|
|
21741
|
+
err: message
|
|
21742
|
+
}, "Failed to approve pending OpenClaw scope-upgrade — will retry on next interval");
|
|
21743
|
+
}
|
|
21744
|
+
}
|
|
21745
|
+
return {
|
|
21746
|
+
approved,
|
|
21747
|
+
skipped,
|
|
21748
|
+
errors
|
|
21749
|
+
};
|
|
21750
|
+
}
|
|
21751
|
+
/**
|
|
21752
|
+
* Start a polling loop that periodically approves eligible pending requests.
|
|
21753
|
+
* Returns a stop function. All errors are caught and logged — this never
|
|
21754
|
+
* throws to the daemon's main loop.
|
|
21755
|
+
*/
|
|
21756
|
+
function startPairingApprovalPoller(opts) {
|
|
21757
|
+
const stateDir = resolveStateDir(opts.stateDir);
|
|
21758
|
+
const intervalMs = opts.intervalMs ?? 3e4;
|
|
21759
|
+
const exec = opts.exec ?? (async (file, args, { timeout }) => {
|
|
21760
|
+
const { stdout, stderr } = await execFileAsync$1(file, args, { timeout });
|
|
21761
|
+
return {
|
|
21762
|
+
stdout,
|
|
21763
|
+
stderr
|
|
21764
|
+
};
|
|
21765
|
+
});
|
|
21766
|
+
const pendingPath = join(stateDir, "devices", "pending.json");
|
|
21767
|
+
let lastSeenMtime = null;
|
|
21768
|
+
let stopped = false;
|
|
21769
|
+
let timer = null;
|
|
21770
|
+
const tick = async () => {
|
|
21771
|
+
if (stopped) return;
|
|
21772
|
+
try {
|
|
21773
|
+
const mtime = await readMtime(pendingPath);
|
|
21774
|
+
if (mtime !== null && mtime === lastSeenMtime) {} else {
|
|
21775
|
+
lastSeenMtime = mtime;
|
|
21776
|
+
if (mtime !== null) await approvePendingScopeUpgrades({
|
|
21777
|
+
stateDir,
|
|
21778
|
+
log: opts.log,
|
|
21779
|
+
exec
|
|
21780
|
+
});
|
|
21781
|
+
}
|
|
21782
|
+
} catch (err) {
|
|
21783
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
21784
|
+
opts.log.warn({ err: message }, "Pairing approval poller tick failed (non-fatal)");
|
|
21785
|
+
}
|
|
21786
|
+
if (!stopped) timer = setTimeout(() => {
|
|
21787
|
+
tick();
|
|
21788
|
+
}, intervalMs);
|
|
21789
|
+
};
|
|
21790
|
+
timer = setTimeout(() => {
|
|
21791
|
+
tick();
|
|
21792
|
+
}, intervalMs);
|
|
21793
|
+
return () => {
|
|
21794
|
+
stopped = true;
|
|
21795
|
+
if (timer) {
|
|
21796
|
+
clearTimeout(timer);
|
|
21797
|
+
timer = null;
|
|
21798
|
+
}
|
|
21799
|
+
};
|
|
21800
|
+
}
|
|
21801
|
+
//#endregion
|
|
20615
21802
|
//#region src/daemon.ts
|
|
20616
21803
|
/**
|
|
20617
21804
|
* Alfe Gateway Daemon — main entry point.
|
|
@@ -20644,6 +21831,7 @@ let commandRegistry;
|
|
|
20644
21831
|
let resolvedCliVersion;
|
|
20645
21832
|
let resolvedRuntimeVersion;
|
|
20646
21833
|
let upgradingRuntime = false;
|
|
21834
|
+
let stopPairingApprovalPoller = null;
|
|
20647
21835
|
/**
|
|
20648
21836
|
* Resolve the installed @alfe.ai/cli version.
|
|
20649
21837
|
*
|
|
@@ -20697,6 +21885,55 @@ async function flushAndExit(code) {
|
|
|
20697
21885
|
});
|
|
20698
21886
|
process.exit(code);
|
|
20699
21887
|
}
|
|
21888
|
+
/**
|
|
21889
|
+
* One-shot migration for VMs provisioned before the persona-files-go-in-agent-workspace
|
|
21890
|
+
* fix landed. Old behavior wrote SOUL.md/IDENTITY.md/BOOTSTRAP.md/AGENTS.md at the
|
|
21891
|
+
* OpenClaw home (e.g. `~/.openclaw/`); the agent reads from the agent workspace
|
|
21892
|
+
* (e.g. `~/.openclaw/workspace/`). Move stale copies into place; skip if the
|
|
21893
|
+
* workspace already has the file. Idempotent and safe to run on every daemon start.
|
|
21894
|
+
*/
|
|
21895
|
+
const PERSONA_FILES = [
|
|
21896
|
+
"SOUL.md",
|
|
21897
|
+
"IDENTITY.md",
|
|
21898
|
+
"BOOTSTRAP.md",
|
|
21899
|
+
"AGENTS.md"
|
|
21900
|
+
];
|
|
21901
|
+
async function migrateLegacyPersonaFiles(home, agentWorkspace) {
|
|
21902
|
+
if (home === agentWorkspace) return;
|
|
21903
|
+
let moved = 0;
|
|
21904
|
+
let skipped = 0;
|
|
21905
|
+
for (const filename of PERSONA_FILES) {
|
|
21906
|
+
const src = join(home, filename);
|
|
21907
|
+
const dst = join(agentWorkspace, filename);
|
|
21908
|
+
try {
|
|
21909
|
+
await stat(src);
|
|
21910
|
+
} catch {
|
|
21911
|
+
continue;
|
|
21912
|
+
}
|
|
21913
|
+
try {
|
|
21914
|
+
await stat(dst);
|
|
21915
|
+
skipped++;
|
|
21916
|
+
continue;
|
|
21917
|
+
} catch {}
|
|
21918
|
+
try {
|
|
21919
|
+
await mkdir(agentWorkspace, { recursive: true });
|
|
21920
|
+
await rename(src, dst);
|
|
21921
|
+
moved++;
|
|
21922
|
+
} catch (err) {
|
|
21923
|
+
logger$1.warn({
|
|
21924
|
+
src,
|
|
21925
|
+
dst,
|
|
21926
|
+
err: err instanceof Error ? err.message : String(err)
|
|
21927
|
+
}, "Persona file migration: rename failed");
|
|
21928
|
+
}
|
|
21929
|
+
}
|
|
21930
|
+
if (moved > 0 || skipped > 0) logger$1.info({
|
|
21931
|
+
home,
|
|
21932
|
+
agentWorkspace,
|
|
21933
|
+
moved,
|
|
21934
|
+
skipped
|
|
21935
|
+
}, "Persona file backfill migration complete");
|
|
21936
|
+
}
|
|
20700
21937
|
async function startDaemon() {
|
|
20701
21938
|
startedAt = Date.now();
|
|
20702
21939
|
const managed = isManagedMode();
|
|
@@ -20805,10 +22042,14 @@ async function startDaemon() {
|
|
|
20805
22042
|
});
|
|
20806
22043
|
const runtimeAppliers = /* @__PURE__ */ new Map();
|
|
20807
22044
|
for (const [name, runtimeCfg] of Object.entries(config.runtimes)) if (name === "openclaw") {
|
|
20808
|
-
runtimeAppliers.set(name, new OpenClawApplier({
|
|
22045
|
+
runtimeAppliers.set(name, new OpenClawApplier({
|
|
22046
|
+
home: runtimeCfg.workspace,
|
|
22047
|
+
agentWorkspace: runtimeCfg.agentWorkspace
|
|
22048
|
+
}));
|
|
20809
22049
|
logger$1.info({
|
|
20810
22050
|
runtime: name,
|
|
20811
|
-
|
|
22051
|
+
home: runtimeCfg.workspace,
|
|
22052
|
+
agentWorkspace: runtimeCfg.agentWorkspace
|
|
20812
22053
|
}, "Registered OpenClaw runtime applier");
|
|
20813
22054
|
} else logger$1.warn({ runtime: name }, "Unknown runtime type — skipping");
|
|
20814
22055
|
const integrationsService = new IntegrationsService(new AlfeApiClient({
|
|
@@ -20854,6 +22095,7 @@ async function startDaemon() {
|
|
|
20854
22095
|
logger$1.debug({ runtime: config.runtime }, "Starting agent runtime...");
|
|
20855
22096
|
const runtimeCfg = config.runtimes[config.runtime];
|
|
20856
22097
|
if (runtimeCfg) {
|
|
22098
|
+
if (config.runtime === "openclaw") await migrateLegacyPersonaFiles(runtimeCfg.workspace, runtimeCfg.agentWorkspace);
|
|
20857
22099
|
logger$1.debug({
|
|
20858
22100
|
runtime: config.runtime,
|
|
20859
22101
|
workspace: runtimeCfg.workspace
|
|
@@ -20865,6 +22107,10 @@ async function startDaemon() {
|
|
|
20865
22107
|
});
|
|
20866
22108
|
runtimeProcess.start();
|
|
20867
22109
|
logger$1.debug("Runtime process started");
|
|
22110
|
+
if (config.runtime === "openclaw") {
|
|
22111
|
+
stopPairingApprovalPoller = startPairingApprovalPoller({ log: logger$1 });
|
|
22112
|
+
logger$1.debug("Pairing approval poller started");
|
|
22113
|
+
}
|
|
20868
22114
|
} else logger$1.warn({ runtime: config.runtime }, "No runtime config found — skipping runtime start");
|
|
20869
22115
|
}
|
|
20870
22116
|
if (!managed) await writePidFile();
|
|
@@ -20872,6 +22118,10 @@ async function startDaemon() {
|
|
|
20872
22118
|
if (shuttingDown) return;
|
|
20873
22119
|
shuttingDown = true;
|
|
20874
22120
|
logger$1.info({ signal }, "Shutting down...");
|
|
22121
|
+
if (stopPairingApprovalPoller) {
|
|
22122
|
+
stopPairingApprovalPoller();
|
|
22123
|
+
stopPairingApprovalPoller = null;
|
|
22124
|
+
}
|
|
20875
22125
|
if (runtimeProcess) {
|
|
20876
22126
|
logger$1.debug("Stopping runtime process...");
|
|
20877
22127
|
await runtimeProcess.stop();
|