vibe64 0.1.44 → 0.1.45
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 +548 -547
- package/dist/assets/{GithubBrowserTabs-CxeMBH6W.js → GithubBrowserTabs-B3eDyosw.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-BuAidNAq.js → Vibe64AuthSettingsButton-D6FpAdMr.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-uWi4NB4y.js → Vibe64DashboardShell-Be9m--8X.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-CCpDbiGK.js → Vibe64DatabaseWorkspace-CJQsjlwO.js} +1 -1
- package/dist/assets/{Vibe64OutputControls-ttqEP46v.js → Vibe64OutputControls-BbIKDmnQ.js} +1 -1
- package/dist/assets/{Vibe64RepositoryWorkspace-Bq37tlM9.js → Vibe64RepositoryWorkspace-Di1Eaj89.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-BhNCbnUP.js → Vibe64SessionFiles-NPF2lVUa.js} +1 -1
- package/dist/assets/{_sessionId_-wrEZX5JX.js → _sessionId_-OpUBmmht.js} +1 -1
- package/dist/assets/{_slug_-CAmuBm-M.css → _slug_-D7Hp7Qdr.css} +1 -1
- package/dist/assets/{_slug_-pVQuRCsN.js → _slug_-URQxfixb.js} +4 -4
- package/dist/assets/{access-CwTmMeFU.js → access-Big-t8bD.js} +1 -1
- package/dist/assets/{app-BSNXOpH-.js → app-ClNGYCqx.js} +1 -1
- package/dist/assets/{changes-BHk1r-xi.js → changes-C5RgXQ6h.js} +1 -1
- package/dist/assets/{dashboard-CtPZicHO.js → dashboard-gczuqt9t.js} +1 -1
- package/dist/assets/{definitions-Cfy1CWRi.js → definitions-Dw7R22FW.js} +1 -1
- package/dist/assets/env-BaQrf0DE.js +1 -0
- package/dist/assets/{env-B5V1EC4M.css → env-ClR9iA1v.css} +1 -1
- package/dist/assets/{history-lzQXJSu7.js → history-h4HQIXvy.js} +1 -1
- package/dist/assets/{index-B17d4wpZ.css → index-Cuz3Jzqo.css} +1 -1
- package/dist/assets/{index-BnZ5igE0.js → index-kYgyZK8I.js} +4 -4
- package/dist/assets/{integrations-CefYdMOC.js → integrations-DVZcDoif.js} +1 -1
- package/dist/assets/{issues-CiGWy5Cv.js → issues-LguLI8Vc.js} +1 -1
- package/dist/assets/{learning-BfyUAtaJ.js → learning-pADlYdN6.js} +1 -1
- package/dist/assets/{publish-W5aA6JkR.js → publish-f7yKue02.js} +1 -1
- package/dist/assets/{pull-requests-BrtOgprU.js → pull-requests-B7bKeIV9.js} +1 -1
- package/dist/assets/{repository-BsSO4tkZ.js → repository-1l6cimH9.js} +1 -1
- package/dist/assets/{settings-Ck7lEre8.js → settings-ME38E4d1.js} +1 -1
- package/dist/assets/{useArchivedVibe64Sessions-DBSnMGIY.js → useArchivedVibe64Sessions-BeXgkSdF.js} +1 -1
- package/dist/assets/{useVibe64ConversationLog-DQUm75XZ.js → useVibe64ConversationLog-NZA-6BkP.js} +1 -1
- package/dist/assets/{useVibe64SessionData-t_rs_q6g.js → useVibe64SessionData-CXGozRef.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-gAUaIEs7.js → useVibe64SessionSelection-DZICz1SJ.js} +1 -1
- package/dist/assets/{vibe64SessionFocus-BZFoISVS.js → vibe64SessionFocus-DSpYUHZA.js} +1 -1
- package/dist/index.html +2 -2
- package/docs/colleague-usage/ai-accounts.md +2 -2
- package/docs/colleague-usage/ai-balance-and-allowance.md +4 -2
- package/docs/colleague-usage/ai-model-setups.md +6 -6
- package/docs/colleague-usage/ai-onboarding.md +2 -2
- package/docs/colleague-usage/ai-personal-use.md +1 -1
- package/docs/colleague-usage/coding-agent-failures.md +3 -2
- package/docs/colleague-usage/colleague.md +2 -3
- package/docs/colleague-usage/conversation-context.md +3 -0
- package/docs/colleague-usage/dashboard-navigation.md +7 -1
- package/docs/colleague-usage/health-checks.md +3 -1
- package/docs/colleague-usage/learning-course-catalogue.md +20 -12
- package/docs/colleague-usage/learning-mode-ui.md +2 -1
- package/docs/colleague-usage/learning-with-colleague.md +3 -1
- package/docs/colleague-usage/lesson-authoring.md +5 -4
- package/docs/colleague-usage/main-chat-approvals.md +7 -0
- package/docs/colleague-usage/plans.md +8 -3
- package/docs/colleague-usage/sessions.md +9 -3
- package/docs/colleague-usage/temporary-chats.md +9 -0
- package/docs/colleague-usage/voice-face-and-speaking-voice.md +3 -0
- package/docs/training-content.md +19 -12
- package/package.json +1 -1
- package/server.bundle.mjs +33217 -33147
- package/dist/assets/env-vkfe7Ud2.js +0 -1
package/bin/run.js
CHANGED
|
@@ -186,7 +186,7 @@ r)||r<-t||r>t?null:r===0?0:r}var ms,ju,Lu,Du,Bu,xt,In,Uu,Vu,Fu,zu,PS,xS,RS,CS,NS
|
|
|
186
186
|
\\d{4}",Lu="0[1-9]|1[0-2]",Du="0[1-9]|[12]\\d|3[01]",Bu="[01]\\d|2[0-3]",xt="[0-5]\\d",In=`(?:${Bu}):${xt}`,Uu=`(?:Z|[+-\
|
|
187
187
|
](?:${Bu}):${xt})`,Vu=`(${ju})-(${Lu})-(${Du})`,Fu=`${ju}-(?:${Lu})-(?:${Du})`,zu=`^${Fu}$`,PS=new RegExp(`^${Vu}$`),xS=
|
|
188
188
|
new RegExp(`^${In}(?::${xt}(?:\\.(\\d+))?)?$`),RS=new RegExp(`^${Vu}T${In}:${xt}(?:\\.(\\d+))?${Uu}$`),CS=new RegExp(ms),
|
|
189
|
-
NS=[31,28,31,30,31,30,31,31,30,31,30,31]});function
|
|
189
|
+
NS=[31,28,31,30,31,30,31,31,30,31,30,31]});function x(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function jS(e,t){if(MS.
|
|
190
190
|
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function LS(e){return typeof e!="string"?e:e.replace(
|
|
191
191
|
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function ws(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
192
192
|
let o=r?LS(e):e;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
@@ -221,7 +221,7 @@ if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$re
|
|
|
221
221
|
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=QS(e.schema,t,e.operationName,e.operation,e.additionalProperties);
|
|
222
222
|
return e.status="built",e.pointer==="#"?n:(r.definitions[e.definitionName]=n,{$ref:e.pointer})}function Ts(e,t,r,n,o=!1){
|
|
223
223
|
let i=On(t),s=ed(e,t,r,n,o);return i.rootNode===s?{$ref:"#"}:td(s,t)}function Pr(e,{referenceBacked:t=!1}={}){return{schema:e,
|
|
224
|
-
referenceBacked:t}}function QS(e,t,r,n,o=!1){let i={},s=[];for(let[c,l]of Object.entries(e.structure))
|
|
224
|
+
referenceBacked:t}}function QS(e,t,r,n,o=!1){let i={},s=[];for(let[c,l]of Object.entries(e.structure))x(i,c,Is(e,c,l,t,r,
|
|
225
225
|
n)),n.enforceRequired&&l.required===!0&&s.push(c);let a={type:"object",properties:i,additionalProperties:o};return s.length>
|
|
226
226
|
0&&(a.required=s),a}function e_(e,t,r,n,o,i){let s=vn(t,r);if(!s)return null;if(s.kind==="schema")return{...An(Ts(s.schema,
|
|
227
227
|
n,"replace",s.schema.operations.replace,!1)),[We]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,
|
|
@@ -236,12 +236,12 @@ Array.isArray(s))throw new Error(`Type '${r.type}' on field '${t}' returned an i
|
|
|
236
236
|
"array"){let a=e_(e,t,r,n,o,i);if(a)return Pr({...s,items:a},{referenceBacked:Es(s)})}return Pr(s,{referenceBacked:Es(s)})}
|
|
237
237
|
function Is(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=r_(e,t,r,n,o,i),c=a.referenceBacked?
|
|
238
238
|
An(a.schema):{...a.schema},l={castType:r.type};for(let h of Object.keys(r)){if(h==="type"||!Object.hasOwn(e.validators,h))
|
|
239
|
-
continue;let p=qS(e,h,t);if(!p)continue;let
|
|
239
|
+
continue;let p=qS(e,h,t);if(!p)continue;let w=p({...s,parameterName:h,parameterValue:r[h],fieldSchema:{...c}});w&&zS(c,w)}
|
|
240
240
|
c[We]&&(vs(l,c[We]),delete c[We]);let u=[];r.nullable===!0&&u.push({type:"null"}),r.nullOnEmpty===!0&&u.push({const:""});
|
|
241
|
-
let
|
|
241
|
+
let f=An(GS(c,u));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.defaultTo!="function"){let h=e._normalizeDefault(
|
|
242
242
|
r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(
|
|
243
243
|
o,i,{})});if(Object.keys(h.errors).length>0){let p=Object.values(h.errors)[0];throw new Error(`defaultTo for "${t}" is i\
|
|
244
|
-
nvalid (${p.code}).`)}
|
|
244
|
+
nvalid (${p.code}).`)}f.default=h.value}else l.defaults={providedByFunction:!0};return f[We]=l,f}function rd(e,t={}){let r=KS(
|
|
245
245
|
t),{operationName:n,operation:o}=YS(e,r),i=r.additionalProperties===void 0?!1:r.additionalProperties,s=On(r),a=ed(e,r,n,
|
|
246
246
|
o,i,{root:!0}),c={$schema:DS,...td(a,r)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}var DS,
|
|
247
247
|
We,ys,bs,BS,US,VS,FS,nd=d(()=>{ps();fs();gs();Tr();Or();DS="http://json-schema.org/draft-07/schema#",We="x-json-rest-sch\
|
|
@@ -265,9 +265,9 @@ tadata",{scale:e}),temporalPrecision:({parameterValue:e})=>it("metadata",{tempor
|
|
|
265
265
|
nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function od(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Rs(e){return e instanceof
|
|
266
266
|
Nt}function n_(){return{self:!1,children:{}}}function id(e){return Object.keys(e.children).length>0}function st(e,t){return`${e}\
|
|
267
267
|
.${String(t)}`}function dd(e,t){return e===""?String(t):st(e,t)}function sd(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
268
|
-
startsWith(r)?e.slice(r.length):null}function Rt(e,t){let r={};for(let n of Object.values(e)){let o=st(t,n.field);
|
|
268
|
+
startsWith(r)?e.slice(r.length):null}function Rt(e,t){let r={};for(let n of Object.values(e)){let o=st(t,n.field);x(r,o,
|
|
269
269
|
{...n,field:o})}return r}function Ps(e){return ws(e,"validatePath")}function ad(e){let t={};for(let r of e){let n=Ps(r),
|
|
270
|
-
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||
|
|
270
|
+
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||x(o,s,n_()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
271
271
|
return t}function o_(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}
|
|
272
272
|
function Pn(e){return e===null?!0:Array.isArray(e)||Q(e)?Object.keys(e).length>0:e!==void 0}function cd(e){return[...e].
|
|
273
273
|
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)})}
|
|
@@ -276,7 +276,7 @@ prototype);return t.set(e,r),r.structure=null,r.types=e.types,r.validators=e.val
|
|
|
276
276
|
Rn(xn(e.structure,t)),r._installOperationMethods(),Object.freeze(r)}function xn(e,t=new WeakMap){if(e===null||typeof e!=
|
|
277
277
|
"object")return e;if(Rs(e))return s_(e,t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let n=new RegExp(
|
|
278
278
|
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);
|
|
279
|
-
for(let o of e)n.push(xn(o,t));return n}if(!Q(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))
|
|
279
|
+
for(let o of e)n.push(xn(o,t));return n}if(!Q(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))x(r,n,xn(
|
|
280
280
|
o,t));return r}function Rn(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||Rs(e))return e;if(t.add(e),Array.
|
|
281
281
|
isArray(e))for(let r of e)Rn(r,t);else for(let r of Reflect.ownKeys(e))Rn(e[r],t);return Object.freeze(e)}function As(e){
|
|
282
282
|
return Rn(xn(e))}function xs(e,t,r=""){if(!Rs(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
@@ -286,7 +286,7 @@ if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nes
|
|
|
286
286
|
n,i);return o.kind==="schema"?s.length<1?null:xs(o.schema,s,a):s.length<1?o.definition:pd(e,o.definition,s,a)}return null}
|
|
287
287
|
function Ct(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>sd(o,t)).filter(o=>o!==null&&o!==
|
|
288
288
|
"");n.length>0?r.skipFields=n:delete r.skipFields}if(Q(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
289
|
-
let s=sd(o,t);s===null||s===""||
|
|
289
|
+
let s=sd(o,t);s===null||s===""||x(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}function ld(e,t,r,n){
|
|
290
290
|
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function Os(e,t,r,n=!0){
|
|
291
291
|
let o=t[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${e}" must define ${r} as a boolean.`)}
|
|
292
292
|
function c_(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);
|
|
@@ -294,9 +294,9 @@ return ld(e,t,"targetFields",["schema","input"]),Os(e,t,"enforceRequired"),Os(e,
|
|
|
294
294
|
["validated","input"]),Os(e,t,"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.
|
|
295
295
|
enforceRequired,applyDefaults:t.applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===
|
|
296
296
|
void 0?!0:t.rejectExplicitUndefined})}function l_(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(
|
|
297
|
-
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(a_))
|
|
298
|
-
entries(e))
|
|
299
|
-
e))
|
|
297
|
+
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(a_))x(t,r,n);for(let[r,n]of Object.
|
|
298
|
+
entries(e))x(t,r,c_(r,n));return Object.freeze(t)}function ud(e){let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
299
|
+
e))x(t,r,n);return Object.freeze(t)}function u_(e){let t={...e};return delete t.operation,delete t.mode,t}var a_,Nt,fd=d(
|
|
300
300
|
()=>{nd();ps();Or();Tr();a_=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
301
301
|
outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,applyDefaults:!0,
|
|
302
302
|
outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,applyDefaults:!1,
|
|
@@ -305,7 +305,7 @@ validators=ud(n),this.operations=l_(o),this._installOperationMethods()}_typeErro
|
|
|
305
305
|
T_FAILED","Value could not be cast to the required type.")}_paramError(t,r,n,o={}){let i=new Error(n);return i.errorObject=
|
|
306
306
|
{field:t,code:r,message:n,params:o},i}_paramToBeSkipped(t,r,n){return typeof r!="object"||r===null?!1:!!(Array.isArray(r[n])&&
|
|
307
307
|
r[n].includes(t))}_fieldToBeSkipped(t,r){return Array.isArray(r.skipFields)&&r.skipFields.includes(t)}_mergeErrors(t,r){
|
|
308
|
-
for(let[n,o]of Object.entries(r))
|
|
308
|
+
for(let[n,o]of Object.entries(r))x(t,n,o)}_singleErrorMap(t){let r={};return x(r,t.field,t),r}_assertSupportedOptions(t={}){
|
|
309
309
|
if(Object.hasOwn(t,"onlyObjectValues"))throw new Error("Unsupported validation option `onlyObjectValues`. Call `patch()`\
|
|
310
310
|
directly.");if(Object.hasOwn(t,"mode"))throw new Error("Unsupported validation option `mode`. Call `validateWith()` or \
|
|
311
311
|
an operation method directly.");if(Object.hasOwn(t,"operation"))throw new Error("Unsupported validation option `operatio\
|
|
@@ -318,84 +318,84 @@ r))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidatio
|
|
|
318
318
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(
|
|
319
319
|
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:u_(t)}}_buildOperationResult(t,r,n){
|
|
320
320
|
let o={};for(let i of n.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=n.isFieldPresent(i);(r[i]!==
|
|
321
|
-
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||
|
|
321
|
+
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||x(o,i,r[i]))}return o}_resolveObjectFieldMode(t,r){
|
|
322
322
|
return Tn(t,r)}_resolveArrayItemsConfig(t,r){return vn(t,r)}_resolveObjectValuesConfig(t,r){return Ir(t,r)}_buildArrayItemSettings(t,r){
|
|
323
323
|
return t.type==="object"&&Object.hasOwn(t,"schema")?{...r,operationName:"replace",operation:this.operations.replace}:r}_castValue(t,r,n,o,i,s,a,c){
|
|
324
324
|
let l=t.nullable===!0||a.nullable===!0,u=t.nullOnEmpty===!0||a.nullOnEmpty===!0;if(!Object.hasOwn(this.types,t.type))throw new Error(
|
|
325
|
-
`No casting function for type: ${t.type}`);let
|
|
325
|
+
`No casting function for type: ${t.type}`);let f=this.types[t.type];if(r===null)return l?(x(o,i,null),{errors:{},shouldContinue:!1}):
|
|
326
326
|
{errors:this._singleErrorMap({field:n,code:"NOT_NULLABLE",message:"Field cannot be null",params:{}}),shouldContinue:!1};
|
|
327
|
-
if(r===""&&u)return
|
|
327
|
+
if(r===""&&u)return x(o,i,null),{errors:{},shouldContinue:!1};let h={schema:this,definition:t,value:r,fieldName:n,object:o,
|
|
328
328
|
objectBeforeCast:s,valueBeforeCast:r,options:a,mode:c.operationName,operation:c.operationName,fieldPresent:!0,computedOptions:{
|
|
329
|
-
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(p,
|
|
330
|
-
n,p,
|
|
329
|
+
nullable:l||u,nullOnEmpty:u},throwTypeError:()=>{throw this._typeError(n)},throwParamError:(p,w,E)=>{throw this._paramError(
|
|
330
|
+
n,p,w,E)}};try{let p=f(h);if(od(p))throw new Error(`Type handler for "${t.type}" must be synchronous.`);p!==void 0&&(x(o,
|
|
331
331
|
i,p),h.value=p)}catch(p){if(p.errorObject)return{errors:this._singleErrorMap(p.errorObject),shouldContinue:!1};throw p}return{
|
|
332
332
|
errors:{},context:h,shouldContinue:!0}}_runFieldValidators(t,r,n,o,i,s){for(let a of Object.keys(t)){if(a==="type"||this.
|
|
333
333
|
_paramToBeSkipped(a,s.skipParams,r)||!Object.hasOwn(this.validators,a))continue;let c=this.validators[a];try{i.parameterName=
|
|
334
334
|
a,i.parameterValue=t[a];let l=c(i);if(od(l))throw new Error(`Validator handler for "${a}" must be synchronous.`);l!==void 0&&
|
|
335
|
-
(
|
|
335
|
+
(x(n,o,l),i.value=l)}catch(l){if(l.errorObject)return this._singleErrorMap(l.errorObject);throw l}}return{}}_normalizeAndValidateValue(t,r,n,o,i,s,a,c){
|
|
336
336
|
let l=this._castValue(t,r,n,o,i,s,a,c);if(Object.keys(l.errors).length>0)return l.errors;if(!l.shouldContinue)return{};let{
|
|
337
|
-
context:u}=l,
|
|
337
|
+
context:u}=l,f=this._validateNestedValue(t,n,o,i,a,c);return Object.keys(f).length>0?f:(u.value=o[i],this._runFieldValidators(
|
|
338
338
|
t,n,o,i,u,a))}_normalizeDefault(t,r,{fieldPath:n,currentObject:o,containerKey:i,objectBeforeCast:s,options:a,settings:c}){
|
|
339
|
-
let l={...o};return
|
|
339
|
+
let l={...o};return x(l,i,r),{errors:this._normalizeAndValidateValue(t,r,n,l,i,s,a,c),value:l[i]}}_validateNestedValue(t,r,n,o,i,s){
|
|
340
340
|
if(t.type==="object"){let c=this._resolveObjectFieldMode(r,t);return c.kind==="nested"?this._validateNestedObjectSchema(
|
|
341
341
|
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.
|
|
342
342
|
_resolveArrayItemsConfig(r,t);return a?this._validateArrayItems(r,n,o,a,i,s):{}}_validateNestedObjectSchema(t,r,n,o,i,s){
|
|
343
343
|
let a=n[o],c=t.allowAdditionalProperties?this._extractKnownObjectFields(a,t.schema):a,l=t.schema._validateWithOperation(
|
|
344
|
-
s.operationName,s.operation,c,Ct(i,r));return
|
|
344
|
+
s.operationName,s.operation,c,Ct(i,r));return x(n,o,t.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(
|
|
345
345
|
a,t.schema,l.validatedObject):l.validatedObject),Rt(l.errors,r)}_extractKnownObjectFields(t,r){let n={};for(let[o,i]of Object.
|
|
346
|
-
entries(t))Object.hasOwn(r.structure,o)&&
|
|
347
|
-
keys(t)){if(!Object.hasOwn(r.structure,i)){
|
|
348
|
-
n))Object.hasOwn(o,i)||
|
|
349
|
-
keys(a)){let
|
|
350
|
-
_mergeErrors(l,this._singleErrorMap(this._typeError(
|
|
351
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,h,Ct(i,
|
|
352
|
-
l,Rt(
|
|
353
|
-
definition,s));this._mergeErrors(l,p)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};
|
|
354
|
-
c.length;u++){let
|
|
355
|
-
this._mergeErrors(l,this._singleErrorMap(this._typeError(
|
|
356
|
-
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],Ct(i,
|
|
357
|
-
l,Rt(p.errors,
|
|
346
|
+
entries(t))Object.hasOwn(r.structure,o)&&x(n,o,i);return n}_mergeKnownAndPassthroughObjectFields(t,r,n){let o={};for(let i of Object.
|
|
347
|
+
keys(t)){if(!Object.hasOwn(r.structure,i)){x(o,i,t[i]);continue}Object.hasOwn(n,i)&&x(o,i,n[i])}for(let[i,s]of Object.entries(
|
|
348
|
+
n))Object.hasOwn(o,i)||x(o,i,s);return o}_validateObjectValues(t,r,n,o,i,s){let a=r[n],c={...a},l={};x(r,n,c);for(let u of Object.
|
|
349
|
+
keys(a)){let f=st(t,u);if(this._fieldToBeSkipped(f,i))continue;let h=c[u];if(h===void 0){s.rejectExplicitUndefined?this.
|
|
350
|
+
_mergeErrors(l,this._singleErrorMap(this._typeError(f).errorObject)):delete c[u];continue}if(o.kind==="schema"){let w=o.
|
|
351
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,h,Ct(i,f));x(c,u,w.validatedObject),this._mergeErrors(
|
|
352
|
+
l,Rt(w.errors,f));continue}let p=this._normalizeAndValidateValue(o.definition,h,f,c,u,a,i,this._buildArrayItemSettings(o.
|
|
353
|
+
definition,s));this._mergeErrors(l,p)}return l}_validateArrayItems(t,r,n,o,i,s){let a=r[n],c=a.slice(),l={};x(r,n,c);for(let u=0;u<
|
|
354
|
+
c.length;u++){let f=st(t,u);if(this._fieldToBeSkipped(f,i))continue;if(!Object.hasOwn(a,u)||c[u]===void 0){s.rejectExplicitUndefined?
|
|
355
|
+
this._mergeErrors(l,this._singleErrorMap(this._typeError(f).errorObject)):delete c[u];continue}if(o.kind==="schema"){let p=o.
|
|
356
|
+
schema._validateWithOperation("replace",o.schema.operations.replace,c[u],Ct(i,f));x(c,u,p.validatedObject),this._mergeErrors(
|
|
357
|
+
l,Rt(p.errors,f));continue}let h=this._normalizeAndValidateValue(o.definition,c[u],f,c,u,a,i,this._buildArrayItemSettings(
|
|
358
358
|
o.definition,s));this._mergeErrors(l,h)}return l}_validateField(t,r,n,o,i){if(!Object.hasOwn(this.structure,t))return{};
|
|
359
359
|
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&&
|
|
360
360
|
s.required&&(!a||l)&&!this._paramToBeSkipped("required",o.skipParams,t)?this._singleErrorMap({field:t,code:"REQUIRED",message:"\
|
|
361
361
|
Field is required",params:{}}):a?l?i.rejectExplicitUndefined?this._singleErrorMap(this._typeError(t).errorObject):{}:this.
|
|
362
362
|
_normalizeAndValidateValue(s,c,t,n,t,r,o,i):{}}_validateWithOperation(t,r,n,o){this._assertSupportedOptions(o);let i={},
|
|
363
|
-
s={...n},a=this._buildOperationSettings(t,r,n);for(let c of Object.keys(n))Object.hasOwn(this.structure,c)||
|
|
363
|
+
s={...n},a=this._buildOperationSettings(t,r,n);for(let c of Object.keys(n))Object.hasOwn(this.structure,c)||x(i,c,{field:c,
|
|
364
364
|
code:"FIELD_NOT_ALLOWED",message:"Field not allowed",params:{}});for(let c of a.targetFieldNames){let l=this._validateField(
|
|
365
365
|
c,n,s,o,a);this._mergeErrors(i,l)}if(a.applyDefaults){for(let c of Object.keys(this.structure))if(!a.isFieldPresent(c)&&
|
|
366
366
|
this.structure[c].defaultTo!==void 0){let l=this.structure[c],u=typeof l.defaultTo=="function"?l.defaultTo():l.defaultTo,
|
|
367
|
-
|
|
368
|
-
_mergeErrors(i,
|
|
367
|
+
f=this._normalizeDefault(l,u,{fieldPath:c,currentObject:s,containerKey:c,objectBeforeCast:n,options:o,settings:a});if(this.
|
|
368
|
+
_mergeErrors(i,f.errors),Object.keys(f.errors).length>0)continue;x(s,c,f.value),a.defaultedFields.add(c)}}return{validatedObject:this.
|
|
369
369
|
_buildOperationResult(n,s,a),errors:i}}_validateSelectedTree(t,r,n,o,i=""){let s={},a={};for(let c of cd(Object.keys(t))){
|
|
370
370
|
let l=dd(i,c);if(!Object.hasOwn(this.structure,c))throw new Error(`Unknown schema path "${l}".`);let u=this._validateSelectedField(
|
|
371
371
|
c,t[c],r,a,n,o,l);this._mergeErrors(s,u)}return{validatedObject:a,errors:s}}_validateSelectedField(t,r,n,o,i,s,a){if(!Object.
|
|
372
372
|
hasOwn(this.structure,t))return{};let c=this.structure[t],l=r.self===!0,u=id(r);if(this._fieldToBeSkipped(a,i))return{};
|
|
373
|
-
let
|
|
373
|
+
let f=Object.hasOwn(n,t),h=n[t],p={};if(!f){if(l&&s.enforceRequired&&c.required&&!this._paramToBeSkipped("required",i.skipParams,
|
|
374
374
|
a)&&this._mergeErrors(p,this._singleErrorMap({field:a,code:"REQUIRED",message:"Field is required",params:{}})),l&&s.applyDefaults&&
|
|
375
|
-
c.defaultTo!==void 0){let
|
|
376
|
-
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(p,
|
|
377
|
-
length===0&&
|
|
378
|
-
a).errorObject):{};let
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
375
|
+
c.defaultTo!==void 0){let m=typeof c.defaultTo=="function"?c.defaultTo():c.defaultTo,g=this._normalizeDefault(c,m,{fieldPath:a,
|
|
376
|
+
currentObject:o,containerKey:t,objectBeforeCast:n,options:i,settings:s});this._mergeErrors(p,g.errors),Object.keys(g.errors).
|
|
377
|
+
length===0&&x(o,t,g.value)}return p}if(h===void 0)return l&&s.rejectExplicitUndefined?this._singleErrorMap(this._typeError(
|
|
378
|
+
a).errorObject):{};let w={[t]:h};if(l){let m=this._normalizeAndValidateValue(c,h,a,w,t,n,i,s);return Object.hasOwn(w,t)&&
|
|
379
|
+
w[t]!==void 0?x(o,t,w[t]):w[t]===null&&x(o,t,null),m}if(!u)return{};let E=this._castValue(c,h,a,w,t,n,i,s);if(Object.keys(
|
|
380
|
+
E.errors).length>0)return E.errors;if(!E.shouldContinue)return{};let S=this._validateSelectedDescendants(c,r.children,a,
|
|
381
|
+
w,t,i,s);return Pn(w[t])&&x(o,t,w[t]),S}_validateSelectedDescendants(t,r,n,o,i,s,a){if(t.type==="object"){let c=this._resolveObjectFieldMode(
|
|
382
382
|
n,t);if(c.kind!=="nested")throw new Error(`Schema path "${n}" does not support nested field selection.`);let l=o[i];if(!Q(
|
|
383
|
-
l))return{};let u=c.schema._validateSelectedTree(r,l,Ct(s,n),{...a,defaultedFields:new Set});return
|
|
383
|
+
l))return{};let u=c.schema._validateSelectedTree(r,l,Ct(s,n),{...a,defaultedFields:new Set});return x(o,i,u.validatedObject),
|
|
384
384
|
Rt(u.errors,n)}if(t.type==="array"){let c=this._resolveArrayItemsConfig(n,t);if(!c)throw new Error(`Schema path "${n}" d\
|
|
385
385
|
oes not define array items for nested selection.`);return this._validateSelectedArrayItems(n,o,i,c,r,s,a)}throw new Error(
|
|
386
386
|
`Schema path "${n}" does not support nested field selection.`)}_validateSelectedArrayItems(t,r,n,o,i,s,a){let c=[],l=r[n],
|
|
387
|
-
u={};
|
|
388
|
-
id because array segments must use numeric indexes.`);let h=Number(
|
|
389
|
-
p,s))continue;if(!Object.hasOwn(l,h)){
|
|
390
|
-
if(
|
|
391
|
-
let
|
|
392
|
-
this._mergeErrors(u,Rt(
|
|
393
|
-
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});Pn(
|
|
394
|
-
this._mergeErrors(u,Rt(
|
|
395
|
-
o.definition,
|
|
396
|
-
continue}if(!S)continue;let
|
|
397
|
-
u,
|
|
398
|
-
s,
|
|
387
|
+
u={};x(r,n,c);for(let f of cd(Object.keys(i))){if(!/^[0-9]+$/.test(f))throw new Error(`Schema path "${st(t,f)}" is inval\
|
|
388
|
+
id because array segments must use numeric indexes.`);let h=Number(f),p=st(t,h),w=i[f],E=w.self===!0,S=id(w);if(this._fieldToBeSkipped(
|
|
389
|
+
p,s))continue;if(!Object.hasOwn(l,h)){E&&a.rejectExplicitUndefined&&x(u,p,this._typeError(p).errorObject);continue}let m=l[h];
|
|
390
|
+
if(m===void 0){E&&a.rejectExplicitUndefined&&x(u,p,this._typeError(p).errorObject);continue}if(o.kind==="schema"){if(E){
|
|
391
|
+
let _=o.schema._validateWithOperation("replace",o.schema.operations.replace,m,Ct(s,p));Pn(_.validatedObject)&&x(c,h,_.validatedObject),
|
|
392
|
+
this._mergeErrors(u,Rt(_.errors,p));continue}if(!S)continue;let b=o.schema._validateSelectedTree(w.children,m,Ct(s,p),{...a,
|
|
393
|
+
operationName:"replace",operation:o.schema.operations.replace,defaultedFields:new Set});Pn(b.validatedObject)&&x(c,h,b.validatedObject),
|
|
394
|
+
this._mergeErrors(u,Rt(b.errors,p));continue}let g=this._buildArrayItemSettings(o.definition,a),y=[m];if(E){let b=this._normalizeAndValidateValue(
|
|
395
|
+
o.definition,m,p,y,0,l,s,g);Object.hasOwn(y,0)&&y[0]!==void 0?x(c,h,y[0]):y[0]===null&&x(c,h,null),this._mergeErrors(u,b);
|
|
396
|
+
continue}if(!S)continue;let v=this._castValue(o.definition,m,p,y,0,l,s,g);if(Object.keys(v.errors).length>0){this._mergeErrors(
|
|
397
|
+
u,v.errors);continue}if(!v.shouldContinue)continue;let T=this._validateSelectedDescendants(o.definition,w.children,p,y,0,
|
|
398
|
+
s,g);Pn(y[0])&&x(c,h,y[0]),this._mergeErrors(u,T)}return u}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
399
399
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
400
400
|
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=Ps(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
401
401
|
_resolvePathValidationRequest(n),c=this._validateSelectedTree(ad([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:o_(
|
|
@@ -407,10 +407,10 @@ _buildOperationSettings(o,i,r))}_installOperationMethods(){for(let t of Object.k
|
|
|
407
407
|
return rd(this,t)}getFieldDefinitions(){return As(this.structure)}getFieldDefinition(t){if(typeof t!="string"||t.trim()===
|
|
408
408
|
"")throw new Error("Field path must be a non-empty string.");let r=xs(this,Ps(t.trim()));return r===null?null:As(r)}getFieldMessages(t){
|
|
409
409
|
let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.messages===null?Object.freeze({}):As(r.messages)}cleanup(t,r){
|
|
410
|
-
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&
|
|
411
|
-
t",m_=(e,t)=>t,hd=(e,t,r)=>{let n=p_(t.push(r)-1);return e.set(r,n),n},gd=(e,t,r)=>{let n=t&&typeof t===md?(u,
|
|
412
|
-
-1<t.indexOf(u)?
|
|
413
|
-
l,r);return"["+s.join(",")+"]";function l(u,
|
|
410
|
+
let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,o)&&this.structure[o][r]&&x(n,o,t[o]);return n}}});var J$,d_,X$,p_,f_,md,m_,hd,gd,wd=d(()=>{({parse:J$,stringify:d_}=JSON),{keys:X$}=Object,p_=String,f_="string",md="objec\
|
|
411
|
+
t",m_=(e,t)=>t,hd=(e,t,r)=>{let n=p_(t.push(r)-1);return e.set(r,n),n},gd=(e,t,r)=>{let n=t&&typeof t===md?(u,f)=>u===""||
|
|
412
|
+
-1<t.indexOf(u)?f:void 0:t||m_,o=new Map,i=[],s=[],a=+hd(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=d_(i[a++],
|
|
413
|
+
l,r);return"["+s.join(",")+"]";function l(u,f){if(c)return c=!c,f;let h=n.call(this,u,f);switch(typeof h){case md:if(h===
|
|
414
414
|
null)return h;case f_:return o.get(h)||hd(o,i,h)}return h}}});function y_(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function yd(e){if(typeof e==
|
|
415
415
|
"number")return Number.isFinite(e)?e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e==
|
|
416
416
|
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function Cs(e,t){
|
|
@@ -465,9 +465,9 @@ length})}),r("notEmpty",n=>{n.parameterValue&&typeof n.value=="string"&&n.value=
|
|
|
465
465
|
ld cannot be empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),r("scale",()=>{}),r("temporalPre\
|
|
466
466
|
cision",n=>{if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(`temporalPrecision can only be\
|
|
467
467
|
used on time or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",()=>{}),r("defaultTo",()=>{})}},
|
|
468
|
-
bd=b_});var Sd=d(()=>{Or()});function E_(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);
|
|
469
|
-
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);
|
|
470
|
-
create(null);for(let[r,n]of Object.entries(e))
|
|
468
|
+
bd=b_});var Sd=d(()=>{Or()});function E_(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);x(e,t,r)}function S_(e,t,r){
|
|
469
|
+
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);x(e,t,r)}function Cn(e={}){let t=Object.
|
|
470
|
+
create(null);for(let[r,n]of Object.entries(e))x(t,r,n);return t}function __(e,t){if(typeof e.install!="function")throw new Error(
|
|
471
471
|
"Plugin must have an install method.");e.install(t)}function _d(e,t,r){Td.set(e,t),Id.set(e,r),Object.defineProperty(e,Ad,
|
|
472
472
|
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function v_(e){if(!e||
|
|
473
473
|
typeof e!="object"&&typeof e!="function")return null;let t=Td.get(e),r=Id.get(e);if(t&&r)return{types:t,validators:r};let n=e[Ad];
|
|
@@ -476,14 +476,14 @@ typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.va
|
|
|
476
476
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
477
477
|
validators}:null}function T_(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function I_(e,t){return e===t}function vd(e,t,r){
|
|
478
478
|
for(let[n,o]of Object.entries(t)){if(Object.hasOwn(e,n)&&!I_(e[n],o))throw new Error(`Cannot merge schema factories with\
|
|
479
|
-
conflicting ${r} "${n}".`);
|
|
479
|
+
conflicting ${r} "${n}".`);x(e,n,o)}}function A_(e,t,r){let n=T_(r).filter(Boolean);if(n.length<1)return{types:Cn(e),validators:Cn(
|
|
480
480
|
t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=v_(s);if(!a)throw new Error("Factory sources m\
|
|
481
481
|
ust be schema instances or schema factories created by json-rest-schema.");vd(o,a.types,"type"),vd(i,a.validators,"valid\
|
|
482
482
|
ator")}return{types:o,validators:i}}function Od({types:e={},validators:t={},installCore:r=!0}={}){let n=Cn(e),o=Cn(t),i=(s,a={})=>{
|
|
483
483
|
let c=new Nt(s,n,o,a.operations);return _d(c,n,o),c};return _d(i,n,o),i.addType=(s,a)=>{E_(n,s,a)},i.addValidator=(s,a)=>{
|
|
484
484
|
S_(o,s,a)},i.use=s=>{__(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{let a=A_(n,o,s);return Od(
|
|
485
|
-
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(bd),i}var Td,Id,Ad,
|
|
486
|
-
new WeakMap,Id=new WeakMap,Ad=Symbol.for("json-rest-schema.registry-metadata");
|
|
485
|
+
{types:a.types,validators:a.validators,installCore:!1})},r&&i.use(bd),i}var Td,Id,Ad,j,kt=d(()=>{fd();Ed();Sd();Or();Td=
|
|
486
|
+
new WeakMap,Id=new WeakMap,Ad=Symbol.for("json-rest-schema.registry-metadata");j=Od({installCore:!0})});var Pd=d(()=>{});function Y(e,{fallback:t=""}={}){return String(e||"").trim()||t}function re(e,{fallback:t={}}={}){return!e||typeof e!="o\
|
|
487
487
|
bject"||Array.isArray(e)?{...t}:e}var wM,yM,bM,EM,SM,we=d(()=>{wM=Object.freeze(["none","pending","committed","rolledBac\
|
|
488
488
|
k","unknown"]);yM=Object.freeze(["bundled","dev_server"]),bM=Object.freeze(["capacitor"]),EM=Object.freeze({callbackPath:"\
|
|
489
489
|
/auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),SM=Object.freeze({packageName:"",minSdk:26,targetSdk:35,
|
|
@@ -509,7 +509,7 @@ call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!kn(n.schema
|
|
|
509
509
|
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=Y(r).toLowerCase();return o.mode=Ns(n,{defaultMode:i||
|
|
510
510
|
"patch",context:`${t}.mode`}),Object.freeze(o)}function Nd(e,{context:t="schema definition",defaultMode:r=""}={}){return $n(
|
|
511
511
|
e,{context:t,defaultMode:r})}function $s(e,t,{context:r="schema definition",defaultMode:n=""}={}){let o=Nd(e,{context:r,
|
|
512
|
-
defaultMode:n});return o?xd(o,t,{defaultMode:n||"patch",context:`${r}.mode`}):null}var xr=d(()=>{we();Cd()});var kd=d(()=>{kt();we();Nn();xr()});var $d=d(()=>{kt();Nn();xr()});var k_,$_,Md=d(()=>{kt();k_=
|
|
512
|
+
defaultMode:n});return o?xd(o,t,{defaultMode:n||"patch",context:`${r}.mode`}):null}var xr=d(()=>{we();Cd()});var kd=d(()=>{kt();we();Nn();xr()});var $d=d(()=>{kt();Nn();xr()});var k_,$_,Md=d(()=>{kt();k_=j({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),$_=Object.
|
|
513
513
|
freeze({schema:k_,mode:"patch"})});var jd,M_,Ld=d(()=>{jd=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),
|
|
514
514
|
M_=Object.freeze({...jd,nullable:!0})});var Dd=d(()=>{});function Bd({message:e="Schema validation failed.",fieldErrors:t=null,errors:r=null,cause:n,statusCode:o=null}={}){let i=new Error(
|
|
515
515
|
e,n?{cause:n}:void 0);return Number.isInteger(o)&&o>=400&&o<=599&&(i.statusCode=o),t&&typeof t=="object"?(i.fieldErrors=
|
|
@@ -518,37 +518,37 @@ input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;
|
|
|
518
518
|
replace":"patch",context:n});if(!i)throw new TypeError(`${n}.schema must be a json-rest-schema schema instance.`);let s=ks(
|
|
519
519
|
i?.errors,e);if(Object.keys(s).length>0)throw Bd({fieldErrors:s,statusCode:o});return i?.validatedObject??t}var Ud=d(()=>{
|
|
520
520
|
xr()});var Vd,js,j_,L_,Fd=d(()=>{kt();Nn();Vd="^[1-9][0-9]*$",js=at({type:"string",minLength:1,pattern:Vd}),j_=at({...js,nullable:!0}),
|
|
521
|
-
L_=at({schema:
|
|
521
|
+
L_=at({schema:j({recordId:{...js,required:!0,messages:{pattern:"Record id must be a canonical positive integer string."}}}),
|
|
522
522
|
mode:"patch"})});var zd=d(()=>{});var Mn=d(()=>{kt();Pd();kd();$d();Md();Ld();Dd();xr();Ud();Fd();zd()});import{isDeepStrictEqual as D_}from"node:util";function Ln(e,t){let r=G_.get(e?.schemaVersion)||Hd;return pe(r,e,t)}function pe(e,t,r){
|
|
523
523
|
let n=Ms({schema:e,mode:"create"},t,{context:r});if(!D_(t,n))throw new Error(`${r}: unknown fields or noncanonical value\
|
|
524
|
-
s.`);return n}var R,
|
|
525
|
-
minLength:1,maxLength:256},
|
|
526
|
-
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),jn={type:"integer",required:!0,enum:[1]},B_=V(
|
|
527
|
-
24),U_=
|
|
528
|
-
ject",required:!1,schema:
|
|
529
|
-
explanationRequired:{type:"boolean",required:!1},files:{...V(R,8),required:!1,minLength:1}})}}),Gd={code:
|
|
530
|
-
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:V(
|
|
531
|
-
required:!1,schema:
|
|
532
|
-
sequenceMode:{...R,required:!1,enum:["create","continue"]}})},checks:{...V(
|
|
524
|
+
s.`);return n}var R,B,V,jn,B_,U_,Gd,Hd,V_,qd,F_,z_,G_,Te,Dn,Bn,Wd,$t=d(()=>{Mn();R={type:"string",required:!0,noTrim:!0,
|
|
525
|
+
minLength:1,maxLength:256},B={...R,maxLength:64},V=(e,t=100)=>({type:"array",required:!0,maxLength:t,items:e,validator:r=>Array.
|
|
526
|
+
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),jn={type:"integer",required:!0,enum:[1]},B_=V(j({code:B}),
|
|
527
|
+
24),U_=j({id:B,kind:{...R,enum:["answer","practical"]},required:{type:"boolean",required:!0},rubric:R,evidence:{type:"ob\
|
|
528
|
+
ject",required:!1,schema:j({producer:{...R,enum:["workspace","colleague","exercise","code"]},operation:B,check:{...B,required:!1},
|
|
529
|
+
explanationRequired:{type:"boolean",required:!1},files:{...V(R,8),required:!1,minLength:1}})}}),Gd={code:B,title:R,prerequisites:B_,
|
|
530
|
+
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:V(j({id:B,descriptor:R}),12),exercise:{type:"object",
|
|
531
|
+
required:!1,schema:j({kind:{...R,enum:["bundled"]},source:R,reuse:{...R,enum:["attempt","sequence"]},sequenceId:{...B,required:!1},
|
|
532
|
+
sequenceMode:{...R,required:!1,enum:["create","continue"]}})},checks:{...V(j({id:B,file:R,assets:{...V(R,32),required:!1},
|
|
533
533
|
kind:{...R,required:!1,enum:["response","code"]},timeoutSeconds:{type:"integer",required:!1,min:1,max:60}}),12),required:!1},
|
|
534
|
-
appRoutes:{...V(
|
|
535
|
-
/-]*$"}}),16),required:!1}},Hd=
|
|
536
|
-
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:
|
|
537
|
-
ct",required:!0}}),16),required:!1}})},guide:{type:"object",required:!1,schema:
|
|
538
|
-
filePath:{...R,required:!1,maxLength:512},caption:{...R,required:!1}})},check:{type:"object",required:!0,schema:
|
|
539
|
-
...R,enum:["auto","choice","review","self","fact","none"]},check:{...
|
|
534
|
+
appRoutes:{...V(j({method:{...R,enum:["POST","PUT","PATCH","DELETE"]},path:{...R,maxLength:128,pattern:"^/[A-Za-z0-9._~:\
|
|
535
|
+
/-]*$"}}),16),required:!1}},Hd=j({schemaVersion:jn,...Gd,document:R,assessments:V(U_,32)}),V_=j({id:B,title:R,body:R,required:{
|
|
536
|
+
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:j({id:B,play:{...V(j({name:B,parameters:{type:"obje\
|
|
537
|
+
ct",required:!0}}),16),required:!1}})},guide:{type:"object",required:!1,schema:j({target:B,navigate:{type:"boolean",required:!1},
|
|
538
|
+
filePath:{...R,required:!1,maxLength:512},caption:{...R,required:!1}})},check:{type:"object",required:!0,schema:j({kind:{
|
|
539
|
+
...R,enum:["auto","choice","review","self","fact","none"]},check:{...B,required:!1},fact:{...B,required:!1},files:{...V(
|
|
540
540
|
R,8),required:!1},question:{...R,required:!1,maxLength:2e3},options:{...V(R,8),required:!1},answer:{...V({type:"integer",
|
|
541
541
|
required:!0,min:0,max:7},8),required:!1},rubric:{...R,required:!1,maxLength:600},evidence:{...V({...R,enum:["changes","c\
|
|
542
|
-
onversation"]},2),required:!1}})}}),qd={...Gd,notes:{...R,required:!1},steps:V(V_,32)},F_=
|
|
543
|
-
r",required:!0,enum:[2]},...qd}),z_=
|
|
544
|
-
io","project"]}}),G_=new Map([[1,Hd],[2,F_],[3,z_]]),Te=e=>e?.schemaVersion===2||e?.schemaVersion===3;Dn=
|
|
545
|
-
topicId:
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
title:R,release:R,status:{...R,enum:["preview","released"]},topics:V(
|
|
549
|
-
Wd=
|
|
550
|
-
...R,maxLength:2e3},commands:V(
|
|
551
|
-
nteger",required:!0,min:1,max:256}}),8),completionState:
|
|
542
|
+
onversation"]},2),required:!1}})}}),qd={...Gd,notes:{...R,required:!1},steps:V(V_,32)},F_=j({schemaVersion:{type:"intege\
|
|
543
|
+
r",required:!0,enum:[2]},...qd}),z_=j({schemaVersion:{type:"integer",required:!0,enum:[3]},...qd,stage:{...R,enum:["stud\
|
|
544
|
+
io","project"]}}),G_=new Map([[1,Hd],[2,F_],[3,z_]]),Te=e=>e?.schemaVersion===2||e?.schemaVersion===3;Dn=j({schemaVersion:jn,
|
|
545
|
+
topicId:B,domainId:B,title:R,status:{...R,enum:["preview","released"]},outline:R,prerequisites:V(j({topicId:B}),24),lessons:V(
|
|
546
|
+
j({code:B,descriptor:R,status:{...R,enum:["draft","published"]},required:{type:"boolean",required:!0}}),64),places:{...V(
|
|
547
|
+
B,64),required:!1},activities:{...V(B,64),required:!1},facts:{...V(B,64),required:!1}}),Bn=j({schemaVersion:jn,courseId:B,
|
|
548
|
+
title:R,release:R,status:{...R,enum:["preview","released"]},topics:V(j({topicId:B,release:R}),32),orientation:{...B,required:!1}}),
|
|
549
|
+
Wd=j({schemaVersion:jn,id:B,title:R,svg:R,controller:R,assets:{...V(R,32),required:!1},initialState:B,states:V(B,32),description:{
|
|
550
|
+
...R,maxLength:2e3},commands:V(j({name:B,parameters:V(j({name:B,required:{type:"boolean",required:!0},maxLength:{type:"i\
|
|
551
|
+
nteger",required:!0,min:1,max:256}}),8),completionState:B,description:{...R,maxLength:2e3}}),32)})});function ne(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function J_(e){if(!Ds(e)||
|
|
552
552
|
!Me.test(e.id||""))throw ne("A place needs a lowercase id.");let t=`Place ${e.id}`;if(!Jd(e.label))throw ne(`${t} needs \
|
|
553
553
|
a label.`);if(!H_.has(e.scope))throw ne(`${t} scope is studio or project.`);let r=e.who??"everyone";if(!q_.has(r))throw ne(
|
|
554
554
|
`${t} who is everyone or owner.`);let n=e.open??null;if(n!==null){let i=Object.keys(n||{}).sort().join(",");if(!(i==="pa\
|
|
@@ -564,10 +564,10 @@ freeze(o.map(i=>Object.freeze({...i}))),...e.event?{event:e.event}:{}})}function
|
|
|
564
564
|
"An activity needs a lowercase id.");if(!Me.test(e.event||""))throw ne(`Activity ${e.id} needs its page activity event.`);
|
|
565
565
|
if(e.place!==void 0&&!Me.test(e.place))throw ne(`Activity ${e.id} place is a place id.`);return Object.freeze({id:e.id,event:e.
|
|
566
566
|
event,...e.place?{place:e.place}:{}})}function Zd({places:e=W_,activities:t=Y_,facts:r=K_}={}){let n=new Map,o=new Map,i=new Set,
|
|
567
|
-
s=(c,l)=>JSON.stringify(c)===JSON.stringify(l);function a({places:c=[],activities:l=[],facts:u=[]}={}){let
|
|
568
|
-
map(X_);for(let p of[...
|
|
567
|
+
s=(c,l)=>JSON.stringify(c)===JSON.stringify(l);function a({places:c=[],activities:l=[],facts:u=[]}={}){let f=c.map(J_),h=l.
|
|
568
|
+
map(X_);for(let p of[...f,...h])if(n.has(p.id)&&!s(n.get(p.id),p)||o.has(p.id)&&!s(o.get(p.id),p)||f.includes(p)&&o.has(
|
|
569
569
|
p.id)||h.includes(p)&&n.has(p.id))throw ne(`${p.id} is already registered with another meaning.`);for(let p of u)if(!Me.
|
|
570
|
-
test(p||""))throw ne("A fact needs a lowercase id.");for(let p of
|
|
570
|
+
test(p||""))throw ne("A fact needs a lowercase id.");for(let p of f)n.set(p.id,p);for(let p of h)o.set(p.id,p);for(let p of u)
|
|
571
571
|
i.add(p)}return a({places:e,activities:t,facts:r}),Object.freeze({register:a,place:c=>n.get(c)||null,activity:c=>o.get(c)||
|
|
572
572
|
null,hasFact:c=>i.has(c),places:()=>[...n.values()],events:()=>new Set([...[...o.values()].map(c=>c.event),...[...n.values()].
|
|
573
573
|
filter(c=>c.event).map(c=>c.event)])})}function Un({places:e=[],activities:t=[],facts:r=[]}={}){let n=Zd(),o=new Set(n.places().
|
|
@@ -619,9 +619,9 @@ text:a.trim()};if(s!==void 0&&!(o==="do"&&i==="file-opened"))throw oe(`${c} take
|
|
|
619
619
|
a path.`);if(o==="show"&&!iv(i,r))throw oe(`${c} names an unknown place.`);if(o==="do"&&!ov(i,r))throw oe(`${c} names n\
|
|
620
620
|
othing the learner can do or be at.`);if(o==="check"&&!Us[i])throw oe(`${c} must be check auto, review, done or fact.`);
|
|
621
621
|
if(s!==void 0){if(!Bs.test(s))throw oe(`${c} needs a relative practice project file path without '..'.`);l.path=s}let u=i===
|
|
622
|
-
"send-message"?ev:Q_;if(l.text.length>u)throw oe(`${c} text is longer than ${u} characters.`);if(i==="send-message"){let
|
|
623
|
-
...l.text.matchAll(nv)].map(h=>h[1].trim());if(
|
|
624
|
-
ed prompt of at most ${rp} characters.`);l.prompt=
|
|
622
|
+
"send-message"?ev:Q_;if(l.text.length>u)throw oe(`${c} text is longer than ${u} characters.`);if(i==="send-message"){let f=[
|
|
623
|
+
...l.text.matchAll(nv)].map(h=>h[1].trim());if(f.length!==1||!f[0]||f[0].length>rp)throw oe(`${c} needs exactly one quot\
|
|
624
|
+
ed prompt of at most ${rp} characters.`);l.prompt=f[0]}return l}function Fn(e,t=Mt){let r=String(e??""),n=tv.exec(r);if(!n)
|
|
625
625
|
return{body:r,beats:null};let o=r.slice(n.index+n[0].length),i=/^```[ \t]*$/mu.exec(o);if(!i)throw oe("the beats block i\
|
|
626
626
|
s not closed with ```.");if(o.slice(i.index+i[0].length).trim())throw oe("the beats block must end the step text.");let s=o.
|
|
627
627
|
slice(0,i.index).split(`
|
|
@@ -635,8 +635,8 @@ Object.freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),tv=/^```bea
|
|
|
635
635
|
nv=/["“]([^"“”]+)["”]/gu;ov=(e,t)=>!!(t.activity(e)||t.place(e)?.event||ep(e,{},t)!==null||t.declared?.(e)),iv=(e,t)=>!!(t.
|
|
636
636
|
place(e)||t.declaredPlace?.(e))});import{createHash as cv}from"node:crypto";import{lstat as lv,readFile as uv,readdir as dv,realpath as op}from"node:fs/promises";
|
|
637
637
|
import ae from"node:path";function Ie(e,t,r){let n=new Set;for(let o of e){let i=t?o[t]:o;if(!Gn(i)||n.has(i))throw new Error(
|
|
638
|
-
`${r}: invalid or duplicate ID ${i}.`);n.add(i)}return n}function
|
|
639
|
-
e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${
|
|
638
|
+
`${r}: invalid or duplicate ID ${i}.`);n.add(i)}return n}function D(e){return Array.isArray(e)?`[${e.map(D).join(",")}]`:
|
|
639
|
+
e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${D(e[t])}`).join(",")}}`:JSON.stringify(e)}
|
|
640
640
|
function sp(e,t){let r=e.get(t.path);if(r&&(r.sha256!==t.sha256||r.bytes!==t.bytes))throw new Error(`Source changed betw\
|
|
641
641
|
een lesson snapshots: ${t.path}. Validate and retry.`);e.set(t.path,t)}function ct(e){let t=new Map;for(let r of e)for(let n of r.
|
|
642
642
|
files)sp(t,n);return[...t.values()]}async function pv(e){let t=await op(e);async function r(i,s=t){if(typeof i!="string"||
|
|
@@ -663,80 +663,80 @@ evidence?.check&&!["exercise","code"].includes(i.evidence.producer))throw new Er
|
|
|
663
663
|
`Lesson ${n}: ${a}`)};e.schemaVersion===3&&e.stage==="project"&&!e.exercise&&s("a project lesson needs its exercise (a p\
|
|
664
664
|
ractice project)."),e.steps.length||s("needs at least one step."),Ie(e.steps,"id","Steps"),e.steps.some(a=>a.required)||
|
|
665
665
|
s("needs a required step.");for(let a of e.steps){let c=`step ${a.id}`;if(a.visual){let p=t.get(a.visual.id);p||s(`${c} \
|
|
666
|
-
shows undeclared visual ${a.visual.id}.`);for(let
|
|
667
|
-
`${c} plays undeclared command ${
|
|
668
|
-
nd ${
|
|
669
|
-
`${c} command ${
|
|
670
|
-
name} parameter ${
|
|
671
|
-
hasOwn(S,
|
|
672
|
-
|
|
673
|
-
message}`)}if(l){a.guide&&s(`${c} has both beats and a guide; its beats replace the guide.`);let p=l.find(
|
|
674
|
-
heck");p&&Us[p.target]!==a.check.kind&&s(`${c} beat check ${p.target} does not match its ${a.check.kind} check.`);let
|
|
675
|
-
find(
|
|
676
|
-
let u=a.check,
|
|
677
|
-
self:[],none:[]}[u.kind],h=Object.keys(u).filter(p=>p!=="kind"&&!
|
|
666
|
+
shows undeclared visual ${a.visual.id}.`);for(let w of a.visual.play||[]){let E=p.commands.find(m=>m.name===w.name);E||s(
|
|
667
|
+
`${c} plays undeclared command ${w.name}.`);let S=w.parameters;(!S||typeof S!="object"||Array.isArray(S))&&s(`${c} comma\
|
|
668
|
+
nd ${w.name} needs a parameters object.`);for(let[m,g]of Object.entries(S)){let y=E.parameters.find(v=>v.name===m);y||s(
|
|
669
|
+
`${c} command ${w.name} has undeclared parameter ${m}.`),(typeof g!="string"||g.length>y.maxLength)&&s(`${c} command ${w.
|
|
670
|
+
name} parameter ${m} must be a string of at most ${y.maxLength} characters.`)}for(let m of E.parameters)m.required&&!Object.
|
|
671
|
+
hasOwn(S,m.name)&&s(`${c} command ${w.name} needs parameter ${m.name}.`)}}if(a.guide){let{caption:p,...w}=a.guide;try{Qd(
|
|
672
|
+
w,i)}catch(E){s(`${c} guide: ${E.message}`)}}let l=null;try{({beats:l}=Fn(o.get(a.body),i))}catch(p){s(`${c} beats: ${p.
|
|
673
|
+
message}`)}if(l){a.guide&&s(`${c} has both beats and a guide; its beats replace the guide.`);let p=l.find(E=>E.kind==="c\
|
|
674
|
+
heck");p&&Us[p.target]!==a.check.kind&&s(`${c} beat check ${p.target} does not match its ${a.check.kind} check.`);let w=l.
|
|
675
|
+
find(E=>np(E,i));w&&!e.exercise&&s(`${c} beat ${w.kind} ${w.target} needs the lesson's exercise (a practice project).`)}
|
|
676
|
+
let u=a.check,f={auto:["check","files"],choice:["question","options","answer"],review:["rubric","evidence"],fact:["fact"],
|
|
677
|
+
self:[],none:[]}[u.kind],h=Object.keys(u).filter(p=>p!=="kind"&&!f.includes(p));if(h.length&&s(`${c} ${u.kind} check can\
|
|
678
678
|
not declare ${h.join(", ")}.`),u.kind==="none"&&a.required&&s(`${c} has no check and cannot be required.`),u.kind==="fac\
|
|
679
679
|
t"&&(e.schemaVersion!==3&&s(`${c} fact check needs lesson format 3.`),(!u.fact||!i.hasFact(u.fact))&&s(`${c} checks an u\
|
|
680
680
|
nknown fact; declare a host's fact in the topic's facts.`)),u.kind==="auto"){(!u.check||!r.has(u.check))&&s(`${c} names \
|
|
681
|
-
an unknown check.`),e.exercise||s(`${c} runs a declared check and needs the lesson's exercise.`);let p=e.checks.find(
|
|
682
|
-
id===u.check),
|
|
681
|
+
an unknown check.`),e.exercise||s(`${c} runs a declared check and needs the lesson's exercise.`);let p=e.checks.find(E=>E.
|
|
682
|
+
id===u.check),w=u.files||[];(p.kind==="code"?w.length<1||w.length>8:w.length)&&s(`${c} ${p.kind==="code"?"code check nee\
|
|
683
683
|
ds 1-8 exercise files":"names files, but only a code check edits files"}.`)}if(u.kind==="review"){u.rubric?.trim()||s(`${c}\
|
|
684
684
|
review needs its rubric.`),e.exercise||s(`${c} reviews practice work and needs the lesson's exercise.`);let p=u.evidence||
|
|
685
685
|
["changes"];(p[0]!=="changes"||p.length>2||p.length===2&&p[1]!=="conversation")&&s(`${c} review evidence is ["changes"] \
|
|
686
|
-
or ["changes", "conversation"].`)}if(u.kind==="choice"){let{question:p,options:
|
|
687
|
-
e needs question, options and answer.`),(
|
|
688
|
-
|
|
686
|
+
or ["changes", "conversation"].`)}if(u.kind==="choice"){let{question:p,options:w,answer:E}=u;(!p||!w||!E)&&s(`${c} choic\
|
|
687
|
+
e needs question, options and answer.`),(w.length<2||w.length>8)&&s(`${c} choice needs 2-8 options.`),(!E.length||new Set(
|
|
688
|
+
E).size!==E.length||E.some(S=>S>=w.length))&&s(`${c} choice answer must list unique option indexes within its options.`)}}}
|
|
689
689
|
async function gv(e,t,{authoring:r,installed:n,vocabulary:o}){let i=await e.json(t.descriptor),s=Ln(i.value,t.code);if(s.
|
|
690
690
|
code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);if(r&&s.schemaVersion!==3)throw new Error(`Lesson ${t.
|
|
691
691
|
code} uses retired lesson format ${s.schemaVersion}. Author it in format 3 with steps and its stage.`);let a=ae.dirname(
|
|
692
|
-
i.filename),c=new Map;function l(
|
|
693
|
-
values()].reduce((
|
|
694
|
-
|
|
695
|
-
[]){l(await e.read(
|
|
696
|
-
document,a),l,h),Te(s))for(let
|
|
697
|
-
|
|
698
|
-
can declare app routes only with its exercise.`);let p=new Set;for(let
|
|
699
|
-
1).split("/").every(
|
|
700
|
-
path}.`);let
|
|
701
|
-
p.add(
|
|
702
|
-
ares a timeout: ${
|
|
703
|
-
needs a required assessment.`);Ie(s.visuals,"id","Visuals");let
|
|
704
|
-
a),
|
|
705
|
-
tates");if(!
|
|
706
|
-
e","Visual commands");for(let
|
|
707
|
-
nged"&&!
|
|
708
|
-
|
|
709
|
-
let
|
|
710
|
-
or ${t.code}.`)}else if(
|
|
711
|
-
!Gn(
|
|
712
|
-
for(let
|
|
713
|
-
let
|
|
714
|
-
read(
|
|
715
|
-
id}`,
|
|
716
|
-
split("/");if(
|
|
717
|
-
relative}/${
|
|
718
|
-
throw new Error(`${
|
|
719
|
-
message}let S={schemaVersion:1,code:s.code,files:[...c.values()].sort((
|
|
720
|
-
lesson:s,manifest:S,hash:zn(
|
|
692
|
+
i.filename),c=new Map;function l(m){if(sp(c,{path:m.relative,sha256:zn(m.bytes),bytes:m.bytes.length}),c.size>512||[...c.
|
|
693
|
+
values()].reduce((g,y)=>g+y.bytes,0)>32*1024*1024)throw new Error(`Lesson ${t.code} exceeds bundle limits.`)}l(i);let u=new Set,
|
|
694
|
+
f=new Map;Ie(s.prerequisites,"code","Lesson prerequisites");let h=Ie(s.checks||[],"id","Checks");for(let m of s.checks||
|
|
695
|
+
[]){l(await e.read(m.file,a));for(let g of m.assets||[])l(await e.read(g,a))}if(s.schemaVersion===1&&mv(s,await e.read(s.
|
|
696
|
+
document,a),l,h),Te(s))for(let m of[s.notes,...new Set(s.steps.map(g=>g.body))]){if(m===void 0)continue;let g=await e.read(
|
|
697
|
+
m,a);l(g),u.add(g.relative),f.set(m,g.bytes.toString("utf8"))}if(s.appRoutes&&!s.exercise)throw new Error(`Lesson ${t.code}\
|
|
698
|
+
can declare app routes only with its exercise.`);let p=new Set;for(let m of s.appRoutes||[]){if(m.path!=="/"&&!m.path.slice(
|
|
699
|
+
1).split("/").every(y=>y===":id"||/^[A-Za-z0-9._~-]+$/u.test(y)))throw new Error(`Invalid app route path for ${t.code}: ${m.
|
|
700
|
+
path}.`);let g=`${m.method} ${m.path}`;if(p.has(g))throw new Error(`Lesson ${t.code} has a duplicate app route: ${g}.`);
|
|
701
|
+
p.add(g)}for(let m of s.checks||[])if(m.timeoutSeconds!==void 0&&m.kind!=="code")throw new Error(`Only a code check decl\
|
|
702
|
+
ares a timeout: ${m.id}.`);if(s.schemaVersion===1&&!s.assessments.some(m=>m.required))throw new Error(`Lesson ${t.code} \
|
|
703
|
+
needs a required assessment.`);Ie(s.visuals,"id","Visuals");let w=new Map;for(let m of s.visuals){let g=await e.json(m.descriptor,
|
|
704
|
+
a),y=pe(Wd,g.value,m.id);if(y.id!==m.id)throw new Error(`Visual ID mismatch: ${m.id}.`);let v=Ie(y.states,null,"Visual s\
|
|
705
|
+
tates");if(!v.has(y.initialState))throw new Error(`Unknown initial visual state: ${y.initialState}.`);Ie(y.commands,"nam\
|
|
706
|
+
e","Visual commands");for(let b of y.commands)if(Ie(b.parameters,"name","Command parameters"),b.completionState!=="uncha\
|
|
707
|
+
nged"&&!v.has(b.completionState))throw new Error(`Unknown completion state: ${b.name}.`);l(g),w.set(y.id,y);let T=ae.dirname(
|
|
708
|
+
g.filename);for(let b of[y.svg,y.controller,...y.assets||[]]){let _=await e.read(b,T);l(_),u.add(_.relative)}}if(s.exercise){
|
|
709
|
+
let m=s.exercise;if(m.reuse==="sequence"){if(!m.sequenceId||!m.sequenceMode)throw new Error(`Invalid exercise sequence f\
|
|
710
|
+
or ${t.code}.`)}else if(m.sequenceId||m.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}.`);if(m.sequenceId&&
|
|
711
|
+
!Gn(m.sequenceId))throw new Error("Invalid exercise sequence ID.");let g=await e.resolve(m.source,a);async function y(T){
|
|
712
|
+
for(let b of(await dv(T,{withFileTypes:!0})).sort((_,A)=>_.name<A.name?-1:_.name>A.name?1:0)){if(ip.has(b.name))continue;
|
|
713
|
+
let _=ae.relative(e.root,ae.join(T,b.name)),A=await e.resolve(_);if(b.isDirectory())await y(A.filename);else{let I=await e.
|
|
714
|
+
read(_);l(I),u.add(I.relative)}}}await y(g.filename);let v=s.schemaVersion===1?s.assessments.map(T=>[`Code assessment ${T.
|
|
715
|
+
id}`,T.evidence?.files||[]]):s.steps.map(T=>[`Code step ${T.id}`,T.check.files||[]]);for(let[T,b]of v){for(let _ of b){let A=_.
|
|
716
|
+
split("/");if(_.includes("\\")||ae.posix.isAbsolute(_)||A.some(I=>!I||I==="."||I===".."||ip.has(I))||!c.has(g.relative?`${g.
|
|
717
|
+
relative}/${_}`:_))throw new Error(`${T} names a file outside its bundled exercise: ${_}.`)}if(new Set(b).size!==b.length)
|
|
718
|
+
throw new Error(`${T} repeats a declared file.`)}}let E="";if(Te(s))try{hv(s,w,h,t.code,f,o)}catch(m){if(!n)throw m;E=m.
|
|
719
|
+
message}let S={schemaVersion:1,code:s.code,files:[...c.values()].sort((m,g)=>m.path<g.path?-1:m.path>g.path?1:0)};return{
|
|
720
|
+
lesson:s,manifest:S,hash:zn(D(S)),descriptorPath:i.relative,served:u,...E?{problem:E}:{}}}async function lt(e,{authoring:t=!1,
|
|
721
721
|
installed:r=!1}={}){let n=await pv(e),o=await n.json("package.json");if(!/^learn-[a-z0-9-]+$/u.test(o.value.name||"")||!/^\d+\.\d+\.\d+$/u.
|
|
722
722
|
test(o.value.version||""))throw new Error("Topic package needs a learn- name and an exact release version.");let i=pe(Dn,
|
|
723
723
|
o.value.vibe64Training,"Topic");if(!Gn(i.topicId)||!Gn(i.domainId))throw new Error("Invalid topic or domain ID.");let s=await n.
|
|
724
724
|
read(i.outline);if(Ie(i.lessons,"code","Lessons"),Ie(i.prerequisites,"topicId","Topic prerequisites"),!i.lessons.length)
|
|
725
725
|
throw new Error("A topic needs lessons.");if(i.status==="released"&&i.lessons.some(p=>p.required&&p.status!=="published"))
|
|
726
726
|
throw new Error("A released topic contains required draft lessons.");let a=Un(i),c=[],l=new Set;for(let p of i.lessons){
|
|
727
|
-
let{served:
|
|
728
|
-
required:p.required})}for(let{descriptorPath:p,lesson:
|
|
729
|
-
ptor cannot also be a step body, notes, visual or exercise file.`);fv(c.map(p=>p.lesson));for(let[p,
|
|
730
|
-
code:
|
|
731
|
-
t precede ${
|
|
732
|
-
lesson.code} requires draft ${
|
|
733
|
-
"sequence")continue;let S=(await n.resolve(p.exercise.source,ae.dirname(ae.join(n.root,
|
|
734
|
-
sequenceId);if(p.exercise.sequenceMode==="create"){if(
|
|
735
|
-
u.set(p.exercise.sequenceId,{source:S,status:
|
|
736
|
-
`Invalid create/continue sequence: ${p.code}.`)}let
|
|
737
|
-
h={schemaVersion:1,topic:i,release:o.value.version,files:
|
|
738
|
-
code,hash:
|
|
739
|
-
topicHash:zn(
|
|
727
|
+
let{served:w,...E}=await gv(n,p,{authoring:t,installed:r,vocabulary:a});for(let S of w)l.add(S);c.push({...E,status:p.status,
|
|
728
|
+
required:p.required})}for(let{descriptorPath:p,lesson:w}of c)if(Te(w)&&l.has(p))throw new Error(`Lesson ${w.code} descri\
|
|
729
|
+
ptor cannot also be a step body, notes, visual or exercise file.`);fv(c.map(p=>p.lesson));for(let[p,w]of c.entries())for(let{
|
|
730
|
+
code:E}of w.lesson.prerequisites){let S=c.findIndex(m=>m.lesson.code===E);if(S>=p)throw new Error(`Prerequisite ${E} mus\
|
|
731
|
+
t precede ${w.lesson.code}.`);if(w.status==="published"&&c[S].status!=="published")throw new Error(`Published lesson ${w.
|
|
732
|
+
lesson.code} requires draft ${E}.`)}let u=new Map;for(let{lesson:p,descriptorPath:w,status:E}of c){if(p.exercise?.reuse!==
|
|
733
|
+
"sequence")continue;let S=(await n.resolve(p.exercise.source,ae.dirname(ae.join(n.root,w)))).relative,m=u.get(p.exercise.
|
|
734
|
+
sequenceId);if(p.exercise.sequenceMode==="create"){if(m)throw new Error(`Invalid create/continue sequence: ${p.code}.`);
|
|
735
|
+
u.set(p.exercise.sequenceId,{source:S,status:E})}else if(!m||m.source!==S||E==="published"&&m.status!=="published")throw new Error(
|
|
736
|
+
`Invalid create/continue sequence: ${p.code}.`)}let f=[o,s].map(p=>({path:p.relative,sha256:zn(p.bytes),bytes:p.bytes.length})),
|
|
737
|
+
h={schemaVersion:1,topic:i,release:o.value.version,files:f,lessons:c.map(({lesson:p,hash:w,status:E,required:S})=>({code:p.
|
|
738
|
+
code,hash:w,status:E,required:S}))};return ct([h,...c.map(p=>p.manifest)]),{topic:i,release:o.value.version,bundles:c,topicManifest:h,
|
|
739
|
+
topicHash:zn(D(h))}}var ip,zn,Gn,jt=d(()=>{$t();Vn();Vs();ip=new Set([".git","node_modules",".genesis"]),zn=e=>cv("sha25\
|
|
740
740
|
6").update(e).digest("hex"),Gn=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{execFile as wv}from"node:child_process";import{readFile as yv}from"node:fs/promises";import Fs from"node:os";import bv from"node:path";
|
|
741
741
|
import{promisify as Ev}from"node:util";function Hn(e=""){return String(e||"").trim()}function cp(e=""){let t=Hn(e);if(!t||
|
|
742
742
|
t.includes("/")||t.includes("\\")||t.includes(":")){let r=new Error("A valid OS username is required.");throw r.code="vi\
|
|
@@ -752,16 +752,16 @@ displayName:String(r?.username||n),gid:Number.isSafeInteger(r?.gid)?r.gid:null,h
|
|
|
752
752
|
isSafeInteger(r?.uid)?r.uid:null,username:n}}async function qn(e="",{execFileFn:t=Sv,platform:r=process.platform,readFileFn:n=yv,
|
|
753
753
|
userInfo:o=Fs.userInfo}={}){let i=cp(e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").
|
|
754
754
|
catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],l=c.length===1?c[0][1].trim().split(/\s+/u):[];if(l[0]===
|
|
755
|
-
"files"&&(l.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(l[1]))){let
|
|
756
|
-
map(zs).find(h=>h?.username===i);if(
|
|
755
|
+
"files"&&(l.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(l[1]))){let f=(await n("/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).
|
|
756
|
+
map(zs).find(h=>h?.username===i);if(f)return f}}let s;if(r==="darwin"){let a=Rr({userInfo:o});if(a.username===i)return a;
|
|
757
757
|
[s]=_v(await ap(t,"dscacheutil",["-q","user","-a","name",i]))}else s=zs((await ap(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);
|
|
758
758
|
if(!s||s.username!==i){let a=new Error(`OS user was not found: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}
|
|
759
|
-
var Sv,Wn=d(()=>{Sv=Ev(wv)});var up=d(()=>{Wn()});import vv from"node:path";function
|
|
760
|
-
isSafeInteger(t)&&t>=0?t:null}function C(e=""){let t=
|
|
761
|
-
"object"&&!Array.isArray(e)?e:{}}function ee(e={}){return Object.fromEntries(Object.entries(ie(e)).map(([t,r])=>[
|
|
762
|
-
r??"")]).filter(([t])=>!!t))}function ut(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:[e]){let o=
|
|
763
|
-
has(o)||(r.add(o),t.push(o))}return t}function je(...e){for(let t of e){let r=
|
|
764
|
-
return{displayName:
|
|
759
|
+
var Sv,Wn=d(()=>{Sv=Ev(wv)});var up=d(()=>{Wn()});import vv from"node:path";function k(e=""){return String(e??"").trim()}function Gs(e=null){let t=Number(e);return Number.
|
|
760
|
+
isSafeInteger(t)&&t>=0?t:null}function C(e=""){let t=k(e);return t?vv.resolve(t):""}function ie(e={}){return e&&typeof e==
|
|
761
|
+
"object"&&!Array.isArray(e)?e:{}}function ee(e={}){return Object.fromEntries(Object.entries(ie(e)).map(([t,r])=>[k(t),String(
|
|
762
|
+
r??"")]).filter(([t])=>!!t))}function ut(e=[]){let t=[],r=new Set;for(let n of Array.isArray(e)?e:[e]){let o=k(n);!o||r.
|
|
763
|
+
has(o)||(r.add(o),t.push(o))}return t}function je(...e){for(let t of e){let r=k(t);if(r)return r}return""}var G=d(()=>{});import Tv from"node:os";import Hs from"node:path";function Yn(e={}){let t=k(e.username),r=C(e.home||(t?`/home/${t}`:Tv.homedir()));
|
|
764
|
+
return{displayName:k(e.displayName||t),gid:Gs(e.gid),home:r,shell:k(e.shell),uid:Gs(e.uid),username:t}}function qs(){return Yn(
|
|
765
765
|
Rr())}async function Ws(e="",t={}){return Yn(await qn(e,t))}function Ys(e={},t={}){let r=Yn(e);return{...t,HOME:r.home,LOGNAME:r.
|
|
766
766
|
username,USER:r.username,XDG_CACHE_HOME:Hs.join(r.home,".cache"),XDG_CONFIG_HOME:Hs.join(r.home,".config"),XDG_DATA_HOME:Hs.
|
|
767
767
|
join(r.home,".local","share")}}function Ks(e={},t={}){return Ys(e,t)}function Js(){return{gid:typeof process.getgid=="fu\
|
|
@@ -783,7 +783,7 @@ e)&&Array.isArray(e.raw),bp=(e,t)=>{let r=[];for(let[i,s]of e.entries())r=$v({te
|
|
|
783
783
|
template:s});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...o]=r;return[n,o,{}]},$v=({
|
|
784
784
|
templates:e,expressions:t,tokens:r,index:n,template:o})=>{if(o===void 0)throw new TypeError(`Invalid backslash sequence:\
|
|
785
785
|
${e.raw[n]}`);let{nextTokens:i,leadingWhitespaces:s,trailingWhitespaces:a}=Mv(o,e.raw[n]),c=gp(r,i,s);if(n===t.length)return c;
|
|
786
|
-
let l=t[n],u=Array.isArray(l)?l.map(
|
|
786
|
+
let l=t[n],u=Array.isArray(l)?l.map(f=>wp(f)):[wp(l)];return gp(c,u,a)},Mv=(e,t)=>{if(t.length===0)return{nextTokens:[],
|
|
787
787
|
leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,o=hp.has(t[0]);for(let s=0,a=0;s<e.length;s+=1,a+=1){let c=t[a];
|
|
788
788
|
if(hp.has(c))n!==s&&r.push(e.slice(n,s)),n=s+1;else if(c==="\\"){let l=t[a+1];l===`
|
|
789
789
|
`?(s-=1,a+=1):l==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=jv[l]??1}}let i=n===e.length;return i||r.push(e.slice(n)),{nextTokens:r,
|
|
@@ -906,7 +906,7 @@ e.substr(-o.length).toLowerCase()===o)return!0}return!1}function Wp(e,t,r){retur
|
|
|
906
906
|
t,r)}function Yp(e,t,r){qp.stat(e,function(n,o){r(n,n?!1:Wp(o,e,t))})}function AT(e,t){return Wp(qp.statSync(e),e,t)}});var tf=se((XL,ef)=>{ef.exports=Zp;Zp.sync=OT;var Xp=Ge("fs");function Zp(e,t,r){Xp.stat(e,function(n,o){r(n,n?!1:Qp(o,t))})}
|
|
907
907
|
function OT(e,t){return Qp(Xp.statSync(e),t)}function Qp(e,t){return e.isFile()&&PT(e,t)}function PT(e,t){var r=e.mode,n=e.
|
|
908
908
|
uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),
|
|
909
|
-
a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,
|
|
909
|
+
a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,f=r&l||r&c&&o===s||r&a&&n===i||r&u&&i===0;return f}});var nf=se((QL,rf)=>{var ZL=Ge("fs"),lo;process.platform==="win32"||global.TESTING_WINDOWS?lo=Jp():lo=tf();rf.exports=ua;
|
|
910
910
|
ua.sync=xT;function ua(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError(
|
|
911
911
|
"callback not provided");return new Promise(function(n,o){ua(e,t||{},function(i,s){i?o(i):n(s)})})}lo(e,t||{},function(n,o){
|
|
912
912
|
n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function xT(e,t){try{return lo.sync(e,t||{})}catch(r){
|
|
@@ -915,12 +915,12 @@ RT=zt?";":":",sf=nf(),af=e=>Object.assign(new Error(`not found: ${e}`),{code:"EN
|
|
|
915
915
|
match(/\//)||zt&&e.match(/\\/)?[""]:[...zt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=zt?t.pathExt||
|
|
916
916
|
process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=zt?o.split(r):[""];return zt&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(
|
|
917
917
|
""),{pathEnv:n,pathExt:i,pathExtExe:o}},lf=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,
|
|
918
|
-
pathExtExe:i}=cf(e,t),s=[],a=l=>new Promise((u,
|
|
919
|
-
test(h)?h.slice(1,-1):h,
|
|
920
|
-
if(
|
|
921
|
-
return h(c(l,u,
|
|
918
|
+
pathExtExe:i}=cf(e,t),s=[],a=l=>new Promise((u,f)=>{if(l===n.length)return t.all&&s.length?u(s):f(af(e));let h=n[l],p=/^".*"$/.
|
|
919
|
+
test(h)?h.slice(1,-1):h,w=of.join(p,e),E=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+w:w;u(c(E,l,0))}),c=(l,u,f)=>new Promise((h,p)=>{
|
|
920
|
+
if(f===o.length)return h(a(u+1));let w=o[f];sf(l+w,{pathExt:i},(E,S)=>{if(!E&&S)if(t.all)s.push(l+w);else return h(l+w);
|
|
921
|
+
return h(c(l,u,f+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},CT=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=cf(
|
|
922
922
|
e,t),i=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=of.join(c,e),u=!c&&/^\.[\\\/]/.test(
|
|
923
|
-
e)?e.slice(0,2)+l:l;for(let
|
|
923
|
+
e)?e.slice(0,2)+l:l;for(let f=0;f<n.length;f++){let h=u+n[f];try{if(sf.sync(h,{pathExt:o}))if(t.all)i.push(h);else return h}catch{}}}
|
|
924
924
|
if(t.all&&i.length)return i;if(t.nothrow)return null;throw af(e)};uf.exports=lf;lf.sync=CT});var ff=se((tD,da)=>{"use strict";var pf=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?
|
|
925
925
|
"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};da.exports=pf;da.exports.default=pf});var wf=se((rD,gf)=>{"use strict";var mf=Ge("path"),NT=df(),kT=ff();function hf(e,t){let r=e.options.env||process.env,n=process.
|
|
926
926
|
cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}
|
|
@@ -1128,12 +1128,12 @@ ${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
|
|
|
1128
1128
|
${e}`}});import aA from"node:path";import Qm from"node:process";var eh,jo,cA,lA,La=d(()=>{eh=qE($f(),1);Vf();go();jr();va();Ca();
|
|
1129
1129
|
Na();ka();$a();mt();ja();Bt();Ve();jo=(e,t,r)=>{r.cwd=Jm(r.cwd);let[n,o,i]=Hm(e,t,r),{command:s,args:a,options:c}=eh.default.
|
|
1130
1130
|
_parse(n,o,i),l=_p(c),u=cA(l);return Vm(u),Km(u),qm(u),am(u),Bm(u),u.shell=Zs(u.shell),u.env=lA(u),u.killSignal=rm(u.killSignal),
|
|
1131
|
-
u.forceKillAfterDelay=im(u.forceKillAfterDelay),u.lines=u.lines.map((
|
|
1131
|
+
u.forceKillAfterDelay=im(u.forceKillAfterDelay),u.lines=u.lines.map((f,h)=>f&&!le.has(u.encoding)&&u.buffer[h]),Qm.platform===
|
|
1132
1132
|
"win32"&&aA.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},cA=({extendEnv:e=!0,preferLocal:t=!1,
|
|
1133
1133
|
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,
|
|
1134
|
-
gracefulCancel:
|
|
1135
|
-
localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:
|
|
1136
|
-
ipc:p,serialization:
|
|
1134
|
+
gracefulCancel:f=!1,ipcInput:h,ipc:p=h!==void 0||f,serialization:w="advanced",...E})=>({...E,extendEnv:e,preferLocal:t,cwd:r,
|
|
1135
|
+
localDirectory:n,encoding:o,reject:i,cleanup:s,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:f,ipcInput:h,
|
|
1136
|
+
ipc:p,serialization:w}),lA=({env:e,extendEnv:t,preferLocal:r,node:n,localDirectory:o,nodePath:i})=>{let s=t?{...Qm.env,...e}:
|
|
1137
1137
|
e;return r||n?Uf({env:s,cwd:o,execPath:i,preferLocal:r,addExecPath:n}):s}});var Lo,Da=d(()=>{Lo=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r]});function Jt(e){if(typeof e=="string")return uA(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("\
|
|
1138
1138
|
Input must be a string or a Uint8Array");return dA(e)}var uA,dA,th,pA,rh,fA,Ba=d(()=>{uA=e=>e.at(-1)===th?e.slice(0,e.at(
|
|
1139
1139
|
-2)===rh?-2:-1):e,dA=e=>e.at(-1)===pA?e.subarray(0,e.at(-2)===fA?-2:-1):e,th=`
|
|
@@ -1157,10 +1157,10 @@ asyncIterator]=="function")return e;if(gA.call(e)==="[object ReadableStream]")re
|
|
|
1157
1157
|
let t=new AbortController,r={};yA(e,t,r);try{for await(let[n]of Vr.on(e,"data",{signal:t.signal}))yield n}catch(n){if(r.
|
|
1158
1158
|
error!==void 0)throw r.error;if(!t.signal.aborted)throw n}finally{e.destroy()}},yA=async(e,t,r)=>{try{await Vr.finished(
|
|
1159
1159
|
e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{t.abort()}},Vr={}});var Xt,bA,dh,lh,EA,uh,xe,Fr=d(()=>{Ha();Xt=async(e,{init:t,convertChunk:r,getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,
|
|
1160
|
-
finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=ch(e),u=t();u.length=0;try{for await(let
|
|
1161
|
-
|
|
1162
|
-
getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(u)}catch(
|
|
1163
|
-
|
|
1160
|
+
finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=ch(e),u=t();u.length=0;try{for await(let f of l){let h=EA(
|
|
1161
|
+
f),p=r[h](f,u);dh({convertedChunk:p,state:u,getSize:n,truncateChunk:o,addChunk:i,maxBuffer:c})}return bA({state:u,convertChunk:r,
|
|
1162
|
+
getSize:n,truncateChunk:o,addChunk:i,getFinalChunk:s,maxBuffer:c}),a(u)}catch(f){let h=typeof f=="object"&&f!==null?f:new Error(
|
|
1163
|
+
f);throw h.bufferedData=a(u),h}},bA=({state:e,getSize:t,truncateChunk:r,addChunk:n,getFinalChunk:o,maxBuffer:i})=>{let s=o(
|
|
1164
1164
|
e);s!==void 0&&dh({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:n,maxBuffer:i})},dh=({convertedChunk:e,state:t,
|
|
1165
1165
|
getSize:r,truncateChunk:n,addChunk:o,maxBuffer:i})=>{let s=r(e),a=t.length+s;if(a<=i){lh(e,t,o,a);return}let c=n(e,i-t.length);
|
|
1166
1166
|
throw c!==void 0&&lh(c,t,o,i),new xe},lh=(e,t,r,n)=>{t.contents=r(e,t,n),t.length=n},EA=e=>{let t=typeof e;if(t==="strin\
|
|
@@ -1190,19 +1190,19 @@ s"};let{maxBufferInfo:{fdNumber:r,unit:n}}=e;delete e.maxBufferInfo;let o=Ue(t,r
|
|
|
1190
1190
|
ut",threshold:o,unit:"messages"}:{streamName:Zn(r),threshold:o,unit:n}},Th=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(
|
|
1191
1191
|
n=>n!==null&&n.length>Wo(r)),Ih=(e,t,r)=>{if(!t)return e;let n=Wo(r);return e.length>n?e.slice(0,n):e},Wo=([,e])=>e});import{inspect as zA}from"node:util";var Oh,GA,HA,qA,WA,YA,Ah,Ph=d(()=>{Ba();ce();ja();to();wt();jr();pt();Oh=({stdio:e,
|
|
1192
1192
|
all:t,ipcOutput:r,originalError:n,signal:o,signalDescription:i,exitCode:s,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,
|
|
1193
|
-
isMaxBuffer:
|
|
1194
|
-
|
|
1195
|
-
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:h,forceKillAfterDelay:p,killSignal:
|
|
1193
|
+
isMaxBuffer:f,isForcefullyTerminated:h,forceKillAfterDelay:p,killSignal:w,maxBuffer:E,timeout:S,cwd:m})=>{let g=n?.code,
|
|
1194
|
+
y=GA({originalError:n,timedOut:c,timeout:S,isMaxBuffer:f,maxBuffer:E,errorCode:g,signal:o,signalDescription:i,exitCode:s,
|
|
1195
|
+
isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:h,forceKillAfterDelay:p,killSignal:w}),v=qA(n,m),T=v===void 0?
|
|
1196
1196
|
"":`
|
|
1197
|
-
${
|
|
1197
|
+
${v}`,b=`${y}: ${a}${T}`,_=t===void 0?[e[2],e[1]]:[t],A=[b,..._,...e.slice(3),r.map(I=>WA(I)).join(`
|
|
1198
1198
|
`)].map(I=>Nr(Jt(YA(I)))).filter(Boolean).join(`
|
|
1199
1199
|
|
|
1200
|
-
`);return{originalMessage:
|
|
1201
|
-
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:
|
|
1202
|
-
killSignal:p})=>{let
|
|
1203
|
-
ully canceled with exit code ${c}`:
|
|
1204
|
-
)`:l?`Command was canceled${
|
|
1205
|
-
(${ho(p)})${
|
|
1200
|
+
`);return{originalMessage:v,shortMessage:b,message:A}},GA=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:n,maxBuffer:o,
|
|
1201
|
+
errorCode:i,signal:s,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:h,
|
|
1202
|
+
killSignal:p})=>{let w=HA(f,h);return t?`Command timed out after ${r} milliseconds${w}`:u?s===void 0?`Command was gracef\
|
|
1203
|
+
ully canceled with exit code ${c}`:f?`Command was gracefully canceled${w}`:`Command was gracefully canceled with ${s} (${a}\
|
|
1204
|
+
)`:l?`Command was canceled${w}`:n?`${vh(e,o)}${w}`:i!==void 0?`Command failed with ${i}${w}`:f?`Command was killed with ${p}\
|
|
1205
|
+
(${ho(p)})${w}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Comma\
|
|
1206
1206
|
nd failed"},HA=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",qA=(e,t)=>{if(e instanceof be)return;
|
|
1207
1207
|
let r=Gf(e)?e.originalMessage:String(e?.message??e),n=Nr(Zm(r,t));return n===""?void 0:n},WA=e=>typeof e=="string"?e:zA(
|
|
1208
1208
|
e),YA=e=>Array.isArray(e)?e.map(t=>Jt(Ah(t))).filter(Boolean).join(`
|
|
@@ -1212,17 +1212,17 @@ isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],
|
|
|
1212
1212
|
Zt=({error:e,command:t,escapedCommand:r,fileDescriptors:n,options:o,startTime:i,isSync:s})=>Gr({error:e,command:t,escapedCommand:r,
|
|
1213
1213
|
startTime:i,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from(
|
|
1214
1214
|
{length:n.length}),ipcOutput:[],options:o,isSync:s}),Gr=({error:e,command:t,escapedCommand:r,startTime:n,timedOut:o,isCanceled:i,
|
|
1215
|
-
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:
|
|
1216
|
-
timeout:
|
|
1217
|
-
l,u),{originalMessage:A,shortMessage:I,message:
|
|
1218
|
-
exitCode:
|
|
1219
|
-
killSignal:
|
|
1220
|
-
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:
|
|
1221
|
-
stdio:
|
|
1222
|
-
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:
|
|
1223
|
-
stdio:h,all:p,ipcOutput:
|
|
1224
|
-
cwd:
|
|
1225
|
-
exitCode:l,signal:u,signalDescription:
|
|
1215
|
+
isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:f,all:h,ipcOutput:p,options:{timeoutDuration:w,
|
|
1216
|
+
timeout:E=w,forceKillAfterDelay:S,killSignal:m,cwd:g,maxBuffer:y},isSync:v})=>{let{exitCode:T,signal:b,signalDescription:_}=JA(
|
|
1217
|
+
l,u),{originalMessage:A,shortMessage:I,message:P}=Oh({stdio:f,all:h,ipcOutput:p,originalError:e,signal:b,signalDescription:_,
|
|
1218
|
+
exitCode:T,escapedCommand:r,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:S,
|
|
1219
|
+
killSignal:m,maxBuffer:y,timeout:E,cwd:g}),L=Ff(e,P,v);return Object.assign(L,KA({error:L,command:t,escapedCommand:r,startTime:n,
|
|
1220
|
+
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:T,signal:b,signalDescription:_,
|
|
1221
|
+
stdio:f,all:h,ipcOutput:p,cwd:g,originalMessage:A,shortMessage:I})),L},KA=({error:e,command:t,escapedCommand:r,startTime:n,
|
|
1222
|
+
timedOut:o,isCanceled:i,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:f,
|
|
1223
|
+
stdio:h,all:p,ipcOutput:w,cwd:E,originalMessage:S,shortMessage:m})=>xh({shortMessage:m,originalMessage:S,command:t,escapedCommand:r,
|
|
1224
|
+
cwd:E,durationMs:ca(n),failed:!0,timedOut:o,isCanceled:i,isGracefullyCanceled:s,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,
|
|
1225
|
+
exitCode:l,signal:u,signalDescription:f,code:e.cause?.code,stdout:h[1],stderr:h[2],all:p,stdio:h,ipcOutput:w,pipedFrom:[]}),
|
|
1226
1226
|
xh=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),JA=(e,t)=>{let r=e===null?void 0:e,n=t===null?void 0:
|
|
1227
1227
|
t,o=n===void 0?void 0:ho(t);return{exitCode:r,signal:n,signalDescription:o}}});function XA(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(
|
|
1228
1228
|
e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Rh(e*1e3)%1e3),nanoseconds:Math.trunc(Rh(e*1e6)%1e3)}}function ZA(e){
|
|
@@ -1230,18 +1230,18 @@ return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000
|
|
|
1230
1230
|
nanoseconds:0n}}function qa(e){switch(typeof e){case"number":{if(Number.isFinite(e))return XA(e);break}case"bigint":return ZA(
|
|
1231
1231
|
e)}throw new TypeError("Expected a finite number or bigint")}var Rh,Ch=d(()=>{Rh=e=>Number.isFinite(e)?e:0});function Wa(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bi\
|
|
1232
1232
|
gint");t={...t};let n=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=
|
|
1233
|
-
!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,
|
|
1234
|
-
floor(u*10**
|
|
1235
|
-
colonNotation&&h==="m"))){if(p??=String(u),t.colonNotation){let
|
|
1236
|
-
0?2:1;p="0".repeat(Math.max(0,
|
|
1233
|
+
!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let o=[],i=(u,f)=>{let h=Math.
|
|
1234
|
+
floor(u*10**f+tO);return(Math.round(h)/10**f).toFixed(f)},s=(u,f,h,p)=>{if(!((o.length===0||!t.colonNotation)&&QA(u)&&!(t.
|
|
1235
|
+
colonNotation&&h==="m"))){if(p??=String(u),t.colonNotation){let w=p.includes(".")?p.split(".")[0].length:p.length,E=o.length>
|
|
1236
|
+
0?2:1;p="0".repeat(Math.max(0,E-w))+p}else p+=t.verbose?" "+eO(f,u):h;o.push(p)}},a=qa(e),c=BigInt(a.days);if(t.hideYearAndDays?
|
|
1237
1237
|
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(
|
|
1238
1238
|
a.hours),"hour","h")),s(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||
|
|
1239
|
-
!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),
|
|
1240
|
-
p=Number(a.nanoseconds);if(s(u,"second","s"),t.formatSubMilliseconds)s(
|
|
1241
|
-
s(p,"nanosecond","ns");else{let
|
|
1242
|
-
0,S=
|
|
1243
|
-
isecond","ms",
|
|
1244
|
-
1,h=i(u,
|
|
1239
|
+
!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let u=Number(a.seconds),f=Number(a.milliseconds),h=Number(a.microseconds),
|
|
1240
|
+
p=Number(a.nanoseconds);if(s(u,"second","s"),t.formatSubMilliseconds)s(f,"millisecond","ms"),s(h,"microsecond","\xB5s"),
|
|
1241
|
+
s(p,"nanosecond","ns");else{let w=f+h/1e3+p/1e6,E=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:
|
|
1242
|
+
0,S=w>=1?Math.round(w):Math.ceil(w),m=1e3-10**-E,g=E?Math.min(w,m).toFixed(E):Math.min(S,m);s(Number.parseFloat(g),"mill\
|
|
1243
|
+
isecond","ms",g)}}else{let u=(r?Number(e%rO):e)/1e3%60,f=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:
|
|
1244
|
+
1,h=i(u,f),p=t.keepDecimalsOnWholeSeconds?h:h.replace(/\.0+$/,"");s(Number.parseFloat(p),"second","s",p)}if(o.length===0)
|
|
1245
1245
|
return n+"0"+(t.verbose?" milliseconds":"ms");let l=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(o=o.slice(
|
|
1246
1246
|
0,Math.max(t.unitCount,1))),n+o.join(l)}var QA,eO,tO,rO,Nh=d(()=>{Ch();QA=e=>e===0||e===0n,eO=(e,t)=>t===1||t===1n?e:`${e}\
|
|
1247
1247
|
s`,tO=1e-7,rO=24n*60n*60n*1000n});var kh,$h=d(()=>{Ft();kh=(e,t)=>{e.failed&&Ae({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})}});var Mh,nO,jh=d(()=>{Nh();Ke();Ft();$h();Mh=(e,t)=>{Ut(t)&&(kh(e,t),nO(e,t))},nO=(e,t)=>{let r=`(done in ${Wa(e.durationMs)}\
|
|
@@ -1284,8 +1284,8 @@ jectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:
|
|
|
1284
1284
|
stdioItem:{value:t},index:r,newTransforms:n,direction:o})=>{let{transform:i,objectMode:s}=H(t)?t:{transform:t},{writableObjectMode:a,
|
|
1285
1285
|
readableObjectMode:c}=Za(s,r,n,o);return{...e,value:{transform:i,writableObjectMode:a,readableObjectMode:c}}},EO=({stdioItem:e,
|
|
1286
1286
|
stdioItem:{value:t},index:r,newTransforms:n,direction:o,encoding:i})=>{let{transform:s,final:a,binary:c=!1,preserveNewlines:l=!1,
|
|
1287
|
-
objectMode:u}=H(t)?t:{transform:t},
|
|
1288
|
-
transform:s,final:a,binary:
|
|
1287
|
+
objectMode:u}=H(t)?t:{transform:t},f=c||le.has(i),{writableObjectMode:h,readableObjectMode:p}=Za(u,r,n,o);return{...e,value:{
|
|
1288
|
+
transform:s,final:a,binary:f,preserveNewlines:l,writableObjectMode:h,readableObjectMode:p}}},SO=(e,t)=>t==="input"?e.reverse():
|
|
1289
1289
|
e});import ec from"node:process";var Zh,_O,vO,er,tc,Qh,TO,IO,eg=d(()=>{gt();te();Zh=(e,t,r)=>{let n=e.map(o=>_O(o,t));if(n.includes(
|
|
1290
1290
|
"input")&&n.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writabl\
|
|
1291
1291
|
e values.`);return n.find(Boolean)??IO},_O=({type:e,value:t},r)=>vO[r]??Qh[e](t),vO=["input","output","output"],er=()=>{},
|
|
@@ -1327,7 +1327,7 @@ transform:i}})=>i===r.transform);mg(o,n,t)},mg=(e,t,r)=>{if(e!==void 0)throw new
|
|
|
1327
1327
|
\` options must not target ${Qe[r]} that is the same.`)}});var Qo,GO,HO,qO,WO,YO,KO,JO,XO,ZO,QO,eP,rc,tP,ei=d(()=>{Be();Xh();Qa();te();eg();ig();cg();ug();hg();Qo=(e,t,r,n)=>{let i=ng(
|
|
1328
1328
|
t,r,n).map((a,c)=>GO({stdioOption:a,fdNumber:c,options:t,isSync:n})),s=ZO({initialFileDescriptors:i,addProperties:e,options:t,
|
|
1329
1329
|
isSync:n});return t.stdio=s.map(({stdioItems:a})=>tP(a)),s},GO=({stdioOption:e,fdNumber:t,options:r,isSync:n})=>{let o=Zn(
|
|
1330
|
-
t),{stdioItems:i,isStdioArray:s}=HO({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Zh(i,t,o),c=i.map(
|
|
1330
|
+
t),{stdioItems:i,isStdioArray:s}=HO({stdioOption:e,fdNumber:t,options:r,optionName:o}),a=Zh(i,t,o),c=i.map(f=>ag({stdioItem:f,
|
|
1331
1331
|
isStdioArray:s,fdNumber:t,direction:a,isSync:n})),l=Jh(c,o,a,r),u=Kh(l,a);return XO(l,u),{direction:a,objectMode:u,stdioItems:l}},
|
|
1332
1332
|
HO=({stdioOption:e,fdNumber:t,options:r,optionName:n})=>{let i=[...(Array.isArray(e)?e:[e]).map(c=>qO(c,n)),...lg(r,t)],
|
|
1333
1333
|
s=dg(i),a=s.length>1;return WO(s,a,n),KO(s),{stdioItems:s,isStdioArray:a}},qO=(e,t)=>({type:Bh(e,t),value:e,optionName:t}),
|
|
@@ -1385,9 +1385,9 @@ r=>[...bt(r,e,0)]),...Wr(e)],bt=function*(e,t,r){if(r===t.length){yield e;return
|
|
|
1385
1385
|
e))yield*bt(o,t,r+1)},Wr=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*_P(r,Number(t),e)},_P=function*(e,t,r){
|
|
1386
1386
|
if(e!==void 0)for(let n of e())yield*bt(n,r,t+1)},vP=function*(e){yield e}});import{Transform as TP,getDefaultHighWaterMark as kg}from"node:stream";var uc,ii,$g,si=d(()=>{te();ri();Og();sc();Cg();lc();
|
|
1387
1387
|
uc=({value:e,value:{transform:t,final:r,writableObjectMode:n,readableObjectMode:o},optionName:i},{encoding:s})=>{let a={},
|
|
1388
|
-
c=$g(e,s,i),l=yt(t),u=yt(r),
|
|
1388
|
+
c=$g(e,s,i),l=yt(t),u=yt(r),f=l?ac.bind(void 0,oi,a):cc.bind(void 0,bt),h=l||u?ac.bind(void 0,xg,a):cc.bind(void 0,Wr),p=l||
|
|
1389
1389
|
u?Rg.bind(void 0,a):void 0;return{stream:new TP({writableObjectMode:n,writableHighWaterMark:kg(n),readableObjectMode:o,readableHighWaterMark:kg(
|
|
1390
|
-
o),transform(
|
|
1390
|
+
o),transform(E,S,m){f([E,c,0],this,m)},flush(E){h([c],this,E)},destroy:p})}},ii=(e,t,r,n)=>{let o=t.filter(({type:s})=>s===
|
|
1391
1391
|
"generator"),i=n?o.reverse():o;for(let{value:s,optionName:a}of i){let c=$g(s,r,a);e=Ng(c,e)}return e},$g=({transform:e,final:t,
|
|
1392
1392
|
binary:r,writableObjectMode:n,readableObjectMode:o,preserveNewlines:i},s,a)=>{let c={};return[{transform:Tg(n,a)},ni(r,s,
|
|
1393
1393
|
n),ti(r,i,n,c),{transform:e,final:t},{transform:Ig(o,a)},vg({binary:r,preserveNewlines:i,readableObjectMode:o,state:c})].
|
|
@@ -1405,10 +1405,10 @@ verboseInfo:r})}});import{writeFileSync as NP,appendFileSync as kP}from"node:fs"
|
|
|
1405
1405
|
Ug=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:n,verboseInfo:o})=>{if(t===null)return{output:Array.from(
|
|
1406
1406
|
{length:3})};let i={},s=new Set([]);return{output:t.map((c,l)=>$P({result:c,fileDescriptors:e,fdNumber:l,state:i,outputFiles:s,
|
|
1407
1407
|
isMaxBuffer:n,verboseInfo:o},r)),...i}},$P=({result:e,fileDescriptors:t,fdNumber:r,state:n,outputFiles:o,isMaxBuffer:i,verboseInfo:s},{
|
|
1408
|
-
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:
|
|
1409
|
-
objectMode:
|
|
1410
|
-
fdNumber:r});LP({serializedResult:
|
|
1411
|
-
void 0;try{return n.error===void 0&&DP(
|
|
1408
|
+
buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:f})=>{if(e===null)return;let h=Ih(e,i,f),p=De(h),{stdioItems:w,
|
|
1409
|
+
objectMode:E}=t[r],S=MP([p],w,c,n),{serializedResult:m,finalResult:g=m}=jP({chunks:S,objectMode:E,encoding:c,lines:l,stripFinalNewline:u,
|
|
1410
|
+
fdNumber:r});LP({serializedResult:m,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:w,objectMode:E});let y=a[r]?g:
|
|
1411
|
+
void 0;try{return n.error===void 0&&DP(m,w,o),y}catch(v){return n.error=v,y}},MP=(e,t,r,n)=>{try{return ii(e,t,r,!1)}catch(o){
|
|
1412
1412
|
return n.error=o,e}},jP=({chunks:e,objectMode:t,encoding:r,lines:n,stripFinalNewline:o,fdNumber:i})=>{if(t)return{serializedResult:e};
|
|
1413
1413
|
if(r==="buffer")return{serializedResult:Cr(e)};let s=mp(e,r);return n[i]?{serializedResult:s,finalResult:ic(s,!o[i],t)}:
|
|
1414
1414
|
{serializedResult:s}},LP=({serializedResult:e,fdNumber:t,state:r,verboseInfo:n,encoding:o,stdioItems:i,objectMode:s})=>{
|
|
@@ -1422,17 +1422,17 @@ if(!UP(t,r)&&fc(t,r))throw new be;return[t,r]},UP=(e,t)=>e===void 0&&t===void 0,
|
|
|
1422
1422
|
"ETIMEDOUT",a=Th(i,n,o);return{resultError:i,exitCode:t,signal:r,timedOut:s,isMaxBuffer:a}},VP=(e,t,r)=>e!==void 0?e:fc(
|
|
1423
1423
|
t,r)?new be:void 0});import{spawnSync as FP}from"node:child_process";var Kg,zP,GP,HP,ci,qP,WP,YP,KP,Jg=d(()=>{la();La();Da();Hr();Ko();Eg();qr();
|
|
1424
1424
|
jg();Vg();wt();zg();Yg();Kg=(e,t,r)=>{let{file:n,commandArguments:o,command:i,escapedCommand:s,startTime:a,verboseInfo:c,
|
|
1425
|
-
options:l,fileDescriptors:u}=zP(e,t,r),
|
|
1426
|
-
fileDescriptors:u,startTime:a});return Qt(
|
|
1427
|
-
e,t,r),a=GP(r),{file:c,commandArguments:l,options:u}=jo(e,t,a);HP(u);let
|
|
1428
|
-
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:
|
|
1425
|
+
options:l,fileDescriptors:u}=zP(e,t,r),f=qP({file:n,commandArguments:o,options:l,command:i,escapedCommand:s,verboseInfo:c,
|
|
1426
|
+
fileDescriptors:u,startTime:a});return Qt(f,c,l)},zP=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=co(
|
|
1427
|
+
e,t,r),a=GP(r),{file:c,commandArguments:l,options:u}=jo(e,t,a);HP(u);let f=yg(u,s);return{file:c,commandArguments:l,command:n,
|
|
1428
|
+
escapedCommand:o,startTime:i,verboseInfo:s,options:u,fileDescriptors:f}},GP=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,HP=({ipc:e,
|
|
1429
1429
|
ipcInput:t,detached:r,cancelSignal:n})=>{t&&ci("ipcInput"),e&&ci("ipc: true"),r&&ci("detached: true"),n&&ci("cancelSigna\
|
|
1430
1430
|
l")},ci=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},qP=({file:e,commandArguments:t,
|
|
1431
1431
|
options:r,command:n,escapedCommand:o,verboseInfo:i,fileDescriptors:s,startTime:a})=>{let c=WP({file:e,commandArguments:t,
|
|
1432
|
-
options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:
|
|
1433
|
-
timedOut:h,isMaxBuffer:p}=Wg(c,r),{output:
|
|
1434
|
-
S=
|
|
1435
|
-
all:
|
|
1432
|
+
options:r,command:n,escapedCommand:o,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:f,
|
|
1433
|
+
timedOut:h,isMaxBuffer:p}=Wg(c,r),{output:w,error:E=l}=Ug({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:i}),
|
|
1434
|
+
S=w.map((g,y)=>ze(g,r,y)),m=ze(Fg(w,r),r,"all");return KP({error:E,exitCode:u,signal:f,timedOut:h,isMaxBuffer:p,stdio:S,
|
|
1435
|
+
all:m,options:r,command:n,escapedCommand:o,startTime:a})},WP=({file:e,commandArguments:t,options:r,command:n,escapedCommand:o,
|
|
1436
1436
|
fileDescriptors:i,startTime:s})=>{try{Mg(i,r);let a=YP(r);return FP(...Lo(e,t,a))}catch(a){return Zt({error:a,command:n,
|
|
1437
1437
|
escapedCommand:o,fileDescriptors:i,options:r,startTime:s,isSync:!0})}},YP=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"\
|
|
1438
1438
|
buffer",maxBuffer:Wo(t)}),KP=({error:e,exitCode:t,signal:r,timedOut:n,isMaxBuffer:o,stdio:i,all:s,options:a,command:c,escapedCommand:l,
|
|
@@ -1528,9 +1528,9 @@ exitCode)):0}#c(t,...r){let n=this.#n;if(t==="exit"&&pi(this.#e)){typeof r[0]=="
|
|
|
1528
1528
|
call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...r)}},xc=globalThis.
|
|
1529
1529
|
process,{onExit:Tw,load:y4,unload:b4}=Ux(pi(xc)?new Pc(xc):new Oc)});import{addAbortListener as Vx}from"node:events";var Aw,Ow=d(()=>{Iw();Aw=(e,{cleanup:t,detached:r},{signal:n})=>{if(!t||
|
|
1530
1530
|
r)return;let o=Tw(()=>{e.kill()});Vx(n,()=>{o()})}});var xw,Fx,zx,Pw,Gx,Rw=d(()=>{Qs();ao();Xe();Bt();xw=({source:e,sourcePromise:t,boundOptions:r,createNested:n},...o)=>{let i=so(),
|
|
1531
|
-
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=Fx(r,n,o),{sourceStream:
|
|
1532
|
-
e,l),{options:p,fileDescriptors:
|
|
1533
|
-
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:
|
|
1531
|
+
{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=Fx(r,n,o),{sourceStream:f,sourceError:h}=Gx(
|
|
1532
|
+
e,l),{options:p,fileDescriptors:w}=Pe.get(e);return{sourcePromise:t,sourceStream:f,sourceOptions:p,sourceError:h,destination:s,
|
|
1533
|
+
destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:w,startTime:i}},Fx=(e,t,r)=>{try{let{destination:n,
|
|
1534
1534
|
pipeOptions:{from:o,to:i,unpipeSignal:s}={}}=zx(e,t,...r),a=Eo(n,i);return{destination:n,destinationStream:a,from:o,unpipeSignal:s}}catch(n){
|
|
1535
1535
|
return{destinationError:n}}},zx=(e,t,r,...n)=>{if(Array.isArray(r))return{destination:t(Pw,e)(r,...n),pipeOptions:e};if(typeof r==
|
|
1536
1536
|
"string"||r instanceof URL||Xs(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options\
|
|
@@ -1553,9 +1553,9 @@ anceled by `unpipeSignal` option.");throw Rc({error:s,fileDescriptors:n,sourceOp
|
|
|
1553
1553
|
...e.boundOptions,...t[0]}});let{destination:r,...n}=xw(e,...t),o=eR({...n,destination:r});return o.pipe=hi.bind(void 0,
|
|
1554
1554
|
{...e,source:r,sourcePromise:o,boundOptions:{}}),o},eR=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:n,
|
|
1555
1555
|
destination:o,destinationStream:i,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=tR(e,o);Nw({
|
|
1556
|
-
sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let
|
|
1557
|
-
try{let h=Mw(t,i,
|
|
1558
|
-
startTime:l})])}finally{
|
|
1556
|
+
sourceStream:t,sourceError:n,destinationStream:i,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let f=new AbortController;
|
|
1557
|
+
try{let h=Mw(t,i,f);return await Promise.race([kw(u),...Lw(a,{sourceStream:t,mergedStream:h,sourceOptions:r,fileDescriptors:c,
|
|
1558
|
+
startTime:l})])}finally{f.abort()}},tR=(e,t)=>Promise.allSettled([e,t])});import{on as rR}from"node:events";import{getDefaultHighWaterMark as nR}from"node:stream";var gi,oR,Nc,iR,Vw,kc,Uw,sR,aR,
|
|
1559
1559
|
wi=d(()=>{sc();ri();lc();gi=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:n,encoding:o,preserveNewlines:i})=>{
|
|
1560
1560
|
let s=new AbortController;return oR(t,s),Vw({stream:e,controller:s,binary:r,shouldEncode:!e.readableObjectMode&&n,encoding:o,
|
|
1561
1561
|
shouldSplit:!e.readableObjectMode,preserveNewlines:i})},oR=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Nc=({stream:e,
|
|
@@ -1569,9 +1569,9 @@ encoding:o,shouldSplit:i,preserveNewlines:s});try{for await(let[c]of e)yield*bt(
|
|
|
1569
1569
|
yield*Wr(a)}},aR=({binary:e,shouldEncode:t,encoding:r,shouldSplit:n,preserveNewlines:o})=>[ni(e,r,!t),ti(e,o,!n,{})].filter(
|
|
1570
1570
|
Boolean)});import{setImmediate as cR}from"node:timers/promises";var Fw,lR,uR,dR,$c,zw,Mc=d(()=>{qo();ce();dc();wi();wt();qr();Fw=async({
|
|
1571
1571
|
stream:e,onStreamEnd:t,fdNumber:r,encoding:n,buffer:o,maxBuffer:i,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{
|
|
1572
|
-
let
|
|
1573
|
-
[uR(e),
|
|
1574
|
-
all([dR({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),
|
|
1572
|
+
let f=lR({stream:e,onStreamEnd:t,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!o){await Promise.all(
|
|
1573
|
+
[uR(e),f]);return}let h=nc(c,r),p=Nc({stream:e,onStreamEnd:t,lines:s,encoding:n,stripFinalNewline:h,allMixed:a}),[w]=await Promise.
|
|
1574
|
+
all([dR({stream:e,iterable:p,fdNumber:r,encoding:n,maxBuffer:i,lines:s}),f]);return w},lR=async({stream:e,onStreamEnd:t,
|
|
1575
1575
|
fdNumber:r,encoding:n,allMixed:o,verboseInfo:i,streamInfo:{fileDescriptors:s}})=>{if(!ai({stdioItems:s[r]?.stdioItems,encoding:n,
|
|
1576
1576
|
verboseInfo:i,fdNumber:r}))return;let a=Nc({stream:e,onStreamEnd:t,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:o});
|
|
1577
1577
|
await Lg(a,e,r,i)},uR=async e=>{await cR(),e.readableFlowing===null&&e.resume()},dR=async({stream:e,stream:{readableObjectMode:t},
|
|
@@ -1588,8 +1588,8 @@ all"&&e[t].direction==="input",yi=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Gw=e
|
|
|
1588
1588
|
streamInfo:a})=>e.stdio.map((c,l)=>Lc({stream:c,fdNumber:l,encoding:t,buffer:r[l],maxBuffer:n[l],lines:o[l],allMixed:!1,
|
|
1589
1589
|
stripFinalNewline:i,verboseInfo:s,streamInfo:a})),Lc=async({stream:e,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,
|
|
1590
1590
|
allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=Xr(e,t,l);if(jc(l,t)){await u;return}let[
|
|
1591
|
-
|
|
1592
|
-
verboseInfo:c,streamInfo:l}),u]);return
|
|
1591
|
+
f]=await Promise.all([Fw({stream:e,onStreamEnd:u,fdNumber:t,encoding:r,buffer:n,maxBuffer:o,lines:i,allMixed:s,stripFinalNewline:a,
|
|
1592
|
+
verboseInfo:c,streamInfo:l}),u]);return f}});var qw,Ww,yR,bR,Bc=d(()=>{ui();Dc();qw=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?Et([e,t].filter(Boolean)):void 0,Ww=({subprocess:e,
|
|
1593
1593
|
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:i,verboseInfo:s,streamInfo:a})=>Lc({...yR(e,r),fdNumber:"all",
|
|
1594
1594
|
encoding:t,maxBuffer:n[1]+n[2],lines:o[1]||o[2],allMixed:bR(e),stripFinalNewline:i,verboseInfo:s,streamInfo:a}),yR=({stdout:e,
|
|
1595
1595
|
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,
|
|
@@ -1598,14 +1598,14 @@ if(!n)return o;let s=Yw(i),a=Ue(t,"ipc"),c=Ue(r,"ipc");for await(let l of gc({an
|
|
|
1598
1598
|
ipc:n,shouldAwait:!1,reference:!0}))a&&(_h(e,o,c),o.push(l)),s&&Kw(l,i);return o},Zw=async(e,t)=>(await Promise.allSettled(
|
|
1599
1599
|
[e]),t)});import{once as ER}from"node:events";var ey,SR,_R,vR,ty=d(()=>{gt();Na();va();Ca();Be();te();Mc();Qw();$a();Bc();Dc();mc();
|
|
1600
1600
|
bi();ey=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:n,lines:o,timeoutDuration:i,cancelSignal:s,gracefulCancel:a,
|
|
1601
|
-
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:
|
|
1602
|
-
onInternalError:S,controller:
|
|
1603
|
-
|
|
1604
|
-
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:
|
|
1605
|
-
maxBuffer:n,ipc:u,ipcOutput:
|
|
1606
|
-
Promise.all(
|
|
1607
|
-
controller:
|
|
1608
|
-
return h.terminationReason??="other",Promise.all([{error:
|
|
1601
|
+
forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:f},context:h,verboseInfo:p,fileDescriptors:w,originalStreams:E,
|
|
1602
|
+
onInternalError:S,controller:m})=>{let g=Gg(e,h),y={originalStreams:E,fileDescriptors:w,subprocess:e,exitPromise:g,propagating:!1},
|
|
1603
|
+
v=Hw({subprocess:e,encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),T=Ww({subprocess:e,
|
|
1604
|
+
encoding:t,buffer:r,maxBuffer:n,lines:o,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),b=[],_=Xw({subprocess:e,buffer:r,
|
|
1605
|
+
maxBuffer:n,ipc:u,ipcOutput:b,verboseInfo:p}),A=SR(E,e,y),I=_R(w,y);try{return await Promise.race([Promise.all([{},qg(g),
|
|
1606
|
+
Promise.all(v),T,_,Wm(e,f),...A,...I]),S,vR(e,m),...Fm(e,i,h,m),...cm({subprocess:e,cancelSignal:s,gracefulCancel:a,context:h,
|
|
1607
|
+
controller:m}),...Um({subprocess:e,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:h,controller:m})])}catch(P){
|
|
1608
|
+
return h.terminationReason??="other",Promise.all([{error:P},g,Promise.all(v.map(L=>$c(L))),$c(T),Zw(_,b),Promise.allSettled(
|
|
1609
1609
|
A),Promise.allSettled(I)])}},SR=(e,t,r)=>e.map((n,o)=>n===t.stdio[o]?void 0:Xr(n,o,r)),_R=(e,t)=>e.flatMap(({stdioItems:r},n)=>r.
|
|
1610
1610
|
filter(({value:o,stream:i=o})=>Se(i,{checkOpen:!1})&&!ye(i)).map(({type:o,value:i,stream:s=i})=>Xr(s,n,t,{isSameDirection:me.
|
|
1611
1611
|
has(o),stopOnExit:o==="native"}))),vR=async(e,{signal:t})=>{let[r]=await ER(e,"error",{signal:t});throw r}});var ry,Zr,rr,Ei=d(()=>{Yt();ry=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),
|
|
@@ -1616,10 +1616,10 @@ e)}catch{}},oy=async e=>{if(e!==void 0)try{await Fc(e)}catch{}},Vc=async e=>{awa
|
|
|
1616
1616
|
Fc=async e=>{await ny(e,{cleanup:!0,readable:!0,writable:!1})},Si=async(e,t)=>{if(await e,t)throw t},_i=(e,t,r)=>{r&&!yi(
|
|
1617
1617
|
r)?e.destroy(r):t&&e.destroy()}});import{Readable as TR}from"node:stream";import{callbackify as IR}from"node:util";var iy,Gc,Hc,qc,AR,Wc,Yc,sy,Kc=d(()=>{mt();
|
|
1618
1618
|
Xe();wi();Yt();Ei();zc();iy=({subprocess:e,concurrentStreams:t,encoding:r},{from:n,binary:o=!0,preserveNewlines:i=!0}={})=>{
|
|
1619
|
-
let s=o||le.has(r),{subprocessStdout:a,waitReadableDestroy:c}=Gc(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:
|
|
1620
|
-
a,s),{read:h,onStdoutDataDone:p}=qc({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),
|
|
1621
|
-
read:h,destroy:IR(Yc.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:
|
|
1622
|
-
encoding:l});return Wc({subprocessStdout:a,onStdoutDataDone:p,readable:
|
|
1619
|
+
let s=o||le.has(r),{subprocessStdout:a,waitReadableDestroy:c}=Gc(e,n,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:f}=Hc(
|
|
1620
|
+
a,s),{read:h,onStdoutDataDone:p}=qc({subprocessStdout:a,subprocess:e,binary:s,encoding:r,preserveNewlines:i}),w=new TR({
|
|
1621
|
+
read:h,destroy:IR(Yc.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:f,objectMode:u,
|
|
1622
|
+
encoding:l});return Wc({subprocessStdout:a,onStdoutDataDone:p,readable:w,subprocess:e}),w},Gc=(e,t,r)=>{let n=Kt(e,t),o=Zr(
|
|
1623
1623
|
r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:o}},Hc=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},n)=>n?
|
|
1624
1624
|
{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:kc},
|
|
1625
1625
|
qc=({subprocessStdout:e,subprocess:t,binary:r,encoding:n,preserveNewlines:o})=>{let i=Oe(),s=gi({subprocessStdout:e,subprocess:t,
|
|
@@ -1637,12 +1637,12 @@ xR=async(e,t,r)=>{await rr(r,t)&&(e.writable&&e.end(),await t)},Zc=async(e,t,r)=
|
|
|
1637
1637
|
await oy(r),ly(t,n)}},Qc=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:n},o)=>{await rr(
|
|
1638
1638
|
r,t),await rr(n,t)&&(ly(e,o),await Si(t,o))},ly=(e,t)=>{_i(e,e.writable,t)}});import{Duplex as RR}from"node:stream";import{callbackify as CR}from"node:util";var uy,NR,dy=d(()=>{mt();Kc();el();uy=({subprocess:e,
|
|
1639
1639
|
concurrentStreams:t,encoding:r},{from:n,to:o,binary:i=!0,preserveNewlines:s=!0}={})=>{let a=i||le.has(r),{subprocessStdout:c,
|
|
1640
|
-
waitReadableDestroy:l}=Gc(e,n,t),{subprocessStdin:u,waitWritableFinal:
|
|
1641
|
-
readableObjectMode:
|
|
1642
|
-
encoding:r,preserveNewlines:s}),
|
|
1643
|
-
subprocess:e,waitReadableDestroy:l,waitWritableFinal:
|
|
1644
|
-
writableHighWaterMark,readableObjectMode:
|
|
1645
|
-
onStdoutDataDone:
|
|
1640
|
+
waitReadableDestroy:l}=Gc(e,n,t),{subprocessStdin:u,waitWritableFinal:f,waitWritableDestroy:h}=Jc(e,o,t),{readableEncoding:p,
|
|
1641
|
+
readableObjectMode:w,readableHighWaterMark:E}=Hc(c,a),{read:S,onStdoutDataDone:m}=qc({subprocessStdout:c,subprocess:e,binary:a,
|
|
1642
|
+
encoding:r,preserveNewlines:s}),g=new RR({read:S,...Xc(u,e,f),destroy:CR(NR.bind(void 0,{subprocessStdout:c,subprocessStdin:u,
|
|
1643
|
+
subprocess:e,waitReadableDestroy:l,waitWritableFinal:f,waitWritableDestroy:h})),readableHighWaterMark:E,writableHighWaterMark:u.
|
|
1644
|
+
writableHighWaterMark,readableObjectMode:w,writableObjectMode:u.writableObjectMode,encoding:p});return Wc({subprocessStdout:c,
|
|
1645
|
+
onStdoutDataDone:m,readable:g,subprocess:e,subprocessStdin:u}),Zc(u,g,c),g},NR=async({subprocessStdout:e,subprocessStdin:t,
|
|
1646
1646
|
subprocess:r,waitReadableDestroy:n,waitWritableFinal:o,waitWritableDestroy:i},s)=>{await Promise.all([Yc({subprocessStdout:e,
|
|
1647
1647
|
subprocess:r,waitReadableDestroy:n},s),Qc({subprocessStdin:t,subprocess:r,waitWritableFinal:o,waitWritableDestroy:i},s)])}});var tl,kR,py=d(()=>{mt();Xe();wi();tl=(e,t,{from:r,binary:n=!1,preserveNewlines:o=!1}={})=>{let i=n||le.has(t),s=Kt(e,r),
|
|
1648
1648
|
a=gi({subprocessStdout:s,subprocess:e,binary:i,shouldEncode:!0,encoding:t,preserveNewlines:o});return kR(a,s,e)},kR=async function*(e,t,r){
|
|
@@ -1651,23 +1651,23 @@ encoding:t}),e.writable=cy.bind(void 0,{subprocess:e,concurrentStreams:r}),e.dup
|
|
|
1651
1651
|
encoding:t}),e.iterable=tl.bind(void 0,e,t),e[Symbol.asyncIterator]=tl.bind(void 0,e,t,{})}});var hy,$R,MR,gy=d(()=>{hy=(e,t)=>{for(let[r,n]of MR){let o=n.value.bind(t);Reflect.defineProperty(e,r,{...n,value:o})}},
|
|
1652
1652
|
$R=(async()=>{})().constructor.prototype,MR=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor($R,e)])});import{setMaxListeners as jR}from"node:events";import{spawn as LR}from"node:child_process";var wy,DR,BR,UR,VR,FR,yy=d(()=>{
|
|
1653
1653
|
qo();la();La();Xe();Da();yc();Hr();Ko();aw();pw();qr();_w();go();Ow();Bw();Bc();ty();my();Yt();gy();wy=(e,t,r,n)=>{let{file:o,
|
|
1654
|
-
commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:
|
|
1655
|
-
promise:p}=UR({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:
|
|
1656
|
-
return h.pipe=hi.bind(void 0,{source:h,sourcePromise:p,boundOptions:{},createNested:n}),hy(h,p),Pe.set(h,{options:u,fileDescriptors:
|
|
1654
|
+
commandArguments:i,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:f}=DR(e,t,r),{subprocess:h,
|
|
1655
|
+
promise:p}=UR({file:o,commandArguments:i,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:f});
|
|
1656
|
+
return h.pipe=hi.bind(void 0,{source:h,sourcePromise:p,boundOptions:{},createNested:n}),hy(h,p),Pe.set(h,{options:u,fileDescriptors:f}),
|
|
1657
1657
|
h},DR=(e,t,r)=>{let{command:n,escapedCommand:o,startTime:i,verboseInfo:s}=co(e,t,r),{file:a,commandArguments:c,options:l}=jo(
|
|
1658
|
-
e,t,r),u=BR(l),
|
|
1659
|
-
fileDescriptors:
|
|
1658
|
+
e,t,r),u=BR(l),f=dw(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:o,startTime:i,verboseInfo:s,options:u,
|
|
1659
|
+
fileDescriptors:f}},BR=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been ren\
|
|
1660
1660
|
amed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},UR=({file:e,commandArguments:t,options:r,startTime:n,verboseInfo:o,
|
|
1661
|
-
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=LR(...Lo(e,t,r))}catch(
|
|
1661
|
+
command:i,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=LR(...Lo(e,t,r))}catch(w){return sw({error:w,command:i,escapedCommand:s,
|
|
1662
1662
|
fileDescriptors:a,options:r,startTime:n,verboseInfo:o})}let l=new AbortController;jR(Number.POSITIVE_INFINITY,l.signal);
|
|
1663
|
-
let u=[...c.stdio];Sw(c,a,l),Aw(c,r,l);let
|
|
1664
|
-
context:
|
|
1665
|
-
originalStreams:u,command:i,escapedCommand:s,context:
|
|
1663
|
+
let u=[...c.stdio];Sw(c,a,l),Aw(c,r,l);let f={},h=Oe();c.kill=sm.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:h,
|
|
1664
|
+
context:f,controller:l}),c.all=qw(c,r),fy(c,r),nw(c,r);let p=VR({subprocess:c,options:r,startTime:n,verboseInfo:o,fileDescriptors:a,
|
|
1665
|
+
originalStreams:u,command:i,escapedCommand:s,context:f,onInternalError:h,controller:l});return{subprocess:c,promise:p}},
|
|
1666
1666
|
VR=async({subprocess:e,options:t,startTime:r,verboseInfo:n,fileDescriptors:o,originalStreams:i,command:s,escapedCommand:a,
|
|
1667
|
-
context:c,onInternalError:l,controller:u})=>{let[
|
|
1668
|
-
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let
|
|
1669
|
-
|
|
1670
|
-
startTime:r});return Qt(
|
|
1667
|
+
context:c,onInternalError:l,controller:u})=>{let[f,[h,p],w,E,S]=await ey({subprocess:e,options:t,context:c,verboseInfo:n,
|
|
1668
|
+
fileDescriptors:o,originalStreams:i,onInternalError:l,controller:u});u.abort(),l.resolve();let m=w.map((v,T)=>ze(v,t,T)),
|
|
1669
|
+
g=ze(E,t,"all"),y=FR({errorInfo:f,exitCode:h,signal:p,stdio:m,all:g,ipcOutput:S,context:c,options:t,command:s,escapedCommand:a,
|
|
1670
|
+
startTime:r});return Qt(y,n,t)},FR=({errorInfo:e,exitCode:t,signal:r,stdio:n,all:o,ipcOutput:i,context:s,options:a,command:c,
|
|
1671
1671
|
escapedCommand:l,startTime:u})=>"error"in e?Gr({error:e.error,command:c,escapedCommand:l,timedOut:s.terminationReason===
|
|
1672
1672
|
"timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason===
|
|
1673
1673
|
"gracefulCancel",isMaxBuffer:e.error instanceof xe,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:t,signal:r,stdio:n,
|
|
@@ -1677,8 +1677,8 @@ deepOptions:r,boundOptions:t,setBoundExeca:n,createNested:o},...s);return n!==vo
|
|
|
1677
1677
|
boundOptions:r={},setBoundExeca:n,createNested:o},i,...s)=>{if(H(i))return o(e,vi(r,i),n);let{file:a,commandArguments:c,
|
|
1678
1678
|
options:l,isSync:u}=qR({mapArguments:e,firstArgument:i,nextArguments:s,deepOptions:t,boundOptions:r});return u?Kg(a,c,l):
|
|
1679
1679
|
wy(a,c,l,o)},qR=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:n,boundOptions:o})=>{let i=yp(t)?bp(t,r):[t,
|
|
1680
|
-
...r],[s,a,c]=Kn(...i),l=vi(vi(n,o),c),{file:u=s,commandArguments:
|
|
1681
|
-
options:l});return{file:u,commandArguments:
|
|
1680
|
+
...r],[s,a,c]=Kn(...i),l=vi(vi(n,o),c),{file:u=s,commandArguments:f=a,options:h=l,isSync:p=!1}=e({file:s,commandArguments:a,
|
|
1681
|
+
options:l});return{file:u,commandArguments:f,options:h,isSync:p}}});var Sy,_y,vy,WR,YR,Ty=d(()=>{Sy=({file:e,commandArguments:t})=>vy(e,t),_y=({file:e,commandArguments:t})=>({...vy(e,t),isSync:!0}),
|
|
1682
1682
|
vy=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}\
|
|
1683
1683
|
.`);let[r,...n]=WR(e);return{file:r,commandArguments:n}},WR=e=>{if(typeof e!="string")throw new TypeError(`The command m\
|
|
1684
1684
|
ust be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let n of t.split(YR)){let o=r.at(-1);o&&
|
|
@@ -1686,12 +1686,12 @@ o.endsWith("\\")?r[r.length-1]=`${o.slice(0,-1)} ${n}`:r.push(n)}return r},YR=/
|
|
|
1686
1686
|
e),isSync:!0}),Oy=e=>({options:{...JR(e),...e}}),JR=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?
|
|
1687
1687
|
{stdin:"inherit"}:{},Py={preferLocal:!0}});var Ry,cG,lG,uG,dG,pG,fG,mG,hG,gG,Cy=d(()=>{Ey();Ty();ka();xy();yc();Ry=et(()=>({})),cG=et(()=>({isSync:!0})),lG=et(Sy),
|
|
1688
1688
|
uG=et(_y),dG=et(Gm),pG=et(Ay,{},Py,Iy),{sendMessage:fG,getOneMessage:mG,getEachMessage:hG,getCancelSignal:gG}=ow()});function XR(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function Qr({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1689
|
-
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:
|
|
1690
|
-
let p=XR(r),
|
|
1691
|
-
`)).trim();return{code:
|
|
1692
|
-
Number(s):null,signal:
|
|
1693
|
-
ct"&&!Array.isArray(
|
|
1694
|
-
d",r={}){let n=
|
|
1689
|
+
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:l="",timedOut:u=!1,execution:f=null,retryable:h=null}={}){
|
|
1690
|
+
let p=XR(r),w=String(l||""),E=String(c||""),S=String(o||[w,E].filter(Boolean).join(`
|
|
1691
|
+
`)).trim();return{code:k(e),error:k(t),exitCode:p,ok:n===null?p===0:n===!0,output:S,pid:Number.isSafeInteger(Number(s))?
|
|
1692
|
+
Number(s):null,signal:k(a),stderr:E,stdout:w,...i==="base64"?{outputEncoding:i}:{},timedOut:u===!0,...f&&typeof f=="obje\
|
|
1693
|
+
ct"&&!Array.isArray(f)?{execution:f}:{},...typeof h=="boolean"?{retryable:h}:{}}}function K(e="",t="vibe64_command_faile\
|
|
1694
|
+
d",r={}){let n=k(e)||"Vibe64 command failed.";return Qr({...r,code:t,error:n,exitCode:1,ok:!1,output:k(r.output)||n,stderr:r.
|
|
1695
1695
|
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var nr=d(()=>{G()});import{spawn as ZR}from"node:child_process";import{mkdir as QR,open as eC}from"node:fs/promises";import tC from"node:path";
|
|
1696
1696
|
async function oC(e=""){return e?(await QR(tC.dirname(e),{recursive:!0}),eC(e,"w",384)):null}async function iC(e){return new Promise(
|
|
1697
1697
|
(t,r)=>{let n=!1,o=(i,s)=>{n||(n=!0,i(s))};e.once?.("spawn",()=>o(t)),e.once?.("error",i=>o(r,i))})}async function $y(e={},{
|
|
@@ -1708,21 +1708,21 @@ kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function Ny(e=null,t="SIGTERM")
|
|
|
1708
1708
|
r;)await new Promise(n=>setTimeout(n,25));return!Ii(e)}async function Ai(e=null,{killTimeoutMs:t=nC,termTimeoutMs:r=rC}={}){
|
|
1709
1709
|
Ny(e,"SIGTERM");let n=await ky(e,r);return n||(Ny(e,"SIGKILL"),n=await ky(e,t)),n}var Ti,rC,nC,en=d(()=>{nr();Ti=new Map,
|
|
1710
1710
|
rC=3e3,nC=1e3});async function tn(e="",t=[],{cwd:r="",env:n={},execution:o=null,input:i=void 0,maxBuffer:s=void 0,onOutput:a=null,outputEncoding:c="\
|
|
1711
|
-
utf8",signal:l=null,timeout:u=15e3}={}){let
|
|
1712
|
-
return K("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let
|
|
1711
|
+
utf8",signal:l=null,timeout:u=15e3}={}){let f,h,p,w=Promise.withResolvers(),E=()=>{p||=h(),p.then(w.resolve)};if(l?.aborted)
|
|
1712
|
+
return K("Command cancelled.","vibe64_command_cancelled",{execution:o});try{let g=Ry(e,t,{all:!0,cwd:r,detached:process.
|
|
1713
1713
|
platform!=="win32",encoding:c,env:n,extendEnv:!1,input:i,maxBuffer:s,reject:!1,stdin:i==null?"ignore":"pipe",stripFinalNewline:!1,
|
|
1714
|
-
timeout:u}),
|
|
1715
|
-
|
|
1716
|
-
l?.aborted&&
|
|
1717
|
-
[w
|
|
1718
|
-
ommand_capture_timed_out":
|
|
1719
|
-
(
|
|
1720
|
-
|
|
1721
|
-
outputEncoding:c,signal:
|
|
1722
|
-
"abort",
|
|
1723
|
-
4_execution_drain_failed",{execution:o,output:
|
|
1724
|
-
o.id);let
|
|
1725
|
-
outputEncoding:c}):
|
|
1714
|
+
timeout:u}),y=Number(g.pid),v;h=()=>{if(!v){let _;process.platform!=="win32"?_=Ai(y).catch(()=>!1):(g.kill("SIGKILL"),_=
|
|
1715
|
+
g.then(()=>!0,()=>!0)),v=_.then(A=>(A||(v=null),A))}return v},o?.id&&My.set(o.id,h),l?.addEventListener("abort",E,{once:!0}),
|
|
1716
|
+
l?.aborted&&E(),typeof a=="function"&&g.all&&g.all.on("data",_=>{try{a(String(_||""))}catch{}});let T=await Promise.race(
|
|
1717
|
+
[g,w.promise.then(_=>_?g:{exitCode:1})]),b=typeof T.exitCode=="number"?T.exitCode:1;f=Qr({code:T.timedOut===!0?"vibe64_c\
|
|
1718
|
+
ommand_capture_timed_out":T.code?"vibe64_command_capture_failed":"",error:b===0?"":T.shortMessage,exitCode:b,output:T.all||
|
|
1719
|
+
(b===0?"":T.shortMessage),outputEncoding:c,signal:T.signal,stderr:T.stderr,stdout:T.stdout,timedOut:T.timedOut===!0,execution:o})}catch(g){
|
|
1720
|
+
f=K(g.message,"vibe64_command_capture_failed",{execution:o,exitCode:typeof g.exitCode=="number"?g.exitCode:1,output:g.all,
|
|
1721
|
+
outputEncoding:c,signal:g.signal,stderr:g.stderr,stdout:g.stdout,timedOut:g.timedOut===!0})}finally{l?.removeEventListener(
|
|
1722
|
+
"abort",E)}if(!await(p||h?.()||!0))return K("The command finished, but its execution scope did not become empty.","vibe6\
|
|
1723
|
+
4_execution_drain_failed",{execution:o,output:f?.output,outputEncoding:c,stderr:f?.stderr,stdout:f?.stdout});o?.id&&My.delete(
|
|
1724
|
+
o.id);let m=o&&{...o,state:"finished"};return l?.aborted?K("Command cancelled.","vibe64_command_cancelled",{...f,execution:m,
|
|
1725
|
+
outputEncoding:c}):m?{...f,execution:m}:f}var My,rn=d(()=>{Cy();nr();en();My=new Map});function _t(){return globalThis[sC]||aC}var sC,aC,or=d(()=>{sC=Symbol.for("vibe64.hostProfile"),aC=Object.freeze({runtimePackRoot:"",
|
|
1726
1726
|
sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1})});function rl(e=""){let t=String(e||"").trim()||_t().execHelperPath;if(!t){let r=new Error("This computer has no helper fo\
|
|
1727
1727
|
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function Dy(e={}){return{
|
|
1728
1728
|
...e,schema:jy,schemaVersion:Ly}}function nn({actor:e={},command:t="",cwd:r="",env:n={},input:o=void 0,operation:i="vibe\
|
|
@@ -1747,15 +1747,15 @@ path",r=hl){let n=String(e||"").trim();if(!n||!ml.isAbsolute(n)||ml.normalize(n)
|
|
|
1747
1747
|
absolute path.`,r);return n}async function ir(e="",{cwd:t="",errorCode:r=hl}={}){let n=Ky(e,"lockPath",r),o=t?Ky(t,"cwd",
|
|
1748
1748
|
r):ml.dirname(n),i=await SC(n,fl.O_CREAT|fl.O_NOFOLLOW|fl.O_RDWR,432),s=null,a="",c=Promise.resolve({code:null,signal:null});
|
|
1749
1749
|
try{if(s=EC("/bin/sh",["-c","/usr/bin/flock --exclusive --nonblock 3 || exit 1; printf 'locked\\n'; IFS= read -r _ || tru\
|
|
1750
|
-
e"],{cwd:o,env:{PATH:"/usr/bin:/bin"},stdio:["pipe","pipe","pipe",i.fd]}),c=new Promise(
|
|
1751
|
-
signal:p}))}),!await new Promise((
|
|
1750
|
+
e"],{cwd:o,env:{PATH:"/usr/bin:/bin"},stdio:["pipe","pipe","pipe",i.fd]}),c=new Promise(f=>{s.once("close",(h,p)=>f({code:h,
|
|
1751
|
+
signal:p}))}),!await new Promise((f,h)=>{let p="",w=!1,E=(S,m)=>{w||(w=!0,S(m))};s.once("error",S=>E(h,S)),s.stderr.on("\
|
|
1752
1752
|
data",S=>{a=`${a}${String(S||"")}`.slice(-4096)}),s.stdout.on("data",S=>{p+=String(S||""),p.includes(`
|
|
1753
|
-
`)&&
|
|
1753
|
+
`)&&E(f,!0)}),s.once("exit",S=>{if(S===1){E(f,!1);return}E(h,xi(`Exclusive file lock process failed${a?`: ${a.trim()}`:"\
|
|
1754
1754
|
."}`,r))})}))return await i.close(),null;let u=!1;return async()=>{if(!u){u=!0;try{if(s.stdin.end(`release
|
|
1755
1755
|
`),(await c).code!==0)throw xi(`Exclusive file lock process exited unexpectedly${a?`: ${a.trim()}`:"."}`,r)}finally{await i.
|
|
1756
1756
|
close()}}}}catch(l){throw s?.stdin?.destroy(),s?.kill?.("SIGTERM"),await c,await i.close().catch(()=>null),l?.code===r?l:
|
|
1757
1757
|
xi(l?.message||String(l||"Exclusive file lock failed."),r)}}var hl,Jy=d(()=>{hl="file_lock_failed"});var Ri=d(()=>{By();Vy();al();sl();cl();Pi();Yy();pl();Jy()});var Xy=d(()=>{Ri()});function _C(e={}){return je(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1758
|
-
session?.metadata?.session_git_command_actor_user_key)}async function Zy(e={}){let t=
|
|
1758
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Zy(e={}){let t=k(e.actor)||"daemon";if(t==="daemon"||
|
|
1759
1759
|
t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:qs()};let r=_C(e);if(!r){let n=new Error("A user key\
|
|
1760
1760
|
is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,credentialScope:"\
|
|
1761
1761
|
user",requiresRealUser:!0,user:await Ws(r)}}var Qy=d(()=>{G();Lt()});import Ci from"node:path";function sr(e={}){let t=Js();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.
|
|
@@ -1770,18 +1770,18 @@ _actor_mismatch",i}}var $i=d(()=>{Lt();G()});function sn(...e){let t={};for(let
|
|
|
1770
1770
|
G();ar=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1771
1771
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1772
1772
|
R","VIBE64_MYSQL_USER"])});import{spawnSync as vC}from"node:child_process";import{statSync as TC}from"node:fs";import IC from"node:path";function gl(e="",t="\
|
|
1773
|
-
vibe64"){return
|
|
1773
|
+
vibe64"){return k(e).toLowerCase().replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function PC(...e){
|
|
1774
1774
|
for(let t of e){let r=ie(t),n=ie(r.user),o=je(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,
|
|
1775
1775
|
n.user_name),i=je(r.email,r.userEmail,r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,n.user_email);if(o&&
|
|
1776
1776
|
i)return{authorEmail:i,authorName:o,committerEmail:i,committerName:o,source:"configured"}}return null}function xC(e={}){
|
|
1777
1777
|
let t=ie(e),r=je(t.name,t.displayName,t.login,t.username),n=je(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:
|
|
1778
1778
|
{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"github"}}function ib({workspace:e="",userKey:t=""}={}){
|
|
1779
1779
|
let r=gl(t,"user"),n=gl(e,"local");return{authorEmail:`${r}@${n}${rb}`,authorName:`${r} via Vibe64`,committerEmail:`vibe\
|
|
1780
|
-
64@${n}${rb}`,committerName:"Vibe64",source:"fallback"}}function nb(e=""){let t=
|
|
1780
|
+
64@${n}${rb}`,committerName:"Vibe64",source:"fallback"}}function nb(e=""){let t=k(e);if(!t||!IC.isAbsolute(t))return"";try{
|
|
1781
1781
|
return TC(t).isDirectory()?t:""}catch{return""}}function ob(e,t){let r=vC("git",["config","--get-regexp","^user\\.(name|e\
|
|
1782
1782
|
mail)$"],{...e?{cwd:e}:{},encoding:"utf8",env:t,stdio:["ignore","pipe","ignore"],timeout:AC});if(r.error||r.status!==0&&
|
|
1783
1783
|
r.status!==1)return null;let n={};for(let o of String(r.stdout||"").split(`
|
|
1784
|
-
`)){let i=/^user\.(name|email)(?: (.*))?$/iu.exec(o);i&&(n[i[1].toLowerCase()]=
|
|
1784
|
+
`)){let i=/^user\.(name|email)(?: (.*))?$/iu.exec(o);i&&(n[i[1].toLowerCase()]=k(i[2]))}return n}function sb({cwd:e="",env:t=null}={}){
|
|
1785
1785
|
if(!t||typeof t!="object")return null;let r={...t,PATH:process.env.PATH||t.PATH},n=nb(e),o=n&&ob(n,r)||ob(nb(t.HOME),r)||
|
|
1786
1786
|
{};return!o.name||!o.email?null:{authorEmail:o.email,authorName:o.name,committerEmail:o.email,committerName:o.name,source:"\
|
|
1787
1787
|
git-config"}}function ab({actor:e={},env:t=process.env,gitConfig:r=null,project:n={},session:o={},userKey:i=""}={}){let s=ie(
|
|
@@ -1793,7 +1793,7 @@ lr,ur,dr,rb,AC,OC,cn=d(()=>{G();cr="GIT_AUTHOR_NAME",lr="GIT_AUTHOR_EMAIL",ur="G
|
|
|
1793
1793
|
IL",rb=".users.vibe64.invalid",AC=2e3,OC=['git config --global user.name "Your Name"','git config --global user.email "y\
|
|
1794
1794
|
ou@example.com"'].join(`
|
|
1795
1795
|
`)});import yl from"node:path";function J({root:e=""}={}){return C(e||_t().runtimePackRoot)}function Sl(e=""){let t=J();return(t?
|
|
1796
|
-
bl[
|
|
1796
|
+
bl[k(e)]?.binDirs||[]:[]).map(n=>yl.join(t,n))}function _l(){let e=J();return e?[yl.join(e,"guard-bin")]:[]}function vl(){
|
|
1797
1797
|
let e=J();return e?[yl.join(e,"policy-bin")]:[]}var bl,El,Ce=d(()=>{G();or();bl=Object.freeze({awsebcli:{binDirs:["awseb\
|
|
1798
1798
|
cli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:["bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:[
|
|
1799
1799
|
"package.json","bun.lock","bun.lockb","package-lock.json"],managedCommands:["bun"]},composer:{binDirs:["composer/bin"],dependencyFiles:[
|
|
@@ -1841,13 +1841,13 @@ let r=C(e),n=C(t);if(!r||!n)return!1;let o=pb.relative(n,r);return!o||!o.startsW
|
|
|
1841
1841
|
actor:e={},request:t={}}={}){let r=t.credentialHome||{},n=C(r.home);if(!n)return{};let o=C(e.user?.home);if(e.requiresRealUser&&
|
|
1842
1842
|
o&&n!==o){let a=new Error("Command credential home must match the resolved real-user actor home.");throw a.code="vibe64_\
|
|
1843
1843
|
command_credential_home_actor_mismatch",a}if(!e.requiresRealUser&&MC(n)&&o&&!jC(n,o)){let a=new Error("A /home credentia\
|
|
1844
|
-
l directory requires a matching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=
|
|
1844
|
+
l directory requires a matching real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=k(
|
|
1845
1845
|
r.username||e.user?.username);return{...Ys({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...C(r.cacheRoot)?{XDG_CACHE_HOME:C(
|
|
1846
1846
|
r.cacheRoot)}:{},...C(r.configRoot)?{XDG_CONFIG_HOME:C(r.configRoot)}:{},...C(r.dataRoot)?{XDG_DATA_HOME:C(r.dataRoot)}:
|
|
1847
|
-
{},...C(r.stateRoot)?{XDG_STATE_HOME:C(r.stateRoot)}:{}}}var mb=d(()=>{Lt();G()});import hb from"node:path";function wb(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=
|
|
1847
|
+
{},...C(r.stateRoot)?{XDG_STATE_HOME:C(r.stateRoot)}:{}}}var mb=d(()=>{Lt();G()});import hb from"node:path";function wb(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=k(n);if(!o||!hb.
|
|
1848
1848
|
isAbsolute(o))continue;let i=hb.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function dn(e={},t=[]){let r={...e&&typeof e==
|
|
1849
1849
|
"object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?
|
|
1850
|
-
n:0;for(let i of Array.isArray(t)?t:[]){let s=
|
|
1850
|
+
n:0;for(let i of Array.isArray(t)?t:[]){let s=k(i?.key);s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(
|
|
1851
1851
|
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function yb(e=[]){return wb(e).map(t=>({key:"safe.directory",value:t}))}
|
|
1852
1852
|
function Al(e={},t=[]){return dn(e,yb(t))}function Ui(){return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"\
|
|
1853
1853
|
0",PAGER:"cat"}}function Ol(e={}){return dn(e,gb)}function bb(e={}){return dn(e,LC)}function BC(e={}){return dn(e,DC)}function Pl(e={}){
|
|
@@ -1862,7 +1862,7 @@ github-https"||e.purpose==="github")&&(r=Pl({...t,...Ui()})),Al(r,e.gitSafeDirec
|
|
|
1862
1862
|
BE64_GIT_AUTH_TOKEN"});import vb from"node:path";function Nl({env:e={}}={}){return J()?C(e?.[Cl])||(C(e?.HOME)?vb.join(C(e.HOME),".local"):""):
|
|
1863
1863
|
""}function kl(e={}){let t=Nl(e);return t?{[Cl]:t}:{}}function $l(e={}){let t=Nl(e);return t?[vb.join(t,"bin")]:[]}var Cl,
|
|
1864
1864
|
Ml=d(()=>{G();Ce();Cl="NPM_CONFIG_PREFIX"});import{existsSync as VC,readdirSync as FC}from"node:fs";import zC from"node:os";import tt from"node:path";import fr from"node:process";
|
|
1865
|
-
function pn(e=""){return String(e||"").split(":").map(
|
|
1865
|
+
function pn(e=""){return String(e||"").split(":").map(k).filter(Boolean)}function Ab(e=[]){return e.filter(t=>{try{return VC(
|
|
1866
1866
|
t)}catch{return!1}})}function Tb(e="",t=/^$/u){try{return FC(e).filter(r=>t.test(r)).sort((r,n)=>Number(/\d+/u.exec(n)?.[0]||
|
|
1867
1867
|
0)-Number(/\d+/u.exec(r)?.[0]||0))}catch{return[]}}function GC(e=fr.env){if(J())return[];let t=String(e.HOME||zC.homedir()||
|
|
1868
1868
|
"");if(!tt.isAbsolute(t))return[];let r=tt.isAbsolute(String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:tt.join(t,".local/sha\
|
|
@@ -1883,7 +1883,7 @@ env,localPath:r="",request:n={}}={}){let o=Array.isArray(n.runtimes)?n.runtimes.
|
|
|
1883
1883
|
t.XDG_RUNTIME_DIR||"").trim(),c={...Ks(e.user,YC(t)),...sr(e)&&qC.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...sn(...JC(t,n)),
|
|
1884
1884
|
...KC(n),..._b({actor:e,request:n}),...s,...fb({actor:e,request:n}),...i},l={...c,...kl({env:c}),VIBE64_DECLARED_RUNTIMES:o},
|
|
1885
1885
|
u=Ob({env:l,existingPath:[...$l({env:l}),l.PATH].filter(Boolean).join(":"),inheritedPath:r,runtimes:n.runtimes,shimDirs:n.
|
|
1886
|
-
shimDirs||[]}),
|
|
1886
|
+
shimDirs||[]}),f={...l,PATH:u,...J()?{}:{VIBE64_TOOL_PATH:u}};return{...f,...wl({actor:e,env:t,gitConfig:{cwd:n.cwd,env:f},
|
|
1887
1887
|
project:n.project,session:n.session,userKey:n.userKey})}}var WC,Vi=d(()=>{$i();Lt();an();Bi();an();mb();Rl();cn();cn();un();
|
|
1888
1888
|
Ml();jl();Ce();G();WC=new Set([...ar,lr,cr,dr,ur,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_\
|
|
1889
1889
|
DATA_HOME","XDG_RUNTIME_DIR"])});import{Buffer as ZC}from"node:buffer";import QC from"node:crypto";import{createRequire as eN}from"node:module";function iN(){
|
|
@@ -1943,24 +1943,24 @@ e.terminal.pid)){let t=new Error(`Terminal execution scope did not become empty:
|
|
|
1943
1943
|
ion_drain_failed",t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function vN(e){try{await e.
|
|
1944
1944
|
scopeDrainCompletion}catch(t){gr(e,t)}try{await Promise.all([$b(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){
|
|
1945
1945
|
gr(e,t)}Mb(e)}function Lb({args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s=null,
|
|
1946
|
-
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:
|
|
1947
|
-
detachedIdleTimeoutMs:
|
|
1948
|
-
[...S.values()].find(z=>Fl(z)&&
|
|
1949
|
-
|
|
1950
|
-
o,
|
|
1951
|
-
"function"?s({args:
|
|
1952
|
-
"object"&&!Array.isArray(
|
|
1946
|
+
namespace:a="default",namespaceLimitPrefix:c="",runningLimitFilter:l=null,onClose:u=null,onOutput:f=null,onStop:h=null,reuseRunning:p=!1,
|
|
1947
|
+
detachedIdleTimeoutMs:w=0}){let E=aN(a);if(E)return E;let S=Hi(a),m=QC.randomUUID(),g=typeof p=="function"?p:()=>!!p,y=p?
|
|
1948
|
+
[...S.values()].find(z=>Fl(z)&&g(z)):null;if(y)return hr(y);let v=Number(i||0),T=c||a;if(v>0&&bN({filter:l,namespacePrefix:T})>=
|
|
1949
|
+
v)return{ok:!1,code:"terminal_limit",error:`Terminal limit reached (${v}).`};let b=typeof o=="function"?o({id:m,namespace:a}):
|
|
1950
|
+
o,_=typeof e=="function"?e({env:b,id:m,namespace:a}):e,A=typeof r=="function"?r({args:_,env:b,id:m,namespace:a}):r,I=typeof s==
|
|
1951
|
+
"function"?s({args:_,env:b,id:m,namespace:a}):s,P=nN("node-pty").spawn(t,_,{cols:Dl,cwd:n,env:{...process.env,...b&&typeof b==
|
|
1952
|
+
"object"&&!Array.isArray(b)?b:{}},name:"xterm-color",rows:Bl}),L,$=new Promise(z=>{L=z}),N={id:m,closeHookCompletion:null,
|
|
1953
1953
|
closePromise:null,commandPreview:A,cols:Dl,createdAt:new Date().toISOString(),cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:Gi(
|
|
1954
|
-
|
|
1954
|
+
w),exitCompletion:$,exitCode:null,lastSubscriberAttachedAt:"",lastSubscriberDetachedAt:new Date().toISOString(),metadata:I&&
|
|
1955
1955
|
typeof I=="object"&&!Array.isArray(I)?I:{},onClose:u,onStop:h,inputVersion:0,lastInputAt:"",lastInputBytes:0,lastOutputAt:"",
|
|
1956
1956
|
lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,processExited:!1,
|
|
1957
|
-
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:
|
|
1958
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:
|
|
1959
|
-
output+z),ue(
|
|
1960
|
-
|
|
1961
|
-
inal output hook failed.");ue(
|
|
1962
|
-
z,
|
|
1963
|
-
vN(
|
|
1957
|
+
killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:L,rows:Bl,status:"running",stopHookCompletion:null,
|
|
1958
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:P};return yN(N),P.onData(z=>{if(hN(N,z),N.output=qi(N.
|
|
1959
|
+
output+z),ue(N,{chunk:z,lastOutputAt:N.lastOutputAt,outputVersion:N.outputVersion,type:"output"}),typeof f=="function")try{
|
|
1960
|
+
f({chunk:z,output:N.output,session:hr(N),updateMetadata(Z){return pN(N,Z)}})}catch(Z){let _e=String(Z?.message||Z||"Term\
|
|
1961
|
+
inal output hook failed.");ue(N,{error:_e,type:"error"})}Ul(N,a)}),P.onExit(({exitCode:z})=>{N.processExited=!0,N.exitCode=
|
|
1962
|
+
z,N.status="closing",jb(N),ue(N,{exitCode:z,status:N.status,type:"status"}),$b(N,N.stopReason||"exit"),N.resolveExitCompletion(),
|
|
1963
|
+
vN(N)}),S.set(m,N),Ul(N,a),TN(m,{namespace:a})}function TN(e,{namespace:t="default",outputLimit:r=0}={}){let o=Hi(t).get(
|
|
1964
1964
|
e);return o?hr(o,{outputLimit:r}):iN()}async function IN(e,t="stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=
|
|
1965
1965
|
String(t||"stop"),e.status==="running"&&(e.status="closing",ue(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];
|
|
1966
1966
|
if(_N(e,e.stopReason),!e.processExited&&!e.killStarted){e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;
|
|
@@ -1982,8 +1982,8 @@ function RN(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper pa
|
|
|
1982
1982
|
execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=zl.join(zl.resolve(t),"exec-helper-\
|
|
1983
1983
|
payloads");return PN(r,{mode:448,recursive:!0}),zl.join(r,`${process.pid}-${Date.now()}-${ON()}.json`)}function CN(e={},{
|
|
1984
1984
|
actor:t,baseEnv:r,localPath:n,cwd:o,env:i}={}){let s=e.terminal||{};return ki(t)?{args:(a={})=>{let c=RN(s.helperPayloadRoot),
|
|
1985
|
-
l=Vb(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,
|
|
1986
|
-
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:on(e)});return xN(c,`${JSON.stringify(
|
|
1985
|
+
l=Vb(e,{actor:t,baseEnv:r,policyEnv:i}),u=typeof e.args=="function"?e.args(a):e.args,f=nn({actor:t,args:u,command:e.command,
|
|
1986
|
+
cwd:o,env:typeof l=="function"?l(a):l,input:e.input,operation:on(e)});return xN(c,`${JSON.stringify(f)}
|
|
1987
1987
|
`,{mode:384}),["-n",rl(),"execute",c]},command:"sudo",cwd:s.helperPayloadRoot,env:{}}:{args:e.args,command:e.command,cwd:o,
|
|
1988
1988
|
env:Vb(e,{actor:t,baseEnv:r,localPath:n,policyEnv:i})}}function Vb(e={},{actor:t={},baseEnv:r={},localPath:n="",policyEnv:o={}}={}){
|
|
1989
1989
|
return typeof e.envFactory!="function"?o:(i={})=>mr({actor:t,baseEnv:r,localPath:n,request:{...e,env:ee(e.envFactory(i)),
|
|
@@ -1999,7 +1999,7 @@ let r=Gb.relative(e,t);return r===""||!r.startsWith("..")&&!Gb.isAbsolute(r)}fun
|
|
|
1999
1999
|
e),n=(Array.isArray(t)?t:[t]).map(C).filter(Boolean);if(n.length===0)return r;let o=n.filter(s=>Hb(s,r));if(o.length>0){
|
|
2000
2000
|
let s=zb(r);if(o.some(a=>Hb(zb(a),s)))return s}let i=new Error("Vibe64 command cwd is outside the allowed roots.");throw i.
|
|
2001
2001
|
code="vibe64_command_cwd_outside_allowed_roots",i}var Wb=d(()=>{G()});import{randomUUID as kN}from"node:crypto";function he(e="",t="vibe64_command_request_invalid"){let r=new Error(e||"Inval\
|
|
2002
|
-
id Vibe64 command request.");return r.code=t,r}function rt(e="",t=[],r="",n="value"){let o=
|
|
2002
|
+
id Vibe64 command request.");return r.code=t,r}function rt(e="",t=[],r="",n="value"){let o=k(e)||r;if(!t.includes(o))throw he(
|
|
2003
2003
|
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function zN(e=[],{mode:t="\
|
|
2004
2004
|
capture"}={}){if(typeof e=="function"){if(t!=="pty")throw he("Function-valued command args are only supported for PTY co\
|
|
2005
2005
|
mmands.","vibe64_command_args_function_requires_pty");return e}return(Array.isArray(e)?e:[e]).map(r=>String(r??""))}function GN(e={},{
|
|
@@ -2007,13 +2007,13 @@ mode:t="capture"}={}){if(typeof e=="function"){if(t!=="pty")throw he("Function-v
|
|
|
2007
2007
|
PTY commands.","vibe64_command_env_function_requires_pty");return{env:{},envFactory:e}}let r=ee(e);return pr(r),{env:r,envFactory:null}}
|
|
2008
2008
|
function Hl(e=[]){return(Array.isArray(e)?e:[e]).map(C).filter(Boolean)}function HN(e={}){let t=ie(e);return{commandPreview:t.
|
|
2009
2009
|
commandPreview,detachedIdleTimeoutMs:t.detachedIdleTimeoutMs,helperPayloadRoot:C(t.helperPayloadRoot||t.payloadRoot),maxRunning:t.
|
|
2010
|
-
maxRunning,metadata:t.metadata,namespace:
|
|
2010
|
+
maxRunning,metadata:t.metadata,namespace:k(t.namespace),namespaceLimitPrefix:k(t.namespaceLimitPrefix),onClose:t.onClose,
|
|
2011
2011
|
onOutput:t.onOutput,onStop:t.onStop,reuseRunning:t.reuseRunning,runningLimitFilter:t.runningLimitFilter}}function qN(e={}){
|
|
2012
2012
|
let t=ie(e),r=C(t.home||t.toolHomeSource);return r?{cacheRoot:C(t.cacheRoot),configRoot:C(t.configRoot),dataRoot:C(t.dataRoot),
|
|
2013
|
-
gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:
|
|
2014
|
-
uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:
|
|
2013
|
+
gid:Number.isSafeInteger(Number(t.gid??t.hostGid))?Number(t.gid??t.hostGid):null,home:r,scope:k(t.scope),stateRoot:C(t.stateRoot),
|
|
2014
|
+
uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null,username:k(t.username||t.ownerUserKey||
|
|
2015
2015
|
t.userKey)}:{}}function WN(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function YN({mode:e="\
|
|
2016
|
-
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function wr(e=""){let t=
|
|
2016
|
+
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function wr(e=""){let t=k(e);
|
|
2017
2017
|
if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw he(`Invalid Vibe64 execution ide\
|
|
2018
2018
|
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function Xb(e={},{mode:t="capture",project:r={},purpose:n="\
|
|
2019
2019
|
terminal",session:o={}}={}){let i=ie(e),s=rt(i.kind,Kb,YN({mode:t,purpose:n}),"execution_kind"),a=rt(i.lifecycle,Jb,WN(t),
|
|
@@ -2025,29 +2025,29 @@ tibilityKey","environment"].includes(u))||!/^[a-z0-9][a-z0-9_-]{0,127}$/u.test(l
|
|
|
2025
2025
|
"")||!["development","test","production"].includes(l.environment)))throw he("Invalid activity resource profile identity.",
|
|
2026
2026
|
"vibe64_resource_profile_invalid");return Object.freeze({...l?{resourceProfile:Object.freeze({...l})}:{},controlGenerationId:wr(
|
|
2027
2027
|
i.controlGenerationId),...i.workflowId===void 0||i.workflowId===null||i.workflowId===""?{}:{workflowId:KN(i.workflowId)},
|
|
2028
|
-
id:kN(),kind:s,label:
|
|
2028
|
+
id:kN(),kind:s,label:k(i.label),lifecycle:a,operationId:wr(i.operationId),ownerId:c,parentExecutionId:wr(i.parentExecutionId),
|
|
2029
2029
|
projectSlug:wr(i.projectSlug||r.slug||r.projectSlug),sessionId:wr(i.sessionId||o.sessionId||o.id)})}function KN(e){if(typeof e!=
|
|
2030
2030
|
"string"||!/^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e))throw he("Execution req\
|
|
2031
2031
|
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function JN(e=""){return FN.has(
|
|
2032
2032
|
e)?El:[]}function Yb(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function XN(e={},t=""){let r=Yb(e,"runt\
|
|
2033
2033
|
imes"),n=Yb(e,"runtime");if(!r&&!n)return ut(JN(t));let o=r?e.runtimes:e.runtime;return ut((Array.isArray(o)?o:[o]).map(
|
|
2034
|
-
|
|
2034
|
+
k).filter(Boolean))}function Zb(e={}){let t=ie(e),r=k(t.command);if(!r)throw he("A command is required.","vibe64_command\
|
|
2035
2035
|
_required");let n=rt(t.mode,jN,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
2036
2036
|
throw he("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=ee(t.baseEnv),i=GN(
|
|
2037
|
-
t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=rt(t.purpose,MN,"terminal","purpose"),a=XN(t,s);for(let
|
|
2038
|
-
|
|
2037
|
+
t.env!==void 0?t.env:t.extraEnv,{mode:n}),s=rt(t.purpose,MN,"terminal","purpose"),a=XN(t,s);for(let f of a)if(!UN.includes(
|
|
2038
|
+
f))throw he(`Unsupported Vibe64 runtime: ${f}.`,"vibe64_command_runtime_unsupported");let c=ie(t.project),l=ie(t.session),
|
|
2039
2039
|
u=t.releaseEnvironmentFile??"";if(typeof u!="string"||u&&(!u.startsWith("/")||/[\r\n\0]/u.test(u)||n!=="capture"||t.actor!==
|
|
2040
2040
|
"app"||t.envPolicy!=="deployment"||Object.keys(i.env).length||i.envFactory||Object.keys(o).length))throw he("Release env\
|
|
2041
2041
|
ironment files require a finite application deployment command without caller Env.","vibe64_command_release_environment_\
|
|
2042
2042
|
invalid");return{actor:rt(t.actor,$N,"daemon","actor"),allowedRoots:Hl(t.allowedRoots),args:zN(t.args,{mode:n}),baseEnv:o,
|
|
2043
2043
|
command:r,cwd:C(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,envPolicy:rt(t.envPolicy,DN,"session","env_polic\
|
|
2044
2044
|
y"),releaseEnvironmentFile:u,execution:Xb(t.execution,{mode:n,project:c,purpose:s,session:l}),credentialHome:qN(t.credentialHome),
|
|
2045
|
-
gitAuthToken:
|
|
2045
|
+
gitAuthToken:k(t.gitAuthToken||t.gitCredentials?.token),gitSafeDirectories:Hl(t.gitSafeDirectories||t.safeDirectories),gitTransport:rt(
|
|
2046
2046
|
t.gitTransport,BN,t.githubTransport?"github-https":"none","git_transport"),inheritProcessEnv:!u&&t.inheritProcessEnv!==!1,
|
|
2047
2047
|
input:t.stdin??t.input,logPath:C(t.logPath),maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Number(
|
|
2048
2048
|
t.maxBuffer):VN,mode:n,onOutput:typeof t.onOutput=="function"?t.onOutput:null,outputEncoding:rt(t.outputEncoding,LN,"utf\
|
|
2049
2049
|
8","output_encoding"),project:c,purpose:s,runtimes:a,session:l,signal:t.signal??null,shimDirs:Hl(t.shimDirs),terminal:HN(
|
|
2050
|
-
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:
|
|
2050
|
+
t.terminal||t.pty),timeout:Number.isSafeInteger(Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,userKey:k(
|
|
2051
2051
|
t.userKey)}}var $N,MN,jN,LN,DN,BN,Kb,Jb,UN,VN,FN,ql=d(()=>{G();Bi();Ce();$N=Object.freeze(["daemon","owner-user","named-\
|
|
2052
2052
|
user","app"]),MN=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview",
|
|
2053
2053
|
"output","deployment","health","workspace-cache","source"]),jN=Object.freeze(["capture","pty","detached"]),LN=Object.freeze(
|
|
@@ -2066,13 +2066,13 @@ cwd:o,env:i,input:e.input,operation:on(e)}),{maxBuffer:e.maxBuffer,outputEncodin
|
|
|
2066
2066
|
timeout}),execution:e.execution}:tn(e.command,e.args,{cwd:o,env:i,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,
|
|
2067
2067
|
onOutput:e.onOutput,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout})}async function yr(e={}){let t=null;
|
|
2068
2068
|
try{if(t=Zb(e),t.signal?.aborted)return K("Command cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Zy(
|
|
2069
|
-
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(
|
|
2069
|
+
t),n=t.inheritProcessEnv?{...process.env,...t.baseEnv}:{...t.baseEnv},o=(w={})=>({...w,VIBE64_EXECUTION_ID:t.execution.id}),
|
|
2070
2070
|
i=Wl(),s=Wi(n)||Wi(process.env),a=ki(r),c=!i&&!s&&!a&&!Ni(n)&&!Ni(process.env)&&sr(r)?[n.PATH,process.env.PATH].filter(Boolean).
|
|
2071
2071
|
join(":"):"",l=o(mr({actor:r,baseEnv:n,localPath:c,request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t}));tb(
|
|
2072
|
-
r,l);let u=qb(t.cwd,{allowedRoots:t.allowedRoots});eb(r,t,u);let
|
|
2073
|
-
t.envFactory?mr({actor:r,baseEnv:n,localPath:c,request:{...t,env:t.envFactory(
|
|
2074
|
-
|
|
2075
|
-
env:l,resolveArgs:
|
|
2072
|
+
r,l);let u=qb(t.cwd,{allowedRoots:t.allowedRoots});eb(r,t,u);let f=(w={})=>typeof t.args=="function"?t.args(w):t.args,h=(w={})=>o(
|
|
2073
|
+
t.envFactory?mr({actor:r,baseEnv:n,localPath:c,request:{...t,env:t.envFactory(w),envFactory:null}}):l),p=(w=t,E={})=>QN(
|
|
2074
|
+
w,{actor:r,baseEnv:n,localPath:c,cwd:u,env:l,requiresHelper:a,...E});return i?await i.runCommand(t,{actor:r,baseEnv:n,cwd:u,
|
|
2075
|
+
env:l,resolveArgs:f,resolveEnv:h,runLocal:p}):t.releaseEnvironmentFile?K("Release environment execution requires a manag\
|
|
2076
2076
|
ed host.","vibe64_release_environment_unavailable",{execution:t.execution}):s?K("Managed execution safety is unavailable\
|
|
2077
2077
|
. Vibe64 did not start this work.","vibe64_managed_execution_provider_unavailable",{execution:t.execution,retryable:!1}):
|
|
2078
2078
|
p()}catch(r){return K(r?.message||"Vibe64 command failed.",r?.code||"vibe64_command_failed",{execution:t?.execution})}}var fn=d(
|
|
@@ -2235,8 +2235,8 @@ r/bin/*) continue ;; esac; fi',` printf '%s\\n' "$found"`,' exec "$found" $ver
|
|
|
2235
2235
|
`)});var hk,mE=d(()=>{Ji();Ce();hk=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,
|
|
2236
2236
|
any:n}=Ki[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as gk}from"node:child_process";import{promisify as wk}from"node:util";var SY,hE=d(()=>{SY=wk(gk)});var gE=d(()=>{Wn();up();Lt();Oi();Xy();fn();rn();Yi();ql();eE();Vi();tE();rE();xl();nE();Rl();an();Bi();Ml();cn();oE();Yl();
|
|
2237
2237
|
aE();G();un();or();Ce();cE();Kl();lE();Jl();uE();dE();pE();Ji();fE();mE();hE();Kl()});import{createHash as yE}from"node:crypto";import{realpath as wE}from"node:fs/promises";async function mn(e){let t=await wE(
|
|
2238
|
-
e),r=async(c,l="utf8",{input:u,maxBuffer:
|
|
2239
|
-
...c],command:"git",cwd:t,envPolicy:"project",gitSafeDirectories:[t],input:u,maxBuffer:
|
|
2238
|
+
e),r=async(c,l="utf8",{input:u,maxBuffer:f=1024*1024}={})=>{let h=await yr({actor:"daemon",allowedRoots:[t],args:["-C",t,
|
|
2239
|
+
...c],command:"git",cwd:t,envPolicy:"project",gitSafeDirectories:[t],input:u,maxBuffer:f,mode:"capture",outputEncoding:l,
|
|
2240
2240
|
purpose:"source",runtimes:["git"],timeout:6e4});if(h.ok!==!0)throw Object.assign(new Error(h.error||"Git could not read \
|
|
2241
2241
|
the pinned topic."),{code:h.code});return l==="base64"?Buffer.from(h.stdout,"base64"):h.stdout.trim()};if(await wE(await r(
|
|
2242
2242
|
["rev-parse","--show-toplevel"]))!==t)throw new Error("Choose the topic repository root.");let n=await r(["rev-parse","H\
|
|
@@ -2245,11 +2245,11 @@ erating a pinned course manifest.");let o=await lt(t),i=JSON.parse(await r(["sho
|
|
|
2245
2245
|
url||"").match(/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+)\.git$/u)?.[1];if(!s)throw new Error("To\
|
|
2246
2246
|
pic package needs its canonical https://github.com/<owner>/learn-<topic>.git repository URL.");let a=ct([o.topicManifest,
|
|
2247
2247
|
...o.bundles.map(c=>c.manifest)]);for(let c=0;c<a.length;){let l=c,u=0;do u+=a[l].bytes+Buffer.byteLength(a[l].path)+128,
|
|
2248
|
-
l+=1;while(l<a.length&&u+a[l].bytes+Buffer.byteLength(a[l].path)+128<=1024*1024);let
|
|
2249
|
-
"--batch","-Z"],"base64",{input:
|
|
2250
|
-
indexOf(0,p),S=
|
|
2251
|
-
|
|
2252
|
-
`Topic input differs from its pinned commit: ${
|
|
2248
|
+
l+=1;while(l<a.length&&u+a[l].bytes+Buffer.byteLength(a[l].path)+128<=1024*1024);let f=a.slice(c,l),h=await r(["cat-file",
|
|
2249
|
+
"--batch","-Z"],"base64",{input:f.map(w=>`${n}:${w.path}\0`).join(""),maxBuffer:2*1024*1024}),p=0;for(let w of f){let E=h.
|
|
2250
|
+
indexOf(0,p),S=E<0?null:/^(?:[a-f0-9]{40}|[a-f0-9]{64}) blob (0|[1-9][0-9]*)$/u.exec(h.subarray(p,E).toString("ascii")),
|
|
2251
|
+
m=S?Number(S[1]):-1,g=E+1+m;if(m!==w.bytes||h[g]!==0||yE("sha256").update(h.subarray(E+1,g)).digest("hex")!==w.sha256)throw new Error(
|
|
2252
|
+
`Topic input differs from its pinned commit: ${w.path}.`);p=g+1}if(p!==h.length)throw new Error("Unexpected trailing dat\
|
|
2253
2253
|
a while reading the pinned topic.");c=l}if(await r(["rev-parse","HEAD"])!==n||await r(["status","--porcelain","--untrack\
|
|
2254
2254
|
ed-files=all"]))throw new Error("Topic changed during manifest generation. Commit and retry.");return{topicId:o.topic.topicId,
|
|
2255
2255
|
release:o.release,repository:s,commit:n,topicManifest:o.topicManifest,topicHash:o.topicHash}}function hn(e,t){let r=pe(Bn,
|
|
@@ -2259,11 +2259,11 @@ throw new Error(`Duplicate course topic: ${i.topicId}.`);n.add(i.topicId);let s=
|
|
|
2259
2259
|
i.release);if(s.length!==1)throw new Error(`Resolve exactly one pinned topic release: ${i.topicId}@${i.release}.`);let a=s[0];
|
|
2260
2260
|
if(!/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u.test(a.repository||"")||!/^[a-f0-9]{40}$/u.test(a.commit||""))throw new Error(
|
|
2261
2261
|
`Topic requires a repository and immutable commit: ${i.topicId}.`);let c=a.topicManifest;if(!c||c.schemaVersion!==1||c.topic?.
|
|
2262
|
-
topicId!==i.topicId||c.release!==i.release||yE("sha256").update(
|
|
2262
|
+
topicId!==i.topicId||c.release!==i.release||yE("sha256").update(D(c)).digest("hex")!==a.topicHash)throw new Error(`Topic\
|
|
2263
2263
|
manifest identity mismatch: ${i.topicId}.`);if(pe(Dn,c.topic,i.topicId),r.status==="released"&&c.topic.status!=="releas\
|
|
2264
2264
|
ed")throw new Error(`Released course requires a released topic: ${i.topicId}.`);let l=c.topic.lessons;if(!Array.isArray(
|
|
2265
2265
|
l)||!l.length||!Array.isArray(c.lessons)||l.length!==c.lessons.length)throw new Error(`Incomplete whole-topic inventory:\
|
|
2266
|
-
${i.topicId}.`);for(let[u,
|
|
2266
|
+
${i.topicId}.`);for(let[u,f]of l.entries()){let h=c.lessons[u];if(h.code!==f.code||h.status!==f.status||h.required!==f.
|
|
2267
2267
|
required||!/^[a-f0-9]{64}$/u.test(h.hash||""))throw new Error(`Changed whole-topic order or lesson identity: ${i.topicId}\
|
|
2268
2268
|
.`);if(r.status==="released"&&h.required&&h.status!=="published")throw new Error(`Released course includes required draf\
|
|
2269
2269
|
t: ${h.code}.`)}return{topicId:i.topicId,release:i.release,repository:a.repository,commit:a.commit,manifestHash:a.topicHash,
|
|
@@ -2284,86 +2284,86 @@ e,!1)).size>t)throw new Error(`Installed file exceeds its ${t}-byte limit.`);let
|
|
|
2284
2284
|
y entries.");let s=U.join(o,i.name);i.isDirectory()?await n(s):(await yn(s,!1),t.push(U.relative(e,s).split(U.sep).join(
|
|
2285
2285
|
"/")))}}return await n(e),t.sort()}function bn({systemRoot:e,allowDraftLessons:t=!1}={}){if(typeof e!="string"||!e||!U.isAbsolute(
|
|
2286
2286
|
e))throw new Error("Installed teaching content needs an absolute server-owned system root.");let r=U.resolve(e);if(typeof t!=
|
|
2287
|
-
"boolean")throw new TypeError("Draft lesson reads require a trusted server construction choice.");let n=new Map;function o(
|
|
2288
|
-
return Object.assign(new Error(`Lesson ${
|
|
2289
|
-
: ${
|
|
2290
|
-
SABLE",statusCode:422})}async function i(
|
|
2291
|
-
lesson)}))}}async function s({topicId:
|
|
2292
|
-
!Zl.test(
|
|
2293
|
-
ring"||!wn.test(
|
|
2294
|
-
stringify([
|
|
2295
|
-
await
|
|
2296
|
-
|
|
2297
|
-
"utf8")),{topicId:
|
|
2298
|
-
|
|
2299
|
-
topicHash,topicManifest
|
|
2300
|
-
code:de.code,hash:ke,status:LE,required:DE,manifest:BE}))};if(
|
|
2301
|
-
e, reordered, unsupported or changed from its source files.");if(
|
|
2302
|
-
A.topicHash)throw new Error("Installed topic identity differs from its pin.");let z=ct([
|
|
2303
|
-
de=>de.manifest)]);if(L
|
|
2304
|
-
files.");let Z=await br(U.join(
|
|
2287
|
+
"boolean")throw new TypeError("Draft lesson reads require a trusted server construction choice.");let n=new Map;function o(m){
|
|
2288
|
+
return Object.assign(new Error(`Lesson ${m.lesson.code} ("${m.lesson.title}") cannot be taught by this version of Vibe64\
|
|
2289
|
+
: ${m.problem} Update the course in Courses, or ask its authors for a fixed release.`),{code:"VIBE64_TRAINING_LESSON_UNU\
|
|
2290
|
+
SABLE",statusCode:422})}async function i(m={}){let g=await s(m);return{...g,bundles:g.bundles.map(y=>({...y,lesson:Xl(y.
|
|
2291
|
+
lesson)}))}}async function s({topicId:m,commit:g,topicHash:y}={}){if(typeof m!="string"||typeof g!="string"||!nt.test(m)||
|
|
2292
|
+
!Zl.test(g))throw new Error("Choose a valid topic ID and its exact 40-character lowercase Git commit.");if(typeof y!="st\
|
|
2293
|
+
ring"||!wn.test(y))throw new Error("Provide the trusted 64-character topic hash from the course or saved attempt.");let v=JSON.
|
|
2294
|
+
stringify([m,g,y]),T=n.get(v);return T||(T=a({topicId:m,commit:g,topicHash:y}).finally(()=>n.delete(v)),n.set(v,T)),structuredClone(
|
|
2295
|
+
await T)}async function a({topicId:m,commit:g,topicHash:y}){try{let v=U.join(r,"training"),T=U.join(v,"content"),b=U.join(
|
|
2296
|
+
T,m),_=U.join(b,g);for(let de of[r,v,T,b,_])await yn(de,!0);let A=vt(JSON.parse((await br(U.join(_,"pin.json"),4096)).toString(
|
|
2297
|
+
"utf8")),{topicId:m,commit:g,topicHash:y}),I=JSON.parse((await br(U.join(_,"bundle.json"),32*1024*1024)).toString("utf8")),
|
|
2298
|
+
P=U.join(_,"files"),L=await Ik(P),$=await lt(P,{installed:!0}),N={schemaVersion:1,topic:$.topic,release:$.release,topicHash:$.
|
|
2299
|
+
topicHash,topicManifest:$.topicManifest,lessons:$.bundles.map(({lesson:de,hash:ke,status:LE,required:DE,manifest:BE})=>({
|
|
2300
|
+
code:de.code,hash:ke,status:LE,required:DE,manifest:BE}))};if(D(I)!==D(N))throw new Error("Installed bundle is incomplet\
|
|
2301
|
+
e, reordered, unsupported or changed from its source files.");if($.topic.topicId!==A.topicId||$.release!==A.release||$.topicHash!==
|
|
2302
|
+
A.topicHash)throw new Error("Installed topic identity differs from its pin.");let z=ct([$.topicManifest,...$.bundles.map(
|
|
2303
|
+
de=>de.manifest)]);if(D(L)!==D(z.map(de=>de.path).sort()))throw new Error("Installed snapshot has missing or unrecorded \
|
|
2304
|
+
files.");let Z=await br(U.join(P,"package.json"),1024*1024),_e=z.find(de=>de.path==="package.json");if(Z.length!==_e.bytes||
|
|
2305
2305
|
Zi(Z)!==_e.sha256)throw new Error("Installed source changed during reading.");if(JSON.parse(Z.toString("utf8")).repository?.
|
|
2306
2306
|
url!==`https://github.com/${A.repository}.git`)throw new Error("Installed package repository URL differs from its canoni\
|
|
2307
|
-
cal pin.");return{pin:A
|
|
2308
|
-
t ${
|
|
2309
|
-
message} Ask the owner to reinstall the verified snapshot.`,{cause:
|
|
2310
|
-
"VIBE64_TRAINING_CONTENT_INVALID",
|
|
2311
|
-
|
|
2312
|
-
"Lesson requested an unrecorded installed file.");let I=await br(
|
|
2313
|
-
"Installed lesson changed while reading. Ask the owner to reinstall the verified snapshot.");return{path:
|
|
2314
|
-
topicId:
|
|
2315
|
-
test(
|
|
2316
|
-
"Choose an exact pinned topic and lesson identity.");try{let
|
|
2317
|
-
I=U.join(A,
|
|
2318
|
-
"utf8")),{topicId:
|
|
2319
|
-
|
|
2320
|
-
est differs from the trusted identity.");let
|
|
2321
|
-
lessons.find(ke=>ke.code===
|
|
2322
|
-
t differs from the trusted content hash.");if(
|
|
2323
|
-
t be taught. Choose a published lesson.`);let _e={pin:
|
|
2324
|
-
_e,".",z.descriptor),de=Ln(JSON.parse(En.bytes.toString("utf8")),
|
|
2325
|
-
criptor identity changed.");return{..._e,lesson:Xl(de)}}catch(
|
|
2326
|
-
invalid: ${
|
|
2327
|
-
|
|
2328
|
-
...
|
|
2329
|
-
string"||typeof
|
|
2330
|
-
aracter lowercase content hash.");let
|
|
2331
|
-
if(!
|
|
2332
|
-
`Lesson ${
|
|
2333
|
-
ent hash changed. Resume its exact pinned revision or explicitly start a new attempt.`);if(
|
|
2334
|
-
fromEntries(["places","activities","facts"].map(I=>[I,[...
|
|
2335
|
-
manifest,hash:
|
|
2336
|
-
|
|
2337
|
-
lesson.visuals){let
|
|
2338
|
-
let I=Un(
|
|
2339
|
-
bodyText
|
|
2340
|
-
visuals:
|
|
2341
|
-
|
|
2342
|
-
$`,"mu").exec(
|
|
2343
|
-
text.slice(I.position,
|
|
2344
|
-
stepId:
|
|
2345
|
-
|
|
2346
|
-
ep ${
|
|
2347
|
-
tep.`);return{pin:
|
|
2348
|
-
topicHash:
|
|
2349
|
-
red visual ID.");let
|
|
2350
|
-
if(!A)throw new Error(`Visual ${
|
|
2351
|
-
|
|
2352
|
-
pin:
|
|
2353
|
-
topicHash:
|
|
2354
|
-
ed check ID.");let
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
hash,check:A,file:
|
|
2358
|
-
admissionOnly:
|
|
2359
|
-
!0?l:
|
|
2360
|
-
new Error(`Lesson ${
|
|
2361
|
-
U.posix.dirname(I.descriptorPath),
|
|
2362
|
-
if(
|
|
2363
|
-
path.slice(
|
|
2364
|
-
readAdmissionIdentity:l,readVisual:
|
|
2307
|
+
cal pin.");return{pin:A,...$}}catch(v){let T=["ENOENT","ENOTDIR"].includes(v.code),b=new Error(T?`Pinned teaching conten\
|
|
2308
|
+
t ${m}@${g} is missing. Ask the owner to install that exact revision.`:`Pinned teaching content ${m}@${g} is invalid: ${v.
|
|
2309
|
+
message} Ask the owner to reinstall the verified snapshot.`,{cause:v});throw b.code=T?"VIBE64_TRAINING_CONTENT_MISSING":
|
|
2310
|
+
"VIBE64_TRAINING_CONTENT_INVALID",b}}async function c({pin:m,manifest:g},y,v){let T=U.join(r,"training","content",m.topicId,
|
|
2311
|
+
m.commit,"files"),b=U.resolve(T,y,v),_=U.relative(T,b).split(U.sep).join("/"),A=g.files.find(P=>P.path===_);if(!A)throw new Error(
|
|
2312
|
+
"Lesson requested an unrecorded installed file.");let I=await br(b,1024*1024);if(I.length!==A.bytes||Zi(I)!==A.sha256)throw new Error(
|
|
2313
|
+
"Installed lesson changed while reading. Ask the owner to reinstall the verified snapshot.");return{path:_,bytes:I}}async function l({
|
|
2314
|
+
topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T}={}){if(typeof m!="string"||!nt.test(m)||typeof g!="string"||!Zl.
|
|
2315
|
+
test(g)||typeof y!="string"||!wn.test(y)||typeof v!="string"||!nt.test(v)||typeof T!="string"||!wn.test(T))throw new Error(
|
|
2316
|
+
"Choose an exact pinned topic and lesson identity.");try{let b=U.join(r,"training"),_=U.join(b,"content"),A=U.join(_,m),
|
|
2317
|
+
I=U.join(A,g);for(let ke of[r,b,_,A,I])await yn(ke,!0);let P=vt(JSON.parse((await br(U.join(I,"pin.json"),4096)).toString(
|
|
2318
|
+
"utf8")),{topicId:m,commit:g,topicHash:y}),L=JSON.parse((await br(U.join(I,"bundle.json"),32*1024*1024)).toString("utf8")),
|
|
2319
|
+
$=L.topicManifest;if(!$||Zi(D($))!==y||$.topic.topicId!==m||$.release!==P.release)throw new Error("Installed topic manif\
|
|
2320
|
+
est differs from the trusted identity.");let N=$.lessons.find(ke=>ke.code===v),z=$.topic.lessons.find(ke=>ke.code===v),Z=L.
|
|
2321
|
+
lessons.find(ke=>ke.code===v);if(!N||!z||!Z||N.hash!==T||Zi(D(Z.manifest))!==T)throw new Error("Installed lesson manifes\
|
|
2322
|
+
t differs from the trusted content hash.");if(N.status!=="published"&&!t)throw new Error(`Lesson ${v} is draft and canno\
|
|
2323
|
+
t be taught. Choose a published lesson.`);let _e={pin:P,manifest:Z.manifest,hash:T,descriptorPath:z.descriptor},En=await c(
|
|
2324
|
+
_e,".",z.descriptor),de=Ln(JSON.parse(En.bytes.toString("utf8")),v);if(de.code!==v)throw new Error("Installed lesson des\
|
|
2325
|
+
criptor identity changed.");return{..._e,lesson:Xl(de)}}catch(b){let _=new Error(`Pinned teaching identity ${m}@${g} is \
|
|
2326
|
+
invalid: ${b.message} Ask the owner to restore the exact snapshot.`,{cause:b});throw _.code=["ENOENT","ENOTDIR"].includes(
|
|
2327
|
+
b.code)?"VIBE64_TRAINING_CONTENT_MISSING":"VIBE64_TRAINING_CONTENT_INVALID",_}}async function u(m={}){let g=await f(m);return{
|
|
2328
|
+
...g,lesson:Xl(g.lesson)}}async function f({topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T}={}){if(typeof v!="\
|
|
2329
|
+
string"||typeof T!="string"||!nt.test(v)||!wn.test(T))throw new Error("Choose a declared lesson code and its exact 64-ch\
|
|
2330
|
+
aracter lowercase content hash.");let b=await s({topicId:m,commit:g,topicHash:y}),_=b.bundles.find(I=>I.lesson.code===v);
|
|
2331
|
+
if(!_)throw new Error(`Lesson ${v} is not declared in this pinned topic.`);if(_.status!=="published"&&!t)throw new Error(
|
|
2332
|
+
`Lesson ${v} is draft and cannot be taught. Choose a published lesson.`);if(_.hash!==T)throw new Error(`Lesson ${v} cont\
|
|
2333
|
+
ent hash changed. Resume its exact pinned revision or explicitly start a new attempt.`);if(_.problem)throw o(_);let A=Object.
|
|
2334
|
+
fromEntries(["places","activities","facts"].map(I=>[I,[...b.topic[I]||[]]]));return{pin:b.pin,lesson:_.lesson,manifest:_.
|
|
2335
|
+
manifest,hash:_.hash,descriptorPath:_.descriptorPath,declarations:A}}async function h(m={}){let g=await u(m),y=U.dirname(
|
|
2336
|
+
g.descriptorPath);async function v(I){let P=await c(g,y,I);return{path:P.path,text:P.bytes.toString("utf8")}}let T=[];for(let I of g.
|
|
2337
|
+
lesson.visuals){let P=await v(I.descriptor);T.push({id:I.id,descriptorPath:P.path,visual:JSON.parse(P.text)})}if(Te(g.lesson)){
|
|
2338
|
+
let I=Un(g.declarations),P=[];for(let L of g.lesson.steps){let{body:$,beats:N}=Fn((await v(L.body)).text,I);P.push({...L,
|
|
2339
|
+
bodyText:$,...N?{beats:N}:{}})}return{...g,steps:P,...g.lesson.notes===void 0?{}:{notesText:(await v(g.lesson.notes)).text},
|
|
2340
|
+
visuals:T}}if(g.lesson.schemaVersion!==1)throw new Error(`Lesson ${g.lesson.code} uses an unsupported format.`);let b=await v(
|
|
2341
|
+
g.lesson.document),_=g.lesson.assessments.map(I=>({id:I.id,reference:I.rubric,position:new RegExp(`^<a id="${I.id}"></a>\
|
|
2342
|
+
$`,"mu").exec(b.text).index})).sort((I,P)=>I.position-P.position),A=_.map((I,P)=>({id:I.id,reference:I.reference,text:b.
|
|
2343
|
+
text.slice(I.position,_[P+1]?.position??b.text.length)}));return{...g,document:b,rubrics:A,visuals:T}}async function p({
|
|
2344
|
+
stepId:m,...g}={}){if(typeof m!="string"||!nt.test(m))throw new Error("Choose a declared step ID.");let{pin:y,lesson:v,hash:T}=await f(
|
|
2345
|
+
g);if(!Te(v))throw new Error(`Lesson ${v.code} has no steps.`);let b=v.steps.find(_=>_.id===m);if(!b)throw new Error(`St\
|
|
2346
|
+
ep ${m} is not declared in this pinned lesson.`);if(b.check.kind!=="choice")throw new Error(`Step ${m} is not a choice s\
|
|
2347
|
+
tep.`);return{pin:y,lessonCode:v.code,lessonHash:T,stepId:m,answer:[...b.check.answer]}}async function w({topicId:m,commit:g,
|
|
2348
|
+
topicHash:y,lessonCode:v,lessonHash:T,visualId:b}={}){if(typeof b!="string"||!nt.test(b))throw new Error("Choose a decla\
|
|
2349
|
+
red visual ID.");let _=await h({topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T}),A=_.visuals.find(N=>N.id===b);
|
|
2350
|
+
if(!A)throw new Error(`Visual ${b} is not declared in this pinned lesson.`);let I=U.dirname(A.descriptorPath),P=await c(
|
|
2351
|
+
_,I,A.visual.svg),L=await c(_,I,A.visual.controller),$=[];for(let N of A.visual.assets||[])$.push(await c(_,I,N));return{
|
|
2352
|
+
pin:_.pin,lessonCode:_.lesson.code,lessonHash:_.hash,...A,svg:P,controller:L,assets:$}}async function E({topicId:m,commit:g,
|
|
2353
|
+
topicHash:y,lessonCode:v,lessonHash:T,checkId:b}={}){if(typeof b!="string"||!nt.test(b))throw new Error("Choose a declar\
|
|
2354
|
+
ed check ID.");let _=await h({topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T}),A=_.lesson.checks?.find($=>$.id===
|
|
2355
|
+
b);if(!A)throw new Error(`Check ${b} is not declared in this pinned lesson.`);let I=U.dirname(_.descriptorPath),P=await c(
|
|
2356
|
+
_,I,A.file),L=[];for(let $ of A.assets||[])L.push(await c(_,I,$));return{pin:_.pin,lessonCode:_.lesson.code,lessonHash:_.
|
|
2357
|
+
hash,check:A,file:P,assets:L}}async function S({topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T,metadataOnly:b=!1,
|
|
2358
|
+
admissionOnly:_=!1}={}){if(_===!0&&b!==!0)throw new TypeError("Admission reads cannot supply exercise content.");let I=await(_===
|
|
2359
|
+
!0?l:b===!0?u:h)({topicId:m,commit:g,topicHash:y,lessonCode:v,lessonHash:T}),P=I.lesson.exercise;if(!P)throw Object.assign(
|
|
2360
|
+
new Error(`Lesson ${v} has no declared bundled exercise.`),{code:"VIBE64_TRAINING_EXERCISE_MISSING"});let L=U.posix.join(
|
|
2361
|
+
U.posix.dirname(I.descriptorPath),P.source),$={pin:I.pin,lessonCode:I.lesson.code,lessonHash:I.hash,exercise:P,sourcePath:L};
|
|
2362
|
+
if(b===!0)return $;let N=L==="."?"":`${L}/`,z=[];for(let Z of I.manifest.files){if(!Z.path.startsWith(N))continue;let _e=Z.
|
|
2363
|
+
path.slice(N.length),En=await c(I,L,_e);z.push({path:_e,bytes:En.bytes})}return{...$,files:z}}return{readTopic:i,readLesson:h,
|
|
2364
|
+
readAdmissionIdentity:l,readVisual:w,readCheck:E,readExercise:S,readChoiceAnswer:p}}var nt,Zl,wn,vk,gn,Tk,Zi,Ql=d(()=>{Mn();
|
|
2365
2365
|
jt();$t();Vs();Vn();nt=/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u,Zl=/^[a-f0-9]{40}$/u,wn=/^[a-f0-9]{64}$/u,vk=/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u,
|
|
2366
|
-
gn={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},Tk=
|
|
2366
|
+
gn={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},Tk=j({schemaVersion:{type:"integer",required:!0,enum:[
|
|
2367
2367
|
1]},topicId:{...gn,maxLength:64},release:gn,repository:gn,commit:{...gn,maxLength:40},topicHash:{...gn,maxLength:64}}),Zi=
|
|
2368
2368
|
e=>yk("sha256").update(e).digest("hex")});import{randomUUID as Ak}from"node:crypto";import{lstat as Ok,mkdir as tu,realpath as Pk,rename as xk,rm as Rk,writeFile as Ck}from"node:fs/promises";
|
|
2369
2369
|
import X from"node:path";function bE(e,t){if(typeof e!="string"||!X.isAbsolute(e)||X.resolve(e)!==e||e===X.parse(e).root)
|
|
@@ -2374,24 +2374,24 @@ await Ok(e)}catch(o){if(r&&o.code==="ENOENT")return null;throw o}if(n.isSymbolic
|
|
|
2374
2374
|
ining installation needs a regular ${t?"directory":"file"}: ${e}.`);if(!t&&(n.nlink!==1||n.size!==0))throw new Error("Tr\
|
|
2375
2375
|
aining installation lock must be an unaliased empty regular file; inspect it before retrying.");return n}async function Qi(e,t=!1){
|
|
2376
2376
|
let r=X.dirname(e);return r!==e&&await Qi(r,t),Ne(e,!0,t)}async function Nk(e){try{await tu(e,{mode:448})}catch(t){if(t.
|
|
2377
|
-
code!=="EEXIST")throw t}await Ne(e,!0,!1)}function es(e,t){if(
|
|
2377
|
+
code!=="EEXIST")throw t}await Ne(e,!0,!1)}function es(e,t){if(D(e)!==D(t))throw new Error("Topic source or installed sna\
|
|
2378
2378
|
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function eu(e,t){
|
|
2379
2379
|
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await mn(e);es({schemaVersion:1,topicId:r,release:n,repository:o,
|
|
2380
2380
|
commit:i,topicHash:s},t)}function SE({systemRoot:e}={}){let t=bE(e,"Training system root"),r=bn({systemRoot:t});async function n({
|
|
2381
2381
|
sourceRoot:o,pin:i}={}){let s={...vt(i)};bE(o,"Trusted topic source root");let a=X.join(t,"training");if(EE(o,a)||EE(a,o))
|
|
2382
2382
|
throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=X.join(a,"conte\
|
|
2383
|
-
nt"),l=X.join(c,s.topicId),u=X.join(l,s.commit),
|
|
2384
|
-
await Qi(t);let p=await Qi(o,!0);for(let
|
|
2383
|
+
nt"),l=X.join(c,s.topicId),u=X.join(l,s.commit),f=X.join(a,".install-locks"),h=X.join(f,`${s.topicId}-${s.commit}.lock`);
|
|
2384
|
+
await Qi(t);let p=await Qi(o,!0);for(let m of[a,c,l,f])await Ne(m,!0);if(await Ne(h,!1),await Ne(u,!0))es((await r.readTopic(
|
|
2385
2385
|
s)).pin,s);else{if(!p)throw new Error("Trusted topic source is missing. Prepare the approved local repository before ins\
|
|
2386
|
-
talling its pin.");await eu(o,s)}for(let
|
|
2387
|
-
revision is being installed. Retry after the current owner operation finishes.");throw
|
|
2388
|
-
USY",
|
|
2389
|
-
readTopic(s);return es(
|
|
2390
|
-
|
|
2391
|
-
if(await ru(["bundle",o,
|
|
2386
|
+
talling its pin.");await eu(o,s)}for(let m of[a,c,l,f])await Nk(m);let E=await ir(h);if(!E){let m=new Error("This topic \
|
|
2387
|
+
revision is being installed. Retry after the current owner operation finishes.");throw m.code="VIBE64_TRAINING_INSTALL_B\
|
|
2388
|
+
USY",m.statusCode=409,m}let S;try{await Ne(h,!1,!1);for(let T of[t,a,c,l,f])await Ne(T,!0,!1);if(await Ne(u,!0)){let T=await r.
|
|
2389
|
+
readTopic(s);return es(T.pin,s),{installed:!1,...T}}await Qi(o),await eu(o,s);let m=X.join(a,`.install-${Ak()}`);await tu(
|
|
2390
|
+
m,{mode:448}),S=m;let g=X.join(S,"training","content",s.topicId);await tu(g,{recursive:!0,mode:448});let y=X.join(g,s.commit);
|
|
2391
|
+
if(await ru(["bundle",o,y],{write(){}}),await eu(o,s),await Ck(X.join(y,"pin.json"),`${D(s)}
|
|
2392
2392
|
`,{flag:"wx",mode:384}),await bn({systemRoot:S}).readTopic(s),await Ne(l,!0,!1),await Ne(u,!0))throw new Error("The dest\
|
|
2393
|
-
ination appeared during installation. Keep it unchanged and retry the verified pin.");await xk(
|
|
2394
|
-
s);return es(
|
|
2393
|
+
ination appeared during installation. Keep it unchanged and retry the verified pin.");await xk(y,u);let v=await r.readTopic(
|
|
2394
|
+
s);return es(v.pin,s),{installed:!0,...v}}finally{try{S&&await Rk(S,{recursive:!0,force:!0})}finally{await E()}}}return{
|
|
2395
2395
|
installTopic:n}}var _E=d(()=>{Ri();Xi();nu();jt();Ql()});var vE=d(()=>{});import{randomUUID as kk}from"node:crypto";import{mkdir as $k,readFile as cJ,rename as Mk,rm as jk,writeFile as Lk}from"node:fs/promises";
|
|
2396
2396
|
import ts from"node:path";async function TE(e,t,{directoryMode:r,fileMode:n}={}){await $k(ts.dirname(e),{recursive:!0,mode:r});
|
|
2397
2397
|
let o=ts.join(ts.dirname(e),`.${ts.basename(e)}.${process.pid}.${kk()}.tmp`);try{await Lk(o,`${JSON.stringify(t,null,2)}\
|
|
@@ -2401,122 +2401,123 @@ import ot from"node:path";function ge(e,t,r,n){return Object.assign(new Error(t)
|
|
|
2401
2401
|
{}})}function iu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Supply the expected revision from a fresh installe\
|
|
2402
2402
|
d catalogue read.")}function su({systemRoot:e}={}){if(typeof e!="string"||!ot.isAbsolute(e)||ot.resolve(e)!==e||e===ot.parse(
|
|
2403
2403
|
e).root)throw new Error("Installed catalogue needs a canonical absolute, non-root server-owned system root.");let t=ot.join(
|
|
2404
|
-
e,"training"),r=ot.join(t,"catalogue.json"),n=ot.join(t,"catalogue.lock"),o=bn({systemRoot:e});async function i(){let
|
|
2405
|
-
t];for(let
|
|
2406
|
-
|
|
2407
|
-
!
|
|
2408
|
-
files.");if(
|
|
2409
|
-
data. Inspect it; do not unlink it.")}return{rootExists:
|
|
2410
|
-
isArray(
|
|
2411
|
-
selected whole topic in order.");let
|
|
2412
|
-
release,repository:
|
|
2413
|
-
throw new Error("Installed topic identity differs from the approved course lock.");
|
|
2414
|
-
title:
|
|
2415
|
-
code,hash:
|
|
2416
|
-
pin.commit,topicManifest:
|
|
2404
|
+
e,"training"),r=ot.join(t,"catalogue.json"),n=ot.join(t,"catalogue.lock"),o=bn({systemRoot:e});async function i(){let S=[
|
|
2405
|
+
t];for(let y=e;S.unshift(y),y!==ot.dirname(y);y=ot.dirname(y));let m=!1,g=null;for(let y of[...S,r,n]){let v;try{v=await Bk(
|
|
2406
|
+
y)}catch(b){if(b.code==="ENOENT")continue;throw b}let T=y!==r&&y!==n;if(v.isSymbolicLink()||await Fk(y)!==y||(T?!v.isDirectory():
|
|
2407
|
+
!v.isFile()||v.nlink!==1))throw new Error("Installed catalogue paths must be canonical directories and unaliased regular\
|
|
2408
|
+
files.");if(y===e&&(m=!0),y===r&&(g=v),y===n&&v.size!==0)throw new Error("Installed catalogue lock contains unexplained\
|
|
2409
|
+
data. Inspect it; do not unlink it.")}return{rootExists:m,catalogueStat:g}}async function s(S){let m=S.lock.topics;if(!Array.
|
|
2410
|
+
isArray(m)||m.length!==S.course.topics.length||m.length>32)throw new Error("The approved course lock must contain every \
|
|
2411
|
+
selected whole topic in order.");let g=[],y=[],v=[];for(let b of m){let _=vt({schemaVersion:1,topicId:b?.topicId,release:b?.
|
|
2412
|
+
release,repository:b?.repository,commit:b?.commit,topicHash:b?.manifestHash}),A=await o.readTopic(_);if(D(A.pin)!==D(_))
|
|
2413
|
+
throw new Error("Installed topic identity differs from the approved course lock.");v.push({topicId:_.topicId,release:_.release,
|
|
2414
|
+
title:A.topicManifest.topic.title});for(let I of A.bundles)y.push({topicId:_.topicId,topicRelease:_.release,code:I.lesson.
|
|
2415
|
+
code,hash:I.hash,title:I.lesson.title});g.push({topicId:A.pin.topicId,release:A.release,repository:A.pin.repository,commit:A.
|
|
2416
|
+
pin.commit,topicManifest:A.topicManifest,topicHash:A.topicHash})}let T=hn(S.course,g);if(D(S.lock)!==D(T))throw new Error(
|
|
2417
2417
|
"The approved course lock differs from the complete installed topic inventory. Regenerate and review its exact release.");
|
|
2418
|
-
return{lessonTitles:
|
|
2419
|
-
"Lesson title projection requires an explicit Boolean read option.");try{let{catalogueStat:
|
|
2420
|
-
revision:0,courses:[]};if(
|
|
2421
|
-
length>ou)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let
|
|
2422
|
-
stalled catalogue");if(
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
"Prepare the server-owned system root before changing the catalogue.");try{await Uk(t,{mode:448})}catch(
|
|
2429
|
-
EEXIST")throw
|
|
2430
|
-
g updated. Retry after the current owner operation finishes.",409);return
|
|
2418
|
+
return{lessonTitles:y,topicTitles:v}}async function a({includeLessonTitles:S=!1}={}){if(typeof S!="boolean")throw new TypeError(
|
|
2419
|
+
"Lesson title projection requires an explicit Boolean read option.");try{let{catalogueStat:m}=await i();if(!m)return{schemaVersion:1,
|
|
2420
|
+
revision:0,courses:[]};if(m.size>ou)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let g=await Vk(r);if(g.
|
|
2421
|
+
length>ou)throw new Error("Installed catalogue exceeds its 1 MiB limit.");let y=pe(zk,JSON.parse(g.toString("utf8")),"In\
|
|
2422
|
+
stalled catalogue");if(y.courses.length&&y.revision<1)throw new Error("Installed catalogue revision conflicts with its c\
|
|
2423
|
+
ourse inventory.");let v=new Set;for(let T of y.courses){let b=`${T.course.courseId}@${T.course.release}`;if(v.has(b))throw new Error(
|
|
2424
|
+
"Installed catalogue contains duplicate course releases.");v.add(b);let{lessonTitles:_,topicTitles:A}=await s(T);S&&Object.
|
|
2425
|
+
assign(T,{lessonTitles:_,topicTitles:A})}return y}catch(m){throw ge("VIBE64_TRAINING_CATALOGUE_INVALID",`Installed catal\
|
|
2426
|
+
ogue is invalid: ${m.message} Keep existing state and ask the owner to restore the exact approved catalogue or pinned co\
|
|
2427
|
+
ntent. No automatic repair was performed.`,null,m)}}async function c(){let{rootExists:S}=await i();if(!S)throw new Error(
|
|
2428
|
+
"Prepare the server-owned system root before changing the catalogue.");try{await Uk(t,{mode:448})}catch(g){if(g.code!=="\
|
|
2429
|
+
EEXIST")throw g}await i();let m=await ir(n);if(!m)throw ge("VIBE64_TRAINING_CATALOGUE_BUSY","Installed catalogue is bein\
|
|
2430
|
+
g updated. Retry after the current owner operation finishes.",409);return m}function l(S,m){if(S.revision!==m)throw ge("\
|
|
2431
2431
|
VIBE64_TRAINING_CATALOGUE_REVISION_CONFLICT","Installed catalogue changed. Read its current revision before deliberately\
|
|
2432
|
-
retrying this enablement change.",409)}async function u(
|
|
2433
|
-
nstalled catalogue reached its revision limit. No change was written.");let
|
|
2434
|
-
`${JSON.stringify(
|
|
2435
|
-
`)>ou)throw new Error("Installed catalogue exceeds its 1 MiB limit. No change was written.");try{await TE(r,
|
|
2436
|
-
fileMode:384})}catch(
|
|
2432
|
+
retrying this enablement change.",409)}async function u(S,m){if(S.revision===Number.MAX_SAFE_INTEGER)throw new Error("I\
|
|
2433
|
+
nstalled catalogue reached its revision limit. No change was written.");let g={...S,revision:S.revision+1};if(Buffer.byteLength(
|
|
2434
|
+
`${JSON.stringify(g,null,2)}
|
|
2435
|
+
`)>ou)throw new Error("Installed catalogue exceeds its 1 MiB limit. No change was written.");try{await TE(r,g,{directoryMode:448,
|
|
2436
|
+
fileMode:384})}catch(y){throw ge("VIBE64_TRAINING_CATALOGUE_SAVE_UNCONFIRMED","Catalogue save was not confirmed; atomic \
|
|
2437
2437
|
rename may already have succeeded. Read the current catalogue before deliberately retrying. Do not assume the course cha\
|
|
2438
|
-
nged or remained unchanged.",null,
|
|
2439
|
-
iu(
|
|
2440
|
-
try{let
|
|
2441
|
-
|
|
2438
|
+
nged or remained unchanged.",null,y)}return{revision:g.revision,entry:m,changed:!0}}async function f({course:S,lock:m,expectedRevision:g}={}){
|
|
2439
|
+
iu(g);let y=structuredClone(pe(AE,{course:S,lock:m,enabled:!0},"Approved installed course"));await a(),await s(y);let v=await c();
|
|
2440
|
+
try{let T=await a();l(T,g),await s(y);let b=T.courses.find(_=>_.course.courseId===y.course.courseId&&_.course.release===
|
|
2441
|
+
y.course.release);if(b){if(D(b.course)!==D(y.course)||D(b.lock)!==D(y.lock))throw ge("VIBE64_TRAINING_COURSE_RELEASE_CON\
|
|
2442
2442
|
FLICT","This installed course release is immutable. Resume its approved pin or publish and approve a different course re\
|
|
2443
|
-
lease.",409);return
|
|
2444
|
-
rs)throw new Error("Installed catalogue reached its 16 course-release limit.
|
|
2445
|
-
courses.push(
|
|
2446
|
-
typeof
|
|
2447
|
-
"Disable an exact installed course ID and three-
|
|
2448
|
-
course.release===
|
|
2449
|
-
|
|
2450
|
-
courseId===
|
|
2451
|
-
the catalogue. Read the current catalogue before retrying.",
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
new Set(
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2443
|
+
lease.",409);return b.enabled?{revision:T.revision,entry:b,changed:!1}:(b.enabled=!0,await u(T,b))}if(T.courses.length>=
|
|
2444
|
+
rs)throw new Error("Installed catalogue reached its 16 course-release limit. Remove a release with vibe64 training remov\
|
|
2445
|
+
e-course to free a place; no release was removed.");return T.courses.push(y),await u(T,y)}finally{await v()}}async function h({
|
|
2446
|
+
courseId:S,release:m,expectedRevision:g}={},y){if(iu(g),typeof S!="string"||!/^[a-z][a-z0-9-]{0,63}$/u.test(S)||typeof m!=
|
|
2447
|
+
"string"||!/^\d+\.\d+\.\d+$/u.test(m))throw new Error(`${y?"Remove":"Disable"} an exact installed course ID and three-pa\
|
|
2448
|
+
rt release.`);if(!(await a()).courses.some(b=>b.course.courseId===S&&b.course.release===m))throw ge("VIBE64_TRAINING_COU\
|
|
2449
|
+
RSE_MISSING","This course release is not installed in the catalogue. Read the current catalogue before retrying.",404);let T=await c();
|
|
2450
|
+
try{let b=await a();l(b,g);let _=b.courses.find(A=>A.course.courseId===S&&A.course.release===m);if(!_)throw ge("VIBE64_T\
|
|
2451
|
+
RAINING_COURSE_MISSING","This course release is no longer in the catalogue. Read the current catalogue before retrying.",
|
|
2452
|
+
404);return y?(b.courses=b.courses.filter(A=>A!==_),await u(b,_)):_.enabled?(_.enabled=!1,await u(b,_)):{revision:b.revision,
|
|
2453
|
+
entry:_,changed:!1}}finally{await T()}}let p=S=>h(S,!1),w=S=>h(S,!0);async function E({title:S,topics:m,expectedRevision:g}={}){
|
|
2454
|
+
iu(g);let y=typeof S=="string"?S.trim():"";if(!y||y.length>120)throw ge("VIBE64_TRAINING_COURSE_INVALID","Name the cours\
|
|
2455
|
+
e with 1 to 120 characters.",400);if(!Array.isArray(m)||!m.length||m.length>32||new Set(m.map(P=>`${P?.topicId}@${P?.release}`)).
|
|
2456
|
+
size!==m.length||new Set(m.map(P=>P?.topicId)).size!==m.length)throw ge("VIBE64_TRAINING_COURSE_INVALID","Choose 1 to 32\
|
|
2457
|
+
different whole topics for the course.",400);let v=await a(),T=v.courses.filter(P=>P.enabled&&P.course.status==="releas\
|
|
2458
|
+
ed").flatMap(P=>P.lock.topics),b=[];for(let P of m){let L=T.find(N=>N.topicId===P.topicId&&N.release===P.release);if(!L)
|
|
2459
|
+
throw ge("VIBE64_TRAINING_COURSE_TOPIC_UNAVAILABLE",`Topic ${P.topicId}@${P.release} is not part of an enabled released \
|
|
2460
|
+
course. Refresh courses and choose an installed topic.`,404);let $=await o.readTopic(vt({schemaVersion:1,topicId:L.topicId,
|
|
2461
|
+
release:L.release,repository:L.repository,commit:L.commit,topicHash:L.manifestHash}));b.push({topicId:$.pin.topicId,release:$.
|
|
2462
|
+
release,repository:$.pin.repository,commit:$.pin.commit,topicManifest:$.topicManifest,topicHash:$.topicHash})}let A={schemaVersion:1,
|
|
2463
|
+
courseId:`custom-${y.toLowerCase().replace(/[^a-z0-9]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,48).replace(/-+$/u,"")||Dk(
|
|
2464
|
+
"sha256").update(y).digest("hex").slice(0,12)}`,title:y,release:"1.0.0",status:"released",topics:m.map(P=>({topicId:P.topicId,
|
|
2465
|
+
release:P.release}))},I=v.courses.find(P=>P.course.courseId===A.courseId);if(I&&D(I.course)!==D(A))throw ge("VIBE64_TRAI\
|
|
2466
|
+
NING_COURSE_EXISTS","A course with this name already exists. Choose another name.",409);if(!I&&v.courses.length>=rs)throw ge(
|
|
2467
|
+
"VIBE64_TRAINING_COURSE_LIMIT",`This installation already has ${rs} course releases. No course was created.`,409);return f(
|
|
2468
|
+
{course:A,lock:hn(A,b),expectedRevision:g})}return{readCatalogue:a,enableCourse:f,disableCourse:p,removeCourse:w,createCourse:E}}
|
|
2469
|
+
var rs,ou,AE,zk,OE=d(()=>{Mn();Ri();IE();Xi();jt();$t();Ql();rs=16,ou=1024*1024,AE=j({course:{type:"object",required:!0,
|
|
2470
|
+
schema:Bn},lock:{type:"object",required:!0},enabled:{type:"boolean",required:!0}}),zk=j({schemaVersion:{type:"integer",required:!0,
|
|
2471
|
+
enum:[1]},revision:{type:"integer",required:!0,min:0,max:Number.MAX_SAFE_INTEGER},courses:V(AE,rs)})});var RE={};cu(RE,{runTrainingCli:()=>ru});import{mkdir as PE,readFile as ns,realpath as Er,rename as Gk,rm as xE,writeFile as au}from"node:fs/promises";
|
|
2471
2472
|
import q from"node:path";import{createHash as Hk,randomUUID as qk}from"node:crypto";async function ru(e,{write:t=r=>console.
|
|
2472
2473
|
log(r)}={}){if(e[0]==="install-topic"){let[,c,l]=e;if(e.length!==3||!c||!l)throw new Error("Usage: vibe64 training insta\
|
|
2473
|
-
ll-topic <committed-topic-directory> <system-root>");let u=await Er(c),{topicId:
|
|
2474
|
-
u),S={schemaVersion:1,topicId:
|
|
2475
|
-
{sourceRoot:u,pin:S});return t(JSON.stringify({ok:!0,installed:
|
|
2474
|
+
ll-topic <committed-topic-directory> <system-root>");let u=await Er(c),{topicId:f,release:h,repository:p,commit:w,topicHash:E}=await mn(
|
|
2475
|
+
u),S={schemaVersion:1,topicId:f,release:h,repository:p,commit:w,topicHash:E},m=await SE({systemRoot:q.resolve(l)}).installTopic(
|
|
2476
|
+
{sourceRoot:u,pin:S});return t(JSON.stringify({ok:!0,installed:m.installed,pin:m.pin},null,2)),0}if(e[0]==="installed-co\
|
|
2476
2477
|
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await su(
|
|
2477
|
-
{systemRoot:q.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(
|
|
2478
|
-
e[0]
|
|
2479
|
-
Number(h)))throw new Error(c==="enable-course"?"Usage: vibe64 training enable-course <course
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
l,"utf8")),lock:JSON.parse(await ns(u,"utf8")),expectedRevision:
|
|
2483
|
-
return t(JSON.stringify({ok:!0,...
|
|
2484
|
-
"Usage: vibe64 training publish-manifest <course.
|
|
2485
|
-
q.dirname(q.resolve(c))),"course.lock.json");if(
|
|
2486
|
-
|
|
2487
|
-
S),
|
|
2488
|
-
must be outside every pinned source topic.");await lt(
|
|
2489
|
-
try{await au(
|
|
2490
|
-
`,{flag:"wx"}),await Gk(
|
|
2491
|
-
status,lockPath:
|
|
2478
|
+
{systemRoot:q.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(["enable-course","disab\
|
|
2479
|
+
le-course","remove-course"].includes(e[0])){let[c,l,u,f,h]=e;if(e.length!==5||!l||!u||!f||!/^(0|[1-9][0-9]*)$/u.test(h||
|
|
2480
|
+
"")||!Number.isSafeInteger(Number(h)))throw new Error(c==="enable-course"?"Usage: vibe64 training enable-course <course.\
|
|
2481
|
+
json> <course.lock.json> <system-root> <expected-revision>":`Usage: vibe64 training ${c} <courseId> <release> <system-ro\
|
|
2482
|
+
ot> <expected-revision>`);let p=su({systemRoot:q.resolve(f)}),w=Number(h),E=c==="enable-course"?await p.enableCourse({course:JSON.
|
|
2483
|
+
parse(await ns(l,"utf8")),lock:JSON.parse(await ns(u,"utf8")),expectedRevision:w}):await p[c==="remove-course"?"removeCo\
|
|
2484
|
+
urse":"disableCourse"]({courseId:l,release:u,expectedRevision:w});return t(JSON.stringify({ok:!0,...E},null,2)),0}if(e[0]===
|
|
2485
|
+
"publish-manifest"){let[,c,...l]=e;if(!c||!l.length)throw new Error("Usage: vibe64 training publish-manifest <course.jso\
|
|
2486
|
+
n> <committed-topic-directory...>");let u=await Er(c),f=q.join(await Er(q.dirname(q.resolve(c))),"course.lock.json");if(f===
|
|
2487
|
+
u||q.basename(c)==="course.lock.json")throw new Error("Course lock output must not replace its input course descriptor.");
|
|
2488
|
+
let h=JSON.parse(await ns(u,"utf8")),p=[];for(let S of l){let m=await Er(S),g=q.relative(m,f);if(!g||!g.startsWith(`..${q.
|
|
2489
|
+
sep}`)&&g!==".."&&!q.isAbsolute(g))throw new Error("Course lock output must be outside every pinned source topic.");await lt(
|
|
2490
|
+
m,{authoring:!0}),p.push(await mn(m))}let w=hn(h,p),E=`${f}.tmp-${qk()}`;try{await au(E,`${D(w)}
|
|
2491
|
+
`,{flag:"wx"}),await Gk(E,f)}finally{await xE(E,{force:!0})}return t(JSON.stringify({ok:!0,courseId:w.courseId,status:w.
|
|
2492
|
+
status,lockPath:f,topics:w.topics.length},null,2)),0}let[r,n,o]=e;if(!["validate","bundle"].includes(r)||!n||r==="bundle"&&
|
|
2492
2493
|
!o||e.length!==(r==="bundle"?3:2))throw new Error("Usage: vibe64 training validate <topic-directory> | bundle <topic-dir\
|
|
2493
2494
|
ectory> <new-output-directory>");let i=await Er(n),s=await lt(i,{authoring:r==="validate"}),a={schemaVersion:1,topic:s.topic,
|
|
2494
|
-
release:s.release,topicHash:s.topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:l,status:u,required:
|
|
2495
|
-
manifest:h})=>({code:c.code,hash:l,status:u,required:
|
|
2495
|
+
release:s.release,topicHash:s.topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:l,status:u,required:f,
|
|
2496
|
+
manifest:h})=>({code:c.code,hash:l,status:u,required:f,manifest:h}))};if(r==="bundle"){let c=q.resolve(o),l=q.join(await Er(
|
|
2496
2497
|
q.dirname(c)),q.basename(c)),u=q.relative(i,l);if(!u||!u.startsWith(`..${q.sep}`)&&u!==".."&&!q.isAbsolute(u))throw new Error(
|
|
2497
|
-
"Bundle output must be outside the source topic.");await PE(l);try{let
|
|
2498
|
-
for(let h of
|
|
2499
|
-
rce changed during bundling: ${h.path}. Validate and retry.`);let
|
|
2500
|
-
await au(
|
|
2501
|
-
`,{flag:"wx"})}catch(
|
|
2498
|
+
"Bundle output must be outside the source topic.");await PE(l);try{let f=ct([s.topicManifest,...s.bundles.map(h=>h.manifest)]);
|
|
2499
|
+
for(let h of f){let p=await ns(q.join(i,h.path));if(Hk("sha256").update(p).digest("hex")!==h.sha256)throw new Error(`Sou\
|
|
2500
|
+
rce changed during bundling: ${h.path}. Validate and retry.`);let w=q.join(l,"files",h.path);await PE(q.dirname(w),{recursive:!0}),
|
|
2501
|
+
await au(w,p,{flag:"wx"})}await au(q.join(l,"bundle.json"),`${D(a)}
|
|
2502
|
+
`,{flag:"wx"})}catch(f){throw await xE(l,{recursive:!0,force:!0}),f}}return t(JSON.stringify({ok:!0,topicId:s.topic.topicId,
|
|
2502
2503
|
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:l,status:u})=>({code:c.code,hash:l,status:u,schemaVersion:c.
|
|
2503
2504
|
schemaVersion,...c.stage?{stage:c.stage}:{},...Te(c)?{steps:c.steps.length}:{}}))},null,2)),0}var nu=d(()=>{jt();$t();Xi();
|
|
2504
2505
|
_E();OE()});import{spawn as NE}from"node:child_process";import{readFileSync as Yk,realpathSync as kE}from"node:fs";import{release as os}from"node:os";
|
|
2505
|
-
import
|
|
2506
|
+
import M from"node:process";import It from"node:path";import{fileURLToPath as Kk}from"node:url";var Wk=new URL("./run.js",
|
|
2506
2507
|
import.meta.url).href,$E=Kk(Wk),ME=It.dirname($E),At=It.join(ME,"server.js");function Sr(e=""){return`'${String(e).replaceAll(
|
|
2507
2508
|
"'","'\\''")}'`}function Jk(e=""){return JSON.stringify(String(e))}function Tt(e=""){return`"${String(e).replaceAll('"',
|
|
2508
2509
|
'\\"')}"`}function Xk(e="",t=[]){return[Tt(e),...t.map(r=>Tt(r))].join(" ")}function CE(e,t=kE){let r=It.resolve(String(
|
|
2509
|
-
e||""));try{return t(r)}catch{return r}}function Zk({argv:e
|
|
2510
|
-
CE(n,r)===CE(t,r):!1}function jE(e
|
|
2511
|
-
t"}function Qk({env:e
|
|
2512
|
-
e.WSL_INTEROP||"").trim()?!0:/\bmicrosoft\b|\bwsl\b/iu.test(String(t||""))}function e$({nodePath:e
|
|
2513
|
-
serverArgs:r=[]}={}){return[Sr(e),Sr(t),...r.map(n=>Sr(n))].join(" ")}function t$({cwd:e
|
|
2510
|
+
e||""));try{return t(r)}catch{return r}}function Zk({argv:e=M.argv,entrypointPath:t=$E,realpath:r=kE}={}){let n=e[1];return n?
|
|
2511
|
+
CE(n,r)===CE(t,r):!1}function jE(e=M.cwd(),t=M.platform){return(t==="win32"?It.win32.basename(e):It.basename(e))||"targe\
|
|
2512
|
+
t"}function Qk({env:e=M.env,osReleaseText:t=os(),platform:r=M.platform}={}){return r!=="linux"?!1:String(e.WSL_DISTRO_NAME||
|
|
2513
|
+
e.WSL_INTEROP||"").trim()?!0:/\bmicrosoft\b|\bwsl\b/iu.test(String(t||""))}function e$({nodePath:e=M.execPath,serverPath:t=At,
|
|
2514
|
+
serverArgs:r=[]}={}){return[Sr(e),Sr(t),...r.map(n=>Sr(n))].join(" ")}function t$({cwd:e=M.cwd(),nodePath:t=M.execPath,serverPath:r=At,
|
|
2514
2515
|
serverArgs:n=[]}={}){let o=[Tt(t),Tt(r),...n.map(i=>Tt(i))].join(" ");return[`cd /d ${Tt(e)}`,"if errorlevel 1 (set VIBE\
|
|
2515
2516
|
64_STATUS=!ERRORLEVEL! & echo. & echo Vibe64 could not enter the target directory. Exit status !VIBE64_STATUS!. & set /p\
|
|
2516
2517
|
VIBE64_PAUSE=Press Enter to close this terminal... & exit /b !VIBE64_STATUS!)",o,"if errorlevel 1 (set VIBE64_STATUS=!E\
|
|
2517
2518
|
RRORLEVEL! & echo. & echo Vibe64 server exited with status !VIBE64_STATUS!. & set /p VIBE64_PAUSE=Press Enter to close t\
|
|
2518
2519
|
his terminal... & exit /b !VIBE64_STATUS!)","exit /b 0"].join(`\r
|
|
2519
|
-
`)}function r$({cwd:e
|
|
2520
|
+
`)}function r$({cwd:e=M.cwd(),nodePath:t=M.execPath,serverArgs:r=[],serverPath:n=At,title:o=`Vibe64 - ${It.basename(M.cwd())||
|
|
2520
2521
|
"target"}`}={}){return["finish_vibe64_terminal() {",' status="$1"',' message="$2"',' if [ "$status" -ne 0 ]; then',` \
|
|
2521
2522
|
printf '\\n%s Exit status %s. Press Enter to close this terminal...' "$message" "$status"`," IFS= read -r _"," fi",
|
|
2522
2523
|
' exit "$status"',"}",`cd ${Sr(e)}`,"status=$?",'if [ "$status" -ne 0 ]; then',' finish_vibe64_terminal "$status" "Vib\
|
|
@@ -2524,10 +2525,10 @@ e64 could not enter the target directory."',"fi",`printf '\\033]0;%s\\007' ${Sr(
|
|
|
2524
2525
|
'finish_vibe64_terminal "$?" "Vibe64 server exited."'].join(`
|
|
2525
2526
|
`)}function n$(e=""){return`printf %s ${Buffer.from(String(e||""),"utf8").toString("base64")} | base64 -d | bash`}function o$({
|
|
2526
2527
|
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",n$(t)]}function i$({
|
|
2527
|
-
cwd:e
|
|
2528
|
+
cwd:e=M.cwd(),env:t=M.env,shellScript:r="",title:n=`Vibe64 - ${jE(e,"linux")}`}={}){let o=o$({distroName:t.WSL_DISTRO_NAME,
|
|
2528
2529
|
shellScript:r});return[{command:"wt.exe",args:["new-window","--title",n,"wsl.exe",...o]},{command:"cmd.exe",args:["/d","\
|
|
2529
|
-
/c",`start ${Tt(n)} ${Xk("wsl.exe",o)}`]}]}function s$({cwd:e
|
|
2530
|
-
platform:o
|
|
2530
|
+
/c",`start ${Tt(n)} ${Xk("wsl.exe",o)}`]}]}function s$({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=os(),
|
|
2531
|
+
platform:o=M.platform,serverArgs:i=[],serverPath:s=At}={}){let a=`Vibe64 - ${jE(e,o)}`,c=r$({cwd:e,nodePath:r,serverArgs:i,
|
|
2531
2532
|
serverPath:s,title:a});if(o==="darwin")return[{command:"osascript",args:["-e",['tell application "Terminal"',"activate",
|
|
2532
2533
|
`do script ${Jk(c)}`,"end tell"].join(`
|
|
2533
2534
|
`)]}];if(o==="win32")return[{command:"cmd.exe",args:["/c","start",a,"cmd.exe","/v:on","/c",t$({cwd:e,nodePath:r,serverArgs:i,
|
|
@@ -2536,26 +2537,26 @@ args:["-e","bash","-lc",c]},{command:"gnome-terminal",args:["--","bash","-lc",c]
|
|
|
2536
2537
|
-lc",c]},{command:"xfce4-terminal",args:["--command",`bash -lc ${Sr(c)}`]},{command:"xterm",args:["-e","bash","-lc",c]}].
|
|
2537
2538
|
filter(Boolean);return Qk({env:t,osReleaseText:n,platform:o})?[...i$({cwd:e,env:t,shellScript:c,title:a}),...l]:l}function a$(e,t=[],r={}){
|
|
2538
2539
|
return new Promise((n,o)=>{let i=NE(e,t,{...r,detached:!0,stdio:"ignore"});i.once("error",o),i.once("spawn",()=>{i.unref(),
|
|
2539
|
-
n(i)})})}async function c$({cwd:e
|
|
2540
|
+
n(i)})})}async function c$({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=os(),platform:o=M.platform,serverArgs:i=[],
|
|
2540
2541
|
serverPath:s=At}={}){let a=s$({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),c=[];for(let l of a)
|
|
2541
2542
|
try{return await a$(l.command,l.args,{cwd:e,env:t}),l}catch(u){c.push(u)}throw new AggregateError(c,"No supported termin\
|
|
2542
|
-
al emulator could be started.")}async function l$({cwd:e
|
|
2543
|
+
al emulator could be started.")}async function l$({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,serverArgs:n=[],serverPath:o=At}={}){
|
|
2543
2544
|
let i=NE(r,[o,...n],{cwd:e,env:t,stdio:"inherit"});return new Promise((s,a)=>{i.once("error",a),i.once("exit",(c,l)=>{if(l){
|
|
2544
2545
|
s(1);return}s(Number(c||0))})})}function u$(e=It.join(ME,"..","package.json")){try{return/^\D*(\d+)/u.exec(String(JSON.parse(
|
|
2545
|
-
Yk(e,"utf8")).engines?.node||""))?.[1]||""}catch{return""}}function d$(e
|
|
2546
|
-
terprises/vibe64/blob/main/docs/colleague-usage/${e==="darwin"?"set-up-macos":"set-up-linux"}.md`}function p$({platform:e
|
|
2547
|
-
platform,nodeVersion:t
|
|
2546
|
+
Yk(e,"utf8")).engines?.node||""))?.[1]||""}catch{return""}}function d$(e=M.platform){return`https://github.com/mobily-en\
|
|
2547
|
+
terprises/vibe64/blob/main/docs/colleague-usage/${e==="darwin"?"set-up-macos":"set-up-linux"}.md`}function p$({platform:e=M.
|
|
2548
|
+
platform,nodeVersion:t=M.versions.node,requiredMajor:r=u$()}={}){if(e==="win32")return["Vibe64 runs on Windows inside WS\
|
|
2548
2549
|
L2 (Ubuntu), not in PowerShell or Command Prompt.","Step by step: https://github.com/mobily-enterprises/vibe64/blob/main\
|
|
2549
2550
|
/docs/colleague-usage/set-up-windows.md"].join(`
|
|
2550
2551
|
`);let n=String(t||"").split(".")[0];return r&&n!==r?[`Vibe64 needs Node.js ${r}; this is Node.js ${t}.`,`To install it \
|
|
2551
2552
|
with mise, run: curl -fsSL https://mise.run | sh && ~/.local/bin/mise use -g node@${r}`,"Then add mise to your shell, op\
|
|
2552
2553
|
en a new terminal and run npx vibe64 again:",`${d$(e)}#nodejs-and-mise`].join(`
|
|
2553
|
-
`):""}async function f$({cwd:e
|
|
2554
|
+
`):""}async function f$({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=os(),platform:o=M.platform,serverArgs:i=M.
|
|
2554
2555
|
argv.slice(2),serverPath:s=At}={}){try{return await c$({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),
|
|
2555
2556
|
console.log("Vibe64 is starting in a new terminal window."),0}catch(a){return console.warn(`${a.message} Starting Vibe64\
|
|
2556
2557
|
in this terminal instead.`),l$({cwd:e,env:t,nodePath:r,serverArgs:i,serverPath:s})}}if(Zk()){let e={spec:()=>Promise.resolve().then(()=>(Mu(),$u)).
|
|
2557
|
-
then(({runAgentSpecCli:n})=>n(
|
|
2558
|
-
|
|
2559
|
-
n}).catch(n=>{console.error("Failed to run Vibe64:",n)
|
|
2558
|
+
then(({runAgentSpecCli:n})=>n(M.argv.slice(3))),training:()=>Promise.resolve().then(()=>(nu(),RE)).then(({runTrainingCli:n})=>n(
|
|
2559
|
+
M.argv.slice(3)))},t=p$();t&&(console.error(t),M.exit(1)),(Object.hasOwn(e,M.argv[2])?e[M.argv[2]]():f$()).then(n=>{M.exitCode=
|
|
2560
|
+
n}).catch(n=>{console.error("Failed to run Vibe64:",n),M.exitCode=1})}export{At as SERVER_ENTRYPOINT,Zk as isDirectCliExecution,Qk as isWslEnvironment,c$ as launchInNewTerminal,p$ as launcherProblem,
|
|
2560
2561
|
Sr as quoteShellArg,f$ as runLauncher,e$ as serverShellCommand,t$ as serverWindowsCommand,jE as targetNameFromCwd,s$ as terminalLaunchCandidates,
|
|
2561
2562
|
r$ as terminalShellScript,o$ as wslServerCommandArgs,i$ as wslTerminalLaunchCandidates};
|