vibe64 0.1.68 → 0.1.69
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 +644 -644
- package/bin/upgrade-state.js +2163 -2170
- package/node_modules/@local/vibe64-execution/package.json +1 -0
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +638 -634
- package/node_modules/@local/vibe64-genesis/src/server/agentSpecs.js +148 -120
- package/node_modules/@local/vibe64-genesis/src/server/index.js +612 -525
- package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +50 -46
- package/package.json +1 -1
- package/server.bundle.mjs +27333 -27361
package/bin/run.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __vibe64CreateRequire } from 'node:module';const require=__vibe64CreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
3
|
+
var cg=Object.create;var Bo=Object.defineProperty;var ug=Object.getOwnPropertyDescriptor;var lg=Object.getOwnPropertyNames;var dg=Object.getPrototypeOf,fg=Object.prototype.hasOwnProperty;var X=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){
|
|
4
4
|
if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zo=(e,t)=>{for(var r in t)
|
|
5
|
-
Bo(e,r,{get:t[r],enumerable:!0})},
|
|
6
|
-
e,o)&&o!==r&&Bo(e,o,{get:()=>t[o],enumerable:!(n=
|
|
7
|
-
ditor/src/server/agentSpecs.js",import.meta.url).href,Qa=e=>()=>
|
|
5
|
+
Bo(e,r,{get:t[r],enumerable:!0})},pg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lg(t))!fg.call(
|
|
6
|
+
e,o)&&o!==r&&Bo(e,o,{get:()=>t[o],enumerable:!(n=ug(t,o))||n.enumerable});return e};var mg=(e,t,r)=>(r=e!=null?cg(dg(e)):{},pg(t||!e||!e.__esModule?Bo(r,"default",{value:e,enumerable:!0}):r,e));import{readFile as _g}from"node:fs/promises";var wg,Qa,ec,tc=b(()=>{wg=new URL("./../node_modules/@local/vibe64-source-e\
|
|
7
|
+
ditor/src/server/agentSpecs.js",import.meta.url).href,Qa=e=>()=>_g(new URL(`../../docs/${e}`,wg),"utf8"),ec=Object.freeze(
|
|
8
8
|
[{name:"integration-setup-command",title:"Integration setup command protocol and integrations.json",text:Qa("application\
|
|
9
9
|
-integration-setup.md")},{name:"integration-payments-laravel",title:"Implementing the integration setup payment operatio\
|
|
10
|
-
ns in Laravel",text:Qa("application-payments-laravel.md")}])});var tr,Yr,
|
|
10
|
+
ns in Laravel",text:Qa("application-payments-laravel.md")}])});var tr,Yr,bg,Jr,rc=b(()=>{tr="email",Yr="login",bg="user-id",Jr=Object.freeze([tr,Yr,bg])});function F(e,{fallback:t=""}={}){return String(e||"").trim()||t}function St(e){return String(e??"").trim()}function ue(e,{
|
|
11
11
|
fallback:t={}}={}){return H(e)?e:{...t}}function H(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}var KA,U=b(()=>{
|
|
12
12
|
KA=Object.freeze(["none","pending","committed","rolledBack","unknown"])});function Kr(e){return H(e)?{...e}:{}}var Go=b(()=>{U()});var ie,Xr=b(()=>{Go();ie=class extends Error{constructor(t,r,n={}){super(r,n.cause===void 0?void 0:{cause:n.cause}),this.
|
|
13
13
|
name="AppError",this.status=Number(t)||500,this.statusCode=this.status,this.code=n.code||"APP_ERROR",this.params=Kr(n.params),
|
|
14
14
|
n.messageCode&&(this.messageCode=String(n.messageCode),this.messageParams=Kr(n.messageParams)),this.details=n.details,this.
|
|
15
15
|
headers=n.headers||{}}}});var nc=b(()=>{U()});var oc=b(()=>{U()});function Q(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||
|
|
16
|
-
|
|
16
|
+
Sg(t)}function Sg(e){return e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null&&Reflect.ownKeys(e).length===0}
|
|
17
17
|
var vt=b(()=>{});function Fo(e){return e!==null&&typeof e=="object"&&Q(e.structure)&&Q(e.operations)&&typeof e.validateWith=="function"&&
|
|
18
18
|
typeof e.toJsonSchema=="function"&&typeof e.cleanup=="function"}function Zr(e,t){if(!Object.hasOwn(t,"items"))return null;
|
|
19
19
|
let{items:r}=t;if(Fo(r))return{kind:"schema",schema:r};if(!Q(r)||typeof r.type!="string")throw new Error(`Array field "${e}\
|
|
@@ -31,87 +31,87 @@ if(Q(e))for(let[r,n]of Object.entries(e)){if(!Q(n))continue;let o=t?`${t}.${r}`:
|
|
|
31
31
|
hasOwn(n,i))continue;let s=n[i];if(n.type!=="array"||!Number.isInteger(s)||s<0)throw new Error(`Field "${o}" ${i} must b\
|
|
32
32
|
e a non-negative integer on an array field.`)}if(n.minItems>n.maxItems)throw new Error(`Field "${o}" minItems (${n.minItems}\
|
|
33
33
|
) is above its maxItems (${n.maxItems}).`);n.type==="array"&&Q(n.items)&&typeof n.items.type=="string"&&qo({"[]":n.items},
|
|
34
|
-
o)}}var en=b(()=>{vt()});function
|
|
35
|
-
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=
|
|
34
|
+
o)}}var en=b(()=>{vt()});function Ag(e){return e%4===0&&(e%100!==0||e%400===0)}function Pg(e,t){return t===2?Ag(e)?29:28:Rg[t-1]}function pc(e,t,r){
|
|
35
|
+
let n=Number(e),o=Number(t),i=Number(r);return o>=1&&o<=12&&i>=1&&i<=Pg(n,o)}function nr(e,t){let r=e.temporalPrecision;
|
|
36
36
|
if(r!==void 0){if(!Number.isInteger(r)||r<0)throw new Error(`temporalPrecision for "${t}" must be a non-negative integer\
|
|
37
37
|
.`);return r}}function mc(e,t){return e===void 0?!0:t===void 0||e.length<=t}function hc(e){if(typeof e!="string")return!1;
|
|
38
|
-
let t=
|
|
39
|
-
null&&mc(r[1],t)}function yc(e,t){if(typeof e!="string")return!1;let r=
|
|
38
|
+
let t=vg.exec(e);return t!==null&&pc(t[1],t[2],t[3])}function gc(e,t){if(typeof e!="string")return!1;let r=Tg.exec(e);return r!==
|
|
39
|
+
null&&mc(r[1],t)}function yc(e,t){if(typeof e!="string")return!1;let r=Ig.exec(e);return r===null?!1:pc(r[1],r[2],r[3])&&
|
|
40
40
|
mc(r[4],t)}function wc(e){return e===void 0?"(?:\\.\\d+)?":e===0?"":`(?:\\.\\d{1,${e}})?`}function _c(e,t){let r=nr(e,t);
|
|
41
41
|
return`^${tn}(?::${It}${wc(r)})?$`}function bc(e,t){let r=nr(e,t);return`^${dc}T${tn}:${It}${wc(r)}${uc}$`}function Yo(e,t){
|
|
42
|
-
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&
|
|
43
|
-
r)||r<-t||r>t?null:r===0?0:r}var Wo,ic,sc,ac,cc,It,tn,uc,lc,dc,fc,
|
|
42
|
+
let r;if(typeof e=="number")r=e;else if(typeof e=="string"&&Og.test(e))r=Number(e);else return null;return!Number.isSafeInteger(
|
|
43
|
+
r)||r<-t||r>t?null:r===0?0:r}var Wo,ic,sc,ac,cc,It,tn,uc,lc,dc,fc,vg,Tg,Ig,Og,Rg,Jo=b(()=>{Wo="^(?:0|-?[1-9]\\d*)$",ic="\
|
|
44
44
|
\\d{4}",sc="0[1-9]|1[0-2]",ac="0[1-9]|[12]\\d|3[01]",cc="[01]\\d|2[0-3]",It="[0-5]\\d",tn=`(?:${cc}):${It}`,uc=`(?:Z|[+-\
|
|
45
|
-
](?:${cc}):${It})`,lc=`(${ic})-(${sc})-(${ac})`,dc=`${ic}-(?:${sc})-(?:${ac})`,fc=`^${dc}$`,
|
|
46
|
-
new RegExp(`^${tn}(?::${It}(?:\\.(\\d+))?)?$`),
|
|
47
|
-
|
|
48
|
-
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function
|
|
45
|
+
](?:${cc}):${It})`,lc=`(${ic})-(${sc})-(${ac})`,dc=`${ic}-(?:${sc})-(?:${ac})`,fc=`^${dc}$`,vg=new RegExp(`^${lc}$`),Tg=
|
|
46
|
+
new RegExp(`^${tn}(?::${It}(?:\\.(\\d+))?)?$`),Ig=new RegExp(`^${lc}T${tn}:${It}(?:\\.(\\d+))?${uc}$`),Og=new RegExp(Wo),
|
|
47
|
+
Rg=[31,28,31,30,31,30,31,31,30,31,30,31]});function N(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0})}function Ng(e,t){if(Cg.
|
|
48
|
+
has(e))throw new Error(`${t}() received unsafe path segment "${e}".`)}function jg(e){return typeof e!="string"?e:e.replace(
|
|
49
49
|
/\[(.+?)\]/g,".$1").replace(/^\.+/,"").replace(/\.+/g,".").replace(/\.$/,"")}function Ko(e,t,{normalize:r=!1,allowEmpty:n=!1}={}){
|
|
50
|
-
let o=r?
|
|
50
|
+
let o=r?jg(e):e;if(typeof o!="string"||o.trim()===""){if(n&&o==="")return[];throw new Error(`${t}() expects a non-empty \
|
|
51
51
|
dotted path string.`)}let i=o.split(".");if(i.some(s=>s===""))throw new Error(`${t}() received an invalid path "${o}".`);
|
|
52
|
-
for(let s of i)
|
|
52
|
+
for(let s of i)Ng(s,t);return i}var Cg,or=b(()=>{Cg=new Set(["__proto__","prototype","constructor"])});function Ec(e){return{anyOf:[{type:"integer",minimum:-e,maximum:e},{type:"string",pattern:Wo}]}}function et(e,t){return{
|
|
53
53
|
[De]:{[e]:t}}}function ri(e,t){for(let r of Object.keys(t)){let n=t[r],o=e[r];if(n&&o&&typeof n=="object"&&typeof o=="ob\
|
|
54
|
-
ject"&&!Array.isArray(n)&&!Array.isArray(o)){ri(o,n);continue}e[r]=n}}function
|
|
54
|
+
ject"&&!Array.isArray(n)&&!Array.isArray(o)){ri(o,n);continue}e[r]=n}}function Dg(e,t){if(!t||typeof t!="object"||Array.
|
|
55
55
|
isArray(t))throw new Error("JSON Schema export hooks must return an object or null.");for(let r of Object.keys(t)){if(r===
|
|
56
56
|
De&&e[r]&&typeof e[r]=="object"&&typeof t[r]=="object"&&!Array.isArray(e[r])&&!Array.isArray(t[r])){ri(e[r],t[r]);continue}
|
|
57
|
-
e[r]=t[r]}}function
|
|
58
|
-
1?e:{anyOf:n}}function
|
|
59
|
-
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n
|
|
60
|
-
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function
|
|
61
|
-
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=
|
|
57
|
+
e[r]=t[r]}}function Vg(e,t){let n=[...Array.isArray(e.anyOf)&&Object.keys(e).length===1?e.anyOf:[e],...t];return n.length===
|
|
58
|
+
1?e:{anyOf:n}}function Ug(e,t){if(!Object.hasOwn(e.types,t.type))throw new Error(`No casting function for type: ${t.type}`);
|
|
59
|
+
let r=e.types[t.type];if(typeof r.toJsonSchema=="function")return r.toJsonSchema;let n=Lg[t.type];if(!n)throw new Error(
|
|
60
|
+
`Type '${t.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return n}function Bg(e,t,r){if(!Object.
|
|
61
|
+
hasOwn(e.validators,t))return null;let n=e.validators[t];if(typeof n.toJsonSchema=="function")return n.toJsonSchema;let o=Mg[t];
|
|
62
62
|
if(o)return o;throw new Error(`Validator '${t}' on field '${r}' cannot be exported to JSON Schema without a toJsonSchema\
|
|
63
63
|
hook.`)}function Sc(e){if(e===void 0)return"create";if(["create","replace","patch"].includes(e))return e;throw new Error(
|
|
64
|
-
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function
|
|
64
|
+
`Unsupported JSON Schema export mode '${e}'. Expected 'create', 'replace', or 'patch'.`)}function zg(e,t={}){if(t.mode!==
|
|
65
65
|
void 0&&t.operation!==void 0){let r=Sc(t.mode);if(r!==t.operation)throw new Error(`Conflicting JSON Schema export option\
|
|
66
66
|
s: mode '${r}' does not match operation '${t.operation}'.`)}if(t.operation!==void 0){if(!Object.hasOwn(e.operations,t.operation))
|
|
67
|
-
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Sc(t.mode)}function
|
|
67
|
+
throw new Error(`Unknown JSON Schema export operation '${t.operation}'.`);return t.operation}return Sc(t.mode)}function Gg(e,t={}){
|
|
68
68
|
if(t.operationName!==void 0&&t.operationDescriptor!==void 0)return{operationName:t.operationName,operation:t.operationDescriptor};
|
|
69
|
-
let r=
|
|
69
|
+
let r=zg(e,t);return{operationName:r,operation:e.operations[r]}}function Fg(e={}){let t={...e};return Object.defineProperty(
|
|
70
70
|
t,Zo,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:!1}),t}function nn(e={}){return e[Zo]?
|
|
71
|
-
e[Zo]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function
|
|
71
|
+
e[Zo]:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function Hg(e){return String(e).replace(/[^a-zA-Z0-9]+/g,
|
|
72
72
|
"_").replace(/^_+|_+$/g,"")||"operation"}function Qo(e){return Q(e)&&Object.keys(e).length===1&&typeof e.$ref=="string"}
|
|
73
|
-
function rn(e){return Qo(e)?{allOf:[e]}:e}function
|
|
74
|
-
r&&i.operation===n&&i.additionalProperties===o)||null}function
|
|
75
|
-
return e.nextDefinitionId+=1,n}function vc(e,t,r,n,o,{root:i=!1}={}){let s=nn(t),a=
|
|
73
|
+
function rn(e){return Qo(e)?{allOf:[e]}:e}function qg(e,t,r,n,o){return e.nodes.find(i=>i.schema===t&&i.operationName===
|
|
74
|
+
r&&i.operation===n&&i.additionalProperties===o)||null}function Wg(e,t){let r=Hg(t),n=`SchemaNode_${e.nextDefinitionId}_${r}`;
|
|
75
|
+
return e.nextDefinitionId+=1,n}function vc(e,t,r,n,o,{root:i=!1}={}){let s=nn(t),a=qg(s,e,r,n,o);if(a)return i&&(a.pointer=
|
|
76
76
|
"#",s.rootNode=a),a;let c={schema:e,operationName:r,operation:n,additionalProperties:o,status:"new",definitionName:i?null:
|
|
77
|
-
|
|
77
|
+
Wg(s,r),pointer:i?"#":null};return i?s.rootNode=c:c.pointer=`#/definitions/${c.definitionName}`,s.nodes.push(c),c}function Tc(e,t){
|
|
78
78
|
if(e.status==="built")return{$ref:e.pointer};if(e.status==="building")return{$ref:e.pointer};let r=nn(t);e.status="build\
|
|
79
|
-
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=
|
|
79
|
+
ing",e.pointer!=="#"&&(r.definitions[e.definitionName]={});let n=Yg(e.schema,t,e.operationName,e.operation,e.additionalProperties);
|
|
80
80
|
return e.status="built",e.pointer==="#"?n:(r.definitions[e.definitionName]=n,{$ref:e.pointer})}function ni(e,t,r,n,o=!1){
|
|
81
81
|
let i=nn(t),s=vc(e,t,r,n,o);return i.rootNode===s?{$ref:"#"}:Tc(s,t)}function ir(e,{referenceBacked:t=!1}={}){return{schema:e,
|
|
82
|
-
referenceBacked:t}}function
|
|
82
|
+
referenceBacked:t}}function Yg(e,t,r,n,o=!1){let i={},s=[];for(let[c,u]of Object.entries(e.structure))N(i,c,oi(e,c,u,t,r,
|
|
83
83
|
n)),n.enforceRequired&&u.required===!0&&s.push(c);let a={type:"object",properties:i,additionalProperties:o};return s.length>
|
|
84
|
-
0&&(a.required=s),a}function
|
|
84
|
+
0&&(a.required=s),a}function Jg(e,t,r,n,o,i){let s=Zr(t,r);if(!s)return null;if(s.kind==="schema")return{...rn(ni(s.schema,
|
|
85
85
|
n,"replace",s.schema.operations.replace,!1)),[De]:{castType:"object"}};let a=r.items.type==="object"&&Object.hasOwn(r.items,
|
|
86
|
-
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return oi(e,`${t}[]`,r.items,n,a,c)}function
|
|
86
|
+
"schema")?"replace":o,c=a==="replace"?e.operations.replace:i;return oi(e,`${t}[]`,r.items,n,a,c)}function Kg(e,t,r,n,o,i){
|
|
87
87
|
let s=rr(t,r);if(!s)return null;if(s.kind==="schema")return{...rn(ni(s.schema,n,"replace",s.schema.operations.replace,!1)),
|
|
88
88
|
[De]:{castType:"object"}};let a=s.definition.type==="object"&&Object.hasOwn(s.definition,"schema")?"replace":o,c=a==="re\
|
|
89
|
-
place"?e.operations.replace:i;return oi(e,`${t}.*`,s.definition,n,a,c)}function
|
|
89
|
+
place"?e.operations.replace:i;return oi(e,`${t}.*`,s.definition,n,a,c)}function Xg(e,t,r,n,o,i){if(r.type==="object"){let a=Qr(
|
|
90
90
|
t,r);if(a.kind==="nested")return ir(ni(a.schema,n,o,i,a.allowAdditionalProperties===!0),{referenceBacked:!0});if(a.kind===
|
|
91
|
-
"opaque")return ir({type:"object",additionalProperties:!0});if(a.kind==="map")return ir({type:"object",additionalProperties:
|
|
92
|
-
e,t,r,n,o,i)})}let s=
|
|
91
|
+
"opaque")return ir({type:"object",additionalProperties:!0});if(a.kind==="map")return ir({type:"object",additionalProperties:Kg(
|
|
92
|
+
e,t,r,n,o,i)})}let s=Ug(e,r)({schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n});if(!s||typeof s!="object"||
|
|
93
93
|
Array.isArray(s))throw new Error(`Type '${r.type}' on field '${t}' returned an invalid JSON Schema fragment.`);if(r.type===
|
|
94
|
-
"array"){let a=
|
|
95
|
-
function oi(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=
|
|
94
|
+
"array"){let a=Jg(e,t,r,n,o,i);if(a)return ir({...s,items:a},{referenceBacked:Qo(s)})}return ir(s,{referenceBacked:Qo(s)})}
|
|
95
|
+
function oi(e,t,r,n,o,i){let s={schema:e,fieldName:t,definition:r,operation:o,mode:o,options:n},a=Xg(e,t,r,n,o,i),c=a.referenceBacked?
|
|
96
96
|
rn(a.schema):{...a.schema},u={castType:r.type};for(let g of Object.keys(r)){if(g==="type"||!Object.hasOwn(e.validators,g))
|
|
97
|
-
continue;let h=
|
|
97
|
+
continue;let h=Bg(e,g,t);if(!h)continue;let l=h({...s,parameterName:g,parameterValue:r[g],fieldSchema:{...c}});l&&Dg(c,l)}
|
|
98
98
|
c[De]&&(ri(u,c[De]),delete c[De]);let d=[];r.nullable===!0&&d.push({type:"null"}),r.nullOnEmpty===!0&&d.push({const:""});
|
|
99
|
-
let p=rn(
|
|
99
|
+
let p=rn(Vg(c,d));if(r.defaultTo!==void 0&&i.applyDefaults)if(typeof r.defaultTo!="function"){let g=e._normalizeDefault(
|
|
100
100
|
r,r.defaultTo,{fieldPath:t,currentObject:{},containerKey:t,objectBeforeCast:{},options:{},settings:e._buildOperationSettings(
|
|
101
101
|
o,i,{})});if(Object.keys(g.errors).length>0){let h=Object.values(g.errors)[0];throw new Error(`defaultTo for "${t}" is i\
|
|
102
|
-
nvalid (${h.code}).`)}p.default=g.value}else u.defaults={providedByFunction:!0};return p[De]=u,p}function Ic(e,t={}){let r=
|
|
103
|
-
t),{operationName:n,operation:o}=
|
|
104
|
-
o,i,{root:!0}),c={$schema:
|
|
105
|
-
De,Xo,Zo,
|
|
106
|
-
ema",Xo=["object","array","string","number","boolean"],Zo=Symbol("json-rest-schema.exportContext"),
|
|
107
|
-
"y","on"]
|
|
102
|
+
nvalid (${h.code}).`)}p.default=g.value}else u.defaults={providedByFunction:!0};return p[De]=u,p}function Ic(e,t={}){let r=Fg(
|
|
103
|
+
t),{operationName:n,operation:o}=Gg(e,r),i=r.additionalProperties===void 0?!1:r.additionalProperties,s=nn(r),a=vc(e,r,n,
|
|
104
|
+
o,i,{root:!0}),c={$schema:xg,...Tc(a,r)};return Object.keys(s.definitions).length>0&&(c.definitions=s.definitions),c}var xg,
|
|
105
|
+
De,Xo,Zo,kg,$g,Lg,Mg,Oc=b(()=>{Ho();en();Jo();vt();or();xg="http://json-schema.org/draft-07/schema#",De="x-json-rest-sch\
|
|
106
|
+
ema",Xo=["object","array","string","number","boolean"],Zo=Symbol("json-rest-schema.exportContext"),kg=["true","1","yes",
|
|
107
|
+
"y","on"],$g=["false","0","no","n","off"];Lg={none:()=>({type:Xo}),blob:()=>({type:Xo}),serialize:()=>({type:Xo}),object:()=>({
|
|
108
108
|
type:"object"}),array:()=>({type:"array"}),file:()=>({type:"string"}),string:()=>({type:"string"}),number:()=>({type:["n\
|
|
109
109
|
umber","string"]}),integer:()=>({type:["integer","string"]}),epochMilliseconds:()=>Ec(864e13),epochSeconds:()=>Ec(864e10),
|
|
110
110
|
dateTime:({definition:e,fieldName:t})=>({type:"string",format:"date-time",pattern:bc(e,t)}),date:()=>({type:"string",format:"\
|
|
111
111
|
date",pattern:fc}),time:({definition:e,fieldName:t})=>({type:"string",pattern:_c(e,t)}),boolean:({definition:e})=>{if(e.
|
|
112
|
-
strictBoolean===!0)return{type:"boolean"};let t=new Set([...
|
|
113
|
-
[
|
|
114
|
-
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},
|
|
112
|
+
strictBoolean===!0)return{type:"boolean"};let t=new Set([...kg,String(e.stringTrueWhen||"true").trim().toLowerCase()]),r=new Set(
|
|
113
|
+
[...$g,String(e.stringFalseWhen||"false").trim().toLowerCase()]);return{anyOf:[{type:"boolean"},{type:"number",enum:[0,1]},
|
|
114
|
+
{type:"string",enum:[...r,...t]}]}},id:()=>({type:["integer","string"],minimum:1,pattern:"^[1-9][0-9]*$"})},Mg={minLength:({
|
|
115
115
|
definition:e,parameterValue:t})=>e.type==="string"?{minLength:t}:null,maxLength:({definition:e,parameterValue:t})=>e.type===
|
|
116
116
|
"string"?{maxLength:t}:null,min:({definition:e,parameterValue:t})=>Tt(e)?{minimum:t}:null,max:({definition:e,parameterValue:t})=>Tt(
|
|
117
117
|
e)?{maximum:t}:null,pattern:({definition:e,parameterValue:t})=>e.type==="string"?{pattern:t instanceof RegExp?t.source:t}:
|
|
@@ -122,18 +122,18 @@ et("transforms",{lowercase:!0}):null,length:({parameterValue:e})=>et("transforms
|
|
|
122
122
|
et("metadata",{unsigned:!0}):null,precision:({parameterValue:e})=>et("metadata",{precision:e}),scale:({parameterValue:e})=>et(
|
|
123
123
|
"metadata",{scale:e}),temporalPrecision:({parameterValue:e})=>et("metadata",{temporalPrecision:e}),strictBoolean:()=>null,
|
|
124
124
|
required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null}});function Rc(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function li(e){return e instanceof
|
|
125
|
-
At}function
|
|
125
|
+
At}function Zg(){return{self:!1,children:{}}}function Ac(e){return Object.keys(e.children).length>0}function tt(e,t){return`${e}\
|
|
126
126
|
.${String(t)}`}function kc(e,t){return e===""?String(t):tt(e,t)}function Pc(e,t){if(e===t)return"";let r=`${t}.`;return e.
|
|
127
127
|
startsWith(r)?e.slice(r.length):null}function Ot(e,t){let r={};for(let n of Object.values(e)){let o=tt(t,n.field);N(r,o,
|
|
128
128
|
{...n,field:o})}return r}function ci(e){return Ko(e,"validatePath")}function Cc(e){let t={};for(let r of e){let n=ci(r),
|
|
129
|
-
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||N(o,s,
|
|
130
|
-
return t}function
|
|
129
|
+
o=t;for(let i=0;i<n.length;i++){let s=n[i];Object.hasOwn(o,s)||N(o,s,Zg()),i===n.length-1&&(o[s].self=!0),o=o[s].children}}
|
|
130
|
+
return t}function Qg(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}
|
|
131
131
|
function on(e){return e===null?!0:Array.isArray(e)||Q(e)?Object.keys(e).length>0:e!==void 0}function Nc(e){return[...e].
|
|
132
132
|
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)})}
|
|
133
|
-
function
|
|
133
|
+
function ey(e){return/^[0-9]+$/.test(e)}function ty(e,t=new WeakMap){if(t.has(e))return t.get(e);let r=Object.create(At.
|
|
134
134
|
prototype);return t.set(e,r),r.structure=null,r.types=e.types,r.validators=e.validators,r.operations=e.operations,r.structure=
|
|
135
135
|
an(sn(e.structure,t)),r._installOperationMethods(),Object.freeze(r)}function sn(e,t=new WeakMap){if(e===null||typeof e!=
|
|
136
|
-
"object")return e;if(li(e))return
|
|
136
|
+
"object")return e;if(li(e))return ty(e,t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let n=new RegExp(
|
|
137
137
|
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);
|
|
138
138
|
for(let o of e)n.push(sn(o,t));return n}if(!Q(e))return e;let r={};t.set(e,r);for(let[n,o]of Object.entries(e))N(r,n,sn(
|
|
139
139
|
o,t));return r}function an(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e)||li(e))return e;if(t.add(e),Array.
|
|
@@ -141,26 +141,26 @@ isArray(e))for(let r of e)an(r,t);else for(let r of Reflect.ownKeys(e))an(e[r],t
|
|
|
141
141
|
return an(sn(e))}function ui(e,t,r=""){if(!li(e)||!Array.isArray(t)||t.length<1)return null;let[n,...o]=t;if(!Object.hasOwn(
|
|
142
142
|
e.structure,n))return null;let i=e.structure[n];if(o.length<1)return i;let s=kc(r,n);return $c(e,i,o,s)}function $c(e,t,r,n){
|
|
143
143
|
if(t?.type==="object"){let o=e._resolveObjectFieldMode(n,t);return o.kind!=="nested"?null:ui(o.schema,r,n)}if(t?.type===
|
|
144
|
-
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!
|
|
144
|
+
"array"){let o=e._resolveArrayItemsConfig(n,t);if(!o||r.length<1)return null;let[i,...s]=r;if(!ey(i))return null;let a=tt(
|
|
145
145
|
n,i);return o.kind==="schema"?s.length<1?null:ui(o.schema,s,a):s.length<1?o.definition:$c(e,o.definition,s,a)}return null}
|
|
146
146
|
function Rt(e,t){let r={...e};if(Array.isArray(e.skipFields)){let n=e.skipFields.map(o=>Pc(o,t)).filter(o=>o!==null&&o!==
|
|
147
147
|
"");n.length>0?r.skipFields=n:delete r.skipFields}if(Q(e.skipParams)){let n={};for(let[o,i]of Object.entries(e.skipParams)){
|
|
148
148
|
let s=Pc(o,t);s===null||s===""||N(n,s,i)}Object.keys(n).length>0?r.skipParams=n:delete r.skipParams}return r}function jc(e,t,r,n){
|
|
149
149
|
let o=t[r];if(!n.includes(o))throw new Error(`Operation "${e}" must define ${r} as one of: ${n.join(", ")}.`)}function ai(e,t,r,n=!0){
|
|
150
150
|
let o=t[r];if(!(o===void 0&&!n)&&typeof o!="boolean")throw new Error(`Operation "${e}" must define ${r} as a boolean.`)}
|
|
151
|
-
function
|
|
151
|
+
function ny(e,t){if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Operation "${e}" must be an object.`);
|
|
152
152
|
return jc(e,t,"targetFields",["schema","input"]),ai(e,t,"enforceRequired"),ai(e,t,"applyDefaults"),jc(e,t,"outputFields",
|
|
153
153
|
["validated","input"]),ai(e,t,"rejectExplicitUndefined",!1),Object.freeze({targetFields:t.targetFields,enforceRequired:t.
|
|
154
154
|
enforceRequired,applyDefaults:t.applyDefaults,outputFields:t.outputFields,rejectExplicitUndefined:t.rejectExplicitUndefined===
|
|
155
|
-
void 0?!0:t.rejectExplicitUndefined})}function
|
|
156
|
-
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
157
|
-
entries(e))N(t,r,
|
|
158
|
-
e))N(t,r,n);return Object.freeze(t)}function
|
|
159
|
-
()=>{Oc();Ho();or();vt();en();si=new WeakMap;
|
|
155
|
+
void 0?!0:t.rejectExplicitUndefined})}function oy(e={}){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(
|
|
156
|
+
"Schema operations must be an object.");let t=Object.create(null);for(let[r,n]of Object.entries(ry))N(t,r,n);for(let[r,n]of Object.
|
|
157
|
+
entries(e))N(t,r,ny(r,n));return Object.freeze(t)}function xc(e){let t=Object.create(null);for(let[r,n]of Object.entries(
|
|
158
|
+
e))N(t,r,n);return Object.freeze(t)}function iy(e){let t={...e};return delete t.operation,delete t.mode,t}var si,ry,At,Lc=b(
|
|
159
|
+
()=>{Oc();Ho();or();vt();en();si=new WeakMap;ry=Object.freeze({create:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
160
160
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),replace:Object.freeze({targetFields:"schema",enforceRequired:!0,
|
|
161
161
|
applyDefaults:!0,outputFields:"validated",rejectExplicitUndefined:!0}),patch:Object.freeze({targetFields:"input",enforceRequired:!1,
|
|
162
162
|
applyDefaults:!1,outputFields:"input",rejectExplicitUndefined:!0})});At=class{constructor(t,r,n,o={}){qo(t),this.structure=
|
|
163
|
-
t,this.types=xc(r),this.validators=xc(n),this.operations=
|
|
163
|
+
t,this.types=xc(r),this.validators=xc(n),this.operations=oy(o),this._installOperationMethods()}_typeError(t){return this.
|
|
164
164
|
_paramError(t,"TYPE_CAST_FAILED","Value could not be cast to the required type.")}_paramError(t,r,n,o={}){let i=new Error(
|
|
165
165
|
n);return i.errorObject={field:t,code:r,message:n,params:o},i}_paramToBeSkipped(t,r,n){return typeof r!="object"||r===null?
|
|
166
166
|
!1:!!(Array.isArray(r[n])&&r[n].includes(t))}_fieldToBeSkipped(t,r){return Array.isArray(r.skipFields)&&r.skipFields.includes(
|
|
@@ -175,7 +175,7 @@ rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:o=>Object.hasOwn(
|
|
|
175
175
|
r))throw new Error(`${t}() expects a plain object input.`)}_resolvePathValidationRequest(t={}){let r=t.operation??t.mode??
|
|
176
176
|
"patch";if(Object.hasOwn(t,"operation")&&Object.hasOwn(t,"mode")&&t.operation!==t.mode)throw new Error("Path validation \
|
|
177
177
|
options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,r))throw new Error(
|
|
178
|
-
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:
|
|
178
|
+
`Unknown operation "${r}".`);let n=this.operations[r];return{operationName:r,operation:n,validationOptions:iy(t)}}_buildOperationResult(t,r,n){
|
|
179
179
|
let o={};for(let i of n.outputFieldNames){if(!Object.hasOwn(this.structure,i))continue;let s=n.isFieldPresent(i);(r[i]!==
|
|
180
180
|
void 0||s&&t[i]===null||n.defaultedFields.has(i))&&(!s&&!n.defaultedFields.has(i)||N(o,i,r[i]))}return o}_resolveObjectFieldMode(t,r){
|
|
181
181
|
return Qr(t,r)}_resolveArrayItemsConfig(t,r){return Zr(t,r)}_resolveObjectValuesConfig(t,r){return rr(t,r)}_buildArrayItemSettings(t,r){
|
|
@@ -257,7 +257,7 @@ d,E.errors);continue}if(!E.shouldContinue)continue;let T=this._validateSelectedD
|
|
|
257
257
|
s,m);on(y[0])&&N(c,g,y[0]),this._mergeErrors(d,T)}return d}validateWith(t,r,n={}){if(!Object.hasOwn(this.operations,t))throw new Error(
|
|
258
258
|
`Unknown operation "${t}".`);let o=this.operations[t];return this._assertPlainObjectInput(t,r),this._validateWithOperation(
|
|
259
259
|
t,o,r,n)}validateAt(t,r,n={}){this._assertPlainObjectInput("validateAt",r);let o=ci(t),{operationName:i,operation:s,validationOptions:a}=this.
|
|
260
|
-
_resolvePathValidationRequest(n),c=this._validateSelectedTree(Cc([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:
|
|
260
|
+
_resolvePathValidationRequest(n),c=this._validateSelectedTree(Cc([t]),r,a,this._buildOperationSettings(i,s,r));return{validatedValue:Qg(
|
|
261
261
|
c.validatedObject,o),errors:c.errors}}validatePaths(t,r,n={}){if(this._assertPlainObjectInput("validatePaths",r),!Array.
|
|
262
262
|
isArray(t)||t.length===0)throw new Error("validatePaths() expects a non-empty array of schema paths.");let{operationName:o,
|
|
263
263
|
operation:i,validationOptions:s}=this._resolvePathValidationRequest(n);return this._validateSelectedTree(Cc(t),r,s,this.
|
|
@@ -267,11 +267,11 @@ return Ic(this,t)}getFieldDefinitions(){return si.has(this)||si.set(this,ii(this
|
|
|
267
267
|
if(typeof t!="string"||t.trim()==="")throw new Error("Field path must be a non-empty string.");let r=ui(this,ci(t.trim()));
|
|
268
268
|
return r===null?null:ii(r)}getFieldMessages(t){let r=this.getFieldDefinition(t);return!r||typeof r.messages!="object"||r.
|
|
269
269
|
messages===null?Object.freeze({}):ii(r.messages)}cleanup(t,r){let n={};for(let o of Object.keys(t))Object.hasOwn(this.structure,
|
|
270
|
-
o)&&this.structure[o][r]&&N(n,o,t[o]);return n}}});var IP,
|
|
271
|
-
t",
|
|
272
|
-
-1<t.indexOf(d)?p:void 0:t||
|
|
270
|
+
o)&&this.structure[o][r]&&N(n,o,t[o]);return n}}});var IP,sy,OP,ay,cy,Mc,uy,Dc,Vc,Uc=b(()=>{({parse:IP,stringify:sy}=JSON),{keys:OP}=Object,ay=String,cy="string",Mc="objec\
|
|
271
|
+
t",uy=(e,t)=>t,Dc=(e,t,r)=>{let n=ay(t.push(r)-1);return e.set(r,n),n},Vc=(e,t,r)=>{let n=t&&typeof t===Mc?(d,p)=>d===""||
|
|
272
|
+
-1<t.indexOf(d)?p:void 0:t||uy,o=new Map,i=[],s=[],a=+Dc(o,i,n.call({"":e},"",e)),c=!a;for(;a<i.length;)c=!0,s[a]=sy(i[a++],
|
|
273
273
|
u,r);return"["+s.join(",")+"]";function u(d,p){if(c)return c=!c,p;let g=n.call(this,d,p);switch(typeof g){case Mc:if(g===
|
|
274
|
-
null)return g;case
|
|
274
|
+
null)return g;case cy:return o.get(g)||Dc(o,i,g)}return g}}});function py(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Bc(e){if(typeof e==
|
|
275
275
|
"number")return Number.isFinite(e)?e:null;if(typeof e=="bigint"){let t=Number(e);return Number.isSafeInteger(t)?t:null}if(typeof e==
|
|
276
276
|
"string"){let t=e.trim();if(t==="")return null;let r=Number(t);return Number.isFinite(r)?r:null}return null}function di(e,t){
|
|
277
277
|
if(Object.is(e,t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&
|
|
@@ -279,8 +279,8 @@ t instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(Array.isArr
|
|
|
279
279
|
e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!di(e[o],t[o]))return!1;return!0}if(e===
|
|
280
280
|
null||t===null||typeof e!="object"||typeof t!="object"||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=Object.
|
|
281
281
|
keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!Object.hasOwn(t,o)||!di(e[o],t[o]))return!1;
|
|
282
|
-
return!0}var
|
|
283
|
-
no","n","off"]);
|
|
282
|
+
return!0}var dy,fy,my,zc,Gc=b(()=>{Uc();en();Jo();vt();dy=new Set(["true","1","yes","y","on"]),fy=new Set(["false","0","\
|
|
283
|
+
no","n","off"]);my={install(e){let{addType:t,addValidator:r}=e;t("none",n=>n.value),t("file",n=>{let o=n.value;o==null&&
|
|
284
284
|
n.throwTypeError();let i=typeof o;if(i==="string"||i==="number"||i==="boolean"){let s=o.toString();return n.definition.noTrim?
|
|
285
285
|
s:s.trim()}n.throwTypeError()}),t("string",n=>{let o=n.value;if(o==null)return"";let i=typeof o;if(i==="string"||i==="nu\
|
|
286
286
|
mber"||i==="boolean"){let s=o.toString();return n.definition.noTrim?s:s.trim()}n.throwTypeError()}),t("blob",n=>n.value),
|
|
@@ -294,7 +294,7 @@ rialize",n=>{try{return JSON.stringify(n.value)}catch{try{return Vc(n.value)}cat
|
|
|
294
294
|
if(typeof n.value=="boolean")return n.value;if(typeof n.value=="number"){if(n.value===1)return!0;if(n.value===0)return!1;
|
|
295
295
|
n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value===1n)return!0;if(n.value===0n)return!1;n.throwTypeError()}if(typeof n.
|
|
296
296
|
value=="string"){let o=String(n.definition.stringFalseWhen||"false").trim().toLowerCase(),i=String(n.definition.stringTrueWhen||
|
|
297
|
-
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...
|
|
297
|
+
"true").trim().toLowerCase(),s=n.value.trim().toLowerCase(),a=new Set([...fy,o]),c=new Set([...dy,i]);if(a.has(s))return!1;
|
|
298
298
|
if(c.has(s))return!0}n.throwTypeError()}),t("id",n=>{if(typeof n.value=="number"){if(Number.isSafeInteger(n.value)&&n.value>
|
|
299
299
|
0)return n.value;n.throwTypeError()}if(typeof n.value=="bigint"){if(n.value>0n&&n.value<=BigInt(Number.MAX_SAFE_INTEGER))
|
|
300
300
|
return Number(n.value);n.throwTypeError()}if(typeof n.value=="string"){let o=n.value.trim();/^[1-9][0-9]*$/.test(o)||n.throwTypeError();
|
|
@@ -315,7 +315,7 @@ RegExp?new RegExp(o.source,o.flags):typeof o=="string"?new RegExp(o):null;if(!i)
|
|
|
315
315
|
{pattern:i.source})}),r("strictBoolean",n=>{if(n.parameterValue){if(n.definition.type!=="boolean")throw new Error(`stric\
|
|
316
316
|
tBoolean can only be used on boolean fields (${n.fieldName}).`);typeof n.valueBeforeCast!="boolean"&&n.throwParamError("\
|
|
317
317
|
STRICT_BOOLEAN","Value must be a boolean.")}}),r("validator",n=>{if(typeof n.parameterValue!="function")throw new Error(
|
|
318
|
-
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(
|
|
318
|
+
`Validator for ${n.fieldName} must be a function.`);let o=n.parameterValue(n.value,n.object,n);if(py(o))throw new Error(
|
|
319
319
|
`Custom validator for "${n.fieldName}" must be synchronous.`);typeof o=="string"&&n.throwParamError("CUSTOM_VALIDATOR_FA\
|
|
320
320
|
ILED",o)}),r("uppercase",n=>{if(typeof n.value=="string")return n.value.toUpperCase()}),r("lowercase",n=>{if(typeof n.value==
|
|
321
321
|
"string")return n.value.toLowerCase()}),r("length",n=>{if(typeof n.value=="string")return n.value.substr(0,n.parameterValue);
|
|
@@ -328,45 +328,45 @@ ms.`,{max:n.parameterValue,actual:n.value.length})}),r("notEmpty",n=>{n.paramete
|
|
|
328
328
|
""&&n.throwParamError("NOT_EMPTY","Field cannot be empty.")}),r("required",()=>{}),r("unsigned",()=>{}),r("precision",()=>{}),
|
|
329
329
|
r("scale",()=>{}),r("temporalPrecision",n=>{if(n.definition.type!=="time"&&n.definition.type!=="dateTime")throw new Error(
|
|
330
330
|
`temporalPrecision can only be used on time or dateTime fields (${n.fieldName}).`)}),r("nullable",()=>{}),r("nullOnEmpty",
|
|
331
|
-
()=>{}),r("defaultTo",()=>{})}},zc=
|
|
331
|
+
()=>{}),r("defaultTo",()=>{})}},zc=my});var Fc=b(()=>{or()});function hy(e,t,r){if(typeof r!="function")throw new Error(`Type handler for '${t}' must be a function.`);N(e,t,r)}function gy(e,t,r){
|
|
332
332
|
if(typeof r!="function")throw new Error(`Validator handler for '${t}' must be a function.`);N(e,t,r)}function un(e={}){let t=Object.
|
|
333
333
|
create(null);for(let[r,n]of Object.entries(e))N(t,r,n);return t}function Hc(e,t){if(typeof e.install!="function")throw new Error(
|
|
334
334
|
"Plugin must have an install method.");e.install(t)}function qc(e,t,r){Yc.set(e,t),Jc.set(e,r),Object.defineProperty(e,Kc,
|
|
335
|
-
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function
|
|
335
|
+
{value:Object.freeze({getTypes:()=>t,getValidators:()=>r}),enumerable:!1,configurable:!1,writable:!1})}function yy(e){if(!e||
|
|
336
336
|
typeof e!="object"&&typeof e!="function")return null;let t=Yc.get(e),r=Jc.get(e);if(t&&r)return{types:t,validators:r};let n=e[Kc];
|
|
337
337
|
return n&&typeof n.getTypes=="function"&&typeof n.getValidators=="function"?{types:n.getTypes(),validators:n.getValidators()}:
|
|
338
338
|
typeof e=="object"&&e.types&&typeof e.types=="object"&&e.validators&&typeof e.validators=="object"&&typeof e.create=="fu\
|
|
339
339
|
nction"&&typeof e.replace=="function"&&typeof e.patch=="function"&&typeof e.toJsonSchema=="function"?{types:e.types,validators:e.
|
|
340
|
-
validators}:null}function
|
|
340
|
+
validators}:null}function wy(e){return e.length===1&&Array.isArray(e[0])?e[0]:e}function Wc(e,t,r){for(let[n,o]of Object.
|
|
341
341
|
entries(t)){if(Object.hasOwn(e,n)&&e[n]!==o){if(cn.has(o))continue;if(!cn.has(e[n]))throw new Error(`Cannot merge schema\
|
|
342
|
-
factories with conflicting ${r} "${n}".`)}N(e,n,o)}}function
|
|
343
|
-
types:un(e),validators:un(t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=
|
|
342
|
+
factories with conflicting ${r} "${n}".`)}N(e,n,o)}}function _y(e,t,r){let n=wy(r).filter(Boolean);if(n.length<1)return{
|
|
343
|
+
types:un(e),validators:un(t)};let o=Object.create(null),i=Object.create(null);for(let s of n){let a=yy(s);if(!a)throw new Error(
|
|
344
344
|
"Factory sources must be schema instances or schema factories created by json-rest-schema.");Wc(o,a.types,"type"),Wc(i,a.
|
|
345
345
|
validators,"validator")}return{types:o,validators:i}}function Xc({types:e={},validators:t={},installCore:r=!0}={}){let n=un(
|
|
346
|
-
e),o=un(t),i=(s,a={})=>{let c=new At(s,n,o,a.operations);return qc(c,n,o),c};return qc(i,n,o),i.addType=(s,a)=>{
|
|
347
|
-
i.addValidator=(s,a)=>{
|
|
348
|
-
let a=
|
|
346
|
+
e),o=un(t),i=(s,a={})=>{let c=new At(s,n,o,a.operations);return qc(c,n,o),c};return qc(i,n,o),i.addType=(s,a)=>{hy(n,s,a)},
|
|
347
|
+
i.addValidator=(s,a)=>{gy(o,s,a)},i.use=s=>{Hc(s,{addType:i.addType,addValidator:i.addValidator})},i.createFactory=(...s)=>{
|
|
348
|
+
let a=_y(n,o,s);return Xc({types:a.types,validators:a.validators,installCore:!1})},r&&Hc(zc,{addType:(s,a)=>{cn.add(a),i.
|
|
349
349
|
addType(s,a)},addValidator:(s,a)=>{cn.add(a),i.addValidator(s,a)}}),i}var Yc,Jc,Kc,cn,L,rt=b(()=>{Lc();Gc();Fc();or();Yc=
|
|
350
|
-
new WeakMap,Jc=new WeakMap,Kc=Symbol.for("json-rest-schema.registry-metadata"),cn=new WeakSet;L=Xc({installCore:!0})});var WP,Zc=b(()=>{rt();U();WP=Object.freeze({schema:L({}),mode:"replace"})});var Qc=b(()=>{U();oc();Xr();Zc()});function
|
|
350
|
+
new WeakMap,Jc=new WeakMap,Kc=Symbol.for("json-rest-schema.registry-metadata"),cn=new WeakSet;L=Xc({installCore:!0})});var WP,Zc=b(()=>{rt();U();WP=Object.freeze({schema:L({}),mode:"replace"})});var Qc=b(()=>{U();oc();Xr();Zc()});function Sy(e){return String(e||"").trim().toLowerCase()}function pi(e,t){let r=Sy(e);if(!eu.test(r))throw new TypeError(
|
|
351
351
|
`${t} must match ${eu.toString()}.`);return r}function ln(e,t){if(e==null)return Object.freeze({});if(!H(e))throw new TypeError(
|
|
352
352
|
`${t} must be an object mapping local names to capability ids.`);let r={},n=new Set;for(let[o,i]of Object.entries(e)){let s=String(
|
|
353
|
-
o||"").trim();if(!
|
|
353
|
+
o||"").trim();if(!Ey.test(s))throw new TypeError(`${t} local name "${s}" must be a JavaScript identifier.`);let a=pi(i,`${t}\
|
|
354
354
|
.${s}`);if(n.has(a))throw new TypeError(`${t} declares capability "${a}" more than once.`);n.add(a),r[s]=a}return Object.
|
|
355
|
-
freeze(r)}function
|
|
355
|
+
freeze(r)}function vy(e,t,r){if(e==null)return Object.freeze({});if(!H(e))throw new TypeError(`${r}.hints must be an obj\
|
|
356
356
|
ect mapping required capability ids to what to register.`);let n=new Set(Object.values(t)),o={};for(let[i,s]of Object.entries(
|
|
357
357
|
e)){let a=pi(i,`${r}.hints key`);if(!n.has(a))throw new TypeError(`${r}.hints names "${a}", which the provider does not \
|
|
358
358
|
require.`);if(typeof s!="string"||!s.trim())throw new TypeError(`${r}.hints["${a}"] must be the text that says what to r\
|
|
359
|
-
egister.`);o[a]=s.trim()}return Object.freeze(o)}function
|
|
359
|
+
egister.`);o[a]=s.trim()}return Object.freeze(o)}function Ty(e){let t=new Map;for(let[r,n]of Object.entries(e))for(let o of Object.
|
|
360
360
|
keys(n)){if(t.has(o))throw new TypeError(`Provider local name "${o}" is declared by both ${t.get(o)} and ${r}.`);t.set(o,
|
|
361
|
-
r)}}function
|
|
361
|
+
r)}}function Iy(e,t,r){for(let n of Object.values(t))for(let[o,i]of Object.entries(r))if(Object.values(i).includes(n))throw new TypeError(
|
|
362
362
|
o==="provides"?`Provider "${e}" cannot late-require capability "${n}" that it provides.`:`Provider "${e}" names capabili\
|
|
363
363
|
ty "${n}" under both late and ${o}.`)}function fi(e,t){if(e==null)return null;if(typeof e!="function")throw new TypeError(
|
|
364
364
|
`${t} must be a function when provided.`);return e}function dn({id:e,requires:t={},optional:r={},late:n={},provides:o={},
|
|
365
365
|
hints:i={},setup:s,boot:a=null,shutdown:c=null}={}){let u=pi(e,"Provider id"),d=ln(t,`${u}.requires`),p=ln(r,`${u}.optio\
|
|
366
|
-
nal`),g=ln(n,`${u}.late`),h=ln(o,`${u}.provides`);
|
|
366
|
+
nal`),g=ln(n,`${u}.late`),h=ln(o,`${u}.provides`);Ty({requires:d,optional:p,late:g,provides:h}),Iy(u,g,{provides:h,requires:d,
|
|
367
367
|
optional:p});let l=fi(s,`${u}.setup`);if(!l)throw new TypeError(`${u}.setup is required.`);return Object.freeze({id:u,requires:d,
|
|
368
|
-
optional:p,late:g,provides:h,hints:
|
|
369
|
-
|
|
368
|
+
optional:p,late:g,provides:h,hints:vy(i,{...d,...g},u),setup:l,boot:fi(a,`${u}.boot`),shutdown:fi(c,`${u}.shutdown`)})}var eu,
|
|
369
|
+
Ey,mi=b(()=>{U();eu=/^[a-z][a-z0-9_.-]*$/u,Ey=/^[A-Za-z_$][A-Za-z0-9_$]*$/u});var tu,ru=b(()=>{tu="public"});var nu=b(()=>{});var iu=b(()=>{U()});var Oy,su,au=b(()=>{nu();iu();Oy="/api",su=`${Oy}/bootstrap`});function hi(){let e=[],t=new Set,r=!1;function n({id:a,order:c=0,contribute:u}={}){if(r)throw new Error("Bootstrap regis\
|
|
370
370
|
tration is closed after the first payload is resolved.");let d=F(a);if(!d)throw new TypeError("Bootstrap contributor id \
|
|
371
371
|
is required.");if(typeof u!="function")throw new TypeError(`Bootstrap contributor "${d}" requires contribute().`);if(t.has(
|
|
372
372
|
d))throw new Error(`Bootstrap contributor "${d}" is duplicated.`);return t.add(d),e.push(Object.freeze({id:d,order:Number.
|
|
@@ -374,24 +374,24 @@ isFinite(c)?Number(c):0,contribute:u})),s}async function o(a={}){r=!0;let c={},u
|
|
|
374
374
|
(d,p)=>d.entry.order-p.entry.order||d.index-p.index).map(({entry:d})=>d);for(let d of u){let p=await d.contribute(Object.
|
|
375
375
|
freeze({...H(a)?a:{},payload:Object.freeze({...c})}));c={...c,...H(p)?p:{}}}return Object.freeze(c)}function i(){return Object.
|
|
376
376
|
freeze({sealed:r,contributorIds:Object.freeze(e.map(a=>a.id).sort())})}let s=Object.freeze({register:n,resolve:o,diagnostics:i});
|
|
377
|
-
return s}var gi=b(()=>{U()});var
|
|
377
|
+
return s}var gi=b(()=>{U()});var Ry,cu=b(()=>{mi();ru();au();gi();Ry=dn({id:"runtime.bootstrap",requires:{http:"runtime.http"},provides:{bootstrap:"r\
|
|
378
378
|
untime.bootstrap"},setup({http:e}){let t=hi();return e.router.register("GET",su,{auth:tu,meta:{tags:["bootstrap"],summary:"\
|
|
379
379
|
Resolve app bootstrap payload"}},async(r,n)=>{n.code(200).send(await t.resolve({request:r,reply:n,query:r.query||{}}))}),
|
|
380
|
-
{bootstrap:t}}})});function
|
|
380
|
+
{bootstrap:t}}})});function Ay(e){if(!H(e))throw new TypeError("Event listener must be an object.");let t=String(e.id||"").trim();if(!t)throw new TypeError(
|
|
381
381
|
"Event listener id is required.");if(typeof e.handle!="function")throw new TypeError(`Event listener "${t}" requires han\
|
|
382
382
|
dle().`);if(e.matches!=null&&typeof e.matches!="function")throw new TypeError(`Event listener "${t}" matches must be a f\
|
|
383
|
-
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function
|
|
383
|
+
unction when provided.`);return Object.freeze({id:t,handle:e.handle,matches:e.matches??null})}function Py(e){if(!H(e))throw new TypeError(
|
|
384
384
|
"Published event must be an object.");let t=String(e.type||"").trim();if(!t)throw new TypeError("Published event type is\
|
|
385
|
-
required.");return Object.freeze({...e,type:t})}function yi(){let e=[],t=new Set;function r(s){let a=
|
|
386
|
-
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=
|
|
385
|
+
required.");return Object.freeze({...e,type:t})}function yi(){let e=[],t=new Set;function r(s){let a=Ay(s);if(t.has(a.id))
|
|
386
|
+
throw new Error(`Event listener "${a.id}" is duplicated.`);return t.add(a.id),e.push(a),i}async function n(s){let a=Py(s);
|
|
387
387
|
for(let c of e)c.matches&&c.matches(a)!==!0||await c.handle(a);return a}function o(){return Object.freeze({listenerIds:Object.
|
|
388
|
-
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var wi=b(()=>{U()});var
|
|
388
|
+
freeze(e.map(s=>s.id))})}let i=Object.freeze({register:r,publish:n,diagnostics:o});return i}var wi=b(()=>{U()});var Cy,uu=b(()=>{mi();wi();Cy=dn({id:"runtime.events",provides:{events:"runtime.events"},setup(){return{events:yi()}}})});var Ve=b(()=>{Xr();nc();Qc();cu();gi();uu();wi()});var lu=b(()=>{});function du(e,t={}){let{missingStatus:r=404}=t,n=e?.errors?.[0]?.code||e?.code||"";return n==="vibe64_session_not_found"?
|
|
389
389
|
r:n.startsWith("vibe64_invalid")?400:n==="vibe64_command_requires_terminal"||n==="vibe64_agent_write_mode_busy"||n==="vi\
|
|
390
390
|
be64_agent_attachment_session_unavailable"||n==="vibe64_project_not_selected"||n==="vibe64_project_not_ready"||n==="vibe\
|
|
391
391
|
64_project_source_lock_timeout"||n==="vibe64_development_database_scope_busy"||n==="vibe64_project_session_policy_lock_t\
|
|
392
392
|
imeout"||n==="vibe64_session_creation_limit"||n==="vibe64_workspace_setup_retry_not_available"||n==="vibe64_workspace_se\
|
|
393
393
|
tup_running"?409:e?.ok===!1?400:200}var fu=b(()=>{});function ve(e,t,r={}){let{status:n=du({ok:!1,code:t}),...o}=r;return new ie(n,e,{...o,code:t})}var le=b(()=>{Ve();U();lu();
|
|
394
|
-
fu()});import
|
|
394
|
+
fu()});import Ny from"node:crypto";function jy(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=String(t.type||"").trim();
|
|
395
395
|
if(!Jr.includes(r))throw ve("Preview identity selector type is invalid.","vibe64_preview_identity_selector_type_invalid");
|
|
396
396
|
let n=String(t.value||"").trim(),o=r===tr?n.toLowerCase():n;if(!o)throw ve("Preview identity selector is missing.","vibe\
|
|
397
397
|
64_preview_identity_selector_missing");if(r===tr&&(!o.includes("@")||o.length>320))throw ve("Preview identity email is i\
|
|
@@ -400,59 +400,59 @@ alid.":"Preview identity user id is invalid.",r===Yr?"vibe64_preview_identity_lo
|
|
|
400
400
|
er_id_invalid");return{type:r,value:o}}function gu(e={}){let t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};if(Object.hasOwn(
|
|
401
401
|
t,"subject"))throw ve("Preview identity login requires an explicit application selector.","vibe64_preview_identity_subje\
|
|
402
402
|
ct_unsupported");let r=String(t.operation||_e).trim();if(![_e,Pt].includes(r))throw ve("Preview identity operation is in\
|
|
403
|
-
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===_e?{selector:
|
|
404
|
-
Pt,pu,mu,hu,YC,_i=b(()=>{rc();le();WC=
|
|
405
|
-
guest","you"]),hu=32,YC=Object.freeze(["projectScope","sessionSourceRoot","sessionId","targetHref","terminalSessionId"])});var ar,bi=b(()=>{ar="vibe64_preview_token"});import{randomUUID as
|
|
403
|
+
valid.","vibe64_preview_identity_operation_invalid");return{operation:r,...r===_e?{selector:jy(t.selector)}:{}}}var WC,_e,
|
|
404
|
+
Pt,pu,mu,hu,YC,_i=b(()=>{rc();le();WC=Ny.randomBytes(32),_e="login-as",Pt="logout",pu="selector",mu=new Set(["default","\
|
|
405
|
+
guest","you"]),hu=32,YC=Object.freeze(["projectScope","sessionSourceRoot","sessionId","targetHref","terminalSessionId"])});var ar,bi=b(()=>{ar="vibe64_preview_token"});import{randomUUID as xy}from"node:crypto";import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as yu}from"@local/vibe64-genesis/server";
|
|
406
406
|
function Ct(e="",t="vibe64_preview_identity_command_failed",r=502,n={}){return new ie(r,e||"Application preview identity\
|
|
407
|
-
command failed.",{code:t,params:n})}function
|
|
407
|
+
command failed.",{code:t,params:n})}function $y(e={}){return{kind:pu,selector:e.selector}}function _u(e={},t={}){let{requestId:r=xy(),
|
|
408
408
|
targetHref:n=""}=t,o=gu(e),i=String(n||"").trim(),s=new URL(i);if(!["http:","https:"].includes(s.protocol))throw new Error(
|
|
409
409
|
"Application preview identity target must use HTTP.");return{operation:o.operation,protocol:yu,requestId:String(r),...o.
|
|
410
|
-
operation===_e?{subject
|
|
410
|
+
operation===_e?{subject:$y(o)}:{},target:{href:s.toString(),origin:s.origin}}}function Ly(e=[]){if(!Array.isArray(e))throw Ct(
|
|
411
411
|
"Application preview identity command returned invalid cookies.","vibe64_preview_identity_command_cookies_invalid");let t=e;
|
|
412
412
|
if(t.length>Ei)throw Ct("Application preview identity command returned too many cookies.","vibe64_preview_identity_comma\
|
|
413
413
|
nd_cookies_too_many");return t.map((r,n)=>{let o=String(r||""),i=o.split(";",1)[0]||"",s=i.indexOf("="),a=(s<0?i:i.slice(
|
|
414
|
-
0,s)).trim();if(!o||Buffer.byteLength(o)>Si||/[\r\n]/u.test(o)||s<1||!
|
|
414
|
+
0,s)).trim();if(!o||Buffer.byteLength(o)>Si||/[\r\n]/u.test(o)||s<1||!ky.test(a)||a===cr||a.startsWith(`${cr}_`)||/(?:^|;)\s*domain\s*=/iu.
|
|
415
415
|
test(o))throw Ct(`Application preview identity command returned invalid cookie ${n+1}.`,"vibe64_preview_identity_command\
|
|
416
|
-
_cookie_invalid",502,{cookie:n+1});return o})}function
|
|
416
|
+
_cookie_invalid",502,{cookie:n+1});return o})}function My(e=null){if(!e||typeof e!="object"||Array.isArray(e))return null;
|
|
417
417
|
let t={displayName:String(e.displayName||e.name||"").trim().slice(0,256),email:String(e.email||"").trim().toLowerCase().
|
|
418
418
|
slice(0,320),login:String(e.login||"").trim().slice(0,256),userId:String(e.userId||e.id||"").trim().slice(0,256),username:String(
|
|
419
|
-
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function
|
|
419
|
+
e.username||"").trim().slice(0,256)};return Object.values(t).some(Boolean)?t:null}function Dy(e={},t={}){let{operation:r=_e,
|
|
420
420
|
requestId:n=""}=t;if(!e||typeof e!="object"||Array.isArray(e))throw Ct("Application preview identity command returned in\
|
|
421
421
|
valid JSON.","vibe64_preview_identity_command_json_invalid");if(e.protocol!==yu||String(e.requestId||"")!==String(n||"")||
|
|
422
422
|
typeof e.ok!="boolean")throw Ct("Application preview identity command returned an invalid protocol response.","vibe64_pr\
|
|
423
|
-
eview_identity_command_response_invalid");let o
|
|
423
|
+
eview_identity_command_response_invalid");let o=Ly(e.setCookie);if(e.ok===!1){let a=Number(e.statusCode);return{code:String(
|
|
424
424
|
e.code||"vibe64_preview_identity_application_rejected").trim().slice(0,128),error:String(e.error||"Application preview i\
|
|
425
425
|
dentity was rejected.").trim().slice(0,2e3),ok:!1,setCookie:o,signedOut:e.signedOut===!0,statusCode:Number.isInteger(a)&&
|
|
426
|
-
a>=400&&a<600?a:400}}let i=r===Pt||e.signedOut===!0,s=i?null:
|
|
426
|
+
a>=400&&a<600?a:400}}let i=r===Pt||e.signedOut===!0,s=i?null:My(e.identity);if(o.length<1||!i&&!s)throw Ct("Application \
|
|
427
427
|
preview identity command did not return an authenticated browser session.","vibe64_preview_identity_command_session_miss\
|
|
428
|
-
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var wu,Ei,Si,cr,
|
|
429
|
-
512*1024,Ei=64,Si=16*1024,cr=ar,
|
|
428
|
+
ing");return{identity:s,ok:!0,setCookie:o,signedOut:i,statusCode:200}}var wu,Ei,Si,cr,ky,rN,bu=b(()=>{Ve();_i();bi();wu=
|
|
429
|
+
512*1024,Ei=64,Si=16*1024,cr=ar,ky=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u;rN=Object.freeze({normalizePreviewIdentityCommandResponse:Dy})});var Eu=b(()=>{});function Su(e=""){return zy.find(t=>t.pattern.test(String(e)))?.kind||""}function Hy(e){if(!je(e)||e.startsWith("/")||e.
|
|
430
430
|
includes("\\")||e.includes("\0"))return!1;let t=e.split("/");return t.every(r=>r&&r!=="."&&r!=="..")&&!t.includes("node_\
|
|
431
|
-
modules")}var
|
|
432
|
-
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),
|
|
433
|
-
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),
|
|
431
|
+
modules")}var Vy,iN,Uy,By,Tu,ur,sN,aN,cN,zy,Gy,Fy,fn,je,vu,uN,lN,Iu=b(()=>{Vy="vibe64.usage-trace.v1",iN=Object.freeze({
|
|
432
|
+
directory:"VIBE64_USAGE_RECORDING_DIR",sourceRoot:"VIBE64_USAGE_SOURCE_ROOT",targetKind:"VIBE64_USAGE_TARGET_KIND"}),Uy=
|
|
433
|
+
Object.freeze(["starting","recording","stopping","stopped","failed","unavailable"]),By=Object.freeze(["person","time-lim\
|
|
434
434
|
it","request-limit","size-limit","target-exited","session-ended","error"]),Tu=Object.freeze(["nodejs","python","php"]),ur=
|
|
435
435
|
1024*1024,sN=Object.freeze({durationMs:600*1e3,capturedRequests:2e3,hitsBytesPerProcess:16*ur,hitsBytesPerRecording:32*ur,
|
|
436
436
|
proxyRequestLines:2e4,interactions:500,bufferedBytesPerProcess:64*ur,flushIntervalMs:1e3,flushEntries:2e3,traceLineBytes:64*
|
|
437
437
|
1024,indexBytes:4*ur,plumbingShare:.8,plumbingMinimumRequests:3}),aN=Object.freeze({maxRecordings:10,maxBytes:64*ur,maxAgeMs:10080*
|
|
438
|
-
60*1e3}),cN=Object.freeze(["click","enter","submit"]),
|
|
438
|
+
60*1e3}),cN=Object.freeze(["click","enter","submit"]),zy=Object.freeze([Object.freeze({kind:"request",pattern:/^r_[0-9]{6}$/u}),
|
|
439
439
|
Object.freeze({kind:"local-request",pattern:/^l_[0-9]+_[0-9]+$/u}),Object.freeze({kind:"run",pattern:/^run_[0-9]+$/u}),Object.
|
|
440
|
-
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),
|
|
440
|
+
freeze({kind:"background",pattern:/^bg_[0-9]+$/u})]),Gy=/^sha256:[0-9a-f]{64}$/u,Fy=Object.freeze(["ready","idle"]);fn=e=>Number.
|
|
441
441
|
isSafeInteger(e)&&e>=0,je=e=>typeof e=="string"&&e.length>0,vu=e=>!!e&&Number.isSafeInteger(e.line)&&e.line>0&&Number.isSafeInteger(
|
|
442
|
-
e.column)&&e.column>0;uN=Object.freeze({header:e=>e.schema===
|
|
443
|
-
e.pid)&&e.pid>0&&je(e.startedAt),tracer:e=>
|
|
442
|
+
e.column)&&e.column>0;uN=Object.freeze({header:e=>e.schema===Vy&&Tu.includes(e.runtime)&&je(e.runtimeVersion)&&Number.isSafeInteger(
|
|
443
|
+
e.pid)&&e.pid>0&&je(e.startedAt),tracer:e=>Fy.includes(e.state),file:e=>fn(e.fileIndex)&&Hy(e.path)&&Gy.test(e.hash||""),
|
|
444
444
|
function:e=>fn(e.functionIndex)&&fn(e.fileIndex)&&typeof e.name=="string"&&vu(e.start)&&vu(e.end),scope:e=>Su(e.scope)===
|
|
445
445
|
e.kind&&je(e.startedAt)&&(e.endedAt===void 0||je(e.endedAt))&&(e.label===void 0||je(e.label)&&["local-request","run"].includes(
|
|
446
446
|
e.kind)),hits:e=>Su(e.scope)!==""&&Array.isArray(e.counts)&&e.counts.every(t=>Array.isArray(t)&&t.length===2&&fn(t[0])&&
|
|
447
447
|
(t[1]===null||Number.isSafeInteger(t[1])&&t[1]>0)),diagnostic:e=>je(e.code)&&(e.path===void 0||je(e.path)),truncated:e=>je(
|
|
448
|
-
e.reason)}),lN=Object.freeze({USAGE_RECORDING_STATES:
|
|
449
|
-
return Ou}}function
|
|
448
|
+
e.reason)}),lN=Object.freeze({USAGE_RECORDING_STATES:Uy,USAGE_RECORDING_STOP_REASONS:By,USAGE_TRACER_RUNTIMES:Tu})});function qy(e=""){try{let t=new URL(e),r=t.protocol==="https:",n=t.port||(r?"443":"80");return`${r?"__Host-":""}${Ou}_${n}`}catch{
|
|
449
|
+
return Ou}}function Wy(e="",t={}){let{proxyOrigin:r="",targetOrigin:n=""}=t,o=String(e||"").trim();if(!o||!r||!n)return o;
|
|
450
450
|
try{let i=new URL(o,n),s=new URL(r),a=new URL(n);return a.protocol=s.protocol,i.origin!==n&&i.origin!==a.origin?o:(s.pathname=
|
|
451
|
-
i.pathname,s.search=
|
|
451
|
+
i.pathname,s.search=Yy(i.search),s.hash=i.hash,s.toString())}catch{return o}}function Yy(e=""){let t=String(e||"");if(!t||
|
|
452
452
|
t==="?")return"";let r=t.startsWith("?")?t.slice(1):t;if(!r)return"";let n=r.split("&").filter(o=>{let i=o.indexOf("="),
|
|
453
|
-
s=i<0?o:o.slice(0,i);return
|
|
453
|
+
s=i<0?o:o.slice(0,i);return Jy(s)!==ar});return n.length>0?`?${n.join("&")}`:""}function Jy(e=""){try{return decodeURIComponent(
|
|
454
454
|
String(e||"").replace(/\+/gu," "))}catch{return String(e||"")}}var Ou,Ru,wN,Au=b(()=>{Eu();Iu();bi();Ou=ar,Ru=/^vibe64-launch-[a-f0-9]{12}$/u;
|
|
455
|
-
wN=Object.freeze({previewTokenCookieName:
|
|
455
|
+
wN=Object.freeze({previewTokenCookieName:qy,proxiedLocation:Wy})});import{VIBE64_PREVIEW_IDENTITY_COMMAND_PROTOCOL as pn}from"@local/vibe64-genesis/server";var vi,Pu,Ti,Cu,Nu,ju,xu,ku=b(()=>{
|
|
456
456
|
_i();bu();Au();vi=e=>JSON.stringify(e,null,2),Pu=Jr.map(e=>`\`${e}\``).join(", "),Ti="6f1c2a7e-3d4b-4c55-9a10-2b7d8e9f0a\
|
|
457
457
|
11",Cu=_u({operation:_e,selector:{type:"email",value:"admin@example.com"}},{requestId:Ti,targetHref:"http://127.0.0.1:51\
|
|
458
458
|
73/"}),Nu=Object.freeze({protocol:pn,requestId:Ti,ok:!0,setCookie:["app_session=abc123; Path=/; HttpOnly; SameSite=Lax"],
|
|
@@ -536,41 +536,41 @@ Entry shape:
|
|
|
536
536
|
\`\`\`json
|
|
537
537
|
{"name":"admin","type":"email","value":"admin@example.com"}
|
|
538
538
|
\`\`\`
|
|
539
|
-
`}])});var Lu={};zo(Lu,{__testables:()=>
|
|
539
|
+
`}])});var Lu={};zo(Lu,{__testables:()=>ew,runAgentSpecCli:()=>Qy});import{readFile as Xy}from"node:fs/promises";import{VIBE64_GENESIS_AGENT_SPECS as Zy}from"@local/vibe64-genesis/server/agentSpecs";
|
|
540
540
|
function $u(){let e=Math.max(...mn.map(({name:t})=>t.length));return["Usage: vibe64 spec <name>","","Vibe64-owned contra\
|
|
541
541
|
cts:",...mn.map(({name:t,title:r})=>` ${t.padEnd(e)} ${r}`)].join(`
|
|
542
|
-
`)}async function
|
|
542
|
+
`)}async function Qy(e=[],{write:t=n=>process.stdout.write(`${n.trimEnd()}
|
|
543
543
|
`),writeError:r=n=>process.stderr.write(`${n.trimEnd()}
|
|
544
544
|
`)}={}){let[n]=e;if(!n||n==="--help"||n==="-h")return t($u()),0;let o=e.length===1&&mn.find(i=>i.name===n);return o?(t(await o.
|
|
545
545
|
text()),0):(r(`Unknown Vibe64 spec: ${e.join(" ")}.
|
|
546
546
|
|
|
547
|
-
${$u()}`),2)}var
|
|
548
|
-
freeze([...
|
|
549
|
-
e",text:()=>
|
|
547
|
+
${$u()}`),2)}var Ky,mn,ew,Mu=b(()=>{tc();ku();Ky=new URL("./../server/lib/agentSpecCli.js",import.meta.url).href,mn=Object.
|
|
548
|
+
freeze([...Zy,...xu,...ec,{name:"training-content",title:"Teaching content format for vibe64 training validate and bundl\
|
|
549
|
+
e",text:()=>Xy(new URL("../../docs/training-content.md",Ky),"utf8")}]);ew=Object.freeze({VIBE64_AGENT_SPECS:mn})});var Du=b(()=>{});import{lstat as tw,readdir as rw}from"node:fs/promises";import lr from"node:path";async function Ii(e){if(!lr.isAbsolute(
|
|
550
550
|
e||"")||lr.resolve(e)===lr.parse(e).root)throw new Error("Project state inventory requires an absolute, non-root system \
|
|
551
|
-
directory.");let t=lr.join(e,hn),r;try{if(!(await
|
|
552
|
-
a regular projects directory.");r=await
|
|
551
|
+
directory.");let t=lr.join(e,hn),r;try{if(!(await tw(t)).isDirectory())throw new Error("Project state inventory requires\
|
|
552
|
+
a regular projects directory.");r=await rw(t,{withFileTypes:!0})}catch(n){if(n.code==="ENOENT")return[];throw n}if(r.some(
|
|
553
553
|
n=>n.isSymbolicLink()))throw new Error("Project state inventory contains a symbolic link. Inspect it before upgrading.");
|
|
554
554
|
return r.filter(n=>n.isDirectory()).map(n=>lr.join(t,n.name)).sort()}var hn,Ue=b(()=>{le();Du();U();hn="projects"});var Ri=z((VN,Bu)=>{"use strict";var dr=e=>e&&typeof e.message=="string",Oi=e=>{if(!e)return;let t=e.cause;if(typeof t=="\
|
|
555
555
|
function"){let r=e.cause();return dr(r)?r:void 0}else return dr(t)?t:void 0},Vu=(e,t)=>{if(!dr(e))return"";let r=e.stack||
|
|
556
556
|
"";if(t.has(e))return r+`
|
|
557
557
|
causes have become circular...`;let n=Oi(e);return n?(t.add(e),r+`
|
|
558
|
-
caused by: `+Vu(n,t)):r},
|
|
559
|
-
": ...";let o=Oi(e);if(o){t.add(e);let i=typeof e.cause=="function";return n+(i?"":": ")+Uu(o,t,i)}else return n},
|
|
560
|
-
e,new Set);Bu.exports={isErrorLike:dr,getErrorCause:Oi,stackWithCauses:
|
|
558
|
+
caused by: `+Vu(n,t)):r},nw=e=>Vu(e,new Set),Uu=(e,t,r)=>{if(!dr(e))return"";let n=r?"":e.message||"";if(t.has(e))return n+
|
|
559
|
+
": ...";let o=Oi(e);if(o){t.add(e);let i=typeof e.cause=="function";return n+(i?"":": ")+Uu(o,t,i)}else return n},ow=e=>Uu(
|
|
560
|
+
e,new Set);Bu.exports={isErrorLike:dr,getErrorCause:Oi,stackWithCauses:nw,messageWithCauses:ow}});var Ai=z((UN,Gu)=>{"use strict";var iw=Symbol("circular-ref-tag"),gn=Symbol("pino-raw-err-ref"),zu=Object.create({},{type:{
|
|
561
561
|
enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,
|
|
562
562
|
value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[gn]},
|
|
563
563
|
set:function(e){this[gn]=e}}});Object.defineProperty(zu,gn,{writable:!0,value:{}});Gu.exports={pinoErrProto:zu,pinoErrorSymbols:{
|
|
564
|
-
seen:
|
|
565
|
-
pinoErrorSymbols:
|
|
566
|
-
create(
|
|
564
|
+
seen:iw,rawSymbol:gn}}});var qu=z((BN,Hu)=>{"use strict";Hu.exports=Ci;var{messageWithCauses:sw,stackWithCauses:aw,isErrorLike:Fu}=Ri(),{pinoErrProto:cw,
|
|
565
|
+
pinoErrorSymbols:uw}=Ai(),{seen:Pi}=uw,{toString:lw}=Object.prototype;function Ci(e){if(!Fu(e))return e;e[Pi]=void 0;let t=Object.
|
|
566
|
+
create(cw);t.type=lw.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=sw(e),t.stack=aw(e),Array.
|
|
567
567
|
isArray(e.errors)&&(t.aggregateErrors=e.errors.map(r=>Ci(r)));for(let r in e)if(t[r]===void 0){let n=e[r];Fu(n)?r!=="cau\
|
|
568
|
-
se"&&!Object.prototype.hasOwnProperty.call(n,Pi)&&(t[r]=Ci(n)):t[r]=n}return delete e[Pi],t.raw=e,t}});var Yu=z((zN,Wu)=>{"use strict";Wu.exports=wn;var{isErrorLike:Ni}=Ri(),{pinoErrProto:
|
|
569
|
-
{toString:
|
|
568
|
+
se"&&!Object.prototype.hasOwnProperty.call(n,Pi)&&(t[r]=Ci(n)):t[r]=n}return delete e[Pi],t.raw=e,t}});var Yu=z((zN,Wu)=>{"use strict";Wu.exports=wn;var{isErrorLike:Ni}=Ri(),{pinoErrProto:dw,pinoErrorSymbols:fw}=Ai(),{seen:yn}=fw,
|
|
569
|
+
{toString:pw}=Object.prototype;function wn(e){if(!Ni(e))return e;e[yn]=void 0;let t=Object.create(dw);t.type=pw.call(e.constructor)===
|
|
570
570
|
"[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=
|
|
571
571
|
e.errors.map(r=>wn(r))),Ni(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,yn)&&(t.cause=wn(e.cause));for(let r in e)
|
|
572
572
|
if(t[r]===void 0){let n=e[r];Ni(n)?Object.prototype.hasOwnProperty.call(n,yn)||(t[r]=wn(n)):t[r]=n}return delete e[yn],t.
|
|
573
|
-
raw=e,t}});var Zu=z((GN,Xu)=>{"use strict";Xu.exports={mapHttpRequest:
|
|
573
|
+
raw=e,t}});var Zu=z((GN,Xu)=>{"use strict";Xu.exports={mapHttpRequest:mw,reqSerializer:Ku};var ji=Symbol("pino-raw-req-ref"),Ju=Object.
|
|
574
574
|
create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,
|
|
575
575
|
value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,
|
|
576
576
|
writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},
|
|
@@ -578,16 +578,16 @@ raw:{enumerable:!1,get:function(){return this[ji]},set:function(e){this[ji]=e}}}
|
|
|
578
578
|
value:{}});function Ku(e){let t=e.info||e.socket,r=Object.create(Ju);if(r.id=typeof e.id=="function"?e.id():e.id||(e.info?
|
|
579
579
|
e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let n=e.path;r.url=typeof n=="string"?n:e.url?
|
|
580
580
|
e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=
|
|
581
|
-
t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function
|
|
581
|
+
t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}function mw(e){return{req:Ku(e)}}});var rl=z((FN,tl)=>{"use strict";tl.exports={mapHttpResponse:hw,resSerializer:el};var xi=Symbol("pino-raw-res-ref"),Qu=Object.
|
|
582
582
|
create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,
|
|
583
583
|
get:function(){return this[xi]},set:function(e){this[xi]=e}}});Object.defineProperty(Qu,xi,{writable:!0,value:{}});function el(e){
|
|
584
584
|
let t=Object.create(Qu);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,
|
|
585
|
-
t.raw=e,t}function
|
|
585
|
+
t.raw=e,t}function hw(e){return{res:el(e)}}});var $i=z((HN,nl)=>{"use strict";var ki=qu(),gw=Yu(),_n=Zu(),bn=rl();nl.exports={err:ki,errWithCause:gw,mapHttpRequest:_n.
|
|
586
586
|
mapHttpRequest,mapHttpResponse:bn.mapHttpResponse,req:_n.reqSerializer,res:bn.resSerializer,wrapErrorSerializer:function(t){
|
|
587
587
|
return t===ki?t:function(n){return t(ki(n))}},wrapRequestSerializer:function(t){return t===_n.reqSerializer?t:function(n){
|
|
588
588
|
return t(_n.reqSerializer(n))}},wrapResponseSerializer:function(t){return t===bn.resSerializer?t:function(n){return t(bn.
|
|
589
|
-
resSerializer(n))}}}});var Li=z((qN,ol)=>{"use strict";function
|
|
590
|
-
|
|
589
|
+
resSerializer(n))}}}});var Li=z((qN,ol)=>{"use strict";function yw(e,t){return t}ol.exports=function(){let t=Error.prepareStackTrace;Error.prepareStackTrace=
|
|
590
|
+
yw;let r=new Error().stack;if(Error.prepareStackTrace=t,!Array.isArray(r))return;let n=r.slice(2),o=[];for(let i of n)i&&
|
|
591
591
|
o.push(i.getFileName());return o}});var ll=z((WN,ul)=>{"use strict";function Mi(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(
|
|
592
592
|
e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=Mi(e[r]);return t}if(typeof e=="object"){let t=Object.
|
|
593
593
|
create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=Mi(e[r]));return t}return e}
|
|
@@ -601,61 +601,61 @@ function al(e,t){let r=e;for(let o=0;o<t.length-1;o++){let i=t[o];if(typeof r!="
|
|
|
601
601
|
"object"||r[i]===null)return!1;r=r[i]}let n=t[t.length-1];if(n==="*"){if(Array.isArray(r))for(let o=0;o<r.length;o++)r[o]=
|
|
602
602
|
void 0;else if(typeof r=="object"&&r!==null)for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&delete r[o]}else typeof r==
|
|
603
603
|
"object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var En=Symbol("PATH_NOT_FOUN\
|
|
604
|
-
D");function
|
|
605
|
-
function
|
|
606
|
-
for(let o of t){let i=il(o);if(i.includes("*"))cl(e,i,r,o,n);else if(n)al(e,i);else{let s=
|
|
604
|
+
D");function ww(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null||!(n in r))return En;r=r[n]}return r}
|
|
605
|
+
function _w(e,t){let r=e;for(let n of t){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function bw(e,t,r,n=!1){
|
|
606
|
+
for(let o of t){let i=il(o);if(i.includes("*"))cl(e,i,r,o,n);else if(n)al(e,i);else{let s=ww(e,i);if(s===En)continue;let a=typeof r==
|
|
607
607
|
"function"?r(s,i):r;sl(e,i,a)}}}function cl(e,t,r,n,o=!1){let i=t.indexOf("*");if(i===t.length-1){let s=t.slice(0,-1),a=e;
|
|
608
608
|
for(let c of s){if(a==null||typeof a!="object"||a===null)return;a=a[c]}if(Array.isArray(a))if(o)for(let c=0;c<a.length;c++)
|
|
609
609
|
a[c]=void 0;else for(let c=0;c<a.length;c++){let u=[...s,c.toString()],d=typeof r=="function"?r(a[c],u):r;a[c]=d}else if(typeof a==
|
|
610
610
|
"object"&&a!==null)if(o){let c=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&c.push(u);for(let u of c)delete a[u]}else
|
|
611
|
-
for(let c in a){let u=[...s,c],d=typeof r=="function"?r(a[c],u):r;a[c]=d}}else
|
|
611
|
+
for(let c in a){let u=[...s,c],d=typeof r=="function"?r(a[c],u):r;a[c]=d}}else Ew(e,t,r,i,n,o)}function Ew(e,t,r,n,o,i=!1){
|
|
612
612
|
let s=t.slice(0,n),a=t.slice(n+1),c=[];function u(d,p){if(p===s.length){if(Array.isArray(d))for(let g=0;g<d.length;g++)c[p]=
|
|
613
613
|
g.toString(),u(d[g],p+1);else if(typeof d=="object"&&d!==null)for(let g in d)c[p]=g,u(d[g],p+1)}else if(p<s.length){let g=s[p];
|
|
614
614
|
d&&typeof d=="object"&&d!==null&&g in d&&(c[p]=g,u(d[g],p+1))}else if(a.includes("*"))cl(d,a,typeof r=="function"?(h,l)=>{
|
|
615
|
-
let w=[...c.slice(0,p),...l];return r(h,w)}:r,o,i);else if(i)al(d,a);else{let g=typeof r=="function"?r(
|
|
615
|
+
let w=[...c.slice(0,p),...l];return r(h,w)}:r,o,i);else if(i)al(d,a);else{let g=typeof r=="function"?r(_w(d,a),[...c.slice(
|
|
616
616
|
0,p),...a]):r;sl(d,a,g)}}if(s.length===0)u(e,0);else{let d=e;for(let p=0;p<s.length;p++){let g=s[p];if(d==null||typeof d!=
|
|
617
|
-
"object"||d===null)return;d=d[g],c[p]=g}d!=null&&u(d,s.length)}}function
|
|
618
|
-
for(let r of e){let n=il(r),o=t;for(let i=0;i<n.length;i++){let s=n[i];o.has(s)||o.set(s,new Map),o=o.get(s)}}return t}function
|
|
617
|
+
"object"||d===null)return;d=d[g],c[p]=g}d!=null&&u(d,s.length)}}function Sw(e){if(e.length===0)return null;let t=new Map;
|
|
618
|
+
for(let r of e){let n=il(r),o=t;for(let i=0;i<n.length;i++){let s=n[i];o.has(s)||o.set(s,new Map),o=o.get(s)}}return t}function vw(e,t){
|
|
619
619
|
if(!t)return e;function r(n,o,i=0){if(!o||o.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(
|
|
620
620
|
n.getTime());if(Array.isArray(n)){let a=[];for(let c=0;c<n.length;c++){let u=c.toString();o.has(u)||o.has("*")?a[c]=r(n[c],
|
|
621
621
|
o.get(u)||o.get("*")):a[c]=n[c]}return a}let s=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.
|
|
622
|
-
call(n,a)&&(o.has(a)||o.has("*")?s[a]=r(n[a],o.get(a)||o.get("*")):s[a]=n[a]);return s}return r(e,t)}function
|
|
622
|
+
call(n,a)&&(o.has(a)||o.has("*")?s[a]=r(n[a],o.get(a)||o.get("*")):s[a]=n[a]);return s}return r(e,t)}function Tw(e){if(typeof e!=
|
|
623
623
|
"string")throw new Error("Paths must be (non-empty) strings");if(e==="")throw new Error("Invalid redaction path ()");if(e.
|
|
624
624
|
includes(".."))throw new Error(`Invalid redaction path (${e})`);if(e.includes(","))throw new Error(`Invalid redaction pa\
|
|
625
625
|
th (${e})`);let t=0,r=!1,n="";for(let o=0;o<e.length;o++){let i=e[o];if((i==='"'||i==="'")&&t>0)r?i===n&&(r=!1,n=""):(r=
|
|
626
626
|
!0,n=i);else if(i==="["&&!r)t++;else if(i==="]"&&!r&&(t--,t<0))throw new Error(`Invalid redaction path (${e})`)}if(t!==0)
|
|
627
|
-
throw new Error(`Invalid redaction path (${e})`)}function
|
|
628
|
-
an array");for(let t of e)
|
|
629
|
-
remove:i=!1}=e;
|
|
630
|
-
return n?n(c):c;let u=
|
|
631
|
-
d)},u):typeof n=="function"?n(u):JSON.stringify(u)}}ul.exports=
|
|
632
|
-
"pino.levelComp"),
|
|
633
|
-
"pino.lsCache")
|
|
634
|
-
|
|
635
|
-
pino.stringifySafe"),
|
|
636
|
-
essageKey"),
|
|
637
|
-
ergeStrategy"),
|
|
638
|
-
"pino.formatters"),
|
|
639
|
-
levelValSym:
|
|
640
|
-
redactFmtSym:
|
|
641
|
-
formatOptsSym:
|
|
642
|
-
formattersSym:
|
|
643
|
-
[Redacted]",ml=!1;function
|
|
627
|
+
throw new Error(`Invalid redaction path (${e})`)}function Iw(e){if(!Array.isArray(e))throw new TypeError("paths must be \
|
|
628
|
+
an array");for(let t of e)Tw(t)}function Ow(e={}){let{paths:t=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:o=!0,
|
|
629
|
+
remove:i=!1}=e;Iw(t);let s=Sw(t);return function(c){if(o&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))
|
|
630
|
+
return n?n(c):c;let u=vw(c,s),d=c,p=r;return typeof r=="function"&&(p=r),bw(u,t,p,i),n===!1?(u.restore=function(){return Mi(
|
|
631
|
+
d)},u):typeof n=="function"?n(u):JSON.stringify(u)}}ul.exports=Ow});var Nt=z((YN,dl)=>{"use strict";var Rw=Symbol("pino.setLevel"),Aw=Symbol("pino.getLevel"),Pw=Symbol("pino.levelVal"),Cw=Symbol(
|
|
632
|
+
"pino.levelComp"),Nw=Symbol("pino.useLevelLabels"),jw=Symbol("pino.useOnlyCustomLevels"),xw=Symbol("pino.mixin"),kw=Symbol(
|
|
633
|
+
"pino.lsCache"),$w=Symbol("pino.chindings"),Lw=Symbol("pino.asJson"),Mw=Symbol("pino.write"),Dw=Symbol("pino.redactFmt"),
|
|
634
|
+
Vw=Symbol("pino.time"),Uw=Symbol("pino.timeSliceIndex"),Bw=Symbol("pino.stream"),zw=Symbol("pino.stringify"),Gw=Symbol("\
|
|
635
|
+
pino.stringifySafe"),Fw=Symbol("pino.stringifiers"),Hw=Symbol("pino.end"),qw=Symbol("pino.formatOpts"),Ww=Symbol("pino.m\
|
|
636
|
+
essageKey"),Yw=Symbol("pino.errorKey"),Jw=Symbol("pino.nestedKey"),Kw=Symbol("pino.nestedKeyStr"),Xw=Symbol("pino.mixinM\
|
|
637
|
+
ergeStrategy"),Zw=Symbol("pino.msgPrefix"),Qw=Symbol("pino.wildcardFirst"),e_=Symbol.for("pino.serializers"),t_=Symbol.for(
|
|
638
|
+
"pino.formatters"),r_=Symbol.for("pino.hooks"),n_=Symbol.for("pino.metadata");dl.exports={setLevelSym:Rw,getLevelSym:Aw,
|
|
639
|
+
levelValSym:Pw,levelCompSym:Cw,useLevelLabelsSym:Nw,mixinSym:xw,lsCacheSym:kw,chindingsSym:$w,asJsonSym:Lw,writeSym:Mw,serializersSym:e_,
|
|
640
|
+
redactFmtSym:Dw,timeSym:Vw,timeSliceIndexSym:Uw,streamSym:Bw,stringifySym:zw,stringifySafeSym:Gw,stringifiersSym:Fw,endSym:Hw,
|
|
641
|
+
formatOptsSym:qw,messageKeySym:Ww,errorKeySym:Yw,nestedKeySym:Jw,wildcardFirstSym:Qw,needsMetadataGsym:n_,useOnlyCustomLevelsSym:jw,
|
|
642
|
+
formattersSym:t_,hooksSym:r_,nestedKeyStrSym:Kw,mixinMergeStrategySym:Xw,msgPrefixSym:Zw}});var Vi=z((JN,hl)=>{"use strict";var fl=ll(),{redactFmtSym:o_,wildcardFirstSym:Sn}=Nt(),Di=/[^.[\]]+|\[([^[\]]*?)\]/g,pl="\
|
|
643
|
+
[Redacted]",ml=!1;function i_(e,t){let{paths:r,censor:n,remove:o}=s_(e),i=r.reduce((c,u)=>{Di.lastIndex=0;let d=Di.exec(
|
|
644
644
|
u),p=Di.exec(u),g=d[1]!==void 0?d[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):d[0];if(g==="*"&&(g=Sn),p===null)return c[g]=
|
|
645
645
|
null,c;if(c[g]===null)return c;let{index:h}=p,l=`${u.substr(h,u.length-1)}`;return c[g]=c[g]||[],g!==Sn&&c[g].length===0&&
|
|
646
|
-
c[g].push(...c[Sn]||[]),g===Sn&&Object.keys(c).forEach(function(w){c[w]&&c[w].push(l)}),c[g].push(l),c},{}),s={[
|
|
646
|
+
c[g].push(...c[Sn]||[]),g===Sn&&Object.keys(c).forEach(function(w){c[w]&&c[w].push(l)}),c[g].push(l),c},{}),s={[o_]:fl({
|
|
647
647
|
paths:r,censor:n,serialize:t,strict:ml,remove:o})},a=(...c)=>t(typeof n=="function"?n(...c):n);return[...Object.keys(i),
|
|
648
648
|
...Object.getOwnPropertySymbols(i)].reduce((c,u)=>{if(i[u]===null)c[u]=d=>a(d,[u]);else{let d=typeof n=="function"?(p,g)=>n(
|
|
649
|
-
p,[u,...g]):n;c[u]=fl({paths:i[u],censor:d,serialize:t,strict:ml,remove:o})}return c},s)}function
|
|
649
|
+
p,[u,...g]):n;c[u]=fl({paths:i[u],censor:d,serialize:t,strict:ml,remove:o})}return c},s)}function s_(e){if(Array.isArray(
|
|
650
650
|
e))return e={paths:e,censor:pl},e;let{paths:t,censor:r=pl,remove:n}=e;if(Array.isArray(t)===!1)throw Error("pino \u2013 redac\
|
|
651
|
-
t must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}hl.exports=
|
|
652
|
-
|
|
653
|
-
hrtime.bigint(),
|
|
651
|
+
t must contain an array of strings");return n===!0&&(r=void 0),{paths:t,censor:r,remove:n}}hl.exports=i_});var wl=z((KN,yl)=>{"use strict";var a_=()=>"",c_=()=>`,"time":${Date.now()}`,u_=()=>`,"time":${Math.round(Date.now()/1e3)}`,
|
|
652
|
+
l_=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,d_=1000000n,gl=1000000000n,f_=BigInt(Date.now())*d_,p_=process.
|
|
653
|
+
hrtime.bigint(),m_=()=>{let e=process.hrtime.bigint()-p_,t=f_+e,r=t/gl,n=t%gl,o=Number(r*1000n+n/1000000n),i=new Date(o),
|
|
654
654
|
s=i.getUTCFullYear(),a=(i.getUTCMonth()+1).toString().padStart(2,"0"),c=i.getUTCDate().toString().padStart(2,"0"),u=i.getUTCHours().
|
|
655
655
|
toString().padStart(2,"0"),d=i.getUTCMinutes().toString().padStart(2,"0"),p=i.getUTCSeconds().toString().padStart(2,"0");
|
|
656
|
-
return`,"time":"${s}-${a}-${c}T${u}:${d}:${p}.${n.toString().padStart(9,"0")}Z"`};yl.exports={nullTime:
|
|
657
|
-
isoTime:
|
|
658
|
-
var n=r&&r.stringify||
|
|
656
|
+
return`,"time":"${s}-${a}-${c}T${u}:${d}:${p}.${n.toString().padStart(9,"0")}Z"`};yl.exports={nullTime:a_,epochTime:c_,unixTime:u_,
|
|
657
|
+
isoTime:l_,isoTimeNano:m_}});var bl=z((XN,_l)=>{"use strict";function h_(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}_l.exports=g_;function g_(e,t,r){
|
|
658
|
+
var n=r&&r.stringify||h_,o=1;if(typeof e=="object"&&e!==null){var i=t.length+o;if(i===1)return e;var s=new Array(i);s[0]=
|
|
659
659
|
n(e);for(var a=1;a<i;a++)s[a]=n(t[a]);return s.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;
|
|
660
660
|
for(var u="",d=1-o,p=-1,g=e&&e.length||0,h=0;h<g;){if(e.charCodeAt(h)===37&&h+1<g){switch(p=p>-1?p:0,e.charCodeAt(h+1)){case 100:case 102:
|
|
661
661
|
if(d>=c||t[d]==null)break;p<h&&(u+=e.slice(p,h)),u+=Number(t[d]),p=h+2,h++;break;case 105:if(d>=c||t[d]==null)break;p<h&&
|
|
@@ -667,9 +667,9 @@ anonymous>",p=h+2,h++;break}u+=n(t[d]),p=h+2,h++;break;case 115:if(d>=c)break;p<
|
|
|
667
667
|
number that is greater than 0 but less than Infinity");Atomics.wait(e,0,0,Number(r))},e=new Int32Array(new SharedArrayBuffer(
|
|
668
668
|
4));Ui.exports=t}else{let e=function(t){if((t>0&&t<1/0)===!1)throw typeof t!="number"&&typeof t!="bigint"?TypeError("sle\
|
|
669
669
|
ep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.
|
|
670
|
-
now()+Number(t);for(;n>Date.now(););};Ui.exports=e}});var Al=z((QN,Rl)=>{"use strict";var q=X("fs"),
|
|
671
|
-
Tn=Buffer.allocUnsafe(0),
|
|
672
|
-
|
|
670
|
+
now()+Number(t);for(;n>Date.now(););};Ui.exports=e}});var Al=z((QN,Rl)=>{"use strict";var q=X("fs"),y_=X("events"),w_=X("util").inherits,El=X("path"),Gi=Bi(),__=X("assert"),vn=100,
|
|
671
|
+
Tn=Buffer.allocUnsafe(0),b_=16*1024,Sl="buffer",vl="utf8",[E_,S_]=(process.versions.node||"0.0").split(".").map(Number),
|
|
672
|
+
v_=E_>=22&&S_>=7;function Tl(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(i,s){if(i){t._reopening=
|
|
673
673
|
!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",i)}):t.emit("erro\
|
|
674
674
|
r",i);return}let a=t._reopening;t.fd=s,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.
|
|
675
675
|
emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():a&&process.
|
|
@@ -679,11 +679,11 @@ i);q.open(e,n,o,r)}):q.open(e,n,o,r)}function be(e){if(!(this instanceof be))ret
|
|
|
679
679
|
maxLength:o,maxWrite:i,periodicFlush:s,sync:a,append:c=!0,mkdir:u,retryEAGAIN:d,fsync:p,contentMode:g,mode:h}=e||{};t=t||
|
|
680
680
|
r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=
|
|
681
681
|
!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=
|
|
682
|
-
o||0,this.maxWrite=i||
|
|
682
|
+
o||0,this.maxWrite=i||b_,this._periodicFlush=s||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this.
|
|
683
683
|
_fsync=p||!1,this.append=c||!1,this.mode=h,this.retryEAGAIN=d||(()=>!0),this.mkdir=u||!1;let l,w;if(g===Sl)this._writingBuf=
|
|
684
|
-
Tn,this.write=
|
|
685
|
-
write(this.fd,this._writingBuf,this.release);else if(g===void 0||g===vl)this._writingBuf="",this.write=
|
|
686
|
-
this.flushSync=
|
|
684
|
+
Tn,this.write=O_,this.flush=A_,this.flushSync=C_,this._actualWrite=j_,l=()=>q.writeSync(this.fd,this._writingBuf),w=()=>q.
|
|
685
|
+
write(this.fd,this._writingBuf,this.release);else if(g===void 0||g===vl)this._writingBuf="",this.write=I_,this.flush=R_,
|
|
686
|
+
this.flushSync=P_,this._actualWrite=N_,l=()=>Buffer.isBuffer(this._writingBuf)?q.writeSync(this.fd,this._writingBuf):q.writeSync(
|
|
687
687
|
this.fd,this._writingBuf,"utf8"),w=()=>Buffer.isBuffer(this._writingBuf)?q.write(this.fd,this._writingBuf,this.release):
|
|
688
688
|
q.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${vl}" and "${Sl}", but \
|
|
689
689
|
passed ${g}`);if(typeof t=="number")this.fd=t,process.nextTick(()=>this.emit("ready"));else if(typeof t=="string")Tl(t,this);else
|
|
@@ -696,23 +696,23 @@ if(!this.sync){w();return}try{do{let E=l(),T=zi(this._writingBuf,this._len,E);th
|
|
|
696
696
|
_writingBuf.length)}catch(E){this.release(E);return}}this._fsync&&q.fsyncSync(this.fd);let y=this._len;this._reopening?(this.
|
|
697
697
|
_writing=!1,this._reopening=!1,this.reopen()):y>this.minLength?this._actualWrite():this._ending?y>0?this._actualWrite():
|
|
698
698
|
(this._writing=!1,In(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.
|
|
699
|
-
nextTick(
|
|
699
|
+
nextTick(T_,this)):this.emit("drain"))},this.on("newListener",function(_){_==="drain"&&(this._asyncDrainScheduled=!1)}),
|
|
700
700
|
this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.
|
|
701
701
|
unref())}function zi(e,t,r){return typeof e=="string"&&(e=Buffer.from(e)),t=Math.max(t-r,0),e=e.subarray(r),{writingBuf:e,
|
|
702
|
-
len:t}}function
|
|
703
|
-
return e.length===0?Tn:e.length===1?e[0]:Buffer.concat(e,t)}function
|
|
702
|
+
len:t}}function T_(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}w_(be,y_);function Il(e,t){
|
|
703
|
+
return e.length===0?Tn:e.length===1?e[0]:Buffer.concat(e,t)}function I_(e){if(this.destroyed)throw new Error("SonicBoom \
|
|
704
704
|
destroyed");e=""+e;let t=Buffer.byteLength(e),r=this._len+t,n=this._bufs;return this.maxLength&&r>this.maxLength?(this.emit(
|
|
705
705
|
"drop",e),this._len<this._hwm):(n.length===0||Buffer.byteLength(n[n.length-1])+t>this.maxWrite?n.push(e):n[n.length-1]+=
|
|
706
|
-
e,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function
|
|
706
|
+
e,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function O_(e){if(this.
|
|
707
707
|
destroyed)throw new Error("SonicBoom destroyed");let t=this._len+e.length,r=this._bufs,n=this._lens;return this.maxLength&&
|
|
708
708
|
t>this.maxLength?(this.emit("drop",e),this._len<this._hwm):(r.length===0||n[n.length-1]+e.length>this.maxWrite?(r.push([
|
|
709
709
|
e]),n.push(e.length)):(r[r.length-1].push(e),n[n.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&
|
|
710
710
|
this._actualWrite(),this._len<this._hwm)}function Ol(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=
|
|
711
711
|
!1,e();else try{q.fsync(this.fd,n=>{this._flushPending=!1,e(n)})}catch(n){e(n)}this.off("error",r)},r=n=>{this._flushPending=
|
|
712
|
-
!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function
|
|
712
|
+
!1,e(n),this.off("drain",t)};this.once("drain",t),this.once("error",r)}function R_(e){if(e!=null&&typeof e!="function")throw new Error(
|
|
713
713
|
"flush cb must be a function");if(this.destroyed){let t=new Error("SonicBoom destroyed");if(e){e(t);return}throw t}if(this.
|
|
714
714
|
minLength<=0){e?.();return}e&&Ol.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}
|
|
715
|
-
function
|
|
715
|
+
function A_(e){if(e!=null&&typeof e!="function")throw new Error("flush cb must be a function");if(this.destroyed){let t=new Error(
|
|
716
716
|
"SonicBoom destroyed");if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&Ol.call(this,e),!this._writing&&(this.
|
|
717
717
|
_bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}be.prototype.reopen=function(e){if(this.
|
|
718
718
|
destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(e)});return}if(this.
|
|
@@ -720,35 +720,35 @@ _ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor
|
|
|
720
720
|
(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&q.close(t,r=>{if(r)
|
|
721
721
|
return this.emit("error",r)})}),Tl(this.file,this)};be.prototype.end=function(){if(this.destroyed)throw new Error("Sonic\
|
|
722
722
|
Boom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&
|
|
723
|
-
(this._len>0&&this.fd>=0?this._actualWrite():In(this)))};function
|
|
723
|
+
(this._len>0&&this.fd>=0?this._actualWrite():In(this)))};function P_(){if(this.destroyed)throw new Error("SonicBoom dest\
|
|
724
724
|
royed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.
|
|
725
725
|
unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);
|
|
726
726
|
try{let t=Buffer.isBuffer(e)?q.writeSync(this.fd,e):q.writeSync(this.fd,e,"utf8"),r=zi(e,this._len,t);e=r.writingBuf,this.
|
|
727
727
|
_len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(t,e.length,
|
|
728
|
-
this._len-e.length))throw t;Gi(vn)}}try{q.fsyncSync(this.fd)}catch{}}function
|
|
728
|
+
this._len-e.length))throw t;Gi(vn)}}try{q.fsyncSync(this.fd)}catch{}}function C_(){if(this.destroyed)throw new Error("So\
|
|
729
729
|
nicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>
|
|
730
730
|
0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=Tn);let e=Tn;for(;this._bufs.length||e.length;){e.length<=0&&
|
|
731
731
|
(e=Il(this._bufs[0],this._lens[0]));try{let t=q.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.
|
|
732
732
|
length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code==="EAGAIN"||t.code==="EBUSY")&&!this.retryEAGAIN(
|
|
733
|
-
t,e.length,this._len-e.length))throw t;Gi(vn)}}}be.prototype.destroy=function(){this.destroyed||In(this)};function
|
|
733
|
+
t,e.length,this._len-e.length))throw t;Gi(vn)}}}be.prototype.destroy=function(){this.destroyed||In(this)};function N_(){
|
|
734
734
|
let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",
|
|
735
735
|
this.sync)try{let t=Buffer.isBuffer(this._writingBuf)?q.writeSync(this.fd,this._writingBuf):q.writeSync(this.fd,this._writingBuf,
|
|
736
|
-
"utf8");e(null,t)}catch(t){e(t)}else q.write(this.fd,this._writingBuf,e)}function
|
|
736
|
+
"utf8");e(null,t)}catch(t){e(t)}else q.write(this.fd,this._writingBuf,e)}function j_(){let e=this.release;if(this._writing=
|
|
737
737
|
!0,this._writingBuf=this._writingBuf.length?this._writingBuf:Il(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=q.
|
|
738
|
-
writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else
|
|
738
|
+
writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else v_&&(this._writingBuf=Buffer.from(this._writingBuf)),q.
|
|
739
739
|
write(this.fd,this._writingBuf,e)}function In(e){if(e.fd===-1){e.once("ready",In.bind(null,e));return}e._periodicFlushTimer!==
|
|
740
|
-
void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],
|
|
740
|
+
void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],__(typeof e.fd=="number",`sonic.fd mus\
|
|
741
741
|
t be a number, got ${typeof e.fd}`);try{q.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?q.close(e.fd,r):r()}function r(n){
|
|
742
742
|
if(n){e.emit("error",n);return}e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}be.SonicBoom=be;be.default=be;Rl.
|
|
743
|
-
exports=be});var Fi=z((ej,xl)=>{"use strict";var Ee={exit:[],beforeExit:[]},Pl={exit
|
|
744
|
-
(jt=new FinalizationRegistry(
|
|
745
|
-
removeListener(e,Pl[e]),Ee.exit.length===0&&Ee.beforeExit.length===0&&(jt=void 0))}function
|
|
746
|
-
Nl("beforeExit")}function Nl(e){for(let t of Ee[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}Ee[e]=[]}function
|
|
743
|
+
exports=be});var Fi=z((ej,xl)=>{"use strict";var Ee={exit:[],beforeExit:[]},Pl={exit:$_,beforeExit:L_},jt;function x_(){jt===void 0&&
|
|
744
|
+
(jt=new FinalizationRegistry(M_))}function k_(e){Ee[e].length>0||process.on(e,Pl[e])}function Cl(e){Ee[e].length>0||(process.
|
|
745
|
+
removeListener(e,Pl[e]),Ee.exit.length===0&&Ee.beforeExit.length===0&&(jt=void 0))}function $_(){Nl("exit")}function L_(){
|
|
746
|
+
Nl("beforeExit")}function Nl(e){for(let t of Ee[e]){let r=t.deref(),n=t.fn;r!==void 0&&n(r,e)}Ee[e]=[]}function M_(e){for(let t of[
|
|
747
747
|
"exit","beforeExit"]){let r=Ee[t].indexOf(e);Ee[t].splice(r,r+1),Cl(t)}}function jl(e,t,r){if(t===void 0)throw new Error(
|
|
748
|
-
"the object can't be undefined");
|
|
749
|
-
jl("exit",e,t)}function
|
|
750
|
-
"beforeExit"])Ee[t]=Ee[t].filter(r=>{let n=r.deref();return n&&n!==e}),Cl(t)}}xl.exports={register:
|
|
751
|
-
unregister:
|
|
748
|
+
"the object can't be undefined");k_(e);let n=new WeakRef(t);n.fn=r,x_(),jt.register(t,n),Ee[e].push(n)}function D_(e,t){
|
|
749
|
+
jl("exit",e,t)}function V_(e,t){jl("beforeExit",e,t)}function U_(e){if(jt!==void 0){jt.unregister(e);for(let t of["exit",
|
|
750
|
+
"beforeExit"])Ee[t]=Ee[t].filter(r=>{let n=r.deref();return n&&n!==e}),Cl(t)}}xl.exports={register:D_,registerBeforeExit:V_,
|
|
751
|
+
unregister:U_}});var kl=z((tj,B_)=>{B_.exports={name:"thread-stream",version:"4.2.0",description:"A streaming way to send data to a Node.\
|
|
752
752
|
js Worker Thread",main:"index.js",types:"index.d.ts",engines:{node:">=20"},dependencies:{"real-require":"^1.0.0"},devDependencies:{
|
|
753
753
|
"@types/node":"^25.0.2","@yao-pkg/pkg":"^6.0.0",borp:"^1.0.0",desm:"^1.3.0",eslint:"^9.39.1",fastbench:"^1.0.1",neostandard:"\
|
|
754
754
|
^0.13.0","pino-elasticsearch":"^9.0.0","sonic-boom":"^5.0.0","ts-node":"^10.8.0",typescript:"~5.7.3"},scripts:{build:"ts\
|
|
@@ -757,40 +757,40 @@ s}"',"test:ci":'npm run lint && npm run transpile && borp --pattern "test/*.test
|
|
|
757
757
|
le && borp --pattern "test/*.test.js"',transpile:"sh ./test/ts/transpile.sh"},repository:{type:"git",url:"git+https://gi\
|
|
758
758
|
thub.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matt\
|
|
759
759
|
eocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com\
|
|
760
|
-
/mcollina/thread-stream#readme"}});var Ll=z((rj,$l)=>{"use strict";function
|
|
760
|
+
/mcollina/thread-stream#readme"}});var Ll=z((rj,$l)=>{"use strict";function z_(e,t,r,n,o){let i=n===1/0?1/0:Date.now()+n,s=()=>{let a=Atomics.load(e,t);if(a===
|
|
761
761
|
r){o(null,"ok");return}if(i!==1/0&&Date.now()>i){o(null,"timed-out");return}let c=i===1/0?1e4:Math.min(1e4,Math.max(1,i-
|
|
762
|
-
Date.now())),u=Atomics.waitAsync(e,t,a,c);u.async?u.value.then(s):setImmediate(s)};s()}function
|
|
762
|
+
Date.now())),u=Atomics.waitAsync(e,t,a,c);u.async?u.value.then(s):setImmediate(s)};s()}function G_(e,t,r,n,o){let i=n===
|
|
763
763
|
1/0?1/0:Date.now()+n,s=()=>{if(Atomics.load(e,t)!==r){o(null,"ok");return}if(i!==1/0&&Date.now()>i){o(null,"timed-out");
|
|
764
764
|
return}let c=i===1/0?1e4:Math.min(1e4,Math.max(1,i-Date.now())),u=Atomics.waitAsync(e,t,r,c);u.async?u.value.then(d=>{if(d===
|
|
765
|
-
"ok"){o(null,"ok");return}s()}):setImmediate(s)};s()}$l.exports={wait:
|
|
766
|
-
{pathToFileURL:
|
|
767
|
-
I=Symbol("kImpl"),
|
|
765
|
+
"ok"){o(null,"ok");return}s()}):setImmediate(s)};s()}$l.exports={wait:z_,waitDiff:G_}});var Dl=z((nj,Ml)=>{"use strict";Ml.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}});var Kl=z((oj,Jl)=>{"use strict";var{version:F_}=kl(),{EventEmitter:H_}=X("events"),{Worker:q_}=X("worker_threads"),{join:W_}=X("path"),
|
|
766
|
+
{pathToFileURL:Y_}=X("url"),{wait:J_}=Ll(),{WRITE_INDEX:xe,READ_INDEX:nt,SEQ_INDEX:Hi}=Dl(),K_=X("buffer"),X_=X("assert"),
|
|
767
|
+
I=Symbol("kImpl"),Z_=K_.constants.MAX_STRING_LENGTH;function Vl(){}function Ji(e,t){Atomics.add(e[I].state,Hi,1),t(),Atomics.
|
|
768
768
|
add(e[I].state,Hi,1),Atomics.notify(e[I].state,Hi)}function Ul(e){Ji(e,()=>{Atomics.store(e[I].state,nt,0),Atomics.store(
|
|
769
769
|
e[I].state,xe,0)})}var fr=class{constructor(t){this._value=t}deref(){return this._value}},On=class{register(){}unregister(){}},
|
|
770
|
-
|
|
771
|
-
Bl=new
|
|
772
|
-
globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||
|
|
773
|
-
name:t.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:
|
|
774
|
-
dataBuf:e[I].dataBuf,stateBuf:e[I].stateBuf,workerData:{$context:{threadStreamVersion:
|
|
775
|
-
e),s.on("message",
|
|
770
|
+
Q_=process.env.NODE_V8_COVERAGE?On:global.FinalizationRegistry||On,eb=process.env.NODE_V8_COVERAGE?fr:global.WeakRef||fr,
|
|
771
|
+
Bl=new Q_(e=>{e.exited||e.terminate()});function tb(e,t){let{filename:r,workerData:n}=t,i=("__bundlerPathsOverrides"in globalThis?
|
|
772
|
+
globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||W_(__dirname,"lib","worker.js"),s=new q_(i,{...t.workerOpts,
|
|
773
|
+
name:t.workerOpts?.name||"thread-stream",trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:Y_(r).href,
|
|
774
|
+
dataBuf:e[I].dataBuf,stateBuf:e[I].stateBuf,workerData:{$context:{threadStreamVersion:F_},...n}}});return s.stream=new fr(
|
|
775
|
+
e),s.on("message",rb),s.on("exit",Fl),Bl.register(e,s),s}function zl(e){X_(!e[I].sync),e[I].needDrain&&(e[I].needDrain=!1,
|
|
776
776
|
e.emit("drain"))}function Gl(e){for(;;){let t=Atomics.load(e[I].state,xe),r=e[I].data.length-t;if(r>0){if(e[I].bufLen===
|
|
777
777
|
0){e[I].flushing=!1,e[I].ending?Ki(e):e[I].needDrain&&process.nextTick(zl,e);return}Wl(e,r,Vl);continue}if(r===0){if(t===
|
|
778
|
-
0&&e[I].bufLen===0)return;Rn(e,()=>{e.destroyed||(Ul(e),Gl(e))});return}he(e,new Error("overwritten"));return}}function
|
|
778
|
+
0&&e[I].bufLen===0)return;Rn(e,()=>{e.destroyed||(Ul(e),Gl(e))});return}he(e,new Error("overwritten"));return}}function rb(e){
|
|
779
779
|
let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case"REA\
|
|
780
|
-
DY":this.stream=new
|
|
780
|
+
DY":this.stream=new eb(t),Rn(t,()=>{t[I].ready=!0,t.emit("ready")});break;case"ERROR":he(t,e.err);break;case"EVENT":Array.
|
|
781
781
|
isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"FLUSHED":{if(e.context!=="thread-stream"){he(t,
|
|
782
782
|
new Error("this should not happen: "+e.code));break}let r=t[I].flushCallbacks.get(e.id);r&&(t[I].flushCallbacks.delete(e.
|
|
783
783
|
id),process.nextTick(r));break}case"WARNING":process.emitWarning(e.err);break;default:he(t,new Error("this should not ha\
|
|
784
784
|
ppen: "+e.code))}}function Fl(e){let t=this.stream.deref();t!==void 0&&(Bl.unregister(t),t.worker.exited=!0,t.worker.off(
|
|
785
|
-
"exit",Fl),he(t,e!==0?new Error("the worker thread exited"):null))}var Wi=class extends
|
|
785
|
+
"exit",Fl),he(t,e!==0?new Error("the worker thread exited"):null))}var Wi=class extends H_{constructor(t={}){if(super(),
|
|
786
786
|
t.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[I]={},this[I].stateBuf=new SharedArrayBuffer(
|
|
787
787
|
128),this[I].state=new Int32Array(this[I].stateBuf),this[I].dataBuf=new SharedArrayBuffer(t.bufferSize||4*1024*1024),this[I].
|
|
788
788
|
data=Buffer.from(this[I].dataBuf),this[I].sync=t.sync||!1,this[I].ending=!1,this[I].ended=!1,this[I].needDrain=!1,this[I].
|
|
789
789
|
destroyed=!1,this[I].flushing=!1,this[I].ready=!1,this[I].finished=!1,this[I].errored=null,this[I].closed=!1,this[I].buf=
|
|
790
|
-
[],this[I].bufHead=0,this[I].bufLen=0,this[I].flushCallbacks=new Map,this[I].nextFlushId=0,this.worker=
|
|
790
|
+
[],this[I].bufHead=0,this[I].bufLen=0,this[I].flushCallbacks=new Map,this[I].nextFlushId=0,this.worker=tb(this,t),this.on(
|
|
791
791
|
"message",(r,n)=>{this.worker.postMessage(r,n)})}write(t){let r=Buffer.isBuffer(t)?t:Buffer.from(t);if(this[I].destroyed)
|
|
792
792
|
return Yi(this,new Error("the worker has exited")),!1;if(this[I].ending)return Yi(this,new Error("the worker is ending")),
|
|
793
|
-
!1;if(this[I].flushing&&this[I].bufLen+r.length>=
|
|
793
|
+
!1;if(this[I].flushing&&this[I].bufLen+r.length>=Z_)try{qi(this),this[I].flushing=!0}catch(n){return he(this,n),!1}if(this[I].
|
|
794
794
|
buf.push(r),this[I].bufLen+=r.length,this[I].sync)try{return qi(this),!0}catch(n){return he(this,n),!1}return this[I].flushing||
|
|
795
795
|
(this[I].flushing=!0,setImmediate(Gl,this)),this[I].needDrain=this[I].data.length-this[I].bufLen-Atomics.load(this[I].state,
|
|
796
796
|
xe)<=0,!this[I].needDrain}end(){this[I].destroyed||(this[I].ending=!0,Ki(this))}flush(t){t=typeof t=="function"?t:Vl,Hl(
|
|
@@ -800,14 +800,14 @@ return this[I].closed}get writable(){return!this[I].destroyed&&!this[I].ending}g
|
|
|
800
800
|
return this[I].finished}get writableNeedDrain(){return this[I].needDrain}get writableObjectMode(){return!1}get writableErrored(){
|
|
801
801
|
return this[I].errored}};function Hl(e,t){if(e[I].destroyed){process.nextTick(t,new Error("the worker has exited"));return}
|
|
802
802
|
if(!e[I].sync&&(e[I].flushing||e[I].bufLen>0)){setImmediate(Hl,e,t);return}Rn(e,t)}function Rn(e,t){let r=Atomics.load(e[I].
|
|
803
|
-
state,xe);
|
|
803
|
+
state,xe);J_(e[I].state,nt,r,1/0,(n,o)=>{if(n){he(e,n),t(n);return}if(o!=="ok"){Rn(e,t);return}t()})}function ql(e,t){if(e[I].
|
|
804
804
|
destroyed){process.nextTick(t,new Error("the worker has exited"));return}if(!e[I].ready){let n=()=>{i(),ql(e,t)},o=()=>{
|
|
805
805
|
i(),process.nextTick(t,new Error("the worker has exited"))},i=()=>{e.off("ready",n),e.off("close",o)};e.once("ready",n),
|
|
806
806
|
e.once("close",o);return}let r=++e[I].nextFlushId;e[I].flushCallbacks.set(r,t);try{e.worker.postMessage({code:"FLUSH",context:"\
|
|
807
|
-
thread-stream",id:r})}catch(n){e[I].flushCallbacks.delete(r),he(e,n),process.nextTick(t,n)}}function
|
|
807
|
+
thread-stream",id:r})}catch(n){e[I].flushCallbacks.delete(r),he(e,n),process.nextTick(t,n)}}function nb(e,t){let r=e[I].
|
|
808
808
|
flushCallbacks;if(r.size===0)return;let n=t||new Error("the worker has exited");for(let o of r.values())process.nextTick(
|
|
809
809
|
o,n);r.clear()}function Yi(e,t){setImmediate(()=>{e.emit("error",t)})}function he(e,t){e[I].destroyed||(e[I].destroyed=!0,
|
|
810
|
-
|
|
810
|
+
nb(e,t),t&&(e[I].errored=t,Yi(e,t)),e.worker.exited?setImmediate(()=>{e[I].closed=!0,e.emit("close")}):e.worker.terminate().
|
|
811
811
|
catch(()=>{}).then(()=>{e[I].closed=!0,e.emit("close")}))}function Wl(e,t,r){let o=Atomics.load(e[I].state,xe),i=t;for(;i>
|
|
812
812
|
0&&e[I].bufLen!==0;){let s=e[I].bufHead,a=e[I].buf[s];if(a.length<=i){a.copy(e[I].data,o),o+=a.length,i-=a.length,e[I].bufLen-=
|
|
813
813
|
a.length,e[I].bufHead=s+1,e[I].bufHead===e[I].buf.length?(e[I].buf.length=0,e[I].bufHead=0):e[I].bufHead>=1024&&e[I].bufHead*
|
|
@@ -821,137 +821,137 @@ e)};for(e[I].flushing=!1;e[I].bufLen!==0;){let r=Atomics.load(e[I].state,xe),n=e
|
|
|
821
821
|
continue}else if(n<0)throw new Error("overwritten");Wl(e,n,t)}}function Yl(e){if(e[I].flushing)throw new Error("unable t\
|
|
822
822
|
o flush while flushing");let t=Atomics.load(e[I].state,xe),r=0;for(;;){let n=Atomics.load(e[I].state,nt);if(n===-2)throw Error(
|
|
823
823
|
"_flushSync failed");if(n!==t)Atomics.wait(e[I].state,nt,n,1e3);else break;if(++r===10)throw new Error("_flushSync took \
|
|
824
|
-
too long (10s)")}}Jl.exports=Wi});var Qi=z((ij,Ql)=>{"use strict";var{createRequire:
|
|
825
|
-
sep:
|
|
826
|
-
e,
|
|
824
|
+
too long (10s)")}}Jl.exports=Wi});var Qi=z((ij,Ql)=>{"use strict";var{createRequire:ob}=X("module"),{existsSync:ib}=X("node:fs"),sb=Li(),{join:Xi,isAbsolute:Zl,
|
|
825
|
+
sep:ab}=X("node:path"),{fileURLToPath:cb}=X("node:url"),ub=Bi(),Zi=Fi(),lb=Kl();function db(e){Zi.register(e,gb),Zi.registerBeforeExit(
|
|
826
|
+
e,yb),e.on("close",function(){Zi.unregister(e)})}function fb(){let e=process.execArgv;for(let t=0;t<e.length;t++){let r=e[t];
|
|
827
827
|
if(r==="--import"||r==="--require"||r==="-r"||r.startsWith("--import=")||r.startsWith("--require=")||r.startsWith("-r="))
|
|
828
|
-
return!0}return!1}function
|
|
828
|
+
return!0}return!1}function pb(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let r=[],n=!1;for(let o=0;o<
|
|
829
829
|
t.length;o++){let i=t[o];if(i==="--require"||i==="-r"||i==="--import"){let s=t[o+1];if(s&&Xl(s)){n=!0,o++;continue}r.push(
|
|
830
830
|
i),s&&(r.push(s),o++);continue}if(i.startsWith("--require=")||i.startsWith("-r=")||i.startsWith("--import=")){let s=i.slice(
|
|
831
|
-
i.indexOf("=")+1);if(Xl(s)){n=!0;continue}}r.push(i)}return n?r.join(" "):e}function Xl(e){let t=
|
|
832
|
-
if(r.startsWith("file://"))try{r=
|
|
833
|
-
'"'&&r==='"'||t==="'"&&r==="'"?e.slice(1,-1):e}function
|
|
834
|
-
!r.env&&process.env.NODE_OPTIONS){let c=
|
|
835
|
-
env,NODE_OPTIONS:c}})}r={...r,name:o};let i=new
|
|
831
|
+
i.indexOf("=")+1);if(Xl(s)){n=!0;continue}}r.push(i)}return n?r.join(" "):e}function Xl(e){let t=mb(e);if(!t)return!1;let r=t;
|
|
832
|
+
if(r.startsWith("file://"))try{r=cb(r)}catch{return!1}return Zl(r)&&!ib(r)}function mb(e){let t=e[0],r=e[e.length-1];return t===
|
|
833
|
+
'"'&&r==='"'||t==="'"&&r==="'"?e.slice(1,-1):e}function hb(e,t,r,n,o){if(!r.execArgv&&fb()&&X.main===void 0&&(r={...r,execArgv:[]}),
|
|
834
|
+
!r.env&&process.env.NODE_OPTIONS){let c=pb(process.env.NODE_OPTIONS);c!==process.env.NODE_OPTIONS&&(r={...r,env:{...process.
|
|
835
|
+
env,NODE_OPTIONS:c}})}r={...r,name:o};let i=new lb({filename:e,workerData:t,workerOpts:r,sync:n});i.on("ready",s),i.on("\
|
|
836
836
|
close",function(){process.removeListener("exit",a)}),process.on("exit",a);function s(){process.removeListener("exit",a),
|
|
837
|
-
i.unref(),r.autoEnd!==!1&&
|
|
838
|
-
flushSync(),e.end(),e.once("close",function(){e.unref()})}function
|
|
839
|
-
levels:n,dedupe:o,worker:i={},caller:s=
|
|
837
|
+
i.unref(),r.autoEnd!==!1&&db(i)}function a(){i.closed||(i.flushSync(),ub(100),i.end())}return i}function gb(e){e.ref(),e.
|
|
838
|
+
flushSync(),e.end(),e.once("close",function(){e.unref()})}function yb(e){e.flushSync()}function wb(e){let{pipeline:t,targets:r,
|
|
839
|
+
levels:n,dedupe:o,worker:i={},caller:s=sb(),sync:a=!1}=e,c={...e.options},u=typeof s=="string"?[s]:s,d=typeof globalThis==
|
|
840
840
|
"object"&&Object.prototype.hasOwnProperty.call(globalThis,"__bundlerPathsOverrides")&&globalThis.__bundlerPathsOverrides&&
|
|
841
841
|
typeof globalThis.__bundlerPathsOverrides=="object"?globalThis.__bundlerPathsOverrides:Object.create(null),p=e.target;if(p&&
|
|
842
842
|
r)throw new Error("only one of target or targets can be specified");r?(p=d["pino-worker"]||Xi(__dirname,"worker.js"),c.targets=
|
|
843
843
|
r.filter(l=>l.target).map(l=>({...l,target:h(l.target)})),c.pipelines=r.filter(l=>l.pipeline).map(l=>l.pipeline.map(w=>({
|
|
844
844
|
...w,level:l.level,target:h(w.target)})))):t&&(p=d["pino-worker"]||Xi(__dirname,"worker.js"),c.pipelines=[t.map(l=>({...l,
|
|
845
|
-
target:h(l.target)}))]),n&&(c.levels=n),o&&(c.dedupe=o),c.pinoWillSendConfig=!0;let g=r||t?"pino.transport":p;return
|
|
845
|
+
target:h(l.target)}))]),n&&(c.levels=n),o&&(c.dedupe=o),c.pinoWillSendConfig=!0;let g=r||t?"pino.transport":p;return hb(
|
|
846
846
|
h(p),c,i,a,g);function h(l){if(l=d[l]||l,Zl(l)||l.indexOf("file://")===0)return l;if(l==="pino/file")return Xi(__dirname,
|
|
847
|
-
"..","file.js");let w;for(let _ of u)try{let f=_==="node:repl"?process.cwd()+
|
|
848
|
-
if(!w)throw new Error(`unable to determine transport target for "${l}"`);return w}}Ql.exports=
|
|
849
|
-
ts=Al(),td=Fi(),{lsCacheSym:
|
|
850
|
-
stringifySym:ud,stringifySafeSym:rs,wildcardFirstSym:ld,nestedKeySym:
|
|
851
|
-
nestedKeyStrSym:
|
|
852
|
-
".").map(e=>Number(e)),od=
|
|
847
|
+
"..","file.js");let w;for(let _ of u)try{let f=_==="node:repl"?process.cwd()+ab:_;w=ob(f).resolve(l);break}catch{continue}
|
|
848
|
+
if(!w)throw new Error(`unable to determine transport target for "${l}"`);return w}}Ql.exports=wb});var Cn=z((aj,fd)=>{"use strict";var _b=X("node:diagnostics_channel"),ed=bl(),{mapHttpRequest:bb,mapHttpResponse:Eb}=$i(),
|
|
849
|
+
ts=Al(),td=Fi(),{lsCacheSym:Sb,chindingsSym:sd,writeSym:rd,serializersSym:ad,formatOptsSym:nd,endSym:vb,stringifiersSym:cd,
|
|
850
|
+
stringifySym:ud,stringifySafeSym:rs,wildcardFirstSym:ld,nestedKeySym:Tb,formattersSym:dd,messageKeySym:Ib,errorKeySym:Ob,
|
|
851
|
+
nestedKeyStrSym:Rb,msgPrefixSym:An}=Nt(),{isMainThread:Ab}=X("worker_threads"),Pb=Qi(),[Cb]=process.versions.node.split(
|
|
852
|
+
".").map(e=>Number(e)),od=_b.tracingChannel("pino_asJson"),es=Cb>=25?e=>JSON.stringify(e):jb;function xt(){}function Nb(e,t){
|
|
853
853
|
if(!t)return r;return function(...o){t.call(this,o,r,e)};function r(n,...o){if(typeof n=="object"){let i=n;n!==null&&(n.
|
|
854
|
-
method&&n.headers&&n.socket?n=
|
|
854
|
+
method&&n.headers&&n.socket?n=bb(n):typeof n.setHeader=="function"&&(n=Eb(n)));let s;i===null&&o.length===0?s=[null]:(i=
|
|
855
855
|
o.shift(),s=o),typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[rd](n,ed(i,s,this[nd]),e)}else{let i=n===
|
|
856
|
-
void 0?o.shift():n;typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[rd](null,ed(i,o,this[nd]),e)}}}function
|
|
856
|
+
void 0?o.shift():n;typeof this[An]=="string"&&i!==void 0&&i!==null&&(i=this[An]+i),this[rd](null,ed(i,o,this[nd]),e)}}}function jb(e){
|
|
857
857
|
let t="",r=0,n=!1,o=255,i=e.length;if(i>100)return JSON.stringify(e);for(var s=0;s<i&&o>=32;s++)o=e.charCodeAt(s),(o===34||
|
|
858
|
-
o===92)&&(t+=e.slice(r,s)+"\\",r=s,n=!0);return n?t+=e.slice(r):t=e,o<32?JSON.stringify(e):'"'+t+'"'}function
|
|
858
|
+
o===92)&&(t+=e.slice(r,s)+"\\",r=s,n=!0);return n?t+=e.slice(r):t=e,o<32?JSON.stringify(e):'"'+t+'"'}function xb(e,t,r,n){
|
|
859
859
|
if(od.hasSubscribers===!1)return id.call(this,e,t,r,n);let o={instance:this,arguments};return od.traceSync(id,o,this,e,t,
|
|
860
|
-
r,n)}function id(e,t,r,n){let o=this[ud],i=this[rs],s=this[cd],a=this[
|
|
861
|
-
h=this[
|
|
860
|
+
r,n)}function id(e,t,r,n){let o=this[ud],i=this[rs],s=this[cd],a=this[vb],c=this[sd],u=this[ad],d=this[dd],p=this[Ib],g=this[Ob],
|
|
861
|
+
h=this[Sb][r]+n;h=h+c;let l;d.log&&(e=d.log(e));let w=s[ld],_="";for(let m in e)if(l=e[m],Object.prototype.hasOwnProperty.
|
|
862
862
|
call(e,m)&&l!==void 0){u[m]?l=u[m](l):m===g&&u.err&&(l=u.err(l));let y=s[m]||w;switch(typeof l){case"undefined":case"fun\
|
|
863
863
|
ction":continue;case"number":Number.isFinite(l)===!1&&(l=null);case"boolean":y&&(l=y(l));break;case"string":l=(y||es)(l);
|
|
864
864
|
break;default:l=(y||o)(l,i)}if(l===void 0)continue;let E=es(m);_+=","+E+":"+l}let f="";if(t!==void 0){l=u[p]?u[p](t):t;let m=s[p]||
|
|
865
865
|
w;switch(typeof l){case"function":break;case"number":Number.isFinite(l)===!1&&(l=null);case"boolean":m&&(l=m(l)),f=',"'+
|
|
866
|
-
p+'":'+l;break;case"string":l=(m||es)(l),f=',"'+p+'":'+l;break;default:l=(m||o)(l,i),f=',"'+p+'":'+l}}return this[
|
|
867
|
-
h+this[
|
|
866
|
+
p+'":'+l;break;case"string":l=(m||es)(l),f=',"'+p+'":'+l;break;default:l=(m||o)(l,i),f=',"'+p+'":'+l}}return this[Tb]&&_?
|
|
867
|
+
h+this[Rb]+_.slice(1)+"}"+f+a:h+_+f+a}function kb(e,t){let r,n=e[sd],o=e[ud],i=e[rs],s=e[cd],a=s[ld],c=e[ad],u=e[dd].bindings;
|
|
868
868
|
t=u(t);for(let d in t)if(r=t[d],((d.length<5||d!=="level"&&d!=="serializers"&&d!=="formatters"&&d!=="customLevels")&&t.hasOwnProperty(
|
|
869
|
-
d)&&r!==void 0)===!0){if(r=c[d]?c[d](r):r,r=(s[d]||a||o)(r,i),r===void 0)continue;n+=',"'+d+'":'+r}return n}function
|
|
870
|
-
return e.write!==e.constructor.prototype.write}function Pn(e){let t=new ts(e);return t.on("error",r),!e.sync&&
|
|
871
|
-
t
|
|
872
|
-
t.destroy=xt;return}t.removeListener("error",r),t.emit("error",n)}}function
|
|
873
|
-
e.on("drain",function(){e.end()})):e.flushSync())}function
|
|
869
|
+
d)&&r!==void 0)===!0){if(r=c[d]?c[d](r):r,r=(s[d]||a||o)(r,i),r===void 0)continue;n+=',"'+d+'":'+r}return n}function $b(e){
|
|
870
|
+
return e.write!==e.constructor.prototype.write}function Pn(e){let t=new ts(e);return t.on("error",r),!e.sync&&Ab&&(td.register(
|
|
871
|
+
t,Lb),t.on("close",function(){td.unregister(t)})),t;function r(n){if(n.code==="EPIPE"){t.write=xt,t.end=xt,t.flushSync=xt,
|
|
872
|
+
t.destroy=xt;return}t.removeListener("error",r),t.emit("error",n)}}function Lb(e,t){e.destroyed||(t==="beforeExit"?(e.flush(),
|
|
873
|
+
e.on("drain",function(){e.end()})):e.flushSync())}function Mb(e){return function(r,n,o={},i){if(typeof o=="string")i=Pn(
|
|
874
874
|
{dest:o}),o={};else if(typeof i=="string"){if(o&&o.transport)throw Error("only one of option.transport or stream can be \
|
|
875
875
|
specified");i=Pn({dest:i})}else if(o instanceof ts||o.writable||o._writableState)i=o,o={};else if(o.transport){if(o.transport instanceof
|
|
876
876
|
ts||o.transport.writable||o.transport._writableState)throw Error("option.transport do not allow stream, please pass to o\
|
|
877
877
|
ption directly. e.g. pino(transport)");if(o.transport.targets&&o.transport.targets.length&&o.formatters&&typeof o.formatters.
|
|
878
878
|
level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;o.customLevels&&(c=
|
|
879
|
-
o.useOnlyCustomLevels?o.customLevels:Object.assign({},o.levels,o.customLevels)),i=
|
|
879
|
+
o.useOnlyCustomLevels?o.customLevels:Object.assign({},o.levels,o.customLevels)),i=Pb({caller:n,...o.transport,levels:c})}
|
|
880
880
|
if(o=Object.assign({},e,o),o.serializers=Object.assign({},e.serializers,o.serializers),o.formatters=Object.assign({},e.formatters,
|
|
881
881
|
o.formatters),o.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (htt\
|
|
882
882
|
ps://github.com/pinojs/pino-pretty)");let{enabled:s,onChild:a}=o;return s===!1&&(o.level="silent"),a||(o.onChild=xt),i||
|
|
883
|
-
(
|
|
883
|
+
($b(process.stdout)?i=process.stdout:i=Pn({fd:process.stdout.fd||1})),{opts:o,stream:i}}}function Db(e,t){try{return JSON.
|
|
884
884
|
stringify(e)}catch{try{return(t||this[rs])(e)}catch{return'"[unable to serialize, circular reference is too complex to a\
|
|
885
|
-
nalyze]"'}}}function
|
|
886
|
-
Number.isFinite(t)?t:e===void 0?1:e}fd.exports={noop:xt,buildSafeSonicBoom:Pn,asChindings:
|
|
887
|
-
stringify:
|
|
888
|
-
SORTING_ORDER:
|
|
889
|
-
hooksSym:
|
|
890
|
-
Te.fatal,e);return function(...r){let n=this[
|
|
885
|
+
nalyze]"'}}}function Vb(e,t,r){return{level:e,bindings:t,log:r}}function Ub(e){let t=Number(e);return typeof e=="string"&&
|
|
886
|
+
Number.isFinite(t)?t:e===void 0?1:e}fd.exports={noop:xt,buildSafeSonicBoom:Pn,asChindings:kb,asJson:xb,genLog:Nb,createArgsNormalizer:Mb,
|
|
887
|
+
stringify:Db,buildFormatters:Vb,normalizeDestFileDescriptor:Ub}});var Nn=z((cj,pd)=>{var Bb={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},zb={ASC:"ASC",DESC:"DESC"};pd.exports={DEFAULT_LEVELS:Bb,
|
|
888
|
+
SORTING_ORDER:zb}});var is=z((uj,yd)=>{"use strict";var{lsCacheSym:Gb,levelValSym:ns,useOnlyCustomLevelsSym:Fb,streamSym:Hb,formattersSym:qb,
|
|
889
|
+
hooksSym:Wb,levelCompSym:md}=Nt(),{noop:Yb,genLog:ot}=Cn(),{DEFAULT_LEVELS:Te,SORTING_ORDER:hd}=Nn(),gd={fatal:e=>{let t=ot(
|
|
890
|
+
Te.fatal,e);return function(...r){let n=this[Hb];if(t.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},
|
|
891
891
|
error:e=>ot(Te.error,e),warn:e=>ot(Te.warn,e),info:e=>ot(Te.info,e),debug:e=>ot(Te.debug,e),trace:e=>ot(Te.trace,e)},os=Object.
|
|
892
|
-
keys(Te).reduce((e,t)=>(e[Te[t]]=t,e),{}),
|
|
893
|
-
let t=e[
|
|
894
|
-
n,e}function
|
|
895
|
-
return!1}}function
|
|
896
|
-
level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[ns],o=this[ns]=r[e],i=this[
|
|
897
|
-
a=this[
|
|
898
|
-
"level-change",e,o,t[n],n,this)}function
|
|
899
|
-
let{values:t}=this.levels,r=t[e];return r!==void 0&&this[md](r,this[ns])}function
|
|
900
|
-
function
|
|
892
|
+
keys(Te).reduce((e,t)=>(e[Te[t]]=t,e),{}),Jb=Object.keys(os).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{});function Kb(e){
|
|
893
|
+
let t=e[qb].level,{labels:r}=e.levels,n={};for(let o in r){let i=t(r[o],Number(o));n[o]=JSON.stringify(i).slice(0,-1)}return e[Gb]=
|
|
894
|
+
n,e}function Xb(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:
|
|
895
|
+
return!1}}function Zb(e){let{labels:t,values:r}=this.levels;if(typeof e=="number"){if(t[e]===void 0)throw Error("unknown\
|
|
896
|
+
level value"+e);e=t[e]}if(r[e]===void 0)throw Error("unknown level "+e);let n=this[ns],o=this[ns]=r[e],i=this[Fb],s=this[md],
|
|
897
|
+
a=this[Wb].logMethod;for(let c in r){if(s(r[c],o)===!1){this[c]=Yb;continue}this[c]=Xb(c,i)?gd[c](a):ot(r[c],a)}this.emit(
|
|
898
|
+
"level-change",e,o,t[n],n,this)}function Qb(e){let{levels:t,levelVal:r}=this;return t&&t.labels?t.labels[r]:""}function eE(e){
|
|
899
|
+
let{values:t}=this.levels,r=t[e];return r!==void 0&&this[md](r,this[ns])}function tE(e,t,r){return e===hd.DESC?t<=r:t>=r}
|
|
900
|
+
function rE(e){return typeof e=="string"?tE.bind(null,e):e}function nE(e=null,t=!1){let r=e?Object.keys(e).reduce((i,s)=>(i[e[s]]=
|
|
901
901
|
s,i),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:os,r),o=Object.assign(Object.
|
|
902
|
-
create(Object.prototype,{silent:{value:1/0}}),t?null:Te,e);return{labels:n,values:o}}function
|
|
902
|
+
create(Object.prototype,{silent:{value:1/0}}),t?null:Te,e);return{labels:n,values:o}}function oE(e,t,r){if(typeof e=="nu\
|
|
903
903
|
mber"){if(![].concat(Object.keys(t||{}).map(i=>t[i]),r?[]:Object.keys(os).map(i=>+i),1/0).includes(e))throw Error(`defau\
|
|
904
904
|
lt level:${e} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),
|
|
905
|
-
r?null:Te,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function
|
|
905
|
+
r?null:Te,t);if(!(e in n))throw Error(`default level:${e} must be included in custom levels`)}function iE(e,t){let{labels:r,
|
|
906
906
|
values:n}=e;for(let o in t){if(o in n)throw Error("levels cannot be overridden");if(t[o]in r)throw Error("pre-existing l\
|
|
907
|
-
evel values cannot be used for new levels")}}function
|
|
908
|
-
hd).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}yd.exports={initialLsCache:
|
|
909
|
-
genLsCache:
|
|
910
|
-
genLevelComparison:
|
|
911
|
-
chindingsSym:xn,mixinSym:
|
|
912
|
-
serializersSym:it,formattersSym:pr,errorKeySym:
|
|
913
|
-
stringifySym:
|
|
914
|
-
mappings:
|
|
915
|
-
stringify:bd,noop:vd}=Cn(),{version:
|
|
916
|
-
isLevelEnabled:
|
|
917
|
-
throw Error("levelVal is read-only")},get msgPrefix(){return this[us]},get[Symbol.toStringTag](){return"Pino"},[
|
|
918
|
-
[Ed]:
|
|
919
|
-
function
|
|
907
|
+
evel values cannot be used for new levels")}}function sE(e){if(typeof e!="function"&&!(typeof e=="string"&&Object.values(
|
|
908
|
+
hd).includes(e)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}yd.exports={initialLsCache:Jb,
|
|
909
|
+
genLsCache:Kb,levelMethods:gd,getLevel:Qb,setLevel:Zb,isLevelEnabled:eE,mappings:nE,assertNoLevelCollisions:iE,assertDefaultLevelFound:oE,
|
|
910
|
+
genLevelComparison:rE,assertLevelComparison:sE}});var ss=z((lj,wd)=>{"use strict";wd.exports={version:"10.3.1"}});var Od=z((fj,Id)=>{"use strict";var{EventEmitter:aE}=X("node:events"),{lsCacheSym:cE,levelValSym:uE,setLevelSym:cs,getLevelSym:_d,
|
|
911
|
+
chindingsSym:xn,mixinSym:lE,asJsonSym:Ed,writeSym:dE,mixinMergeStrategySym:fE,timeSym:pE,timeSliceIndexSym:mE,streamSym:Sd,
|
|
912
|
+
serializersSym:it,formattersSym:pr,errorKeySym:hE,messageKeySym:gE,useOnlyCustomLevelsSym:yE,needsMetadataGsym:wE,redactFmtSym:_E,
|
|
913
|
+
stringifySym:bE,formatOptsSym:EE,stringifiersSym:SE,msgPrefixSym:us,hooksSym:vE}=Nt(),{getLevel:TE,setLevel:IE,isLevelEnabled:OE,
|
|
914
|
+
mappings:RE,initialLsCache:AE,genLsCache:PE,assertNoLevelCollisions:CE}=is(),{asChindings:ls,asJson:NE,buildFormatters:as,
|
|
915
|
+
stringify:bd,noop:vd}=Cn(),{version:jE}=ss(),xE=Vi(),kE=class{},Td={constructor:kE,child:$E,bindings:LE,setBindings:ME,flush:UE,
|
|
916
|
+
isLevelEnabled:OE,version:jE,get level(){return this[_d]()},set level(e){this[cs](e)},get levelVal(){return this[uE]},set levelVal(e){
|
|
917
|
+
throw Error("levelVal is read-only")},get msgPrefix(){return this[us]},get[Symbol.toStringTag](){return"Pino"},[cE]:AE,[dE]:VE,
|
|
918
|
+
[Ed]:NE,[_d]:TE,[cs]:IE};Object.setPrototypeOf(Td,aE.prototype);Id.exports=function(){return Object.create(Td)};var jn=e=>e;
|
|
919
|
+
function $E(e,t){if(!e)throw Error("missing bindings for child Pino");let r=this[it],n=this[pr],o=Object.create(this);if(t==
|
|
920
920
|
null)return o[pr].bindings!==jn&&(o[pr]=as(n.level,jn,n.log)),o[xn]=ls(o,e),this.onChild!==vd&&this.onChild(o),o;if(t.hasOwnProperty(
|
|
921
921
|
"serializers")===!0){o[it]=Object.create(null);for(let u in r)o[it][u]=r[u];let a=Object.getOwnPropertySymbols(r);for(var i=0;i<
|
|
922
922
|
a.length;i++){let u=a[i];o[it][u]=r[u]}for(let u in t.serializers)o[it][u]=t.serializers[u];let c=Object.getOwnPropertySymbols(
|
|
923
923
|
t.serializers);for(var s=0;s<c.length;s++){let u=c[s];o[it][u]=t.serializers[u]}}else o[it]=r;if(t.hasOwnProperty("forma\
|
|
924
924
|
tters")){let{level:a,bindings:c,log:u}=t.formatters;o[pr]=as(a||n.level,c||jn,u||n.log)}else o[pr]=as(n.level,jn,n.log);
|
|
925
|
-
if(t.hasOwnProperty("customLevels")===!0&&(
|
|
926
|
-
redact=="object"&&t.redact!==null||Array.isArray(t.redact)){o.redact=t.redact;let a=
|
|
927
|
-
o[
|
|
928
|
-
t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;o[cs](a)}return this.onChild(o),o}function
|
|
929
|
-
let t=`{${this[xn].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function
|
|
930
|
-
this[xn]=t}function
|
|
931
|
-
a=this[
|
|
932
|
-
e[s]===void 0&&e[i]&&(t=e[i].message)),o&&(c=a(c,o(c,r,this)));let d=this[Ed](c,t,r,n),p=this[Sd];p[
|
|
933
|
-
r,p.lastObj=c,p.lastMsg=t,p.lastTime=n.slice(this[
|
|
925
|
+
if(t.hasOwnProperty("customLevels")===!0&&(CE(this.levels,t.customLevels),o.levels=RE(t.customLevels,o[yE]),PE(o)),typeof t.
|
|
926
|
+
redact=="object"&&t.redact!==null||Array.isArray(t.redact)){o.redact=t.redact;let a=xE(o.redact,bd),c={stringify:a[_E]};
|
|
927
|
+
o[bE]=bd,o[SE]=a,o[EE]=c}if(typeof t.msgPrefix=="string"&&(o[us]=(this[us]||"")+t.msgPrefix),o[xn]=ls(o,e),t.level!==void 0&&
|
|
928
|
+
t.level!==this.level||t.hasOwnProperty("customLevels")){let a=t.level||this.level;o[cs](a)}return this.onChild(o),o}function LE(){
|
|
929
|
+
let t=`{${this[xn].substr(1)}}`,r=JSON.parse(t);return delete r.pid,delete r.hostname,r}function ME(e){let t=ls(this,e);
|
|
930
|
+
this[xn]=t}function DE(e,t){return Object.assign(t,e)}function VE(e,t,r){let n=this[pE](),o=this[lE],i=this[hE],s=this[gE],
|
|
931
|
+
a=this[fE]||DE,c,u=this[vE].streamWrite;e==null?c={}:e instanceof Error?(c={[i]:e},t===void 0&&(t=e.message)):(c=e,t===void 0&&
|
|
932
|
+
e[s]===void 0&&e[i]&&(t=e[i].message)),o&&(c=a(c,o(c,r,this)));let d=this[Ed](c,t,r,n),p=this[Sd];p[wE]===!0&&(p.lastLevel=
|
|
933
|
+
r,p.lastObj=c,p.lastMsg=t,p.lastTime=n.slice(this[mE]),p.lastLogger=this),p.write(u?u(d):d)}function UE(e){if(e!=null&&typeof e!=
|
|
934
934
|
"function")throw Error("callback must be a function");let t=this[Sd];typeof t.flush=="function"?t.flush(e||vd):e&&e()}});var Cd=z((ms,Pd)=>{"use strict";var{hasOwnProperty:mr}=Object.prototype,at=ps();at.configure=ps;at.stringify=at;at.default=
|
|
935
|
-
at;ms.stringify=at;ms.configure=ps;Pd.exports=at;var
|
|
936
|
-
length<5e3&&!
|
|
937
|
-
length;r++){let n=e[r],o=r;for(;o!==0&&e[o-1]>n;)e[o]=e[o-1],o--;e[o]=n}return e}var
|
|
938
|
-
Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function fs(e){return
|
|
935
|
+
at;ms.stringify=at;ms.configure=ps;Pd.exports=at;var BE=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Be(e){return e.
|
|
936
|
+
length<5e3&&!BE.test(e)?`"${e}"`:JSON.stringify(e)}function ds(e,t){if(e.length>200||t)return e.sort(t);for(let r=1;r<e.
|
|
937
|
+
length;r++){let n=e[r],o=r;for(;o!==0&&e[o-1]>n;)e[o]=e[o-1],o--;e[o]=n}return e}var zE=Object.getOwnPropertyDescriptor(
|
|
938
|
+
Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function fs(e){return zE.call(e)!==void 0&&
|
|
939
939
|
e.length!==0}function Rd(e,t,r){e.length<r&&(r=e.length);let n=t===","?"":" ",o=`"0":${n}${e[0]}`;for(let i=1;i<r;i++)o+=
|
|
940
|
-
`${t}"${i}":${n}${e[i]}`;return o}function
|
|
940
|
+
`${t}"${i}":${n}${e[i]}`;return o}function GE(e){if(mr.call(e,"circularValue")){let t=e.circularValue;if(typeof t=="stri\
|
|
941
941
|
ng")return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting cir\
|
|
942
942
|
cular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null o\
|
|
943
|
-
r undefined')}return'"[Circular]"'}function
|
|
943
|
+
r undefined')}return'"[Circular]"'}function FE(e){let t;if(mr.call(e,"deterministic")&&(t=e.deterministic,typeof t!="boo\
|
|
944
944
|
lean"&&typeof t!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator fun\
|
|
945
|
-
ction');return t===void 0?!0:t}function
|
|
945
|
+
ction');return t===void 0?!0:t}function HE(e,t){let r;if(mr.call(e,t)&&(r=e[t],typeof r!="boolean"))throw new TypeError(
|
|
946
946
|
`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function Ad(e,t){let r;if(mr.call(e,t)){if(r=e[t],
|
|
947
947
|
typeof r!="number")throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(
|
|
948
948
|
`The "${t}" argument must be an integer`);if(r<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?
|
|
949
|
-
1/0:r}function st(e){return e===1?"1 item":`${e} items`}function
|
|
950
|
-
typeof r=="number")&&t.add(String(r));return t}function
|
|
949
|
+
1/0:r}function st(e){return e===1?"1 item":`${e} items`}function qE(e){let t=new Set;for(let r of e)(typeof r=="string"||
|
|
950
|
+
typeof r=="number")&&t.add(String(r));return t}function WE(e){if(mr.call(e,"strict")){let t=e.strict;if(typeof t!="boole\
|
|
951
951
|
an")throw new TypeError('The "strict" argument must be of type boolean');if(t)return r=>{let n=`Object can not safely be\
|
|
952
952
|
stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function ps(e){
|
|
953
|
-
e={...e};let t=
|
|
954
|
-
e,"bigint"),o=
|
|
953
|
+
e={...e};let t=WE(e);t&&(e.bigint===void 0&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=GE(e),n=HE(
|
|
954
|
+
e,"bigint"),o=FE(e),i=typeof o=="function"?o:void 0,s=Ad(e,"maximumDepth"),a=Ad(e,"maximumBreadth");function c(h,l,w,_,f,m){
|
|
955
955
|
let y=l[h];switch(typeof y=="object"&&y!==null&&typeof y.toJSON=="function"&&(y=y.toJSON(h)),y=_.call(l,h,y),typeof y){case"\
|
|
956
956
|
string":return Be(y);case"object":{if(y===null)return"null";if(w.indexOf(y)!==-1)return r;let E="",T=",",S=m;if(Array.isArray(
|
|
957
957
|
y)){if(y.length===0)return"[]";if(s<w.length+1)return'"[Array]"';w.push(y),f!==""&&(m+=f,E+=`
|
|
@@ -1006,97 +1006,97 @@ E=",")}if(y>a){let S=y-a;_+=`${E}"...":"${st(S)} not stringified"`}return w.pop(
|
|
|
1006
1006
|
l)?String(l):t?t(l):"null";case"boolean":return l===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(
|
|
1007
1007
|
l);default:return t?t(l):void 0}}function g(h,l,w){if(arguments.length>1){let _="";if(typeof w=="number"?_=" ".repeat(Math.
|
|
1008
1008
|
min(w,10)):typeof w=="string"&&(_=w.slice(0,10)),l!=null){if(typeof l=="function")return c("",{"":h},[],l,_,"");if(Array.
|
|
1009
|
-
isArray(l))return u("",h,[],
|
|
1009
|
+
isArray(l))return u("",h,[],qE(l),_,"")}if(_.length!==0)return d("",h,[],_,"")}return p("",h,[])}return g}});var kd=z((pj,xd)=>{"use strict";var hs=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:jd}=Nn(),YE=jd.info;function JE(e,t){
|
|
1010
1010
|
e=e||[],t=t||{dedupe:!1};let r=Object.create(jd);r.silent=1/0,t.levels&&typeof t.levels=="object"&&Object.keys(t.levels).
|
|
1011
1011
|
forEach(p=>{r[p]=t.levels[p]});let n={write:o,add:a,remove:c,emit:i,flushSync:s,end:u,minLevel:0,lastId:0,streams:[],clone:d,
|
|
1012
1012
|
[hs]:!0,streamLevels:r};return Array.isArray(e)?e.forEach(a,n):a.call(n,e),e=null,n;function o(p){let g,h=this.lastLevel,
|
|
1013
|
-
{streams:l}=this,w=0,_;for(let f=
|
|
1013
|
+
{streams:l}=this,w=0,_;for(let f=KE(l.length,t.dedupe);ZE(f,l.length,t.dedupe);f=XE(f,t.dedupe))if(g=l[f],g.level<=h){if(w!==
|
|
1014
1014
|
0&&w!==g.level)break;if(_=g.stream,_[hs]){let{lastTime:m,lastMsg:y,lastObj:E,lastLogger:T}=this;_.lastLevel=h,_.lastTime=
|
|
1015
1015
|
m,_.lastMsg=y,_.lastObj=E,_.lastLogger=T}_.write(p),t.dedupe&&(w=g.level)}else if(!t.dedupe)break}function i(...p){for(let{
|
|
1016
1016
|
stream:g}of this.streams)typeof g.emit=="function"&&g.emit(...p)}function s(){for(let{stream:p}of this.streams)typeof p.
|
|
1017
1017
|
flushSync=="function"&&p.flushSync()}function a(p){if(!p)return n;let g=typeof p.write=="function"||p.stream,h=p.write?p:
|
|
1018
1018
|
p.stream;if(!g)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:l,
|
|
1019
1019
|
streamLevels:w}=this,_;typeof p.levelVal=="number"?_=p.levelVal:typeof p.level=="string"?_=w[p.level]:typeof p.level=="n\
|
|
1020
|
-
umber"?_=p.level:_=
|
|
1020
|
+
umber"?_=p.level:_=YE;let f={stream:h,level:_,levelVal:void 0,id:++n.lastId};return l.unshift(f),l.sort(Nd),this.minLevel=
|
|
1021
1021
|
l[0].level,n}function c(p){let{streams:g}=this,h=g.findIndex(l=>l.id===p);return h>=0&&(g.splice(h,1),g.sort(Nd),this.minLevel=
|
|
1022
1022
|
g.length>0?g[0].level:-1),n}function u(){for(let{stream:p}of this.streams)typeof p.flushSync=="function"&&p.flushSync(),
|
|
1023
1023
|
p.end()}function d(p){let g=new Array(this.streams.length);for(let h=0;h<g.length;h++)g[h]={level:p,stream:this.streams[h].
|
|
1024
1024
|
stream};return{write:o,add:a,remove:c,minLevel:p,streams:g,clone:d,emit:i,flushSync:s,[hs]:!0}}}function Nd(e,t){return e.
|
|
1025
|
-
level-t.level}function
|
|
1026
|
-
exports=
|
|
1027
|
-
{assertDefaultLevelFound:
|
|
1028
|
-
SORTING_ORDER:
|
|
1029
|
-
noop:
|
|
1030
|
-
stringifySym:Vd,stringifySafeSym:ys,stringifiersSym:Ud,setLevelSym:
|
|
1031
|
-
nestedKeySym:
|
|
1032
|
-
msgPrefixSym:
|
|
1033
|
-
ASC,levels:qd,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:
|
|
1034
|
-
Object.create(null),{err:
|
|
1025
|
+
level-t.level}function KE(e,t){return t?e-1:0}function XE(e,t){return t?e-1:e+1}function ZE(e,t,r){return r?e>=0:e<t}xd.
|
|
1026
|
+
exports=JE});var Yd=z((mj,ge)=>{"use strict";var QE=X("node:os"),zd=$i(),eS=Li(),tS=Vi(),Gd=wl(),rS=Od(),Fd=Nt(),{configure:nS}=Cd(),
|
|
1027
|
+
{assertDefaultLevelFound:oS,mappings:Hd,genLsCache:iS,genLevelComparison:sS,assertLevelComparison:aS}=is(),{DEFAULT_LEVELS:qd,
|
|
1028
|
+
SORTING_ORDER:cS}=Nn(),{createArgsNormalizer:uS,asChindings:lS,buildSafeSonicBoom:$d,buildFormatters:dS,stringify:gs,normalizeDestFileDescriptor:Ld,
|
|
1029
|
+
noop:fS}=Cn(),{version:pS}=ss(),{chindingsSym:Md,redactFmtSym:mS,serializersSym:Dd,timeSym:hS,timeSliceIndexSym:gS,streamSym:yS,
|
|
1030
|
+
stringifySym:Vd,stringifySafeSym:ys,stringifiersSym:Ud,setLevelSym:wS,endSym:_S,formatOptsSym:bS,messageKeySym:ES,errorKeySym:SS,
|
|
1031
|
+
nestedKeySym:vS,mixinSym:TS,levelCompSym:IS,useOnlyCustomLevelsSym:OS,formattersSym:Bd,hooksSym:RS,nestedKeyStrSym:AS,mixinMergeStrategySym:PS,
|
|
1032
|
+
msgPrefixSym:CS}=Fd,{epochTime:Wd,nullTime:NS}=Gd,{pid:jS}=process,xS=QE.hostname(),kS=zd.err,$S={level:"info",levelComparison:cS.
|
|
1033
|
+
ASC,levels:qd,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:jS,hostname:xS},serializers:Object.assign(
|
|
1034
|
+
Object.create(null),{err:kS}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),
|
|
1035
1035
|
hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Wd,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,
|
|
1036
|
-
depthLimit:5,edgeLimit:100}
|
|
1037
|
-
t,
|
|
1036
|
+
depthLimit:5,edgeLimit:100},LS=uS($S),MS=Object.assign(Object.create(null),zd);function ws(...e){let t={},{opts:r,stream:n}=LS(
|
|
1037
|
+
t,eS(),...e);r.level&&typeof r.level=="string"&&qd[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{
|
|
1038
1038
|
redact:o,crlf:i,serializers:s,timestamp:a,messageKey:c,errorKey:u,nestedKey:d,base:p,name:g,level:h,customLevels:l,levelComparison:w,
|
|
1039
1039
|
mixin:_,mixinMergeStrategy:f,useOnlyCustomLevels:m,formatters:y,hooks:E,depthLimit:T,edgeLimit:S,onChild:v,msgPrefix:R}=r,
|
|
1040
|
-
O=
|
|
1040
|
+
O=nS({maximumDepth:T,maximumBreadth:S}),A=dS(y.level,y.bindings,y.log),$=gs.bind({[ys]:O}),P=o?tS(o,$):{},C=o?{stringify:P[mS]}:
|
|
1041
1041
|
{stringify:$},D="}"+(i?`\r
|
|
1042
1042
|
`:`
|
|
1043
|
-
`),Y=
|
|
1044
|
-
{},p,{name:g})));let Qe=a instanceof Function?a:a?Wd:
|
|
1043
|
+
`),Y=lS.bind(null,{[Md]:"",[Dd]:s,[Ud]:P,[Vd]:gs,[ys]:O,[Bd]:A}),ae="";p!==null&&(g===void 0?ae=Y(p):ae=Y(Object.assign(
|
|
1044
|
+
{},p,{name:g})));let Qe=a instanceof Function?a:a?Wd:NS,ce=Qe().indexOf(":")+1;if(m&&!l)throw Error("customLevels is req\
|
|
1045
1045
|
uired if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - ex\
|
|
1046
|
-
pected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);
|
|
1046
|
+
pected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);oS(
|
|
1047
1047
|
h,l,m);let me=Hd(l,m);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:me,messageKey:c,errorKey:u}}),
|
|
1048
|
-
|
|
1049
|
-
[
|
|
1050
|
-
[
|
|
1048
|
+
aS(w);let Uo=sS(w);return Object.assign(t,{levels:me,[IS]:Uo,[OS]:m,[yS]:n,[hS]:Qe,[gS]:ce,[Vd]:gs,[ys]:O,[Ud]:P,[_S]:D,
|
|
1049
|
+
[bS]:C,[ES]:c,[SS]:u,[vS]:d,[AS]:d?`,${JSON.stringify(d)}:{`:"",[Dd]:s,[TS]:_,[PS]:f,[Md]:ae,[Bd]:A,[RS]:E,silent:fS,onChild:v,
|
|
1050
|
+
[CS]:R}),Object.setPrototypeOf(t,rS()),iS(t),t[wS](h),t}ge.exports=ws;ge.exports.destination=(e=process.stdout.fd)=>typeof e==
|
|
1051
1051
|
"object"?(e.dest=Ld(e.dest||process.stdout.fd),$d(e)):$d({dest:Ld(e),minLength:0});ge.exports.transport=Qi();ge.exports.
|
|
1052
|
-
multistream=kd();ge.exports.levels=Hd();ge.exports.stdSerializers=
|
|
1053
|
-
exports.symbols=Fd;ge.exports.version=
|
|
1054
|
-
e,""),n=Kd(t,kn);return!r||n==="silent"?!1:Jd[r]>=Jd[n]}var kn,
|
|
1052
|
+
multistream=kd();ge.exports.levels=Hd();ge.exports.stdSerializers=MS;ge.exports.stdTimeFunctions=Object.assign({},Gd);ge.
|
|
1053
|
+
exports.symbols=Fd;ge.exports.version=pS;ge.exports.default=ws;ge.exports.pino=ws});function Kd(e="",t=kn){let r=String(e||"").trim().toLowerCase();return DS.includes(r)?r:t}function VS(e="info",t=kn){let r=Kd(
|
|
1054
|
+
e,""),n=Kd(t,kn);return!r||n==="silent"?!1:Jd[r]>=Jd[n]}var kn,DS,Jd,hj,Xd=b(()=>{kn="warn",DS=Object.freeze(["fatal","e\
|
|
1055
1055
|
rror","warn","info","debug","trace","silent"]),Jd=Object.freeze({trace:10,debug:20,info:30,warn:40,error:50,fatal:60,silent:1/0});
|
|
1056
|
-
hj=Object.freeze({isVibe64LogLevelEnabled:
|
|
1057
|
-
"")||t}function
|
|
1058
|
-
|
|
1056
|
+
hj=Object.freeze({isVibe64LogLevelEnabled:VS})});function Zd(e="",t="vibe64.operational_event"){return String(e||"").trim().replace(/[^a-zA-Z0-9_.:-]+/gu,"_").replace(/^_+|_+$/gu,
|
|
1057
|
+
"")||t}function qS(e=""){return BS.test(String(e||""))}function $n(e=""){return String(e||"").replace(GS,`$1$2${hr}`).replace(
|
|
1058
|
+
FS,`$1 ${hr}`).replace(zS,`$1$2${hr}`).replace(HS,`$1${hr}@`)}function gr(e,t={}){let{field:r="",seen:n=new WeakSet}=t;return qS(
|
|
1059
1059
|
r)?hr:typeof e=="string"?$n(e):!e||typeof e!="object"?e:n.has(e)?"[circular]":(n.add(e),e instanceof Error?{code:String(
|
|
1060
1060
|
e.code||""),message:$n(e.message),name:String(e.name||"Error"),...Array.isArray(e.errors)?{errors:e.errors.map(o=>gr(o,{
|
|
1061
1061
|
seen:n}))}:{},...e.cause!==void 0?{cause:gr(e.cause,{seen:n})}:{}}:Array.isArray(e)?e.map(o=>gr(o,{seen:n})):Object.fromEntries(
|
|
1062
|
-
Object.entries(e).map(([o,i])=>[o,gr(i,{field:o,seen:n})])))}function
|
|
1063
|
-
e)?e:{};return gr({...t,component:Zd(t.component,"vibe64"),event:Zd(t.event,"vibe64.operational_event")})}var
|
|
1064
|
-
|
|
1062
|
+
Object.entries(e).map(([o,i])=>[o,gr(i,{field:o,seen:n})])))}function WS(e={}){let t=e&&typeof e=="object"&&!Array.isArray(
|
|
1063
|
+
e)?e:{};return gr({...t,component:Zd(t.component,"vibe64"),event:Zd(t.event,"vibe64.operational_event")})}var US,_j,hr,BS,
|
|
1064
|
+
zS,GS,FS,HS,bj,Qd=b(()=>{US=mg(Yd(),1);Xd();_j=Object.freeze(["req.headers.authorization","req.headers.cookie","req.head\
|
|
1065
1065
|
ers['set-cookie']","res.headers['set-cookie']","*.authorization","*.cookie","*.credential","*.credentials","*.databaseUr\
|
|
1066
1066
|
l","*.database_url","*.dsn","*.password","*.secret","*.token","*.apiToken","*.api_token","*.apiKey","*.api_key","*.acces\
|
|
1067
|
-
sToken","*.access_token","*.refreshToken","*.refresh_token"]),hr="[redacted]",
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1067
|
+
sToken","*.access_token","*.refreshToken","*.refresh_token"]),hr="[redacted]",BS=/(?:authorization|password|passphrase|token|secret|credential|api[_-]?key|api[_-]?token|access[_-]?token|refresh[_-]?token|database[_-]?url|dsn)/iu,
|
|
1068
|
+
zS=/\b((?:DATABASE[_-]?URL|DSN)|(?:[A-Za-z_][A-Za-z0-9_-]*?)?(?:PASSWORD|PASS|PASSPHRASE|TOKEN|SECRET|CREDENTIAL|API[_-]?KEY|API[_-]?TOKEN|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|DSN)[A-Za-z0-9_-]*)\b(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,
|
|
1069
|
+
GS=/\b(authorization|proxy-authorization)\b(\s*[:=]\s*)(?:"[^"]*"|'[^']*'|(?:Bearer|Basic)\s+[^\s,;]+|[^\s,;]+)/giu,FS=/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/giu,
|
|
1070
|
+
HS=/\b([a-z][a-z0-9+.-]*:\/\/)([^/@\s:]+):([^/@\s]+)@/giu;bj=Object.freeze({operationalLogFields:WS})});import{AsyncLocalStorage as YS}from"node:async_hooks";function tf(){let e=ef.getStore()||null;if(e?.[_s]&&!e[_s].active())
|
|
1071
1071
|
throw Object.assign(new Error("Practice access ended with its owning callback. Read the saved lesson again."),{code:"vib\
|
|
1072
|
-
e64_practice_scope_expired"});return e}var ef,_s,kt=b(()=>{Ve();ef=new
|
|
1073
|
-
return Ln.resolve(r||t||bs.cwd())}function nf({env:e,home:t=
|
|
1072
|
+
e64_practice_scope_expired"});return e}var ef,_s,kt=b(()=>{Ve();ef=new YS,_s=Symbol("Vibe64 server practice scope")});import Ln from"node:path";import bs from"node:process";import JS from"node:os";function rf(e,t){let r=String(e||"").trim();
|
|
1073
|
+
return Ln.resolve(r||t||bs.cwd())}function nf({env:e,home:t=JS.homedir(),platform:r=bs.platform}){let n=t||bs.cwd();if(r===
|
|
1074
1074
|
"darwin")return rf(Ln.join(n,"Library","Application Support","Vibe64"));let o=String(e.XDG_STATE_HOME||"").trim();return rf(
|
|
1075
|
-
Ln.join(o||Ln.join(n,".local","state"),"vibe64"))}var Es,Mn=b(()=>{Es="VIBE64_SYSTEM_ROOT"});var of,$t=b(()=>{le();Ve();of="vibe64_practice_project_deleted"});import{randomUUID as
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
t,null,2)}
|
|
1080
|
-
`,r)}var yr=b(()=>{});var Vn=b(()=>{yr();le();U()});function Ie(){return globalThis[tv]||rv}var tv,rv,ke=b(()=>{tv=Symbol.for("vibe64.hostProfile"),rv=Object.freeze({runtimePackRoot:"",
|
|
1075
|
+
Ln.join(o||Ln.join(n,".local","state"),"vibe64"))}var Es,Mn=b(()=>{Es="VIBE64_SYSTEM_ROOT"});var of,$t=b(()=>{le();Ve();of="vibe64_practice_project_deleted"});import{randomUUID as KS}from"node:crypto";import{mkdir as XS,open as sf,rename as ZS,rm as QS}from"node:fs/promises";import Ss from"node:path";
|
|
1076
|
+
async function af(e,t,r={}){let{directoryMode:n,fileMode:o}=r,i=Ss.dirname(e);await XS(i,{recursive:!0,mode:n});let s=Ss.
|
|
1077
|
+
join(i,`.${Ss.basename(e)}.${process.pid}.${KS()}.tmp`),a;try{let c=await sf(s,"wx",o);try{await c.writeFile(t,"utf8"),o!==
|
|
1078
|
+
void 0&&await c.chmod(o),await c.sync(),a=await c.stat({bigint:!0})}finally{await c.close()}await ZS(s,e)}finally{await QS(
|
|
1079
|
+
s,{force:!0})}return await ev(i),a}async function Dn(e,t,r={}){return af(e,`${JSON.stringify(t,null,2)}
|
|
1080
|
+
`,r)}async function ev(e){let t=await sf(e,"r");try{await t.sync()}finally{await t.close()}}var yr=b(()=>{});var Vn=b(()=>{yr();le();U()});function Ie(){return globalThis[tv]||rv}var tv,rv,ke=b(()=>{tv=Symbol.for("vibe64.hostProfile"),rv=Object.freeze({runtimePackRoot:"",
|
|
1081
1081
|
sharedCacheRoot:"",execHelperPath:"",sharedGroupAccess:!1})});var Xj,Un=b(()=>{yr();le();Ue();ke();U();Xj=Object.freeze(["repository","branch","path","baseCommit","canonicalCommit"])});import{execFile as ov}from"node:child_process";import{readFile as iv}from"node:fs/promises";import vs from"node:os";import sv from"node:path";
|
|
1082
|
-
import{promisify as av}from"node:util";function
|
|
1083
|
-
":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}function
|
|
1082
|
+
import{promisify as av}from"node:util";function uf(e=""){let t=F(e);if(!t||t.includes("/")||t.includes("\\")||t.includes(
|
|
1083
|
+
":")){let r=new Error("A valid OS username is required.");throw r.code="vibe64_invalid_os_username",r}return t}function lf([
|
|
1084
1084
|
e,t,r,n,o,i]=[]){if(!/^\d+$/u.test(t)||!/^\d+$/u.test(r))return null;let s=Number(t),a=Number(r);return!Number.isSafeInteger(
|
|
1085
1085
|
s)||!Number.isSafeInteger(a)?null:{displayName:String(n||"").split(",")[0],gid:a,home:String(o||""),shell:String(i||""),
|
|
1086
|
-
uid:s,username:String(e||"")}}function Ts(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:
|
|
1086
|
+
uid:s,username:String(e||"")}}function Ts(e=""){let t=String(e||"").trim().split(":");return t.length<7?null:lf([t[0],t[2],
|
|
1087
1087
|
t[3],t[4],t[5],t[6]])}function uv(e=""){return String(e||"").split(/\r?\n[\t ]*\r?\n/u).map(t=>{let r={};for(let n of t.
|
|
1088
|
-
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return
|
|
1089
|
-
dir,r.shell])}).filter(Boolean)}async function
|
|
1088
|
+
split(/\r?\n/u)){let o=/^\s*([a-z]+):\s?(.*)$/u.exec(n);o&&(r[o[1]]=o[2].trim())}return lf([r.name,r.uid,r.gid,r.gecos,r.
|
|
1089
|
+
dir,r.shell])}).filter(Boolean)}async function cf(e,t,r){let n=await e(t,r,{encoding:"utf8"});return String((typeof n=="\
|
|
1090
1090
|
string"?n:n?.stdout)||"")}function wr({homedir:e=vs.homedir,userInfo:t=vs.userInfo}={}){let r=t(),n=F(r?.username||process.
|
|
1091
1091
|
env.USER||process.env.LOGNAME),o=sv.resolve(String(r?.homedir||e()||""));return{displayName:String(r?.username||n),gid:Number.
|
|
1092
1092
|
isSafeInteger(r?.gid)?r.gid:null,home:o,shell:String(r?.shell||""),uid:Number.isSafeInteger(r?.uid)?r.uid:null,username:n}}
|
|
1093
|
-
async function Bn(e="",{execFileFn:t=cv,platform:r=process.platform,readFileFn:n=iv,userInfo:o=vs.userInfo}={}){let i=
|
|
1093
|
+
async function Bn(e="",{execFileFn:t=cv,platform:r=process.platform,readFileFn:n=iv,userInfo:o=vs.userInfo}={}){let i=uf(
|
|
1094
1094
|
e);if(r==="linux"&&!/^\d+$/u.test(i)){let c=[...(await n("/etc/nsswitch.conf","utf8").catch(()=>"")).matchAll(/^[\t ]*passwd[\t ]*:[\t ]*([^#\r\n]*)/gmu)],
|
|
1095
1095
|
u=c.length===1?c[0][1].trim().split(/\s+/u):[];if(u[0]==="files"&&(u.length===1||/^[a-z_][a-z0-9_-]*$/iu.test(u[1]))){let p=(await n(
|
|
1096
1096
|
"/etc/passwd","utf8").catch(()=>"")).split(/\r?\n/u).map(Ts).find(g=>g?.username===i);if(p)return p}}let s;if(r==="darwi\
|
|
1097
|
-
n"){let a=wr({userInfo:o});if(a.username===i)return a;[s]=uv(await
|
|
1098
|
-
s=Ts((await
|
|
1099
|
-
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var cv,ix,zn=b(()=>{U();cv=av(ov);ix=Object.freeze({parsePasswdLine:Ts})});var
|
|
1097
|
+
n"){let a=wr({userInfo:o});if(a.username===i)return a;[s]=uv(await cf(t,"dscacheutil",["-q","user","-a","name",i]))}else
|
|
1098
|
+
s=Ts((await cf(t,"getent",["passwd",i])).split(/\r?\n/u)[0]);if(!s||s.username!==i){let a=new Error(`OS user was not fou\
|
|
1099
|
+
nd: ${i}`);throw a.code="vibe64_os_user_not_found",a}return s}var cv,ix,zn=b(()=>{U();cv=av(ov);ix=Object.freeze({parsePasswdLine:Ts})});var df=b(()=>{zn();U()});import Gn from"node:path";function j(e=""){return String(e??"").trim()}function Is(e=null){let t=Number(e);return Number.
|
|
1100
1100
|
isSafeInteger(t)&&t>=0?t:null}function x(e=""){let t=j(e);return t?Gn.resolve(t):""}function ze(e="",t=""){let r=x(e),n=x(
|
|
1101
1101
|
t);if(!r||!n)return!1;let o=Gn.relative(r,n);return o!==".."&&!o.startsWith(`..${Gn.sep}`)&&!Gn.isAbsolute(o)}function ee(e={}){
|
|
1102
1102
|
return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ye(e={}){return Object.fromEntries(Object.entries(ee(e)).map(
|
|
@@ -1106,7 +1106,7 @@ isFinite(t)?t:0}function $e(...e){for(let t of e){let r=j(t);if(r)return r}retur
|
|
|
1106
1106
|
return{displayName:j(e.displayName||t),gid:Is(e.gid),home:r,shell:j(e.shell),uid:Is(e.uid),username:t}}function As(){return Rs(
|
|
1107
1107
|
wr())}async function Ps(e="",t={}){return Rs(await Bn(e,t))}function _r(e={},t={}){let r=Rs(e);return{...t,HOME:r.home,LOGNAME:r.
|
|
1108
1108
|
username,USER:r.username,XDG_CACHE_HOME:Os.join(r.home,".cache"),XDG_CONFIG_HOME:Os.join(r.home,".config"),XDG_DATA_HOME:Os.
|
|
1109
|
-
join(r.home,".local","share")}}function
|
|
1109
|
+
join(r.home,".local","share")}}function ff(){return{gid:typeof process.getgid=="function"?process.getgid():null,uid:typeof process.
|
|
1110
1110
|
getuid=="function"?process.getuid():null}}var Mt=b(()=>{zn();K()});function dv(e=0){let t=Number(e);return Number.isSafeInteger(t)?t:1}function br({code:e="",error:t="",exitCode:r=0,ok:n=null,
|
|
1111
1111
|
output:o="",outputEncoding:i="utf8",pid:s=null,signal:a="",stderr:c="",stdout:u="",timedOut:d=!1,execution:p=null,retryable:g=null}={}){
|
|
1112
1112
|
let h=dv(r),l=String(u||""),w=String(c||""),_=String(o||[l,w].filter(Boolean).join(`
|
|
@@ -1115,16 +1115,16 @@ Number(s):null,signal:j(a),stderr:w,stdout:l,...i==="base64"?{outputEncoding:i}:
|
|
|
1115
1115
|
ct"&&!Array.isArray(p)?{execution:p}:{},...typeof g=="boolean"?{retryable:g}:{}}}function te(e="",t="vibe64_command_fail\
|
|
1116
1116
|
ed",r={}){let n=j(e)||"Vibe64 command failed.";return br({...r,code:t,error:n,exitCode:1,ok:!1,output:j(r.output)||n,stderr:r.
|
|
1117
1117
|
stderr??(r.outputEncoding==="base64"?Buffer.from(n).toString("base64"):n),stdout:r.stdout??""})}var ut=b(()=>{K()});import{spawn as fv}from"node:child_process";import{statSync as pv}from"node:fs";import mv from"node:path";import{StringDecoder as hv}from"node:string_decoder";
|
|
1118
|
-
import{stripVTControlCharacters as gv}from"node:util";function
|
|
1118
|
+
import{stripVTControlCharacters as gv}from"node:util";function gf(e){return e.replaceAll(_v,t=>{if(mf[t]!==void 0)return mf[t];
|
|
1119
1119
|
let r=t.codePointAt(0);return r<=65535?`\\u${r.toString(16).padStart(4,"0")}`:`\\U${r.toString(16)}`})}function bv(e){return gv(
|
|
1120
1120
|
e).split(`
|
|
1121
|
-
`).map(
|
|
1122
|
-
`)}function Ev(e,t){return[e,...t].map(r=>{let n=
|
|
1121
|
+
`).map(gf).join(`
|
|
1122
|
+
`)}function Ev(e,t){return[e,...t].map(r=>{let n=gf(String(r));return wv.test(n)?n:process.platform==="win32"?`"${n.replaceAll(
|
|
1123
1123
|
'"','""')}"`:`'${n.replaceAll("'","'\\''")}'`}).join(" ")}function Sv(e,t){let r=String(e?.message??e);if(t===process.cwd())
|
|
1124
1124
|
return r;try{if(!pv(t).isDirectory())return`The "cwd" option is not a directory: ${t}.
|
|
1125
1125
|
${r}`}catch(n){return`The "cwd" option is invalid: ${t}.
|
|
1126
1126
|
${n.message}
|
|
1127
|
-
${r}`}return r}function vv(e){let t=e.forcefullyTerminated?` and was forcefully terminated after ${
|
|
1127
|
+
${r}`}return r}function vv(e){let t=e.forcefullyTerminated?` and was forcefully terminated after ${hf} milliseconds`:"";
|
|
1128
1128
|
if(e.timedOut)return`Command timed out after ${e.timeout} milliseconds${t}`;if(e.maxBuffer)return`Command's ${e.maxBuffer.
|
|
1129
1129
|
stream} was larger than ${e.maxBuffer.limit} ${e.maxBuffer.unit}${t}`;if(e.spawnError?.code!==void 0)return`Command fail\
|
|
1130
1130
|
ed with ${e.spawnError.code}${t}`;if(e.signal){let r=yv[e.signal];return`Command was killed with ${e.signal}${r?` (${r})`:
|
|
@@ -1132,68 +1132,68 @@ ed with ${e.spawnError.code}${t}`;if(e.signal){let r=yv[e.signal];return`Command
|
|
|
1132
1132
|
bv(Sv(e.spawnError,e.cwd)):e.maxBuffer?"maxBuffer exceeded":"";return`${vv(e)}: ${e.commandLine}${t?`
|
|
1133
1133
|
${t}`:""}`}function Cs(e,t){let r=new hv(e),n=[],o=0,i=!1;return{write(s){if(i)return!1;let a=r.write(s);return o+a.length>
|
|
1134
1134
|
t?(n.push(a.slice(0,t-o)),o=t,i=!0,!1):(n.push(a),o+=a.length,!0)},text(){if(!i){let s=r.end();s&&n.push(s.slice(0,t-o)),
|
|
1135
|
-
i=!0}return n.join("")}}}function
|
|
1136
|
-
utf8",timeout:c=0}={}){let u=Number.isSafeInteger(i)&&i>0?i:
|
|
1135
|
+
i=!0}return n.join("")}}}function yf(e,t,{cwd:r="",env:n={},input:o=void 0,maxBuffer:i=pf,onOutput:s=null,outputEncoding:a="\
|
|
1136
|
+
utf8",timeout:c=0}={}){let u=Number.isSafeInteger(i)&&i>0?i:pf,d={all:Cs(a,u*2),stderr:Cs(a,u),stdout:Cs(a,u)},p=o!=null,
|
|
1137
1137
|
g=fv(e,t,{cwd:r||void 0,detached:process.platform!=="win32",env:n,stdio:[p?"pipe":"ignore","pipe","pipe"],windowsHide:!0}),
|
|
1138
1138
|
h={commandLine:Ev(e,t),cwd:mv.resolve(r||"."),forcefullyTerminated:!1,maxBuffer:null,spawnError:null,timedOut:!1,timeout:c},
|
|
1139
1139
|
l=!1,w=null,_=()=>{};g.on("error",T=>{h.spawnError||=T,g.pid===void 0&&_()});let f=()=>{l||!g.kill("SIGTERM")||w||(w=setTimeout(
|
|
1140
|
-
()=>{!l&&g.kill("SIGKILL")&&(h.forcefullyTerminated=!0)},
|
|
1140
|
+
()=>{!l&&g.kill("SIGKILL")&&(h.forcefullyTerminated=!0)},hf))},m=(T,S)=>v=>{if(d.all.write(v),d[T].write(v)||(h.maxBuffer||=
|
|
1141
1141
|
{limit:u,stream:T,unit:"characters"},S.destroy()),typeof s=="function")try{s(String(v||""))}catch{}};g.stdout&&g.stdout.
|
|
1142
1142
|
on("data",m("stdout",g.stdout)),g.stderr&&g.stderr.on("data",m("stderr",g.stderr)),p&&g.stdin&&(g.stdin.on("error",()=>{}),
|
|
1143
1143
|
g.stdin.end(o));let y=c>0?setTimeout(()=>{h.timedOut=!0,f()},c):null;return{completion:new Promise(T=>{_=(S,v)=>{if(l)return;
|
|
1144
1144
|
l=!0,clearTimeout(y),clearTimeout(w);let R=h.spawnError?{}:{exitCode:typeof S=="number"&&S>=0?S:void 0,signal:v||void 0},
|
|
1145
1145
|
O=h.spawnError||h.timedOut||h.maxBuffer||R.exitCode!==0;T({all:d.all.text(),code:h.spawnError?.code,exitCode:R.exitCode,
|
|
1146
1146
|
shortMessage:O?Tv({...h,...R}):"",signal:R.signal,stderr:d.stderr.text(),stdout:d.stdout.text(),timedOut:h.timedOut})},g.
|
|
1147
|
-
once("close",_)}),kill:T=>g.kill(T),pid:g.pid}}var
|
|
1147
|
+
once("close",_)}),kill:T=>g.kill(T),pid:g.pid}}var pf,hf,yv,wv,_v,mf,wf=b(()=>{pf=1e8,hf=5e3,yv=Object.freeze({SIGABRT:"\
|
|
1148
1148
|
Aborted",SIGALRM:"Timeout or timer",SIGHUP:"Terminal closed",SIGINT:"User interruption with CTRL-C",SIGKILL:"Forced term\
|
|
1149
1149
|
ination",SIGPIPE:"Broken pipe or socket",SIGQUIT:"User interruption with CTRL-\\",SIGSEGV:"Segmentation fault",SIGTERM:"\
|
|
1150
1150
|
Termination",SIGUSR1:"Application-specific signal",SIGUSR2:"Application-specific signal"}),wv=/^[\w./-]+$/u,_v=new RegExp(
|
|
1151
|
-
"\\p{Separator}|\\p{Other}","gu"),
|
|
1151
|
+
"\\p{Separator}|\\p{Other}","gu"),mf=Object.freeze({" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"})});import{spawn as Ef}from"node:child_process";import{mkdir as Ov,open as Rv,readdir as Av,readFile as Pv}from"node:fs/promises";
|
|
1152
1152
|
import Cv from"node:path";import{fileURLToPath as Nv}from"node:url";function $v(e){if(process.platform!=="win32"){if(!Se){
|
|
1153
|
-
let t=
|
|
1153
|
+
let t=Ef(process.execPath,[kv],{cwd:"/",detached:!0,stdio:["pipe","ignore","ignore"]});t.once("error",()=>{Se===t&&(Se=null)}),
|
|
1154
1154
|
t.once("exit",()=>{Se===t&&(Se=null)}),t.stdin.on("error",()=>{}),t.unref(),t.stdin.unref(),Se=t;for(let r of lt.values())
|
|
1155
1155
|
r.scopeEmpty!==!0&&r.pid!==e&&t.stdin.write(`+${r.pid}
|
|
1156
1156
|
`)}Se.stdin.write(`+${e}
|
|
1157
1157
|
`)}}function Lv(e){Se&&(Se.stdin.write(`-${e}
|
|
1158
1158
|
`),![...lt.values()].some(t=>t.scopeEmpty!==!0)&&(Se.stdin.end(),Se=null))}async function Mv(e=""){return e?(await Ov(Cv.
|
|
1159
1159
|
dirname(e),{recursive:!0}),Rv(e,"w",384)):null}async function Dv(e){return new Promise((t,r)=>{let n=!1,o=(i,s)=>{n||(n=
|
|
1160
|
-
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function
|
|
1161
|
-
try{o=await Mv(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=
|
|
1160
|
+
!0,i(s))};e.once("spawn",()=>o(t)),e.once("error",i=>o(r,i))})}async function Sf(e={},t={}){let{cwd:r="",env:n={}}=t,o=null;
|
|
1161
|
+
try{o=await Mv(e.logPath);let i=o?["ignore",o.fd,o.fd]:["ignore","ignore","ignore"],s=Ef(e.command,e.args,{cwd:r||void 0,
|
|
1162
1162
|
detached:!0,env:n,stdio:i});await Dv(s);let a=e.execution?.id||"";return a&&(lt.set(a,{child:s,pid:Number(s.pid)}),$v(Number(
|
|
1163
1163
|
s.pid)),s.once("exit",()=>{!Fn(s.pid)&<.has(a)&&(lt.set(a,{child:s,pid:Number(s.pid),scopeEmpty:!0}),Lv(Number(s.pid)))})),
|
|
1164
1164
|
s.unref(),br({execution:e.execution,exitCode:0,ok:!0,output:"Detached command started.",pid:s.pid})}catch(i){return te(i?.
|
|
1165
1165
|
message||"Detached command failed to start.",i?.code||"vibe64_command_detached_failed",{execution:e.execution})}finally{
|
|
1166
1166
|
await o?.close().catch(()=>null)}}function Fn(e=null){let t=Number(e);if(!Number.isSafeInteger(t)||t<=0)return!1;if(process.
|
|
1167
1167
|
platform==="win32"){let r=[...lt.values()].find(n=>n.pid===t);return r?.child?.exitCode===null&&r?.child?.signalCode===null}
|
|
1168
|
-
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function
|
|
1168
|
+
try{return process.kill(-t,0),!0}catch(r){return r?.code==="EPERM"}}function _f(e=null,t="SIGTERM"){if(!Fn(e))return!1;try{
|
|
1169
1169
|
return process.platform==="win32"?[...lt.values()].find(n=>n.pid===Number(e))?.child?.kill(t):process.kill(-Number(e),t),
|
|
1170
|
-
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function
|
|
1170
|
+
!0}catch(r){if(r?.code==="ESRCH")return!1;throw r}}async function vf(e=null,t=10){let r=Number(e);if(process.platform!==
|
|
1171
1171
|
"linux"||!Number.isSafeInteger(r)||r<=0)return[];let n=[];for(let o of await Av("/proc").catch(()=>[])){if(n.length>=t)break;
|
|
1172
1172
|
if(!/^\d+$/u.test(o))continue;let i=await Pv(`/proc/${o}/stat`,"utf8").catch(()=>""),s=i.lastIndexOf(")"),a=s<0?[]:i.slice(
|
|
1173
|
-
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function
|
|
1173
|
+
s+2).split(" ");Number(a[2])!==r||a[0]==="Z"||n.push({command:i.slice(i.indexOf("(")+1,s),pid:Number(o)})}return n}async function bf(e=null,t=0){
|
|
1174
1174
|
let r=Date.now()+Math.max(0,Number(t)||0);for(;Fn(e)&&Date.now()<r;)await new Promise(n=>setTimeout(n,25));return!Fn(e)}
|
|
1175
|
-
async function Hn(e=null,t={}){let{killTimeoutMs:r=xv,termTimeoutMs:n=jv}=t;
|
|
1176
|
-
(
|
|
1175
|
+
async function Hn(e=null,t={}){let{killTimeoutMs:r=xv,termTimeoutMs:n=jv}=t;_f(e,"SIGTERM");let o=await bf(e,n);return o||
|
|
1176
|
+
(_f(e,"SIGKILL"),o=await bf(e,r)),o}var Iv,lt,jv,xv,kv,Se,Er=b(()=>{ut();Iv=new URL("./../node_modules/@local/vibe64-exe\
|
|
1177
1177
|
cution/src/server/engines/detached.js",import.meta.url).href,lt=new Map,jv=3e3,xv=1e3,kv=Nv(new URL("./detachedReaper.js",
|
|
1178
1178
|
Iv)),Se=null});async function Sr(e="",t=[],r={}){let{cwd:n="",env:o={},execution:i=null,input:s=void 0,maxBuffer:a=void 0,onOutput:c=null,
|
|
1179
1179
|
outputEncoding:u="utf8",signal:d=null,timeout:p=15e3}=r,g,h,l,w=null,_=Promise.withResolvers(),f=()=>{l||=h(),l.then(_.resolve)};
|
|
1180
|
-
if(d?.aborted)return te("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let E=
|
|
1180
|
+
if(d?.aborted)return te("Command cancelled.","vibe64_command_cancelled",{execution:i});try{let E=yf(e,t,{cwd:n,env:o,input:s,
|
|
1181
1181
|
maxBuffer:a,onOutput:c,outputEncoding:u,timeout:p});w=Number(E.pid);let T;h=()=>{if(!T){let R;process.platform!=="win32"?
|
|
1182
|
-
R=Hn(w).catch(()=>!1):(E.kill("SIGKILL"),R=E.completion.then(()=>!0)),T=R.then(O=>(O||(T=null),O))}return T},i?.id&&
|
|
1182
|
+
R=Hn(w).catch(()=>!1):(E.kill("SIGKILL"),R=E.completion.then(()=>!0)),T=R.then(O=>(O||(T=null),O))}return T},i?.id&&Tf.set(
|
|
1183
1183
|
i.id,h),d?.addEventListener("abort",f,{once:!0}),d?.aborted&&f();let S=await Promise.race([E.completion,_.promise.then(R=>R?
|
|
1184
1184
|
E.completion:{exitCode:1})]),v=typeof S.exitCode=="number"?S.exitCode:1;g=br({code:S.timedOut===!0?"vibe64_command_captu\
|
|
1185
1185
|
re_timed_out":S.code?"vibe64_command_capture_failed":"",error:v===0?"":S.shortMessage,exitCode:v,output:S.all||(v===0?"":
|
|
1186
1186
|
S.shortMessage),outputEncoding:u,signal:S.signal,stderr:S.stderr,stdout:S.stdout,timedOut:S.timedOut===!0,execution:i})}catch(E){
|
|
1187
1187
|
g=te(E.message,"vibe64_command_capture_failed",{execution:i,outputEncoding:u})}finally{d?.removeEventListener("abort",f)}
|
|
1188
|
-
if(!await(l||h?.()||!0)){let E=await
|
|
1188
|
+
if(!await(l||h?.()||!0)){let E=await vf(w),T=g?.timedOut?"The command timed out":d?.aborted?"The command was cancelled":
|
|
1189
1189
|
"The command finished",S=E.length?`: ${E.map(v=>`${v.command} (pid ${v.pid})`).join(", ")} still running`:"";return{...te(
|
|
1190
1190
|
`${T}, and its execution scope did not become empty${S}.`,"vibe64_execution_drain_failed",{execution:i,output:g?.output,
|
|
1191
1191
|
outputEncoding:u,signal:g?.signal,stderr:g?.stderr,stdout:g?.stdout,timedOut:g?.timedOut}),remainingProcesses:E}}i?.id&&
|
|
1192
|
-
|
|
1193
|
-
execution:y,outputEncoding:u}):y?{...g,execution:y}:g}var
|
|
1194
|
-
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function
|
|
1192
|
+
Tf.delete(i.id);let y=i&&{...i,state:"finished"};return d?.aborted?te("Command cancelled.","vibe64_command_cancelled",{...g,
|
|
1193
|
+
execution:y,outputEncoding:u}):y?{...g,execution:y}:g}var Tf,vr=b(()=>{ut();wf();Er();Tf=new Map});function Ns(e=""){let t=String(e||"").trim()||Ie().execHelperPath;if(!t){let r=new Error("This computer has no helper fo\
|
|
1194
|
+
r running commands as another user.");throw r.code="vibe64_exec_helper_unavailable",r}return t}function If(e={}){return{
|
|
1195
1195
|
...e,schema:Vv,schemaVersion:Uv}}function qn({actor:e={},command:t="",cwd:r="",env:n={},input:o,operation:i="vibe64-comm\
|
|
1196
|
-
and",args:s=[]}={}){return
|
|
1196
|
+
and",args:s=[]}={}){return If({args:Array.isArray(s)?s.map(a=>String(a)):[],command:t,cwd:r,env:n,gid:e.user?.gid,home:e.
|
|
1197
1197
|
user?.home,inputBase64:o==null?"":Buffer.isBuffer(o)?o.toString("base64"):Buffer.from(String(o)).toString("base64"),operation:i,
|
|
1198
1198
|
uid:e.user?.uid,username:e.user?.username})}function Tr(e={}){return e.mode==="pty"&&e.envPolicy==="auth"&&!["assistant",
|
|
1199
1199
|
"codex"].includes(e.purpose)?"account-auth-terminal":e.purpose==="codex"&&e.mode==="capture"&&e.envPolicy==="auth"||e.purpose===
|
|
@@ -1205,83 +1205,83 @@ d":e.purpose==="github-api"?"github-api-command":e.purpose==="workspace-cache"?"
|
|
|
1205
1205
|
alth"?"health-status":"vibe64-command"}async function js(e={},{env:t,helperPath:r="",maxBuffer:n=void 0,outputEncoding:o="\
|
|
1206
1206
|
utf8",runCapture:i=Sr,signal:s=null,timeout:a=15e3}){let c={env:t,input:`${JSON.stringify(e)}
|
|
1207
1207
|
`,outputEncoding:o,signal:s,timeout:a};return Number.isSafeInteger(Number(n))&&Number(n)>0&&(c.maxBuffer=Number(n)),i("s\
|
|
1208
|
-
udo",["-n",Ns(r),"execute"],c)}var Vv,Uv,Wn=b(()=>{vr();ke();Vv="vibe64.exec-helper.payload",Uv=1});import{createRequire as zv}from"node:module";var Bv,Vx,
|
|
1209
|
-
upport/symlinkSafeRequire.js",import.meta.url).href,Vx=zv(Bv)});var Hx,qx,Wx,Yx,
|
|
1208
|
+
udo",["-n",Ns(r),"execute"],c)}var Vv,Uv,Wn=b(()=>{vr();ke();Vv="vibe64.exec-helper.payload",Uv=1});import{createRequire as zv}from"node:module";var Bv,Vx,Of=b(()=>{Bv=new URL("./../node_modules/@jskit-ai/kernel/server/s\
|
|
1209
|
+
upport/symlinkSafeRequire.js",import.meta.url).href,Vx=zv(Bv)});var Hx,qx,Wx,Yx,Rf=b(()=>{U();Hx=Object.freeze(["bundled","dev_server"]),qx=Object.freeze(["capacitor"]),Wx=Object.freeze(
|
|
1210
1210
|
{callbackPath:"/auth/login",customScheme:"",appLinkDomains:Object.freeze([])}),Yx=Object.freeze({packageName:"",minSdk:26,
|
|
1211
|
-
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var
|
|
1212
|
-
e))Ge(e[r],t);return Object.freeze(e)}var Ir=b(()=>{});var
|
|
1211
|
+
targetSdk:35,versionCode:1,versionName:"1.0.0"})});var Af=b(()=>{U();Rf()});var xs=b(()=>{});var ks=b(()=>{});var Pf=b(()=>{xs();U();ks()});function Ge(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e);for(let r of Object.getOwnPropertyNames(
|
|
1212
|
+
e))Ge(e[r],t);return Object.freeze(e)}var Ir=b(()=>{});var Cf=b(()=>{});var mk,hk,Nf=b(()=>{Ir();U();Cf();xs();mk=Object.freeze(["dependencies","optionalDependencies","peerDependencies"]),hk=Object.
|
|
1213
1213
|
freeze(["capabilities","kind","metadata","migrations","runtime","vite"])});var $s=b(()=>{U()});import Hv from"node:child_process";import{constants as Ls}from"node:fs";import{open as qv}from"node:fs/promises";import Ms from"node:path";
|
|
1214
|
-
function Ds(e="",t=Vs){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function
|
|
1214
|
+
function Ds(e="",t=Vs){let r=new Error(e||"Exclusive file lock failed.");return r.code=t,r}function jf(e="",t="path",r=Vs){
|
|
1215
1215
|
let n=String(e||"").trim();if(!n||!Ms.isAbsolute(n)||Ms.normalize(n)!==n)throw Ds(`${t} must be a normalized absolute pa\
|
|
1216
1216
|
th.`,r);return n}function Yv(e,t){return new Promise((r,n)=>{let o=Hv.spawn("/usr/bin/flock",["--exclusive","--nonblock",
|
|
1217
1217
|
"3"],{cwd:t,env:{PATH:"/usr/bin:/bin"},stdio:["ignore","ignore","pipe",e]}),i="";o.stderr.on("data",s=>{i=`${i}${String(
|
|
1218
1218
|
s||"")}`.slice(-4096)}),o.once("error",n),o.once("close",s=>r({status:s,stderr:i.trim()}))})}async function Dt(e="",{cwd:t="",
|
|
1219
|
-
errorCode:r=Vs}={}){let n=
|
|
1219
|
+
errorCode:r=Vs}={}){let n=jf(e,"lockPath",r),o=t?jf(t,"cwd",r):Ms.dirname(n),i=await qv(n,Ls.O_CREAT|Ls.O_NOFOLLOW|Ls.O_RDWR,
|
|
1220
1220
|
432),s;try{s=await Yv(i.fd,o)}catch(c){throw await i.close().catch(()=>null),Ds(c?.message||String(c||"Exclusive file lo\
|
|
1221
1221
|
ck failed."),r)}if(s.status!==0){if(await i.close(),s.status===Wv)return null;throw Ds(`Exclusive file lock process fail\
|
|
1222
|
-
ed${s.stderr?`: ${s.stderr}`:"."}`,r)}let a=!1;return async()=>{a||(a=!0,await i.close())}}var Vs,Wv,
|
|
1223
|
-
lock_failed",Wv=1});var Jv,Tk,
|
|
1224
|
-
session?.metadata?.session_git_command_actor_user_key)}async function
|
|
1222
|
+
ed${s.stderr?`: ${s.stderr}`:"."}`,r)}let a=!1;return async()=>{a||(a=!0,await i.close())}}var Vs,Wv,xf=b(()=>{Vs="file_\
|
|
1223
|
+
lock_failed",Wv=1});var Jv,Tk,kf=b(()=>{Jv="jskit-client-build",Tk=new RegExp(`<meta name="${Jv}" content="([0-9a-f]+)"`,"u")});import Xv from"node:path";var Ck,$f=b(()=>{kf();$s();Ck=Xv.join("dist","index.html")});var Yn=b(()=>{Of();Af();Pf();ks();Nf();$s();xf();$f()});var Lf=b(()=>{Yn()});function Zv(e={}){return $e(e.userKey,e.project?.ownerUserKey,e.project?.ownerUsername,e.project?.ownerUser?.username,e.
|
|
1224
|
+
session?.metadata?.session_git_command_actor_user_key)}async function Mf(e={}){let t=j(e.actor)||"daemon";if(t==="app"&&
|
|
1225
1225
|
e.applicationAccount)return{actor:t,applicationAccount:!0,credentialScope:t,requiresRealUser:!1,user:await Ps(e.applicationAccount)};
|
|
1226
1226
|
if(t==="daemon"||t==="app")return{actor:t,credentialScope:t,requiresRealUser:!1,user:As()};let r=Zv(e);if(!r){let n=new Error(
|
|
1227
1227
|
"A user key is required for real-user command execution.");throw n.code="vibe64_command_actor_user_required",n}return{actor:t,
|
|
1228
|
-
credentialScope:"user",requiresRealUser:!0,user:await Ps(r)}}var
|
|
1229
|
-
user?.gid}function Us(){return!!Ie().execHelperPath}function Jn(e={}){return e.requiresRealUser?Us()||!Vt(e):!1}function
|
|
1228
|
+
credentialScope:"user",requiresRealUser:!0,user:await Ps(r)}}var Df=b(()=>{K();Mt()});import Vf from"node:path";function Vt(e={}){let t=ff();return t.uid===null||t.gid===null||t.uid===e.user?.uid&&t.gid===e.
|
|
1229
|
+
user?.gid}function Us(){return!!Ie().execHelperPath}function Jn(e={}){return e.requiresRealUser?Us()||!Vt(e):!1}function Uf(e={},t={},r=""){
|
|
1230
1230
|
if(!e.requiresRealUser)return;let n=x(t.session?.sourceRoot||t.session?.sourcePath),o=x(r);if(!n||!o||!ze(n,o))return;let i=new Error(
|
|
1231
1231
|
"Commands in a session's source must run as the editor's own user, not as a person's account.");throw i.code="vibe64_com\
|
|
1232
|
-
mand_managed_source_real_user_forbidden",i}function
|
|
1233
|
-
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&
|
|
1232
|
+
mand_managed_source_real_user_forbidden",i}function Bf(e={},t={}){let r=x(e.user?.home),n=x(t.HOME),o=x(t.VIBE64_CREDENTIAL_HOME);
|
|
1233
|
+
if(!(!e.requiresRealUser&&o&&n===o)&&r&&n&&Vf.resolve(r)!==Vf.resolve(n)){let i=new Error("Command HOME does not match t\
|
|
1234
1234
|
he resolved actor home.");throw i.code="vibe64_command_home_actor_mismatch",i}}var Kn=b(()=>{Mt();ke();K()});function Xn(...e){let t={};for(let r of e){let n=ye(r);for(let o of Or)n[o]!==void 0&&(t[o]=n[o])}return t}var Or,Zn=b(()=>{
|
|
1235
1235
|
K();Or=Object.freeze(["DATABASE_URL","DB_CLIENT","DB_DATABASE","DB_HOST","DB_NAME","DB_PASSWORD","DB_PORT","DB_USER","DB\
|
|
1236
1236
|
_USERNAME","MYSQL_DATABASE","MYSQL_HOST","MYSQL_PWD","MYSQL_TCP_PORT","PGDATABASE","PGHOST","PGPASSWORD","PGPORT","PGUSE\
|
|
1237
|
-
R","VIBE64_MYSQL_USER"])});import{spawn as Qv,spawnSync as eT}from"node:child_process";import{createHash as tT}from"node:crypto";import{statSync as
|
|
1238
|
-
import{stat as
|
|
1237
|
+
R","VIBE64_MYSQL_USER"])});import{spawn as Qv,spawnSync as eT}from"node:child_process";import{createHash as tT}from"node:crypto";import{statSync as Yf}from"node:fs";
|
|
1238
|
+
import{stat as Jf}from"node:fs/promises";import Qn from"node:path";function Gf(e="",t="vibe64"){return j(e).toLowerCase().
|
|
1239
1239
|
replace(/[^a-z0-9-]+/gu,"-").replace(/^-+|-+$/gu,"").slice(0,63)||t}function oT(...e){for(let t of e){let r=ee(t),n=ee(r.
|
|
1240
1240
|
user),o=$e(r.name,r.userName,r.user_name,r.gitUserName,r.git_user_name,n.name,n.userName,n.user_name),i=$e(r.email,r.userEmail,
|
|
1241
1241
|
r.user_email,r.gitUserEmail,r.git_user_email,n.email,n.userEmail,n.user_email);if(o&&i)return{authorEmail:i,authorName:o,
|
|
1242
1242
|
committerEmail:i,committerName:o,source:"configured"}}return null}function iT(e={}){let t=ee(e),r=$e(t.name,t.displayName,
|
|
1243
1243
|
t.login,t.username),n=$e(t.email,t.publicEmail,t.verifiedEmail);return!r||!n?null:{authorEmail:n,authorName:r,committerEmail:n,
|
|
1244
|
-
committerName:r,source:"github"}}function sT({workspace:e="",userKey:t=""}={}){let r=
|
|
1245
|
-
authorEmail:`${r}@${n}${
|
|
1246
|
-
fallback"}}function Bs(e=""){let t=j(e);return t&&Qn.isAbsolute(t)?t:""}function
|
|
1247
|
-
isDirectory()?t:""}catch{return""}}async function
|
|
1248
|
-
t:""}function
|
|
1249
|
-
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=j(n[2]))}return t}function
|
|
1250
|
-
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:rT}}function
|
|
1251
|
-
utf8"});return r.error||r.signal?{transient:!0,values:null}:{transient:!1,values:r.status===0||r.status===1?
|
|
1252
|
-
null}}function
|
|
1244
|
+
committerName:r,source:"github"}}function sT({workspace:e="",userKey:t=""}={}){let r=Gf(t,"user"),n=Gf(e,"local");return{
|
|
1245
|
+
authorEmail:`${r}@${n}${zf}`,authorName:`${r} via Vibe64`,committerEmail:`vibe64@${n}${zf}`,committerName:"Vibe64",source:"\
|
|
1246
|
+
fallback"}}function Bs(e=""){let t=j(e);return t&&Qn.isAbsolute(t)?t:""}function Ff(e=""){let t=Bs(e);try{return t&&Yf(t).
|
|
1247
|
+
isDirectory()?t:""}catch{return""}}async function Hf(e=""){let t=Bs(e);return t&&await Jf(t).then(r=>r.isDirectory(),()=>!1)?
|
|
1248
|
+
t:""}function Zf(e=""){let t={};for(let r of String(e||"").split(`
|
|
1249
|
+
`)){let n=/^user\.(name|email)(?: (.*))?$/iu.exec(r);n&&(t[n[1].toLowerCase()]=j(n[2]))}return t}function Qf(e,t){return{
|
|
1250
|
+
...e?{cwd:e}:{},env:t,stdio:["ignore","pipe","ignore"],timeout:rT}}function qf(e,t){let r=eT("git",Kf,{...Qf(e,t),encoding:"\
|
|
1251
|
+
utf8"});return r.error||r.signal?{transient:!0,values:null}:{transient:!1,values:r.status===0||r.status===1?Zf(r.stdout):
|
|
1252
|
+
null}}function Wf(e,t){return new Promise(r=>{let n="",o=!1,i=a=>{o||(o=!0,r(a))},s=Qv("git",Kf,Qf(e,t));s.stdout.setEncoding(
|
|
1253
1253
|
"utf8"),s.stdout.on("data",a=>{n+=a}),s.once("error",()=>i({transient:!0,values:null})),s.once("close",(a,c)=>i(c?{transient:!0,
|
|
1254
|
-
values:null}:{transient:!1,values:a===0||a===1?
|
|
1255
|
-
email,authorName:e.name,committerEmail:e.email,committerName:e.name,source:"git-config"}}function
|
|
1256
|
-
env.PATH||e.PATH}}function
|
|
1254
|
+
values:null}:{transient:!1,values:a===0||a===1?Zf(n):null}))})}function ep(e=null){return!e?.name||!e?.email?null:{authorEmail:e.
|
|
1255
|
+
email,authorName:e.name,committerEmail:e.email,committerName:e.name,source:"git-config"}}function tp(e={}){return{...e,PATH:process.
|
|
1256
|
+
env.PATH||e.PATH}}function rp(e={}){if(Object.hasOwn(e,"GIT_CONFIG_GLOBAL"))return[String(e.GIT_CONFIG_GLOBAL)];let t=Bs(
|
|
1257
1257
|
e.HOME),r=j(e.XDG_CONFIG_HOME)||(t?Qn.join(t,".config"):"");return[r?Qn.join(r,"git","config"):"",t?Qn.join(t,".gitconfi\
|
|
1258
|
-
g"):""].filter(Boolean)}async function aT(e={}){return(await Promise.all(
|
|
1259
|
-
mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join("|")}function cT(e={}){return
|
|
1260
|
-
:${r.size}:${r.mtimeMs}:${r.ctimeMs}`}catch{return"missing"}}).join("|")}function
|
|
1258
|
+
g"):""].filter(Boolean)}async function aT(e={}){return(await Promise.all(rp(e).map(r=>Jf(r).then(n=>`${n.ino}:${n.size}:${n.
|
|
1259
|
+
mtimeMs}:${n.ctimeMs}`,()=>"missing")))).join("|")}function cT(e={}){return rp(e).map(t=>{try{let r=Yf(t);return`${r.ino}\
|
|
1260
|
+
:${r.size}:${r.mtimeMs}:${r.ctimeMs}`}catch{return"missing"}}).join("|")}function np(e,t,r){let n=Object.entries(r).sort(
|
|
1261
1261
|
([o],[i])=>o<i?-1:o>i?1:0);return tT("sha256").update(JSON.stringify([e,t,n])).digest("hex")}async function uT(e,t,r){let n=e?
|
|
1262
|
-
await
|
|
1263
|
-
function lT(e,t,r){let n=e?
|
|
1264
|
-
values:o.values}}function
|
|
1265
|
-
r&&dt.delete(o);return null}async function dT(e,t,r){let n=
|
|
1266
|
-
read).values;let a={expiresAt:i+
|
|
1267
|
-
a&&dt.delete(n):a.values=c.values,c.values}function fT(e,t,r){let n=
|
|
1268
|
-
hasOwn(s,"values"))return s.values;let a=lT(e,t,r);return a.transient||dt.set(n,{expiresAt:i+
|
|
1262
|
+
await Wf(e,r):null;if(n?.values)return n;let o=await Wf(t,r);return{transient:!!(n?.transient||o.transient),values:o.values}}
|
|
1263
|
+
function lT(e,t,r){let n=e?qf(e,r):null;if(n?.values)return n;let o=qf(t,r);return{transient:!!(n?.transient||o.transient),
|
|
1264
|
+
values:o.values}}function op(e,t,r){let n=dt.get(e);if(n&&n.revision===t&&n.expiresAt>r)return n;for(let[o,i]of dt)i.expiresAt<=
|
|
1265
|
+
r&&dt.delete(o);return null}async function dT(e,t,r){let n=np(e,t,r),o=await aT(r),i=Date.now(),s=op(n,o,i);if(s)return(await s.
|
|
1266
|
+
read).values;let a={expiresAt:i+Xf,read:uT(e,t,r),revision:o};dt.set(n,a);let c=await a.read;return c.transient?dt.get(n)===
|
|
1267
|
+
a&&dt.delete(n):a.values=c.values,c.values}function fT(e,t,r){let n=np(e,t,r),o=cT(r),i=Date.now(),s=op(n,o,i);if(s&&Object.
|
|
1268
|
+
hasOwn(s,"values"))return s.values;let a=lT(e,t,r);return a.transient||dt.set(n,{expiresAt:i+Xf,read:Promise.resolve(a),
|
|
1269
1269
|
revision:o,values:a.values}),a.values}async function pT({cwd:e="",env:t=null}={}){if(!t||typeof t!="object")return null;
|
|
1270
|
-
let[r,n]=await Promise.all([
|
|
1271
|
-
typeof t!="object"?null:
|
|
1272
|
-
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function
|
|
1270
|
+
let[r,n]=await Promise.all([Hf(e),Hf(t.HOME)]);return ep(await dT(r,n,tp(t)))}function mT({cwd:e="",env:t=null}={}){return!t||
|
|
1271
|
+
typeof t!="object"?null:ep(fT(Ff(e),Ff(t.HOME),tp(t)))}function hT(e={}){let t=ee(e),r=j(t.name),n=j(t.email);return!r||
|
|
1272
|
+
!n?null:{authorEmail:n,authorName:r,committerEmail:n,committerName:r,source:"git-config"}}function ip({env:e,personGitIdentity:t=null,
|
|
1273
1273
|
project:r={},session:n={}}){let o=ee(n.metadata);return oT(r.gitIdentity,r.config?.git,n.gitIdentity,o.git_identity,{name:e.
|
|
1274
|
-
VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||hT(t)}function
|
|
1274
|
+
VIBE64_GIT_USER_NAME,email:e.VIBE64_GIT_USER_EMAIL})||hT(t)}function sp({actor:e={},env:t,project:r={},session:n={},userKey:o=""}){
|
|
1275
1275
|
let i=ee(n.metadata);return iT(r.githubUser||n.githubUser||i.github_user)||sT({workspace:$e(r.workspace,t.VIBE64_WORKSPACE,
|
|
1276
1276
|
t.VIBE64_RUNTIME_NAMESPACE),userKey:$e(o,e.user?.username,t.VIBE64_GIT_USER_KEY,t.VIBE64_USER_KEY,t.VIBE64_USER,t.USER,t.
|
|
1277
|
-
LOGNAME)})}async function gT(e){return
|
|
1278
|
-
{})||
|
|
1279
|
-
return
|
|
1280
|
-
ME",pt="GIT_AUTHOR_EMAIL",mt="GIT_COMMITTER_NAME",ht="GIT_COMMITTER_EMAIL",
|
|
1281
|
-
"--get-regexp","^user\\.(name|email)$"],
|
|
1277
|
+
LOGNAME)})}async function gT(e){return ip(e)||await pT(e.gitConfig||{})||sp(e)}function yT(e){return ip(e)||mT(e.gitConfig||
|
|
1278
|
+
{})||sp(e)}function ap(e){return{[pt]:e.authorEmail,[ft]:e.authorName,[ht]:e.committerEmail,[mt]:e.committerName}}async function cp(e){
|
|
1279
|
+
return ap(await gT(e))}function up(e){return ap(yT(e))}var ft,pt,mt,ht,zf,rT,Kf,Xf,nT,dt,Ut=b(()=>{K();ft="GIT_AUTHOR_NA\
|
|
1280
|
+
ME",pt="GIT_AUTHOR_EMAIL",mt="GIT_COMMITTER_NAME",ht="GIT_COMMITTER_EMAIL",zf=".users.vibe64.invalid",rT=2e3,Kf=["config",
|
|
1281
|
+
"--get-regexp","^user\\.(name|email)$"],Xf=3e4,nT=['git config --global user.name "Your Name"','git config --global user\
|
|
1282
1282
|
.email "you@example.com"'].join(`
|
|
1283
1283
|
`);dt=new Map});import zs from"node:path";function re({root:e=""}={}){return x(e||Ie().runtimePackRoot)}function Fs(e=""){let t=re();return(t?
|
|
1284
|
-
Bt[j(e)]?.binDirs||[]:[]).map(n=>zs.join(t,n))}function
|
|
1284
|
+
Bt[j(e)]?.binDirs||[]:[]).map(n=>zs.join(t,n))}function lp(){let e=re();return e?[zs.join(e,"guard-bin")]:[]}function Hs(){
|
|
1285
1285
|
let e=re();return e?[zs.join(e,"policy-bin")]:[]}function wT(e=""){let t=j(e);return[...Bt[t]?.managedCommands||[]]}var Bt,
|
|
1286
1286
|
Gs,b0,Oe=b(()=>{K();ke();Bt=Object.freeze({awsebcli:{binDirs:["awsebcli/bin"],managedCommands:["eb"]},bubblewrap:{binDirs:[
|
|
1287
1287
|
"bubblewrap/bin"],managedCommands:[]},bun:{binDirs:["bun/bin"],dependencyFiles:["package.json","bun.lock","bun.lockb","p\
|
|
@@ -1314,55 +1314,55 @@ in"],managedCommands:["php"]},playwright:{binDirs:["playwright/bin"],identityPat
|
|
|
1314
1314
|
g_isready","postgres","psql"]},ripgrep:{binDirs:["ripgrep/bin"],managedCommands:[]},sqlite:{binDirs:["sqlite/bin"],managedCommands:[
|
|
1315
1315
|
"sqlite3"]}}),Gs=Object.freeze(["operator-clis","node26","git","gh","mysql","mariadb","postgresql","sqlite","ripgrep","b\
|
|
1316
1316
|
ubblewrap","bun","php","composer","awsebcli","cpp","python","ruby","go","java","kotlin","csharp","rust","playwright"]);b0=
|
|
1317
|
-
Object.freeze({runtimePackManagedCommands:wT})});import{readFileSync as _T}from"node:fs";import
|
|
1318
|
-
if(!t)return"";let r=
|
|
1317
|
+
Object.freeze({runtimePackManagedCommands:wT})});import{readFileSync as _T}from"node:fs";import dp from"node:path";function vT({runtimePackRoot:e=""}={}){let t=re({root:e});
|
|
1318
|
+
if(!t)return"";let r=dp.join(t,fp,ET),n;try{n=_T(r,"utf8")}catch(i){if(i?.code==="ENOENT")return"";throw i}let o=n.split(
|
|
1319
1319
|
/\r?\n/u).filter(i=>i.startsWith("playwright_version=")).map(i=>i.slice(19).trim());if(o.length!==1||!ST.test(o[0]))throw new Error(
|
|
1320
|
-
`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function
|
|
1321
|
-
r=x(Ie().sharedCacheRoot),n=vT({runtimePackRoot:t});return{...r?{[eo]:r}:{},...t?{[Rr]:
|
|
1322
|
-
{[Ws]:n}:{}}}var eo,Rr,qs,Ws,
|
|
1323
|
-
ATH",qs="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Ws="VIBE64_PLAYWRIGHT_VERSION",
|
|
1320
|
+
`Invalid managed Playwright runtime manifest: ${r}.`);return o[0]}function pp({runtimePackRoot:e=""}={}){let t=re({root:e}),
|
|
1321
|
+
r=x(Ie().sharedCacheRoot),n=vT({runtimePackRoot:t});return{...r?{[eo]:r}:{},...t?{[Rr]:dp.join(t,fp,bT),[qs]:"1"}:{},...n?
|
|
1322
|
+
{[Ws]:n}:{}}}var eo,Rr,qs,Ws,fp,bT,ET,ST,Ar=b(()=>{K();ke();Oe();eo="VIBE64_SHARED_CACHE_ROOT",Rr="PLAYWRIGHT_BROWSERS_P\
|
|
1323
|
+
ATH",qs="PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD",Ws="VIBE64_PLAYWRIGHT_VERSION",fp="playwright",bT="browsers",ET="runtime.env",
|
|
1324
1324
|
ST=/^\d+\.\d+\.\d+$/u});function zt(e={}){for(let t of Object.keys(ye(e)))if(TT.has(t)||t.startsWith("XDG_")){let r=new Error(`Vibe64 command ca\
|
|
1325
1325
|
llers cannot provide execution policy env: ${t}.`);throw r.code="vibe64_command_env_policy_reserved",r}}function to(e={},t={}){
|
|
1326
1326
|
let{envPolicy:r="session"}=t,n=ye(e);zt(n);let o=Object.fromEntries(Object.entries(n).filter(([i])=>!IT.has(i)));return r===
|
|
1327
1327
|
"deployment"?o:{...o,...Xn(n)}}var TT,IT,ro=b(()=>{K();Zn();Ut();Ar();TT=new Set(["HOME","LOGNAME","PATH","TMPDIR","USER",
|
|
1328
1328
|
"VIBE64_EXECUTION_ID","VIBE64_MANAGED_EXECUTION_REQUIRED","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIM\
|
|
1329
|
-
E_DIR"]),IT=new Set([...Or,pt,ft,ht,mt,Rr,qs,Ws,eo])});function OT(e=""){let t=x(e);return t==="/home"||t.startsWith("/home/")}function
|
|
1329
|
+
E_DIR"]),IT=new Set([...Or,pt,ft,ht,mt,Rr,qs,Ws,eo])});function OT(e=""){let t=x(e);return t==="/home"||t.startsWith("/home/")}function mp({actor:e={},request:t={}}={}){let r=t.
|
|
1330
1330
|
credentialHome||{},n=x(r.home);if(!n)return{};let o=x(e.user?.home);if(e.requiresRealUser&&o&&n!==o){let a=new Error("Co\
|
|
1331
1331
|
mmand credential home must match the resolved real-user actor home.");throw a.code="vibe64_command_credential_home_actor\
|
|
1332
1332
|
_mismatch",a}if(!e.requiresRealUser&&OT(n)&&o&&!ze(o,n)){let a=new Error("A /home credential directory requires a matchi\
|
|
1333
1333
|
ng real-user actor.");throw a.code="vibe64_command_credential_home_real_user_required",a}let i=j(r.username||e.user?.username);
|
|
1334
1334
|
return{..._r({home:n,username:i},{VIBE64_CREDENTIAL_HOME:n}),...x(r.cacheRoot)?{XDG_CACHE_HOME:x(r.cacheRoot)}:{},...x(r.
|
|
1335
1335
|
configRoot)?{XDG_CONFIG_HOME:x(r.configRoot)}:{},...x(r.dataRoot)?{XDG_DATA_HOME:x(r.dataRoot)}:{},...x(r.stateRoot)?{XDG_STATE_HOME:x(
|
|
1336
|
-
r.stateRoot)}:{}}}var
|
|
1337
|
-
isAbsolute(o))continue;let i=
|
|
1336
|
+
r.stateRoot)}:{}}}var hp=b(()=>{Mt();K()});import gp from"node:path";function CT(e=[]){let t=new Set,r=[];for(let n of Array.isArray(e)?e:[e]){let o=j(n);if(!o||!gp.
|
|
1337
|
+
isAbsolute(o))continue;let i=gp.resolve(o);t.has(i)||(t.add(i),r.push(i))}return r}function Pr(e={},t=[]){let r={...e&&typeof e==
|
|
1338
1338
|
"object"&&!Array.isArray(e)?e:{}},n=Number.parseInt(String(r.GIT_CONFIG_COUNT||"0"),10),o=Number.isSafeInteger(n)&&n>=0?
|
|
1339
1339
|
n:0;for(let i of Array.isArray(t)?t:[]){let s=j(i?.key);s&&(r[`GIT_CONFIG_KEY_${o}`]=s,r[`GIT_CONFIG_VALUE_${o}`]=String(
|
|
1340
|
-
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function
|
|
1341
|
-
function
|
|
1340
|
+
i?.value??""),o+=1)}return r.GIT_CONFIG_COUNT=String(o),r}function yp(e=[]){return CT(e).map(t=>({key:"safe.directory",value:t}))}
|
|
1341
|
+
function wp(e={},t=[]){return Pr(e,yp(t))}function NT(e=[]){return yp(e).flatMap(t=>["-c",`${t.key}=${t.value}`])}function Ys(){
|
|
1342
1342
|
return{GH_PROMPT_DISABLED:"1",GIT_PAGER:"cat",GIT_TERMINAL_PROMPT:"0",PAGER:"cat"}}function Js(e={}){return Pr(e,RT)}function jT(e={}){
|
|
1343
|
-
return Pr(e,AT)}function xT(e={}){return Pr(e,PT)}function
|
|
1344
|
-
var RT,AT,PT,D0,
|
|
1343
|
+
return Pr(e,AT)}function xT(e={}){return Pr(e,PT)}function _p(e={}){return jT(Js(e))}function bp(e={}){return xT(Js(e))}
|
|
1344
|
+
var RT,AT,PT,D0,Ep=b(()=>{K();RT=Object.freeze([{key:"url.https://github.com/.insteadOf",value:"git@github.com:"},{key:"\
|
|
1345
1345
|
url.https://github.com/.insteadOf",value:"ssh://git@github.com/"}]),AT=Object.freeze([{key:"credential.https://github.co\
|
|
1346
1346
|
m.helper",value:"!/usr/bin/env gh auth git-credential"}]),PT=Object.freeze([{key:"credential.https://github.com.helper",
|
|
1347
1347
|
value:`!f() { case "$1" in get) printf '%s\\n' username=x-access-token "password=\${VIBE64_GIT_AUTH_TOKEN}" ;; esac; }; f`}]);
|
|
1348
1348
|
D0=Object.freeze({applyGitConfigEntriesToEnv:Pr,githubSshToHttpsGitEnv:Js,gitSafeDirectoryArgs:NT})});function $T(e={}){if(!e.gitAuthToken){let t=new Error("Token-backed GitHub transport requires a gitAuthToken.");throw t.
|
|
1349
|
-
code="vibe64_command_git_auth_token_required",t}return
|
|
1349
|
+
code="vibe64_command_git_auth_token_required",t}return bp({...Ys(),GIT_TERMINAL_PROMPT:"0",[kT]:e.gitAuthToken})}function Sp({
|
|
1350
1350
|
request:e={}}={}){let t={GIT_TERMINAL_PROMPT:"0"},r=t;return e.gitTransport==="github-token"?r=$T(e):(e.gitTransport==="\
|
|
1351
|
-
github-https"||e.purpose==="github")&&(r=
|
|
1352
|
-
BE64_GIT_AUTH_TOKEN"});import
|
|
1353
|
-
function
|
|
1351
|
+
github-https"||e.purpose==="github")&&(r=_p({...t,...Ys()})),wp(r,e.gitSafeDirectories||[])}var kT,vp=b(()=>{Ep();kT="VI\
|
|
1352
|
+
BE64_GIT_AUTH_TOKEN"});import Tp from"node:path";function Ip({env:e={}}={}){return re()?x(e[Ks])||(x(e.HOME)?Tp.join(x(e.HOME),".local"):""):""}
|
|
1353
|
+
function Op(e={}){let t=Ip(e);return t?{[Ks]:t}:{}}function Rp(e={}){let t=Ip(e);return t?[Tp.join(t,"bin")]:[]}var Ks,Xs=b(
|
|
1354
1354
|
()=>{K();Oe();Ks="NPM_CONFIG_PREFIX"});import{existsSync as LT,readdirSync as MT}from"node:fs";import DT from"node:os";import Fe from"node:path";import no from"node:process";
|
|
1355
|
-
function Cr(e=""){return String(e||"").split(":").map(j).filter(Boolean)}function
|
|
1356
|
-
t)}catch{return!1}})}function
|
|
1355
|
+
function Cr(e=""){return String(e||"").split(":").map(j).filter(Boolean)}function Pp(e=[]){return e.filter(t=>{try{return LT(
|
|
1356
|
+
t)}catch{return!1}})}function Ap(e="",t=/^$/u){try{return MT(e).filter(r=>t.test(r)).sort((r,n)=>Number(/\d+/u.exec(n)?.[0]||
|
|
1357
1357
|
0)-Number(/\d+/u.exec(r)?.[0]||0))}catch{return[]}}function VT(e){if(re())return[];let t=String(e.HOME||DT.homedir()||"");
|
|
1358
1358
|
if(!Fe.isAbsolute(t))return[];let r=Fe.isAbsolute(String(e.XDG_DATA_HOME||""))?e.XDG_DATA_HOME:Fe.join(t,".local/share"),
|
|
1359
|
-
n=Fe.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:Fe.join(r,"mise");return
|
|
1359
|
+
n=Fe.isAbsolute(String(e.MISE_DATA_DIR||""))?e.MISE_DATA_DIR:Fe.join(r,"mise");return Pp([Fe.join(t,".local/bin"),Fe.join(
|
|
1360
1360
|
n,"shims"),...[".claude/local",".opencode/bin",".cargo/bin",".bun/bin"].map(o=>Fe.join(t,o))])}function UT(){if(re())return[];
|
|
1361
|
-
let e=["/opt/homebrew","/usr/local"];return[...Cr(no.env.PATH),...no.platform==="darwin"?["/opt/homebrew/bin"]:[],...
|
|
1362
|
-
[...
|
|
1363
|
-
t=>[...
|
|
1361
|
+
let e=["/opt/homebrew","/usr/local"];return[...Cr(no.env.PATH),...no.platform==="darwin"?["/opt/homebrew/bin"]:[],...Pp(
|
|
1362
|
+
[...Ap("/usr/lib/postgresql",/^\d+$/u).slice(0,1).map(t=>`/usr/lib/postgresql/${t}/bin`),...no.platform==="darwin"?e.flatMap(
|
|
1363
|
+
t=>[...Ap(`${t}/opt`,/^postgresql@\d+$/u).slice(0,1).map(r=>`${t}/opt/${r}/bin`),`${t}/opt/mariadb/bin`]):[]])]}function Cp({
|
|
1364
1364
|
env:e,existingPath:t="",inheritedPath:r="",runtimes:n=[],shimDirs:o=[]}){return ct([...Cr(o.join(":")),...Hs(),...n.flatMap(
|
|
1365
|
-
i=>Fs(i)),...
|
|
1365
|
+
i=>Fs(i)),...lp(),...Cr(t||(r?"":e.PATH)),...VT(no.env),...Cr(r),...UT(),...Cr(Nr)]).join(":")}var Nr,oo=b(()=>{K();Oe();
|
|
1366
1366
|
Nr="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"});import BT from"node:path";function FT(e={}){return e.envPolicy==="deployment"||e.purpose==="deployment"||e.applicationAccount?
|
|
1367
1367
|
{}:{APP_ENV:"development"}}function HT(e={}){return e.purpose==="preview"?{NODE_ENV:"development"}:{}}function qT(e={}){
|
|
1368
1368
|
return Object.fromEntries(Object.entries(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).map(([t,r])=>[String(t||"").trim(),
|
|
@@ -1370,65 +1370,65 @@ String(r??"")]).filter(([t])=>t&&!zT.has(t)&&!GT.has(t)&&!t.startsWith("GIT_")&&
|
|
|
1370
1370
|
_")))}function Zs(e={}){return e.envPolicy==="deployment"?[e.project?.deploymentEnv,e.project?.deployment?.env]:[e.project?.
|
|
1371
1371
|
runtimeConfigEnv,e.project?.databaseEnv]}function WT(e={}){return Zs(e).reduce((t,r)=>e.envPolicy==="deployment"?(zt(r),
|
|
1372
1372
|
{...t,...ye(r)}):{...t,...to(r,e)},{})}function YT(e={},t={}){return t.envPolicy==="deployment"?[]:t.envPolicy==="projec\
|
|
1373
|
-
t"?Zs(t):[e,...Zs(t),t.project?.databaseEnv,t.session?.databaseEnv]}function
|
|
1374
|
-
let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=
|
|
1375
|
-
e.user,qT(t)),...Vt(e)&&BT.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...HT(n),...Xn(...YT(t,n)),...WT(n),...
|
|
1376
|
-
...s,...
|
|
1377
|
-
...
|
|
1378
|
-
PATH:d,...re()?{}:{VIBE64_TOOL_PATH:d}}}function
|
|
1379
|
-
cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.project,session:r.session,userKey:r.userKey}}async function
|
|
1380
|
-
let t=
|
|
1381
|
-
e,t))}}var zT,GT,ea=b(()=>{Kn();Mt();Zn();ro();Zn();
|
|
1373
|
+
t"?Zs(t):[e,...Zs(t),t.project?.databaseEnv,t.session?.databaseEnv]}function Np({actor:e={},baseEnv:t,localPath:r="",request:n={}}){
|
|
1374
|
+
let o=Array.isArray(n.runtimes)?n.runtimes.join(":"):"",i=pp(),s=to(n.env,n),a=String(t.XDG_RUNTIME_DIR||"").trim(),c={..._r(
|
|
1375
|
+
e.user,qT(t)),...Vt(e)&&BT.isAbsolute(a)?{XDG_RUNTIME_DIR:a}:{},...HT(n),...Xn(...YT(t,n)),...WT(n),...Sp({actor:e,request:n}),
|
|
1376
|
+
...s,...mp({actor:e,request:n}),...i,...FT(n)},u={...c,...Op({env:c}),VIBE64_DECLARED_RUNTIMES:o},d=Cp({env:u,existingPath:[
|
|
1377
|
+
...Rp({env:u}),u.PATH].filter(Boolean).join(":"),inheritedPath:r,runtimes:n.runtimes,shimDirs:n.shimDirs||[]});return{...u,
|
|
1378
|
+
PATH:d,...re()?{}:{VIBE64_TOOL_PATH:d}}}function jp({actor:e={},baseEnv:t,request:r={}},n){return{actor:e,env:t,gitConfig:{
|
|
1379
|
+
cwd:r.cwd,env:n},personGitIdentity:r.personGitIdentity,project:r.project,session:r.session,userKey:r.userKey}}async function xp(e){
|
|
1380
|
+
let t=Np(e);return{...t,...await cp(jp(e,t))}}function Qs(e){let t=Np(e);return{...t,...e.resolvedGitIdentityEnv||up(jp(
|
|
1381
|
+
e,t))}}var zT,GT,ea=b(()=>{Kn();Mt();Zn();ro();Zn();hp();vp();Ut();Ut();Ar();Xs();oo();Oe();K();zT=new Set([...Or,pt,ft,
|
|
1382
1382
|
ht,mt,"HOME","LOGNAME","PATH","USER","XDG_CACHE_HOME","XDG_CONFIG_HOME","XDG_DATA_HOME","XDG_RUNTIME_DIR"]),GT=new Set([
|
|
1383
|
-
"APP_ENV","NODE_ENV"])});import{Buffer as JT}from"node:buffer";function
|
|
1383
|
+
"APP_ENV","NODE_ENV"])});import{Buffer as JT}from"node:buffer";function $p(){return{code:"terminal_session_not_found",error:"Terminal session not\
|
|
1384
1384
|
found.",ok:!1}}function He(e=""){return String(e||"default").trim()||"default"}function ao(e){let t=String(e||""),r=t.length;
|
|
1385
1385
|
for(let n=0;n<KT&&(r=t.lastIndexOf(`
|
|
1386
|
-
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>
|
|
1387
|
-
"running"||e.status==="closing"}function ta(e={}){return jr(e)||e.status==="exited"}function
|
|
1386
|
+
`,r-1),!(r<0));n+=1);return r>=0&&(t=t.slice(r+1)),t.length>kp&&(t=t.slice(t.length-kp)),t}function jr(e={}){return e.status===
|
|
1387
|
+
"running"||e.status==="closing"}function ta(e={}){return jr(e)||e.status==="exited"}function Mp(e,t){try{return t(qe(e))===
|
|
1388
1388
|
!0}catch{return!1}}function ZT(e=0){let t=Math.floor(Number(e||0));return Number.isFinite(t)&&t>0?t:0}function QT(e="",t={}){
|
|
1389
1389
|
let{outputLimit:r=0}=t,n=String(e||""),o=ZT(r);return!o||n.length<=o?{output:n,outputTruncated:!1}:{output:n.slice(n.length-
|
|
1390
1390
|
o),outputTruncated:!0}}function qe(e,t={}){let r=QT(e.output,t);return{ok:!0,closeError:e.closeError||"",cols:e.cols||io,
|
|
1391
1391
|
createdAt:e.createdAt||"",id:e.id,commandPreview:e.commandPreview,exitCode:e.exitCode,inputVersion:e.inputVersion||0,lastInputAt:e.
|
|
1392
1392
|
lastInputAt||"",lastInputBytes:e.lastInputBytes||0,lastOutputAt:e.lastOutputAt||"",lastOutputBytes:e.lastOutputBytes||0,
|
|
1393
1393
|
metadata:e.metadata||{},output:r.output,outputTruncated:r.outputTruncated,outputVersion:e.outputVersion||0,rows:e.rows||
|
|
1394
|
-
so,status:e.status}}function
|
|
1394
|
+
so,status:e.status}}function Dp(e=""){return JT.byteLength(String(e||""),"utf8")}function xr(e=0){let t=Math.floor(Number(
|
|
1395
1395
|
e));return!Number.isFinite(t)||t<0?0:Math.min(t,XT)}function eI(e={}){return Math.max(Lt(e.lastSubscriberDetachedAt),Lt(
|
|
1396
1396
|
e.lastInputAt),Lt(e.lastOutputAt),Lt(e.createdAt))}function ra(e={},t=Date.now()){if(e.subscribers?.size)return 0;let r=eI(
|
|
1397
1397
|
e);return r>0?Math.max(0,Number(t)-r):0}function co(e={}){e.detachedCleanupTimer&&(clearTimeout(e.detachedCleanupTimer),
|
|
1398
|
-
e.detachedCleanupTimer=null)}var
|
|
1399
|
-
60*1e3,w$=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "})
|
|
1400
|
-
metadata:e.metadata,type:"metadata"}),qe(e))}function
|
|
1398
|
+
e.detachedCleanupTimer=null)}var kp,KT,io,so,y$,XT,w$,Lp,Gt=b(()=>{K();kp=256*1024,KT=300,io=100,so=28,y$=600*1e3,XT=1440*
|
|
1399
|
+
60*1e3,w$=Object.freeze({"ctrl-c":"",enter:"\r",escape:"\x1B",tab:" "});Lp=new Map});function Vp(e,t={}){return!e||!t||typeof t!="object"||Array.isArray(t)?qe(e):(e.metadata={...e.metadata||{},...t},Re(e,{
|
|
1400
|
+
metadata:e.metadata,type:"metadata"}),qe(e))}function Up(e,t=""){let r=Dp(t);r<1||(e.outputVersion=Number(e.outputVersion||
|
|
1401
1401
|
0)+1,e.lastOutputAt=new Date().toISOString(),e.lastOutputBytes=r)}function Re(e,t){if(e?.subscribers?.size)for(let r of[
|
|
1402
1402
|
...e.subscribers])try{r(t)}catch{e.subscribers.delete(r)}}function tI(e){let t=String(e?.code||""),r=String(e?.message||
|
|
1403
|
-
e||"Terminal PTY error.");return{code:t,message:r}}function
|
|
1403
|
+
e||"Terminal PTY error.");return{code:t,message:r}}function Bp(e,t){if(!e)return;let r=tI(t);e.lastWriteErrorAt=new Date().
|
|
1404
1404
|
toISOString(),e.lastWriteErrorCode=r.code,e.lastWriteError=r.message,console.warn("Vibe64 terminal PTY write error.",{code:r.
|
|
1405
1405
|
code,id:e.id,metadata:e.metadata||{},message:r.message,namespace:e.namespace||""}),Re(e,{code:r.code,error:r.message,type:"\
|
|
1406
|
-
error"})}function
|
|
1406
|
+
error"})}function zp(e){let t=e?.terminal?._writeStream;!t||typeof t.on!="function"||t.on("error",r=>{Bp(e,r)})}function Gp(e,t,r=t){
|
|
1407
1407
|
let n=`\r
|
|
1408
1408
|
[studio] ${r}\r
|
|
1409
|
-
`;e.closeError=t,e.output=ao(`${e.output}${n}`),Re(e,{chunk:n,type:"output"}),Re(e,{error:t,type:"error"})}async function
|
|
1409
|
+
`;e.closeError=t,e.output=ao(`${e.output}${n}`),Re(e,{chunk:n,type:"output"}),Re(e,{error:t,type:"error"})}async function Fp(e,{
|
|
1410
1410
|
code:t,flag:r,hook:n,label:o,payload:i}){if(e[r])return null;e[r]=!0;try{return await e[n](i),null}catch(s){let a=String(
|
|
1411
|
-
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,
|
|
1411
|
+
s?.message||s||`${o}.`),c=s instanceof Error?s:new Error(a);return c.code||=t,Gp(e,a,`${o}: ${a}`),c}}function gt(e,t){let r=`${String(
|
|
1412
1412
|
t?.code||"terminal_cleanup_failed")}:${String(t?.message||"")}`;return e.reportedLifecycleFailures||=new Set,e.reportedLifecycleFailures.
|
|
1413
|
-
has(r)||(e.reportedLifecycleFailures.add(r),
|
|
1413
|
+
has(r)||(e.reportedLifecycleFailures.add(r),Gp(e,String(t?.message||t||"Terminal cleanup failed."))),t}function uo(e,t=[]){
|
|
1414
1414
|
let r=new AggregateError(t,`Terminal session could not close cleanly: ${e.id}`);return r.code=t.some(n=>String(n?.code||
|
|
1415
1415
|
"").startsWith("terminal_exit_"))?"terminal_exit_unverified":"terminal_cleanup_failed",r.terminalSessionId=e.id,r}function rI(e,t){
|
|
1416
|
-
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>
|
|
1416
|
+
return e.stopHookCompletion||(e.stopHookCompletion=Promise.resolve().then(()=>Fp(e,{code:"terminal_stop_hook_failed",flag:"\
|
|
1417
1417
|
stopHookStarted",hook:"onStop",label:"Terminal stop failed",payload:{id:e.id,output:e.output,reason:t,status:e.status}}))),
|
|
1418
|
-
e.stopHookCompletion}function na(e,t){return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>
|
|
1418
|
+
e.stopHookCompletion}function na(e,t){return e.closeHookCompletion||(e.closeHookCompletion=Promise.resolve().then(()=>Fp(
|
|
1419
1419
|
e,{code:"terminal_close_hook_failed",flag:"closeHookStarted",hook:"onClose",label:"Terminal finalization failed",payload:{
|
|
1420
1420
|
exitCode:e.exitCode,id:e.id,output:e.output,reason:t,status:e.status}}))),e.closeHookCompletion}function oa(e){e.status!==
|
|
1421
1421
|
"exited"&&(e.status="exited",Re(e,{closeError:e.closeError||"",exitCode:e.exitCode,status:e.status,type:"status"}))}function ia(e){
|
|
1422
1422
|
return e.scopeDrainCompletion||(e.scopeDrainCompletion=(async()=>{if(process.platform!=="win32"&&!await Hn(e.terminal.pid)){
|
|
1423
1423
|
let t=new Error(`Terminal execution scope did not become empty: ${e.id}`);throw t.code="terminal_execution_drain_failed",
|
|
1424
|
-
t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function
|
|
1424
|
+
t}})(),e.scopeDrainCompletion.catch(()=>null)),e.scopeDrainCompletion}async function Hp(e){try{await e.scopeDrainCompletion}catch(t){
|
|
1425
1425
|
gt(e,t)}try{await Promise.all([na(e,e.stopReason||"exit"),e.stopHookCompletion])}catch(t){gt(e,t)}oa(e)}async function sa(e,t="\
|
|
1426
1426
|
stop"){if(!e||e.processExited)return{failures:[]};e.stopReason||=String(t||"stop"),e.status==="running"&&(e.status="clos\
|
|
1427
1427
|
ing",Re(e,{exitCode:e.exitCode,status:e.status,type:"status"}));let r=[];if(rI(e,e.stopReason),!e.processExited&&!e.killStarted){
|
|
1428
1428
|
e.killStarted=!0;try{e.terminal.kill()}catch(n){e.killStarted=!1;let o=n instanceof Error?n:new Error(String(n||"Termina\
|
|
1429
1429
|
l process could not be killed."));o.code||="terminal_kill_failed",r.push(gt(e,o))}}try{await ia(e)}catch(n){r.push(gt(e,
|
|
1430
|
-
n))}return{failures:r}}var aa=b(()=>{Er();Gt()});function oI(e="default"){return nI.get(He(e))||null}function
|
|
1431
|
-
ok:!1}:null}var nI,
|
|
1430
|
+
n))}return{failures:r}}var aa=b(()=>{Er();Gt()});function oI(e="default"){return nI.get(He(e))||null}function qp(e="default"){let t=oI(e);return t?{code:t.code,error:t.error,
|
|
1431
|
+
ok:!1}:null}var nI,Wp=b(()=>{Gt();nI=new Map});function Ft(e){return yt.get(He(e))||Lp}function Yp(e){let t=He(e);return yt.has(t)||yt.set(t,new Map),yt.get(t)}function Jp(e,t,r){
|
|
1432
1432
|
e.delete(r);let n=He(t);e.size<1&&yt.get(n)===e&&yt.delete(n)}function iI(e=""){let t=String(e||"");return[...yt.keys()].
|
|
1433
1433
|
filter(r=>r.startsWith(t))}function lo({namespace:e="",namespacePrefix:t="",runningOnly:r=!1}={}){let n=e?[He(e)]:iI(t),
|
|
1434
1434
|
o=[];for(let i of n){let s=Ft(i);for(let a of s.values())r&&!jr(a)||o.push({namespace:i,session:a})}return o}var yt,ca=b(
|
|
@@ -1437,14 +1437,14 @@ let n=Math.max(0,r-ra(e));e.detachedCleanupTimer=setTimeout(()=>{e.detachedClean
|
|
|
1437
1437
|
let{namespace:r="default"}=t,n=Ft(r),o=n.get(e);if(!o)return{ok:!0,closed:!1};if(o.closePromise)return o.closePromise;let i=(async()=>{
|
|
1438
1438
|
let s=[];if(co(o),!o.processExited){let u=await sa(o,"close");if(u.failures.length)throw uo(o,u.failures)}try{await o.exitCompletion}catch(u){
|
|
1439
1439
|
s.push(gt(o,u))}try{await o.scopeDrainCompletion}catch(u){s.push(gt(o,u))}let c=(await Promise.all([o.stopHookCompletion,
|
|
1440
|
-
o.closeHookCompletion])).filter(Boolean);if(o.processExited&&oa(o),s.length>0)throw uo(o,[...s,...c]);return
|
|
1440
|
+
o.closeHookCompletion])).filter(Boolean);if(o.processExited&&oa(o),s.length>0)throw uo(o,[...s,...c]);return Jp(n,r,e),{
|
|
1441
1441
|
ok:!0,closed:!0,...c.length>0?{cleanupErrors:c.map(u=>String(u?.message||u))}:{}}})();o.closePromise=i;try{return await i}finally{
|
|
1442
1442
|
o.closePromise===i&&(o.closePromise=null)}}async function sI({namespace:e}){for(let{namespace:t,session:r}of lo({namespace:e})){
|
|
1443
1443
|
if(!ta(r)||r.subscribers?.size)continue;let n=xr(r.detachedIdleTimeoutMs);if(!(n<1)){if(ra(r)<n){fo(r,t);continue}await ua(
|
|
1444
1444
|
r.id,{namespace:t})}}}var la=b(()=>{K();aa();ca();Gt()});import cI from"node:crypto";import{createRequire as uI}from"node:module";function da(){}function lI(){return!0}function fI({
|
|
1445
|
-
filter:e,namespacePrefix:t}){return lo({namespacePrefix:t,runningOnly:!0}).filter(r=>
|
|
1445
|
+
filter:e,namespacePrefix:t}){return lo({namespacePrefix:t,runningOnly:!0}).filter(r=>Mp(r.session,e)).length}function Kp({
|
|
1446
1446
|
args:e,command:t,commandPreview:r,cwd:n=process.cwd(),env:o={},maxRunning:i=0,metadata:s={},namespace:a="default",namespaceLimitPrefix:c="",
|
|
1447
|
-
runningLimitFilter:u=lI,onClose:d=da,onOutput:p=da,onStop:g=da,reuseRunning:h=!1,detachedIdleTimeoutMs:l=0}){let w=
|
|
1447
|
+
runningLimitFilter:u=lI,onClose:d=da,onOutput:p=da,onStop:g=da,reuseRunning:h=!1,detachedIdleTimeoutMs:l=0}){let w=qp(a);
|
|
1448
1448
|
if(w)return w;let _=Ft(a),f=cI.randomUUID(),m=typeof h=="function"?h:()=>!!h,y=h?[..._.values()].find(D=>jr(D)&&m(D)):null;
|
|
1449
1449
|
if(y)return qe(y);let E=Number(i||0),T=c||a;if(E>0&&fI({filter:u,namespacePrefix:T})>=E)return{ok:!1,code:"terminal_limi\
|
|
1450
1450
|
t",error:`Terminal limit reached (${E}).`};let S=typeof o=="function"?o({id:f,namespace:a}):o,v=typeof e=="function"?e({
|
|
@@ -1455,13 +1455,13 @@ cwd:n,detachedCleanupTimer:null,detachedIdleTimeoutMs:xr(l),exitCompletion:P,exi
|
|
|
1455
1455
|
toISOString(),metadata:O&&typeof O=="object"&&!Array.isArray(O)?O:{},onClose:d,onStop:g,inputVersion:0,lastInputAt:"",lastInputBytes:0,
|
|
1456
1456
|
lastOutputAt:"",lastOutputBytes:0,lastWriteError:"",lastWriteErrorAt:"",lastWriteErrorCode:"",output:"",outputVersion:0,
|
|
1457
1457
|
processExited:!1,killStarted:!1,reportedLifecycleFailures:new Set,resolveExitCompletion:$,rows:so,status:"running",stopHookCompletion:null,
|
|
1458
|
-
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:A};return
|
|
1458
|
+
scopeDrainCompletion:null,namespace:a,subscribers:new Set,terminal:A};return zp(C),A.onData(D=>{Up(C,D),C.output=ao(C.output+
|
|
1459
1459
|
D),Re(C,{chunk:D,lastOutputAt:C.lastOutputAt,outputVersion:C.outputVersion,type:"output"});try{p({chunk:D,output:C.output,
|
|
1460
|
-
session:qe(C),updateMetadata(Y){return
|
|
1460
|
+
session:qe(C),updateMetadata(Y){return Vp(C,Y)}})}catch(Y){let ae=String(Y?.message||Y||"Terminal output hook failed.");
|
|
1461
1461
|
Re(C,{error:ae,type:"error"})}fo(C,a)}),A.onExit(({exitCode:D})=>{C.processExited=!0,C.exitCode=D,C.status="closing",ia(
|
|
1462
|
-
C),Re(C,{exitCode:D,status:C.status,type:"status"}),na(C,C.stopReason||"exit"),C.resolveExitCompletion(),
|
|
1462
|
+
C),Re(C,{exitCode:D,status:C.status,type:"status"}),na(C,C.stopReason||"exit"),C.resolveExitCompletion(),Hp(C)}),Yp(a).set(
|
|
1463
1463
|
f,C),fo(C,a),pI(f,{namespace:a})}function pI(e,t={}){let{namespace:r="default",outputLimit:n=0}=t,i=Ft(r).get(e);return i?
|
|
1464
|
-
qe(i,{outputLimit:n})
|
|
1464
|
+
qe(i,{outputLimit:n}):$p()}var aI,dI,Xp=b(()=>{K();Gt();aa();Wp();la();ca();aI=new URL("./../node_modules/@local/vibe64-\
|
|
1465
1465
|
execution/src/server/engines/terminalSessions.js",import.meta.url).href;dI=uI(aI)});import{randomUUID as mI}from"node:crypto";import{mkdirSync as hI,writeFileSync as gI}from"node:fs";import fa from"node:path";
|
|
1466
1466
|
function yI(){}function wI(e=""){let t=String(e||"").trim();if(!t){let n=new Error("A helper payload root is required fo\
|
|
1467
1467
|
r real-user PTY execution.");throw n.code="vibe64_command_pty_helper_payload_root_required",n}let r=fa.join(fa.resolve(t),
|
|
@@ -1470,17 +1470,17 @@ let{actor:r,cwd:n,env:o,resolveEnv:i}=t,s=e.terminal||{},a=e.envFactory?i:o;retu
|
|
|
1470
1470
|
d=typeof e.args=="function"?e.args(c):e.args,p=qn({actor:r,args:d,command:e.command,cwd:n,env:typeof a=="function"?a(c):
|
|
1471
1471
|
a,input:e.input,operation:Tr(e)});return gI(u,`${JSON.stringify(p)}
|
|
1472
1472
|
`,{mode:384}),["-n",Ns(),"execute",u]},command:"sudo",cwd:s.helperPayloadRoot,env:{PATH:process.env.PATH||Nr}}:{args:e.args,
|
|
1473
|
-
command:e.command,cwd:n,env:a}}async function
|
|
1474
|
-
{},{onClose:a=yI}=s,c=e.execution?.id||"",u=_I(e,{actor:r,cwd:n,env:o,resolveEnv:i}),d=
|
|
1473
|
+
command:e.command,cwd:n,env:a}}async function Qp(e={},t={}){let{actor:r,cwd:n,env:o,resolveEnv:i}=t;try{let s=e.terminal||
|
|
1474
|
+
{},{onClose:a=yI}=s,c=e.execution?.id||"",u=_I(e,{actor:r,cwd:n,env:o,resolveEnv:i}),d=Kp({args:u.args,command:u.command,
|
|
1475
1475
|
commandPreview:s.commandPreview,cwd:u.cwd,detachedIdleTimeoutMs:s.detachedIdleTimeoutMs,env:u.env,maxRunning:s.maxRunning,
|
|
1476
1476
|
metadata:s.metadata,namespace:s.namespace,namespaceLimitPrefix:s.namespaceLimitPrefix,onClose:async p=>{try{await a(p)}finally{
|
|
1477
|
-
c&&
|
|
1478
|
-
runningLimitFilter:s.runningLimitFilter});return d?.ok===!0&&c&&
|
|
1477
|
+
c&&Zp.set(c,{id:p.id,namespace:s.namespace,scopeEmpty:!0})}},onOutput:s.onOutput,onStop:s.onStop,reuseRunning:s.reuseRunning,
|
|
1478
|
+
runningLimitFilter:s.runningLimitFilter});return d?.ok===!0&&c&&Zp.set(c,{id:d.id,namespace:s.namespace}),d?.ok===!0?{...d,
|
|
1479
1479
|
execution:e.execution}:d}catch(s){return te(s?.message||"Vibe64 PTY command failed.",s?.code||"vibe64_command_pty_failed",
|
|
1480
|
-
{execution:e.execution})}}var
|
|
1480
|
+
{execution:e.execution})}}var Zp,pa=b(()=>{ut();oo();Xp();la();Wn();Kn();Zp=new Map});import{realpathSync as em}from"node:fs";function bI(e=""){return x(e||process.cwd())}function tm(e="",t={}){let{allowedRoots:r=[],
|
|
1481
1481
|
resolveLinks:n=!0}=t,o=bI(e),i=(Array.isArray(r)?r:[r]).map(x).filter(Boolean);if(i.length===0)return o;let s=i.filter(c=>ze(
|
|
1482
|
-
c,o));if(s.length>0){if(!n)return o;let c=
|
|
1483
|
-
s outside the allowed roots.");throw a.code="vibe64_command_cwd_outside_allowed_roots",a}var
|
|
1482
|
+
c,o));if(s.length>0){if(!n)return o;let c=em(o);if(s.some(u=>ze(em(u),c)))return c}let a=new Error("Vibe64 command cwd i\
|
|
1483
|
+
s outside the allowed roots.");throw a.code="vibe64_command_cwd_outside_allowed_roots",a}var rm=b(()=>{K()});import{randomUUID as EI}from"node:crypto";function se(e="",t="vibe64_command_request_invalid"){let r=new Error(e||"Inval\
|
|
1484
1484
|
id Vibe64 command request.");return r.code=t,r}function We(e="",t=[],r="",n="value"){let o=j(e)||r;if(!t.includes(o))throw se(
|
|
1485
1485
|
`Unsupported Vibe64 command ${n}: ${o||"(empty)"}.`,`vibe64_command_${n}_unsupported`);return o}function xI(e=[],t={}){let{
|
|
1486
1486
|
mode:r="capture"}=t;if(typeof e=="function"){if(r!=="pty")throw se("Function-valued command args are only supported for \
|
|
@@ -1497,7 +1497,7 @@ uid:Number.isSafeInteger(Number(t.uid??t.hostUid))?Number(t.uid??t.hostUid):null
|
|
|
1497
1497
|
t.userKey)}:{}}function MI(e="capture"){return e==="detached"?"service":e==="pty"?"interactive":"finite"}function DI({mode:e="\
|
|
1498
1498
|
capture",purpose:t="terminal"}={}){return t==="preview"?"preview":e==="pty"?"terminal":"job"}function Ht(e=""){let t=j(e);
|
|
1499
1499
|
if(!t)return"";if(!/^[A-Za-z0-9](?:[A-Za-z0-9._:-]{0,254}[A-Za-z0-9])?$/u.test(t))throw se(`Invalid Vibe64 execution ide\
|
|
1500
|
-
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function
|
|
1500
|
+
ntifier: ${t}.`,"vibe64_execution_identifier_invalid");return t}function om(e={},t={}){let{mode:r="capture",project:n={},
|
|
1501
1501
|
purpose:o="terminal",session:i={}}=t,s=ee(e),a=We(s.kind,PI,DI({mode:r,purpose:o}),"execution_kind"),c=We(s.lifecycle,CI,
|
|
1502
1502
|
MI(r),"execution_lifecycle");if(r==="detached"&&c!=="service"||r==="pty"&&c!=="interactive"||r==="capture"&&c!=="finite")
|
|
1503
1503
|
throw se(`Execution lifecycle ${c} is incompatible with command mode ${r}.`,"vibe64_execution_lifecycle_incompatible");let u=Ht(
|
|
@@ -1511,9 +1511,9 @@ id:EI(),kind:a,label:j(s.label),lifecycle:c,operationId:Ht(s.operationId),ownerI
|
|
|
1511
1511
|
projectSlug:Ht(s.projectSlug||n.slug||n.projectSlug),sessionId:Ht(s.sessionId||i.sessionId)})}function VI(e){if(typeof e!=
|
|
1512
1512
|
"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 se("Execution req\
|
|
1513
1513
|
uires a valid managed workflow id.","vibe64_workflow_id_invalid");return e.toLowerCase()}function UI(e=""){return jI.has(
|
|
1514
|
-
e)?Gs:[]}function
|
|
1515
|
-
imes"),n=
|
|
1516
|
-
j).filter(Boolean))}function
|
|
1514
|
+
e)?Gs:[]}function nm(e={},t=""){return Object.prototype.hasOwnProperty.call(e,t)}function BI(e={},t=""){let r=nm(e,"runt\
|
|
1515
|
+
imes"),n=nm(e,"runtime");if(!r&&!n)return ct(UI(t));let o=r?e.runtimes:e.runtime;return ct((Array.isArray(o)?o:[o]).map(
|
|
1516
|
+
j).filter(Boolean))}function im(e={}){let t=ee(e),r=j(t.command);if(!r)throw se("A command is required.","vibe64_command\
|
|
1517
1517
|
_required");let n=We(t.mode,II,"capture","mode");if(t.signal!=null&&(!(t.signal instanceof AbortSignal)||n!=="capture"))
|
|
1518
1518
|
throw se("Cancellation signals require a finite capture command.","vibe64_command_signal_invalid");let o=ye(t.baseEnv),i=kI(
|
|
1519
1519
|
t.env,{mode:n}),s=We(t.purpose,TI,"terminal","purpose"),a=BI(t,s);for(let l of a)if(!Object.hasOwn(Bt,l))throw se(`Unsup\
|
|
@@ -1529,7 +1529,7 @@ let h=t.sandboxAllowances??[];if(!Array.isArray(h)||h.some(l=>typeof l!="string"
|
|
|
1529
1529
|
h).size!==h.length||h.length>0&&!g)throw se("Sandbox allowances belong only to an application account's own commands.","\
|
|
1530
1530
|
vibe64_command_sandbox_allowances_invalid");return{actor:We(t.actor,SI,"daemon","actor"),applicationAccount:g,allowedRoots:ma(
|
|
1531
1531
|
t.allowedRoots),args:xI(t.args,{mode:n}),baseEnv:o,command:r,cwd:x(t.cwd||process.cwd()),env:i.env,envFactory:i.envFactory,
|
|
1532
|
-
envPolicy:We(t.envPolicy,RI,"session","env_policy"),releaseEnvironmentFile:d,sandboxAllowances:[...h],execution:
|
|
1532
|
+
envPolicy:We(t.envPolicy,RI,"session","env_policy"),releaseEnvironmentFile:d,sandboxAllowances:[...h],execution:om(t.execution,
|
|
1533
1533
|
{mode:n,project:c,purpose:s,session:u}),credentialHome:LI(t.credentialHome),gitAuthToken:j(t.gitAuthToken),gitSafeDirectories:ma(
|
|
1534
1534
|
t.gitSafeDirectories),personGitIdentity:{email:j(t.personGitIdentity?.email),name:j(t.personGitIdentity?.name)},gitTransport:We(
|
|
1535
1535
|
t.gitTransport,AI,"none","git_transport"),inheritProcessEnv:!d&&t.inheritProcessEnv!==!1,input:t.input,logPath:x(t.logPath),
|
|
@@ -1537,52 +1537,52 @@ maxBuffer:Number.isSafeInteger(Number(t.maxBuffer))&&Number(t.maxBuffer)>0?Numbe
|
|
|
1537
1537
|
onOutput=="function"?t.onOutput:null,outputEncoding:We(t.outputEncoding,OI,"utf8","output_encoding"),project:c,purpose:s,
|
|
1538
1538
|
runtimes:a,session:u,signal:t.signal??null,shimDirs:ma(t.shimDirs),terminal:$I(t.terminal),timeout:Number.isSafeInteger(
|
|
1539
1539
|
Number(t.timeout))&&Number(t.timeout)>0?Number(t.timeout):15e3,usageRecordingPreload:p,userKey:j(t.userKey)}}var SI,vI,TI,
|
|
1540
|
-
II,OI,RI,AI,PI,CI,NI,jI,yL,
|
|
1540
|
+
II,OI,RI,AI,PI,CI,NI,jI,yL,sm=b(()=>{K();ro();Oe();SI=Object.freeze(["daemon","owner-user","named-user","app"]),vI=/^[a-z_][a-z0-9_-]{0,31}$/u,
|
|
1541
1541
|
TI=Object.freeze(["account","assistant","terminal","codex","github","github-api","source-editor","preview","output","dep\
|
|
1542
1542
|
loyment","health","workspace-cache","source"]),II=Object.freeze(["capture","pty","detached"]),OI=Object.freeze(["utf8","\
|
|
1543
1543
|
base64"]),RI=Object.freeze(["session","project","preview","auth","deployment"]),AI=Object.freeze(["none","github-https",
|
|
1544
1544
|
"github-token"]),PI=Object.freeze(["assistant","browser","control","job","preview","service","terminal"]),CI=Object.freeze(
|
|
1545
1545
|
["finite","interactive","service"]),NI=1e3*1e3*100,jI=new Set(["assistant","codex","deployment","output","preview","sour\
|
|
1546
|
-
ce","terminal"]);yL=Object.freeze({normalizeExecutionDescriptor:
|
|
1547
|
-
()=>{vr();Er();pa();ut();zI=null,
|
|
1546
|
+
ce","terminal"]);yL=Object.freeze({normalizeExecutionDescriptor:om})});function ha(){return zI}function po(e){return["1","true"].includes(String(e[am]||"").trim().toLowerCase())}var zI,am,mo=b(
|
|
1547
|
+
()=>{vr();Er();pa();ut();zI=null,am="VIBE64_MANAGED_EXECUTION_REQUIRED"});import{realpathSync as cm,statSync as FI}from"node:fs";import Ye from"node:path";import{fileURLToPath as HI}from"node:url";
|
|
1548
1548
|
function qI(e){let t=[Ye.resolve(Ye.dirname(e),"../../../vibe64-usage-recording/runtime/node")];for(let r=Ye.dirname(e);t.
|
|
1549
1549
|
push(Ye.join(r,"node_modules/@local/vibe64-usage-recording/runtime/node")),Ye.dirname(r)!==r;r=Ye.dirname(r));return t.flatMap(
|
|
1550
|
-
r=>{try{return[
|
|
1550
|
+
r=>{try{return[cm(r)]}catch{return[]}})}function um(e="",t=HI(GI)){try{if(Ye.resolve(e)===e&&cm(e)===e&&FI(e).isFile()&&
|
|
1551
1551
|
qI(t).some(r=>e.startsWith(`${r}${Ye.sep}`)))return`--import=${e}`}catch{}throw Object.assign(new Error("The usage recor\
|
|
1552
|
-
der is not part of this Vibe64 installation."),{code:"vibe64_usage_recording_preload_invalid"})}var GI,
|
|
1553
|
-
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function
|
|
1552
|
+
der is not part of this Vibe64 installation."),{code:"vibe64_usage_recording_preload_invalid"})}var GI,lm=b(()=>{GI=new URL(
|
|
1553
|
+
"./../node_modules/@local/vibe64-execution/src/server/usageRecordingPreload.js",import.meta.url).href});function dm(e){return e.releaseEnvironmentFile?te("Release environment execution requires a managed host.","vibe64_relea\
|
|
1554
1554
|
se_environment_unavailable",{execution:e.execution}):e.applicationAccount?te("Application account execution requires a m\
|
|
1555
1555
|
anaged host.","vibe64_application_account_unavailable",{execution:e.execution}):null}async function WI(e,t={}){let{actor:r,
|
|
1556
|
-
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=
|
|
1557
|
-
u=s;o={...o,NODE_OPTIONS:c},s=d=>({...u(d),NODE_OPTIONS:c})}return e.mode==="pty"?
|
|
1556
|
+
cwd:n,env:o,requiresHelper:i,resolveEnv:s}=t,a=dm(e);if(a)return a;if(e.usageRecordingPreload){let c=um(e.usageRecordingPreload),
|
|
1557
|
+
u=s;o={...o,NODE_OPTIONS:c},s=d=>({...u(d),NODE_OPTIONS:c})}return e.mode==="pty"?Qp(e,{actor:r,cwd:n,env:o,resolveEnv:s}):
|
|
1558
1558
|
e.mode==="detached"?r.requiresRealUser&&(!Vt(r)||i)?te("Detached real-user command execution is unsupported when the hel\
|
|
1559
|
-
per is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):
|
|
1559
|
+
per is required.","vibe64_command_detached_real_user_unsupported",{execution:e.execution}):Sf(e,{actor:r,cwd:n,env:o}):i?
|
|
1560
1560
|
{...await js(qn({actor:r,args:e.args,command:e.command,cwd:n,env:o,input:e.input,operation:Tr(e)}),{env:process.env,maxBuffer:e.
|
|
1561
1561
|
maxBuffer,outputEncoding:e.outputEncoding,signal:e.signal,timeout:e.timeout}),execution:e.execution}:Sr(e.command,e.args,
|
|
1562
1562
|
{cwd:n,env:o,execution:e.execution,input:e.input,maxBuffer:e.maxBuffer,onOutput:e.onOutput,outputEncoding:e.outputEncoding,
|
|
1563
|
-
signal:e.signal,timeout:e.timeout})}async function qt(e={}){let t=null;try{if(t=
|
|
1564
|
-
nd cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await
|
|
1563
|
+
signal:e.signal,timeout:e.timeout})}async function qt(e={}){let t=null;try{if(t=im(e),t.signal?.aborted)return te("Comma\
|
|
1564
|
+
nd cancelled.","vibe64_command_cancelled",{execution:t.execution});let r=await Mf(t),n=t.inheritProcessEnv?{...process.env,
|
|
1565
1565
|
...t.baseEnv}:{...t.baseEnv},o=(f={})=>({...f,VIBE64_EXECUTION_ID:t.execution.id}),i=ha(),s=po(n)||po(process.env),a=Jn(
|
|
1566
|
-
r),u=!(!!i||s||Us())&&Vt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",d=o(await
|
|
1566
|
+
r),u=!(!!i||s||Us())&&Vt(r)?[n.PATH,process.env.PATH].filter(Boolean).join(":"):"",d=o(await xp({actor:r,baseEnv:n,localPath:u,
|
|
1567
1567
|
request:t.releaseEnvironmentFile?{...t,project:{},session:{}}:t})),p=Object.fromEntries([pt,ft,ht,mt].map(f=>[f,d[f]]));
|
|
1568
|
-
|
|
1568
|
+
Bf(r,d);let g=tm(t.cwd,{allowedRoots:t.allowedRoots,resolveLinks:!t.applicationAccount});Uf(r,t,g);let h=(f={})=>typeof t.
|
|
1569
1569
|
args=="function"?t.args(f):t.args,l=(f={})=>o(t.envFactory?Qs({actor:r,baseEnv:n,localPath:u,resolvedGitIdentityEnv:p,request:{
|
|
1570
1570
|
...t,env:t.envFactory(f),envFactory:null}}):d),w=(f=t,m={})=>WI(f,{actor:r,cwd:g,env:d,requiresHelper:a,resolveEnv:l,...m});
|
|
1571
|
-
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:g,env:d,resolveArgs:h,resolveEnv:l,runLocal:w});let _=
|
|
1571
|
+
if(i)return await i.runCommand(t,{actor:r,baseEnv:n,cwd:g,env:d,resolveArgs:h,resolveEnv:l,runLocal:w});let _=dm(t);return _||
|
|
1572
1572
|
(s?te("Managed execution safety is unavailable. Vibe64 did not start this work.","vibe64_managed_execution_provider_unav\
|
|
1573
1573
|
ailable",{execution:t.execution,retryable:!1}):w())}catch(r){return te(r?.message||"Vibe64 command failed.",r?.code||"vi\
|
|
1574
|
-
be64_command_failed",{execution:t?.execution})}}var ho=b(()=>{
|
|
1575
|
-
|
|
1574
|
+
be64_command_failed",{execution:t?.execution})}}var ho=b(()=>{Df();ea();Ut();vr();Wn();Er();pa();rm();Kn();sm();ut();mo();
|
|
1575
|
+
lm()});import{fileURLToPath as JI}from"node:url";var YI,YL,JL,KL,XL,fm=b(()=>{ke();YI=new URL("./../node_modules/@local/vibe64-\
|
|
1576
1576
|
execution/src/server/gitTurnCheckpoint.js",import.meta.url).href,YL=JI(new URL("./gitTurnCheckpointCommand.js",YI)),JL=15*
|
|
1577
|
-
6e4,KL=512*1024*1024,XL=1024*1024*1024});var eM,
|
|
1578
|
-
e||"").trim();return ZI[t]||t}function
|
|
1577
|
+
6e4,KL=512*1024*1024,XL=1024*1024*1024});var eM,pm=b(()=>{K();eM=Object.freeze(["LANG","LC_ALL","NO_PROXY","PATH","SSL_CERT_DIR","SSL_CERT_FILE","TZ"])});var mm=b(()=>{});import{existsSync as KI}from"node:fs";import go from"node:path";import hm from"node:process";function ga(e=""){let t=String(
|
|
1578
|
+
e||"").trim();return ZI[t]||t}function ym({platform:e=hm.platform,aptGet:t=!1}={}){return e==="darwin"?"brew":t?"apt":""}
|
|
1579
1579
|
function QI(e,t=Nr){return[...String(e.PATH||"").split(go.delimiter),...String(t||"").split(go.delimiter)].some(r=>go.isAbsolute(
|
|
1580
|
-
r)&&KI(go.join(r,"apt-get")))}function wo({env:e,platform:t=
|
|
1580
|
+
r)&&KI(go.join(r,"apt-get")))}function wo({env:e,platform:t=hm.platform,systemPath:r}){return ym({platform:t,aptGet:t!==
|
|
1581
1581
|
"darwin"&&QI(e,r)})}function _o(e="",t={}){let{family:r="",mise:n=!1,xcode:o=!0}=t,i=yo[ga(e)];if(!i)return null;if(r===
|
|
1582
1582
|
"brew"&&!o&&["git","cpp"].includes(ga(e)))return{command:"xcode-select --install",sudo:!1,note:""};let s=i.any||i[r]||"";
|
|
1583
1583
|
if(!s&&i.mise&&(s=n?`mise use -g ${i.mise}`:`${XI} && ~/.local/bin/mise use -g ${i.mise}`),!s)return null;let a=s.startsWith(
|
|
1584
|
-
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?
|
|
1585
|
-
|
|
1584
|
+
"sudo ")||r==="apt"&&s.includes("--with-deps");return{command:s,sudo:a,note:a?gm:""}}var gm,XI,aM,yo,ZI,cM,kr=b(()=>{oo();
|
|
1585
|
+
gm="You'll be asked for your computer password. Nothing shows while you type.",XI="curl -fsSL https://mise.run | sh",aM=
|
|
1586
1586
|
Object.freeze({linux:"https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-linux.md",darwin:"\
|
|
1587
1587
|
https://github.com/mobily-enterprises/vibe64/blob/main/docs/colleague-usage/set-up-macos.md"}),yo=Object.freeze({claude:{
|
|
1588
1588
|
name:"Claude Code",run:[["claude"]],guideUrl:"https://code.claude.com/docs/en/setup",any:"curl -fsSL https://claude.ai/i\
|
|
@@ -1608,17 +1608,17 @@ rl -fsSL https://php.new/install/linux)"',brew:'/bin/bash -c "$(curl -fsSL https
|
|
|
1608
1608
|
ild tools",setup:"build-tools",run:[["cc","gcc","clang"],["make"]],guideUrl:"https://guides.rubyonrails.org/install_ruby\
|
|
1609
1609
|
_on_rails.html",detail:"Some packages compile native code, so they need a compiler and a few libraries.",apt:"sudo apt i\
|
|
1610
1610
|
nstall build-essential pkg-config libyaml-dev libssl-dev zlib1g-dev libpq-dev default-libmysqlclient-dev libgmp-dev",brew:"\
|
|
1611
|
-
brew install pkg-config libyaml openssl@3 gmp"}}),ZI=Object.freeze({composer:"php"});cM=Object.freeze({SUDO_NOTE:
|
|
1611
|
+
brew install pkg-config libyaml openssl@3 gmp"}}),ZI=Object.freeze({composer:"php"});cM=Object.freeze({SUDO_NOTE:gm,localToolFamily:ym})});function wm({env:e,platform:t,systemPath:r}){return _o("git",{family:wo({env:e,platform:t,systemPath:r})})?.command||""}
|
|
1612
1612
|
function eO(e={}){return[e.error,e.stderr,e.output].filter(Boolean).join(`
|
|
1613
|
-
`)}function tO(e,t){let r=eO(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=
|
|
1613
|
+
`)}function tO(e,t){let r=eO(e);if(/spawn(?:Sync)? git ENOENT|(?:^|\s)git: (?:command )?not found/mu.test(r)){let n=wm(t);
|
|
1614
1614
|
return{code:"vibe64_git_missing",installCommand:n,message:n?`Git isn't installed on this computer. Install it with: ${n}`:
|
|
1615
1615
|
"Git isn't installed on this computer. Install Git, then try again."}}return/unknown option [`']initial-branch/u.test(r)?
|
|
1616
|
-
{code:"vibe64_git_too_old",installCommand:
|
|
1616
|
+
{code:"vibe64_git_too_old",installCommand:wm(t),message:"This Git is too old for Vibe64. Update Git to version 2.28 or n\
|
|
1617
1617
|
ewer, then try again."}:/gpg failed to sign|failed to sign the data|signing failed|couldn't (?:load|find) (?:public )?key|incorrect passphrase/iu.
|
|
1618
1618
|
test(r)?{code:"vibe64_git_signing_failed",installCommand:"",message:"Your Git is set to sign every commit, and signing d\
|
|
1619
1619
|
idn't work here. Vibe64 can't type a key passphrase for you. Make one signed commit in a terminal to check your key work\
|
|
1620
|
-
s and is unlocked, then try again."}:null}var dM,
|
|
1621
|
-
backups.git",
|
|
1620
|
+
s and is unlocked, then try again."}:null}var dM,_m=b(()=>{kr();dM=Object.freeze({describeGitFailure:tO})});var ya=b(()=>{});import bm from"node:path";function oO(e=""){return e?bm.join(bm.dirname(e),Em):""}var Em,Sm,nO,gM,yM,vm=b(()=>{ya();Em="\
|
|
1621
|
+
backups.git",Sm="vibe64-atomic",nO=`backup_canonical_ref() {
|
|
1622
1622
|
vibe64_backup_repository="$1"
|
|
1623
1623
|
vibe64_source_repository="$2"
|
|
1624
1624
|
vibe64_source_ref="$3"
|
|
@@ -1642,7 +1642,7 @@ set -eu
|
|
|
1642
1642
|
zero_object=0000000000000000000000000000000000000000
|
|
1643
1643
|
git_dir="$(git rev-parse --absolute-git-dir)"
|
|
1644
1644
|
repository_root="$(dirname "$git_dir")"
|
|
1645
|
-
backup_repository="$repository_root/${
|
|
1645
|
+
backup_repository="$repository_root/${Em}"
|
|
1646
1646
|
if [ -L "$repository_root" ] || [ -L "$backup_repository" ] || [ -L "$repository_root/mutation.lock" ]; then
|
|
1647
1647
|
printf '[vibe64] Canonical repository storage must not use symlinked role paths.
|
|
1648
1648
|
' >&2
|
|
@@ -1651,7 +1651,7 @@ fi
|
|
|
1651
1651
|
exec 8>"$repository_root/mutation.lock"
|
|
1652
1652
|
flock -x 8
|
|
1653
1653
|
|
|
1654
|
-
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${
|
|
1654
|
+
if [ "\${GIT_PUSH_OPTION_COUNT:-0}" != "1" ] || [ "\${GIT_PUSH_OPTION_0:-}" != "${Sm}" ]; then
|
|
1655
1655
|
printf '[vibe64] Canonical repository pushes must use the Vibe64 atomic mutation path.
|
|
1656
1656
|
' >&2
|
|
1657
1657
|
exit 1
|
|
@@ -1710,8 +1710,8 @@ while read -r old_object _new_object ref_name; do
|
|
|
1710
1710
|
backup_canonical_ref "$backup_repository" "$git_dir" "$ref_name" "$old_object" "$backup_ref"
|
|
1711
1711
|
fi
|
|
1712
1712
|
done <"$updates_file"
|
|
1713
|
-
`;yM=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:
|
|
1714
|
-
wserWorkerSource.js",import.meta.url).href});var sO,
|
|
1713
|
+
`;yM=Object.freeze({CANONICAL_REPOSITORY_PUSH_OPTION:Sm,canonicalRepositoryBackupPath:oO})});var Tm=b(()=>{Ar();Oe()});var wa=b(()=>{});var Im=b(()=>{});var Om=b(()=>{});var _a=b(()=>{});var AM,Rm=b(()=>{Im();Om();_a();AM=new URL("./../node_modules/@local/vibe64-execution/src/server/runtime/agentPreviewBro\
|
|
1714
|
+
wserWorkerSource.js",import.meta.url).href});var sO,Am=b(()=>{sO=["Usage:"," vibe64-helper preview ensure [--target <target-id>] [--wait] [--json] [--timeout-ms <ms\
|
|
1715
1715
|
>]"," vibe64-helper preview targets [--json]"," vibe64-helper preview status [--json]"," vibe64-helper preview stop [\
|
|
1716
1716
|
--json]"," vibe64-helper preview open <path> [--json]"," vibe64-helper preview inspect-url"," vibe64-helper preview s\
|
|
1717
1717
|
creenshot [--output <path>]"," vibe64-helper preview browser ensure"," vibe64-helper preview browser eval < playwright\
|
|
@@ -1754,67 +1754,67 @@ ical preview server for the configured primary application.","Do not start a dup
|
|
|
1754
1754
|
er port.","A distinct secondary application explicitly requested by the user, such as a reference app, may run separatel\
|
|
1755
1755
|
y without replacing this preview."].join(`
|
|
1756
1756
|
`)+`
|
|
1757
|
-
`});var
|
|
1758
|
-
-execution/src/server/conversationExecution.js",import.meta.url).href,VM=dO(new URL("./engines/stdioBridge.js",lO))});var HM,
|
|
1757
|
+
`});var Pm=b(()=>{});import{fileURLToPath as dO}from"node:url";var lO,VM,Cm=b(()=>{ho();mo();ke();lO=new URL("./../node_modules/@local/vibe64\
|
|
1758
|
+
-execution/src/server/conversationExecution.js",import.meta.url).href,VM=dO(new URL("./engines/stdioBridge.js",lO))});var HM,Nm=b(()=>{ho();kr();Oe();HM=["skip=$1; version=$2; shift 2",'for name in "$@"; do',' found=$(command -v -- "$nam\
|
|
1759
1759
|
e" 2>/dev/null) || continue'," case $found in /*) ;; *) continue ;; esac",' if [ -n "$skip" ]; then case $found in /us\
|
|
1760
1760
|
r/bin/*) continue ;; esac; fi',` printf '%s\\n' "$found"`,' exec "$found" $version 2>&1',"done","exit 127"].join(`
|
|
1761
|
-
`)});var fO,
|
|
1762
|
-
any:n}=yo[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as pO}from"node:child_process";import{promisify as mO}from"node:util";var ZM,
|
|
1763
|
-
Oe();
|
|
1764
|
-
yr();le();U();hO="runtime",gO="open.json";q4=Object.freeze({projectRuntimeOpenStatePath:yO})});var $r=b(()=>{ba();le();$t();Ea();Vn();Un()
|
|
1761
|
+
`)});var fO,jm=b(()=>{kr();Oe();fO=Object.freeze(Object.fromEntries(["claude","codex","opencode"].map(e=>{let{name:t,guideUrl:r,
|
|
1762
|
+
any:n}=yo[e];return[e,Object.freeze({name:t,guideUrl:r,install:n})]})))});import{execFile as pO}from"node:child_process";import{promisify as mO}from"node:util";var ZM,xm=b(()=>{ZM=mO(pO)});var ba=b(()=>{zn();df();Mt();Wn();Lf();ho();vr();ut();mo();fm();ea();pm();mm();ro();Xs();Ut();_m();ya();vm();K();Ar();ke();
|
|
1763
|
+
Oe();Tm();wa();Rm();_a();Am();Pm();Cm();kr();Nm();jm();xm();wa()});var Ea=b(()=>{le()});import km from"node:path";function yO(e=""){let t=St(e);return t?km.join(km.resolve(t),hO,gO):""}var hO,gO,q4,$m=b(()=>{
|
|
1764
|
+
yr();le();U();hO="runtime",gO="open.json";q4=Object.freeze({projectRuntimeOpenStatePath:yO})});var $r=b(()=>{ba();le();$t();Ea();Vn();Un();$m();Ue();Mn();Ve()});var Um=b(()=>{le();$t();kt();Vn();Un();Ue();$r()});var zm=b(()=>{le();kt();Ue();$r()});var Hm=b(()=>{le();$t();kt();Ea();Vn();Un();Ue();$r()});var qm=b(()=>{le();kt();Mn();Ue();$t();Um();zm();Hm();$r()});var Wm=b(()=>{});var Ym,NO,jO,xV,kV,Jm=b(()=>{Wm();Ym="vibe64_learning_mode_project",NO="You're in Learn mode. Press L to go back to your\
|
|
1765
1765
|
projects.",jO="This is a practice project. Press L to switch to Learn.",xV=Object.freeze({on:!1,currentAttemptId:"",lessonCode:"",
|
|
1766
|
-
practiceSlug:""}),kV=Object.freeze({LEARNING_MODE_PROJECT_MESSAGE:NO,PRACTICE_PROJECT_MODE_MESSAGE:jO})});var
|
|
1767
|
-
freeze({vibe64_invalid_project_slug:422,vibe64_project_route_unavailable:404,[
|
|
1768
|
-
[of]:404,vibe64_project_path_not_directory:409,vibe64_project_path_symlink:409})});import{appendFile as xO,mkdir as kO,readdir as $O,rename as LO,stat as
|
|
1766
|
+
practiceSlug:""}),kV=Object.freeze({LEARNING_MODE_PROJECT_MESSAGE:NO,PRACTICE_PROJECT_MODE_MESSAGE:jO})});var Km=b(()=>{});var Xm,Zm=b(()=>{Ve();Km();Xm="vibe64_team_ai_required"});function Qm(){return String(tf()?.projectRuntimeRoot||"").trim()}var eU,eh=b(()=>{qm();le();$t();Jm();Zm();kt();eU=Object.
|
|
1767
|
+
freeze({vibe64_invalid_project_slug:422,vibe64_project_route_unavailable:404,[Ym]:403,[Xm]:403,vibe64_project_path_not_accessible:404,
|
|
1768
|
+
[of]:404,vibe64_project_path_not_directory:409,vibe64_project_path_symlink:409})});import{appendFile as xO,mkdir as kO,readdir as $O,rename as LO,stat as th,unlink as MO}from"node:fs/promises";import Lr from"node:path";
|
|
1769
1769
|
function Ta(e,t){let r=Lr.join(e,va);return Object.freeze({current:Lr.join(r,`${t}.jsonl`),directory:r,previous:Lr.join(
|
|
1770
1770
|
r,`${t}.1.jsonl`)})}function Sa(e){if(typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;
|
|
1771
|
-
if(typeof e!="string")return;let t=$n(e).replace(/\s+/gu," ").trim();if(t)return t.length>
|
|
1771
|
+
if(typeof e!="string")return;let t=$n(e).replace(/\s+/gu," ").trim();if(t)return t.length>rh?`${t.slice(0,rh-1)}\u2026`:
|
|
1772
1772
|
t}function FO(e,t){let r=Sa(e?.kind),n=Sa(e?.event);if(!Mr.includes(r)||!n)return null;let o={at:t.toISOString(),kind:r,
|
|
1773
1773
|
event:n},i=0;for(let[s,a]of Object.entries(e)){if(s==="kind"||s==="event"||s==="at"||!GO.test(s))continue;let c=Sa(a);if(c!==
|
|
1774
1774
|
void 0&&(o[s]=c,++i>=BO))break}return`${JSON.stringify(o)}
|
|
1775
1775
|
`}function HO({fileBytes:e=DO,retentionMs:t=VO,now:r=Date.now}={}){let n=new Map,o=new Map,i=new Set;function s(l,w){let _=`${l}\
|
|
1776
1776
|
|
|
1777
1777
|
${w}`,f=n.get(_);if(f?n.delete(_):f={paths:Ta(l,w),projectRuntimeRoot:l,sessionId:w,lines:[],queuedLength:0,size:null,pending:null},
|
|
1778
|
-
n.set(_,f),n.size>
|
|
1778
|
+
n.set(_,f),n.size>nh)for(let[m,y]of n){if(n.size<=nh)break;y.pending||n.delete(m)}return f}async function a(l){let w=r()-
|
|
1779
1779
|
t,_=await $O(l).catch(()=>[]),f=new Map;for(let m of n.values())f.set(m.paths.current,m),f.set(m.paths.previous,m);for(let m of _){
|
|
1780
|
-
if(!m.endsWith(".jsonl"))continue;let y=Lr.join(l,m),E=f.get(y),T=await
|
|
1780
|
+
if(!m.endsWith(".jsonl"))continue;let y=Lr.join(l,m),E=f.get(y),T=await th(y).catch(()=>null);!T?.isFile()||T.mtimeMs>=w||
|
|
1781
1781
|
E?.pending||(await MO(y).catch(()=>{}),E&&(E.size=null))}}function c(l){let w=o.get(l)||0;if(r()-w<UO)return;o.set(l,r());
|
|
1782
1782
|
let _=a(l).finally(()=>i.delete(_));i.add(_)}async function u(l){let{lines:w}=l;if(l.lines=[],l.queuedLength=0,!w.length)
|
|
1783
1783
|
return;let _=w.join(""),f=Buffer.byteLength(_);if(f>e){let m=w.length-1,y=Buffer.byteLength(w[m]);for(;m>0&&y+Buffer.byteLength(
|
|
1784
1784
|
w[m-1])<=e;)y+=Buffer.byteLength(w[--m]);_=w.slice(m).join(""),f=y}try{l.size===null&&(await kO(l.paths.directory,{recursive:!0,
|
|
1785
|
-
mode:448}),l.size=(await
|
|
1785
|
+
mode:448}),l.size=(await th(l.paths.current).catch(()=>null))?.size||0),c(l.paths.directory),l.size>0&&l.size+f>e&&(await LO(
|
|
1786
1786
|
l.paths.current,l.paths.previous).catch(m=>{if(m?.code!=="ENOENT")throw m}),l.size=0),await xO(l.paths.current,_,{encoding:"\
|
|
1787
1787
|
utf8",mode:384}),l.size+=f}catch{l.size=null}}function d(l){l.pending||(l.pending=new Promise(w=>{setImmediate(()=>{u(l).
|
|
1788
1788
|
finally(()=>{l.pending=null,l.lines.length&&d(l),w()})})}))}function p(l,w,_={}){try{let f=String(_.projectRuntimeRoot??
|
|
1789
|
-
|
|
1789
|
+
Qm()??"").trim(),m=String(l||"").trim();if(!Lr.isAbsolute(f)||!zO.test(m))return!1;let y=FO(w,new Date(r()));if(!y)return!1;
|
|
1790
1790
|
let E=s(f,m);if(E.lines.push(y),E.queuedLength+=y.length,E.queuedLength>2*e){let T=0;for(;E.queuedLength>e&&T<E.lines.length-
|
|
1791
1791
|
1;)E.queuedLength-=E.lines[T++].length;E.lines.splice(0,T)}return d(E),!0}catch{return!1}}function g(l){let w=0;for(let _ of[
|
|
1792
1792
|
...n.values()])p(_.sessionId,l,{projectRuntimeRoot:_.projectRuntimeRoot})&&(w+=1);return w}async function h(){for(;i.size||
|
|
1793
1793
|
[...n.values()].some(l=>l.pending);)await Promise.all([...i,...[...n.values()].map(l=>l.pending)])}return Object.freeze(
|
|
1794
|
-
{flush:h,record:p,recordForActiveSessions:g})}var va,DO,VO,Mr,UO,
|
|
1794
|
+
{flush:h,record:p,recordForActiveSessions:g})}var va,DO,VO,Mr,UO,rh,BO,nh,zO,GO,sU,oh=b(()=>{Qd();eh();va="timeline",DO=
|
|
1795
1795
|
1024*1024,VO=336*60*60*1e3,Mr=Object.freeze(["turn","conversation","process","connection","request","server"]),UO=1440*60*
|
|
1796
|
-
1e3,
|
|
1797
|
-
import{readdir as qO,readFile as WO,stat as YO}from"node:fs/promises";import Eo from"node:path";import
|
|
1796
|
+
1e3,rh=200,BO=24,nh=256,zO=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u,GO=/^[a-z][A-Za-z0-9]{0,39}$/u;sU=HO()});var fh={};zo(fh,{describeTimelineEvent:()=>lh,listSessionTimelines:()=>Ia,readSessionTimeline:()=>dh,runSessionTimelineCli:()=>sR});
|
|
1797
|
+
import{readdir as qO,readFile as WO,stat as YO}from"node:fs/promises";import Eo from"node:path";import ih from"node:process";
|
|
1798
1798
|
import{parseArgs as JO}from"node:util";function eR(e){let t=Math.round(Number(e)/1e3);if(t<120)return`${t} s`;let r=Math.
|
|
1799
|
-
round(t/60);return r<120?`${r} min`:`${Math.round(r/60)} h`}function
|
|
1799
|
+
round(t/60);return r<120?`${r} min`:`${Math.round(r/60)} h`}function lh(e){let t=[];if((e.method||e.route)&&t.push(`${e.
|
|
1800
1800
|
method||""} ${e.route||""}`.trim()),e.chat||e.conversation){let n=QO[e.chat]||e.chat||"conversation";t.push(e.conversation?
|
|
1801
|
-
`${n} ${e.conversation}`:n)}for(let[n,o]of
|
|
1801
|
+
`${n} ${e.conversation}`:n)}for(let[n,o]of uh){let i=e[n]===void 0||e[n]===""?"":o(e[n]);i&&t.push(i)}for(let[n,o]of Object.
|
|
1802
1802
|
entries(e))tR.has(n)||t.push(`${n}=${o}`);let r=ZO[`${e.kind}.${e.event}`]||`${e.kind} ${e.event}`;return`${e.at} ${r}${t.
|
|
1803
|
-
length?` (${t.join("; ")})`:""}`}function Dr(e){return Object.assign(new Error(e),{usage:!0})}function
|
|
1803
|
+
length?` (${t.join("; ")})`:""}`}function Dr(e){return Object.assign(new Error(e),{usage:!0})}function ah(e,t,r){if(e===
|
|
1804
1804
|
void 0)return null;let n=KO.exec(String(e).trim());if(n)return t-Number(n[1])*XO[n[2]];let o=Date.parse(String(e));if(Number.
|
|
1805
1805
|
isNaN(o))throw Dr(`${r} needs an ISO time or a time back from now such as 30m: ${e}`);return o}function rR(e){if(e===void 0)
|
|
1806
1806
|
return null;let t=String(e).split(",").map(n=>n.trim()).filter(Boolean),r=t.filter(n=>!Mr.includes(n));if(!t.length||r.length)
|
|
1807
1807
|
throw Dr(`--kind takes ${Mr.join(", ")}; not ${r.join(", ")||"nothing"}.`);return new Set(t)}function nR(e,{env:t,now:r}){
|
|
1808
1808
|
let n;try{n=JO({args:e,allowPositionals:!0,options:{help:{type:"boolean"},json:{type:"boolean"},kind:{type:"string"},project:{
|
|
1809
1809
|
type:"string"},since:{type:"string"},"state-root":{type:"string"},until:{type:"string"}}})}catch(c){throw Dr(c.message)}
|
|
1810
|
-
let{positionals:o,values:i}=n;if(o.length>1)throw Dr("Name one session at most.");let s=o[0]||"";if(s&&!
|
|
1810
|
+
let{positionals:o,values:i}=n;if(o.length>1)throw Dr("Name one session at most.");let s=o[0]||"";if(s&&!ch.test(s))throw Dr(
|
|
1811
1811
|
`Not a session id: ${s}`);let a=String(i["state-root"]||t[Es]||"").trim()||nf({env:t});return Object.freeze({help:i.help===
|
|
1812
|
-
!0,json:i.json===!0,kinds:rR(i.kind),project:String(i.project||"").trim(),sessionId:s,since:
|
|
1813
|
-
resolve(a),until:
|
|
1814
|
-
va);for(let o of await qO(n).catch(()=>[])){let i=o.replace(/(\.1)?\.jsonl$/u,"");if(i===o||!
|
|
1812
|
+
!0,json:i.json===!0,kinds:rR(i.kind),project:String(i.project||"").trim(),sessionId:s,since:ah(i.since,r,"--since"),stateRoot:Eo.
|
|
1813
|
+
resolve(a),until:ah(i.until,r,"--until")})}async function Ia(e){let t=new Map;for(let r of await Ii(e)){let n=Eo.join(r,
|
|
1814
|
+
va);for(let o of await qO(n).catch(()=>[])){let i=o.replace(/(\.1)?\.jsonl$/u,"");if(i===o||!ch.test(i))continue;let s=await YO(
|
|
1815
1815
|
Eo.join(n,o)).catch(()=>null);if(!s?.isFile())continue;let a=`${r}
|
|
1816
1816
|
${i}`,c=t.get(a)||{project:Eo.basename(r),projectRuntimeRoot:r,sessionId:i,bytes:0,updatedMs:0};c.bytes+=s.size,c.updatedMs=
|
|
1817
|
-
Math.max(c.updatedMs,s.mtimeMs),t.set(a,c)}}return[...t.values()].sort((r,n)=>n.updatedMs-r.updatedMs)}async function
|
|
1817
|
+
Math.max(c.updatedMs,s.mtimeMs),t.set(a,c)}}return[...t.values()].sort((r,n)=>n.updatedMs-r.updatedMs)}async function dh(e,t,{
|
|
1818
1818
|
since:r=null,until:n=null,kinds:o=null}={}){let i=Ta(e,t),s=[];for(let a of[i.previous,i.current]){let c=await WO(a,"utf\
|
|
1819
1819
|
8").catch(u=>{if(u?.code==="ENOENT")return"";throw u});for(let u of c.split(`
|
|
1820
1820
|
`)){if(!u.trim())continue;let d;try{d=JSON.parse(u)}catch{continue}let p=Date.parse(d?.at);Number.isNaN(p)||r!==null&&p<
|
|
@@ -1825,13 +1825,13 @@ Je(t,`${i} ${o.project} ${o.sessionId} ${Math.ceil(o.bytes/1024)} KB`)}return!
|
|
|
1825
1825
|
lines under ${e.stateRoot}.`),0}async function iR(e,t,r){let n=(await Ia(e.stateRoot)).filter(a=>a.sessionId===e.sessionId&&
|
|
1826
1826
|
(!e.project||a.project===e.project));if(n.length!==1)return Je(r,n.length?`Session ${e.sessionId} is in several projects\
|
|
1827
1827
|
(${n.map(({project:a})=>a).join(", ")}); add --project NAME.`:`No timeline for session ${e.sessionId} under ${e.stateRoot}\
|
|
1828
|
-
. Run vibe64 timeline to list them.`),1;let[{project:o,projectRuntimeRoot:i}]=n,s=await
|
|
1829
|
-
Je(t,e.json?JSON.stringify({project:o,session:e.sessionId,...a}):
|
|
1830
|
-
t window."),0}async function sR(e,{env:t,stdout:r=
|
|
1828
|
+
. Run vibe64 timeline to list them.`),1;let[{project:o,projectRuntimeRoot:i}]=n,s=await dh(i,e.sessionId,e);for(let a of s)
|
|
1829
|
+
Je(t,e.json?JSON.stringify({project:o,session:e.sessionId,...a}):lh(a));return!s.length&&!e.json&&Je(t,"No events in tha\
|
|
1830
|
+
t window."),0}async function sR(e,{env:t,stdout:r=ih.stdout,stderr:n=ih.stderr,now:o=Date.now()}){let i;try{i=nR(e,{env:t,
|
|
1831
1831
|
now:o})}catch(s){return Je(n,`${s.message}
|
|
1832
1832
|
|
|
1833
|
-
${
|
|
1834
|
-
64 timeline could not read ${i.stateRoot}: ${s.message}`),1}}var
|
|
1833
|
+
${sh}`),2}if(i.help)return r.write(sh),0;try{return i.sessionId?await iR(i,r,n):await oR(i,r)}catch(s){return Je(n,`vibe\
|
|
1834
|
+
64 timeline could not read ${i.stateRoot}: ${s.message}`),1}}var sh,ch,KO,XO,ZO,QO,uh,tR,ph=b(()=>{Ue();oh();Mn();sh=`Us\
|
|
1835
1835
|
age: vibe64 timeline [SESSION] [options]
|
|
1836
1836
|
|
|
1837
1837
|
Without SESSION, lists the sessions that have a timeline, most recent first.
|
|
@@ -1848,7 +1848,7 @@ Options:
|
|
|
1848
1848
|
this user's own, such as ~/.local/state/vibe64)
|
|
1849
1849
|
--json one JSON object per line, for tools
|
|
1850
1850
|
--help show this help
|
|
1851
|
-
`,
|
|
1851
|
+
`,ch=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/u,KO=/^(\d+(?:\.\d+)?)(s|m|h|d)$/u,XO=Object.freeze({s:1e3,m:6e4,h:36e5,d:864e5}),
|
|
1852
1852
|
ZO=Object.freeze({"turn.started":"Turn started","turn.steered":"Message added to the running turn","turn.refused":"Messa\
|
|
1853
1853
|
ge not sent","turn.running":"Turn running","turn.finished":"Turn finished","turn.failed":"Turn failed","turn.interrupted":"\
|
|
1854
1854
|
Turn interrupted","turn.cancelled":"Turn cancelled","turn.timed-out":"Turn stopped at its deadline","turn.observation-lo\
|
|
@@ -1860,21 +1860,21 @@ sk-started":"AI task started","conversation.task-closed":"AI task closed","proce
|
|
|
1860
1860
|
AI engine process stopped by Vibe64","connection.connected":"Browser tab connected","connection.reconnected":"Browser ta\
|
|
1861
1861
|
b reconnected","connection.disconnected":"Browser tab disconnected","connection.left":"Browser tab left the session","re\
|
|
1862
1862
|
quest.failed":"Request failed","server.stopping":"Vibe64 server stopping"}),QO=Object.freeze({"ai-task":"AI task window",
|
|
1863
|
-
colleague:"Colleague",main:"Main chat",temporary:"temporary chat"});
|
|
1863
|
+
colleague:"Colleague",main:"Main chat",temporary:"temporary chat"});uh=Object.freeze([["engine",e=>`engine ${e}`],["turn",
|
|
1864
1864
|
e=>`turn ${e}`],["thread",e=>`thread ${e}`],["message",e=>`message ${e}`],["operation",e=>`${e}`],["execution",e=>`proce\
|
|
1865
1865
|
ss ${e}`],["pid",e=>`pid ${e}`],["exitCode",e=>`exit code ${e}`],["signal",e=>`signal ${e}`],["taskLimit",e=>e?"it reach\
|
|
1866
1866
|
ed its task limit":""],["tab",e=>`tab ${e}`],["user",e=>`user ${e}`],["by",e=>`asked by ${e}`],["offlineMs",e=>`after ${eR(
|
|
1867
1867
|
e)} offline`],["reason",e=>`reason: ${e}`],["status",e=>`status ${e}`],["state",e=>`state ${e}`],["ok",e=>e===!1?"it did\
|
|
1868
1868
|
not succeed":""],["code",e=>`code ${e}`],["error",e=>`error: ${e}`],["trigger",e=>`via ${e}`]]),tR=new Set(["at","kind",
|
|
1869
|
-
"event","chat","conversation","method","route","project","session",...
|
|
1869
|
+
"event","chat","conversation","method","route","project","session",...uh.map(([e])=>e)])});function So(e){return!!e&&typeof e=="object"&&lR.every(t=>typeof e[t]=="function")}function hh(e=null,{defaultMode:t="cr\
|
|
1870
1870
|
eate",context:r="schema definition.mode"}={}){let n=ue(e),o=F(t).toLowerCase()||"create",i=Object.prototype.hasOwnProperty.
|
|
1871
1871
|
call(n,"mode")?F(n.mode).toLowerCase():"";if(!i)return o;if(!aR.has(i))throw new TypeError(`${r} must be one of: create,\
|
|
1872
|
-
replace, patch.`);return i}function
|
|
1873
|
-
getFieldMessages(r)):{}}function dR(e=null,t=""){let r=F(t).split(".").filter(Boolean);return r.length<2?{}:(r.pop(),
|
|
1874
|
-
e,r.join(".")))}function
|
|
1872
|
+
replace, patch.`);return i}function gh(e=null,t=""){let r=F(t);if(!r)return{};let n=ue(e);return So(n.schema)?ue(n.schema.
|
|
1873
|
+
getFieldMessages(r)):{}}function dR(e=null,t=""){let r=F(t).split(".").filter(Boolean);return r.length<2?{}:(r.pop(),gh(
|
|
1874
|
+
e,r.join(".")))}function mh(e,t){let r=t?e[t]:void 0;if(typeof r=="string"){let i=F(r);return i?{message:i}:null}if(!H(r))
|
|
1875
1875
|
return null;let n=F(r.message);if(!n)return null;let o=F(r.code);return o?{message:n,code:o,params:ue(r.params)}:{message:n}}
|
|
1876
|
-
function fR(e,t,r=null){let n=F(t?.code).toUpperCase(),o=cR[n]||{},i=ue(t?.params),s=
|
|
1877
|
-
Object.keys(s).length<1?dR(r,e):s,c=
|
|
1876
|
+
function fR(e,t,r=null){let n=F(t?.code).toUpperCase(),o=cR[n]||{},i=ue(t?.params),s=gh(r,e),a=n==="FIELD_NOT_ALLOWED"&&
|
|
1877
|
+
Object.keys(s).length<1?dR(r,e):s,c=mh(a,o.messageKey)||mh(a,"default");if(c)return c.code?{message:c.message,code:c.code,
|
|
1878
1878
|
params:{...i,...c.params}}:{message:c.message};let u=F(t?.message);if(u)return o.code?{message:u,code:o.code,params:i}:{
|
|
1879
1879
|
message:u};let d=F(t?.code);return d?{message:d}:{...uR,params:{}}}function Oa(e={},t=null){let r=ue(e),n={},o={};for(let[
|
|
1880
1880
|
i,s]of Object.entries(r)){let a=F(i);if(!a)continue;if(typeof s=="string"){n[a]=s;continue}let{message:c,code:u,params:d}=fR(
|
|
@@ -1894,18 +1894,18 @@ reate","replace","patch","toJsonSchema"])});function pR(e){return!!e&&typeof e==
|
|
|
1894
1894
|
prototype.hasOwnProperty.call(e,"mode"))}function vo(e,{context:t="schema definition",defaultMode:r=""}={}){if(e==null)return null;
|
|
1895
1895
|
if(!pR(e))throw new TypeError(`${t} must be a schema definition object.`);let n=ue(e);if(!Object.prototype.hasOwnProperty.
|
|
1896
1896
|
call(n,"schema"))throw new TypeError(`${t}.schema is required.`);if(!So(n.schema))throw new TypeError(`${t}.schema must \
|
|
1897
|
-
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=F(r).toLowerCase();return o.mode=
|
|
1897
|
+
be a json-rest-schema schema instance.`);let o={schema:n.schema},i=F(r).toLowerCase();return o.mode=hh(n,{defaultMode:i||
|
|
1898
1898
|
"patch",context:`${t}.mode`}),Object.freeze(o)}function Aa(e,t,{context:r="schema definition",defaultMode:n=""}={}){let o=vo(
|
|
1899
|
-
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var Vr=b(()=>{U();Ra()});var
|
|
1900
|
-
freeze({schema:mR,mode:"patch"})});var
|
|
1901
|
-
gR=Object.freeze({...
|
|
1902
|
-
e,o?{cause:o}:void 0);if(e===
|
|
1899
|
+
e,{context:r,defaultMode:n});return o?o.schema[o.mode](t):null}var Vr=b(()=>{U();Ra()});var yh=b(()=>{rt();U();Ir();Vr()});var wh=b(()=>{rt();Ir();Vr()});var mR,hR,_h=b(()=>{rt();mR=L({cursor:{type:"id",required:!1},limit:{type:"number",required:!1,min:1,unsigned:!0}}),hR=Object.
|
|
1900
|
+
freeze({schema:mR,mode:"patch"})});var bh,gR,Eh=b(()=>{bh=Object.freeze({type:"string",pattern:"^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$",minLength:5}),
|
|
1901
|
+
gR=Object.freeze({...bh,nullable:!0})});var Sh=b(()=>{U()});function Th({message:e=vh,fieldErrors:t=null,fieldErrorCodes:r=null,errors:n=null,cause:o,statusCode:i=null}={}){let s=new Error(
|
|
1902
|
+
e,o?{cause:o}:void 0);if(e===vh&&(s.messageCode="kernel.validation.schemaFailed",s.messageParams={}),Number.isInteger(i)&&
|
|
1903
1903
|
i>=400&&i<=599&&(s.statusCode=i),H(t)){let a=H(r)&&Object.keys(r).length>0?r:null;s.fieldErrors=t,a&&(s.fieldErrorCodes=
|
|
1904
1904
|
a),s.details={...s.details||{},fieldErrors:t,...a?{fieldErrorCodes:a}:{}}}else n!=null&&(s.details={...s.details||{},errors:n});
|
|
1905
1905
|
return s}function Pa(e,t,{phase:r="input",context:n="schema definition",statusCode:o=null}={}){if(e==null)return t;let i=Aa(
|
|
1906
1906
|
e,t,{defaultMode:r==="output"?"replace":"patch",context:n}),{fieldErrors:s,fieldErrorCodes:a}=Oa(i.errors,e);if(Object.keys(
|
|
1907
|
-
s).length>0)throw
|
|
1908
|
-
|
|
1907
|
+
s).length>0)throw Th({fieldErrors:s,fieldErrorCodes:a,statusCode:o});return i.validatedObject??t}var vh,Ih=b(()=>{U();Vr();
|
|
1908
|
+
vh="Schema validation failed."});var VU,Oh=b(()=>{U();VU=new Map([{keyword:"required",code:"kernel.validation.required"},{keyword:"type",code:"kernel.val\
|
|
1909
1909
|
idation.type"},{keyword:"minLength",code:"kernel.validation.minLength"},{keyword:"maxLength",code:"kernel.validation.max\
|
|
1910
1910
|
Length"},{keyword:"minimum",code:"kernel.validation.minimum"},{keyword:"maximum",code:"kernel.validation.maximum"},{keyword:"\
|
|
1911
1911
|
exclusiveMinimum",code:"kernel.validation.exclusiveMinimum"},{keyword:"exclusiveMaximum",code:"kernel.validation.exclusi\
|
|
@@ -1917,44 +1917,44 @@ tion.maxItems"},{keyword:"additionalItems",code:"kernel.validation.additionalIte
|
|
|
1917
1917
|
kernel.validation.maxProperties"},{keyword:"additionalProperties",code:"kernel.validation.additionalProperties"},{keyword:"\
|
|
1918
1918
|
propertyNames",code:"kernel.validation.propertyNames"},{keyword:"oneOf",code:"kernel.validation.oneOf"},{keyword:"anyOf",
|
|
1919
1919
|
code:"kernel.validation.anyOf"},{keyword:"not",code:"kernel.validation.not"},{keyword:"if",code:"kernel.validation.if"}].
|
|
1920
|
-
map(({keyword:e,code:t})=>[e,t]))});var
|
|
1920
|
+
map(({keyword:e,code:t})=>[e,t]))});var Rh,Ca,yR,wR,Ah=b(()=>{rt();Ir();Rh="^[1-9][0-9]*$",Ca=Ge({type:"string",minLength:1,pattern:Rh}),yR=Ge({...Ca,nullable:!0}),
|
|
1921
1921
|
wR=Ge({schema:L({recordId:{...Ca,required:!0,messages:{pattern:{code:"kernel.validation.recordIdInvalid",message:"Record\
|
|
1922
|
-
id must be a canonical positive integer string."}}}}),mode:"patch"})});var
|
|
1922
|
+
id must be a canonical positive integer string."}}}}),mode:"patch"})});var Ph=b(()=>{U()});var To=b(()=>{rt();Go();yh();wh();_h();Eh();Sh();Ra();Vr();Ih();Oh();Ah();Ph()});import{isDeepStrictEqual as _R}from"node:util";function Oo(e,t){let r=IR.get(e?.schemaVersion)||Nh;return we(r,e,t)}function we(e,t,r){
|
|
1923
1923
|
let n=Pa({schema:e,mode:"create"},t,{context:r});if(!_R(t,n))throw new Error(`${r}: unknown fields or noncanonical value\
|
|
1924
|
-
s.`);return n}var k,B,W,Io,bR,ER,
|
|
1924
|
+
s.`);return n}var k,B,W,Io,bR,ER,Ch,Nh,SR,jh,vR,TR,IR,Ae,Ro,Ao,xh,Wt=b(()=>{To();k={type:"string",required:!0,noTrim:!0,
|
|
1925
1925
|
minLength:1,maxLength:256},B={...k,maxLength:64},W=(e,t=100)=>({type:"array",required:!0,maxLength:t,items:e,validator:r=>Array.
|
|
1926
1926
|
isArray(r)&&r.length>t?`Expected at most ${t} items.`:void 0}),Io={type:"integer",required:!0,enum:[1]},bR=W(L({code:B}),
|
|
1927
1927
|
24),ER=L({id:B,kind:{...k,enum:["answer","practical"]},required:{type:"boolean",required:!0},rubric:k,evidence:{type:"ob\
|
|
1928
1928
|
ject",required:!1,schema:L({producer:{...k,enum:["workspace","colleague","exercise","code"]},operation:B,check:{...B,required:!1},
|
|
1929
|
-
explanationRequired:{type:"boolean",required:!1},files:{...W(k,8),required:!1,minLength:1}})}}),
|
|
1929
|
+
explanationRequired:{type:"boolean",required:!1},files:{...W(k,8),required:!1,minLength:1}})}}),Ch={code:B,title:k,prerequisites:bR,
|
|
1930
1930
|
estimatedMinutes:{type:"integer",required:!0,min:1,max:180},visuals:W(L({id:B,descriptor:k}),12),exercise:{type:"object",
|
|
1931
1931
|
required:!1,schema:L({kind:{...k,enum:["bundled"]},source:k,reuse:{...k,enum:["attempt","sequence"]},sequenceId:{...B,required:!1},
|
|
1932
1932
|
sequenceMode:{...k,required:!1,enum:["create","continue"]}})},checks:{...W(L({id:B,file:k,assets:{...W(k,32),required:!1},
|
|
1933
1933
|
kind:{...k,required:!1,enum:["response","code"]},timeoutSeconds:{type:"integer",required:!1,min:1,max:60}}),12),required:!1},
|
|
1934
1934
|
appRoutes:{...W(L({method:{...k,enum:["POST","PUT","PATCH","DELETE"]},path:{...k,maxLength:128,pattern:"^/[A-Za-z0-9._~:\
|
|
1935
|
-
/-]*$"}}),16),required:!1}},
|
|
1935
|
+
/-]*$"}}),16),required:!1}},Nh=L({schemaVersion:Io,...Ch,document:k,assessments:W(ER,32)}),SR=L({id:B,title:k,body:k,required:{
|
|
1936
1936
|
type:"boolean",required:!0},visual:{type:"object",required:!1,schema:L({id:B,play:{...W(L({name:B,parameters:{type:"obje\
|
|
1937
1937
|
ct",required:!0}}),16),required:!1}})},guide:{type:"object",required:!1,schema:L({target:B,navigate:{type:"boolean",required:!1},
|
|
1938
1938
|
filePath:{...k,required:!1,maxLength:512},caption:{...k,required:!1}})},check:{type:"object",required:!0,schema:L({kind:{
|
|
1939
1939
|
...k,enum:["auto","choice","review","self","fact","none"]},check:{...B,required:!1},fact:{...B,required:!1},files:{...W(
|
|
1940
1940
|
k,8),required:!1},question:{...k,required:!1,maxLength:2e3},options:{...W(k,8),required:!1},answer:{...W({type:"integer",
|
|
1941
1941
|
required:!0,min:0,max:7},8),required:!1},rubric:{...k,required:!1,maxLength:600},evidence:{...W({...k,enum:["changes","c\
|
|
1942
|
-
onversation"]},2),required:!1}})}}),
|
|
1943
|
-
r",required:!0,enum:[2]},...
|
|
1944
|
-
io","project"]}}),IR=new Map([[1,
|
|
1942
|
+
onversation"]},2),required:!1}})}}),jh={...Ch,notes:{...k,required:!1},steps:W(SR,32)},vR=L({schemaVersion:{type:"intege\
|
|
1943
|
+
r",required:!0,enum:[2]},...jh}),TR=L({schemaVersion:{type:"integer",required:!0,enum:[3]},...jh,stage:{...k,enum:["stud\
|
|
1944
|
+
io","project"]}}),IR=new Map([[1,Nh],[2,vR],[3,TR]]),Ae=e=>e?.schemaVersion===2||e?.schemaVersion===3;Ro=L({schemaVersion:Io,
|
|
1945
1945
|
topicId:B,domainId:B,title:k,status:{...k,enum:["preview","released"]},outline:k,prerequisites:W(L({topicId:B}),24),lessons:W(
|
|
1946
1946
|
L({code:B,descriptor:k,status:{...k,enum:["draft","published"]},required:{type:"boolean",required:!0}}),64),places:{...W(
|
|
1947
1947
|
B,64),required:!1},activities:{...W(B,64),required:!1},facts:{...W(B,64),required:!1}}),Ao=L({schemaVersion:Io,courseId:B,
|
|
1948
1948
|
title:k,release:k,status:{...k,enum:["preview","released"]},topics:W(L({topicId:B,release:k}),32),orientation:{...B,required:!1}}),
|
|
1949
|
-
|
|
1949
|
+
xh=L({schemaVersion:Io,id:B,title:k,svg:k,controller:k,assets:{...W(k,32),required:!1},initialState:B,states:W(B,32),description:{
|
|
1950
1950
|
...k,maxLength:2e3},commands:W(L({name:B,parameters:W(L({name:B,required:{type:"boolean",required:!0},maxLength:{type:"i\
|
|
1951
1951
|
nteger",required:!0,min:1,max:256}}),8),completionState:B,description:{...k,maxLength:2e3}}),32)})});function de(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_VOCABULARY_INVALID"})}function NR(e){if(!H(e)||!Me.
|
|
1952
|
-
test(e.id||""))throw de("A place needs a lowercase id.");let t=`Place ${e.id}`;if(
|
|
1952
|
+
test(e.id||""))throw de("A place needs a lowercase id.");let t=`Place ${e.id}`;if(!Lh(e.label))throw de(`${t} needs a la\
|
|
1953
1953
|
bel.`);if(!OR.has(e.scope))throw de(`${t} scope is studio or project.`);let r=e.who??"everyone";if(!RR.has(r))throw de(`${t}\
|
|
1954
1954
|
who is everyone or owner.`);let n=e.open??null;if(n!==null){let i=Object.keys(n||{}).sort().join(",");if(!(i==="pane"||
|
|
1955
1955
|
i==="databaseView,pane"?e.scope==="project"&&Me.test(n.pane):i==="route"?e.scope==="studio"&&typeof n.route=="string"&&/^\/app(?:\/[a-z0-9-]+)*$/u.
|
|
1956
1956
|
test(n.route):i==="learning"&&n.learning===!0))throw de(`${t} opens a project pane, a studio /app route, Courses, or not\
|
|
1957
|
-
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!Me.test(i?.id||"")
|
|
1957
|
+
hing.`)}if(!Array.isArray(e.steps)||!e.steps.length||e.steps.length>6||e.steps.some(i=>!Me.test(i?.id||"")||!Lh(i.label))||
|
|
1958
1958
|
e.steps.at(-1).id!==e.id)throw de(`${t} needs 1 to 6 labelled steps ending with itself.`);let o=e.shown??(n?.pane?[{pane:n.
|
|
1959
1959
|
pane,...n.databaseView?{databaseView:n.databaseView}:{}}]:n?.route?[{route:n.route}]:[]);if(!Array.isArray(o)||o.some(i=>!H(
|
|
1960
1960
|
i)||!Object.keys(i).length))throw de(`${t} shown is a list of page focus matchers.`);if(e.event!==void 0&&!Me.test(e.event))
|
|
@@ -1976,7 +1976,7 @@ map(p=>p.id));for(let p of[...e,...t,...r])if(!Me.test(p||""))throw de(`Declared
|
|
|
1976
1976
|
e.filter(p=>!o.has(p))),s=new Set(t.filter(p=>!n.activity(p)));function a(p){return i.has(p)}function c(p){return s.has(
|
|
1977
1977
|
p)}function u(p){return a(p)||c(p)}function d(p){return n.hasFact(p)||r.includes(p)}return Object.freeze({register:n.register,
|
|
1978
1978
|
place:n.place,activity:n.activity,hasFact:d,places:n.places,events:n.events,declared:u,declaredPlace:a,declaredActivity:c})}
|
|
1979
|
-
function Ke(e,t,r){return new ie(422,e,{code:t,params:r})}function
|
|
1979
|
+
function Ke(e,t,r){return new ie(422,e,{code:t,params:r})}function Mh(e={},t=wt){let r=typeof e.target=="string"?t.place(
|
|
1980
1980
|
e.target):null,n=!r&&t.declaredPlace(e.target);if(!r&&!n){let c=t.places().map(u=>u.id).join(", ");throw Ke(`Use one of \
|
|
1981
1981
|
this installation's guide places: ${c}.`,"VIBE64_TRAINING_GUIDE_INVALID",{places:c})}let o=e.target,i=e.navigate??!1,s=e.
|
|
1982
1982
|
highlight??!0;if(typeof i!="boolean"||typeof s!="boolean")throw Ke("navigate and highlight are booleans.","VIBE64_TRAINI\
|
|
@@ -1988,18 +1988,18 @@ label});let a={target:o,navigate:i,highlight:s};if(e.filePath!==void 0){if(o!=="
|
|
|
1988
1988
|
e files place.","VIBE64_TRAINING_GUIDE_FILE_PATH_MISPLACED");if(typeof e.filePath!="string"||!$a.test(e.filePath))throw Ke(
|
|
1989
1989
|
"Use a relative practice project file path without '..'.","VIBE64_TRAINING_GUIDE_FILE_PATH_INVALID");a.filePath=e.filePath}
|
|
1990
1990
|
if(e.caption!==void 0){if(typeof e.caption!="string"||!e.caption.trim()||e.caption.length>xa)throw Ke(`Use a caption of \
|
|
1991
|
-
1 to ${xa} characters.`,"VIBE64_TRAINING_GUIDE_CAPTION_INVALID",{limit:xa});a.caption=e.caption.trim()}return a}function
|
|
1991
|
+
1 to ${xa} characters.`,"VIBE64_TRAINING_GUIDE_CAPTION_INVALID",{limit:xa});a.caption=e.caption.trim()}return a}function Dh(e,t={},r=wt){
|
|
1992
1992
|
let n=r.place(e);return n?.shown.length?n.shown.some(o=>Object.entries(o).every(([i,s])=>i==="route"?typeof t.route=="st\
|
|
1993
1993
|
ring"&&(t.route===s||t.route.startsWith(`${s}/`)):t[i]===s)):null}function kR(e,t=wt){let r=new Set,n=new Set,o=new Set;
|
|
1994
1994
|
for(let i of Array.isArray(e?.beats)?e.beats:[]){if(i.kind==="check")continue;let s=t.activity(i.target);s||t.declaredActivity(
|
|
1995
1995
|
i.target)?(n.add(i.target),s?.place&&r.add(s.place)):r.add(i.target)}return e?.guide?.target&&r.add(e.guide.target),e?.check?.
|
|
1996
|
-
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Me,OR,RR,J,
|
|
1996
|
+
kind==="fact"&&o.add(e.check.fact),{places:[...r],activities:[...n],facts:[...o]}}var Me,OR,RR,J,kh,Le,$h,Na,AR,PR,CR,Lh,
|
|
1997
1997
|
wt,$a,xa,xR,SB,Co=b(()=>{Xr();U();Me=/^[a-z][a-z0-9-]{0,63}$/u,OR=new Set(["studio","project"]),RR=new Set(["everyone","\
|
|
1998
|
-
owner"]),J=(e,t)=>Object.freeze({id:e,label:t}),
|
|
1998
|
+
owner"]),J=(e,t)=>Object.freeze({id:e,label:t}),kh=J("preview","Preview"),Le=J("dashboard","Dashboard"),$h=J("database",
|
|
1999
1999
|
"Database"),Na=J("account-menu","Account menu"),AR=[{id:"preview",label:"Preview",scope:"project",open:{pane:"preview"},
|
|
2000
|
-
steps:[
|
|
2001
|
-
project",open:{pane:"database",databaseView:"erd"},steps:[Le,
|
|
2002
|
-
a",scope:"project",open:{pane:"database",databaseView:"data"},steps:[Le,
|
|
2000
|
+
steps:[kh]},{id:"dashboard",label:"Dashboard",scope:"project",open:null,steps:[Le]},{id:"database-erd",label:"ERD",scope:"\
|
|
2001
|
+
project",open:{pane:"database",databaseView:"erd"},steps:[Le,$h,J("database-erd","ERD")]},{id:"database-data",label:"Dat\
|
|
2002
|
+
a",scope:"project",open:{pane:"database",databaseView:"data"},steps:[Le,$h,J("database-data","Data")]},{id:"files",label:"\
|
|
2003
2003
|
Files",scope:"project",open:{pane:"files"},steps:[Le,J("files","Files")]},{id:"changes",label:"Current changes",scope:"p\
|
|
2004
2004
|
roject",open:{pane:"changes"},steps:[Le,J("changes","Current changes")]},{id:"git-log",label:"Git log",scope:"project",open:{
|
|
2005
2005
|
pane:"repository"},steps:[Le,J("git-log","Git log")]},{id:"session-info",label:"Session info",scope:"project",open:{pane:"\
|
|
@@ -2007,7 +2007,7 @@ session"},steps:[Le,J("session-info","Session info")]},{id:"architecture",label:
|
|
|
2007
2007
|
system"},steps:[Le,J("architecture","Architecture")]},{id:"publish",label:"Publish",scope:"project",open:{pane:"publish"},
|
|
2008
2008
|
steps:[Le,J("publish","Publish")]},{id:"chat",label:"Coding chat",scope:"project",open:null,shown:[{pane:"chat"},{chatVisible:!0}],
|
|
2009
2009
|
steps:[J("chat","Coding chat")]},{id:"save",label:"Save",scope:"project",open:null,event:"saved",steps:[J("save","Save")]},
|
|
2010
|
-
{id:"reload-preview",label:"Reload preview",scope:"project",open:null,event:"preview-reloaded",steps:[
|
|
2010
|
+
{id:"reload-preview",label:"Reload preview",scope:"project",open:null,event:"preview-reloaded",steps:[kh,J("reload-previ\
|
|
2011
2011
|
ew","Reload preview")]},{id:"learning",label:"Learning",scope:"studio",open:{learning:!0},shown:[],event:"learn-toggled",
|
|
2012
2012
|
steps:[J("learning","Learning")]},{id:"lesson",label:"Lesson",scope:"studio",open:null,shown:[{pane:"lesson"}],steps:[J(
|
|
2013
2013
|
"lesson","Lesson")]},{id:"lesson-bar",label:"Lesson step bar",scope:"studio",open:null,steps:[J("lesson-bar","Lesson ste\
|
|
@@ -2017,7 +2017,7 @@ p bar")]},{id:"courses",label:"Courses",scope:"studio",open:null,shown:[{learnin
|
|
|
2017
2017
|
ngs",scope:"studio",open:null,steps:[Na,J("account-settings","Account settings")]},{id:"ai-setup",label:"AI setup",scope:"\
|
|
2018
2018
|
studio",open:null,steps:[Na,J("ai-setup","AI setup")]}],PR=[{id:"send-message",event:"message-sent",place:"chat"},{id:"a\
|
|
2019
2019
|
gent-finished",event:"agent-finished"},{id:"file-opened",event:"file-opened",place:"files"},{id:"app-pressed",event:"app\
|
|
2020
|
-
-pressed",place:"preview"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],CR=["ai-ready"]
|
|
2020
|
+
-pressed",place:"preview"},{id:"colleague-minimised",event:"colleague-minimised",place:"colleague"}],CR=["ai-ready"];Lh=
|
|
2021
2021
|
e=>typeof e=="string"&&e.trim().length>0&&e.length<=64;wt=ka({facts:[]});$a=/^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\u0000-\u001f\\]{1,512}$/u,
|
|
2022
2022
|
xa=256;xR=e=>!!e?.open;SB=Object.freeze({createLearningVocabulary:ka,lessonStepNeeds:kR})});function fe(e){return Object.assign(new Error(e),{code:"VIBE64_TRAINING_BEATS_INVALID"})}function zR(e,t,r){let n=DR.exec(
|
|
2023
2023
|
e);if(!n)throw fe(`beat ${t} must read "<show|do|check> <target>: <text>".`);let[,o,i,s,a=""]=n,c=`beat ${t} (${o} ${i})`;
|
|
@@ -2028,28 +2028,28 @@ text:a.trim()};if(s!==void 0&&!(o==="do"&&i==="file-opened"))throw fe(`${c} take
|
|
|
2028
2028
|
othing the learner can do or be at.`);if(o==="check"&&!La[i])throw fe(`${c} must be check auto, review, done or fact.`);
|
|
2029
2029
|
if(s!==void 0){if(!$a.test(s))throw fe(`${c} needs a relative practice project file path without '..'.`);u.path=s}let d=i===
|
|
2030
2030
|
"send-message"?LR:$R;if(u.text.length>d)throw fe(`${c} text is longer than ${d} characters.`);if(i==="send-message"){let p=[
|
|
2031
|
-
...u.text.matchAll(VR)].map(g=>g[1].trim());if(p.length!==1||!p[0]||p[0].length>
|
|
2032
|
-
ed prompt of at most ${
|
|
2031
|
+
...u.text.matchAll(VR)].map(g=>g[1].trim());if(p.length!==1||!p[0]||p[0].length>Uh)throw fe(`${c} needs exactly one quot\
|
|
2032
|
+
ed prompt of at most ${Uh} characters.`);u.prompt=p[0]}return u}function No(e,t=wt){let r=String(e??""),n=MR.exec(r);if(!n)
|
|
2033
2033
|
return{body:r,beats:null};let o=r.slice(n.index+n[0].length),i=/^```[ \t]*$/mu.exec(o);if(!i)throw fe("the beats block i\
|
|
2034
2034
|
s not closed with ```.");if(o.slice(i.index+i[0].length).trim())throw fe("the beats block must end the step text.");let s=o.
|
|
2035
2035
|
slice(0,i.index).split(`
|
|
2036
|
-
`).map(u=>u.trim()).filter(Boolean);if(!s.length||s.length>
|
|
2036
|
+
`).map(u=>u.trim()).filter(Boolean);if(!s.length||s.length>Vh)throw fe(`a beats block holds 1 to ${Vh} beats.`);let a=s.
|
|
2037
2037
|
map((u,d)=>zR(u,d+1,t)),c=a.filter(u=>u.kind==="check");if(c.length>1||c.length&&a.at(-1).kind!=="check")throw fe("a ste\
|
|
2038
2038
|
p has at most one check beat, and it is the last.");return{body:r.slice(0,n.index).replace(/\s+$/u,`
|
|
2039
2039
|
`),beats:a}}function GR(e,t=wt){if(!e||e.kind==="check")return"";let r=t.activity(e.target);return r?r.place||"":e.target}
|
|
2040
|
-
function
|
|
2041
|
-
scope==="project":!t.declared(e.target)}var
|
|
2040
|
+
function Bh(e,t=wt){if(e.kind==="check")return e.target==="auto"||e.target==="review";let r=t.place(GR(e,t));return r?r.
|
|
2041
|
+
scope==="project":!t.declared(e.target)}var Vh,$R,Uh,LR,La,MR,DR,VR,UR,BR,Ma=b(()=>{Co();Vh=8,$R=160,Uh=500,LR=600,La=Object.
|
|
2042
2042
|
freeze({auto:"auto",review:"review",done:"self",fact:"fact"}),MR=/^```beats[ \t]*$/mu,DR=/^(show|do|check)[ \t]+([a-z][a-z-]*)(?:[ \t]+([^:]+?))?[ \t]*(?::[ \t]*(.*))?$/u,
|
|
2043
|
-
VR=/["“]([^"“”]+)["”]/gu;UR=(e,t)=>!!(t.activity(e)||t.place(e)?.event||
|
|
2044
|
-
place(e)||t.declaredPlace(e))});import{createHash as FR}from"node:crypto";function ne(e){return FR("sha256").update(e).digest("hex")}var Yt=b(()=>{});import{lstat as HR,readFile as qR,readdir as WR,realpath as
|
|
2043
|
+
VR=/["“]([^"“”]+)["”]/gu;UR=(e,t)=>!!(t.activity(e)||t.place(e)?.event||Dh(e,{},t)!==null||t.declared(e)),BR=(e,t)=>!!(t.
|
|
2044
|
+
place(e)||t.declaredPlace(e))});import{createHash as FR}from"node:crypto";function ne(e){return FR("sha256").update(e).digest("hex")}var Yt=b(()=>{});import{lstat as HR,readFile as qR,readdir as WR,realpath as zh}from"node:fs/promises";import pe from"node:path";function Pe(e,t,r){
|
|
2045
2045
|
let n=new Set;for(let o of e){let i=t?o[t]:o;if(!jo(i)||n.has(i))throw new Error(`${r}: invalid or duplicate ID ${i}.`);
|
|
2046
2046
|
n.add(i)}return n}function V(e){return Array.isArray(e)?`[${e.map(V).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(
|
|
2047
|
-
e).sort().map(t=>`${JSON.stringify(t)}:${V(e[t])}`).join(",")}}`:JSON.stringify(e)}function
|
|
2047
|
+
e).sort().map(t=>`${JSON.stringify(t)}:${V(e[t])}`).join(",")}}`:JSON.stringify(e)}function Fh(e,t){let r=e.get(t.path);
|
|
2048
2048
|
if(r&&(r.sha256!==t.sha256||r.bytes!==t.bytes))throw new Error(`Source changed between lesson snapshots: ${t.path}. Vali\
|
|
2049
|
-
date and retry.`);e.set(t.path,t)}function _t(e){let t=new Map;for(let r of e)for(let n of r.files)
|
|
2050
|
-
async function YR(e){let t=await
|
|
2049
|
+
date and retry.`);e.set(t.path,t)}function _t(e){let t=new Map;for(let r of e)for(let n of r.files)Fh(t,n);return[...t.values()]}
|
|
2050
|
+
async function YR(e){let t=await zh(e);async function r(i,s=t){if(typeof i!="string"||!i||i.includes("\\")||pe.isAbsolute(
|
|
2051
2051
|
i))throw new Error(`Invalid topic-relative path: ${i}.`);let a=pe.resolve(s,i),c=pe.relative(t,a);if(c===".."||c.startsWith(
|
|
2052
|
-
`..${pe.sep}`)||pe.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await
|
|
2052
|
+
`..${pe.sep}`)||pe.isAbsolute(c))throw new Error(`Path escapes topic: ${i}.`);if(await zh(a)!==a)throw new Error(`Symlin\
|
|
2053
2053
|
k content is not supported: ${i}.`);return{filename:a,relative:c.split(pe.sep).join("/")}}async function n(i,s=t){let a=await r(
|
|
2054
2054
|
i,s),c=await HR(a.filename);if(!c.isFile()||c.size>1024*1024)throw new Error(`Expected a regular file of at most 1 MiB: ${a.
|
|
2055
2055
|
relative}.`);return{...a,bytes:await qR(a.filename)}}async function o(i,s=t){let a=await n(i,s);return{...a,value:JSON.parse(
|
|
@@ -2076,12 +2076,12 @@ shows undeclared visual ${a.visual.id}.`);for(let l of a.visual.play||[]){let w=
|
|
|
2076
2076
|
nd ${l.name} needs a parameters object.`);for(let[f,m]of Object.entries(_)){let y=w.parameters.find(E=>E.name===f);y||s(
|
|
2077
2077
|
`${c} command ${l.name} has undeclared parameter ${f}.`),(typeof m!="string"||m.length>y.maxLength)&&s(`${c} command ${l.
|
|
2078
2078
|
name} parameter ${f} must be a string of at most ${y.maxLength} characters.`)}for(let f of w.parameters)f.required&&!Object.
|
|
2079
|
-
hasOwn(_,f.name)&&s(`${c} command ${l.name} needs parameter ${f.name}.`)}}if(a.guide){let{caption:h,...l}=a.guide;try{
|
|
2079
|
+
hasOwn(_,f.name)&&s(`${c} command ${l.name} needs parameter ${f.name}.`)}}if(a.guide){let{caption:h,...l}=a.guide;try{Mh(
|
|
2080
2080
|
l,i)}catch(w){s(`${c} guide: ${w.message}`)}i.place(a.guide.target)?.scope==="project"&&!e.exercise&&s(`${c} guide ${a.guide.
|
|
2081
2081
|
target} needs the lesson's exercise (a practice project).`)}let u=null;try{({beats:u}=No(o.get(a.body),i))}catch(h){s(`${c}\
|
|
2082
2082
|
beats: ${h.message}`)}if(u){a.guide&&s(`${c} has both beats and a guide; its beats replace the guide.`);let h=u.find(w=>w.
|
|
2083
2083
|
kind==="check");h&&La[h.target]!==a.check.kind&&s(`${c} beat check ${h.target} does not match its ${a.check.kind} check.`);
|
|
2084
|
-
let l=u.find(w=>
|
|
2084
|
+
let l=u.find(w=>Bh(w,i));l&&!e.exercise&&s(`${c} beat ${l.kind} ${l.target} needs the lesson's exercise (a practice proj\
|
|
2085
2085
|
ect).`)}let d=a.check,p={auto:["check","files"],choice:["question","options","answer"],review:["rubric","evidence"],fact:[
|
|
2086
2086
|
"fact"],self:[],none:[]}[d.kind],g=Object.keys(d).filter(h=>h!=="kind"&&!p.includes(h));if(g.length&&s(`${c} ${d.kind} c\
|
|
2087
2087
|
heck cannot declare ${g.join(", ")}.`),d.kind==="none"&&a.required&&s(`${c} has no check and cannot be required.`),d.kind===
|
|
@@ -2098,7 +2098,7 @@ new Set(w).size!==w.length||w.some(_=>_>=l.length))&&s(`${c} choice answer must
|
|
|
2098
2098
|
tions.`)}}}async function ZR(e,t,{authoring:r,installed:n,vocabulary:o}){let i=await e.json(t.descriptor),s=Oo(i.value,t.
|
|
2099
2099
|
code);if(s.code!==t.code)throw new Error(`Lesson code mismatch: ${t.code}.`);if(r&&s.schemaVersion!==3)throw new Error(`\
|
|
2100
2100
|
Lesson ${t.code} uses retired lesson format ${s.schemaVersion}. Author it in format 3 with steps and its stage.`);let a=pe.
|
|
2101
|
-
dirname(i.filename),c=new Map;function u(f){if(
|
|
2101
|
+
dirname(i.filename),c=new Map;function u(f){if(Fh(c,{path:f.relative,sha256:ne(f.bytes),bytes:f.bytes.length}),c.size>512||
|
|
2102
2102
|
[...c.values()].reduce((m,y)=>m+y.bytes,0)>32*1024*1024)throw new Error(`Lesson ${t.code} exceeds bundle limits.`)}u(i);
|
|
2103
2103
|
let d=new Set,p=new Map;Pe(s.prerequisites,"code","Lesson prerequisites");let g=Pe(s.checks||[],"id","Checks");for(let f of s.
|
|
2104
2104
|
checks||[]){u(await e.read(f.file,a));for(let m of f.assets||[])u(await e.read(m,a))}if(s.schemaVersion===1&&KR(s,await e.
|
|
@@ -2110,7 +2110,7 @@ slice(1).split("/").every(y=>y===":id"||/^[A-Za-z0-9._~-]+$/u.test(y)))throw new
|
|
|
2110
2110
|
.`);h.add(m)}for(let f of s.checks||[])if(f.timeoutSeconds!==void 0&&f.kind!=="code")throw new Error(`Only a code check \
|
|
2111
2111
|
declares a timeout: ${f.id}.`);if(s.schemaVersion===1&&!s.assessments.some(f=>f.required))throw new Error(`Lesson ${t.code}\
|
|
2112
2112
|
needs a required assessment.`);Pe(s.visuals,"id","Visuals");let l=new Map;for(let f of s.visuals){let m=await e.json(f.
|
|
2113
|
-
descriptor,a),y=we(
|
|
2113
|
+
descriptor,a),y=we(xh,m.value,f.id);if(y.id!==f.id)throw new Error(`Visual ID mismatch: ${f.id}.`);let E=Pe(y.states,null,
|
|
2114
2114
|
"Visual states");if(!E.has(y.initialState))throw new Error(`Unknown initial visual state: ${y.initialState}.`);Pe(y.commands,
|
|
2115
2115
|
"name","Visual commands");for(let S of y.commands)if(Pe(S.parameters,"name","Command parameters"),S.completionState!=="u\
|
|
2116
2116
|
nchanged"&&!E.has(S.completionState))throw new Error(`Unknown completion state: ${S.name}.`);u(m),l.set(y.id,y);let T=pe.
|
|
@@ -2118,11 +2118,11 @@ dirname(m.filename);for(let S of[y.svg,y.controller,...y.assets||[]]){let v=awai
|
|
|
2118
2118
|
exercise){let f=s.exercise;if(f.reuse==="sequence"){if(!f.sequenceId||!f.sequenceMode)throw new Error(`Invalid exercise \
|
|
2119
2119
|
sequence for ${t.code}.`)}else if(f.sequenceId||f.sequenceMode)throw new Error(`Invalid exercise sequence for ${t.code}.`);
|
|
2120
2120
|
if(f.sequenceId&&!jo(f.sequenceId))throw new Error("Invalid exercise sequence ID.");let m=await e.resolve(f.source,a);async function y(T){
|
|
2121
|
-
for(let S of(await WR(T,{withFileTypes:!0})).sort((v,R)=>v.name<R.name?-1:v.name>R.name?1:0)){if(
|
|
2121
|
+
for(let S of(await WR(T,{withFileTypes:!0})).sort((v,R)=>v.name<R.name?-1:v.name>R.name?1:0)){if(Gh.has(S.name))continue;
|
|
2122
2122
|
let v=pe.relative(e.root,pe.join(T,S.name)),R=await e.resolve(v);if(S.isDirectory())await y(R.filename);else{let O=await e.
|
|
2123
2123
|
read(v);u(O),d.add(O.relative)}}}await y(m.filename);let E=s.schemaVersion===1?s.assessments.map(T=>[`Code assessment ${T.
|
|
2124
2124
|
id}`,T.evidence?.files||[]]):s.steps.map(T=>[`Code step ${T.id}`,T.check.files||[]]);for(let[T,S]of E){for(let v of S){let R=v.
|
|
2125
|
-
split("/");if(v.includes("\\")||pe.posix.isAbsolute(v)||R.some(O=>!O||O==="."||O===".."||
|
|
2125
|
+
split("/");if(v.includes("\\")||pe.posix.isAbsolute(v)||R.some(O=>!O||O==="."||O===".."||Gh.has(O))||!c.has(m.relative?`${m.
|
|
2126
2126
|
relative}/${v}`:v))throw new Error(`${T} names a file outside its bundled exercise: ${v}.`)}if(new Set(S).size!==S.length)
|
|
2127
2127
|
throw new Error(`${T} repeats a declared file.`)}}let w="";if(Ae(s))try{XR(s,l,g,t.code,p,o)}catch(f){if(!n)throw f;w=f.
|
|
2128
2128
|
message}let _={schemaVersion:1,code:s.code,files:[...c.values()].sort((f,m)=>f.path<m.path?-1:f.path>m.path?1:0)};return{
|
|
@@ -2145,12 +2145,12 @@ ence: ${l.code}.`);p.set(l.exercise.sequenceId,{source:f,status:_})}else if(!m||
|
|
|
2145
2145
|
"published")throw new Error(`Invalid create/continue sequence: ${l.code}.`)}let g=[i,a].map(l=>({path:l.relative,sha256:ne(
|
|
2146
2146
|
l.bytes),bytes:l.bytes.length})),h={schemaVersion:1,topic:s,release:i.value.version,files:g,lessons:u.map(({lesson:l,hash:w,
|
|
2147
2147
|
status:_,required:f})=>({code:l.code,hash:w,status:_,required:f}))};return _t([h,...u.map(l=>l.manifest)]),{topic:s,release:i.
|
|
2148
|
-
value.version,bundles:u,topicManifest:h,topicHash:ne(V(h))}}var
|
|
2149
|
-
node_modules",".genesis"]),jo=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{realpath as
|
|
2148
|
+
value.version,bundles:u,topicManifest:h,topicHash:ne(V(h))}}var Gh,jo,Jt=b(()=>{Wt();Co();Ma();Yt();Gh=new Set([".git","\
|
|
2149
|
+
node_modules",".genesis"]),jo=e=>/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u.test(e)});import{realpath as Hh}from"node:fs/promises";async function Ur(e){let t=await Hh(e),r=async(c,u="utf8",d={})=>{let{input:p,
|
|
2150
2150
|
maxBuffer:g=1024*1024}=d,h=await qt({actor:"daemon",allowedRoots:[t],args:["-C",t,...c],command:"git",cwd:t,envPolicy:"p\
|
|
2151
2151
|
roject",gitSafeDirectories:[t],input:p,maxBuffer:g,mode:"capture",outputEncoding:u,purpose:"source",runtimes:["git"],timeout:6e4});
|
|
2152
2152
|
if(h.ok!==!0)throw Object.assign(new Error(h.error||"Git could not read the pinned topic."),{code:h.code});return u==="b\
|
|
2153
|
-
ase64"?Buffer.from(h.stdout,"base64"):h.stdout.trim()};if(await
|
|
2153
|
+
ase64"?Buffer.from(h.stdout,"base64"):h.stdout.trim()};if(await Hh(await r(["rev-parse","--show-toplevel"]))!==t)throw new Error(
|
|
2154
2154
|
"Choose the topic repository root.");let n=await r(["rev-parse","HEAD"]);if(await r(["status","--porcelain","--untracked\
|
|
2155
2155
|
-files=all"]))throw new Error("Commit the topic content before generating a pinned course manifest.");let o=await bt(t),
|
|
2156
2156
|
i=JSON.parse(await r(["show",`${n}:package.json`])),s=String(i.repository?.url||"").match(/^https:\/\/github\.com\/([a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+)\.git$/u)?.[1];
|
|
@@ -2182,7 +2182,7 @@ void 0&&!o.some(i=>i.lessons.some(s=>s.code===r.orientation&&s.status==="publish
|
|
|
2182
2182
|
n ${r.orientation} must be a published lesson of the course.`);return{schemaVersion:1,courseId:r.courseId,release:r.release,
|
|
2183
2183
|
status:r.status,topics:o}}var xo=b(()=>{ba();Jt();Wt();Yt()});function Kt(e,t,r){let{statusCode:n,cause:o,...i}=r,s=new ie(n,e,{...i,code:t});return o&&(s.cause=o),s}function ko(e,t,r=409,n={}){
|
|
2184
2184
|
return Kt(e,t,{...n,statusCode:r})}function Ce(e,t,r,n){return Kt(e,t,{statusCode:r,cause:n})}function Da(e,t,r){return Object.
|
|
2185
|
-
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var zB,$o=b(()=>{Ve();zB=128*1024});var
|
|
2185
|
+
assign(new Error(e,r?{cause:r}:void 0),{code:t})}var zB,$o=b(()=>{Ve();zB=128*1024});var qh=b(()=>{});import{lstat as QR,readFile as eA,readdir as tA,realpath as rA}from"node:fs/promises";import G from"node:path";function Va(e){
|
|
2186
2186
|
return Ae(e)?{...e,steps:e.steps.map(t=>{if(t.check.kind!=="choice")return t;let{answer:r,...n}=t.check;return{...t,check:n}})}:
|
|
2187
2187
|
e}function Et(e,t={}){let r=we(oA,e,"Installed topic pin");if(!Xe.test(r.topicId)||!Ua.test(r.commit)||r.topicId!==(t.topicId??
|
|
2188
2188
|
r.topicId)||r.commit!==(t.commit??r.commit)||!/^\d+\.\d+\.\d+$/u.test(r.release)||!nA.test(r.repository)||!Gr.test(r.topicHash))
|
|
@@ -2208,8 +2208,8 @@ topicId:f,commit:m,topicHash:y}){try{let E=G.join(r,"training"),T=G.join(E,"cont
|
|
|
2208
2208
|
r,E,T,S,v])await Fr(ce,!0);let R=Et(JSON.parse((await Xt(G.join(v,"pin.json"),4096)).toString("utf8")),{topicId:f,commit:m,
|
|
2209
2209
|
topicHash:y}),O=JSON.parse((await Xt(G.join(v,"bundle.json"),32*1024*1024)).toString("utf8")),A=G.join(v,"files"),$=await iA(
|
|
2210
2210
|
A),P=await bt(A,{installed:!0}),C={schemaVersion:1,topic:P.topic,release:P.release,topicHash:P.topicHash,topicManifest:P.
|
|
2211
|
-
topicManifest,lessons:P.bundles.map(({lesson:ce,hash:me,status:Uo,required:
|
|
2212
|
-
required:
|
|
2211
|
+
topicManifest,lessons:P.bundles.map(({lesson:ce,hash:me,status:Uo,required:sg,manifest:ag})=>({code:ce.code,hash:me,status:Uo,
|
|
2212
|
+
required:sg,manifest:ag}))};if(V(O)!==V(C))throw new Error("Installed bundle is incomplete, reordered, unsupported or ch\
|
|
2213
2213
|
anged from its source files.");if(P.topic.topicId!==R.topicId||P.release!==R.release||P.topicHash!==R.topicHash)throw new Error(
|
|
2214
2214
|
"Installed topic identity differs from its pin.");let D=_t([P.topicManifest,...P.bundles.map(ce=>ce.manifest)]);if(V($)!==
|
|
2215
2215
|
V(D.map(ce=>ce.path).sort()))throw new Error("Installed snapshot has missing or unrecorded files.");let Y=await Xt(G.join(
|
|
@@ -2274,12 +2274,12 @@ G.posix.dirname(O.descriptorPath),A.source),P={pin:O.pin,lessonCode:O.lesson.cod
|
|
|
2274
2274
|
if(S===!0)return P;let C=$==="."?"":`${$}/`,D=[];for(let Y of O.manifest.files){if(!Y.path.startsWith(C))continue;let ae=Y.
|
|
2275
2275
|
path.slice(C.length),Qe=await c(O,$,ae);D.push({path:ae,bytes:Qe.bytes})}return{...P,files:D}}return Object.freeze({readTopic:i,
|
|
2276
2276
|
readLesson:g,readAdmissionIdentity:u,readVisual:l,readCheck:w,readExercise:_,readChoiceAnswer:h})}var Xe,Ua,Gr,nA,zr,oA,
|
|
2277
|
-
sA,Ba=b(()=>{To();Jt();Wt();Ma();Co();
|
|
2277
|
+
sA,Ba=b(()=>{To();Jt();Wt();Ma();Co();qh();Yt();$o();Xe=/^[a-zA-Z][a-zA-Z0-9-]{0,63}$/u,Ua=/^[a-f0-9]{40}$/u,Gr=/^[a-f0-9]{64}$/u,
|
|
2278
2278
|
nA=/^[a-zA-Z0-9_.-]+\/learn-[a-zA-Z0-9_.-]+$/u,zr={type:"string",required:!0,noTrim:!0,minLength:1,maxLength:256},oA=L({
|
|
2279
2279
|
schemaVersion:{type:"integer",required:!0,enum:[1]},topicId:{...zr,maxLength:64},release:zr,repository:zr,commit:{...zr,
|
|
2280
2280
|
maxLength:40},topicHash:{...zr,maxLength:64}});sA=e=>e==="published"});import{randomUUID as cA}from"node:crypto";import{lstat as uA,mkdir as Ga,realpath as lA,rename as dA,rm as fA,writeFile as pA}from"node:fs/promises";
|
|
2281
|
-
import oe from"node:path";function
|
|
2282
|
-
root)throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function
|
|
2281
|
+
import oe from"node:path";function Wh(e,t){if(typeof e!="string"||!oe.isAbsolute(e)||oe.resolve(e)!==e||e===oe.parse(e).
|
|
2282
|
+
root)throw new Error(`${t} must be a normalized absolute, non-root server-owned directory.`);return e}function Yh(e,t){let r=oe.
|
|
2283
2283
|
relative(e,t);return!r||r!==".."&&!r.startsWith(`..${oe.sep}`)&&!oe.isAbsolute(r)}async function Ne(e,t,r=!0){let n;try{
|
|
2284
2284
|
n=await uA(e)}catch(o){if(r&&o.code==="ENOENT")return null;throw o}if(n.isSymbolicLink()||await lA(e)!==e)throw new Error(
|
|
2285
2285
|
"Training installation cannot use symlink or directory aliases.");if(t?!n.isDirectory():!n.isFile())throw new Error(`Tra\
|
|
@@ -2289,8 +2289,8 @@ let r=oe.dirname(e);return r!==e&&await Lo(r,t),Ne(e,!0,t)}async function mA(e){
|
|
|
2289
2289
|
code!=="EEXIST")throw t}await Ne(e,!0,!1)}function Mo(e,t){if(V(e)!==V(t))throw new Error("Topic source or installed sna\
|
|
2290
2290
|
pshot conflicts with the approved owner pin. Keep existing content and check the exact source revision.")}async function za(e,t){
|
|
2291
2291
|
let{topicId:r,release:n,repository:o,commit:i,topicHash:s}=await Ur(e);Mo({schemaVersion:1,topicId:r,release:n,repository:o,
|
|
2292
|
-
commit:i,topicHash:s},t)}function
|
|
2293
|
-
sourceRoot:o,pin:i}={}){let s={...Et(i)};
|
|
2292
|
+
commit:i,topicHash:s},t)}function Jh({systemRoot:e}){let t=Wh(e,"Training system root"),r=Hr({systemRoot:t});async function n({
|
|
2293
|
+
sourceRoot:o,pin:i}={}){let s={...Et(i)};Wh(o,"Trusted topic source root");let a=oe.join(t,"training");if(Yh(o,a)||Yh(a,
|
|
2294
2294
|
o))throw new Error("Trusted topic source must be separate from the training installation namespace.");let c=oe.join(a,"c\
|
|
2295
2295
|
ontent"),u=oe.join(c,s.topicId),d=oe.join(u,s.commit),p=oe.join(a,".install-locks"),g=oe.join(p,`${s.topicId}-${s.commit}\
|
|
2296
2296
|
.lock`);await Lo(t);let h=await Lo(o,!0);for(let f of[a,c,u,p])await Ne(f,!0);if(await Ne(g,!1),await Ne(d,!0))Mo((await r.
|
|
@@ -2304,7 +2304,7 @@ e",o,y],{write(){}}),await za(o,s),await pA(oe.join(y,"pin.json"),`${V(s)}
|
|
|
2304
2304
|
`,{flag:"wx",mode:384}),await Hr({systemRoot:_}).readTopic(s),await Ne(u,!0,!1),await Ne(d,!0))throw new Error("The dest\
|
|
2305
2305
|
ination appeared during installation. Keep it unchanged and retry the verified pin.");await dA(y,d);let E=await r.readTopic(
|
|
2306
2306
|
s);return Mo(E.pin,s),{installed:!0,...E}}finally{try{_&&await fA(_,{recursive:!0,force:!0})}finally{await w()}}}return Object.
|
|
2307
|
-
freeze({installTopic:n})}var
|
|
2307
|
+
freeze({installTopic:n})}var Kh=b(()=>{Yn();xo();Ha();Jt();$o();Ba()});import{lstat as hA,mkdir as gA,readFile as yA,realpath as wA}from"node:fs/promises";import Ze from"node:path";function Wa(e){
|
|
2308
2308
|
if(!Number.isSafeInteger(e)||e<0)throw new Error("Supply the expected revision from a fresh installed catalogue read.")}
|
|
2309
2309
|
function Ya({systemRoot:e}){if(typeof e!="string"||!Ze.isAbsolute(e)||Ze.resolve(e)!==e||e===Ze.parse(e).root)throw new Error(
|
|
2310
2310
|
"Installed catalogue needs a canonical absolute, non-root server-owned system root.");let t=Ze.join(e,"training"),r=Ze.join(
|
|
@@ -2342,7 +2342,7 @@ ritten.");let m={..._,revision:_.revision+1};if(Buffer.byteLength(`${JSON.string
|
|
|
2342
2342
|
fileMode:384})}catch(y){throw Da("Catalogue save was not confirmed; atomic rename may already have succeeded. Read the c\
|
|
2343
2343
|
urrent catalogue before deliberately retrying. Do not assume the course changed or remained unchanged.","VIBE64_TRAINING\
|
|
2344
2344
|
_CATALOGUE_SAVE_UNCONFIRMED",y)}return{revision:m.revision,entry:f,changed:!0}}async function p({course:_,lock:f,expectedRevision:m}={}){
|
|
2345
|
-
Wa(m);let y=structuredClone(we(
|
|
2345
|
+
Wa(m);let y=structuredClone(we(Xh,{course:_,lock:f,enabled:!0},"Approved installed course"));await a(),await s(y);let E=await c();
|
|
2346
2346
|
try{let T=await a();u(T,m),await s(y);let S=T.courses.find(v=>v.course.courseId===y.course.courseId&&v.course.release===
|
|
2347
2347
|
y.course.release);if(S){if(V(S.course)!==V(y.course)||V(S.lock)!==V(y.lock))throw Ce("This installed course release is i\
|
|
2348
2348
|
mmutable. Resume its approved pin or publish and approve a different course release.","VIBE64_TRAINING_COURSE_RELEASE_CO\
|
|
@@ -2372,14 +2372,14 @@ topicId,release:A.release}))},O=E.courses.find(A=>A.course.courseId===R.courseId
|
|
|
2372
2372
|
ourse with this name already exists. Choose another name.","VIBE64_TRAINING_COURSE_EXISTS",409);if(!O&&E.courses.length>=
|
|
2373
2373
|
qr)throw Kt(`This installation already has ${qr} course releases. No course was created.`,"VIBE64_TRAINING_COURSE_CREATE\
|
|
2374
2374
|
_LIMIT",{statusCode:409,params:{limit:qr}});return p({course:R,lock:Br(R,S),expectedRevision:m})}return Object.freeze({readCatalogue:a,
|
|
2375
|
-
enableCourse:p,disableCourse:h,removeCourse:l,createCourse:w})}var qr,qa,
|
|
2376
|
-
$o();Yt();qr=16,qa=1024*1024,
|
|
2375
|
+
enableCourse:p,disableCourse:h,removeCourse:l,createCourse:w})}var qr,qa,Xh,_A,Zh=b(()=>{To();Yn();yr();xo();Jt();Wt();Ba();
|
|
2376
|
+
$o();Yt();qr=16,qa=1024*1024,Xh=L({course:{type:"object",required:!0,schema:Ao},lock:{type:"object",required:!0},enabled:{
|
|
2377
2377
|
type:"boolean",required:!0}}),_A=L({schemaVersion:{type:"integer",required:!0,enum:[1]},revision:{type:"integer",required:!0,
|
|
2378
|
-
min:0,max:Number.MAX_SAFE_INTEGER},courses:W(
|
|
2378
|
+
min:0,max:Number.MAX_SAFE_INTEGER},courses:W(Xh,qr)})});var tg={};zo(tg,{runTrainingCli:()=>Fa});import{mkdir as Qh,readFile as Do,realpath as Zt,rename as bA,rm as eg,writeFile as Ja}from"node:fs/promises";
|
|
2379
2379
|
import Z from"node:path";import{randomUUID as EA}from"node:crypto";async function Fa(e,{write:t=r=>console.log(r)}={}){if(e[0]===
|
|
2380
2380
|
"install-topic"){let[,c,u]=e;if(e.length!==3||!c||!u)throw new Error("Usage: vibe64 training install-topic <committed-to\
|
|
2381
2381
|
pic-directory> <system-root>");let d=await Zt(c),{topicId:p,release:g,repository:h,commit:l,topicHash:w}=await Ur(d),_={
|
|
2382
|
-
schemaVersion:1,topicId:p,release:g,repository:h,commit:l,topicHash:w},f=await
|
|
2382
|
+
schemaVersion:1,topicId:p,release:g,repository:h,commit:l,topicHash:w},f=await Jh({systemRoot:Z.resolve(u)}).installTopic(
|
|
2383
2383
|
{sourceRoot:d,pin:_});return t(JSON.stringify({ok:!0,installed:f.installed,pin:f.pin},null,2)),0}if(e[0]==="installed-co\
|
|
2384
2384
|
urses"){if(e.length!==2||!e[1])throw new Error("Usage: vibe64 training installed-courses <system-root>");let c=await Ya(
|
|
2385
2385
|
{systemRoot:Z.resolve(e[1])}).readCatalogue();return t(JSON.stringify({ok:!0,...c},null,2)),0}if(["enable-course","disab\
|
|
@@ -2395,27 +2395,27 @@ d||Z.basename(c)==="course.lock.json")throw new Error("Course lock output must n
|
|
|
2395
2395
|
let g=JSON.parse(await Do(d,"utf8")),h=[];for(let _ of u){let f=await Zt(_),m=Z.relative(f,p);if(!m||!m.startsWith(`..${Z.
|
|
2396
2396
|
sep}`)&&m!==".."&&!Z.isAbsolute(m))throw new Error("Course lock output must be outside every pinned source topic.");await bt(
|
|
2397
2397
|
f,{authoring:!0}),h.push(await Ur(f))}let l=Br(g,h),w=`${p}.tmp-${EA()}`;try{await Ja(w,`${V(l)}
|
|
2398
|
-
`,{flag:"wx"}),await bA(w,p)}finally{await
|
|
2398
|
+
`,{flag:"wx"}),await bA(w,p)}finally{await eg(w,{force:!0})}return t(JSON.stringify({ok:!0,courseId:l.courseId,status:l.
|
|
2399
2399
|
status,lockPath:p,topics:l.topics.length},null,2)),0}let[r,n,o]=e;if(!["validate","bundle"].includes(r)||!n||r==="bundle"&&
|
|
2400
2400
|
!o||e.length!==(r==="bundle"?3:2))throw new Error("Usage: vibe64 training validate <topic-directory> | bundle <topic-dir\
|
|
2401
2401
|
ectory> <new-output-directory>");let i=await Zt(n),s=await bt(i,{authoring:r==="validate"}),a={schemaVersion:1,topic:s.topic,
|
|
2402
2402
|
release:s.release,topicHash:s.topicHash,topicManifest:s.topicManifest,lessons:s.bundles.map(({lesson:c,hash:u,status:d,required:p,
|
|
2403
2403
|
manifest:g})=>({code:c.code,hash:u,status:d,required:p,manifest:g}))};if(r==="bundle"){let c=Z.resolve(o),u=Z.join(await Zt(
|
|
2404
2404
|
Z.dirname(c)),Z.basename(c)),d=Z.relative(i,u);if(!d||!d.startsWith(`..${Z.sep}`)&&d!==".."&&!Z.isAbsolute(d))throw new Error(
|
|
2405
|
-
"Bundle output must be outside the source topic.");await
|
|
2405
|
+
"Bundle output must be outside the source topic.");await Qh(u);try{let p=_t([s.topicManifest,...s.bundles.map(g=>g.manifest)]);
|
|
2406
2406
|
for(let g of p){let h=await Do(Z.join(i,g.path));if(ne(h)!==g.sha256)throw new Error(`Source changed during bundling: ${g.
|
|
2407
|
-
path}. Validate and retry.`);let l=Z.join(u,"files",g.path);await
|
|
2407
|
+
path}. Validate and retry.`);let l=Z.join(u,"files",g.path);await Qh(Z.dirname(l),{recursive:!0}),await Ja(l,h,{flag:"wx"})}
|
|
2408
2408
|
await Ja(Z.join(u,"bundle.json"),`${V(a)}
|
|
2409
|
-
`,{flag:"wx"})}catch(p){throw await
|
|
2409
|
+
`,{flag:"wx"})}catch(p){throw await eg(u,{recursive:!0,force:!0}),p}}return t(JSON.stringify({ok:!0,topicId:s.topic.topicId,
|
|
2410
2410
|
status:s.topic.status,lessons:s.bundles.map(({lesson:c,hash:u,status:d})=>({code:c.code,hash:u,status:d,schemaVersion:c.
|
|
2411
2411
|
schemaVersion,...c.stage?{stage:c.stage}:{},...Ae(c)?{steps:c.steps.length}:{}}))},null,2)),0}var Ha=b(()=>{Jt();Wt();xo();
|
|
2412
|
-
|
|
2413
|
-
import Wr from"node:path";import{fileURLToPath as TA}from"node:url";import{realpathSync as
|
|
2414
|
-
resolve(String(e||""));try{return t(r)}catch{return r}}function Za({entrypointPath:e,argv:t=
|
|
2415
|
-
return n?Xa(n,r)===Xa(e,r):!1}var SA=new URL("./run.js",import.meta.url).href,
|
|
2412
|
+
Kh();Zh();Yt()});import{spawn as rg}from"node:child_process";import{readFileSync as vA}from"node:fs";import{release as Vo}from"node:os";import M from"node:process";
|
|
2413
|
+
import Wr from"node:path";import{fileURLToPath as TA}from"node:url";import{realpathSync as hg}from"node:fs";import gg from"node:path";import yg from"node:process";function Xa(e,t){let r=gg.
|
|
2414
|
+
resolve(String(e||""));try{return t(r)}catch{return r}}function Za({entrypointPath:e,argv:t=yg.argv,realpath:r=hg}){let n=t[1];
|
|
2415
|
+
return n?Xa(n,r)===Xa(e,r):!1}var SA=new URL("./run.js",import.meta.url).href,ng=TA(SA),og=Wr.dirname(ng),er=Wr.join(og,"server.js");function Qt(e=""){
|
|
2416
2416
|
return`'${String(e).replaceAll("'","'\\''")}'`}function IA(e=""){return JSON.stringify(String(e))}function Ka(e=""){return`\
|
|
2417
|
-
"${String(e).replaceAll('"','\\"')}"`}function OA(e="",t=[]){return[Ka(e),...t.map(r=>Ka(r))].join(" ")}function RA({entrypointPath:e=
|
|
2418
|
-
...t}={}){return Za({entrypointPath:e,...t})}function
|
|
2417
|
+
"${String(e).replaceAll('"','\\"')}"`}function OA(e="",t=[]){return[Ka(e),...t.map(r=>Ka(r))].join(" ")}function RA({entrypointPath:e=ng,
|
|
2418
|
+
...t}={}){return Za({entrypointPath:e,...t})}function ig(e=M.cwd()){return Wr.basename(e)||"target"}function AA({env:e=M.
|
|
2419
2419
|
env,osReleaseText:t=Vo(),platform:r=M.platform}={}){return r!=="linux"?!1:String(e.WSL_DISTRO_NAME||e.WSL_INTEROP||"").trim()?
|
|
2420
2420
|
!0:/\bmicrosoft\b|\bwsl\b/iu.test(String(t||""))}function PA({nodePath:e=M.execPath,serverPath:t=er,serverArgs:r=[]}={}){
|
|
2421
2421
|
return[Qt(e),Qt(t),...r.map(n=>Qt(n))].join(" ")}function CA({cwd:e=M.cwd(),nodePath:t=M.execPath,serverArgs:r=[],serverPath:n=er,
|
|
@@ -2426,23 +2426,23 @@ n',' finish_vibe64_terminal "$status" "Vibe64 could not enter the target direct
|
|
|
2426
2426
|
o)}`,PA({nodePath:t,serverArgs:r,serverPath:n}),'finish_vibe64_terminal "$?" "Vibe64 server exited."'].join(`
|
|
2427
2427
|
`)}function NA(e=""){return`printf %s ${Buffer.from(String(e||""),"utf8").toString("base64")} | base64 -d | bash`}function jA({
|
|
2428
2428
|
distroName:e="",shellScript:t=""}={}){let r=String(e||"").trim();return[...r?["-d",r]:[],"--","bash","-lc",NA(t)]}function xA({
|
|
2429
|
-
cwd:e=M.cwd(),env:t=M.env,shellScript:r="",title:n=`Vibe64 - ${
|
|
2429
|
+
cwd:e=M.cwd(),env:t=M.env,shellScript:r="",title:n=`Vibe64 - ${ig(e)}`}={}){let o=jA({distroName:t.WSL_DISTRO_NAME,shellScript:r});
|
|
2430
2430
|
return[{command:"wt.exe",args:["new-window","--title",n,"wsl.exe",...o]},{command:"cmd.exe",args:["/d","/c",`start ${Ka(
|
|
2431
2431
|
n)} ${OA("wsl.exe",o)}`]}]}function kA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=Vo(),platform:o=M.
|
|
2432
|
-
platform,serverArgs:i=[],serverPath:s=er}={}){let a=`Vibe64 - ${
|
|
2432
|
+
platform,serverArgs:i=[],serverPath:s=er}={}){let a=`Vibe64 - ${ig(e)}`,c=CA({cwd:e,nodePath:r,serverArgs:i,serverPath:s,
|
|
2433
2433
|
title:a});if(o==="darwin")return[{command:"osascript",args:["-e",['tell application "Terminal"',"activate",`do script ${IA(
|
|
2434
2434
|
c)}`,"end tell"].join(`
|
|
2435
2435
|
`)]}];let u=[t.TERMINAL?{command:t.TERMINAL,args:["-e","bash","-lc",c]}:null,{command:"x-terminal-emulator",args:["-e","\
|
|
2436
2436
|
bash","-lc",c]},{command:"gnome-terminal",args:["--","bash","-lc",c]},{command:"konsole",args:["-e","bash","-lc",c]},{command:"\
|
|
2437
2437
|
xfce4-terminal",args:["--command",`bash -lc ${Qt(c)}`]},{command:"xterm",args:["-e","bash","-lc",c]}].filter(Boolean);return AA(
|
|
2438
2438
|
{env:t,osReleaseText:n,platform:o})?[...xA({cwd:e,env:t,shellScript:c,title:a}),...u]:u}function $A(e,t=[],r={}){return new Promise(
|
|
2439
|
-
(n,o)=>{let i=
|
|
2439
|
+
(n,o)=>{let i=rg(e,t,{...r,detached:!0,stdio:"ignore"});i.once("error",o),i.once("spawn",()=>{i.unref(),n(i)})})}async function LA({
|
|
2440
2440
|
cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,osReleaseText:n=Vo(),platform:o=M.platform,serverArgs:i=[],serverPath:s=er}={}){
|
|
2441
2441
|
let a=kA({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),c=[];for(let u of a)try{return await $A(
|
|
2442
2442
|
u.command,u.args,{cwd:e,env:t}),u}catch(d){c.push(d)}throw new AggregateError(c,"No supported terminal emulator could be\
|
|
2443
|
-
started.")}async function MA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,serverArgs:n=[],serverPath:o=er}={}){let i=
|
|
2443
|
+
started.")}async function MA({cwd:e=M.cwd(),env:t=M.env,nodePath:r=M.execPath,serverArgs:n=[],serverPath:o=er}={}){let i=rg(
|
|
2444
2444
|
r,[o,...n],{cwd:e,env:t,stdio:"inherit"});return new Promise((s,a)=>{i.once("error",a),i.once("exit",(c,u)=>{if(u){s(1);
|
|
2445
|
-
return}s(Number(c||0))})})}function DA(e=Wr.join(
|
|
2445
|
+
return}s(Number(c||0))})})}function DA(e=Wr.join(og,"..","package.json")){try{return/^\D*(\d+)/u.exec(String(JSON.parse(
|
|
2446
2446
|
vA(e,"utf8")).engines?.node||""))?.[1]||""}catch{return""}}function VA(e=M.platform){return`https://github.com/mobily-en\
|
|
2447
2447
|
terprises/vibe64/blob/main/docs/colleague-usage/${e==="darwin"?"set-up-macos":"set-up-linux"}.md`}function UA({platform:e=M.
|
|
2448
2448
|
platform,nodeVersion:t=M.versions.node,requiredMajor:r=DA()}={}){if(e==="win32")return["Vibe64 runs on Windows inside WS\
|
|
@@ -2455,9 +2455,9 @@ en a new terminal and run npx vibe64 again:",`${VA(e)}#nodejs-and-mise`].join(`
|
|
|
2455
2455
|
argv.slice(2),serverPath:s=er}={}){try{return await LA({cwd:e,env:t,nodePath:r,osReleaseText:n,platform:o,serverArgs:i,serverPath:s}),
|
|
2456
2456
|
console.log("Vibe64 is starting in a new terminal window."),0}catch(a){return console.warn(`${a.message} Starting Vibe64\
|
|
2457
2457
|
in this terminal instead.`),MA({cwd:e,env:t,nodePath:r,serverArgs:i,serverPath:s})}}if(RA()){let e={spec:()=>Promise.resolve().then(()=>(Mu(),Lu)).
|
|
2458
|
-
then(({runAgentSpecCli:n})=>n(M.argv.slice(3))),timeline:()=>Promise.resolve().then(()=>(
|
|
2459
|
-
M.argv.slice(3),{env:M.env})),training:()=>Promise.resolve().then(()=>(Ha(),
|
|
2458
|
+
then(({runAgentSpecCli:n})=>n(M.argv.slice(3))),timeline:()=>Promise.resolve().then(()=>(ph(),fh)).then(({runSessionTimelineCli:n})=>n(
|
|
2459
|
+
M.argv.slice(3),{env:M.env})),training:()=>Promise.resolve().then(()=>(Ha(),tg)).then(({runTrainingCli:n})=>n(M.argv.slice(
|
|
2460
2460
|
3)))},t=UA();t&&(console.error(t),M.exit(1)),(Object.hasOwn(e,M.argv[2])?e[M.argv[2]]():BA()).then(n=>{M.exitCode=n}).catch(
|
|
2461
2461
|
n=>{console.error("Failed to run Vibe64:",n),M.exitCode=1})}export{er as SERVER_ENTRYPOINT,RA as isDirectCliExecution,AA as isWslEnvironment,LA as launchInNewTerminal,UA as launcherProblem,
|
|
2462
|
-
Qt as quoteShellArg,BA as runLauncher,PA as serverShellCommand,
|
|
2462
|
+
Qt as quoteShellArg,BA as runLauncher,PA as serverShellCommand,ig as targetNameFromCwd,kA as terminalLaunchCandidates,CA as terminalShellScript,
|
|
2463
2463
|
jA as wslServerCommandArgs,xA as wslTerminalLaunchCandidates};
|