openmausbot 0.1.86 → 0.1.88
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/README.md +4 -3
- package/dist/assets/{abnfDiagram-O67JEVCF-DpUZNnFD.js → abnfDiagram-O67JEVCF-qd9VD3GV.js} +1 -1
- package/dist/assets/{arc-DW7mrI4p.js → arc-3RwkUjRe.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-CyeZ5WLZ.js → architectureDiagram-NJMV4G6O-CFKSJS7a.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-CBVaNjO7.js → blockDiagram-BEXU5L5S-CG1rEfWD.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-sf8d41uT.js → c4Diagram-YGBWAQC7-CBW9N664.js} +1 -1
- package/dist/assets/channel-CnRnO3tF.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BOGvy7Y_.js → chunk-2Q5K7J3B-2mRfTksB.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-BiF9zyiz.js → chunk-3FUC2YCW-Cv1dpErj.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-EFuZ1SBZ.js → chunk-5VM5RSS4-B7IACJp-.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-pJLNSAT7.js → chunk-GTNCS2PH-An0hZtYa.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-Cb-3_3IT.js → chunk-GWA4HPMP-BcJB2nEm.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-DAf5aogn.js → chunk-JWPE2WC7-CV_W7TN7.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-DR3kiwZz.js → chunk-NETBCI7D-Bcs_kwnA.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-BmU8PeyM.js → chunk-WEXAMYUT-lrx_DxFP.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-Buh8g8OT.js → chunk-XXDRQBXY-DabHlLGM.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-BurfmMWM.js → classDiagram-v2-NBCMYWYE-BnHj6P7d.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-KkGZUEkU.js → cose-bilkent-JH36ORCC-CfLp6UDi.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-C3PpV96d.js → cynefin-OW5HDTMX-Dm4dbVA1.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-Dt8JwJaI.js → cynefinDiagram-VND7K2PF-B9mH-PID.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-DkjN8266.js → dagre-6A5THRUB-DDc_NVQJ.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-DUAJS0JV.js → diagram-22UHCM2B-lwr8Ip8-.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-Dw4KhF1a.js → diagram-3UASUU5V-BLLe6dmI.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-Dd1gmQqf.js → diagram-ATOU4E4O-6eUIq4lz.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-CjwGs0Yw.js → diagram-CDSNMT55-O-pRN7VQ.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-BL-69Zrq.js → diagram-MLGK6HIB-BietvGAI.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-5Zi2N7wo.js → diagram-MPIPVDR6-Bd2Cl62X.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-D9NekWUX.js → ebnfDiagram-ZINNZB2B-B6iDy69W.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-CkaSQjxw.js → elk-276RUBZZ-DQVHfKe0.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-CdAVBV8-.js → erDiagram-OPXOYQCR-BWdVp2tQ.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-Bm_lWWH7.js → flowDiagram-KWPJA3E3-WLE6rKB4.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-FZ8ejYWJ.js → ganttDiagram-FUAMR5RP-BbjS-4gn.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-Dlv9rizZ.js → gitGraphDiagram-X574FWY7-Dpy2QSGq.js} +1 -1
- package/dist/assets/index-BIMdIbaw.css +1 -0
- package/dist/assets/index-CHnODCr2.js +583 -0
- package/dist/assets/{index-h9FFNwTu.js → index-CIaHn5NS.js} +1 -1
- package/dist/assets/{infoDiagram-VRGFBTTK-BdQ_gW5B.js → infoDiagram-VRGFBTTK-D_jKWlKe.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-EwssEp2X.js → ishikawaDiagram-OU5B5YK6-DLJohSuK.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-BX1G1vOd.js → journeyDiagram-ZHPQQLJL-DPOFj0qN.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-BB4kAsyC.js → kanban-definition-PNTS6WVX-BI7v-xpK.js} +1 -1
- package/dist/assets/{linear-3su2TG93.js → linear-C2pWPSxO.js} +1 -1
- package/dist/assets/{mermaid.core-CDD1E0s9.js → mermaid.core-CR-j5WQU.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-Ba50MsNK.js → mindmap-definition-NLK3R4M7-lz9GvXRh.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-DZLkkZlM.js → pegDiagram-GJSIUBJH-Dl4_ia61.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-DaTz77Uq.js → pieDiagram-5QR66LMP-DWuT3n88.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-CpaiidpR.js → quadrantDiagram-O4NWA36T-DXWe9Jx7.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-mN4JrMeI.js → railroadDiagram-XR7U4H2S-COY1IBVY.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-BSNDRpg7.js → requirementDiagram-PLB6GJNP-DnyVuhsQ.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-FngzGNug.js → sankeyDiagram-IPEJSGJF-BSc4NdGK.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-CM4pCC3L.js → sequenceDiagram-PO4LG4MO-kqEU2EGq.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-CRICHXkw.js → sizeCapture-INFHLROL-BvB4bkWD.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-oyTWpxH2.js → stateDiagram-v2-GCMORJYK-BIrqNv7y.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-D9h9mPBq.js → swimlanes-2SLR337P-CFnalQUE.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-C4a8qNGj.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-BJUlN9bW.js → timeline-definition-EJHVYXUP-CsSWJnSQ.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-3uBNkbAb.js → usecaseDiagram-POWQR4AR-DkAmJ1EE.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-D2odalzT.js → vennDiagram-UO4OBE2U-C3vd9drL.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-DHgFaB9S.js → wardleyDiagram-VNRHLVJA-j26CM-pi.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-w5GYM2h0.js → xychartDiagram-PMCCYNJV-BYu1Q_at.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/browser-proxy.js +2 -1
- package/dist-server/companion/src/routes.js +8 -1
- package/dist-server/connector-proxy.js +105 -1
- package/dist-server/container-mcp.js +1032 -165
- package/dist-server/drivers/agents-proxy.js +338 -29
- package/dist-server/drivers/phone-proxy.js +33 -2
- package/dist-server/index.js +40590 -31811
- package/dist-server/local-computer-proxy.js +5 -3
- package/dist-server/local-computer.js +53 -17
- package/dist-server/mcp-gate.js +2 -0
- package/dist-server/mcp-server.js +5 -3
- package/dist-server/message-search.worker.js +52 -0
- package/dist-server/openmausbot.js +4457 -1399
- package/dist-server/pair-cli.js +4457 -1399
- package/dist-server/permission-proxy.js +29 -9
- package/dist-server/server/admission.js +81 -0
- package/dist-server/server/aside-queue.js +294 -0
- package/dist-server/server/attachments.js +98 -1
- package/dist-server/server/auto-approve.js +4 -3
- package/dist-server/server/auto-vm-claims.js +1 -0
- package/dist-server/server/bot-attachment.js +107 -0
- package/dist-server/server/bot-overview.js +19 -0
- package/dist-server/server/bot-package.js +18 -292
- package/dist-server/server/bot-profile.js +5 -17
- package/dist-server/server/box-create-idempotency.js +3 -3
- package/dist-server/server/box.js +57 -55
- package/dist-server/server/browser-proxy.js +3 -2
- package/dist-server/server/browser-runtime.js +37 -1
- package/dist-server/server/cli-api-setup.js +1 -0
- package/dist-server/server/cli.js +2 -2
- package/dist-server/server/command-allowlist.js +154 -0
- package/dist-server/server/composio.js +297 -1
- package/dist-server/server/computer-wait.js +22 -9
- package/dist-server/server/config.js +84 -12
- package/dist-server/server/connector-advertisement.js +165 -0
- package/dist-server/server/connector-proxy.js +14 -2
- package/dist-server/server/connector-verdict.js +168 -0
- package/dist-server/server/container-computer.js +61 -1
- package/dist-server/server/contracts.js +22 -0
- package/dist-server/server/default-model-selection.js +9 -0
- package/dist-server/server/delegations.js +85 -34
- package/dist-server/server/drivers/acp/core.js +80 -20
- package/dist-server/server/drivers/acp/cursor.js +3 -7
- package/dist-server/server/drivers/acp/droid.js +4 -7
- package/dist-server/server/drivers/acp/gemini.js +4 -4
- package/dist-server/server/drivers/acp/grok.js +4 -9
- package/dist-server/server/drivers/acp/hermes.js +3 -5
- package/dist-server/server/drivers/acp/opencode-go.js +2 -5
- package/dist-server/server/drivers/acp/qwen.js +9 -15
- package/dist-server/server/drivers/agents-call.js +179 -13
- package/dist-server/server/drivers/agents-catalog.js +134 -10
- package/dist-server/server/drivers/boxagent.js +160 -36
- package/dist-server/server/drivers/builtIn.js +2 -0
- package/dist-server/server/drivers/chat-box-tools.js +90 -0
- package/dist-server/server/drivers/chat-images.js +54 -0
- package/dist-server/server/drivers/chat-mcp-tools.js +38 -8
- package/dist-server/server/drivers/chat-tool-approval.js +70 -18
- package/dist-server/server/drivers/claude.js +38 -19
- package/dist-server/server/drivers/codex-catalog.js +14 -6
- package/dist-server/server/drivers/codex-identity.js +2 -1
- package/dist-server/server/drivers/codex-instructions.js +48 -6
- package/dist-server/server/drivers/codex-release.js +48 -0
- package/dist-server/server/drivers/codex-tool-surface.js +20 -0
- package/dist-server/server/drivers/codex.js +102 -55
- package/dist-server/server/drivers/mistral.js +115 -0
- package/dist-server/server/drivers/openai-chat.js +180 -33
- package/dist-server/server/drivers/openai-compat.js +1 -0
- package/dist-server/server/drivers/permission-command.js +35 -0
- package/dist-server/server/drivers/phone-proxy.js +47 -2
- package/dist-server/server/drivers/pi.js +306 -28
- package/dist-server/server/drivers/prompt-split.js +110 -0
- package/dist-server/server/drivers/session-idle.js +29 -0
- package/dist-server/server/env-path.js +15 -0
- package/dist-server/server/fleet.js +1 -1
- package/dist-server/server/group-thread-usage.js +103 -0
- package/dist-server/server/guarded-requests.js +2 -2
- package/dist-server/server/harness/registry.js +1 -0
- package/dist-server/server/harness-capabilities.js +46 -0
- package/dist-server/server/hosted-models.js +1 -1
- package/dist-server/server/index.js +2396 -505
- package/dist-server/server/local-computer.js +72 -23
- package/dist-server/server/managed-desktop.js +1 -1
- package/dist-server/server/mcp-bridge.js +6 -6
- package/dist-server/server/message-db.js +22 -42
- package/dist-server/server/message-file.js +9 -1
- package/dist-server/server/message-search-query.js +43 -0
- package/dist-server/server/message-search-worker.js +80 -0
- package/dist-server/server/message-search.worker.js +21 -0
- package/dist-server/server/model-requests.js +248 -0
- package/dist-server/server/new-bot-defaults.js +115 -0
- package/dist-server/server/options-card.js +21 -0
- package/dist-server/server/org-library.js +1065 -0
- package/dist-server/server/package-export.js +627 -39
- package/dist-server/server/package-import.js +458 -0
- package/dist-server/server/package-parts.js +87 -0
- package/dist-server/server/peer-approval.js +16 -7
- package/dist-server/server/peer-delivery.js +60 -0
- package/dist-server/server/peer-roster.js +67 -0
- package/dist-server/server/presets.js +492 -0
- package/dist-server/server/profile-requests.js +66 -39
- package/dist-server/server/profile-revision.js +9 -1
- package/dist-server/server/profile-versions.js +6 -3
- package/dist-server/server/provider-key-check.js +3 -2
- package/dist-server/server/published-teams.js +80 -0
- package/dist-server/server/room-handoffs.js +19 -3
- package/dist-server/server/routes/bot-presets.js +25 -0
- package/dist-server/server/routine-requests.js +35 -10
- package/dist-server/server/routines.js +41 -1
- package/dist-server/server/section-context.js +10 -0
- package/dist-server/server/skill-fetch.js +72 -14
- package/dist-server/server/skills.js +35 -61
- package/dist-server/server/steer-queue.js +3 -2
- package/dist-server/server/store.js +291 -17
- package/dist-server/server/surface.js +10 -4
- package/dist-server/server/system-prompt.js +38 -6
- package/dist-server/server/team-backup.js +6 -2
- package/dist-server/server/team-computers.js +10 -0
- package/dist-server/server/team-library.js +6 -2
- package/dist-server/server/team-manifest.js +4 -3
- package/dist-server/server/team-setup-requests.js +139 -27
- package/dist-server/server/thread-events.js +20 -2
- package/dist-server/server/tightening-requests.js +405 -0
- package/dist-server/server/tts/chatterbox.js +27 -5
- package/dist-server/server/turn-context.js +2 -0
- package/dist-server/server/turn-watchdog.js +12 -3
- package/dist-server/server/usage-ledger.js +19 -2
- package/dist-server/server/vps-computer.js +139 -51
- package/dist-server/server/vps-container-mcp.js +7 -0
- package/dist-server/server/vps-ssh.js +36 -7
- package/dist-server/server/workspace-backup-policy.js +12 -0
- package/dist-server/server/workspace-backup.js +42 -5
- package/dist-server/server/workspace-backup.worker.js +10 -0
- package/dist-server/server/workspace.js +1 -1
- package/dist-server/shared/approval-mode.js +1 -1
- package/dist-server/shared/ask-question.js +207 -12
- package/dist-server/shared/bot-profile.js +15 -0
- package/dist-server/shared/command-allowlist.js +1 -0
- package/dist-server/shared/credential-request.js +6 -2
- package/dist-server/shared/line-diff.js +23 -0
- package/dist-server/shared/model-request.js +1 -0
- package/dist-server/shared/options-card.js +51 -0
- package/dist-server/shared/package-format.js +967 -0
- package/dist-server/shared/profile-request.js +5 -4
- package/dist-server/shared/skill-md.js +64 -0
- package/dist-server/shared/team-backup.js +7 -0
- package/dist-server/shared/tightening-request.js +87 -0
- package/dist-server/shared/wire.js +4 -0
- package/dist-server/src/lib/composer-attachments.js +25 -3
- package/dist-server/vps-container-mcp.js +1132 -171
- package/dist-server/workspace-backup.worker.js +19474 -0
- package/enterprise/README.md +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-BXFkgus9.js +0 -1
- package/dist/assets/index-BGgqlWPJ.css +0 -1
- package/dist/assets/index-BtHo8ZKl.js +0 -577
- package/dist/assets/swimlanesDiagram-TC7HE7FX-BWrvB2ak.js +0 -8
|
@@ -17,7 +17,7 @@ import { basename, delimiter, dirname, extname, join } from "node:path";
|
|
|
17
17
|
function nvmBinDirs() {
|
|
18
18
|
try {
|
|
19
19
|
const base = join(homedir(), ".nvm", "versions", "node");
|
|
20
|
-
return readdirSync(base).filter((
|
|
20
|
+
return readdirSync(base).filter((v2) => v2.startsWith("v")).sort((a, b2) => b2.localeCompare(a, void 0, { numeric: true })).map((v2) => join(base, v2, "bin"));
|
|
21
21
|
} catch {
|
|
22
22
|
return [];
|
|
23
23
|
}
|
|
@@ -44,6 +44,8 @@ function knownDirs() {
|
|
|
44
44
|
join(home, ".volta", "bin"),
|
|
45
45
|
join(home, ".bun", "bin"),
|
|
46
46
|
join(home, ".asdf", "shims"),
|
|
47
|
+
join(home, ".local", "share", "mise", "shims"),
|
|
48
|
+
// mise installer
|
|
47
49
|
join(home, ".deno", "bin"),
|
|
48
50
|
join(home, "bin"),
|
|
49
51
|
...nvmBinDirs()
|
|
@@ -107,10 +109,10 @@ function probeLoginShellPath() {
|
|
|
107
109
|
{ timeout: 5e3 },
|
|
108
110
|
(err, stdout) => {
|
|
109
111
|
if (err || !stdout) return;
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
112
|
-
loginShellPath =
|
|
113
|
-
cached = mergePaths([...(cached ?? "").split(delimiter), ...
|
|
112
|
+
const m2 = /__OMB_PATH__([^\n]*)/.exec(stdout);
|
|
113
|
+
if (!m2 || !m2[1]) return;
|
|
114
|
+
loginShellPath = m2[1];
|
|
115
|
+
cached = mergePaths([...(cached ?? "").split(delimiter), ...m2[1].split(delimiter)]);
|
|
114
116
|
}
|
|
115
117
|
);
|
|
116
118
|
}
|
|
@@ -653,7 +655,7 @@ function $constructor(name, initializer3, params) {
|
|
|
653
655
|
Object.defineProperty(inst, "_zod", {
|
|
654
656
|
value: {
|
|
655
657
|
def,
|
|
656
|
-
constr:
|
|
658
|
+
constr: _2,
|
|
657
659
|
traits: /* @__PURE__ */ new Set()
|
|
658
660
|
},
|
|
659
661
|
enumerable: false
|
|
@@ -664,12 +666,12 @@ function $constructor(name, initializer3, params) {
|
|
|
664
666
|
}
|
|
665
667
|
inst._zod.traits.add(name);
|
|
666
668
|
initializer3(inst, def);
|
|
667
|
-
const proto =
|
|
669
|
+
const proto = _2.prototype;
|
|
668
670
|
const keys = Object.keys(proto);
|
|
669
671
|
for (let i = 0; i < keys.length; i++) {
|
|
670
|
-
const
|
|
671
|
-
if (!(
|
|
672
|
-
inst[
|
|
672
|
+
const k2 = keys[i];
|
|
673
|
+
if (!(k2 in inst)) {
|
|
674
|
+
inst[k2] = proto[k2].bind(inst);
|
|
673
675
|
}
|
|
674
676
|
}
|
|
675
677
|
}
|
|
@@ -677,7 +679,7 @@ function $constructor(name, initializer3, params) {
|
|
|
677
679
|
class Definition extends Parent {
|
|
678
680
|
}
|
|
679
681
|
Object.defineProperty(Definition, "name", { value: name });
|
|
680
|
-
function
|
|
682
|
+
function _2(def) {
|
|
681
683
|
var _a3;
|
|
682
684
|
const inst = params?.Parent ? new Definition() : this;
|
|
683
685
|
init(inst, def);
|
|
@@ -687,16 +689,16 @@ function $constructor(name, initializer3, params) {
|
|
|
687
689
|
}
|
|
688
690
|
return inst;
|
|
689
691
|
}
|
|
690
|
-
Object.defineProperty(
|
|
691
|
-
Object.defineProperty(
|
|
692
|
+
Object.defineProperty(_2, "init", { value: init });
|
|
693
|
+
Object.defineProperty(_2, Symbol.hasInstance, {
|
|
692
694
|
value: (inst) => {
|
|
693
695
|
if (params?.Parent && inst instanceof params.Parent)
|
|
694
696
|
return true;
|
|
695
697
|
return inst?._zod?.traits?.has(name);
|
|
696
698
|
}
|
|
697
699
|
});
|
|
698
|
-
Object.defineProperty(
|
|
699
|
-
return
|
|
700
|
+
Object.defineProperty(_2, "name", { value: name });
|
|
701
|
+
return _2;
|
|
700
702
|
}
|
|
701
703
|
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
702
704
|
var $ZodAsyncError = class extends Error {
|
|
@@ -796,17 +798,17 @@ function assertIs(_arg) {
|
|
|
796
798
|
function assertNever(_x) {
|
|
797
799
|
throw new Error("Unexpected value in exhaustive check");
|
|
798
800
|
}
|
|
799
|
-
function assert(
|
|
801
|
+
function assert(_2) {
|
|
800
802
|
}
|
|
801
803
|
function getEnumValues(entries) {
|
|
802
|
-
const numericValues = Object.values(entries).filter((
|
|
803
|
-
const values = Object.entries(entries).filter(([
|
|
804
|
+
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
805
|
+
const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v2]) => v2);
|
|
804
806
|
return values;
|
|
805
807
|
}
|
|
806
808
|
function joinValues(array2, separator = "|") {
|
|
807
809
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
808
810
|
}
|
|
809
|
-
function jsonStringifyReplacer(
|
|
811
|
+
function jsonStringifyReplacer(_2, value) {
|
|
810
812
|
if (typeof value === "bigint")
|
|
811
813
|
return value.toString();
|
|
812
814
|
return value;
|
|
@@ -854,9 +856,9 @@ function defineLazy(object2, key, getter) {
|
|
|
854
856
|
}
|
|
855
857
|
return value;
|
|
856
858
|
},
|
|
857
|
-
set(
|
|
859
|
+
set(v2) {
|
|
858
860
|
Object.defineProperty(object2, key, {
|
|
859
|
-
value:
|
|
861
|
+
value: v2
|
|
860
862
|
// configurable: true,
|
|
861
863
|
});
|
|
862
864
|
},
|
|
@@ -931,7 +933,7 @@ var allowsEval = /* @__PURE__ */ cached2(() => {
|
|
|
931
933
|
const F = Function;
|
|
932
934
|
new F("");
|
|
933
935
|
return true;
|
|
934
|
-
} catch (
|
|
936
|
+
} catch (_2) {
|
|
935
937
|
return false;
|
|
936
938
|
}
|
|
937
939
|
});
|
|
@@ -1052,31 +1054,31 @@ function normalizeParams(_params) {
|
|
|
1052
1054
|
function createTransparentProxy(getter) {
|
|
1053
1055
|
let target;
|
|
1054
1056
|
return new Proxy({}, {
|
|
1055
|
-
get(
|
|
1057
|
+
get(_2, prop, receiver) {
|
|
1056
1058
|
target ?? (target = getter());
|
|
1057
1059
|
return Reflect.get(target, prop, receiver);
|
|
1058
1060
|
},
|
|
1059
|
-
set(
|
|
1061
|
+
set(_2, prop, value, receiver) {
|
|
1060
1062
|
target ?? (target = getter());
|
|
1061
1063
|
return Reflect.set(target, prop, value, receiver);
|
|
1062
1064
|
},
|
|
1063
|
-
has(
|
|
1065
|
+
has(_2, prop) {
|
|
1064
1066
|
target ?? (target = getter());
|
|
1065
1067
|
return Reflect.has(target, prop);
|
|
1066
1068
|
},
|
|
1067
|
-
deleteProperty(
|
|
1069
|
+
deleteProperty(_2, prop) {
|
|
1068
1070
|
target ?? (target = getter());
|
|
1069
1071
|
return Reflect.deleteProperty(target, prop);
|
|
1070
1072
|
},
|
|
1071
|
-
ownKeys(
|
|
1073
|
+
ownKeys(_2) {
|
|
1072
1074
|
target ?? (target = getter());
|
|
1073
1075
|
return Reflect.ownKeys(target);
|
|
1074
1076
|
},
|
|
1075
|
-
getOwnPropertyDescriptor(
|
|
1077
|
+
getOwnPropertyDescriptor(_2, prop) {
|
|
1076
1078
|
target ?? (target = getter());
|
|
1077
1079
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
1078
1080
|
},
|
|
1079
|
-
defineProperty(
|
|
1081
|
+
defineProperty(_2, prop, descriptor) {
|
|
1080
1082
|
target ?? (target = getter());
|
|
1081
1083
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
1082
1084
|
}
|
|
@@ -1090,8 +1092,8 @@ function stringifyPrimitive(value) {
|
|
|
1090
1092
|
return `${value}`;
|
|
1091
1093
|
}
|
|
1092
1094
|
function optionalKeys(shape) {
|
|
1093
|
-
return Object.keys(shape).filter((
|
|
1094
|
-
return shape[
|
|
1095
|
+
return Object.keys(shape).filter((k2) => {
|
|
1096
|
+
return shape[k2]._zod.optin === "optional" && shape[k2]._zod.optout === "optional";
|
|
1095
1097
|
});
|
|
1096
1098
|
}
|
|
1097
1099
|
var NUMBER_FORMAT_RANGES = {
|
|
@@ -1191,20 +1193,20 @@ function safeExtend(schema, shape) {
|
|
|
1191
1193
|
});
|
|
1192
1194
|
return clone(schema, def);
|
|
1193
1195
|
}
|
|
1194
|
-
function merge(a,
|
|
1196
|
+
function merge(a, b2) {
|
|
1195
1197
|
if (a._zod.def.checks?.length) {
|
|
1196
1198
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1197
1199
|
}
|
|
1198
1200
|
const def = mergeDefs(a._zod.def, {
|
|
1199
1201
|
get shape() {
|
|
1200
|
-
const _shape = { ...a._zod.def.shape, ...
|
|
1202
|
+
const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
|
|
1201
1203
|
assignProp(this, "shape", _shape);
|
|
1202
1204
|
return _shape;
|
|
1203
1205
|
},
|
|
1204
1206
|
get catchall() {
|
|
1205
|
-
return
|
|
1207
|
+
return b2._zod.def.catchall;
|
|
1206
1208
|
},
|
|
1207
|
-
checks:
|
|
1209
|
+
checks: b2._zod.def.checks ?? []
|
|
1208
1210
|
});
|
|
1209
1211
|
return clone(a, def);
|
|
1210
1212
|
}
|
|
@@ -1277,21 +1279,21 @@ function required(Class2, schema, mask) {
|
|
|
1277
1279
|
});
|
|
1278
1280
|
return clone(schema, def);
|
|
1279
1281
|
}
|
|
1280
|
-
function aborted(
|
|
1281
|
-
if (
|
|
1282
|
+
function aborted(x2, startIndex = 0) {
|
|
1283
|
+
if (x2.aborted === true)
|
|
1282
1284
|
return true;
|
|
1283
|
-
for (let i = startIndex; i <
|
|
1284
|
-
if (
|
|
1285
|
+
for (let i = startIndex; i < x2.issues.length; i++) {
|
|
1286
|
+
if (x2.issues[i]?.continue !== true) {
|
|
1285
1287
|
return true;
|
|
1286
1288
|
}
|
|
1287
1289
|
}
|
|
1288
1290
|
return false;
|
|
1289
1291
|
}
|
|
1290
|
-
function explicitlyAborted(
|
|
1291
|
-
if (
|
|
1292
|
+
function explicitlyAborted(x2, startIndex = 0) {
|
|
1293
|
+
if (x2.aborted === true)
|
|
1292
1294
|
return true;
|
|
1293
|
-
for (let i = startIndex; i <
|
|
1294
|
-
if (
|
|
1295
|
+
for (let i = startIndex; i < x2.issues.length; i++) {
|
|
1296
|
+
if (x2.issues[i]?.continue === false) {
|
|
1295
1297
|
return true;
|
|
1296
1298
|
}
|
|
1297
1299
|
}
|
|
@@ -1368,8 +1370,8 @@ function issue(...args) {
|
|
|
1368
1370
|
return { ...iss };
|
|
1369
1371
|
}
|
|
1370
1372
|
function cleanEnum(obj) {
|
|
1371
|
-
return Object.entries(obj).filter(([
|
|
1372
|
-
return Number.isNaN(Number.parseInt(
|
|
1373
|
+
return Object.entries(obj).filter(([k2, _2]) => {
|
|
1374
|
+
return Number.isNaN(Number.parseInt(k2, 10));
|
|
1373
1375
|
}).map((el) => el[1]);
|
|
1374
1376
|
}
|
|
1375
1377
|
function base64ToUint8Array(base643) {
|
|
@@ -1407,7 +1409,7 @@ function hexToUint8Array(hex3) {
|
|
|
1407
1409
|
return bytes;
|
|
1408
1410
|
}
|
|
1409
1411
|
function uint8ArrayToHex(bytes) {
|
|
1410
|
-
return Array.from(bytes).map((
|
|
1412
|
+
return Array.from(bytes).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
1411
1413
|
}
|
|
1412
1414
|
var Class = class {
|
|
1413
1415
|
constructor(..._args) {
|
|
@@ -1544,7 +1546,7 @@ function toDotPath(_path) {
|
|
|
1544
1546
|
}
|
|
1545
1547
|
function prettifyError(error51) {
|
|
1546
1548
|
const lines = [];
|
|
1547
|
-
const issues = [...error51.issues].sort((a,
|
|
1549
|
+
const issues = [...error51.issues].sort((a, b2) => (a.path ?? []).length - (b2.path ?? []).length);
|
|
1548
1550
|
for (const issue2 of issues) {
|
|
1549
1551
|
lines.push(`\u2716 ${issue2.message}`);
|
|
1550
1552
|
if (issue2.path?.length)
|
|
@@ -2368,9 +2370,9 @@ var Doc = class {
|
|
|
2368
2370
|
return;
|
|
2369
2371
|
}
|
|
2370
2372
|
const content = arg;
|
|
2371
|
-
const lines = content.split("\n").filter((
|
|
2372
|
-
const minIndent = Math.min(...lines.map((
|
|
2373
|
-
const dedented = lines.map((
|
|
2373
|
+
const lines = content.split("\n").filter((x2) => x2);
|
|
2374
|
+
const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
|
|
2375
|
+
const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
|
|
2374
2376
|
for (const line of dedented) {
|
|
2375
2377
|
this.content.push(line);
|
|
2376
2378
|
}
|
|
@@ -2379,7 +2381,7 @@ var Doc = class {
|
|
|
2379
2381
|
const F = Function;
|
|
2380
2382
|
const args = this?.args;
|
|
2381
2383
|
const content = this?.content ?? [``];
|
|
2382
|
-
const lines = [...content.map((
|
|
2384
|
+
const lines = [...content.map((x2) => ` ${x2}`)];
|
|
2383
2385
|
return new F(...args, lines.join("\n"));
|
|
2384
2386
|
}
|
|
2385
2387
|
};
|
|
@@ -2427,13 +2429,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2427
2429
|
continue;
|
|
2428
2430
|
}
|
|
2429
2431
|
const currLen = payload.issues.length;
|
|
2430
|
-
const
|
|
2431
|
-
if (
|
|
2432
|
+
const _2 = ch._zod.check(payload);
|
|
2433
|
+
if (_2 instanceof Promise && ctx?.async === false) {
|
|
2432
2434
|
throw new $ZodAsyncError();
|
|
2433
2435
|
}
|
|
2434
|
-
if (asyncResult ||
|
|
2436
|
+
if (asyncResult || _2 instanceof Promise) {
|
|
2435
2437
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2436
|
-
await
|
|
2438
|
+
await _2;
|
|
2437
2439
|
const nextLen = payload.issues.length;
|
|
2438
2440
|
if (nextLen === currLen)
|
|
2439
2441
|
return;
|
|
@@ -2495,7 +2497,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2495
2497
|
try {
|
|
2496
2498
|
const r = safeParse(inst, value);
|
|
2497
2499
|
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
2498
|
-
} catch (
|
|
2500
|
+
} catch (_2) {
|
|
2499
2501
|
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
2500
2502
|
}
|
|
2501
2503
|
},
|
|
@@ -2506,11 +2508,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
2506
2508
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
2507
2509
|
$ZodType.init(inst, def);
|
|
2508
2510
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
2509
|
-
inst._zod.parse = (payload,
|
|
2511
|
+
inst._zod.parse = (payload, _2) => {
|
|
2510
2512
|
if (def.coerce)
|
|
2511
2513
|
try {
|
|
2512
2514
|
payload.value = String(payload.value);
|
|
2513
|
-
} catch (
|
|
2515
|
+
} catch (_3) {
|
|
2514
2516
|
}
|
|
2515
2517
|
if (typeof payload.value === "string")
|
|
2516
2518
|
return payload;
|
|
@@ -2543,10 +2545,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
2543
2545
|
v7: 7,
|
|
2544
2546
|
v8: 8
|
|
2545
2547
|
};
|
|
2546
|
-
const
|
|
2547
|
-
if (
|
|
2548
|
+
const v2 = versionMap[def.version];
|
|
2549
|
+
if (v2 === void 0)
|
|
2548
2550
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
2549
|
-
def.pattern ?? (def.pattern = uuid(
|
|
2551
|
+
def.pattern ?? (def.pattern = uuid(v2));
|
|
2550
2552
|
} else
|
|
2551
2553
|
def.pattern ?? (def.pattern = uuid());
|
|
2552
2554
|
$ZodStringFormat.init(inst, def);
|
|
@@ -2608,7 +2610,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
2608
2610
|
payload.value = trimmed;
|
|
2609
2611
|
}
|
|
2610
2612
|
return;
|
|
2611
|
-
} catch (
|
|
2613
|
+
} catch (_2) {
|
|
2612
2614
|
payload.issues.push({
|
|
2613
2615
|
code: "invalid_format",
|
|
2614
2616
|
format: "url",
|
|
@@ -2835,7 +2837,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
2835
2837
|
if (def.coerce)
|
|
2836
2838
|
try {
|
|
2837
2839
|
payload.value = Number(payload.value);
|
|
2838
|
-
} catch (
|
|
2840
|
+
} catch (_2) {
|
|
2839
2841
|
}
|
|
2840
2842
|
const input = payload.value;
|
|
2841
2843
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -2863,7 +2865,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
2863
2865
|
if (def.coerce)
|
|
2864
2866
|
try {
|
|
2865
2867
|
payload.value = Boolean(payload.value);
|
|
2866
|
-
} catch (
|
|
2868
|
+
} catch (_2) {
|
|
2867
2869
|
}
|
|
2868
2870
|
const input = payload.value;
|
|
2869
2871
|
if (typeof input === "boolean")
|
|
@@ -2884,7 +2886,7 @@ var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
|
2884
2886
|
if (def.coerce)
|
|
2885
2887
|
try {
|
|
2886
2888
|
payload.value = BigInt(payload.value);
|
|
2887
|
-
} catch (
|
|
2889
|
+
} catch (_2) {
|
|
2888
2890
|
}
|
|
2889
2891
|
if (typeof payload.value === "bigint")
|
|
2890
2892
|
return payload;
|
|
@@ -3077,9 +3079,9 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
3077
3079
|
}
|
|
3078
3080
|
function normalizeDef(def) {
|
|
3079
3081
|
const keys = Object.keys(def.shape);
|
|
3080
|
-
for (const
|
|
3081
|
-
if (!def.shape?.[
|
|
3082
|
-
throw new Error(`Invalid element at key "${
|
|
3082
|
+
for (const k2 of keys) {
|
|
3083
|
+
if (!def.shape?.[k2]?._zod?.traits?.has("$ZodType")) {
|
|
3084
|
+
throw new Error(`Invalid element at key "${k2}": expected a Zod schema`);
|
|
3083
3085
|
}
|
|
3084
3086
|
}
|
|
3085
3087
|
const okeys = optionalKeys(def.shape);
|
|
@@ -3151,8 +3153,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3151
3153
|
const field = shape[key]._zod;
|
|
3152
3154
|
if (field.values) {
|
|
3153
3155
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3154
|
-
for (const
|
|
3155
|
-
propValues[key].add(
|
|
3156
|
+
for (const v2 of field.values)
|
|
3157
|
+
propValues[key].add(v2);
|
|
3156
3158
|
}
|
|
3157
3159
|
}
|
|
3158
3160
|
return propValues;
|
|
@@ -3200,8 +3202,8 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3200
3202
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
3201
3203
|
const normalized = _normalized.value;
|
|
3202
3204
|
const parseStr = (key) => {
|
|
3203
|
-
const
|
|
3204
|
-
return `shape[${
|
|
3205
|
+
const k2 = esc(key);
|
|
3206
|
+
return `shape[${k2}]._zod.run({ value: input[${k2}], issues: [] }, ctx)`;
|
|
3205
3207
|
};
|
|
3206
3208
|
doc.write(`const input = payload.value;`);
|
|
3207
3209
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
@@ -3212,7 +3214,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3212
3214
|
doc.write(`const newResult = {};`);
|
|
3213
3215
|
for (const key of normalized.keys) {
|
|
3214
3216
|
const id = ids[key];
|
|
3215
|
-
const
|
|
3217
|
+
const k2 = esc(key);
|
|
3216
3218
|
const schema = shape[key];
|
|
3217
3219
|
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
3218
3220
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
@@ -3220,30 +3222,30 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3220
3222
|
if (isOptionalIn && isOptionalOut) {
|
|
3221
3223
|
doc.write(`
|
|
3222
3224
|
if (${id}.issues.length) {
|
|
3223
|
-
if (${
|
|
3225
|
+
if (${k2} in input) {
|
|
3224
3226
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3225
3227
|
...iss,
|
|
3226
|
-
path: iss.path ? [${
|
|
3228
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3227
3229
|
})));
|
|
3228
3230
|
}
|
|
3229
3231
|
}
|
|
3230
3232
|
|
|
3231
3233
|
if (${id}.value === undefined) {
|
|
3232
|
-
if (${
|
|
3233
|
-
newResult[${
|
|
3234
|
+
if (${k2} in input) {
|
|
3235
|
+
newResult[${k2}] = undefined;
|
|
3234
3236
|
}
|
|
3235
3237
|
} else {
|
|
3236
|
-
newResult[${
|
|
3238
|
+
newResult[${k2}] = ${id}.value;
|
|
3237
3239
|
}
|
|
3238
3240
|
|
|
3239
3241
|
`);
|
|
3240
3242
|
} else if (!isOptionalIn) {
|
|
3241
3243
|
doc.write(`
|
|
3242
|
-
const ${id}_present = ${
|
|
3244
|
+
const ${id}_present = ${k2} in input;
|
|
3243
3245
|
if (${id}.issues.length) {
|
|
3244
3246
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3245
3247
|
...iss,
|
|
3246
|
-
path: iss.path ? [${
|
|
3248
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3247
3249
|
})));
|
|
3248
3250
|
}
|
|
3249
3251
|
if (!${id}_present && !${id}.issues.length) {
|
|
@@ -3251,15 +3253,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3251
3253
|
code: "invalid_type",
|
|
3252
3254
|
expected: "nonoptional",
|
|
3253
3255
|
input: undefined,
|
|
3254
|
-
path: [${
|
|
3256
|
+
path: [${k2}]
|
|
3255
3257
|
});
|
|
3256
3258
|
}
|
|
3257
3259
|
|
|
3258
3260
|
if (${id}_present) {
|
|
3259
3261
|
if (${id}.value === undefined) {
|
|
3260
|
-
newResult[${
|
|
3262
|
+
newResult[${k2}] = undefined;
|
|
3261
3263
|
} else {
|
|
3262
|
-
newResult[${
|
|
3264
|
+
newResult[${k2}] = ${id}.value;
|
|
3263
3265
|
}
|
|
3264
3266
|
}
|
|
3265
3267
|
|
|
@@ -3269,16 +3271,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3269
3271
|
if (${id}.issues.length) {
|
|
3270
3272
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3271
3273
|
...iss,
|
|
3272
|
-
path: iss.path ? [${
|
|
3274
|
+
path: iss.path ? [${k2}, ...iss.path] : [${k2}]
|
|
3273
3275
|
})));
|
|
3274
3276
|
}
|
|
3275
3277
|
|
|
3276
3278
|
if (${id}.value === undefined) {
|
|
3277
|
-
if (${
|
|
3278
|
-
newResult[${
|
|
3279
|
+
if (${k2} in input) {
|
|
3280
|
+
newResult[${k2}] = undefined;
|
|
3279
3281
|
}
|
|
3280
3282
|
} else {
|
|
3281
|
-
newResult[${
|
|
3283
|
+
newResult[${k2}] = ${id}.value;
|
|
3282
3284
|
}
|
|
3283
3285
|
|
|
3284
3286
|
`);
|
|
@@ -3352,7 +3354,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
3352
3354
|
defineLazy(inst._zod, "pattern", () => {
|
|
3353
3355
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
3354
3356
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
3355
|
-
return new RegExp(`^(${patterns.map((
|
|
3357
|
+
return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
|
|
3356
3358
|
}
|
|
3357
3359
|
return void 0;
|
|
3358
3360
|
});
|
|
@@ -3447,11 +3449,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3447
3449
|
const pv = option._zod.propValues;
|
|
3448
3450
|
if (!pv || Object.keys(pv).length === 0)
|
|
3449
3451
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
3450
|
-
for (const [
|
|
3451
|
-
if (!propValues[
|
|
3452
|
-
propValues[
|
|
3453
|
-
for (const val of
|
|
3454
|
-
propValues[
|
|
3452
|
+
for (const [k2, v2] of Object.entries(pv)) {
|
|
3453
|
+
if (!propValues[k2])
|
|
3454
|
+
propValues[k2] = /* @__PURE__ */ new Set();
|
|
3455
|
+
for (const val of v2) {
|
|
3456
|
+
propValues[k2].add(val);
|
|
3455
3457
|
}
|
|
3456
3458
|
}
|
|
3457
3459
|
}
|
|
@@ -3464,11 +3466,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
3464
3466
|
const values = o._zod.propValues?.[def.discriminator];
|
|
3465
3467
|
if (!values || values.size === 0)
|
|
3466
3468
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
3467
|
-
for (const
|
|
3468
|
-
if (map2.has(
|
|
3469
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
3469
|
+
for (const v2 of values) {
|
|
3470
|
+
if (map2.has(v2)) {
|
|
3471
|
+
throw new Error(`Duplicate discriminator value "${String(v2)}"`);
|
|
3470
3472
|
}
|
|
3471
|
-
map2.set(
|
|
3473
|
+
map2.set(v2, o);
|
|
3472
3474
|
}
|
|
3473
3475
|
}
|
|
3474
3476
|
return map2;
|
|
@@ -3519,19 +3521,19 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
|
|
|
3519
3521
|
return handleIntersectionResults(payload, left, right);
|
|
3520
3522
|
};
|
|
3521
3523
|
});
|
|
3522
|
-
function mergeValues(a,
|
|
3523
|
-
if (a ===
|
|
3524
|
+
function mergeValues(a, b2) {
|
|
3525
|
+
if (a === b2) {
|
|
3524
3526
|
return { valid: true, data: a };
|
|
3525
3527
|
}
|
|
3526
|
-
if (a instanceof Date &&
|
|
3528
|
+
if (a instanceof Date && b2 instanceof Date && +a === +b2) {
|
|
3527
3529
|
return { valid: true, data: a };
|
|
3528
3530
|
}
|
|
3529
|
-
if (isPlainObject(a) && isPlainObject(
|
|
3530
|
-
const bKeys = Object.keys(
|
|
3531
|
+
if (isPlainObject(a) && isPlainObject(b2)) {
|
|
3532
|
+
const bKeys = Object.keys(b2);
|
|
3531
3533
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
3532
|
-
const newObj = { ...a, ...
|
|
3534
|
+
const newObj = { ...a, ...b2 };
|
|
3533
3535
|
for (const key of sharedKeys) {
|
|
3534
|
-
const sharedValue = mergeValues(a[key],
|
|
3536
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
3535
3537
|
if (!sharedValue.valid) {
|
|
3536
3538
|
return {
|
|
3537
3539
|
valid: false,
|
|
@@ -3542,14 +3544,14 @@ function mergeValues(a, b) {
|
|
|
3542
3544
|
}
|
|
3543
3545
|
return { valid: true, data: newObj };
|
|
3544
3546
|
}
|
|
3545
|
-
if (Array.isArray(a) && Array.isArray(
|
|
3546
|
-
if (a.length !==
|
|
3547
|
+
if (Array.isArray(a) && Array.isArray(b2)) {
|
|
3548
|
+
if (a.length !== b2.length) {
|
|
3547
3549
|
return { valid: false, mergeErrorPath: [] };
|
|
3548
3550
|
}
|
|
3549
3551
|
const newArray = [];
|
|
3550
3552
|
for (let index = 0; index < a.length; index++) {
|
|
3551
3553
|
const itemA = a[index];
|
|
3552
|
-
const itemB =
|
|
3554
|
+
const itemB = b2[index];
|
|
3553
3555
|
const sharedValue = mergeValues(itemA, itemB);
|
|
3554
3556
|
if (!sharedValue.valid) {
|
|
3555
3557
|
return {
|
|
@@ -3569,10 +3571,10 @@ function handleIntersectionResults(result, left, right) {
|
|
|
3569
3571
|
for (const iss of left.issues) {
|
|
3570
3572
|
if (iss.code === "unrecognized_keys") {
|
|
3571
3573
|
unrecIssue ?? (unrecIssue = iss);
|
|
3572
|
-
for (const
|
|
3573
|
-
if (!unrecKeys.has(
|
|
3574
|
-
unrecKeys.set(
|
|
3575
|
-
unrecKeys.get(
|
|
3574
|
+
for (const k2 of iss.keys) {
|
|
3575
|
+
if (!unrecKeys.has(k2))
|
|
3576
|
+
unrecKeys.set(k2, {});
|
|
3577
|
+
unrecKeys.get(k2).l = true;
|
|
3576
3578
|
}
|
|
3577
3579
|
} else {
|
|
3578
3580
|
result.issues.push(iss);
|
|
@@ -3580,16 +3582,16 @@ function handleIntersectionResults(result, left, right) {
|
|
|
3580
3582
|
}
|
|
3581
3583
|
for (const iss of right.issues) {
|
|
3582
3584
|
if (iss.code === "unrecognized_keys") {
|
|
3583
|
-
for (const
|
|
3584
|
-
if (!unrecKeys.has(
|
|
3585
|
-
unrecKeys.set(
|
|
3586
|
-
unrecKeys.get(
|
|
3585
|
+
for (const k2 of iss.keys) {
|
|
3586
|
+
if (!unrecKeys.has(k2))
|
|
3587
|
+
unrecKeys.set(k2, {});
|
|
3588
|
+
unrecKeys.get(k2).r = true;
|
|
3587
3589
|
}
|
|
3588
3590
|
} else {
|
|
3589
3591
|
result.issues.push(iss);
|
|
3590
3592
|
}
|
|
3591
3593
|
}
|
|
3592
|
-
const bothKeys = [...unrecKeys].filter(([,
|
|
3594
|
+
const bothKeys = [...unrecKeys].filter(([, f2]) => f2.l && f2.r).map(([k2]) => k2);
|
|
3593
3595
|
if (bothKeys.length && unrecIssue) {
|
|
3594
3596
|
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
3595
3597
|
}
|
|
@@ -3933,7 +3935,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
3933
3935
|
const values = getEnumValues(def.entries);
|
|
3934
3936
|
const valuesSet = new Set(values);
|
|
3935
3937
|
inst._zod.values = valuesSet;
|
|
3936
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((
|
|
3938
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k2) => propertyKeyTypes.has(typeof k2)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
3937
3939
|
inst._zod.parse = (payload, _ctx) => {
|
|
3938
3940
|
const input = payload.value;
|
|
3939
3941
|
if (valuesSet.has(input)) {
|
|
@@ -4107,8 +4109,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
4107
4109
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
4108
4110
|
$ZodType.init(inst, def);
|
|
4109
4111
|
defineLazy(inst._zod, "values", () => {
|
|
4110
|
-
const
|
|
4111
|
-
return
|
|
4112
|
+
const v2 = def.innerType._zod.values;
|
|
4113
|
+
return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
|
|
4112
4114
|
});
|
|
4113
4115
|
inst._zod.parse = (payload, ctx) => {
|
|
4114
4116
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -4453,7 +4455,7 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
|
4453
4455
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
4454
4456
|
$ZodCheck.init(inst, def);
|
|
4455
4457
|
$ZodType.init(inst, def);
|
|
4456
|
-
inst._zod.parse = (payload,
|
|
4458
|
+
inst._zod.parse = (payload, _2) => {
|
|
4457
4459
|
return payload;
|
|
4458
4460
|
};
|
|
4459
4461
|
inst._zod.check = (payload) => {
|
|
@@ -6505,7 +6507,7 @@ var error17 = () => {
|
|
|
6505
6507
|
if (issue2.values.length === 1) {
|
|
6506
6508
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
|
|
6507
6509
|
}
|
|
6508
|
-
const stringified = issue2.values.map((
|
|
6510
|
+
const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
|
|
6509
6511
|
if (issue2.values.length === 2) {
|
|
6510
6512
|
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
|
|
6511
6513
|
}
|
|
@@ -10470,12 +10472,12 @@ var $ZodRegistry = class {
|
|
|
10470
10472
|
return this;
|
|
10471
10473
|
}
|
|
10472
10474
|
get(schema) {
|
|
10473
|
-
const
|
|
10474
|
-
if (
|
|
10475
|
-
const pm = { ...this.get(
|
|
10475
|
+
const p2 = schema._zod.parent;
|
|
10476
|
+
if (p2) {
|
|
10477
|
+
const pm = { ...this.get(p2) ?? {} };
|
|
10476
10478
|
delete pm.id;
|
|
10477
|
-
const
|
|
10478
|
-
return Object.keys(
|
|
10479
|
+
const f2 = { ...pm, ...this._map.get(schema) };
|
|
10480
|
+
return Object.keys(f2).length ? f2 : void 0;
|
|
10479
10481
|
}
|
|
10480
10482
|
return this._map.get(schema);
|
|
10481
10483
|
}
|
|
@@ -11260,7 +11262,7 @@ function _set(Class2, valueType, params) {
|
|
|
11260
11262
|
}
|
|
11261
11263
|
// @__NO_SIDE_EFFECTS__
|
|
11262
11264
|
function _enum(Class2, values, params) {
|
|
11263
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
11265
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
11264
11266
|
return new Class2({
|
|
11265
11267
|
type: "enum",
|
|
11266
11268
|
entries,
|
|
@@ -11465,8 +11467,8 @@ function _stringbool(Classes, _params) {
|
|
|
11465
11467
|
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
11466
11468
|
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
11467
11469
|
if (params.case !== "sensitive") {
|
|
11468
|
-
truthyArray = truthyArray.map((
|
|
11469
|
-
falsyArray = falsyArray.map((
|
|
11470
|
+
truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
11471
|
+
falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
|
|
11470
11472
|
}
|
|
11471
11473
|
const truthySet = new Set(truthyArray);
|
|
11472
11474
|
const falsySet = new Set(falsyArray);
|
|
@@ -12008,9 +12010,9 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
12008
12010
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
12009
12011
|
const def = schema._zod.def;
|
|
12010
12012
|
const values = getEnumValues(def.entries);
|
|
12011
|
-
if (values.every((
|
|
12013
|
+
if (values.every((v2) => typeof v2 === "number"))
|
|
12012
12014
|
json2.type = "number";
|
|
12013
|
-
if (values.every((
|
|
12015
|
+
if (values.every((v2) => typeof v2 === "string"))
|
|
12014
12016
|
json2.type = "string";
|
|
12015
12017
|
json2.enum = values;
|
|
12016
12018
|
};
|
|
@@ -12043,13 +12045,13 @@ var literalProcessor = (schema, ctx, json2, _params) => {
|
|
|
12043
12045
|
json2.const = val;
|
|
12044
12046
|
}
|
|
12045
12047
|
} else {
|
|
12046
|
-
if (vals.every((
|
|
12048
|
+
if (vals.every((v2) => typeof v2 === "number"))
|
|
12047
12049
|
json2.type = "number";
|
|
12048
|
-
if (vals.every((
|
|
12050
|
+
if (vals.every((v2) => typeof v2 === "string"))
|
|
12049
12051
|
json2.type = "string";
|
|
12050
|
-
if (vals.every((
|
|
12052
|
+
if (vals.every((v2) => typeof v2 === "boolean"))
|
|
12051
12053
|
json2.type = "boolean";
|
|
12052
|
-
if (vals.every((
|
|
12054
|
+
if (vals.every((v2) => v2 === null))
|
|
12053
12055
|
json2.type = "null";
|
|
12054
12056
|
json2.enum = vals;
|
|
12055
12057
|
}
|
|
@@ -12085,7 +12087,7 @@ var fileProcessor = (schema, _ctx, json2, _params) => {
|
|
|
12085
12087
|
Object.assign(_json, file2);
|
|
12086
12088
|
} else {
|
|
12087
12089
|
Object.assign(_json, file2);
|
|
12088
|
-
_json.anyOf = mime.map((
|
|
12090
|
+
_json.anyOf = mime.map((m2) => ({ contentMediaType: m2 }));
|
|
12089
12091
|
}
|
|
12090
12092
|
} else {
|
|
12091
12093
|
Object.assign(_json, file2);
|
|
@@ -12147,11 +12149,11 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12147
12149
|
}
|
|
12148
12150
|
const allKeys = new Set(Object.keys(shape));
|
|
12149
12151
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
12150
|
-
const
|
|
12152
|
+
const v2 = def.shape[key]._zod;
|
|
12151
12153
|
if (ctx.io === "input") {
|
|
12152
|
-
return
|
|
12154
|
+
return v2.optin === void 0;
|
|
12153
12155
|
} else {
|
|
12154
|
-
return
|
|
12156
|
+
return v2.optout === void 0;
|
|
12155
12157
|
}
|
|
12156
12158
|
}));
|
|
12157
12159
|
if (requiredKeys.size > 0) {
|
|
@@ -12172,7 +12174,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
12172
12174
|
var unionProcessor = (schema, ctx, json2, params) => {
|
|
12173
12175
|
const def = schema._zod.def;
|
|
12174
12176
|
const isExclusive = def.inclusive === false;
|
|
12175
|
-
const options = def.options.map((
|
|
12177
|
+
const options = def.options.map((x2, i) => process2(x2, ctx, {
|
|
12176
12178
|
...params,
|
|
12177
12179
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
12178
12180
|
}));
|
|
@@ -12188,14 +12190,14 @@ var intersectionProcessor = (schema, ctx, json2, params) => {
|
|
|
12188
12190
|
...params,
|
|
12189
12191
|
path: [...params.path, "allOf", 0]
|
|
12190
12192
|
});
|
|
12191
|
-
const
|
|
12193
|
+
const b2 = process2(def.right, ctx, {
|
|
12192
12194
|
...params,
|
|
12193
12195
|
path: [...params.path, "allOf", 1]
|
|
12194
12196
|
});
|
|
12195
12197
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
12196
12198
|
const allOf = [
|
|
12197
12199
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
12198
|
-
...isSimpleIntersection(
|
|
12200
|
+
...isSimpleIntersection(b2) ? b2.allOf : [b2]
|
|
12199
12201
|
];
|
|
12200
12202
|
json2.allOf = allOf;
|
|
12201
12203
|
};
|
|
@@ -12205,7 +12207,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
12205
12207
|
json2.type = "array";
|
|
12206
12208
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
12207
12209
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
12208
|
-
const prefixItems = def.items.map((
|
|
12210
|
+
const prefixItems = def.items.map((x2, i) => process2(x2, ctx, {
|
|
12209
12211
|
...params,
|
|
12210
12212
|
path: [...params.path, prefixPath, i]
|
|
12211
12213
|
}));
|
|
@@ -12271,7 +12273,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
12271
12273
|
}
|
|
12272
12274
|
const keyValues = keyType._zod.values;
|
|
12273
12275
|
if (keyValues) {
|
|
12274
|
-
const validKeyValues = [...keyValues].filter((
|
|
12276
|
+
const validKeyValues = [...keyValues].filter((v2) => typeof v2 === "string" || typeof v2 === "number");
|
|
12275
12277
|
if (validKeyValues.length > 0) {
|
|
12276
12278
|
json2.required = validKeyValues;
|
|
12277
12279
|
}
|
|
@@ -12402,7 +12404,7 @@ function toJSONSchema(input, params) {
|
|
|
12402
12404
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
12403
12405
|
const defs = {};
|
|
12404
12406
|
for (const entry of registry2._idmap.entries()) {
|
|
12405
|
-
const [
|
|
12407
|
+
const [_2, schema] = entry;
|
|
12406
12408
|
process2(schema, ctx2);
|
|
12407
12409
|
}
|
|
12408
12410
|
const schemas = {};
|
|
@@ -12501,7 +12503,7 @@ var JSONSchemaGenerator = class {
|
|
|
12501
12503
|
}
|
|
12502
12504
|
extractDefs(this.ctx, schema);
|
|
12503
12505
|
const result = finalize(this.ctx, schema);
|
|
12504
|
-
const { "~standard":
|
|
12506
|
+
const { "~standard": _2, ...plainResult } = result;
|
|
12505
12507
|
return plainResult;
|
|
12506
12508
|
}
|
|
12507
12509
|
};
|
|
@@ -12836,12 +12838,12 @@ function _installLazyMethods(inst, group, methods) {
|
|
|
12836
12838
|
});
|
|
12837
12839
|
return bound;
|
|
12838
12840
|
},
|
|
12839
|
-
set(
|
|
12841
|
+
set(v2) {
|
|
12840
12842
|
Object.defineProperty(this, key, {
|
|
12841
12843
|
configurable: true,
|
|
12842
12844
|
writable: true,
|
|
12843
12845
|
enumerable: true,
|
|
12844
|
-
value:
|
|
12846
|
+
value: v2
|
|
12845
12847
|
});
|
|
12846
12848
|
}
|
|
12847
12849
|
});
|
|
@@ -13637,11 +13639,11 @@ function record(keyType, valueType, params) {
|
|
|
13637
13639
|
});
|
|
13638
13640
|
}
|
|
13639
13641
|
function partialRecord(keyType, valueType, params) {
|
|
13640
|
-
const
|
|
13641
|
-
|
|
13642
|
+
const k2 = clone(keyType);
|
|
13643
|
+
k2._zod.values = void 0;
|
|
13642
13644
|
return new ZodRecord({
|
|
13643
13645
|
type: "record",
|
|
13644
|
-
keyType:
|
|
13646
|
+
keyType: k2,
|
|
13645
13647
|
valueType,
|
|
13646
13648
|
...util_exports.normalizeParams(params)
|
|
13647
13649
|
});
|
|
@@ -13729,7 +13731,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
13729
13731
|
};
|
|
13730
13732
|
});
|
|
13731
13733
|
function _enum2(values, params) {
|
|
13732
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
13734
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
13733
13735
|
return new ZodEnum({
|
|
13734
13736
|
type: "enum",
|
|
13735
13737
|
entries,
|
|
@@ -14283,10 +14285,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
14283
14285
|
if (enumValues.length === 1) {
|
|
14284
14286
|
return z.literal(enumValues[0]);
|
|
14285
14287
|
}
|
|
14286
|
-
if (enumValues.every((
|
|
14288
|
+
if (enumValues.every((v2) => typeof v2 === "string")) {
|
|
14287
14289
|
return z.enum(enumValues);
|
|
14288
14290
|
}
|
|
14289
|
-
const literalSchemas = enumValues.map((
|
|
14291
|
+
const literalSchemas = enumValues.map((v2) => z.literal(v2));
|
|
14290
14292
|
if (literalSchemas.length < 2) {
|
|
14291
14293
|
return literalSchemas[0];
|
|
14292
14294
|
}
|
|
@@ -14526,12 +14528,12 @@ function convertSchema(schema, ctx) {
|
|
|
14526
14528
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
14527
14529
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
14528
14530
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
14529
|
-
const options = schema.anyOf.map((
|
|
14531
|
+
const options = schema.anyOf.map((s2) => convertSchema(s2, ctx));
|
|
14530
14532
|
const anyOfUnion = z.union(options);
|
|
14531
14533
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
14532
14534
|
}
|
|
14533
14535
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
14534
|
-
const options = schema.oneOf.map((
|
|
14536
|
+
const options = schema.oneOf.map((s2) => convertSchema(s2, ctx));
|
|
14535
14537
|
const oneOfUnion = z.xor(options);
|
|
14536
14538
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
14537
14539
|
}
|
|
@@ -14652,6 +14654,52 @@ function normalizeImageGenerationUrl(value) {
|
|
|
14652
14654
|
return url2.toString().replace(/\/+$/, "");
|
|
14653
14655
|
}
|
|
14654
14656
|
|
|
14657
|
+
// shared/bot-avatar.ts
|
|
14658
|
+
var BOT_AVATAR_CROPS = ["mascot", "circle", "rounded", "square"];
|
|
14659
|
+
var botAvatarCropSchema = external_exports.enum(BOT_AVATAR_CROPS);
|
|
14660
|
+
var botAvatarUrlSchema = external_exports.string().regex(
|
|
14661
|
+
/^\/api\/attachments\/[A-Za-z0-9-]+\.(?:png|jpg|gif|webp)$/,
|
|
14662
|
+
"must be a stored PNG, JPEG, GIF, or WebP attachment"
|
|
14663
|
+
);
|
|
14664
|
+
|
|
14665
|
+
// shared/bot-profile.ts
|
|
14666
|
+
var BOT_PROFILE_LIMITS = {
|
|
14667
|
+
name: 100,
|
|
14668
|
+
title: 200,
|
|
14669
|
+
description: 4e3,
|
|
14670
|
+
voice: 200,
|
|
14671
|
+
soul: 24e3
|
|
14672
|
+
};
|
|
14673
|
+
function fitsOnOneLine(value) {
|
|
14674
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
14675
|
+
const code = value.charCodeAt(i);
|
|
14676
|
+
if (code < 32 || code >= 127 && code <= 159 || code === 8232 || code === 8233) return false;
|
|
14677
|
+
}
|
|
14678
|
+
return true;
|
|
14679
|
+
}
|
|
14680
|
+
|
|
14681
|
+
// shared/mascot-bodies.ts
|
|
14682
|
+
var MASCOT_BODY_IDS = ["cursor", "blob", "circle", "squircle", "capsule", "drop", "shield", "hexagon", "diamond", "star"];
|
|
14683
|
+
var mascotBodySchema = external_exports.enum(MASCOT_BODY_IDS);
|
|
14684
|
+
|
|
14685
|
+
// server/bot-profile.ts
|
|
14686
|
+
var profilePatchSchema = external_exports.object({
|
|
14687
|
+
name: external_exports.string({ error: "name must be a string" }).max(BOT_PROFILE_LIMITS.name, { error: "name must be at most 100 characters" }).refine((value) => Boolean(value.trim()), { error: "name must not be empty" }).refine(fitsOnOneLine, { error: "name must fit on one line" }).optional(),
|
|
14688
|
+
title: external_exports.string({ error: "title must be a string" }).max(BOT_PROFILE_LIMITS.title, { error: "title must be at most 200 characters" }).refine(fitsOnOneLine, { error: "title must fit on one line" }).optional(),
|
|
14689
|
+
description: external_exports.string({ error: "description must be a string" }).max(BOT_PROFILE_LIMITS.description, { error: "description must be at most 4000 characters" }).optional(),
|
|
14690
|
+
soul: external_exports.string({ error: "soul must be a string" }).refine((value) => Buffer.byteLength(value, "utf8") <= BOT_PROFILE_LIMITS.soul, {
|
|
14691
|
+
error: "standing instructions must be at most 24000 bytes"
|
|
14692
|
+
}).optional(),
|
|
14693
|
+
notifications: external_exports.boolean({ error: "notifications must be true or false" }).optional(),
|
|
14694
|
+
avatarUrl: external_exports.union([botAvatarUrlSchema, external_exports.literal(""), external_exports.null()], {
|
|
14695
|
+
error: "avatarUrl must be a stored PNG, JPEG, GIF, or WebP attachment"
|
|
14696
|
+
}).optional(),
|
|
14697
|
+
avatarCrop: botAvatarCropSchema.optional(),
|
|
14698
|
+
mascotBody: mascotBodySchema.optional(),
|
|
14699
|
+
voice: external_exports.string({ error: "voice must be a string" }).max(BOT_PROFILE_LIMITS.voice, { error: "voice must be at most 200 characters" }).optional(),
|
|
14700
|
+
speakReplies: external_exports.boolean({ error: "speakReplies must be true or false" }).optional()
|
|
14701
|
+
});
|
|
14702
|
+
|
|
14655
14703
|
// shared/wire.ts
|
|
14656
14704
|
var EFFORT_LEVELS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
14657
14705
|
|
|
@@ -14660,6 +14708,815 @@ function isModelVariant(value) {
|
|
|
14660
14708
|
return typeof value === "string" && value.length > 0 && value.length <= 256 && value.trim() === value && !new RegExp("\\p{Cc}", "u").test(value);
|
|
14661
14709
|
}
|
|
14662
14710
|
|
|
14711
|
+
// node_modules/.pnpm/croner@10.0.1/node_modules/croner/dist/croner.js
|
|
14712
|
+
function T(s2) {
|
|
14713
|
+
return Date.UTC(s2.y, s2.m - 1, s2.d, s2.h, s2.i, s2.s);
|
|
14714
|
+
}
|
|
14715
|
+
function D(s2, e) {
|
|
14716
|
+
return s2.y === e.y && s2.m === e.m && s2.d === e.d && s2.h === e.h && s2.i === e.i && s2.s === e.s;
|
|
14717
|
+
}
|
|
14718
|
+
function A(s2, e) {
|
|
14719
|
+
let t = new Date(Date.parse(s2));
|
|
14720
|
+
if (isNaN(t)) throw new Error("Invalid ISO8601 passed to timezone parser.");
|
|
14721
|
+
let r = s2.substring(9);
|
|
14722
|
+
return r.includes("Z") || r.includes("+") || r.includes("-") ? b(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), "Etc/UTC") : b(t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), e);
|
|
14723
|
+
}
|
|
14724
|
+
function v(s2, e, t) {
|
|
14725
|
+
return k(A(s2, e), t);
|
|
14726
|
+
}
|
|
14727
|
+
function k(s2, e) {
|
|
14728
|
+
let t = new Date(T(s2)), r = g(t, s2.tz), n = T(s2), i = T(r), a = n - i, o = new Date(t.getTime() + a), h = g(o, s2.tz);
|
|
14729
|
+
if (D(h, s2)) {
|
|
14730
|
+
let u = new Date(o.getTime() - 36e5), d = g(u, s2.tz);
|
|
14731
|
+
return D(d, s2) ? u : o;
|
|
14732
|
+
}
|
|
14733
|
+
let l = new Date(o.getTime() + T(s2) - T(h)), y = g(l, s2.tz);
|
|
14734
|
+
if (D(y, s2)) return l;
|
|
14735
|
+
if (e) throw new Error("Invalid date passed to fromTZ()");
|
|
14736
|
+
return o.getTime() > l.getTime() ? o : l;
|
|
14737
|
+
}
|
|
14738
|
+
function g(s2, e) {
|
|
14739
|
+
let t, r;
|
|
14740
|
+
try {
|
|
14741
|
+
t = new Intl.DateTimeFormat("en-US", { timeZone: e, year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric", hour12: false }), r = t.formatToParts(s2);
|
|
14742
|
+
} catch (i) {
|
|
14743
|
+
let a = i instanceof Error ? i.message : String(i);
|
|
14744
|
+
throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`);
|
|
14745
|
+
}
|
|
14746
|
+
let n = { year: 0, month: 0, day: 0, hour: 0, minute: 0, second: 0 };
|
|
14747
|
+
for (let i of r) (i.type === "year" || i.type === "month" || i.type === "day" || i.type === "hour" || i.type === "minute" || i.type === "second") && (n[i.type] = parseInt(i.value, 10));
|
|
14748
|
+
if (isNaN(n.year) || isNaN(n.month) || isNaN(n.day) || isNaN(n.hour) || isNaN(n.minute) || isNaN(n.second)) throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);
|
|
14749
|
+
return n.hour === 24 && (n.hour = 0), { y: n.year, m: n.month, d: n.day, h: n.hour, i: n.minute, s: n.second, tz: e };
|
|
14750
|
+
}
|
|
14751
|
+
function b(s2, e, t, r, n, i, a) {
|
|
14752
|
+
return { y: s2, m: e, d: t, h: r, i: n, s: i, tz: a };
|
|
14753
|
+
}
|
|
14754
|
+
var O = [1, 2, 4, 8, 16];
|
|
14755
|
+
var C = class {
|
|
14756
|
+
pattern;
|
|
14757
|
+
timezone;
|
|
14758
|
+
mode;
|
|
14759
|
+
alternativeWeekdays;
|
|
14760
|
+
sloppyRanges;
|
|
14761
|
+
second;
|
|
14762
|
+
minute;
|
|
14763
|
+
hour;
|
|
14764
|
+
day;
|
|
14765
|
+
month;
|
|
14766
|
+
dayOfWeek;
|
|
14767
|
+
year;
|
|
14768
|
+
lastDayOfMonth;
|
|
14769
|
+
lastWeekday;
|
|
14770
|
+
nearestWeekdays;
|
|
14771
|
+
starDOM;
|
|
14772
|
+
starDOW;
|
|
14773
|
+
starYear;
|
|
14774
|
+
useAndLogic;
|
|
14775
|
+
constructor(e, t, r) {
|
|
14776
|
+
this.pattern = e, this.timezone = t, this.mode = r?.mode ?? "auto", this.alternativeWeekdays = r?.alternativeWeekdays ?? false, this.sloppyRanges = r?.sloppyRanges ?? false, this.second = Array(60).fill(0), this.minute = Array(60).fill(0), this.hour = Array(24).fill(0), this.day = Array(31).fill(0), this.month = Array(12).fill(0), this.dayOfWeek = Array(7).fill(0), this.year = Array(1e4).fill(0), this.lastDayOfMonth = false, this.lastWeekday = false, this.nearestWeekdays = Array(31).fill(0), this.starDOM = false, this.starDOW = false, this.starYear = false, this.useAndLogic = false, this.parse();
|
|
14777
|
+
}
|
|
14778
|
+
parse() {
|
|
14779
|
+
if (!(typeof this.pattern == "string" || this.pattern instanceof String)) throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
14780
|
+
this.pattern.indexOf("@") >= 0 && (this.pattern = this.handleNicknames(this.pattern).trim());
|
|
14781
|
+
let e = this.pattern.match(/\S+/g) || [""], t = e.length;
|
|
14782
|
+
if (e.length < 5 || e.length > 7) throw new TypeError("CronPattern: invalid configuration format ('" + this.pattern + "'), exactly five, six, or seven space separated parts are required.");
|
|
14783
|
+
if (this.mode !== "auto") {
|
|
14784
|
+
let n;
|
|
14785
|
+
switch (this.mode) {
|
|
14786
|
+
case "5-part":
|
|
14787
|
+
n = 5;
|
|
14788
|
+
break;
|
|
14789
|
+
case "6-part":
|
|
14790
|
+
n = 6;
|
|
14791
|
+
break;
|
|
14792
|
+
case "7-part":
|
|
14793
|
+
n = 7;
|
|
14794
|
+
break;
|
|
14795
|
+
case "5-or-6-parts":
|
|
14796
|
+
n = [5, 6];
|
|
14797
|
+
break;
|
|
14798
|
+
case "6-or-7-parts":
|
|
14799
|
+
n = [6, 7];
|
|
14800
|
+
break;
|
|
14801
|
+
default:
|
|
14802
|
+
n = 0;
|
|
14803
|
+
}
|
|
14804
|
+
if (!(Array.isArray(n) ? n.includes(t) : t === n)) {
|
|
14805
|
+
let a = Array.isArray(n) ? n.join(" or ") : n.toString();
|
|
14806
|
+
throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`);
|
|
14807
|
+
}
|
|
14808
|
+
}
|
|
14809
|
+
if (e.length === 5 && e.unshift("0"), e.length === 6 && e.push("*"), e[3].toUpperCase() === "LW" ? (this.lastWeekday = true, e[3] = "") : e[3].toUpperCase().indexOf("L") >= 0 && (e[3] = e[3].replace(/L/gi, ""), this.lastDayOfMonth = true), e[3] == "*" && (this.starDOM = true), e[6] == "*" && (this.starYear = true), e[4].length >= 3 && (e[4] = this.replaceAlphaMonths(e[4])), e[5].length >= 3 && (e[5] = this.alternativeWeekdays ? this.replaceAlphaDaysQuartz(e[5]) : this.replaceAlphaDays(e[5])), e[5].startsWith("+") && (this.useAndLogic = true, e[5] = e[5].substring(1), e[5] === "")) throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");
|
|
14810
|
+
switch (e[5] == "*" && (this.starDOW = true), this.pattern.indexOf("?") >= 0 && (e[0] = e[0].replace(/\?/g, "*"), e[1] = e[1].replace(/\?/g, "*"), e[2] = e[2].replace(/\?/g, "*"), e[3] = e[3].replace(/\?/g, "*"), e[4] = e[4].replace(/\?/g, "*"), e[5] = e[5].replace(/\?/g, "*"), e[6] && (e[6] = e[6].replace(/\?/g, "*"))), this.mode) {
|
|
14811
|
+
case "5-part":
|
|
14812
|
+
e[0] = "0", e[6] = "*";
|
|
14813
|
+
break;
|
|
14814
|
+
case "6-part":
|
|
14815
|
+
e[6] = "*";
|
|
14816
|
+
break;
|
|
14817
|
+
case "5-or-6-parts":
|
|
14818
|
+
e[6] = "*";
|
|
14819
|
+
break;
|
|
14820
|
+
case "6-or-7-parts":
|
|
14821
|
+
break;
|
|
14822
|
+
case "7-part":
|
|
14823
|
+
case "auto":
|
|
14824
|
+
break;
|
|
14825
|
+
}
|
|
14826
|
+
this.throwAtIllegalCharacters(e), this.partToArray("second", e[0], 0, 1), this.partToArray("minute", e[1], 0, 1), this.partToArray("hour", e[2], 0, 1), this.partToArray("day", e[3], -1, 1), this.partToArray("month", e[4], -1, 1);
|
|
14827
|
+
let r = this.alternativeWeekdays ? -1 : 0;
|
|
14828
|
+
this.partToArray("dayOfWeek", e[5], r, 63), this.partToArray("year", e[6], 0, 1), !this.alternativeWeekdays && this.dayOfWeek[7] && (this.dayOfWeek[0] = this.dayOfWeek[7]);
|
|
14829
|
+
}
|
|
14830
|
+
partToArray(e, t, r, n) {
|
|
14831
|
+
let i = this[e], a = e === "day" && this.lastDayOfMonth, o = e === "day" && this.lastWeekday;
|
|
14832
|
+
if (t === "" && !a && !o) throw new TypeError("CronPattern: configuration entry " + e + " (" + t + ") is empty, check for trailing spaces.");
|
|
14833
|
+
if (t === "*") return i.fill(n);
|
|
14834
|
+
let h = t.split(",");
|
|
14835
|
+
if (h.length > 1) for (let l = 0; l < h.length; l++) this.partToArray(e, h[l], r, n);
|
|
14836
|
+
else t.indexOf("-") !== -1 && t.indexOf("/") !== -1 ? this.handleRangeWithStepping(t, e, r, n) : t.indexOf("-") !== -1 ? this.handleRange(t, e, r, n) : t.indexOf("/") !== -1 ? this.handleStepping(t, e, r, n) : t !== "" && this.handleNumber(t, e, r, n);
|
|
14837
|
+
}
|
|
14838
|
+
throwAtIllegalCharacters(e) {
|
|
14839
|
+
for (let t = 0; t < e.length; t++) if ((t === 3 ? /[^/*0-9,\-WwLl]+/ : t === 5 ? /[^/*0-9,\-#Ll]+/ : /[^/*0-9,\-]+/).test(e[t])) throw new TypeError("CronPattern: configuration entry " + t + " (" + e[t] + ") contains illegal characters.");
|
|
14840
|
+
}
|
|
14841
|
+
handleNumber(e, t, r, n) {
|
|
14842
|
+
let i = this.extractNth(e, t), a = e.toUpperCase().includes("W");
|
|
14843
|
+
if (t !== "day" && a) throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");
|
|
14844
|
+
a && (t = "nearestWeekdays");
|
|
14845
|
+
let o = parseInt(i[0], 10) + r;
|
|
14846
|
+
if (isNaN(o)) throw new TypeError("CronPattern: " + t + " is not a number: '" + e + "'");
|
|
14847
|
+
this.setPart(t, o, i[1] || n);
|
|
14848
|
+
}
|
|
14849
|
+
setPart(e, t, r) {
|
|
14850
|
+
if (!Object.prototype.hasOwnProperty.call(this, e)) throw new TypeError("CronPattern: Invalid part specified: " + e);
|
|
14851
|
+
if (e === "dayOfWeek") {
|
|
14852
|
+
if (t === 7 && (t = 0), t < 0 || t > 6) throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + t);
|
|
14853
|
+
this.setNthWeekdayOfMonth(t, r);
|
|
14854
|
+
return;
|
|
14855
|
+
}
|
|
14856
|
+
if (e === "second" || e === "minute") {
|
|
14857
|
+
if (t < 0 || t >= 60) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
14858
|
+
} else if (e === "hour") {
|
|
14859
|
+
if (t < 0 || t >= 24) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
14860
|
+
} else if (e === "day" || e === "nearestWeekdays") {
|
|
14861
|
+
if (t < 0 || t >= 31) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
14862
|
+
} else if (e === "month") {
|
|
14863
|
+
if (t < 0 || t >= 12) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
14864
|
+
} else if (e === "year" && (t < 1 || t >= 1e4)) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t + " (supported range: 1-9999)");
|
|
14865
|
+
this[e][t] = r;
|
|
14866
|
+
}
|
|
14867
|
+
validateNotNaN(e, t) {
|
|
14868
|
+
if (isNaN(e)) throw new TypeError(t);
|
|
14869
|
+
}
|
|
14870
|
+
validateRange(e, t, r, n, i) {
|
|
14871
|
+
if (e > t) throw new TypeError("CronPattern: From value is larger than to value: '" + i + "'");
|
|
14872
|
+
if (r !== void 0) {
|
|
14873
|
+
if (r === 0) throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
|
|
14874
|
+
if (r > this[n].length) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[n].length + ")");
|
|
14875
|
+
}
|
|
14876
|
+
}
|
|
14877
|
+
handleRangeWithStepping(e, t, r, n) {
|
|
14878
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");
|
|
14879
|
+
let i = this.extractNth(e, t), a = i[0].match(/^(\d+)-(\d+)\/(\d+)$/);
|
|
14880
|
+
if (a === null) throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + e + "'");
|
|
14881
|
+
let [, o, h, l] = a, y = parseInt(o, 10) + r, u = parseInt(h, 10) + r, d = parseInt(l, 10);
|
|
14882
|
+
this.validateNotNaN(y, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(u, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateNotNaN(d, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(y, u, d, t, e);
|
|
14883
|
+
for (let c = y; c <= u; c += d) this.setPart(t, c, i[1] || n);
|
|
14884
|
+
}
|
|
14885
|
+
extractNth(e, t) {
|
|
14886
|
+
let r = e, n;
|
|
14887
|
+
if (r.includes("#")) {
|
|
14888
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
|
|
14889
|
+
n = r.split("#")[1], r = r.split("#")[0];
|
|
14890
|
+
} else if (r.toUpperCase().endsWith("L")) {
|
|
14891
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");
|
|
14892
|
+
n = "L", r = r.slice(0, -1);
|
|
14893
|
+
}
|
|
14894
|
+
return [r, n];
|
|
14895
|
+
}
|
|
14896
|
+
handleRange(e, t, r, n) {
|
|
14897
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");
|
|
14898
|
+
let i = this.extractNth(e, t), a = i[0].split("-");
|
|
14899
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal range: '" + e + "'");
|
|
14900
|
+
let o = parseInt(a[0], 10) + r, h = parseInt(a[1], 10) + r;
|
|
14901
|
+
this.validateNotNaN(o, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(h, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateRange(o, h, void 0, t, e);
|
|
14902
|
+
for (let l = o; l <= h; l++) this.setPart(t, l, i[1] || n);
|
|
14903
|
+
}
|
|
14904
|
+
handleStepping(e, t, r, n) {
|
|
14905
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");
|
|
14906
|
+
let i = this.extractNth(e, t), a = i[0].split("/");
|
|
14907
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + e + "'");
|
|
14908
|
+
if (this.sloppyRanges) a[0] === "" && (a[0] = "*");
|
|
14909
|
+
else {
|
|
14910
|
+
if (a[0] === "") throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
|
|
14911
|
+
if (a[0] !== "*") throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
|
|
14912
|
+
}
|
|
14913
|
+
let o = 0;
|
|
14914
|
+
a[0] !== "*" && (o = parseInt(a[0], 10) + r);
|
|
14915
|
+
let h = parseInt(a[1], 10);
|
|
14916
|
+
this.validateNotNaN(h, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(0, this[t].length - 1, h, t, e);
|
|
14917
|
+
for (let l = o; l < this[t].length; l += h) this.setPart(t, l, i[1] || n);
|
|
14918
|
+
}
|
|
14919
|
+
replaceAlphaDays(e) {
|
|
14920
|
+
return e.replace(/-sun/gi, "-7").replace(/sun/gi, "0").replace(/mon/gi, "1").replace(/tue/gi, "2").replace(/wed/gi, "3").replace(/thu/gi, "4").replace(/fri/gi, "5").replace(/sat/gi, "6");
|
|
14921
|
+
}
|
|
14922
|
+
replaceAlphaDaysQuartz(e) {
|
|
14923
|
+
return e.replace(/sun/gi, "1").replace(/mon/gi, "2").replace(/tue/gi, "3").replace(/wed/gi, "4").replace(/thu/gi, "5").replace(/fri/gi, "6").replace(/sat/gi, "7");
|
|
14924
|
+
}
|
|
14925
|
+
replaceAlphaMonths(e) {
|
|
14926
|
+
return e.replace(/jan/gi, "1").replace(/feb/gi, "2").replace(/mar/gi, "3").replace(/apr/gi, "4").replace(/may/gi, "5").replace(/jun/gi, "6").replace(/jul/gi, "7").replace(/aug/gi, "8").replace(/sep/gi, "9").replace(/oct/gi, "10").replace(/nov/gi, "11").replace(/dec/gi, "12");
|
|
14927
|
+
}
|
|
14928
|
+
handleNicknames(e) {
|
|
14929
|
+
let t = e.trim().toLowerCase();
|
|
14930
|
+
if (t === "@yearly" || t === "@annually") return "0 0 1 1 *";
|
|
14931
|
+
if (t === "@monthly") return "0 0 1 * *";
|
|
14932
|
+
if (t === "@weekly") return "0 0 * * 0";
|
|
14933
|
+
if (t === "@daily" || t === "@midnight") return "0 0 * * *";
|
|
14934
|
+
if (t === "@hourly") return "0 * * * *";
|
|
14935
|
+
if (t === "@reboot") throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");
|
|
14936
|
+
return e;
|
|
14937
|
+
}
|
|
14938
|
+
setNthWeekdayOfMonth(e, t) {
|
|
14939
|
+
if (typeof t != "number" && t.toUpperCase() === "L") this.dayOfWeek[e] = this.dayOfWeek[e] | 32;
|
|
14940
|
+
else if (t === 63) this.dayOfWeek[e] = 63;
|
|
14941
|
+
else if (t < 6 && t > 0) this.dayOfWeek[e] = this.dayOfWeek[e] | O[t - 1];
|
|
14942
|
+
else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`);
|
|
14943
|
+
}
|
|
14944
|
+
};
|
|
14945
|
+
var P = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
14946
|
+
var f = [["month", "year", 0], ["day", "month", -1], ["hour", "day", 0], ["minute", "hour", 0], ["second", "minute", 0]];
|
|
14947
|
+
var m = class s {
|
|
14948
|
+
tz;
|
|
14949
|
+
ms;
|
|
14950
|
+
second;
|
|
14951
|
+
minute;
|
|
14952
|
+
hour;
|
|
14953
|
+
day;
|
|
14954
|
+
month;
|
|
14955
|
+
year;
|
|
14956
|
+
constructor(e, t) {
|
|
14957
|
+
if (this.tz = t, e && e instanceof Date) if (!isNaN(e)) this.fromDate(e);
|
|
14958
|
+
else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
14959
|
+
else if (e == null) this.fromDate(/* @__PURE__ */ new Date());
|
|
14960
|
+
else if (e && typeof e == "string") this.fromString(e);
|
|
14961
|
+
else if (e instanceof s) this.fromCronDate(e);
|
|
14962
|
+
else throw new TypeError("CronDate: Invalid type (" + typeof e + ") passed to CronDate constructor");
|
|
14963
|
+
}
|
|
14964
|
+
getLastDayOfMonth(e, t) {
|
|
14965
|
+
return t !== 1 ? P[t] : new Date(Date.UTC(e, t + 1, 0)).getUTCDate();
|
|
14966
|
+
}
|
|
14967
|
+
getLastWeekday(e, t) {
|
|
14968
|
+
let r = this.getLastDayOfMonth(e, t), i = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
14969
|
+
return i === 0 ? r - 2 : i === 6 ? r - 1 : r;
|
|
14970
|
+
}
|
|
14971
|
+
getNearestWeekday(e, t, r) {
|
|
14972
|
+
let n = this.getLastDayOfMonth(e, t);
|
|
14973
|
+
if (r > n) return -1;
|
|
14974
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
14975
|
+
return a === 0 ? r === n ? r - 2 : r + 1 : a === 6 ? r === 1 ? r + 2 : r - 1 : r;
|
|
14976
|
+
}
|
|
14977
|
+
isNthWeekdayOfMonth(e, t, r, n) {
|
|
14978
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay(), o = 0;
|
|
14979
|
+
for (let h = 1; h <= r; h++) new Date(Date.UTC(e, t, h)).getUTCDay() === a && o++;
|
|
14980
|
+
if (n & 63 && O[o - 1] & n) return true;
|
|
14981
|
+
if (n & 32) {
|
|
14982
|
+
let h = this.getLastDayOfMonth(e, t);
|
|
14983
|
+
for (let l = r + 1; l <= h; l++) if (new Date(Date.UTC(e, t, l)).getUTCDay() === a) return false;
|
|
14984
|
+
return true;
|
|
14985
|
+
}
|
|
14986
|
+
return false;
|
|
14987
|
+
}
|
|
14988
|
+
fromDate(e) {
|
|
14989
|
+
if (this.tz !== void 0) if (typeof this.tz == "number") this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes() + this.tz, this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), this.apply();
|
|
14990
|
+
else try {
|
|
14991
|
+
let t = g(e, this.tz);
|
|
14992
|
+
this.ms = e.getMilliseconds(), this.second = t.s, this.minute = t.i, this.hour = t.h, this.day = t.d, this.month = t.m - 1, this.year = t.y;
|
|
14993
|
+
} catch (t) {
|
|
14994
|
+
let r = t instanceof Error ? t.message : String(t);
|
|
14995
|
+
throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${r}`);
|
|
14996
|
+
}
|
|
14997
|
+
else this.ms = e.getMilliseconds(), this.second = e.getSeconds(), this.minute = e.getMinutes(), this.hour = e.getHours(), this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear();
|
|
14998
|
+
}
|
|
14999
|
+
fromCronDate(e) {
|
|
15000
|
+
this.tz = e.tz, this.year = e.year, this.month = e.month, this.day = e.day, this.hour = e.hour, this.minute = e.minute, this.second = e.second, this.ms = e.ms;
|
|
15001
|
+
}
|
|
15002
|
+
apply() {
|
|
15003
|
+
if (this.month > 11 || this.month < 0 || this.day > P[this.month] || this.day < 1 || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
|
|
15004
|
+
let e = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
15005
|
+
return this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes(), this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), true;
|
|
15006
|
+
} else return false;
|
|
15007
|
+
}
|
|
15008
|
+
fromString(e) {
|
|
15009
|
+
if (typeof this.tz == "number") {
|
|
15010
|
+
let t = v(e);
|
|
15011
|
+
this.ms = t.getUTCMilliseconds(), this.second = t.getUTCSeconds(), this.minute = t.getUTCMinutes(), this.hour = t.getUTCHours(), this.day = t.getUTCDate(), this.month = t.getUTCMonth(), this.year = t.getUTCFullYear(), this.apply();
|
|
15012
|
+
} else return this.fromDate(v(e, this.tz));
|
|
15013
|
+
}
|
|
15014
|
+
findNext(e, t, r, n) {
|
|
15015
|
+
return this._findMatch(e, t, r, n, 1);
|
|
15016
|
+
}
|
|
15017
|
+
_findMatch(e, t, r, n, i) {
|
|
15018
|
+
let a = this[t], o;
|
|
15019
|
+
r.lastDayOfMonth && (o = this.getLastDayOfMonth(this.year, this.month));
|
|
15020
|
+
let h = !r.starDOW && t == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0, l = this[t] + n, y = i === 1 ? (u) => u < r[t].length : (u) => u >= 0;
|
|
15021
|
+
for (let u = l; y(u); u += i) {
|
|
15022
|
+
let d = r[t][u];
|
|
15023
|
+
if (t === "day" && !d) {
|
|
15024
|
+
for (let c = 0; c < r.nearestWeekdays.length; c++) if (r.nearestWeekdays[c]) {
|
|
15025
|
+
let M = this.getNearestWeekday(this.year, this.month, c - n);
|
|
15026
|
+
if (M === -1) continue;
|
|
15027
|
+
if (M === u - n) {
|
|
15028
|
+
d = 1;
|
|
15029
|
+
break;
|
|
15030
|
+
}
|
|
15031
|
+
}
|
|
15032
|
+
}
|
|
15033
|
+
if (t === "day" && r.lastWeekday) {
|
|
15034
|
+
let c = this.getLastWeekday(this.year, this.month);
|
|
15035
|
+
u - n === c && (d = 1);
|
|
15036
|
+
}
|
|
15037
|
+
if (t === "day" && r.lastDayOfMonth && u - n == o && (d = 1), t === "day" && !r.starDOW) {
|
|
15038
|
+
let c = r.dayOfWeek[(h + (u - n - 1)) % 7];
|
|
15039
|
+
if (c && c & 63) c = this.isNthWeekdayOfMonth(this.year, this.month, u - n, c) ? 1 : 0;
|
|
15040
|
+
else if (c) throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);
|
|
15041
|
+
r.useAndLogic ? d = d && c : !e.domAndDow && !r.starDOM ? d = d || c : d = d && c;
|
|
15042
|
+
}
|
|
15043
|
+
if (d) return this[t] = u - n, a !== this[t] ? 2 : 1;
|
|
15044
|
+
}
|
|
15045
|
+
return 3;
|
|
15046
|
+
}
|
|
15047
|
+
recurse(e, t, r) {
|
|
15048
|
+
if (r === 0 && !e.starYear) {
|
|
15049
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
15050
|
+
let i = -1;
|
|
15051
|
+
for (let a = this.year + 1; a < e.year.length && a < 1e4; a++) if (e.year[a] === 1) {
|
|
15052
|
+
i = a;
|
|
15053
|
+
break;
|
|
15054
|
+
}
|
|
15055
|
+
if (i === -1) return null;
|
|
15056
|
+
this.year = i, this.month = 0, this.day = 1, this.hour = 0, this.minute = 0, this.second = 0, this.ms = 0;
|
|
15057
|
+
}
|
|
15058
|
+
if (this.year >= 1e4) return null;
|
|
15059
|
+
}
|
|
15060
|
+
let n = this.findNext(t, f[r][0], e, f[r][2]);
|
|
15061
|
+
if (n > 1) {
|
|
15062
|
+
let i = r + 1;
|
|
15063
|
+
for (; i < f.length; ) this[f[i][0]] = -f[i][2], i++;
|
|
15064
|
+
if (n === 3) {
|
|
15065
|
+
if (this[f[r][1]]++, this[f[r][0]] = -f[r][2], this.apply(), r === 0 && !e.starYear) {
|
|
15066
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0 && this.year < 1e4; ) this.year++;
|
|
15067
|
+
if (this.year >= 1e4 || this.year >= e.year.length) return null;
|
|
15068
|
+
}
|
|
15069
|
+
return this.recurse(e, t, 0);
|
|
15070
|
+
} else if (this.apply()) return this.recurse(e, t, r - 1);
|
|
15071
|
+
}
|
|
15072
|
+
return r += 1, r >= f.length ? this : (e.starYear ? this.year >= 3e3 : this.year >= 1e4) ? null : this.recurse(e, t, r);
|
|
15073
|
+
}
|
|
15074
|
+
increment(e, t, r) {
|
|
15075
|
+
return this.second += t.interval !== void 0 && t.interval > 1 && r ? t.interval : 1, this.ms = 0, this.apply(), this.recurse(e, t, 0);
|
|
15076
|
+
}
|
|
15077
|
+
decrement(e, t) {
|
|
15078
|
+
return this.second -= t.interval !== void 0 && t.interval > 1 ? t.interval : 1, this.ms = 0, this.apply(), this.recurseBackward(e, t, 0, 0);
|
|
15079
|
+
}
|
|
15080
|
+
recurseBackward(e, t, r, n = 0) {
|
|
15081
|
+
if (n > 1e4) return null;
|
|
15082
|
+
if (r === 0 && !e.starYear) {
|
|
15083
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
15084
|
+
let a = -1;
|
|
15085
|
+
for (let o = this.year - 1; o >= 0; o--) if (e.year[o] === 1) {
|
|
15086
|
+
a = o;
|
|
15087
|
+
break;
|
|
15088
|
+
}
|
|
15089
|
+
if (a === -1) return null;
|
|
15090
|
+
this.year = a, this.month = 11, this.day = 31, this.hour = 23, this.minute = 59, this.second = 59, this.ms = 0;
|
|
15091
|
+
}
|
|
15092
|
+
if (this.year < 0) return null;
|
|
15093
|
+
}
|
|
15094
|
+
let i = this.findPrevious(t, f[r][0], e, f[r][2]);
|
|
15095
|
+
if (i > 1) {
|
|
15096
|
+
let a = r + 1;
|
|
15097
|
+
for (; a < f.length; ) {
|
|
15098
|
+
let o = f[a][0], h = f[a][2], l = this.getMaxPatternValue(o, e, h);
|
|
15099
|
+
this[o] = l, a++;
|
|
15100
|
+
}
|
|
15101
|
+
if (i === 3) {
|
|
15102
|
+
if (this[f[r][1]]--, r === 0) {
|
|
15103
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
15104
|
+
this.day > y && (this.day = y);
|
|
15105
|
+
}
|
|
15106
|
+
if (r === 1) if (this.day <= 0) this.day = 1;
|
|
15107
|
+
else {
|
|
15108
|
+
let y = this.year, u = this.month;
|
|
15109
|
+
for (; u < 0; ) u += 12, y--;
|
|
15110
|
+
for (; u > 11; ) u -= 12, y++;
|
|
15111
|
+
let d = u !== 1 ? P[u] : new Date(Date.UTC(y, u + 1, 0)).getUTCDate();
|
|
15112
|
+
this.day > d && (this.day = d);
|
|
15113
|
+
}
|
|
15114
|
+
this.apply();
|
|
15115
|
+
let o = f[r][0], h = f[r][2], l = this.getMaxPatternValue(o, e, h);
|
|
15116
|
+
if (o === "day") {
|
|
15117
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
15118
|
+
this[o] = Math.min(l, y);
|
|
15119
|
+
} else this[o] = l;
|
|
15120
|
+
if (this.apply(), r === 0) {
|
|
15121
|
+
let y = f[1][2], u = this.getMaxPatternValue("day", e, y), d = this.getLastDayOfMonth(this.year, this.month), c = Math.min(u, d);
|
|
15122
|
+
c !== this.day && (this.day = c, this.hour = this.getMaxPatternValue("hour", e, f[2][2]), this.minute = this.getMaxPatternValue("minute", e, f[3][2]), this.second = this.getMaxPatternValue("second", e, f[4][2]));
|
|
15123
|
+
}
|
|
15124
|
+
if (r === 0 && !e.starYear) {
|
|
15125
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0; ) this.year--;
|
|
15126
|
+
if (this.year < 0) return null;
|
|
15127
|
+
}
|
|
15128
|
+
return this.recurseBackward(e, t, 0, n + 1);
|
|
15129
|
+
} else if (this.apply()) return this.recurseBackward(e, t, r - 1, n + 1);
|
|
15130
|
+
}
|
|
15131
|
+
return r += 1, r >= f.length ? this : this.year < 0 ? null : this.recurseBackward(e, t, r, n + 1);
|
|
15132
|
+
}
|
|
15133
|
+
getMaxPatternValue(e, t, r) {
|
|
15134
|
+
if (e === "day" && t.lastDayOfMonth) return this.getLastDayOfMonth(this.year, this.month);
|
|
15135
|
+
if (e === "day" && !t.starDOW) return this.getLastDayOfMonth(this.year, this.month);
|
|
15136
|
+
for (let n = t[e].length - 1; n >= 0; n--) if (t[e][n]) return n - r;
|
|
15137
|
+
return t[e].length - 1 - r;
|
|
15138
|
+
}
|
|
15139
|
+
findPrevious(e, t, r, n) {
|
|
15140
|
+
return this._findMatch(e, t, r, n, -1);
|
|
15141
|
+
}
|
|
15142
|
+
getDate(e) {
|
|
15143
|
+
return e || this.tz === void 0 ? new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms) : typeof this.tz == "number" ? new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms)) : k(b(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz), false);
|
|
15144
|
+
}
|
|
15145
|
+
getTime() {
|
|
15146
|
+
return this.getDate(false).getTime();
|
|
15147
|
+
}
|
|
15148
|
+
match(e, t) {
|
|
15149
|
+
if (!e.starYear && (this.year < 0 || this.year >= e.year.length || e.year[this.year] === 0)) return false;
|
|
15150
|
+
for (let r = 0; r < f.length; r++) {
|
|
15151
|
+
let n = f[r][0], i = f[r][2], a = this[n];
|
|
15152
|
+
if (a + i < 0 || a + i >= e[n].length) return false;
|
|
15153
|
+
let o = e[n][a + i];
|
|
15154
|
+
if (n === "day") {
|
|
15155
|
+
if (!o) {
|
|
15156
|
+
for (let h = 0; h < e.nearestWeekdays.length; h++) if (e.nearestWeekdays[h]) {
|
|
15157
|
+
let l = this.getNearestWeekday(this.year, this.month, h - i);
|
|
15158
|
+
if (l !== -1 && l === a) {
|
|
15159
|
+
o = 1;
|
|
15160
|
+
break;
|
|
15161
|
+
}
|
|
15162
|
+
}
|
|
15163
|
+
}
|
|
15164
|
+
if (e.lastWeekday) {
|
|
15165
|
+
let h = this.getLastWeekday(this.year, this.month);
|
|
15166
|
+
a === h && (o = 1);
|
|
15167
|
+
}
|
|
15168
|
+
if (e.lastDayOfMonth) {
|
|
15169
|
+
let h = this.getLastDayOfMonth(this.year, this.month);
|
|
15170
|
+
a === h && (o = 1);
|
|
15171
|
+
}
|
|
15172
|
+
if (!e.starDOW) {
|
|
15173
|
+
let h = new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay(), l = e.dayOfWeek[(h + (a - 1)) % 7];
|
|
15174
|
+
l && l & 63 && (l = this.isNthWeekdayOfMonth(this.year, this.month, a, l) ? 1 : 0), e.useAndLogic ? o = o && l : !t.domAndDow && !e.starDOM ? o = o || l : o = o && l;
|
|
15175
|
+
}
|
|
15176
|
+
}
|
|
15177
|
+
if (!o) return false;
|
|
15178
|
+
}
|
|
15179
|
+
return true;
|
|
15180
|
+
}
|
|
15181
|
+
};
|
|
15182
|
+
function R(s2) {
|
|
15183
|
+
if (s2 === void 0 && (s2 = {}), delete s2.name, s2.legacyMode !== void 0 && s2.domAndDow === void 0 ? s2.domAndDow = !s2.legacyMode : s2.domAndDow === void 0 && (s2.domAndDow = false), s2.legacyMode = !s2.domAndDow, s2.paused = s2.paused === void 0 ? false : s2.paused, s2.maxRuns = s2.maxRuns === void 0 ? 1 / 0 : s2.maxRuns, s2.catch = s2.catch === void 0 ? false : s2.catch, s2.interval = s2.interval === void 0 ? 0 : parseInt(s2.interval.toString(), 10), s2.utcOffset = s2.utcOffset === void 0 ? void 0 : parseInt(s2.utcOffset.toString(), 10), s2.dayOffset = s2.dayOffset === void 0 ? 0 : parseInt(s2.dayOffset.toString(), 10), s2.unref = s2.unref === void 0 ? false : s2.unref, s2.mode = s2.mode === void 0 ? "auto" : s2.mode, s2.alternativeWeekdays = s2.alternativeWeekdays === void 0 ? false : s2.alternativeWeekdays, s2.sloppyRanges = s2.sloppyRanges === void 0 ? false : s2.sloppyRanges, !["auto", "5-part", "6-part", "7-part", "5-or-6-parts", "6-or-7-parts"].includes(s2.mode)) throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");
|
|
15184
|
+
if (s2.startAt && (s2.startAt = new m(s2.startAt, s2.timezone)), s2.stopAt && (s2.stopAt = new m(s2.stopAt, s2.timezone)), s2.interval !== null) {
|
|
15185
|
+
if (isNaN(s2.interval)) throw new Error("CronOptions: Supplied value for interval is not a number");
|
|
15186
|
+
if (s2.interval < 0) throw new Error("CronOptions: Supplied value for interval can not be negative");
|
|
15187
|
+
}
|
|
15188
|
+
if (s2.utcOffset !== void 0) {
|
|
15189
|
+
if (isNaN(s2.utcOffset)) throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
|
|
15190
|
+
if (s2.utcOffset < -870 || s2.utcOffset > 870) throw new Error("CronOptions: utcOffset out of bounds.");
|
|
15191
|
+
if (s2.utcOffset !== void 0 && s2.timezone) throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
|
|
15192
|
+
}
|
|
15193
|
+
if (s2.unref !== true && s2.unref !== false) throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
|
|
15194
|
+
if (s2.dayOffset !== void 0 && s2.dayOffset !== 0 && isNaN(s2.dayOffset)) throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");
|
|
15195
|
+
return s2;
|
|
15196
|
+
}
|
|
15197
|
+
function p(s2) {
|
|
15198
|
+
return Object.prototype.toString.call(s2) === "[object Function]" || typeof s2 == "function" || s2 instanceof Function;
|
|
15199
|
+
}
|
|
15200
|
+
function _(s2) {
|
|
15201
|
+
return p(s2);
|
|
15202
|
+
}
|
|
15203
|
+
function x(s2) {
|
|
15204
|
+
typeof Deno < "u" && typeof Deno.unrefTimer < "u" ? Deno.unrefTimer(s2) : s2 && typeof s2.unref < "u" && s2.unref();
|
|
15205
|
+
}
|
|
15206
|
+
var W = 30 * 1e3;
|
|
15207
|
+
var w = [];
|
|
15208
|
+
var E = class {
|
|
15209
|
+
name;
|
|
15210
|
+
options;
|
|
15211
|
+
_states;
|
|
15212
|
+
fn;
|
|
15213
|
+
getTz() {
|
|
15214
|
+
return this.options.timezone || this.options.utcOffset;
|
|
15215
|
+
}
|
|
15216
|
+
applyDayOffset(e) {
|
|
15217
|
+
if (this.options.dayOffset !== void 0 && this.options.dayOffset !== 0) {
|
|
15218
|
+
let t = this.options.dayOffset * 24 * 60 * 60 * 1e3;
|
|
15219
|
+
return new Date(e.getTime() + t);
|
|
15220
|
+
}
|
|
15221
|
+
return e;
|
|
15222
|
+
}
|
|
15223
|
+
constructor(e, t, r) {
|
|
15224
|
+
let n, i;
|
|
15225
|
+
if (p(t)) i = t;
|
|
15226
|
+
else if (typeof t == "object") n = t;
|
|
15227
|
+
else if (t !== void 0) throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
|
|
15228
|
+
if (p(r)) i = r;
|
|
15229
|
+
else if (typeof r == "object") n = r;
|
|
15230
|
+
else if (r !== void 0) throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
|
|
15231
|
+
if (this.name = n?.name, this.options = R(n), this._states = { kill: false, blocking: false, previousRun: void 0, currentRun: void 0, once: void 0, currentTimeout: void 0, maxRuns: n ? n.maxRuns : void 0, paused: n ? n.paused : false, pattern: new C("* * * * *", void 0, { mode: "auto" }) }, e && (e instanceof Date || typeof e == "string" && e.indexOf(":") > 0) ? this._states.once = new m(e, this.getTz()) : this._states.pattern = new C(e, this.options.timezone, { mode: this.options.mode, alternativeWeekdays: this.options.alternativeWeekdays, sloppyRanges: this.options.sloppyRanges }), this.name) {
|
|
15232
|
+
if (w.find((o) => o.name === this.name)) throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
|
|
15233
|
+
w.push(this);
|
|
15234
|
+
}
|
|
15235
|
+
return i !== void 0 && _(i) && (this.fn = i, this.schedule()), this;
|
|
15236
|
+
}
|
|
15237
|
+
nextRun(e) {
|
|
15238
|
+
let t = this._next(e);
|
|
15239
|
+
return t ? this.applyDayOffset(t.getDate(false)) : null;
|
|
15240
|
+
}
|
|
15241
|
+
nextRuns(e, t) {
|
|
15242
|
+
this._states.maxRuns !== void 0 && e > this._states.maxRuns && (e = this._states.maxRuns);
|
|
15243
|
+
let r = t || this._states.currentRun || void 0;
|
|
15244
|
+
return this._enumerateRuns(e, r, "next");
|
|
15245
|
+
}
|
|
15246
|
+
previousRuns(e, t) {
|
|
15247
|
+
return this._enumerateRuns(e, t || void 0, "previous");
|
|
15248
|
+
}
|
|
15249
|
+
_enumerateRuns(e, t, r) {
|
|
15250
|
+
let n = [], i = t ? new m(t, this.getTz()) : null, a = r === "next" ? this._next : this._previous;
|
|
15251
|
+
for (; e--; ) {
|
|
15252
|
+
let o = a.call(this, i);
|
|
15253
|
+
if (!o) break;
|
|
15254
|
+
let h = o.getDate(false);
|
|
15255
|
+
n.push(this.applyDayOffset(h)), i = o;
|
|
15256
|
+
}
|
|
15257
|
+
return n;
|
|
15258
|
+
}
|
|
15259
|
+
match(e) {
|
|
15260
|
+
if (this._states.once) {
|
|
15261
|
+
let r = new m(e, this.getTz());
|
|
15262
|
+
r.ms = 0;
|
|
15263
|
+
let n = new m(this._states.once, this.getTz());
|
|
15264
|
+
return n.ms = 0, r.getTime() === n.getTime();
|
|
15265
|
+
}
|
|
15266
|
+
let t = new m(e, this.getTz());
|
|
15267
|
+
return t.ms = 0, t.match(this._states.pattern, this.options);
|
|
15268
|
+
}
|
|
15269
|
+
getPattern() {
|
|
15270
|
+
if (!this._states.once) return this._states.pattern ? this._states.pattern.pattern : void 0;
|
|
15271
|
+
}
|
|
15272
|
+
getOnce() {
|
|
15273
|
+
return this._states.once ? this._states.once.getDate() : null;
|
|
15274
|
+
}
|
|
15275
|
+
isRunning() {
|
|
15276
|
+
let e = this.nextRun(this._states.currentRun), t = !this._states.paused, r = this.fn !== void 0, n = !this._states.kill;
|
|
15277
|
+
return t && r && n && e !== null;
|
|
15278
|
+
}
|
|
15279
|
+
isStopped() {
|
|
15280
|
+
return this._states.kill;
|
|
15281
|
+
}
|
|
15282
|
+
isBusy() {
|
|
15283
|
+
return this._states.blocking;
|
|
15284
|
+
}
|
|
15285
|
+
currentRun() {
|
|
15286
|
+
return this._states.currentRun ? this._states.currentRun.getDate() : null;
|
|
15287
|
+
}
|
|
15288
|
+
previousRun() {
|
|
15289
|
+
return this._states.previousRun ? this._states.previousRun.getDate() : null;
|
|
15290
|
+
}
|
|
15291
|
+
msToNext(e) {
|
|
15292
|
+
let t = this._next(e);
|
|
15293
|
+
return t ? e instanceof m || e instanceof Date ? t.getTime() - e.getTime() : t.getTime() - new m(e).getTime() : null;
|
|
15294
|
+
}
|
|
15295
|
+
stop() {
|
|
15296
|
+
this._states.kill = true, this._states.currentTimeout && clearTimeout(this._states.currentTimeout);
|
|
15297
|
+
let e = w.indexOf(this);
|
|
15298
|
+
e >= 0 && w.splice(e, 1);
|
|
15299
|
+
}
|
|
15300
|
+
pause() {
|
|
15301
|
+
return this._states.paused = true, !this._states.kill;
|
|
15302
|
+
}
|
|
15303
|
+
resume() {
|
|
15304
|
+
return this._states.paused = false, !this._states.kill;
|
|
15305
|
+
}
|
|
15306
|
+
schedule(e) {
|
|
15307
|
+
if (e && this.fn) throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
|
|
15308
|
+
e && (this.fn = e);
|
|
15309
|
+
let t = this.msToNext(), r = this.nextRun(this._states.currentRun);
|
|
15310
|
+
return t == null || isNaN(t) || r === null ? this : (t > W && (t = W), this._states.currentTimeout = setTimeout(() => this._checkTrigger(r), t), this._states.currentTimeout && this.options.unref && x(this._states.currentTimeout), this);
|
|
15311
|
+
}
|
|
15312
|
+
async _trigger(e) {
|
|
15313
|
+
this._states.blocking = true, this._states.currentRun = new m(void 0, this.getTz());
|
|
15314
|
+
try {
|
|
15315
|
+
if (this.options.catch) try {
|
|
15316
|
+
this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
15317
|
+
} catch (t) {
|
|
15318
|
+
if (p(this.options.catch)) try {
|
|
15319
|
+
this.options.catch(t, this);
|
|
15320
|
+
} catch {
|
|
15321
|
+
}
|
|
15322
|
+
}
|
|
15323
|
+
else this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
15324
|
+
} finally {
|
|
15325
|
+
this._states.previousRun = new m(e, this.getTz()), this._states.blocking = false;
|
|
15326
|
+
}
|
|
15327
|
+
}
|
|
15328
|
+
async trigger() {
|
|
15329
|
+
await this._trigger();
|
|
15330
|
+
}
|
|
15331
|
+
runsLeft() {
|
|
15332
|
+
return this._states.maxRuns;
|
|
15333
|
+
}
|
|
15334
|
+
_checkTrigger(e) {
|
|
15335
|
+
let t = /* @__PURE__ */ new Date(), r = !this._states.paused && t.getTime() >= e.getTime(), n = this._states.blocking && this.options.protect;
|
|
15336
|
+
r && !n ? (this._states.maxRuns !== void 0 && this._states.maxRuns--, this._trigger()) : r && n && p(this.options.protect) && setTimeout(() => this.options.protect(this), 0), this.schedule();
|
|
15337
|
+
}
|
|
15338
|
+
_next(e) {
|
|
15339
|
+
let t = !!(e || this._states.currentRun), r = false;
|
|
15340
|
+
!e && this.options.startAt && this.options.interval && ([e, t] = this._calculatePreviousRun(e, t), r = !e), e = new m(e, this.getTz()), this.options.startAt && e && e.getTime() < this.options.startAt.getTime() && (e = this.options.startAt);
|
|
15341
|
+
let n = this._states.once || new m(e, this.getTz());
|
|
15342
|
+
return !r && n !== this._states.once && (n = n.increment(this._states.pattern, this.options, t)), this._states.once && this._states.once.getTime() <= e.getTime() || n === null || this._states.maxRuns !== void 0 && this._states.maxRuns <= 0 || this._states.kill || this.options.stopAt && n.getTime() >= this.options.stopAt.getTime() ? null : n;
|
|
15343
|
+
}
|
|
15344
|
+
_previous(e) {
|
|
15345
|
+
let t = new m(e, this.getTz());
|
|
15346
|
+
this.options.stopAt && t.getTime() > this.options.stopAt.getTime() && (t = this.options.stopAt);
|
|
15347
|
+
let r = new m(t, this.getTz());
|
|
15348
|
+
return this._states.once ? this._states.once.getTime() < t.getTime() ? this._states.once : null : (r = r.decrement(this._states.pattern, this.options), r === null || this.options.startAt && r.getTime() < this.options.startAt.getTime() ? null : r);
|
|
15349
|
+
}
|
|
15350
|
+
_calculatePreviousRun(e, t) {
|
|
15351
|
+
let r = new m(void 0, this.getTz()), n = e;
|
|
15352
|
+
if (this.options.startAt.getTime() <= r.getTime()) {
|
|
15353
|
+
n = this.options.startAt;
|
|
15354
|
+
let i = n.getTime() + this.options.interval * 1e3;
|
|
15355
|
+
for (; i <= r.getTime(); ) n = new m(n, this.getTz()).increment(this._states.pattern, this.options, true), i = n.getTime() + this.options.interval * 1e3;
|
|
15356
|
+
t = true;
|
|
15357
|
+
}
|
|
15358
|
+
return n === null && (n = void 0), [n, t];
|
|
15359
|
+
}
|
|
15360
|
+
};
|
|
15361
|
+
|
|
15362
|
+
// shared/routine-schedule.ts
|
|
15363
|
+
var MAX_EXPRESSION_LENGTH = 256;
|
|
15364
|
+
function cronCalculator(value) {
|
|
15365
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Choose a valid cron schedule");
|
|
15366
|
+
const input = value;
|
|
15367
|
+
if (input.type !== "cron" || typeof input.expression !== "string") throw new Error("Choose a valid cron schedule");
|
|
15368
|
+
if (Object.keys(input).some((key) => !["type", "expression", "timeZone"].includes(key))) {
|
|
15369
|
+
throw new Error("Cron schedules accept only type, expression and timeZone; start/end dates and other restrictions are not supported");
|
|
15370
|
+
}
|
|
15371
|
+
const expression = input.expression.trim().replace(/\s+/g, " ");
|
|
15372
|
+
if (expression.length > MAX_EXPRESSION_LENGTH || expression.split(" ").length !== 5 || expression.includes("@")) {
|
|
15373
|
+
throw new Error("Cron must have five fields: minute hour day-of-month month weekday (no seconds, year, or macros)");
|
|
15374
|
+
}
|
|
15375
|
+
const timeZone = typeof input.timeZone === "string" ? input.timeZone.trim() : "";
|
|
15376
|
+
if (timeZone.length > 128 || !(timeZone === "UTC" || /^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+)+$/.test(timeZone))) {
|
|
15377
|
+
throw new Error("Choose an IANA timezone such as America/New_York, Asia/Kolkata, or UTC");
|
|
15378
|
+
}
|
|
15379
|
+
try {
|
|
15380
|
+
new Intl.DateTimeFormat("en-US", { timeZone }).format(0);
|
|
15381
|
+
} catch {
|
|
15382
|
+
throw new Error("Choose a valid IANA timezone such as America/New_York, Asia/Kolkata, or UTC");
|
|
15383
|
+
}
|
|
15384
|
+
try {
|
|
15385
|
+
const cron = new E(expression, { timezone: timeZone, mode: "5-part", paused: true });
|
|
15386
|
+
return { schedule: { type: "cron", expression, timeZone }, cron };
|
|
15387
|
+
} catch (error51) {
|
|
15388
|
+
throw new Error(`Invalid cron expression: ${error51.message}`);
|
|
15389
|
+
}
|
|
15390
|
+
}
|
|
15391
|
+
function calculationDate(after) {
|
|
15392
|
+
const date5 = new Date(after);
|
|
15393
|
+
if (!Number.isFinite(after) || !Number.isFinite(date5.getTime())) throw new Error("Choose a valid cron preview date");
|
|
15394
|
+
return date5;
|
|
15395
|
+
}
|
|
15396
|
+
function futureRuns(cron, after, count) {
|
|
15397
|
+
const from = calculationDate(after);
|
|
15398
|
+
const maximum = count + 1440;
|
|
15399
|
+
let requested = count;
|
|
15400
|
+
while (true) {
|
|
15401
|
+
const candidates = cron.nextRuns(requested, from);
|
|
15402
|
+
const runs = [];
|
|
15403
|
+
for (const date5 of candidates) {
|
|
15404
|
+
const at = date5.getTime();
|
|
15405
|
+
if (!Number.isFinite(at)) throw new Error("The cron schedule produced an invalid date");
|
|
15406
|
+
if (at > (runs.at(-1) ?? after)) runs.push(at);
|
|
15407
|
+
if (runs.length === count) return runs;
|
|
15408
|
+
}
|
|
15409
|
+
if (candidates.length < requested || requested === maximum) return runs;
|
|
15410
|
+
requested = Math.min(maximum, requested * 2);
|
|
15411
|
+
}
|
|
15412
|
+
}
|
|
15413
|
+
function normalizeCronSchedule(value, after = Date.now()) {
|
|
15414
|
+
const { schedule, cron } = cronCalculator(value);
|
|
15415
|
+
if (!futureRuns(cron, after, 1).length) throw new Error("This cron expression has no future runs. Choose dates that exist.");
|
|
15416
|
+
return schedule;
|
|
15417
|
+
}
|
|
15418
|
+
|
|
15419
|
+
// server/new-bot-defaults.ts
|
|
15420
|
+
var strings = (max, length) => external_exports.array(external_exports.string().max(length)).max(max);
|
|
15421
|
+
var clock = external_exports.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/);
|
|
15422
|
+
var weekdays = external_exports.array(external_exports.number().int().min(0).max(6)).min(1).max(7);
|
|
15423
|
+
var timestamp = external_exports.number().int().nonnegative().max(864e13);
|
|
15424
|
+
var botDefaultModelSchema = external_exports.object({
|
|
15425
|
+
instanceId: external_exports.string().trim().min(1).max(200),
|
|
15426
|
+
model: external_exports.string().trim().min(1).max(500),
|
|
15427
|
+
effort: external_exports.enum(EFFORT_LEVELS).optional(),
|
|
15428
|
+
variant: external_exports.string().refine(isModelVariant, "invalid model variant").optional()
|
|
15429
|
+
}).strict().refine(
|
|
15430
|
+
(value) => value.effort === void 0 || value.variant === void 0,
|
|
15431
|
+
"choose either a model variant or an effort level"
|
|
15432
|
+
);
|
|
15433
|
+
var botDefaultsProfileSchema = profilePatchSchema.extend({
|
|
15434
|
+
name: external_exports.string().max(100).refine(fitsOnOneLine, "name must fit on one line").optional(),
|
|
15435
|
+
section: external_exports.string().trim().max(60).optional(),
|
|
15436
|
+
color: external_exports.enum(["green", "blue", "red", "orange", "purple", "cyan", "pink", "yellow", "teal", "coral"]).optional(),
|
|
15437
|
+
mascotExpression: external_exports.string().max(60).nullable().optional(),
|
|
15438
|
+
modelSelection: botDefaultModelSchema.optional(),
|
|
15439
|
+
computer: external_exports.enum(["cloud", "vm", "local", "browser", "off"]).nullable().optional(),
|
|
15440
|
+
cloudBackend: external_exports.enum(["box", "vps"]).optional(),
|
|
15441
|
+
autoStartVps: external_exports.boolean().optional(),
|
|
15442
|
+
cwd: external_exports.string().max(4096).nullable().optional(),
|
|
15443
|
+
approvalMode: external_exports.enum(["ask", "auto", "full", "custom"]).optional(),
|
|
15444
|
+
alwaysAllow: strings(200, 500).optional(),
|
|
15445
|
+
chiefOfStaff: external_exports.boolean().optional(),
|
|
15446
|
+
managedSections: strings(100, 60).optional(),
|
|
15447
|
+
approvePeerComms: external_exports.boolean().optional(),
|
|
15448
|
+
peers: strings(1e3, 100).nullable().optional(),
|
|
15449
|
+
composio: external_exports.boolean().optional(),
|
|
15450
|
+
browser: external_exports.boolean().optional(),
|
|
15451
|
+
browserProfile: external_exports.string().max(100).nullable().optional(),
|
|
15452
|
+
mcpServers: strings(100, 100).nullable().optional(),
|
|
15453
|
+
parkDirectMessages: external_exports.boolean().optional()
|
|
15454
|
+
}).strict();
|
|
15455
|
+
var scheduleSchema = external_exports.discriminatedUnion("type", [
|
|
15456
|
+
external_exports.object({ type: external_exports.literal("once"), at: timestamp }).strict(),
|
|
15457
|
+
external_exports.object({ type: external_exports.literal("daily"), time: clock, weekdays }).strict(),
|
|
15458
|
+
external_exports.object({
|
|
15459
|
+
type: external_exports.literal("interval"),
|
|
15460
|
+
everyMinutes: external_exports.number().int().min(5).max(1440),
|
|
15461
|
+
anchorAt: timestamp,
|
|
15462
|
+
weekdays: weekdays.nullable().optional(),
|
|
15463
|
+
window: external_exports.object({ start: clock, end: clock }).strict().nullable().optional(),
|
|
15464
|
+
endsAt: timestamp.nullable().optional()
|
|
15465
|
+
}).strict(),
|
|
15466
|
+
external_exports.object({ type: external_exports.literal("cron"), expression: external_exports.string().max(256), timeZone: external_exports.string().max(128) }).strict()
|
|
15467
|
+
]).superRefine((value, ctx) => {
|
|
15468
|
+
if (value.type === "cron") {
|
|
15469
|
+
try {
|
|
15470
|
+
normalizeCronSchedule(value);
|
|
15471
|
+
} catch (error51) {
|
|
15472
|
+
ctx.addIssue({ code: "custom", message: String(error51) });
|
|
15473
|
+
}
|
|
15474
|
+
}
|
|
15475
|
+
if (value.type === "interval" && value.window) {
|
|
15476
|
+
const minutes = (time3) => Number(time3.slice(0, 2)) * 60 + Number(time3.slice(3));
|
|
15477
|
+
if (minutes(value.window.end) - minutes(value.window.start) < value.everyMinutes) {
|
|
15478
|
+
ctx.addIssue({ code: "custom", message: "The interval must fit inside its time window" });
|
|
15479
|
+
}
|
|
15480
|
+
}
|
|
15481
|
+
});
|
|
15482
|
+
var botRoutineTemplateSchema = external_exports.object({
|
|
15483
|
+
name: external_exports.string().trim().min(1).max(80),
|
|
15484
|
+
prompt: external_exports.string().trim().min(1).max(2e4),
|
|
15485
|
+
schedule: scheduleSchema,
|
|
15486
|
+
enabled: external_exports.boolean().optional(),
|
|
15487
|
+
runOn: external_exports.enum(["maus", "cloud"]).optional(),
|
|
15488
|
+
durationMinutes: external_exports.number().int().min(5).max(240).optional(),
|
|
15489
|
+
timeoutMinutes: external_exports.number().min(1).max(1440).nullable().optional(),
|
|
15490
|
+
overlap: external_exports.enum(["skip", "queue"]).optional(),
|
|
15491
|
+
attachments: external_exports.array(external_exports.object({
|
|
15492
|
+
id: external_exports.string().min(1).max(200),
|
|
15493
|
+
kind: external_exports.enum(["file", "image"]),
|
|
15494
|
+
name: external_exports.string().min(1).max(255),
|
|
15495
|
+
path: external_exports.string().min(1).max(4096),
|
|
15496
|
+
size: external_exports.number().nonnegative()
|
|
15497
|
+
}).strict()).max(50).optional()
|
|
15498
|
+
}).strict();
|
|
15499
|
+
var botSkillTemplateSchema = external_exports.object({
|
|
15500
|
+
name: external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),
|
|
15501
|
+
description: external_exports.string().max(1024),
|
|
15502
|
+
warnings: strings(100, 2e3).default([]),
|
|
15503
|
+
source: external_exports.string().min(1).max(2e3),
|
|
15504
|
+
text: external_exports.string().refine((value) => Buffer.byteLength(value, "utf8") <= 262144, "Skill exceeds 256 KiB"),
|
|
15505
|
+
enabled: external_exports.boolean()
|
|
15506
|
+
}).strict();
|
|
15507
|
+
var newBotDefaultsSchema = external_exports.object({
|
|
15508
|
+
profile: botDefaultsProfileSchema.default({}),
|
|
15509
|
+
memory: external_exports.record(
|
|
15510
|
+
external_exports.string().regex(/^(?:MEMORY\.md|memory\/[a-zA-Z0-9_-]+\.md)$/),
|
|
15511
|
+
external_exports.string().refine((value) => Buffer.byteLength(value, "utf8") <= 262144, "Memory file exceeds 256 KiB")
|
|
15512
|
+
).refine((value) => Object.keys(value).length <= 100, "At most 100 memory files").default({}),
|
|
15513
|
+
skills: external_exports.array(botSkillTemplateSchema).max(100).default([]),
|
|
15514
|
+
routines: external_exports.array(botRoutineTemplateSchema).max(100).default([])
|
|
15515
|
+
}).strict().refine(
|
|
15516
|
+
(value) => Buffer.byteLength(JSON.stringify(value), "utf8") <= 9e5,
|
|
15517
|
+
"Bot defaults must fit within 900 KB"
|
|
15518
|
+
);
|
|
15519
|
+
|
|
14663
15520
|
// shared/provider-icon.ts
|
|
14664
15521
|
var PROVIDER_ICON_PRESETS = [
|
|
14665
15522
|
"openai",
|
|
@@ -14787,7 +15644,7 @@ var MAX_CONCURRENT_BOT_THREADS = 10;
|
|
|
14787
15644
|
var MIN_THREAD_EVENT_LOG_BYTES = 256 * 1024;
|
|
14788
15645
|
var MAX_THREAD_EVENT_LOG_BYTES = 4 * 1024 * 1024 * 1024;
|
|
14789
15646
|
var MIN_LOCAL_VM_MAX_INSTANCES = 1;
|
|
14790
|
-
var MAX_LOCAL_VM_MAX_INSTANCES =
|
|
15647
|
+
var MAX_LOCAL_VM_MAX_INSTANCES = 8;
|
|
14791
15648
|
function isValidSshAlias(value) {
|
|
14792
15649
|
return typeof value === "string" && SSH_ALIAS.test(value);
|
|
14793
15650
|
}
|
|
@@ -14980,8 +15837,8 @@ var instanceConfigSchema = external_exports.object({
|
|
|
14980
15837
|
});
|
|
14981
15838
|
var instanceConfigMapSchema = external_exports.record(external_exports.string(), instanceConfigSchema);
|
|
14982
15839
|
var defaultModelSelectionSchema = external_exports.object({
|
|
14983
|
-
instanceId: external_exports.string().trim().min(1),
|
|
14984
|
-
model: external_exports.string().trim().min(1),
|
|
15840
|
+
instanceId: external_exports.string().trim().min(1).max(200),
|
|
15841
|
+
model: external_exports.string().trim().min(1).max(500),
|
|
14985
15842
|
effort: external_exports.enum(EFFORT_LEVELS).optional(),
|
|
14986
15843
|
variant: external_exports.string().refine(isModelVariant, "invalid model variant").optional()
|
|
14987
15844
|
}).refine(
|
|
@@ -14997,6 +15854,13 @@ var threadsConfigSchema = external_exports.object({
|
|
|
14997
15854
|
* Absent keeps them forever. */
|
|
14998
15855
|
eventLogRetentionDays: external_exports.number().int().min(1).max(3650).optional()
|
|
14999
15856
|
}).strict();
|
|
15857
|
+
var newBotsConfigSchema = external_exports.object({
|
|
15858
|
+
/** Effort for a new bot whose model selection names none. */
|
|
15859
|
+
effort: external_exports.enum(EFFORT_LEVELS).optional()
|
|
15860
|
+
}).strict();
|
|
15861
|
+
var newBotsPatchSchema = external_exports.object({
|
|
15862
|
+
effort: newBotsConfigSchema.shape.effort.nullable()
|
|
15863
|
+
}).strict();
|
|
15000
15864
|
var threadsPatchSchema = threadsConfigSchema.extend({
|
|
15001
15865
|
maxConcurrentPerBot: threadsConfigSchema.shape.maxConcurrentPerBot.optional(),
|
|
15002
15866
|
eventLogMaxBytes: threadsConfigSchema.shape.eventLogMaxBytes.nullable(),
|
|
@@ -15009,12 +15873,15 @@ var appConfigSchema = external_exports.object({
|
|
|
15009
15873
|
* addresses or `@domain` entries; admins get every scope, members chat only. */
|
|
15010
15874
|
signIn: external_exports.object({ admins: external_exports.array(external_exports.string().max(320)).max(500).optional(), members: external_exports.array(external_exports.string().max(320)).max(5e3).optional() }).optional(),
|
|
15011
15875
|
defaultModelSelection: defaultModelSelectionSchema.optional(),
|
|
15876
|
+
newBotDefaults: newBotDefaultsSchema.optional(),
|
|
15877
|
+
newBots: newBotsConfigSchema.optional(),
|
|
15012
15878
|
/** CLI-only launch preferences. Never enable remote access implicitly. */
|
|
15013
15879
|
cliStartup: external_exports.object({
|
|
15014
15880
|
access: external_exports.enum(["local", "tunnel", "tailscale", "public-url"]),
|
|
15015
15881
|
publicUrl: external_exports.string().url().optional(),
|
|
15016
15882
|
phone: external_exports.enum(["ios", "android"]).optional()
|
|
15017
15883
|
}).optional(),
|
|
15884
|
+
mistral: external_exports.object({ key: optionalText }).optional(),
|
|
15018
15885
|
xai: external_exports.object({ key: optionalText, url: optionalText }).optional(),
|
|
15019
15886
|
/** Anthropic API key for Claude Code billed per token, handed only to
|
|
15020
15887
|
* Claude instances; `url` only for a proxy or a test double. Never a
|
|
@@ -15083,8 +15950,8 @@ var appConfigSchema = external_exports.object({
|
|
|
15083
15950
|
"Use a model ID without control characters"
|
|
15084
15951
|
).optional()
|
|
15085
15952
|
}).optional(),
|
|
15086
|
-
/** Non-secret profile details
|
|
15087
|
-
profile: external_exports.object({ name: optionalText, email: optionalText }).optional(),
|
|
15953
|
+
/** Non-secret profile details; aboutMe is shared with every bot. */
|
|
15954
|
+
profile: external_exports.object({ name: optionalText, email: optionalText, aboutMe: external_exports.string().max(24e3).optional() }).optional(),
|
|
15088
15955
|
/** UI language override (BCP-47, lowercase). Empty/absent = follow the
|
|
15089
15956
|
* system language. Unknown tags degrade to English in the renderer. */
|
|
15090
15957
|
language: optionalText,
|
|
@@ -15114,7 +15981,7 @@ var appConfigSchema = external_exports.object({
|
|
|
15114
15981
|
var storedAppConfigSchema = appConfigSchema.extend({
|
|
15115
15982
|
browserProfiles: storedBrowserProfilesSchema.optional()
|
|
15116
15983
|
});
|
|
15117
|
-
var appConfigPatchSchema = appConfigSchema.omit({ instances: true, mcpServers: true, cliStartup: true, customDomain: true }).extend({ threads: threadsPatchSchema.optional() });
|
|
15984
|
+
var appConfigPatchSchema = appConfigSchema.omit({ instances: true, mcpServers: true, cliStartup: true, customDomain: true }).extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional() });
|
|
15118
15985
|
var jsonObjectSchema = external_exports.record(external_exports.string(), external_exports.json());
|
|
15119
15986
|
var DATA_DIR = process.env.OMB_DATA_DIR ?? join2(homedir2(), ".openmausbot");
|
|
15120
15987
|
var LEGACY_DATA_DIR = join2(homedir2(), ".opengrokbot");
|
|
@@ -15340,11 +16207,11 @@ function createToolListNormalizer() {
|
|
|
15340
16207
|
// server/mcp-bridge.ts
|
|
15341
16208
|
var BRIDGE_INACTIVITY_MS = 45e3;
|
|
15342
16209
|
var PROBE_TIMEOUT_MS = 1e4;
|
|
15343
|
-
function runLivenessProbe(probe, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
16210
|
+
function runLivenessProbe(probe, timeoutMs = PROBE_TIMEOUT_MS, env) {
|
|
15344
16211
|
return new Promise((resolve2) => {
|
|
15345
16212
|
const child = spawn(probe.command, probe.args, {
|
|
15346
16213
|
shell: false,
|
|
15347
|
-
env: { ...process.env, PATH: augmentedPath() },
|
|
16214
|
+
env: env ?? { ...process.env, PATH: augmentedPath() },
|
|
15348
16215
|
stdio: ["ignore", "ignore", "ignore"]
|
|
15349
16216
|
});
|
|
15350
16217
|
const timer = setTimeout(() => {
|
|
@@ -15531,7 +16398,7 @@ function runMcpBridge(options) {
|
|
|
15531
16398
|
const liveness = options.liveness;
|
|
15532
16399
|
watchdog = createInactivityWatchdog({
|
|
15533
16400
|
inactivityMs: BRIDGE_INACTIVITY_MS,
|
|
15534
|
-
probe: () => runLivenessProbe(liveness),
|
|
16401
|
+
probe: () => runLivenessProbe(liveness, PROBE_TIMEOUT_MS, options.env),
|
|
15535
16402
|
onDead: () => {
|
|
15536
16403
|
process.stderr.write(
|
|
15537
16404
|
`${options.label} transport went silent and stopped answering liveness probes; ending the bridge
|