vibe64 0.1.65 → 0.1.67
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 +2004 -1363
- package/bin/server.js +282 -276
- package/bin/upgrade-state.js +4673 -4470
- package/dist/assets/{GithubBrowserTabs-D21Nl3QI.js → GithubBrowserTabs-CW3GBeJu.js} +1 -1
- package/dist/assets/{LocalDatabaseServer-POxY1K1U.js → LocalDatabaseServer-DYh3UF9q.js} +1 -1
- package/dist/assets/{SelectField-Dezd0B3y.js → SelectField-Df50ZFLj.js} +1 -1
- package/dist/assets/{ShellOutlet-DfF9vsWA.js → ShellOutlet-DkLdtzJW.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-I3ufyScN.js → Vibe64AuthSettingsButton-Cksj7FS6.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-DFfFPrd7.css → Vibe64AuthSettingsButton-DfKYI6ZS.css} +1 -1
- package/dist/assets/{Vibe64ConversationLog-C04oOQ2g.js → Vibe64ConversationLog-BC0eDtUP.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-BbrOUmRD.js → Vibe64DashboardShell-DX5dOXAB.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-VPEM2o1v.js → Vibe64DatabaseWorkspace-8i-RDc9y.js} +1 -1
- package/dist/assets/{Vibe64FileArea-C_nC2bPk.js → Vibe64FileArea-EK5yUio3.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-DTO3Fw3x.js → Vibe64OutputControls--LB4G83q.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-B8xcCOvL.js → Vibe64RepositoryWorkspace-D6uJCype.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-Cb9Mxsyq.js → Vibe64SessionFiles-DVHGc7hd.js} +1 -1
- package/dist/assets/{Vibe64SessionSourceEditor-CVQ3NRjh.js → Vibe64SessionSourceEditor-Bws5ihr-.js} +1 -1
- package/dist/assets/{Vibe64UiStoryboardView-BV4JFgcZ.js → Vibe64UiStoryboardView-BmABkyG4.js} +1 -1
- package/dist/assets/{Vibe64UnavailableSessions-DGQAxYE-.js → Vibe64UnavailableSessions-C6Bkwsqk.js} +1 -1
- package/dist/assets/{_pageId_-CkG15vv4.js → _pageId_-FjW-3sqF.js} +1 -1
- package/dist/assets/{_sessionId_-Bka3RUmK.js → _sessionId_-4cH83Bfi.js} +1 -1
- package/dist/assets/_slug_-Cazfy5ui.js +14 -0
- package/dist/assets/_slug_-DQDycgFK.css +1 -0
- package/dist/assets/{access-Xo3unxGO.js → access-mxcxtn7b.js} +1 -1
- package/dist/assets/{app-B0spNegd.js → app-8zP_FAuO.js} +1 -1
- package/dist/assets/assistantRouting-Bbxguvre.js +3 -0
- package/dist/assets/{changes-DFv4tuoO.js → changes-cmlEyHug.js} +1 -1
- package/dist/assets/{client-4uCr4dYG.js → client-BJBzomgt.js} +1 -1
- package/dist/assets/{client-CVuXqm4b.js → client-C1i-bIgL.js} +1 -1
- package/dist/assets/{client-Dlg1kjjO.js → client-C7yZ1hEm.js} +1 -1
- package/dist/assets/{client-CevjVK2b.js → client-CQ49uWhR.js} +1 -1
- package/dist/assets/{client-DR0w56e8.js → client-D46Uu-YO.js} +2 -2
- package/dist/assets/{client-BjMjS6lX.js → client-DKNTl1to.js} +2 -2
- package/dist/assets/{conversation-OkWbkHjm.js → conversation-CFJRkeTj.js} +3 -3
- package/dist/assets/{conversation-DReMq0MF.css → conversation-COcuIkcD.css} +1 -1
- package/dist/assets/conversation-CexAK3Qk.js +1 -0
- package/dist/assets/{dashboard-CAca9MQn.js → dashboard-CMtWKazq.js} +1 -1
- package/dist/assets/{english-definitions-BtX8KA5g.js → english-definitions-DiyU9O9D.js} +1 -1
- package/dist/assets/{env-DrNyBVkB.js → env-LUc22Wgd.js} +1 -1
- package/dist/assets/{error-BqMxhgpB.js → error-BccdQn04.js} +1 -1
- package/dist/assets/{error-BQ7r64JO.js → error-DPDAz9Td.js} +1 -1
- package/dist/assets/{errorMessageHelpers-B49LyMJi.js → errorMessageHelpers-G32Hjqfm.js} +1 -1
- package/dist/assets/{health-B5yTW5Tt.js → health-CfMjMJFf.js} +1 -1
- package/dist/assets/{history-S3anp6xg.js → history-hX_kNskf.js} +1 -1
- package/dist/assets/{httpClient-Bwitq9Xf.js → httpClient-C71X5grL.js} +1 -1
- package/dist/assets/{i18n-BuXRXGaO.js → i18n-5EHeMSvt.js} +1 -1
- package/dist/assets/{i18n-DQPYjuW7.js → i18n-BSfPKqM3.js} +1 -1
- package/dist/assets/{i18n-Dm74yE_M.js → i18n-Dq-ep9n7.js} +1 -1
- package/dist/assets/index-BJWiPV6i.css +1 -0
- package/dist/assets/index-FVeEbKiO.js +134 -0
- package/dist/assets/{integrations-C7dj7el_.js → integrations-Ccb8EOEO.js} +14 -15
- package/dist/assets/{integrations-CwgrZgmM.css → integrations-CtnIjM1Y.css} +1 -1
- package/dist/assets/{issues-OkV4v4GX.js → issues-Bxtt7oqi.js} +1 -1
- package/dist/assets/{learning-lW9nBGjT.js → learning-BUx9jo91.js} +1 -1
- package/dist/assets/{pages-shOT9IVe.js → pages-D43zM2UW.js} +1 -1
- package/dist/assets/{project-files-D_K1N0JF.js → project-files-BX3zZCcl.js} +1 -1
- package/dist/assets/{publish-Bxe4ZCqe.js → publish-DatierL2.js} +1 -1
- package/dist/assets/{pull-requests-CQvk0TeH.js → pull-requests-DNkOjcuy.js} +1 -1
- package/dist/assets/{repository-CI2CqDwF.js → repository-0EKOcyTL.js} +1 -1
- package/dist/assets/{settings-DIVrFrs4.js → settings-DbR9JIc3.js} +1 -1
- package/dist/assets/{studioGateApi-UqmdV50W.js → studioGateApi-B9EUTtMx.js} +1 -1
- package/dist/assets/{studioUrls-k_pQIuPs.js → studioUrls-BR4ZL-TN.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-BkWrTOzg.js → useArchivedVibe64Sessions-B8VDhA9F.js} +1 -1
- package/dist/assets/useAssistantAttachments-C9kAnWqw.js +2 -0
- package/dist/assets/useCommand-CfqxMb4C.js +1 -0
- package/dist/assets/{useEndpointResource-DZTjr9gg.js → useEndpointResource-BwGXpV2u.js} +1 -1
- package/dist/assets/{useUiFeedback-BU4NyMq8.js → useUiFeedback-8Wvg7A_S.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-BADhWyNY.js → useVibe64ConversationLog-7wgLlKG5.js} +2 -2
- package/dist/assets/useVibe64Learning-DkneotqS.js +5 -0
- package/dist/assets/{useVibe64SessionData-DvFvAJC-.js → useVibe64SessionData-DuJ-dHR8.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-BukDTAxb.js → useVibe64SessionSelection-BwjtqeIR.js} +1 -1
- package/dist/assets/{vibe64FileUpload-BDkcaUyk.js → vibe64FileUpload-D_rOa1R8.js} +1 -1
- package/dist/assets/{vibe64RepositoryRealtime-DX2DEqIz.js → vibe64RepositoryRealtime-CVGNqwxz.js} +1 -1
- package/dist/assets/vibe64SavedEnvValues-CCZew0j7.js +1 -0
- package/dist/assets/{vibe64SessionFocus-CzuP3qPT.js → vibe64SessionFocus-B4diopOJ.js} +1 -1
- package/dist/index.html +23 -23
- package/docs/colleague-usage/ai-accounts.md +7 -7
- package/docs/colleague-usage/ai-model-setups.md +1 -1
- package/docs/colleague-usage/ai-tasks.md +2 -1
- package/docs/colleague-usage/auto-workflow.md +67 -44
- package/docs/colleague-usage/chat-settings.md +115 -114
- package/docs/colleague-usage/coding-agent-goal-pause.md +34 -12
- package/docs/colleague-usage/coding-agent-goals.md +33 -16
- package/docs/colleague-usage/coding-agent-history.md +9 -0
- package/docs/colleague-usage/coding-agent-questions.md +7 -0
- package/docs/colleague-usage/coding-agent-recovery.md +3 -0
- package/docs/colleague-usage/coding-agents.md +10 -4
- package/docs/colleague-usage/connected-repositories.md +4 -1
- package/docs/colleague-usage/developing-vibe64.md +11 -5
- package/docs/colleague-usage/development-env.md +74 -32
- package/docs/colleague-usage/github-work.md +39 -5
- package/docs/colleague-usage/integrations.md +2 -2
- package/docs/colleague-usage/main-chat-approvals.md +7 -6
- package/docs/colleague-usage/message-delivery-recovery.md +1 -1
- package/docs/colleague-usage/passes.md +260 -0
- package/docs/colleague-usage/plans.md +27 -16
- package/docs/colleague-usage/session-timeline.md +93 -0
- package/docs/colleague-usage/temporary-chats.md +6 -0
- package/docs/colleague-usage/ui-pass.md +30 -32
- package/docs/colleague-usage/workspace-preparation.md +51 -0
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +12 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +2 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +5 -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/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/patterns/calendar-cli/example/.env.example +1 -0
- package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/patterns/api-key-connection/PATTERN.md +4 -1
- package/node_modules/@jskit-ai/connectors-catalog/patterns/oauth-connection/PATTERN.md +3 -1
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/connectors-core/README.md +3 -1
- 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 +6 -0
- package/node_modules/@jskit-ai/kernel/package.json +3 -4
- package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/payments-core/locales/en.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/realtime/patterns/realtime-application/example/.env.example +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-core/package.json +2 -0
- package/node_modules/@local/vibe64-execution/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +715 -666
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +989 -847
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +129 -107
- package/node_modules/@local/vibe64-genesis/src/server/index.js +632 -614
- package/node_modules/@local/vibe64-genesis/src/server/packaging.js +27 -28
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +172 -162
- package/node_modules/@local/vibe64-runtime/package.json +1 -0
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +1042 -898
- package/node_modules/@local/vibe64-terminals/package.json +2 -1
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +560 -420
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +586 -581
- package/package.json +15 -15
- package/server.bundle.mjs +44592 -44103
- package/dist/assets/_slug_-7Oo7pGKn.js +0 -14
- package/dist/assets/_slug_-BaxjtsgP.css +0 -1
- package/dist/assets/assistantRouting-B9cub38g.js +0 -3
- package/dist/assets/conversation-D7T_us2O.js +0 -1
- package/dist/assets/index-DSyb-mRJ.css +0 -1
- package/dist/assets/index-JBqyg0mr.js +0 -134
- package/dist/assets/useAssistantAttachments-DqlNFiha.js +0 -2
- package/dist/assets/useCommand-D-MIMmhp.js +0 -1
- package/dist/assets/useVibe64Learning-CbsI-XHB.js +0 -5
- package/dist/assets/vibe64SavedEnvValues-CgfMvj_h.js +0 -1
package/bin/server.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
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 Dt.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Be(){return
|
|
6
|
-
(
|
|
7
|
-
Be()),
|
|
8
|
-
"/proc/version","utf8").toLowerCase().includes("microsoft"))return!C()}catch{}return
|
|
9
|
-
misc/WSLInterop")||
|
|
10
|
-
.0\\powershell.exe`;var
|
|
11
|
-
utf8",...r})};
|
|
12
|
-
e=>
|
|
3
|
+
import{existsSync as Ma}from"node:fs";import{mkdir as La}from"node:fs/promises";import jo from"node:os";import ae from"node:path";import sr from"node:process";import et from"node:path";import{fileURLToPath as vn}from"node:url";import Tn from"node:child_process";
|
|
4
|
+
import On,{constants as Pn}from"node:fs/promises";import Wo from"node:path";import{promisify as qo}from"node:util";import Yo from"node:child_process";import Ve,{constants as Vt}from"node:fs/promises";import Bt from"node:process";import Fo from"node:os";import Ge from"node:fs";import Uo from"node:fs";import Dt from"node:fs";var Ue;function Lo(){try{return Dt.statSync("/.dockerenv"),!0}catch{return!1}}function Do(){try{
|
|
5
|
+
return Dt.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Be(){return Ue===void 0&&
|
|
6
|
+
(Ue=Lo()||Do()),Ue}var Fe,Bo=()=>{try{return Uo.statSync("/run/.containerenv"),!0}catch{return!1}};function C(){return Fe===void 0&&(Fe=Bo()||
|
|
7
|
+
Be()),Fe}var Ut=()=>{if(Bt.platform!=="linux")return!1;if(Fo.release().toLowerCase().includes("microsoft"))return!C();try{if(Ge.readFileSync(
|
|
8
|
+
"/proc/version","utf8").toLowerCase().includes("microsoft"))return!C()}catch{}return Ge.existsSync("/proc/sys/fs/binfmt_\
|
|
9
|
+
misc/WSLInterop")||Ge.existsSync("/run/WSL")?!C():!1},S=Bt.env.__IS_WSL_TEST__?Ut:Ut();import Ft from"node:process";import{Buffer as Go}from"node:buffer";import{promisify as zo}from"node:util";import Vo from"node:child_process";var Ho=zo(Vo.execFile),ze=()=>`${Ft.env.SYSTEMROOT||Ft.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1\
|
|
10
|
+
.0\\powershell.exe`;var N=async(e,t={})=>{let{powerShellPath:o,...r}=t,n=N.encodeCommand(e);return Ho(o??ze(),[...N.argumentsPrefix,n],{encoding:"\
|
|
11
|
+
utf8",...r})};N.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];N.encodeCommand=
|
|
12
|
+
e=>Go.from(e,"utf16le").toString("base64");N.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,Vt.F_OK),r=!0}catch{}if(!r)return e;let n=await
|
|
16
|
-
i,t=t.endsWith("/")?t:`${t}/`,t)}})(),
|
|
17
|
-
ue=S?
|
|
14
|
+
mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var Jo=qo(Yo.execFile),Ko=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let o="/etc/wsl.conf",r=!1;try{await Ve.
|
|
15
|
+
access(o,Vt.F_OK),r=!0}catch{}if(!r)return e;let n=await Ve.readFile(o,{encoding:"utf8"}),i=Gt(n);return i===void 0?e:(t=
|
|
16
|
+
i,t=t.endsWith("/")?t:`${t}/`,t)}})(),Xo=async()=>`${await Ko()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,
|
|
17
|
+
ue=S?Xo:ze,zt,Ht=async()=>(zt??=(async()=>{try{let e=await ue();return await Ve.access(e,Vt.X_OK),!0}catch{return!1}})(),
|
|
18
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
|
|
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 Yt from"node:process";import{Buffer as
|
|
23
|
-
.0\\powershell.exe`;var Jt=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],Kt=e=>
|
|
24
|
-
"base64"),
|
|
25
|
-
shell:!1}),v=async(e,t={})=>{let{powerShellPath:o,...r}=t;return
|
|
26
|
-
Kt;v.escapeArgument=
|
|
27
|
-
t,{configurable:!0,enumerable:!0,get(){let n=o();return r(n),n},set(n){r(n)}}),e}import{promisify as
|
|
28
|
-
|
|
19
|
+
{stdout:o}=await N(t,{powerShellPath:e,cwd:Wo.dirname(e)});return o.trim()},Zo=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())Zo(a)||(r.push(s),n.push(a));let i=[...o];if(n.length>0)try{let{
|
|
21
|
+
stdout:s}=await Jo("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 Qo}from"node:buffer";import{promisify as en}from"node:util";import tn from"node:child_process";var rn=en(tn.execFile),on=()=>`${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=>Qo.from(e,"utf16le").toString(
|
|
24
|
+
"base64"),nn=e=>`'${String(e).replaceAll(/['‘’‚‛]/g,t=>t+t)}'`,Xt=e=>[...Jt,Kt(e)],sn=e=>({encoding:"utf8",...e,
|
|
25
|
+
shell:!1}),v=async(e,t={})=>{let{powerShellPath:o,...r}=t;return rn(o??on(),Xt(e),sn(r))};v.argumentsPrefix=Jt;v.encodeCommand=
|
|
26
|
+
Kt;v.escapeArgument=nn;v.createArguments=Xt;function x(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 _n}from"node:util";import Ke from"node:process";import{execFile as yn}from"node:child_process";import{promisify as an}from"node:util";import cn from"node:process";import{execFile as un}from"node:child_process";var ln=an(
|
|
28
|
+
un);async function He(){if(cn.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await ln("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 dn from"node:process";import{promisify as pn}from"node:util";import{execFile as mn,execFileSync as Uc}from"node:child_process";
|
|
31
|
+
var fn=pn(mn);async function Zt(e,{humanReadableOutput:t=!0,signal:o}={}){if(dn.platform!=="darwin")throw new Error("mac\
|
|
32
|
+
OS only");let r=t?[]:["-ss"],n={};o&&(n.signal=o);let{stdout:i}=await fn("osascript",["-e",e,r],n);return i.trim()}async function We(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 Qt from"node:process";import{promisify as
|
|
35
|
-
|
|
34
|
+
ontents:Info.plist")`)}import Qt from"node:process";import{promisify as hn}from"node:util";import{execFile as gn}from"node:child_process";var wn=hn(
|
|
35
|
+
gn),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"}},Ye=new Map(Object.entries(le)),qe=class extends Error{};
|
|
43
|
+
async function Je(e=wn){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 qe(`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
|
-
tr)):"",rr=
|
|
47
|
+
n.slice(0,s);return le[n]??le[a]??le[c]??{name:n,id:n}}var bn=_n(yn),En=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,t=>t.toUpperCase());async function Xe(){if(Ke.platform===
|
|
48
|
+
"darwin"){let e=await He();return{name:await We(e),id:e}}if(Ke.platform==="linux"){let{stdout:e}=await bn("xdg-mime",["q\
|
|
49
|
+
uery","default","x-scheme-handler/http"]),t=e.trim();return{name:En(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(Ke.
|
|
50
|
+
platform==="win32")return Je();throw new Error("Only macOS, Linux, and Windows are supported")}import Ze from"node:process";var Sn=!!(Ze.env.SSH_CONNECTION||Ze.env.SSH_CLIENT||Ze.env.SSH_TTY),er=Sn;var tr=new URL("./../node_modules/open/index.js",import.meta.url).href,de=Symbol("fallbackAttempt"),Qe=tr?et.dirname(vn(
|
|
51
|
+
tr)):"",rr=et.join(Qe,"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
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(
|
|
@@ -56,7 +56,7 @@ o,u=>pe({...e,app:{name:u,arguments:r},[de]:!0}));if(o==="browser"||o==="browser
|
|
|
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 Wt();d=
|
|
59
|
+
ate"},d;if(S){let f=await Wt();d=Ye.get(f)??{}}else d=await Xe();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
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.
|
|
@@ -64,70 +64,70 @@ background&&i.push("--background"),e.newInstance&&i.push("--new"),o&&i.push("-a"
|
|
|
64
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=!
|
|
67
|
+
r.join(","))),e.target=v.encodeCommand(u.join(" ")),e.wait||(s.stdio="ignore"),S&&(s.cwd=et.dirname(n))}else{if(o)n=o;else{
|
|
68
|
+
let u=!Qe||Qe==="/",l=!1;try{await On.access(rr,Pn.X_OK),l=!0}catch{}n=sr.versions.electron??(j==="android"||u||!l)?"xdg\
|
|
69
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=
|
|
70
|
+
e.target&&i.push(e.target);let c=Tn.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
|
-
|
|
74
|
+
Rn=(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
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
|
-
e)}var P={browser:"browser",browserPrivate:"browserPrivate"};
|
|
76
|
+
e)}var P={browser:"browser",browserPrivate:"browserPrivate"};x(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)\
|
|
79
|
-
/Google/Chrome/Application/chrome.exe"]}}));
|
|
79
|
+
/Google/Chrome/Application/chrome.exe"]}}));x(P,"brave",()=>W({darwin:"brave browser",win32:"brave",linux:["brave-browse\
|
|
80
80
|
r","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Prog\
|
|
81
81
|
ram Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/App\
|
|
82
|
-
lication/brave.exe"]}}));
|
|
83
|
-
linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));
|
|
82
|
+
lication/brave.exe"]}}));x(P,"firefox",()=>W({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
83
|
+
linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));x(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"}));
|
|
86
|
-
|
|
85
|
+
e.exe"}));x(P,"safari",()=>W({darwin:"Safari"}));var tt=Rn;import _ from"node:process";import{fileURLToPath as Da}from"node:url";var hu=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 y(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
|
+
In(t)}function In(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===0}function rt(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(rt(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(rt(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(!rt(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"}function
|
|
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 ot(e,t=""){
|
|
99
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
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
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"&&
|
|
103
|
-
n)}}var
|
|
104
|
-
(?:${lr}):${
|
|
105
|
-
`^${pr}$`),
|
|
106
|
-
|
|
107
|
-
2
|
|
102
|
+
) is above its maxItems (${r.maxItems}).`);r.type==="array"&&g(r.items)&&typeof r.items.type=="string"&&ot({"[]":r.items},
|
|
103
|
+
n)}}var nt="^(?: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]",U="[0-5]\\d",he=`\
|
|
104
|
+
(?:${lr}):${U}`,dr=`(?:Z|[+-](?:${lr}):${U})`,pr=`(${ar})-(${cr})-(${ur})`,mr=`${ar}-(?:${cr})-(?:${ur})`,fr=`^${mr}$`,Cn=new RegExp(
|
|
105
|
+
`^${pr}$`),Nn=new RegExp(`^${he}(?::${U}(?:\\.(\\d+))?)?$`),xn=new RegExp(`^${pr}T${he}:${U}(?:\\.(\\d+))?${dr}$`),jn=new RegExp(
|
|
106
|
+
nt),kn=[31,28,31,30,31,30,31,31,30,31,30,31];function $n(e){return e%4===0&&(e%100!==0||e%400===0)}function Mn(e,t){return t===
|
|
107
|
+
2?$n(e)?29:28:kn[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<=Mn(r,n)}function Y(e,t){
|
|
108
108
|
let o=e.temporalPrecision;if(o!==void 0){if(!Number.isInteger(o)||o<0)throw new Error(`temporalPrecision for "${t}" must\
|
|
109
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=
|
|
111
|
-
exec(e);return o!==null&&gr(o[1],t)}function
|
|
110
|
+
"string")return!1;let t=Cn.exec(e);return t!==null&&hr(t[1],t[2],t[3])}function _r(e,t){if(typeof e!="string")return!1;let o=Nn.
|
|
111
|
+
exec(e);return o!==null&&gr(o[1],t)}function yr(e,t){if(typeof e!="string")return!1;let o=xn.exec(e);return o===null?!1:
|
|
112
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}(?::${
|
|
114
|
-
let o;if(typeof e=="number")o=e;else if(typeof e=="string"&&
|
|
115
|
-
o)||o<-t||o>t?null:o===0?0:o}var
|
|
116
|
-
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function
|
|
117
|
-
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function
|
|
118
|
-
let n=o?
|
|
113
|
+
let o=Y(e,t);return`^${he}(?::${U}${br(o)})?$`}function Sr(e,t){let o=Y(e,t);return`^${mr}T${he}:${U}${br(o)}${dr}$`}function it(e,t){
|
|
114
|
+
let o;if(typeof e=="number")o=e;else if(typeof e=="string"&&jn.test(e))o=Number(e);else return null;return!Number.isSafeInteger(
|
|
115
|
+
o)||o<-t||o>t?null:o===0?0:o}var Ln=new Set(["__proto__","prototype","constructor"]);function p(e,t,o){Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0})}function Dn(e,t){if(Ln.
|
|
116
|
+
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function Un(e){return typeof e!="string"?e:e.replace(
|
|
117
|
+
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function st(e,t,{normalize:o=!1,allowEmpty:r=!1}={}){
|
|
118
|
+
let n=o?Un(e):e;if(typeof n!="string"||n.trim()===""){if(r&&n==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
119
119
|
dotted path string.`)}let i=n.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${n}".`);
|
|
120
|
-
for(let s of i)
|
|
121
|
-
|
|
122
|
-
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:
|
|
123
|
-
none:()=>({type:
|
|
120
|
+
for(let s of i)Dn(s,t);return i}var Bn="http://json-schema.org/draft-07/schema#",R="x-json-rest-schema",at=["object","array","string","number","boolean"],
|
|
121
|
+
ct=Symbol("json-rest-schema.exportContext"),Fn=["true","1","yes","y","on"],Gn=["false","0","no","n","off"];function vr(e){
|
|
122
|
+
return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:nt}]}}function k(e,t){return{[R]:{[e]:t}}}var zn={
|
|
123
|
+
none:()=>({type:at}),blob:()=>({type:at}),serialize:()=>({type:at}),object:()=>({type:"object"}),array:()=>({type:"array"}),
|
|
124
124
|
file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["number","string"]}),integer:()=>({type:["int\
|
|
125
125
|
eger","string"]}),epochMilliseconds:()=>vr(864e13),epochSeconds:()=>vr(864e10),dateTime:({definition:e,fieldName:t})=>({
|
|
126
126
|
type:"string",format:"date-time",pattern:Sr(e,t)}),date:()=>({type:"string",format:"date",pattern:fr}),time:({definition:e,
|
|
127
127
|
fieldName:t})=>({type:"string",pattern:Er(e,t)}),boolean:({definition:e})=>{if(e.strictBoolean===!0)return{type:"boolean"};
|
|
128
|
-
let t=new Set([...
|
|
128
|
+
let t=new Set([...Fn,String(e.stringTrueWhen||"true").trim().toLowerCase()]),o=new Set([...Gn,String(e.stringFalseWhen||
|
|
129
129
|
"false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},{type:"string",enum:[...o,...t]}]}},
|
|
130
|
-
id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},
|
|
130
|
+
id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Vn={minLength:({definition:e,parameterValue:t})=>e.
|
|
131
131
|
type==="string"?{minLength:t}:null,maxLength:({definition:e,parameterValue:t})=>e.type==="string"?{maxLength:t}:null,min:({
|
|
132
132
|
definition:e,parameterValue:t})=>D(e)?{minimum:t}:null,max:({definition:e,parameterValue:t})=>D(e)?{maximum:t}:null,pattern:({
|
|
133
133
|
definition:e,parameterValue:t})=>e.type==="string"?{pattern:t instanceof RegExp?t.source:t}:null,enum:({parameterValue:e})=>({
|
|
@@ -137,96 +137,96 @@ parameterValue:e})=>e?k("transforms",{uppercase:!0}):null,lowercase:({parameterV
|
|
|
137
137
|
null,length:({parameterValue:e})=>k("transforms",{length:e}),unsigned:({parameterValue:e})=>e?k("metadata",{unsigned:!0}):
|
|
138
138
|
null,precision:({parameterValue:e})=>k("metadata",{precision:e}),scale:({parameterValue:e})=>k("metadata",{scale:e}),temporalPrecision:({
|
|
139
139
|
parameterValue:e})=>k("metadata",{temporalPrecision:e}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,
|
|
140
|
-
defaultTo:()=>null};function
|
|
141
|
-
"object"&&!Array.isArray(r)&&!Array.isArray(n)){
|
|
140
|
+
defaultTo:()=>null};function pt(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)){pt(n,r);continue}e[o]=r}}function Hn(e,t){if(!t||typeof t!="object"||Array.
|
|
142
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])){
|
|
144
|
-
e[o]=t[o]}}function
|
|
145
|
-
1?e:{anyOf:r}}function
|
|
146
|
-
let o=e.types[t.type];if(typeof o.toJsonSchema=="function")return o.toJsonSchema;let r=
|
|
147
|
-
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return r}function
|
|
148
|
-
hasOwn(e.validators,t))return null;let r=e.validators[t];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=
|
|
143
|
+
R&&e[o]&&typeof e[o]=="object"&&typeof t[o]=="object"&&!Array.isArray(e[o])&&!Array.isArray(t[o])){pt(e[o],t[o]);continue}
|
|
144
|
+
e[o]=t[o]}}function Wn(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 qn(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=zn[t.type];if(!r)throw new Error(
|
|
147
|
+
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return r}function Yn(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=Vn[t];
|
|
149
149
|
if(n)return n;throw new Error(`Validator '${t}' on field '${o}' cannot be exported to JSON Schema without a toJsonSchema\
|
|
150
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
|
|
151
|
+
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function Jn(e,t={}){if(t.mode!==
|
|
152
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
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
|
|
154
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Tr(t.mode)}function Kn(e,t={}){
|
|
155
155
|
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
156
|
-
let o=
|
|
157
|
-
t,
|
|
158
|
-
e[
|
|
159
|
-
"_").replace(/^_+|_+$/g,"")||"operation"}function
|
|
160
|
-
function ge(e){return
|
|
161
|
-
o&&i.operation===r&&i.additionalProperties===n)||null}function
|
|
162
|
-
return e.nextDefinitionId+=1,r}function Or(e,t,o,r,n,{root:i=!1}={}){let s=we(t),a=
|
|
156
|
+
let o=Jn(e,t);return{operationName:o,operation:e.operations[o]}}function Xn(e={}){let t={...e};return Object.defineProperty(
|
|
157
|
+
t,ct,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function we(e={}){return e[ct]?
|
|
158
|
+
e[ct]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function Zn(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
159
|
+
"_").replace(/^_+|_+$/g,"")||"operation"}function ut(e){return g(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
160
|
+
function ge(e){return ut(e)?{allOf:[e]}:e}function Qn(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 ei(e,t){let o=Zn(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=Qn(s,e,o,r,n);if(a)return i&&(a.pointer=
|
|
163
163
|
"#",s.rootNode=a),a;let c={schema:e,operationName:o,operation:r,additionalProperties:n,status:"new",definitionName:i?null:
|
|
164
|
-
|
|
164
|
+
ei(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
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=
|
|
167
|
-
return e.status="built",e.pointer==="#"?r:(o.definitions[e.definitionName]=r,{$ref:e.pointer})}function
|
|
166
|
+
ing",e.pointer!=="#"&&(o.definitions[e.definitionName]={});let r=ti(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 mt(e,t,o,r,n=!1){
|
|
168
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
|
|
169
|
+
referenceBacked:t}}function ti(e,t,o,r,n=!1){let i={},s=[];for(let[c,u]of Object.entries(e.structure))p(i,c,ft(e,c,u,t,o,
|
|
170
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
|
|
171
|
+
0&&(a.required=s),a}function ri(e,t,o,r,n,i){let s=me(t,o);if(!s)return null;if(s.kind==="schema")return{...ge(mt(s.schema,
|
|
172
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
|
|
174
|
-
let s=q(t,o);if(!s)return null;if(s.kind==="schema")return{...ge(
|
|
173
|
+
"schema")?"replace":n,c=a==="replace"?e.operations.replace:i;return ft(e,`${t}[]`,o.items,r,a,c)}function oi(e,t,o,r,n,i){
|
|
174
|
+
let s=q(t,o);if(!s)return null;if(s.kind==="schema")return{...ge(mt(s.schema,r,"replace",s.schema.operations.replace,!1)),
|
|
175
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
|
|
177
|
-
t,o);if(a.kind==="nested")return J(
|
|
178
|
-
"opaque")return J({type:"object",additionalProperties:!0});if(a.kind==="map")return J({type:"object",additionalProperties:
|
|
179
|
-
e,t,o,r,n,i)})}let s=
|
|
176
|
+
lace"?e.operations.replace:i;return ft(e,`${t}.*`,s.definition,r,a,c)}function ni(e,t,o,r,n,i){if(o.type==="object"){let a=fe(
|
|
177
|
+
t,o);if(a.kind==="nested")return J(mt(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:oi(
|
|
179
|
+
e,t,o,r,n,i)})}let s=qn(e,o)({schema:e,fieldName:t,definition:o,operation:n,mode:n,options:r});if(!s||typeof s!="object"||
|
|
180
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=
|
|
182
|
-
function
|
|
181
|
+
"array"){let a=ri(e,t,o,r,n,i);if(a)return J({...s,items:a},{referenceBacked:ut(s)})}return J(s,{referenceBacked:ut(s)})}
|
|
182
|
+
function ft(e,t,o,r,n,i){let s={schema:e,fieldName:t,definition:o,operation:n,mode:n,options:r},a=ni(e,t,o,r,n,i),c=a.referenceBacked?
|
|
183
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=
|
|
185
|
-
c[R]&&(
|
|
186
|
-
|
|
184
|
+
continue;let f=Yn(e,m,t);if(!f)continue;let h=f({...s,parameterName:m,parameterValue:o[m],fieldSchema:{...c}});h&&Hn(c,h)}
|
|
185
|
+
c[R]&&(pt(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
|
+
Wn(c,l));if(o.defaultTo!==void 0&&i.applyDefaults)if(typeof o.defaultTo!="function"){let m=e._normalizeDefault(o,o.defaultTo,
|
|
187
187
|
{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(n,i,{})});
|
|
188
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=
|
|
190
|
-
operation:n}=
|
|
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
|
|
192
|
-
G}function
|
|
189
|
+
code}).`)}d.default=m.value}else u.defaults={providedByFunction:!0};return d[R]=u,d}function Rr(e,t={}){let o=Xn(t),{operationName:r,
|
|
190
|
+
operation:n}=Kn(e,o),i=o.additionalProperties===void 0?!1:o.additionalProperties,s=we(o),a=Or(e,o,r,n,i,{root:!0}),c={$schema:Bn,
|
|
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 bt(e){return e instanceof
|
|
192
|
+
G}function ii(){return{self:!1,children:{}}}function Ir(e){return Object.keys(e.children).length>0}function $(e,t){return`${e}\
|
|
193
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.
|
|
194
|
-
startsWith(o)?e.slice(o.length):null}function
|
|
195
|
-
field:n})}return o}function
|
|
196
|
-
r.length;i++){let s=r[i];Object.hasOwn(n,s)||p(n,s,
|
|
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
|
|
198
|
-
null?!0:Array.isArray(e)||g(e)?Object.keys(e).length>0:e!==void 0}function
|
|
199
|
-
test(t),n=/^[0-9]+$/.test(o);return r&&n?Number(t)-Number(o):r?-1:n?1:t.localeCompare(o)})}function
|
|
200
|
-
test(e)}function
|
|
201
|
-
null,o.types=e.types,o.validators=e.validators,o.operations=e.operations,o.structure=be(
|
|
202
|
-
Object.freeze(o)}function
|
|
194
|
+
startsWith(o)?e.slice(o.length):null}function B(e,t){let o={};for(let r of Object.values(e)){let n=$(t,r.field);p(o,n,{...r,
|
|
195
|
+
field:n})}return o}function _t(e){return st(e,"validatePath")}function Nr(e){let t={};for(let o of e){let r=_t(o),n=t;for(let i=0;i<
|
|
196
|
+
r.length;i++){let s=r[i];Object.hasOwn(n,s)||p(n,s,ii()),i===r.length-1&&(n[s].self=!0),n=n[s].children}}return t}function si(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 _e(e){return e===
|
|
198
|
+
null?!0:Array.isArray(e)||g(e)?Object.keys(e).length>0:e!==void 0}function xr(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 ai(e){return/^[0-9]+$/.
|
|
200
|
+
test(e)}function ci(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(ye(e.structure,t)),o._installOperationMethods(),
|
|
202
|
+
Object.freeze(o)}function ye(e,t=new WeakMap){if(e===null||typeof e!="object")return e;if(bt(e))return ci(e,t);if(e instanceof
|
|
203
203
|
Date)return new Date(e.getTime());if(e instanceof RegExp){let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,
|
|
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(
|
|
205
|
-
return e;let o={};t.set(e,o);for(let[r,n]of Object.entries(e))p(o,r,
|
|
206
|
-
null||typeof e!="object"||t.has(e)||
|
|
207
|
-
ownKeys(e))be(e[o],t);return Object.freeze(e)}function
|
|
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(ye(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,ye(n,t));return o}function be(e,t=new WeakSet){if(e===
|
|
206
|
+
null||typeof e!="object"||t.has(e)||bt(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 ht(e){return be(ye(e))}var gt=new WeakMap;function yt(e,t,o=""){if(!bt(
|
|
208
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
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
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(!
|
|
211
|
+
length<1)return null;let[i,...s]=o;if(!ai(i))return null;let a=$(r,i);return n.kind==="schema"?s.length<1?null:yt(n.schema,
|
|
212
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
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
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
|
|
215
|
+
skipParams=r:delete o.skipParams}return o}var ui=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
216
216
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
217
217
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,
|
|
218
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
|
|
220
|
-
typeof n!="boolean")throw new Error(`Operation "${e}" must define ${o} as a boolean.`)}function
|
|
219
|
+
`Operation "${e}" must define ${o} as one of: ${r.join(", ")}.`)}function wt(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 li(e,t){if(typeof t!="ob\
|
|
221
221
|
ject"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);return jr(e,t,"targetFields",["\
|
|
222
|
-
schema","input"]),
|
|
222
|
+
schema","input"]),wt(e,t,"enforceRequired"),wt(e,t,"applyDefaults"),jr(e,t,"outputFields",["validated","input"]),wt(e,t,
|
|
223
223
|
"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.enforceRequired,applyDefaults:t.
|
|
224
224
|
applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===void 0?!0:t.rejectExplicitUndefined})}
|
|
225
|
-
function
|
|
226
|
-
.");let t=Object.create(null);for(let[o,r]of Object.entries(
|
|
225
|
+
function di(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(ui))p(t,o,r);for(let[o,r]of Object.entries(e))p(t,o,li(o,r));
|
|
227
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
|
|
229
|
-
this.structure=t,this.types=kr(o),this.validators=kr(r),this.operations=
|
|
228
|
+
freeze(t)}function pi(e){let t={...e};return delete t.operation,delete t.mode,t}var G=class{constructor(t,o,r,n={}){ot(t),
|
|
229
|
+
this.structure=t,this.types=kr(o),this.validators=kr(r),this.operations=di(n),this._installOperationMethods()}_typeError(t){
|
|
230
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(
|
|
231
231
|
r);return i.errorObject={field:t,code:o,message:r,params:n},i}_paramToBeSkipped(t,o,r){return typeof o!="object"||o===null?
|
|
232
232
|
!1:!!(Array.isArray(o[r])&&o[r].includes(t))}_fieldToBeSkipped(t,o){return Array.isArray(o.skipFields)&&o.skipFields.includes(
|
|
@@ -241,7 +241,7 @@ rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:n=>Object.hasOwn(
|
|
|
241
241
|
o))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let o=t.operation??t.mode??
|
|
242
242
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
243
243
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,o))throw new Error(
|
|
244
|
-
`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:pi(t)}}_buildOperationResult(t,o,r){
|
|
245
245
|
let n={};for(let i of r.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=r.isFieldPresent(i);(o[i]!==
|
|
246
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){
|
|
247
247
|
return fe(t,o)}_resolveArrayItemsConfig(t,o){return me(t,o)}_resolveObjectValuesConfig(t,o){return q(t,o)}_buildArrayItemSettings(t,o){
|
|
@@ -267,18 +267,18 @@ c,o,r,n,i,s):c.kind==="map"?this._validateObjectValues(o,r,n,c.valuesConfig,i,s)
|
|
|
267
267
|
_resolveArrayItemsConfig(o,t);return a?this._validateArrayItems(o,r,n,a,i,s):{}}_validateNestedObjectSchema(t,o,r,n,i,s){
|
|
268
268
|
let a=r[n],c=t.allowAdditionalProperties?this._extractKnownObjectFields(a,t.schema):a,u=t.schema._validateWithOperation(
|
|
269
269
|
s.operationName,s.operation,c,F(i,o));return p(r,n,t.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
|
|
270
|
-
a,t.schema,u.validatedObject):u.validatedObject),
|
|
270
|
+
a,t.schema,u.validatedObject):u.validatedObject),B(u.errors,o)}_extractKnownObjectFields(t,o){let r={};for(let[n,i]of Object.
|
|
271
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.
|
|
272
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(
|
|
273
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.
|
|
274
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(
|
|
275
275
|
u,this._singleErrorMap(this._typeError(d).errorObject)):delete c[l];continue}if(n.kind==="schema"){let h=n.schema._validateWithOperation(
|
|
276
|
-
"replace",n.schema.operations.replace,m,F(i,d));p(c,l,h.validatedObject),this._mergeErrors(u,
|
|
276
|
+
"replace",n.schema.operations.replace,m,F(i,d));p(c,l,h.validatedObject),this._mergeErrors(u,B(h.errors,d));continue}let f=this.
|
|
277
277
|
_normalizeAndValidateValue(n.definition,m,d,c,l,a,i,this._buildArrayItemSettings(n.definition,s));this._mergeErrors(u,f)}
|
|
278
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);
|
|
279
279
|
if(this._fieldToBeSkipped(d,i))continue;if(!Object.hasOwn(a,l)||c[l]===void 0){s.rejectExplicitUndefined?this._mergeErrors(
|
|
280
280
|
u,this._singleErrorMap(this._typeError(d).errorObject)):delete c[l];continue}if(n.kind==="schema"){let f=n.schema._validateWithOperation(
|
|
281
|
-
"replace",n.schema.operations.replace,c[l],F(i,d));p(c,l,f.validatedObject),this._mergeErrors(u,
|
|
281
|
+
"replace",n.schema.operations.replace,c[l],F(i,d));p(c,l,f.validatedObject),this._mergeErrors(u,B(f.errors,d));continue}
|
|
282
282
|
let m=this._normalizeAndValidateValue(n.definition,c[l],d,c,l,a,i,this._buildArrayItemSettings(n.definition,s));this._mergeErrors(
|
|
283
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(
|
|
284
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(
|
|
@@ -291,7 +291,7 @@ this.structure))if(!a.isFieldPresent(c)&&this.structure[c].defaultTo!==void 0){l
|
|
|
291
291
|
"function"?u.defaultTo():u.defaultTo,d=this._normalizeDefault(u,l,{fieldPath:c,currentObject:s,containerKey:c,objectBeforeCast:r,
|
|
292
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.
|
|
293
293
|
add(c)}}return{validatedObject:this._buildOperationResult(r,s,a),errors:i}}_validateSelectedTree(t,o,r,n,i=""){let s={},
|
|
294
|
-
a={};for(let c of
|
|
294
|
+
a={};for(let c of xr(Object.keys(t))){let u=$r(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema \
|
|
295
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){
|
|
296
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))
|
|
297
297
|
return{};let d=Object.hasOwn(r,t),m=r[t],f={};if(!d){if(u&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("requi\
|
|
@@ -302,62 +302,62 @@ Object.keys(I.errors).length===0&&p(n,t,I.value)}return f}if(m===void 0)return u
|
|
|
302
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.
|
|
303
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);
|
|
304
304
|
if(Object.keys(b.errors).length>0)return b.errors;if(!b.shouldContinue)return{};let ce=this._validateSelectedDescendants(
|
|
305
|
-
c,o.children,a,h,t,i,s);return
|
|
305
|
+
c,o.children,a,h,t,i,s);return _e(h[t])&&p(n,t,h[t]),ce}_validateSelectedDescendants(t,o,r,n,i,s,a){if(t.type==="object"){
|
|
306
306
|
let c=this._resolveObjectFieldMode(r,t);if(c.kind!=="nested")throw new Error(`Schema path "${r}" does not support nested\
|
|
307
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});
|
|
308
|
-
return p(n,i,l.validatedObject),
|
|
308
|
+
return p(n,i,l.validatedObject),B(l.errors,r)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(r,t);if(!c)throw new Error(
|
|
309
309
|
`Schema path "${r}" does not define array items for nested selection.`);return this._validateSelectedArrayItems(r,n,i,c,
|
|
310
310
|
o,s,a)}throw new Error(`Schema path "${r}" does not support nested field selection.`)}_validateSelectedArrayItems(t,o,r,n,i,s,a){
|
|
311
|
-
let c=[],u=o[r],l={};p(o,r,c);for(let d of
|
|
311
|
+
let c=[],u=o[r],l={};p(o,r,c);for(let d of xr(Object.keys(i))){if(!/^[0-9]+$/.test(d))throw new Error(`Schema path "${$(
|
|
312
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(
|
|
313
313
|
h);if(this._fieldToBeSkipped(f,s))continue;if(!Object.hasOwn(u,m)){b&&a.rejectExplicitUndefined&&p(l,f,this._typeError(f).
|
|
314
314
|
errorObject);continue}let E=u[m];if(E===void 0){b&&a.rejectExplicitUndefined&&p(l,f,this._typeError(f).errorObject);continue}
|
|
315
|
-
if(n.kind==="schema"){if(b){let
|
|
316
|
-
validatedObject)&&p(c,m,
|
|
315
|
+
if(n.kind==="schema"){if(b){let De=n.schema._validateWithOperation("replace",n.schema.operations.replace,E,F(s,f));_e(De.
|
|
316
|
+
validatedObject)&&p(c,m,De.validatedObject),this._mergeErrors(l,B(De.errors,f));continue}if(!ce)continue;let H=n.schema.
|
|
317
317
|
_validateSelectedTree(h.children,E,F(s,f),{...a,operationName:"replace",operation:n.schema.operations.replace,defaultedFields:new Set});
|
|
318
|
-
|
|
318
|
+
_e(H.validatedObject)&&p(c,m,H.validatedObject),this._mergeErrors(l,B(H.errors,f));continue}let I=this._buildArrayItemSettings(
|
|
319
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
|
|
321
|
-
E,f,O,0,u,s,I);if(Object.keys(
|
|
322
|
-
let
|
|
320
|
+
void 0?p(c,m,O[0]):O[0]===null&&p(c,m,null),this._mergeErrors(l,H);continue}if(!ce)continue;let Le=this._castValue(n.definition,
|
|
321
|
+
E,f,O,0,u,s,I);if(Object.keys(Le.errors).length>0){this._mergeErrors(l,Le.errors);continue}if(!Le.shouldContinue)continue;
|
|
322
|
+
let Mo=this._validateSelectedDescendants(n.definition,h.children,f,O,0,s,I);_e(O[0])&&p(c,m,O[0]),this._mergeErrors(l,Mo)}
|
|
323
323
|
return l}validateWith(t,o,r={}){if(!Object.hasOwn(this.operations,t))throw new Error(`Unknown operation "${t}".`);let n=this.
|
|
324
324
|
operations[t];return this._assertPlainObjectInput(t,o),this._validateWithOperation(t,n,o,r)}validateAt(t,o,r={}){this._assertPlainObjectInput(
|
|
325
|
-
"validateAt",o);let n=
|
|
326
|
-
_validateSelectedTree(
|
|
325
|
+
"validateAt",o);let n=_t(t),{operationName:i,operation:s,validationOptions:a}=this._resolvePathValidationRequest(r),c=this.
|
|
326
|
+
_validateSelectedTree(Nr([t]),o,a,this._buildOperationSettings(i,s,o));return{validatedValue:si(c.validatedObject,n),errors:c.
|
|
327
327
|
errors}}validatePaths(t,o,r={}){if(this._assertPlainObjectInput("validatePaths",o),!Array.isArray(t)||t.length===0)throw new Error(
|
|
328
328
|
"validatePaths() expects a non-empty array of schema paths.");let{operationName:n,operation:i,validationOptions:s}=this.
|
|
329
|
-
_resolvePathValidationRequest(r);return this._validateSelectedTree(
|
|
329
|
+
_resolvePathValidationRequest(r);return this._validateSelectedTree(Nr(t),o,s,this._buildOperationSettings(n,i,o))}_installOperationMethods(){
|
|
330
330
|
for(let t of Object.keys(this.operations)){if(t in this)throw new Error(`Operation name "${t}" is reserved and cannot be\
|
|
331
331
|
used as a schema method.`);this[t]=(o,r={})=>this.validateWith(t,o,r)}}toJsonSchema(t={}){return Rr(this,t)}getFieldDefinitions(){
|
|
332
|
-
return
|
|
333
|
-
"")throw new Error("Field path must be a non-empty string.");let o=yt(this,
|
|
334
|
-
let o=this.getFieldDefinition(t);return!o||typeof o.messages!="object"||o.messages===null?Object.freeze({}):
|
|
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:
|
|
336
|
-
{"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=
|
|
337
|
-
d;let m=r.call(this,l,d);switch(typeof m){case Lr:if(m===null)return m;case
|
|
338
|
-
"object"||typeof e=="function")&&typeof e.then=="function"}function
|
|
332
|
+
return gt.has(this)||gt.set(this,ht(this.structure)),gt.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,_t(t.trim()));return o===null?null:ht(o)}getFieldMessages(t){
|
|
334
|
+
let o=this.getFieldDefinition(t);return!o||typeof o.messages!="object"||o.messages===null?Object.freeze({}):ht(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:Hu,stringify:mi}=JSON,{keys:Wu}=Object,fi=String,hi="string";var Lr="object",gi=(e,t)=>t;var Dr=(e,t,o)=>{let r=fi(t.push(o)-1);return e.set(o,r),r};var Ur=(e,t,o)=>{let r=t&&typeof t===Lr?(l,d)=>l===""||-1<t.indexOf(l)?d:void 0:t||gi,n=new Map,i=[],s=[],a=+Dr(n,i,r.call(
|
|
336
|
+
{"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=mi(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 hi:return n.get(m)||Dr(n,i,m)}return m}};var _i=new Set(["true","1","yes","y","on"]),yi=new Set(["false","0","no","n","off"]);function bi(e){return e!==null&&(typeof e==
|
|
338
|
+
"object"||typeof e=="function")&&typeof e.then=="function"}function Br(e){if(typeof e=="number")return Number.isFinite(e)?
|
|
339
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();
|
|
340
|
-
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 Et(e,t){if(Object.is(e,t))return!0;
|
|
341
341
|
if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.
|
|
342
342
|
source===t.source&&e.flags===t.flags;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==
|
|
343
|
-
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(!Et(e[n],t[n]))return!1;return!0}if(e===null||t===null||typeof e!="objec\
|
|
344
344
|
t"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let o=Object.keys(e),r=Object.keys(
|
|
345
|
-
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)||!Et(e[n],t[n]))return!1;return!0}var Ei={install(e){
|
|
346
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;
|
|
347
347
|
if(i==="string"||i==="number"||i==="boolean"){let s=n.toString();return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),
|
|
348
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();
|
|
349
|
-
return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),t("blob",r=>r.value),t("number",r=>{let n=
|
|
350
|
-
null&&r.throwTypeError(),n}),t("integer",r=>{let n=
|
|
351
|
-
n}),t("epochMilliseconds",r=>{let n=
|
|
352
|
-
r.value,864e10);return n===null&&r.throwTypeError(),n}),t("dateTime",r=>{let n=Y(r.definition,r.fieldName);return
|
|
349
|
+
return r.definition.noTrim?s:s.trim()}r.throwTypeError()}),t("blob",r=>r.value),t("number",r=>{let n=Br(r.value);return n===
|
|
350
|
+
null&&r.throwTypeError(),n}),t("integer",r=>{let n=Br(r.value);return(n===null||!Number.isInteger(n))&&r.throwTypeError(),
|
|
351
|
+
n}),t("epochMilliseconds",r=>{let n=it(r.value,864e13);return n===null&&r.throwTypeError(),n}),t("epochSeconds",r=>{let n=it(
|
|
352
|
+
r.value,864e10);return n===null&&r.throwTypeError(),n}),t("dateTime",r=>{let n=Y(r.definition,r.fieldName);return yr(r.value,
|
|
353
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
|
|
354
|
+
r.fieldName);return _r(r.value,n)||r.throwTypeError(),r.value}),t("array",r=>r.definition.type==="array"&&!Array.isArray(
|
|
355
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
|
|
356
|
+
r.value)}catch{try{return Ur(r.value)}catch{r.throwTypeError()}}}),t("boolean",r=>{if(typeof r.value=="boolean")return r.
|
|
357
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==
|
|
358
358
|
"bigint"){if(r.value===1n)return!0;if(r.value===0n)return!1;r.throwTypeError()}if(typeof r.value=="string"){let n=String(
|
|
359
359
|
r.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(r.definition.stringTrueWhen||"true").trim().toLowerCase(),
|
|
360
|
-
s=r.value.trim().toLowerCase(),a=new Set([...
|
|
360
|
+
s=r.value.trim().toLowerCase(),a=new Set([...yi,n]),c=new Set([..._i,i]);if(a.has(s))return!1;if(c.has(s))return!0}r.throwTypeError()}),
|
|
361
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.
|
|
362
362
|
value=="bigint"){if(r.value>0n&&r.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(r.value);r.throwTypeError()}if(typeof r.
|
|
363
363
|
value=="string"){let n=r.value.trim();/^[1-9][0-9]*$/.test(n)||r.throwTypeError();let i=Number(n);return Number.isSafeInteger(
|
|
@@ -370,7 +370,7 @@ r.value.toString().length>r.parameterValue&&r.throwParamError("MAX_LENGTH",`Leng
|
|
|
370
370
|
characters.`,{max:r.parameterValue,actual:r.value.toString().length})}),o("max",r=>{r.value!==void 0&&D(r.definition)&&
|
|
371
371
|
typeof r.value=="number"&&r.value>r.parameterValue&&r.throwParamError("MAX_VALUE",`Value must be no more than ${r.parameterValue}\
|
|
372
372
|
.`,{max:r.parameterValue,actual:r.value})}),o("enum",r=>{if(!Array.isArray(r.parameterValue))throw new Error(`Enum for ${r.
|
|
373
|
-
fieldName} must be an array.`);r.parameterValue.some(i=>
|
|
373
|
+
fieldName} must be an array.`);r.parameterValue.some(i=>Et(i,r.value))||r.throwParamError("ENUM_VALUE","Value must match\
|
|
374
374
|
one of the allowed enum values.",{allowed:r.parameterValue})}),o("pattern",r=>{if(r.value===void 0||r.definition.type!==
|
|
375
375
|
"string"||typeof r.value!="string")return;let n=r.parameterValue,i=n instanceof RegExp?new RegExp(n.source,n.flags):typeof n==
|
|
376
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)||
|
|
@@ -378,7 +378,7 @@ r.throwParamError("PATTERN","Value does not match the required pattern.",{patter
|
|
|
378
378
|
parameterValue){if(r.definition.type!=="boolean")throw new Error(`strictBoolean can only be used on boolean fields (${r.
|
|
379
379
|
fieldName}).`);typeof r.valueBeforeCast!="boolean"&&r.throwParamError("STRICT_BOOLEAN","Value must be a boolean.")}}),o(
|
|
380
380
|
"validator",r=>{if(typeof r.parameterValue!="function")throw new Error(`Validator for ${r.fieldName} must be a function.`);
|
|
381
|
-
let n=r.parameterValue(r.value,r.object,r);if(
|
|
381
|
+
let n=r.parameterValue(r.value,r.object,r);if(bi(n))throw new Error(`Custom validator for "${r.fieldName}" must be synch\
|
|
382
382
|
ronous.`);typeof n=="string"&&r.throwParamError("CUSTOM_VALIDATOR_FAILED",n)}),o("uppercase",r=>{if(typeof r.value=="str\
|
|
383
383
|
ing")return r.value.toUpperCase()}),o("lowercase",r=>{if(typeof r.value=="string")return r.value.toLowerCase()}),o("leng\
|
|
384
384
|
th",r=>{if(typeof r.value=="string")return r.value.substr(0,r.parameterValue);Number.isInteger(Number(r.valueBeforeCast))&&
|
|
@@ -390,74 +390,77 @@ r.throwParamError("MAX_ITEMS",`Must have no more than ${r.parameterValue} items.
|
|
|
390
390
|
o("notEmpty",r=>{r.parameterValue&&typeof r.value=="string"&&r.value===""&&r.throwParamError("NOT_EMPTY","Field cannot b\
|
|
391
391
|
e empty.")}),o("required",()=>{}),o("unsigned",()=>{}),o("precision",()=>{}),o("scale",()=>{}),o("temporalPrecision",r=>{
|
|
392
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=
|
|
394
|
-
if(typeof o!="function")throw new Error(`Type handler for '${t}' must be a function.`);p(e,t,o)}function
|
|
393
|
+
e or dateTime fields (${r.fieldName}).`)}),o("nullable",()=>{}),o("nullOnEmpty",()=>{}),o("defaultTo",()=>{})}},Fr=Ei;var Hr=new WeakMap,Wr=new WeakMap,qr=Symbol.for("json-rest-schema.registry-metadata"),Ee=new WeakSet;function Si(e,t,o){
|
|
394
|
+
if(typeof o!="function")throw new Error(`Type handler for '${t}' must be a function.`);p(e,t,o)}function vi(e,t,o){if(typeof o!=
|
|
395
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
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
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
|
|
398
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>o}),enumerable:!1,configurable:!1,writable:!1})}function Ti(e){if(!e||
|
|
399
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];
|
|
400
400
|
return r&&typeof r.getTypes=="function"&&typeof r.getValidators=="function"?{types:r.getTypes(),validators:r.getValidators()}:
|
|
401
401
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
402
402
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
403
|
-
validators}:null}function
|
|
403
|
+
validators}:null}function Oi(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function Vr(e,t,o){for(let[r,n]of Object.
|
|
404
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
|
|
406
|
-
types:Se(e),validators:Se(t)};let n=Object.create(null),i=Object.create(null);for(let s of r){let a=
|
|
405
|
+
factories with conflicting ${o} "${r}".`)}p(e,r,n)}}function Pi(e,t,o){let r=Oi(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=Ti(s);if(!a)throw new Error(
|
|
407
407
|
"Factory sources must be schema instances or schema factories created by json-rest-schema.");Vr(n,a.types,"type"),Vr(i,a.
|
|
408
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)=>{
|
|
410
|
-
i.addValidator=(s,a)=>{
|
|
411
|
-
let a=
|
|
412
|
-
addType(s,a)},addValidator:(s,a)=>{Ee.add(a),i.addValidator(s,a)}}),i}var Jr=Yr({installCore:!0});var
|
|
413
|
-
function vt(e,t){let o=
|
|
414
|
-
if(e==null)return Object.freeze({});if(!
|
|
415
|
-
ty ids.`);let o={},r=new Set;for(let[n,i]of Object.entries(e)){let s=String(n||"").trim();if(!
|
|
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)=>{Si(r,s,a)},
|
|
410
|
+
i.addValidator=(s,a)=>{vi(n,s,a)},i.use=s=>{Gr(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{
|
|
411
|
+
let a=Pi(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 ml=Object.freeze({schema:Jr({}),mode:"replace"});var Kr=/^[a-z][a-z0-9_.-]*$/u,Ai=/^[A-Za-z_$][A-Za-z0-9_$]*$/u;function Ii(e){return String(e||"").trim().toLowerCase()}
|
|
413
|
+
function vt(e,t){let o=Ii(e);if(!Kr.test(o))throw new TypeError(`${t} must match ${Kr.toString()}.`);return o}function Te(e,t){
|
|
414
|
+
if(e==null)return Object.freeze({});if(!y(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(!Ai.test(s))throw new TypeError(
|
|
416
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
|
|
418
|
-
freeze({});if(!
|
|
417
|
+
declares capability "${a}" more than once.`);r.add(a),o[s]=a}return Object.freeze(o)}function Ci(e,t,o){if(e==null)return Object.
|
|
418
|
+
freeze({});if(!y(e))throw new TypeError(`${o}.hints must be an object mapping required capability ids to what to registe\
|
|
419
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(
|
|
420
420
|
`${o}.hints names "${a}", which the provider does not require.`);if(typeof s!="string"||!s.trim())throw new TypeError(`${o}\
|
|
421
|
-
.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 Ni(e){let t=new Map;
|
|
422
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}\
|
|
423
|
-
" is declared by both ${t.get(n)} and ${o}.`);t.set(n,o)}}function
|
|
424
|
-
throw new TypeError(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
423
|
+
" is declared by both ${t.get(n)} and ${o}.`);t.set(n,o)}}function xi(e,t,o){for(let r of Object.values(t))for(let[n,i]of Object.
|
|
424
|
+
entries(o))if(Object.values(i).includes(r))throw new TypeError(n==="provides"?`Provider "${e}" cannot late-require capab\
|
|
425
|
+
ility "${r}" that it provides.`:`Provider "${e}" names capability "${r}" under both late and ${n}.`)}function St(e,t){if(e==
|
|
426
|
+
null)return null;if(typeof e!="function")throw new TypeError(`${t} must be a function when provided.`);return e}function Oe({
|
|
427
|
+
id:e,requires:t={},optional:o={},late:r={},provides:n={},hints:i={},setup:s,boot:a=null,shutdown:c=null}={}){let u=vt(e,
|
|
428
|
+
"Provider id"),l=Te(t,`${u}.requires`),d=Te(o,`${u}.optional`),m=Te(r,`${u}.late`),f=Te(n,`${u}.provides`);Ni({requires:l,
|
|
429
|
+
optional:d,late:m,provides:f}),xi(u,m,{provides:f,requires:l,optional:d});let h=St(s,`${u}.setup`);if(!h)throw new TypeError(
|
|
430
|
+
`${u}.setup is required.`);return Object.freeze({id:u,requires:l,optional:d,late:m,provides:f,hints:Ci(i,{...l,...m},u),
|
|
431
|
+
setup:h,boot:St(a,`${u}.boot`),shutdown:St(c,`${u}.shutdown`)})}var Xr="public";var ji="/api",Qr=`${ji}/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\
|
|
429
432
|
tration is closed after the first payload is resolved.");let l=T(a);if(!l)throw new TypeError("Bootstrap contributor id \
|
|
430
433
|
is required.");if(typeof u!="function")throw new TypeError(`Bootstrap contributor "${l}" requires contribute().`);if(t.has(
|
|
431
434
|
l))throw new Error(`Bootstrap contributor "${l}" is duplicated.`);return t.add(l),e.push(Object.freeze({id:l,order:Number.
|
|
432
435
|
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(
|
|
433
436
|
(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.
|
|
434
|
-
freeze({...
|
|
437
|
+
freeze({...y(a)?a:{},payload:Object.freeze({...c})}));c={...c,...y(d)?d:{}}}return Object.freeze(c)}function i(){return Object.
|
|
435
438
|
freeze({sealed:o,contributorIds:Object.freeze(e.map(a=>a.id).sort())})}let s=Object.freeze({register:r,resolve:n,diagnostics:i});
|
|
436
|
-
return s}var
|
|
439
|
+
return s}var ki=Oe({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"runtime.bootstrap"},setup({http:e}){
|
|
437
440
|
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
|
|
441
|
+
async(o,r)=>{r.code(200).send(await t.resolve({request:o,reply:r,query:o.query||{}}))}),{bootstrap:t}}});function $i(e){if(!y(e))throw new TypeError("Event listener must be an object.");let t=String(e.id||"").trim();if(!t)throw new TypeError(
|
|
439
442
|
"Event listener id is required.");if(typeof e.handle!="function")throw new TypeError(`Event listener "${t}" requires han\
|
|
440
443
|
dle().`);if(e.matches!=null&&typeof e.matches!="function")throw new TypeError(`Event listener "${t}" matches must be a f\
|
|
441
|
-
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function
|
|
444
|
+
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function Mi(e){if(!y(e))throw new TypeError(
|
|
442
445
|
"Published event must be an object.");let t=String(e.type||"").trim();if(!t)throw new TypeError("Published event type is\
|
|
443
|
-
required.");return Object.freeze({...e,type:t})}function Ot(){let e=[],t=new Set;function o(s){let a
|
|
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=
|
|
446
|
+
required.");return Object.freeze({...e,type:t})}function Ot(){let e=[],t=new Set;function o(s){let a=$i(s);if(t.has(a.id))
|
|
447
|
+
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function r(s){let a=Mi(s);
|
|
445
448
|
for(let c of e)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function n(){return Object.freeze({listenerIds:Object.
|
|
446
|
-
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:o,publish:r,diagnostics:n});return i}var
|
|
447
|
-
ibrary","Application Support","Vibe64"));let n=String(e.XDG_STATE_HOME||"").trim();return eo(
|
|
448
|
-
l","state"),"vibe64"))}var
|
|
449
|
+
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:o,publish:r,diagnostics:n});return i}var Li=Oe({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:Ot()}}});import{AsyncLocalStorage as Di}from"node:async_hooks";var md=new Di;import Pe from"node:path";import Pt from"node:process";import Ui from"node:os";var Rt="VIBE64_SYSTEM_ROOT";function eo(e,t){let o=String(e||"").trim();return Pe.resolve(o||t||Pt.cwd())}function Re({env:e,home:t=Ui.homedir(),platform:o=Pt.platform}){let r=t||Pt.cwd();if(o==="darwin")return eo(Pe.join(r,"L\
|
|
450
|
+
ibrary","Application Support","Vibe64"));let n=String(e.XDG_STATE_HOME||"").trim();return eo(Pe.join(n||Pe.join(r,".loca\
|
|
451
|
+
l","state"),"vibe64"))}var Md=Object.freeze({runtimePackRoot:"",sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1});var Yd=Object.freeze(["repository","branch","path","baseCommit","canonicalCommit"]);import{execFile as Gi}from"node:child_process";import{promisify as zi}from"node:util";var Qd=zi(Gi);function Vi([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.
|
|
449
452
|
isSafeInteger(s)||!Number.isSafeInteger(a)?null:{displayName:String(r||"").split(",")[0],gid:a,home:String(n||""),shell:String(
|
|
450
|
-
i||""),uid:s,username:String(e||"")}}function
|
|
451
|
-
t[0],t[2],t[3],t[4],t[5],t[6]])}var
|
|
453
|
+
i||""),uid:s,username:String(e||"")}}function Hi(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:Vi([
|
|
454
|
+
t[0],t[2],t[3],t[4],t[5],t[6]])}var ep=Object.freeze({parsePasswdLine:Hi});function w(e=""){return String(e??"").trim()}function Z(e={}){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}var pp=Object.freeze({SIGABRT:"Aborted",SIGALRM:"Timeout or timer",SIGHUP:"Terminal closed",SIGINT:"User interruption wi\
|
|
452
455
|
th CTRL-C",SIGKILL:"Forced termination",SIGPIPE:"Broken pipe or socket",SIGQUIT:"User interruption with CTRL-\\",SIGSEGV:"\
|
|
453
|
-
Segmentation fault",SIGTERM:"Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"});var
|
|
454
|
-
" ":"\\t"});import{fileURLToPath as
|
|
455
|
-
in",customScheme:"",appLinkDomains:Object.freeze([])}),
|
|
456
|
-
versionName:"1.0.0"});var
|
|
457
|
-
"metadata","migrations","runtime","vite"]);import
|
|
456
|
+
Segmentation fault",SIGTERM:"Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"});var mp=new RegExp("\\p{Separator}|\\p{Other}","gu"),fp=Object.freeze({" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r",
|
|
457
|
+
" ":"\\t"});import{fileURLToPath as Yi}from"node:url";var qi=new URL("./../node_modules/@local/vibe64-execution/src/server/engines/detached.js",import.meta.url).href;var _p=Yi(new URL("./detachedReaper.js",qi));import{createRequire as Xi}from"node:module";var Ki=new URL("./../node_modules/@jskit-ai/kernel/server/support/symlinkSafeRequire.js",import.meta.url).href;var Cp=Xi(Ki);var Mp=Object.freeze(["bundled","dev_server"]),Lp=Object.freeze(["capacitor"]),Dp=Object.freeze({callbackPath:"/auth/log\
|
|
458
|
+
in",customScheme:"",appLinkDomains:Object.freeze([])}),Up=Object.freeze({packageName:"",minSdk:26,targetSdk:35,versionCode:1,
|
|
459
|
+
versionName:"1.0.0"});var sm=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),am=Object.freeze(["capabilities","kind",
|
|
460
|
+
"metadata","migrations","runtime","vite"]);import rs from"node:path";var es="jskit-client-build",pm=new RegExp(`<meta name="${es}" content="([0-9a-f]+)"`,"u");var _m=rs.join("dist","index.html");var Ie=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
458
461
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
459
|
-
R","VIBE64_MYSQL_USER"]);var te="GIT_AUTHOR_NAME",re="GIT_AUTHOR_EMAIL",oe="GIT_COMMITTER_NAME",ne="GIT_COMMITTER_EMAIL";var
|
|
460
|
-
`);var
|
|
462
|
+
R","VIBE64_MYSQL_USER"]);var te="GIT_AUTHOR_NAME",re="GIT_AUTHOR_EMAIL",oe="GIT_COMMITTER_NAME",ne="GIT_COMMITTER_EMAIL";var ss=['git config --global user.name "Your Name"','git config --global user.email "you@example.com"'].join(`
|
|
463
|
+
`);var Ce=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],
|
|
461
464
|
managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","package-lock.json"],
|
|
462
465
|
managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","composer.lock"],managedCommands:[
|
|
463
466
|
"composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-configuration.json","conanfi\
|
|
@@ -487,41 +490,41 @@ playwright:{binDirs:["playwright/bin"],identityPaths:["playwright/runtime.env","
|
|
|
487
490
|
playwright"]},postgresql:{binDirs:["postgresql/bin"],managedCommands:["initdb","pg_ctl","pg_isready","postgres","psql"]},
|
|
488
491
|
ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:["sqlite3"]}}),no=Object.
|
|
489
492
|
freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","bubblewrap","bun","php","\
|
|
490
|
-
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function
|
|
491
|
-
GHT_VERSION";var
|
|
492
|
-
steadOf",value:"ssh://git@github.com/"}]),
|
|
493
|
-
/env gh auth git-credential"}]),
|
|
494
|
-
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function
|
|
493
|
+
composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);function as(e=""){let t=w(e);return[...Ce[t]?.managedCommands||[]]}var of=Object.freeze({runtimePackManagedCommands:as});var It="VIBE64_SHARED_CACHE_ROOT",Ne="PLAYWRIGHT_BROWSERS_PATH",io="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",so="VIBE64_PLAYWRI\
|
|
494
|
+
GHT_VERSION";var ff=new Set([...Ie,re,te,ne,oe,Ne,io,so,It]);import co from"node:path";var us=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"url.https://github.com/.in\
|
|
495
|
+
steadOf",value:"ssh://git@github.com/"}]),Ef=Object.freeze([{key:"credential.https://github.com.helper",value:"!/usr/bin\
|
|
496
|
+
/env gh auth git-credential"}]),Sf=Object.freeze([{key:"credential.https://github.com.helper",value:`!f() { case "$1" in\
|
|
497
|
+
get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);function ls(e=[]){let t=new Set,
|
|
495
498
|
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
499
|
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
500
|
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);
|
|
498
501
|
s&&(o[`GIT_CONFIG_KEY_${n}`]=s,o[`GIT_CONFIG_VALUE_${n}`]=String(i?.value??""),n+=1)}return o.GIT_CONFIG_COUNT=String(n),
|
|
499
|
-
o}function
|
|
500
|
-
_RUNTIME_DIR"]);import{createRequire as
|
|
501
|
-
"deployment","health","workspace-cache","source"]),
|
|
502
|
-
8","base64"])
|
|
503
|
-
ps","github-token"]),
|
|
504
|
-
freeze(["finite","interactive","service"]),
|
|
502
|
+
o}function ds(e=[]){return ls(e).map(t=>({key:"safe.directory",value:t}))}function ps(e=[]){return ds(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function ms(e={}){return uo(e,us)}var vf=Object.freeze({applyGitConfigEntriesToEnv:uo,githubSshToHttpsGitEnv:ms,gitSafeDirectoryArgs:ps});var Nt="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";var sh=new Set([...Ie,re,te,ne,oe,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG\
|
|
503
|
+
_RUNTIME_DIR"]);import{createRequire as Cs}from"node:module";var uh=256*1024;var lh=600*1e3,dh=1440*60*1e3,ph=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});var Is=new URL("./../node_modules/@local/vibe64-execution/src/server/engines/terminalSessions.js",import.meta.url).href;var fg=Cs(Is);import{randomUUID as js}from"node:crypto";var Ng=Object.freeze(["daemon","owner-user","named-user","app"]);var xg=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview","output",
|
|
504
|
+
"deployment","health","workspace-cache","source"]),jg=Object.freeze(["capture","pty","detached"]),kg=Object.freeze(["utf\
|
|
505
|
+
8","base64"]),$g=Object.freeze(["session","project","preview","auth","deployment"]),Mg=Object.freeze(["none","github-htt\
|
|
506
|
+
ps","github-token"]),ks=Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),$s=Object.
|
|
507
|
+
freeze(["finite","interactive","service"]),Lg=1e3*1e3*100;function V(e="",t="vibe64_command_request_invalid"){let o=new Error(e||"Invalid Vibe64 command request.");return o.code=
|
|
505
508
|
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
|
|
509
|
+
"(empty)"}.`,`vibe64_command_${r}_unsupported`);return n}function Ms(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function Ls({mode:e="capture",
|
|
507
510
|
purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function z(e=""){let t=w(e);if(!t)return"";
|
|
508
511
|
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
|
|
510
|
-
inal",session:i={}}=t,s=Z(e),a=fo(s.kind,
|
|
512
|
+
"vibe64_execution_identifier_invalid");return t}function Ds(e={},t={}){let{mode:o="capture",project:r={},purpose:n="term\
|
|
513
|
+
inal",session:i={}}=t,s=Z(e),a=fo(s.kind,ks,Ls({mode:o,purpose:n}),"execution_kind"),c=fo(s.lifecycle,$s,Ms(o),"executio\
|
|
511
514
|
n_lifecycle");if(o==="detached"&&c!=="service"||o==="pty"&&c!=="interactive"||o==="capture"&&c!=="finite")throw V(`Execu\
|
|
512
515
|
tion lifecycle ${c} is incompatible with command mode ${o}.`,"vibe64_execution_lifecycle_incompatible");let u=z(s.ownerId||
|
|
513
516
|
i.sessionId);if(c==="service"&&!u)throw V("Service execution requires a durable owner id.","vibe64_execution_owner_requi\
|
|
514
517
|
red");let l=s.resourceProfile;if(l!=null&&(!l||typeof l!="object"||Object.keys(l).some(d=>!["key","compatibilityKey","en\
|
|
515
518
|
vironment"].includes(d))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l.key||"")||!/^[a-f0-9]{64}$/u.test(l.compatibilityKey||"")||
|
|
516
|
-
!["development","test","
|
|
517
|
-
|
|
518
|
-
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId
|
|
519
|
-
id:
|
|
520
|
-
projectSlug:z(s.projectSlug||r.slug||r.projectSlug),sessionId:z(s.sessionId||i.sessionId)})}function
|
|
519
|
+
!["development","test","staging"].includes(l.environment)))throw V("Invalid activity resource profile identity.","vibe64\
|
|
520
|
+
_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.freeze({...l})}:{},controlGenerationId:z(
|
|
521
|
+
s.controlGenerationId),...s.workflowId===void 0||s.workflowId===null||s.workflowId===""?{}:{workflowId:Us(s.workflowId)},
|
|
522
|
+
id:js(),kind:a,label:w(s.label),lifecycle:c,operationId:z(s.operationId),ownerId:u,parentExecutionId:z(s.parentExecutionId),
|
|
523
|
+
projectSlug:z(s.projectSlug||r.slug||r.projectSlug),sessionId:z(s.sessionId||i.sessionId)})}function Us(e){if(typeof e!=
|
|
521
524
|
"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
|
|
523
|
-
|
|
524
|
-
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),
|
|
525
|
+
ires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}var Dg=Object.freeze({normalizeExecutionDescriptor:Ds});var Jg=new URL("./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href;import{fileURLToPath as Hs}from"node:url";var Vs=new URL("./../node_modules/@local/vibe64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href;var vw=Hs(new URL("./gitTurnCheckpointCommand.js",Vs)),Tw=15*6e4,Ow=512*1024*1024,Pw=1024*1024*1024;var Iw=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"]);import{existsSync as Ws}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.",qs="curl -fsSL https://mise.run | sh",
|
|
526
|
+
Mw=Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
527
|
+
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),je=Object.freeze({claude:{
|
|
525
528
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
526
529
|
nstall.sh | bash"},codex:{name:"Codex",run:[["codex"]],guideUrl:"https://github.com/openai/codex",any:"curl -fsSL https:\
|
|
527
530
|
//chatgpt.com/codex/install.sh | sh"},opencode:{name:"opencode",run:[["opencode"]],guideUrl:"https://opencode.ai/docs/",
|
|
@@ -545,23 +548,23 @@ rl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -fsSL https
|
|
|
545
548
|
ild tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/install_ruby\
|
|
546
549
|
_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"sudo apt i\
|
|
547
550
|
nstall build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-dev",brew:"\
|
|
548
|
-
brew install pkg-config libyaml openssl@3 gmp"}}),
|
|
549
|
-
trim();return
|
|
550
|
-
return[...String(e.PATH||"").split(xe.delimiter),...String(t||"").split(xe.delimiter)].some(o=>xe.isAbsolute(o)&&
|
|
551
|
-
o,"apt-get")))}function
|
|
552
|
-
o)})}function
|
|
553
|
-
it","cpp"].includes(
|
|
554
|
-
(s=r?`mise use -g ${i.mise}`:`${
|
|
555
|
-
o==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?go:""}}var
|
|
556
|
-
function
|
|
557
|
-
`)}function
|
|
551
|
+
brew install pkg-config libyaml openssl@3 gmp"}}),Ys=Object.freeze({composer:"php"});function xt(e=""){let t=String(e||"").
|
|
552
|
+
trim();return Ys[t]||t}function wo({platform:e=ho.platform,aptGet:t=!1}={}){return e==="darwin"?"brew":t?"apt":""}function Js(e,t=Nt){
|
|
553
|
+
return[...String(e.PATH||"").split(xe.delimiter),...String(t||"").split(xe.delimiter)].some(o=>xe.isAbsolute(o)&&Ws(xe.join(
|
|
554
|
+
o,"apt-get")))}function ke({env:e,platform:t=ho.platform,systemPath:o}){return wo({platform:t,aptGet:t!=="darwin"&&Js(e,
|
|
555
|
+
o)})}function $e(e="",t={}){let{family:o="",mise:r=!1,xcode:n=!0}=t,i=je[xt(e)];if(!i)return null;if(o==="brew"&&!n&&["g\
|
|
556
|
+
it","cpp"].includes(xt(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[o]||"";if(!s&&i.mise&&
|
|
557
|
+
(s=r?`mise use -g ${i.mise}`:`${qs} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith("sudo ")||
|
|
558
|
+
o==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?go:""}}var Lw=Object.freeze({SUDO_NOTE:go,localToolFamily:wo});function _o({env:e,platform:t,systemPath:o}){return $e("git",{family:ke({env:e,platform:t,systemPath:o})})?.command||""}
|
|
559
|
+
function Ks(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
560
|
+
`)}function Xs(e,t){let o=Ks(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(o)){let r=_o(t);
|
|
558
561
|
return{code:"vibe64_git_missing",installCommand:r,message:r?`Git isn't installed on this computer. Install it with: ${r}`:
|
|
559
562
|
"Git isn't installed on this computer. Install Git, then try again."}}return/unknown option [`']initial-branch/u.test(o)?
|
|
560
|
-
{code:"vibe64_git_too_old",installCommand:
|
|
563
|
+
{code:"vibe64_git_too_old",installCommand:_o(t),message:"This Git is too old for Vibe64. Update Git to version 2.28 or n\
|
|
561
564
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
562
565
|
test(o)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
563
566
|
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\
|
|
564
|
-
s and is unlocked, then try again."}:null}var
|
|
567
|
+
s and is unlocked, then try again."}:null}var Bw=Object.freeze({describeGitFailure:Xs});function ie(e){let t=String(e);return/^[A-Za-z0-9_./:=@,+-]+$/u.test(t)?t:`'${t.replaceAll("'","'\\''")}'`}import yo from"node:path";var bo="backups.git",Eo="vibe64-atomic",Zs=`backup_canonical_ref() {
|
|
565
568
|
vibe64_backup_repository="$1"
|
|
566
569
|
vibe64_source_repository="$2"
|
|
567
570
|
vibe64_source_ref="$3"
|
|
@@ -579,7 +582,7 @@ r "$vibe64_backup_repository" rev-parse --verify "$vibe64_backup_ref"
|
|
|
579
582
|
' "$vibe64_source_ref" >&2
|
|
580
583
|
return 1
|
|
581
584
|
fi
|
|
582
|
-
}`,
|
|
585
|
+
}`,Hw=`#!/bin/sh
|
|
583
586
|
set -eu
|
|
584
587
|
|
|
585
588
|
zero_object=0000000000000000000000000000000000000000
|
|
@@ -605,7 +608,7 @@ if [ "$(git --git-dir "$backup_repository" rev-parse --is-bare-repository 2>/dev
|
|
|
605
608
|
exit 1
|
|
606
609
|
fi
|
|
607
610
|
|
|
608
|
-
${
|
|
611
|
+
${Zs}
|
|
609
612
|
|
|
610
613
|
updates_file="$(mktemp "$repository_root/.pre-receive.XXXXXX")"
|
|
611
614
|
cleanup_updates_file() {
|
|
@@ -653,8 +656,8 @@ while read -r old_object _new_object ref_name; do
|
|
|
653
656
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
654
657
|
fi
|
|
655
658
|
done <"$updates_file"
|
|
656
|
-
`;function
|
|
657
|
-
url).href;var
|
|
659
|
+
`;function Qs(e=""){return e?yo.join(yo.dirname(e),bo):""}var Ww=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:Eo,canonicalRepositoryBackupPath:Qs});var o_=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBrowserWorkerSource.js",import.meta.
|
|
660
|
+
url).href;var ta=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms>]"," vibe64\
|
|
658
661
|
-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [--json]"," v\
|
|
659
662
|
ibe64-helper preview open <path> [--json]"," vibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--\
|
|
660
663
|
output <path>]"," vibe64-helper preview browser ensure"," vibe64-helper preview browser eval < playwright-code.js"," \
|
|
@@ -697,37 +700,40 @@ server for the configured primary application.","Do not start a duplicate copy o
|
|
|
697
700
|
distinct secondary application explicitly requested by the user, such as a reference app, may run separately without rep\
|
|
698
701
|
lacing this preview."].join(`
|
|
699
702
|
`)+`
|
|
700
|
-
`;import{fileURLToPath as
|
|
701
|
-
new URL("./engines/stdioBridge.js",
|
|
703
|
+
`;import{fileURLToPath as sa}from"node:url";var ia=new URL("./../node_modules/@local/vibe64-execution/src/server/conversationExecution.js",import.meta.url).href,f_=sa(
|
|
704
|
+
new URL("./engines/stdioBridge.js",ia));var b_=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$name" 2>/dev/null) || continue',
|
|
702
705
|
" case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /usr/bin/*) continue ;; esac; fi',
|
|
703
706
|
` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
704
|
-
`);var
|
|
705
|
-
e,Object.freeze({name:t,guideUrl:o,install:r})]})));import{execFile as
|
|
706
|
-
resolve(String(e||""));try{return t(o)}catch{return o}}function Ao({entrypointPath:e,argv:t=
|
|
707
|
-
return r?Ro(r,o)===Ro(e,o):!1}var Mt="__local__",Lt="VIBE64_RUNTIME_NAMESPACE";var Io="local";var
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
function
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
707
|
+
`);var aa=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:o,any:r}=je[e];return[
|
|
708
|
+
e,Object.freeze({name:t,guideUrl:o,install:r})]})));import{execFile as ca}from"node:child_process";import{promisify as ua}from"node:util";var R_=ua(ca);import So from"node:path";var da="runtime",pa="open.json";function ma(e=""){let t=L(e);return t?So.join(So.resolve(t),da,pa):""}var Ob=Object.freeze({projectRuntimeOpenStatePath:ma});function $t(e=""){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,"")}import{startServer as Ua}from"../server.bundle.mjs";import{realpathSync as Ia}from"node:fs";import Ca from"node:path";import Na from"node:process";function Ro(e,t){let o=Ca.
|
|
709
|
+
resolve(String(e||""));try{return t(o)}catch{return o}}function Ao({entrypointPath:e,argv:t=Na.argv,realpath:o=Ia}){let r=t[1];
|
|
710
|
+
return r?Ro(r,o)===Ro(e,o):!1}var Mt="__local__",Lt="VIBE64_RUNTIME_NAMESPACE";var Io="local";import Co from"node:path";import{fileURLToPath as ja}from"node:url";var xa=new URL("./../server/lib/envFile.js",import.meta.
|
|
711
|
+
url).href,ka=Co.resolve(Co.dirname(ja(xa)),"../..",".env"),No=!1;function xo(){if(!No){try{process.loadEnvFile(ka)}catch(e){
|
|
712
|
+
if(e.code!=="ENOENT")throw e}No=!0}}var $a=new URL("./server.js",import.meta.url).href,Ba=Da($a),Fa=3001,ko=new Map([["--open",!0],["--open=true",!0],["--op\
|
|
713
|
+
en=1",!0],["--no-open",!1],["--open=false",!1],["--open=0",!1]]);function $o(e,t){return e.some(o=>ko.get(String(o||"").
|
|
714
|
+
trim().toLowerCase())===t)}function Ga(e=_.argv.slice(2)){return $o(e,!0)}function za(e=_.argv.slice(2)){return $o(e,!1)}
|
|
715
|
+
function Va({entrypointPath:e=Ba,...t}={}){return Ao({entrypointPath:e,...t})}function se(e=""){let t=new Error(`Unsuppo\
|
|
716
|
+
rted Vibe64 startup argument: ${String(e||"").trim()}`);return t.code="vibe64_invalid_startup_argument",t}function Ha(e,t,o){
|
|
717
|
+
let r=String(e[t+1]||"").trim();if(!r)throw se(o);return r}function Wa(e=_.argv.slice(2)){let t="",o="";for(let r=0;r<e.
|
|
718
|
+
length;r+=1){let n=String(e[r]||"").trim();if(!n)continue;let i=n.toLowerCase();if(!ko.has(i)){if(i==="--project"){let s=Ha(
|
|
719
|
+
e,r,n);if(t||o)throw se(s);o=ae.resolve(s),t=Me(o),r+=1;continue}if(i.startsWith("--project=")){let s=n.slice(10).trim();
|
|
720
|
+
if(!s||t||o)throw se(n);o=ae.resolve(s),t=Me(o);continue}if(n.startsWith("-")||t||o)throw se(n);o=ae.resolve(n),t=Me(o)}}
|
|
721
|
+
return!t&&!o&&(o=_.cwd(),t=Me(o)),{openOnStart:qa(e,{targetRoot:o}),startupSlug:t,targetRoot:o}}function qa(e=_.argv.slice(
|
|
722
|
+
2),{targetRoot:t=""}={}){return za(e)?!1:Ga(e)?!0:!!String(t||"").trim()}function Me(e=""){return $t(ae.basename(ae.resolve(
|
|
723
|
+
e)))||"local-project"}async function Ya(e){try{await tt(e,{app:{name:P.browser,arguments:["--new-window"]}})}catch{try{await tt(
|
|
724
|
+
e)}catch(t){console.warn(`Could not open browser automatically: ${t.message}`)}}}function Ja({env:e=_.env,openOnStart:t=!1,
|
|
720
725
|
startupSlug:o="",targetRoot:r=""}={}){let n=!!String(e.PORT||"").trim();return{browserLifecycleShutdown:!0,port:t===!0&&
|
|
721
|
-
!n?
|
|
722
|
-
trim();return t||(e[Lt]=Mt,Mt)}function
|
|
723
|
-
"
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
i
|
|
731
|
-
t&&console.
|
|
732
|
-
|
|
733
|
-
|
|
726
|
+
!n?Fa:void 0,runtimeMode:Io,strictPort:n,startupSlug:o,targetRoot:r}}function Ka({env:e=_.env}={}){let t=String(e[Lt]||"").
|
|
727
|
+
trim();return t||(e[Lt]=Mt,Mt)}function Xa({env:e=_.env}={}){let t=String(e.APP_ENV||"").trim();return t||(e.APP_ENV="pr\
|
|
728
|
+
oduction",e.NODE_ENV="production",e.APP_ENV)}function Za({env:e=_.env,exists:t=Ma,home:o=jo.homedir(),platform:r=_.platform}={}){
|
|
729
|
+
if(r!=="darwin"||String(e[Rt]||"").trim())return"";let n=Re({env:e,home:o,platform:"darwin"}),i=Re({env:e,home:o,platform:"\
|
|
730
|
+
linux"});return t(n)||!t(i)?"":[`Vibe64 now keeps its data in ${n}.`,"Move your existing data there, then start Vibe64 a\
|
|
731
|
+
gain:",` mv ${ie(i)} ${ie(n)}`].join(`
|
|
732
|
+
`)}async function Qa({env:e=_.env,home:t=jo.homedir(),makeDirectory:o=La,platform:r=_.platform}={}){if(String(e[Rt]||"").
|
|
733
|
+
trim())return"";let n=Re({env:e,home:t,platform:r});return await o(n,{recursive:!0,mode:448}),n}async function ec(){let e=Za();
|
|
734
|
+
if(e){console.error(e),_.exitCode=1;return}let{openOnStart:t,startupSlug:o,targetRoot:r}=Wa();Ka(),xo(),Xa(),await Qa();
|
|
735
|
+
let n=await Ua(Ja({openOnStart:t,startupSlug:o,targetRoot:r})),i=n.vibe64Url;if(i){console.log(`Vibe64 is running at ${i}`),
|
|
736
|
+
t&&await Ya(i);return}n.vibe64Listen?.transport==="socket"&&(console.log(`Vibe64 is listening on Unix socket ${n.vibe64Listen.
|
|
737
|
+
socketPath}`),t&&console.warn("Cannot open a browser for a Unix socket listener. Set VIBE64_PUBLIC_ORIGIN or PORT."))}Va()&&
|
|
738
|
+
ec().catch(e=>{console.error("Failed to start Vibe64 server:",e),_.exitCode=1});export{Xa as applyLocalCliAppEnvironment,Ka as applyLocalCliRuntimeNamespace,Va as isDirectServerExecution,Za as macosDataMoveMessage,
|
|
739
|
+
Wa as parseStartupArgs,Qa as prepareLocalSystemRoot,Ja as serverStartOptions,Ga as shouldOpenBrowser};
|