vibe64 0.1.54 → 0.1.55
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 +926 -926
- package/bin/server.js +109 -109
- package/bin/upgrade-state.js +1820 -1817
- package/dist/assets/{GithubBrowserTabs-B3o7MQQR.js → GithubBrowserTabs-ByMqpsdH.js} +1 -1
- package/dist/assets/{LocalDatabaseServer-OnPGrWzT.js → LocalDatabaseServer-DAqJ_cyP.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-j3_ikAuW.js → Vibe64AuthSettingsButton-oE_6LWCD.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-B0NPbnB3.js → Vibe64DashboardShell-zx0w3bRI.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-B_lZnRTj.js → Vibe64DatabaseWorkspace-_IaElLVX.js} +1 -1
- package/dist/assets/{Vibe64FileArea-nnRwNnqT.js → Vibe64FileArea-1mU0h47c.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-Bri4USOZ.js → Vibe64OutputControls-C3Raycqc.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-D1A8LVag.js → Vibe64RepositoryWorkspace-BsHp64eR.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-B36EvXEi.js → Vibe64SessionFiles-zjMzQfSS.js} +1 -1
- package/dist/assets/Vibe64UiStoryboardView-BWsEULBB.js +8 -0
- package/dist/assets/Vibe64UiStoryboardView-C9v9v4Zv.css +1 -0
- package/dist/assets/{Vibe64UnavailableSessions-hx-_cGSq.js → Vibe64UnavailableSessions-BfaSkPIh.js} +1 -1
- package/dist/assets/{_sessionId_-Dp6jNvbl.js → _sessionId_-Bx2fQJdt.js} +1 -1
- package/dist/assets/_slug_-BNJ4DwRj.js +14 -0
- package/dist/assets/{_slug_-BzW52gC4.css → _slug_-CACf3YXY.css} +1 -1
- package/dist/assets/{access-D8qig7ec.js → access-DvhbzP1W.js} +1 -1
- package/dist/assets/{app-Cj_EAhpX.js → app-DxAkth1b.js} +1 -1
- package/dist/assets/{changes-wPjq7Hm0.js → changes-BgBvTcJs.js} +1 -1
- package/dist/assets/{client-CFYZ-lyr.js → client-DgZ7BJpj.js} +1 -1
- package/dist/assets/{client-DFOt8wBN.js → client-DmD9KhSL.js} +1 -1
- package/dist/assets/{conversation-DI1nCDwa.js → conversation-zwXYLGqc.js} +1 -1
- package/dist/assets/{dashboard-CxIdG5jv.js → dashboard-B8ZPGRSb.js} +1 -1
- package/dist/assets/{english-definitions-ByX3eXsy.js → english-definitions-DzGMSCaJ.js} +1 -1
- package/dist/assets/{env-z9srOupe.js → env-CE1-Na2V.js} +1 -1
- package/dist/assets/errorMessageHelpers-Bf-YjXAL.js +1 -0
- package/dist/assets/{health-Cnxgo_A1.js → health-CzUPMWhP.js} +1 -1
- package/dist/assets/{history-B6Eu1y05.js → history-iHe5lOfS.js} +1 -1
- package/dist/assets/{incoming-C9FqNt2v.js → incoming-DPZHnajt.js} +1 -1
- package/dist/assets/{index-CaALYaBx.css → index-Bw_SFNRe.css} +1 -1
- package/dist/assets/index-DT1bcQbm.js +136 -0
- package/dist/assets/{integrations-CtQ0y43P.js → integrations-CxRqYAB4.js} +1 -1
- package/dist/assets/{issues-CcEiyt-B.js → issues-z8ED0UVJ.js} +1 -1
- package/dist/assets/{learning-675vJSpE.js → learning-C3KucBok.js} +1 -1
- package/dist/assets/{project-files-B_oJKklm.js → project-files-DSOrYwSx.js} +1 -1
- package/dist/assets/{publish-zKiUnNh6.js → publish-WTWqQTu7.js} +1 -1
- package/dist/assets/{pull-requests-CGCXU3Vk.js → pull-requests-CEl58lxJ.js} +1 -1
- package/dist/assets/{repository-Cl1JsvV6.js → repository-B3PXgVP1.js} +1 -1
- package/dist/assets/{settings-CiSyW_3E.js → settings-CoBE8B2-.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-CG7LwvNK.js → useArchivedVibe64Sessions--xBin9tl.js} +1 -1
- package/dist/assets/useAssistantAttachments-DRv0XzKj.js +2 -0
- package/dist/assets/{useCommand-BCpvrh_p.js → useCommand-0NzdEIqN.js} +1 -1
- package/dist/assets/{useEndpointResource-CDrYFeId.js → useEndpointResource-DX_fQ5e0.js} +1 -1
- package/dist/assets/{useUiFeedback-4s9XMiFM.js → useUiFeedback-icdVQp7A.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-DwfY7cIR.js → useVibe64ConversationLog-ImR785hf.js} +1 -1
- package/dist/assets/{useVibe64DatabaseTools-DxUt1UUx.js → useVibe64DatabaseTools-CInDY3Vy.js} +1 -1
- package/dist/assets/{useVibe64Learning-CxZHaFwU.js → useVibe64Learning-YqOT1_ft.js} +1 -1
- package/dist/assets/{useVibe64SessionData-C-gkuY3U.js → useVibe64SessionData-CwKQmgq-.js} +1 -1
- package/dist/assets/{useVibe64SystemGraph-Dyy2FXVf.js → useVibe64SystemGraph-CpArSXUH.js} +1 -1
- package/dist/assets/vibe64AssistantHost-CyWUOG-F.js +1 -0
- package/dist/assets/{vibe64SessionFocus-CZ8mBals.js → vibe64SessionFocus-DZaD51lR.js} +1 -1
- package/dist/index.html +15 -15
- package/docs/colleague-usage/ai-tasks.md +20 -3
- package/docs/colleague-usage/coding-agent-failures.md +3 -1
- package/docs/colleague-usage/coding-agent-recovery.md +5 -0
- package/docs/colleague-usage/preview-browser-checks.md +11 -0
- package/docs/colleague-usage/preview.md +13 -5
- package/docs/colleague-usage/sessions.md +9 -1
- package/docs/colleague-usage/usage-map.md +45 -12
- package/docs/colleague-usage/usage-recording.md +5 -3
- package/docs/colleague-usage/workspace-preparation.md +3 -1
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +346 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +171 -6
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/assistantConfigRepository.js +188 -187
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/conversationsRepository.js +230 -229
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/messagesRepository.js +248 -247
- package/node_modules/@jskit-ai/assistant-voice/locales/en.json +2 -1
- package/node_modules/@jskit-ai/assistant-voice/package.json +1 -1
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +4 -0
- package/node_modules/@jskit-ai/kernel/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +20 -0
- package/node_modules/@jskit-ai/realtime/locales/en.json +3 -0
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/CHANGELOG.md +21 -0
- package/node_modules/@jskit-ai/resource-crud-core/locales/en.json +18 -0
- package/node_modules/@jskit-ai/resource-crud-core/package.json +3 -2
- package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +442 -436
- package/node_modules/@local/vibe64-genesis/src/server/index.js +48 -45
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +54 -51
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +390 -390
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +30 -29
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1412 -1408
- package/node_modules/@local/vibe64-usage-recording/README.md +4 -2
- package/node_modules/@local/vibe64-usage-recording/runtime/node/preload.mjs +209 -207
- package/node_modules/@local/vibe64-usage-recording/runtime/php/build.mjs +14 -14
- package/node_modules/@local/vibe64-usage-recording/runtime/php/ext/vibe64_path.h +89 -0
- package/node_modules/@local/vibe64-usage-recording/runtime/php/ext/vibe64_usage.c +7 -9
- package/node_modules/@local/vibe64-usage-recording/runtime/python/vibe64_usage/tracer.py +17 -1
- package/package.json +14 -14
- package/server.bundle.mjs +37628 -37450
- package/dist/assets/Vibe64UiStoryboardView-BHNN4C5U.css +0 -1
- package/dist/assets/Vibe64UiStoryboardView-D0uyPOEQ.js +0 -8
- package/dist/assets/_slug_-TS4avXZJ.js +0 -14
- package/dist/assets/errorMessageHelpers-DcxY5WmY.js +0 -1
- package/dist/assets/index-CSxRprxi.js +0 -136
- package/dist/assets/useAssistantAttachments-LW1SwpSD.js +0 -2
- package/dist/assets/vibe64AssistantHost-BAcbDf1j.js +0 -1
package/bin/run.js
CHANGED
|
@@ -3,16 +3,16 @@ import { createRequire as __vibe64CreateRequire } from 'node:module';const requi
|
|
|
3
3
|
var aS=Object.create;var Ps=Object.defineProperty;var cS=Object.getOwnPropertyDescriptor;var lS=Object.getOwnPropertyNames;var uS=Object.getPrototypeOf,dS=Object.prototype.hasOwnProperty;var Ke=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
4
4
|
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var d=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var le=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Du=(e,t)=>{for(var r in t)
|
|
5
5
|
Ps(e,r,{get:t[r],enumerable:!0})},pS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lS(t))!dS.call(
|
|
6
|
-
e,o)&&o!==r&&Ps(e,o,{get:()=>t[o],enumerable:!(n=cS(t,o))||n.enumerable});return e};var mS=(e,t,r)=>(r=e!=null?aS(uS(e)):{},pS(t||!e||!e.__esModule?Ps(r,"default",{value:e,enumerable:!0}):r,e));import{readFile as
|
|
7
|
-
ditor/src/server/agentSpecs.js",import.meta.url).href,Gu=e=>()=>
|
|
6
|
+
e,o)&&o!==r&&Ps(e,o,{get:()=>t[o],enumerable:!(n=cS(t,o))||n.enumerable});return e};var mS=(e,t,r)=>(r=e!=null?aS(uS(e)):{},pS(t||!e||!e.__esModule?Ps(r,"default",{value:e,enumerable:!0}):r,e));import{readFile as yS}from"node:fs/promises";var wS,Gu,Fu,Vu=d(()=>{wS=new URL("./../node_modules/@local/vibe64-source-e\
|
|
7
|
+
ditor/src/server/agentSpecs.js",import.meta.url).href,Gu=e=>()=>yS(new URL(`../../docs/${e}`,wS),"utf8"),Fu=Object.freeze(
|
|
8
8
|
[{name:"integration-setup-command",title:"Integration setup command protocol and integrations.json",text:Gu("application\
|
|
9
9
|
-integration-setup.md")},{name:"integration-payments-laravel",title:"Implementing the integration setup payment operatio\
|
|
10
10
|
ns in Laravel",text:Gu("application-payments-laravel.md")}])});var Lr,Bn,bS,Gn,zu=d(()=>{Lr="email",Bn="login",bS="user-id",Gn=Object.freeze([Lr,Bn,bS])});function G(e,{fallback:t=""}={}){return String(e||"").trim()||t}function ie(e,{fallback:t={}}={}){return z(e)?e:{...t}}function z(e){
|
|
11
|
-
return!!(e&&typeof e=="object"&&!Array.isArray(e))}var
|
|
12
|
-
dBack","unknown"])});function
|
|
13
|
-
name="AppError",this.status=Number(t)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=
|
|
14
|
-
n.messageCode&&(this.messageCode=String(n.messageCode),this.messageParams=
|
|
15
|
-
headers=n.headers||{}}}});var Hu=d(()=>{
|
|
11
|
+
return!!(e&&typeof e=="object"&&!Array.isArray(e))}var wL,F=d(()=>{wL=Object.freeze(["none","pending","committed","rolle\
|
|
12
|
+
dBack","unknown"])});function Fn(e){return z(e)?{...e}:{}}var Cs=d(()=>{F()});var fe,Vn=d(()=>{Cs();fe=class extends Error{constructor(t,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.
|
|
13
|
+
name="AppError",this.status=Number(t)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=Fn(n.params),
|
|
14
|
+
n.messageCode&&(this.messageCode=String(n.messageCode),this.messageParams=Fn(n.messageParams)),this.details=n.details,this.
|
|
15
|
+
headers=n.headers||{}}}});var Hu=d(()=>{F()});var qu=d(()=>{F()});function ne(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===
|
|
16
16
|
null||_S(t)}function _S(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===
|
|
17
17
|
0}var Mr=d(()=>{});function Ns(e){return e!==null&&typeof e=="object"&&ne(e.structure)&&ne(e.operations)&&typeof e.validateWith=="function"&&
|
|
18
18
|
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function zn(e,t){if(!Object.hasOwn(t,"items"))return null;
|
|
@@ -31,15 +31,15 @@ e,t)}:t.additionalProperties===!0?{kind:"opaque"}:{kind:"plain"}}var ks=d(()=>{M
|
|
|
31
31
|
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=xS(n,o)}function Dr(e,t){let r=e.temporalPrecision;
|
|
32
32
|
if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(`temporalPrecision for "${t}" must be a non-negative integer\
|
|
33
33
|
.`);return r}}function rd(e,t){return e===void 0?!0:t===void 0||e.length<=t}function nd(e){if(typeof e!="string")return!1;
|
|
34
|
-
let t=SS.exec(e);return t!==null&&td(t[1],t[2],t[3])}function od(e,t){if(typeof e!="string")return!1;let r=
|
|
35
|
-
null&&rd(r[1],t)}function id(e,t){if(typeof e!="string")return!1;let r=
|
|
34
|
+
let t=SS.exec(e);return t!==null&&td(t[1],t[2],t[3])}function od(e,t){if(typeof e!="string")return!1;let r=TS.exec(e);return r!==
|
|
35
|
+
null&&rd(r[1],t)}function id(e,t){if(typeof e!="string")return!1;let r=vS.exec(e);return r===null?!1:td(r[1],r[2],r[3])&&
|
|
36
36
|
rd(r[4],t)}function sd(e){return e===void 0?"(?:\\.\\d+)?":e===0?"":`(?:\\.\\d{1,${e}})?`}function ad(e,t){let r=Dr(e,t);
|
|
37
|
-
return`^${qn}(?::${
|
|
37
|
+
return`^${qn}(?::${zt}${sd(r)})?$`}function cd(e,t){let r=Dr(e,t);return`^${Zu}T${qn}:${zt}${sd(r)}${Xu}$`}function Ms(e,t){
|
|
38
38
|
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&IS.test(e))r=Number(e);else return null;return!Number.isSafeInteger(
|
|
39
|
-
r)||r<-t||r>t?null:r===0?0:r}var Ls,Wu,Yu,Ju,Ku,
|
|
40
|
-
\\d{4}",Yu="0[1-9]|1[0-2]",Ju="0[1-9]|[12]\\d|3[01]",Ku="[01]\\d|2[0-3]",
|
|
41
|
-
](?:${Ku}):${
|
|
42
|
-
new RegExp(`^${qn}(?::${
|
|
39
|
+
r)||r<-t||r>t?null:r===0?0:r}var Ls,Wu,Yu,Ju,Ku,zt,qn,Xu,Qu,Zu,ed,SS,TS,vS,IS,OS,js=d(()=>{Ls="^(?:0|-?[1-9]\\d*)$",Wu="\
|
|
40
|
+
\\d{4}",Yu="0[1-9]|1[0-2]",Ju="0[1-9]|[12]\\d|3[01]",Ku="[01]\\d|2[0-3]",zt="[0-5]\\d",qn=`(?:${Ku}):${zt}`,Xu=`(?:Z|[+-\
|
|
41
|
+
](?:${Ku}):${zt})`,Qu=`(${Wu})-(${Yu})-(${Ju})`,Zu=`${Wu}-(?:${Yu})-(?:${Ju})`,ed=`^${Zu}$`,SS=new RegExp(`^${Qu}$`),TS=
|
|
42
|
+
new RegExp(`^${qn}(?::${zt}(?:\\.(\\d+))?)?$`),vS=new RegExp(`^${Qu}T${qn}:${zt}(?:\\.(\\d+))?${Xu}$`),IS=new RegExp(Ls),
|
|
43
43
|
OS=[31,28,31,30,31,30,31,31,30,31,30,31]});function R(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function PS(e,t){if(RS.
|
|
44
44
|
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function CS(e){return typeof e!="string"?e:e.replace(
|
|
45
45
|
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function Ds(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
@@ -60,9 +60,9 @@ if(o)return o;throw new Error(`Validator '${t}' on field '${r}' cannot be export
|
|
|
60
60
|
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function GS(e,t={}){if(t.mode!==
|
|
61
61
|
void 0&&t.operation!==void 0){let r=ud(t.mode);if(r!==t.operation)throw new Error(`Conflicting JSON Schema export option\
|
|
62
62
|
s: mode '${r}' does not match operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))
|
|
63
|
-
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return ud(t.mode)}function
|
|
63
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return ud(t.mode)}function FS(e,t={}){
|
|
64
64
|
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
65
|
-
let r=GS(e,t);return{operationName:r,operation:e.operations[r]}}function
|
|
65
|
+
let r=GS(e,t);return{operationName:r,operation:e.operations[r]}}function VS(e={}){let t={...e};return Object.defineProperty(
|
|
66
66
|
t,Bs,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function Yn(e={}){return e[Bs]?
|
|
67
67
|
e[Bs]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function zS(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
68
68
|
"_").replace(/^_+|_+$/g,"")||"operation"}function Gs(e){return ne(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
@@ -90,13 +90,13 @@ Array.isArray(s))throw new Error(`Type '${r.type}' on field '${t}' returned an i
|
|
|
90
90
|
"array"){let a=YS(e,t,r,n,o,i);if(a)return Br({...s,items:a},{referenceBacked:Gs(s)})}return Br(s,{referenceBacked:Gs(s)})}
|
|
91
91
|
function qs(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=KS(e,t,r,n,o,i),c=a.referenceBacked?
|
|
92
92
|
Wn(a.schema):{...a.schema},l={castType:r.type};for(let f of Object.keys(r)){if(f==="type"||!Object.hasOwn(e.validators,f))
|
|
93
|
-
continue;let h=BS(e,f,t);if(!h)continue;let
|
|
93
|
+
continue;let h=BS(e,f,t);if(!h)continue;let w=h({...s,parameterName:f,parameterValue:r[f],fieldSchema:{...c}});w&&jS(c,w)}
|
|
94
94
|
c[Xe]&&(zs(l,c[Xe]),delete c[Xe]);let u=[];r.nullable===!0&&u.push({type:"null"}),r.nullOnEmpty===!0&&u.push({const:""});
|
|
95
95
|
let p=Wn(DS(c,u));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.defaultTo!="function"){let f=e._normalizeDefault(
|
|
96
96
|
r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(
|
|
97
97
|
o,i,{})});if(Object.keys(f.errors).length>0){let h=Object.values(f.errors)[0];throw new Error(`defaultTo for "${t}" is i\
|
|
98
|
-
nvalid (${h.code}).`)}p.default=f.value}else l.defaults={providedByFunction:!0};return p[Xe]=l,p}function md(e,t={}){let r=
|
|
99
|
-
t),{operationName:n,operation:o}=
|
|
98
|
+
nvalid (${h.code}).`)}p.default=f.value}else l.defaults={providedByFunction:!0};return p[Xe]=l,p}function md(e,t={}){let r=VS(
|
|
99
|
+
t),{operationName:n,operation:o}=FS(e,r),i=r.additionalProperties===void 0?!1:r.additionalProperties,s=Yn(r),a=dd(e,r,n,
|
|
100
100
|
o,i,{root:!0}),c={$schema:NS,...pd(a,r)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}var NS,
|
|
101
101
|
Xe,Us,Bs,kS,$S,LS,MS,fd=d(()=>{ks();$s();js();Mr();Ur();NS="http://json-schema.org/draft-07/schema#",Xe="x-json-rest-sch\
|
|
102
102
|
ema",Us=["object","array","string","number","boolean"],Bs=Symbol("json-rest-schema.exportContext"),kS=["true","1","yes",
|
|
@@ -117,45 +117,45 @@ uppercase:({parameterValue:e})=>e?ft("transforms",{uppercase:!0}):null,lowercase
|
|
|
117
117
|
ata",{unsigned:!0}):null,precision:({parameterValue:e})=>ft("metadata",{precision:e}),scale:({parameterValue:e})=>ft("me\
|
|
118
118
|
tadata",{scale:e}),temporalPrecision:({parameterValue:e})=>ft("metadata",{temporalPrecision:e}),strictBoolean:()=>null,required:()=>null,
|
|
119
119
|
nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function hd(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Xs(e){return e instanceof
|
|
120
|
-
|
|
121
|
-
.${String(t)}`}function Sd(e,t){return e===""?String(t):ht(e,t)}function
|
|
122
|
-
startsWith(r)?e.slice(r.length):null}function
|
|
123
|
-
{...n,field:o})}return r}function Js(e){return Ds(e,"validatePath")}function
|
|
120
|
+
Wt}function XS(){return{self:!1,children:{}}}function gd(e){return Object.keys(e.children).length>0}function ht(e,t){return`${e}\
|
|
121
|
+
.${String(t)}`}function Sd(e,t){return e===""?String(t):ht(e,t)}function wd(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
122
|
+
startsWith(r)?e.slice(r.length):null}function Ht(e,t){let r={};for(let n of Object.values(e)){let o=ht(t,n.field);R(r,o,
|
|
123
|
+
{...n,field:o})}return r}function Js(e){return Ds(e,"validatePath")}function yd(e){let t={};for(let r of e){let n=Js(r),
|
|
124
124
|
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||R(o,s,XS()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
125
125
|
return t}function QS(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||!Object.hasOwn(r,n))return;r=r[n]}return r}
|
|
126
126
|
function Jn(e){return e===null?!0:Array.isArray(e)||ne(e)?Object.keys(e).length>0:e!==void 0}function bd(e){return[...e].
|
|
127
127
|
sort((t,r)=>{let n=/^[0-9]+$/.test(t),o=/^[0-9]+$/.test(r);return n&&o?Number(t)-Number(r):n?-1:o?1:t.localeCompare(r)})}
|
|
128
|
-
function ZS(e){return/^[0-9]+$/.test(e)}function
|
|
128
|
+
function ZS(e){return/^[0-9]+$/.test(e)}function eT(e,t=new WeakMap){if(t.has(e))return t.get(e);let r=Object.create(Wt.
|
|
129
129
|
prototype);return t.set(e,r),r.structure=null,r.types=e.types,r.validators=e.validators,r.operations=e.operations,r.structure=
|
|
130
130
|
Xn(Kn(e.structure,t)),r._installOperationMethods(),Object.freeze(r)}function Kn(e,t=new WeakMap){if(e===null||typeof e!=
|
|
131
|
-
"object")return e;if(Xs(e))return
|
|
131
|
+
"object")return e;if(Xs(e))return eT(e,t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let n=new RegExp(
|
|
132
132
|
e.source,e.flags);return n.lastIndex=e.lastIndex,n}if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];t.set(e,n);
|
|
133
133
|
for(let o of e)n.push(Kn(o,t));return n}if(!ne(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))R(r,n,Kn(
|
|
134
134
|
o,t));return r}function Xn(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||Xs(e))return e;if(t.add(e),Array.
|
|
135
135
|
isArray(e))for(let r of e)Xn(r,t);else for(let r of Reflect.ownKeys(e))Xn(e[r],t);return Object.freeze(e)}function Ws(e){
|
|
136
136
|
return Xn(Kn(e))}function Ks(e,t,r=""){if(!Xs(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
137
|
-
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=Sd(r,n);return
|
|
137
|
+
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=Sd(r,n);return Td(e,i,o,s)}function Td(e,t,r,n){
|
|
138
138
|
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:Ks(o.schema,r,n)}if(t?.type===
|
|
139
139
|
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!ZS(i))return null;let a=ht(
|
|
140
|
-
n,i);return o.kind==="schema"?s.length<1?null:Ks(o.schema,s,a):s.length<1?o.definition:
|
|
141
|
-
function
|
|
140
|
+
n,i);return o.kind==="schema"?s.length<1?null:Ks(o.schema,s,a):s.length<1?o.definition:Td(e,o.definition,s,a)}return null}
|
|
141
|
+
function qt(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>wd(o,t)).filter(o=>o!==null&&o!==
|
|
142
142
|
"");n.length>0?r.skipFields=n:delete r.skipFields}if(ne(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
143
|
-
let s=
|
|
143
|
+
let s=wd(o,t);s===null||s===""||R(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}function Ed(e,t,r,n){
|
|
144
144
|
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function Ys(e,t,r,n=!0){
|
|
145
145
|
let o=t[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${e}" must define ${r} as a boolean.`)}
|
|
146
|
-
function
|
|
146
|
+
function rT(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);
|
|
147
147
|
return Ed(e,t,"targetFields",["schema","input"]),Ys(e,t,"enforceRequired"),Ys(e,t,"applyDefaults"),Ed(e,t,"outputFields",
|
|
148
148
|
["validated","input"]),Ys(e,t,"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.
|
|
149
149
|
enforceRequired,applyDefaults:t.applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===
|
|
150
|
-
void 0?!0:t.rejectExplicitUndefined})}function
|
|
151
|
-
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
152
|
-
entries(e))R(t,r,
|
|
153
|
-
e))R(t,r,n);return Object.freeze(t)}function
|
|
154
|
-
()=>{fd();ks();Ur();Mr();
|
|
150
|
+
void 0?!0:t.rejectExplicitUndefined})}function nT(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(
|
|
151
|
+
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(tT))R(t,r,n);for(let[r,n]of Object.
|
|
152
|
+
entries(e))R(t,r,rT(r,n));return Object.freeze(t)}function _d(e){let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
153
|
+
e))R(t,r,n);return Object.freeze(t)}function oT(e){let t={...e};return delete t.operation,delete t.mode,t}var tT,Wt,vd=d(
|
|
154
|
+
()=>{fd();ks();Ur();Mr();tT=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
155
155
|
outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
156
156
|
outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,applyDefaults:!1,
|
|
157
|
-
outputFields:"input",rejectExplicitUndefined:!0})});
|
|
158
|
-
validators=_d(n),this.operations=
|
|
157
|
+
outputFields:"input",rejectExplicitUndefined:!0})});Wt=class{constructor(t,r,n,o={}){this.structure=t,this.types=_d(r),this.
|
|
158
|
+
validators=_d(n),this.operations=nT(o),this._installOperationMethods()}_typeError(t){return this._paramError(t,"TYPE_CAS\
|
|
159
159
|
T_FAILED","Value could not be cast to the required type.")}_paramError(t,r,n,o={}){let i=new Error(n);return i.errorObject=
|
|
160
160
|
{field:t,code:r,message:n,params:o},i}_paramToBeSkipped(t,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&
|
|
161
161
|
r[n].includes(t))}_fieldToBeSkipped(t,r){return Array.isArray(r.skipFields)&&r.skipFields.includes(t)}_mergeErrors(t,r){
|
|
@@ -170,7 +170,7 @@ rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:o=>Object.hasOwn(
|
|
|
170
170
|
r))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let r=t.operation??t.mode??
|
|
171
171
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
172
172
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(
|
|
173
|
-
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:
|
|
173
|
+
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:oT(t)}}_buildOperationResult(t,r,n){
|
|
174
174
|
let o={};for(let i of n.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=n.isFieldPresent(i);(r[i]!==
|
|
175
175
|
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||R(o,i,r[i]))}return o}_resolveObjectFieldMode(t,r){
|
|
176
176
|
return Hn(t,r)}_resolveArrayItemsConfig(t,r){return zn(t,r)}_resolveObjectValuesConfig(t,r){return jr(t,r)}_buildArrayItemSettings(t,r){
|
|
@@ -180,8 +180,8 @@ let l=t.nullable===!0||a.nullable===!0,u=t.nullOnEmpty===!0||a.nullOnEmpty===!0;
|
|
|
180
180
|
{errors:this._singleErrorMap({field:n,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
|
|
181
181
|
if(r===""&&u)return R(o,i,null),{errors:{},shouldContinue:!1};let f={schema:this,definition:t,value:r,fieldName:n,object:o,
|
|
182
182
|
objectBeforeCast:s,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
183
|
-
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(h,
|
|
184
|
-
n,h,
|
|
183
|
+
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(h,w,E)=>{throw this._paramError(
|
|
184
|
+
n,h,w,E)}};try{let h=p(f);if(hd(h))throw new Error(`Type handler for "${t.type}" must be synchronous.`);h!==void 0&&(R(o,
|
|
185
185
|
i,h),f.value=h)}catch(h){if(h.errorObject)return{errors:this._singleErrorMap(h.errorObject),shouldContinue:!1};throw h}return{
|
|
186
186
|
errors:{},context:f,shouldContinue:!0}}_runFieldValidators(t,r,n,o,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
187
187
|
_paramToBeSkipped(a,s.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
@@ -195,20 +195,20 @@ if(t.type==="object"){let c=this._resolveObjectFieldMode(r,t);return c.kind==="n
|
|
|
195
195
|
c,r,n,o,i,s):c.kind==="map"?this._validateObjectValues(r,n,o,c.valuesConfig,i,s):{}}if(t.type!=="array")return{};let a=this.
|
|
196
196
|
_resolveArrayItemsConfig(r,t);return a?this._validateArrayItems(r,n,o,a,i,s):{}}_validateNestedObjectSchema(t,r,n,o,i,s){
|
|
197
197
|
let a=n[o],c=t.allowAdditionalProperties?this._extractKnownObjectFields(a,t.schema):a,l=t.schema._validateWithOperation(
|
|
198
|
-
s.operationName,s.operation,c,
|
|
199
|
-
a,t.schema,l.validatedObject):l.validatedObject),
|
|
198
|
+
s.operationName,s.operation,c,qt(i,r));return R(n,o,t.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
|
|
199
|
+
a,t.schema,l.validatedObject):l.validatedObject),Ht(l.errors,r)}_extractKnownObjectFields(t,r){let n={};for(let[o,i]of Object.
|
|
200
200
|
entries(t))Object.hasOwn(r.structure,o)&&R(n,o,i);return n}_mergeKnownAndPassthroughObjectFields(t,r,n){let o={};for(let i of Object.
|
|
201
201
|
keys(t)){if(!Object.hasOwn(r.structure,i)){R(o,i,t[i]);continue}Object.hasOwn(n,i)&&R(o,i,n[i])}for(let[i,s]of Object.entries(
|
|
202
202
|
n))Object.hasOwn(o,i)||R(o,i,s);return o}_validateObjectValues(t,r,n,o,i,s){let a=r[n],c={...a},l={};R(r,n,c);for(let u of Object.
|
|
203
203
|
keys(a)){let p=ht(t,u);if(this._fieldToBeSkipped(p,i))continue;let f=c[u];if(f===void 0){s.rejectExplicitUndefined?this.
|
|
204
|
-
_mergeErrors(l,this._singleErrorMap(this._typeError(p).errorObject)):delete c[u];continue}if(o.kind==="schema"){let
|
|
205
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,f,
|
|
206
|
-
l,
|
|
204
|
+
_mergeErrors(l,this._singleErrorMap(this._typeError(p).errorObject)):delete c[u];continue}if(o.kind==="schema"){let w=o.
|
|
205
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,f,qt(i,p));R(c,u,w.validatedObject),this._mergeErrors(
|
|
206
|
+
l,Ht(w.errors,p));continue}let h=this._normalizeAndValidateValue(o.definition,f,p,c,u,a,i,this._buildArrayItemSettings(o.
|
|
207
207
|
definition,s));this._mergeErrors(l,h)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};R(r,n,c);for(let u=0;u<
|
|
208
208
|
c.length;u++){let p=ht(t,u);if(this._fieldToBeSkipped(p,i))continue;if(!Object.hasOwn(a,u)||c[u]===void 0){s.rejectExplicitUndefined?
|
|
209
209
|
this._mergeErrors(l,this._singleErrorMap(this._typeError(p).errorObject)):delete c[u];continue}if(o.kind==="schema"){let h=o.
|
|
210
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],
|
|
211
|
-
l,
|
|
210
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],qt(i,p));R(c,u,h.validatedObject),this._mergeErrors(
|
|
211
|
+
l,Ht(h.errors,p));continue}let f=this._normalizeAndValidateValue(o.definition,c[u],p,c,u,a,i,this._buildArrayItemSettings(
|
|
212
212
|
o.definition,s));this._mergeErrors(l,f)}return l}_validateField(t,r,n,o,i){if(!Object.hasOwn(this.structure,t))return{};
|
|
213
213
|
let s=this.structure[t];if(this._fieldToBeSkipped(t,o))return{};let a=i.isFieldPresent(t),c=r[t],l=c===void 0;return i.enforceRequired&&
|
|
214
214
|
s.required&&(!a||l)&&!this._paramToBeSkipped("required",o.skipParams,t)?this._singleErrorMap({field:t,code:"REQUIRED",message:"\
|
|
@@ -229,43 +229,43 @@ a)&&this._mergeErrors(h,this._singleErrorMap({field:a,code:"REQUIRED",message:"F
|
|
|
229
229
|
c.defaultTo!==void 0){let m=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,g=this._normalizeDefault(c,m,{fieldPath:a,
|
|
230
230
|
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(h,g.errors),Object.keys(g.errors).
|
|
231
231
|
length===0&&R(o,t,g.value)}return h}if(f===void 0)return l&&s.rejectExplicitUndefined?this._singleErrorMap(this._typeError(
|
|
232
|
-
a).errorObject):{};let
|
|
233
|
-
|
|
232
|
+
a).errorObject):{};let w={[t]:f};if(l){let m=this._normalizeAndValidateValue(c,f,a,w,t,n,i,s);return Object.hasOwn(w,t)&&
|
|
233
|
+
w[t]!==void 0?R(o,t,w[t]):w[t]===null&&R(o,t,null),m}if(!u)return{};let E=this._castValue(c,f,a,w,t,n,i,s);if(Object.keys(
|
|
234
234
|
E.errors).length>0)return E.errors;if(!E.shouldContinue)return{};let _=this._validateSelectedDescendants(c,r.children,a,
|
|
235
|
-
|
|
235
|
+
w,t,i,s);return Jn(w[t])&&R(o,t,w[t]),_}_validateSelectedDescendants(t,r,n,o,i,s,a){if(t.type==="object"){let c=this._resolveObjectFieldMode(
|
|
236
236
|
n,t);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let l=o[i];if(!ne(
|
|
237
|
-
l))return{};let u=c.schema._validateSelectedTree(r,l,
|
|
238
|
-
|
|
237
|
+
l))return{};let u=c.schema._validateSelectedTree(r,l,qt(s,n),{...a,defaultedFields:new Set});return R(o,i,u.validatedObject),
|
|
238
|
+
Ht(u.errors,n)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(n,t);if(!c)throw new Error(`Schema path "${n}" d\
|
|
239
239
|
oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,i,c,r,s,a)}throw new Error(
|
|
240
240
|
`Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(t,r,n,o,i,s,a){let c=[],l=r[n],
|
|
241
241
|
u={};R(r,n,c);for(let p of bd(Object.keys(i))){if(!/^[0-9]+$/.test(p))throw new Error(`Schema path "${ht(t,p)}" is inval\
|
|
242
|
-
id because array segments must use numeric indexes.`);let f=Number(p),h=ht(t,f),
|
|
242
|
+
id because array segments must use numeric indexes.`);let f=Number(p),h=ht(t,f),w=i[p],E=w.self===!0,_=gd(w);if(this._fieldToBeSkipped(
|
|
243
243
|
h,s))continue;if(!Object.hasOwn(l,f)){E&&a.rejectExplicitUndefined&&R(u,h,this._typeError(h).errorObject);continue}let m=l[f];
|
|
244
244
|
if(m===void 0){E&&a.rejectExplicitUndefined&&R(u,h,this._typeError(h).errorObject);continue}if(o.kind==="schema"){if(E){
|
|
245
|
-
let
|
|
246
|
-
this._mergeErrors(u,
|
|
245
|
+
let T=o.schema._validateWithOperation("replace",o.schema.operations.replace,m,qt(s,h));Jn(T.validatedObject)&&R(c,f,T.validatedObject),
|
|
246
|
+
this._mergeErrors(u,Ht(T.errors,h));continue}if(!_)continue;let b=o.schema._validateSelectedTree(w.children,m,qt(s,h),{...a,
|
|
247
247
|
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});Jn(b.validatedObject)&&R(c,f,b.validatedObject),
|
|
248
|
-
this._mergeErrors(u,
|
|
249
|
-
o.definition,m,h,
|
|
250
|
-
continue}if(!_)continue;let S=this._castValue(o.definition,m,h,
|
|
251
|
-
u,S.errors);continue}if(!S.shouldContinue)continue;let
|
|
252
|
-
s,g);Jn(
|
|
248
|
+
this._mergeErrors(u,Ht(b.errors,h));continue}let g=this._buildArrayItemSettings(o.definition,a),y=[m];if(E){let b=this._normalizeAndValidateValue(
|
|
249
|
+
o.definition,m,h,y,0,l,s,g);Object.hasOwn(y,0)&&y[0]!==void 0?R(c,f,y[0]):y[0]===null&&R(c,f,null),this._mergeErrors(u,b);
|
|
250
|
+
continue}if(!_)continue;let S=this._castValue(o.definition,m,h,y,0,l,s,g);if(Object.keys(S.errors).length>0){this._mergeErrors(
|
|
251
|
+
u,S.errors);continue}if(!S.shouldContinue)continue;let v=this._validateSelectedDescendants(o.definition,w.children,h,y,0,
|
|
252
|
+
s,g);Jn(y[0])&&R(c,f,y[0]),this._mergeErrors(u,v)}return u}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
253
253
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
254
254
|
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=Js(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
255
|
-
_resolvePathValidationRequest(n),c=this._validateSelectedTree(
|
|
255
|
+
_resolvePathValidationRequest(n),c=this._validateSelectedTree(yd([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:QS(
|
|
256
256
|
c.validatedObject,o),errors:c.errors}}validatePaths(t,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
|
|
257
257
|
isArray(t)||t.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
|
|
258
|
-
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(
|
|
258
|
+
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(yd(t),r,s,this.
|
|
259
259
|
_buildOperationSettings(o,i,r))}_installOperationMethods(){for(let t of Object.keys(this.operations)){if(t in this)throw new Error(
|
|
260
260
|
`Operation name "${t}" is reserved and cannot be used as a schema method.`);this[t]=(r,n={})=>this.validateWith(t,r,n)}}toJsonSchema(t={}){
|
|
261
261
|
return md(this,t)}getFieldDefinitions(){return Ws(this.structure)}getFieldDefinition(t){if(typeof t!="string"||t.trim()===
|
|
262
262
|
"")throw new Error("Field path must be a non-empty string.");let r=Ks(this,Js(t.trim()));return r===null?null:Ws(r)}getFieldMessages(t){
|
|
263
263
|
let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):Ws(r.messages)}cleanup(t,r){
|
|
264
|
-
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&R(n,o,t[o]);return n}}});var zL,
|
|
265
|
-
t",
|
|
266
|
-
-1<t.indexOf(u)?p:void 0:t||
|
|
264
|
+
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&R(n,o,t[o]);return n}}});var zL,iT,HL,sT,aT,Id,cT,Od,Ad,xd=d(()=>{({parse:zL,stringify:iT}=JSON),{keys:HL}=Object,sT=String,aT="string",Id="objec\
|
|
265
|
+
t",cT=(e,t)=>t,Od=(e,t,r)=>{let n=sT(t.push(r)-1);return e.set(r,n),n},Ad=(e,t,r)=>{let n=t&&typeof t===Id?(u,p)=>u===""||
|
|
266
|
+
-1<t.indexOf(u)?p:void 0:t||cT,o=new Map,i=[],s=[],a=+Od(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=iT(i[a++],
|
|
267
267
|
l,r);return"["+s.join(",")+"]";function l(u,p){if(c)return c=!c,p;let f=n.call(this,u,p);switch(typeof f){case Id:if(f===
|
|
268
|
-
null)return f;case
|
|
268
|
+
null)return f;case aT:return o.get(f)||Od(o,i,f)}return f}}});function pT(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Rd(e){if(typeof e==
|
|
269
269
|
"number")return Number.isFinite(e)?e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e==
|
|
270
270
|
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function Qs(e,t){
|
|
271
271
|
if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&
|
|
@@ -273,8 +273,8 @@ t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(Array.isArr
|
|
|
273
273
|
e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!Qs(e[o],t[o]))return!1;return!0}if(e===
|
|
274
274
|
null||t===null||typeof e!="object"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=Object.
|
|
275
275
|
keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(t,o)||!Qs(e[o],t[o]))return!1;
|
|
276
|
-
return!0}var
|
|
277
|
-
no","n","off"]);
|
|
276
|
+
return!0}var uT,dT,mT,Pd,Cd=d(()=>{xd();$s();js();Mr();uT=new Set(["true","1","yes","y","on"]),dT=new Set(["false","0","\
|
|
277
|
+
no","n","off"]);mT={install(e){let{addType:t,addValidator:r}=e;t("none",n=>n.value),t("file",n=>{let o=n.value;o==null&&
|
|
278
278
|
n.throwTypeError();let i=typeof o;if(i==="string"||i==="number"||i==="boolean"){let s=o.toString();return n.definition.noTrim?
|
|
279
279
|
s:s.trim()}n.throwTypeError()}),t("string",n=>{let o=n.value;if(o==null)return"";let i=typeof o;if(i==="string"||i==="nu\
|
|
280
280
|
mber"||i==="boolean"){let s=o.toString();return n.definition.noTrim?s:s.trim()}n.throwTypeError()}),t("blob",n=>n.value),
|
|
@@ -288,7 +288,7 @@ erialize",n=>{try{return JSON.stringify(n.value)}catch{try{return Ad(n.value)}ca
|
|
|
288
288
|
if(typeof n.value=="boolean")return n.value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;
|
|
289
289
|
n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.
|
|
290
290
|
value=="string"){let o=String(n.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(n.definition.stringTrueWhen||
|
|
291
|
-
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...
|
|
291
|
+
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...dT,o]),c=new Set([...uT,i]);if(a.has(s))return!1;
|
|
292
292
|
if(c.has(s))return!0}n.throwTypeError()}),t("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>
|
|
293
293
|
0)return n.value;n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))
|
|
294
294
|
return Number(n.value);n.throwTypeError()}if(typeof n.value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();
|
|
@@ -309,7 +309,7 @@ RegExp?new RegExp(o.source,o.flags):typeof o=="string"?new RegExp(o):null;if(!i)
|
|
|
309
309
|
{pattern:i.source})}),r("strictBoolean",n=>{if(n.parameterValue){if(n.definition.type!=="boolean")throw new Error(`stric\
|
|
310
310
|
tBoolean can only be used on boolean fields (${n.fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("\
|
|
311
311
|
STRICT_BOOLEAN","Value must be a boolean.")}}),r("validator",n=>{if(typeof n.parameterValue!="function")throw new Error(
|
|
312
|
-
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(
|
|
312
|
+
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(pT(o))throw new Error(
|
|
313
313
|
`Custom validator for "${n.fieldName}" must be synchronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FA\
|
|
314
314
|
ILED",o)}),r("uppercase",n=>{if(typeof n.value=="string")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value==
|
|
315
315
|
"string")return n.value.toLowerCase()}),r("length",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);
|
|
@@ -319,36 +319,36 @@ length})}),r("notEmpty",n=>{n.parameterValue&&typeof n.value=="string"&&n.value=
|
|
|
319
319
|
ld cannot be empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPre\
|
|
320
320
|
cision",n=>{if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be\
|
|
321
321
|
used on time or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},
|
|
322
|
-
Pd=
|
|
322
|
+
Pd=mT});var Nd=d(()=>{Ur()});function fT(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);R(e,t,r)}function hT(e,t,r){
|
|
323
323
|
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);R(e,t,r)}function Qn(e={}){let t=Object.
|
|
324
|
-
create(null);for(let[r,n]of Object.entries(e))R(t,r,n);return t}function
|
|
324
|
+
create(null);for(let[r,n]of Object.entries(e))R(t,r,n);return t}function gT(e,t){if(typeof e.install!="function")throw new Error(
|
|
325
325
|
"Plugin must have an install method.");e.install(t)}function kd(e,t,r){Ld.set(e,t),Md.set(e,r),Object.defineProperty(e,jd,
|
|
326
|
-
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function
|
|
326
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function wT(e){if(!e||
|
|
327
327
|
typeof e!="object"&&typeof e!="function")return null;let t=Ld.get(e),r=Md.get(e);if(t&&r)return{types:t,validators:r};let n=e[jd];
|
|
328
328
|
return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
|
|
329
329
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
330
330
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
331
|
-
validators}:null}function
|
|
332
|
-
for(let[n,o]of Object.entries(t)){if(Object.hasOwn(e,n)&&!
|
|
333
|
-
conflicting ${r} "${n}".`);R(e,n,o)}}function
|
|
334
|
-
t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=
|
|
331
|
+
validators}:null}function yT(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function bT(e,t){return e===t}function $d(e,t,r){
|
|
332
|
+
for(let[n,o]of Object.entries(t)){if(Object.hasOwn(e,n)&&!bT(e[n],o))throw new Error(`Cannot merge schema factories with\
|
|
333
|
+
conflicting ${r} "${n}".`);R(e,n,o)}}function ET(e,t,r){let n=yT(r).filter(Boolean);if(n.length<1)return{types:Qn(e),validators:Qn(
|
|
334
|
+
t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=wT(s);if(!a)throw new Error("Factory sources m\
|
|
335
335
|
ust be schema instances or schema factories created by json-rest-schema.");$d(o,a.types,"type"),$d(i,a.validators,"valid\
|
|
336
336
|
ator")}return{types:o,validators:i}}function Dd({types:e={},validators:t={},installCore:r=!0}={}){let n=Qn(e),o=Qn(t),i=(s,a={})=>{
|
|
337
|
-
let c=new
|
|
338
|
-
|
|
339
|
-
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(Pd),i}var Ld,Md,jd,L,gt=d(()=>{
|
|
340
|
-
new WeakMap,Md=new WeakMap,jd=Symbol.for("json-rest-schema.registry-metadata");L=Dd({installCore:!0})});var pM,Ud=d(()=>{gt();
|
|
337
|
+
let c=new Wt(s,n,o,a.operations);return kd(c,n,o),c};return kd(i,n,o),i.addType=(s,a)=>{fT(n,s,a)},i.addValidator=(s,a)=>{
|
|
338
|
+
hT(o,s,a)},i.use=s=>{gT(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{let a=ET(n,o,s);return Dd(
|
|
339
|
+
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(Pd),i}var Ld,Md,jd,L,gt=d(()=>{vd();Cd();Nd();Ur();Ld=
|
|
340
|
+
new WeakMap,Md=new WeakMap,jd=Symbol.for("json-rest-schema.registry-metadata");L=Dd({installCore:!0})});var pM,Ud=d(()=>{gt();F();pM=Object.freeze({schema:L({}),mode:"replace"})});var Bd=d(()=>{F();qu();Vn();Ud()});function Fd(e,t){let r=String(e||"").trim().toLowerCase();if(!Gd.test(r))throw new TypeError(`${t} must match ${Gd.toString()}\
|
|
341
341
|
.`);return r}function Zs(e,t){if(e==null)return Object.freeze({});if(!z(e))throw new TypeError(`${t} must be an object m\
|
|
342
342
|
apping local names to capability ids.`);let r={},n=new Set;for(let[o,i]of Object.entries(e)){let s=String(o||"").trim();
|
|
343
|
-
if(!
|
|
344
|
-
has(a))throw new TypeError(`${t} declares capability "${a}" more than once.`);n.add(a),r[s]=a}return Object.freeze(r)}function
|
|
343
|
+
if(!ST.test(s))throw new TypeError(`${t} local name "${s}" must be a JavaScript identifier.`);let a=Fd(i,`${t}.${s}`);if(n.
|
|
344
|
+
has(a))throw new TypeError(`${t} declares capability "${a}" more than once.`);n.add(a),r[s]=a}return Object.freeze(r)}function TT(e){
|
|
345
345
|
let t=new Map;for(let[r,n]of Object.entries(e))for(let o of Object.keys(n)){if(t.has(o))throw new TypeError(`Provider lo\
|
|
346
346
|
cal name "${o}" is declared by both ${t.get(o)} and ${r}.`);t.set(o,r)}}function ea(e,t){if(e==null)return null;if(typeof e!=
|
|
347
347
|
"function")throw new TypeError(`${t} must be a function when provided.`);return e}function Zn({id:e,requires:t={},optional:r={},
|
|
348
|
-
provides:n={},setup:o,boot:i=null,shutdown:s=null}={}){let a=
|
|
349
|
-
tional`),u=Zs(n,`${a}.provides`);
|
|
348
|
+
provides:n={},setup:o,boot:i=null,shutdown:s=null}={}){let a=Fd(e,"Provider id"),c=Zs(t,`${a}.requires`),l=Zs(r,`${a}.op\
|
|
349
|
+
tional`),u=Zs(n,`${a}.provides`);TT({requires:c,optional:l,provides:u});let p=ea(o,`${a}.setup`);if(!p)throw new TypeError(
|
|
350
350
|
`${a}.setup is required.`);return Object.freeze({id:a,requires:c,optional:l,provides:u,setup:p,boot:ea(i,`${a}.boot`),shutdown:ea(
|
|
351
|
-
s,`${a}.shutdown`)})}var Gd,
|
|
351
|
+
s,`${a}.shutdown`)})}var Gd,ST,ta=d(()=>{F();Gd=/^[a-z][a-z0-9_.-]*$/u,ST=/^[A-Za-z_$][A-Za-z0-9_$]*$/u});var Vd,zd=d(()=>{Vd="public"});var Hd=d(()=>{});var Wd=d(()=>{F()});var vT,Yd,Jd=d(()=>{Hd();Wd();vT="/api",Yd=`${vT}/bootstrap`});function ra(){let e=[],t=new Set,r=!1;function n({id:a,order:c=0,contribute:l}={}){if(r)throw new Error("Bootstrap regis\
|
|
352
352
|
tration is closed after the first payload is resolved.");let u=G(a);if(!u)throw new TypeError("Bootstrap contributor id \
|
|
353
353
|
is required.");if(typeof l!="function")throw new TypeError(`Bootstrap contributor "${u}" requires contribute().`);if(t.has(
|
|
354
354
|
u))throw new Error(`Bootstrap contributor "${u}" is duplicated.`);return t.add(u),e.push(Object.freeze({id:u,order:Number.
|
|
@@ -356,86 +356,86 @@ isFinite(c)?Number(c):0,contribute:l})),s}async function o(a={}){r=!0;let c={},l
|
|
|
356
356
|
(u,p)=>u.entry.order-p.entry.order||u.index-p.index).map(({entry:u})=>u);for(let u of l){let p=await u.contribute(Object.
|
|
357
357
|
freeze({...z(a)?a:{},payload:Object.freeze({...c})}));c={...c,...z(p)?p:{}}}return Object.freeze(c)}function i(){return Object.
|
|
358
358
|
freeze({sealed:r,contributorIds:Object.freeze(e.map(a=>a.id).sort())})}let s=Object.freeze({register:n,resolve:o,diagnostics:i});
|
|
359
|
-
return s}var na=d(()=>{
|
|
360
|
-
untime.bootstrap"},setup({http:e}){let t=ra();return e.router.register("GET",Yd,{auth:
|
|
359
|
+
return s}var na=d(()=>{F()});var IT,Kd=d(()=>{ta();zd();Jd();na();IT=Zn({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"r\
|
|
360
|
+
untime.bootstrap"},setup({http:e}){let t=ra();return e.router.register("GET",Yd,{auth:Vd,meta:{tags:["bootstrap"],summary:"\
|
|
361
361
|
Resolve app bootstrap payload"}},async(r,n)=>{n.code(200).send(await t.resolve({request:r,reply:n,query:r.query||{}}))}),
|
|
362
|
-
{bootstrap:t}}})});function
|
|
362
|
+
{bootstrap:t}}})});function OT(e){if(!z(e))throw new TypeError("Event listener must be an object.");let t=String(e.id||"").trim();if(!t)throw new TypeError(
|
|
363
363
|
"Event listener id is required.");if(typeof e.handle!="function")throw new TypeError(`Event listener "${t}" requires han\
|
|
364
364
|
dle().`);if(e.matches!=null&&typeof e.matches!="function")throw new TypeError(`Event listener "${t}" matches must be a f\
|
|
365
|
-
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function
|
|
365
|
+
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function AT(e){if(!z(e))throw new TypeError(
|
|
366
366
|
"Published event must be an object.");let t=String(e.type||"").trim();if(!t)throw new TypeError("Published event type is\
|
|
367
|
-
required.");return Object.freeze({...e,type:t})}function oa(){let e=[],t=new Set;function r(s){let a=
|
|
368
|
-
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=
|
|
367
|
+
required.");return Object.freeze({...e,type:t})}function oa(){let e=[],t=new Set;function r(s){let a=OT(s);if(t.has(a.id))
|
|
368
|
+
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=AT(s);
|
|
369
369
|
for(let c of e)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function o(){return Object.freeze({listenerIds:Object.
|
|
370
|
-
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var ia=d(()=>{
|
|
370
|
+
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var ia=d(()=>{F()});var xT,Xd=d(()=>{ta();ia();xT=Zn({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:oa()}}})});var eo=d(()=>{Vn();Hu();Bd();Kd();na();Xd();ia()});var Qd=d(()=>{});function Zd(e,t={}){let{missingStatus:r=404}=t,n=e?.errors?.[0]?.code||e?.code||"";return n==="vibe64_session_not_found"?
|
|
371
371
|
r:n.startsWith("vibe64_invalid")?400:n==="vibe64_command_requires_terminal"||n==="vibe64_agent_write_mode_busy"||n==="vi\
|
|
372
372
|
be64_agent_attachment_session_unavailable"||n==="vibe64_project_not_selected"||n==="vibe64_project_not_ready"||n==="vibe\
|
|
373
373
|
64_project_source_lock_timeout"||n==="vibe64_development_database_scope_busy"||n==="vibe64_project_session_policy_lock_t\
|
|
374
374
|
imeout"||n==="vibe64_session_creation_limit"||n==="vibe64_workspace_setup_retry_not_available"||n==="vibe64_workspace_se\
|
|
375
|
-
tup_running"?409:e?.ok===!1?400:200}var ep=d(()=>{});function
|
|
376
|
-
ep()});import
|
|
377
|
-
if(!Gn.includes(r))throw
|
|
378
|
-
let n=String(t.value||"").trim(),o=r===Lr?n.toLowerCase():n;if(!o)throw
|
|
379
|
-
64_preview_identity_selector_missing");if(r===Lr&&(!o.includes("@")||o.length>320))throw
|
|
380
|
-
nvalid.","vibe64_preview_identity_email_invalid");if(r!==Lr&&o.length>256)throw
|
|
375
|
+
tup_running"?409:e?.ok===!1?400:200}var ep=d(()=>{});function wt(e,t,r={}){let{status:n=Zd({ok:!1,code:t}),...o}=r;return new fe(n,e,{...o,code:t})}var tp=d(()=>{eo();F();Qd();
|
|
376
|
+
ep()});import RT from"node:crypto";function PT(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=String(t.type||"").trim();
|
|
377
|
+
if(!Gn.includes(r))throw wt("Preview identity selector type is invalid.","vibe64_preview_identity_selector_type_invalid");
|
|
378
|
+
let n=String(t.value||"").trim(),o=r===Lr?n.toLowerCase():n;if(!o)throw wt("Preview identity selector is missing.","vibe\
|
|
379
|
+
64_preview_identity_selector_missing");if(r===Lr&&(!o.includes("@")||o.length>320))throw wt("Preview identity email is i\
|
|
380
|
+
nvalid.","vibe64_preview_identity_email_invalid");if(r!==Lr&&o.length>256)throw wt(r===Bn?"Preview identity login is inv\
|
|
381
381
|
alid.":"Preview identity user id is invalid.",r===Bn?"vibe64_preview_identity_login_invalid":"vibe64_preview_identity_us\
|
|
382
382
|
er_id_invalid");return{type:r,value:o}}function ip(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};if(Object.hasOwn(
|
|
383
|
-
t,"subject"))throw
|
|
384
|
-
ct_unsupported");let r=String(t.operation||be).trim();if(![be,
|
|
385
|
-
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===be?{selector:
|
|
386
|
-
|
|
387
|
-
guest","you"]),op=32,fj=Object.freeze(["projectScope","sessionSourceRoot","sessionId","targetHref","terminalSessionId"])});var Gr,aa=d(()=>{Gr="vibe64_preview_token"});import{randomUUID as
|
|
388
|
-
function
|
|
389
|
-
command failed.",{code:t,params:n})}function
|
|
383
|
+
t,"subject"))throw wt("Preview identity login requires an explicit application selector.","vibe64_preview_identity_subje\
|
|
384
|
+
ct_unsupported");let r=String(t.operation||be).trim();if(![be,Yt].includes(r))throw wt("Preview identity operation is in\
|
|
385
|
+
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===be?{selector:PT(t.selector)}:{}}}var mj,be,
|
|
386
|
+
Yt,rp,np,op,fj,sa=d(()=>{zu();tp();mj=RT.randomBytes(32),be="login-as",Yt="logout",rp="selector",np=new Set(["default","\
|
|
387
|
+
guest","you"]),op=32,fj=Object.freeze(["projectScope","sessionSourceRoot","sessionId","targetHref","terminalSessionId"])});var Gr,aa=d(()=>{Gr="vibe64_preview_token"});import{randomUUID as CT}from"node:crypto";import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as sp}from"@local/vibe64-genesis/server";
|
|
388
|
+
function Jt(e="",t="vibe64_preview_identity_command_failed",r=502,n={}){return new fe(r,e||"Application preview identity\
|
|
389
|
+
command failed.",{code:t,params:n})}function kT(e={}){return{kind:rp,selector:e.selector}}function cp(e={},t={}){let{requestId:r=CT(),
|
|
390
390
|
targetHref:n=""}=t,o=ip(e),i=String(n||"").trim(),s=new URL(i);if(!["http:","https:"].includes(s.protocol))throw new Error(
|
|
391
391
|
"Application preview identity target must use HTTP.");return{operation:o.operation,protocol:sp,requestId:String(r),...o.
|
|
392
|
-
operation===be?{subject:
|
|
392
|
+
operation===be?{subject:kT(o)}:{},target:{href:s.toString(),origin:s.origin}}}function $T(e=[]){if(!Array.isArray(e))throw Jt(
|
|
393
393
|
"Application preview identity command returned invalid cookies.","vibe64_preview_identity_command_cookies_invalid");let t=e;
|
|
394
|
-
if(t.length>ca)throw
|
|
394
|
+
if(t.length>ca)throw Jt("Application preview identity command returned too many cookies.","vibe64_preview_identity_comma\
|
|
395
395
|
nd_cookies_too_many");return t.map((r,n)=>{let o=String(r||""),i=o.split(";",1)[0]||"",s=i.indexOf("="),a=(s<0?i:i.slice(
|
|
396
|
-
0,s)).trim();if(!o||Buffer.byteLength(o)>la||/[\r\n]/u.test(o)||s<1||!
|
|
397
|
-
test(o))throw
|
|
398
|
-
_cookie_invalid",502,{cookie:n+1});return o})}function
|
|
396
|
+
0,s)).trim();if(!o||Buffer.byteLength(o)>la||/[\r\n]/u.test(o)||s<1||!NT.test(a)||a===Fr||a.startsWith(`${Fr}_`)||/(?:^|;)\s*domain\s*=/iu.
|
|
397
|
+
test(o))throw Jt(`Application preview identity command returned invalid cookie ${n+1}.`,"vibe64_preview_identity_command\
|
|
398
|
+
_cookie_invalid",502,{cookie:n+1});return o})}function LT(e=null){if(!e||typeof e!="object"||Array.isArray(e))return null;
|
|
399
399
|
let t={displayName:String(e.displayName||e.name||"").trim().slice(0,256),email:String(e.email||"").trim().toLowerCase().
|
|
400
400
|
slice(0,320),login:String(e.login||"").trim().slice(0,256),userId:String(e.userId||e.id||"").trim().slice(0,256),username:String(
|
|
401
|
-
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function
|
|
402
|
-
requestId:n=""}=t;if(!e||typeof e!="object"||Array.isArray(e))throw
|
|
401
|
+
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function MT(e={},t={}){let{operation:r=be,
|
|
402
|
+
requestId:n=""}=t;if(!e||typeof e!="object"||Array.isArray(e))throw Jt("Application preview identity command returned in\
|
|
403
403
|
valid JSON.","vibe64_preview_identity_command_json_invalid");if(e.protocol!==sp||String(e.requestId||"")!==String(n||"")||
|
|
404
|
-
typeof e.ok!="boolean")throw
|
|
405
|
-
eview_identity_command_response_invalid");let o=$
|
|
404
|
+
typeof e.ok!="boolean")throw Jt("Application preview identity command returned an invalid protocol response.","vibe64_pr\
|
|
405
|
+
eview_identity_command_response_invalid");let o=$T(e.setCookie);if(e.ok===!1){let a=Number(e.statusCode);return{code:String(
|
|
406
406
|
e.code||"vibe64_preview_identity_application_rejected").trim().slice(0,128),error:String(e.error||"Application preview i\
|
|
407
407
|
dentity was rejected.").trim().slice(0,2e3),ok:!1,setCookie:o,signedOut:e.signedOut===!0,statusCode:Number.isInteger(a)&&
|
|
408
|
-
a>=400&&a<600?a:400}}let i=r===
|
|
408
|
+
a>=400&&a<600?a:400}}let i=r===Yt||e.signedOut===!0,s=i?null:LT(e.identity);if(o.length<1||!i&&!s)throw Jt("Application \
|
|
409
409
|
preview identity command did not return an authenticated browser session.","vibe64_preview_identity_command_session_miss\
|
|
410
|
-
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var ap,ca,la,
|
|
411
|
-
512*1024,ca=64,la=16*1024,
|
|
410
|
+
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var ap,ca,la,Fr,NT,Sj,lp=d(()=>{eo();sa();aa();ap=
|
|
411
|
+
512*1024,ca=64,la=16*1024,Fr=Gr,NT=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u;Sj=Object.freeze({normalizePreviewIdentityCommandResponse:MT})});var up=d(()=>{});function dp(e=""){return BT.find(t=>t.pattern.test(String(e)))?.kind||""}function VT(e){if(!Ue(e)||e.startsWith("/")||e.
|
|
412
412
|
includes("\\")||e.includes("\0"))return!1;let t=e.split("/");return t.every(r=>r&&r!=="."&&r!=="..")&&!t.includes("node_\
|
|
413
|
-
modules")}var
|
|
414
|
-
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),
|
|
415
|
-
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),
|
|
416
|
-
it","request-limit","size-limit","target-exited","session-ended","error"]),mp=Object.freeze(["nodejs","python","php"]),
|
|
417
|
-
1024*1024,Oj=Object.freeze({durationMs:600*1e3,capturedRequests:2e3,hitsBytesPerProcess:16*
|
|
418
|
-
proxyRequestLines:2e4,interactions:500,bufferedBytesPerProcess:64*
|
|
419
|
-
1024,indexBytes:4*
|
|
420
|
-
60*1e3}),xj=Object.freeze(["click","enter","submit"]),
|
|
413
|
+
modules")}var jT,Ij,DT,UT,mp,Vr,Oj,Aj,xj,BT,GT,FT,to,Ue,pp,Rj,Pj,fp=d(()=>{jT="vibe64.usage-trace.v1",Ij=Object.freeze({
|
|
414
|
+
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),DT=
|
|
415
|
+
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),UT=Object.freeze(["person","time-lim\
|
|
416
|
+
it","request-limit","size-limit","target-exited","session-ended","error"]),mp=Object.freeze(["nodejs","python","php"]),Vr=
|
|
417
|
+
1024*1024,Oj=Object.freeze({durationMs:600*1e3,capturedRequests:2e3,hitsBytesPerProcess:16*Vr,hitsBytesPerRecording:32*Vr,
|
|
418
|
+
proxyRequestLines:2e4,interactions:500,bufferedBytesPerProcess:64*Vr,flushIntervalMs:1e3,flushEntries:2e3,traceLineBytes:64*
|
|
419
|
+
1024,indexBytes:4*Vr,plumbingShare:.8,plumbingMinimumRequests:3}),Aj=Object.freeze({maxRecordings:10,maxBytes:64*Vr,maxAgeMs:10080*
|
|
420
|
+
60*1e3}),xj=Object.freeze(["click","enter","submit"]),BT=Object.freeze([Object.freeze({kind:"request",pattern:/^r_[0-9]{6}$/u}),
|
|
421
421
|
Object.freeze({kind:"local-request",pattern:/^l_[0-9]+_[0-9]+$/u}),Object.freeze({kind:"run",pattern:/^run_[0-9]+$/u}),Object.
|
|
422
|
-
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),
|
|
422
|
+
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),GT=/^sha256:[0-9a-f]{64}$/u,FT=Object.freeze(["ready","idle"]);to=e=>Number.
|
|
423
423
|
isSafeInteger(e)&&e>=0,Ue=e=>typeof e=="string"&&e.length>0,pp=e=>!!e&&Number.isSafeInteger(e.line)&&e.line>0&&Number.isSafeInteger(
|
|
424
|
-
e.column)&&e.column>0;Rj=Object.freeze({header:e=>e.schema===
|
|
425
|
-
e.pid)&&e.pid>0&&Ue(e.startedAt),tracer:e=>
|
|
424
|
+
e.column)&&e.column>0;Rj=Object.freeze({header:e=>e.schema===jT&&mp.includes(e.runtime)&&Ue(e.runtimeVersion)&&Number.isSafeInteger(
|
|
425
|
+
e.pid)&&e.pid>0&&Ue(e.startedAt),tracer:e=>FT.includes(e.state),file:e=>to(e.fileIndex)&&VT(e.path)&>.test(e.hash||""),
|
|
426
426
|
function:e=>to(e.functionIndex)&&to(e.fileIndex)&&typeof e.name=="string"&&pp(e.start)&&pp(e.end),scope:e=>dp(e.scope)===
|
|
427
427
|
e.kind&&Ue(e.startedAt)&&(e.endedAt===void 0||Ue(e.endedAt))&&(e.label===void 0||Ue(e.label)&&["local-request","run"].includes(
|
|
428
428
|
e.kind)),hits:e=>dp(e.scope)!==""&&Array.isArray(e.counts)&&e.counts.every(t=>Array.isArray(t)&&t.length===2&&to(t[0])&&
|
|
429
429
|
(t[1]===null||Number.isSafeInteger(t[1])&&t[1]>0)),diagnostic:e=>Ue(e.code)&&(e.path===void 0||Ue(e.path)),truncated:e=>Ue(
|
|
430
|
-
e.reason)}),Pj=Object.freeze({USAGE_RECORDING_STATES:
|
|
431
|
-
return hp}}function
|
|
430
|
+
e.reason)}),Pj=Object.freeze({USAGE_RECORDING_STATES:DT,USAGE_RECORDING_STOP_REASONS:UT,USAGE_TRACER_RUNTIMES:mp})});function zT(e=""){try{let t=new URL(e),r=t.protocol==="https:",n=t.port||(r?"443":"80");return`${r?"__Host-":""}${hp}_${n}`}catch{
|
|
431
|
+
return hp}}function HT(e="",t={}){let{proxyOrigin:r="",targetOrigin:n=""}=t,o=String(e||"").trim();if(!o||!r||!n)return o;
|
|
432
432
|
try{let i=new URL(o,n),s=new URL(r),a=new URL(n);return a.protocol=s.protocol,i.origin!==n&&i.origin!==a.origin?o:(s.pathname=
|
|
433
|
-
i.pathname,s.search=
|
|
433
|
+
i.pathname,s.search=qT(i.search),s.hash=i.hash,s.toString())}catch{return o}}function qT(e=""){let t=String(e||"");if(!t||
|
|
434
434
|
t==="?")return"";let r=t.startsWith("?")?t.slice(1):t;if(!r)return"";let n=r.split("&").filter(o=>{let i=o.indexOf("="),
|
|
435
|
-
s=i<0?o:o.slice(0,i);return
|
|
436
|
-
String(e||"").replace(/\+/gu," "))}catch{return String(e||"")}}var hp,gp,Dj,
|
|
437
|
-
Dj=Object.freeze({previewTokenCookieName:
|
|
438
|
-
sa();lp();
|
|
435
|
+
s=i<0?o:o.slice(0,i);return WT(s)!==Gr});return n.length>0?`?${n.join("&")}`:""}function WT(e=""){try{return decodeURIComponent(
|
|
436
|
+
String(e||"").replace(/\+/gu," "))}catch{return String(e||"")}}var hp,gp,Dj,wp=d(()=>{up();fp();aa();hp=Gr,gp=/^vibe64-launch-[a-f0-9]{12}$/u;
|
|
437
|
+
Dj=Object.freeze({previewTokenCookieName:zT,proxiedLocation:HT})});import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as ro}from"@local/vibe64-genesis/server";var ua,yp,da,bp,Ep,_p,Sp,Tp=d(()=>{
|
|
438
|
+
sa();lp();wp();ua=e=>JSON.stringify(e,null,2),yp=Gn.map(e=>`\`${e}\``).join(", "),da="6f1c2a7e-3d4b-4c55-9a10-2b7d8e9f0a\
|
|
439
439
|
11",bp=cp({operation:be,selector:{type:"email",value:"admin@example.com"}},{requestId:da,targetHref:"http://127.0.0.1:51\
|
|
440
440
|
73/"}),Ep=Object.freeze({protocol:ro,requestId:da,ok:!0,setCookie:["app_session=abc123; Path=/; HttpOnly; SameSite=Lax"],
|
|
441
441
|
identity:{displayName:"Admin",email:"admin@example.com",userId:"1"}}),_p=Object.freeze({protocol:ro,requestId:da,ok:!1,code:"\
|
|
@@ -465,9 +465,9 @@ mand({ env: process.env, protocol: "${ro}", localHostnames: [${gp}] })\`.
|
|
|
465
465
|
|
|
466
466
|
## Request
|
|
467
467
|
|
|
468
|
-
- \`operation\`: \`${be}\` or \`${
|
|
468
|
+
- \`operation\`: \`${be}\` or \`${Yt}\`.
|
|
469
469
|
- \`protocol\`, \`requestId\`: echo both in the response.
|
|
470
|
-
- \`subject\` (${be} only): \`{"kind":"selector","selector":{"type":\u2026,"value":\u2026}}\` with type ${
|
|
470
|
+
- \`subject\` (${be} only): \`{"kind":"selector","selector":{"type":\u2026,"value":\u2026}}\` with type ${yp}. Email val\
|
|
471
471
|
ues arrive lowercased.
|
|
472
472
|
- \`target\`: \`{"href","origin"}\` of the application page the cookies are for.
|
|
473
473
|
|
|
@@ -478,10 +478,10 @@ ${ua(bp)}
|
|
|
478
478
|
## Response
|
|
479
479
|
|
|
480
480
|
- Always: \`protocol\`, the same \`requestId\`, boolean \`ok\`, and \`setCookie\`: an array of complete Set-Cookie header values\
|
|
481
|
-
(at most ${ca}, each at most ${la} bytes, no line breaks, no \`Domain\` attribute, never named \`${
|
|
481
|
+
(at most ${ca}, each at most ${la} bytes, no line breaks, no \`Domain\` attribute, never named \`${Fr}\` or \`${Fr}_*\`)\
|
|
482
482
|
.
|
|
483
483
|
- \`ok: true\`: at least one cookie. For ${be}, \`identity\` with at least one of \`displayName\`, \`email\`, \`login\`, \`userId\
|
|
484
|
-
\`, \`username\`. For ${
|
|
484
|
+
\`, \`username\`. For ${Yt} (or \`"signedOut": true\`), the cookies that clear the session.
|
|
485
485
|
- \`ok: false\`: \`code\` (at most 128 characters), \`error\` (a person-readable reason, at most 2000), \`statusCode\` 400 throu\
|
|
486
486
|
gh 599 (default 400), optional \`signedOut\`, and \`setCookie\` (may be empty).
|
|
487
487
|
|
|
@@ -497,7 +497,7 @@ ${ua(_p)}
|
|
|
497
497
|
The ordered list of named existing application accounts that Preview and managed Playwright can sign in as through the a\
|
|
498
498
|
pplication's Preview identity command (\`vibe64-helper spec preview-identity-command\`).
|
|
499
499
|
|
|
500
|
-
- Each entry has a \`name\`, a selector \`type\` (${
|
|
500
|
+
- Each entry has a \`name\`, a selector \`type\` (${yp}) and the application's \`value\` for that account. Names are uniqu\
|
|
501
501
|
e, start with a lowercase letter and use at most 64 lowercase letters, digits, \`_\` or \`-\`; ${[...np].map(e=>`\`${e}\``).
|
|
502
502
|
join(", ")} are reserved. At most ${op} entries; the first is the default.
|
|
503
503
|
- Entries are selectors only, never passwords. A saved entry does not prove that the account exists or can reach a page:\
|
|
@@ -518,31 +518,31 @@ Entry shape:
|
|
|
518
518
|
\`\`\`json
|
|
519
519
|
{"name":"admin","type":"email","value":"admin@example.com"}
|
|
520
520
|
\`\`\`
|
|
521
|
-
`}])});var Ip={};Du(Ip,{__testables:()=>
|
|
522
|
-
function
|
|
521
|
+
`}])});var Ip={};Du(Ip,{__testables:()=>QT,runAgentSpecCli:()=>XT});import{readFile as JT}from"node:fs/promises";import{VIBE64_GENESIS_AGENT_SPECS as KT}from"@local/vibe64-genesis/server/agentSpecs";
|
|
522
|
+
function vp(){let e=Math.max(...no.map(({name:t})=>t.length));return["Usage: vibe64 spec <name>","","Vibe64-owned contra\
|
|
523
523
|
cts:",...no.map(({name:t,title:r})=>` ${t.padEnd(e)} ${r}`)].join(`
|
|
524
|
-
`)}async function
|
|
524
|
+
`)}async function XT(e=[],{write:t=n=>process.stdout.write(`${n.trimEnd()}
|
|
525
525
|
`),writeError:r=n=>process.stderr.write(`${n.trimEnd()}
|
|
526
|
-
`)}={}){let[n]=e;if(!n||n==="--help"||n==="-h")return t(
|
|
526
|
+
`)}={}){let[n]=e;if(!n||n==="--help"||n==="-h")return t(vp()),0;let o=e.length===1&&no.find(i=>i.name===n);return o?(t(await o.
|
|
527
527
|
text()),0):(r(`Unknown Vibe64 spec: ${e.join(" ")}.
|
|
528
528
|
|
|
529
|
-
${
|
|
530
|
-
freeze([...
|
|
531
|
-
e",text:()=>
|
|
532
|
-
e))
|
|
529
|
+
${vp()}`),2)}var YT,no,QT,Op=d(()=>{Vu();Tp();YT=new URL("./../server/lib/agentSpecCli.js",import.meta.url).href,no=Object.
|
|
530
|
+
freeze([...KT,...Sp,...Fu,{name:"training-content",title:"Teaching content format for vibe64 training validate and bundl\
|
|
531
|
+
e",text:()=>JT(new URL("../../docs/training-content.md",YT),"utf8")}]);QT=Object.freeze({VIBE64_AGENT_SPECS:no})});function yt(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e);for(let r of Object.getOwnPropertyNames(
|
|
532
|
+
e))yt(e[r],t);return Object.freeze(e)}var oo=d(()=>{});function io(e){return!!e&&typeof e=="object"&&rv.every(t=>typeof e[t]=="function")}function xp(e=null,{defaultMode:t="cr\
|
|
533
533
|
eate",context:r="schema definition.mode"}={}){let n=ie(e),o=G(t).toLowerCase()||"create",i=Object.prototype.hasOwnProperty.
|
|
534
|
-
call(n,"mode")?G(n.mode).toLowerCase():"";if(!i)return o;if(!
|
|
534
|
+
call(n,"mode")?G(n.mode).toLowerCase():"";if(!i)return o;if(!ZT.has(i))throw new TypeError(`${r} must be one of: create,\
|
|
535
535
|
replace, patch.`);return i}function Rp(e=null,t=""){let r=G(t);if(!r)return{};let n=ie(e);return io(n.schema)?ie(n.schema.
|
|
536
|
-
getFieldMessages(r)):{}}function
|
|
536
|
+
getFieldMessages(r)):{}}function nv(e=null,t=""){let r=G(t).split(".").filter(Boolean);return r.length<2?{}:(r.pop(),Rp(
|
|
537
537
|
e,r.join(".")))}function Ap(e,t){let r=t?e[t]:void 0;if(typeof r=="string"){let i=G(r);return i?{message:i}:null}if(!z(r))
|
|
538
538
|
return null;let n=G(r.message);if(!n)return null;let o=G(r.code);return o?{message:n,code:o,params:ie(r.params)}:{message:n}}
|
|
539
|
-
function
|
|
540
|
-
Object.keys(s).length<1?
|
|
539
|
+
function ov(e,t,r=null){let n=G(t?.code).toUpperCase(),o=ev[n]||{},i=ie(t?.params),s=Rp(r,e),a=n==="FIELD_NOT_ALLOWED"&&
|
|
540
|
+
Object.keys(s).length<1?nv(r,e):s,c=Ap(a,o.messageKey)||Ap(a,"default");if(c)return c.code?{message:c.message,code:c.code,
|
|
541
541
|
params:{...i,...c.params}}:{message:c.message};let l=G(t?.message);if(l)return o.code?{message:l,code:o.code,params:i}:{
|
|
542
|
-
message:l};let u=G(t?.code);return u?{message:u}:{...
|
|
543
|
-
i,s]of Object.entries(r)){let a=G(i);if(!a)continue;if(typeof s=="string"){n[a]=s;continue}let{message:c,code:l,params:u}=
|
|
544
|
-
a,s,t);n[a]=c,l&&(o[a]={code:l,params:u})}return{fieldErrors:n,fieldErrorCodes:o}}var
|
|
545
|
-
["create","replace","patch"]),
|
|
542
|
+
message:l};let u=G(t?.code);return u?{message:u}:{...tv,params:{}}}function pa(e={},t=null){let r=ie(e),n={},o={};for(let[
|
|
543
|
+
i,s]of Object.entries(r)){let a=G(i);if(!a)continue;if(typeof s=="string"){n[a]=s;continue}let{message:c,code:l,params:u}=ov(
|
|
544
|
+
a,s,t);n[a]=c,l&&(o[a]={code:l,params:u})}return{fieldErrors:n,fieldErrorCodes:o}}var ZT,ev,tv,rv,ma=d(()=>{F();ZT=new Set(
|
|
545
|
+
["create","replace","patch"]),ev=Object.freeze({REQUIRED:{messageKey:"required",code:"kernel.validation.field.required"},
|
|
546
546
|
TYPE_CAST_FAILED:{messageKey:"default",code:"kernel.validation.field.typeCastFailed"},NOT_NULLABLE:{messageKey:"default",
|
|
547
547
|
code:"kernel.validation.field.notNullable"},MIN_LENGTH:{messageKey:"minLength",code:"kernel.validation.field.minLength"},
|
|
548
548
|
MAX_LENGTH:{messageKey:"maxLength",code:"kernel.validation.field.maxLength"},MIN_VALUE:{messageKey:"min",code:"kernel.va\
|
|
@@ -551,23 +551,23 @@ ern",code:"kernel.validation.field.pattern"},ENUM_VALUE:{messageKey:"enum",code:
|
|
|
551
551
|
messageKey:"additionalProperties",code:"kernel.validation.field.notAllowed"},CUSTOM_VALIDATOR_FAILED:{messageKey:"valida\
|
|
552
552
|
tor",code:""},STRICT_BOOLEAN:{messageKey:"default",code:"kernel.validation.field.strictBoolean"},RANGE_EXCEEDED:{messageKey:"\
|
|
553
553
|
default",code:"kernel.validation.field.rangeExceeded"},NOT_EMPTY:{messageKey:"default",code:"kernel.validation.field.not\
|
|
554
|
-
Empty"}}),
|
|
555
|
-
ace","patch","toJsonSchema"])});function
|
|
554
|
+
Empty"}}),tv=Object.freeze({code:"kernel.validation.invalid",message:"Invalid value."}),rv=Object.freeze(["create","repl\
|
|
555
|
+
ace","patch","toJsonSchema"])});function iv(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&(Object.prototype.hasOwnProperty.call(e,"schema")||Object.
|
|
556
556
|
prototype.hasOwnProperty.call(e,"mode"))}function so(e,{context:t="schema definition",defaultMode:r=""}={}){if(e==null)return null;
|
|
557
|
-
if(!
|
|
557
|
+
if(!iv(e))throw new TypeError(`${t} must be a schema definition object.`);let n=ie(e);if(!Object.prototype.hasOwnProperty.
|
|
558
558
|
call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!io(n.schema))throw new TypeError(`${t}.schema must \
|
|
559
559
|
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=G(r).toLowerCase();return o.mode=xp(n,{defaultMode:i||
|
|
560
560
|
"patch",context:`${t}.mode`}),Object.freeze(o)}function fa(e,t,{context:r="schema definition",defaultMode:n=""}={}){let o=so(
|
|
561
|
-
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var zr=d(()=>{
|
|
562
|
-
freeze({schema:
|
|
563
|
-
|
|
561
|
+
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var zr=d(()=>{F();ma()});var Pp=d(()=>{gt();F();oo();zr()});var Cp=d(()=>{gt();oo();zr()});var sv,av,Np=d(()=>{gt();sv=L({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),av=Object.
|
|
562
|
+
freeze({schema:sv,mode:"patch"})});var kp,cv,$p=d(()=>{kp=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),
|
|
563
|
+
cv=Object.freeze({...kp,nullable:!0})});var Lp=d(()=>{F()});function jp({message:e=Mp,fieldErrors:t=null,fieldErrorCodes:r=null,errors:n=null,cause:o,statusCode:i=null}={}){let s=new Error(
|
|
564
564
|
e,o?{cause:o}:void 0);if(e===Mp&&(s.messageCode="kernel.validation.schemaFailed",s.messageParams={}),Number.isInteger(i)&&
|
|
565
565
|
i>=400&&i<=599&&(s.statusCode=i),z(t)){let a=z(r)&&Object.keys(r).length>0?r:null;s.fieldErrors=t,a&&(s.fieldErrorCodes=
|
|
566
566
|
a),s.details={...s.details||{},fieldErrors:t,...a?{fieldErrorCodes:a}:{}}}else n!=null&&(s.details={...s.details||{},errors:n});
|
|
567
567
|
return s}function ha(e,t,{phase:r="input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;let i=fa(
|
|
568
568
|
e,t,{defaultMode:r==="output"?"replace":"patch",context:n}),{fieldErrors:s,fieldErrorCodes:a}=pa(i.errors,e);if(Object.keys(
|
|
569
|
-
s).length>0)throw jp({fieldErrors:s,fieldErrorCodes:a,statusCode:o});return i.validatedObject??t}var Mp,Dp=d(()=>{
|
|
570
|
-
Mp="Schema validation failed."});var ED,Up=d(()=>{
|
|
569
|
+
s).length>0)throw jp({fieldErrors:s,fieldErrorCodes:a,statusCode:o});return i.validatedObject??t}var Mp,Dp=d(()=>{F();zr();
|
|
570
|
+
Mp="Schema validation failed."});var ED,Up=d(()=>{F();ED=new Map([{keyword:"required",code:"kernel.validation.required"},{keyword:"type",code:"kernel.val\
|
|
571
571
|
idation.type"},{keyword:"minLength",code:"kernel.validation.minLength"},{keyword:"maxLength",code:"kernel.validation.max\
|
|
572
572
|
Length"},{keyword:"minimum",code:"kernel.validation.minimum"},{keyword:"maximum",code:"kernel.validation.maximum"},{keyword:"\
|
|
573
573
|
exclusiveMinimum",code:"kernel.validation.exclusiveMinimum"},{keyword:"exclusiveMaximum",code:"kernel.validation.exclusi\
|
|
@@ -579,40 +579,40 @@ tion.maxItems"},{keyword:"additionalItems",code:"kernel.validation.additionalIte
|
|
|
579
579
|
kernel.validation.maxProperties"},{keyword:"additionalProperties",code:"kernel.validation.additionalProperties"},{keyword:"\
|
|
580
580
|
propertyNames",code:"kernel.validation.propertyNames"},{keyword:"oneOf",code:"kernel.validation.oneOf"},{keyword:"anyOf",
|
|
581
581
|
code:"kernel.validation.anyOf"},{keyword:"not",code:"kernel.validation.not"},{keyword:"if",code:"kernel.validation.if"}].
|
|
582
|
-
map(({keyword:e,code:t})=>[e,t]))});var Bp,ga,
|
|
583
|
-
|
|
584
|
-
id must be a canonical positive integer string."}}}}),mode:"patch"})});var
|
|
585
|
-
let n=ha({schema:e,mode:"create"},t,{context:r});if(!
|
|
586
|
-
s.`);return n}var C,U,
|
|
587
|
-
minLength:1,maxLength:256},U={...C,maxLength:64},
|
|
588
|
-
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),co={type:"integer",required:!0,enum:[1]},
|
|
589
|
-
24),
|
|
582
|
+
map(({keyword:e,code:t})=>[e,t]))});var Bp,ga,lv,uv,Gp=d(()=>{gt();oo();Bp="^[1-9][0-9]*$",ga=yt({type:"string",minLength:1,pattern:Bp}),lv=yt({...ga,nullable:!0}),
|
|
583
|
+
uv=yt({schema:L({recordId:{...ga,required:!0,messages:{pattern:{code:"kernel.validation.recordIdInvalid",message:"Record\
|
|
584
|
+
id must be a canonical positive integer string."}}}}),mode:"patch"})});var Fp=d(()=>{F()});var ao=d(()=>{gt();Cs();Pp();Cp();Np();$p();Lp();ma();zr();Dp();Up();Gp();Fp()});import{isDeepStrictEqual as dv}from"node:util";function lo(e,t){let r=wv.get(e?.schemaVersion)||zp;return he(r,e,t)}function he(e,t,r){
|
|
585
|
+
let n=ha({schema:e,mode:"create"},t,{context:r});if(!dv(t,n))throw new Error(`${r}: unknown fields or noncanonical value\
|
|
586
|
+
s.`);return n}var C,U,V,co,pv,mv,Vp,zp,fv,Hp,hv,gv,wv,Oe,uo,po,qp,Kt=d(()=>{ao();C={type:"string",required:!0,noTrim:!0,
|
|
587
|
+
minLength:1,maxLength:256},U={...C,maxLength:64},V=(e,t=100)=>({type:"array",required:!0,maxLength:t,items:e,validator:r=>Array.
|
|
588
|
+
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),co={type:"integer",required:!0,enum:[1]},pv=V(L({code:U}),
|
|
589
|
+
24),mv=L({id:U,kind:{...C,enum:["answer","practical"]},required:{type:"boolean",required:!0},rubric:C,evidence:{type:"ob\
|
|
590
590
|
ject",required:!1,schema:L({producer:{...C,enum:["workspace","colleague","exercise","code"]},operation:U,check:{...U,required:!1},
|
|
591
|
-
explanationRequired:{type:"boolean",required:!1},files:{...
|
|
592
|
-
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:
|
|
591
|
+
explanationRequired:{type:"boolean",required:!1},files:{...V(C,8),required:!1,minLength:1}})}}),Vp={code:U,title:C,prerequisites:pv,
|
|
592
|
+
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:V(L({id:U,descriptor:C}),12),exercise:{type:"object",
|
|
593
593
|
required:!1,schema:L({kind:{...C,enum:["bundled"]},source:C,reuse:{...C,enum:["attempt","sequence"]},sequenceId:{...U,required:!1},
|
|
594
|
-
sequenceMode:{...C,required:!1,enum:["create","continue"]}})},checks:{...
|
|
594
|
+
sequenceMode:{...C,required:!1,enum:["create","continue"]}})},checks:{...V(L({id:U,file:C,assets:{...V(C,32),required:!1},
|
|
595
595
|
kind:{...C,required:!1,enum:["response","code"]},timeoutSeconds:{type:"integer",required:!1,min:1,max:60}}),12),required:!1},
|
|
596
|
-
appRoutes:{...
|
|
597
|
-
/-]*$"}}),16),required:!1}},zp=L({schemaVersion:co,...
|
|
598
|
-
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:L({id:U,play:{...
|
|
596
|
+
appRoutes:{...V(L({method:{...C,enum:["POST","PUT","PATCH","DELETE"]},path:{...C,maxLength:128,pattern:"^/[A-Za-z0-9._~:\
|
|
597
|
+
/-]*$"}}),16),required:!1}},zp=L({schemaVersion:co,...Vp,document:C,assessments:V(mv,32)}),fv=L({id:U,title:C,body:C,required:{
|
|
598
|
+
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:L({id:U,play:{...V(L({name:U,parameters:{type:"obje\
|
|
599
599
|
ct",required:!0}}),16),required:!1}})},guide:{type:"object",required:!1,schema:L({target:U,navigate:{type:"boolean",required:!1},
|
|
600
600
|
filePath:{...C,required:!1,maxLength:512},caption:{...C,required:!1}})},check:{type:"object",required:!0,schema:L({kind:{
|
|
601
|
-
...C,enum:["auto","choice","review","self","fact","none"]},check:{...U,required:!1},fact:{...U,required:!1},files:{...
|
|
602
|
-
C,8),required:!1},question:{...C,required:!1,maxLength:2e3},options:{...
|
|
603
|
-
required:!0,min:0,max:7},8),required:!1},rubric:{...C,required:!1,maxLength:600},evidence:{...
|
|
604
|
-
onversation"]},2),required:!1}})}}),Hp={...
|
|
605
|
-
r",required:!0,enum:[2]},...Hp}),
|
|
606
|
-
io","project"]}}),
|
|
607
|
-
topicId:U,domainId:U,title:C,status:{...C,enum:["preview","released"]},outline:C,prerequisites:
|
|
608
|
-
L({code:U,descriptor:C,status:{...C,enum:["draft","published"]},required:{type:"boolean",required:!0}}),64),places:{...
|
|
609
|
-
U,64),required:!1},activities:{...
|
|
610
|
-
title:C,release:C,status:{...C,enum:["preview","released"]},topics:
|
|
611
|
-
qp=L({schemaVersion:co,id:U,title:C,svg:C,controller:C,assets:{...
|
|
612
|
-
...C,maxLength:2e3},commands:
|
|
613
|
-
nteger",required:!0,min:1,max:256}}),8),completionState:U,description:{...C,maxLength:2e3}}),32)})});function se(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function
|
|
601
|
+
...C,enum:["auto","choice","review","self","fact","none"]},check:{...U,required:!1},fact:{...U,required:!1},files:{...V(
|
|
602
|
+
C,8),required:!1},question:{...C,required:!1,maxLength:2e3},options:{...V(C,8),required:!1},answer:{...V({type:"integer",
|
|
603
|
+
required:!0,min:0,max:7},8),required:!1},rubric:{...C,required:!1,maxLength:600},evidence:{...V({...C,enum:["changes","c\
|
|
604
|
+
onversation"]},2),required:!1}})}}),Hp={...Vp,notes:{...C,required:!1},steps:V(fv,32)},hv=L({schemaVersion:{type:"intege\
|
|
605
|
+
r",required:!0,enum:[2]},...Hp}),gv=L({schemaVersion:{type:"integer",required:!0,enum:[3]},...Hp,stage:{...C,enum:["stud\
|
|
606
|
+
io","project"]}}),wv=new Map([[1,zp],[2,hv],[3,gv]]),Oe=e=>e?.schemaVersion===2||e?.schemaVersion===3;uo=L({schemaVersion:co,
|
|
607
|
+
topicId:U,domainId:U,title:C,status:{...C,enum:["preview","released"]},outline:C,prerequisites:V(L({topicId:U}),24),lessons:V(
|
|
608
|
+
L({code:U,descriptor:C,status:{...C,enum:["draft","published"]},required:{type:"boolean",required:!0}}),64),places:{...V(
|
|
609
|
+
U,64),required:!1},activities:{...V(U,64),required:!1},facts:{...V(U,64),required:!1}}),po=L({schemaVersion:co,courseId:U,
|
|
610
|
+
title:C,release:C,status:{...C,enum:["preview","released"]},topics:V(L({topicId:U,release:C}),32),orientation:{...U,required:!1}}),
|
|
611
|
+
qp=L({schemaVersion:co,id:U,title:C,svg:C,controller:C,assets:{...V(C,32),required:!1},initialState:U,states:V(U,32),description:{
|
|
612
|
+
...C,maxLength:2e3},commands:V(L({name:U,parameters:V(L({name:U,required:{type:"boolean",required:!0},maxLength:{type:"i\
|
|
613
|
+
nteger",required:!0,min:1,max:256}}),8),completionState:U,description:{...C,maxLength:2e3}}),32)})});function se(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function Tv(e){if(!z(e)||!Ge.
|
|
614
614
|
test(e.id||""))throw se("A place needs a lowercase id.");let t=`Place ${e.id}`;if(!Jp(e.label))throw se(`${t} needs a la\
|
|
615
|
-
bel.`);if(!
|
|
615
|
+
bel.`);if(!yv.has(e.scope))throw se(`${t} scope is studio or project.`);let r=e.who??"everyone";if(!bv.has(r))throw se(`${t}\
|
|
616
616
|
who is everyone or owner.`);let n=e.open??null;if(n!==null){let i=Object.keys(n||{}).sort().join(",");if(!(i==="pane"||
|
|
617
617
|
i==="databaseView,pane"?e.scope==="project"&&Ge.test(n.pane):i==="route"?e.scope==="studio"&&typeof n.route=="string"&&/^\/app(?:\/[a-z0-9-]+)*$/u.
|
|
618
618
|
test(n.route):i==="learning"&&n.learning===!0))throw se(`${t} opens a project pane, a studio /app route, Courses, or not\
|
|
@@ -622,18 +622,18 @@ pane,...n.databaseView?{databaseView:n.databaseView}:{}}]:n?.route?[{route:n.rou
|
|
|
622
622
|
i)||!Object.keys(i).length))throw se(`${t} shown is a list of page focus matchers.`);if(e.event!==void 0&&!Ge.test(e.event))
|
|
623
623
|
throw se(`${t} event is a lowercase activity name.`);return Object.freeze({id:e.id,label:e.label,scope:e.scope,who:r,open:n&&
|
|
624
624
|
Object.freeze({...n}),steps:Object.freeze(e.steps.map(i=>H(i.id,i.label))),shown:Object.freeze(o.map(i=>Object.freeze({...i}))),
|
|
625
|
-
...e.event?{event:e.event}:{}})}function
|
|
625
|
+
...e.event?{event:e.event}:{}})}function vv(e){if(!z(e)||!Ge.test(e.id||""))throw se("An activity needs a lowercase id.");
|
|
626
626
|
if(!Ge.test(e.event||""))throw se(`Activity ${e.id} needs its page activity event.`);if(e.place!==void 0&&!Ge.test(e.place))
|
|
627
627
|
throw se(`Activity ${e.id} place is a place id.`);return Object.freeze({id:e.id,event:e.event,...e.place?{place:e.place}:
|
|
628
|
-
{}})}function
|
|
629
|
-
stringify(h)===JSON.stringify(
|
|
628
|
+
{}})}function ya(){return!1}function Ea({places:e=Ev,activities:t=_v,facts:r=Sv}={}){let n=new Map,o=new Map,i=new Set,s=(h,w)=>JSON.
|
|
629
|
+
stringify(h)===JSON.stringify(w);function a({places:h=[],activities:w=[],facts:E=[]}={}){let _=h.map(Tv),m=w.map(vv);for(let g of[
|
|
630
630
|
..._,...m])if(n.has(g.id)&&!s(n.get(g.id),g)||o.has(g.id)&&!s(o.get(g.id),g)||_.includes(g)&&o.has(g.id)||m.includes(g)&&
|
|
631
631
|
n.has(g.id))throw se(`${g.id} is already registered with another meaning.`);for(let g of E)if(!Ge.test(g||""))throw se("\
|
|
632
632
|
A fact needs a lowercase id.");for(let g of _)n.set(g.id,g);for(let g of m)o.set(g.id,g);for(let g of E)i.add(g)}a({places:e,
|
|
633
633
|
activities:t,facts:r});function c(h){return n.get(h)||null}function l(h){return o.get(h)||null}function u(h){return i.has(
|
|
634
634
|
h)}function p(){return[...n.values()]}function f(){return new Set([...[...o.values()].map(h=>h.event),...[...n.values()].
|
|
635
|
-
filter(h=>h.event).map(h=>h.event)])}return Object.freeze({register:a,place:c,activity:l,hasFact:u,places:p,events:f,declared:
|
|
636
|
-
declaredPlace:
|
|
635
|
+
filter(h=>h.event).map(h=>h.event)])}return Object.freeze({register:a,place:c,activity:l,hasFact:u,places:p,events:f,declared:ya,
|
|
636
|
+
declaredPlace:ya,declaredActivity:ya})}function mo({places:e=[],activities:t=[],facts:r=[]}={}){let n=Ea(),o=new Set(n.places().
|
|
637
637
|
map(p=>p.id));for(let p of[...e,...t,...r])if(!Ge.test(p||""))throw se(`Declared name ${p} is not a lowercase id.`);let i=new Set(
|
|
638
638
|
e.filter(p=>!o.has(p))),s=new Set(t.filter(p=>!n.activity(p)));function a(p){return i.has(p)}function c(p){return s.has(
|
|
639
639
|
p)}function l(p){return a(p)||c(p)}function u(p){return n.hasFact(p)||r.includes(p)}return Object.freeze({register:n.register,
|
|
@@ -645,20 +645,20 @@ highlight??!0;if(typeof i!="boolean"||typeof s!="boolean")throw Qe("navigate and
|
|
|
645
645
|
NG_GUIDE_FLAGS_INVALID");if(!i&&!s)throw Qe("Point at the place (highlight) or open it (navigate); this request does nei\
|
|
646
646
|
ther.","VIBE64_TRAINING_GUIDE_ACTION_MISSING");if(i&&o==="dashboard")throw Qe("Dashboard has no single view to open. Poi\
|
|
647
647
|
nt at it, or open one Dashboard section such as files or database-erd.","VIBE64_TRAINING_GUIDE_DASHBOARD_UNOPENABLE");if(i&&
|
|
648
|
-
r&&!
|
|
648
|
+
r&&!Iv(r))throw Qe(`${r.label} has no view to open; point at it instead.`,"VIBE64_TRAINING_GUIDE_PLACE_UNOPENABLE",{place:r.
|
|
649
649
|
label});let a={target:o,navigate:i,highlight:s};if(e.filePath!==void 0){if(o!=="files")throw Qe("filePath is only for th\
|
|
650
650
|
e files place.","VIBE64_TRAINING_GUIDE_FILE_PATH_MISPLACED");if(typeof e.filePath!="string"||!_a.test(e.filePath))throw Qe(
|
|
651
651
|
"Use a relative practice project file path without '..'.","VIBE64_TRAINING_GUIDE_FILE_PATH_INVALID");a.filePath=e.filePath}
|
|
652
652
|
if(e.caption!==void 0){if(typeof e.caption!="string"||!e.caption.trim()||e.caption.length>ba)throw Qe(`Use a caption of \
|
|
653
653
|
1 to ${ba} characters.`,"VIBE64_TRAINING_GUIDE_CAPTION_INVALID",{limit:ba});a.caption=e.caption.trim()}return a}function Xp(e,t={},r=bt){
|
|
654
654
|
let n=r.place(e);return n?.shown.length?n.shown.some(o=>Object.entries(o).every(([i,s])=>i==="route"?typeof t.route=="st\
|
|
655
|
-
ring"&&(t.route===s||t.route.startsWith(`${s}/`)):t[i]===s)):null}function
|
|
655
|
+
ring"&&(t.route===s||t.route.startsWith(`${s}/`)):t[i]===s)):null}function Ov(e,t=bt){let r=new Set,n=new Set,o=new Set;
|
|
656
656
|
for(let i of Array.isArray(e?.beats)?e.beats:[]){if(i.kind==="check")continue;let s=t.activity(i.target);s||t.declaredActivity(
|
|
657
657
|
i.target)?(n.add(i.target),s?.place&&r.add(s.place)):r.add(i.target)}return e?.guide?.target&&r.add(e.guide.target),e?.check?.
|
|
658
|
-
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Ge,
|
|
659
|
-
bt,_a,ba,
|
|
658
|
+
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Ge,yv,bv,H,Wp,Be,Yp,wa,Ev,_v,Sv,Jp,
|
|
659
|
+
bt,_a,ba,Iv,nU,fo=d(()=>{Vn();F();Ge=/^[a-z][a-z0-9-]{0,63}$/u,yv=new Set(["studio","project"]),bv=new Set(["everyone","\
|
|
660
660
|
owner"]),H=(e,t)=>Object.freeze({id:e,label:t}),Wp=H("preview","Preview"),Be=H("dashboard","Dashboard"),Yp=H("database",
|
|
661
|
-
"Database"),
|
|
661
|
+
"Database"),wa=H("account-menu","Account menu"),Ev=[{id:"preview",label:"Preview",scope:"project",open:{pane:"preview"},
|
|
662
662
|
steps:[Wp]},{id:"dashboard",label:"Dashboard",scope:"project",open:null,steps:[Be]},{id:"database-erd",label:"ERD",scope:"\
|
|
663
663
|
project",open:{pane:"database",databaseView:"erd"},steps:[Be,Yp,H("database-erd","ERD")]},{id:"database-data",label:"Dat\
|
|
664
664
|
a",scope:"project",open:{pane:"database",databaseView:"data"},steps:[Be,Yp,H("database-data","Data")]},{id:"files",label:"\
|
|
@@ -675,50 +675,50 @@ steps:[H("learning","Learning")]},{id:"lesson",label:"Lesson",scope:"studio",ope
|
|
|
675
675
|
"lesson","Lesson")]},{id:"lesson-bar",label:"Lesson step bar",scope:"studio",open:null,steps:[H("lesson-bar","Lesson ste\
|
|
676
676
|
p bar")]},{id:"courses",label:"Courses",scope:"studio",open:null,shown:[{learningOpen:!0}],steps:[H("courses","Courses")]},
|
|
677
677
|
{id:"colleague",label:"Colleague",scope:"studio",open:null,event:"colleague-opened",steps:[H("colleague","Colleague")]},
|
|
678
|
-
{id:"account-menu",label:"Account menu",scope:"studio",open:null,steps:[
|
|
679
|
-
ngs",scope:"studio",open:null,steps:[
|
|
680
|
-
studio",open:null,steps:[
|
|
678
|
+
{id:"account-menu",label:"Account menu",scope:"studio",open:null,steps:[wa]},{id:"account-settings",label:"Account setti\
|
|
679
|
+
ngs",scope:"studio",open:null,steps:[wa,H("account-settings","Account settings")]},{id:"ai-setup",label:"AI setup",scope:"\
|
|
680
|
+
studio",open:null,steps:[wa,H("ai-setup","AI setup")]}],_v=[{id:"send-message",event:"message-sent",place:"chat"},{id:"a\
|
|
681
681
|
gent-finished",event:"agent-finished"},{id:"file-opened",event:"file-opened",place:"files"},{id:"app-pressed",event:"app\
|
|
682
|
-
-pressed",place:"preview"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],
|
|
682
|
+
-pressed",place:"preview"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],Sv=["ai-ready"];Jp=
|
|
683
683
|
e=>typeof e=="string"&&e.trim().length>0&&e.length<=64;bt=Ea({facts:[]});_a=/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\u0000-\u001f\\]{1,512}$/u,
|
|
684
|
-
ba=256;
|
|
684
|
+
ba=256;Iv=e=>!!e?.open;nU=Object.freeze({createLearningVocabulary:Ea,lessonStepNeeds:Ov})});function ae(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_BEATS_INVALID"})}function $v(e,t,r){let n=Pv.exec(
|
|
685
685
|
e);if(!n)throw ae(`beat ${t} must read "<show|do|check> <target>: <text>".`);let[,o,i,s,a=""]=n,c=`beat ${t} (${o} ${i})`;
|
|
686
686
|
if(o==="check"&&i==="review"){if(a.trim()||s!==void 0)throw ae(`${c} takes no text: the bar shows the step's check.rubri\
|
|
687
687
|
c.`);return{kind:o,target:i,text:""}}if(!a.trim())throw ae(`${c} needs its text after the colon.`);let l={kind:o,target:i,
|
|
688
688
|
text:a.trim()};if(s!==void 0&&!(o==="do"&&i==="file-opened"))throw ae(`${c} takes no argument; only do file-opened names\
|
|
689
|
-
a path.`);if(o==="show"&&!
|
|
689
|
+
a path.`);if(o==="show"&&!kv(i,r))throw ae(`${c} names an unknown place.`);if(o==="do"&&!Nv(i,r))throw ae(`${c} names n\
|
|
690
690
|
othing the learner can do or be at.`);if(o==="check"&&!Sa[i])throw ae(`${c} must be check auto, review, done or fact.`);
|
|
691
691
|
if(s!==void 0){if(!_a.test(s))throw ae(`${c} needs a relative practice project file path without '..'.`);l.path=s}let u=i===
|
|
692
|
-
"send-message"?
|
|
693
|
-
...l.text.matchAll(
|
|
694
|
-
ed prompt of at most ${Zp} characters.`);l.prompt=p[0]}return l}function ho(e,t=bt){let r=String(e??""),n=
|
|
692
|
+
"send-message"?xv:Av;if(l.text.length>u)throw ae(`${c} text is longer than ${u} characters.`);if(i==="send-message"){let p=[
|
|
693
|
+
...l.text.matchAll(Cv)].map(f=>f[1].trim());if(p.length!==1||!p[0]||p[0].length>Zp)throw ae(`${c} needs exactly one quot\
|
|
694
|
+
ed prompt of at most ${Zp} characters.`);l.prompt=p[0]}return l}function ho(e,t=bt){let r=String(e??""),n=Rv.exec(r);if(!n)
|
|
695
695
|
return{body:r,beats:null};let o=r.slice(n.index+n[0].length),i=/^```[ \t]*$/mu.exec(o);if(!i)throw ae("the beats block i\
|
|
696
696
|
s not closed with ```.");if(o.slice(i.index+i[0].length).trim())throw ae("the beats block must end the step text.");let s=o.
|
|
697
697
|
slice(0,i.index).split(`
|
|
698
698
|
`).map(l=>l.trim()).filter(Boolean);if(!s.length||s.length>Qp)throw ae(`a beats block holds 1 to ${Qp} beats.`);let a=s.
|
|
699
|
-
map((l,u)=>$
|
|
699
|
+
map((l,u)=>$v(l,u+1,t)),c=a.filter(l=>l.kind==="check");if(c.length>1||c.length&&a.at(-1).kind!=="check")throw ae("a ste\
|
|
700
700
|
p has at most one check beat, and it is the last.");return{body:r.slice(0,n.index).replace(/\s+$/u,`
|
|
701
|
-
`),beats:a}}function
|
|
702
|
-
function em(e,t=bt){if(e.kind==="check")return e.target==="auto"||e.target==="review";let r=t.place(
|
|
703
|
-
scope==="project":!t.declared(e.target)}var Qp,
|
|
704
|
-
freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),
|
|
705
|
-
|
|
706
|
-
place(e)||t.declaredPlace(e))});import{createHash as
|
|
701
|
+
`),beats:a}}function Lv(e,t=bt){if(!e||e.kind==="check")return"";let r=t.activity(e.target);return r?r.place||"":e.target}
|
|
702
|
+
function em(e,t=bt){if(e.kind==="check")return e.target==="auto"||e.target==="review";let r=t.place(Lv(e,t));return r?r.
|
|
703
|
+
scope==="project":!t.declared(e.target)}var Qp,Av,Zp,xv,Sa,Rv,Pv,Cv,Nv,kv,Ta=d(()=>{fo();Qp=8,Av=160,Zp=500,xv=600,Sa=Object.
|
|
704
|
+
freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),Rv=/^```beats[ \t]*$/mu,Pv=/^(show|do|check)[ \t]+([a-z][a-z-]*)(?:[ \t]+([^:]+?))?[ \t]*(?::[ \t]*(.*))?$/u,
|
|
705
|
+
Cv=/["“]([^"“”]+)["”]/gu;Nv=(e,t)=>!!(t.activity(e)||t.place(e)?.event||Xp(e,{},t)!==null||t.declared(e)),kv=(e,t)=>!!(t.
|
|
706
|
+
place(e)||t.declaredPlace(e))});import{createHash as Mv}from"node:crypto";function Q(e){return Mv("sha256").update(e).digest("hex")}var Xt=d(()=>{});import{lstat as jv,readFile as Dv,readdir as Uv,realpath as tm}from"node:fs/promises";import ue from"node:path";function Ae(e,t,r){
|
|
707
707
|
let n=new Set;for(let o of e){let i=t?o[t]:o;if(!go(i)||n.has(i))throw new Error(`${r}: invalid or duplicate ID ${i}.`);
|
|
708
708
|
n.add(i)}return n}function D(e){return Array.isArray(e)?`[${e.map(D).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(
|
|
709
709
|
e).sort().map(t=>`${JSON.stringify(t)}:${D(e[t])}`).join(",")}}`:JSON.stringify(e)}function nm(e,t){let r=e.get(t.path);
|
|
710
710
|
if(r&&(r.sha256!==t.sha256||r.bytes!==t.bytes))throw new Error(`Source changed between lesson snapshots: ${t.path}. Vali\
|
|
711
711
|
date and retry.`);e.set(t.path,t)}function Et(e){let t=new Map;for(let r of e)for(let n of r.files)nm(t,n);return[...t.values()]}
|
|
712
|
-
async function
|
|
712
|
+
async function Bv(e){let t=await tm(e);async function r(i,s=t){if(typeof i!="string"||!i||i.includes("\\")||ue.isAbsolute(
|
|
713
713
|
i))throw new Error(`Invalid topic-relative path: ${i}.`);let a=ue.resolve(s,i),c=ue.relative(t,a);if(c===".."||c.startsWith(
|
|
714
714
|
`..${ue.sep}`)||ue.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await tm(a)!==a)throw new Error(`Symlin\
|
|
715
715
|
k content is not supported: ${i}.`);return{filename:a,relative:c.split(ue.sep).join("/")}}async function n(i,s=t){let a=await r(
|
|
716
|
-
i,s),c=await
|
|
717
|
-
relative}.`);return{...a,bytes:await
|
|
718
|
-
a.bytes.toString("utf8"))}}return Object.freeze({root:t,resolve:r,read:n,json:o})}function
|
|
716
|
+
i,s),c=await jv(a.filename);if(!c.isFile()||c.size>1024*1024)throw new Error(`Expected a regular file of at most 1 MiB: ${a.
|
|
717
|
+
relative}.`);return{...a,bytes:await Dv(a.filename)}}async function o(i,s=t){let a=await n(i,s);return{...a,value:JSON.parse(
|
|
718
|
+
a.bytes.toString("utf8"))}}return Object.freeze({root:t,resolve:r,read:n,json:o})}function Gv(e){let t=new Map(e.map(i=>[
|
|
719
719
|
i.code,i])),r=new Set,n=new Set;function o(i){if(n.has(i))throw new Error(`Prerequisite cycle at ${i}.`);if(r.has(i))return;
|
|
720
720
|
let s=t.get(i);if(!s)throw new Error(`Unknown prerequisite ${i}.`);n.add(i);for(let a of s.prerequisites)o(a.code);n.delete(
|
|
721
|
-
i),r.add(i)}for(let i of e)o(i.code)}function
|
|
721
|
+
i),r.add(i)}for(let i of e)o(i.code)}function Fv(e,t,r,n){r(t);let o=t.bytes.toString("utf8");Ae(e.assessments,"id","Ass\
|
|
722
722
|
essments");for(let i of e.assessments){let[s,a,c]=i.rubric.split("#");if(s!==e.document||!a||c||!new RegExp(`^<a id="${i.
|
|
723
723
|
id}"></a>$`,"mu").test(o)||a!==i.id)throw new Error(`Missing explicit rubric anchor for ${i.id}.`);if(i.kind==="practica\
|
|
724
724
|
l"&&!i.evidence)throw new Error(`Practical assessment ${i.id} needs an evidence producer.`);if(i.kind==="answer"&&i.evidence)
|
|
@@ -729,118 +729,118 @@ check&&!["exercise","code"].includes(i.evidence.producer))throw new Error(`Only
|
|
|
729
729
|
d check: ${i.id}.`);let l=(e.checks||[]).find(u=>u.id===i.evidence?.check)?.kind||"response";if(i.evidence?.producer==="\
|
|
730
730
|
code"){if(!e.exercise||!i.evidence.check||l!=="code"||!i.evidence.files?.length)throw new Error(`Code assessment ${i.id}\
|
|
731
731
|
needs its declared exercise, files and a code check.`)}else if(i.evidence?.files||i.evidence?.check&&l==="code")throw new Error(
|
|
732
|
-
`Only code evidence names edited files or runs a code check: ${i.id}.`)}}function
|
|
732
|
+
`Only code evidence names edited files or runs a code check: ${i.id}.`)}}function Vv(e,t,r,n,o,i){let s=a=>{throw new Error(
|
|
733
733
|
`Lesson ${n}: ${a}`)};e.schemaVersion===3&&e.stage==="project"&&!e.exercise&&s("a project lesson needs its exercise (a p\
|
|
734
734
|
ractice project)."),e.steps.length||s("needs at least one step."),Ae(e.steps,"id","Steps"),e.steps.some(a=>a.required)||
|
|
735
735
|
s("needs a required step.");for(let a of e.steps){let c=`step ${a.id}`;if(a.visual){let h=t.get(a.visual.id);h||s(`${c} \
|
|
736
|
-
shows undeclared visual ${a.visual.id}.`);for(let
|
|
737
|
-
`${c} plays undeclared command ${
|
|
738
|
-
nd ${
|
|
739
|
-
`${c} command ${
|
|
740
|
-
name} parameter ${m} must be a string of at most ${
|
|
741
|
-
hasOwn(_,m.name)&&s(`${c} command ${
|
|
742
|
-
|
|
736
|
+
shows undeclared visual ${a.visual.id}.`);for(let w of a.visual.play||[]){let E=h.commands.find(m=>m.name===w.name);E||s(
|
|
737
|
+
`${c} plays undeclared command ${w.name}.`);let _=w.parameters;(!_||typeof _!="object"||Array.isArray(_))&&s(`${c} comma\
|
|
738
|
+
nd ${w.name} needs a parameters object.`);for(let[m,g]of Object.entries(_)){let y=E.parameters.find(S=>S.name===m);y||s(
|
|
739
|
+
`${c} command ${w.name} has undeclared parameter ${m}.`),(typeof g!="string"||g.length>y.maxLength)&&s(`${c} command ${w.
|
|
740
|
+
name} parameter ${m} must be a string of at most ${y.maxLength} characters.`)}for(let m of E.parameters)m.required&&!Object.
|
|
741
|
+
hasOwn(_,m.name)&&s(`${c} command ${w.name} needs parameter ${m.name}.`)}}if(a.guide){let{caption:h,...w}=a.guide;try{Kp(
|
|
742
|
+
w,i)}catch(E){s(`${c} guide: ${E.message}`)}i.place(a.guide.target)?.scope==="project"&&!e.exercise&&s(`${c} guide ${a.guide.
|
|
743
743
|
target} needs the lesson's exercise (a practice project).`)}let l=null;try{({beats:l}=ho(o.get(a.body),i))}catch(h){s(`${c}\
|
|
744
744
|
beats: ${h.message}`)}if(l){a.guide&&s(`${c} has both beats and a guide; its beats replace the guide.`);let h=l.find(E=>E.
|
|
745
745
|
kind==="check");h&&Sa[h.target]!==a.check.kind&&s(`${c} beat check ${h.target} does not match its ${a.check.kind} check.`);
|
|
746
|
-
let
|
|
746
|
+
let w=l.find(E=>em(E,i));w&&!e.exercise&&s(`${c} beat ${w.kind} ${w.target} needs the lesson's exercise (a practice proj\
|
|
747
747
|
ect).`)}let u=a.check,p={auto:["check","files"],choice:["question","options","answer"],review:["rubric","evidence"],fact:[
|
|
748
748
|
"fact"],self:[],none:[]}[u.kind],f=Object.keys(u).filter(h=>h!=="kind"&&!p.includes(h));if(f.length&&s(`${c} ${u.kind} c\
|
|
749
749
|
heck cannot declare ${f.join(", ")}.`),u.kind==="none"&&a.required&&s(`${c} has no check and cannot be required.`),u.kind===
|
|
750
750
|
"fact"&&(e.schemaVersion!==3&&s(`${c} fact check needs lesson format 3.`),(!u.fact||!i.hasFact(u.fact))&&s(`${c} checks \
|
|
751
751
|
an unknown fact; declare a host's fact in the topic's facts.`)),u.kind==="auto"){(!u.check||!r.has(u.check))&&s(`${c} na\
|
|
752
752
|
mes an unknown check.`),e.exercise||s(`${c} runs a declared check and needs the lesson's exercise.`);let h=e.checks.find(
|
|
753
|
-
E=>E.id===u.check),
|
|
753
|
+
E=>E.id===u.check),w=u.files||[];(h.kind==="code"?w.length<1||w.length>8:w.length)&&s(`${c} ${h.kind==="code"?"code chec\
|
|
754
754
|
k needs 1-8 exercise files":"names files, but only a code check edits files"}.`)}if(u.kind==="review"){u.rubric?.trim()||
|
|
755
755
|
s(`${c} review needs its rubric.`),e.exercise||s(`${c} reviews practice work and needs the lesson's exercise.`);let h=u.
|
|
756
756
|
evidence||["changes"];(h[0]!=="changes"||h.length>2||h.length===2&&h[1]!=="conversation")&&s(`${c} review evidence is ["\
|
|
757
|
-
changes"] or ["changes", "conversation"].`)}if(u.kind==="choice"){let{question:h,options:
|
|
758
|
-
choice needs question, options and answer.`),(
|
|
759
|
-
new Set(E).size!==E.length||E.some(_=>_>=
|
|
760
|
-
tions.`)}}}async function
|
|
757
|
+
changes"] or ["changes", "conversation"].`)}if(u.kind==="choice"){let{question:h,options:w,answer:E}=u;(!h||!w||!E)&&s(`${c}\
|
|
758
|
+
choice needs question, options and answer.`),(w.length<2||w.length>8)&&s(`${c} choice needs 2-8 options.`),(!E.length||
|
|
759
|
+
new Set(E).size!==E.length||E.some(_=>_>=w.length))&&s(`${c} choice answer must list unique option indexes within its op\
|
|
760
|
+
tions.`)}}}async function zv(e,t,{authoring:r,installed:n,vocabulary:o}){let i=await e.json(t.descriptor),s=lo(i.value,t.
|
|
761
761
|
code);if(s.code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);if(r&&s.schemaVersion!==3)throw new Error(`\
|
|
762
762
|
Lesson ${t.code} uses retired lesson format ${s.schemaVersion}. Author it in format 3 with steps and its stage.`);let a=ue.
|
|
763
763
|
dirname(i.filename),c=new Map;function l(m){if(nm(c,{path:m.relative,sha256:Q(m.bytes),bytes:m.bytes.length}),c.size>512||
|
|
764
|
-
[...c.values()].reduce((g,
|
|
764
|
+
[...c.values()].reduce((g,y)=>g+y.bytes,0)>32*1024*1024)throw new Error(`Lesson ${t.code} exceeds bundle limits.`)}l(i);
|
|
765
765
|
let u=new Set,p=new Map;Ae(s.prerequisites,"code","Lesson prerequisites");let f=Ae(s.checks||[],"id","Checks");for(let m of s.
|
|
766
|
-
checks||[]){l(await e.read(m.file,a));for(let g of m.assets||[])l(await e.read(g,a))}if(s.schemaVersion===1&&
|
|
766
|
+
checks||[]){l(await e.read(m.file,a));for(let g of m.assets||[])l(await e.read(g,a))}if(s.schemaVersion===1&&Fv(s,await e.
|
|
767
767
|
read(s.document,a),l,f),Oe(s))for(let m of[s.notes,...new Set(s.steps.map(g=>g.body))]){if(m===void 0)continue;let g=await e.
|
|
768
768
|
read(m,a);l(g),u.add(g.relative),p.set(m,g.bytes.toString("utf8"))}if(s.appRoutes&&!s.exercise)throw new Error(`Lesson ${t.
|
|
769
769
|
code} can declare app routes only with its exercise.`);let h=new Set;for(let m of s.appRoutes||[]){if(m.path!=="/"&&!m.path.
|
|
770
|
-
slice(1).split("/").every(
|
|
770
|
+
slice(1).split("/").every(y=>y===":id"||/^[A-Za-z0-9._~-]+$/u.test(y)))throw new Error(`Invalid app route path for ${t.code}\
|
|
771
771
|
: ${m.path}.`);let g=`${m.method} ${m.path}`;if(h.has(g))throw new Error(`Lesson ${t.code} has a duplicate app route: ${g}\
|
|
772
772
|
.`);h.add(g)}for(let m of s.checks||[])if(m.timeoutSeconds!==void 0&&m.kind!=="code")throw new Error(`Only a code check \
|
|
773
773
|
declares a timeout: ${m.id}.`);if(s.schemaVersion===1&&!s.assessments.some(m=>m.required))throw new Error(`Lesson ${t.code}\
|
|
774
|
-
needs a required assessment.`);Ae(s.visuals,"id","Visuals");let
|
|
775
|
-
descriptor,a),
|
|
776
|
-
"Visual states");if(!S.has(
|
|
777
|
-
"name","Visual commands");for(let b of
|
|
778
|
-
nchanged"&&!S.has(b.completionState))throw new Error(`Unknown completion state: ${b.name}.`);l(g),
|
|
779
|
-
dirname(g.filename);for(let b of[
|
|
774
|
+
needs a required assessment.`);Ae(s.visuals,"id","Visuals");let w=new Map;for(let m of s.visuals){let g=await e.json(m.
|
|
775
|
+
descriptor,a),y=he(qp,g.value,m.id);if(y.id!==m.id)throw new Error(`Visual ID mismatch: ${m.id}.`);let S=Ae(y.states,null,
|
|
776
|
+
"Visual states");if(!S.has(y.initialState))throw new Error(`Unknown initial visual state: ${y.initialState}.`);Ae(y.commands,
|
|
777
|
+
"name","Visual commands");for(let b of y.commands)if(Ae(b.parameters,"name","Command parameters"),b.completionState!=="u\
|
|
778
|
+
nchanged"&&!S.has(b.completionState))throw new Error(`Unknown completion state: ${b.name}.`);l(g),w.set(y.id,y);let v=ue.
|
|
779
|
+
dirname(g.filename);for(let b of[y.svg,y.controller,...y.assets||[]]){let T=await e.read(b,v);l(T),u.add(T.relative)}}if(s.
|
|
780
780
|
exercise){let m=s.exercise;if(m.reuse==="sequence"){if(!m.sequenceId||!m.sequenceMode)throw new Error(`Invalid exercise \
|
|
781
781
|
sequence for ${t.code}.`)}else if(m.sequenceId||m.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}.`);
|
|
782
|
-
if(m.sequenceId&&!go(m.sequenceId))throw new Error("Invalid exercise sequence ID.");let g=await e.resolve(m.source,a);async function
|
|
783
|
-
for(let b of(await
|
|
784
|
-
let
|
|
785
|
-
read(
|
|
786
|
-
id}`,
|
|
787
|
-
split("/");if(
|
|
788
|
-
relative}/${
|
|
789
|
-
throw new Error(`${
|
|
782
|
+
if(m.sequenceId&&!go(m.sequenceId))throw new Error("Invalid exercise sequence ID.");let g=await e.resolve(m.source,a);async function y(v){
|
|
783
|
+
for(let b of(await Uv(v,{withFileTypes:!0})).sort((T,O)=>T.name<O.name?-1:T.name>O.name?1:0)){if(rm.has(b.name))continue;
|
|
784
|
+
let T=ue.relative(e.root,ue.join(v,b.name)),O=await e.resolve(T);if(b.isDirectory())await y(O.filename);else{let I=await e.
|
|
785
|
+
read(T);l(I),u.add(I.relative)}}}await y(g.filename);let S=s.schemaVersion===1?s.assessments.map(v=>[`Code assessment ${v.
|
|
786
|
+
id}`,v.evidence?.files||[]]):s.steps.map(v=>[`Code step ${v.id}`,v.check.files||[]]);for(let[v,b]of S){for(let T of b){let O=T.
|
|
787
|
+
split("/");if(T.includes("\\")||ue.posix.isAbsolute(T)||O.some(I=>!I||I==="."||I===".."||rm.has(I))||!c.has(g.relative?`${g.
|
|
788
|
+
relative}/${T}`:T))throw new Error(`${v} names a file outside its bundled exercise: ${T}.`)}if(new Set(b).size!==b.length)
|
|
789
|
+
throw new Error(`${v} repeats a declared file.`)}}let E="";if(Oe(s))try{Vv(s,w,f,t.code,p,o)}catch(m){if(!n)throw m;E=m.
|
|
790
790
|
message}let _={schemaVersion:1,code:s.code,files:[...c.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0)};return{
|
|
791
791
|
lesson:s,manifest:_,hash:Q(D(_)),descriptorPath:i.relative,served:u,...E?{problem:E}:{}}}async function _t(e,t={}){let{authoring:r=!1,
|
|
792
|
-
installed:n=!1}=t,o=await
|
|
792
|
+
installed:n=!1}=t,o=await Bv(e),i=await o.json("package.json");if(!/^learn-[a-z0-9-]+$/u.test(i.value.name||"")||!/^\d+\.\d+\.\d+$/u.
|
|
793
793
|
test(i.value.version||""))throw new Error("Topic package needs a learn- name and an exact release version.");let s=he(uo,
|
|
794
794
|
i.value.vibe64Training,"Topic");if(!go(s.topicId)||!go(s.domainId))throw new Error("Invalid topic or domain ID.");let a=await o.
|
|
795
795
|
read(s.outline);if(Ae(s.lessons,"code","Lessons"),Ae(s.prerequisites,"topicId","Topic prerequisites"),!s.lessons.length)
|
|
796
|
-
throw new Error("A topic needs lessons.");if(s.status==="released"&&s.lessons.some(
|
|
797
|
-
throw new Error("A released topic contains required draft lessons.");let c=mo(s),l=[],u=new Set;for(let
|
|
798
|
-
let{served:E,..._}=await
|
|
799
|
-
required:
|
|
800
|
-
ptor cannot also be a step body, notes, visual or exercise file.`);
|
|
801
|
-
code:_}of E.lesson.prerequisites){let m=l.findIndex(g=>g.lesson.code===_);if(m>=
|
|
796
|
+
throw new Error("A topic needs lessons.");if(s.status==="released"&&s.lessons.some(w=>w.required&&w.status!=="published"))
|
|
797
|
+
throw new Error("A released topic contains required draft lessons.");let c=mo(s),l=[],u=new Set;for(let w of s.lessons){
|
|
798
|
+
let{served:E,..._}=await zv(o,w,{authoring:r,installed:n,vocabulary:c});for(let m of E)u.add(m);l.push({..._,status:w.status,
|
|
799
|
+
required:w.required})}for(let{descriptorPath:w,lesson:E}of l)if(Oe(E)&&u.has(w))throw new Error(`Lesson ${E.code} descri\
|
|
800
|
+
ptor cannot also be a step body, notes, visual or exercise file.`);Gv(l.map(w=>w.lesson));for(let[w,E]of l.entries())for(let{
|
|
801
|
+
code:_}of E.lesson.prerequisites){let m=l.findIndex(g=>g.lesson.code===_);if(m>=w)throw new Error(`Prerequisite ${_} mus\
|
|
802
802
|
t precede ${E.lesson.code}.`);if(E.status==="published"&&l[m].status!=="published")throw new Error(`Published lesson ${E.
|
|
803
|
-
lesson.code} requires draft ${_}.`)}let p=new Map;for(let{lesson:
|
|
804
|
-
"sequence")continue;let m=(await o.resolve(
|
|
805
|
-
sequenceId);if(
|
|
806
|
-
p.set(
|
|
807
|
-
`Invalid create/continue sequence: ${
|
|
808
|
-
h={schemaVersion:1,topic:s,release:i.value.version,files:f,lessons:l.map(({lesson:
|
|
809
|
-
code,hash:E,status:_,required:m}))};return Et([h,...l.map(
|
|
810
|
-
topicHash:Q(D(h))}}var rm,go,
|
|
811
|
-
test(e)});import{execFile as
|
|
812
|
-
import{promisify as
|
|
803
|
+
lesson.code} requires draft ${_}.`)}let p=new Map;for(let{lesson:w,descriptorPath:E,status:_}of l){if(w.exercise?.reuse!==
|
|
804
|
+
"sequence")continue;let m=(await o.resolve(w.exercise.source,ue.dirname(ue.join(o.root,E)))).relative,g=p.get(w.exercise.
|
|
805
|
+
sequenceId);if(w.exercise.sequenceMode==="create"){if(g)throw new Error(`Invalid create/continue sequence: ${w.code}.`);
|
|
806
|
+
p.set(w.exercise.sequenceId,{source:m,status:_})}else if(!g||g.source!==m||_==="published"&&g.status!=="published")throw new Error(
|
|
807
|
+
`Invalid create/continue sequence: ${w.code}.`)}let f=[i,a].map(w=>({path:w.relative,sha256:Q(w.bytes),bytes:w.bytes.length})),
|
|
808
|
+
h={schemaVersion:1,topic:s,release:i.value.version,files:f,lessons:l.map(({lesson:w,hash:E,status:_,required:m})=>({code:w.
|
|
809
|
+
code,hash:E,status:_,required:m}))};return Et([h,...l.map(w=>w.manifest)]),{topic:s,release:i.value.version,bundles:l,topicManifest:h,
|
|
810
|
+
topicHash:Q(D(h))}}var rm,go,Qt=d(()=>{Kt();fo();Ta();Xt();rm=new Set([".git","node_modules",".genesis"]),go=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.
|
|
811
|
+
test(e)});import{execFile as Hv}from"node:child_process";import{readFile as qv}from"node:fs/promises";import va from"node:os";import Wv from"node:path";
|
|
812
|
+
import{promisify as Yv}from"node:util";function im(e=""){let t=G(e);if(!t||t.includes("/")||t.includes("\\")||t.includes(
|
|
813
813
|
":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}function sm([
|
|
814
814
|
e,t,r,n,o,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(r))return null;let s=Number(t),a=Number(r);return!Number.isSafeInteger(
|
|
815
815
|
s)||!Number.isSafeInteger(a)?null:{displayName:String(n||"").split(",")[0],gid:a,home:String(o||""),shell:String(i||""),
|
|
816
816
|
uid:s,username:String(e||"")}}function Ia(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:sm([t[0],t[2],
|
|
817
|
-
t[3],t[4],t[5],t[6]])}function
|
|
817
|
+
t[3],t[4],t[5],t[6]])}function Kv(e=""){return String(e||"").split(/\r?\n[\t ]*\r?\n/u).map(t=>{let r={};for(let n of t.
|
|
818
818
|
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return sm([r.name,r.uid,r.gid,r.gecos,r.
|
|
819
819
|
dir,r.shell])}).filter(Boolean)}async function om(e,t,r){let n=await e(t,r,{encoding:"utf8"});return String((typeof n=="\
|
|
820
|
-
string"?n:n?.stdout)||"")}function Hr({homedir:e=
|
|
821
|
-
env.USER||process.env.LOGNAME),o=
|
|
820
|
+
string"?n:n?.stdout)||"")}function Hr({homedir:e=va.homedir,userInfo:t=va.userInfo}={}){let r=t(),n=G(r?.username||process.
|
|
821
|
+
env.USER||process.env.LOGNAME),o=Wv.resolve(String(r?.homedir||e()||""));return{displayName:String(r?.username||n),gid:Number.
|
|
822
822
|
isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:null,username:n}}
|
|
823
|
-
async function
|
|
823
|
+
async function wo(e="",{execFileFn:t=Jv,platform:r=process.platform,readFileFn:n=qv,userInfo:o=va.userInfo}={}){let i=im(
|
|
824
824
|
e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],
|
|
825
825
|
l=c.length===1?c[0][1].trim().split(/\s+/u):[];if(l[0]==="files"&&(l.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(l[1]))){let p=(await n(
|
|
826
826
|
"/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).map(Ia).find(f=>f?.username===i);if(p)return p}}let s;if(r==="darwi\
|
|
827
|
-
n"){let a=Hr({userInfo:o});if(a.username===i)return a;[s]=
|
|
827
|
+
n"){let a=Hr({userInfo:o});if(a.username===i)return a;[s]=Kv(await om(t,"dscacheutil",["-q","user","-a","name",i]))}else
|
|
828
828
|
s=Ia((await om(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);if(!s||s.username!==i){let a=new Error(`OS user was not fou\
|
|
829
|
-
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var
|
|
829
|
+
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var Jv,SU,yo=d(()=>{F();Jv=Yv(Hv);SU=Object.freeze({parsePasswdLine:Ia})});var am=d(()=>{yo();F()});import bo from"node:path";function P(e=""){return String(e??"").trim()}function Oa(e=null){let t=Number(e);return Number.
|
|
830
830
|
isSafeInteger(t)&&t>=0?t:null}function N(e=""){let t=P(e);return t?bo.resolve(t):""}function Ze(e="",t=""){let r=N(e),n=N(
|
|
831
831
|
t);if(!r||!n)return!1;let o=bo.relative(r,n);return o!==".."&&!o.startsWith(`..${bo.sep}`)&&!bo.isAbsolute(o)}function X(e={}){
|
|
832
832
|
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ge(e={}){return Object.fromEntries(Object.entries(X(e)).map(
|
|
833
833
|
([t,r])=>[P(t),String(r??"")]).filter(([t])=>!!t))}function St(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:
|
|
834
|
-
[e]){let o=P(n);!o||r.has(o)||(r.add(o),t.push(o))}return t}function
|
|
835
|
-
isFinite(t)?t:0}function
|
|
834
|
+
[e]){let o=P(n);!o||r.has(o)||(r.add(o),t.push(o))}return t}function Zt(e){let t=Date.parse(String(e||"").trim());return Number.
|
|
835
|
+
isFinite(t)?t:0}function Fe(...e){for(let t of e){let r=P(t);if(r)return r}return""}var W=d(()=>{});import Xv from"node:os";import Aa from"node:path";function xa(e={}){let t=P(e.username),r=N(e.home||(t?`/home/${t}`:Xv.homedir()));
|
|
836
836
|
return{displayName:P(e.displayName||t),gid:Oa(e.gid),home:r,shell:P(e.shell),uid:Oa(e.uid),username:t}}function Ra(){return xa(
|
|
837
|
-
Hr())}async function Pa(e="",t={}){return xa(await
|
|
837
|
+
Hr())}async function Pa(e="",t={}){return xa(await wo(e,t))}function qr(e={},t={}){let r=xa(e);return{...t,HOME:r.home,LOGNAME:r.
|
|
838
838
|
username,USER:r.username,XDG_CACHE_HOME:Aa.join(r.home,".cache"),XDG_CONFIG_HOME:Aa.join(r.home,".config"),XDG_DATA_HOME:Aa.
|
|
839
839
|
join(r.home,".local","share")}}function cm(){return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.
|
|
840
|
-
getuid=="function"?process.getuid():null}}var
|
|
841
|
-
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var
|
|
842
|
-
`${t} must be a string or a file URL: ${r}.`);return r},
|
|
843
|
-
e)===String.prototype,Na=e=>e instanceof URL?
|
|
840
|
+
getuid=="function"?process.getuid():null}}var er=d(()=>{yo();W()});function Y(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||
|
|
841
|
+
Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var Ve=d(()=>{});import{fileURLToPath as Qv}from"node:url";var tr,Zv,Ca,Na,rr=d(()=>{tr=(e,t)=>{let r=Na(Zv(e));if(typeof r!="string")throw new TypeError(
|
|
842
|
+
`${t} must be a string or a file URL: ${r}.`);return r},Zv=e=>Ca(e)?e.toString():e,Ca=e=>typeof e!="string"&&e&&Object.getPrototypeOf(
|
|
843
|
+
e)===String.prototype,Na=e=>e instanceof URL?Qv(e):e});var Eo,ka=d(()=>{Ve();rr();Eo=(e,t=[],r={})=>{let n=tr(e,"First argument"),[o,i]=Y(t)?[[],t]:[t,r];if(!Array.isArray(o))
|
|
844
844
|
throw new TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(c=>typeof c==
|
|
845
845
|
"object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${o}`);let s=o.map(String),a=s.find(
|
|
846
846
|
c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Y(i))throw new TypeError(
|
|
@@ -850,8 +850,8 @@ e.buffer,e.byteOffset,e.byteLength),tI=new TextEncoder,dm=e=>tI.encode(e),rI=new
|
|
|
850
850
|
e,t).join(""),nI=(e,t)=>{if(t==="utf8"&&e.every(i=>typeof i=="string"))return e;let r=new eI(t),n=e.map(i=>typeof i=="st\
|
|
851
851
|
ring"?dm(i):i).map(i=>r.write(i)),o=r.end();return o===""?n:[...n,o]},Wr=e=>e.length===1&&K(e[0])?e[0]:$a(oI(e)),oI=e=>e.
|
|
852
852
|
map(t=>typeof t=="string"?dm(t):t),$a=e=>{let t=new Uint8Array(iI(e)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t},
|
|
853
|
-
iI=e=>{let t=0;for(let r of e)t+=r.length;return t}});import{ChildProcess as sI}from"node:child_process";var gm,
|
|
854
|
-
e)&&Array.isArray(e.raw),
|
|
853
|
+
iI=e=>{let t=0;for(let r of e)t+=r.length;return t}});import{ChildProcess as sI}from"node:child_process";var gm,wm,aI,cI,mm,lI,fm,hm,uI,ym=d(()=>{Ve();de();gm=e=>Array.isArray(
|
|
854
|
+
e)&&Array.isArray(e.raw),wm=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=aI({templates:e,expressions:t,tokens:r,index:i,
|
|
855
855
|
template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},aI=({
|
|
856
856
|
templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backslash sequence:\
|
|
857
857
|
${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=cI(o,e.raw[n]),c=fm(r,i,s);if(n===t.length)return c;
|
|
@@ -866,28 +866,28 @@ e))return uI(e);throw e instanceof sI||Object.prototype.toString.call(e)==="[obj
|
|
|
866
866
|
subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected \
|
|
867
867
|
"${t}" in template expression`)},uI=({stdout:e})=>{if(typeof e=="string")return e;if(K(e))return _o(e);throw e===void 0?
|
|
868
868
|
new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" o\
|
|
869
|
-
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)}});import La from"node:process";var Ee,So,
|
|
870
|
-
"stdout","stderr"],
|
|
871
|
-
...e};for(let r of Da)t[r]=Ma(e,r);return t},Ma=(e,t)=>{let r=Array.from({length:pI(e)+1}),n=mI(e[t],r,t);return
|
|
872
|
-
pI=({stdio:e})=>Array.isArray(e)?Math.max(e.length,
|
|
869
|
+
ption.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)}});import La from"node:process";var Ee,So,we,To,He=d(()=>{Ee=e=>So.includes(e),So=[La.stdin,La.stdout,La.stderr],we=["stdin",
|
|
870
|
+
"stdout","stderr"],To=e=>we[e]??`stdio[${e}]`});import{debuglog as dI}from"node:util";var Em,Ma,pI,mI,fI,hI,bm,gI,ja,wI,yI,bI,EI,Da,qe,We=d(()=>{Ve();He();Em=e=>{let t={
|
|
871
|
+
...e};for(let r of Da)t[r]=Ma(e,r);return t},Ma=(e,t)=>{let r=Array.from({length:pI(e)+1}),n=mI(e[t],r,t);return yI(n,t)},
|
|
872
|
+
pI=({stdio:e})=>Array.isArray(e)?Math.max(e.length,we.length):we.length,mI=(e,t,r)=>Y(e)?fI(e,t,r):t.fill(e),fI=(e,t,r)=>{
|
|
873
873
|
for(let n of Object.keys(e).sort(hI))for(let o of gI(n,r,t))t[o]=e[n];return t},hI=(e,t)=>bm(e)<bm(t)?1:-1,bm=e=>e==="st\
|
|
874
874
|
dout"||e==="stderr"?0:e==="all"?2:1,gI=(e,t,r)=>{if(e==="ipc")return[r.length-1];let n=ja(e);if(n===void 0||n===0)throw new TypeError(
|
|
875
875
|
`"${t}.${e}" is invalid.
|
|
876
876
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(n>=r.length)
|
|
877
877
|
throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
878
878
|
Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},ja=e=>{if(e==="all")return e;
|
|
879
|
-
if(
|
|
879
|
+
if(we.includes(e))return we.indexOf(e);let t=wI.exec(e);if(t!==null)return Number(t[1])},wI=/^fd(\d+)$/,yI=(e,t)=>e.map(
|
|
880
880
|
r=>r===void 0?EI[t]:r),bI=dI("execa").enabled?"full":"none",EI={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:bI,stripFinalNewline:!0},
|
|
881
|
-
Da=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],qe=(e,t)=>t==="ipc"?e.at(-1):e[t]});var
|
|
882
|
-
Ua(e,t)),_m=({verbose:e},t)=>{let r=Ua(e,t);return
|
|
883
|
-
t))??Io.findLast(t=>e.includes(t)),
|
|
884
|
-
xI,RI,PI,Oo=d(()=>{Sm=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>RI(
|
|
885
|
-
Yr=e=>
|
|
886
|
-
`).map(t=>
|
|
887
|
-
`),
|
|
881
|
+
Da=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],qe=(e,t)=>t==="ipc"?e.at(-1):e[t]});var nr,or,_m,Ua,_I,vo,Io,et=d(()=>{We();nr=({verbose:e},t)=>Ua(e,t)!=="none",or=({verbose:e},t)=>!["none","short"].includes(
|
|
882
|
+
Ua(e,t)),_m=({verbose:e},t)=>{let r=Ua(e,t);return vo(r)?r:void 0},Ua=(e,t)=>t===void 0?_I(e):qe(e,t),_I=e=>e.find(t=>vo(
|
|
883
|
+
t))??Io.findLast(t=>e.includes(t)),vo=e=>typeof e=="function",Io=["none","short","full"]});import{platform as SI}from"node:process";import{stripVTControlCharacters as TI}from"node:util";var Sm,Yr,Tm,vI,II,OI,AI,
|
|
884
|
+
xI,RI,PI,Oo=d(()=>{Sm=(e,t)=>{let r=[e,...t],n=r.join(" "),o=r.map(i=>RI(Tm(i))).join(" ");return{command:n,escapedCommand:o}},
|
|
885
|
+
Yr=e=>TI(e).split(`
|
|
886
|
+
`).map(t=>Tm(t)).join(`
|
|
887
|
+
`),Tm=e=>e.replaceAll(OI,t=>vI(t)),vI=e=>{let t=AI[e];if(t!==void 0)return t;let r=e.codePointAt(0),n=r.toString(16);return r<=
|
|
888
888
|
xI?`\\u${n.padStart(4,"0")}`:`\\U${n}`},II=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},
|
|
889
889
|
OI=II(),AI={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},xI=65535,RI=e=>PI.test(e)?e:SI==="win32"?`"${e.
|
|
890
|
-
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,PI=/^[\w./-]+$/});import
|
|
890
|
+
replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,PI=/^[\w./-]+$/});import vm from"node:process";function Ba(){let{env:e}=vm,{TERM:t,TERM_PROGRAM:r}=e;return vm.platform!=="win32"?t!=="lin\
|
|
891
891
|
ux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xter\
|
|
892
892
|
m-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}
|
|
893
893
|
var Im=d(()=>{});var Om,Am,CI,NI,kI,$I,LI,Ao,sB,xm=d(()=>{Im();Om={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\
|
|
@@ -942,14 +942,14 @@ nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},CI={tic
|
|
|
942
942
|
checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\
|
|
943
943
|
\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",
|
|
944
944
|
star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},NI={...Om,...Am},kI={...Om,
|
|
945
|
-
...CI},$I=Ba(),LI=$I?NI:kI,Ao=LI,sB=Object.entries(Am)});import MI from"node:tty";var jI,A,lB,Rm,uB,dB,pB,mB,fB,hB,gB,yB,
|
|
946
|
-
MB,jB,Pm,DB,Cm,UB,BB,GB,VB,
|
|
945
|
+
...CI},$I=Ba(),LI=$I?NI:kI,Ao=LI,sB=Object.entries(Am)});import MI from"node:tty";var jI,A,lB,Rm,uB,dB,pB,mB,fB,hB,gB,wB,yB,bB,EB,_B,SB,TB,vB,IB,OB,AB,xB,xo,RB,PB,CB,NB,kB,$B,LB,
|
|
946
|
+
MB,jB,Pm,DB,Cm,UB,BB,GB,FB,VB,zB,HB,qB,WB,YB,JB,KB,XB,QB,ZB,e4,t4,r4,n4,o4,i4,s4,a4,c4,l4,u4,d4,Ga=d(()=>{jI=MI?.WriteStream?.
|
|
947
947
|
prototype?.hasColors?.()??!1,A=(e,t)=>{if(!jI)return o=>o;let r=`\x1B[${e}m`,n=`\x1B[${t}m`;return o=>{let i=o+"",s=i.indexOf(
|
|
948
948
|
n);if(s===-1)return r+i+n;let a=r,c=0,u=(t===22?n:"")+r;for(;s!==-1;)a+=i.slice(c,s)+u,c=s+n.length,s=i.indexOf(n,c);return a+=
|
|
949
949
|
i.slice(c)+n,a}},lB=A(0,0),Rm=A(1,22),uB=A(2,22),dB=A(3,23),pB=A(4,24),mB=A("4:2",24),fB=A("4:3",24),hB=A("4:4",24),gB=A(
|
|
950
|
-
"4:5",24),
|
|
950
|
+
"4:5",24),wB=A(53,55),yB=A(7,27),bB=A(8,28),EB=A(9,29),_B=A(30,39),SB=A(31,39),TB=A(32,39),vB=A(33,39),IB=A(34,39),OB=A(
|
|
951
951
|
35,39),AB=A(36,39),xB=A(37,39),xo=A(90,39),RB=A(40,49),PB=A(41,49),CB=A(42,49),NB=A(43,49),kB=A(44,49),$B=A(45,49),LB=A(
|
|
952
|
-
46,49),MB=A(47,49),jB=A(100,49),Pm=A(91,39),DB=A(92,39),Cm=A(93,39),UB=A(94,39),BB=A(95,39),GB=A(96,39),
|
|
952
|
+
46,49),MB=A(47,49),jB=A(100,49),Pm=A(91,39),DB=A(92,39),Cm=A(93,39),UB=A(94,39),BB=A(95,39),GB=A(96,39),FB=A(97,39),VB=A(
|
|
953
953
|
101,49),zB=A(102,49),HB=A(103,49),qB=A(104,49),WB=A(105,49),YB=A(106,49),JB=A(107,49),KB=A("58;5;0",59),XB=A("58;5;1",59),
|
|
954
954
|
QB=A("58;5;2",59),ZB=A("58;5;3",59),e4=A("58;5;4",59),t4=A("58;5;5",59),r4=A("58;5;6",59),n4=A("58;5;7",59),o4=A("58;5;8",
|
|
955
955
|
59),i4=A("58;5;9",59),s4=A("58;5;10",59),a4=A("58;5;11",59),c4=A("58;5;12",59),l4=A("58;5;13",59),u4=A("58;5;14",59),d4=
|
|
@@ -958,20 +958,20 @@ options:{reject:s=!0}})=>{let a=UI(r),c=BI[e]({failed:i,reject:s,piped:n}),l=GI[
|
|
|
958
958
|
`[${o}]`)} ${l(c)} ${l(t)}`},UI=e=>`${Ro(e.getHours(),2)}:${Ro(e.getMinutes(),2)}:${Ro(e.getSeconds(),2)}.${Ro(e.getMilliseconds(),
|
|
959
959
|
3)}`,Ro=(e,t)=>String(e).padStart(t,"0"),km=({failed:e,reject:t})=>e?t?Ao.cross:Ao.warning:Ao.tick,BI={command:({piped:e})=>e?
|
|
960
960
|
"|":"$",output:()=>" ",ipc:()=>"*",error:km,duration:km},$m=e=>e,GI={command:()=>Rm,output:()=>$m,ipc:()=>$m,error:({reject:e})=>e?
|
|
961
|
-
Pm:Cm,duration:()=>xo}});var jm,VI,
|
|
962
|
-
o=>o!==void 0).map(o=>
|
|
963
|
-
|
|
961
|
+
Pm:Cm,duration:()=>xo}});var jm,FI,VI,Dm=d(()=>{et();jm=(e,t,r)=>{let n=_m(t,r);return e.map(({verboseLine:o,verboseObject:i})=>FI(o,i,n)).filter(
|
|
962
|
+
o=>o!==void 0).map(o=>VI(o)).join("")},FI=(e,t,r)=>{if(r===void 0)return e;let n=r(e,t);if(typeof n=="string")return n},
|
|
963
|
+
VI=e=>e.endsWith(`
|
|
964
964
|
`)?e:`${e}
|
|
965
|
-
`});import{inspect as zI}from"node:util";var xe,HI,qI,WI,Po,YI,
|
|
965
|
+
`});import{inspect as zI}from"node:util";var xe,HI,qI,WI,Po,YI,ir=d(()=>{Oo();Mm();Dm();xe=({type:e,verboseMessage:t,fdNumber:r,
|
|
966
966
|
verboseInfo:n,result:o})=>{let i=HI({type:e,result:o,verboseInfo:n}),s=qI(t,i),a=jm(s,n,r);a!==""&&console.warn(a.slice(
|
|
967
967
|
0,-1))},HI=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:o=!1,...i}}})=>({type:e,escapedCommand:r,
|
|
968
968
|
commandId:`${n}`,timestamp:new Date,piped:o,result:t,options:i}),qI=(e,t)=>e.split(`
|
|
969
969
|
`).map(r=>WI({...t,message:r})),WI=e=>({verboseLine:Lm(e),verboseObject:e}),Po=e=>{let t=typeof e=="string"?e:zI(e);return Yr(
|
|
970
|
-
t).replaceAll(" "," ".repeat(YI))},YI=2});var Um,Bm=d(()=>{et();
|
|
971
|
-
JI=e=>
|
|
970
|
+
t).replaceAll(" "," ".repeat(YI))},YI=2});var Um,Bm=d(()=>{et();ir();Um=(e,t)=>{nr(t)&&xe({type:"command",verboseMessage:e,verboseInfo:t})}});var Gm,JI,KI,XI,Fm=d(()=>{et();Gm=(e,t,r)=>{XI(e);let n=JI(e);return{verbose:e,escapedCommand:t,commandId:n,rawOptions:r}},
|
|
971
|
+
JI=e=>nr({verbose:e})?KI++:void 0,KI=0n,XI=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" optio\
|
|
972
972
|
n was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose:\
|
|
973
|
-
'short'".`);if(!Io.includes(t)&&!
|
|
974
|
-
must not be ${t}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as
|
|
973
|
+
'short'".`);if(!Io.includes(t)&&!vo(t)){let r=Io.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option \
|
|
974
|
+
must not be ${t}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as Vm}from"node:process";var Co,Fa,No=d(()=>{Co=()=>Vm.bigint(),Fa=e=>Number(Vm.bigint()-e)/1e6});var ko,Va=d(()=>{Bm();Fm();No();Oo();We();ko=(e,t,r)=>{let n=Co(),{command:o,escapedCommand:i}=Sm(e,t),s=Ma(r,"verbose"),
|
|
975
975
|
a=Gm(s,i,{...r});return Um(i,a),{command:o,escapedCommand:i,startTime:n,verboseInfo:a}}});var Ym=le((j4,Wm)=>{Wm.exports=qm;qm.sync=ZI;var zm=Ke("fs");function QI(e,t){var r=t.pathExt!==void 0?t.pathExt:process.
|
|
976
976
|
env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&
|
|
977
977
|
e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Hm(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:QI(
|
|
@@ -982,50 +982,50 @@ a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,p=r&l||r&c&&o=
|
|
|
982
982
|
za.sync=rO;function za(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError(
|
|
983
983
|
"callback not provided");return new Promise(function(n,o){za(e,t||{},function(i,s){i?o(i):n(s)})})}$o(e,t||{},function(n,o){
|
|
984
984
|
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function rO(e,t){try{return $o.sync(e,t||{})}catch(r){
|
|
985
|
-
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lf=le((G4,cf)=>{var
|
|
986
|
-
nO=
|
|
987
|
-
match(/\//)||
|
|
988
|
-
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=
|
|
985
|
+
if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var lf=le((G4,cf)=>{var sr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rf=Ke("path"),
|
|
986
|
+
nO=sr?";":":",nf=tf(),of=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),sf=(e,t)=>{let r=t.colon||nO,n=e.
|
|
987
|
+
match(/\//)||sr&&e.match(/\\/)?[""]:[...sr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=sr?t.pathExt||
|
|
988
|
+
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=sr?o.split(r):[""];return sr&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
989
989
|
""),{pathEnv:n,pathExt:i,pathExtExe:o}},af=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
990
990
|
pathExtExe:i}=sf(e,t),s=[],a=l=>new Promise((u,p)=>{if(l===n.length)return t.all&&s.length?u(s):p(of(e));let f=n[l],h=/^".*"$/.
|
|
991
|
-
test(f)?f.slice(1,-1):f,
|
|
992
|
-
if(p===o.length)return f(a(u+1));let
|
|
991
|
+
test(f)?f.slice(1,-1):f,w=rf.join(h,e),E=!h&&/^\.[\\\/]/.test(e)?e.slice(0,2)+w:w;u(c(E,l,0))}),c=(l,u,p)=>new Promise((f,h)=>{
|
|
992
|
+
if(p===o.length)return f(a(u+1));let w=o[p];nf(l+w,{pathExt:i},(E,_)=>{if(!E&&_)if(t.all)s.push(l+w);else return f(l+w);
|
|
993
993
|
return f(c(l,u,p+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},oO=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=sf(
|
|
994
994
|
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=rf.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
995
995
|
e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let f=u+n[p];try{if(nf.sync(f,{pathExt:o}))if(t.all)i.push(f);else return f}catch{}}}
|
|
996
|
-
if(t.all&&i.length)return i;if(t.nothrow)return null;throw of(e)};cf.exports=af;af.sync=oO});var df=le((
|
|
997
|
-
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Ha.exports=uf;Ha.exports.default=uf});var hf=le((
|
|
996
|
+
if(t.all&&i.length)return i;if(t.nothrow)return null;throw of(e)};cf.exports=af;af.sync=oO});var df=le((F4,Ha)=>{"use strict";var uf=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?
|
|
997
|
+
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Ha.exports=uf;Ha.exports.default=uf});var hf=le((V4,ff)=>{"use strict";var pf=Ke("path"),iO=lf(),sO=df();function mf(e,t){let r=e.options.env||process.env,n=process.
|
|
998
998
|
cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}
|
|
999
999
|
let s;try{s=iO.sync(e.command,{path:r[sO({env:r})],pathExt:t?pf.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return s&&
|
|
1000
1000
|
(s=pf.resolve(o?e.options.cwd:"",s)),s}function aO(e){return mf(e)||mf(e,!0)}ff.exports=aO});var gf=le((z4,Wa)=>{"use strict";var qa=/([()\][%!^"`<>&|;, *?])/g;function cO(e){return e=e.replace(qa,"^$1"),e}function lO(e,t){
|
|
1001
1001
|
return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(qa,
|
|
1002
|
-
"^$1"),t&&(e=e.replace(qa,"^$1")),e}Wa.exports.command=cO;Wa.exports.argument=lO});var
|
|
1002
|
+
"^$1"),t&&(e=e.replace(qa,"^$1")),e}Wa.exports.command=cO;Wa.exports.argument=lO});var yf=le((H4,wf)=>{"use strict";wf.exports=/^#!(.*)/});var Ef=le((q4,bf)=>{"use strict";var uO=yf();bf.exports=(e="")=>{let t=e.match(uO);if(!t)return null;let[r,n]=t[0].replace(
|
|
1003
1003
|
/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Sf=le((W4,_f)=>{"use strict";var Ya=Ke("fs"),dO=Ef();function pO(e){let r=Buffer.alloc(150),n;try{n=Ya.openSync(e,"r"),
|
|
1004
|
-
Ya.readSync(n,r,0,150,0),Ya.closeSync(n)}catch{}return dO(r.toString())}_f.exports=pO});var Of=le((Y4,If)=>{"use strict";var mO=Ke("path"),
|
|
1005
|
-
|
|
1006
|
-
e.file),e.command=t,
|
|
1007
|
-
test(t);e.command=mO.normalize(e.command),e.command=
|
|
1004
|
+
Ya.readSync(n,r,0,150,0),Ya.closeSync(n)}catch{}return dO(r.toString())}_f.exports=pO});var Of=le((Y4,If)=>{"use strict";var mO=Ke("path"),Tf=hf(),vf=gf(),fO=Sf(),hO=process.platform==="win32",gO=/\.(?:com|exe)$/i,
|
|
1005
|
+
wO=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function yO(e){e.file=Tf(e);let t=e.file&&fO(e.file);return t?(e.args.unshift(
|
|
1006
|
+
e.file),e.command=t,Tf(e)):e.file}function bO(e){if(!hO)return e;let t=yO(e),r=!gO.test(t);if(e.options.forceShell||r){let n=wO.
|
|
1007
|
+
test(t);e.command=mO.normalize(e.command),e.command=vf.command(e.command),e.args=e.args.map(i=>vf.argument(i,n));let o=[
|
|
1008
1008
|
e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.
|
|
1009
1009
|
windowsVerbatimArguments=!0}return e}function EO(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign(
|
|
1010
1010
|
{},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:bO(n)}If.exports=EO});var Rf=le((J4,xf)=>{"use strict";var Ja=process.platform==="win32";function Ka(e,t){return Object.assign(new Error(`${t}\
|
|
1011
1011
|
${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function _O(e,t){
|
|
1012
1012
|
if(!Ja)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Af(o,t);if(i)return r.call(e,"error",i)}return r.apply(
|
|
1013
1013
|
e,arguments)}}function Af(e,t){return Ja&&e===1&&!t.file?Ka(t.original,"spawn"):null}function SO(e,t){return Ja&&e===1&&
|
|
1014
|
-
!t.file?Ka(t.original,"spawnSync"):null}xf.exports={hookChildProcess:_O,verifyENOENT:Af,verifyENOENTSync:SO,notFoundError:Ka}});var Nf=le((K4,
|
|
1015
|
-
n.command,n.args,n.options);return Qa.hookChildProcess(o,n),o}function
|
|
1016
|
-
n.args,n.options);return o.error=o.error||Qa.verifyENOENTSync(o.status,n),o}
|
|
1017
|
-
sync=
|
|
1018
|
-
find(n=>n.toUpperCase()==="PATH")||"Path"}var kf=d(()=>{});var $f=d(()=>{});import{promisify as
|
|
1014
|
+
!t.file?Ka(t.original,"spawnSync"):null}xf.exports={hookChildProcess:_O,verifyENOENT:Af,verifyENOENTSync:SO,notFoundError:Ka}});var Nf=le((K4,ar)=>{"use strict";var Pf=Ke("child_process"),Xa=Of(),Qa=Rf();function Cf(e,t,r){let n=Xa(e,t,r),o=Pf.spawn(
|
|
1015
|
+
n.command,n.args,n.options);return Qa.hookChildProcess(o,n),o}function TO(e,t,r){let n=Xa(e,t,r),o=Pf.spawnSync(n.command,
|
|
1016
|
+
n.args,n.options);return o.error=o.error||Qa.verifyENOENTSync(o.status,n),o}ar.exports=Cf;ar.exports.spawn=Cf;ar.exports.
|
|
1017
|
+
sync=TO;ar.exports._parse=Xa;ar.exports._enoent=Qa});function Lo(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().
|
|
1018
|
+
find(n=>n.toUpperCase()==="PATH")||"Path"}var kf=d(()=>{});var $f=d(()=>{});import{promisify as vO}from"node:util";import{execFile as IO,execFileSync as tG}from"node:child_process";import Lf from"node:path";
|
|
1019
1019
|
import{fileURLToPath as OO}from"node:url";function Mo(e){return e instanceof URL?OO(e):e}function Mf(e){return{*[Symbol.
|
|
1020
|
-
iterator](){let t=Lf.resolve(Mo(e)),r;for(;r!==t;)yield t,r=t,t=Lf.resolve(t,"..")}}}var
|
|
1021
|
-
|
|
1022
|
-
env[Lo()],preferLocal:r=!0,execPath:n=jo.execPath,addExecPath:o=!0}={})=>{let i=
|
|
1023
|
-
return r&&xO(s,a,i),o&&RO(s,a,n,i),t===""||t===
|
|
1024
|
-
(e,t,r)=>{for(let n of Mf(r)){let o=
|
|
1020
|
+
iterator](){let t=Lf.resolve(Mo(e)),r;for(;r!==t;)yield t,r=t,t=Lf.resolve(t,"..")}}}var oG,iG,jf=d(()=>{$f();oG=vO(IO);
|
|
1021
|
+
iG=10*1024*1024});import jo from"node:process";import Tt from"node:path";var AO,xO,RO,Df,Uf=d(()=>{kf();jf();AO=({cwd:e=jo.cwd(),path:t=jo.
|
|
1022
|
+
env[Lo()],preferLocal:r=!0,execPath:n=jo.execPath,addExecPath:o=!0}={})=>{let i=Tt.resolve(Mo(e)),s=[],a=t.split(Tt.delimiter);
|
|
1023
|
+
return r&&xO(s,a,i),o&&RO(s,a,n,i),t===""||t===Tt.delimiter?`${s.join(Tt.delimiter)}${t}`:[...s,t].join(Tt.delimiter)},xO=
|
|
1024
|
+
(e,t,r)=>{for(let n of Mf(r)){let o=Tt.join(n,"node_modules/.bin");t.includes(o)||e.push(o)}},RO=(e,t,r,n)=>{let o=Tt.resolve(
|
|
1025
1025
|
n,Mo(r),"..");t.includes(o)||e.push(o)},Df=({env:e=jo.env,...t}={})=>{e={...e};let r=Lo({env:e});return t.path=e[r],e[r]=
|
|
1026
|
-
AO(t),e}});var Bf,_e,Gf,Vf,
|
|
1026
|
+
AO(t),e}});var Bf,_e,Gf,Ff,Vf,Do,Jr,Kr,vt=d(()=>{Bf=(e,t,r)=>{let n=r?Kr:Jr,o=e instanceof _e?{}:{cause:e};return new n(t,o)},_e=class extends Error{},
|
|
1027
1027
|
Gf=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(
|
|
1028
|
-
e.prototype,
|
|
1028
|
+
e.prototype,Vf,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Ff=e=>Do(e)&&Vf in e,Vf=Symbol("isExecaError"),Do=
|
|
1029
1029
|
e=>Object.prototype.toString.call(e)==="[object Error]",Jr=class extends Error{};Gf(Jr,Jr.name);Kr=class extends Error{};
|
|
1030
1030
|
Gf(Kr,Kr.name)});var zf,PO,Hf,qf,Wf=d(()=>{zf=()=>{let e=qf-Hf+1;return Array.from({length:e},PO)},PO=(e,t)=>({name:`SIGRT${t+1}`,number:Hf+
|
|
1031
1031
|
t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Hf=34,qf=64});var Yf,Jf=d(()=>{Yf=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"S\
|
|
@@ -1061,12 +1061,12 @@ te",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS"
|
|
|
1061
1061
|
valid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"\
|
|
1062
1062
|
other"}]});import{constants as CO}from"node:os";var Za,NO,Kf=d(()=>{Jf();Wf();Za=()=>{let e=zf();return[...Yf,...e].map(NO)},NO=({name:e,
|
|
1063
1063
|
number:t,description:r,action:n,forced:o=!1,standard:i})=>{let{signals:{[e]:s}}=CO,a=s!==void 0;return{name:e,number:a?s:
|
|
1064
|
-
t,description:r,supported:a,action:n,forced:o,standard:i}}});import{constants as kO}from"node:os";var $O,LO,Xf,MO,jO,DO,
|
|
1064
|
+
t,description:r,supported:a,action:n,forced:o,standard:i}}});import{constants as kO}from"node:os";var $O,LO,Xf,MO,jO,DO,SG,Qf=d(()=>{Kf();$O=()=>{let e=Za();return Object.fromEntries(
|
|
1065
1065
|
e.map(LO))},LO=({name:e,number:t,description:r,supported:n,action:o,forced:i,standard:s})=>[e,{name:e,number:t,description:r,
|
|
1066
1066
|
supported:n,action:o,forced:i,standard:s}],Xf=$O(),MO=()=>{let e=Za(),t=65,r=Array.from({length:t},(n,o)=>jO(o,e));return Object.
|
|
1067
1067
|
assign({},...r)},jO=(e,t)=>{let r=DO(e,t);if(r===void 0)return{};let{name:n,description:o,supported:i,action:s,forced:a,
|
|
1068
1068
|
standard:c}=r;return{[e]:{name:n,number:e,description:o,supported:i,action:s,forced:a,standard:c}}},DO=(e,t)=>{let r=t.find(
|
|
1069
|
-
({name:n})=>kO.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},
|
|
1069
|
+
({name:n})=>kO.signals[n]===e);return r!==void 0?r:t.find(n=>n.number===e)},SG=MO()});import{constants as Xr}from"node:os";var eh,th,rh,UO,BO,Zf,GO,ec,FO,VO,Uo,Qr=d(()=>{Qf();eh=e=>{let t="option `killSigna\
|
|
1070
1070
|
l`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return rh(e,t)},th=e=>e===0?e:rh(e,"`subprocess.kill\
|
|
1071
1071
|
()`'s argument"),rh=(e,t)=>{if(Number.isInteger(e))return UO(e,t);if(typeof e=="string")return GO(e,t);throw new TypeError(
|
|
1072
1072
|
`Invalid ${t} ${String(e)}: it must be a string or an integer.
|
|
@@ -1075,9 +1075,9 @@ ${ec()}`)},UO=(e,t)=>{if(Zf.has(e))return Zf.get(e);throw new TypeError(`Invalid
|
|
|
1075
1075
|
${ec()}`)},BO=()=>new Map(Object.entries(Xr.signals).reverse().map(([e,t])=>[t,e])),Zf=BO(),GO=(e,t)=>{if(e in Xr.signals)
|
|
1076
1076
|
return e;throw e.toUpperCase()in Xr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'\
|
|
1077
1077
|
.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
|
|
1078
|
-
${ec()}`)},ec=()=>`Available signal names: ${
|
|
1079
|
-
Available signal numbers: ${
|
|
1080
|
-
Object.values(Xr.signals).sort((e,t)=>e-t))].join(", "),Uo=e=>Xf[e].description});import{setTimeout as zO}from"node:timers/promises";var nh,HO,oh,qO,WO,YO,tc,Bo=d(()=>{
|
|
1078
|
+
${ec()}`)},ec=()=>`Available signal names: ${FO()}.
|
|
1079
|
+
Available signal numbers: ${VO()}.`,FO=()=>Object.keys(Xr.signals).sort().map(e=>`'${e}'`).join(", "),VO=()=>[...new Set(
|
|
1080
|
+
Object.values(Xr.signals).sort((e,t)=>e-t))].join(", "),Uo=e=>Xf[e].description});import{setTimeout as zO}from"node:timers/promises";var nh,HO,oh,qO,WO,YO,tc,Bo=d(()=>{vt();Qr();nh=e=>{if(e===!1)return e;
|
|
1081
1081
|
if(e===!0)return HO;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a n\
|
|
1082
1082
|
on-negative integer, got \`${e}\` (${typeof e})`);return e},HO=1e3*5,oh=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},
|
|
1083
1083
|
onInternalError:n,context:o,controller:i},s,a)=>{let{signal:c,error:l}=qO(s,a,r);WO(l,n);let u=e(c);return YO({kill:e,signal:c,
|
|
@@ -1090,7 +1090,7 @@ context:i,controllerSignal:s.signal})},tc=async({kill:e,forceKillAfterDelay:t,co
|
|
|
1090
1090
|
try{await zO(t,void 0,{signal:n}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as JO}from"node:events";var Go,rc=d(()=>{Go=async(e,t)=>{e.aborted||await JO(e,"abort",{signal:t})}});var ih,sh,KO,nc=d(()=>{rc();ih=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSig\
|
|
1091
1091
|
nal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},sh=({subprocess:e,cancelSignal:t,
|
|
1092
1092
|
gracefulCancel:r,context:n,controller:o})=>t===void 0||r?[]:[KO(e,t,n,o)],KO=async(e,t,r,{signal:n})=>{throw await Go(t,
|
|
1093
|
-
n),r.terminationReason??="cancel",e.kill(),t.reason}});var
|
|
1093
|
+
n),r.terminationReason??="cancel",e.kill(),t.reason}});var cr,XO,oc,ah,ch,Fo,lh,uh,dh,ph,mh,fh,QO,ZO,eA,Se,tA,tt,lr,ur=d(()=>{cr=({methodName:e,isSubprocess:t,ipc:r,isConnected:n})=>{
|
|
1094
1094
|
XO(e,t,r),oc(e,t,n)},XO=(e,t,r)=>{if(!r)throw new Error(`${Se(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},
|
|
1095
1095
|
oc=(e,t,r)=>{if(!r)throw new Error(`${Se(e,t)} cannot be used: the ${tt(t)} has already exited or disconnected.`)},ah=e=>{
|
|
1096
1096
|
throw new Error(`${Se("getOneMessage",e)} could not complete: the ${tt(e)} exited or disconnected.`)},ch=e=>{throw new Error(
|
|
@@ -1100,7 +1100,7 @@ This can be fixed by both sending a message and listening to incoming messages a
|
|
|
1100
1100
|
const [receivedMessage] = await Promise.all([
|
|
1101
1101
|
${Se("getOneMessage",e)},
|
|
1102
1102
|
${Se("sendMessage",e,"message, {strict: true}")},
|
|
1103
|
-
]);`)},
|
|
1103
|
+
]);`)},Fo=(e,t)=>new Error(`${Se("sendMessage",t)} failed when sending an acknowledgment response to the ${tt(t)}.`,{cause:e}),
|
|
1104
1104
|
lh=e=>{throw new Error(`${Se("sendMessage",e)} failed: the ${tt(e)} is not listening to incoming messages.`)},uh=e=>{throw new Error(
|
|
1105
1105
|
`${Se("sendMessage",e)} failed: the ${tt(e)} exited without listening to incoming messages.`)},dh=()=>new Error(`\`cancel\
|
|
1106
1106
|
Signal\` aborted: the ${tt(!0)} disconnected.`),ph=()=>{throw new Error("`getCancelSignal()` cannot be used without sett\
|
|
@@ -1109,60 +1109,60 @@ ing the `cancelSignal` subprocess option.")},mh=({error:e,methodName:t,isSubproc
|
|
|
1109
1109
|
if(QO(e))throw new Error(`${Se(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:e})},
|
|
1110
1110
|
QO=({code:e,message:t})=>ZO.has(e)||eA.some(r=>t.includes(r)),ZO=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),eA=
|
|
1111
1111
|
["could not be cloned","circular structure","call stack size exceeded"],Se=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal\
|
|
1112
|
-
`'s `controller.abort()`":`${tA(t)}${e}(${r})`,tA=e=>e?"":"subprocess.",tt=e=>e?"parent process":"subprocess",
|
|
1113
|
-
e.disconnect()}});var Re,
|
|
1114
|
-
t,!0),s=e.stdio[i];if(s===null)throw new TypeError(gh(i,t,n,!0));return s},
|
|
1112
|
+
`'s `controller.abort()`":`${tA(t)}${e}(${r})`,tA=e=>e?"":"subprocess.",tt=e=>e?"parent process":"subprocess",lr=e=>{e.connected&&
|
|
1113
|
+
e.disconnect()}});var Re,dr=d(()=>{Re=()=>{let e={},t=new Promise((r,n)=>{Object.assign(e,{resolve:r,reject:n})});return Object.assign(t,e)}});var zo,pr,Pe,hh,rA,nA,gh,oA,wh,Zr,Vo,rt=d(()=>{We();zo=(e,t="stdin")=>{let{options:n,fileDescriptors:o}=Pe.get(e),i=hh(o,
|
|
1114
|
+
t,!0),s=e.stdio[i];if(s===null)throw new TypeError(gh(i,t,n,!0));return s},pr=(e,t="stdout")=>{let{options:n,fileDescriptors:o}=Pe.
|
|
1115
1115
|
get(e),i=hh(o,t,!1),s=i==="all"?e.all:e.stdio[i];if(s==null)throw new TypeError(gh(i,t,n,!1));return s},Pe=new WeakMap,hh=
|
|
1116
1116
|
(e,t,r)=>{let n=rA(t,r);return nA(n,t,r,e),n},rA=(e,t)=>{let r=ja(e);if(r!==void 0)return r;let{validOptions:n,defaultValue:o}=t?
|
|
1117
1117
|
{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(
|
|
1118
1118
|
`"${Zr(t)}" must not be "${e}".
|
|
1119
1119
|
It must be ${n} or "fd3", "fd4" (and so on).
|
|
1120
|
-
It is optional and defaults to "${o}".`)},nA=(e,t,r,n)=>{let o=n[
|
|
1120
|
+
It is optional and defaults to "${o}".`)},nA=(e,t,r,n)=>{let o=n[wh(e)];if(o===void 0)throw new TypeError(`"${Zr(r)}" mu\
|
|
1121
1121
|
st not be ${t}. That file descriptor does not exist.
|
|
1122
1122
|
Please set the "stdio" option to ensure that file descriptor exists.`);if(o.direction==="input"&&!r)throw new TypeError(
|
|
1123
1123
|
`"${Zr(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(o.direction!=="input"&&r)throw new TypeError(
|
|
1124
1124
|
`"${Zr(r)}" must not be ${t}. It must be a writable stream, not readable.`)},gh=(e,t,r,n)=>{if(e==="all"&&!r.all)return`\
|
|
1125
|
-
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=oA(e,r);return`The "${o}: ${
|
|
1126
|
-
option is incompatible with using "${Zr(n)}: ${
|
|
1127
|
-
Please set this option with "pipe" instead.`},oA=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=
|
|
1125
|
+
The "all" option must be true to use "from: 'all'".`;let{optionName:o,optionValue:i}=oA(e,r);return`The "${o}: ${Vo(i)}"\
|
|
1126
|
+
option is incompatible with using "${Zr(n)}: ${Vo(t)}".
|
|
1127
|
+
Please set this option with "pipe" instead.`},oA=(e,{stdin:t,stdout:r,stderr:n,stdio:o})=>{let i=wh(e);return i===0&&t!==
|
|
1128
1128
|
void 0?{optionName:"stdin",optionValue:t}:i===1&&r!==void 0?{optionName:"stdout",optionValue:r}:i===2&&n!==void 0?{optionName:"\
|
|
1129
|
-
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},
|
|
1129
|
+
stderr",optionValue:n}:{optionName:`stdio[${i}]`,optionValue:o[i]}},wh=e=>e==="all"?1:e,Zr=e=>e?"to":"from",Vo=e=>typeof e==
|
|
1130
1130
|
"string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream"});import{addAbortListener as iA}from"node:events";var It,Ho=d(()=>{It=(e,t,r)=>{let n=e.getMaxListeners();n===0||n===Number.
|
|
1131
|
-
POSITIVE_INFINITY||(e.setMaxListeners(n+t),iA(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))}});var qo,ic,Wo,sc,
|
|
1132
|
-
|
|
1133
|
-
Xo();Eh=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(
|
|
1134
|
-
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Ih(e,n,o),await aA.yield();let s=await
|
|
1131
|
+
POSITIVE_INFINITY||(e.setMaxListeners(n+t),iA(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))}});var qo,ic,Wo,sc,yh,bh,en=d(()=>{qo=(e,t)=>{t&&ic(e)},ic=e=>{e.refCounted()},Wo=(e,t)=>{t&&sc(e)},sc=e=>{e.unrefCounted()},
|
|
1132
|
+
yh=(e,t)=>{t&&(sc(e),sc(e))},bh=(e,t)=>{t&&(ic(e),ic(e))}});import{once as sA}from"node:events";import{scheduler as aA}from"node:timers/promises";var Eh,_h,Yo,Sh=d(()=>{Ko();en();Jo();
|
|
1133
|
+
Xo();Eh=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n},o)=>{if(vh(o)||Oh(o))return;Yo.has(e)||Yo.set(e,[]);let i=Yo.
|
|
1134
|
+
get(e);if(i.push(o),!(i.length>1))for(;i.length>0;){await Ih(e,n,o),await aA.yield();let s=await Th({wrappedMessage:i[0],
|
|
1135
1135
|
anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:n});i.shift(),n.emit("message",s),n.emit("message:done")}},_h=async({anyProcess:e,
|
|
1136
1136
|
channel:t,isSubprocess:r,ipcEmitter:n,boundOnMessage:o})=>{ac();let i=Yo.get(e);for(;i?.length>0;)await sA(n,"message:do\
|
|
1137
1137
|
ne");e.removeListener("message",o),bh(t,r),n.connected=!1,n.emit("disconnect")},Yo=new WeakMap});import{EventEmitter as cA}from"node:events";var nt,Qo,lA,Zo,tn=d(()=>{Sh();en();nt=(e,t,r)=>{if(Qo.has(e))return Qo.get(
|
|
1138
1138
|
e);let n=new cA;return n.connected=!0,Qo.set(e,n),lA({ipcEmitter:n,anyProcess:e,channel:t,isSubprocess:r}),n},Qo=new WeakMap,
|
|
1139
1139
|
lA=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:n})=>{let o=Eh.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,
|
|
1140
1140
|
ipcEmitter:e});t.on("message",o),t.once("disconnect",_h.bind(void 0,{anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:e,
|
|
1141
|
-
boundOnMessage:o})),
|
|
1141
|
+
boundOnMessage:o})),yh(r,n)},Zo=e=>{let t=Qo.get(e);return t===void 0?e.channel!==null:t.connected}});import{once as uA}from"node:events";var Ah,dA,xh,Th,vh,Rh,ei,pA,ti,Ph,Jo=d(()=>{dr();Ho();oi();ur();tn();Ko();Ah=({anyProcess:e,
|
|
1142
1142
|
channel:t,isSubprocess:r,message:n,strict:o})=>{if(!o)return n;let i=nt(e,t,r),s=ri(e,i);return{id:dA++,type:ti,message:n,
|
|
1143
1143
|
hasListeners:s}},dA=0n,xh=(e,t)=>{if(!(t?.type!==ti||t.hasListeners))for(let{id:r}of e)r!==void 0&&ei[r].resolve({isDeadlock:!0,
|
|
1144
|
-
hasListeners:!1})},
|
|
1144
|
+
hasListeners:!1})},Th=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:n,ipcEmitter:o})=>{if(e?.type!==ti||!t.
|
|
1145
1145
|
connected)return e;let{id:i,message:s}=e,a={id:i,type:Ph,message:ri(t,o)};try{await ni({anyProcess:t,channel:r,isSubprocess:n,
|
|
1146
|
-
ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},
|
|
1146
|
+
ipc:!0},a)}catch(c){o.emit("strict:error",c)}return s},vh=e=>{if(e?.type!==Ph)return!1;let{id:t,message:r}=e;return ei[t]?.
|
|
1147
1147
|
resolve({isDeadlock:!1,hasListeners:r}),!0},Rh=async(e,t,r)=>{if(e?.type!==ti)return;let n=Re();ei[e.id]=n;let o=new AbortController;
|
|
1148
1148
|
try{let{isDeadlock:i,hasListeners:s}=await Promise.race([n,pA(t,r,o)]);i&&ch(r),s||lh(r)}finally{o.abort(),delete ei[e.id]}},
|
|
1149
1149
|
ei={},pA=async(e,t,{signal:r})=>{It(e,1,r),await uA(e,"disconnect",{signal:r}),uh(t)},ti="execa:ipc:request",Ph="execa:i\
|
|
1150
|
-
pc:response"});var Ch,Nh,Ih,rn,ri,mA,Ko=d(()=>{
|
|
1150
|
+
pc:response"});var Ch,Nh,Ih,rn,ri,mA,Ko=d(()=>{dr();We();rt();Jo();Ch=(e,t,r)=>{rn.has(e)||rn.set(e,new Set);let n=rn.get(e),o=Re(),i=r?
|
|
1151
1151
|
t.id:void 0,s={onMessageSent:o,id:i};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},Nh=({outgoingMessages:e,outgoingMessage:t})=>{
|
|
1152
1152
|
e.delete(t),t.onMessageSent.resolve()},Ih=async(e,t,r)=>{for(;!ri(e,t)&&rn.get(e)?.size>0;){let n=[...rn.get(e)];xh(n,r),
|
|
1153
1153
|
await Promise.all(n.map(({onMessageSent:o})=>o))}},rn=new WeakMap,ri=(e,t)=>t.listenerCount("message")>mA(e),mA=e=>Pe.has(
|
|
1154
|
-
e)&&!qe(Pe.get(e).options.buffer,"ipc")?1:0});import{promisify as fA}from"node:util";var ni,hA,lc,gA,cc,oi=d(()=>{
|
|
1155
|
-
ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return
|
|
1154
|
+
e)&&!qe(Pe.get(e).options.buffer,"ipc")?1:0});import{promisify as fA}from"node:util";var ni,hA,lc,gA,cc,oi=d(()=>{ur();Ko();Jo();ni=({anyProcess:e,channel:t,isSubprocess:r,
|
|
1155
|
+
ipc:n},o,{strict:i=!1}={})=>{let s="sendMessage";return cr({methodName:s,isSubprocess:r,ipc:n,isConnected:e.connected}),
|
|
1156
1156
|
hA({anyProcess:e,channel:t,methodName:s,isSubprocess:r,message:o,strict:i})},hA=async({anyProcess:e,channel:t,methodName:r,
|
|
1157
1157
|
isSubprocess:n,message:o,strict:i})=>{let s=Ah({anyProcess:e,channel:t,isSubprocess:n,message:o,strict:i}),a=Ch(e,s,i);try{
|
|
1158
|
-
await lc({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw
|
|
1158
|
+
await lc({anyProcess:e,methodName:r,isSubprocess:n,wrappedMessage:s,message:o})}catch(c){throw lr(e),c}finally{Nh(a)}},lc=
|
|
1159
1159
|
async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:n,message:o})=>{let i=gA(e);try{await Promise.all([Rh(n,e,
|
|
1160
1160
|
r),i(n)])}catch(s){throw mh({error:s,methodName:t,isSubprocess:r}),fh({error:s,methodName:t,isSubprocess:r,message:o}),s}},
|
|
1161
|
-
gA=e=>{if(cc.has(e))return cc.get(e);let t=fA(e.send.bind(e));return cc.set(e,t),t},cc=new WeakMap});import{scheduler as
|
|
1161
|
+
gA=e=>{if(cc.has(e))return cc.get(e);let t=fA(e.send.bind(e));return cc.set(e,t),t},cc=new WeakMap});import{scheduler as wA}from"node:timers/promises";var $h,Lh,yA,kh,Oh,Mh,ac,uc,Xo=d(()=>{oi();tn();ur();$h=(e,t)=>{let r="\
|
|
1162
1162
|
cancelSignal";return oc(r,!1,e.connected),lc({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:Mh,message:t},
|
|
1163
|
-
message:t})},Lh=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await
|
|
1164
|
-
uc.signal),
|
|
1165
|
-
return}nt(e,t,r),await
|
|
1163
|
+
message:t})},Lh=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>(await yA({anyProcess:e,channel:t,isSubprocess:r,ipc:n}),
|
|
1164
|
+
uc.signal),yA=async({anyProcess:e,channel:t,isSubprocess:r,ipc:n})=>{if(!kh){if(kh=!0,!n){ph();return}if(t===null){ac();
|
|
1165
|
+
return}nt(e,t,r),await wA.yield()}},kh=!1,Oh=e=>e?.type!==Mh?!1:(uc.abort(e.message),!0),Mh="execa:ipc:cancel",ac=()=>{uc.
|
|
1166
1166
|
abort(dh())},uc=new AbortController});var jh,Dh,bA,EA,dc=d(()=>{rc();Xo();Bo();jh=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:n})=>{if(e){if(t===void 0)
|
|
1167
1167
|
throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error(
|
|
1168
1168
|
"The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(n==="json")throw new Error("The `serial\
|
|
@@ -1171,13 +1171,13 @@ forceKillAfterDelay:n,context:o,controller:i})=>r?[bA({subprocess:e,cancelSignal
|
|
|
1171
1171
|
[],bA=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:n,controller:{signal:o}})=>{await Go(t,o);let i=EA(
|
|
1172
1172
|
t);throw await $h(e,i),tc({kill:e.kill,forceKillAfterDelay:r,context:n,controllerSignal:o}),n.terminationReason??="grace\
|
|
1173
1173
|
fulCancel",t.reason},EA=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.
|
|
1174
|
-
defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t}});import{setTimeout as _A}from"node:timers/promises";var Uh,Bh,SA,pc=d(()=>{
|
|
1174
|
+
defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t}});import{setTimeout as _A}from"node:timers/promises";var Uh,Bh,SA,pc=d(()=>{vt();Uh=({timeout:e})=>{if(e!==void 0&&(!Number.
|
|
1175
1175
|
isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e}\
|
|
1176
1176
|
)`)},Bh=(e,t,r,n)=>t===0||t===void 0?[]:[SA(e,t,r,n)],SA=async(e,t,r,{signal:n})=>{throw await _A(t,void 0,{signal:n}),r.
|
|
1177
|
-
terminationReason??="timeout",e.kill(),new _e}});import{execPath as
|
|
1177
|
+
terminationReason??="timeout",e.kill(),new _e}});import{execPath as TA,execArgv as vA}from"node:process";import Gh from"node:path";var Fh,Vh,mc=d(()=>{rr();Fh=({options:e})=>{
|
|
1178
1178
|
if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},
|
|
1179
|
-
|
|
1180
|
-
void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=
|
|
1179
|
+
Vh=(e,t,{node:r=!1,nodePath:n=TA,nodeOptions:o=vA.filter(c=>!c.startsWith("--inspect")),cwd:i,execPath:s,...a})=>{if(s!==
|
|
1180
|
+
void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=tr(
|
|
1181
1181
|
n,'The "nodePath" option'),l=Gh.resolve(i,c),u={...a,nodePath:l,node:r,cwd:i};if(!r)return[e,t,u];if(Gh.basename(e,".exe")===
|
|
1182
1182
|
"node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[l,[...o,
|
|
1183
1183
|
e,...t],{ipc:!0,...u,shell:!1}]}});import{serialize as IA}from"node:v8";var zh,OA,AA,xA,Hh,fc=d(()=>{zh=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){
|
|
@@ -1191,44 +1191,44 @@ e)}\`.
|
|
|
1191
1191
|
Please rename it to one of: ${r}.`)},RA=new Set(["utf8","utf16le"]),pe=new Set(["buffer","hex","base64","base64url","lat\
|
|
1192
1192
|
in1","ascii"]),hc=new Set([...RA,...pe]),PA=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();
|
|
1193
1193
|
if(t in qh)return qh[t];if(hc.has(t))return t},qh={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",
|
|
1194
|
-
binary:"latin1"},ii=e=>typeof e=="string"?`"${e}"`:String(e)});import{statSync as CA}from"node:fs";import NA from"node:path";import kA from"node:process";var Yh,Jh,Kh,gc=d(()=>{
|
|
1195
|
-
(e=Jh())=>{let t=
|
|
1194
|
+
binary:"latin1"},ii=e=>typeof e=="string"?`"${e}"`:String(e)});import{statSync as CA}from"node:fs";import NA from"node:path";import kA from"node:process";var Yh,Jh,Kh,gc=d(()=>{rr();Yh=
|
|
1195
|
+
(e=Jh())=>{let t=tr(e,'The "cwd" option');return NA.resolve(t)},Jh=()=>{try{return kA.cwd()}catch(e){throw e.message=`Th\
|
|
1196
1196
|
e current directory does not exist.
|
|
1197
1197
|
${e.message}`,e}},Kh=(e,t)=>{if(t===Jh())return e;let r;try{r=CA(t)}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
1198
1198
|
${n.message}
|
|
1199
1199
|
${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
1200
|
-
${e}`}});import $A from"node:path";import Xh from"node:process";var Qh,si,LA,MA,
|
|
1201
|
-
pc();mc();fc();Ot();gc();
|
|
1200
|
+
${e}`}});import $A from"node:path";import Xh from"node:process";var Qh,si,LA,MA,wc=d(()=>{Qh=mS(Nf(),1);Uf();Bo();Qr();nc();dc();
|
|
1201
|
+
pc();mc();fc();Ot();gc();rr();We();si=(e,t,r)=>{r.cwd=Yh(r.cwd);let[n,o,i]=Vh(e,t,r),{command:s,args:a,options:c}=Qh.default.
|
|
1202
1202
|
_parse(n,o,i),l=Em(c),u=LA(l);return Uh(u),Wh(u),zh(u),ih(u),jh(u),u.shell=Na(u.shell),u.env=MA(u),u.killSignal=eh(u.killSignal),
|
|
1203
1203
|
u.forceKillAfterDelay=nh(u.forceKillAfterDelay),u.lines=u.lines.map((p,f)=>p&&!pe.has(u.encoding)&&u.buffer[f]),Xh.platform===
|
|
1204
1204
|
"win32"&&$A.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},LA=({extendEnv:e=!0,preferLocal:t=!1,
|
|
1205
1205
|
cwd:r,localDir:n=r,encoding:o="utf8",reject:i=!0,cleanup:s=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,
|
|
1206
|
-
gracefulCancel:p=!1,ipcInput:f,ipc:h=f!==void 0||p,serialization:
|
|
1206
|
+
gracefulCancel:p=!1,ipcInput:f,ipc:h=f!==void 0||p,serialization:w="advanced",...E})=>({...E,extendEnv:e,preferLocal:t,cwd:r,
|
|
1207
1207
|
localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:p,ipcInput:f,
|
|
1208
|
-
ipc:h,serialization:
|
|
1209
|
-
e;return r||n?Df({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s}});var ai,
|
|
1208
|
+
ipc:h,serialization:w}),MA=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...Xh.env,...e}:
|
|
1209
|
+
e;return r||n?Df({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s}});var ai,yc=d(()=>{ai=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r]});function mr(e){if(typeof e=="string")return jA(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
1210
1210
|
Input must be a string or a Uint8Array");return DA(e)}var jA,DA,Zh,UA,eg,BA,bc=d(()=>{jA=e=>e.at(-1)===Zh?e.slice(0,e.at(
|
|
1211
1211
|
-2)===eg?-2:-1):e,DA=e=>e.at(-1)===UA?e.subarray(0,e.at(-2)===BA?-2:-1):e,Zh=`
|
|
1212
|
-
`,UA=Zh.codePointAt(0),eg="\r",BA=eg.codePointAt(0)});function
|
|
1213
|
-
e.readable===void 0)&&typeof e.pipe=="function"}function Ec(e,{checkOpen:t=!0}={}){return
|
|
1212
|
+
`,UA=Zh.codePointAt(0),eg="\r",BA=eg.codePointAt(0)});function Te(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&
|
|
1213
|
+
e.readable===void 0)&&typeof e.pipe=="function"}function Ec(e,{checkOpen:t=!0}={}){return Te(e,{checkOpen:t})&&(e.writable||
|
|
1214
1214
|
!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="b\
|
|
1215
|
-
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function At(e,{checkOpen:t=!0}={}){return
|
|
1215
|
+
oolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function At(e,{checkOpen:t=!0}={}){return Te(e,{checkOpen:t})&&
|
|
1216
1216
|
(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.
|
|
1217
|
-
destroy=="function"&&typeof e.destroyed=="boolean"}function _c(e,t){return Ec(e,t)&&At(e,t)}var xt=d(()=>{});function tg(){return this[
|
|
1218
|
-
getReader(),r=new Sc(t,e),n=Object.create(
|
|
1217
|
+
destroy=="function"&&typeof e.destroyed=="boolean"}function _c(e,t){return Ec(e,t)&&At(e,t)}var xt=d(()=>{});function tg(){return this[Tc].next()}function rg(e){return this[Tc].return(e)}function vc({preventCancel:e=!1}={}){let t=this.
|
|
1218
|
+
getReader(),r=new Sc(t,e),n=Object.create(FA);return n[Tc]=r,n}var GA,Sc,Tc,FA,ng=d(()=>{GA=Object.getPrototypeOf(Object.
|
|
1219
1219
|
getPrototypeOf(async function*(){}).prototype),Sc=class{#t;#r;#e=!1;#n=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){
|
|
1220
1220
|
let t=()=>this.#i();return this.#n=this.#n?this.#n.then(t,t):t(),this.#n}return(t){let r=()=>this.#o(t);return this.#n?this.#n.
|
|
1221
1221
|
then(r,r):r()}async#i(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#n=
|
|
1222
1222
|
void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#n=void 0,this.#e=!0,this.#t.releaseLock()),t}async#o(t){
|
|
1223
1223
|
if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,
|
|
1224
|
-
{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},
|
|
1225
|
-
ext"});Object.defineProperty(rg,"name",{value:"return"});
|
|
1226
|
-
value:tg},return:{enumerable:!0,configurable:!0,writable:!0,value:rg}})});var og=d(()=>{});var ig=d(()=>{ng();og()});var sg,
|
|
1227
|
-
asyncIterator]=="function")return e;if(
|
|
1228
|
-
first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:
|
|
1224
|
+
{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Tc=Symbol();Object.defineProperty(tg,"name",{value:"n\
|
|
1225
|
+
ext"});Object.defineProperty(rg,"name",{value:"return"});FA=Object.create(GA,{next:{enumerable:!0,configurable:!0,writable:!0,
|
|
1226
|
+
value:tg},return:{enumerable:!0,configurable:!0,writable:!0,value:rg}})});var og=d(()=>{});var ig=d(()=>{ng();og()});var sg,VA,zA,HA,nn,Ic=d(()=>{xt();ig();sg=e=>{if(At(e,{checkOpen:!1})&&nn.on!==void 0)return zA(e);if(typeof e?.[Symbol.
|
|
1227
|
+
asyncIterator]=="function")return e;if(VA.call(e)==="[object ReadableStream]")return vc.call(e);throw new TypeError("The\
|
|
1228
|
+
first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:VA}=Object.prototype,zA=async function*(e){
|
|
1229
1229
|
let t=new AbortController,r={};HA(e,t,r);try{for await(let[n]of nn.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.
|
|
1230
1230
|
error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}},HA=async(e,t,r)=>{try{await nn.finished(
|
|
1231
|
-
e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},nn={}});var
|
|
1231
|
+
e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},nn={}});var fr,qA,lg,ag,WA,cg,Ce,on=d(()=>{Ic();fr=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,
|
|
1232
1232
|
finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=sg(e),u=t();u.length=0;try{for await(let p of l){let f=WA(
|
|
1233
1233
|
p),h=r[f](p,u);lg({convertedChunk:h,state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return qA({state:u,convertChunk:r,
|
|
1234
1234
|
getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(u)}catch(p){let f=typeof p=="object"&&p!==null?p:new Error(
|
|
@@ -1240,85 +1240,85 @@ g")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?
|
|
|
1240
1240
|
e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.
|
|
1241
1241
|
isInteger(e.byteOffset)&&cg.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:cg}=Object.prototype,
|
|
1242
1242
|
Ce=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Ye,sn,ci,li,ui,di=d(()=>{Ye=e=>e,sn=()=>{},ci=({contents:e})=>e,li=e=>{throw new Error(`Streams in object mode are n\
|
|
1243
|
-
ot supported: ${String(e)}`)},ui=e=>e.length});async function pi(e,t){return
|
|
1243
|
+
ot supported: ${String(e)}`)},ui=e=>e.length});async function pi(e,t){return fr(e,XA,t)}var YA,JA,KA,XA,ug=d(()=>{on();di();YA=()=>({contents:[]}),JA=()=>1,KA=(e,{contents:t})=>(t.
|
|
1244
1244
|
push(e),t),XA={init:YA,convertChunk:{string:Ye,buffer:Ye,arrayBuffer:Ye,dataView:Ye,typedArray:Ye,others:Ye},getSize:JA,
|
|
1245
|
-
truncateChunk:sn,addChunk:KA,getFinalChunk:sn,finalize:ci}});async function mi(e,t){return
|
|
1245
|
+
truncateChunk:sn,addChunk:KA,getFinalChunk:sn,finalize:ci}});async function mi(e,t){return fr(e,sx,t)}var QA,ZA,ex,dg,pg,tx,rx,nx,ox,fg,mg,ix,hg,sx,gg=d(()=>{on();di();QA=()=>({contents:new ArrayBuffer(
|
|
1246
1246
|
0)}),ZA=e=>ex.encode(e),ex=new TextEncoder,dg=e=>new Uint8Array(e),pg=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),
|
|
1247
1247
|
tx=(e,t)=>e.slice(0,t),rx=(e,{contents:t,length:r},n)=>{let o=hg()?ox(t,n):nx(t,n);return new Uint8Array(o).set(e,r),o},
|
|
1248
1248
|
nx=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(fg(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},
|
|
1249
1249
|
ox=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:fg(t)});return new Uint8Array(
|
|
1250
1250
|
r).set(new Uint8Array(e),0),r},fg=e=>mg**Math.ceil(Math.log(e)/Math.log(mg)),mg=2,ix=({contents:e,length:t})=>hg()?e:e.slice(
|
|
1251
1251
|
0,t),hg=()=>"resize"in ArrayBuffer.prototype,sx={init:QA,convertChunk:{string:ZA,buffer:dg,arrayBuffer:dg,dataView:pg,typedArray:pg,
|
|
1252
|
-
others:li},getSize:ui,truncateChunk:tx,addChunk:rx,getFinalChunk:sn,finalize:ix}});async function hi(e,t){return
|
|
1252
|
+
others:li},getSize:ui,truncateChunk:tx,addChunk:rx,getFinalChunk:sn,finalize:ix}});async function hi(e,t){return fr(e,dx,t)}var ax,fi,cx,lx,ux,dx,wg=d(()=>{on();di();ax=()=>({contents:"",textDecoder:new TextDecoder}),
|
|
1253
1253
|
fi=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),cx=(e,{contents:t})=>t+e,lx=(e,t)=>e.slice(0,t),ux=({textDecoder:e})=>{let t=e.
|
|
1254
1254
|
decode();return t===""?void 0:t},dx={init:ax,convertChunk:{string:Ye,buffer:fi,arrayBuffer:fi,dataView:fi,typedArray:fi,
|
|
1255
|
-
others:li},getSize:ui,truncateChunk:lx,addChunk:cx,getFinalChunk:ux,finalize:ci}});var
|
|
1256
|
-
nn,{on:px,finished:mx})});var bg,fx,Eg,_g,hx,Sg,
|
|
1255
|
+
others:li},getSize:ui,truncateChunk:lx,addChunk:cx,getFinalChunk:ux,finalize:ci}});var yg=d(()=>{ug();gg();wg();on()});import{on as px}from"node:events";import{finished as mx}from"node:stream/promises";var gi=d(()=>{Ic();yg();Object.assign(
|
|
1256
|
+
nn,{on:px,finished:mx})});var bg,fx,Eg,_g,hx,Sg,Tg,wi,Rt=d(()=>{gi();He();We();bg=({error:e,stream:t,readableObjectMode:r,lines:n,encoding:o,fdNumber:i})=>{
|
|
1257
1257
|
if(!(e instanceof Ce))throw e;if(i==="all")return e;let s=fx(r,n,o);throw e.maxBufferInfo={fdNumber:i,unit:s},t.destroy(),
|
|
1258
1258
|
e},fx=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",Eg=(e,t,r)=>{if(t.length!==r)return;let n=new Ce;
|
|
1259
1259
|
throw n.maxBufferInfo={fdNumber:"ipc"},n},_g=(e,t)=>{let{streamName:r,threshold:n,unit:o}=hx(e,t);return`Command's ${r} \
|
|
1260
1260
|
was larger than ${n} ${o}`},hx=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"byte\
|
|
1261
1261
|
s"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=qe(t,r);return r==="ipc"?{streamName:"IPC outp\
|
|
1262
|
-
ut",threshold:o,unit:"messages"}:{streamName:
|
|
1263
|
-
n=>n!==null&&n.length>
|
|
1262
|
+
ut",threshold:o,unit:"messages"}:{streamName:To(r),threshold:o,unit:n}},Sg=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(
|
|
1263
|
+
n=>n!==null&&n.length>wi(r)),Tg=(e,t,r)=>{if(!t)return e;let n=wi(r);return e.length>n?e.slice(0,n):e},wi=([,e])=>e});import{inspect as gx}from"node:util";var Ig,wx,yx,bx,Ex,_x,vg,Og=d(()=>{bc();de();gc();Oo();Rt();Qr();vt();Ig=({stdio:e,
|
|
1264
1264
|
all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,
|
|
1265
|
-
isMaxBuffer:p,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:
|
|
1266
|
-
|
|
1267
|
-
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:
|
|
1265
|
+
isMaxBuffer:p,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:w,maxBuffer:E,timeout:_,cwd:m})=>{let g=n?.code,
|
|
1266
|
+
y=wx({originalError:n,timedOut:c,timeout:_,isMaxBuffer:p,maxBuffer:E,errorCode:g,signal:o,signalDescription:i,exitCode:s,
|
|
1267
|
+
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:h,killSignal:w}),S=bx(n,m),v=S===void 0?
|
|
1268
1268
|
"":`
|
|
1269
|
-
${S}`,b=`${
|
|
1270
|
-
`)].map(I=>Yr(
|
|
1269
|
+
${S}`,b=`${y}: ${a}${v}`,T=t===void 0?[e[2],e[1]]:[t],O=[b,...T,...e.slice(3),r.map(I=>Ex(I)).join(`
|
|
1270
|
+
`)].map(I=>Yr(mr(_x(I)))).filter(Boolean).join(`
|
|
1271
1271
|
|
|
1272
|
-
`);return{originalMessage:S,shortMessage:b,message:O}},
|
|
1272
|
+
`);return{originalMessage:S,shortMessage:b,message:O}},wx=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
1273
1273
|
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:f,
|
|
1274
|
-
killSignal:h})=>{let
|
|
1275
|
-
ully canceled with exit code ${c}`:p?`Command was gracefully canceled${
|
|
1276
|
-
)`:l?`Command was canceled${
|
|
1277
|
-
(${Uo(h)})${
|
|
1278
|
-
nd failed"},
|
|
1279
|
-
let r=
|
|
1280
|
-
e),_x=e=>Array.isArray(e)?e.map(t=>
|
|
1281
|
-
`):
|
|
1282
|
-
startTime:s})=>Ag({command:e,escapedCommand:t,cwd:i,durationMs:
|
|
1274
|
+
killSignal:h})=>{let w=yx(p,f);return t?`Command timed out after ${r} milliseconds${w}`:u?s===void 0?`Command was gracef\
|
|
1275
|
+
ully canceled with exit code ${c}`:p?`Command was gracefully canceled${w}`:`Command was gracefully canceled with ${s} (${a}\
|
|
1276
|
+
)`:l?`Command was canceled${w}`:n?`${_g(e,o)}${w}`:i!==void 0?`Command failed with ${i}${w}`:p?`Command was killed with ${h}\
|
|
1277
|
+
(${Uo(h)})${w}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
1278
|
+
nd failed"},yx=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",bx=(e,t)=>{if(e instanceof _e)return;
|
|
1279
|
+
let r=Ff(e)?e.originalMessage:String(e?.message??e),n=Yr(Kh(r,t));return n===""?void 0:n},Ex=e=>typeof e=="string"?e:gx(
|
|
1280
|
+
e),_x=e=>Array.isArray(e)?e.map(t=>mr(vg(t))).filter(Boolean).join(`
|
|
1281
|
+
`):vg(e),vg=e=>typeof e=="string"?e:K(e)?_o(e):""});var yi,hr,an,Sx,Ag,Tx,cn=d(()=>{Qr();No();vt();Og();yi=({command:e,escapedCommand:t,stdio:r,all:n,ipcOutput:o,options:{cwd:i},
|
|
1282
|
+
startTime:s})=>Ag({command:e,escapedCommand:t,cwd:i,durationMs:Fa(s),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,
|
|
1283
1283
|
isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:n,stdio:r,ipcOutput:o,pipedFrom:[]}),
|
|
1284
|
-
|
|
1284
|
+
hr=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:s})=>an({error:e,command:t,escapedCommand:r,
|
|
1285
1285
|
startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from(
|
|
1286
1286
|
{length:n.length}),ipcOutput:[],options:o,isSync:s}),an=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,
|
|
1287
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:p,all:f,ipcOutput:h,options:{timeoutDuration:
|
|
1288
|
-
timeout:E=
|
|
1289
|
-
l,u),{originalMessage:O,shortMessage:I,message:x}=Ig({stdio:p,all:f,ipcOutput:h,originalError:e,signal:b,signalDescription:
|
|
1290
|
-
exitCode:
|
|
1291
|
-
killSignal:m,maxBuffer:
|
|
1292
|
-
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:
|
|
1287
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:p,all:f,ipcOutput:h,options:{timeoutDuration:w,
|
|
1288
|
+
timeout:E=w,forceKillAfterDelay:_,killSignal:m,cwd:g,maxBuffer:y},isSync:S})=>{let{exitCode:v,signal:b,signalDescription:T}=Tx(
|
|
1289
|
+
l,u),{originalMessage:O,shortMessage:I,message:x}=Ig({stdio:p,all:f,ipcOutput:h,originalError:e,signal:b,signalDescription:T,
|
|
1290
|
+
exitCode:v,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:_,
|
|
1291
|
+
killSignal:m,maxBuffer:y,timeout:E,cwd:g}),j=Bf(e,x,S);return Object.assign(j,Sx({error:j,command:t,escapedCommand:r,startTime:n,
|
|
1292
|
+
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:v,signal:b,signalDescription:T,
|
|
1293
1293
|
stdio:p,all:f,ipcOutput:h,cwd:g,originalMessage:O,shortMessage:I})),j},Sx=({error:e,command:t,escapedCommand:r,startTime:n,
|
|
1294
1294
|
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:p,
|
|
1295
|
-
stdio:f,all:h,ipcOutput:
|
|
1296
|
-
cwd:E,durationMs:
|
|
1297
|
-
exitCode:l,signal:u,signalDescription:p,code:e.cause?.code,stdout:f[1],stderr:f[2],all:h,stdio:f,ipcOutput:
|
|
1298
|
-
Ag=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),
|
|
1299
|
-
t,o=n===void 0?void 0:Uo(t);return{exitCode:r,signal:n,signalDescription:o}}});function
|
|
1295
|
+
stdio:f,all:h,ipcOutput:w,cwd:E,originalMessage:_,shortMessage:m})=>Ag({shortMessage:m,originalMessage:_,command:t,escapedCommand:r,
|
|
1296
|
+
cwd:E,durationMs:Fa(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
1297
|
+
exitCode:l,signal:u,signalDescription:p,code:e.cause?.code,stdout:f[1],stderr:f[2],all:h,stdio:f,ipcOutput:w,pipedFrom:[]}),
|
|
1298
|
+
Ag=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),Tx=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:
|
|
1299
|
+
t,o=n===void 0?void 0:Uo(t);return{exitCode:r,signal:n,signalDescription:o}}});function vx(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(
|
|
1300
1300
|
e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(xg(e*1e3)%1e3),nanoseconds:Math.trunc(xg(e*1e6)%1e3)}}function Ix(e){
|
|
1301
1301
|
return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,
|
|
1302
|
-
nanoseconds:0n}}function Oc(e){switch(typeof e){case"number":{if(Number.isFinite(e))return
|
|
1302
|
+
nanoseconds:0n}}function Oc(e){switch(typeof e){case"number":{if(Number.isFinite(e))return vx(e);break}case"bigint":return Ix(
|
|
1303
1303
|
e)}throw new TypeError("Expected a finite number or bigint")}var xg,Rg=d(()=>{xg=e=>Number.isFinite(e)?e:0});function Ac(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bi\
|
|
1304
1304
|
gint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=
|
|
1305
1305
|
!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,p)=>{let f=Math.
|
|
1306
1306
|
floor(u*10**p+xx);return(Math.round(f)/10**p).toFixed(p)},s=(u,p,f,h)=>{if(!((o.length===0||!t.colonNotation)&&Ox(u)&&!(t.
|
|
1307
|
-
colonNotation&&f==="m"))){if(h??=String(u),t.colonNotation){let
|
|
1308
|
-
0?2:1;h="0".repeat(Math.max(0,E-
|
|
1307
|
+
colonNotation&&f==="m"))){if(h??=String(u),t.colonNotation){let w=h.includes(".")?h.split(".")[0].length:h.length,E=o.length>
|
|
1308
|
+
0?2:1;h="0".repeat(Math.max(0,E-w))+h}else h+=t.verbose?" "+Ax(p,u):f;o.push(h)}},a=Oc(e),c=BigInt(a.days);if(t.hideYearAndDays?
|
|
1309
1309
|
s(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?s(c,"day","d"):(s(c/365n,"year","y"),s(c%365n,"day","d")),s(Number(
|
|
1310
1310
|
a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||
|
|
1311
1311
|
!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),p=Number(a.milliseconds),f=Number(a.microseconds),
|
|
1312
1312
|
h=Number(a.nanoseconds);if(s(u,"second","s"),t.formatSubMilliseconds)s(p,"millisecond","ms"),s(f,"microsecond","\xB5s"),
|
|
1313
|
-
s(h,"nanosecond","ns");else{let
|
|
1314
|
-
0,_=
|
|
1313
|
+
s(h,"nanosecond","ns");else{let w=p+f/1e3+h/1e6,E=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:
|
|
1314
|
+
0,_=w>=1?Math.round(w):Math.ceil(w),m=1e3-10**-E,g=E?Math.min(w,m).toFixed(E):Math.min(_,m);s(Number.parseFloat(g),"mill\
|
|
1315
1315
|
isecond","ms",g)}}else{let u=(r?Number(e%Rx):e)/1e3%60,p=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:
|
|
1316
1316
|
1,f=i(u,p),h=t.keepDecimalsOnWholeSeconds?f:f.replace(/\.0+$/,"");s(Number.parseFloat(h),"second","s",h)}if(o.length===0)
|
|
1317
1317
|
return n+"0"+(t.verbose?" milliseconds":"ms");let l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(
|
|
1318
1318
|
0,Math.max(t.unitCount,1))),n+o.join(l)}var Ox,Ax,xx,Rx,Pg=d(()=>{Rg();Ox=e=>e===0||e===0n,Ax=(e,t)=>t===1||t===1n?e:`${e}\
|
|
1319
|
-
s`,xx=1e-7,Rx=24n*60n*60n*1000n});var Cg,Ng=d(()=>{
|
|
1320
|
-
)`;xe({type:"duration",verboseMessage:r,verboseInfo:t,result:e})}});var
|
|
1321
|
-
de();jg=(e,t)=>Pt(e)?"asyncGenerator":Bg(e)?"generator":Ei(e)?"fileUrl":Lx(e)?"filePath":Dx(e)?"webStream":
|
|
1319
|
+
s`,xx=1e-7,Rx=24n*60n*60n*1000n});var Cg,Ng=d(()=>{ir();Cg=(e,t)=>{e.failed&&xe({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})}});var kg,Px,$g=d(()=>{Pg();et();ir();Ng();kg=(e,t)=>{nr(t)&&(Cg(e,t),Px(e,t))},Px=(e,t)=>{let r=`(done in ${Ac(e.durationMs)}\
|
|
1320
|
+
)`;xe({type:"duration",verboseMessage:r,verboseInfo:t,result:e})}});var gr,bi=d(()=>{$g();gr=(e,t,{reject:r})=>{if(kg(e,t),e.failed&&r)throw e;return e}});var jg,Cx,Nx,Dg,Ug,Lg,kx,xc,Mg,Pt,Bg,$x,Ei,Gg,Lx,Mx,Rc,Fg,jx,Vg,_i,Dx,Pc,Ux,Bx,zg,ye,Si,Cc,Hg,qg,ot,oe=d(()=>{xt();Ve();
|
|
1321
|
+
de();jg=(e,t)=>Pt(e)?"asyncGenerator":Bg(e)?"generator":Ei(e)?"fileUrl":Lx(e)?"filePath":Dx(e)?"webStream":Te(e,{checkOpen:!1})?
|
|
1322
1322
|
"native":K(e)?"uint8Array":Ux(e)?"asyncIterable":Bx(e)?"iterable":Pc(e)?Dg({transform:e},t):$x(e)?Cx(e,t):"native",Cx=(e,t)=>_c(
|
|
1323
1323
|
e.transform,{checkOpen:!1})?Nx(e,t):Pc(e.transform)?Dg(e,t):kx(e,t),Nx=(e,t)=>(Ug(e,t,"Duplex stream"),"duplex"),Dg=(e,t)=>(Ug(
|
|
1324
1324
|
e,t,"web TransformStream"),"webTransform"),Ug=({final:e,binary:t,objectMode:r},n,o)=>{Lg(e,`${n}.final`,o),Lg(t,`${n}.bi\
|
|
@@ -1332,20 +1332,20 @@ if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must
|
|
|
1332
1332
|
e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",Bg=e=>Object.prototype.toString.call(e)==="[obj\
|
|
1333
1333
|
ect GeneratorFunction]",$x=e=>Y(e)&&(e.transform!==void 0||e.final!==void 0),Ei=e=>Object.prototype.toString.call(e)==="\
|
|
1334
1334
|
[object URL]",Gg=e=>Ei(e)&&e.protocol!=="file:",Lx=e=>Y(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>Mx.has(t))&&
|
|
1335
|
-
Rc(e.file),Mx=new Set(["file","append"]),Rc=e=>typeof e=="string",
|
|
1336
|
-
jx=new Set(["ipc","ignore","inherit","overlapped","pipe"]),
|
|
1337
|
-
ream]",_i=e=>Object.prototype.toString.call(e)==="[object WritableStream]",Dx=e=>
|
|
1335
|
+
Rc(e.file),Mx=new Set(["file","append"]),Rc=e=>typeof e=="string",Fg=(e,t)=>e==="native"&&typeof t=="string"&&!jx.has(t),
|
|
1336
|
+
jx=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Vg=e=>Object.prototype.toString.call(e)==="[object ReadableSt\
|
|
1337
|
+
ream]",_i=e=>Object.prototype.toString.call(e)==="[object WritableStream]",Dx=e=>Vg(e)||_i(e),Pc=e=>Vg(e?.readable)&&_i(
|
|
1338
1338
|
e?.writable),Ux=e=>zg(e)&&typeof e[Symbol.asyncIterator]=="function",Bx=e=>zg(e)&&typeof e[Symbol.iterator]=="function",
|
|
1339
|
-
zg=e=>typeof e=="object"&&e!==null,
|
|
1339
|
+
zg=e=>typeof e=="object"&&e!==null,ye=new Set(["generator","asyncGenerator","duplex","webTransform"]),Si=new Set(["fileU\
|
|
1340
1340
|
rl","filePath","fileNumber"]),Cc=new Set(["fileUrl","filePath"]),Hg=new Set([...Cc,"webStream","nodeStream"]),qg=new Set(
|
|
1341
1341
|
["webTransform","duplex"]),ot={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"\
|
|
1342
1342
|
a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"\
|
|
1343
1343
|
a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterab\
|
|
1344
|
-
le",string:"a string",uint8Array:"a Uint8Array"}});var Nc,Gx,
|
|
1345
|
-
return{writableObjectMode:n,readableObjectMode:e??n}},
|
|
1346
|
-
r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},Wg=(e,t)=>{let r=e.findLast(({type:n})=>
|
|
1347
|
-
return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var Yg,
|
|
1348
|
-
|
|
1344
|
+
le",string:"a string",uint8Array:"a Uint8Array"}});var Nc,Gx,Fx,Wg,kc=d(()=>{oe();Nc=(e,t,r,n)=>n==="output"?Gx(e,t,r):Fx(e,t,r),Gx=(e,t,r)=>{let n=t!==0&&r[t-1].value.readableObjectMode;
|
|
1345
|
+
return{writableObjectMode:n,readableObjectMode:e??n}},Fx=(e,t,r)=>{let n=t===0?e===!0:r[t-1].value.readableObjectMode,o=t!==
|
|
1346
|
+
r.length-1&&(e??n);return{writableObjectMode:n,readableObjectMode:o}},Wg=(e,t)=>{let r=e.findLast(({type:n})=>ye.has(n));
|
|
1347
|
+
return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var Yg,Vx,zx,Hx,qx,Wx,Yx,Jg=d(()=>{Ve();Ot();oe();kc();Yg=(e,t,r,n)=>[...e.filter(({type:o})=>!ye.has(o)),...Vx(e,t,r,n)],
|
|
1348
|
+
Vx=(e,t,r,{encoding:n})=>{let o=e.filter(({type:s})=>ye.has(s)),i=Array.from({length:o.length});for(let[s,a]of Object.entries(
|
|
1349
1349
|
o))i[s]=zx({stdioItem:a,index:Number(s),newTransforms:i,optionName:t,direction:r,encoding:n});return Yx(i,r)},zx=({stdioItem:e,
|
|
1350
1350
|
stdioItem:{type:t},index:r,newTransforms:n,optionName:o,direction:i,encoding:s})=>t==="duplex"?Hx({stdioItem:e,optionName:o}):
|
|
1351
1351
|
t==="webTransform"?qx({stdioItem:e,index:r,newTransforms:n,direction:i}):Wx({stdioItem:e,index:r,newTransforms:n,direction:i,
|
|
@@ -1358,226 +1358,226 @@ readableObjectMode:c}=Nc(s,r,n,o);return{...e,value:{transform:i,writableObjectM
|
|
|
1358
1358
|
stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,
|
|
1359
1359
|
objectMode:u}=Y(t)?t:{transform:t},p=c||pe.has(i),{writableObjectMode:f,readableObjectMode:h}=Nc(u,r,n,o);return{...e,value:{
|
|
1360
1360
|
transform:s,final:a,binary:p,preserveNewlines:l,writableObjectMode:f,readableObjectMode:h}}},Yx=(e,t)=>t==="input"?e.reverse():
|
|
1361
|
-
e});import $c from"node:process";var Kg,Jx,Kx,
|
|
1361
|
+
e});import $c from"node:process";var Kg,Jx,Kx,wr,Lc,Xg,Xx,Qx,Qg=d(()=>{xt();oe();Kg=(e,t,r)=>{let n=e.map(o=>Jx(o,t));if(n.includes(
|
|
1362
1362
|
"input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writabl\
|
|
1363
|
-
e values.`);return n.find(Boolean)??Qx},Jx=({type:e,value:t},r)=>Kx[r]??Xg[e](t),Kx=["input","output","output"],
|
|
1364
|
-
Lc=()=>"input",Xg={generator:
|
|
1365
|
-
e)?"output":"input",nodeStream(e){return At(e,{checkOpen:!1})?Ec(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:
|
|
1366
|
-
duplex:
|
|
1367
|
-
stdin].includes(e))return"input";if([1,2,$c.stdout,$c.stderr].includes(e))return"output"},Qx="output"});var Zg,
|
|
1368
|
-
return i?tR(s,r,o):Zg(s,t)},Zx=(e,t)=>{if(e===void 0)return
|
|
1369
|
-
to provide \`stdio\` in combination with one of ${
|
|
1363
|
+
e values.`);return n.find(Boolean)??Qx},Jx=({type:e,value:t},r)=>Kx[r]??Xg[e](t),Kx=["input","output","output"],wr=()=>{},
|
|
1364
|
+
Lc=()=>"input",Xg={generator:wr,asyncGenerator:wr,fileUrl:wr,filePath:wr,iterable:Lc,asyncIterable:Lc,uint8Array:Lc,webStream:e=>_i(
|
|
1365
|
+
e)?"output":"input",nodeStream(e){return At(e,{checkOpen:!1})?Ec(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:wr,
|
|
1366
|
+
duplex:wr,native(e){let t=Xx(e);if(t!==void 0)return t;if(Te(e,{checkOpen:!1}))return Xg.nodeStream(e)}},Xx=e=>{if([0,$c.
|
|
1367
|
+
stdin].includes(e))return"input";if([1,2,$c.stdout,$c.stderr].includes(e))return"output"},Qx="output"});var Zg,ew=d(()=>{Zg=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e});var tw,Zx,eR,rw,tR,rR,nw=d(()=>{He();ew();et();tw=({stdio:e,ipc:t,buffer:r,...n},o,i)=>{let s=Zx(e,n).map((a,c)=>rw(a,c));
|
|
1368
|
+
return i?tR(s,r,o):Zg(s,t)},Zx=(e,t)=>{if(e===void 0)return we.map(n=>t[n]);if(eR(t))throw new Error(`It's not possible \
|
|
1369
|
+
to provide \`stdio\` in combination with one of ${we.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];
|
|
1370
1370
|
if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);
|
|
1371
|
-
let r=Math.max(e.length,
|
|
1372
|
-
isArray(e)?e.map(r=>
|
|
1373
|
-
gnore":n),rR=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe")});import{readFileSync as nR}from"node:fs";import oR from"node:tty";var
|
|
1371
|
+
let r=Math.max(e.length,we.length);return Array.from({length:r},(n,o)=>e[o])},eR=e=>we.some(t=>e[t]!==void 0),rw=(e,t)=>Array.
|
|
1372
|
+
isArray(e)?e.map(r=>rw(r,t)):e??(t>=we.length?"ignore":"pipe"),tR=(e,t,r)=>e.map((n,o)=>!t[o]&&o!==0&&!or(r,o)&&rR(n)?"i\
|
|
1373
|
+
gnore":n),rR=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe")});import{readFileSync as nR}from"node:fs";import oR from"node:tty";var iw,iR,sR,aR,cR,ow,sw=d(()=>{xt();He();de();rt();iw=
|
|
1374
1374
|
({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:n,direction:o,isSync:i})=>!r||t!=="native"?e:i?iR({stdioItem:e,
|
|
1375
1375
|
fdNumber:n,direction:o}):cR({stdioItem:e,fdNumber:n}),iR=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n,direction:o})=>{
|
|
1376
|
-
let i=sR({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(
|
|
1376
|
+
let i=sR({value:t,optionName:r,fdNumber:n,direction:o});if(i!==void 0)return i;if(Te(t,{checkOpen:!1}))throw new TypeError(
|
|
1377
1377
|
`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},sR=({value:e,
|
|
1378
1378
|
optionName:t,fdNumber:r,direction:n})=>{let o=aR(e,r);if(o!==void 0){if(n==="output")return{type:"fileNumber",value:o,optionName:t};
|
|
1379
|
-
if(oR.isatty(o))throw new TypeError(`The \`${t}: ${
|
|
1379
|
+
if(oR.isatty(o))throw new TypeError(`The \`${t}: ${Vo(e)}\` option is invalid: it cannot be a TTY with synchronous method\
|
|
1380
1380
|
s.`);return{type:"uint8Array",value:ze(nR(o)),optionName:t}}},aR=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")
|
|
1381
1381
|
return e;let r=So.indexOf(e);if(r!==-1)return r},cR=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:n})=>t==="in\
|
|
1382
|
-
herit"?{type:"nodeStream",value:
|
|
1383
|
-
|
|
1384
|
-
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n}});var
|
|
1382
|
+
herit"?{type:"nodeStream",value:ow(n,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:ow(t,t,r),optionName:r}:
|
|
1383
|
+
Te(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,ow=(e,t,r)=>{let n=So[e];if(n===void 0)throw new TypeError(
|
|
1384
|
+
`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return n}});var aw,lR,uR,dR,pR,cw=d(()=>{xt();de();oe();aw=({input:e,inputFile:t},r)=>r===0?[...lR(e),...dR(t)]:[],lR=e=>e===void 0?
|
|
1385
1385
|
[]:[{type:uR(e),value:e,optionName:"input"}],uR=e=>{if(At(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"\
|
|
1386
1386
|
string";if(K(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Reada\
|
|
1387
1387
|
ble stream.")},dR=e=>e===void 0?[]:[{...pR(e),optionName:"inputFile"}],pR=e=>{if(Ei(e))return{type:"fileUrl",value:e};if(Rc(
|
|
1388
1388
|
e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file U\
|
|
1389
|
-
RL.")}});var
|
|
1390
|
-
ator"||t.type==="asyncGenerator")),
|
|
1389
|
+
RL.")}});var lw,uw,mR,fR,dw,hR,gR,pw,mw=d(()=>{oe();lw=e=>e.filter((t,r)=>e.every((n,o)=>t.value!==n.value||r>=o||t.type==="gener\
|
|
1390
|
+
ator"||t.type==="asyncGenerator")),uw=({stdioItem:{type:e,value:t,optionName:r},direction:n,fileDescriptors:o,isSync:i})=>{
|
|
1391
1391
|
let s=mR(o,e);if(s.length!==0){if(i){fR({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});return}if(Hg.has(e))
|
|
1392
|
-
return
|
|
1392
|
+
return dw({otherStdioItems:s,type:e,value:t,optionName:r,direction:n});qg.has(e)&&gR({otherStdioItems:s,type:e,value:t,optionName:r})}},
|
|
1393
1393
|
mR=(e,t)=>e.flatMap(({direction:r,stdioItems:n})=>n.filter(o=>o.type===t).map((o=>({...o,direction:r})))),fR=({otherStdioItems:e,
|
|
1394
|
-
type:t,value:r,optionName:n,direction:o})=>{Cc.has(t)&&
|
|
1395
|
-
|
|
1396
|
-
find(a=>a.direction!==o);return
|
|
1394
|
+
type:t,value:r,optionName:n,direction:o})=>{Cc.has(t)&&dw({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})},
|
|
1395
|
+
dw=({otherStdioItems:e,type:t,value:r,optionName:n,direction:o})=>{let i=e.filter(a=>hR(a,r));if(i.length===0)return;let s=i.
|
|
1396
|
+
find(a=>a.direction!==o);return pw(s,n,t),o==="output"?i[0].stream:void 0},hR=({type:e,value:t},r)=>e==="filePath"?t.file===
|
|
1397
1397
|
r.file:e==="fileUrl"?t.href===r.href:t===r,gR=({otherStdioItems:e,type:t,value:r,optionName:n})=>{let o=e.find(({value:{
|
|
1398
|
-
transform:i}})=>i===r.transform);
|
|
1399
|
-
\` options must not target ${ot[r]} that is the same.`)}});var
|
|
1400
|
-
t,r,n).map((a,c)=>
|
|
1401
|
-
isSync:n});return t.stdio=s.map(({stdioItems:a})=>xR(a)),s},
|
|
1402
|
-
t),{stdioItems:i,isStdioArray:s}=
|
|
1403
|
-
isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=Yg(c,o,a,r),u=Wg(l,a);return
|
|
1404
|
-
|
|
1405
|
-
s=
|
|
1398
|
+
transform:i}})=>i===r.transform);pw(o,n,t)},pw=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\
|
|
1399
|
+
\` options must not target ${ot[r]} that is the same.`)}});var Ti,wR,yR,bR,ER,_R,SR,TR,vR,IR,OR,AR,Mc,xR,vi=d(()=>{He();Jg();kc();oe();Qg();nw();sw();cw();mw();Ti=(e,t,r,n)=>{let i=tw(
|
|
1400
|
+
t,r,n).map((a,c)=>wR({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=IR({initialFileDescriptors:i,addProperties:e,options:t,
|
|
1401
|
+
isSync:n});return t.stdio=s.map(({stdioItems:a})=>xR(a)),s},wR=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o=To(
|
|
1402
|
+
t),{stdioItems:i,isStdioArray:s}=yR({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Kg(i,t,o),c=i.map(p=>iw({stdioItem:p,
|
|
1403
|
+
isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=Yg(c,o,a,r),u=Wg(l,a);return vR(l,u),{direction:a,objectMode:u,stdioItems:l}},
|
|
1404
|
+
yR=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).map(c=>bR(c,n)),...aw(r,t)],
|
|
1405
|
+
s=lw(i),a=s.length>1;return ER(s,a,n),SR(s),{stdioItems:s,isStdioArray:a}},bR=(e,t)=>({type:jg(e,t),value:e,optionName:t}),
|
|
1406
1406
|
ER=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:n,
|
|
1407
1407
|
optionName:o}of e)if(_R.has(n))throw new Error(`The \`${o}\` option must not include \`${n}\`.`)}},_R=new Set(["ignore",
|
|
1408
|
-
"ipc"]),SR=e=>{for(let t of e)
|
|
1408
|
+
"ipc"]),SR=e=>{for(let t of e)TR(t)},TR=({type:e,value:t,optionName:r})=>{if(Gg(t))throw new TypeError(`The \`${r}: URL\`\
|
|
1409
1409
|
option must use the \`file:\` scheme.
|
|
1410
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
1411
|
-
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},
|
|
1410
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Fg(e,t))throw new TypeError(`Th\
|
|
1411
|
+
e \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},vR=(e,t)=>{if(!t)return;let r=e.find(({type:n})=>Si.
|
|
1412
1412
|
has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectM\
|
|
1413
1413
|
ode.`)},IR=({initialFileDescriptors:e,addProperties:t,options:r,isSync:n})=>{let o=[];try{for(let i of e)o.push(OR({fileDescriptor:i,
|
|
1414
1414
|
fileDescriptors:o,addProperties:t,options:r,isSync:n}));return o}catch(i){throw Mc(o),i}},OR=({fileDescriptor:{direction:e,
|
|
1415
1415
|
objectMode:t,stdioItems:r},fileDescriptors:n,addProperties:o,options:i,isSync:s})=>{let a=r.map(c=>AR({stdioItem:c,addProperties:o,
|
|
1416
1416
|
direction:e,options:i,fileDescriptors:n,isSync:s}));return{direction:e,objectMode:t,stdioItems:a}},AR=({stdioItem:e,addProperties:t,
|
|
1417
|
-
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=
|
|
1417
|
+
direction:r,options:n,fileDescriptors:o,isSync:i})=>{let s=uw({stdioItem:e,direction:r,fileDescriptors:o,isSync:i});return s!==
|
|
1418
1418
|
void 0?{...e,stream:s}:{...e,...t[r][e.type](e,n)}},Mc=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!Ee(
|
|
1419
1419
|
r)&&r.destroy()},xR=e=>{if(e.length>1)return e.some(({value:n})=>n==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;
|
|
1420
|
-
return t==="native"?r:"pipe"}});import{readFileSync as
|
|
1421
|
-
optionName:t})=>{
|
|
1422
|
-
throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},
|
|
1423
|
-
webStream:Ne,nodeStream:Ne,webTransform:Ne,duplex:Ne,asyncIterable:Ne,native:RR},PR={input:{...
|
|
1424
|
-
contents:[ze(
|
|
1425
|
-
...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...
|
|
1420
|
+
return t==="native"?r:"pipe"}});import{readFileSync as fw}from"node:fs";var gw,Ne,RR,ww,hw,PR,yw=d(()=>{de();vi();oe();gw=(e,t)=>Ti(PR,e,t,!0),Ne=({type:e,
|
|
1421
|
+
optionName:t})=>{ww(t,ot[e])},RR=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&ww(e,`"${t}"`),{}),ww=(e,t)=>{
|
|
1422
|
+
throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},hw={generator(){},asyncGenerator:Ne,
|
|
1423
|
+
webStream:Ne,nodeStream:Ne,webTransform:Ne,duplex:Ne,asyncIterable:Ne,native:RR},PR={input:{...hw,fileUrl:({value:e})=>({
|
|
1424
|
+
contents:[ze(fw(e))]}),filePath:({value:{file:e}})=>({contents:[ze(fw(e))]}),fileNumber:Ne,iterable:({value:e})=>({contents:[
|
|
1425
|
+
...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...hw,fileUrl:({value:e})=>({
|
|
1426
1426
|
path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Ne,string:Ne,
|
|
1427
|
-
uint8Array:Ne}}});var Je,jc,ln=d(()=>{bc();Je=(e,{stripFinalNewline:t},r)=>jc(t,r)&&e!==void 0&&!Array.isArray(e)?
|
|
1428
|
-
ll"?e[1]||e[2]:e[t]});var Ii,Uc,
|
|
1429
|
-
|
|
1427
|
+
uint8Array:Ne}}});var Je,jc,ln=d(()=>{bc();Je=(e,{stripFinalNewline:t},r)=>jc(t,r)&&e!==void 0&&!Array.isArray(e)?mr(e):e,jc=(e,t)=>t==="a\
|
|
1428
|
+
ll"?e[1]||e[2]:e[t]});var Ii,Uc,bw,Ew,CR,NR,kR,_w,$R,Dc,LR,MR,jR,Oi=d(()=>{Ii=(e,t,r,n)=>e||r?void 0:Ew(t,n),Uc=(e,t,r)=>r?e.flatMap(n=>bw(n,t)):
|
|
1429
|
+
bw(e,t),bw=(e,t)=>{let{transform:r,final:n}=Ew(t,{});return[...r(e),...n()]},Ew=(e,t)=>(t.previousChunks="",{transform:CR.
|
|
1430
1430
|
bind(void 0,t,e),final:kR.bind(void 0,t)}),CR=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=e,
|
|
1431
1431
|
o=-1;for(let i=0;i<r.length;i+=1)if(r[i]===`
|
|
1432
1432
|
`){let s=NR(r,i,t,e),a=r.slice(o+1,i+1-s);n.length>0&&(a=Dc(n,a),n=""),yield a,o=i}o!==r.length-1&&(n=Dc(n,r.slice(o+1))),
|
|
1433
1433
|
e.previousChunks=n},NR=(e,t,r,n)=>r?0:(n.isWindowsNewline=t!==0&&e[t-1]==="\r",n.isWindowsNewline?2:1),kR=function*({previousChunks:e}){
|
|
1434
|
-
e.length>0&&(yield e)},
|
|
1434
|
+
e.length>0&&(yield e)},_w=({binary:e,preserveNewlines:t,readableObjectMode:r,state:n})=>e||t||r?void 0:{transform:$R.bind(
|
|
1435
1435
|
void 0,n)},$R=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:n,LF:o,concatBytes:i}=typeof t=="str\
|
|
1436
1436
|
ing"?LR:jR;if(t.at(-1)===o){yield t;return}yield i(t,e?n:r)},Dc=(e,t)=>`${e}${t}`,LR={windowsNewline:`\r
|
|
1437
1437
|
`,unixNewline:`
|
|
1438
1438
|
`,LF:`
|
|
1439
1439
|
`,concatBytes:Dc},MR=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},jR={windowsNewline:new Uint8Array(
|
|
1440
|
-
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:MR}});import{Buffer as DR}from"node:buffer";var
|
|
1440
|
+
[13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:MR}});import{Buffer as DR}from"node:buffer";var Sw,UR,Tw,BR,GR,vw,Iw=d(()=>{de();Sw=(e,t)=>e?void 0:UR.bind(void 0,t),UR=function*(e,t){
|
|
1441
1441
|
if(typeof t!="string"&&!K(t)&&!DR.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: \
|
|
1442
|
-
true" to receive as input: ${typeof t}.`);yield t},
|
|
1443
|
-
e,t),yield t},GR=function*(e,t){if(
|
|
1444
|
-
must yield a string or an Uint8Array, not ${typeof t}.`);yield t},
|
|
1442
|
+
true" to receive as input: ${typeof t}.`);yield t},Tw=(e,t)=>e?BR.bind(void 0,t):GR.bind(void 0,t),BR=function*(e,t){vw(
|
|
1443
|
+
e,t),yield t},GR=function*(e,t){if(vw(e,t),typeof t!="string"&&!K(t))throw new TypeError(`The \`${e}\` option's function \
|
|
1444
|
+
must yield a string or an Uint8Array, not ${typeof t}.`);yield t},vw=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\`\
|
|
1445
1445
|
option's function must not call \`yield ${t}\`.
|
|
1446
1446
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
1447
|
-
if (condition) { yield value; }`)}});import{Buffer as
|
|
1448
|
-
Ai=(e,t,r)=>{if(r)return;if(e)return{transform:zR.bind(void 0,new TextEncoder)};let n=new
|
|
1449
|
-
void 0,n),final:qR.bind(void 0,n)}},zR=function*(e,t){
|
|
1450
|
-
HR=function*(e,t){yield K(t)?e.write(t):t},qR=function*(e){let t=e.end();t!==""&&(yield t)}});import{callbackify as
|
|
1447
|
+
if (condition) { yield value; }`)}});import{Buffer as FR}from"node:buffer";import{StringDecoder as VR}from"node:string_decoder";var Ai,zR,HR,qR,Bc=d(()=>{de();
|
|
1448
|
+
Ai=(e,t,r)=>{if(r)return;if(e)return{transform:zR.bind(void 0,new TextEncoder)};let n=new VR(t);return{transform:HR.bind(
|
|
1449
|
+
void 0,n),final:qR.bind(void 0,n)}},zR=function*(e,t){FR.isBuffer(t)?yield ze(t):typeof t=="string"?yield e.encode(t):yield t},
|
|
1450
|
+
HR=function*(e,t){yield K(t)?e.write(t):t},qR=function*(e){let t=e.end();t!==""&&(yield t)}});import{callbackify as Ow}from"node:util";var Gc,xi,Aw,WR,xw,YR,Rw=d(()=>{Gc=Ow(async(e,t,r,n)=>{t.currentIterable=e(...r);
|
|
1451
1451
|
try{for await(let o of t.currentIterable)n.push(o)}finally{delete t.currentIterable}}),xi=async function*(e,t,r){if(r===
|
|
1452
|
-
t.length){yield e;return}let{transform:n=YR}=t[r];for await(let o of n(e))yield*xi(o,t,r+1)},
|
|
1452
|
+
t.length){yield e;return}let{transform:n=YR}=t[r];for await(let o of n(e))yield*xi(o,t,r+1)},Aw=async function*(e){for(let[
|
|
1453
1453
|
t,{final:r}]of Object.entries(e))yield*WR(r,Number(t),e)},WR=async function*(e,t,r){if(e!==void 0)for await(let n of e())
|
|
1454
|
-
yield*xi(n,r,t+1)},
|
|
1455
|
-
YR=function*(e){yield e}});var
|
|
1454
|
+
yield*xi(n,r,t+1)},xw=Ow(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),
|
|
1455
|
+
YR=function*(e){yield e}});var Fc,Pw,Ct,un,JR,KR,Vc=d(()=>{Fc=(e,t,r,n)=>{try{for(let o of e(...t))r.push(o);n()}catch(o){n(o)}},Pw=(e,t)=>[...t.flatMap(
|
|
1456
1456
|
r=>[...Ct(r,e,0)]),...un(e)],Ct=function*(e,t,r){if(r===t.length){yield e;return}let{transform:n=KR}=t[r];for(let o of n(
|
|
1457
1457
|
e))yield*Ct(o,t,r+1)},un=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*JR(r,Number(t),e)},JR=function*(e,t,r){
|
|
1458
|
-
if(e!==void 0)for(let n of e())yield*Ct(n,r,t+1)},KR=function*(e){yield e}});import{Transform as XR,getDefaultHighWaterMark as
|
|
1458
|
+
if(e!==void 0)for(let n of e())yield*Ct(n,r,t+1)},KR=function*(e){yield e}});import{Transform as XR,getDefaultHighWaterMark as Cw}from"node:stream";var zc,Ri,Nw,Pi=d(()=>{oe();Oi();Iw();Bc();Rw();Vc();
|
|
1459
1459
|
zc=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
1460
|
-
c=
|
|
1461
|
-
u?
|
|
1460
|
+
c=Nw(e,s,i),l=Pt(t),u=Pt(r),p=l?Gc.bind(void 0,xi,a):Fc.bind(void 0,Ct),f=l||u?Gc.bind(void 0,Aw,a):Fc.bind(void 0,un),h=l||
|
|
1461
|
+
u?xw.bind(void 0,a):void 0;return{stream:new XR({writableObjectMode:n,writableHighWaterMark:Cw(n),readableObjectMode:o,readableHighWaterMark:Cw(
|
|
1462
1462
|
o),transform(E,_,m){p([E,c,0],this,m)},flush(E){f([c],this,E)},destroy:h})}},Ri=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
1463
|
-
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=
|
|
1464
|
-
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:
|
|
1465
|
-
n),Ii(r,i,n,c),{transform:e,final:t},{transform:
|
|
1466
|
-
filter(Boolean)}});var
|
|
1463
|
+
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=Nw(s,r,a);e=Pw(c,e)}return e},Nw=({transform:e,final:t,
|
|
1464
|
+
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Sw(n,a)},Ai(r,s,
|
|
1465
|
+
n),Ii(r,i,n,c),{transform:e,final:t},{transform:Tw(o,a)},_w({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
1466
|
+
filter(Boolean)}});var kw,QR,ZR,eP,tP,$w=d(()=>{Pi();de();oe();kw=(e,t)=>{for(let r of QR(e))ZR(e,r,t)},QR=e=>new Set(Object.entries(e).filter(
|
|
1467
1467
|
([,{direction:t}])=>t==="input").map(([t])=>Number(t))),ZR=(e,t,r)=>{let{stdioItems:n}=e[t],o=n.filter(({contents:a})=>a!==
|
|
1468
1468
|
void 0);if(o.length===0)return;if(t!==0){let[{type:a,optionName:c}]=o;throw new TypeError(`Only the \`stdin\` option, not \
|
|
1469
1469
|
\`${c}\`, can be ${ot[a]} with synchronous methods.`)}let s=o.map(({contents:a})=>a).map(a=>eP(a,n));r.input=Wr(s)},eP=(e,t)=>{
|
|
1470
1470
|
let r=Ri(e,t,"utf8",!0);return tP(r),Wr(r)},tP=e=>{let t=e.find(r=>typeof r!="string"&&!K(r));if(t!==void 0)throw new TypeError(
|
|
1471
1471
|
`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or \
|
|
1472
|
-
Uint8Arrays: ${t}.`)}});var Ci,rP,nP,
|
|
1473
|
-
|
|
1474
|
-
1||e===2,nP=new Set(["pipe","overlapped"]),
|
|
1475
|
-
|
|
1476
|
-
verboseInfo:r})}});import{writeFileSync as iP,appendFileSync as sP}from"node:fs";var
|
|
1477
|
-
|
|
1472
|
+
Uint8Arrays: ${t}.`)}});var Ci,rP,nP,Lw,Mw,oP,jw,Hc=d(()=>{Ot();oe();ir();et();Ci=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:n})=>n!=="all"&&
|
|
1473
|
+
or(r,n)&&!pe.has(t)&&rP(n)&&(e.some(({type:o,value:i})=>o==="native"&&nP.has(i))||e.every(({type:o})=>ye.has(o))),rP=e=>e===
|
|
1474
|
+
1||e===2,nP=new Set(["pipe","overlapped"]),Lw=async(e,t,r,n)=>{for await(let o of e)oP(t)||jw(o,r,n)},Mw=(e,t,r)=>{for(let n of e)
|
|
1475
|
+
jw(n,t,r)},oP=e=>e._readableState.pipes.length>0,jw=(e,t,r)=>{let n=Po(e);xe({type:"output",verboseMessage:n,fdNumber:t,
|
|
1476
|
+
verboseInfo:r})}});import{writeFileSync as iP,appendFileSync as sP}from"node:fs";var Dw,aP,cP,lP,uP,dP,Uw=d(()=>{Hc();Pi();Oi();de();oe();Rt();
|
|
1477
|
+
Dw=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.from(
|
|
1478
1478
|
{length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>aP({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
1479
1479
|
isMaxBuffer:n,verboseInfo:o},r)),...i}},aP=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
1480
|
-
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:p})=>{if(e===null)return;let f=
|
|
1481
|
-
objectMode:E}=t[r],_=cP([h],
|
|
1482
|
-
fdNumber:r});uP({serializedResult:m,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:
|
|
1483
|
-
void 0;try{return n.error===void 0&&dP(m,
|
|
1480
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:p})=>{if(e===null)return;let f=Tg(e,i,p),h=ze(f),{stdioItems:w,
|
|
1481
|
+
objectMode:E}=t[r],_=cP([h],w,c,n),{serializedResult:m,finalResult:g=m}=lP({chunks:_,objectMode:E,encoding:c,lines:l,stripFinalNewline:u,
|
|
1482
|
+
fdNumber:r});uP({serializedResult:m,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:w,objectMode:E});let y=a[r]?g:
|
|
1483
|
+
void 0;try{return n.error===void 0&&dP(m,w,o),y}catch(S){return n.error=S,y}},cP=(e,t,r,n)=>{try{return Ri(e,t,r,!1)}catch(o){
|
|
1484
1484
|
return n.error=o,e}},lP=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
1485
1485
|
if(r==="buffer")return{serializedResult:Wr(e)};let s=pm(e,r);return n[i]?{serializedResult:s,finalResult:Uc(s,!o[i],t)}:
|
|
1486
1486
|
{serializedResult:s}},uP=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
1487
|
-
if(!Ci({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Uc(e,!1,s);try{
|
|
1487
|
+
if(!Ci({stdioItems:i,encoding:o,verboseInfo:n,fdNumber:t}))return;let a=Uc(e,!1,s);try{Mw(a,t,n)}catch(c){r.error??=c}},
|
|
1488
1488
|
dP=(e,t,r)=>{for(let{path:n,append:o}of t.filter(({type:i})=>Si.has(i))){let i=typeof n=="string"?n:n.toString();o||r.has(
|
|
1489
|
-
i)?sP(n,e):(r.add(i),iP(n,e))}}});var
|
|
1490
|
-
...e,...t]:[...e,Je(t,r,"all")]:Array.isArray(t)?[Je(e,r,"all"),...t]:K(e)&&K(t)?$a([e,t]):`${e}${t}`}});import{once as qc}from"node:events";var
|
|
1489
|
+
i)?sP(n,e):(r.add(i),iP(n,e))}}});var Bw,Gw=d(()=>{de();ln();Bw=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[
|
|
1490
|
+
...e,...t]:[...e,Je(t,r,"all")]:Array.isArray(t)?[Je(e,r,"all"),...t]:K(e)&&K(t)?$a([e,t]):`${e}${t}`}});import{once as qc}from"node:events";var Fw,pP,Vw,zw,mP,Wc,Yc=d(()=>{vt();Fw=async(e,t)=>{let[r,n]=await pP(e);return t.isForcefullyTerminated??=
|
|
1491
1491
|
!1,[r,n]},pP=async e=>{let[t,r]=await Promise.allSettled([qc(e,"spawn"),qc(e,"exit")]);return t.status==="rejected"?[]:r.
|
|
1492
|
-
status==="rejected"?
|
|
1493
|
-
if(!mP(t,r)&&Wc(t,r))throw new _e;return[t,r]},mP=(e,t)=>e===void 0&&t===void 0,Wc=(e,t)=>e!==0||t!==null});var
|
|
1492
|
+
status==="rejected"?Vw(e):r.value},Vw=async e=>{try{return await qc(e,"exit")}catch{return Vw(e)}},zw=async e=>{let[t,r]=await e;
|
|
1493
|
+
if(!mP(t,r)&&Wc(t,r))throw new _e;return[t,r]},mP=(e,t)=>e===void 0&&t===void 0,Wc=(e,t)=>e!==0||t!==null});var Hw,fP,qw=d(()=>{vt();Rt();Yc();Hw=({error:e,status:t,signal:r,output:n},{maxBuffer:o})=>{let i=fP(e,t,r),s=i?.code===
|
|
1494
1494
|
"ETIMEDOUT",a=Sg(i,n,o);return{resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},fP=(e,t,r)=>e!==void 0?e:Wc(
|
|
1495
|
-
t,r)?new _e:void 0});import{spawnSync as hP}from"node:child_process";var
|
|
1496
|
-
$
|
|
1495
|
+
t,r)?new _e:void 0});import{spawnSync as hP}from"node:child_process";var Ww,gP,wP,yP,Ni,bP,EP,_P,SP,Yw=d(()=>{Va();wc();yc();cn();bi();yw();ln();
|
|
1496
|
+
$w();Uw();Rt();Gw();qw();Ww=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,
|
|
1497
1497
|
options:l,fileDescriptors:u}=gP(e,t,r),p=bP({file:n,commandArguments:o,options:l,command:i,escapedCommand:s,verboseInfo:c,
|
|
1498
|
-
fileDescriptors:u,startTime:a});return
|
|
1499
|
-
e,t,r),a=
|
|
1500
|
-
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:p}},
|
|
1498
|
+
fileDescriptors:u,startTime:a});return gr(p,c,l)},gP=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=ko(
|
|
1499
|
+
e,t,r),a=wP(r),{file:c,commandArguments:l,options:u}=si(e,t,a);yP(u);let p=gw(u,s);return{file:c,commandArguments:l,command:n,
|
|
1500
|
+
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:p}},wP=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,yP=({ipc:e,
|
|
1501
1501
|
ipcInput:t,detached:r,cancelSignal:n})=>{t&&Ni("ipcInput"),e&&Ni("ipc: true"),r&&Ni("detached: true"),n&&Ni("cancelSigna\
|
|
1502
1502
|
l")},Ni=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},bP=({file:e,commandArguments:t,
|
|
1503
1503
|
options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=EP({file:e,commandArguments:t,
|
|
1504
1504
|
options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:p,
|
|
1505
|
-
timedOut:f,isMaxBuffer:h}=
|
|
1506
|
-
_=
|
|
1505
|
+
timedOut:f,isMaxBuffer:h}=Hw(c,r),{output:w,error:E=l}=Dw({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:h,verboseInfo:i}),
|
|
1506
|
+
_=w.map((g,y)=>Je(g,r,y)),m=Je(Bw(w,r),r,"all");return SP({error:E,exitCode:u,signal:p,timedOut:f,isMaxBuffer:h,stdio:_,
|
|
1507
1507
|
all:m,options:r,command:n,escapedCommand:o,startTime:a})},EP=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,
|
|
1508
|
-
fileDescriptors:i,startTime:s})=>{try{
|
|
1508
|
+
fileDescriptors:i,startTime:s})=>{try{kw(i,r);let a=_P(r);return hP(...ai(e,t,a))}catch(a){return hr({error:a,command:n,
|
|
1509
1509
|
escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},_P=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"\
|
|
1510
|
-
buffer",maxBuffer:
|
|
1511
|
-
startTime:u})=>e===void 0?
|
|
1510
|
+
buffer",maxBuffer:wi(t)}),SP=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:l,
|
|
1511
|
+
startTime:u})=>e===void 0?yi({command:c,escapedCommand:l,stdio:i,all:s,ipcOutput:[],options:a,startTime:u}):an({error:e,
|
|
1512
1512
|
command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:o,isForcefullyTerminated:!1,exitCode:t,
|
|
1513
|
-
signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as Jc,on as
|
|
1514
|
-
ipc:n},{reference:o=!0,filter:i}={})=>(
|
|
1515
|
-
channel:t,isSubprocess:r,filter:i,reference:o})),
|
|
1516
|
-
qo(t,o);let i=nt(e,t,r),s=new AbortController;try{return await Promise.race([IP(i,n,s),OP(i,r,s),AP(i,r,s)])}catch(a){throw
|
|
1513
|
+
signal:r,stdio:i,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as Jc,on as TP}from"node:events";var Jw,vP,IP,OP,AP,Kw=d(()=>{ur();tn();en();Jw=({anyProcess:e,channel:t,isSubprocess:r,
|
|
1514
|
+
ipc:n},{reference:o=!0,filter:i}={})=>(cr({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Zo(e)}),vP({anyProcess:e,
|
|
1515
|
+
channel:t,isSubprocess:r,filter:i,reference:o})),vP=async({anyProcess:e,channel:t,isSubprocess:r,filter:n,reference:o})=>{
|
|
1516
|
+
qo(t,o);let i=nt(e,t,r),s=new AbortController;try{return await Promise.race([IP(i,n,s),OP(i,r,s),AP(i,r,s)])}catch(a){throw lr(
|
|
1517
1517
|
e),a}finally{s.abort(),Wo(t,o)}},IP=async(e,t,{signal:r})=>{if(t===void 0){let[n]=await Jc(e,"message",{signal:r});return n}
|
|
1518
|
-
for await(let[n]of
|
|
1519
|
-
ah(t)},AP=async(e,t,{signal:r})=>{let[n]=await Jc(e,"strict:error",{signal:r});throw
|
|
1518
|
+
for await(let[n]of TP(e,"message",{signal:r}))if(t(n))return n},OP=async(e,t,{signal:r})=>{await Jc(e,"disconnect",{signal:r}),
|
|
1519
|
+
ah(t)},AP=async(e,t,{signal:r})=>{let[n]=await Jc(e,"strict:error",{signal:r});throw Fo(n,t)}});import{once as Qw,on as xP}from"node:events";var Zw,Kc,RP,PP,CP,Xw,Xc=d(()=>{ur();tn();en();Zw=({anyProcess:e,channel:t,
|
|
1520
1520
|
isSubprocess:r,ipc:n},{reference:o=!0}={})=>Kc({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:!r,reference:o}),
|
|
1521
|
-
Kc=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{
|
|
1521
|
+
Kc=({anyProcess:e,channel:t,isSubprocess:r,ipc:n,shouldAwait:o,reference:i})=>{cr({methodName:"getEachMessage",isSubprocess:r,
|
|
1522
1522
|
ipc:n,isConnected:Zo(e)}),qo(t,i);let s=nt(e,t,r),a=new AbortController,c={};return RP(e,s,a),PP({ipcEmitter:s,isSubprocess:r,
|
|
1523
1523
|
controller:a,state:c}),CP({anyProcess:e,channel:t,ipcEmitter:s,isSubprocess:r,shouldAwait:o,controller:a,state:c,reference:i})},
|
|
1524
|
-
RP=async(e,t,r)=>{try{await
|
|
1525
|
-
controller:r,state:n})=>{try{let[o]=await
|
|
1524
|
+
RP=async(e,t,r)=>{try{await Qw(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},PP=async({ipcEmitter:e,isSubprocess:t,
|
|
1525
|
+
controller:r,state:n})=>{try{let[o]=await Qw(e,"strict:error",{signal:r.signal});n.error=Fo(o,t),r.abort()}catch{}},CP=async function*({
|
|
1526
1526
|
anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:n,shouldAwait:o,controller:i,state:s,reference:a}){try{for await(let[c]of xP(
|
|
1527
|
-
r,"message",{signal:i.signal}))
|
|
1528
|
-
if(e)throw e}});import
|
|
1529
|
-
()=>{let e=
|
|
1530
|
-
isSubprocess:t,ipc:r})}},
|
|
1531
|
-
getOneMessage:
|
|
1527
|
+
r,"message",{signal:i.signal}))Xw(s),yield c}catch{Xw(s)}finally{i.abort(),Wo(t,a),n||lr(e),o&&await e}},Xw=({error:e})=>{
|
|
1528
|
+
if(e)throw e}});import ey from"node:process";var ty,ry,ny,Qc=d(()=>{oi();Kw();Xc();Xo();ty=(e,{ipc:t})=>{Object.assign(e,ny(e,!1,t))},ry=
|
|
1529
|
+
()=>{let e=ey,t=!0,r=ey.channel!==void 0;return{...ny(e,t,r),getCancelSignal:Lh.bind(void 0,{anyProcess:e,channel:e.channel,
|
|
1530
|
+
isSubprocess:t,ipc:r})}},ny=(e,t,r)=>({sendMessage:ni.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),
|
|
1531
|
+
getOneMessage:Jw.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:Zw.bind(void 0,{anyProcess:e,
|
|
1532
1532
|
channel:e.channel,isSubprocess:t,ipc:r})})});import{ChildProcess as NP}from"node:child_process";import{PassThrough as kP,Readable as $P,Writable as LP,Duplex as MP}from"node:stream";
|
|
1533
|
-
var
|
|
1534
|
-
verboseInfo:s})=>{Mc(n);let a=new NP;jP(a,n),Object.assign(a,{readable:DP,writable:UP,duplex:BP});let c=
|
|
1533
|
+
var oy,jP,dn,DP,UP,BP,GP,iy=d(()=>{vi();cn();bi();oy=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,
|
|
1534
|
+
verboseInfo:s})=>{Mc(n);let a=new NP;jP(a,n),Object.assign(a,{readable:DP,writable:UP,duplex:BP});let c=hr({error:e,command:t,
|
|
1535
1535
|
escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:!1}),l=GP(c,s,o);return{subprocess:a,promise:l}},jP=(e,t)=>{
|
|
1536
1536
|
let r=dn(),n=dn(),o=dn(),i=Array.from({length:t.length-3},dn),s=dn(),a=[r,n,o,...i];Object.assign(e,{stdin:r,stdout:n,stderr:o,
|
|
1537
1537
|
all:s,stdio:a})},dn=()=>{let e=new kP;return e.end(),e},DP=()=>new $P({read(){}}),UP=()=>new LP({write(){}}),BP=()=>new MP(
|
|
1538
|
-
{read(){},write(){}}),GP=async(e,t,r)=>
|
|
1539
|
-
Writable as
|
|
1540
|
-
optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${ot[e]}.`)},
|
|
1538
|
+
{read(){},write(){}}),GP=async(e,t,r)=>gr(e,t,r)});import{createReadStream as sy,createWriteStream as ay}from"node:fs";import{Buffer as FP}from"node:buffer";import{Readable as pn,
|
|
1539
|
+
Writable as VP,Duplex as zP}from"node:stream";var ly,mn,cy,HP,uy=d(()=>{Pi();vi();oe();ly=(e,t)=>Ti(HP,e,t,!1),mn=({type:e,
|
|
1540
|
+
optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${ot[e]}.`)},cy={fileNumber:mn,generator:zc,asyncGenerator:zc,
|
|
1541
1541
|
nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let n=t||
|
|
1542
|
-
r;return{stream:zP.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},HP={input:{...
|
|
1543
|
-
fileUrl:({value:e})=>({stream:
|
|
1542
|
+
r;return{stream:zP.fromWeb(e,{objectMode:n})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},HP={input:{...cy,
|
|
1543
|
+
fileUrl:({value:e})=>({stream:sy(e)}),filePath:({value:{file:e}})=>({stream:sy(e)}),webStream:({value:e})=>({stream:pn.fromWeb(
|
|
1544
1544
|
e)}),iterable:({value:e})=>({stream:pn.from(e)}),asyncIterable:({value:e})=>({stream:pn.from(e)}),string:({value:e})=>({
|
|
1545
|
-
stream:pn.from(e)}),uint8Array:({value:e})=>({stream:pn.from(
|
|
1546
|
-
e)}),filePath:({value:{file:e,append:t}})=>({stream:
|
|
1547
|
-
e)}),iterable:mn,asyncIterable:mn,string:mn,uint8Array:mn}}});import{on as qP,once as
|
|
1548
|
-
finished as
|
|
1545
|
+
stream:pn.from(e)}),uint8Array:({value:e})=>({stream:pn.from(FP.from(e))})},output:{...cy,fileUrl:({value:e})=>({stream:ay(
|
|
1546
|
+
e)}),filePath:({value:{file:e,append:t}})=>({stream:ay(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:VP.fromWeb(
|
|
1547
|
+
e)}),iterable:mn,asyncIterable:mn,string:mn,uint8Array:mn}}});import{on as qP,once as dy}from"node:events";import{PassThrough as WP,getDefaultHighWaterMark as YP}from"node:stream";import{
|
|
1548
|
+
finished as fy}from"node:stream/promises";function Nt(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, go\
|
|
1549
1549
|
t \`${typeof e}\`.`);for(let o of e)el(o);let t=e.some(({readableObjectMode:o})=>o),r=JP(e,t),n=new Zc({objectMode:t,writableHighWaterMark:r,
|
|
1550
|
-
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var JP,Zc,KP,XP,QP,el,ZP,eC,tC,rC,nC,
|
|
1550
|
+
readableHighWaterMark:r});for(let o of e)n.add(o);return n}var JP,Zc,KP,XP,QP,el,ZP,eC,tC,rC,nC,hy,gy,tl,wy,oC,ki,py,my,
|
|
1551
1551
|
$i=d(()=>{JP=(e,t)=>{if(e.length===0)return YP(t);let r=e.filter(({readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);
|
|
1552
1552
|
return Math.max(...r)},Zc=class extends WP{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#i=Symbol("unpipe");#o=new WeakMap;add(t){
|
|
1553
1553
|
if(el(t),this.#t.has(t))return;this.#t.add(t),this.#n??=KP(this,this.#t,this.#i);let r=ZP({passThroughStream:this,stream:t,
|
|
1554
1554
|
streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#i});this.#o.set(t,r),t.pipe(this,{end:!1})}async remove(t){
|
|
1555
1555
|
if(el(t),!this.#t.has(t))return!1;let r=this.#o.get(t);return r===void 0?!1:(this.#o.delete(t),t.unpipe(this),await r,!0)}},
|
|
1556
|
-
KP=async(e,t,r)=>{ki(e,
|
|
1557
|
-
e,-
|
|
1556
|
+
KP=async(e,t,r)=>{ki(e,py);let n=new AbortController;try{await Promise.race([XP(e,n),QP(e,t,r,n)])}finally{n.abort(),ki(
|
|
1557
|
+
e,-py)}},XP=async(e,{signal:t})=>{try{await fy(e,{signal:t,cleanup:!0})}catch(r){throw hy(e,r),r}},QP=async(e,t,r,{signal:n})=>{
|
|
1558
1558
|
for await(let[o]of qP(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},el=e=>{if(typeof e?.pipe!="function")throw new TypeError(
|
|
1559
1559
|
`Expected a readable stream, got: \`${typeof e}\`.`)},ZP=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
1560
|
-
onFinished:i,unpipeEvent:s})=>{ki(e,
|
|
1560
|
+
onFinished:i,unpipeEvent:s})=>{ki(e,my);let a=new AbortController;try{await Promise.race([eC(i,t,a),tC({passThroughStream:e,
|
|
1561
1561
|
stream:t,streams:r,ended:n,aborted:o,controller:a}),rC({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{
|
|
1562
|
-
a.abort(),ki(e,-
|
|
1563
|
-
await e,r.aborted||tl(t)}catch(n){r.aborted||
|
|
1564
|
-
controller:{signal:i}})=>{try{await
|
|
1565
|
-
aborted||!r.has(t))return;
|
|
1566
|
-
signal:i}})=>{if(await
|
|
1567
|
-
nC=e=>{e.writable&&e.end()},
|
|
1568
|
-
e.writable)&&e.destroy()},
|
|
1569
|
-
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},
|
|
1570
|
-
iC=async(e,t)=>{if(!(Ee(e)||Ee(t))){try{await
|
|
1571
|
-
e.end()},sC=async(e,t)=>{if(!(Ee(e)||Ee(t))){try{await
|
|
1572
|
-
e.readable&&e.destroy()}});var
|
|
1573
|
-
entries(t)){for(let{stream:a}of i.filter(({type:c})=>
|
|
1562
|
+
a.abort(),ki(e,-my)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?tl(e):nC(e))},eC=async(e,t,{signal:r})=>{try{
|
|
1563
|
+
await e,r.aborted||tl(t)}catch(n){r.aborted||hy(t,n)}},tC=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,
|
|
1564
|
+
controller:{signal:i}})=>{try{await fy(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.
|
|
1565
|
+
aborted||!r.has(t))return;gy(s)?o.add(t):wy(e,s)}},rC=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{
|
|
1566
|
+
signal:i}})=>{if(await dy(e,o,{signal:i}),!e.readable)return dy(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},
|
|
1567
|
+
nC=e=>{e.writable&&e.end()},hy=(e,t)=>{gy(t)?tl(e):wy(e,t)},gy=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",tl=e=>{(e.readable||
|
|
1568
|
+
e.writable)&&e.destroy()},wy=(e,t)=>{e.destroyed||(e.once("error",oC),e.destroy(t))},oC=()=>{},ki=(e,t)=>{let r=e.getMaxListeners();
|
|
1569
|
+
r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},py=2,my=1});import{finished as yy}from"node:stream/promises";var yr,iC,rl,sC,nl,Li=d(()=>{He();yr=(e,t)=>{e.pipe(t),iC(e,t),sC(e,t)},
|
|
1570
|
+
iC=async(e,t)=>{if(!(Ee(e)||Ee(t))){try{await yy(e,{cleanup:!0,readable:!0,writable:!1})}catch{}rl(t)}},rl=e=>{e.writable&&
|
|
1571
|
+
e.end()},sC=async(e,t)=>{if(!(Ee(e)||Ee(t))){try{await yy(t,{cleanup:!0,readable:!1,writable:!0})}catch{}nl(e)}},nl=e=>{
|
|
1572
|
+
e.readable&&e.destroy()}});var by,aC,cC,lC,uC,dC,Ey=d(()=>{$i();He();Ho();oe();Li();by=(e,t,r)=>{let n=new Map;for(let[o,{stdioItems:i,direction:s}]of Object.
|
|
1573
|
+
entries(t)){for(let{stream:a}of i.filter(({type:c})=>ye.has(c)))aC(e,a,s,o);for(let{stream:a}of i.filter(({type:c})=>!ye.
|
|
1574
1574
|
has(c)))lC({subprocess:e,stream:a,direction:s,fdNumber:o,pipeGroups:n,controller:r})}for(let[o,i]of n.entries()){let s=i.
|
|
1575
1575
|
length===1?i[0]:Nt(i);yr(s,o)}},aC=(e,t,r,n)=>{r==="output"?yr(e.stdio[n],t):yr(t,e.stdio[n]);let o=cC[n];o!==void 0&&(e[o]=
|
|
1576
1576
|
t),e.stdio[n]=t},cC=["stdin","stdout","stderr"],lC=({subprocess:e,stream:t,direction:r,fdNumber:n,pipeGroups:o,controller:i})=>{
|
|
1577
1577
|
if(t===void 0)return;uC(t,i);let[s,a]=r==="output"?[t,e.stdio[n]]:[e.stdio[n],t],c=o.get(s)??[];o.set(s,[...c,a])},uC=(e,{
|
|
1578
|
-
signal:t})=>{Ee(e)&&It(e,dC,t)},dC=2});var kt,
|
|
1578
|
+
signal:t})=>{Ee(e)&&It(e,dC,t)},dC=2});var kt,_y=d(()=>{kt=[];kt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&kt.push("SIGALRM","SIGABRT","SIG\
|
|
1579
1579
|
VTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&kt.push("SIGIO",
|
|
1580
|
-
"SIGPOLL","SIGPWR","SIGSTKFLT")});var Mi,ol,il,pC,sl,ji,mC,al,cl,ll,
|
|
1580
|
+
"SIGPOLL","SIGPWR","SIGSTKFLT")});var Mi,ol,il,pC,sl,ji,mC,al,cl,ll,Sy,iH,sH,Ty=d(()=>{_y();Mi=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="funct\
|
|
1581
1581
|
ion"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="functi\
|
|
1582
1582
|
on"&&typeof e.pid=="number"&&typeof e.on=="function",ol=Symbol.for("signal-exit emitter"),il=globalThis,pC=Object.defineProperty.
|
|
1583
1583
|
bind(Object),sl=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){
|
|
@@ -1598,220 +1598,220 @@ t=>this.#a(t)}}unload(){this.#s&&(this.#s=!1,kt.forEach(t=>{let r=this.#o[t];if(
|
|
|
1598
1598
|
1)}#a(t){return Mi(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.
|
|
1599
1599
|
exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&Mi(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let o=n.
|
|
1600
1600
|
call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},ll=globalThis.
|
|
1601
|
-
process,{onExit:
|
|
1602
|
-
r)return;let o=
|
|
1603
|
-
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=hC(r,n,o),{sourceStream:p,sourceError:f}=
|
|
1604
|
-
e,l),{options:h,fileDescriptors:
|
|
1605
|
-
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:
|
|
1601
|
+
process,{onExit:Sy,load:iH,unload:sH}=mC(Mi(ll)?new cl(ll):new al)});import{addAbortListener as fC}from"node:events";var vy,Iy=d(()=>{Ty();vy=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||
|
|
1602
|
+
r)return;let o=Sy(()=>{e.kill()});fC(n,()=>{o()})}});var Ay,hC,gC,Oy,wC,xy=d(()=>{ka();No();rt();rr();Ay=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=Co(),
|
|
1603
|
+
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=hC(r,n,o),{sourceStream:p,sourceError:f}=wC(
|
|
1604
|
+
e,l),{options:h,fileDescriptors:w}=Pe.get(e);return{sourcePromise:t,sourceStream:p,sourceOptions:h,sourceError:f,destination:s,
|
|
1605
|
+
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:w,startTime:i}},hC=(e,t,r)=>{try{let{destination:n,
|
|
1606
1606
|
pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=gC(e,t,...r),a=zo(n,i);return{destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){
|
|
1607
|
-
return{destinationError:n}}},gC=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(
|
|
1607
|
+
return{destinationError:n}}},gC=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(Oy,e)(r,...n),pipeOptions:e};if(typeof r==
|
|
1608
1608
|
"string"||r instanceof URL||Ca(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options\
|
|
1609
1609
|
) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[o,i,s]=Eo(r,...n);return{destination:t(
|
|
1610
|
-
|
|
1610
|
+
Oy)(o,i,s),pipeOptions:s}}if(Pe.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`comman\
|
|
1611
1611
|
d` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(
|
|
1612
|
-
`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},
|
|
1613
|
-
...e,stdin:"pipe",piped:!0}}),
|
|
1614
|
-
sourceOptions:i,startTime:s})=>{let a=
|
|
1615
|
-
throw ul({error:a,fileDescriptors:o,sourceOptions:i,startTime:s})},
|
|
1612
|
+
`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Oy=({options:e})=>({options:{
|
|
1613
|
+
...e,stdin:"pipe",piped:!0}}),wC=(e,t)=>{try{return{sourceStream:pr(e,t)}}catch(r){return{sourceError:r}}}});var Py,yC,ul,Ry,dl=d(()=>{cn();Li();Py=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n,fileDescriptors:o,
|
|
1614
|
+
sourceOptions:i,startTime:s})=>{let a=yC({sourceStream:e,sourceError:t,destinationStream:r,destinationError:n});if(a!==void 0)
|
|
1615
|
+
throw ul({error:a,fileDescriptors:o,sourceOptions:i,startTime:s})},yC=({sourceStream:e,sourceError:t,destinationStream:r,
|
|
1616
1616
|
destinationError:n})=>{if(t!==void 0&&n!==void 0)return n;if(n!==void 0)return nl(e),n;if(t!==void 0)return rl(r),t},ul=
|
|
1617
|
-
({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>
|
|
1618
|
-
startTime:n,isSync:!1}),
|
|
1619
|
-
n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s}});import{finished as bC}from"node:stream/promises";var
|
|
1620
|
-
has(t)?_C(e,t):EC(e,t);return It(e,
|
|
1617
|
+
({error:e,fileDescriptors:t,sourceOptions:r,startTime:n})=>hr({error:e,command:Ry,escapedCommand:Ry,fileDescriptors:t,options:r,
|
|
1618
|
+
startTime:n,isSync:!1}),Ry="source.pipe(destination)"});var Cy,Ny=d(()=>{Cy=async e=>{let[{status:t,reason:r,value:n=r},{status:o,reason:i,value:s=i}]=await e;if(s.pipedFrom.includes(
|
|
1619
|
+
n)||s.pipedFrom.push(n),o==="rejected")throw s;if(t==="rejected")throw n;return s}});import{finished as bC}from"node:stream/promises";var ky,EC,_C,SC,Di,TC,vC,$y=d(()=>{$i();Ho();Li();ky=(e,t,r)=>{let n=Di.
|
|
1620
|
+
has(t)?_C(e,t):EC(e,t);return It(e,TC,r.signal),It(t,vC,r.signal),SC(t),n},EC=(e,t)=>{let r=Nt([e]);return yr(r,t),Di.set(
|
|
1621
1621
|
t,r),r},_C=(e,t)=>{let r=Di.get(t);return r.add(e),r},SC=async e=>{try{await bC(e,{cleanup:!0,readable:!1,writable:!0})}catch{}
|
|
1622
|
-
Di.delete(e)},Di=new WeakMap,
|
|
1622
|
+
Di.delete(e)},Di=new WeakMap,TC=2,vC=1});import{aborted as IC}from"node:util";var Ly,OC,My=d(()=>{dl();Ly=(e,t)=>e===void 0?[]:[OC(e,t)],OC=async(e,{sourceStream:t,
|
|
1623
1623
|
mergedStream:r,fileDescriptors:n,sourceOptions:o,startTime:i})=>{await IC(e,t),await r.remove(t);let s=new Error("Pipe c\
|
|
1624
|
-
anceled by `unpipeSignal` option.");throw ul({error:s,fileDescriptors:n,sourceOptions:o,startTime:i})}});var Ui,AC,xC,
|
|
1625
|
-
...e.boundOptions,...t[0]}});let{destination:r,...n}=
|
|
1624
|
+
anceled by `unpipeSignal` option.");throw ul({error:s,fileDescriptors:n,sourceOptions:o,startTime:i})}});var Ui,AC,xC,jy=d(()=>{Ve();xy();dl();Ny();$y();My();Ui=(e,...t)=>{if(Y(t[0]))return Ui.bind(void 0,{...e,boundOptions:{
|
|
1625
|
+
...e.boundOptions,...t[0]}});let{destination:r,...n}=Ay(e,...t),o=AC({...n,destination:r});return o.pipe=Ui.bind(void 0,
|
|
1626
1626
|
{...e,source:r,sourcePromise:o,boundOptions:{}}),o},AC=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,
|
|
1627
|
-
destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=xC(e,o);
|
|
1627
|
+
destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=xC(e,o);Py({
|
|
1628
1628
|
sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let p=new AbortController;
|
|
1629
|
-
try{let f=
|
|
1630
|
-
startTime:l})])}finally{p.abort()}},xC=(e,t)=>Promise.allSettled([e,t])});import{on as RC}from"node:events";import{getDefaultHighWaterMark as PC}from"node:stream";var Bi,CC,pl,NC,
|
|
1631
|
-
Gi=d(()=>{Bc();Oi();
|
|
1632
|
-
let s=new AbortController;return CC(t,s),
|
|
1629
|
+
try{let f=ky(t,i,p);return await Promise.race([Cy(u),...Ly(a,{sourceStream:t,mergedStream:f,sourceOptions:r,fileDescriptors:c,
|
|
1630
|
+
startTime:l})])}finally{p.abort()}},xC=(e,t)=>Promise.allSettled([e,t])});import{on as RC}from"node:events";import{getDefaultHighWaterMark as PC}from"node:stream";var Bi,CC,pl,NC,Uy,ml,Dy,kC,$C,
|
|
1631
|
+
Gi=d(()=>{Bc();Oi();Vc();Bi=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{
|
|
1632
|
+
let s=new AbortController;return CC(t,s),Uy({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,
|
|
1633
1633
|
shouldSplit:!e.readableObjectMode,preserveNewlines:i})},CC=async(e,t)=>{try{await e}catch{}finally{t.abort()}},pl=({stream:e,
|
|
1634
1634
|
onStreamEnd:t,lines:r,encoding:n,stripFinalNewline:o,allMixed:i})=>{let s=new AbortController;NC(t,s,e);let a=e.readableObjectMode&&
|
|
1635
|
-
!i;return
|
|
1636
|
-
NC=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},
|
|
1637
|
-
shouldSplit:i,preserveNewlines:s})=>{let a=RC(e,"data",{signal:t.signal,highWaterMark:
|
|
1638
|
-
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},ml=PC(!0),
|
|
1635
|
+
!i;return Uy({stream:e,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!o})},
|
|
1636
|
+
NC=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},Uy=({stream:e,controller:t,binary:r,shouldEncode:n,encoding:o,
|
|
1637
|
+
shouldSplit:i,preserveNewlines:s})=>{let a=RC(e,"data",{signal:t.signal,highWaterMark:Dy,highWatermark:Dy});return kC({onStdoutChunk:a,
|
|
1638
|
+
controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s})},ml=PC(!0),Dy=ml,kC=async function*({
|
|
1639
1639
|
onStdoutChunk:e,controller:t,binary:r,shouldEncode:n,encoding:o,shouldSplit:i,preserveNewlines:s}){let a=$C({binary:r,shouldEncode:n,
|
|
1640
1640
|
encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*Ct(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{
|
|
1641
1641
|
yield*un(a)}},$C=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[Ai(e,r,!t),Ii(e,o,!n,{})].filter(
|
|
1642
|
-
Boolean)});import{setImmediate as LC}from"node:timers/promises";var
|
|
1642
|
+
Boolean)});import{setImmediate as LC}from"node:timers/promises";var By,MC,jC,DC,fl,Gy,hl=d(()=>{gi();de();Hc();Gi();Rt();ln();By=async({
|
|
1643
1643
|
stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{
|
|
1644
1644
|
let p=MC({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.all(
|
|
1645
|
-
[jC(e),p]);return}let f=jc(c,r),h=pl({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[
|
|
1646
|
-
all([DC({stream:e,iterable:h,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),p]);return
|
|
1645
|
+
[jC(e),p]);return}let f=jc(c,r),h=pl({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[w]=await Promise.
|
|
1646
|
+
all([DC({stream:e,iterable:h,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),p]);return w},MC=async({stream:e,onStreamEnd:t,
|
|
1647
1647
|
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!Ci({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
1648
1648
|
verboseInfo:i,fdNumber:r}))return;let a=pl({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
1649
|
-
await
|
|
1649
|
+
await Lw(a,e,r,i)},jC=async e=>{await LC(),e.readableFlowing===null&&e.resume()},DC=async({stream:e,stream:{readableObjectMode:t},
|
|
1650
1650
|
iterable:r,fdNumber:n,encoding:o,maxBuffer:i,lines:s})=>{try{return t||s?await pi(r,{maxBuffer:i}):o==="buffer"?new Uint8Array(
|
|
1651
|
-
await mi(r,{maxBuffer:i})):await hi(r,{maxBuffer:i})}catch(a){return
|
|
1652
|
-
encoding:o,fdNumber:n}))}},fl=async e=>{try{return await e}catch(t){return
|
|
1653
|
-
e):e});import{finished as UC}from"node:stream/promises";var fn,BC,GC,VC,
|
|
1651
|
+
await mi(r,{maxBuffer:i})):await hi(r,{maxBuffer:i})}catch(a){return Gy(bg({error:a,stream:e,readableObjectMode:t,lines:s,
|
|
1652
|
+
encoding:o,fdNumber:n}))}},fl=async e=>{try{return await e}catch(t){return Gy(t)}},Gy=({bufferedData:e})=>um(e)?new Uint8Array(
|
|
1653
|
+
e):e});import{finished as UC}from"node:stream/promises";var fn,BC,GC,FC,VC,zC,gl,Fi,Fy,Vi=d(()=>{fn=async(e,t,r,{isSameDirection:n,
|
|
1654
1654
|
stopOnExit:o=!1}={})=>{let i=BC(e,r),s=new AbortController;try{await Promise.race([...o?[r.exitPromise]:[],UC(e,{cleanup:!0,
|
|
1655
|
-
signal:s.signal})])}catch(a){i.stdinCleanedUp||
|
|
1656
|
-
let n={stdinCleanedUp:!1};return e===t&&GC(e,r,n),n},GC=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{
|
|
1657
|
-
...o)}},
|
|
1658
|
-
zC=(e,t,r,n=!0)=>r.propagating?
|
|
1659
|
-
all"&&e[t].direction==="input",
|
|
1660
|
-
streamInfo:a})=>e.stdio.map((c,l)=>
|
|
1661
|
-
stripFinalNewline:i,verboseInfo:s,streamInfo:a})),
|
|
1655
|
+
signal:s.signal})])}catch(a){i.stdinCleanedUp||VC(a,t,r,n)}finally{s.abort()}},BC=(e,{originalStreams:[t],subprocess:r})=>{
|
|
1656
|
+
let n={stdinCleanedUp:!1};return e===t&&GC(e,r,n),n},GC=(e,t,r)=>{let{_destroy:n}=e;e._destroy=(...o)=>{FC(t,r),n.call(e,
|
|
1657
|
+
...o)}},FC=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},VC=(e,t,r,n)=>{if(!zC(e,t,r,n))throw e},
|
|
1658
|
+
zC=(e,t,r,n=!0)=>r.propagating?Fy(e)||Fi(e):(r.propagating=!0,gl(r,t)===n?Fy(e):Fi(e)),gl=({fileDescriptors:e},t)=>t!=="\
|
|
1659
|
+
all"&&e[t].direction==="input",Fi=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Fy=e=>e?.code==="EPIPE"});var Vy,wl,yl=d(()=>{hl();Vi();Vy=({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,
|
|
1660
|
+
streamInfo:a})=>e.stdio.map((c,l)=>wl({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,
|
|
1661
|
+
stripFinalNewline:i,verboseInfo:s,streamInfo:a})),wl=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,
|
|
1662
1662
|
allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=fn(e,t,l);if(gl(l,t)){await u;return}let[
|
|
1663
|
-
p]=await Promise.all([
|
|
1664
|
-
verboseInfo:c,streamInfo:l}),u]);return p}});var
|
|
1665
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>
|
|
1663
|
+
p]=await Promise.all([By({stream:e,onStreamEnd:u,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,
|
|
1664
|
+
verboseInfo:c,streamInfo:l}),u]);return p}});var zy,Hy,HC,qC,bl=d(()=>{$i();yl();zy=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Nt([e,t].filter(Boolean)):void 0,Hy=({subprocess:e,
|
|
1665
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>wl({...HC(e,r),fdNumber:"all",
|
|
1666
1666
|
encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:qC(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),HC=({stdout:e,
|
|
1667
1667
|
stderr:t,all:r},[,n,o])=>{let i=n||o;return i?n?o?{stream:r,buffer:i}:{stream:e,buffer:i}:{stream:t,buffer:i}:{stream:r,
|
|
1668
|
-
buffer:i}},qC=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode});var
|
|
1669
|
-
if(!n)return o;let s=
|
|
1670
|
-
ipc:n,shouldAwait:!1,reference:!0}))a&&(Eg(e,o,c),o.push(l)),s&&
|
|
1671
|
-
[e]),t)});import{once as WC}from"node:events";var
|
|
1672
|
-
|
|
1673
|
-
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:p},context:f,verboseInfo:h,fileDescriptors:
|
|
1674
|
-
onInternalError:_,controller:m})=>{let g=
|
|
1675
|
-
S=
|
|
1676
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:h,streamInfo:
|
|
1677
|
-
maxBuffer:n,ipc:u,ipcOutput:b,verboseInfo:h}),O=YC(E,e,
|
|
1678
|
-
Promise.all(S),T,
|
|
1668
|
+
buffer:i}},qC=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode});var qy,Wy,Yy=d(()=>{ir();et();qy=e=>or(e,"ipc"),Wy=(e,t)=>{let r=Po(e);xe({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})}});var Jy,Ky,Xy=d(()=>{Rt();Yy();We();Xc();Jy=async({subprocess:e,buffer:t,maxBuffer:r,ipc:n,ipcOutput:o,verboseInfo:i})=>{
|
|
1669
|
+
if(!n)return o;let s=qy(i),a=qe(t,"ipc"),c=qe(r,"ipc");for await(let l of Kc({anyProcess:e,channel:e.channel,isSubprocess:!1,
|
|
1670
|
+
ipc:n,shouldAwait:!1,reference:!0}))a&&(Eg(e,o,c),o.push(l)),s&&Wy(l,i);return o},Ky=async(e,t)=>(await Promise.allSettled(
|
|
1671
|
+
[e]),t)});import{once as WC}from"node:events";var Qy,YC,JC,KC,Zy=d(()=>{xt();pc();nc();dc();He();oe();hl();Xy();fc();bl();yl();Yc();
|
|
1672
|
+
Vi();Qy=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
1673
|
+
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:p},context:f,verboseInfo:h,fileDescriptors:w,originalStreams:E,
|
|
1674
|
+
onInternalError:_,controller:m})=>{let g=Fw(e,f),y={originalStreams:E,fileDescriptors:w,subprocess:e,exitPromise:g,propagating:!1},
|
|
1675
|
+
S=Vy({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:h,streamInfo:y}),v=Hy({subprocess:e,
|
|
1676
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:h,streamInfo:y}),b=[],T=Jy({subprocess:e,buffer:r,
|
|
1677
|
+
maxBuffer:n,ipc:u,ipcOutput:b,verboseInfo:h}),O=YC(E,e,y),I=JC(w,y);try{return await Promise.race([Promise.all([{},zw(g),
|
|
1678
|
+
Promise.all(S),v,T,Hh(e,p),...O,...I]),_,KC(e,m),...Bh(e,i,f,m),...sh({subprocess:e,cancelSignal:s,gracefulCancel:a,context:f,
|
|
1679
1679
|
controller:m}),...Dh({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:m})])}catch(x){
|
|
1680
|
-
return f.terminationReason??="other",Promise.all([{error:x},g,Promise.all(S.map(j=>fl(j))),fl(
|
|
1680
|
+
return f.terminationReason??="other",Promise.all([{error:x},g,Promise.all(S.map(j=>fl(j))),fl(v),Ky(T,b),Promise.allSettled(
|
|
1681
1681
|
O),Promise.allSettled(I)])}},YC=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:fn(n,o,r)),JC=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
1682
|
-
filter(({value:o,stream:i=o})=>
|
|
1683
|
-
has(o),stopOnExit:o==="native"}))),KC=async(e,{signal:t})=>{let[r]=await WC(e,"error",{signal:t});throw r}});var eb,hn,
|
|
1682
|
+
filter(({value:o,stream:i=o})=>Te(i,{checkOpen:!1})&&!Ee(i)).map(({type:o,value:i,stream:s=i})=>fn(s,n,t,{isSameDirection:ye.
|
|
1683
|
+
has(o),stopOnExit:o==="native"}))),KC=async(e,{signal:t})=>{let[r]=await WC(e,"error",{signal:t});throw r}});var eb,hn,br,zi=d(()=>{dr();eb=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),
|
|
1684
1684
|
hn=(e,t,r)=>{let n=e[r];n.has(t)||n.set(t,[]);let o=n.get(t),i=Re();return o.push(i),{resolve:i.resolve.bind(i),promises:o}},
|
|
1685
|
-
|
|
1686
|
-
return!n}});import{finished as tb}from"node:stream/promises";var El,rb,_l,Sl,Hi,qi,
|
|
1685
|
+
br=async({resolve:e,promises:t},r)=>{e();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);
|
|
1686
|
+
return!n}});import{finished as tb}from"node:stream/promises";var El,rb,_l,Sl,Hi,qi,Tl=d(()=>{Vi();El=async e=>{if(e!==void 0)try{await _l(
|
|
1687
1687
|
e)}catch{}},rb=async e=>{if(e!==void 0)try{await Sl(e)}catch{}},_l=async e=>{await tb(e,{cleanup:!0,readable:!1,writable:!0})},
|
|
1688
|
-
Sl=async e=>{await tb(e,{cleanup:!0,readable:!0,writable:!1})},Hi=async(e,t)=>{if(await e,t)throw t},qi=(e,t,r)=>{r&&!
|
|
1689
|
-
r)?e.destroy(r):t&&e.destroy()}});import{Readable as XC}from"node:stream";import{callbackify as QC}from"node:util";var nb,
|
|
1690
|
-
rt();Gi();
|
|
1691
|
-
let s=o||pe.has(r),{subprocessStdout:a,waitReadableDestroy:c}=
|
|
1692
|
-
a,s),{read:f,onStdoutDataDone:h}=Ol({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),
|
|
1688
|
+
Sl=async e=>{await tb(e,{cleanup:!0,readable:!0,writable:!1})},Hi=async(e,t)=>{if(await e,t)throw t},qi=(e,t,r)=>{r&&!Fi(
|
|
1689
|
+
r)?e.destroy(r):t&&e.destroy()}});import{Readable as XC}from"node:stream";import{callbackify as QC}from"node:util";var nb,vl,Il,Ol,ZC,Al,xl,ob,Rl=d(()=>{Ot();
|
|
1690
|
+
rt();Gi();dr();zi();Tl();nb=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{
|
|
1691
|
+
let s=o||pe.has(r),{subprocessStdout:a,waitReadableDestroy:c}=vl(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:p}=Il(
|
|
1692
|
+
a,s),{read:f,onStdoutDataDone:h}=Ol({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),w=new XC({
|
|
1693
1693
|
read:f,destroy:QC(xl.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:p,objectMode:u,
|
|
1694
|
-
encoding:l});return Al({subprocessStdout:a,onStdoutDataDone:h,readable:
|
|
1694
|
+
encoding:l});return Al({subprocessStdout:a,onStdoutDataDone:h,readable:w,subprocess:e}),w},vl=(e,t,r)=>{let n=pr(e,t),o=hn(
|
|
1695
1695
|
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Il=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
1696
1696
|
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:ml},
|
|
1697
1697
|
Ol=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=Re(),s=Bi({subprocessStdout:e,subprocess:t,
|
|
1698
1698
|
binary:r,shouldEncode:!r,encoding:n,preserveNewlines:o});return{read(){ZC(this,s,i)},onStdoutDataDone:i}},ZC=async(e,t,r)=>{
|
|
1699
1699
|
try{let{value:n,done:o}=await t.next();o?r.resolve():e.push(n)}catch{}},Al=async({subprocessStdout:e,onStdoutDataDone:t,
|
|
1700
1700
|
readable:r,subprocess:n,subprocessStdin:o})=>{try{await Sl(e),await n,await El(o),await t,r.readable&&r.push(null)}catch(i){
|
|
1701
|
-
await El(o),ob(r,i)}},xl=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await
|
|
1701
|
+
await El(o),ob(r,i)}},xl=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},n)=>{await br(r,t)&&(ob(e,n),await Hi(
|
|
1702
1702
|
t,n))},ob=(e,t)=>{qi(e,e.readable,t)}});import{Writable as eN}from"node:stream";import{callbackify as ib}from"node:util";var sb,Pl,Cl,tN,rN,Nl,kl,ab,$l=d(()=>{rt();
|
|
1703
|
-
zi();
|
|
1703
|
+
zi();Tl();sb=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}=Pl(
|
|
1704
1704
|
e,r,t),s=new eN({...Cl(n,e,o),destroy:ib(kl.bind(void 0,{subprocessStdin:n,subprocess:e,waitWritableFinal:o,waitWritableDestroy:i})),
|
|
1705
1705
|
highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return Nl(n,s),s},Pl=(e,t,r)=>{let n=zo(e,t),o=hn(
|
|
1706
1706
|
r,n,"writableFinal"),i=hn(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:o,waitWritableDestroy:i}},Cl=
|
|
1707
1707
|
(e,t,r)=>({write:tN.bind(void 0,e),final:ib(rN.bind(void 0,e,t,r))}),tN=(e,t,r,n)=>{e.write(t,r)?n():e.once("drain",n)},
|
|
1708
|
-
rN=async(e,t,r)=>{await
|
|
1709
|
-
await rb(r),ab(t,n)}},kl=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await
|
|
1710
|
-
r,t),await
|
|
1708
|
+
rN=async(e,t,r)=>{await br(r,t)&&(e.writable&&e.end(),await t)},Nl=async(e,t,r)=>{try{await _l(e),t.writable&&t.end()}catch(n){
|
|
1709
|
+
await rb(r),ab(t,n)}},kl=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await br(
|
|
1710
|
+
r,t),await br(n,t)&&(ab(e,o),await Hi(t,o))},ab=(e,t)=>{qi(e,e.writable,t)}});import{Duplex as nN}from"node:stream";import{callbackify as oN}from"node:util";var cb,iN,lb=d(()=>{Ot();Rl();$l();cb=({subprocess:e,
|
|
1711
1711
|
concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||pe.has(r),{subprocessStdout:c,
|
|
1712
|
-
waitReadableDestroy:l}=
|
|
1713
|
-
readableObjectMode:
|
|
1712
|
+
waitReadableDestroy:l}=vl(e,n,t),{subprocessStdin:u,waitWritableFinal:p,waitWritableDestroy:f}=Pl(e,o,t),{readableEncoding:h,
|
|
1713
|
+
readableObjectMode:w,readableHighWaterMark:E}=Il(c,a),{read:_,onStdoutDataDone:m}=Ol({subprocessStdout:c,subprocess:e,binary:a,
|
|
1714
1714
|
encoding:r,preserveNewlines:s}),g=new nN({read:_,...Cl(u,e,p),destroy:oN(iN.bind(void 0,{subprocessStdout:c,subprocessStdin:u,
|
|
1715
1715
|
subprocess:e,waitReadableDestroy:l,waitWritableFinal:p,waitWritableDestroy:f})),readableHighWaterMark:E,writableHighWaterMark:u.
|
|
1716
|
-
writableHighWaterMark,readableObjectMode:
|
|
1716
|
+
writableHighWaterMark,readableObjectMode:w,writableObjectMode:u.writableObjectMode,encoding:h});return Al({subprocessStdout:c,
|
|
1717
1717
|
onStdoutDataDone:m,readable:g,subprocess:e,subprocessStdin:u}),Nl(u,g,c),g},iN=async({subprocessStdout:e,subprocessStdin:t,
|
|
1718
1718
|
subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([xl({subprocessStdout:e,
|
|
1719
|
-
subprocess:r,waitReadableDestroy:n},s),kl({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])}});var Ll,sN,ub=d(()=>{Ot();rt();Gi();Ll=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||pe.has(t),s=
|
|
1719
|
+
subprocess:r,waitReadableDestroy:n},s),kl({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])}});var Ll,sN,ub=d(()=>{Ot();rt();Gi();Ll=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||pe.has(t),s=pr(e,r),
|
|
1720
1720
|
a=Bi({subprocessStdout:s,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return sN(a,s,e)},sN=async function*(e,t,r){
|
|
1721
1721
|
try{yield*e}finally{t.readable&&t.destroy(),await r}}});var db,pb=d(()=>{zi();Rl();$l();lb();ub();db=(e,{encoding:t})=>{let r=eb();e.readable=nb.bind(void 0,{subprocess:e,concurrentStreams:r,
|
|
1722
1722
|
encoding:t}),e.writable=sb.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=cb.bind(void 0,{subprocess:e,concurrentStreams:r,
|
|
1723
1723
|
encoding:t}),e.iterable=Ll.bind(void 0,e,t),e[Symbol.asyncIterator]=Ll.bind(void 0,e,t,{})}});var mb,aN,cN,fb=d(()=>{mb=(e,t)=>{for(let[r,n]of cN){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},
|
|
1724
1724
|
aN=(async()=>{})().constructor.prototype,cN=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(aN,e)])});import{setMaxListeners as lN}from"node:events";import{spawn as uN}from"node:child_process";var hb,dN,pN,mN,fN,hN,gb=d(()=>{
|
|
1725
|
-
gi();
|
|
1725
|
+
gi();Va();wc();rt();yc();Qc();cn();bi();iy();uy();ln();Ey();Bo();Iy();jy();bl();Zy();pb();dr();fb();hb=(e,t,r,n)=>{let{file:o,
|
|
1726
1726
|
commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:p}=dN(e,t,r),{subprocess:f,
|
|
1727
1727
|
promise:h}=mN({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:p});
|
|
1728
1728
|
return f.pipe=Ui.bind(void 0,{source:f,sourcePromise:h,boundOptions:{},createNested:n}),mb(f,h),Pe.set(f,{options:u,fileDescriptors:p}),
|
|
1729
1729
|
f},dN=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=ko(e,t,r),{file:a,commandArguments:c,options:l}=si(
|
|
1730
|
-
e,t,r),u=pN(l),p=
|
|
1730
|
+
e,t,r),u=pN(l),p=ly(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:u,
|
|
1731
1731
|
fileDescriptors:p}},pN=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been ren\
|
|
1732
1732
|
amed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},mN=({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,
|
|
1733
|
-
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=uN(...ai(e,t,r))}catch(
|
|
1733
|
+
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=uN(...ai(e,t,r))}catch(w){return oy({error:w,command:i,escapedCommand:s,
|
|
1734
1734
|
fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;lN(Number.POSITIVE_INFINITY,l.signal);
|
|
1735
|
-
let u=[...c.stdio];
|
|
1736
|
-
context:p,controller:l}),c.all=
|
|
1735
|
+
let u=[...c.stdio];by(c,a,l),vy(c,r,l);let p={},f=Re();c.kill=oh.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,
|
|
1736
|
+
context:p,controller:l}),c.all=zy(c,r),db(c,r),ty(c,r);let h=fN({subprocess:c,options:r,startTime:n,verboseInfo:o,fileDescriptors:a,
|
|
1737
1737
|
originalStreams:u,command:i,escapedCommand:s,context:p,onInternalError:f,controller:l});return{subprocess:c,promise:h}},
|
|
1738
1738
|
fN=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:s,escapedCommand:a,
|
|
1739
|
-
context:c,onInternalError:l,controller:u})=>{let[p,[f,h],
|
|
1740
|
-
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let m=
|
|
1741
|
-
g=Je(E,t,"all"),
|
|
1742
|
-
startTime:r});return
|
|
1739
|
+
context:c,onInternalError:l,controller:u})=>{let[p,[f,h],w,E,_]=await Qy({subprocess:e,options:t,context:c,verboseInfo:n,
|
|
1740
|
+
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let m=w.map((S,v)=>Je(S,t,v)),
|
|
1741
|
+
g=Je(E,t,"all"),y=hN({errorInfo:p,exitCode:f,signal:h,stdio:m,all:g,ipcOutput:_,context:c,options:t,command:s,escapedCommand:a,
|
|
1742
|
+
startTime:r});return gr(y,n,t)},hN=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:s,options:a,command:c,
|
|
1743
1743
|
escapedCommand:l,startTime:u})=>"error"in e?an({error:e.error,command:c,escapedCommand:l,timedOut:s.terminationReason===
|
|
1744
1744
|
"timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason===
|
|
1745
1745
|
"gracefulCancel",isMaxBuffer:e.error instanceof Ce,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,
|
|
1746
|
-
all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):
|
|
1747
|
-
...e,...r}},gN=(e,t,r)=>
|
|
1748
|
-
deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},
|
|
1746
|
+
all:o,ipcOutput:i,options:a,startTime:u,isSync:!1}):yi({command:c,escapedCommand:l,stdio:n,all:o,ipcOutput:i,options:a,startTime:u})});var Wi,gN,wN,wb=d(()=>{Ve();We();Wi=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([n,o])=>[n,gN(n,e[n],o)]));return{
|
|
1747
|
+
...e,...r}},gN=(e,t,r)=>wN.has(e)&&Y(t)&&Y(r)?{...t,...r}:r,wN=new Set(["env",...Da])});var it,yN,bN,yb=d(()=>{Ve();ka();ym();Yw();gb();wb();it=(e,t,r,n)=>{let o=(s,a,c)=>it(s,a,r,c),i=(...s)=>yN({mapArguments:e,
|
|
1748
|
+
deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==void 0&&n(i,o,t),i},yN=({mapArguments:e,deepOptions:t={},
|
|
1749
1749
|
boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(Y(i))return o(e,Wi(r,i),n);let{file:a,commandArguments:c,
|
|
1750
|
-
options:l,isSync:u}=bN({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?
|
|
1751
|
-
hb(a,c,l,o)},bN=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=gm(t)?
|
|
1750
|
+
options:l,isSync:u}=bN({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?Ww(a,c,l):
|
|
1751
|
+
hb(a,c,l,o)},bN=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=gm(t)?wm(t,r):[t,
|
|
1752
1752
|
...r],[s,a,c]=Eo(...i),l=Wi(Wi(n,o),c),{file:u=s,commandArguments:p=a,options:f=l,isSync:h=!1}=e({file:s,commandArguments:a,
|
|
1753
1753
|
options:l});return{file:u,commandArguments:p,options:f,isSync:h}}});var bb,Eb,_b,EN,_N,Sb=d(()=>{bb=({file:e,commandArguments:t})=>_b(e,t),Eb=({file:e,commandArguments:t})=>({..._b(e,t),isSync:!0}),
|
|
1754
1754
|
_b=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}\
|
|
1755
1755
|
.`);let[r,...n]=EN(e);return{file:r,commandArguments:n}},EN=e=>{if(typeof e!="string")throw new TypeError(`The command m\
|
|
1756
1756
|
ust be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(_N)){let o=r.at(-1);o&&
|
|
1757
|
-
o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},_N=/ +/g});var vb,
|
|
1758
|
-
e),isSync:!0}),Ib=e=>({options:{...
|
|
1759
|
-
{stdin:"inherit"}:{},Ob={preferLocal:!0}});var xb,J2,K2,X2,Q2,Z2,eW,tW,rW,nW,Rb=d(()=>{
|
|
1760
|
-
X2=it(Eb),Q2=it(
|
|
1757
|
+
o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},_N=/ +/g});var Tb,vb,SN,Ib,TN,Ob,Ab=d(()=>{Tb=(e,t,r)=>{e.sync=t(SN,r),e.s=e.sync},vb=({options:e})=>Ib(e),SN=({options:e})=>({...Ib(
|
|
1758
|
+
e),isSync:!0}),Ib=e=>({options:{...TN(e),...e}}),TN=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?
|
|
1759
|
+
{stdin:"inherit"}:{},Ob={preferLocal:!0}});var xb,J2,K2,X2,Q2,Z2,eW,tW,rW,nW,Rb=d(()=>{yb();Sb();mc();Ab();Qc();xb=it(()=>({})),J2=it(()=>({isSync:!0})),K2=it(bb),
|
|
1760
|
+
X2=it(Eb),Q2=it(Fh),Z2=it(vb,{},Ob,Tb),{sendMessage:eW,getOneMessage:tW,getEachMessage:rW,getCancelSignal:nW}=ry()});function vN(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function gn({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1761
1761
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:p=null,retryable:f=null}={}){
|
|
1762
|
-
let h=
|
|
1762
|
+
let h=vN(r),w=String(l||""),E=String(c||""),_=String(o||[w,E].filter(Boolean).join(`
|
|
1763
1763
|
`)).trim();return{code:P(e),error:P(t),exitCode:h,ok:n===null?h===0:n===!0,output:_,pid:Number.isSafeInteger(Number(s))?
|
|
1764
|
-
Number(s):null,signal:P(a),stderr:E,stdout:
|
|
1764
|
+
Number(s):null,signal:P(a),stderr:E,stdout:w,...i==="base64"?{outputEncoding:i}:{},timedOut:u===!0,...p&&typeof p=="obje\
|
|
1765
1765
|
ct"&&!Array.isArray(p)?{execution:p}:{},...typeof f=="boolean"?{retryable:f}:{}}}function Z(e="",t="vibe64_command_faile\
|
|
1766
1766
|
d",r={}){let n=P(e)||"Vibe64 command failed.";return gn({...r,code:t,error:n,exitCode:1,ok:!1,output:P(r.output)||n,stderr:r.
|
|
1767
|
-
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var
|
|
1768
|
-
import PN from"node:path";import{fileURLToPath as CN}from"node:url";function LN(e){if(process.platform!=="win32"){if(!
|
|
1769
|
-
let t=Nb(process.execPath,[$N],{cwd:"/",detached:!0,stdio:["pipe","ignore","ignore"]});t.once("error",()=>{
|
|
1770
|
-
t.once("exit",()=>{
|
|
1767
|
+
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var $t=d(()=>{W()});import{spawn as Nb}from"node:child_process";import{mkdir as ON,open as AN,readdir as xN,readFile as RN}from"node:fs/promises";
|
|
1768
|
+
import PN from"node:path";import{fileURLToPath as CN}from"node:url";function LN(e){if(process.platform!=="win32"){if(!ve){
|
|
1769
|
+
let t=Nb(process.execPath,[$N],{cwd:"/",detached:!0,stdio:["pipe","ignore","ignore"]});t.once("error",()=>{ve===t&&(ve=null)}),
|
|
1770
|
+
t.once("exit",()=>{ve===t&&(ve=null)}),t.stdin.on("error",()=>{}),t.unref(),t.stdin.unref(),ve=t;for(let r of Lt.values())
|
|
1771
1771
|
r.scopeEmpty!==!0&&r.pid!==e&&t.stdin.write(`+${r.pid}
|
|
1772
|
-
`)}
|
|
1773
|
-
`)}}function MN(e){
|
|
1774
|
-
`),![
|
|
1772
|
+
`)}ve.stdin.write(`+${e}
|
|
1773
|
+
`)}}function MN(e){ve&&(ve.stdin.write(`-${e}
|
|
1774
|
+
`),![...Lt.values()].some(t=>t.scopeEmpty!==!0)&&(ve.stdin.end(),ve=null))}async function jN(e=""){return e?(await ON(PN.
|
|
1775
1775
|
dirname(e),{recursive:!0}),AN(e,"w",384)):null}async function DN(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=
|
|
1776
1776
|
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function kb(e={},t={}){let{cwd:r="",env:n={}}=t,o=null;
|
|
1777
1777
|
try{o=await jN(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=Nb(e.command,e.args,{cwd:r||void 0,
|
|
1778
|
-
detached:!0,env:n,stdio:i});await DN(s);let a=e.execution?.id||"";return a&&(
|
|
1779
|
-
s.pid)),s.once("exit",()=>{!Yi(s.pid)
|
|
1778
|
+
detached:!0,env:n,stdio:i});await DN(s);let a=e.execution?.id||"";return a&&(Lt.set(a,{child:s,pid:Number(s.pid)}),LN(Number(
|
|
1779
|
+
s.pid)),s.once("exit",()=>{!Yi(s.pid)&&Lt.has(a)&&(Lt.set(a,{child:s,pid:Number(s.pid),scopeEmpty:!0}),MN(Number(s.pid)))})),
|
|
1780
1780
|
s.unref(),gn({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:s.pid})}catch(i){return Z(i?.
|
|
1781
1781
|
message||"Detached command failed to start.",i?.code||"vibe64_command_detached_failed",{execution:e.execution})}finally{
|
|
1782
1782
|
await o?.close().catch(()=>null)}}function Yi(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return!1;if(process.
|
|
1783
|
-
platform==="win32"){let r=[
|
|
1783
|
+
platform==="win32"){let r=[...Lt.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&r?.child?.signalCode===null}
|
|
1784
1784
|
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Pb(e=null,t="SIGTERM"){if(!Yi(e))return!1;try{
|
|
1785
|
-
return process.platform==="win32"?[
|
|
1785
|
+
return process.platform==="win32"?[...Lt.values()].find(n=>n.pid===Number(e))?.child?.kill(t):process.kill(-Number(e),t),
|
|
1786
1786
|
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function $b(e=null,t=10){let r=Number(e);if(process.platform!==
|
|
1787
1787
|
"linux"||!Number.isSafeInteger(r)||r<=0)return[];let n=[];for(let o of await xN("/proc").catch(()=>[])){if(n.length>=t)break;
|
|
1788
1788
|
if(!/^\d+$/u.test(o))continue;let i=await RN(`/proc/${o}/stat`,"utf8").catch(()=>""),s=i.lastIndexOf(")"),a=s<0?[]:i.slice(
|
|
1789
1789
|
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function Cb(e=null,t=0){
|
|
1790
1790
|
let r=Date.now()+Math.max(0,Number(t)||0);for(;Yi(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!Yi(e)}
|
|
1791
1791
|
async function Ji(e=null,t={}){let{killTimeoutMs:r=kN,termTimeoutMs:n=NN}=t;Pb(e,"SIGTERM");let o=await Cb(e,n);return o||
|
|
1792
|
-
(Pb(e,"SIGKILL"),o=await Cb(e,r)),o}var IN
|
|
1793
|
-
cution/src/server/engines/detached.js",import.meta.url).href
|
|
1794
|
-
IN)),
|
|
1795
|
-
outputEncoding:l="utf8",signal:u=null,timeout:p=15e3}=r,f,h,
|
|
1792
|
+
(Pb(e,"SIGKILL"),o=await Cb(e,r)),o}var IN,Lt,NN,kN,$N,ve,wn=d(()=>{$t();IN=new URL("./../node_modules/@local/vibe64-exe\
|
|
1793
|
+
cution/src/server/engines/detached.js",import.meta.url).href,Lt=new Map,NN=3e3,kN=1e3,$N=CN(new URL("./detachedReaper.js",
|
|
1794
|
+
IN)),ve=null});async function yn(e="",t=[],r={}){let{cwd:n="",env:o={},execution:i=null,input:s=void 0,maxBuffer:a=void 0,onOutput:c=null,
|
|
1795
|
+
outputEncoding:l="utf8",signal:u=null,timeout:p=15e3}=r,f,h,w,E=null,_=Promise.withResolvers(),m=()=>{w||=h(),w.then(_.resolve)};
|
|
1796
1796
|
if(u?.aborted)return Z("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let S=xb(e,t,{all:!0,cwd:n,detached:process.
|
|
1797
1797
|
platform!=="win32",encoding:l,env:o,extendEnv:!1,input:s,maxBuffer:a,reject:!1,stdin:s==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
1798
|
-
timeout:p});E=Number(S.pid);let
|
|
1799
|
-
O=S.then(()=>!0,()=>!0)),
|
|
1798
|
+
timeout:p});E=Number(S.pid);let v;h=()=>{if(!v){let O;process.platform!=="win32"?O=Ji(E).catch(()=>!1):(S.kill("SIGKILL"),
|
|
1799
|
+
O=S.then(()=>!0,()=>!0)),v=O.then(I=>(I||(v=null),I))}return v},i?.id&&Lb.set(i.id,h),u?.addEventListener("abort",m,{once:!0}),
|
|
1800
1800
|
u?.aborted&&m(),typeof c=="function"&&S.all&&S.all.on("data",O=>{try{c(String(O||""))}catch{}});let b=await Promise.race(
|
|
1801
|
-
[S,_.promise.then(O=>O?S:{exitCode:1})]),
|
|
1802
|
-
ommand_capture_timed_out":b.code?"vibe64_command_capture_failed":"",error:
|
|
1803
|
-
(
|
|
1801
|
+
[S,_.promise.then(O=>O?S:{exitCode:1})]),T=typeof b.exitCode=="number"?b.exitCode:1;f=gn({code:b.timedOut===!0?"vibe64_c\
|
|
1802
|
+
ommand_capture_timed_out":b.code?"vibe64_command_capture_failed":"",error:T===0?"":b.shortMessage,exitCode:T,output:b.all||
|
|
1803
|
+
(T===0?"":b.shortMessage),outputEncoding:l,signal:b.signal,stderr:b.stderr,stdout:b.stdout,timedOut:b.timedOut===!0,execution:i})}catch(S){
|
|
1804
1804
|
f=Z(S.message,"vibe64_command_capture_failed",{execution:i,exitCode:typeof S.exitCode=="number"?S.exitCode:1,output:S.all,
|
|
1805
1805
|
outputEncoding:l,signal:S.signal,stderr:S.stderr,stdout:S.stdout,timedOut:S.timedOut===!0})}finally{u?.removeEventListener(
|
|
1806
|
-
"abort",m)}if(!await(
|
|
1807
|
-
cancelled":"The command finished",b=S.length?`: ${S.map(
|
|
1808
|
-
return{...Z(`${
|
|
1806
|
+
"abort",m)}if(!await(w||h?.()||!0)){let S=await $b(E),v=f?.timedOut?"The command timed out":u?.aborted?"The command was \
|
|
1807
|
+
cancelled":"The command finished",b=S.length?`: ${S.map(T=>`${T.command} (pid ${T.pid})`).join(", ")} still running`:"";
|
|
1808
|
+
return{...Z(`${v}, and its execution scope did not become empty${b}.`,"vibe64_execution_drain_failed",{execution:i,output:f?.
|
|
1809
1809
|
output,outputEncoding:l,signal:f?.signal,stderr:f?.stderr,stdout:f?.stdout,timedOut:f?.timedOut}),remainingProcesses:S}}
|
|
1810
|
-
i?.id&&Lb.delete(i.id);let
|
|
1811
|
-
ed",{...f,execution:
|
|
1810
|
+
i?.id&&Lb.delete(i.id);let y=i&&{...i,state:"finished"};return u?.aborted?Z("Command cancelled.","vibe64_command_cancell\
|
|
1811
|
+
ed",{...f,execution:y,outputEncoding:l}):y?{...f,execution:y}:f}var Lb,bn=d(()=>{Rb();$t();wn();Lb=new Map});function ke(){return globalThis[UN]||BN}var UN,BN,st=d(()=>{UN=Symbol.for("vibe64.hostProfile"),BN=Object.freeze({runtimePackRoot:"",
|
|
1812
1812
|
sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1})});function Ml(e=""){let t=String(e||"").trim()||ke().execHelperPath;if(!t){let r=new Error("This computer has no helper fo\
|
|
1813
1813
|
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function Mb(e={}){return{
|
|
1814
|
-
...e,schema:GN,schemaVersion:
|
|
1814
|
+
...e,schema:GN,schemaVersion:FN}}function Ki({actor:e={},command:t="",cwd:r="",env:n={},input:o,operation:i="vibe64-comm\
|
|
1815
1815
|
and",args:s=[]}={}){return Mb({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,gid:e.user?.gid,home:e.
|
|
1816
1816
|
user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).toString("base64"),operation:i,
|
|
1817
1817
|
uid:e.user?.uid,username:e.user?.username})}function En(e={}){return e.mode==="pty"&&e.envPolicy==="auth"&&!["assistant",
|
|
@@ -1822,46 +1822,46 @@ includes(e.execution?.operationId)||e.mode==="capture"&&e.execution?.kind==="ass
|
|
|
1822
1822
|
ncode-catalog"?"opencode-app-server":e.purpose==="account"?"account-status":e.purpose==="github"?"github-workflow-comman\
|
|
1823
1823
|
d":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"workspace-cache-command":e.purpose==="he\
|
|
1824
1824
|
alth"?"health-status":"vibe64-command"}async function jl(e={},{env:t,helperPath:r="",maxBuffer:n=void 0,outputEncoding:o="\
|
|
1825
|
-
utf8",runCapture:i=
|
|
1825
|
+
utf8",runCapture:i=yn,signal:s=null,timeout:a=15e3}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1826
1826
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
1827
|
-
udo",["-n",Ml(r),"execute"],c)}var GN,
|
|
1828
|
-
upport/symlinkSafeRequire.js",import.meta.url).href,SW=zN(
|
|
1827
|
+
udo",["-n",Ml(r),"execute"],c)}var GN,FN,Xi=d(()=>{bn();st();GN="vibe64.exec-helper.payload",FN=1});import{createRequire as zN}from"node:module";var VN,SW,jb=d(()=>{VN=new URL("./../node_modules/@jskit-ai/kernel/server/s\
|
|
1828
|
+
upport/symlinkSafeRequire.js",import.meta.url).href,SW=zN(VN)});var xW,RW,PW,CW,Db=d(()=>{F();xW=Object.freeze(["bundled","dev_server"]),RW=Object.freeze(["capacitor"]),PW=Object.freeze(
|
|
1829
1829
|
{callbackPath:"/auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),CW=Object.freeze({packageName:"",minSdk:26,
|
|
1830
|
-
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var Ub=d(()=>{
|
|
1831
|
-
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var Bl=d(()=>{
|
|
1832
|
-
import
|
|
1833
|
-
path",r=
|
|
1834
|
-
absolute path.`,r);return n}async function Er(e="",{cwd:t="",errorCode:r=
|
|
1835
|
-
r):
|
|
1830
|
+
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var Ub=d(()=>{F();Db()});var Dl=d(()=>{});var Ul=d(()=>{});var Bb=d(()=>{Dl();F();Ul()});var Gb=d(()=>{});var JW,KW,Fb=d(()=>{F();Gb();Dl();JW=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),KW=Object.
|
|
1831
|
+
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var Bl=d(()=>{F()});import{spawn as WN}from"node:child_process";import{constants as Gl}from"node:fs";import{open as YN}from"node:fs/promises";
|
|
1832
|
+
import Fl from"node:path";function Qi(e="",t=Vl){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function Vb(e="",t="\
|
|
1833
|
+
path",r=Vl){let n=String(e||"").trim();if(!n||!Fl.isAbsolute(n)||Fl.normalize(n)!==n)throw Qi(`${t} must be a normalized\
|
|
1834
|
+
absolute path.`,r);return n}async function Er(e="",{cwd:t="",errorCode:r=Vl}={}){let n=Vb(e,"lockPath",r),o=t?Vb(t,"cwd",
|
|
1835
|
+
r):Fl.dirname(n),i=await YN(n,Gl.O_CREAT|Gl.O_NOFOLLOW|Gl.O_RDWR,432),s=null,a="",c=Promise.resolve({code:null,signal:null});
|
|
1836
1836
|
try{if(s=WN("/bin/sh",["-c","/usr/bin/flock --exclusive --nonblock 3 || exit 1; printf 'locked\\n'; IFS= read -r _ || tru\
|
|
1837
1837
|
e"],{cwd:o,env:{PATH:"/usr/bin:/bin"},stdio:["pipe","pipe","pipe",i.fd]}),c=new Promise(p=>{s.once("close",(f,h)=>p({code:f,
|
|
1838
|
-
signal:h}))}),!await new Promise((p,f)=>{let h="",
|
|
1838
|
+
signal:h}))}),!await new Promise((p,f)=>{let h="",w=!1,E=(_,m)=>{w||(w=!0,_(m))};s.once("error",_=>E(f,_)),s.stderr.on("\
|
|
1839
1839
|
data",_=>{a=`${a}${String(_||"")}`.slice(-4096)}),s.stdout.on("data",_=>{h+=String(_||""),h.includes(`
|
|
1840
1840
|
`)&&E(p,!0)}),s.once("exit",_=>{if(_===1){E(p,!1);return}E(f,Qi(`Exclusive file lock process failed${a?`: ${a.trim()}`:"\
|
|
1841
1841
|
."}`,r))})}))return await i.close(),null;let u=!1;return async()=>{if(!u){u=!0;try{if(s.stdin.end(`release
|
|
1842
1842
|
`),(await c).code!==0)throw Qi(`Exclusive file lock process exited unexpectedly${a?`: ${a.trim()}`:"."}`,r)}finally{await i.
|
|
1843
1843
|
close()}}}}catch(l){throw s?.stdin?.destroy(),s?.kill("SIGTERM"),await c,await i.close().catch(()=>null),l?.code===r?l:Qi(
|
|
1844
|
-
l?.message||String(l||"Exclusive file lock failed."),r)}}var
|
|
1844
|
+
l?.message||String(l||"Exclusive file lock failed."),r)}}var Vl,zb=d(()=>{Vl="file_lock_failed"});var JN,iY,Hb=d(()=>{JN="jskit-client-build",iY=new RegExp(`<meta name="${JN}" content="([0-9a-f]+)"`,"u")});import XN from"node:path";var dY,qb=d(()=>{Hb();Bl();dY=XN.join("dist","index.html")});var Zi=d(()=>{jb();Ub();Bb();Ul();Fb();Bl();zb();qb()});var Wb=d(()=>{Zi()});function QN(e={}){return Fe(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1845
1845
|
session?.metadata?.session_git_command_actor_user_key)}async function Yb(e={}){let t=P(e.actor)||"daemon";if(t==="app"&&
|
|
1846
1846
|
e.applicationAccount)return{actor:t,applicationAccount:!0,credentialScope:t,requiresRealUser:!1,user:await Pa(e.applicationAccount)};
|
|
1847
1847
|
if(t==="daemon"||t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:Ra()};let r=QN(e);if(!r){let n=new Error(
|
|
1848
1848
|
"A user key is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,
|
|
1849
|
-
credentialScope:"user",requiresRealUser:!0,user:await Pa(r)}}var Jb=d(()=>{W();
|
|
1849
|
+
credentialScope:"user",requiresRealUser:!0,user:await Pa(r)}}var Jb=d(()=>{W();er()});import Kb from"node:path";function _r(e={}){let t=cm();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.
|
|
1850
1850
|
user?.gid}function zl(){return!!ke().execHelperPath}function es(e={}){return e.requiresRealUser?zl()||!_r(e):!1}function Xb(e={},t={},r=""){
|
|
1851
1851
|
if(!e.requiresRealUser)return;let n=N(t.session?.sourceRoot||t.session?.sourcePath),o=N(r);if(!n||!o||!Ze(n,o))return;let i=new Error(
|
|
1852
1852
|
"Commands in a session's source must run as the editor's own user, not as a person's account.");throw i.code="vibe64_com\
|
|
1853
1853
|
mand_managed_source_real_user_forbidden",i}function Qb(e={},t={}){let r=N(e.user?.home),n=N(t.HOME),o=N(t.VIBE64_CREDENTIAL_HOME);
|
|
1854
1854
|
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&Kb.resolve(r)!==Kb.resolve(n)){let i=new Error("Command HOME does not match t\
|
|
1855
|
-
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var ts=d(()=>{
|
|
1855
|
+
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var ts=d(()=>{er();st();W()});function rs(...e){let t={};for(let r of e){let n=ge(r);for(let o of _n)n[o]!==void 0&&(t[o]=n[o])}return t}var _n,ns=d(()=>{
|
|
1856
1856
|
W();_n=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1857
1857
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1858
1858
|
R","VIBE64_MYSQL_USER"])});import{spawn as ZN,spawnSync as ek}from"node:child_process";import{createHash as tk}from"node:crypto";import{statSync as rk}from"node:fs";
|
|
1859
1859
|
import{stat as iE}from"node:fs/promises";import os from"node:path";function eE(e="",t="vibe64"){return P(e).toLowerCase().
|
|
1860
1860
|
replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function sk(...e){for(let t of e){let r=X(t),n=X(r.user),
|
|
1861
|
-
o=
|
|
1861
|
+
o=Fe(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,n.user_name),i=Fe(r.email,r.userEmail,
|
|
1862
1862
|
r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,n.user_email);if(o&&i)return{authorEmail:i,authorName:o,
|
|
1863
|
-
committerEmail:i,committerName:o,source:"configured"}}return null}function ak(e={}){let t=X(e),r=
|
|
1864
|
-
t.login,t.username),n=
|
|
1863
|
+
committerEmail:i,committerName:o,source:"configured"}}return null}function ak(e={}){let t=X(e),r=Fe(t.name,t.displayName,
|
|
1864
|
+
t.login,t.username),n=Fe(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:{authorEmail:n,authorName:r,committerEmail:n,
|
|
1865
1865
|
committerName:r,source:"github"}}function ck({workspace:e="",userKey:t=""}={}){let r=eE(t,"user"),n=eE(e,"local");return{
|
|
1866
1866
|
authorEmail:`${r}@${n}${Zb}`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}${Zb}`,committerName:"Vibe64",source:"\
|
|
1867
1867
|
fallback"}}function Hl(e=""){let t=P(e);return t&&os.isAbsolute(t)?t:""}function tE(e=""){let t=Hl(e);try{return t&&rk(t).
|
|
@@ -1888,18 +1888,18 @@ let r=uE(t),n=tE(e);return lE(n&&nE(n,r)||nE(tE(t.HOME),r))}function gk(e={}){le
|
|
|
1888
1888
|
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function dE({env:e,personGitIdentity:t=null,
|
|
1889
1889
|
project:r={},session:n={}}){let o=X(n.metadata);return sk(r.gitIdentity,r.config?.git,n.gitIdentity,o.git_identity,{name:e.
|
|
1890
1890
|
VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||gk(t)}function pE({actor:e={},env:t,project:r={},session:n={},userKey:o=""}){
|
|
1891
|
-
let i=X(n.metadata);return ak(r.githubUser||n.githubUser||i.github_user)||ck({workspace:
|
|
1892
|
-
t.VIBE64_RUNTIME_NAMESPACE),userKey:
|
|
1893
|
-
LOGNAME)})}async function
|
|
1894
|
-
{})||pE(e)}function mE(e){return{[
|
|
1895
|
-
return mE(await
|
|
1896
|
-
ME",
|
|
1891
|
+
let i=X(n.metadata);return ak(r.githubUser||n.githubUser||i.github_user)||ck({workspace:Fe(r.workspace,t.VIBE64_WORKSPACE,
|
|
1892
|
+
t.VIBE64_RUNTIME_NAMESPACE),userKey:Fe(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.
|
|
1893
|
+
LOGNAME)})}async function wk(e){return dE(e)||await fk(e.gitConfig||{})||pE(e)}function yk(e){return dE(e)||hk(e.gitConfig||
|
|
1894
|
+
{})||pE(e)}function mE(e){return{[jt]:e.authorEmail,[Mt]:e.authorName,[Ut]:e.committerEmail,[Dt]:e.committerName}}async function fE(e){
|
|
1895
|
+
return mE(await wk(e))}function hE(e){return mE(yk(e))}var Mt,jt,Dt,Ut,Zb,nk,sE,ok,ik,Sr,Tr=d(()=>{W();Mt="GIT_AUTHOR_NA\
|
|
1896
|
+
ME",jt="GIT_AUTHOR_EMAIL",Dt="GIT_COMMITTER_NAME",Ut="GIT_COMMITTER_EMAIL",Zb=".users.vibe64.invalid",nk=2e3,sE=["config",
|
|
1897
1897
|
"--get-regexp","^user\\.(name|email)$"],ok=3e4,ik=['git config --global user.name "Your Name"','git config --global user\
|
|
1898
1898
|
.email "you@example.com"'].join(`
|
|
1899
1899
|
`);Sr=new Map});import ql from"node:path";function ee({root:e=""}={}){return N(e||ke().runtimePackRoot)}function Yl(e=""){let t=ee();return(t?
|
|
1900
|
-
|
|
1901
|
-
let e=ee();return e?[ql.join(e,"policy-bin")]:[]}function bk(e=""){let t=P(e);return[...
|
|
1902
|
-
Wl,tJ,$e=d(()=>{W();st();
|
|
1900
|
+
vr[P(e)]?.binDirs||[]:[]).map(n=>ql.join(t,n))}function gE(){let e=ee();return e?[ql.join(e,"guard-bin")]:[]}function Jl(){
|
|
1901
|
+
let e=ee();return e?[ql.join(e,"policy-bin")]:[]}function bk(e=""){let t=P(e);return[...vr[t]?.managedCommands||[]]}var vr,
|
|
1902
|
+
Wl,tJ,$e=d(()=>{W();st();vr=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:[
|
|
1903
1903
|
"bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","p\
|
|
1904
1904
|
ackage-lock.json"],managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:["composer.json","compose\
|
|
1905
1905
|
r.lock"],managedCommands:["composer"]},cpp:{binDirs:["cpp/bin"],dependencyFiles:["CMakeLists.txt","vcpkg.json","vcpkg-co\
|
|
@@ -1930,41 +1930,41 @@ in"],managedCommands:["php"]},playwright:{binDirs:["playwright/bin"],identityPat
|
|
|
1930
1930
|
g_isready","postgres","psql"]},ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:[
|
|
1931
1931
|
"sqlite3"]}}),Wl=Object.freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","b\
|
|
1932
1932
|
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);tJ=
|
|
1933
|
-
Object.freeze({runtimePackManagedCommands:bk})});import{readFileSync as Ek}from"node:fs";import
|
|
1934
|
-
if(!t)return"";let r=
|
|
1935
|
-
/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!
|
|
1933
|
+
Object.freeze({runtimePackManagedCommands:bk})});import{readFileSync as Ek}from"node:fs";import wE from"node:path";function vk({runtimePackRoot:e=""}={}){let t=ee({root:e});
|
|
1934
|
+
if(!t)return"";let r=wE.join(t,yE,Sk),n;try{n=Ek(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}let o=n.split(
|
|
1935
|
+
/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!Tk.test(o[0]))throw new Error(
|
|
1936
1936
|
`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function bE({runtimePackRoot:e=""}={}){let t=ee({root:e}),
|
|
1937
|
-
r=N(ke().sharedCacheRoot),n=
|
|
1938
|
-
{[Xl]:n}:{}}}var is,Sn,Kl,Xl,
|
|
1939
|
-
ATH",Kl="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Xl="VIBE64_PLAYWRIGHT_VERSION",
|
|
1940
|
-
|
|
1937
|
+
r=N(ke().sharedCacheRoot),n=vk({runtimePackRoot:t});return{...r?{[is]:r}:{},...t?{[Sn]:wE.join(t,yE,_k),[Kl]:"1"}:{},...n?
|
|
1938
|
+
{[Xl]:n}:{}}}var is,Sn,Kl,Xl,yE,_k,Sk,Tk,Tn=d(()=>{W();st();$e();is="VIBE64_SHARED_CACHE_ROOT",Sn="PLAYWRIGHT_BROWSERS_P\
|
|
1939
|
+
ATH",Kl="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Xl="VIBE64_PLAYWRIGHT_VERSION",yE="playwright",_k="browsers",Sk="runtime.env",
|
|
1940
|
+
Tk=/^\d+\.\d+\.\d+$/u});function Ir(e={}){for(let t of Object.keys(ge(e)))if(Ik.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command ca\
|
|
1941
1941
|
llers cannot provide execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function ss(e={},t={}){
|
|
1942
1942
|
let{envPolicy:r="session"}=t,n=ge(e);Ir(n);let o=Object.fromEntries(Object.entries(n).filter(([i])=>!Ok.has(i)));return r===
|
|
1943
|
-
"deployment"?o:{...o,...rs(n)}}var Ik,Ok,as=d(()=>{W();ns();
|
|
1943
|
+
"deployment"?o:{...o,...rs(n)}}var Ik,Ok,as=d(()=>{W();ns();Tr();Tn();Ik=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER",
|
|
1944
1944
|
"VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIM\
|
|
1945
|
-
E_DIR"]),Ok=new Set([..._n,Mt,
|
|
1945
|
+
E_DIR"]),Ok=new Set([..._n,jt,Mt,Ut,Dt,Sn,Kl,Xl,is])});function Ak(e=""){let t=N(e);return t==="/home"||t.startsWith("/home/")}function EE({actor:e={},request:t={}}={}){let r=t.
|
|
1946
1946
|
credentialHome||{},n=N(r.home);if(!n)return{};let o=N(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error("Co\
|
|
1947
1947
|
mmand credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_actor\
|
|
1948
1948
|
_mismatch",a}if(!e.requiresRealUser&&Ak(n)&&o&&!Ze(o,n)){let a=new Error("A /home credential directory requires a matchi\
|
|
1949
1949
|
ng real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=P(r.username||e.user?.username);
|
|
1950
1950
|
return{...qr({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...N(r.cacheRoot)?{XDG_CACHE_HOME:N(r.cacheRoot)}:{},...N(r.
|
|
1951
1951
|
configRoot)?{XDG_CONFIG_HOME:N(r.configRoot)}:{},...N(r.dataRoot)?{XDG_DATA_HOME:N(r.dataRoot)}:{},...N(r.stateRoot)?{XDG_STATE_HOME:N(
|
|
1952
|
-
r.stateRoot)}:{}}}var _E=d(()=>{
|
|
1953
|
-
isAbsolute(o))continue;let i=SE.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function
|
|
1952
|
+
r.stateRoot)}:{}}}var _E=d(()=>{er();W()});import SE from"node:path";function Ck(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=P(n);if(!o||!SE.
|
|
1953
|
+
isAbsolute(o))continue;let i=SE.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function vn(e={},t=[]){let r={...e&&typeof e==
|
|
1954
1954
|
"object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?
|
|
1955
1955
|
n:0;for(let i of Array.isArray(t)?t:[]){let s=P(i?.key);s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(
|
|
1956
|
-
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function
|
|
1957
|
-
function
|
|
1958
|
-
return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Zl(e={}){return
|
|
1959
|
-
return
|
|
1956
|
+
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function TE(e=[]){return Ck(e).map(t=>({key:"safe.directory",value:t}))}
|
|
1957
|
+
function vE(e={},t=[]){return vn(e,TE(t))}function Nk(e=[]){return TE(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function Ql(){
|
|
1958
|
+
return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Zl(e={}){return vn(e,xk)}function kk(e={}){
|
|
1959
|
+
return vn(e,Rk)}function $k(e={}){return vn(e,Pk)}function IE(e={}){return kk(Zl(e))}function OE(e={}){return $k(Zl(e))}
|
|
1960
1960
|
var xk,Rk,Pk,bJ,AE=d(()=>{W();xk=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"\
|
|
1961
1961
|
url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),Rk=Object.freeze([{key:"credential.https://github.co\
|
|
1962
1962
|
m.helper",value:"!/usr/bin/env gh auth git-credential"}]),Pk=Object.freeze([{key:"credential.https://github.com.helper",
|
|
1963
1963
|
value:`!f() { case "$1" in get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);
|
|
1964
|
-
bJ=Object.freeze({applyGitConfigEntriesToEnv:
|
|
1964
|
+
bJ=Object.freeze({applyGitConfigEntriesToEnv:vn,githubSshToHttpsGitEnv:Zl,gitSafeDirectoryArgs:Nk})});function Mk(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requires a gitAuthToken.");throw t.
|
|
1965
1965
|
code="vibe64_command_git_auth_token_required",t}return OE({...Ql(),GIT_TERMINAL_PROMPT:"0",[Lk]:e.gitAuthToken})}function xE({
|
|
1966
1966
|
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r=Mk(e):(e.gitTransport==="\
|
|
1967
|
-
github-https"||e.purpose==="github")&&(r=IE({...t,...Ql()})),
|
|
1967
|
+
github-https"||e.purpose==="github")&&(r=IE({...t,...Ql()})),vE(r,e.gitSafeDirectories||[])}var Lk,RE=d(()=>{AE();Lk="VI\
|
|
1968
1968
|
BE64_GIT_AUTH_TOKEN"});import PE from"node:path";function CE({env:e={}}={}){return ee()?N(e[eu])||(N(e.HOME)?PE.join(N(e.HOME),".local"):""):""}
|
|
1969
1969
|
function NE(e={}){let t=CE(e);return t?{[eu]:t}:{}}function kE(e={}){let t=CE(e);return t?[PE.join(t,"bin")]:[]}var eu,tu=d(
|
|
1970
1970
|
()=>{W();$e();eu="NPM_CONFIG_PREFIX"});import{existsSync as jk,readdirSync as Dk}from"node:fs";import Uk from"node:os";import at from"node:path";import cs from"node:process";
|
|
@@ -1979,25 +1979,25 @@ let e=["/opt/homebrew","/usr/local"];return[...In(cs.env.PATH),...cs.platform===
|
|
|
1979
1979
|
t=>[...$E(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function ME({
|
|
1980
1980
|
env:e,existingPath:t="",inheritedPath:r="",runtimes:n=[],shimDirs:o=[]}){return St([...In(o.join(":")),...Jl(),...n.flatMap(
|
|
1981
1981
|
i=>Yl(i)),...gE(),...In(t||(r?"":e.PATH)),...Bk(cs.env),...In(r),...Gk(),...In(On)]).join(":")}var On,ls=d(()=>{W();$e();
|
|
1982
|
-
On="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"});import
|
|
1983
|
-
e)?e:{}).map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!
|
|
1982
|
+
On="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"});import Fk from"node:path";function zk(e={}){return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(
|
|
1983
|
+
e)?e:{}).map(([t,r])=>[String(t||"").trim(),String(r??"")]).filter(([t])=>t&&!Vk.has(t)&&!t.startsWith("GIT_")&&!t.startsWith(
|
|
1984
1984
|
"GH_")&&!t.startsWith("XDG_")))}function ru(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.
|
|
1985
1985
|
deployment?.env]:[e.project?.runtimeConfigEnv,e.project?.databaseEnv]}function Hk(e={}){return ru(e).reduce((t,r)=>e.envPolicy===
|
|
1986
1986
|
"deployment"?(Ir(r),{...t,...ge(r)}):{...t,...ss(r,e)},{})}function qk(e={},t={}){return t.envPolicy==="deployment"?[]:t.
|
|
1987
1987
|
envPolicy==="project"?ru(t):[e,...ru(t),t.project?.databaseEnv,t.session?.databaseEnv]}function jE({actor:e={},baseEnv:t,
|
|
1988
1988
|
localPath:r="",request:n={}}){let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=bE(),s=ss(n.env,n),a=String(t.XDG_RUNTIME_DIR||
|
|
1989
|
-
"").trim(),c={...qr(e.user,zk(t)),..._r(e)&&
|
|
1989
|
+
"").trim(),c={...qr(e.user,zk(t)),..._r(e)&&Fk.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...rs(...qk(t,n)),...Hk(n),...xE({actor:e,
|
|
1990
1990
|
request:n}),...s,...EE({actor:e,request:n}),...i},l={...c,...NE({env:c}),VIBE64_DECLARED_RUNTIMES:o},u=ME({env:l,existingPath:[
|
|
1991
1991
|
...kE({env:l}),l.PATH].filter(Boolean).join(":"),inheritedPath:r,runtimes:n.runtimes,shimDirs:n.shimDirs||[]});return{...l,
|
|
1992
1992
|
PATH:u,...ee()?{}:{VIBE64_TOOL_PATH:u}}}function DE({actor:e={},baseEnv:t,request:r={}},n){return{actor:e,env:t,gitConfig:{
|
|
1993
1993
|
cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.project,session:r.session,userKey:r.userKey}}async function UE(e){
|
|
1994
1994
|
let t=jE(e);return{...t,...await fE(DE(e,t))}}function nu(e){let t=jE(e);return{...t,...e.resolvedGitIdentityEnv||hE(DE(
|
|
1995
|
-
e,t))}}var
|
|
1996
|
-
|
|
1995
|
+
e,t))}}var Vk,ou=d(()=>{ts();er();ns();as();ns();_E();RE();Tr();Tr();Tn();tu();ls();$e();W();Vk=new Set([..._n,jt,Mt,Ut,
|
|
1996
|
+
Dt,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"])});import{Buffer as Wk}from"node:buffer";function GE(){return{code:"terminal_session_not_found",error:"Terminal session not\
|
|
1997
1997
|
found.",ok:!1}}function ct(e=""){return String(e||"default").trim()||"default"}function ps(e){let t=String(e||""),r=t.length;
|
|
1998
1998
|
for(let n=0;n<Yk&&(r=t.lastIndexOf(`
|
|
1999
1999
|
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>BE&&(t=t.slice(t.length-BE)),t}function An(e={}){return e.status===
|
|
2000
|
-
"running"||e.status==="closing"}function iu(e={}){return An(e)||e.status==="exited"}function
|
|
2000
|
+
"running"||e.status==="closing"}function iu(e={}){return An(e)||e.status==="exited"}function VE(e,t){try{return t(lt(e))===
|
|
2001
2001
|
!0}catch{return!1}}function Kk(e=0){let t=Math.floor(Number(e||0));return Number.isFinite(t)&&t>0?t:0}function Xk(e="",t={}){
|
|
2002
2002
|
let{outputLimit:r=0}=t,n=String(e||""),o=Kk(r);return!o||n.length<=o?{output:n,outputTruncated:!1}:{output:n.slice(n.length-
|
|
2003
2003
|
o),outputTruncated:!0}}function lt(e,t={}){let r=Xk(e.output,t);return{ok:!0,closeError:e.closeError||"",cols:e.cols||us,
|
|
@@ -2005,11 +2005,11 @@ createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.exi
|
|
|
2005
2005
|
lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,
|
|
2006
2006
|
metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,outputVersion:e.outputVersion||0,rows:e.rows||
|
|
2007
2007
|
ds,status:e.status}}function zE(e=""){return Wk.byteLength(String(e||""),"utf8")}function xn(e=0){let t=Math.floor(Number(
|
|
2008
|
-
e));return!Number.isFinite(t)||t<0?0:Math.min(t,Jk)}function Qk(e={}){return Math.max(
|
|
2009
|
-
e.lastInputAt),
|
|
2008
|
+
e));return!Number.isFinite(t)||t<0?0:Math.min(t,Jk)}function Qk(e={}){return Math.max(Zt(e.lastSubscriberDetachedAt),Zt(
|
|
2009
|
+
e.lastInputAt),Zt(e.lastOutputAt),Zt(e.createdAt))}function su(e={},t=Date.now()){if(e.subscribers?.size)return 0;let r=Qk(
|
|
2010
2010
|
e);return r>0?Math.max(0,Number(t)-r):0}function ms(e={}){e.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
2011
|
-
e.detachedCleanupTimer=null)}var BE,Yk,us,ds,QJ,Jk,ZJ,
|
|
2012
|
-
60*1e3,ZJ=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});
|
|
2011
|
+
e.detachedCleanupTimer=null)}var BE,Yk,us,ds,QJ,Jk,ZJ,FE,Or=d(()=>{W();BE=256*1024,Yk=300,us=100,ds=28,QJ=600*1e3,Jk=1440*
|
|
2012
|
+
60*1e3,ZJ=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});FE=new Map});function HE(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)?lt(e):(e.metadata={...e.metadata||{},...t},Le(e,{
|
|
2013
2013
|
metadata:e.metadata,type:"metadata"}),lt(e))}function qE(e,t=""){let r=zE(t);r<1||(e.outputVersion=Number(e.outputVersion||
|
|
2014
2014
|
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function Le(e,t){if(e?.subscribers?.size)for(let r of[
|
|
2015
2015
|
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function Zk(e){let t=String(e?.code||""),r=String(e?.message||
|
|
@@ -2021,7 +2021,7 @@ let n=`\r
|
|
|
2021
2021
|
[studio] ${r}\r
|
|
2022
2022
|
`;e.closeError=t,e.output=ps(`${e.output}${n}`),Le(e,{chunk:n,type:"output"}),Le(e,{error:t,type:"error"})}async function KE(e,{
|
|
2023
2023
|
code:t,flag:r,hook:n,label:o,payload:i}){if(e[r])return null;e[r]=!0;try{return await e[n](i),null}catch(s){let a=String(
|
|
2024
|
-
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,JE(e,a,`${o}: ${a}`),c}}function
|
|
2024
|
+
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,JE(e,a,`${o}: ${a}`),c}}function Bt(e,t){let r=`${String(
|
|
2025
2025
|
t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;return e.reportedLifecycleFailures||=new Set,e.reportedLifecycleFailures.
|
|
2026
2026
|
has(r)||(e.reportedLifecycleFailures.add(r),JE(e,String(t?.message||t||"Terminal cleanup failed."))),t}function fs(e,t=[]){
|
|
2027
2027
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
@@ -2035,36 +2035,36 @@ exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}}))),e.clos
|
|
|
2035
2035
|
return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await Ji(e.terminal.pid)){
|
|
2036
2036
|
let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execution_drain_failed",
|
|
2037
2037
|
t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function XE(e){try{await e.scopeDrainCompletion}catch(t){
|
|
2038
|
-
|
|
2038
|
+
Bt(e,t)}try{await Promise.all([au(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){Bt(e,t)}cu(e)}async function uu(e,t="\
|
|
2039
2039
|
stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="running"&&(e.status="clos\
|
|
2040
2040
|
ing",Le(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(e$(e,e.stopReason),!e.processExited&&!e.killStarted){
|
|
2041
2041
|
e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?n:new Error(String(n||"Termina\
|
|
2042
|
-
l process could not be killed."));o.code||="terminal_kill_failed",r.push(
|
|
2043
|
-
n))}return{failures:r}}var du=d(()=>{
|
|
2044
|
-
ok:!1}:null}var t$,ZE=d(()=>{Or();t$=new Map});function Ar(e){return
|
|
2045
|
-
e.delete(r);let n=ct(t);e.size<1&&
|
|
2042
|
+
l process could not be killed."));o.code||="terminal_kill_failed",r.push(Bt(e,o))}}try{await lu(e)}catch(n){r.push(Bt(e,
|
|
2043
|
+
n))}return{failures:r}}var du=d(()=>{wn();Or()});function r$(e="default"){return t$.get(ct(e))||null}function QE(e="default"){let t=r$(e);return t?{code:t.code,error:t.error,
|
|
2044
|
+
ok:!1}:null}var t$,ZE=d(()=>{Or();t$=new Map});function Ar(e){return Gt.get(ct(e))||FE}function e_(e){let t=ct(e);return Gt.has(t)||Gt.set(t,new Map),Gt.get(t)}function t_(e,t,r){
|
|
2045
|
+
e.delete(r);let n=ct(t);e.size<1&&Gt.get(n)===e&&Gt.delete(n)}function n$(e=""){let t=String(e||"");return[...Gt.keys()].
|
|
2046
2046
|
filter(r=>r.startsWith(t))}function hs({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[ct(e)]:n$(t),
|
|
2047
|
-
o=[];for(let i of n){let s=Ar(i);for(let a of s.values())r&&!An(a)||o.push({namespace:i,session:a})}return o}var
|
|
2048
|
-
()=>{Or();
|
|
2047
|
+
o=[];for(let i of n){let s=Ar(i);for(let a of s.values())r&&!An(a)||o.push({namespace:i,session:a})}return o}var Gt,pu=d(
|
|
2048
|
+
()=>{Or();Gt=new Map});function gs(e={},t="default"){if(ms(e),!iu(e)||e.subscribers?.size)return;let r=xn(e.detachedIdleTimeoutMs);if(r<1)return;
|
|
2049
2049
|
let n=Math.max(0,r-su(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedCleanupTimer=null,o$({namespace:t})},n)}async function mu(e,t={}){
|
|
2050
2050
|
let{namespace:r="default"}=t,n=Ar(r),o=n.get(e);if(!o)return{ok:!0,closed:!1};if(o.closePromise)return o.closePromise;let i=(async()=>{
|
|
2051
2051
|
let s=[];if(ms(o),!o.processExited){let l=await uu(o,"close");if(l.failures.length)throw fs(o,l.failures)}try{await o.exitCompletion}catch(l){
|
|
2052
|
-
s.push(
|
|
2052
|
+
s.push(Bt(o,l))}try{await o.scopeDrainCompletion}catch(l){s.push(Bt(o,l))}let c=(await Promise.all([o.stopHookCompletion,
|
|
2053
2053
|
o.closeHookCompletion])).filter(Boolean);if(o.processExited&&cu(o),s.length>0)throw fs(o,[...s,...c]);return t_(n,r,e),{
|
|
2054
2054
|
ok:!0,closed:!0,...c.length>0?{cleanupErrors:c.map(l=>String(l?.message||l))}:{}}})();o.closePromise=i;try{return await i}finally{
|
|
2055
2055
|
o.closePromise===i&&(o.closePromise=null)}}async function o$({namespace:e}){for(let{namespace:t,session:r}of hs({namespace:e})){
|
|
2056
2056
|
if(!iu(r)||r.subscribers?.size)continue;let n=xn(r.detachedIdleTimeoutMs);if(!(n<1)){if(su(r)<n){gs(r,t);continue}await mu(
|
|
2057
2057
|
r.id,{namespace:t})}}}var fu=d(()=>{W();du();pu();Or()});import s$ from"node:crypto";import{createRequire as a$}from"node:module";function hu(){}function c$(){return!0}function u$({
|
|
2058
|
-
filter:e,namespacePrefix:t}){return hs({namespacePrefix:t,runningOnly:!0}).filter(r=>
|
|
2058
|
+
filter:e,namespacePrefix:t}){return hs({namespacePrefix:t,runningOnly:!0}).filter(r=>VE(r.session,e)).length}function r_({
|
|
2059
2059
|
args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s={},namespace:a="default",namespaceLimitPrefix:c="",
|
|
2060
|
-
runningLimitFilter:l=c$,onClose:u=hu,onOutput:p=hu,onStop:f=hu,reuseRunning:h=!1,detachedIdleTimeoutMs:
|
|
2061
|
-
if(E)return E;let _=Ar(a),m=s$.randomUUID(),g=typeof h=="function"?h:()=>!!h,
|
|
2062
|
-
if(
|
|
2063
|
-
t",error:`Terminal limit reached (${S}).`};let b=typeof o=="function"?o({id:m,namespace:a}):o,
|
|
2064
|
-
env:b,id:m,namespace:a}):e,O=typeof r=="function"?r({args:
|
|
2065
|
-
env:b,id:m,namespace:a}):s,x=l$("node-pty").spawn(t,
|
|
2060
|
+
runningLimitFilter:l=c$,onClose:u=hu,onOutput:p=hu,onStop:f=hu,reuseRunning:h=!1,detachedIdleTimeoutMs:w=0}){let E=QE(a);
|
|
2061
|
+
if(E)return E;let _=Ar(a),m=s$.randomUUID(),g=typeof h=="function"?h:()=>!!h,y=h?[..._.values()].find(q=>An(q)&&g(q)):null;
|
|
2062
|
+
if(y)return lt(y);let S=Number(i||0),v=c||a;if(S>0&&u$({filter:l,namespacePrefix:v})>=S)return{ok:!1,code:"terminal_limi\
|
|
2063
|
+
t",error:`Terminal limit reached (${S}).`};let b=typeof o=="function"?o({id:m,namespace:a}):o,T=typeof e=="function"?e({
|
|
2064
|
+
env:b,id:m,namespace:a}):e,O=typeof r=="function"?r({args:T,env:b,id:m,namespace:a}):r,I=typeof s=="function"?s({args:T,
|
|
2065
|
+
env:b,id:m,namespace:a}):s,x=l$("node-pty").spawn(t,T,{cols:us,cwd:n,env:X(b),name:"xterm-color",rows:ds}),j,$=new Promise(
|
|
2066
2066
|
q=>{j=q}),k={id:m,closeHookCompletion:null,closePromise:null,commandPreview:O,cols:us,createdAt:new Date().toISOString(),
|
|
2067
|
-
cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:xn(
|
|
2067
|
+
cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:xn(w),exitCompletion:$,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().
|
|
2068
2068
|
toISOString(),metadata:I&&typeof I=="object"&&!Array.isArray(I)?I:{},onClose:u,onStop:f,inputVersion:0,lastInputAt:"",lastInputBytes:0,
|
|
2069
2069
|
lastOutputAt:"",lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,
|
|
2070
2070
|
processExited:!1,killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:j,rows:ds,status:"running",stopHookCompletion:null,
|
|
@@ -2078,20 +2078,20 @@ lt(i,{outputLimit:n}):GE()}var i$,l$,n_=d(()=>{W();Or();du();ZE();fu();pu();i$=n
|
|
|
2078
2078
|
execution/src/server/engines/terminalSessions.js",import.meta.url).href;l$=a$(i$)});import{randomUUID as p$}from"node:crypto";import{mkdirSync as m$,writeFileSync as f$}from"node:fs";import gu from"node:path";
|
|
2079
2079
|
function h$(){}function g$(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
2080
2080
|
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=gu.join(gu.resolve(t),
|
|
2081
|
-
"exec-helper-payloads");return m$(r,{mode:448,recursive:!0}),gu.join(r,`${process.pid}-${Date.now()}-${p$()}.json`)}function
|
|
2081
|
+
"exec-helper-payloads");return m$(r,{mode:448,recursive:!0}),gu.join(r,`${process.pid}-${Date.now()}-${p$()}.json`)}function w$(e,t){
|
|
2082
2082
|
let{actor:r,cwd:n,env:o,resolveEnv:i}=t,s=e.terminal||{},a=e.envFactory?i:o;return es(r)?{args:(c={})=>{let l=g$(s.helperPayloadRoot),
|
|
2083
2083
|
u=typeof e.args=="function"?e.args(c):e.args,p=Ki({actor:r,args:u,command:e.command,cwd:n,env:typeof a=="function"?a(c):
|
|
2084
2084
|
a,input:e.input,operation:En(e)});return f$(l,`${JSON.stringify(p)}
|
|
2085
2085
|
`,{mode:384}),["-n",Ml(),"execute",l]},command:"sudo",cwd:s.helperPayloadRoot,env:{PATH:process.env.PATH||On}}:{args:e.args,
|
|
2086
2086
|
command:e.command,cwd:n,env:a}}async function i_(e={},t={}){let{actor:r,cwd:n,env:o,resolveEnv:i}=t;try{let s=e.terminal||
|
|
2087
|
-
{},{onClose:a=h$}=s,c=e.execution?.id||"",l=
|
|
2087
|
+
{},{onClose:a=h$}=s,c=e.execution?.id||"",l=w$(e,{actor:r,cwd:n,env:o,resolveEnv:i}),u=r_({args:l.args,command:l.command,
|
|
2088
2088
|
commandPreview:s.commandPreview,cwd:l.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:l.env,maxRunning:s.maxRunning,
|
|
2089
2089
|
metadata:s.metadata,namespace:s.namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async p=>{try{await a(p)}finally{
|
|
2090
2090
|
c&&o_.set(c,{id:p.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.reuseRunning,
|
|
2091
2091
|
runningLimitFilter:s.runningLimitFilter});return u?.ok===!0&&c&&o_.set(c,{id:u.id,namespace:s.namespace}),u?.ok===!0?{...u,
|
|
2092
2092
|
execution:e.execution}:u}catch(s){return Z(s?.message||"Vibe64 PTY command failed.",s?.code||"vibe64_command_pty_failed",
|
|
2093
|
-
{execution:e.execution})}}var o_,
|
|
2094
|
-
resolveLinks:n=!0}=t,o=
|
|
2093
|
+
{execution:e.execution})}}var o_,wu=d(()=>{$t();ls();n_();fu();Xi();ts();o_=new Map});import{realpathSync as s_}from"node:fs";function y$(e=""){return N(e||process.cwd())}function a_(e="",t={}){let{allowedRoots:r=[],
|
|
2094
|
+
resolveLinks:n=!0}=t,o=y$(e),i=(Array.isArray(r)?r:[r]).map(N).filter(Boolean);if(i.length===0)return o;let s=i.filter(c=>Ze(
|
|
2095
2095
|
c,o));if(s.length>0){if(!n)return o;let c=s_(o);if(s.some(l=>Ze(s_(l),c)))return c}let a=new Error("Vibe64 command cwd i\
|
|
2096
2096
|
s outside the allowed roots.");throw a.code="vibe64_command_cwd_outside_allowed_roots",a}var c_=d(()=>{W()});import{randomUUID as b$}from"node:crypto";function ce(e="",t="vibe64_command_request_invalid"){let r=new Error(e||"Inval\
|
|
2097
2097
|
id Vibe64 command request.");return r.code=t,r}function ut(e="",t=[],r="",n="value"){let o=P(e)||r;if(!t.includes(o))throw ce(
|
|
@@ -2100,7 +2100,7 @@ mode:r="capture"}=t;if(typeof e=="function"){if(r!=="pty")throw ce("Function-val
|
|
|
2100
2100
|
PTY commands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(n=>String(n??""))}
|
|
2101
2101
|
function N$(e={},t={}){let{mode:r="capture"}=t;if(typeof e=="function"){if(r!=="pty")throw ce("Function-valued command e\
|
|
2102
2102
|
nv is only supported for PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let n=ge(
|
|
2103
|
-
e);return Ir(n),{env:n,envFactory:null}}function
|
|
2103
|
+
e);return Ir(n),{env:n,envFactory:null}}function yu(e=[]){return(Array.isArray(e)?e:[e]).map(N).filter(Boolean)}function k$(e={}){
|
|
2104
2104
|
let t=X(e);return{commandPreview:t.commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:N(t.helperPayloadRoot),
|
|
2105
2105
|
maxRunning:t.maxRunning,metadata:t.metadata,namespace:P(t.namespace),namespaceLimitPrefix:P(t.namespaceLimitPrefix),onClose:t.
|
|
2106
2106
|
onClose,onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function $$(e={}){
|
|
@@ -2127,9 +2127,9 @@ uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLow
|
|
|
2127
2127
|
e)?Wl:[]}function l_(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function U$(e={},t=""){let r=l_(e,"runt\
|
|
2128
2128
|
imes"),n=l_(e,"runtime");if(!r&&!n)return St(D$(t));let o=r?e.runtimes:e.runtime;return St((Array.isArray(o)?o:[o]).map(
|
|
2129
2129
|
P).filter(Boolean))}function d_(e={}){let t=X(e),r=P(t.command);if(!r)throw ce("A command is required.","vibe64_command_\
|
|
2130
|
-
required");let n=ut(t.mode,
|
|
2130
|
+
required");let n=ut(t.mode,T$,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))throw ce(
|
|
2131
2131
|
"Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=ge(t.baseEnv),i=N$(t.env,
|
|
2132
|
-
{mode:n}),s=ut(t.purpose,S$,"terminal","purpose"),a=U$(t,s);for(let h of a)if(!Object.hasOwn(
|
|
2132
|
+
{mode:n}),s=ut(t.purpose,S$,"terminal","purpose"),a=U$(t,s);for(let h of a)if(!Object.hasOwn(vr,h))throw ce(`Unsupported\
|
|
2133
2133
|
Vibe64 runtime: ${h}.`,"vibe64_command_runtime_unsupported");let c=X(t.project),l=X(t.session),u=t.releaseEnvironmentFile??
|
|
2134
2134
|
"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!=="app"||t.envPolicy!=="de\
|
|
2135
2135
|
ployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw ce("Release environment files require a\
|
|
@@ -2138,62 +2138,62 @@ ployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw
|
|
|
2138
2138
|
pp"))throw ce("A usage recording preload belongs only to a Preview or Output target launch.","vibe64_command_usage_recor\
|
|
2139
2139
|
ding_preload_invalid");let f=t.applicationAccount??"";if(typeof f!="string"||f&&(!_$.test(f)||t.actor!=="app"||n!=="capt\
|
|
2140
2140
|
ure"))throw ce("Application accounts run only finite application commands.","vibe64_command_application_account_invalid");
|
|
2141
|
-
return{actor:ut(t.actor,E$,"daemon","actor"),applicationAccount:f,allowedRoots:
|
|
2141
|
+
return{actor:ut(t.actor,E$,"daemon","actor"),applicationAccount:f,allowedRoots:yu(t.allowedRoots),args:C$(t.args,{mode:n}),
|
|
2142
2142
|
baseEnv:o,command:r,cwd:N(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:ut(t.envPolicy,I$,"session",
|
|
2143
2143
|
"env_policy"),releaseEnvironmentFile:u,execution:u_(t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:$$(
|
|
2144
|
-
t.credentialHome),gitAuthToken:P(t.gitAuthToken),gitSafeDirectories:
|
|
2144
|
+
t.credentialHome),gitAuthToken:P(t.gitAuthToken),gitSafeDirectories:yu(t.gitSafeDirectories),personGitIdentity:{email:P(
|
|
2145
2145
|
t.personGitIdentity?.email),name:P(t.personGitIdentity?.name)},gitTransport:ut(t.gitTransport,O$,"none","git_transport"),
|
|
2146
2146
|
inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,input:t.input,logPath:N(t.logPath),maxBuffer:Number.isSafeInteger(Number(
|
|
2147
2147
|
t.maxBuffer))&&Number(t.maxBuffer)>0?Number(t.maxBuffer):R$,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,
|
|
2148
|
-
outputEncoding:ut(t.outputEncoding,
|
|
2149
|
-
null,shimDirs:
|
|
2150
|
-
0?Number(t.timeout):15e3,usageRecordingPreload:p,userKey:P(t.userKey)}}var E$,_$,S$,v$,
|
|
2148
|
+
outputEncoding:ut(t.outputEncoding,v$,"utf8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??
|
|
2149
|
+
null,shimDirs:yu(t.shimDirs),terminal:k$(t.terminal),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>
|
|
2150
|
+
0?Number(t.timeout):15e3,usageRecordingPreload:p,userKey:P(t.userKey)}}var E$,_$,S$,T$,v$,I$,O$,A$,x$,R$,P$,QK,p_=d(()=>{
|
|
2151
2151
|
W();as();$e();E$=Object.freeze(["daemon","owner-user","named-user","app"]),_$=/^[a-z_][a-z0-9_-]{0,31}$/u,S$=Object.freeze(
|
|
2152
2152
|
["account","assistant","terminal","codex","github","github-api","source-editor","preview","output","deployment","health",
|
|
2153
|
-
"workspace-cache","source"]),
|
|
2153
|
+
"workspace-cache","source"]),T$=Object.freeze(["capture","pty","detached"]),v$=Object.freeze(["utf8","base64"]),I$=Object.
|
|
2154
2154
|
freeze(["session","project","preview","auth","deployment"]),O$=Object.freeze(["none","github-https","github-token"]),A$=
|
|
2155
2155
|
Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),x$=Object.freeze(["finite","intera\
|
|
2156
2156
|
ctive","service"]),R$=1e3*1e3*100,P$=new Set(["assistant","codex","deployment","output","preview","source","terminal"]);
|
|
2157
|
-
QK=Object.freeze({normalizeExecutionDescriptor:u_})});function bu(){return B$}function
|
|
2158
|
-
()=>{bn();
|
|
2157
|
+
QK=Object.freeze({normalizeExecutionDescriptor:u_})});function bu(){return B$}function ws(e){return["1","true"].includes(String(e[m_]||"").trim().toLowerCase())}var B$,m_,ys=d(
|
|
2158
|
+
()=>{bn();wn();wu();$t();B$=null,m_="VIBE64_MANAGED_EXECUTION_REQUIRED"});import{realpathSync as f_,statSync as F$}from"node:fs";import dt from"node:path";import{fileURLToPath as V$}from"node:url";
|
|
2159
2159
|
function z$(e){let t=[dt.resolve(dt.dirname(e),"../../../vibe64-usage-recording/runtime/node")];for(let r=dt.dirname(e);t.
|
|
2160
2160
|
push(dt.join(r,"node_modules/@local/vibe64-usage-recording/runtime/node")),dt.dirname(r)!==r;r=dt.dirname(r));return t.flatMap(
|
|
2161
|
-
r=>{try{return[f_(r)]}catch{return[]}})}function h_(e="",t=
|
|
2161
|
+
r=>{try{return[f_(r)]}catch{return[]}})}function h_(e="",t=V$(G$)){try{if(dt.resolve(e)===e&&f_(e)===e&&F$(e).isFile()&&
|
|
2162
2162
|
z$(t).some(r=>e.startsWith(`${r}${dt.sep}`)))return`--import=${e}`}catch{}throw Object.assign(new Error("The usage recor\
|
|
2163
2163
|
der is not part of this Vibe64 installation."),{code:"vibe64_usage_recording_preload_invalid"})}var G$,g_=d(()=>{G$=new URL(
|
|
2164
|
-
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function
|
|
2164
|
+
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function w_(e){return e.releaseEnvironmentFile?Z("Release environment execution requires a managed host.","vibe64_releas\
|
|
2165
2165
|
e_environment_unavailable",{execution:e.execution}):e.applicationAccount?Z("Application account execution requires a man\
|
|
2166
2166
|
aged host.","vibe64_application_account_unavailable",{execution:e.execution}):null}async function H$(e,t={}){let{actor:r,
|
|
2167
|
-
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=
|
|
2167
|
+
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=w_(e);if(a)return a;if(e.usageRecordingPreload){let c=h_(e.usageRecordingPreload),
|
|
2168
2168
|
l=s;o={...o,NODE_OPTIONS:c},s=u=>({...l(u),NODE_OPTIONS:c})}return e.mode==="pty"?i_(e,{actor:r,cwd:n,env:o,resolveEnv:s}):
|
|
2169
2169
|
e.mode==="detached"?r.requiresRealUser&&(!_r(r)||i)?Z("Detached real-user command execution is unsupported when the help\
|
|
2170
2170
|
er is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):kb(e,{actor:r,cwd:n,env:o}):i?
|
|
2171
2171
|
{...await jl(Ki({actor:r,args:e.args,command:e.command,cwd:n,env:o,input:e.input,operation:En(e)}),{env:process.env,maxBuffer:e.
|
|
2172
|
-
maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.execution}:
|
|
2172
|
+
maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.execution}:yn(e.command,e.args,
|
|
2173
2173
|
{cwd:n,env:o,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,onOutput:e.onOutput,outputEncoding:e.outputEncoding,
|
|
2174
2174
|
signal:e.signal,timeout:e.timeout})}async function Rr(e={}){let t=null;try{if(t=d_(e),t.signal?.aborted)return Z("Comman\
|
|
2175
2175
|
d cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Yb(t),n=t.inheritProcessEnv?{...process.env,
|
|
2176
|
-
...t.baseEnv}:{...t.baseEnv},o=(m={})=>({...m,VIBE64_EXECUTION_ID:t.execution.id}),i=bu(),s=
|
|
2176
|
+
...t.baseEnv}:{...t.baseEnv},o=(m={})=>({...m,VIBE64_EXECUTION_ID:t.execution.id}),i=bu(),s=ws(n)||ws(process.env),a=es(
|
|
2177
2177
|
r),l=!(!!i||s||zl())&&_r(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",u=o(await UE({actor:r,baseEnv:n,localPath:l,
|
|
2178
|
-
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),p=Object.fromEntries([Mt,
|
|
2178
|
+
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),p=Object.fromEntries([jt,Mt,Ut,Dt].map(m=>[m,u[m]]));
|
|
2179
2179
|
Qb(r,u);let f=a_(t.cwd,{allowedRoots:t.allowedRoots,resolveLinks:!t.applicationAccount});Xb(r,t,f);let h=(m={})=>typeof t.
|
|
2180
|
-
args=="function"?t.args(m):t.args,
|
|
2181
|
-
...t,env:t.envFactory(m),envFactory:null}}):u),E=(m=t,g={})=>H$(m,{actor:r,cwd:f,env:u,requiresHelper:a,resolveEnv:
|
|
2182
|
-
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:f,env:u,resolveArgs:h,resolveEnv:
|
|
2180
|
+
args=="function"?t.args(m):t.args,w=(m={})=>o(t.envFactory?nu({actor:r,baseEnv:n,localPath:l,resolvedGitIdentityEnv:p,request:{
|
|
2181
|
+
...t,env:t.envFactory(m),envFactory:null}}):u),E=(m=t,g={})=>H$(m,{actor:r,cwd:f,env:u,requiresHelper:a,resolveEnv:w,...g});
|
|
2182
|
+
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:f,env:u,resolveArgs:h,resolveEnv:w,runLocal:E});let _=w_(t);return _||
|
|
2183
2183
|
(s?Z("Managed execution safety is unavailable. Vibe64 did not start this work.","vibe64_managed_execution_provider_unava\
|
|
2184
2184
|
ilable",{execution:t.execution,retryable:!1}):E())}catch(r){return Z(r?.message||"Vibe64 command failed.",r?.code||"vibe\
|
|
2185
|
-
64_command_failed",{execution:t?.execution})}}var Rn=d(()=>{Jb();ou();
|
|
2186
|
-
g_()});import{fileURLToPath as W$}from"node:url";var q$,P3,C3,N3,k3,
|
|
2185
|
+
64_command_failed",{execution:t?.execution})}}var Rn=d(()=>{Jb();ou();Tr();bn();Xi();wn();wu();c_();ts();p_();$t();ys();
|
|
2186
|
+
g_()});import{fileURLToPath as W$}from"node:url";var q$,P3,C3,N3,k3,y_=d(()=>{st();Rn();q$=new URL("./../node_modules/@local/vi\
|
|
2187
2187
|
be64-execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,P3=W$(new URL("./gitTurnCheckpointCommand.js",q$)),
|
|
2188
2188
|
C3=15*6e4,N3=512*1024*1024,k3=1024*1024*1024});var M3,b_=d(()=>{W();M3=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"])});var E_=d(()=>{});import{existsSync as Y$}from"node:fs";import bs from"node:path";import __ from"node:process";function Eu(e=""){let t=String(
|
|
2189
|
-
e||"").trim();return K$[t]||t}function
|
|
2189
|
+
e||"").trim();return K$[t]||t}function T_({platform:e=__.platform,aptGet:t=!1}={}){return e==="darwin"?"brew":t?"apt":""}
|
|
2190
2190
|
function X$(e,t=On){return[...String(e.PATH||"").split(bs.delimiter),...String(t||"").split(bs.delimiter)].some(r=>bs.isAbsolute(
|
|
2191
|
-
r)&&Y$(bs.join(r,"apt-get")))}function _s({env:e,platform:t=__.platform,systemPath:r}){return
|
|
2191
|
+
r)&&Y$(bs.join(r,"apt-get")))}function _s({env:e,platform:t=__.platform,systemPath:r}){return T_({platform:t,aptGet:t!==
|
|
2192
2192
|
"darwin"&&X$(e,r)})}function Ss(e="",t={}){let{family:r="",mise:n=!1,xcode:o=!0}=t,i=Es[Eu(e)];if(!i)return null;if(r===
|
|
2193
2193
|
"brew"&&!o&&["git","cpp"].includes(Eu(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[r]||"";
|
|
2194
2194
|
if(!s&&i.mise&&(s=n?`mise use -g ${i.mise}`:`${J$} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith(
|
|
2195
|
-
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?S_:""}}var S_,J$,
|
|
2196
|
-
S_="You'll be asked for your computer password. Nothing shows while you type.",J$="curl -fsSL https://mise.run | sh",
|
|
2195
|
+
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?S_:""}}var S_,J$,V3,Es,K$,z3,Pn=d(()=>{ls();
|
|
2196
|
+
S_="You'll be asked for your computer password. Nothing shows while you type.",J$="curl -fsSL https://mise.run | sh",V3=
|
|
2197
2197
|
Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
2198
2198
|
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),Es=Object.freeze({claude:{
|
|
2199
2199
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
@@ -2219,12 +2219,12 @@ rl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -fsSL https
|
|
|
2219
2219
|
ild tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/install_ruby\
|
|
2220
2220
|
_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"sudo apt i\
|
|
2221
2221
|
nstall build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-dev",brew:"\
|
|
2222
|
-
brew install pkg-config libyaml openssl@3 gmp"}}),K$=Object.freeze({composer:"php"});z3=Object.freeze({SUDO_NOTE:S_,localToolFamily:
|
|
2222
|
+
brew install pkg-config libyaml openssl@3 gmp"}}),K$=Object.freeze({composer:"php"});z3=Object.freeze({SUDO_NOTE:S_,localToolFamily:T_})});function v_({env:e,platform:t,systemPath:r}){return Ss("git",{family:_s({env:e,platform:t,systemPath:r})})?.command||""}
|
|
2223
2223
|
function Q$(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
2224
|
-
`)}function Z$(e,t){let r=Q$(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=
|
|
2224
|
+
`)}function Z$(e,t){let r=Q$(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=v_(t);
|
|
2225
2225
|
return{code:"vibe64_git_missing",installCommand:n,message:n?`Git isn't installed on this computer. Install it with: ${n}`:
|
|
2226
2226
|
"Git isn't installed on this computer. Install Git, then try again."}}return/unknown option [`']initial-branch/u.test(r)?
|
|
2227
|
-
{code:"vibe64_git_too_old",installCommand:
|
|
2227
|
+
{code:"vibe64_git_too_old",installCommand:v_(t),message:"This Git is too old for Vibe64. Update Git to version 2.28 or n\
|
|
2228
2228
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
2229
2229
|
test(r)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
2230
2230
|
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\
|
|
@@ -2321,7 +2321,7 @@ while read -r old_object _new_object ref_name; do
|
|
|
2321
2321
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
2322
2322
|
fi
|
|
2323
2323
|
done <"$updates_file"
|
|
2324
|
-
`;Z3=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:x_,canonicalRepositoryBackupPath:r0})});var P_=d(()=>{
|
|
2324
|
+
`;Z3=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:x_,canonicalRepositoryBackupPath:r0})});var P_=d(()=>{Tn();$e()});var Su=d(()=>{});var C_=d(()=>{});var N_=d(()=>{});var Tu=d(()=>{});var u9,k_=d(()=>{C_();N_();Tu();u9=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBro\
|
|
2325
2325
|
wserWorkerSource.js",import.meta.url).href});var o0,$_=d(()=>{o0=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms\
|
|
2326
2326
|
>]"," vibe64-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [\
|
|
2327
2327
|
--json]"," vibe64-helper preview inspect-url"," vibe64-helper preview screenshot [--output <path>]"," vibe64-helper p\
|
|
@@ -2359,13 +2359,13 @@ y reread empty or unchanged logs between brief waits.","This is the canonical pr
|
|
|
2359
2359
|
application.","Do not start a duplicate copy of that application on another port.","A distinct secondary application exp\
|
|
2360
2360
|
licitly requested by the user, such as a reference app, may run separately without replacing this preview."].join(`
|
|
2361
2361
|
`)+`
|
|
2362
|
-
`});var L_=d(()=>{});import{fileURLToPath as l0}from"node:url";var c0,_9,M_=d(()=>{Rn();
|
|
2362
|
+
`});var L_=d(()=>{});import{fileURLToPath as l0}from"node:url";var c0,_9,M_=d(()=>{Rn();ys();st();c0=new URL("./../node_modules/@local/vibe64\
|
|
2363
2363
|
-execution/src/server/conversationExecution.js",import.meta.url).href,_9=l0(new URL("./engines/stdioBridge.js",c0))});var A9,j_=d(()=>{Rn();Pn();$e();A9=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$nam\
|
|
2364
2364
|
e" 2>/dev/null) || continue'," case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /us\
|
|
2365
2365
|
r/bin/*) continue ;; esac; fi',` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
2366
2366
|
`)});var u0,D_=d(()=>{Pn();$e();u0=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,
|
|
2367
|
-
any:n}=Es[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as d0}from"node:child_process";import{promisify as p0}from"node:util";var $9,U_=d(()=>{$9=p0(d0)});var B_=d(()=>{
|
|
2368
|
-
P_();Su();k_();
|
|
2367
|
+
any:n}=Es[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as d0}from"node:child_process";import{promisify as p0}from"node:util";var $9,U_=d(()=>{$9=p0(d0)});var B_=d(()=>{yo();am();er();Xi();Wb();Rn();bn();$t();ys();y_();ou();b_();E_();as();tu();Tr();I_();_u();R_();W();Tn();st();
|
|
2368
|
+
$e();P_();Su();k_();Tu();$_();L_();M_();Pn();j_();D_();U_();Su()});import{realpath as G_}from"node:fs/promises";async function Cn(e){let t=await G_(e),r=async(c,l="utf8",u={})=>{let{input:p,
|
|
2369
2369
|
maxBuffer:f=1024*1024}=u,h=await Rr({actor:"daemon",allowedRoots:[t],args:["-C",t,...c],command:"git",cwd:t,envPolicy:"p\
|
|
2370
2370
|
roject",gitSafeDirectories:[t],input:p,maxBuffer:f,mode:"capture",outputEncoding:l,purpose:"source",runtimes:["git"],timeout:6e4});
|
|
2371
2371
|
if(h.ok!==!0)throw Object.assign(new Error(h.error||"Git could not read the pinned topic."),{code:h.code});return l==="b\
|
|
@@ -2376,10 +2376,10 @@ i=JSON.parse(await r(["show",`${n}:package.json`])),s=String(i.repository?.url||
|
|
|
2376
2376
|
if(!s)throw new Error("Topic package needs its canonical https://github.com/<owner>/learn-<topic>.git repository URL.");
|
|
2377
2377
|
let a=Et([o.topicManifest,...o.bundles.map(c=>c.manifest)]);for(let c=0;c<a.length;){let l=c,u=0;do u+=a[l].bytes+Buffer.
|
|
2378
2378
|
byteLength(a[l].path)+128,l+=1;while(l<a.length&&u+a[l].bytes+Buffer.byteLength(a[l].path)+128<=1024*1024);let p=a.slice(
|
|
2379
|
-
c,l),f=await r(["cat-file","--batch","-Z"],"base64",{input:p.map(
|
|
2380
|
-
h=0;for(let
|
|
2381
|
-
h,E).toString("ascii")),m=_?Number(_[1]):-1,g=E+1+m;if(m!==
|
|
2382
|
-
`Topic input differs from its pinned commit: ${
|
|
2379
|
+
c,l),f=await r(["cat-file","--batch","-Z"],"base64",{input:p.map(w=>`${n}:${w.path}\0`).join(""),maxBuffer:2*1024*1024}),
|
|
2380
|
+
h=0;for(let w of p){let E=f.indexOf(0,h),_=E<0?null:/^(?:[a-f0-9]{40}|[a-f0-9]{64}) blob (0|[1-9][0-9]*)$/u.exec(f.subarray(
|
|
2381
|
+
h,E).toString("ascii")),m=_?Number(_[1]):-1,g=E+1+m;if(m!==w.bytes||f[g]!==0||Q(f.subarray(E+1,g))!==w.sha256)throw new Error(
|
|
2382
|
+
`Topic input differs from its pinned commit: ${w.path}.`);h=g+1}if(h!==f.length)throw new Error("Unexpected trailing dat\
|
|
2383
2383
|
a while reading the pinned topic.");c=l}if(await r(["rev-parse","HEAD"])!==n||await r(["status","--porcelain","--untrack\
|
|
2384
2384
|
ed-files=all"]))throw new Error("Topic changed during manifest generation. Commit and retry.");return{topicId:o.topic.topicId,
|
|
2385
2385
|
release:o.release,repository:s,commit:n,topicManifest:o.topicManifest,topicHash:o.topicHash}}function Nn(e,t){let r=he(po,
|
|
@@ -2399,12 +2399,12 @@ throw new Error(`Changed whole-topic order or lesson identity: ${i.topicId}.`);i
|
|
|
2399
2399
|
repository:a.repository,commit:a.commit,manifestHash:a.topicHash,lessons:c.lessons.map(u=>({...u}))}});if(r.orientation!==
|
|
2400
2400
|
void 0&&!o.some(i=>i.lessons.some(s=>s.code===r.orientation&&s.status==="published")))throw new Error(`Course orientatio\
|
|
2401
2401
|
n ${r.orientation} must be a published lesson of the course.`);return{schemaVersion:1,courseId:r.courseId,release:r.release,
|
|
2402
|
-
status:r.status,topics:o}}var
|
|
2403
|
-
return Pr(e,t,{...n,statusCode:r})}function Me(e,t,r,n){return Pr(e,t,{statusCode:r,cause:n})}function
|
|
2404
|
-
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var
|
|
2402
|
+
status:r.status,topics:o}}var Ts=d(()=>{B_();Qt();Kt();Xt()});function Pr(e,t,r){let{statusCode:n,cause:o,...i}=r,s=new fe(n,e,{...i,code:t});return o&&(s.cause=o),s}function vs(e,t,r=409,n={}){
|
|
2403
|
+
return Pr(e,t,{...n,statusCode:r})}function Me(e,t,r,n){return Pr(e,t,{statusCode:r,cause:n})}function vu(e,t,r){return Object.
|
|
2404
|
+
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var R5,Is=d(()=>{eo();R5=128*1024});var F_=d(()=>{});import{lstat as m0,readFile as f0,readdir as h0,realpath as g0}from"node:fs/promises";import B from"node:path";function Iu(e){
|
|
2405
2405
|
return Oe(e)?{...e,steps:e.steps.map(t=>{if(t.check.kind!=="choice")return t;let{answer:r,...n}=t.check;return{...t,check:n}})}:
|
|
2406
|
-
e}function
|
|
2407
|
-
r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!
|
|
2406
|
+
e}function Ft(e,t={}){let r=he(y0,e,"Installed topic pin");if(!pt.test(r.topicId)||!Ou.test(r.commit)||r.topicId!==(t.topicId??
|
|
2407
|
+
r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!w0.test(r.repository)||!$n.test(r.topicHash))
|
|
2408
2408
|
throw new Error("Installed pin does not match the requested topic, commit or canonical source identity.");if(r.topicHash!==
|
|
2409
2409
|
(t.topicHash??r.topicHash))throw new Error("Installed topic differs from the trusted course or attempt pin.");return r}async function Ln(e,t){
|
|
2410
2410
|
let r=await m0(e);if(r.isSymbolicLink()||await g0(e)!==e)throw new Error("Installed content cannot use symlink or direct\
|
|
@@ -2415,17 +2415,17 @@ let t=[],r=0;async function n(o){await Ln(o,!0);for(let i of await h0(o,{withFil
|
|
|
2415
2415
|
"Installed snapshot exceeds 65536 directory entries.");let s=B.join(o,i.name);i.isDirectory()?await n(s):(await Ln(s,!1),
|
|
2416
2416
|
t.push(B.relative(e,s).split(B.sep).join("/")))}}return await n(e),t.sort()}function Mn({systemRoot:e}){return _0(e,E0)}
|
|
2417
2417
|
function _0(e,t){if(typeof e!="string"||!e||!B.isAbsolute(e))throw new Error("Installed teaching content needs an absolu\
|
|
2418
|
-
te server-owned system root.");let r=B.resolve(e),n=new Map;function o(m){return
|
|
2418
|
+
te server-owned system root.");let r=B.resolve(e),n=new Map;function o(m){return vs(`Lesson ${m.lesson.code} ("${m.lesson.
|
|
2419
2419
|
title}") cannot be taught by this version of Vibe64: ${m.problem} Update the course in Courses, or ask its authors for a\
|
|
2420
2420
|
fixed release.`,"VIBE64_TRAINING_LESSON_UNUSABLE",422,{params:{lessonCode:m.lesson.code,lessonTitle:m.lesson.title,problem:m.
|
|
2421
|
-
problem}})}async function i(m={}){let g=await s(m);return{...g,bundles:g.bundles.map(
|
|
2422
|
-
topicId:m,commit:g,topicHash:
|
|
2423
|
-
"Choose a valid topic ID and its exact 40-character lowercase Git commit.");if(typeof
|
|
2424
|
-
"Provide the trusted 64-character topic hash from the course or saved attempt.");let S=JSON.stringify([m,g,
|
|
2425
|
-
return
|
|
2426
|
-
topicId:m,commit:g,topicHash:
|
|
2427
|
-
r,S,
|
|
2428
|
-
topicHash:
|
|
2421
|
+
problem}})}async function i(m={}){let g=await s(m);return{...g,bundles:g.bundles.map(y=>({...y,lesson:Iu(y.lesson)}))}}async function s({
|
|
2422
|
+
topicId:m,commit:g,topicHash:y}={}){if(typeof m!="string"||typeof g!="string"||!pt.test(m)||!Ou.test(g))throw new Error(
|
|
2423
|
+
"Choose a valid topic ID and its exact 40-character lowercase Git commit.");if(typeof y!="string"||!$n.test(y))throw new Error(
|
|
2424
|
+
"Provide the trusted 64-character topic hash from the course or saved attempt.");let S=JSON.stringify([m,g,y]),v=n.get(S);
|
|
2425
|
+
return v||(v=a({topicId:m,commit:g,topicHash:y}).finally(()=>n.delete(S)),n.set(S,v)),structuredClone(await v)}async function a({
|
|
2426
|
+
topicId:m,commit:g,topicHash:y}){try{let S=B.join(r,"training"),v=B.join(S,"content"),b=B.join(v,m),T=B.join(b,g);for(let me of[
|
|
2427
|
+
r,S,v,b,T])await Ln(me,!0);let O=Ft(JSON.parse((await Cr(B.join(T,"pin.json"),4096)).toString("utf8")),{topicId:m,commit:g,
|
|
2428
|
+
topicHash:y}),I=JSON.parse((await Cr(B.join(T,"bundle.json"),32*1024*1024)).toString("utf8")),x=B.join(T,"files"),j=await b0(
|
|
2429
2429
|
x),$=await _t(x,{installed:!0}),k={schemaVersion:1,topic:$.topic,release:$.release,topicHash:$.topicHash,topicManifest:$.
|
|
2430
2430
|
topicManifest,lessons:$.bundles.map(({lesson:me,hash:De,status:oS,required:iS,manifest:sS})=>({code:me.code,hash:De,status:oS,
|
|
2431
2431
|
required:iS,manifest:sS}))};if(D(I)!==D(k))throw new Error("Installed bundle is incomplete, reordered, unsupported or ch\
|
|
@@ -2435,72 +2435,72 @@ D(q.map(me=>me.path).sort()))throw new Error("Installed snapshot has missing or
|
|
|
2435
2435
|
x,"package.json"),1024*1024),Ie=q.find(me=>me.path==="package.json");if(re.length!==Ie.bytes||Q(re)!==Ie.sha256)throw new Error(
|
|
2436
2436
|
"Installed source changed during reading.");if(JSON.parse(re.toString("utf8")).repository?.url!==`https://github.com/${O.
|
|
2437
2437
|
repository}.git`)throw new Error("Installed package repository URL differs from its canonical pin.");return{pin:O,...$}}catch(S){
|
|
2438
|
-
let
|
|
2438
|
+
let v=["ENOENT","ENOTDIR"].includes(S.code),b=new Error(v?`Pinned teaching content ${m}@${g} is missing. Ask the owner t\
|
|
2439
2439
|
o install that exact revision.`:`Pinned teaching content ${m}@${g} is invalid: ${S.message} Ask the owner to reinstall t\
|
|
2440
|
-
he verified snapshot.`,{cause:S});throw b.code=
|
|
2441
|
-
async function c({pin:m,manifest:g},
|
|
2442
|
-
S),
|
|
2440
|
+
he verified snapshot.`,{cause:S});throw b.code=v?"VIBE64_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",b}}
|
|
2441
|
+
async function c({pin:m,manifest:g},y,S){let v=B.join(r,"training","content",m.topicId,m.commit,"files"),b=B.resolve(v,y,
|
|
2442
|
+
S),T=B.relative(v,b).split(B.sep).join("/"),O=g.files.find(x=>x.path===T);if(!O)throw new Error("Lesson requested an unr\
|
|
2443
2443
|
ecorded installed file.");let I=await Cr(b,1024*1024);if(I.length!==O.bytes||Q(I)!==O.sha256)throw new Error("Installed \
|
|
2444
|
-
lesson changed while reading. Ask the owner to reinstall the verified snapshot.");return{path:
|
|
2445
|
-
topicId:m,commit:g,topicHash:
|
|
2446
|
-
test(g)||typeof
|
|
2447
|
-
"Choose an exact pinned topic and lesson identity.");try{let b=B.join(r,"training"),
|
|
2448
|
-
I=B.join(O,g);for(let De of[r,b,
|
|
2449
|
-
"utf8")),{topicId:m,commit:g,topicHash:
|
|
2450
|
-
$=j.topicManifest;if(!$||Q(D($))!==
|
|
2444
|
+
lesson changed while reading. Ask the owner to reinstall the verified snapshot.");return{path:T,bytes:I}}async function l({
|
|
2445
|
+
topicId:m,commit:g,topicHash:y,lessonCode:S,lessonHash:v}={}){if(typeof m!="string"||!pt.test(m)||typeof g!="string"||!Ou.
|
|
2446
|
+
test(g)||typeof y!="string"||!$n.test(y)||typeof S!="string"||!pt.test(S)||typeof v!="string"||!$n.test(v))throw new Error(
|
|
2447
|
+
"Choose an exact pinned topic and lesson identity.");try{let b=B.join(r,"training"),T=B.join(b,"content"),O=B.join(T,m),
|
|
2448
|
+
I=B.join(O,g);for(let De of[r,b,T,O,I])await Ln(De,!0);let x=Ft(JSON.parse((await Cr(B.join(I,"pin.json"),4096)).toString(
|
|
2449
|
+
"utf8")),{topicId:m,commit:g,topicHash:y}),j=JSON.parse((await Cr(B.join(I,"bundle.json"),32*1024*1024)).toString("utf8")),
|
|
2450
|
+
$=j.topicManifest;if(!$||Q(D($))!==y||$.topic.topicId!==m||$.release!==x.release)throw new Error("Installed topic manife\
|
|
2451
2451
|
st differs from the trusted identity.");let k=$.lessons.find(De=>De.code===S),q=$.topic.lessons.find(De=>De.code===S),re=j.
|
|
2452
|
-
lessons.find(De=>De.code===S);if(!k||!q||!re||k.hash!==
|
|
2452
|
+
lessons.find(De=>De.code===S);if(!k||!q||!re||k.hash!==v||Q(D(re.manifest))!==v)throw new Error("Installed lesson manife\
|
|
2453
2453
|
st differs from the trusted content hash.");if(!t(k.status))throw new Error(`Lesson ${S} is draft and cannot be taught. \
|
|
2454
|
-
Choose a published lesson.`);let Ie={pin:x,manifest:re.manifest,hash:
|
|
2454
|
+
Choose a published lesson.`);let Ie={pin:x,manifest:re.manifest,hash:v,descriptorPath:q.descriptor},Un=await c(Ie,".",q.
|
|
2455
2455
|
descriptor),me=lo(JSON.parse(Un.bytes.toString("utf8")),S);if(me.code!==S)throw new Error("Installed lesson descriptor i\
|
|
2456
|
-
dentity changed.");return{...Ie,lesson:Iu(me)}}catch(b){let
|
|
2457
|
-
message} Ask the owner to restore the exact snapshot.`,{cause:b});throw
|
|
2458
|
-
BE64_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",
|
|
2459
|
-
lesson:Iu(g.lesson)}}async function p({topicId:m,commit:g,topicHash:
|
|
2460
|
-
g"||typeof
|
|
2461
|
-
er lowercase content hash.");let b=await s({topicId:m,commit:g,topicHash:
|
|
2462
|
-
throw new Error(`Lesson ${S} is not declared in this pinned topic.`);if(!t(
|
|
2463
|
-
ft and cannot be taught. Choose a published lesson.`);if(
|
|
2464
|
-
esume its exact pinned revision or explicitly start a new attempt.`);if(
|
|
2465
|
-
places","activities","facts"].map(I=>[I,[...b.topic[I]||[]]]));return{pin:b.pin,lesson:
|
|
2466
|
-
hash,descriptorPath:
|
|
2467
|
-
async function S(I){let x=await c(g,
|
|
2468
|
-
visuals){let x=await S(I.descriptor);
|
|
2456
|
+
dentity changed.");return{...Ie,lesson:Iu(me)}}catch(b){let T=new Error(`Pinned teaching identity ${m}@${g} is invalid: ${b.
|
|
2457
|
+
message} Ask the owner to restore the exact snapshot.`,{cause:b});throw T.code=["ENOENT","ENOTDIR"].includes(b.code)?"VI\
|
|
2458
|
+
BE64_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",T}}async function u(m={}){let g=await p(m);return{...g,
|
|
2459
|
+
lesson:Iu(g.lesson)}}async function p({topicId:m,commit:g,topicHash:y,lessonCode:S,lessonHash:v}={}){if(typeof S!="strin\
|
|
2460
|
+
g"||typeof v!="string"||!pt.test(S)||!$n.test(v))throw new Error("Choose a declared lesson code and its exact 64-charact\
|
|
2461
|
+
er lowercase content hash.");let b=await s({topicId:m,commit:g,topicHash:y}),T=b.bundles.find(I=>I.lesson.code===S);if(!T)
|
|
2462
|
+
throw new Error(`Lesson ${S} is not declared in this pinned topic.`);if(!t(T.status))throw new Error(`Lesson ${S} is dra\
|
|
2463
|
+
ft and cannot be taught. Choose a published lesson.`);if(T.hash!==v)throw new Error(`Lesson ${S} content hash changed. R\
|
|
2464
|
+
esume its exact pinned revision or explicitly start a new attempt.`);if(T.problem)throw o(T);let O=Object.fromEntries(["\
|
|
2465
|
+
places","activities","facts"].map(I=>[I,[...b.topic[I]||[]]]));return{pin:b.pin,lesson:T.lesson,manifest:T.manifest,hash:T.
|
|
2466
|
+
hash,descriptorPath:T.descriptorPath,declarations:O}}async function f(m={}){let g=await u(m),y=B.dirname(g.descriptorPath);
|
|
2467
|
+
async function S(I){let x=await c(g,y,I);return{path:x.path,text:x.bytes.toString("utf8")}}let v=[];for(let I of g.lesson.
|
|
2468
|
+
visuals){let x=await S(I.descriptor);v.push({id:I.id,descriptorPath:x.path,visual:JSON.parse(x.text)})}if(Oe(g.lesson)){
|
|
2469
2469
|
let I=mo(g.declarations),x=[];for(let j of g.lesson.steps){let{body:$,beats:k}=ho((await S(j.body)).text,I);x.push({...j,
|
|
2470
2470
|
bodyText:$,...k?{beats:k}:{}})}return{...g,steps:x,...g.lesson.notes===void 0?{}:{notesText:(await S(g.lesson.notes)).text},
|
|
2471
|
-
visuals:
|
|
2472
|
-
g.lesson.document),
|
|
2473
|
-
$`,"mu").exec(b.text).index})).sort((I,x)=>I.position-x.position),O=
|
|
2474
|
-
text.slice(I.position,
|
|
2475
|
-
stepId:m,...g}={}){if(typeof m!="string"||!pt.test(m))throw new Error("Choose a declared step ID.");let{pin:
|
|
2476
|
-
g);if(!Oe(S))throw new Error(`Lesson ${S.code} has no steps.`);let b=S.steps.find(
|
|
2471
|
+
visuals:v}}if(g.lesson.schemaVersion!==1)throw new Error(`Lesson ${g.lesson.code} uses an unsupported format.`);let b=await S(
|
|
2472
|
+
g.lesson.document),T=g.lesson.assessments.map(I=>({id:I.id,reference:I.rubric,position:new RegExp(`^<a id="${I.id}"></a>\
|
|
2473
|
+
$`,"mu").exec(b.text).index})).sort((I,x)=>I.position-x.position),O=T.map((I,x)=>({id:I.id,reference:I.reference,text:b.
|
|
2474
|
+
text.slice(I.position,T[x+1]?.position??b.text.length)}));return{...g,document:b,rubrics:O,visuals:v}}async function h({
|
|
2475
|
+
stepId:m,...g}={}){if(typeof m!="string"||!pt.test(m))throw new Error("Choose a declared step ID.");let{pin:y,lesson:S,hash:v}=await p(
|
|
2476
|
+
g);if(!Oe(S))throw new Error(`Lesson ${S.code} has no steps.`);let b=S.steps.find(T=>T.id===m);if(!b)throw new Error(`St\
|
|
2477
2477
|
ep ${m} is not declared in this pinned lesson.`);if(b.check.kind!=="choice")throw new Error(`Step ${m} is not a choice s\
|
|
2478
|
-
tep.`);return{pin:
|
|
2479
|
-
topicHash:
|
|
2480
|
-
red visual ID.");let
|
|
2478
|
+
tep.`);return{pin:y,lessonCode:S.code,lessonHash:v,stepId:m,answer:[...b.check.answer]}}async function w({topicId:m,commit:g,
|
|
2479
|
+
topicHash:y,lessonCode:S,lessonHash:v,visualId:b}={}){if(typeof b!="string"||!pt.test(b))throw new Error("Choose a decla\
|
|
2480
|
+
red visual ID.");let T=await f({topicId:m,commit:g,topicHash:y,lessonCode:S,lessonHash:v}),O=T.visuals.find(k=>k.id===b);
|
|
2481
2481
|
if(!O)throw Pr(`Visual ${b} is not declared in this pinned lesson.`,"VIBE64_TRAINING_VISUAL_UNDECLARED",{statusCode:400,
|
|
2482
|
-
params:{visualId:b}});let I=B.dirname(O.descriptorPath),x=await c(
|
|
2483
|
-
for(let k of O.visual.assets||[])$.push(await c(
|
|
2484
|
-
svg:x,controller:j,assets:$}}async function E({topicId:m,commit:g,topicHash:
|
|
2485
|
-
"string"||!pt.test(b))throw new Error("Choose a declared check ID.");let
|
|
2486
|
-
lessonHash:
|
|
2487
|
-
son.`);let I=B.dirname(
|
|
2488
|
-
pin:
|
|
2489
|
-
lessonCode:S,lessonHash:
|
|
2490
|
-
ds cannot supply exercise content.");let I=await(
|
|
2482
|
+
params:{visualId:b}});let I=B.dirname(O.descriptorPath),x=await c(T,I,O.visual.svg),j=await c(T,I,O.visual.controller),$=[];
|
|
2483
|
+
for(let k of O.visual.assets||[])$.push(await c(T,I,k));return{pin:T.pin,lessonCode:T.lesson.code,lessonHash:T.hash,...O,
|
|
2484
|
+
svg:x,controller:j,assets:$}}async function E({topicId:m,commit:g,topicHash:y,lessonCode:S,lessonHash:v,checkId:b}={}){if(typeof b!=
|
|
2485
|
+
"string"||!pt.test(b))throw new Error("Choose a declared check ID.");let T=await f({topicId:m,commit:g,topicHash:y,lessonCode:S,
|
|
2486
|
+
lessonHash:v}),O=T.lesson.checks?.find($=>$.id===b);if(!O)throw new Error(`Check ${b} is not declared in this pinned les\
|
|
2487
|
+
son.`);let I=B.dirname(T.descriptorPath),x=await c(T,I,O.file),j=[];for(let $ of O.assets||[])j.push(await c(T,I,$));return{
|
|
2488
|
+
pin:T.pin,lessonCode:T.lesson.code,lessonHash:T.hash,check:O,file:x,assets:j}}async function _({topicId:m,commit:g,topicHash:y,
|
|
2489
|
+
lessonCode:S,lessonHash:v,metadataOnly:b=!1,admissionOnly:T=!1}={}){if(T===!0&&b!==!0)throw new TypeError("Admission rea\
|
|
2490
|
+
ds cannot supply exercise content.");let I=await(T===!0?l:b===!0?u:f)({topicId:m,commit:g,topicHash:y,lessonCode:S,lessonHash:v}),
|
|
2491
2491
|
x=I.lesson.exercise;if(!x)throw Object.assign(new Error(`Lesson ${S} has no declared bundled exercise.`),{code:"VIBE64_T\
|
|
2492
2492
|
RAINING_EXERCISE_MISSING"});let j=B.posix.join(B.posix.dirname(I.descriptorPath),x.source),$={pin:I.pin,lessonCode:I.lesson.
|
|
2493
2493
|
code,lessonHash:I.hash,exercise:x,sourcePath:j};if(b===!0)return $;let k=j==="."?"":`${j}/`,q=[];for(let re of I.manifest.
|
|
2494
2494
|
files){if(!re.path.startsWith(k))continue;let Ie=re.path.slice(k.length),Un=await c(I,j,Ie);q.push({path:Ie,bytes:Un.bytes})}
|
|
2495
|
-
return{...$,files:q}}return Object.freeze({readTopic:i,readLesson:f,readAdmissionIdentity:l,readVisual:
|
|
2496
|
-
readChoiceAnswer:h})}var pt,Ou,$n,
|
|
2497
|
-
Ou=/^[a-f0-9]{40}$/u,$n=/^[a-f0-9]{64}$/u,
|
|
2498
|
-
minLength:1,maxLength:256},
|
|
2499
|
-
repository:kn,commit:{...kn,maxLength:40},topicHash:{...kn,maxLength:64}});E0=e=>e==="published"});import{randomUUID as S0}from"node:crypto";import{lstat as
|
|
2500
|
-
import te from"node:path";function
|
|
2495
|
+
return{...$,files:q}}return Object.freeze({readTopic:i,readLesson:f,readAdmissionIdentity:l,readVisual:w,readCheck:E,readExercise:_,
|
|
2496
|
+
readChoiceAnswer:h})}var pt,Ou,$n,w0,kn,y0,E0,Au=d(()=>{ao();Qt();Kt();Ta();fo();F_();Xt();Is();pt=/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u,
|
|
2497
|
+
Ou=/^[a-f0-9]{40}$/u,$n=/^[a-f0-9]{64}$/u,w0=/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u,kn={type:"string",required:!0,noTrim:!0,
|
|
2498
|
+
minLength:1,maxLength:256},y0=L({schemaVersion:{type:"integer",required:!0,enum:[1]},topicId:{...kn,maxLength:64},release:kn,
|
|
2499
|
+
repository:kn,commit:{...kn,maxLength:40},topicHash:{...kn,maxLength:64}});E0=e=>e==="published"});import{randomUUID as S0}from"node:crypto";import{lstat as T0,mkdir as Ru,realpath as v0,rename as I0,rm as O0,writeFile as A0}from"node:fs/promises";
|
|
2500
|
+
import te from"node:path";function V_(e,t){if(typeof e!="string"||!te.isAbsolute(e)||te.resolve(e)!==e||e===te.parse(e).
|
|
2501
2501
|
root)throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function z_(e,t){let r=te.
|
|
2502
2502
|
relative(e,t);return!r||r!==".."&&!r.startsWith(`..${te.sep}`)&&!te.isAbsolute(r)}async function je(e,t,r=!0){let n;try{
|
|
2503
|
-
n=await
|
|
2503
|
+
n=await T0(e)}catch(o){if(r&&o.code==="ENOENT")return null;throw o}if(n.isSymbolicLink()||await v0(e)!==e)throw new Error(
|
|
2504
2504
|
"Training installation cannot use symlink or directory aliases.");if(t?!n.isDirectory():!n.isFile())throw new Error(`Tra\
|
|
2505
2505
|
ining installation needs a regular ${t?"directory":"file"}: ${e}.`);if(!t&&(n.nlink!==1||n.size!==0))throw new Error("Tr\
|
|
2506
2506
|
aining installation lock must be an unaliased empty regular file; inspect it before retrying.");return n}async function Os(e,t=!1){
|
|
@@ -2508,22 +2508,22 @@ let r=te.dirname(e);return r!==e&&await Os(r,t),je(e,!0,t)}async function x0(e){
|
|
|
2508
2508
|
code!=="EEXIST")throw t}await je(e,!0,!1)}function As(e,t){if(D(e)!==D(t))throw new Error("Topic source or installed sna\
|
|
2509
2509
|
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function xu(e,t){
|
|
2510
2510
|
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await Cn(e);As({schemaVersion:1,topicId:r,release:n,repository:o,
|
|
2511
|
-
commit:i,topicHash:s},t)}function H_({systemRoot:e}){let t=
|
|
2512
|
-
sourceRoot:o,pin:i}={}){let s={...
|
|
2511
|
+
commit:i,topicHash:s},t)}function H_({systemRoot:e}){let t=V_(e,"Training system root"),r=Mn({systemRoot:t});async function n({
|
|
2512
|
+
sourceRoot:o,pin:i}={}){let s={...Ft(i)};V_(o,"Trusted topic source root");let a=te.join(t,"training");if(z_(o,a)||z_(a,
|
|
2513
2513
|
o))throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=te.join(a,"c\
|
|
2514
2514
|
ontent"),l=te.join(c,s.topicId),u=te.join(l,s.commit),p=te.join(a,".install-locks"),f=te.join(p,`${s.topicId}-${s.commit}\
|
|
2515
2515
|
.lock`);await Os(t);let h=await Os(o,!0);for(let m of[a,c,l,p])await je(m,!0);if(await je(f,!1),await je(u,!0))As((await r.
|
|
2516
2516
|
readTopic(s)).pin,s);else{if(!h)throw new Error("Trusted topic source is missing. Prepare the approved local repository \
|
|
2517
|
-
before installing its pin.");await xu(o,s)}for(let m of[a,c,l,p])await x0(m);let E=await Er(f);if(!E)throw
|
|
2517
|
+
before installing its pin.");await xu(o,s)}for(let m of[a,c,l,p])await x0(m);let E=await Er(f);if(!E)throw vs("This topi\
|
|
2518
2518
|
c revision is being installed. Retry after the current owner operation finishes.","VIBE64_TRAINING_INSTALL_BUSY");let _;
|
|
2519
|
-
try{await je(f,!1,!1);for(let
|
|
2520
|
-
|
|
2521
|
-
join(_,"training","content",s.topicId);await Ru(g,{recursive:!0,mode:448});let
|
|
2522
|
-
e",o,
|
|
2519
|
+
try{await je(f,!1,!1);for(let v of[t,a,c,l,p])await je(v,!0,!1);if(await je(u,!0)){let v=await r.readTopic(s);return As(
|
|
2520
|
+
v.pin,s),{installed:!1,...v}}await Os(o),await xu(o,s);let m=te.join(a,`.install-${S0()}`);await Ru(m,{mode:448}),_=m;let g=te.
|
|
2521
|
+
join(_,"training","content",s.topicId);await Ru(g,{recursive:!0,mode:448});let y=te.join(g,s.commit);if(await Pu(["bundl\
|
|
2522
|
+
e",o,y],{write(){}}),await xu(o,s),await A0(te.join(y,"pin.json"),`${D(s)}
|
|
2523
2523
|
`,{flag:"wx",mode:384}),await Mn({systemRoot:_}).readTopic(s),await je(l,!0,!1),await je(u,!0))throw new Error("The dest\
|
|
2524
|
-
ination appeared during installation. Keep it unchanged and retry the verified pin.");await I0(
|
|
2524
|
+
ination appeared during installation. Keep it unchanged and retry the verified pin.");await I0(y,u);let S=await r.readTopic(
|
|
2525
2525
|
s);return As(S.pin,s),{installed:!0,...S}}finally{try{_&&await O0(_,{recursive:!0,force:!0})}finally{await E()}}}return Object.
|
|
2526
|
-
freeze({installTopic:n})}var q_=d(()=>{Zi();
|
|
2526
|
+
freeze({installTopic:n})}var q_=d(()=>{Zi();Ts();Cu();Qt();Is();Au()});import{randomUUID as R0}from"node:crypto";import{chmod as P0,mkdir as C0,rename as N0,rm as k0,writeFile as $0}from"node:fs/promises";
|
|
2527
2527
|
import Nu from"node:path";async function L0(e,t,r={}){let{directoryMode:n,fileMode:o}=r,i=Nu.dirname(e);await C0(i,{recursive:!0,
|
|
2528
2528
|
mode:n});let s=Nu.join(i,`.${Nu.basename(e)}.${process.pid}.${R0()}.tmp`);try{await $0(s,t,{encoding:"utf8",flag:"wx",mode:o}),
|
|
2529
2529
|
o!==void 0&&await P0(s,o),await N0(s,e)}finally{await k0(s,{force:!0})}}async function W_(e,t,r={}){await L0(e,`${JSON.stringify(
|
|
@@ -2532,28 +2532,28 @@ t,null,2)}
|
|
|
2532
2532
|
if(!Number.isSafeInteger(e)||e<0)throw new Error("Supply the expected revision from a fresh installed catalogue read.")}
|
|
2533
2533
|
function Lu({systemRoot:e}){if(typeof e!="string"||!mt.isAbsolute(e)||mt.resolve(e)!==e||e===mt.parse(e).root)throw new Error(
|
|
2534
2534
|
"Installed catalogue needs a canonical absolute, non-root server-owned system root.");let t=mt.join(e,"training"),r=mt.join(
|
|
2535
|
-
t,"catalogue.json"),n=mt.join(t,"catalogue.lock"),o=Mn({systemRoot:e});async function i(){let _=[t];for(let
|
|
2536
|
-
|
|
2537
|
-
"ENOENT")continue;throw b}let
|
|
2538
|
-
nlink!==1))throw new Error("Installed catalogue paths must be canonical directories and unaliased regular files.");if(
|
|
2539
|
-
e&&(m=!0),
|
|
2535
|
+
t,"catalogue.json"),n=mt.join(t,"catalogue.lock"),o=Mn({systemRoot:e});async function i(){let _=[t];for(let y=e;_.unshift(
|
|
2536
|
+
y),y!==mt.dirname(y);y=mt.dirname(y));let m=!1,g=null;for(let y of[..._,r,n]){let S;try{S=await M0(y)}catch(b){if(b.code===
|
|
2537
|
+
"ENOENT")continue;throw b}let v=y!==r&&y!==n;if(S.isSymbolicLink()||await U0(y)!==y||(v?!S.isDirectory():!S.isFile()||S.
|
|
2538
|
+
nlink!==1))throw new Error("Installed catalogue paths must be canonical directories and unaliased regular files.");if(y===
|
|
2539
|
+
e&&(m=!0),y===r&&(g=S),y===n&&S.size!==0)throw new Error("Installed catalogue lock contains unexplained data. Inspect it\
|
|
2540
2540
|
; do not unlink it.")}return{rootExists:m,catalogueStat:g}}async function s(_){let m=_.lock.topics;if(!Array.isArray(m)||
|
|
2541
2541
|
m.length!==_.course.topics.length||m.length>32)throw new Error("The approved course lock must contain every selected who\
|
|
2542
|
-
le topic in order.");let g=[],
|
|
2543
|
-
repository:b?.repository,commit:b?.commit,topicHash:b?.manifestHash}),O=await o.readTopic(
|
|
2544
|
-
"Installed topic identity differs from the approved course lock.");S.push({topicId:
|
|
2545
|
-
topic.title});for(let I of O.bundles)
|
|
2542
|
+
le topic in order.");let g=[],y=[],S=[];for(let b of m){let T=Ft({schemaVersion:1,topicId:b?.topicId,release:b?.release,
|
|
2543
|
+
repository:b?.repository,commit:b?.commit,topicHash:b?.manifestHash}),O=await o.readTopic(T);if(D(O.pin)!==D(T))throw new Error(
|
|
2544
|
+
"Installed topic identity differs from the approved course lock.");S.push({topicId:T.topicId,release:T.release,title:O.topicManifest.
|
|
2545
|
+
topic.title});for(let I of O.bundles)y.push({topicId:T.topicId,topicRelease:T.release,code:I.lesson.code,hash:I.hash,title:I.
|
|
2546
2546
|
lesson.title});g.push({topicId:O.pin.topicId,release:O.release,repository:O.pin.repository,commit:O.pin.commit,topicManifest:O.
|
|
2547
|
-
topicManifest,topicHash:O.topicHash})}let
|
|
2548
|
-
differs from the complete installed topic inventory. Regenerate and review its exact release.");return{lessonTitles:
|
|
2547
|
+
topicManifest,topicHash:O.topicHash})}let v=Nn(_.course,g);if(D(_.lock)!==D(v))throw new Error("The approved course lock\
|
|
2548
|
+
differs from the complete installed topic inventory. Regenerate and review its exact release.");return{lessonTitles:y,topicTitles:S}}
|
|
2549
2549
|
async function a({includeLessonTitles:_=!1}={}){if(typeof _!="boolean")throw new TypeError("Lesson title projection requ\
|
|
2550
2550
|
ires an explicit Boolean read option.");try{let{catalogueStat:m}=await i();if(!m)return{schemaVersion:1,revision:0,courses:[]};
|
|
2551
2551
|
if(m.size>ku)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let g=await D0(r);if(g.length>ku)throw new Error(
|
|
2552
|
-
"Installed catalogue exceeds its 1 MiB limit.");let
|
|
2553
|
-
length&&
|
|
2554
|
-
for(let
|
|
2555
|
-
e contains duplicate course releases.");S.add(b);let{lessonTitles:
|
|
2556
|
-
topicTitles:O})}return
|
|
2552
|
+
"Installed catalogue exceeds its 1 MiB limit.");let y=he(B0,JSON.parse(g.toString("utf8")),"Installed catalogue");if(y.courses.
|
|
2553
|
+
length&&y.revision<1)throw new Error("Installed catalogue revision conflicts with its course inventory.");let S=new Set;
|
|
2554
|
+
for(let v of y.courses){let b=`${v.course.courseId}@${v.course.release}`;if(S.has(b))throw new Error("Installed catalogu\
|
|
2555
|
+
e contains duplicate course releases.");S.add(b);let{lessonTitles:T,topicTitles:O}=await s(v);_&&Object.assign(v,{lessonTitles:T,
|
|
2556
|
+
topicTitles:O})}return y}catch(m){throw vu(`Installed catalogue is invalid: ${m.message} Keep existing state and ask the\
|
|
2557
2557
|
owner to restore the exact approved catalogue or pinned content. No automatic repair was performed.`,"VIBE64_TRAINING_C\
|
|
2558
2558
|
ATALOGUE_INVALID",m)}}async function c(){let{rootExists:_}=await i();if(!_)throw new Error("Prepare the server-owned sys\
|
|
2559
2559
|
tem root before changing the catalogue.");try{await j0(t,{mode:448})}catch(g){if(g.code!=="EEXIST")throw g}await i();let m=await Er(
|
|
@@ -2563,64 +2563,64 @@ rent revision before deliberately retrying this enablement change.","VIBE64_TRAI
|
|
|
2563
2563
|
if(_.revision===Number.MAX_SAFE_INTEGER)throw new Error("Installed catalogue reached its revision limit. No change was w\
|
|
2564
2564
|
ritten.");let g={..._,revision:_.revision+1};if(Buffer.byteLength(`${JSON.stringify(g,null,2)}
|
|
2565
2565
|
`)>ku)throw new Error("Installed catalogue exceeds its 1 MiB limit. No change was written.");try{await W_(r,g,{directoryMode:448,
|
|
2566
|
-
fileMode:384})}catch(
|
|
2566
|
+
fileMode:384})}catch(y){throw vu("Catalogue save was not confirmed; atomic rename may already have succeeded. Read the c\
|
|
2567
2567
|
urrent catalogue before deliberately retrying. Do not assume the course changed or remained unchanged.","VIBE64_TRAINING\
|
|
2568
|
-
_CATALOGUE_SAVE_UNCONFIRMED",
|
|
2569
|
-
$u(g);let
|
|
2570
|
-
try{let
|
|
2571
|
-
|
|
2568
|
+
_CATALOGUE_SAVE_UNCONFIRMED",y)}return{revision:g.revision,entry:m,changed:!0}}async function p({course:_,lock:m,expectedRevision:g}={}){
|
|
2569
|
+
$u(g);let y=structuredClone(he(J_,{course:_,lock:m,enabled:!0},"Approved installed course"));await a(),await s(y);let S=await c();
|
|
2570
|
+
try{let v=await a();l(v,g),await s(y);let b=v.courses.find(T=>T.course.courseId===y.course.courseId&&T.course.release===
|
|
2571
|
+
y.course.release);if(b){if(D(b.course)!==D(y.course)||D(b.lock)!==D(y.lock))throw Me("This installed course release is i\
|
|
2572
2572
|
mmutable. Resume its approved pin or publish and approve a different course release.","VIBE64_TRAINING_COURSE_RELEASE_CO\
|
|
2573
|
-
NFLICT",409);return b.enabled?{revision:
|
|
2573
|
+
NFLICT",409);return b.enabled?{revision:v.revision,entry:b,changed:!1}:(b.enabled=!0,await u(v,b))}if(v.courses.length>=
|
|
2574
2574
|
jn)throw new Error("Installed catalogue reached its 16 course-release limit. Remove a release with vibe64 training remov\
|
|
2575
|
-
e-course to free a place; no release was removed.");return
|
|
2576
|
-
courseId:_,release:m,expectedRevision:g},
|
|
2577
|
-
string"||!/^\d+\.\d+\.\d+$/u.test(m))throw new Error(`${
|
|
2575
|
+
e-course to free a place; no release was removed.");return v.courses.push(y),await u(v,y)}finally{await S()}}async function f({
|
|
2576
|
+
courseId:_,release:m,expectedRevision:g},y){if($u(g),typeof _!="string"||!/^[a-z][a-z0-9-]{0,63}$/u.test(_)||typeof m!="\
|
|
2577
|
+
string"||!/^\d+\.\d+\.\d+$/u.test(m))throw new Error(`${y?"Remove":"Disable"} an exact installed course ID and three-par\
|
|
2578
2578
|
t release.`);if(!(await a()).courses.some(b=>b.course.courseId===_&&b.course.release===m))throw Me("This course release \
|
|
2579
|
-
is not installed in the catalogue. Read the current catalogue before retrying.","VIBE64_TRAINING_COURSE_MISSING",404);let
|
|
2580
|
-
try{let b=await a();l(b,g);let
|
|
2579
|
+
is not installed in the catalogue. Read the current catalogue before retrying.","VIBE64_TRAINING_COURSE_MISSING",404);let v=await c();
|
|
2580
|
+
try{let b=await a();l(b,g);let T=b.courses.find(O=>O.course.courseId===_&&O.course.release===m);if(!T)throw Me("This cou\
|
|
2581
2581
|
rse release is no longer in the catalogue. Read the current catalogue before retrying.","VIBE64_TRAINING_COURSE_REMOVED",
|
|
2582
|
-
404);return
|
|
2583
|
-
entry:
|
|
2584
|
-
$u(g);let
|
|
2582
|
+
404);return y?(b.courses=b.courses.filter(O=>O!==T),await u(b,T)):T.enabled?(T.enabled=!1,await u(b,T)):{revision:b.revision,
|
|
2583
|
+
entry:T,changed:!1}}finally{await v()}}let h=_=>f(_,!1),w=_=>f(_,!0);async function E({title:_,topics:m,expectedRevision:g}){
|
|
2584
|
+
$u(g);let y=typeof _=="string"?_.trim():"";if(!y||y.length>120)throw Me("Name the course with 1 to 120 characters.","VIB\
|
|
2585
2585
|
E64_TRAINING_COURSE_NAME_INVALID",400);if(!Array.isArray(m)||!m.length||m.length>32||new Set(m.map(x=>`${x?.topicId}@${x?.
|
|
2586
2586
|
release}`)).size!==m.length||new Set(m.map(x=>x?.topicId)).size!==m.length)throw Me("Choose 1 to 32 different whole topi\
|
|
2587
|
-
cs for the course.","VIBE64_TRAINING_COURSE_TOPICS_INVALID",400);let S=await a(),
|
|
2588
|
-
status==="released").flatMap(x=>x.lock.topics),b=[];for(let x of m){let j=
|
|
2587
|
+
cs for the course.","VIBE64_TRAINING_COURSE_TOPICS_INVALID",400);let S=await a(),v=S.courses.filter(x=>x.enabled&&x.course.
|
|
2588
|
+
status==="released").flatMap(x=>x.lock.topics),b=[];for(let x of m){let j=v.find(k=>k.topicId===x.topicId&&k.release===x.
|
|
2589
2589
|
release);if(!j)throw Me(`Topic ${x.topicId}@${x.release} is not part of an enabled released course. Refresh courses and \
|
|
2590
|
-
choose an installed topic.`,"VIBE64_TRAINING_COURSE_TOPIC_UNAVAILABLE",404);let $=await o.readTopic(
|
|
2590
|
+
choose an installed topic.`,"VIBE64_TRAINING_COURSE_TOPIC_UNAVAILABLE",404);let $=await o.readTopic(Ft({schemaVersion:1,
|
|
2591
2591
|
topicId:j.topicId,release:j.release,repository:j.repository,commit:j.commit,topicHash:j.manifestHash}));b.push({topicId:$.
|
|
2592
2592
|
pin.topicId,release:$.release,repository:$.pin.repository,commit:$.pin.commit,topicManifest:$.topicManifest,topicHash:$.
|
|
2593
|
-
topicHash})}let O={schemaVersion:1,courseId:`custom-${
|
|
2594
|
-
slice(0,48).replace(/-+$/u,"")||Q(
|
|
2593
|
+
topicHash})}let O={schemaVersion:1,courseId:`custom-${y.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"").
|
|
2594
|
+
slice(0,48).replace(/-+$/u,"")||Q(y).slice(0,12)}`,title:y,release:"1.0.0",status:"released",topics:m.map(x=>({topicId:x.
|
|
2595
2595
|
topicId,release:x.release}))},I=S.courses.find(x=>x.course.courseId===O.courseId);if(I&&D(I.course)!==D(O))throw Me("A c\
|
|
2596
2596
|
ourse with this name already exists. Choose another name.","VIBE64_TRAINING_COURSE_EXISTS",409);if(!I&&S.courses.length>=
|
|
2597
2597
|
jn)throw Pr(`This installation already has ${jn} course releases. No course was created.`,"VIBE64_TRAINING_COURSE_CREATE\
|
|
2598
2598
|
_LIMIT",{statusCode:409,params:{limit:jn}});return p({course:O,lock:Nn(O,b),expectedRevision:g})}return Object.freeze({readCatalogue:a,
|
|
2599
|
-
enableCourse:p,disableCourse:h,removeCourse:
|
|
2600
|
-
Is();
|
|
2599
|
+
enableCourse:p,disableCourse:h,removeCourse:w,createCourse:E})}var jn,ku,J_,B0,K_=d(()=>{ao();Zi();Y_();Ts();Qt();Kt();Au();
|
|
2600
|
+
Is();Xt();jn=16,ku=1024*1024,J_=L({course:{type:"object",required:!0,schema:po},lock:{type:"object",required:!0},enabled:{
|
|
2601
2601
|
type:"boolean",required:!0}}),B0=L({schemaVersion:{type:"integer",required:!0,enum:[1]},revision:{type:"integer",required:!0,
|
|
2602
|
-
min:0,max:Number.MAX_SAFE_INTEGER},courses:
|
|
2603
|
-
import J from"node:path";import{randomUUID as
|
|
2602
|
+
min:0,max:Number.MAX_SAFE_INTEGER},courses:V(J_,jn)})});var Z_={};Du(Z_,{runTrainingCli:()=>Pu});import{mkdir as X_,readFile as xs,realpath as Nr,rename as G0,rm as Q_,writeFile as Mu}from"node:fs/promises";
|
|
2603
|
+
import J from"node:path";import{randomUUID as F0}from"node:crypto";async function Pu(e,{write:t=r=>console.log(r)}={}){if(e[0]===
|
|
2604
2604
|
"install-topic"){let[,c,l]=e;if(e.length!==3||!c||!l)throw new Error("Usage: vibe64 training install-topic <committed-to\
|
|
2605
|
-
pic-directory> <system-root>");let u=await Nr(c),{topicId:p,release:f,repository:h,commit:
|
|
2606
|
-
schemaVersion:1,topicId:p,release:f,repository:h,commit:
|
|
2605
|
+
pic-directory> <system-root>");let u=await Nr(c),{topicId:p,release:f,repository:h,commit:w,topicHash:E}=await Cn(u),_={
|
|
2606
|
+
schemaVersion:1,topicId:p,release:f,repository:h,commit:w,topicHash:E},m=await H_({systemRoot:J.resolve(l)}).installTopic(
|
|
2607
2607
|
{sourceRoot:u,pin:_});return t(JSON.stringify({ok:!0,installed:m.installed,pin:m.pin},null,2)),0}if(e[0]==="installed-co\
|
|
2608
2608
|
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await Lu(
|
|
2609
2609
|
{systemRoot:J.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(["enable-course","disab\
|
|
2610
2610
|
le-course","remove-course"].includes(e[0])){let[c,l,u,p,f]=e;if(e.length!==5||!l||!u||!p||!/^(0|[1-9][0-9]*)$/u.test(f||
|
|
2611
2611
|
"")||!Number.isSafeInteger(Number(f)))throw new Error(c==="enable-course"?"Usage: vibe64 training enable-course <course.\
|
|
2612
2612
|
json> <course.lock.json> <system-root> <expected-revision>":`Usage: vibe64 training ${c} <courseId> <release> <system-ro\
|
|
2613
|
-
ot> <expected-revision>`);let h=Lu({systemRoot:J.resolve(p)}),
|
|
2614
|
-
parse(await xs(l,"utf8")),lock:JSON.parse(await xs(u,"utf8")),expectedRevision:
|
|
2615
|
-
urse":"disableCourse"]({courseId:l,release:u,expectedRevision:
|
|
2613
|
+
ot> <expected-revision>`);let h=Lu({systemRoot:J.resolve(p)}),w=Number(f),E=c==="enable-course"?await h.enableCourse({course:JSON.
|
|
2614
|
+
parse(await xs(l,"utf8")),lock:JSON.parse(await xs(u,"utf8")),expectedRevision:w}):await h[c==="remove-course"?"removeCo\
|
|
2615
|
+
urse":"disableCourse"]({courseId:l,release:u,expectedRevision:w});return t(JSON.stringify({ok:!0,...E},null,2)),0}if(e[0]===
|
|
2616
2616
|
"publish-manifest"){let[,c,...l]=e;if(!c||!l.length)throw new Error("Usage: vibe64 training publish-manifest <course.jso\
|
|
2617
2617
|
n> <committed-topic-directory...>");let u=await Nr(c),p=J.join(await Nr(J.dirname(J.resolve(c))),"course.lock.json");if(p===
|
|
2618
2618
|
u||J.basename(c)==="course.lock.json")throw new Error("Course lock output must not replace its input course descriptor.");
|
|
2619
2619
|
let f=JSON.parse(await xs(u,"utf8")),h=[];for(let _ of l){let m=await Nr(_),g=J.relative(m,p);if(!g||!g.startsWith(`..${J.
|
|
2620
2620
|
sep}`)&&g!==".."&&!J.isAbsolute(g))throw new Error("Course lock output must be outside every pinned source topic.");await _t(
|
|
2621
|
-
m,{authoring:!0}),h.push(await Cn(m))}let
|
|
2622
|
-
`,{flag:"wx"}),await G0(E,p)}finally{await Q_(E,{force:!0})}return t(JSON.stringify({ok:!0,courseId:
|
|
2623
|
-
status,lockPath:p,topics:
|
|
2621
|
+
m,{authoring:!0}),h.push(await Cn(m))}let w=Nn(f,h),E=`${p}.tmp-${F0()}`;try{await Mu(E,`${D(w)}
|
|
2622
|
+
`,{flag:"wx"}),await G0(E,p)}finally{await Q_(E,{force:!0})}return t(JSON.stringify({ok:!0,courseId:w.courseId,status:w.
|
|
2623
|
+
status,lockPath:p,topics:w.topics.length},null,2)),0}let[r,n,o]=e;if(!["validate","bundle"].includes(r)||!n||r==="bundle"&&
|
|
2624
2624
|
!o||e.length!==(r==="bundle"?3:2))throw new Error("Usage: vibe64 training validate <topic-directory> | bundle <topic-dir\
|
|
2625
2625
|
ectory> <new-output-directory>");let i=await Nr(n),s=await _t(i,{authoring:r==="validate"}),a={schemaVersion:1,topic:s.topic,
|
|
2626
2626
|
release:s.release,topicHash:s.topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:l,status:u,required:p,
|
|
@@ -2628,15 +2628,15 @@ manifest:f})=>({code:c.code,hash:l,status:u,required:p,manifest:f}))};if(r==="bu
|
|
|
2628
2628
|
J.dirname(c)),J.basename(c)),u=J.relative(i,l);if(!u||!u.startsWith(`..${J.sep}`)&&u!==".."&&!J.isAbsolute(u))throw new Error(
|
|
2629
2629
|
"Bundle output must be outside the source topic.");await X_(l);try{let p=Et([s.topicManifest,...s.bundles.map(f=>f.manifest)]);
|
|
2630
2630
|
for(let f of p){let h=await xs(J.join(i,f.path));if(Q(h)!==f.sha256)throw new Error(`Source changed during bundling: ${f.
|
|
2631
|
-
path}. Validate and retry.`);let
|
|
2631
|
+
path}. Validate and retry.`);let w=J.join(l,"files",f.path);await X_(J.dirname(w),{recursive:!0}),await Mu(w,h,{flag:"wx"})}
|
|
2632
2632
|
await Mu(J.join(l,"bundle.json"),`${D(a)}
|
|
2633
2633
|
`,{flag:"wx"})}catch(p){throw await Q_(l,{recursive:!0,force:!0}),p}}return t(JSON.stringify({ok:!0,topicId:s.topic.topicId,
|
|
2634
2634
|
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:l,status:u})=>({code:c.code,hash:l,status:u,schemaVersion:c.
|
|
2635
|
-
schemaVersion,...c.stage?{stage:c.stage}:{},...Oe(c)?{steps:c.steps.length}:{}}))},null,2)),0}var Cu=d(()=>{
|
|
2636
|
-
q_();K_();
|
|
2635
|
+
schemaVersion,...c.stage?{stage:c.stage}:{},...Oe(c)?{steps:c.steps.length}:{}}))},null,2)),0}var Cu=d(()=>{Qt();Kt();Ts();
|
|
2636
|
+
q_();K_();Xt()});import{spawn as eS}from"node:child_process";import{readFileSync as z0}from"node:fs";import{release as Rs}from"node:os";import M from"node:process";
|
|
2637
2637
|
import Dn from"node:path";import{fileURLToPath as H0}from"node:url";import{realpathSync as fS}from"node:fs";import hS from"node:path";import gS from"node:process";function Uu(e,t){let r=hS.
|
|
2638
2638
|
resolve(String(e||""));try{return t(r)}catch{return r}}function Bu({entrypointPath:e,argv:t=gS.argv,realpath:r=fS}){let n=t[1];
|
|
2639
|
-
return n?Uu(n,r)===Uu(e,r):!1}var
|
|
2639
|
+
return n?Uu(n,r)===Uu(e,r):!1}var V0=new URL("./run.js",import.meta.url).href,tS=H0(V0),rS=Dn.dirname(tS),$r=Dn.join(rS,"server.js");function kr(e=""){
|
|
2640
2640
|
return`'${String(e).replaceAll("'","'\\''")}'`}function q0(e=""){return JSON.stringify(String(e))}function ju(e=""){return`\
|
|
2641
2641
|
"${String(e).replaceAll('"','\\"')}"`}function W0(e="",t=[]){return[ju(e),...t.map(r=>ju(r))].join(" ")}function Y0({entrypointPath:e=tS,
|
|
2642
2642
|
...t}={}){return Bu({entrypointPath:e,...t})}function nS(e=M.cwd()){return Dn.basename(e)||"target"}function J0({env:e=M.
|