vibe64 0.1.59 → 0.1.60
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/bin/run.js +1070 -1054
- package/bin/server.js +392 -376
- package/bin/upgrade-state.js +4439 -4420
- package/dist/assets/{GithubBrowserTabs-D_nMB5Y1.js → GithubBrowserTabs-Vv-64NIg.js} +1 -1
- package/dist/assets/{LocalDatabaseServer-BgO_aeUg.js → LocalDatabaseServer-rolg-sXl.js} +1 -1
- package/dist/assets/SelectField-DwWoHC2p.js +1 -0
- package/dist/assets/{ShellOutlet-Cr8SJs7s.js → ShellOutlet-Clsh2qYP.js} +1 -1
- package/dist/assets/Vibe64AuthSettingsButton-BICxvZDm.js +5 -0
- package/dist/assets/{Vibe64AuthSettingsButton-DRTKdimW.css → Vibe64AuthSettingsButton-DbL7Ukry.css} +1 -1
- package/dist/assets/{Vibe64ConversationLog-DtOgxPNR.js → Vibe64ConversationLog-K6aUo3q1.js} +4 -4
- package/dist/assets/{Vibe64ConversationLog-NH61odld.css → Vibe64ConversationLog-ksf1U6PP.css} +1 -1
- package/dist/assets/{Vibe64DashboardShell-DhPE6H3P.js → Vibe64DashboardShell-C_wkAaSb.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-Bpnbjs4l.css → Vibe64DashboardShell-D0GNI4V8.css} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-cfn8TTxQ.css → Vibe64DatabaseWorkspace-De4sbXAN.css} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-CHV0cd3l.js → Vibe64DatabaseWorkspace-Dy88t2ZX.js} +2 -2
- package/dist/assets/Vibe64FileArea-BU5rPyqx.js +1 -0
- package/dist/assets/{Vibe64FileArea-mydNQQl8.css → Vibe64FileArea-ZEzsvLt2.css} +1 -1
- package/dist/assets/Vibe64OutputControls-Z2K52QCc.js +8 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-DUSMn4pR.js → Vibe64RepositoryWorkspace-CWw4w5SA.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-BXt__PJL.js → Vibe64SessionFiles-DI8ZH6aF.js} +1 -1
- package/dist/assets/{Vibe64SessionSourceEditor-NyG6niQM.js → Vibe64SessionSourceEditor-BVfoXgmZ.js} +1 -1
- package/dist/assets/{Vibe64UiStoryboardView-CtlJWiCY.css → Vibe64UiStoryboardView-BYLWabXY.css} +1 -1
- package/dist/assets/Vibe64UiStoryboardView-C-99xlAo.js +8 -0
- package/dist/assets/{Vibe64UnavailableSessions-CCPWJo8e.js → Vibe64UnavailableSessions-BRB2bUR_.js} +1 -1
- package/dist/assets/{_pageId_-D54CqzqG.js → _pageId_-DPJ8pvUs.js} +1 -1
- package/dist/assets/{_sessionId_-CW044RVi.js → _sessionId_-CiU1Awul.js} +1 -1
- package/dist/assets/_slug_-C5yeqlpL.js +14 -0
- package/dist/assets/{_slug_-WWvJTLoc.css → _slug_-Vy_1jrpy.css} +1 -1
- package/dist/assets/access-BH1OsqPS.css +1 -0
- package/dist/assets/access-Cq6GEVhT.js +1 -0
- package/dist/assets/{app-D9FegZf0.js → app-BKwP6m9e.js} +1 -1
- package/dist/assets/{assistantRouting-D4SnnxJn.js → assistantRouting-BS0ZW5Ki.js} +1 -1
- package/dist/assets/{changes-DtfJc780.js → changes-DT8e3wYn.js} +1 -1
- package/dist/assets/{client-Dra4Vp3A.js → client-BHa4BumO.js} +2 -2
- package/dist/assets/{client-DnjkdG6K.js → client-B_iZQVU8.js} +1 -1
- package/dist/assets/{client-BBqNv4HL.js → client-C-Rw8t8y.js} +1 -1
- package/dist/assets/{client-B8u2_Svv.css → client-CM6TGZc9.css} +1 -1
- package/dist/assets/{client-DuDOzb5A.js → client-Cf6iimPy.js} +2 -2
- package/dist/assets/{client-mU-LObHG.js → client-DWPSlYBq.js} +1 -1
- package/dist/assets/{conversation-QpMeXw70.js → conversation-CsB1b1JZ.js} +1 -1
- package/dist/assets/{conversation-La-pkh5h.css → conversation-DA_fbJJD.css} +1 -1
- package/dist/assets/{dashboard-B26QwE6y.js → dashboard-DRwBugiR.js} +1 -1
- package/dist/assets/{english-definitions-I9tIXY2u.js → english-definitions-Bi3yaDu7.js} +1 -1
- package/dist/assets/{env-BXsvM592.js → env-ObiVMW6f.js} +1 -1
- package/dist/assets/errorMessageHelpers-BjIt31kK.js +1 -0
- package/dist/assets/{errors-DErd0NON.js → errors-D17nJYne.js} +1 -1
- package/dist/assets/{health-C4WtefLm.js → health-Ev-UBIsw.js} +1 -1
- package/dist/assets/history-BSIuLgnI.css +1 -0
- package/dist/assets/history-U6UcbKBZ.js +1 -0
- package/dist/assets/{httpClient-BRO3GqjU.js → httpClient-Bwitq9Xf.js} +1 -1
- package/dist/assets/i18n-BkxO7BMl.js +1 -0
- package/dist/assets/index-Ctygjyf8.css +1 -0
- package/dist/assets/index-Wcdz2Rey.js +134 -0
- package/dist/assets/{integrations-CQNJxkMu.js → integrations-BHURBo17.js} +3 -3
- package/dist/assets/{integrations-CrI893NK.css → integrations-Bo_beIy3.css} +1 -1
- package/dist/assets/issues-D4Asc_wa.css +1 -0
- package/dist/assets/issues-DEzrDqDU.js +1 -0
- package/dist/assets/{learning-0cINHUSN.js → learning-BrBAyLFt.js} +1 -1
- package/dist/assets/{pages-DbF-yXqO.js → pages-5jaEclQo.js} +1 -1
- package/dist/assets/{pages-CIKw99GN.js → pages-BTk_FkDr.js} +1 -1
- package/dist/assets/{pathname-DOqQPPVa.js → pathname-JHQIKk21.js} +1 -1
- package/dist/assets/{placement-BAaZQhAh.js → placement-1lT0lW3-.js} +1 -1
- package/dist/assets/{placement-Lk1Lpy6s.js → placement-B2V88UDJ.js} +1 -1
- package/dist/assets/{project-files-CklWobqZ.js → project-files-CTGwnBh7.js} +1 -1
- package/dist/assets/publish-BYZ7KRzq.js +3 -0
- package/dist/assets/{publish-DOybV3Qz.css → publish-C9O0tDPB.css} +1 -1
- package/dist/assets/{pull-requests-ybnixBv0.js → pull-requests-C-puL4SG.js} +1 -1
- package/dist/assets/{pull-requests-DnEm9m_1.css → pull-requests-DgWKsMdI.css} +1 -1
- package/dist/assets/{repository-wJZei_NJ.js → repository-DknGo0hr.js} +1 -1
- package/dist/assets/settings-BKZcbISO.css +1 -0
- package/dist/assets/settings-BmOQ1NnW.js +1 -0
- package/dist/assets/{shared-X5MxTHwl.js → shared-B6plZPQ_.js} +1 -1
- package/dist/assets/{studioGateApi-CHIdcQvD.js → studioGateApi-UqmdV50W.js} +1 -1
- package/dist/assets/{studioUrls-oIU1Eq_t.js → studioUrls-k_pQIuPs.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-DI9ow2ds.js +1 -0
- package/dist/assets/useCommand-YOAaO5Wz.js +1 -0
- package/dist/assets/{useEndpointResource-61E93qP-.js → useEndpointResource-CmMwteuX.js} +1 -1
- package/dist/assets/{usePaths-B-QGqa_I.js → usePaths-CvUbx5-V.js} +1 -1
- package/dist/assets/{useUiFeedback-CycH_fvY.js → useUiFeedback-Bixow9mW.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-BkcPA64C.js +2 -0
- package/dist/assets/{useVibe64Learning-DZCyrfpy.js → useVibe64Learning-RE4HXHqo.js} +1 -1
- package/dist/assets/{useVibe64SessionData-rBvWMqyc.js → useVibe64SessionData-Df7M5k1M.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-C546mBu8.js → useVibe64SessionSelection-B0USk6X6.js} +1 -1
- package/dist/assets/validators-HqYRjxEO.js +1 -0
- package/dist/assets/{vibe64FileUpload-D0Lv2mMJ.js → vibe64FileUpload-BDkcaUyk.js} +1 -1
- package/dist/assets/vibe64GithubProject-CJneIo5O.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-DKSXVg1B.js +1 -0
- package/dist/assets/vibe64SessionFocus-BJLy8eTE.js +1 -0
- package/dist/assets/vibe64SessionFocus-DdYRpG72.css +1 -0
- package/dist/index.html +26 -24
- package/docs/colleague-usage/ai-tasks.md +15 -4
- package/docs/colleague-usage/coding-agent-recovery.md +3 -1
- package/docs/colleague-usage/coding-agents.md +19 -1
- package/docs/colleague-usage/connected-repositories.md +16 -4
- package/docs/colleague-usage/files.md +2 -1
- package/docs/colleague-usage/github-work.md +50 -11
- package/docs/colleague-usage/health-checks.md +1 -1
- package/docs/colleague-usage/preview-browser-checks.md +3 -0
- package/docs/colleague-usage/preview.md +29 -0
- package/docs/colleague-usage/project-messages.md +3 -2
- package/docs/colleague-usage/project-settings.md +3 -0
- package/docs/colleague-usage/session-archive.md +9 -0
- package/docs/colleague-usage/sessions.md +5 -4
- package/docs/colleague-usage/temporary-chats.md +4 -3
- package/docs/colleague-usage/usage-map.md +3 -2
- package/docs/colleague-usage/workspace-preparation.md +12 -0
- package/node_modules/@jskit-ai/agent/CHANGELOG.md +5 -0
- package/node_modules/@jskit-ai/agent/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +8 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +4 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/connectors-core/README.md +4 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +7 -0
- package/node_modules/@jskit-ai/kernel/package.json +1 -1
- package/node_modules/@jskit-ai/payments-core/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@jskit-ai/resource-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +428 -423
- package/node_modules/@local/vibe64-genesis/bin/genesis +17 -11
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +830 -816
- package/node_modules/@local/vibe64-genesis/src/server/index.js +533 -519
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +172 -169
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +490 -479
- package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +12 -11
- package/node_modules/@local/vibe64-system-graph/README.md +9 -5
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +262 -252
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1060 -1018
- package/node_modules/json-rest-schema/README.md +3 -1
- package/node_modules/json-rest-schema/package.json +1 -1
- package/package.json +17 -17
- package/server.bundle.mjs +43046 -42782
- package/dist/assets/Vibe64AuthSettingsButton-Bx9patil.js +0 -5
- package/dist/assets/Vibe64FileArea-DIDyAUvD.js +0 -1
- package/dist/assets/Vibe64OutputControls-mNWUWLSm.js +0 -8
- package/dist/assets/Vibe64UiStoryboardView-BXH2MSWn.js +0 -8
- package/dist/assets/_slug_-CRtFhc0A.js +0 -14
- package/dist/assets/access-ChMLRErk.js +0 -1
- package/dist/assets/access-Cm2lrMF6.css +0 -1
- package/dist/assets/errorMessageHelpers-L2GsOwCP.js +0 -1
- package/dist/assets/history-BhqQz5jH.css +0 -1
- package/dist/assets/history-HHPFoNi3.js +0 -1
- package/dist/assets/index-BBfSvf2i.css +0 -1
- package/dist/assets/index-Bvd00puv.js +0 -134
- package/dist/assets/issues-BHr_nI-9.js +0 -1
- package/dist/assets/issues-CpBRQTQ_.css +0 -1
- package/dist/assets/publish-Cot797YN.js +0 -3
- package/dist/assets/settings-DJByC5Wb.js +0 -1
- package/dist/assets/settings-bEkDjn0Y.css +0 -1
- package/dist/assets/useArchivedVibe64Sessions-B-DtXrk-.js +0 -1
- package/dist/assets/useCommand-D96utlVe.js +0 -1
- package/dist/assets/useVibe64ConversationLog-BVANhCHq.js +0 -2
- package/dist/assets/validators-B3YzM6px.js +0 -1
- package/dist/assets/vibe64GithubProject-DNl0aDcC.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-BPsE5l5E.js +0 -1
- package/dist/assets/vibe64SessionFocus-CxX2nK6F.js +0 -1
- package/dist/assets/vibe64SessionFocus-DW73PN_o.css +0 -1
package/bin/server.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
3
|
-
import{existsSync as
|
|
4
|
-
import
|
|
5
|
-
return
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
"/proc/version","utf8").toLowerCase().includes("microsoft"))return!C()}catch{}return
|
|
9
|
-
misc/WSLInterop")||
|
|
10
|
-
.0\\powershell.exe`;var x=async(e,t={})=>{let{powerShellPath:o,...r}=t,n=x.encodeCommand(e);return
|
|
3
|
+
import{existsSync as Ia}from"node:fs";import{mkdir as Ca}from"node:fs/promises";import Co from"node:os";import ae from"node:path";import sr from"node:process";import Qe from"node:path";import{fileURLToPath as bn}from"node:url";import En from"node:child_process";
|
|
4
|
+
import Sn,{constants as vn}from"node:fs/promises";import zo from"node:path";import{promisify as Vo}from"node:util";import Ho from"node:child_process";import ze,{constants as Vt}from"node:fs/promises";import Ut from"node:process";import Do from"node:os";import Fe from"node:fs";import Mo from"node:fs";import Dt from"node:fs";var De;function ko(){try{return Dt.statSync("/.dockerenv"),!0}catch{return!1}}function $o(){try{
|
|
5
|
+
return Dt.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Be(){return De===void 0&&
|
|
6
|
+
(De=ko()||$o()),De}var Ue,Lo=()=>{try{return Mo.statSync("/run/.containerenv"),!0}catch{return!1}};function C(){return Ue===void 0&&(Ue=Lo()||
|
|
7
|
+
Be()),Ue}var Bt=()=>{if(Ut.platform!=="linux")return!1;if(Do.release().toLowerCase().includes("microsoft"))return!C();try{if(Fe.readFileSync(
|
|
8
|
+
"/proc/version","utf8").toLowerCase().includes("microsoft"))return!C()}catch{}return Fe.existsSync("/proc/sys/fs/binfmt_\
|
|
9
|
+
misc/WSLInterop")||Fe.existsSync("/run/WSL")?!C():!1},S=Ut.env.__IS_WSL_TEST__?Bt:Bt();import Ft from"node:process";import{Buffer as Bo}from"node:buffer";import{promisify as Uo}from"node:util";import Fo from"node:child_process";var Go=Uo(Fo.execFile),Ge=()=>`${Ft.env.SYSTEMROOT||Ft.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1\
|
|
10
|
+
.0\\powershell.exe`;var x=async(e,t={})=>{let{powerShellPath:o,...r}=t,n=x.encodeCommand(e);return Go(o??Ge(),[...x.argumentsPrefix,n],{encoding:"\
|
|
11
11
|
utf8",...r})};x.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];x.encodeCommand=
|
|
12
|
-
e
|
|
12
|
+
e=>Bo.from(e,"utf16le").toString("base64");x.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;function Gt(e){for(let t of e.split(`
|
|
13
13
|
`)){if(/^\s*#/.test(t))continue;let o=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(o)return o.groups.
|
|
14
|
-
mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var
|
|
15
|
-
access(o,
|
|
16
|
-
i,t=t.endsWith("/")?t:`${t}/`,t)}})(),
|
|
17
|
-
ue=S?
|
|
18
|
-
|
|
19
|
-
{stdout:o}=await x(t,{powerShellPath:e,cwd:
|
|
20
|
-
isArray(e),o=t?e:[e],r=[],n=[];for(let[s,a]of o.entries())
|
|
21
|
-
stdout:s}=await
|
|
22
|
-
i[u]=a[c]??o[u]}catch{}return t?i:i[0]};import
|
|
23
|
-
.0\\powershell.exe`;var
|
|
24
|
-
"base64"),
|
|
25
|
-
shell:!1}),v=async(e,t={})=>{let{powerShellPath:o,...r}=t;return
|
|
26
|
-
|
|
27
|
-
t,{configurable:!0,enumerable:!0,get(){let n=o();return r(n),n},set(n){r(n)}}),e}import{promisify as
|
|
28
|
-
|
|
14
|
+
mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var Wo=Vo(Ho.execFile),qo=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let o="/etc/wsl.conf",r=!1;try{await ze.
|
|
15
|
+
access(o,Vt.F_OK),r=!0}catch{}if(!r)return e;let n=await ze.readFile(o,{encoding:"utf8"}),i=Gt(n);return i===void 0?e:(t=
|
|
16
|
+
i,t=t.endsWith("/")?t:`${t}/`,t)}})(),Yo=async()=>`${await qo()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,
|
|
17
|
+
ue=S?Yo:Ge,zt,Ht=async()=>(zt??=(async()=>{try{let e=await ue();return await ze.access(e,Vt.X_OK),!0}catch{return!1}})(),
|
|
18
|
+
zt),Wt=async()=>{let e=await ue(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,
|
|
19
|
+
{stdout:o}=await x(t,{powerShellPath:e,cwd:zo.dirname(e)});return o.trim()},Jo=e=>/^[a-z]+:\/\//i.test(e),qt=async e=>{let t=Array.
|
|
20
|
+
isArray(e),o=t?e:[e],r=[],n=[];for(let[s,a]of o.entries())Jo(a)||(r.push(s),n.push(a));let i=[...o];if(n.length>0)try{let{
|
|
21
|
+
stdout:s}=await Wo("wslpath",["-aw",...n],{encoding:"utf8"}),a=s.split(/\r?\n/).filter(Boolean);for(let[c,u]of r.entries())
|
|
22
|
+
i[u]=a[c]??o[u]}catch{}return t?i:i[0]};import Yt from"node:process";import{Buffer as Ko}from"node:buffer";import{promisify as Xo}from"node:util";import Zo from"node:child_process";var Qo=Xo(Zo.execFile),en=()=>`${Yt.env.SYSTEMROOT||Yt.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1\
|
|
23
|
+
.0\\powershell.exe`;var Jt=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],Kt=e=>Ko.from(e,"utf16le").toString(
|
|
24
|
+
"base64"),tn=e=>`'${String(e).replaceAll(/['‘’‚‛]/g,t=>t+t)}'`,Xt=e=>[...Jt,Kt(e)],rn=e=>({encoding:"utf8",...e,
|
|
25
|
+
shell:!1}),v=async(e,t={})=>{let{powerShellPath:o,...r}=t;return Qo(o??en(),Xt(e),rn(r))};v.argumentsPrefix=Jt;v.encodeCommand=
|
|
26
|
+
Kt;v.escapeArgument=tn;v.createArguments=Xt;function N(e,t,o){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,
|
|
27
|
+
t,{configurable:!0,enumerable:!0,get(){let n=o();return r(n),n},set(n){r(n)}}),e}import{promisify as hn}from"node:util";import Je from"node:process";import{execFile as gn}from"node:child_process";import{promisify as on}from"node:util";import nn from"node:process";import{execFile as sn}from"node:child_process";var an=on(
|
|
28
|
+
sn);async function Ve(){if(nn.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await an("defaults",["read",
|
|
29
29
|
"com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),o=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.
|
|
30
|
-
exec(e)?.groups.id??"com.apple.Safari";return o==="com.apple.safari"?"com.apple.Safari":o}import
|
|
31
|
-
var
|
|
32
|
-
OS only");let r=t?[]:["-ss"],n={};o&&(n.signal=o);let{stdout:i}=await
|
|
30
|
+
exec(e)?.groups.id??"com.apple.Safari";return o==="com.apple.safari"?"com.apple.Safari":o}import cn from"node:process";import{promisify as un}from"node:util";import{execFile as ln,execFileSync as xc}from"node:child_process";
|
|
31
|
+
var dn=un(ln);async function Zt(e,{humanReadableOutput:t=!0,signal:o}={}){if(cn.platform!=="darwin")throw new Error("mac\
|
|
32
|
+
OS only");let r=t?[]:["-ss"],n={};o&&(n.signal=o);let{stdout:i}=await dn("osascript",["-e",e,r],n);return i.trim()}async function He(e){return Zt(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
33
33
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":C\
|
|
34
|
-
ontents:Info.plist")`)}import
|
|
35
|
-
|
|
34
|
+
ontents:Info.plist")`)}import Qt from"node:process";import{promisify as pn}from"node:util";import{execFile as mn}from"node:child_process";var fn=pn(
|
|
35
|
+
mn),le={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{
|
|
36
36
|
name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.ol\
|
|
37
37
|
d"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{
|
|
38
38
|
name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"\
|
|
39
39
|
Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"\
|
|
40
40
|
com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"\
|
|
41
41
|
org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi\
|
|
42
|
-
.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},
|
|
43
|
-
async function
|
|
42
|
+
.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},qe=new Map(Object.entries(le)),We=class extends Error{};
|
|
43
|
+
async function Ye(e=fn){let t=`${Qt.env.SYSTEMROOT??Qt.env.windir??"C:\\Windows"}\\System32\\reg.exe`,{stdout:o}=await e(
|
|
44
44
|
t,["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/\
|
|
45
|
-
v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(o);if(!r)throw new
|
|
45
|
+
v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(o);if(!r)throw new We(`Cannot find Windows browser in stdout: ${JSON.
|
|
46
46
|
stringify(o)}`);let{id:n}=r.groups,i=n.lastIndexOf("."),s=n.lastIndexOf("-"),a=i===-1?void 0:n.slice(0,i),c=s===-1?void 0:
|
|
47
|
-
n.slice(0,s);return le[n]??le[a]??le[c]??{name:n,id:n}}var
|
|
48
|
-
"darwin"){let e=await
|
|
49
|
-
uery","default","x-scheme-handler/http"]),t=e.trim();return{name:
|
|
50
|
-
platform==="win32")return
|
|
51
|
-
|
|
47
|
+
n.slice(0,s);return le[n]??le[a]??le[c]??{name:n,id:n}}var wn=hn(gn),yn=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,t=>t.toUpperCase());async function Ke(){if(Je.platform===
|
|
48
|
+
"darwin"){let e=await Ve();return{name:await He(e),id:e}}if(Je.platform==="linux"){let{stdout:e}=await wn("xdg-mime",["q\
|
|
49
|
+
uery","default","x-scheme-handler/http"]),t=e.trim();return{name:yn(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(Je.
|
|
50
|
+
platform==="win32")return Ye();throw new Error("Only macOS, Linux, and Windows are supported")}import Xe from"node:process";var _n=!!(Xe.env.SSH_CONNECTION||Xe.env.SSH_CLIENT||Xe.env.SSH_TTY),er=_n;var tr=new URL("./../node_modules/open/index.js",import.meta.url).href,de=Symbol("fallbackAttempt"),Ze=tr?Qe.dirname(bn(
|
|
51
|
+
tr)):"",rr=Qe.join(Ze,"xdg-open"),{platform:j,arch:or}=sr,nr=async(e,t)=>{if(e.length===0)return;let o=[];for(let r of e)
|
|
52
52
|
try{return await t(r)}catch(n){o.push(n)}throw new AggregateError(o,"Failed to open in all supported apps")},pe=async e=>{
|
|
53
53
|
e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[de]===!0;if(delete e[de],Array.isArray(e.app))
|
|
54
|
-
return
|
|
54
|
+
return nr(e.app,u=>pe({...e,app:u,[de]:!0}));let{name:o,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(o))return nr(
|
|
55
55
|
o,u=>pe({...e,app:{name:u,arguments:r},[de]:!0}));if(o==="browser"||o==="browserPrivate"){let u={"com.google.chrome":"ch\
|
|
56
56
|
rome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"fi\
|
|
57
57
|
refox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"\
|
|
58
58
|
edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPriv\
|
|
59
|
-
ate"},d;if(S){let f=await
|
|
59
|
+
ate"},d;if(S){let f=await Wt();d=qe.get(f)??{}}else d=await Ke();let m=d.id?.toLowerCase();if(Object.hasOwn(u,m)){let f=u[m];
|
|
60
60
|
if(o==="browserPrivate"){if(f==="safari")throw new Error("Safari doesn't support opening in private mode via command lin\
|
|
61
61
|
e");r.push(l[f])}return pe({...e,app:{name:P[f],arguments:r}})}throw new Error(`${d.name} is not supported as a default \
|
|
62
|
-
browser`)}let n,i=[],s={},a=!1;if(S&&!C()&&!
|
|
62
|
+
browser`)}let n,i=[],s={},a=!1;if(S&&!C()&&!er&&!o&&(a=await Ht()),j==="darwin")n="open",e.wait&&i.push("--wait-apps"),e.
|
|
63
63
|
background&&i.push("--background"),e.newInstance&&i.push("--new"),o&&i.push("-a",o);else if(j==="win32"||a){n=await ue(),
|
|
64
|
-
i.push(...v.argumentsPrefix),S||(s.windowsVerbatimArguments=!0),S&&e.target&&(e.target=await
|
|
64
|
+
i.push(...v.argumentsPrefix),S||(s.windowsVerbatimArguments=!0),S&&e.target&&(e.target=await qt(e.target));let u=["$Prog\
|
|
65
65
|
ressPreference = 'SilentlyContinue';","Start"];e.wait&&u.push("-Wait"),o?(u.push(v.escapeArgument(o)),e.target&&r.push(e.
|
|
66
66
|
target)):e.target&&u.push(v.escapeArgument(e.target)),r.length>0&&(r=r.map(l=>v.escapeArgument(l)),u.push("-ArgumentList",
|
|
67
|
-
r.join(","))),e.target=v.encodeCommand(u.join(" ")),e.wait||(s.stdio="ignore"),S&&(s.cwd=
|
|
68
|
-
let u=!
|
|
69
|
-
-open":
|
|
70
|
-
e.target&&i.push(e.target);let c=
|
|
67
|
+
r.join(","))),e.target=v.encodeCommand(u.join(" ")),e.wait||(s.stdio="ignore"),S&&(s.cwd=Qe.dirname(n))}else{if(o)n=o;else{
|
|
68
|
+
let u=!Ze||Ze==="/",l=!1;try{await Sn.access(rr,vn.X_OK),l=!0}catch{}n=sr.versions.electron??(j==="android"||u||!l)?"xdg\
|
|
69
|
+
-open":rr}r.length>0&&i.push(...r),e.wait||(s.stdio="ignore",s.detached=!0)}j==="darwin"&&r.length>0&&i.push("--args",...r),
|
|
70
|
+
e.target&&i.push(e.target);let c=En.spawn(n,i,s);return e.wait?new Promise((u,l)=>{c.once("error",l),c.once("close",d=>{
|
|
71
71
|
if(!e.allowNonzeroExitCode&&d!==0){l(new Error(`Exited with code ${d}`));return}u(c)})}):t||j==="win32"||a?new Promise((u,l)=>{
|
|
72
72
|
c.once("error",l),c.once("spawn",()=>{c.once("close",d=>{if(c.off("error",l),t&&d!==0){l(new Error(`Exited with code ${d}`));
|
|
73
73
|
return}c.unref(),u(c)})})}):(c.unref(),new Promise((u,l)=>{c.once("error",l),c.once("spawn",()=>{c.off("error",l),u(c)})}))},
|
|
74
|
-
|
|
75
|
-
ted`);return t}function W({[j]:e},{wsl:t}={}){if(t&&S)return
|
|
74
|
+
Tn=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return pe({...t,target:e})};function ir(e){if(typeof e=="string"||Array.isArray(e))return e;let{[or]:t}=e;if(!t)throw new Error(`${or} is not suppor\
|
|
75
|
+
ted`);return t}function W({[j]:e},{wsl:t}={}){if(t&&S)return ir(t);if(!e)throw new Error(`${j} is not supported`);return ir(
|
|
76
76
|
e)}var P={browser:"browser",browserPrivate:"browserPrivate"};N(P,"chrome",()=>W({darwin:"google chrome",win32:"chrome",linux:[
|
|
77
77
|
"google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chr\
|
|
78
78
|
ome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)\
|
|
@@ -82,146 +82,152 @@ ram Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Fil
|
|
|
82
82
|
lication/brave.exe"]}}));N(P,"firefox",()=>W({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
83
83
|
linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));N(P,"edge",()=>W({darwin:"microsoft edge",win32:"\
|
|
84
84
|
msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedg\
|
|
85
|
-
e.exe"}));N(P,"safari",()=>W({darwin:"Safari"}));var
|
|
86
|
-
|
|
85
|
+
e.exe"}));N(P,"safari",()=>W({darwin:"Safari"}));var et=Tn;import y from"node:process";import{fileURLToPath as xa}from"node:url";var au=Object.freeze(["none","pending","committed","rolledBack","unknown"]);function T(e,{fallback:t=""}={}){return String(e||"").trim()||t}function L(e){return String(e??"").trim()}function _(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function g(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||
|
|
86
|
+
Pn(t)}function Pn(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===0}function tt(e){return e!==null&&typeof e=="object"&&g(e.structure)&&g(e.operations)&&typeof e.validateWith=="function"&&
|
|
87
87
|
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function me(e,t){if(!Object.hasOwn(t,"items"))return null;
|
|
88
|
-
let{items:o}=t;if(
|
|
88
|
+
let{items:o}=t;if(tt(o))return{kind:"schema",schema:o};if(!g(o)||typeof o.type!="string")throw new Error(`Array field "${e}\
|
|
89
89
|
" must define items as either a Schema instance or a field definition object.`);return{kind:"definition",definition:o}}function q(e,t){
|
|
90
|
-
if(!Object.hasOwn(t,"values"))return null;let{values:o}=t;if(
|
|
90
|
+
if(!Object.hasOwn(t,"values"))return null;let{values:o}=t;if(tt(o))return{kind:"schema",schema:o};if(!g(o)||typeof o.type!=
|
|
91
91
|
"string")throw new Error(`Object field "${e}" must define values as either a Schema instance or a field definition objec\
|
|
92
92
|
t.`);return{kind:"definition",definition:o}}function fe(e,t){let o=Object.hasOwn(t,"schema"),r=Object.hasOwn(t,"values"),
|
|
93
93
|
n=Object.hasOwn(t,"additionalProperties");if(o&&r)throw new Error(`Object field "${e}" cannot define both schema and val\
|
|
94
94
|
ues.`);if(n&&t.additionalProperties!==!0)throw new Error(`Object field "${e}" only supports additionalProperties: true.`);
|
|
95
95
|
if(r&&t.additionalProperties===!0)throw new Error(`Object field "${e}" cannot define both values and additionalPropertie\
|
|
96
|
-
s: true.`);if(o){if(!
|
|
96
|
+
s: true.`);if(o){if(!tt(t.schema))throw new Error(`Object field "${e}" must define schema as a Schema instance.`);return{
|
|
97
97
|
kind:"nested",schema:t.schema,allowAdditionalProperties:t.additionalProperties===!0}}return r?{kind:"map",valuesConfig:q(
|
|
98
|
-
e,t)}:t.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function D(e){return e?.type==="number"||e?.type==="integer"||e?.type==="epochMilliseconds"||e?.type==="epochSeconds"}
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
e,t)}:t.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}function D(e){return e?.type==="number"||e?.type==="integer"||e?.type==="epochMilliseconds"||e?.type==="epochSeconds"}function rt(e,t=""){
|
|
99
|
+
if(g(e))for(let[o,r]of Object.entries(e)){if(!g(r))continue;let n=t?`${t}.${o}`:o;for(let i of["minItems","maxItems"]){if(!Object.
|
|
100
|
+
hasOwn(r,i))continue;let s=r[i];if(r.type!=="array"||!Number.isInteger(s)||s<0)throw new Error(`Field "${n}" ${i} must b\
|
|
101
|
+
e a non-negative integer on an array field.`)}if(r.minItems>r.maxItems)throw new Error(`Field "${n}" minItems (${r.minItems}\
|
|
102
|
+
) is above its maxItems (${r.maxItems}).`);r.type==="array"&&g(r.items)&&typeof r.items.type=="string"&&rt({"[]":r.items},
|
|
103
|
+
n)}}var ot="^(?:0|-?[1-9]\\d*)$",ar="\\d{4}",cr="0[1-9]|1[0-2]",ur="0[1-9]|[12]\\d|3[01]",lr="[01]\\d|2[0-3]",B="[0-5]\\d",he=`\
|
|
104
|
+
(?:${lr}):${B}`,dr=`(?:Z|[+-](?:${lr}):${B})`,pr=`(${ar})-(${cr})-(${ur})`,mr=`${ar}-(?:${cr})-(?:${ur})`,fr=`^${mr}$`,Rn=new RegExp(
|
|
105
|
+
`^${pr}$`),An=new RegExp(`^${he}(?::${B}(?:\\.(\\d+))?)?$`),In=new RegExp(`^${pr}T${he}:${B}(?:\\.(\\d+))?${dr}$`),Cn=new RegExp(
|
|
106
|
+
ot),xn=[31,28,31,30,31,30,31,31,30,31,30,31];function Nn(e){return e%4===0&&(e%100!==0||e%400===0)}function jn(e,t){return t===
|
|
107
|
+
2?Nn(e)?29:28:xn[t-1]}function hr(e,t,o){let r=Number(e),n=Number(t),i=Number(o);return n>=1&&n<=12&&i>=1&&i<=jn(r,n)}function Y(e,t){
|
|
103
108
|
let o=e.temporalPrecision;if(o!==void 0){if(!Number.isInteger(o)||o<0)throw new Error(`temporalPrecision for "${t}" must\
|
|
104
|
-
be a non-negative integer.`);return o}}function
|
|
105
|
-
"string")return!1;let t=
|
|
106
|
-
exec(e);return o!==null&&
|
|
107
|
-
|
|
108
|
-
let o=Y(e,t);return`^${he}(?::${B}${
|
|
109
|
-
let o;if(typeof e=="number")o=e;else if(typeof e=="string"&&
|
|
110
|
-
o)||o<-t||o>t?null:o===0?0:o}var
|
|
111
|
-
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function
|
|
112
|
-
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function
|
|
113
|
-
let n=o?
|
|
109
|
+
be a non-negative integer.`);return o}}function gr(e,t){return e===void 0?!0:t===void 0||e.length<=t}function wr(e){if(typeof e!=
|
|
110
|
+
"string")return!1;let t=Rn.exec(e);return t!==null&&hr(t[1],t[2],t[3])}function yr(e,t){if(typeof e!="string")return!1;let o=An.
|
|
111
|
+
exec(e);return o!==null&&gr(o[1],t)}function _r(e,t){if(typeof e!="string")return!1;let o=In.exec(e);return o===null?!1:
|
|
112
|
+
hr(o[1],o[2],o[3])&&gr(o[4],t)}function br(e){return e===void 0?"(?:\\.\\d+)?":e===0?"":`(?:\\.\\d{1,${e}})?`}function Er(e,t){
|
|
113
|
+
let o=Y(e,t);return`^${he}(?::${B}${br(o)})?$`}function Sr(e,t){let o=Y(e,t);return`^${mr}T${he}:${B}${br(o)}${dr}$`}function nt(e,t){
|
|
114
|
+
let o;if(typeof e=="number")o=e;else if(typeof e=="string"&&Cn.test(e))o=Number(e);else return null;return!Number.isSafeInteger(
|
|
115
|
+
o)||o<-t||o>t?null:o===0?0:o}var kn=new Set(["__proto__","prototype","constructor"]);function p(e,t,o){Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0})}function $n(e,t){if(kn.
|
|
116
|
+
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function Mn(e){return typeof e!="string"?e:e.replace(
|
|
117
|
+
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function it(e,t,{normalize:o=!1,allowEmpty:r=!1}={}){
|
|
118
|
+
let n=o?Mn(e):e;if(typeof n!="string"||n.trim()===""){if(r&&n==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
114
119
|
dotted path string.`)}let i=n.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${n}".`);
|
|
115
|
-
for(let s of i)
|
|
116
|
-
|
|
117
|
-
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:
|
|
118
|
-
none:()=>({type:
|
|
120
|
+
for(let s of i)$n(s,t);return i}var Ln="http://json-schema.org/draft-07/schema#",R="x-json-rest-schema",st=["object","array","string","number","boolean"],
|
|
121
|
+
at=Symbol("json-rest-schema.exportContext"),Dn=["true","1","yes","y","on"],Bn=["false","0","no","n","off"];function vr(e){
|
|
122
|
+
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:ot}]}}function k(e,t){return{[R]:{[e]:t}}}var Un={
|
|
123
|
+
none:()=>({type:st}),blob:()=>({type:st}),serialize:()=>({type:st}),object:()=>({type:"object"}),array:()=>({type:"array"}),
|
|
119
124
|
file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["number","string"]}),integer:()=>({type:["int\
|
|
120
|
-
eger","string"]}),epochMilliseconds:()=>
|
|
121
|
-
type:"string",format:"date-time",pattern:
|
|
122
|
-
fieldName:t})=>({type:"string",pattern:
|
|
123
|
-
let t=new Set([...
|
|
125
|
+
eger","string"]}),epochMilliseconds:()=>vr(864e13),epochSeconds:()=>vr(864e10),dateTime:({definition:e,fieldName:t})=>({
|
|
126
|
+
type:"string",format:"date-time",pattern:Sr(e,t)}),date:()=>({type:"string",format:"date",pattern:fr}),time:({definition:e,
|
|
127
|
+
fieldName:t})=>({type:"string",pattern:Er(e,t)}),boolean:({definition:e})=>{if(e.strictBoolean===!0)return{type:"boolean"};
|
|
128
|
+
let t=new Set([...Dn,String(e.stringTrueWhen||"true").trim().toLowerCase()]),o=new Set([...Bn,String(e.stringFalseWhen||
|
|
124
129
|
"false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},{type:"string",enum:[...o,...t]}]}},
|
|
125
|
-
id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},
|
|
130
|
+
id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Fn={minLength:({definition:e,parameterValue:t})=>e.
|
|
126
131
|
type==="string"?{minLength:t}:null,maxLength:({definition:e,parameterValue:t})=>e.type==="string"?{maxLength:t}:null,min:({
|
|
127
132
|
definition:e,parameterValue:t})=>D(e)?{minimum:t}:null,max:({definition:e,parameterValue:t})=>D(e)?{maximum:t}:null,pattern:({
|
|
128
133
|
definition:e,parameterValue:t})=>e.type==="string"?{pattern:t instanceof RegExp?t.source:t}:null,enum:({parameterValue:e})=>({
|
|
129
|
-
enum:e}),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"metadata",{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
t)
|
|
151
|
-
|
|
152
|
-
nodes:[],nextDefinitionId:1,rootNode:null}}function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{});let
|
|
161
|
-
definitions[e.definitionName]=
|
|
162
|
-
|
|
163
|
-
let i=
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
r,n,i
|
|
172
|
-
if(a.kind==="
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
s)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
134
|
+
enum:e}),minItems:({definition:e,parameterValue:t})=>e.type==="array"?{minItems:t}:null,maxItems:({definition:e,parameterValue:t})=>e.
|
|
135
|
+
type==="array"?{maxItems:t}:null,notEmpty:({parameterValue:e,definition:t})=>!e||t.type==="array"?null:{minLength:1},uppercase:({
|
|
136
|
+
parameterValue:e})=>e?k("transforms",{uppercase:!0}):null,lowercase:({parameterValue:e})=>e?k("transforms",{lowercase:!0}):
|
|
137
|
+
null,length:({parameterValue:e})=>k("transforms",{length:e}),unsigned:({parameterValue:e})=>e?k("metadata",{unsigned:!0}):
|
|
138
|
+
null,precision:({parameterValue:e})=>k("metadata",{precision:e}),scale:({parameterValue:e})=>k("metadata",{scale:e}),temporalPrecision:({
|
|
139
|
+
parameterValue:e})=>k("metadata",{temporalPrecision:e}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,
|
|
140
|
+
defaultTo:()=>null};function dt(e,t){for(let o of Object.keys(t)){let r=t[o],n=e[o];if(r&&n&&typeof r=="object"&&typeof n==
|
|
141
|
+
"object"&&!Array.isArray(r)&&!Array.isArray(n)){dt(n,r);continue}e[o]=r}}function Gn(e,t){if(!t||typeof t!="object"||Array.
|
|
142
|
+
isArray(t))throw new Error("JSON Schema export hooks must return an object or null.");for(let o of Object.keys(t)){if(o===
|
|
143
|
+
R&&e[o]&&typeof e[o]=="object"&&typeof t[o]=="object"&&!Array.isArray(e[o])&&!Array.isArray(t[o])){dt(e[o],t[o]);continue}
|
|
144
|
+
e[o]=t[o]}}function zn(e,t){let r=[...Array.isArray(e.anyOf)&&Object.keys(e).length===1?e.anyOf:[e],...t];return r.length===
|
|
145
|
+
1?e:{anyOf:r}}function Vn(e,t){if(!Object.hasOwn(e.types,t.type))throw new Error(`No casting function for type: ${t.type}`);
|
|
146
|
+
let o=e.types[t.type];if(typeof o.toJsonSchema=="function")return o.toJsonSchema;let r=Un[t.type];if(!r)throw new Error(
|
|
147
|
+
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return r}function Hn(e,t,o){if(!Object.
|
|
148
|
+
hasOwn(e.validators,t))return null;let r=e.validators[t];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=Fn[t];
|
|
149
|
+
if(n)return n;throw new Error(`Validator '${t}' on field '${o}' cannot be exported to JSON Schema without a toJsonSchema\
|
|
150
|
+
hook.`)}function Tr(e){if(e===void 0)return"create";if(["create","replace","patch"].includes(e))return e;throw new Error(
|
|
151
|
+
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function Wn(e,t={}){if(t.mode!==
|
|
152
|
+
void 0&&t.operation!==void 0){let o=Tr(t.mode);if(o!==t.operation)throw new Error(`Conflicting JSON Schema export option\
|
|
153
|
+
s: mode '${o}' does not match operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))
|
|
154
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Tr(t.mode)}function qn(e,t={}){
|
|
155
|
+
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
156
|
+
let o=Wn(e,t);return{operationName:o,operation:e.operations[o]}}function Yn(e={}){let t={...e};return Object.defineProperty(
|
|
157
|
+
t,at,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function we(e={}){return e[at]?
|
|
158
|
+
e[at]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function Jn(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
159
|
+
"_").replace(/^_+|_+$/g,"")||"operation"}function ct(e){return g(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
160
|
+
function ge(e){return ct(e)?{allOf:[e]}:e}function Kn(e,t,o,r,n){return e.nodes.find(i=>i.schema===t&&i.operationName===
|
|
161
|
+
o&&i.operation===r&&i.additionalProperties===n)||null}function Xn(e,t){let o=Jn(t),r=`SchemaNode_${e.nextDefinitionId}_${o}`;
|
|
162
|
+
return e.nextDefinitionId+=1,r}function Or(e,t,o,r,n,{root:i=!1}={}){let s=we(t),a=Kn(s,e,o,r,n);if(a)return i&&(a.pointer=
|
|
163
|
+
"#",s.rootNode=a),a;let c={schema:e,operationName:o,operation:r,additionalProperties:n,status:"new",definitionName:i?null:
|
|
164
|
+
Xn(s,o),pointer:i?"#":null};return i?s.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,s.nodes.push(c),c}function Pr(e,t){
|
|
165
|
+
if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$ref:e.pointer};let o=we(t);e.status="build\
|
|
166
|
+
ing",e.pointer!=="#"&&(o.definitions[e.definitionName]={});let r=Zn(e.schema,t,e.operationName,e.operation,e.additionalProperties);
|
|
167
|
+
return e.status="built",e.pointer==="#"?r:(o.definitions[e.definitionName]=r,{$ref:e.pointer})}function pt(e,t,o,r,n=!1){
|
|
168
|
+
let i=we(t),s=Or(e,t,o,r,n);return i.rootNode===s?{$ref:"#"}:Pr(s,t)}function J(e,{referenceBacked:t=!1}={}){return{schema:e,
|
|
169
|
+
referenceBacked:t}}function Zn(e,t,o,r,n=!1){let i={},s=[];for(let[c,u]of Object.entries(e.structure))p(i,c,mt(e,c,u,t,o,
|
|
170
|
+
r)),r.enforceRequired&&u.required===!0&&s.push(c);let a={type:"object",properties:i,additionalProperties:n};return s.length>
|
|
171
|
+
0&&(a.required=s),a}function Qn(e,t,o,r,n,i){let s=me(t,o);if(!s)return null;if(s.kind==="schema")return{...ge(pt(s.schema,
|
|
172
|
+
r,"replace",s.schema.operations.replace,!1)),[R]:{castType:"object"}};let a=o.items.type==="object"&&Object.hasOwn(o.items,
|
|
173
|
+
"schema")?"replace":n,c=a==="replace"?e.operations.replace:i;return mt(e,`${t}[]`,o.items,r,a,c)}function ei(e,t,o,r,n,i){
|
|
174
|
+
let s=q(t,o);if(!s)return null;if(s.kind==="schema")return{...ge(pt(s.schema,r,"replace",s.schema.operations.replace,!1)),
|
|
175
|
+
[R]:{castType:"object"}};let a=s.definition.type==="object"&&Object.hasOwn(s.definition,"schema")?"replace":n,c=a==="rep\
|
|
176
|
+
lace"?e.operations.replace:i;return mt(e,`${t}.*`,s.definition,r,a,c)}function ti(e,t,o,r,n,i){if(o.type==="object"){let a=fe(
|
|
177
|
+
t,o);if(a.kind==="nested")return J(pt(a.schema,r,n,i,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
|
|
178
|
+
"opaque")return J({type:"object",additionalProperties:!0});if(a.kind==="map")return J({type:"object",additionalProperties:ei(
|
|
179
|
+
e,t,o,r,n,i)})}let s=Vn(e,o)({schema:e,fieldName:t,definition:o,operation:n,mode:n,options:r});if(!s||typeof s!="object"||
|
|
180
|
+
Array.isArray(s))throw new Error(`Type '${o.type}' on field '${t}' returned an invalid JSON Schema fragment.`);if(o.type===
|
|
181
|
+
"array"){let a=Qn(e,t,o,r,n,i);if(a)return J({...s,items:a},{referenceBacked:ct(s)})}return J(s,{referenceBacked:ct(s)})}
|
|
182
|
+
function mt(e,t,o,r,n,i){let s={schema:e,fieldName:t,definition:o,operation:n,mode:n,options:r},a=ti(e,t,o,r,n,i),c=a.referenceBacked?
|
|
183
|
+
ge(a.schema):{...a.schema},u={castType:o.type};for(let m of Object.keys(o)){if(m==="type"||!Object.hasOwn(e.validators,m))
|
|
184
|
+
continue;let f=Hn(e,m,t);if(!f)continue;let h=f({...s,parameterName:m,parameterValue:o[m],fieldSchema:{...c}});h&&Gn(c,h)}
|
|
185
|
+
c[R]&&(dt(u,c[R]),delete c[R]);let l=[];o.nullable===!0&&l.push({type:"null"}),o.nullOnEmpty===!0&&l.push({const:""});let d=ge(
|
|
186
|
+
zn(c,l));if(o.defaultTo!==void 0&&i.applyDefaults)if(typeof o.defaultTo!="function"){let m=e._normalizeDefault(o,o.defaultTo,
|
|
187
|
+
{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(n,i,{})});
|
|
188
|
+
if(Object.keys(m.errors).length>0){let f=Object.values(m.errors)[0];throw new Error(`defaultTo for "${t}" is invalid (${f.
|
|
189
|
+
code}).`)}d.default=m.value}else u.defaults={providedByFunction:!0};return d[R]=u,d}function Rr(e,t={}){let o=Yn(t),{operationName:r,
|
|
190
|
+
operation:n}=qn(e,o),i=o.additionalProperties===void 0?!1:o.additionalProperties,s=we(o),a=Or(e,o,r,n,i,{root:!0}),c={$schema:Ln,
|
|
191
|
+
...Pr(a,o)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}function Ar(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function _t(e){return e instanceof
|
|
192
|
+
G}function ri(){return{self:!1,children:{}}}function Ir(e){return Object.keys(e.children).length>0}function $(e,t){return`${e}\
|
|
193
|
+
.${String(t)}`}function $r(e,t){return e===""?String(t):$(e,t)}function Cr(e,t){if(e===t)return"";let o=`${t}.`;return e.
|
|
188
194
|
startsWith(o)?e.slice(o.length):null}function U(e,t){let o={};for(let r of Object.values(e)){let n=$(t,r.field);p(o,n,{...r,
|
|
189
|
-
field:n})}return o}function
|
|
190
|
-
r.length;i++){let s=r[i];Object.hasOwn(n,s)||p(n,s,
|
|
191
|
-
let o=e;for(let r of t){if(o==null||typeof o!="object"||!Object.hasOwn(o,r))return;o=o[r]}return o}function
|
|
192
|
-
null?!0:Array.isArray(e)||
|
|
193
|
-
test(t),n=/^[0-9]+$/.test(o);return r&&n?Number(t)-Number(o):r?-1:n?1:t.localeCompare(o)})}function
|
|
194
|
-
test(e)}function
|
|
195
|
-
null,o.types=e.types,o.validators=e.validators,o.operations=e.operations,o.structure=be(
|
|
196
|
-
Object.freeze(o)}function
|
|
195
|
+
field:n})}return o}function wt(e){return it(e,"validatePath")}function xr(e){let t={};for(let o of e){let r=wt(o),n=t;for(let i=0;i<
|
|
196
|
+
r.length;i++){let s=r[i];Object.hasOwn(n,s)||p(n,s,ri()),i===r.length-1&&(n[s].self=!0),n=n[s].children}}return t}function oi(e,t){
|
|
197
|
+
let o=e;for(let r of t){if(o==null||typeof o!="object"||!Object.hasOwn(o,r))return;o=o[r]}return o}function ye(e){return e===
|
|
198
|
+
null?!0:Array.isArray(e)||g(e)?Object.keys(e).length>0:e!==void 0}function Nr(e){return[...e].sort((t,o)=>{let r=/^[0-9]+$/.
|
|
199
|
+
test(t),n=/^[0-9]+$/.test(o);return r&&n?Number(t)-Number(o):r?-1:n?1:t.localeCompare(o)})}function ni(e){return/^[0-9]+$/.
|
|
200
|
+
test(e)}function ii(e,t=new WeakMap){if(t.has(e))return t.get(e);let o=Object.create(G.prototype);return t.set(e,o),o.structure=
|
|
201
|
+
null,o.types=e.types,o.validators=e.validators,o.operations=e.operations,o.structure=be(_e(e.structure,t)),o._installOperationMethods(),
|
|
202
|
+
Object.freeze(o)}function _e(e,t=new WeakMap){if(e===null||typeof e!="object")return e;if(_t(e))return ii(e,t);if(e instanceof
|
|
197
203
|
Date)return new Date(e.getTime());if(e instanceof RegExp){let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,
|
|
198
|
-
r}if(t.has(e))return t.get(e);if(Array.isArray(e)){let r=[];t.set(e,r);for(let n of e)r.push(
|
|
199
|
-
return e;let o={};t.set(e,o);for(let[r,n]of Object.entries(e))p(o,r,
|
|
200
|
-
null||typeof e!="object"||t.has(e)||
|
|
201
|
-
ownKeys(e))be(e[o],t);return Object.freeze(e)}function
|
|
202
|
-
t)||t.length<1)return null;let[r,...n]=t;if(!Object.hasOwn(e.structure,r))return null;let i=e.structure[r];
|
|
203
|
-
return i;let s
|
|
204
|
-
t);return n.kind!=="nested"?null:
|
|
205
|
-
1)return null;let[i,...s]=o;if(!
|
|
206
|
-
s.length<1?n.definition:
|
|
207
|
-
let r=e.skipFields.map(n=>
|
|
208
|
-
let r={};for(let[n,i]of Object.entries(e.skipParams)){let s=
|
|
209
|
-
skipParams=r:delete o.skipParams}return o}var
|
|
204
|
+
r}if(t.has(e))return t.get(e);if(Array.isArray(e)){let r=[];t.set(e,r);for(let n of e)r.push(_e(n,t));return r}if(!g(e))
|
|
205
|
+
return e;let o={};t.set(e,o);for(let[r,n]of Object.entries(e))p(o,r,_e(n,t));return o}function be(e,t=new WeakSet){if(e===
|
|
206
|
+
null||typeof e!="object"||t.has(e)||_t(e))return e;if(t.add(e),Array.isArray(e))for(let o of e)be(o,t);else for(let o of Reflect.
|
|
207
|
+
ownKeys(e))be(e[o],t);return Object.freeze(e)}function ft(e){return be(_e(e))}var ht=new WeakMap;function yt(e,t,o=""){if(!_t(
|
|
208
|
+
e)||!Array.isArray(t)||t.length<1)return null;let[r,...n]=t;if(!Object.hasOwn(e.structure,r))return null;let i=e.structure[r];
|
|
209
|
+
if(n.length<1)return i;let s=$r(o,r);return Mr(e,i,n,s)}function Mr(e,t,o,r){if(t?.type==="object"){let n=e._resolveObjectFieldMode(
|
|
210
|
+
r,t);return n.kind!=="nested"?null:yt(n.schema,o,r)}if(t?.type==="array"){let n=e._resolveArrayItemsConfig(r,t);if(!n||o.
|
|
211
|
+
length<1)return null;let[i,...s]=o;if(!ni(i))return null;let a=$(r,i);return n.kind==="schema"?s.length<1?null:yt(n.schema,
|
|
212
|
+
s,a):s.length<1?n.definition:Mr(e,n.definition,s,a)}return null}function F(e,t){let o={...e};if(Array.isArray(e.skipFields)){
|
|
213
|
+
let r=e.skipFields.map(n=>Cr(n,t)).filter(n=>n!==null&&n!=="");r.length>0?o.skipFields=r:delete o.skipFields}if(g(e.skipParams)){
|
|
214
|
+
let r={};for(let[n,i]of Object.entries(e.skipParams)){let s=Cr(n,t);s===null||s===""||p(r,s,i)}Object.keys(r).length>0?o.
|
|
215
|
+
skipParams=r:delete o.skipParams}return o}var si=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
210
216
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
211
217
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,
|
|
212
|
-
applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});function
|
|
213
|
-
`Operation "${e}" must define ${o} as one of: ${r.join(", ")}.`)}function
|
|
214
|
-
typeof n!="boolean")throw new Error(`Operation "${e}" must define ${o} as a boolean.`)}function
|
|
215
|
-
ject"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);return
|
|
216
|
-
schema","input"]),
|
|
218
|
+
applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});function jr(e,t,o,r){let n=t[o];if(!r.includes(n))throw new Error(
|
|
219
|
+
`Operation "${e}" must define ${o} as one of: ${r.join(", ")}.`)}function gt(e,t,o,r=!0){let n=t[o];if(!(n===void 0&&!r)&&
|
|
220
|
+
typeof n!="boolean")throw new Error(`Operation "${e}" must define ${o} as a boolean.`)}function ai(e,t){if(typeof t!="ob\
|
|
221
|
+
ject"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);return jr(e,t,"targetFields",["\
|
|
222
|
+
schema","input"]),gt(e,t,"enforceRequired"),gt(e,t,"applyDefaults"),jr(e,t,"outputFields",["validated","input"]),gt(e,t,
|
|
217
223
|
"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.enforceRequired,applyDefaults:t.
|
|
218
224
|
applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===void 0?!0:t.rejectExplicitUndefined})}
|
|
219
|
-
function
|
|
220
|
-
.");let t=Object.create(null);for(let[o,r]of Object.entries(
|
|
221
|
-
return Object.freeze(t)}function
|
|
222
|
-
freeze(t)}function
|
|
223
|
-
structure=t,this.types=
|
|
224
|
-
_paramError(t,"TYPE_CAST_FAILED","Value could not be cast to the required type.")}_paramError(t,o,r,n={}){let i=new Error(
|
|
225
|
+
function ci(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Schema operations must be an object\
|
|
226
|
+
.");let t=Object.create(null);for(let[o,r]of Object.entries(si))p(t,o,r);for(let[o,r]of Object.entries(e))p(t,o,ai(o,r));
|
|
227
|
+
return Object.freeze(t)}function kr(e){let t=Object.create(null);for(let[o,r]of Object.entries(e))p(t,o,r);return Object.
|
|
228
|
+
freeze(t)}function ui(e){let t={...e};return delete t.operation,delete t.mode,t}var G=class{constructor(t,o,r,n={}){rt(t),
|
|
229
|
+
this.structure=t,this.types=kr(o),this.validators=kr(r),this.operations=ci(n),this._installOperationMethods()}_typeError(t){
|
|
230
|
+
return this._paramError(t,"TYPE_CAST_FAILED","Value could not be cast to the required type.")}_paramError(t,o,r,n={}){let i=new Error(
|
|
225
231
|
r);return i.errorObject={field:t,code:o,message:r,params:n},i}_paramToBeSkipped(t,o,r){return typeof o!="object"||o===null?
|
|
226
232
|
!1:!!(Array.isArray(o[r])&&o[r].includes(t))}_fieldToBeSkipped(t,o){return Array.isArray(o.skipFields)&&o.skipFields.includes(
|
|
227
233
|
t)}_mergeErrors(t,o){for(let[r,n]of Object.entries(o))p(t,r,n)}_singleErrorMap(t){let o={};return p(o,t.field,t),o}_assertSupportedOptions(t={}){
|
|
@@ -231,11 +237,11 @@ an operation method directly.");if(Object.hasOwn(t,"operation"))throw new Error(
|
|
|
231
237
|
n`. Call `validateWith()` or an operation method directly.")}_buildOperationSettings(t,o,r){return{operationName:t,operation:o,
|
|
232
238
|
targetFieldNames:o.targetFields==="input"?Object.keys(r):Object.keys(this.structure),outputFieldNames:o.outputFields==="\
|
|
233
239
|
input"?Object.keys(r):Object.keys(this.structure),enforceRequired:o.enforceRequired,applyDefaults:o.applyDefaults,rejectExplicitUndefined:o.
|
|
234
|
-
rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:n=>Object.hasOwn(r,n)}}_assertPlainObjectInput(t,o){if(!
|
|
240
|
+
rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:n=>Object.hasOwn(r,n)}}_assertPlainObjectInput(t,o){if(!g(
|
|
235
241
|
o))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let o=t.operation??t.mode??
|
|
236
242
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
237
243
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,o))throw new Error(
|
|
238
|
-
`Unknown operation "${o}".`);let r=this.operations[o];return{operationName:o,operation:r,validationOptions:
|
|
244
|
+
`Unknown operation "${o}".`);let r=this.operations[o];return{operationName:o,operation:r,validationOptions:ui(t)}}_buildOperationResult(t,o,r){
|
|
239
245
|
let n={};for(let i of r.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=r.isFieldPresent(i);(o[i]!==
|
|
240
246
|
void 0||s&&t[i]===null||r.defaultedFields.has(i))&&(!s&&!r.defaultedFields.has(i)||p(n,i,o[i]))}return n}_resolveObjectFieldMode(t,o){
|
|
241
247
|
return fe(t,o)}_resolveArrayItemsConfig(t,o){return me(t,o)}_resolveObjectValuesConfig(t,o){return q(t,o)}_buildArrayItemSettings(t,o){
|
|
@@ -246,11 +252,11 @@ let u=t.nullable===!0||a.nullable===!0,l=t.nullOnEmpty===!0||a.nullOnEmpty===!0;
|
|
|
246
252
|
if(o===""&&l)return p(n,i,null),{errors:{},shouldContinue:!1};let m={schema:this,definition:t,value:o,fieldName:r,object:n,
|
|
247
253
|
objectBeforeCast:s,valueBeforeCast:o,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
248
254
|
nullable:u||l,nullOnEmpty:l},throwTypeError:()=>{throw this._typeError(r)},throwParamError:(f,h,b)=>{throw this._paramError(
|
|
249
|
-
r,f,h,b)}};try{let f=d(m);if(
|
|
255
|
+
r,f,h,b)}};try{let f=d(m);if(Ar(f))throw new Error(`Type handler for "${t.type}" must be synchronous.`);f!==void 0&&(p(n,
|
|
250
256
|
i,f),m.value=f)}catch(f){if(f.errorObject)return{errors:this._singleErrorMap(f.errorObject),shouldContinue:!1};throw f}return{
|
|
251
257
|
errors:{},context:m,shouldContinue:!0}}_runFieldValidators(t,o,r,n,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
252
258
|
_paramToBeSkipped(a,s.skipParams,o)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
253
|
-
a,i.parameterValue=t[a];let u=c(i);if(
|
|
259
|
+
a,i.parameterValue=t[a];let u=c(i);if(Ar(u))throw new Error(`Validator handler for "${a}" must be synchronous.`);u!==void 0&&
|
|
254
260
|
(p(r,n,u),i.value=u)}catch(u){if(u.errorObject)return this._singleErrorMap(u.errorObject);throw u}}return{}}_normalizeAndValidateValue(t,o,r,n,i,s,a,c){
|
|
255
261
|
let u=this._castValue(t,o,r,n,i,s,a,c);if(Object.keys(u.errors).length>0)return u.errors;if(!u.shouldContinue)return{};let{
|
|
256
262
|
context:l}=u,d=this._validateNestedValue(t,r,n,i,a,c);return Object.keys(d).length>0?d:(l.value=n[i],this._runFieldValidators(
|
|
@@ -260,19 +266,19 @@ if(t.type==="object"){let c=this._resolveObjectFieldMode(o,t);return c.kind==="n
|
|
|
260
266
|
c,o,r,n,i,s):c.kind==="map"?this._validateObjectValues(o,r,n,c.valuesConfig,i,s):{}}if(t.type!=="array")return{};let a=this.
|
|
261
267
|
_resolveArrayItemsConfig(o,t);return a?this._validateArrayItems(o,r,n,a,i,s):{}}_validateNestedObjectSchema(t,o,r,n,i,s){
|
|
262
268
|
let a=r[n],c=t.allowAdditionalProperties?this._extractKnownObjectFields(a,t.schema):a,u=t.schema._validateWithOperation(
|
|
263
|
-
s.operationName,s.operation,c,
|
|
269
|
+
s.operationName,s.operation,c,F(i,o));return p(r,n,t.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
|
|
264
270
|
a,t.schema,u.validatedObject):u.validatedObject),U(u.errors,o)}_extractKnownObjectFields(t,o){let r={};for(let[n,i]of Object.
|
|
265
271
|
entries(t))Object.hasOwn(o.structure,n)&&p(r,n,i);return r}_mergeKnownAndPassthroughObjectFields(t,o,r){let n={};for(let i of Object.
|
|
266
272
|
keys(t)){if(!Object.hasOwn(o.structure,i)){p(n,i,t[i]);continue}Object.hasOwn(r,i)&&p(n,i,r[i])}for(let[i,s]of Object.entries(
|
|
267
273
|
r))Object.hasOwn(n,i)||p(n,i,s);return n}_validateObjectValues(t,o,r,n,i,s){let a=o[r],c={...a},u={};p(o,r,c);for(let l of Object.
|
|
268
274
|
keys(a)){let d=$(t,l);if(this._fieldToBeSkipped(d,i))continue;let m=c[l];if(m===void 0){s.rejectExplicitUndefined?this._mergeErrors(
|
|
269
275
|
u,this._singleErrorMap(this._typeError(d).errorObject)):delete c[l];continue}if(n.kind==="schema"){let h=n.schema._validateWithOperation(
|
|
270
|
-
"replace",n.schema.operations.replace,m,
|
|
276
|
+
"replace",n.schema.operations.replace,m,F(i,d));p(c,l,h.validatedObject),this._mergeErrors(u,U(h.errors,d));continue}let f=this.
|
|
271
277
|
_normalizeAndValidateValue(n.definition,m,d,c,l,a,i,this._buildArrayItemSettings(n.definition,s));this._mergeErrors(u,f)}
|
|
272
278
|
return u}_validateArrayItems(t,o,r,n,i,s){let a=o[r],c=a.slice(),u={};p(o,r,c);for(let l=0;l<c.length;l++){let d=$(t,l);
|
|
273
279
|
if(this._fieldToBeSkipped(d,i))continue;if(!Object.hasOwn(a,l)||c[l]===void 0){s.rejectExplicitUndefined?this._mergeErrors(
|
|
274
280
|
u,this._singleErrorMap(this._typeError(d).errorObject)):delete c[l];continue}if(n.kind==="schema"){let f=n.schema._validateWithOperation(
|
|
275
|
-
"replace",n.schema.operations.replace,c[l],
|
|
281
|
+
"replace",n.schema.operations.replace,c[l],F(i,d));p(c,l,f.validatedObject),this._mergeErrors(u,U(f.errors,d));continue}
|
|
276
282
|
let m=this._normalizeAndValidateValue(n.definition,c[l],d,c,l,a,i,this._buildArrayItemSettings(n.definition,s));this._mergeErrors(
|
|
277
283
|
u,m)}return u}_validateField(t,o,r,n,i){if(!Object.hasOwn(this.structure,t))return{};let s=this.structure[t];if(this._fieldToBeSkipped(
|
|
278
284
|
t,n))return{};let a=i.isFieldPresent(t),c=o[t],u=c===void 0;return i.enforceRequired&&s.required&&(!a||u)&&!this._paramToBeSkipped(
|
|
@@ -285,9 +291,9 @@ this.structure))if(!a.isFieldPresent(c)&&this.structure[c].defaultTo!==void 0){l
|
|
|
285
291
|
"function"?u.defaultTo():u.defaultTo,d=this._normalizeDefault(u,l,{fieldPath:c,currentObject:s,containerKey:c,objectBeforeCast:r,
|
|
286
292
|
options:n,settings:a});if(this._mergeErrors(i,d.errors),Object.keys(d.errors).length>0)continue;p(s,c,d.value),a.defaultedFields.
|
|
287
293
|
add(c)}}return{validatedObject:this._buildOperationResult(r,s,a),errors:i}}_validateSelectedTree(t,o,r,n,i=""){let s={},
|
|
288
|
-
a={};for(let c of
|
|
294
|
+
a={};for(let c of Nr(Object.keys(t))){let u=$r(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema \
|
|
289
295
|
path "${u}".`);let l=this._validateSelectedField(c,t[c],o,a,r,n,u);this._mergeErrors(s,l)}return{validatedObject:a,errors:s}}_validateSelectedField(t,o,r,n,i,s,a){
|
|
290
|
-
if(!Object.hasOwn(this.structure,t))return{};let c=this.structure[t],u=o.self===!0,l=
|
|
296
|
+
if(!Object.hasOwn(this.structure,t))return{};let c=this.structure[t],u=o.self===!0,l=Ir(o);if(this._fieldToBeSkipped(a,i))
|
|
291
297
|
return{};let d=Object.hasOwn(r,t),m=r[t],f={};if(!d){if(u&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("requi\
|
|
292
298
|
red",i.skipParams,a)&&this._mergeErrors(f,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),
|
|
293
299
|
u&&s.applyDefaults&&c.defaultTo!==void 0){let E=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,I=this._normalizeDefault(
|
|
@@ -296,62 +302,62 @@ Object.keys(I.errors).length===0&&p(n,t,I.value)}return f}if(m===void 0)return u
|
|
|
296
302
|
this._typeError(a).errorObject):{};let h={[t]:m};if(u){let E=this._normalizeAndValidateValue(c,m,a,h,t,r,i,s);return Object.
|
|
297
303
|
hasOwn(h,t)&&h[t]!==void 0?p(n,t,h[t]):h[t]===null&&p(n,t,null),E}if(!l)return{};let b=this._castValue(c,m,a,h,t,r,i,s);
|
|
298
304
|
if(Object.keys(b.errors).length>0)return b.errors;if(!b.shouldContinue)return{};let ce=this._validateSelectedDescendants(
|
|
299
|
-
c,o.children,a,h,t,i,s);return
|
|
305
|
+
c,o.children,a,h,t,i,s);return ye(h[t])&&p(n,t,h[t]),ce}_validateSelectedDescendants(t,o,r,n,i,s,a){if(t.type==="object"){
|
|
300
306
|
let c=this._resolveObjectFieldMode(r,t);if(c.kind!=="nested")throw new Error(`Schema path "${r}" does not support nested\
|
|
301
|
-
field selection.`);let u=n[i];if(!
|
|
307
|
+
field selection.`);let u=n[i];if(!g(u))return{};let l=c.schema._validateSelectedTree(o,u,F(s,r),{...a,defaultedFields:new Set});
|
|
302
308
|
return p(n,i,l.validatedObject),U(l.errors,r)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(r,t);if(!c)throw new Error(
|
|
303
309
|
`Schema path "${r}" does not define array items for nested selection.`);return this._validateSelectedArrayItems(r,n,i,c,
|
|
304
310
|
o,s,a)}throw new Error(`Schema path "${r}" does not support nested field selection.`)}_validateSelectedArrayItems(t,o,r,n,i,s,a){
|
|
305
|
-
let c=[],u=o[r],l={};p(o,r,c);for(let d of
|
|
306
|
-
t,d)}" is invalid because array segments must use numeric indexes.`);let m=Number(d),f=$(t,m),h=i[d],b=h.self===!0,ce=
|
|
311
|
+
let c=[],u=o[r],l={};p(o,r,c);for(let d of Nr(Object.keys(i))){if(!/^[0-9]+$/.test(d))throw new Error(`Schema path "${$(
|
|
312
|
+
t,d)}" is invalid because array segments must use numeric indexes.`);let m=Number(d),f=$(t,m),h=i[d],b=h.self===!0,ce=Ir(
|
|
307
313
|
h);if(this._fieldToBeSkipped(f,s))continue;if(!Object.hasOwn(u,m)){b&&a.rejectExplicitUndefined&&p(l,f,this._typeError(f).
|
|
308
314
|
errorObject);continue}let E=u[m];if(E===void 0){b&&a.rejectExplicitUndefined&&p(l,f,this._typeError(f).errorObject);continue}
|
|
309
|
-
if(n.kind==="schema"){if(b){let
|
|
310
|
-
validatedObject)&&p(c,m,
|
|
311
|
-
_validateSelectedTree(h.children,E,
|
|
312
|
-
|
|
313
|
-
n.definition,a),O=[E];if(b){let
|
|
314
|
-
void 0?p(c,m,O[0]):O[0]===null&&p(c,m,null),this._mergeErrors(l,
|
|
315
|
-
E,f,O,0,u,s,I);if(Object.keys(
|
|
316
|
-
let
|
|
315
|
+
if(n.kind==="schema"){if(b){let Le=n.schema._validateWithOperation("replace",n.schema.operations.replace,E,F(s,f));ye(Le.
|
|
316
|
+
validatedObject)&&p(c,m,Le.validatedObject),this._mergeErrors(l,U(Le.errors,f));continue}if(!ce)continue;let H=n.schema.
|
|
317
|
+
_validateSelectedTree(h.children,E,F(s,f),{...a,operationName:"replace",operation:n.schema.operations.replace,defaultedFields:new Set});
|
|
318
|
+
ye(H.validatedObject)&&p(c,m,H.validatedObject),this._mergeErrors(l,U(H.errors,f));continue}let I=this._buildArrayItemSettings(
|
|
319
|
+
n.definition,a),O=[E];if(b){let H=this._normalizeAndValidateValue(n.definition,E,f,O,0,u,s,I);Object.hasOwn(O,0)&&O[0]!==
|
|
320
|
+
void 0?p(c,m,O[0]):O[0]===null&&p(c,m,null),this._mergeErrors(l,H);continue}if(!ce)continue;let Me=this._castValue(n.definition,
|
|
321
|
+
E,f,O,0,u,s,I);if(Object.keys(Me.errors).length>0){this._mergeErrors(l,Me.errors);continue}if(!Me.shouldContinue)continue;
|
|
322
|
+
let jo=this._validateSelectedDescendants(n.definition,h.children,f,O,0,s,I);ye(O[0])&&p(c,m,O[0]),this._mergeErrors(l,jo)}
|
|
317
323
|
return l}validateWith(t,o,r={}){if(!Object.hasOwn(this.operations,t))throw new Error(`Unknown operation "${t}".`);let n=this.
|
|
318
324
|
operations[t];return this._assertPlainObjectInput(t,o),this._validateWithOperation(t,n,o,r)}validateAt(t,o,r={}){this._assertPlainObjectInput(
|
|
319
|
-
"validateAt",o);let n=
|
|
320
|
-
_validateSelectedTree(
|
|
325
|
+
"validateAt",o);let n=wt(t),{operationName:i,operation:s,validationOptions:a}=this._resolvePathValidationRequest(r),c=this.
|
|
326
|
+
_validateSelectedTree(xr([t]),o,a,this._buildOperationSettings(i,s,o));return{validatedValue:oi(c.validatedObject,n),errors:c.
|
|
321
327
|
errors}}validatePaths(t,o,r={}){if(this._assertPlainObjectInput("validatePaths",o),!Array.isArray(t)||t.length===0)throw new Error(
|
|
322
328
|
"validatePaths() expects a non-empty array of schema paths.");let{operationName:n,operation:i,validationOptions:s}=this.
|
|
323
|
-
_resolvePathValidationRequest(r);return this._validateSelectedTree(
|
|
329
|
+
_resolvePathValidationRequest(r);return this._validateSelectedTree(xr(t),o,s,this._buildOperationSettings(n,i,o))}_installOperationMethods(){
|
|
324
330
|
for(let t of Object.keys(this.operations)){if(t in this)throw new Error(`Operation name "${t}" is reserved and cannot be\
|
|
325
|
-
used as a schema method.`);this[t]=(o,r={})=>this.validateWith(t,o,r)}}toJsonSchema(t={}){return
|
|
326
|
-
return
|
|
327
|
-
a non-empty string.");let o=
|
|
328
|
-
t);return!o||typeof o.messages!="object"||o.messages===null?Object.freeze({}):
|
|
329
|
-
keys(t))Object.hasOwn(this.structure,n)&&this.structure[n][o]&&p(r,n,t[n]);return r}};var{parse:
|
|
330
|
-
{"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=
|
|
331
|
-
d;let m=r.call(this,l,d);switch(typeof m){case
|
|
332
|
-
"object"||typeof e=="function")&&typeof e.then=="function"}function
|
|
331
|
+
used as a schema method.`);this[t]=(o,r={})=>this.validateWith(t,o,r)}}toJsonSchema(t={}){return Rr(this,t)}getFieldDefinitions(){
|
|
332
|
+
return ht.has(this)||ht.set(this,ft(this.structure)),ht.get(this)}getFieldDefinition(t){if(typeof t!="string"||t.trim()===
|
|
333
|
+
"")throw new Error("Field path must be a non-empty string.");let o=yt(this,wt(t.trim()));return o===null?null:ft(o)}getFieldMessages(t){
|
|
334
|
+
let o=this.getFieldDefinition(t);return!o||typeof o.messages!="object"||o.messages===null?Object.freeze({}):ft(o.messages)}cleanup(t,o){
|
|
335
|
+
let r={};for(let n of Object.keys(t))Object.hasOwn(this.structure,n)&&this.structure[n][o]&&p(r,n,t[n]);return r}};var{parse:Lu,stringify:li}=JSON,{keys:Du}=Object,di=String,pi="string";var Lr="object",mi=(e,t)=>t;var Dr=(e,t,o)=>{let r=di(t.push(o)-1);return e.set(o,r),r};var Br=(e,t,o)=>{let r=t&&typeof t===Lr?(l,d)=>l===""||-1<t.indexOf(l)?d:void 0:t||mi,n=new Map,i=[],s=[],a=+Dr(n,i,r.call(
|
|
336
|
+
{"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=li(i[a++],u,o);return"["+s.join(",")+"]";function u(l,d){if(c)return c=!c,
|
|
337
|
+
d;let m=r.call(this,l,d);switch(typeof m){case Lr:if(m===null)return m;case pi:return n.get(m)||Dr(n,i,m)}return m}};var hi=new Set(["true","1","yes","y","on"]),gi=new Set(["false","0","no","n","off"]);function wi(e){return e!==null&&(typeof e==
|
|
338
|
+
"object"||typeof e=="function")&&typeof e.then=="function"}function Ur(e){if(typeof e=="number")return Number.isFinite(e)?
|
|
333
339
|
e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e=="string"){let t=e.trim();
|
|
334
|
-
if(t==="")return null;let o=Number(t);return Number.isFinite(o)?o:null}return null}function
|
|
340
|
+
if(t==="")return null;let o=Number(t);return Number.isFinite(o)?o:null}return null}function bt(e,t){if(Object.is(e,t))return!0;
|
|
335
341
|
if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.
|
|
336
342
|
source===t.source&&e.flags===t.flags;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==
|
|
337
|
-
t.length)return!1;for(let n=0;n<e.length;n++)if(!
|
|
343
|
+
t.length)return!1;for(let n=0;n<e.length;n++)if(!bt(e[n],t[n]))return!1;return!0}if(e===null||t===null||typeof e!="objec\
|
|
338
344
|
t"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let o=Object.keys(e),r=Object.keys(
|
|
339
|
-
t);if(o.length!==r.length)return!1;for(let n of o)if(!Object.hasOwn(t,n)||!
|
|
345
|
+
t);if(o.length!==r.length)return!1;for(let n of o)if(!Object.hasOwn(t,n)||!bt(e[n],t[n]))return!1;return!0}var yi={install(e){
|
|
340
346
|
let{addType:t,addValidator:o}=e;t("none",r=>r.value),t("file",r=>{let n=r.value;n==null&&r.throwTypeError();let i=typeof n;
|
|
341
347
|
if(i==="string"||i==="number"||i==="boolean"){let s=n.toString();return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),
|
|
342
348
|
t("string",r=>{let n=r.value;if(n==null)return"";let i=typeof n;if(i==="string"||i==="number"||i==="boolean"){let s=n.toString();
|
|
343
|
-
return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),t("blob",r=>r.value),t("number",r=>{let n=
|
|
344
|
-
null&&r.throwTypeError(),n}),t("integer",r=>{let n=
|
|
345
|
-
n}),t("epochMilliseconds",r=>{let n=
|
|
346
|
-
r.value,864e10);return n===null&&r.throwTypeError(),n}),t("dateTime",r=>{let n=Y(r.definition,r.fieldName);return
|
|
347
|
-
n)||r.throwTypeError(),r.value}),t("date",r=>(
|
|
348
|
-
r.fieldName);return
|
|
349
|
-
r.value)?[r.value]:r.value),t("object",r=>(
|
|
350
|
-
r.value)}catch{try{return
|
|
349
|
+
return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),t("blob",r=>r.value),t("number",r=>{let n=Ur(r.value);return n===
|
|
350
|
+
null&&r.throwTypeError(),n}),t("integer",r=>{let n=Ur(r.value);return(n===null||!Number.isInteger(n))&&r.throwTypeError(),
|
|
351
|
+
n}),t("epochMilliseconds",r=>{let n=nt(r.value,864e13);return n===null&&r.throwTypeError(),n}),t("epochSeconds",r=>{let n=nt(
|
|
352
|
+
r.value,864e10);return n===null&&r.throwTypeError(),n}),t("dateTime",r=>{let n=Y(r.definition,r.fieldName);return _r(r.value,
|
|
353
|
+
n)||r.throwTypeError(),r.value}),t("date",r=>(wr(r.value)||r.throwTypeError(),r.value)),t("time",r=>{let n=Y(r.definition,
|
|
354
|
+
r.fieldName);return yr(r.value,n)||r.throwTypeError(),r.value}),t("array",r=>r.definition.type==="array"&&!Array.isArray(
|
|
355
|
+
r.value)?[r.value]:r.value),t("object",r=>(g(r.value)||r.throwTypeError(),r.value)),t("serialize",r=>{try{return JSON.stringify(
|
|
356
|
+
r.value)}catch{try{return Br(r.value)}catch{r.throwTypeError()}}}),t("boolean",r=>{if(typeof r.value=="boolean")return r.
|
|
351
357
|
value;if(typeof r.value=="number"){if(r.value===1)return!0;if(r.value===0)return!1;r.throwTypeError()}if(typeof r.value==
|
|
352
358
|
"bigint"){if(r.value===1n)return!0;if(r.value===0n)return!1;r.throwTypeError()}if(typeof r.value=="string"){let n=String(
|
|
353
359
|
r.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(r.definition.stringTrueWhen||"true").trim().toLowerCase(),
|
|
354
|
-
s=r.value.trim().toLowerCase(),a=new Set([...
|
|
360
|
+
s=r.value.trim().toLowerCase(),a=new Set([...gi,n]),c=new Set([...hi,i]);if(a.has(s))return!1;if(c.has(s))return!0}r.throwTypeError()}),
|
|
355
361
|
t("id",r=>{if(typeof r.value=="number"){if(Number.isSafeInteger(r.value)&&r.value>0)return r.value;r.throwTypeError()}if(typeof r.
|
|
356
362
|
value=="bigint"){if(r.value>0n&&r.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(r.value);r.throwTypeError()}if(typeof r.
|
|
357
363
|
value=="string"){let n=r.value.trim();/^[1-9][0-9]*$/.test(n)||r.throwTypeError();let i=Number(n);return Number.isSafeInteger(
|
|
@@ -364,7 +370,7 @@ r.value.toString().length>r.parameterValue&&r.throwParamError("MAX_LENGTH",`Leng
|
|
|
364
370
|
characters.`,{max:r.parameterValue,actual:r.value.toString().length})}),o("max",r=>{r.value!==void 0&&D(r.definition)&&
|
|
365
371
|
typeof r.value=="number"&&r.value>r.parameterValue&&r.throwParamError("MAX_VALUE",`Value must be no more than ${r.parameterValue}\
|
|
366
372
|
.`,{max:r.parameterValue,actual:r.value})}),o("enum",r=>{if(!Array.isArray(r.parameterValue))throw new Error(`Enum for ${r.
|
|
367
|
-
fieldName} must be an array.`);r.parameterValue.some(i=>
|
|
373
|
+
fieldName} must be an array.`);r.parameterValue.some(i=>bt(i,r.value))||r.throwParamError("ENUM_VALUE","Value must match\
|
|
368
374
|
one of the allowed enum values.",{allowed:r.parameterValue})}),o("pattern",r=>{if(r.value===void 0||r.definition.type!==
|
|
369
375
|
"string"||typeof r.value!="string")return;let n=r.parameterValue,i=n instanceof RegExp?new RegExp(n.source,n.flags):typeof n==
|
|
370
376
|
"string"?new RegExp(n):null;if(!i)throw new Error(`Pattern for ${r.fieldName} must be a string or RegExp.`);i.test(r.value)||
|
|
@@ -372,82 +378,86 @@ r.throwParamError("PATTERN","Value does not match the required pattern.",{patter
|
|
|
372
378
|
parameterValue){if(r.definition.type!=="boolean")throw new Error(`strictBoolean can only be used on boolean fields (${r.
|
|
373
379
|
fieldName}).`);typeof r.valueBeforeCast!="boolean"&&r.throwParamError("STRICT_BOOLEAN","Value must be a boolean.")}}),o(
|
|
374
380
|
"validator",r=>{if(typeof r.parameterValue!="function")throw new Error(`Validator for ${r.fieldName} must be a function.`);
|
|
375
|
-
let n=r.parameterValue(r.value,r.object,r);if(
|
|
381
|
+
let n=r.parameterValue(r.value,r.object,r);if(wi(n))throw new Error(`Custom validator for "${r.fieldName}" must be synch\
|
|
376
382
|
ronous.`);typeof n=="string"&&r.throwParamError("CUSTOM_VALIDATOR_FAILED",n)}),o("uppercase",r=>{if(typeof r.value=="str\
|
|
377
383
|
ing")return r.value.toUpperCase()}),o("lowercase",r=>{if(typeof r.value=="string")return r.value.toLowerCase()}),o("leng\
|
|
378
384
|
th",r=>{if(typeof r.value=="string")return r.value.substr(0,r.parameterValue);Number.isInteger(Number(r.valueBeforeCast))&&
|
|
379
385
|
String(r.valueBeforeCast).length>r.parameterValue&&r.throwParamError("RANGE_EXCEEDED","Numeric value is out of the allow\
|
|
380
|
-
ed character range.",{max:r.parameterValue,actual:String(r.valueBeforeCast).length})}),o("
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
386
|
+
ed character range.",{max:r.parameterValue,actual:String(r.valueBeforeCast).length})}),o("minItems",r=>{Array.isArray(r.
|
|
387
|
+
value)&&r.value.length<r.parameterValue&&r.throwParamError("MIN_ITEMS",`Must have at least ${r.parameterValue} items.`,{
|
|
388
|
+
min:r.parameterValue,actual:r.value.length})}),o("maxItems",r=>{Array.isArray(r.value)&&r.value.length>r.parameterValue&&
|
|
389
|
+
r.throwParamError("MAX_ITEMS",`Must have no more than ${r.parameterValue} items.`,{max:r.parameterValue,actual:r.value.length})}),
|
|
390
|
+
o("notEmpty",r=>{r.parameterValue&&typeof r.value=="string"&&r.value===""&&r.throwParamError("NOT_EMPTY","Field cannot b\
|
|
391
|
+
e empty.")}),o("required",()=>{}),o("unsigned",()=>{}),o("precision",()=>{}),o("scale",()=>{}),o("temporalPrecision",r=>{
|
|
392
|
+
if(r.definition.type!=="time"&&r.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be used on tim\
|
|
393
|
+
e or dateTime fields (${r.fieldName}).`)}),o("nullable",()=>{}),o("nullOnEmpty",()=>{}),o("defaultTo",()=>{})}},Fr=yi;var Hr=new WeakMap,Wr=new WeakMap,qr=Symbol.for("json-rest-schema.registry-metadata"),Ee=new WeakSet;function _i(e,t,o){
|
|
394
|
+
if(typeof o!="function")throw new Error(`Type handler for '${t}' must be a function.`);p(e,t,o)}function bi(e,t,o){if(typeof o!=
|
|
395
|
+
"function")throw new Error(`Validator handler for '${t}' must be a function.`);p(e,t,o)}function Se(e={}){let t=Object.create(
|
|
396
|
+
null);for(let[o,r]of Object.entries(e))p(t,o,r);return t}function Gr(e,t){if(typeof e.install!="function")throw new Error(
|
|
397
|
+
"Plugin must have an install method.");e.install(t)}function zr(e,t,o){Hr.set(e,t),Wr.set(e,o),Object.defineProperty(e,qr,
|
|
398
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>o}),enumerable:!1,configurable:!1,writable:!1})}function Ei(e){if(!e||
|
|
399
|
+
typeof e!="object"&&typeof e!="function")return null;let t=Hr.get(e),o=Wr.get(e);if(t&&o)return{types:t,validators:o};let r=e[qr];
|
|
391
400
|
return r&&typeof r.getTypes=="function"&&typeof r.getValidators=="function"?{types:r.getTypes(),validators:r.getValidators()}:
|
|
392
401
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
393
402
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
394
|
-
validators}:null}function
|
|
395
|
-
|
|
396
|
-
conflicting ${o} "${r}".`)
|
|
397
|
-
t)};let n=Object.create(null),i=Object.create(null);for(let s of r){let a=
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
let c=new
|
|
401
|
-
|
|
402
|
-
{types:a.types,validators:a.validators,installCore:!1})},o&&
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
403
|
+
validators}:null}function Si(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function Vr(e,t,o){for(let[r,n]of Object.
|
|
404
|
+
entries(t)){if(Object.hasOwn(e,r)&&e[r]!==n){if(Ee.has(n))continue;if(!Ee.has(e[r]))throw new Error(`Cannot merge schema\
|
|
405
|
+
factories with conflicting ${o} "${r}".`)}p(e,r,n)}}function vi(e,t,o){let r=Si(o).filter(Boolean);if(r.length<1)return{
|
|
406
|
+
types:Se(e),validators:Se(t)};let n=Object.create(null),i=Object.create(null);for(let s of r){let a=Ei(s);if(!a)throw new Error(
|
|
407
|
+
"Factory sources must be schema instances or schema factories created by json-rest-schema.");Vr(n,a.types,"type"),Vr(i,a.
|
|
408
|
+
validators,"validator")}return{types:n,validators:i}}function Yr({types:e={},validators:t={},installCore:o=!0}={}){let r=Se(
|
|
409
|
+
e),n=Se(t),i=(s,a={})=>{let c=new G(s,r,n,a.operations);return zr(c,r,n),c};return zr(i,r,n),i.addType=(s,a)=>{_i(r,s,a)},
|
|
410
|
+
i.addValidator=(s,a)=>{bi(n,s,a)},i.use=s=>{Gr(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{
|
|
411
|
+
let a=vi(r,n,s);return Yr({types:a.types,validators:a.validators,installCore:!1})},o&&Gr(Fr,{addType:(s,a)=>{Ee.add(a),i.
|
|
412
|
+
addType(s,a)},addValidator:(s,a)=>{Ee.add(a),i.addValidator(s,a)}}),i}var Jr=Yr({installCore:!0});var il=Object.freeze({schema:Jr({}),mode:"replace"});var Kr=/^[a-z][a-z0-9_.-]*$/u,Oi=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function Pi(e){return String(e||"").trim().toLowerCase()}
|
|
413
|
+
function vt(e,t){let o=Pi(e);if(!Kr.test(o))throw new TypeError(`${t} must match ${Kr.toString()}.`);return o}function Et(e,t){
|
|
414
|
+
if(e==null)return Object.freeze({});if(!_(e))throw new TypeError(`${t} must be an object mapping local names to capabili\
|
|
415
|
+
ty ids.`);let o={},r=new Set;for(let[n,i]of Object.entries(e)){let s=String(n||"").trim();if(!Oi.test(s))throw new TypeError(
|
|
416
|
+
`${t} local name "${s}" must be a JavaScript identifier.`);let a=vt(i,`${t}.${s}`);if(r.has(a))throw new TypeError(`${t}\
|
|
417
|
+
declares capability "${a}" more than once.`);r.add(a),o[s]=a}return Object.freeze(o)}function Ri(e,t,o){if(e==null)return Object.
|
|
418
|
+
freeze({});if(!_(e))throw new TypeError(`${o}.hints must be an object mapping required capability ids to what to registe\
|
|
419
|
+
r.`);let r=new Set(Object.values(t)),n={};for(let[i,s]of Object.entries(e)){let a=vt(i,`${o}.hints key`);if(!r.has(a))throw new TypeError(
|
|
410
420
|
`${o}.hints names "${a}", which the provider does not require.`);if(typeof s!="string"||!s.trim())throw new TypeError(`${o}\
|
|
411
|
-
.hints["${a}"] must be the text that says what to register.`);n[a]=s.trim()}return Object.freeze(n)}function
|
|
421
|
+
.hints["${a}"] must be the text that says what to register.`);n[a]=s.trim()}return Object.freeze(n)}function Ai(e){let t=new Map;
|
|
412
422
|
for(let[o,r]of Object.entries(e))for(let n of Object.keys(r)){if(t.has(n))throw new TypeError(`Provider local name "${n}\
|
|
413
|
-
" is declared by both ${t.get(n)} and ${o}.`);t.set(n,o)}}function
|
|
414
|
-
throw new TypeError(`${t} must be a function when provided.`);return e}function
|
|
415
|
-
hints:n={},setup:i,boot:s=null,shutdown:a=null}={}){let c=
|
|
416
|
-
nal`),d=
|
|
417
|
-
`${c}.setup is required.`);return Object.freeze({id:c,requires:u,optional:l,provides:d,hints:
|
|
418
|
-
`${c}.boot`),shutdown:
|
|
423
|
+
" is declared by both ${t.get(n)} and ${o}.`);t.set(n,o)}}function St(e,t){if(e==null)return null;if(typeof e!="function")
|
|
424
|
+
throw new TypeError(`${t} must be a function when provided.`);return e}function Te({id:e,requires:t={},optional:o={},provides:r={},
|
|
425
|
+
hints:n={},setup:i,boot:s=null,shutdown:a=null}={}){let c=vt(e,"Provider id"),u=Et(t,`${c}.requires`),l=Et(o,`${c}.optio\
|
|
426
|
+
nal`),d=Et(r,`${c}.provides`);Ai({requires:u,optional:l,provides:d});let m=St(i,`${c}.setup`);if(!m)throw new TypeError(
|
|
427
|
+
`${c}.setup is required.`);return Object.freeze({id:c,requires:u,optional:l,provides:d,hints:Ri(n,u,c),setup:m,boot:St(s,
|
|
428
|
+
`${c}.boot`),shutdown:St(a,`${c}.shutdown`)})}var Xr="public";var Ii="/api",Qr=`${Ii}/bootstrap`;function Tt(){let e=[],t=new Set,o=!1;function r({id:a,order:c=0,contribute:u}={}){if(o)throw new Error("Bootstrap regis\
|
|
419
429
|
tration is closed after the first payload is resolved.");let l=T(a);if(!l)throw new TypeError("Bootstrap contributor id \
|
|
420
430
|
is required.");if(typeof u!="function")throw new TypeError(`Bootstrap contributor "${l}" requires contribute().`);if(t.has(
|
|
421
431
|
l))throw new Error(`Bootstrap contributor "${l}" is duplicated.`);return t.add(l),e.push(Object.freeze({id:l,order:Number.
|
|
422
432
|
isFinite(c)?Number(c):0,contribute:u})),s}async function n(a={}){o=!0;let c={},u=e.map((l,d)=>({entry:l,index:d})).sort(
|
|
423
433
|
(l,d)=>l.entry.order-d.entry.order||l.index-d.index).map(({entry:l})=>l);for(let l of u){let d=await l.contribute(Object.
|
|
424
|
-
freeze({...
|
|
434
|
+
freeze({..._(a)?a:{},payload:Object.freeze({...c})}));c={...c,..._(d)?d:{}}}return Object.freeze(c)}function i(){return Object.
|
|
425
435
|
freeze({sealed:o,contributorIds:Object.freeze(e.map(a=>a.id).sort())})}let s=Object.freeze({register:r,resolve:n,diagnostics:i});
|
|
426
|
-
return s}var
|
|
427
|
-
let t=
|
|
428
|
-
async(o,r)=>{r.code(200).send(await t.resolve({request:o,reply:r,query:o.query||{}}))}),{bootstrap:t}}});function
|
|
436
|
+
return s}var Ci=Te({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:e}){
|
|
437
|
+
let t=Tt();return e.router.register("GET",Qr,{auth:Xr,meta:{tags:["bootstrap"],summary:"Resolve app bootstrap payload"}},
|
|
438
|
+
async(o,r)=>{r.code(200).send(await t.resolve({request:o,reply:r,query:o.query||{}}))}),{bootstrap:t}}});function xi(e){if(!_(e))throw new TypeError("Event listener must be an object.");let t=String(e.id||"").trim();if(!t)throw new TypeError(
|
|
429
439
|
"Event listener id is required.");if(typeof e.handle!="function")throw new TypeError(`Event listener "${t}" requires han\
|
|
430
440
|
dle().`);if(e.matches!=null&&typeof e.matches!="function")throw new TypeError(`Event listener "${t}" matches must be a f\
|
|
431
|
-
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function
|
|
441
|
+
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function Ni(e){if(!_(e))throw new TypeError(
|
|
432
442
|
"Published event must be an object.");let t=String(e.type||"").trim();if(!t)throw new TypeError("Published event type is\
|
|
433
|
-
required.");return Object.freeze({...e,type:t})}function
|
|
434
|
-
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function r(s){let a=
|
|
443
|
+
required.");return Object.freeze({...e,type:t})}function Ot(){let e=[],t=new Set;function o(s){let a=xi(s);if(t.has(a.id))
|
|
444
|
+
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function r(s){let a=Ni(s);
|
|
435
445
|
for(let c of e)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function n(){return Object.freeze({listenerIds:Object.
|
|
436
|
-
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:o,publish:r,diagnostics:n});return i}var
|
|
437
|
-
ibrary","Application Support","Vibe64"));let n=String(e.XDG_STATE_HOME||"").trim();return
|
|
438
|
-
l","state"),"vibe64"))}var
|
|
446
|
+
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:o,publish:r,diagnostics:n});return i}var ji=Te({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:Ot()}}});import{AsyncLocalStorage as ki}from"node:async_hooks";var id=new ki;import Oe from"node:path";import Pt from"node:process";import $i from"node:os";var Rt="VIBE64_SYSTEM_ROOT";function eo(e,t){let o=String(e||"").trim();return Oe.resolve(o||t||Pt.cwd())}function Pe({env:e,home:t=$i.homedir(),platform:o=Pt.platform}){let r=t||Pt.cwd();if(o==="darwin")return eo(Oe.join(r,"L\
|
|
447
|
+
ibrary","Application Support","Vibe64"));let n=String(e.XDG_STATE_HOME||"").trim();return eo(Oe.join(n||Oe.join(r,".loca\
|
|
448
|
+
l","state"),"vibe64"))}var Ad=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});var Ud=Object.freeze(["repository","branch","path","baseCommit","canonicalCommit"]);import{execFile as Di}from"node:child_process";import{promisify as Bi}from"node:util";var Hd=Bi(Di);function Ui([e,t,o,r,n,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(o))return null;let s=Number(t),a=Number(o);return!Number.
|
|
439
449
|
isSafeInteger(s)||!Number.isSafeInteger(a)?null:{displayName:String(r||"").split(",")[0],gid:a,home:String(n||""),shell:String(
|
|
440
|
-
i||""),uid:s,username:String(e||"")}}function
|
|
441
|
-
t[0],t[2],t[3],t[4],t[5],t[6]])}var
|
|
450
|
+
i||""),uid:s,username:String(e||"")}}function Fi(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:Ui([
|
|
451
|
+
t[0],t[2],t[3],t[4],t[5],t[6]])}var Wd=Object.freeze({parsePasswdLine:Fi});function w(e=""){return String(e??"").trim()}function Z(e={}){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}var np=Object.freeze({SIGABRT:"Aborted",SIGALRM:"Timeout or timer",SIGHUP:"Terminal closed",SIGINT:"User interruption wi\
|
|
442
452
|
th CTRL-C",SIGKILL:"Forced termination",SIGPIPE:"Broken pipe or socket",SIGQUIT:"User interruption with CTRL-\\",SIGSEGV:"\
|
|
443
|
-
Segmentation fault",SIGTERM:"Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"});var
|
|
444
|
-
" ":"\\t"});import{fileURLToPath as
|
|
445
|
-
in",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
446
|
-
versionName:"1.0.0"});var
|
|
447
|
-
"metadata","migrations","runtime","vite"]);import
|
|
453
|
+
Segmentation fault",SIGTERM:"Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"});var ip=new RegExp("\\p{Separator}|\\p{Other}","gu"),sp=Object.freeze({" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r",
|
|
454
|
+
" ":"\\t"});import{fileURLToPath as Vi}from"node:url";var zi=new URL("./../node_modules/@local/vibe64-execution/src/server/engines/detached.js",import.meta.url).href;var lp=Vi(new URL("./detachedReaper.js",zi));import{createRequire as qi}from"node:module";var Wi=new URL("./../node_modules/@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var Sp=qi(Wi);var Ap=Object.freeze(["bundled","dev_server"]),Ip=Object.freeze(["capacitor"]),Cp=Object.freeze({callbackPath:"/auth/log\
|
|
455
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),xp=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
456
|
+
versionName:"1.0.0"});var Zp=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),Qp=Object.freeze(["capabilities","kind",
|
|
457
|
+
"metadata","migrations","runtime","vite"]);import Zi from"node:path";var Ki="jskit-client-build",nm=new RegExp(`<meta name="${Ki}" content="([0-9a-f]+)"`,"u");var lm=Zi.join("dist","index.html");var Ae=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
448
458
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
449
|
-
R","VIBE64_MYSQL_USER"]);var te="GIT_AUTHOR_NAME",re="GIT_AUTHOR_EMAIL",oe="GIT_COMMITTER_NAME",ne="GIT_COMMITTER_EMAIL";var
|
|
450
|
-
`);var
|
|
459
|
+
R","VIBE64_MYSQL_USER"]);var te="GIT_AUTHOR_NAME",re="GIT_AUTHOR_EMAIL",oe="GIT_COMMITTER_NAME",ne="GIT_COMMITTER_EMAIL";var rs=['git config --global user.name "Your Name"','git config --global user.email "you@example.com"'].join(`
|
|
460
|
+
`);var Ie=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],
|
|
451
461
|
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","package-lock.json"],
|
|
452
462
|
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","composer.lock"],managedCommands:[
|
|
453
463
|
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-configuration.json","conanfi\
|
|
@@ -475,43 +485,43 @@ i/claude-code/package.json","operator-clis/lib/node_modules/@openai/codex/packag
|
|
|
475
485
|
opencode-ai/package.json"],managedCommands:["claude","codex","opencode"]},php:{binDirs:["php/bin"],managedCommands:["php"]},
|
|
476
486
|
playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","playwright/browsers"],managedCommands:["\
|
|
477
487
|
playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","pg_isready","postgres","psql"]},
|
|
478
|
-
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),
|
|
488
|
+
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),no=Object.
|
|
479
489
|
freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","\
|
|
480
|
-
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function
|
|
481
|
-
GHT_VERSION";var
|
|
482
|
-
steadOf",value:"ssh://git@github.com/"}]),
|
|
483
|
-
/env gh auth git-credential"}]),
|
|
484
|
-
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function
|
|
485
|
-
o=[];for(let r of Array.isArray(e)?e:[e]){let n=
|
|
486
|
-
add(i),o.push(i))}return o}function
|
|
487
|
-
String(o.GIT_CONFIG_COUNT||"0"),10),n=Number.isSafeInteger(r)&&r>=0?r:0;for(let i of Array.isArray(t)?t:[]){let s=
|
|
490
|
+
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function os(e=""){let t=w(e);return[...Ie[t]?.managedCommands||[]]}var Jm=Object.freeze({runtimePackManagedCommands:os});var It="VIBE64_SHARED_CACHE_ROOT",Ce="PLAYWRIGHT_BROWSERS_PATH",io="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",so="VIBE64_PLAYWRI\
|
|
491
|
+
GHT_VERSION";var sf=new Set([...Ae,re,te,ne,oe,Ce,io,so,It]);import co from"node:path";var is=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
492
|
+
steadOf",value:"ssh://git@github.com/"}]),mf=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
493
|
+
/env gh auth git-credential"}]),ff=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
494
|
+
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function ss(e=[]){let t=new Set,
|
|
495
|
+
o=[];for(let r of Array.isArray(e)?e:[e]){let n=w(r);if(!n||!co.isAbsolute(n))continue;let i=co.resolve(n);t.has(i)||(t.
|
|
496
|
+
add(i),o.push(i))}return o}function uo(e={},t=[]){let o={...e&&typeof e=="object"&&!Array.isArray(e)?e:{}},r=Number.parseInt(
|
|
497
|
+
String(o.GIT_CONFIG_COUNT||"0"),10),n=Number.isSafeInteger(r)&&r>=0?r:0;for(let i of Array.isArray(t)?t:[]){let s=w(i?.key);
|
|
488
498
|
s&&(o[`GIT_CONFIG_KEY_${n}`]=s,o[`GIT_CONFIG_VALUE_${n}`]=String(i?.value??""),n+=1)}return o.GIT_CONFIG_COUNT=String(n),
|
|
489
|
-
o}function
|
|
490
|
-
_RUNTIME_DIR"]);import{createRequire as
|
|
491
|
-
"deployment","health","workspace-cache","source"]),
|
|
492
|
-
8","base64"]),
|
|
493
|
-
ps","github-token"]),
|
|
494
|
-
freeze(["finite","interactive","service"]),
|
|
495
|
-
t,o}function
|
|
496
|
-
"(empty)"}.`,`vibe64_command_${r}_unsupported`);return n}function
|
|
497
|
-
purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function z(e=""){let t=
|
|
498
|
-
if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw
|
|
499
|
-
"vibe64_execution_identifier_invalid");return t}function
|
|
500
|
-
inal",session:i={}}=t,s=Z(e),a=
|
|
501
|
-
n_lifecycle");if(o==="detached"&&c!=="service"||o==="pty"&&c!=="interactive"||o==="capture"&&c!=="finite")throw
|
|
499
|
+
o}function as(e=[]){return ss(e).map(t=>({key:"safe.directory",value:t}))}function cs(e=[]){return as(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function us(e={}){return uo(e,is)}var hf=Object.freeze({applyGitConfigEntriesToEnv:uo,githubSshToHttpsGitEnv:us,gitSafeDirectoryArgs:cs});var xt="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";var Zf=new Set([...Ae,re,te,ne,oe,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
500
|
+
_RUNTIME_DIR"]);import{createRequire as Ps}from"node:module";var th=256*1024;var rh=600*1e3,oh=1440*60*1e3,nh=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});var Os=new URL("./../node_modules/@local/vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href;var sg=Ps(Os);import{randomUUID as Is}from"node:crypto";var vg=Object.freeze(["daemon","owner-user","named-user","app"]);var Tg=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview","output",
|
|
501
|
+
"deployment","health","workspace-cache","source"]),Og=Object.freeze(["capture","pty","detached"]),Pg=Object.freeze(["utf\
|
|
502
|
+
8","base64"]),Rg=Object.freeze(["session","project","preview","auth","deployment"]),Ag=Object.freeze(["none","github-htt\
|
|
503
|
+
ps","github-token"]),Cs=Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),xs=Object.
|
|
504
|
+
freeze(["finite","interactive","service"]),Ig=1e3*1e3*100;function V(e="",t="vibe64_command_request_invalid"){let o=new Error(e||"Invalid Vibe64 command request.");return o.code=
|
|
505
|
+
t,o}function fo(e="",t=[],o="",r="value"){let n=w(e)||o;if(!t.includes(n))throw V(`Unsupported Vibe64 command ${r}: ${n||
|
|
506
|
+
"(empty)"}.`,`vibe64_command_${r}_unsupported`);return n}function Ns(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function js({mode:e="capture",
|
|
507
|
+
purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function z(e=""){let t=w(e);if(!t)return"";
|
|
508
|
+
if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw V(`Invalid Vibe64 execution identifier: ${t}.`,
|
|
509
|
+
"vibe64_execution_identifier_invalid");return t}function ks(e={},t={}){let{mode:o="capture",project:r={},purpose:n="term\
|
|
510
|
+
inal",session:i={}}=t,s=Z(e),a=fo(s.kind,Cs,js({mode:o,purpose:n}),"execution_kind"),c=fo(s.lifecycle,xs,Ns(o),"executio\
|
|
511
|
+
n_lifecycle");if(o==="detached"&&c!=="service"||o==="pty"&&c!=="interactive"||o==="capture"&&c!=="finite")throw V(`Execu\
|
|
502
512
|
tion lifecycle ${c} is incompatible with command mode ${o}.`,"vibe64_execution_lifecycle_incompatible");let u=z(s.ownerId||
|
|
503
|
-
i.sessionId);if(c==="service"&&!u)throw
|
|
513
|
+
i.sessionId);if(c==="service"&&!u)throw V("Service execution requires a durable owner id.","vibe64_execution_owner_requi\
|
|
504
514
|
red");let l=s.resourceProfile;if(l!=null&&(!l||typeof l!="object"||Object.keys(l).some(d=>!["key","compatibilityKey","en\
|
|
505
515
|
vironment"].includes(d))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||"")||!/^[a-f0-9]{64}$/u.test(l.compatibilityKey||"")||
|
|
506
|
-
!["development","test","production"].includes(l.environment)))throw
|
|
516
|
+
!["development","test","production"].includes(l.environment)))throw V("Invalid activity resource profile identity.","vib\
|
|
507
517
|
e64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.freeze({...l})}:{},controlGenerationId:z(
|
|
508
|
-
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId
|
|
509
|
-
id:
|
|
510
|
-
projectSlug:z(s.projectSlug||r.slug||r.projectSlug),sessionId:z(s.sessionId||i.sessionId)})}function
|
|
511
|
-
"string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e))throw
|
|
512
|
-
ires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}var
|
|
513
|
-
|
|
514
|
-
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),
|
|
518
|
+
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId:$s(s.workflowId)},
|
|
519
|
+
id:Is(),kind:a,label:w(s.label),lifecycle:c,operationId:z(s.operationId),ownerId:u,parentExecutionId:z(s.parentExecutionId),
|
|
520
|
+
projectSlug:z(s.projectSlug||r.slug||r.projectSlug),sessionId:z(s.sessionId||i.sessionId)})}function $s(e){if(typeof e!=
|
|
521
|
+
"string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e))throw V("Execution requ\
|
|
522
|
+
ires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}var Cg=Object.freeze({normalizeExecutionDescriptor:ks});var Fg=new URL("./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href;import{fileURLToPath as Fs}from"node:url";var Us=new URL("./../node_modules/@local/vibe64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href;var hw=Fs(new URL("./gitTurnCheckpointCommand.js",Us)),gw=15*6e4,ww=512*1024*1024,yw=1024*1024*1024;var Ew=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);import{existsSync as Gs}from"node:fs";import xe from"node:path";import ho from"node:process";var go="You'll be asked for your computer password. Nothing shows while you type.",zs="curl -fsSL https://mise.run | sh",
|
|
523
|
+
Aw=Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
524
|
+
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),Ne=Object.freeze({claude:{
|
|
515
525
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
516
526
|
nstall.sh | bash"},codex:{name:"Codex",run:[["codex"]],guideUrl:"https://github.com/openai/codex",any:"curl -fsSL https:\
|
|
517
527
|
//chatgpt.com/codex/install.sh | sh"},opencode:{name:"opencode",run:[["opencode"]],guideUrl:"https://opencode.ai/docs/",
|
|
@@ -535,23 +545,23 @@ rl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -fsSL https
|
|
|
535
545
|
ild tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/install_ruby\
|
|
536
546
|
_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"sudo apt i\
|
|
537
547
|
nstall build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-dev",brew:"\
|
|
538
|
-
brew install pkg-config libyaml openssl@3 gmp"}}),
|
|
539
|
-
trim();return
|
|
540
|
-
return[...String(e.PATH||"").split(
|
|
541
|
-
o,"apt-get")))}function
|
|
542
|
-
o)})}function
|
|
543
|
-
it","cpp"].includes(
|
|
544
|
-
(s=r?`mise use -g ${i.mise}`:`${
|
|
545
|
-
o==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?
|
|
546
|
-
function
|
|
547
|
-
`)}function
|
|
548
|
+
brew install pkg-config libyaml openssl@3 gmp"}}),Vs=Object.freeze({composer:"php"});function Nt(e=""){let t=String(e||"").
|
|
549
|
+
trim();return Vs[t]||t}function wo({platform:e=ho.platform,aptGet:t=!1}={}){return e==="darwin"?"brew":t?"apt":""}function Hs(e,t=xt){
|
|
550
|
+
return[...String(e.PATH||"").split(xe.delimiter),...String(t||"").split(xe.delimiter)].some(o=>xe.isAbsolute(o)&&Gs(xe.join(
|
|
551
|
+
o,"apt-get")))}function je({env:e,platform:t=ho.platform,systemPath:o}){return wo({platform:t,aptGet:t!=="darwin"&&Hs(e,
|
|
552
|
+
o)})}function ke(e="",t={}){let{family:o="",mise:r=!1,xcode:n=!0}=t,i=Ne[Nt(e)];if(!i)return null;if(o==="brew"&&!n&&["g\
|
|
553
|
+
it","cpp"].includes(Nt(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[o]||"";if(!s&&i.mise&&
|
|
554
|
+
(s=r?`mise use -g ${i.mise}`:`${zs} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith("sudo ")||
|
|
555
|
+
o==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?go:""}}var Iw=Object.freeze({SUDO_NOTE:go,localToolFamily:wo});function yo({env:e,platform:t,systemPath:o}){return ke("git",{family:je({env:e,platform:t,systemPath:o})})?.command||""}
|
|
556
|
+
function Ws(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
557
|
+
`)}function qs(e,t){let o=Ws(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(o)){let r=yo(t);
|
|
548
558
|
return{code:"vibe64_git_missing",installCommand:r,message:r?`Git isn't installed on this computer. Install it with: ${r}`:
|
|
549
559
|
"Git isn't installed on this computer. Install Git, then try again."}}return/unknown option [`']initial-branch/u.test(o)?
|
|
550
|
-
{code:"vibe64_git_too_old",installCommand:
|
|
560
|
+
{code:"vibe64_git_too_old",installCommand:yo(t),message:"This Git is too old for Vibe64. Update Git to version 2.28 or n\
|
|
551
561
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
552
562
|
test(o)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
553
563
|
idn't work here. Vibe64 can't type a key passphrase for you. Make one signed commit in a terminal to check your key work\
|
|
554
|
-
s and is unlocked, then try again."}:null}var
|
|
564
|
+
s and is unlocked, then try again."}:null}var Nw=Object.freeze({describeGitFailure:qs});function ie(e){let t=String(e);return/^[A-Za-z0-9_./:=@,+-]+$/u.test(t)?t:`'${t.replaceAll("'","'\\''")}'`}import _o from"node:path";var bo="backups.git",Eo="vibe64-atomic",Ys=`backup_canonical_ref() {
|
|
555
565
|
vibe64_backup_repository="$1"
|
|
556
566
|
vibe64_source_repository="$2"
|
|
557
567
|
vibe64_source_ref="$3"
|
|
@@ -569,13 +579,13 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
569
579
|
' "$vibe64_source_ref" >&2
|
|
570
580
|
return 1
|
|
571
581
|
fi
|
|
572
|
-
}`,
|
|
582
|
+
}`,Lw=`#!/bin/sh
|
|
573
583
|
set -eu
|
|
574
584
|
|
|
575
585
|
zero_object=0000000000000000000000000000000000000000
|
|
576
586
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
577
587
|
repository_root="$(dirname "$git_dir")"
|
|
578
|
-
backup_repository="$repository_root/${
|
|
588
|
+
backup_repository="$repository_root/${bo}"
|
|
579
589
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
580
590
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
581
591
|
' >&2
|
|
@@ -584,7 +594,7 @@ fi
|
|
|
584
594
|
exec 8>"$repository_root/mutation.lock"
|
|
585
595
|
flock -x 8
|
|
586
596
|
|
|
587
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
597
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${Eo}" ]; then
|
|
588
598
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
589
599
|
' >&2
|
|
590
600
|
exit 1
|
|
@@ -595,7 +605,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
595
605
|
exit 1
|
|
596
606
|
fi
|
|
597
607
|
|
|
598
|
-
${
|
|
608
|
+
${Ys}
|
|
599
609
|
|
|
600
610
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
601
611
|
cleanup_updates_file() {
|
|
@@ -643,75 +653,81 @@ while read -r old_object _new_object ref_name; do
|
|
|
643
653
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
644
654
|
fi
|
|
645
655
|
done <"$updates_file"
|
|
646
|
-
`;function
|
|
647
|
-
url).href;var
|
|
656
|
+
`;function Js(e=""){return e?_o.join(_o.dirname(e),bo):""}var Dw=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:Eo,canonicalRepositoryBackupPath:Js});var Jw=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.
|
|
657
|
+
url).href;var Xs=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms>]"," vibe64\
|
|
648
658
|
-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [--json]"," v\
|
|
649
|
-
ibe64-helper preview
|
|
650
|
-
|
|
651
|
-
|guest|configured-name>"," vibe64-helper preview browser storage-state
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
preview restart [--wait] [--json] [--timeout-ms <ms>]"," vibe64-helper
|
|
656
|
-
default|guest|configured-name>] test [playwright test arguments]","
|
|
657
|
-
identity <default|guest|configured-name>] npm-run <package-script> [--
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
.","
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
659
|
+
ibe64-helper preview open <path> [--json]"," vibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--\
|
|
660
|
+
output <path>]"," vibe64-helper preview browser ensure"," vibe64-helper preview browser eval < playwright-code.js"," \
|
|
661
|
+
vibe64-helper preview browser identity <default|guest|configured-name>"," vibe64-helper preview browser storage-state <\
|
|
662
|
+
default|guest|configured-name> --output <new-path>"," vibe64-helper preview browser screenshot [--output <path>]"," vi\
|
|
663
|
+
be64-helper preview browser status"," vibe64-helper preview browser reset"," vibe64-helper preview browser close"," v\
|
|
664
|
+
ibe64-helper preview identities"," vibe64-helper preview identities save < identities.json"," vibe64-helper preview lo\
|
|
665
|
+
gs [--lines <count>] [--json]"," vibe64-helper preview restart [--wait] [--json] [--timeout-ms <ms>]"," vibe64-helper \
|
|
666
|
+
playwright [--target <target-id>] [--identity <default|guest|configured-name>] test [playwright test arguments]"," vibe\
|
|
667
|
+
64-helper playwright [--target <target-id>] [--identity <default|guest|configured-name>] npm-run <package-script> [-- sc\
|
|
668
|
+
ript arguments]","","JSON output:"," status/ensure/restart/stop --json: ready, stoppedIntent, stale, outputTargetId, en\
|
|
669
|
+
dpoints.browser {url, hostname, port}, currentPage {url, route, title, observedAt}, terminal {id, status, running, exitC\
|
|
670
|
+
ode, command, createdAt}, defaultIdentity, identities [{name, type}], identityTypes, diagnostics {latest, log, directApp\
|
|
671
|
+
licationEndpoint}."," open --json: path, moved (how many of the person's open Previews moved to it), errors (why one th\
|
|
672
|
+
at answered did not move)."," screenshot: outputPath, byteLength, sha256, capturedAt, url, title, width, height, lumina\
|
|
673
|
+
nce, darkPixelPercentage, domTextLength, domTextSummary."," browser eval: result (the code's JSON-safe return value), l\
|
|
674
|
+
ogs [{level, values}] from console, url (the page afterwards)."," identities: the project's Managed app identities [{na\
|
|
675
|
+
me, type, value}] (first is the default) and the Stack's declared Preview identity types.",' identities save: replaces \
|
|
676
|
+
the whole ordered list with the JSON array on stdin (or {"identities": [...]}); each type must be declared. Save only na\
|
|
677
|
+
mes and accounts the person asked for or confirmed; never create app accounts or change roles for this. Then verify each\
|
|
678
|
+
with preview browser identity <name>.'," browser storage-state: writes the identity's Playwright storage state to a ne\
|
|
679
|
+
w file at --output; the interactive browser keeps its identity.","","When the person asks to see a page, run preview ope\
|
|
680
|
+
n with its path inside the app (/orders/42?tab=notes): it moves every Preview pane they have open for this session to th\
|
|
681
|
+
at page, as their Preview address box would, and they see a note that the AI opened it. Only paths starting with a singl\
|
|
682
|
+
e / are accepted, never other sites. If it reports moved: 0, give them the path to type into the Preview address box ins\
|
|
683
|
+
tead. Your own browser commands never move their pane.","Screenshot commands emit JSON metadata for a uniquely named, im\
|
|
684
|
+
mutable PNG.","For browser navigation, use preview inspect-url or the status Browser URL; these use the managed Preview \
|
|
685
|
+
proxy.","Inside browser eval, navigate with await page.goto(new URL('/your-path', preview.url).href).","The direct appli\
|
|
686
|
+
cation endpoint in diagnostics bypasses Preview identity; do not use it for interactive browsing.","The browser keeps it\
|
|
687
|
+
s page between browser commands. After each command the page keeps running for 30 seconds, then pauses (no timers, anima\
|
|
688
|
+
tions or network handling) until the next browser command. For a longer wait, wait inside the command, for example with \
|
|
689
|
+
await page.waitForSelector(...).","Five minutes after the last browser command ends, the browser closes; the next comman\
|
|
690
|
+
d opens a fresh page, so select its identity again if needed.","Managed Playwright suites and live preview browser actio\
|
|
691
|
+
ns are sequential. Wait on the suite through cleanup and restoration before browser actions or Preview ensure/restart/ta\
|
|
692
|
+
rget changes; confirm playwright status has no active run and preview status is ready. Read-only status and logs are saf\
|
|
693
|
+
e during a suite.","For background commands, wait on the existing execution/session with about a 30-second window where \
|
|
694
|
+
supported: set yield_time_ms: 30000 for an empty command poll. Reserve shorter waits for interactive input or a specific\
|
|
695
|
+
immediate check; do not repeatedly reread empty or unchanged logs between brief waits.","This is the canonical preview \
|
|
696
|
+
server for the configured primary application.","Do not start a duplicate copy of that application on another port.","A \
|
|
697
|
+
distinct secondary application explicitly requested by the user, such as a reference app, may run separately without rep\
|
|
698
|
+
lacing this preview."].join(`
|
|
683
699
|
`)+`
|
|
684
|
-
`;import{fileURLToPath as
|
|
685
|
-
new URL("./engines/stdioBridge.js",
|
|
700
|
+
`;import{fileURLToPath as ra}from"node:url";var ta=new URL("./../node_modules/@local/vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,sy=ra(
|
|
701
|
+
new URL("./engines/stdioBridge.js",ta));var py=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$name" 2>/dev/null) || continue',
|
|
686
702
|
" case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /usr/bin/*) continue ;; esac; fi',
|
|
687
703
|
` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
688
|
-
`);var
|
|
689
|
-
e,Object.freeze({name:t,guideUrl:o,install:r})]})));import{execFile as
|
|
690
|
-
resolve(String(e||""));try{return t(o)}catch{return o}}function
|
|
691
|
-
return r?
|
|
692
|
-
en=1",!0],["--no-open",!1],["--open=false",!1],["--open=0",!1]]);function
|
|
693
|
-
trim().toLowerCase())===t)}function
|
|
694
|
-
function
|
|
695
|
-
rted Vibe64 startup argument: ${String(e||"").trim()}`);return t.code="vibe64_invalid_startup_argument",t}function
|
|
696
|
-
let r=String(e[t+1]||"").trim();if(!r)throw se(o);return r}function
|
|
697
|
-
length;r+=1){let n=String(e[r]||"").trim();if(!n)continue;let i=n.toLowerCase();if(!
|
|
698
|
-
e,r,n);if(t||o)throw se(s);o=ae.resolve(s),t
|
|
699
|
-
if(!s||t||o)throw se(n);o=ae.resolve(s),t
|
|
700
|
-
return!t&&!o&&(o=
|
|
701
|
-
2),{targetRoot:t=""}={}){return
|
|
702
|
-
e)))||"local-project"}async function
|
|
703
|
-
e)}catch(t){console.warn(`Could not open browser automatically: ${t.message}`)}}}function
|
|
704
|
+
`);var oa=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:o,any:r}=Ne[e];return[
|
|
705
|
+
e,Object.freeze({name:t,guideUrl:o,install:r})]})));import{execFile as na}from"node:child_process";import{promisify as ia}from"node:util";var _y=ia(na);import So from"node:path";var aa="runtime",ca="open.json";function ua(e=""){let t=L(e);return t?So.join(So.resolve(t),aa,ca):""}var wb=Object.freeze({projectRuntimeOpenStatePath:ua});function $t(e=""){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,"")}import{startServer as Na}from"../server.bundle.mjs";import{realpathSync as Oa}from"node:fs";import Pa from"node:path";import Ra from"node:process";function Ro(e,t){let o=Pa.
|
|
706
|
+
resolve(String(e||""));try{return t(o)}catch{return o}}function Ao({entrypointPath:e,argv:t=Ra.argv,realpath:o=Oa}){let r=t[1];
|
|
707
|
+
return r?Ro(r,o)===Ro(e,o):!1}var Mt="__local__",Lt="VIBE64_RUNTIME_NAMESPACE";var Io="local";var Aa=new URL("./server.js",import.meta.url).href,ja=xa(Aa),ka=3001,xo=new Map([["--open",!0],["--open=true",!0],["--op\
|
|
708
|
+
en=1",!0],["--no-open",!1],["--open=false",!1],["--open=0",!1]]);function No(e,t){return e.some(o=>xo.get(String(o||"").
|
|
709
|
+
trim().toLowerCase())===t)}function $a(e=y.argv.slice(2)){return No(e,!0)}function Ma(e=y.argv.slice(2)){return No(e,!1)}
|
|
710
|
+
function La({entrypointPath:e=ja,...t}={}){return Ao({entrypointPath:e,...t})}function se(e=""){let t=new Error(`Unsuppo\
|
|
711
|
+
rted Vibe64 startup argument: ${String(e||"").trim()}`);return t.code="vibe64_invalid_startup_argument",t}function Da(e,t,o){
|
|
712
|
+
let r=String(e[t+1]||"").trim();if(!r)throw se(o);return r}function Ba(e=y.argv.slice(2)){let t="",o="";for(let r=0;r<e.
|
|
713
|
+
length;r+=1){let n=String(e[r]||"").trim();if(!n)continue;let i=n.toLowerCase();if(!xo.has(i)){if(i==="--project"){let s=Da(
|
|
714
|
+
e,r,n);if(t||o)throw se(s);o=ae.resolve(s),t=$e(o),r+=1;continue}if(i.startsWith("--project=")){let s=n.slice(10).trim();
|
|
715
|
+
if(!s||t||o)throw se(n);o=ae.resolve(s),t=$e(o);continue}if(n.startsWith("-")||t||o)throw se(n);o=ae.resolve(n),t=$e(o)}}
|
|
716
|
+
return!t&&!o&&(o=y.cwd(),t=$e(o)),{openOnStart:Ua(e,{targetRoot:o}),startupSlug:t,targetRoot:o}}function Ua(e=y.argv.slice(
|
|
717
|
+
2),{targetRoot:t=""}={}){return Ma(e)?!1:$a(e)?!0:!!String(t||"").trim()}function $e(e=""){return $t(ae.basename(ae.resolve(
|
|
718
|
+
e)))||"local-project"}async function Fa(e){try{await et(e,{app:{name:P.browser,arguments:["--new-window"]}})}catch{try{await et(
|
|
719
|
+
e)}catch(t){console.warn(`Could not open browser automatically: ${t.message}`)}}}function Ga({env:e=y.env,openOnStart:t=!1,
|
|
704
720
|
startupSlug:o="",targetRoot:r=""}={}){let n=!!String(e.PORT||"").trim();return{browserLifecycleShutdown:!0,port:t===!0&&
|
|
705
|
-
!n?
|
|
706
|
-
trim();return t||(e[
|
|
707
|
-
"darwin"||String(e[
|
|
721
|
+
!n?ka:void 0,runtimeMode:Io,strictPort:n,startupSlug:o,targetRoot:r}}function za({env:e=y.env}={}){let t=String(e[Lt]||"").
|
|
722
|
+
trim();return t||(e[Lt]=Mt,Mt)}function Va({env:e=y.env,exists:t=Ia,home:o=Co.homedir(),platform:r=y.platform}={}){if(r!==
|
|
723
|
+
"darwin"||String(e[Rt]||"").trim())return"";let n=Pe({env:e,home:o,platform:"darwin"}),i=Pe({env:e,home:o,platform:"linu\
|
|
708
724
|
x"});return t(n)||!t(i)?"":[`Vibe64 now keeps its data in ${n}.`,"Move your existing data there, then start Vibe64 again\
|
|
709
725
|
:",` mv ${ie(i)} ${ie(n)}`].join(`
|
|
710
|
-
`)}async function
|
|
711
|
-
trim())return"";let n=
|
|
712
|
-
if(e){console.error(e),
|
|
713
|
-
|
|
726
|
+
`)}async function Ha({env:e=y.env,home:t=Co.homedir(),makeDirectory:o=Ca,platform:r=y.platform}={}){if(String(e[Rt]||"").
|
|
727
|
+
trim())return"";let n=Pe({env:e,home:t,platform:r});return await o(n,{recursive:!0,mode:448}),n}async function Wa(){let e=Va();
|
|
728
|
+
if(e){console.error(e),y.exitCode=1;return}let{openOnStart:t,startupSlug:o,targetRoot:r}=Ba();za(),await Ha();let n=await Na(
|
|
729
|
+
Ga({openOnStart:t,startupSlug:o,targetRoot:r})),i=n.vibe64Url;if(i){console.log(`Vibe64 is running at ${i}`),t&&await Fa(
|
|
714
730
|
i);return}n.vibe64Listen?.transport==="socket"&&(console.log(`Vibe64 is listening on Unix socket ${n.vibe64Listen.socketPath}`),
|
|
715
|
-
t&&console.warn("Cannot open a browser for a Unix socket listener. Set VIBE64_PUBLIC_ORIGIN or PORT."))}
|
|
716
|
-
e=>{console.error("Failed to start Vibe64 server:",e),
|
|
717
|
-
|
|
731
|
+
t&&console.warn("Cannot open a browser for a Unix socket listener. Set VIBE64_PUBLIC_ORIGIN or PORT."))}La()&&Wa().catch(
|
|
732
|
+
e=>{console.error("Failed to start Vibe64 server:",e),y.exitCode=1});export{za as applyLocalCliRuntimeNamespace,La as isDirectServerExecution,Va as macosDataMoveMessage,Ba as parseStartupArgs,
|
|
733
|
+
Ha as prepareLocalSystemRoot,Ga as serverStartOptions,$a as shouldOpenBrowser};
|