@keepur/hive 0.2.5 → 0.2.7
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/package.json +1 -1
- package/pkg/cli.min.js +122 -122
- package/pkg/mcp/structured-memory.min.js +6 -6
- package/pkg/server.min.js +84 -84
- package/service/deploy-check.sh +15 -1
- package/service/deploy.sh +129 -72
- package/service/instances.conf +19 -4
package/pkg/cli.min.js
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __hiveCreateRequire } from 'module'; const require = __hiveCreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`)}};yt.defaultYaml={explicit:!1,version:"1.2"};yt.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
5
|
-
`)?
|
|
3
|
+
var gf=Object.create;var Ds=Object.defineProperty;var yf=Object.getOwnPropertyDescriptor;var Sf=Object.getOwnPropertyNames;var vf=Object.getPrototypeOf,wf=Object.prototype.hasOwnProperty;var we=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Q=(t,e)=>{for(var n in e)Ds(t,n,{get:e[n],enumerable:!0})},bf=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Sf(e))!wf.call(t,i)&&i!==n&&Ds(t,i,{get:()=>e[i],enumerable:!(s=yf(e,i))||s.enumerable});return t};var te=(t,e,n)=>(n=t!=null?gf(vf(t)):{},bf(e||!t||!t.__esModule?Ds(n,"default",{value:t,enumerable:!0}):n,t));import{existsSync as Ef}from"node:fs";import{resolve as ne}from"node:path";function se(){return process.env.HIVE_HOME?ne(process.env.HIVE_HOME):Ef(ne(process.cwd(),"hive.yaml"))?process.cwd():ne(kf,"hive")}function un(t){let e=process.env.HIVE_CONFIG||"hive.yaml";return ne(t,e)}function ro(t){let n=(process.env.HIVE_CONFIG||"hive.yaml").match(/^hive-(.+)\.yaml$/)?.[1];return ne(t,n?`.env-${n}`:".env")}var kf,P,Y,xe,Af,ES,oo,G=O(()=>{"use strict";kf=process.env.HOME??"/tmp";P=se(),Y=ne(P,"skills"),xe=ne(P,".hive"),Af=ne(P,".hive-state"),ES=ne(Af,"git"),oo=ne(import.meta.dirname,"..","seeds")});var N=S(F=>{"use strict";var qs=Symbol.for("yaml.alias"),ao=Symbol.for("yaml.document"),fn=Symbol.for("yaml.map"),lo=Symbol.for("yaml.pair"),Rs=Symbol.for("yaml.scalar"),dn=Symbol.for("yaml.seq"),pe=Symbol.for("yaml.node.type"),_f=t=>!!t&&typeof t=="object"&&t[pe]===qs,If=t=>!!t&&typeof t=="object"&&t[pe]===ao,Of=t=>!!t&&typeof t=="object"&&t[pe]===fn,Nf=t=>!!t&&typeof t=="object"&&t[pe]===lo,co=t=>!!t&&typeof t=="object"&&t[pe]===Rs,Tf=t=>!!t&&typeof t=="object"&&t[pe]===dn;function uo(t){if(t&&typeof t=="object")switch(t[pe]){case fn:case dn:return!0}return!1}function Lf(t){if(t&&typeof t=="object")switch(t[pe]){case qs:case fn:case Rs:case dn:return!0}return!1}var Cf=t=>(co(t)||uo(t))&&!!t.anchor;F.ALIAS=qs;F.DOC=ao;F.MAP=fn;F.NODE_TYPE=pe;F.PAIR=lo;F.SCALAR=Rs;F.SEQ=dn;F.hasAnchor=Cf;F.isAlias=_f;F.isCollection=uo;F.isDocument=If;F.isMap=Of;F.isNode=Lf;F.isPair=Nf;F.isScalar=co;F.isSeq=Tf});var gt=S(xs=>{"use strict";var q=N(),W=Symbol("break visit"),fo=Symbol("skip children"),ie=Symbol("remove node");function pn(t,e){let n=po(e);q.isDocument(t)?Je(null,t.contents,n,Object.freeze([t]))===ie&&(t.contents=null):Je(null,t,n,Object.freeze([]))}pn.BREAK=W;pn.SKIP=fo;pn.REMOVE=ie;function Je(t,e,n,s){let i=ho(t,e,n,s);if(q.isNode(i)||q.isPair(i))return mo(t,s,i),Je(t,i,n,s);if(typeof i!="symbol"){if(q.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=Je(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ie&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=Je("key",e.key,n,s);if(r===W)return W;r===ie&&(e.key=null);let o=Je("value",e.value,n,s);if(o===W)return W;o===ie&&(e.value=null)}}return i}async function hn(t,e){let n=po(e);q.isDocument(t)?await Qe(null,t.contents,n,Object.freeze([t]))===ie&&(t.contents=null):await Qe(null,t,n,Object.freeze([]))}hn.BREAK=W;hn.SKIP=fo;hn.REMOVE=ie;async function Qe(t,e,n,s){let i=await ho(t,e,n,s);if(q.isNode(i)||q.isPair(i))return mo(t,s,i),Qe(t,i,n,s);if(typeof i!="symbol"){if(q.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=await Qe(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ie&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=await Qe("key",e.key,n,s);if(r===W)return W;r===ie&&(e.key=null);let o=await Qe("value",e.value,n,s);if(o===W)return W;o===ie&&(e.value=null)}}return i}function po(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function ho(t,e,n,s){if(typeof n=="function")return n(t,e,s);if(q.isMap(e))return n.Map?.(t,e,s);if(q.isSeq(e))return n.Seq?.(t,e,s);if(q.isPair(e))return n.Pair?.(t,e,s);if(q.isScalar(e))return n.Scalar?.(t,e,s);if(q.isAlias(e))return n.Alias?.(t,e,s)}function mo(t,e,n){let s=e[e.length-1];if(q.isCollection(s))s.items[t]=n;else if(q.isPair(s))t==="key"?s.key=n:s.value=n;else if(q.isDocument(s))s.contents=n;else{let i=q.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}xs.visit=pn;xs.visitAsync=hn});var Ks=S(yo=>{"use strict";var go=N(),Pf=gt(),Mf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$f=t=>t.replace(/[!,[\]{}]/g,e=>Mf[e]),yt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,s]of Object.entries(this.tags))if(e.startsWith(s))return n+$f(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(e&&s.length>0&&go.isNode(e.contents)){let r={};Pf.visit(e.contents,(o,a)=>{go.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
|
|
4
|
+
`)}};yt.defaultYaml={explicit:!1,version:"1.2"};yt.defaultTags={"!!":"tag:yaml.org,2002:"};yo.Directives=yt});var mn=S(St=>{"use strict";var So=N(),Df=gt();function qf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function vo(t){let e=new Set;return Df.visit(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function wo(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function Rf(t,e){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=vo(t));let o=wo(e,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(So.isScalar(o.node)||So.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:s}}St.anchorIsValid=qf;St.anchorNames=vo;St.createNodeAnchors=Rf;St.findNewAnchor=wo});var Bs=S(bo=>{"use strict";function vt(t,e,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){let o=s[i],a=vt(t,s,String(i),o);a===void 0?delete s[i]:a!==o&&(s[i]=a)}else if(s instanceof Map)for(let i of Array.from(s.keys())){let r=s.get(i),o=vt(t,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(let i of Array.from(s)){let r=vt(t,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(let[i,r]of Object.entries(s)){let o=vt(t,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return t.call(e,n,s)}bo.applyReviver=vt});var be=S(ko=>{"use strict";var xf=N();function Eo(t,e,n){if(Array.isArray(t))return t.map((s,i)=>Eo(s,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!xf.hasAnchor(t))return t.toJSON(e,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(t,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}ko.toJS=Eo});var gn=S(_o=>{"use strict";var Kf=Bs(),Ao=N(),Bf=be(),Fs=class{constructor(e){Object.defineProperty(this,Ao.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!Ao.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Bf.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?Kf.applyReviver(r,{"":a},"",a):a}};_o.NodeBase=Fs});var wt=S(Io=>{"use strict";var Ff=mn(),Uf=gt(),ze=N(),jf=gn(),Hf=be(),Us=class extends jf.NodeBase{constructor(e){super(ze.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],Uf.visit(e,{Node:(r,o)=>{(ze.isAlias(o)||ze.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let i;for(let r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:s,doc:i,maxAliasCount:r}=n,o=this.resolve(i,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(Hf.toJS(o,null,n),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=yn(i,o,s)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,s){let i=`*${this.source}`;if(e){if(Ff.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function yn(t,e,n){if(ze.isAlias(e)){let s=e.resolve(t),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(ze.isCollection(e)){let s=0;for(let i of e.items){let r=yn(t,i,n);r>s&&(s=r)}return s}else if(ze.isPair(e)){let s=yn(t,e.key,n),i=yn(t,e.value,n);return Math.max(s,i)}return 1}Io.Alias=Us});var $=S(js=>{"use strict";var Yf=N(),Vf=gn(),Gf=be(),Wf=t=>!t||typeof t!="function"&&typeof t!="object",Ee=class extends Vf.NodeBase{constructor(e){super(Yf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Gf.toJS(this.value,e,n)}toString(){return String(this.value)}};Ee.BLOCK_FOLDED="BLOCK_FOLDED";Ee.BLOCK_LITERAL="BLOCK_LITERAL";Ee.PLAIN="PLAIN";Ee.QUOTE_DOUBLE="QUOTE_DOUBLE";Ee.QUOTE_SINGLE="QUOTE_SINGLE";js.Scalar=Ee;js.isScalarValue=Wf});var bt=S(No=>{"use strict";var Jf=wt(),Ke=N(),Oo=$(),Qf="tag:yaml.org,2002:";function zf(t,e,n){if(e){let s=n.filter(r=>r.tag===e),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(s=>s.identify?.(t)&&!s.format)}function Xf(t,e,n){if(Ke.isDocument(t)&&(t=t.contents),Ke.isNode(t))return t;if(Ke.isPair(t)){let u=n.schema[Ke.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=n,l;if(s&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new Jf.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=Qf+e.slice(2));let c=zf(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new Oo.Scalar(t);return l&&(l.node=u),u}c=t instanceof Map?o[Ke.MAP]:Symbol.iterator in Object(t)?o[Ke.SEQ]:o[Ke.MAP]}r&&(r(c),delete n.onTagObj);let d=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new Oo.Scalar(t);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}No.createNode=Xf});var vn=S(Sn=>{"use strict";var Zf=bt(),re=N(),ed=gn();function Hs(t,e,n){let s=n;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return Zf.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var To=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ys=class extends ed.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(s=>re.isNode(s)||re.isPair(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(To(e))this.add(n);else{let[s,...i]=e,r=this.get(s,!0);if(re.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,Hs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){let[n,...s]=e;if(s.length===0)return this.delete(n);let i=this.get(n,!0);if(re.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(e,n){let[s,...i]=e,r=this.get(s,!0);return i.length===0?!n&&re.isScalar(r)?r.value:r:re.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!re.isPair(n))return!1;let s=n.value;return s==null||e&&re.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[n,...s]=e;if(s.length===0)return this.has(n);let i=this.get(n,!0);return re.isCollection(i)?i.hasIn(s):!1}setIn(e,n){let[s,...i]=e;if(i.length===0)this.set(s,n);else{let r=this.get(s,!0);if(re.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,Hs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};Sn.Collection=Ys;Sn.collectionFromPath=Hs;Sn.isEmptyPath=To});var Et=S(wn=>{"use strict";var td=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Vs(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var nd=(t,e,n)=>t.endsWith(`
|
|
5
|
+
`)?Vs(n,e):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)n===
|
|
7
|
+
`+Vs(n,e):(t.endsWith(" ")?"":" ")+n;wn.indentComment=Vs;wn.lineComment=nd;wn.stringifyComment=td});var Co=S(kt=>{"use strict";var sd="flow",Gs="block",bn="quoted";function id(t,e,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<r&&(r=0);let l=Math.max(1+r,1+i-e.length);if(t.length<=l)return t;let c=[],d={},u=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let f,p,y=!1,h=-1,m=-1,w=-1;n===Gs&&(h=Lo(t,h,e.length),h!==-1&&(u=h+l));for(let A;A=t[h+=1];){if(n===bn&&A==="\\"){switch(m=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(A===`
|
|
8
|
+
`)n===Gs&&(h=Lo(t,h,e.length)),u=h+e.length+l,f=void 0;else{if(A===" "&&p&&p!==" "&&p!==`
|
|
9
9
|
`&&p!==" "){let _=t[h+1];_&&_!==" "&&_!==`
|
|
10
|
-
`&&_!==" "&&(
|
|
11
|
-
${e}${t.slice(0,
|
|
12
|
-
${e}${t.slice(_+1,
|
|
13
|
-
`);s=e,i=e+1,r=t[i]}return s}
|
|
14
|
-
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function At(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(
|
|
10
|
+
`&&_!==" "&&(f=h)}if(h>=u)if(f)c.push(f),u=f+l,f=void 0;else if(n===bn){for(;p===" "||p===" ";)p=A,A=t[h+=1],y=!0;let _=h>w+1?h-2:m-1;if(d[_])return t;c.push(_),d[_]=!0,u=_+l,f=void 0}else y=!0}p=A}if(y&&a&&a(),c.length===0)return t;o&&o();let b=t.slice(0,c[0]);for(let A=0;A<c.length;++A){let _=c[A],k=c[A+1]||t.length;_===0?b=`
|
|
11
|
+
${e}${t.slice(0,k)}`:(n===bn&&d[_]&&(b+=`${t[_]}\\`),b+=`
|
|
12
|
+
${e}${t.slice(_+1,k)}`)}return b}function Lo(t,e,n){let s=e,i=e+1,r=t[i];for(;r===" "||r===" ";)if(e<i+n)r=t[++e];else{do r=t[++e];while(r&&r!==`
|
|
13
|
+
`);s=e,i=e+1,r=t[i]}return s}kt.FOLD_BLOCK=Gs;kt.FOLD_FLOW=sd;kt.FOLD_QUOTED=bn;kt.foldFlowLines=id});var _t=S(Po=>{"use strict";var Z=$(),ke=Co(),kn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),An=t=>/^(%|---|\.\.\.)/m.test(t);function rd(t,e,n){if(!e||e<0)return!1;let s=e-n,i=t.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(t[r]===`
|
|
14
|
+
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function At(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(An(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let d=n.substr(l+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||n[l+2]==='"'||n.length<i)l+=1;else{for(o+=n.slice(a,l)+`
|
|
15
15
|
|
|
16
16
|
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
|
|
17
|
-
`,l+=2;o+=r,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return At(t,e);let n=e.indent||(
|
|
19
|
-
${n}`)+"'";return e.implicitKey?s:
|
|
17
|
+
`,l+=2;o+=r,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:ke.foldFlowLines(o,r,ke.FOLD_QUOTED,kn(e,!1))}function Ws(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return At(t,e);let n=e.indent||(An(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${n}`)+"'";return e.implicitKey?s:ke.foldFlowLines(s,n,ke.FOLD_FLOW,kn(e,!1))}function Xe(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=At;else{let i=t.includes('"'),r=t.includes("'");i&&!r?s=Ws:r&&!i?s=At:s=n?Ws:At}return s(t,e)}var Js;try{Js=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{Js=/\n+(?!\n|$)/g}function En({comment:t,type:e,value:n},s,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(n))return Xe(n,s);let c=s.indent||(s.forceBlockIndent||An(n)?" ":""),d=o==="literal"?!0:o==="folded"||e===Z.Scalar.BLOCK_FOLDED?!1:e===Z.Scalar.BLOCK_LITERAL?!0:!rd(n,l,c.length);if(!n)return d?`|
|
|
23
23
|
`:`>
|
|
24
|
-
`;let u,
|
|
25
|
-
`&&
|
|
24
|
+
`;let u,f;for(f=n.length;f>0;--f){let k=n[f-1];if(k!==`
|
|
25
|
+
`&&k!==" "&&k!==" ")break}let p=n.substring(f),y=p.indexOf(`
|
|
26
26
|
`);y===-1?u="-":n===p||y!==p.length-1?(u="+",r&&r()):u="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
27
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
28
|
-
`)w=m;else break}let b=n.substring(0,w<m?w+1:m);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let _=(h?c?"2":"1":"")+u;if(t&&(_+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),I=!1,T=kn(s,!0);o!=="folded"&&e!==Z.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{I=!0});let
|
|
30
|
-
${c}${
|
|
31
|
-
${c}${b}${n}${p}`}function
|
|
32
|
-
`)||
|
|
33
|
-
`)?Xe(r,e):
|
|
34
|
-
`))return
|
|
35
|
-
${l}`);if(o){let
|
|
36
|
-
${e.indent}${a}`:a}
|
|
37
|
-
${a}:`):(m=`${m}:`,
|
|
27
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Js,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<n.length;++m){let k=n[m];if(k===" ")h=!0;else if(k===`
|
|
28
|
+
`)w=m;else break}let b=n.substring(0,w<m?w+1:m);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let _=(h?c?"2":"1":"")+u;if(t&&(_+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!d){let k=n.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),I=!1,T=kn(s,!0);o!=="folded"&&e!==Z.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{I=!0});let E=ke.foldFlowLines(`${b}${k}${p}`,c,ke.FOLD_BLOCK,T);if(!I)return`>${_}
|
|
30
|
+
${c}${E}`}return n=n.replace(/\n+/g,`$&${c}`),`|${_}
|
|
31
|
+
${c}${b}${n}${p}`}function od(t,e,n,s){let{type:i,value:r}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:d}=e;if(a&&r.includes(`
|
|
32
|
+
`)||d&&/[[\]{},]/.test(r))return Xe(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||d||!r.includes(`
|
|
33
|
+
`)?Xe(r,e):En(t,e,n,s);if(!a&&!d&&i!==Z.Scalar.PLAIN&&r.includes(`
|
|
34
|
+
`))return En(t,e,n,s);if(An(r)){if(l==="")return e.forceBlockIndent=!0,En(t,e,n,s);if(a&&l===c)return Xe(r,e)}let u=r.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:y}=e.doc.schema;if(y.some(f)||p?.some(f))return Xe(r,e)}return a?u:ke.foldFlowLines(u,l,ke.FOLD_FLOW,kn(e,!1))}function ad(t,e,n,s){let{implicitKey:i,inFlow:r}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Z.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Z.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case Z.Scalar.BLOCK_FOLDED:case Z.Scalar.BLOCK_LITERAL:return i||r?Xe(o.value,e):En(o,e,n,s);case Z.Scalar.QUOTE_DOUBLE:return At(o.value,e);case Z.Scalar.QUOTE_SINGLE:return Ws(o.value,e);case Z.Scalar.PLAIN:return od(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=i&&d||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}Po.stringifyString=ad});var It=S(Qs=>{"use strict";var ld=mn(),Ae=N(),cd=Et(),ud=_t();function fd(t,e){let n=Object.assign({blockQuote:!0,commentString:cd.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function dd(t,e){if(e.tag){let i=t.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let n,s;if(Ae.isScalar(e)){s=e.value;let i=t.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else s=e,n=t.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function pd(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(Ae.isScalar(t)||Ae.isCollection(t))&&t.anchor;r&&ld.anchorIsValid(r)&&(n.add(r),i.push(`&${r}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function hd(t,e,n,s){if(Ae.isPair(t))return t.toString(e,n,s);if(Ae.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,r=Ae.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=dd(e.doc.schema.tags,r));let o=pd(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,n,s):Ae.isScalar(r)?ud.stringifyString(r,e,n,s):r.toString(e,n,s);return o?Ae.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${e.indent}${a}`:a}Qs.createStringifyContext=fd;Qs.stringify=hd});var qo=S(Do=>{"use strict";var he=N(),Mo=$(),$o=It(),Ot=Et();function md({key:t,value:e},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:u}}=n,f=he.isNode(t)&&t.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(he.isCollection(t)||!he.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!u&&(!t||f&&e==null&&!n.inFlow||he.isCollection(t)||(he.isScalar(t)?t.type===Mo.Scalar.BLOCK_FOLDED||t.type===Mo.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let y=!1,h=!1,m=$o.stringify(t,n,()=>y=!0,()=>h=!0);if(!p&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(r||e==null)return y&&s&&s(),m===""?"?":p?`? ${m}`:m}else if(r&&!u||e==null&&p)return m=`? ${m}`,f&&!y?m+=Ot.lineComment(m,n.indent,c(f)):h&&i&&i(),m;y&&(f=null),p?(f&&(m+=Ot.lineComment(m,n.indent,c(f))),m=`? ${m}
|
|
37
|
+
${a}:`):(m=`${m}:`,f&&(m+=Ot.lineComment(m,n.indent,c(f))));let w,b,A;he.isNode(e)?(w=!!e.spaceBefore,b=e.commentBefore,A=e.comment):(w=!1,b=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!p&&!f&&he.isScalar(e)&&(n.indentAtStart=m.length+1),h=!1,!d&&l.length>=2&&!n.inFlow&&!p&&he.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let _=!1,k=$o.stringify(e,n,()=>_=!0,()=>h=!0),I=" ";if(f||w||b){if(I=w?`
|
|
38
38
|
`:"",b){let T=c(b);I+=`
|
|
39
|
-
${Ot.indentComment(T,n.indent)}`}
|
|
39
|
+
${Ot.indentComment(T,n.indent)}`}k===""&&!n.inFlow?I===`
|
|
40
40
|
`&&A&&(I=`
|
|
41
41
|
|
|
42
42
|
`):I+=`
|
|
43
|
-
${n.indent}`}else if(!p&&
|
|
44
|
-
`),M=
|
|
45
|
-
${n.indent}`)}}else(
|
|
46
|
-
`)&&(I="");return m+=I+
|
|
43
|
+
${n.indent}`}else if(!p&&he.isCollection(e)){let T=k[0],E=k.indexOf(`
|
|
44
|
+
`),M=E!==-1,ve=n.inFlow??e.flow??e.items.length===0;if(M||!ve){let We=!1;if(M&&(T==="&"||T==="!")){let D=k.indexOf(" ");T==="&"&&D!==-1&&D<E&&k[D+1]==="!"&&(D=k.indexOf(" ",D+1)),(D===-1||E<D)&&(We=!0)}We||(I=`
|
|
45
|
+
${n.indent}`)}}else(k===""||k[0]===`
|
|
46
|
+
`)&&(I="");return m+=I+k,n.inFlow?_&&s&&s():A&&!_?m+=Ot.lineComment(m,n.indent,c(A)):h&&i&&i(),m}Do.stringifyPair=md});var Xs=S(zs=>{"use strict";var Ro=we("process");function gd(t,...e){t==="debug"&&console.log(...e)}function yd(t,e){(t==="debug"||t==="warn")&&(typeof Ro.emitWarning=="function"?Ro.emitWarning(e):console.warn(e))}zs.debug=gd;zs.warn=yd});var Nn=S(On=>{"use strict";var Nt=N(),xo=$(),_n="<<",In={identify:t=>t===_n||typeof t=="symbol"&&t.description===_n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new xo.Scalar(Symbol(_n)),{addToJSMap:Ko}),stringify:()=>_n},Sd=(t,e)=>(In.identify(e)||Nt.isScalar(e)&&(!e.type||e.type===xo.Scalar.PLAIN)&&In.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===In.tag&&n.default);function Ko(t,e,n){if(n=t&&Nt.isAlias(n)?n.resolve(t.doc):n,Nt.isSeq(n))for(let s of n.items)Zs(t,e,s);else if(Array.isArray(n))for(let s of n)Zs(t,e,s);else Zs(t,e,n)}function Zs(t,e,n){let s=t&&Nt.isAlias(n)?n.resolve(t.doc):n;if(!Nt.isMap(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,t,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}On.addMergeToJSMap=Ko;On.isMergeKey=Sd;On.merge=In});var ti=S(Uo=>{"use strict";var vd=Xs(),Bo=Nn(),wd=It(),Fo=N(),ei=be();function bd(t,e,{key:n,value:s}){if(Fo.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(Bo.isMergeKey(t,n))Bo.addMergeToJSMap(t,e,s);else{let i=ei.toJS(n,"",t);if(e instanceof Map)e.set(i,ei.toJS(s,i,t));else if(e instanceof Set)e.add(i);else{let r=Ed(n,i,t),o=ei.toJS(s,r,t);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Ed(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Fo.isNode(t)&&n?.doc){let s=wd.createStringifyContext(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=t.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),vd.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}Uo.addPairToJSMap=bd});var _e=S(ni=>{"use strict";var jo=bt(),kd=qo(),Ad=ti(),Tn=N();function _d(t,e,n){let s=jo.createNode(t,void 0,n),i=jo.createNode(e,void 0,n);return new Ln(s,i)}var Ln=class t{constructor(e,n=null){Object.defineProperty(this,Tn.NODE_TYPE,{value:Tn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return Tn.isNode(n)&&(n=n.clone(e)),Tn.isNode(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return Ad.addPairToJSMap(n,s,this)}toString(e,n,s){return e?.doc?kd.stringifyPair(this,e,n,s):JSON.stringify(this)}};ni.Pair=Ln;ni.createPair=_d});var si=S(Yo=>{"use strict";var Be=N(),Ho=It(),Cn=Et();function Id(t,e,n){return(e.inFlow??t.flow?Nd:Od)(t,e,n)}function Od({comment:t,items:e},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,d=Object.assign({},n,{indent:r,type:null}),u=!1,f=[];for(let y=0;y<e.length;++y){let h=e[y],m=null;if(Be.isNode(h))!u&&h.spaceBefore&&f.push(""),Pn(n,f,h.commentBefore,u),h.comment&&(m=h.comment);else if(Be.isPair(h)){let b=Be.isNode(h.key)?h.key:null;b&&(!u&&b.spaceBefore&&f.push(""),Pn(n,f,b.commentBefore,u))}u=!1;let w=Ho.stringify(h,d,()=>m=null,()=>u=!0);m&&(w+=Cn.lineComment(w,r,c(m))),u&&m&&(u=!1),f.push(s+w)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let y=1;y<f.length;++y){let h=f[y];p+=h?`
|
|
47
47
|
${l}${h}`:`
|
|
48
48
|
`}}return t?(p+=`
|
|
49
|
-
`+
|
|
50
|
-
`)),y<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((b,A)=>b+A.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=
|
|
49
|
+
`+Cn.indentComment(c(t),l),a&&a()):u&&o&&o(),p}function Nd({items:t},e,{flowChars:n,itemIndent:s}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;s+=r;let l=Object.assign({},e,{indent:s,inFlow:!0,type:null}),c=!1,d=0,u=[];for(let y=0;y<t.length;++y){let h=t[y],m=null;if(Be.isNode(h))h.spaceBefore&&u.push(""),Pn(e,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Be.isPair(h)){let b=Be.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&u.push(""),Pn(e,u,b.commentBefore,!1),b.comment&&(c=!0));let A=Be.isNode(h.value)?h.value:null;A?(A.comment&&(m=A.comment),A.commentBefore&&(c=!0)):h.value==null&&b?.comment&&(m=b.comment)}m&&(c=!0);let w=Ho.stringify(h,l,()=>m=null);c||(c=u.length>d||w.includes(`
|
|
50
|
+
`)),y<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((b,A)=>b+A.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=Cn.lineComment(w,s,a(m))),u.push(w),d=u.length}let{start:f,end:p}=n;if(u.length===0)return f+p;if(!c){let y=u.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=f;for(let h of u)y+=h?`
|
|
51
51
|
${r}${i}${h}`:`
|
|
52
52
|
`;return`${y}
|
|
53
|
-
${i}${p}`}else return`${
|
|
54
|
-
`:" ")}return
|
|
53
|
+
${i}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Pn({indent:t,options:{commentString:e}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=Cn.indentComment(e(s),t);n.push(r.trimStart())}}Yo.stringifyCollection=Id});var Oe=S(ri=>{"use strict";var Td=si(),Ld=ti(),Cd=vn(),Ie=N(),Mn=_e(),Pd=$();function Tt(t,e){let n=Ie.isScalar(e)?e.value:e;for(let s of t)if(Ie.isPair(s)&&(s.key===e||s.key===n||Ie.isScalar(s.key)&&s.key.value===n))return s}var ii=class extends Cd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Ie.MAP,e),this.items=[]}static from(e,n,s){let{keepUndefined:i,replacer:r}=s,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(n,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(Mn.createPair(l,c,s))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let s;Ie.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new Mn.Pair(e,e?.value):s=new Mn.Pair(e.key,e.value);let i=Tt(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Ie.isScalar(i.value)&&Pd.isScalarValue(s.value)?i.value.value=s.value:i.value=s.value}else if(r){let o=this.items.findIndex(a=>r(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(e){let n=Tt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Tt(this.items,e)?.value;return(!n&&Ie.isScalar(i)?i.value:i)??void 0}has(e){return!!Tt(this.items,e)}set(e,n){this.add(new Mn.Pair(e,n),!0)}toJSON(e,n,s){let i=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let r of this.items)Ld.addPairToJSMap(n,i,r);return i}toString(e,n,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Ie.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Td.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};ri.YAMLMap=ii;ri.findPair=Tt});var Ze=S(Go=>{"use strict";var Md=N(),Vo=Oe(),$d={collection:"map",default:!0,nodeClass:Vo.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Md.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Vo.YAMLMap.from(t,e,n)};Go.map=$d});var Ne=S(Wo=>{"use strict";var Dd=bt(),qd=si(),Rd=vn(),Dn=N(),xd=$(),Kd=be(),oi=class extends Rd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Dn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=$n(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=$n(e);if(typeof s!="number")return;let i=this.items[s];return!n&&Dn.isScalar(i)?i.value:i}has(e){let n=$n(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=$n(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Dn.isScalar(i)&&xd.isScalarValue(n)?i.value=n:this.items[s]=n}toJSON(e,n){let s=[];n?.onCreate&&n.onCreate(s);let i=0;for(let r of this.items)s.push(Kd.toJS(r,String(i++),n));return s}toString(e,n,s){return e?qd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(o++);a=i.call(n,l,a)}r.items.push(Dd.createNode(a,void 0,s))}}return r}};function $n(t){let e=Dn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Wo.YAMLSeq=oi});var et=S(Qo=>{"use strict";var Bd=N(),Jo=Ne(),Fd={collection:"seq",default:!0,nodeClass:Jo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Bd.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Jo.YAMLSeq.from(t,e,n)};Qo.seq=Fd});var Lt=S(zo=>{"use strict";var Ud=_t(),jd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,s){return e=Object.assign({actualString:!0},e),Ud.stringifyString(t,e,n,s)}};zo.string=jd});var qn=S(ea=>{"use strict";var Xo=$(),Zo={identify:t=>t==null,createNode:()=>new Xo.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Xo.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Zo.test.test(t)?t:e.options.nullStr};ea.nullTag=Zo});var ai=S(na=>{"use strict";var Hd=$(),ta={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Hd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ta.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};na.boolTag=ta});var tt=S(sa=>{"use strict";function Yd({format:t,minFractionDigits:e,tag:n,value:s}){if(typeof s=="bigint")return String(s);let i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}sa.stringifyNumber=Yd});var ci=S(Rn=>{"use strict";var Vd=$(),li=tt(),Gd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:li.stringifyNumber},Wd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():li.stringifyNumber(t)}},Jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Vd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:li.stringifyNumber};Rn.float=Jd;Rn.floatExp=Wd;Rn.floatNaN=Gd});var fi=S(Kn=>{"use strict";var ia=tt(),xn=t=>typeof t=="bigint"||Number.isInteger(t),ui=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function ra(t,e,n){let{value:s}=t;return xn(s)&&s>=0?n+s.toString(e):ia.stringifyNumber(t)}var Qd={identify:t=>xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ui(t,2,8,n),stringify:t=>ra(t,8,"0o")},zd={identify:xn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ui(t,0,10,n),stringify:ia.stringifyNumber},Xd={identify:t=>xn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ui(t,2,16,n),stringify:t=>ra(t,16,"0x")};Kn.int=zd;Kn.intHex=Xd;Kn.intOct=Qd});var aa=S(oa=>{"use strict";var Zd=Ze(),ep=qn(),tp=et(),np=Lt(),sp=ai(),di=ci(),pi=fi(),ip=[Zd.map,tp.seq,np.string,ep.nullTag,sp.boolTag,pi.intOct,pi.int,pi.intHex,di.floatNaN,di.floatExp,di.float];oa.schema=ip});var ua=S(ca=>{"use strict";var rp=$(),op=Ze(),ap=et();function la(t){return typeof t=="bigint"||Number.isInteger(t)}var Bn=({value:t})=>JSON.stringify(t),lp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Bn},{identify:t=>t==null,createNode:()=>new rp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Bn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Bn},{identify:la,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>la(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Bn}],cp={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},up=[op.map,ap.seq].concat(lp,cp);ca.schema=up});var mi=S(fa=>{"use strict";var Ct=we("buffer"),hi=$(),fp=_t(),dp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ct.Buffer=="function")return Ct.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},s,i,r){if(!n)return"";let o=n,a;if(typeof Ct.Buffer=="function")a=o instanceof Ct.Buffer?o.toString("base64"):Ct.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=hi.Scalar.BLOCK_LITERAL),e!==hi.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),d=new Array(c);for(let u=0,f=0;u<c;++u,f+=l)d[u]=a.substr(f,l);a=d.join(e===hi.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return fp.stringifyString({comment:t,type:e,value:a},s,i,r)}};fa.binary=dp});var jn=S(Un=>{"use strict";var Fn=N(),gi=_e(),pp=$(),hp=Ne();function da(t,e){if(Fn.isSeq(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!Fn.isPair(s)){if(Fn.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new gi.Pair(new pp.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
|
|
55
55
|
${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
|
|
56
|
-
${r.comment}`:s.comment}s=i}t.items[n]=Bn.isPair(s)?s:new hi.Pair(s)}}else e("Expected a sequence for this tag");return t}function fa(t,e,n){let{replacer:s}=n,i=new fp.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(hi.createPair(a,l,n))}return i}var dp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ua,createNode:fa};Fn.createPairs=fa;Fn.pairs=dp;Fn.resolvePairs=ua});var yi=S(gi=>{"use strict";var da=N(),mi=be(),Pt=Oe(),pp=Ne(),pa=Un(),Fe=class t extends pp.YAMLSeq{constructor(){super(),this.add=Pt.YAMLMap.prototype.add.bind(this),this.delete=Pt.YAMLMap.prototype.delete.bind(this),this.get=Pt.YAMLMap.prototype.get.bind(this),this.has=Pt.YAMLMap.prototype.has.bind(this),this.set=Pt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(da.isPair(i)?(r=mi.toJS(i.key,"",n),o=mi.toJS(i.value,r,n)):r=mi.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,n,s){let i=pa.createPairs(e,n,s),r=new this;return r.items=i.items,r}};Fe.tag="tag:yaml.org,2002:omap";var hp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=pa.resolvePairs(t,e),s=[];for(let{key:i}of n.items)da.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Fe,n)},createNode:(t,e,n)=>Fe.from(t,e,n)};gi.YAMLOMap=Fe;gi.omap=hp});var Sa=S(Si=>{"use strict";var ha=$();function ma({value:t,source:e},n){return e&&(t?ga:ya).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var ga={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ha.Scalar(!0),stringify:ma},ya={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ha.Scalar(!1),stringify:ma};Si.falseTag=ya;Si.trueTag=ga});var va=S(jn=>{"use strict";var mp=$(),vi=tt(),gp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:vi.stringifyNumber},yp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():vi.stringifyNumber(t)}},Sp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new mp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let s=t.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:vi.stringifyNumber};jn.float=Sp;jn.floatExp=yp;jn.floatNaN=gp});var ba=S($t=>{"use strict";var wa=tt(),Mt=t=>typeof t=="bigint"||Number.isInteger(t);function Hn(t,e,n,{intAsBigInt:s}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),s){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let r=parseInt(t,n);return i==="-"?-1*r:r}function wi(t,e,n){let{value:s}=t;if(Mt(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return wa.stringifyNumber(t)}var vp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Hn(t,2,2,n),stringify:t=>wi(t,2,"0b")},wp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Hn(t,1,8,n),stringify:t=>wi(t,8,"0")},bp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Hn(t,0,10,n),stringify:wa.stringifyNumber},kp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Hn(t,2,16,n),stringify:t=>wi(t,16,"0x")};$t.int=bp;$t.intBin=vp;$t.intHex=kp;$t.intOct=wp});var ki=S(bi=>{"use strict";var Gn=N(),Yn=_e(),Vn=Oe(),Ue=class t extends Vn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Gn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Yn.Pair(e.key,null):n=new Yn.Pair(e,null),Vn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=Vn.findPair(this.items,e);return!n&&Gn.isPair(s)?Gn.isScalar(s.key)?s.key.value:s.key:s}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=Vn.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Yn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(Yn.createPair(o,null,s));return r}};Ue.tag="tag:yaml.org,2002:set";var Ep={collection:"map",identify:t=>t instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ue.from(t,e,n),resolve(t,e){if(Gn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ue,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};bi.YAMLSet=Ue;bi.set=Ep});var Ai=S(Wn=>{"use strict";var Ap=tt();function Ei(t,e){let n=t[0],s=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function ka(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Ap.stringifyNumber(t);let s="";e<0&&(s="-",e*=n(-1));let i=n(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var _p={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Ei(t,n),stringify:ka},Ip={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Ei(t,!1),stringify:ka},Ea={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Ea.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=Ei(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Wn.floatTime=Ip;Wn.intTime=_p;Wn.timestamp=Ea});var Ia=S(_a=>{"use strict";var Op=Ze(),Np=Dn(),Tp=et(),Lp=Lt(),Cp=pi(),Aa=Sa(),_i=va(),Jn=ba(),Pp=On(),Mp=yi(),$p=Un(),Dp=ki(),Ii=Ai(),qp=[Op.map,Tp.seq,Lp.string,Np.nullTag,Aa.trueTag,Aa.falseTag,Jn.intBin,Jn.intOct,Jn.int,Jn.intHex,_i.floatNaN,_i.floatExp,_i.float,Cp.binary,Pp.merge,Mp.omap,$p.pairs,Dp.set,Ii.intTime,Ii.floatTime,Ii.timestamp];_a.schema=qp});var qa=S(Ti=>{"use strict";var La=Ze(),Rp=Dn(),Ca=et(),xp=Lt(),Kp=ri(),Oi=ai(),Ni=ci(),Bp=ra(),Fp=la(),Pa=pi(),Dt=On(),Ma=yi(),$a=Un(),Oa=Ia(),Da=ki(),Qn=Ai(),Na=new Map([["core",Bp.schema],["failsafe",[La.map,Ca.seq,xp.string]],["json",Fp.schema],["yaml11",Oa.schema],["yaml-1.1",Oa.schema]]),Ta={binary:Pa.binary,bool:Kp.boolTag,float:Oi.float,floatExp:Oi.floatExp,floatNaN:Oi.floatNaN,floatTime:Qn.floatTime,int:Ni.int,intHex:Ni.intHex,intOct:Ni.intOct,intTime:Qn.intTime,map:La.map,merge:Dt.merge,null:Rp.nullTag,omap:Ma.omap,pairs:$a.pairs,seq:Ca.seq,set:Da.set,timestamp:Qn.timestamp},Up={"tag:yaml.org,2002:binary":Pa.binary,"tag:yaml.org,2002:merge":Dt.merge,"tag:yaml.org,2002:omap":Ma.omap,"tag:yaml.org,2002:pairs":$a.pairs,"tag:yaml.org,2002:set":Da.set,"tag:yaml.org,2002:timestamp":Qn.timestamp};function jp(t,e,n){let s=Na.get(e);if(s&&!t)return n&&!s.includes(Dt.merge)?s.concat(Dt.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(Na.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(t))for(let r of t)i=i.concat(r);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Dt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Ta[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ta).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Ti.coreKnownTags=Up;Ti.getTags=jp});var Pi=S(Ra=>{"use strict";var Li=N(),Hp=Ze(),Yp=et(),Vp=Lt(),zn=qa(),Gp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Ci=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?zn.getTags(e,"compat"):e?zn.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?zn.coreKnownTags:{},this.tags=zn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Li.MAP,{value:Hp.map}),Object.defineProperty(this,Li.SCALAR,{value:Vp.string}),Object.defineProperty(this,Li.SEQ,{value:Yp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Gp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ra.Schema=Ci});var Ka=S(xa=>{"use strict";var Wp=N(),Mi=It(),qt=kt();function Jp(t,e){let n=[],s=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),s=!0):t.directives.docStart&&(s=!0)}s&&n.push("---");let i=Mi.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift(qt.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(Wp.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let f=r(t.contents.commentBefore);n.push(qt.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=Mi.stringify(t.contents,i,()=>a=null,l);a&&(c+=qt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Mi.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=r(t.comment);l.includes(`
|
|
56
|
+
${r.comment}`:s.comment}s=i}t.items[n]=Fn.isPair(s)?s:new gi.Pair(s)}}else e("Expected a sequence for this tag");return t}function pa(t,e,n){let{replacer:s}=n,i=new hp.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(gi.createPair(a,l,n))}return i}var mp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:da,createNode:pa};Un.createPairs=pa;Un.pairs=mp;Un.resolvePairs=da});var vi=S(Si=>{"use strict";var ha=N(),yi=be(),Pt=Oe(),gp=Ne(),ma=jn(),Fe=class t extends gp.YAMLSeq{constructor(){super(),this.add=Pt.YAMLMap.prototype.add.bind(this),this.delete=Pt.YAMLMap.prototype.delete.bind(this),this.get=Pt.YAMLMap.prototype.get.bind(this),this.has=Pt.YAMLMap.prototype.has.bind(this),this.set=Pt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(ha.isPair(i)?(r=yi.toJS(i.key,"",n),o=yi.toJS(i.value,r,n)):r=yi.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,n,s){let i=ma.createPairs(e,n,s),r=new this;return r.items=i.items,r}};Fe.tag="tag:yaml.org,2002:omap";var yp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=ma.resolvePairs(t,e),s=[];for(let{key:i}of n.items)ha.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Fe,n)},createNode:(t,e,n)=>Fe.from(t,e,n)};Si.YAMLOMap=Fe;Si.omap=yp});var wa=S(wi=>{"use strict";var ga=$();function ya({value:t,source:e},n){return e&&(t?Sa:va).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var Sa={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ga.Scalar(!0),stringify:ya},va={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ga.Scalar(!1),stringify:ya};wi.falseTag=va;wi.trueTag=Sa});var ba=S(Hn=>{"use strict";var Sp=$(),bi=tt(),vp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:bi.stringifyNumber},wp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():bi.stringifyNumber(t)}},bp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Sp.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let s=t.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:bi.stringifyNumber};Hn.float=bp;Hn.floatExp=wp;Hn.floatNaN=vp});var ka=S($t=>{"use strict";var Ea=tt(),Mt=t=>typeof t=="bigint"||Number.isInteger(t);function Yn(t,e,n,{intAsBigInt:s}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),s){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let r=parseInt(t,n);return i==="-"?-1*r:r}function Ei(t,e,n){let{value:s}=t;if(Mt(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return Ea.stringifyNumber(t)}var Ep={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Yn(t,2,2,n),stringify:t=>Ei(t,2,"0b")},kp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Yn(t,1,8,n),stringify:t=>Ei(t,8,"0")},Ap={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Yn(t,0,10,n),stringify:Ea.stringifyNumber},_p={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Yn(t,2,16,n),stringify:t=>Ei(t,16,"0x")};$t.int=Ap;$t.intBin=Ep;$t.intHex=_p;$t.intOct=kp});var Ai=S(ki=>{"use strict";var Wn=N(),Vn=_e(),Gn=Oe(),Ue=class t extends Gn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Wn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Vn.Pair(e.key,null):n=new Vn.Pair(e,null),Gn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=Gn.findPair(this.items,e);return!n&&Wn.isPair(s)?Wn.isScalar(s.key)?s.key.value:s.key:s}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=Gn.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Vn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(Vn.createPair(o,null,s));return r}};Ue.tag="tag:yaml.org,2002:set";var Ip={collection:"map",identify:t=>t instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ue.from(t,e,n),resolve(t,e){if(Wn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ue,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ki.YAMLSet=Ue;ki.set=Ip});var Ii=S(Jn=>{"use strict";var Op=tt();function _i(t,e){let n=t[0],s=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function Aa(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Op.stringifyNumber(t);let s="";e<0&&(s="-",e*=n(-1));let i=n(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Np={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>_i(t,n),stringify:Aa},Tp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>_i(t,!1),stringify:Aa},_a={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(_a.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,a||0,l),d=e[8];if(d&&d!=="Z"){let u=_i(d,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Jn.floatTime=Tp;Jn.intTime=Np;Jn.timestamp=_a});var Na=S(Oa=>{"use strict";var Lp=Ze(),Cp=qn(),Pp=et(),Mp=Lt(),$p=mi(),Ia=wa(),Oi=ba(),Qn=ka(),Dp=Nn(),qp=vi(),Rp=jn(),xp=Ai(),Ni=Ii(),Kp=[Lp.map,Pp.seq,Mp.string,Cp.nullTag,Ia.trueTag,Ia.falseTag,Qn.intBin,Qn.intOct,Qn.int,Qn.intHex,Oi.floatNaN,Oi.floatExp,Oi.float,$p.binary,Dp.merge,qp.omap,Rp.pairs,xp.set,Ni.intTime,Ni.floatTime,Ni.timestamp];Oa.schema=Kp});var xa=S(Ci=>{"use strict";var Pa=Ze(),Bp=qn(),Ma=et(),Fp=Lt(),Up=ai(),Ti=ci(),Li=fi(),jp=aa(),Hp=ua(),$a=mi(),Dt=Nn(),Da=vi(),qa=jn(),Ta=Na(),Ra=Ai(),zn=Ii(),La=new Map([["core",jp.schema],["failsafe",[Pa.map,Ma.seq,Fp.string]],["json",Hp.schema],["yaml11",Ta.schema],["yaml-1.1",Ta.schema]]),Ca={binary:$a.binary,bool:Up.boolTag,float:Ti.float,floatExp:Ti.floatExp,floatNaN:Ti.floatNaN,floatTime:zn.floatTime,int:Li.int,intHex:Li.intHex,intOct:Li.intOct,intTime:zn.intTime,map:Pa.map,merge:Dt.merge,null:Bp.nullTag,omap:Da.omap,pairs:qa.pairs,seq:Ma.seq,set:Ra.set,timestamp:zn.timestamp},Yp={"tag:yaml.org,2002:binary":$a.binary,"tag:yaml.org,2002:merge":Dt.merge,"tag:yaml.org,2002:omap":Da.omap,"tag:yaml.org,2002:pairs":qa.pairs,"tag:yaml.org,2002:set":Ra.set,"tag:yaml.org,2002:timestamp":zn.timestamp};function Vp(t,e,n){let s=La.get(e);if(s&&!t)return n&&!s.includes(Dt.merge)?s.concat(Dt.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(La.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(t))for(let r of t)i=i.concat(r);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Dt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Ca[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ca).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Ci.coreKnownTags=Yp;Ci.getTags=Vp});var $i=S(Ka=>{"use strict";var Pi=N(),Gp=Ze(),Wp=et(),Jp=Lt(),Xn=xa(),Qp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Mi=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Xn.getTags(e,"compat"):e?Xn.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Xn.coreKnownTags:{},this.tags=Xn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Pi.MAP,{value:Gp.map}),Object.defineProperty(this,Pi.SCALAR,{value:Jp.string}),Object.defineProperty(this,Pi.SEQ,{value:Wp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Qp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ka.Schema=Mi});var Fa=S(Ba=>{"use strict";var zp=N(),Di=It(),qt=Et();function Xp(t,e){let n=[],s=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),s=!0):t.directives.docStart&&(s=!0)}s&&n.push("---");let i=Di.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift(qt.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(zp.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let d=r(t.contents.commentBefore);n.push(qt.indentComment(d,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=Di.stringify(t.contents,i,()=>a=null,l);a&&(c+=qt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Di.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=r(t.comment);l.includes(`
|
|
57
57
|
`)?(n.push("..."),n.push(qt.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(qt.indentComment(r(l),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
59
|
+
`}Ba.stringifyDocument=Xp});var Rt=S(Ua=>{"use strict";var Zp=wt(),nt=vn(),z=N(),eh=_e(),th=be(),nh=$i(),sh=Fa(),qi=mn(),ih=Bs(),rh=bt(),Ri=Ks(),xi=class t{constructor(e,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,z.NODE_TYPE,{value:z.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Ri.Directives({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){let e=Object.create(t.prototype,{[z.NODE_TYPE]:{value:z.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=z.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){st(this.contents)&&this.contents.add(e)}addIn(e,n){st(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=qi.anchorNames(this);e.anchor=!n||s.has(n)?qi.findNewAnchor(n||"a",s):n}return new Zp.Alias(e.anchor)}createNode(e,n,s){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let m=b=>typeof b=="number"||b instanceof String||b instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:d}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=qi.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=rh.createNode(e,d,y);return a&&z.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,n,s={}){let i=this.createNode(e,null,s),r=this.createNode(n,null,s);return new eh.Pair(i,r)}delete(e){return st(this.contents)?this.contents.delete(e):!1}deleteIn(e){return nt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):st(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return z.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return nt.isEmptyPath(e)?!n&&z.isScalar(this.contents)?this.contents.value:this.contents:z.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return z.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return nt.isEmptyPath(e)?this.contents!==void 0:z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=nt.collectionFromPath(this.schema,[e],n):st(this.contents)&&this.contents.set(e,n)}setIn(e,n){nt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=nt.collectionFromPath(this.schema,Array.from(e),n):st(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ri.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Ri.Directives({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new nh.Schema(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=th.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:c,res:d}of a.anchors.values())r(d,c);return typeof o=="function"?ih.applyReviver(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return sh.stringifyDocument(this,e)}};function st(t){if(z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Ua.Document=xi});var Bt=S(Kt=>{"use strict";var xt=class extends Error{constructor(e,n,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=n}},Ki=class extends xt{constructor(e,n,s){super("YAMLParseError",e,n,s)}},Bi=class extends xt{constructor(e,n,s){super("YAMLWarning",e,n,s)}},oh=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=t.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let a=t.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
60
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.linePos[1];l?.line===s&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${o}
|
|
63
63
|
${c}
|
|
64
|
-
`}};Kt.YAMLError=xt;Kt.YAMLParseError=
|
|
65
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(
|
|
66
|
-
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||
|
|
67
|
-
`+A.comment:b.comment=A.comment);let _=new
|
|
68
|
-
`+I.comment:c.comment=I.comment),u=I.end;continue}!o&&n.options.strict&&
|
|
69
|
-
`+T:
|
|
70
|
-
`+M.comment:
|
|
71
|
-
`+m.comment:c.comment=m.comment),c.range=[s.offset,h,m.offset]}else c.range=[s.offset,h,h];return c}
|
|
72
|
-
`.repeat(Math.max(1,o.length-1)):"",m=s+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[s,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,
|
|
73
|
-
`;for(let h=
|
|
74
|
-
`):m.length>l||w[0]===" "?(
|
|
75
|
-
`:!p&&
|
|
76
|
-
`&&(
|
|
64
|
+
`}};Kt.YAMLError=xt;Kt.YAMLParseError=Ki;Kt.YAMLWarning=Bi;Kt.prettifyError=oh});var Ft=S(ja=>{"use strict";function ah(t,{flow:e,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,d=a,u="",f="",p=!1,y=!1,h=null,m=null,w=null,b=null,A=null,_=null,k=null;for(let E of t)switch(y&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&r(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),h&&(c&&E.type!=="comment"&&E.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),E.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&E.source.includes(" ")&&(h=E),d=!0;break;case"comment":{d||r(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=E.source.substring(1)||" ";u?u+=f+M:u=M,f="",c=!1;break}case"newline":c?u?u+=E.source:(!_||n!=="seq-item-ind")&&(l=!0):f+=E.source,c=!0,p=!0,(m||w)&&(b=E),d=!0;break;case"anchor":m&&r(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&r(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=E,k??(k=E.offset),c=!1,d=!1,y=!0;break;case"tag":{w&&r(E,"MULTIPLE_TAGS","A node can have at most one tag"),w=E,k??(k=E.offset),c=!1,d=!1,y=!0;break}case n:(m||w)&&r(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),_&&r(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),_=E,c=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(e){A&&r(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=E,c=!1,d=!1;break}default:r(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),c=!1,d=!1}let I=t[t.length-1],T=I?I.offset+I.source.length:i;return y&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:A,found:_,spaceBefore:l,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:b,end:T,start:k??T}}ja.resolveProps=ah});var Zn=S(Ha=>{"use strict";function Fi(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
65
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Fi(e.key)||Fi(e.value))return!0}return!1;default:return!0}}Ha.containsNewline=Fi});var Ui=S(Ya=>{"use strict";var lh=Zn();function ch(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&lh.containsNewline(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ya.flowIndentCheck=ch});var ji=S(Ga=>{"use strict";var Va=N();function uh(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||Va.isScalar(r)&&Va.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,n))}Ga.mapIncludes=uh});var Za=S(Xa=>{"use strict";var Wa=_e(),fh=Oe(),Ja=Ft(),dh=Zn(),Qa=Ui(),ph=ji(),za="All mapping items must start at the same column";function hh({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??fh.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let d of s.items){let{start:u,key:f,sep:p,value:y}=d,h=Ja.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&i(l,"BAD_INDENT",za)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||dh.containsNewline(f))&&i(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(l,"BAD_INDENT",za);n.atKey=!0;let w=h.end,b=f?t(n,f,h,i):e(n,w,u,null,h,i);n.schema.compat&&Qa.flowIndentCheck(s.indent,f,i),n.atKey=!1,ph.mapIncludes(n,a.items,b)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let A=Ja.resolveProps(p??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:i,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=A.end,A.found){m&&(y?.type==="block-map"&&!A.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<A.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=y?t(n,y,A,i):e(n,l,p,null,A,i);n.schema.compat&&Qa.flowIndentCheck(s.indent,y,i),l=_.range[2];let k=new Wa.Pair(b,_);n.options.keepSourceTokens&&(k.srcToken=d),a.items.push(k)}else{m&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(b.comment?b.comment+=`
|
|
67
|
+
`+A.comment:b.comment=A.comment);let _=new Wa.Pair(b);n.options.keepSourceTokens&&(_.srcToken=d),a.items.push(_)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}Xa.resolveBlockMap=hh});var tl=S(el=>{"use strict";var mh=Ne(),gh=Ft(),yh=Ui();function Sh({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??mh.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=s.offset,c=null;for(let{start:d,value:u}of s.items){let f=gh.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?t(n,u,f,i):e(n,f.end,d,null,f,i);n.schema.compat&&yh.flowIndentCheck(s.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}el.resolveBlockSeq=Sh});var it=S(nl=>{"use strict";function vh(t,e,n,s){let i="";if(t){let r=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{n&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";i?i+=o+d:i=d,o="";break}case"newline":i&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}nl.resolveEnd=vh});var ol=S(rl=>{"use strict";var wh=N(),bh=_e(),sl=Oe(),Eh=Ne(),kh=it(),il=Ft(),Ah=Zn(),_h=ji(),Hi="Block collections are not allowed within flow collections",Yi=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Ih({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?sl.YAMLMap:Eh.YAMLSeq),c=new l(n.schema);c.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let m=0;m<s.items.length;++m){let w=s.items[m],{start:b,key:A,sep:_,value:k}=w,I=il.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:A??_?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!I.found){if(!I.anchor&&!I.tag&&!_&&!k){m===0&&I.comma?i(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(I.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),I.comment&&(c.comment?c.comment+=`
|
|
68
|
+
`+I.comment:c.comment=I.comment),u=I.end;continue}!o&&n.options.strict&&Ah.containsNewline(A)&&i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)I.comma&&i(I.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(I.comma||i(I.start,"MISSING_CHAR",`Missing , between ${a} items`),I.comment){let T="";e:for(let E of b)switch(E.type){case"comma":case"space":break;case"comment":T=E.source.substring(1);break e;default:break e}if(T){let E=c.items[c.items.length-1];wh.isPair(E)&&(E=E.value??E.key),E.comment?E.comment+=`
|
|
69
|
+
`+T:E.comment=T,I.comment=I.comment.substring(T.length+1)}}if(!o&&!_&&!I.found){let T=k?t(n,k,I,i):e(n,I.end,_,null,I,i);c.items.push(T),u=T.range[2],Yi(k)&&i(T.range,"BLOCK_IN_FLOW",Hi)}else{n.atKey=!0;let T=I.end,E=A?t(n,A,I,i):e(n,T,b,null,I,i);Yi(A)&&i(E.range,"BLOCK_IN_FLOW",Hi),n.atKey=!1;let M=il.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:k,offset:E.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(M.found){if(!o&&!I.found&&n.options.strict){if(_)for(let D of _){if(D===M.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}I.start<M.found.offset-1024&&i(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${a}`):i(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ve=k?t(n,k,M,i):M.found?e(n,M.end,_,null,M,i):null;ve?Yi(k)&&i(ve.range,"BLOCK_IN_FLOW",Hi):M.comment&&(E.comment?E.comment+=`
|
|
70
|
+
`+M.comment:E.comment=M.comment);let We=new bh.Pair(E,ve);if(n.options.keepSourceTokens&&(We.srcToken=w),o){let D=c;_h.mapIncludes(n,D.items,E)&&i(T,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(We)}else{let D=new sl.YAMLMap(n.schema);D.flow=!0,D.items.push(We);let io=(ve??E).range;D.range=[E.range[0],io[1],io[2]],c.items.push(D)}u=ve?ve.range[2]:M.end}}let f=o?"}":"]",[p,...y]=s.end,h=u;if(p?.source===f)h=p.offset+p.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;i(u,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let m=kh.resolveEnd(y,h,n.options.strict,i);m.comment&&(c.comment?c.comment+=`
|
|
71
|
+
`+m.comment:c.comment=m.comment),c.range=[s.offset,h,m.offset]}else c.range=[s.offset,h,h];return c}rl.resolveFlowCollection=Ih});var ll=S(al=>{"use strict";var Oh=N(),Nh=$(),Th=Oe(),Lh=Ne(),Ch=Za(),Ph=tl(),Mh=ol();function Vi(t,e,n,s,i,r){let o=n.type==="block-map"?Ch.resolveBlockMap(t,e,n,s,r):n.type==="block-seq"?Ph.resolveBlockSeq(t,e,n,s,r):Mh.resolveFlowCollection(t,e,n,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function $h(t,e,n,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,f=>i(r,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=s,y=f&&r?f.offset>r.offset?f:r:f??r;y&&(!p||p.offset<y.offset)&&i(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Th.YAMLMap.tagName&&a==="map"||o===Lh.YAMLSeq.tagName&&a==="seq")return Vi(t,e,n,i,o);let l=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!l){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?i(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Vi(t,e,n,i,o)}let c=Vi(t,e,n,i,o,l),d=l.resolve?.(c,f=>i(r,"TAG_RESOLVE_FAILED",f),e.options)??c,u=Oh.isNode(d)?d:new Nh.Scalar(d);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}al.composeCollection=$h});var Wi=S(cl=>{"use strict";var Gi=$();function Dh(t,e,n){let s=e.offset,i=qh(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?Gi.Scalar.BLOCK_FOLDED:Gi.Scalar.BLOCK_LITERAL,o=e.source?Rh(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,o.length-1)):"",m=s+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[s,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,d=0;for(let h=0;h<a;++h){let[m,w]=o[h];if(w===""||w==="\r")i.indent===0&&m.length>l&&(l=m.length);else{m.length<l&&n(c+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=m.length),d=h,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+w.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>l&&(a=h+1);let u="",f="",p=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(l)+`
|
|
73
|
+
`;for(let h=d;h<a;++h){let[m,w]=o[h];c+=m.length+w.length+1;let b=w[w.length-1]==="\r";if(b&&(w=w.slice(0,-1)),w&&m.length<l){let _=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-w.length-(b?2:1),"BAD_INDENT",_),m=""}r===Gi.Scalar.BLOCK_LITERAL?(u+=f+m.slice(l)+w,f=`
|
|
74
|
+
`):m.length>l||w[0]===" "?(f===" "?f=`
|
|
75
|
+
`:!p&&f===`
|
|
76
|
+
`&&(f=`
|
|
77
77
|
|
|
78
|
-
`),u+=
|
|
79
|
-
`,p=!0):w===""?
|
|
78
|
+
`),u+=f+m.slice(l)+w,f=`
|
|
79
|
+
`,p=!0):w===""?f===`
|
|
80
80
|
`?u+=`
|
|
81
|
-
`:
|
|
82
|
-
`:(u+=
|
|
81
|
+
`:f=`
|
|
82
|
+
`:(u+=f+w,f=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)u+=`
|
|
83
83
|
`+o[h][0].slice(l);u[u.length-1]!==`
|
|
84
84
|
`&&(u+=`
|
|
85
85
|
`);break;default:u+=`
|
|
86
|
-
`}let y=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,y,y]}}function
|
|
86
|
+
`}let y=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,y,y]}}function qh({offset:t,props:e},n,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let y=Number(p);!o&&y?o=y:l===-1&&(l=t+f)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,d="",u=i.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":n&&!c&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let y=`Unexpected token in block scalar header: ${p.type}`;s(p,"UNEXPECTED_TOKEN",y);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:d,length:u}}function Rh(t){let e=t.split(/\n( *)/),n=e[0],s=n.match(/^( *)/),r=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}cl.resolveBlockScalar=Dh});var Qi=S(fl=>{"use strict";var Ji=$(),xh=it();function Kh(t,e,n){let{offset:s,type:i,source:r,end:o}=t,a,l,c=(f,p,y)=>n(s+f,p,y);switch(i){case"scalar":a=Ji.Scalar.PLAIN,l=Bh(r,c);break;case"single-quoted-scalar":a=Ji.Scalar.QUOTE_SINGLE,l=Fh(r,c);break;case"double-quoted-scalar":a=Ji.Scalar.QUOTE_DOUBLE,l=Uh(r,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let d=s+r.length,u=xh.resolveEnd(o,d,e,n);return{value:l,type:a,comment:u.comment,range:[s,d,u.offset]}}function Bh(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),ul(t)}function Fh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),ul(t.slice(1,-1)).replace(/''/g,"'")}function ul(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
87
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
88
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(t);if(!s)return t;let i=s[1],r=" ",o=e.lastIndex;for(n.lastIndex=o;s=n.exec(t);)s[1]===""?r===`
|
|
89
89
|
`?i+=r:r=`
|
|
90
|
-
`:(i+=r+s[1],r=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(t),i+r+(s?.[1]??"")}function
|
|
90
|
+
`:(i+=r+s[1],r=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(t),i+r+(s?.[1]??"")}function Uh(t,e){let n="";for(let s=1;s<t.length-1;++s){let i=t[s];if(!(i==="\r"&&t[s+1]===`
|
|
91
91
|
`))if(i===`
|
|
92
|
-
`){let{fold:r,offset:o}=
|
|
92
|
+
`){let{fold:r,offset:o}=jh(t,s);n+=r,s=o}else if(i==="\\"){let r=t[++s],o=Hh[r];if(o)n+=o;else if(r===`
|
|
93
93
|
`)for(r=t[s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="\r"&&t[s+1]===`
|
|
94
|
-
`)for(r=t[++s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];n+=
|
|
94
|
+
`)for(r=t[++s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];n+=Yh(t,s+1,a,e),s+=a}else{let a=t.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let r=s,o=t[s+1];for(;o===" "||o===" ";)o=t[++s+1];o!==`
|
|
95
95
|
`&&!(o==="\r"&&t[s+2]===`
|
|
96
|
-
`)&&(n+=s>r?t.slice(r,s+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
96
|
+
`)&&(n+=s>r?t.slice(r,s+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function jh(t,e){let n="",s=t[e+1];for(;(s===" "||s===" "||s===`
|
|
97
97
|
`||s==="\r")&&!(s==="\r"&&t[e+2]!==`
|
|
98
98
|
`);)s===`
|
|
99
99
|
`&&(n+=`
|
|
100
|
-
`),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var
|
|
101
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
100
|
+
`),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Hh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Yh(t,e,n,s){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}fl.resolveFlowScalar=Kh});var hl=S(pl=>{"use strict";var je=N(),dl=$(),Vh=Wi(),Gh=Qi();function Wh(t,e,n,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Vh.resolveBlockScalar(t,e,s):Gh.resolveFlowScalar(e,t.options.strict,s),l=n?t.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[je.SCALAR]:l?c=Jh(t.schema,i,l,n,s):e.type==="scalar"?c=Qh(t,i,e,s):c=t.schema[je.SCALAR];let d;try{let u=c.resolve(i,f=>s(n??e,"TAG_RESOLVE_FAILED",f),t.options);d=je.isScalar(u)?u:new dl.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(n??e,"TAG_RESOLVE_FAILED",f),d=new dl.Scalar(i)}return d.range=a,d.source=i,r&&(d.type=r),l&&(d.tag=l),c.format&&(d.format=c.format),o&&(d.comment=o),d}function Jh(t,e,n,s,i){if(n==="!")return t[je.SCALAR];let r=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[je.SCALAR])}function Qh({atKey:t,directives:e,schema:n},s,i,r){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(s))||n[je.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[je.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),d=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return o}pl.composeScalar=Wh});var gl=S(ml=>{"use strict";function zh(t,e,n){if(e){n??(n=e.length);for(let s=n-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++s];i?.type==="space";)t+=i.source.length,i=e[++s];break}}return t}ml.emptyScalarPosition=zh});var vl=S(Xi=>{"use strict";var Xh=wt(),Zh=N(),em=ll(),yl=hl(),tm=it(),nm=gl(),sm={composeNode:Sl,composeEmptyNode:zi};function Sl(t,e,n,s){let i=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,c,d=!0;switch(e.type){case"alias":c=im(t,e,s),(a||l)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=yl.composeScalar(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=em.composeCollection(sm,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),d=!1}}return c??(c=zi(t,e.offset,void 0,null,n,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Zh.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&d&&(c.srcToken=e),c}function zi(t,e,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:nm.emptyScalarPosition(e,n,s),indent:-1,source:""},u=yl.composeScalar(t,d,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function im({options:t},{offset:e,source:n,end:s},i){let r=new Xh.Alias(n.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=tm.resolveEnd(s,o,t.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Xi.composeEmptyNode=zi;Xi.composeNode=Sl});var El=S(bl=>{"use strict";var rm=Rt(),wl=vl(),om=it(),am=Ft();function lm(t,e,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},t),l=new rm.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=am.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?wl.composeNode(c,i,d,o):wl.composeEmptyNode(c,d.end,s,null,d,o);let u=l.contents.range[2],f=om.resolveEnd(r,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[n,u,f.offset],l}bl.composeDoc=lm});var er=S(_l=>{"use strict";var cm=we("process"),um=Ks(),fm=Rt(),Ut=Bt(),kl=N(),dm=El(),pm=it();function jt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Al(t){let e="",n=!1,s=!1;for(let i=0;i<t.length;++i){let r=t[i];switch(r[0]){case"#":e+=(e===""?"":s?`
|
|
102
102
|
|
|
103
103
|
`:`
|
|
104
|
-
`)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:e,afterEmptyLine:s}}var
|
|
105
|
-
${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(
|
|
104
|
+
`)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:e,afterEmptyLine:s}}var Zi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=jt(n);r?this.warnings.push(new Ut.YAMLWarning(o,s,i)):this.errors.push(new Ut.YAMLParseError(o,s,i))},this.directives=new um.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:i}=Al(this.prelude);if(s){let r=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
105
|
+
${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(kl.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];kl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
106
106
|
${a}`:s}else{let o=r.commentBefore;r.commentBefore=o?`${s}
|
|
107
|
-
${o}`:s}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
108
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ut.YAMLParseError(jt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),i=new
|
|
107
|
+
${o}`:s}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Al(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,s=-1){for(let i of e)yield*this.next(i);yield*this.end(n,s)}*next(e){switch(cm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,s,i)=>{let r=jt(e);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=dm.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new Ut.YAMLParseError(jt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new Ut.YAMLParseError(jt(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=pm.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
108
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ut.YAMLParseError(jt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),i=new fm.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};_l.Composer=Zi});var Nl=S(es=>{"use strict";var hm=Wi(),mm=Qi(),gm=Bt(),Il=_t();function ym(t,e=!0,n){if(t){let s=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,r,o);else throw new gm.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return mm.resolveFlowScalar(t,e,s);case"block-scalar":return hm.resolveBlockScalar({options:{strict:e}},t,s)}}return null}function Sm(t,e){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=Il.stringifyString({type:o,value:t},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
109
109
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
110
|
-
`),
|
|
111
|
-
`,
|
|
112
|
-
`}),{type:"block-scalar",offset:r,indent:s,props:
|
|
110
|
+
`),d=a.substring(0,c),u=a.substring(c+1)+`
|
|
111
|
+
`,f=[{type:"block-scalar-header",offset:r,indent:s,source:d}];return Ol(f,l)||f.push({type:"newline",offset:-1,indent:s,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:r,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:a,end:l};default:return{type:"scalar",offset:r,indent:s,source:a,end:l}}}function vm(t,e,n={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=n,a="indent"in t?t.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Il.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":wm(t,l);break;case'"':tr(t,l,"double-quoted-scalar");break;case"'":tr(t,l,"single-quoted-scalar");break;default:tr(t,l,"scalar")}}function wm(t,e){let n=e.indexOf(`
|
|
113
113
|
`),s=e.substring(0,n),i=e.substring(n+1)+`
|
|
114
|
-
`;if(t.type==="block-scalar"){let r=t.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,t.source=i}else{let{offset:r}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];
|
|
115
|
-
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function
|
|
116
|
-
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let s="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(t))r!=="type"&&r!=="offset"&&delete t[r];Object.assign(t,{type:n,indent:s,source:e,end:i})}}}
|
|
114
|
+
`;if(t.type==="block-scalar"){let r=t.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,t.source=i}else{let{offset:r}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];Ol(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
115
|
+
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function Ol(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function tr(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let s=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let r of s)r.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:s});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
116
|
+
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let s="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(t))r!=="type"&&r!=="offset"&&delete t[r];Object.assign(t,{type:n,indent:s,source:e,end:i})}}}es.createScalarToken=Sm;es.resolveAsScalar=ym;es.setScalarValue=vm});var Ll=S(Tl=>{"use strict";var bm=t=>"type"in t?ns(t):ts(t);function ns(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=ns(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=ts(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=ts(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=ts(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function ts({start:t,key:e,sep:n,value:s}){let i="";for(let r of t)i+=r.source;if(e&&(i+=ns(e)),n)for(let r of n)i+=r.source;return s&&(i+=ns(s)),i}Tl.stringify=bm});var $l=S(Ml=>{"use strict";var nr=Symbol("break visit"),Em=Symbol("skip children"),Cl=Symbol("remove item");function He(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Pl(Object.freeze([]),t,e)}He.BREAK=nr;He.SKIP=Em;He.REMOVE=Cl;He.itemAtPath=(t,e)=>{let n=t;for(let[s,i]of e){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};He.parentCollection=(t,e)=>{let n=He.itemAtPath(t,e.slice(0,-1)),s=e[e.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Pl(t,e,n){let s=n(e,t);if(typeof s=="symbol")return s;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Pl(Object.freeze(t.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===nr)return nr;a===Cl&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}Ml.visit=He});var ss=S(J=>{"use strict";var sr=Nl(),km=Ll(),Am=$l(),ir="\uFEFF",rr="",or="",ar="",_m=t=>!!t&&"items"in t,Im=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Om(t){switch(t){case ir:return"<BOM>";case rr:return"<DOC>";case or:return"<FLOW_END>";case ar:return"<SCALAR>";default:return JSON.stringify(t)}}function Nm(t){switch(t){case ir:return"byte-order-mark";case rr:return"doc-mode";case or:return"flow-error-end";case ar:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
117
|
`:case`\r
|
|
118
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
119
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
120
|
-
\r `),
|
|
118
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}J.createScalarToken=sr.createScalarToken;J.resolveAsScalar=sr.resolveAsScalar;J.setScalarValue=sr.setScalarValue;J.stringify=km.stringify;J.visit=Am.visit;J.BOM=ir;J.DOCUMENT=rr;J.FLOW_END=or;J.SCALAR=ar;J.isCollection=_m;J.isScalar=Im;J.prettyToken=Om;J.tokenType=Nm});var ur=S(ql=>{"use strict";var Ht=ss();function ee(t){switch(t){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var Dl=new Set("0123456789ABCDEFabcdef"),Tm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),is=new Set(",[]{}"),Lm=new Set(` ,[]{}
|
|
120
|
+
\r `),lr=t=>!t||Lm.has(t),cr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
121
121
|
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
122
122
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+e];if(n==="\r"){let i=this.buffer[s+e+1];if(i===`
|
|
123
123
|
`||!i&&!this.atEnd)return e+s+1}return n===`
|
|
124
124
|
`||s>=this.indentNext||!n&&!this.atEnd?e+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&ee(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
125
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Ht.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,s=e.indexOf("#");for(;s!==-1;){let r=e[s-1];if(r===" "||r===" "){n=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let r=e[n-1];if(r===" "||r===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Ht.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ee(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ee(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ee(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
125
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Ht.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,s=e.indexOf("#");for(;s!==-1;){let r=e[s-1];if(r===" "||r===" "){n=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let r=e[n-1];if(r===" "||r===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Ht.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&ee(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ee(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ee(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(lr),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,s=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&i[0]!=="#"||s===0&&(i.startsWith("---")||i.startsWith("..."))&&ee(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Ht.FLOW_END,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(lr),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ee(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let r=0;for(;this.buffer[n-1-r]==="\\";)r+=1;if(r%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),i=s.indexOf(`
|
|
126
126
|
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
|
|
127
127
|
`,r)}i!==-1&&(n=i-(s[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ee(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case`
|
|
128
128
|
`:e=r,n=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
129
129
|
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
130
130
|
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
131
131
|
`;)s=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
132
|
-
`&&r>=this.pos&&r+1+n>a)e=r;else break}while(!0);return yield Ht.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(ee(r)||e&&
|
|
132
|
+
`&&r>=this.pos&&r+1+n>a)e=r;else break}while(!0);return yield Ht.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(ee(r)||e&&is.has(r))break;n=s}else if(ee(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
|
|
133
133
|
`?(s+=1,i=`
|
|
134
|
-
`,r=this.buffer[s+1]):n=s),r==="#"||e&&
|
|
135
|
-
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&
|
|
134
|
+
`,r=this.buffer[s+1]):n=s),r==="#"||e&&is.has(r))break;if(i===`
|
|
135
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&is.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ht.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(lr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(ee(n)||e&&is.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ee(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Tm.has(n))n=this.buffer[++e];else if(n==="%"&&Dl.has(this.buffer[e+1])&&Dl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
136
136
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
137
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||e&&s===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,s=this.buffer[n];for(;!e(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||e&&s===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,s=this.buffer[n];for(;!e(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};ql.Lexer=cr});var dr=S(Rl=>{"use strict";var fr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,s=this.lineStarts.length;for(;n<s;){let r=n+s>>1;this.lineStarts[r]<e?n=r+1:s=r}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};Rl.LineCounter=fr});var hr=S(Ul=>{"use strict";var Cm=we("process"),xl=ss(),Pm=ur();function Te(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Kl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Fl(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function rs(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function rt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Bl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Te(e.start,"explicit-key-ind")&&!Te(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Fl(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var pr=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Pm.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,n))yield*this.next(s);n||(yield*this.end())}*next(e){if(this.source=e,Cm.env.LOG_TOKENS&&console.log("|",xl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=xl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Bl(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Kl(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<n.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Kl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=rs(this.peek(2)),s=rt(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Te(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(
|
|
139
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Te(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Fl(n.key)&&!Te(n.sep,"newline")){let o=rt(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?n.sep=n.sep.concat(r,this.sourceToken):n.sep.push(this.sourceToken);else if(Te(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=rt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Te(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||n.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Te(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Te(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let i=rs(s),r=rt(i);Bl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
140
140
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
141
|
-
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=
|
|
142
|
-
`).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function
|
|
143
|
-
`);let t=0;for(let e of
|
|
141
|
+
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=rs(e),s=rt(n);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=rs(e),s=rt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Ul.Parser=pr});var Gl=S(Vt=>{"use strict";var jl=er(),Mm=Rt(),Yt=Bt(),$m=Xs(),Dm=N(),qm=dr(),Hl=hr();function Yl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new qm.LineCounter||null,prettyErrors:e}}function Rm(t,e={}){let{lineCounter:n,prettyErrors:s}=Yl(e),i=new Hl.Parser(n?.addNewLine),r=new jl.Composer(e),o=Array.from(r.compose(i.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(Yt.prettifyError(t,n)),a.warnings.forEach(Yt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Vl(t,e={}){let{lineCounter:n,prettyErrors:s}=Yl(e),i=new Hl.Parser(n?.addNewLine),r=new jl.Composer(e),o=null;for(let a of r.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Yt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Yt.prettifyError(t,n)),o.warnings.forEach(Yt.prettifyError(t,n))),o}function xm(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Vl(t,n);if(!i)return null;if(i.warnings.forEach(r=>$m.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function Km(t,e,n){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Dm.isDocument(t)&&!s?t.toString(n):new Mm.Document(t,s,n).toString(n)}Vt.parse=xm;Vt.parseAllDocuments=Rm;Vt.parseDocument=Vl;Vt.stringify=Km});var oe=S(L=>{"use strict";var Bm=er(),Fm=Rt(),Um=$i(),mr=Bt(),jm=wt(),Le=N(),Hm=_e(),Ym=$(),Vm=Oe(),Gm=Ne(),Wm=ss(),Jm=ur(),Qm=dr(),zm=hr(),os=Gl(),Wl=gt();L.Composer=Bm.Composer;L.Document=Fm.Document;L.Schema=Um.Schema;L.YAMLError=mr.YAMLError;L.YAMLParseError=mr.YAMLParseError;L.YAMLWarning=mr.YAMLWarning;L.Alias=jm.Alias;L.isAlias=Le.isAlias;L.isCollection=Le.isCollection;L.isDocument=Le.isDocument;L.isMap=Le.isMap;L.isNode=Le.isNode;L.isPair=Le.isPair;L.isScalar=Le.isScalar;L.isSeq=Le.isSeq;L.Pair=Hm.Pair;L.Scalar=Ym.Scalar;L.YAMLMap=Vm.YAMLMap;L.YAMLSeq=Gm.YAMLSeq;L.CST=Wm;L.Lexer=Jm.Lexer;L.LineCounter=Qm.LineCounter;L.Parser=zm.Parser;L.parse=os.parse;L.parseAllDocuments=os.parseAllDocuments;L.parseDocument=os.parseDocument;L.stringify=os.stringify;L.visit=Wl.visit;L.visitAsync=Wl.visitAsync});import{execFileSync as R}from"node:child_process";import{writeFileSync as Xm,unlinkSync as Zm}from"node:fs";import{resolve as eg}from"node:path";import{tmpdir as tg}from"node:os";function gr(t){try{return R("which",[t],Gt),!0}catch{return!1}}function Jl(t){try{return R("brew",["list",t],Gt),!0}catch{return!1}}function ng(t){try{return R("brew",["services","list"],Gt).split(`
|
|
142
|
+
`).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function Ql(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}async function zl(){console.log(`Checking prerequisites...
|
|
143
|
+
`);let t=0;for(let e of sg){let n=e.required?"":" (optional)";if(await e.check()){console.log(` \u2713 ${e.name}${n}`);continue}console.log(` \u2717 ${e.name}${n} \u2014 installing...`);try{e.install(),await e.check()?console.log(` \u2713 ${e.name} \u2014 installed`):e.required&&(console.error(` \u2717 ${e.name} \u2014 install failed`),t++)}catch(s){e.required?(console.error(` \u2717 ${e.name} \u2014 install failed: ${s}`),t++):console.log(` \u25CB ${e.name} \u2014 skipped (install failed)`)}}t>0&&(console.error(`
|
|
144
144
|
${t} required prerequisite(s) failed. Fix and re-run 'hive init'.`),process.exit(1)),console.log(`
|
|
145
|
-
All prerequisites ready.`)}var Gt,
|
|
145
|
+
All prerequisites ready.`)}var Gt,sg,Xl=O(()=>{"use strict";Gt={encoding:"utf-8",stdio:"pipe"};sg=[{name:"Xcode CLI Tools",required:!0,check:()=>{try{return R("xcode-select",["-p"],Gt),!0}catch{return!1}},install:()=>{console.log(" Installing Xcode CLI Tools (this opens a system dialog)..."),R("xcode-select",["--install"],{stdio:"inherit"}),console.log(" Complete the installation dialog, then re-run 'hive init'."),process.exit(0)}},{name:"Homebrew",required:!0,check:()=>gr("brew"),install:()=>{console.log(" Installing Homebrew...");let t=eg(tg(),"brew-install.sh"),e=R("curl",["-fsSL","https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"],{encoding:"utf-8"});Xm(t,e,{mode:493}),R("/bin/bash",[t],{stdio:"inherit"}),Zm(t)}},{name:"Node.js >= 22",required:!0,check:()=>parseInt(process.versions.node.split(".")[0])>=22,install:()=>{console.log(" Installing Node.js via Homebrew..."),R("brew",["install","node"],{stdio:"inherit"})}},{name:"MongoDB",required:!0,check:()=>ng("mongodb-community"),install:()=>{Jl("mongodb-community")||(console.log(" Tapping mongodb/brew..."),R("brew",["tap","mongodb/brew"],{stdio:"inherit"}),console.log(" Installing mongodb-community..."),R("brew",["install","mongodb-community"],{stdio:"inherit"})),console.log(" Starting MongoDB..."),R("brew",["services","start","mongodb-community"],{stdio:"inherit"})}},{name:"Ollama",required:!0,check:()=>Ql("http://127.0.0.1:11434/api/tags"),install:()=>{console.log(" Installing Ollama..."),R("brew",["install","ollama"],{stdio:"inherit"}),R("brew",["services","start","ollama"],{stdio:"inherit"})}},{name:"Ollama models (bge-large, gemma4:e4b)",required:!0,check:()=>{if(!gr("ollama"))return!1;try{let t=R("ollama",["list"],Gt);return t.includes("bge-large")&&t.includes("gemma4:e4b")}catch{return!1}},install:()=>{console.log(" \u26A0 Pulling Ollama models \u2014 ~10 GB total, several minutes on first run."),console.log(" Pulling bge-large (~670 MB)..."),R("ollama",["pull","bge-large"],{stdio:"inherit"}),console.log(" Pulling gemma4:e4b (~9.6 GB)..."),R("ollama",["pull","gemma4:e4b"],{stdio:"inherit"})}},{name:"Qdrant",required:!0,check:()=>Ql("http://127.0.0.1:6333/"),install:()=>{Jl("qdrant")||(console.log(" Installing Qdrant..."),R("brew",["install","qdrant/tap/qdrant"],{stdio:"inherit"})),console.log(" Starting Qdrant..."),R("brew",["services","start","qdrant"],{stdio:"inherit"})}},{name:"gh CLI",required:!1,check:()=>gr("gh"),install:()=>{console.log(" Installing gh CLI..."),R("brew",["install","gh"],{stdio:"inherit"})}}]});import{existsSync as as,mkdirSync as yr,statSync as ig}from"node:fs";import{execFileSync as Zl}from"node:child_process";import{resolve as Wt,dirname as rg}from"node:path";function ec(t,e,n={}){let s=Wt(e,".hive");if(as(s))throw new Error(`Engine already populated at ${s}. If this is a resume after an interrupted init, rm -rf ${s} and re-run 'hive init'. populateEngine does not silently overwrite.`);yr(s,{recursive:!0});for(let i of og){let r=Wt(t,i);if(!as(r))continue;let o=Wt(s,i);yr(rg(o),{recursive:!0});let a=ig(r).isDirectory(),l=a?`${r}/`:r,c=a?`${o}/`:o;a&&yr(o,{recursive:!0}),Zl("rsync",["-a",l,c])}n.skipInstall||Sr(s)}function Sr(t){as(Wt(t,"package.json"))&&(as(Wt(t,"node_modules"))||Zl("npm",["install","--omit=dev","--no-audit","--no-fund","--no-progress"],{cwd:t,stdio:"inherit"}))}var og,tc=O(()=>{"use strict";og=["pkg","seeds","templates","scripts/honeypot","install","service","package.json"]});function vr(t,e){let n=e.split("."),s=t;for(let i of n)if(s=s?.[i],s===void 0)return;return s}function nc(t){return t!=null&&t!==""&&t!==!1}function sc(t,e){let n=!0;for(;n;)n=!1,t=t.replace(/\{\{#([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>i==="sms_section"?s:(n=!0,nc(vr(e,i))?r:"")),t=t.replace(/\{\{\^([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>(n=!0,nc(vr(e,i))?"":r));return t=t.replace(/\{\{([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}/g,(s,i)=>{let r=vr(e,i);return r===void 0?s:String(r)}),t}var ic=O(()=>{"use strict"});var cs={};Q(cs,{buildPlist:()=>cc,getInstanceId:()=>ac,getLabel:()=>Qt,getLaunchAgentLink:()=>br,getPlistPath:()=>lc,startDaemon:()=>ug,stopDaemon:()=>fg});import{execFileSync as ls}from"node:child_process";import{existsSync as Jt,readFileSync as ag,writeFileSync as lg,mkdirSync as wr,symlinkSync as cg,unlinkSync as rc}from"node:fs";import{resolve as ae}from"node:path";function ac(t){let e=ae(t,process.env.HIVE_CONFIG??"hive.yaml");return Jt(e)?((0,oc.parse)(ag(e,"utf-8"))??{}).instance?.id??"hive":"hive"}function Qt(t){return`com.hive.${ac(t)}.agent`}function lc(t){return ae(t,"service",`${Qt(t)}.plist`)}function br(t){let e=process.env.HOME??"/tmp";return ae(e,"Library","LaunchAgents",`${Qt(t)}.plist`)}function cc(t){let{label:e,nodePath:n,serverPath:s,hiveHome:i,home:r,pathEnv:o,logsDir:a}=t;return`<?xml version="1.0" encoding="UTF-8"?>
|
|
146
146
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
147
147
|
<plist version="1.0">
|
|
148
148
|
<dict>
|
|
@@ -186,69 +186,69 @@ All prerequisites ready.`)}var Gt,eg,Ql=O(()=>{"use strict";Gt={encoding:"utf-8"
|
|
|
186
186
|
<string>${a}/hive.err</string>
|
|
187
187
|
</dict>
|
|
188
188
|
</plist>
|
|
189
|
-
`}async function
|
|
190
|
-
`)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s===-1)continue;let i=n.slice(0,s),r=n.slice(s+1);t[i]=r}return t}function zt(t){let e=["# Hive environment \u2014 generated by setup wizard","# Secrets and API keys. Do not commit this file.",""],n=[{header:"# Slack",keys:["SLACK_APP_TOKEN","SLACK_BOT_TOKEN","SLACK_MCP_TOKEN"]},{header:"# Anthropic",keys:["ANTHROPIC_API_KEY"]},{header:"# SMS (Quo/OpenPhone)",keys:["QUO_API_KEY","QUO_PHONE_NUMBER_ID"]},{header:"# Google",keys:["GOOGLE_ACCOUNT"]},{header:"# Project Management",keys:["LINEAR_API_KEY","CLICKUP_API_TOKEN"]},{header:"# External Communications",keys:["EXTERNAL_COMMS_ENABLED"]}],s=new Set;for(let i of n){let r=[];for(let o of i.keys){s.add(o);let a=t[o];a?r.push(`${o}=${a}`):r.push(`# ${o}=`)}r.some(o=>!o.startsWith("#"))&&(e.push(i.header),e.push(...r),e.push(""))}for(let[i,r]of Object.entries(t))!s.has(i)&&r&&e.push(`${i}=${r}`);
|
|
189
|
+
`}async function ug(t){let e=Qt(t),n=lc(t),s=br(t),i=ae(t,"service"),r=ae(t,"logs"),o=ae(t,".hive");wr(i,{recursive:!0}),wr(r,{recursive:!0});let a=ls("which",["node"],{encoding:"utf-8"}).trim(),l=Jt(ae(o,"pkg","server.min.js"))?ae(o,"pkg","server.min.js"):ae(o,"dist","index.js"),c=process.env.HOME??"/tmp",d=process.env.PATH??"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",u=cc({label:e,nodePath:a,serverPath:l,hiveHome:t,home:c,pathEnv:d,logsDir:r});lg(n,u),console.log(`Generated plist: ${n}`);let f=ae(s,"..");wr(f,{recursive:!0}),Jt(s)&&rc(s),cg(n,s);try{ls("launchctl",["unload",s],{stdio:"pipe"})}catch{}try{ls("launchctl",["load",s],{stdio:"inherit"}),console.log(`Started ${e}`)}catch{throw new Error(`Failed to start ${e}. Check: launchctl list | grep hive`)}}async function fg(t){let e=br(t),n=Qt(t);if(!Jt(e)){console.log(`No LaunchAgent found for ${n}`);return}try{ls("launchctl",["unload",e],{stdio:"inherit"}),console.log(`Stopped ${n}`)}catch{console.error(`Failed to stop ${n}`)}try{Jt(e)&&rc(e),console.log(`Removed ${e}`)}catch{}}var oc,us=O(()=>{"use strict";oc=te(oe(),1)});var Ac={};Q(Ac,{runWizard:()=>mg});import{createInterface as dg}from"node:readline";import{readFileSync as ot,writeFileSync as wc,existsSync as j,readdirSync as pg}from"node:fs";import{execFileSync as H}from"node:child_process";import{resolve as me,join as U}from"node:path";import{MongoClient as Er}from"mongodb";function C(t,e=""){let n=e?`${t} [${e}]: `:`${t}: `;return new Promise(s=>{bc.question(n,i=>{s(i.trim()||e)})})}async function K(t,e=!0){return(await C(`${t} (${e?"Y/n":"y/N"})`,e?"y":"n")).toLowerCase().startsWith("y")}function hg(){console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive Setup Wizard \u2551"),console.log("\u2551 Multi-Agent Slack Orchestration Framework \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log("")}function X(t){console.log(""),console.log(`\u2500\u2500 ${t} ${"\u2500".repeat(Math.max(0,44-t.length))}`),console.log("")}function Ec(){if(!j(fs))return{};let t={};for(let e of ot(fs,"utf-8").split(`
|
|
190
|
+
`)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s===-1)continue;let i=n.slice(0,s),r=n.slice(s+1);t[i]=r}return t}function zt(t){let e=["# Hive environment \u2014 generated by setup wizard","# Secrets and API keys. Do not commit this file.",""],n=[{header:"# Slack",keys:["SLACK_APP_TOKEN","SLACK_BOT_TOKEN","SLACK_MCP_TOKEN"]},{header:"# Anthropic",keys:["ANTHROPIC_API_KEY"]},{header:"# SMS (Quo/OpenPhone)",keys:["QUO_API_KEY","QUO_PHONE_NUMBER_ID"]},{header:"# Google",keys:["GOOGLE_ACCOUNT"]},{header:"# Project Management",keys:["LINEAR_API_KEY","CLICKUP_API_TOKEN"]},{header:"# External Communications",keys:["EXTERNAL_COMMS_ENABLED"]}],s=new Set;for(let i of n){let r=[];for(let o of i.keys){s.add(o);let a=t[o];a?r.push(`${o}=${a}`):r.push(`# ${o}=`)}r.some(o=>!o.startsWith("#"))&&(e.push(i.header),e.push(...r),e.push(""))}for(let[i,r]of Object.entries(t))!s.has(i)&&r&&e.push(`${i}=${r}`);wc(fs,e.join(`
|
|
191
191
|
`)+`
|
|
192
|
-
`)}function
|
|
193
|
-
`),await K("Enable SMS via Quo (OpenPhone)?",!1)){console.log("Get your API key from: Quo workspace settings \u2192 API tab"),i.QUO_API_KEY=await C("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await C("Default Phone Number ID (PNxxx)",i.QUO_PHONE_NUMBER_ID||"");let p=[],y={};if(await K("Configure named phone lines?",!1)){let m=!0;for(;m;){let w=await C("Line name (e.g. main, personal)"),b=await C("Phone Number ID (PNxxx)"),A=await C("Phone number (e.g. (555) 123-4567)"),_=await C("Label (e.g. Jane's Line)"),
|
|
192
|
+
`)}function kc(){return j(ds)?(0,at.parse)(ot(ds,"utf-8"))??{}:{}}function Xt(t){wc(ds,(0,at.stringify)(t))}function uc(t){return!!(t.business?.name&&t.business?.owner?.name)}function fc(t){return!!(t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)}async function dc(){let t=process.env.MONGODB_DB;if(!t)return!1;try{let e=new Er(process.env.MONGODB_URI??"mongodb://localhost:27017");await e.connect();let s=await e.db(t).collection("agent_definitions").findOne({_id:"chief-of-staff"});return await e.close(),!!s}catch{return!1}}function pc(t){return j(me(import.meta.dirname,"..","pkg","server.min.js"))?!0:j(me(t,"dist","index.js"))}async function mg(t,e,n){fs=U(t,".env"),ds=U(t,"hive.yaml");let s=j(me(n,"pkg","server.min.js"));hg();let i=Ec(),r=kc(),o=r.instance?.id;o||(console.error("Error: hive.yaml is missing instance.id. Re-run 'hive init'."),process.exit(1)),process.env.MONGODB_DB||(process.env.MONGODB_DB=`hive_${o}`);let a=[];if(uc(r)&&a.push("Business info"),fc(i)&&a.push("Slack"),await dc()&&a.push("Agent setup"),pc(t)&&a.push("Build"),a.length>0){console.log("Resuming setup. Already completed:");for(let p of a)console.log(` \u2713 ${p}`);console.log("")}else console.log("This wizard will configure Hive for your business."),console.log("Progress is saved after each section \u2014 you can quit and resume anytime."),console.log(""),await C("Press Enter to begin...");if(uc(r)?(console.log(`Business: ${r.business.name} (${r.business.owner.name}, ${r.business.owner.role})`),await K("Redo business info?",!1)?await hc(r):console.log(" \u2713 Skipped")):await hc(r),fc(i)?(console.log("Slack: \u2713 tokens configured"),await K("Redo Slack setup?",!1)?await mc(i,n):console.log(" \u2713 Skipped")):await mc(i,n),X("Anthropic"),i.ANTHROPIC_API_KEY?(console.log("Anthropic API key: \u2713 configured"),await K("Change it?",!1)?await gc(i):console.log(" \u2713 Skipped")):(console.log("Your Claude CLI session is already authenticated \u2014 Hive's Agent SDK"),console.log("will use that automatically. No API key needed."),console.log(""),await K("Use a separate API key instead?",!1)?await gc(i):(console.log(" \u2713 Using existing Claude authentication"),zt(i))),X("Optional Integrations"),console.log(`These can be added later. Press Enter to skip any.
|
|
193
|
+
`),await K("Enable SMS via Quo (OpenPhone)?",!1)){console.log("Get your API key from: Quo workspace settings \u2192 API tab"),i.QUO_API_KEY=await C("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await C("Default Phone Number ID (PNxxx)",i.QUO_PHONE_NUMBER_ID||"");let p=[],y={};if(await K("Configure named phone lines?",!1)){let m=!0;for(;m;){let w=await C("Line name (e.g. main, personal)"),b=await C("Phone Number ID (PNxxx)"),A=await C("Phone number (e.g. (555) 123-4567)"),_=await C("Label (e.g. Jane's Line)"),k=await C("Slack channel for incoming SMS",`sms-${w}`);y[w]={id:b,number:A,label:_},p.push({id:b,label:_,number:A,slackChannel:k}),m=await K("Add another line?",!1)}}p.length>0&&(r.sms={lines:p}),Object.keys(y).length>0&&(r.quo={lines:y})}if(await K("Enable Google Gmail/Calendar integration?",!1)){let p=!1;try{H("which",["gog"],{stdio:"pipe"}),p=!0,console.log(" \u2713 gog CLI found")}catch{console.log(" gog CLI not found. Installing via Homebrew...");try{H("brew",["install","gog"],{stdio:"inherit"}),p=!0,console.log(" \u2713 gog CLI installed")}catch{console.log(" \u26A0 Failed to install gog. Install manually: brew install gog")}}if(p){try{let h=H("gog",["auth","list"],{encoding:"utf-8",stdio:"pipe"}).trim();h&&!h.includes("no accounts")&&(console.log(`
|
|
194
194
|
Authenticated accounts:`),console.log(` ${h.replace(/\n/g,`
|
|
195
195
|
`)}`))}catch{}if(console.log(""),await K("Authenticate a Google account now?",!0)){let h=!0;for(;h;){let m=await C("Google account email");console.log(`
|
|
196
196
|
Opening browser for ${m}...`),console.log(` Complete the OAuth flow in your browser, then come back here.
|
|
197
197
|
`);try{H("gog",["auth","add",m],{stdio:"inherit"}),console.log(` \u2713 ${m} authenticated`)}catch{console.log(` \u26A0 Authentication failed for ${m}. You can retry later: gog auth add ${m}`)}h=await K("Authenticate another Google account?",!1)}}if(i.GOOGLE_ACCOUNT=await C("Primary Google account for Hive",i.GOOGLE_ACCOUNT||""),i.GOOGLE_ACCOUNT)try{H("gog",["gmail","search","is:unread","-a",i.GOOGLE_ACCOUNT,"--json","--results-only","--no-input"],{encoding:"utf-8",timeout:15e3}),console.log(` \u2713 Gmail access verified for ${i.GOOGLE_ACCOUNT}`)}catch{console.log(" \u26A0 Could not verify Gmail access \u2014 check authentication later")}}}if(await K("Enable project management integration?",!1)){let p=await C("Which system? (linear / clickup)","");p.toLowerCase().startsWith("l")?(i.LINEAR_API_KEY=await C("Linear API Key",i.LINEAR_API_KEY||""),console.log(" Get it from: Linear \u2192 Settings \u2192 API \u2192 Personal API Keys")):p.toLowerCase().startsWith("c")?(i.CLICKUP_API_TOKEN=await C("ClickUp API Token",i.CLICKUP_API_TOKEN||""),console.log(" Get it from: ClickUp \u2192 Settings \u2192 Apps \u2192 API Token")):console.log(" Skipped \u2014 you can configure this in .env later.")}zt(i),Xt(r),console.log(`
|
|
198
|
-
\u2713 Configuration saved (.env + hive.yaml)`),X("Plugins");let u=U(t,"plugins");if(j(u)){let p=
|
|
199
|
-
`);for(let m of p){let w=(0,at.parse)(ot(U(u,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${w.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",h=await C("Which plugins to enable? (comma-separated, or 'none')",y);h.toLowerCase()!=="none"?r.plugins=h.split(",").map(m=>m.trim()).filter(Boolean):r.plugins=[]}else console.log("No plugins found in plugins/ directory."),r.plugins=[]}else console.log("No plugins/ directory found."),r.plugins=[];if(Xt(r),await
|
|
200
|
-
Chief of Staff agent: \u2713 already set up`),await K("Regenerate agent from template?",!1)?await
|
|
201
|
-
\u2713 Business info saved (hive.yaml)`)}async function
|
|
198
|
+
\u2713 Configuration saved (.env + hive.yaml)`),X("Plugins");let u=U(t,"plugins");if(j(u)){let p=pg(u).filter(y=>j(U(u,y,"plugin.yaml")));if(p.length>0){console.log(`Available plugins:
|
|
199
|
+
`);for(let m of p){let w=(0,at.parse)(ot(U(u,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${w.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",h=await C("Which plugins to enable? (comma-separated, or 'none')",y);h.toLowerCase()!=="none"?r.plugins=h.split(",").map(m=>m.trim()).filter(Boolean):r.plugins=[]}else console.log("No plugins found in plugins/ directory."),r.plugins=[]}else console.log("No plugins/ directory found."),r.plugins=[];if(Xt(r),await dc()?(console.log(`
|
|
200
|
+
Chief of Staff agent: \u2713 already set up`),await K("Regenerate agent from template?",!1)?await yc(r):console.log(" \u2713 Skipped")):await yc(r),await gg(r),X("Memory (MongoDB)"),await yg(r,e),s||(X("Build"),pc(t)?(console.log("Build output exists."),await K("Rebuild?",!0)?await Sc(n):console.log(" \u2713 Skipped")):await Sc(n)),!s){X("Deploy");let p=U(process.env.HOME??"/tmp","services","hive");j(U(p,"package.json"))?(console.log(`Deploy directory exists: ${p}`),await K("Sync latest build and config?",!0)?await vc(p,n):console.log(" \u2713 Skipped")):(console.log("Hive runs from a separate deploy directory (not this dev repo)."),console.log(` Dev: ${n}`),console.log(` Deploy: ${p}`),console.log(""),await K("Set up the deploy directory now?",!0)&&await vc(p,n))}if(s){X("Engine");let p=me(t,".hive");j(p)?(Sr(p),console.log(` \u2713 Engine already populated at ${p} (deps verified)`)):(ec(n,t),console.log(` \u2713 Engine populated at ${p}`))}if(X("Service"),await K("Install Hive as a LaunchAgent (starts on login)?"))try{let{startDaemon:p}=await Promise.resolve().then(()=>(us(),cs));await p(t)}catch(p){console.log(` \u26A0 Service installation failed: ${p}`),console.log(" You can start manually: hive start")}console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive is ready! \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log(""),console.log("Quick reference:"),console.log(` Config dir: ${t}`),console.log(" Start: hive start"),console.log(" Daemon: hive start --daemon"),console.log(" Stop: hive stop"),console.log(" Health: hive doctor"),s||console.log(` Dev mode: npm run dev (from ${n})`),console.log(""),console.log("Your chief-of-staff agent is stored in the agent_definitions collection."),console.log("Additional agents can be created through the chief of staff."),console.log(""),bc.close()}async function hc(t){X("Your Business");let e=await C("Business name",t.business?.name||""),n=await C("What does your business do? (one sentence)",t.business?.description||""),s=await C("Location (city, state)",t.business?.location||""),i=await C("Timezone (e.g. America/New_York)",t.business?.timezone||""),r=await C("Business hours (e.g. 9 AM - 5 PM)",t.business?.businessHours||"9 AM - 5 PM"),o=await C("Your name",t.business?.owner?.name||""),a=await C("Your role",t.business?.owner?.role||"CEO");t.business={name:e,description:n,...s?{location:s}:{},...i?{timezone:i}:{},businessHours:r,owner:{name:o,role:a}},Xt(t),console.log(`
|
|
201
|
+
\u2713 Business info saved (hive.yaml)`)}async function mc(t,e){X("Slack App Setup"),console.log("You need a Slack app with Socket Mode enabled."),console.log(""),console.log("1. Go to: https://api.slack.com/apps");try{H("open",["https://api.slack.com/apps"],{stdio:"pipe"})}catch{}console.log('2. Click "Create New App" \u2192 "From a manifest"'),console.log("3. Select your workspace"),console.log("4. Choose YAML format and paste this manifest:"),console.log(""),console.log("\u2500\u2500\u2500 Copy everything below this line \u2500\u2500\u2500");let n=j(me(e,"pkg","setup","slack-manifest.yaml"))?me(e,"pkg","setup","slack-manifest.yaml"):me(e,"setup","slack-manifest.yaml");if(console.log(ot(n,"utf-8")),console.log("\u2500\u2500\u2500 Copy everything above this line \u2500\u2500\u2500"),console.log(""),console.log('5. Click "Create"'),console.log('6. Go to "Install App" \u2192 Install to workspace'),console.log(""),await C("Press Enter when your app is created and installed..."),console.log(""),console.log("Now collect your tokens:"),console.log(""),console.log('App-Level Token: Go to "Basic Information" \u2192 "App-Level Tokens"'),console.log(' \u2192 "Generate Token and Scopes" \u2192 add scope "connections:write"'),t.SLACK_APP_TOKEN=await C("App-Level Token (xapp-...)",t.SLACK_APP_TOKEN||""),console.log(""),console.log('Bot Token: Go to "OAuth & Permissions" \u2192 "Bot User OAuth Token"'),t.SLACK_BOT_TOKEN=await C("Bot Token (xoxb-...)",t.SLACK_BOT_TOKEN||""),console.log(""),await K("Do you have a Slack MCP user token (xoxp-...)? (for Slack search)",!1)&&(t.SLACK_MCP_TOKEN=await C("Slack MCP Token (xoxp-...)",t.SLACK_MCP_TOKEN||"")),t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)try{let r=await(await fetch("https://slack.com/api/auth.test",{headers:{Authorization:`Bearer ${t.SLACK_BOT_TOKEN}`}})).json();r.ok?console.log(`
|
|
202
202
|
\u2713 Slack connected as: ${r.user} in ${r.team}`):(console.log(`
|
|
203
203
|
\u26A0 Slack token test failed: ${r.error}`),console.log(" You can fix this in .env later."))}catch{console.log(`
|
|
204
|
-
\u26A0 Could not validate Slack token (no network?)`)}zt(t);try{t.SLACK_APP_TOKEN&&H("honeypot",["set","SLACK_APP_TOKEN",t.SLACK_APP_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_BOT_TOKEN&&H("honeypot",["set","SLACK_BOT_TOKEN",t.SLACK_BOT_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_MCP_TOKEN&&H("honeypot",["set","SLACK_MCP_TOKEN",t.SLACK_MCP_TOKEN],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Slack tokens saved (.env)")}async function
|
|
205
|
-
`);let e=await C("Name your Chief of Staff","Chief"),n=await C("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},Xt(t);let s=me(
|
|
204
|
+
\u26A0 Could not validate Slack token (no network?)`)}zt(t);try{t.SLACK_APP_TOKEN&&H("honeypot",["set","SLACK_APP_TOKEN",t.SLACK_APP_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_BOT_TOKEN&&H("honeypot",["set","SLACK_BOT_TOKEN",t.SLACK_BOT_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_MCP_TOKEN&&H("honeypot",["set","SLACK_MCP_TOKEN",t.SLACK_MCP_TOKEN],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Slack tokens saved (.env)")}async function gc(t){console.log("Get your API key from: https://console.anthropic.com/settings/keys"),console.log(""),t.ANTHROPIC_API_KEY=await C("Anthropic API Key (sk-ant-...)",t.ANTHROPIC_API_KEY||""),zt(t);try{t.ANTHROPIC_API_KEY&&H("honeypot",["set","ANTHROPIC_API_KEY",t.ANTHROPIC_API_KEY],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Anthropic key saved (.env)")}async function yc(t){X("Chief of Staff Agent"),console.log("Hive starts with a Chief of Staff \u2014 your primary agent."),console.log(`Additional agents are created through it as needed.
|
|
205
|
+
`);let e=await C("Name your Chief of Staff","Chief"),n=await C("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},Xt(t);let s=me(oo,"chief-of-staff","agent.yaml");if(!j(s)){console.log(` \u26A0 Seed not found: ${s}`),console.log(" You can seed the agent manually later.");return}let i=(0,at.parse)(ot(s,"utf-8"));i.name=e,i.channels=[n];let r=process.env.MONGODB_URI||"mongodb://localhost:27017",a=kc().instance?.id??"hive",l=process.env.MONGODB_DB||`hive_${a}`;try{let c=new Er(r);await c.connect();let u=c.db(l).collection("agent_definitions");if(await u.findOne({_id:i._id}))console.log(` Agent "${i._id}" already exists in DB \u2014 updating name and channel.`),await u.updateOne({_id:i._id},{$set:{name:e,channels:[n],updatedAt:new Date,updatedBy:"setup-wizard"}});else{let p=new Date;await u.insertOne({...i,createdAt:p,updatedAt:p,updatedBy:"setup-wizard"})}await c.close(),console.log(` \u2713 ${e} (Chief of Staff) seeded to MongoDB`)}catch(c){console.log(` \u26A0 Failed to seed agent: ${c}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function gg(t){X("Constitution \u2014 Chief of Staff Permissions");let e=t.agents?.["chief-of-staff"]?.name??"Chief of Staff",n=t.business?.owner?.name??"you",s=Object.keys(t.agents??{}).length>1;console.log("The constitution defines what your agents can and can't do."),console.log(`Since ${e} is your only agent right now, we need to decide`),console.log(`what permissions to grant.
|
|
206
206
|
`),t.constitution||(t.constitution={}),console.log("\u2500\u2500 Agent definitions (agent_definitions collection)"),console.log(`${e} can create new agents, edit their personality and config,`),console.log(`and manage the team roster.
|
|
207
207
|
`),t.constitution.cosCanManageAgents=!0,console.log(` \u2713 ${e} can manage agent definitions
|
|
208
208
|
`),console.log(`
|
|
209
209
|
\u2500\u2500 External communications (email, SMS)`),console.log("This is a hard gate \u2014 when off, email and SMS tools are completely"),console.log(`removed from all agents. Not just a policy, they literally can't send.
|
|
210
210
|
`),console.log("Default: OFF. You can enable later by setting EXTERNAL_COMMS_ENABLED=true"),console.log(`in .env and restarting Hive.
|
|
211
|
-
`),t.constitution.cosCanContactExternal=await K("Enable external communications now?",!1);let i=
|
|
211
|
+
`),t.constitution.cosCanContactExternal=await K("Enable external communications now?",!1);let i=Ec();t.constitution.cosCanContactExternal?(i.EXTERNAL_COMMS_ENABLED="true",console.log(" \u2713 External comms enabled \u2014 email/SMS tools available"),console.log(` (sensitive topics still escalate to ${n} per constitution)`)):(i.EXTERNAL_COMMS_ENABLED="",console.log(" \u2717 External comms disabled \u2014 no agent can send email or SMS"),console.log(" To enable later: set EXTERNAL_COMMS_ENABLED=true in .env")),zt(i),console.log(`
|
|
212
212
|
\u2500\u2500 Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(" Agent management: \u2713 yes"),console.log(` External communications: ${t.constitution.cosCanContactExternal?"\u2713 yes":"\u2717 no"}`),console.log(" Hive build & deploy: \u2717 no (external provisioning only)"),console.log(" Hive source code: \u2717 no (external provisioning only)"),Xt(t),console.log(`
|
|
213
|
-
\u2713 Constitution preferences saved (hive.yaml)`)}async function
|
|
213
|
+
\u2713 Constitution preferences saved (hive.yaml)`)}async function yg(t,e){let n=process.env.MONGODB_URI||"mongodb://localhost:27017",s=process.env.MONGODB_DB;console.log("Seeding shared memory to MongoDB...");try{let i=new Er(n);await i.connect();let o=i.db(s).collection("memory");await o.createIndex({path:1},{unique:!0});let a=t.business??{},l=[`# Business Context
|
|
214
214
|
`,`**Company:** ${a.name??""}`,`**About:** ${a.description??""}`,a.location?`**Location:** ${a.location}`:"",a.timezone?`**Timezone:** ${a.timezone}`:"",a.businessHours?`**Business Hours:** ${a.businessHours}${a.timezone?` (${a.timezone})`:""}`:"",`**Owner:** ${a.owner?.name??""} (${a.owner?.role??""})`,"","## Additional Context","(Add more details about your business here \u2014 products, services, team, etc.)"].filter(Boolean).join(`
|
|
215
|
-
`);await o.updateOne({path:"shared/business-context.md"},{$set:{content:l,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/business-context.md");let c="<!-- SECTION 2: OPERATIONAL -->",
|
|
216
|
-
\u2713 Deploy directory ready: ${t}`)}var at,
|
|
217
|
-
`);let n=await
|
|
218
|
-
An existing hive install was found at ${o}. Aborting to avoid clobbering.`),console.error(`If you want to reconfigure that instance, run: hive init --config ${o}/hive.yaml`),process.exit(1)),
|
|
215
|
+
`);await o.updateOne({path:"shared/business-context.md"},{$set:{content:l,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/business-context.md");let c="<!-- SECTION 2: OPERATIONAL -->",d=U(e,"constitution-bootstrap.md.tpl");if(j(d)){let u=ot(d,"utf-8"),f=sc(u,{business:a}),p=await o.findOne({path:"shared/constitution.md"}),y;if(p){let h=p.content.indexOf(c);if(h!==-1){let m=p.content.slice(h),w=f.indexOf(c);w===-1?y=f:y=f.slice(0,w)+m}else y=f}else y=f;await o.updateOne({path:"shared/constitution.md"},{$set:{content:y,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/constitution.md")}await i.close(),console.log(" \u2713 Memory seeded to MongoDB")}catch(i){console.log(` \u26A0 Failed to seed memory: ${i}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function Sc(t){console.log(" Compiling TypeScript...");try{H("npm",["run","build"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Build complete")}catch(e){console.log(" \u26A0 Build failed:"),console.log(String(e))}}async function vc(t,e){let{mkdirSync:n}=await import("node:fs");if(j(U(t,"package.json"))){console.log(" Pulling latest...");try{H("git",["pull","--ff-only"],{cwd:t,stdio:"inherit"})}catch{console.log(" \u26A0 git pull failed \u2014 continuing with existing code")}}else{console.log(" Cloning repository...");let o=me(t,"..");n(o,{recursive:!0});let a=H("git",["remote","get-url","origin"],{cwd:e,encoding:"utf-8"}).trim();H("git",["clone",a,t],{stdio:"inherit"}),console.log(" \u2713 Repository cloned")}console.log(" Installing production dependencies..."),H("npm",["install","--omit=dev"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Dependencies installed"),console.log(" Syncing config and build output...");let s=U(e,".env");if(j(s)){let{copyFileSync:o}=await import("node:fs");o(s,U(t,".env")),console.log(" \u2713 .env")}let i=U(e,"hive.yaml");if(j(i)){let{copyFileSync:o}=await import("node:fs");o(i,U(t,"hive.yaml")),console.log(" \u2713 hive.yaml")}let r=U(e,"dist");j(r)&&(H("rsync",["-a","--delete",`${r}/`,`${U(t,"dist")}/`],{stdio:"pipe"}),console.log(" \u2713 dist/")),n(U(t,"logs"),{recursive:!0}),console.log(`
|
|
216
|
+
\u2713 Deploy directory ready: ${t}`)}var at,fs,ds,bc,_c=O(()=>{"use strict";at=te(oe(),1);tc();ic();G();fs="",ds="",bc=dg({input:process.stdin,output:process.stdout})});var Oc={};Q(Oc,{runSetupWizard:()=>Tg});import{mkdirSync as Sg,existsSync as Ce,readFileSync as Ic,writeFileSync as vg,readdirSync as wg}from"node:fs";import{resolve as Pe,join as lt}from"node:path";import{createInterface as bg}from"node:readline";import{execFileSync as Eg}from"node:child_process";function Ag(t){try{return Eg("lsof",["-iTCP:"+t,"-sTCP:LISTEN","-t"],{stdio:["ignore","pipe","ignore"],encoding:"utf-8"}).trim().length>0}catch(e){return e.code==="ENOENT",!1}}function _g(t){let e=new Set,n=Pe(t,"services","hive");if(Ce(n))for(let s of wg(n)){let i=lt(n,s,"hive.yaml");if(Ce(i))try{let o=((0,Zt.parse)(Ic(i,"utf-8"))??{})?.instance?.portBase;e.add(typeof o=="number"?o:3100)}catch{}}for(let s=3100;s<3900;s+=100){if(e.has(s))continue;let i=!1;for(let r=0;r<kg;r++)if(Ag(s+r)){i=!0;break}if(!i)return s}return 3100}function Ig(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function kr(t,e,n=""){let s=n?`${e} [${n}]: `:`${e}: `;return new Promise(i=>t.question(s,r=>i(r.trim()||n)))}async function Og(t){let e=bg({input:process.stdin,output:process.stdout});try{console.log(`\u2500\u2500 Where to install \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
217
|
+
`);let n=await kr(e,"Business name (e.g. your company)");n||(console.error("Business name is required."),process.exit(1));let s=Ig(n)||"hive",i=await kr(e,"Instance ID (short slug, used for the mongo db name)",s),r=Pe(t,"services","hive",i),o=Pe(await kr(e,"Install location",r));Ce(lt(o,"hive.yaml"))&&(console.error(`
|
|
218
|
+
An existing hive install was found at ${o}. Aborting to avoid clobbering.`),console.error(`If you want to reconfigure that instance, run: hive init --config ${o}/hive.yaml`),process.exit(1)),Sg(o,{recursive:!0});let a=_g(t),l={instance:{id:i,type:"business",portBase:a},business:{name:n}};return vg(lt(o,"hive.yaml"),(0,Zt.stringify)(l)),console.log(`
|
|
219
219
|
\u2713 Created ${o}/hive.yaml (instance.id: ${i}, portBase: ${a})
|
|
220
|
-
`),o}finally{e.close()}}function
|
|
220
|
+
`),o}finally{e.close()}}function Ng(){if(process.env.HIVE_HOME){let e=Pe(process.env.HIVE_HOME);return Ce(lt(e,"hive.yaml")),e}if(Ce(Pe(process.cwd(),"hive.yaml")))return process.cwd();let t=se();return Ce(lt(t,"hive.yaml"))?t:null}async function Tg(t){console.log(`
|
|
221
221
|
Hive Setup Wizard
|
|
222
|
-
`),await
|
|
223
|
-
`);let r=lt(s,"hive.yaml");Ce(r)&&(((0,Zt.parse)(
|
|
224
|
-
`).find(o=>o.includes(s));if(r){let o=r.trim().split(/\s+/),a=o[0],l=o[1];console.log(`Service: running (PID ${a}, last exit ${l})`)}else console.log("Service: not running")}catch{console.log("Service: unknown (could not query launchctl)")}try{
|
|
225
|
-
`).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function
|
|
226
|
-
`);let s;for(;(s=
|
|
227
|
-
`),r=r.replace(/\\r/g,"\r")),e[i]=r}return e}function ey(t){t=t||{};let e=ru(t);t.path=e;let n=x.configDotenv(t);if(!n.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let s=iu(t).split(","),i=s.length,r;for(let o=0;o<i;o++)try{let a=s[o].trim(),l=ny(n,a);r=x.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return x.parse(r)}function ty(t){console.error(`\u26A0 ${t}`)}function tn(t){console.log(`\u2506 ${t}`)}function su(t){console.log(`\u25C7 ${t}`)}function iu(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function ny(t,e){let n;try{n=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let s=n.password;if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let r=`DOTENV_VAULT_${i.toUpperCase()}`,o=t.parsed[r];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${r} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:s}}function ru(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)Ir.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=hs.resolve(process.cwd(),".env.vault");return Ir.existsSync(e)?e:null}function nu(t){return t[0]==="~"?hs.join(Gg.homedir(),t.slice(1)):t}function sy(t){let e=ct(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=ct(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&su("loading env from encrypted .env.vault");let s=x._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),x.populate(i,s,t),{parsed:s}}function iy(t){let e=hs.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=ct(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=ct(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&tn("no encoding is specified (UTF-8 is used by default)");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[nu(t.path)];else{o=[];for(let f of t.path)o.push(nu(f))}let a,l={};for(let f of o)try{let u=x.parse(Ir.readFileSync(f,{encoding:n}));x.populate(l,u,t)}catch(u){i&&tn(`failed to load ${f} ${u.message}`),a=u}let c=x.populate(s,l,t);if(i=ct(s.DOTENV_CONFIG_DEBUG||i),r=ct(s.DOTENV_CONFIG_QUIET||r),i||!r){let f=Object.keys(c).length,u=[];for(let d of o)try{let p=hs.relative(process.cwd(),d);u.push(p)}catch(p){i&&tn(`failed to load ${d} ${p.message}`),a=p}su(`injected env (${f}) from ${u.join(",")} ${zg(`// tip: ${Jg()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function ry(t){if(iu(t).length===0)return x.configDotenv(t);let e=ru(t);return e?x._configVault(t):(ty(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),x.configDotenv(t))}function oy(t,e){let n=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),i=s.subarray(0,12),r=s.subarray(-16);s=s.subarray(12,-16);try{let o=Wg.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(r),`${o.update(s)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let f=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw f.code="INVALID_DOTENV_KEY",f}else if(c){let f=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw f.code="DECRYPTION_FAILED",f}else throw o}}function ay(t,e,n={}){let s=!!(n&&n.debug),i=!!(n&&n.override),r={};if(typeof e!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(e))Object.prototype.hasOwnProperty.call(t,o)?(i===!0&&(t[o]=e[o],r[o]=e[o]),s&&tn(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(t[o]=e[o],r[o]=e[o]);return r}var x={configDotenv:iy,_configVault:sy,_parseVault:ey,config:ry,decrypt:oy,parse:Zg,populate:ay};ge.exports.configDotenv=x.configDotenv;ge.exports._configVault=x._configVault;ge.exports._parseVault=x._parseVault;ge.exports.config=x.config;ge.exports.decrypt=x.decrypt;ge.exports.parse=x.parse;ge.exports.populate=x.populate;ge.exports=x});var ms,au=O(()=>{"use strict";ms={externalComms:!0,codeTask:!1,codeAccess:!1}});import{execFileSync as ly}from"node:child_process";function lu(t,e){if(process.platform!=="darwin")return"";try{return ly("security",["find-generic-password","-s",`hive/${t}/${e}`,"-w"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return""}}var cu=O(()=>{"use strict"});var gs={};J(gs,{config:()=>hy});import{readFileSync as cy,existsSync as pu,readdirSync as uy,statSync as fy}from"node:fs";import{resolve as Or}from"node:path";import{randomUUID as Nr}from"node:crypto";function uu(t){let e=process.env[t]||mu(t);if(!e)throw new Error(`Missing required env var: ${t}`);return e}function g(t,e){return process.env[t]||mu(t)||e}function py(t){if(t?.length)return t.map(n=>Or(n.replace(/^~/,process.env.HOME??"/tmp")));let e=Or(xe,"plugins/claude-code");return pu(e)?uy(e).map(n=>Or(e,n)).filter(n=>fy(n).isDirectory()):[]}var du,hu,dy,fu,v,Yw,nn,mu,Me,Ye,hy,ys=O(()=>{"use strict";du=fe(ou(),1),hu=fe(he(),1);au();cu();Q();dy=so(P);du.default.config({path:dy});fu=no(P),v={};pu(fu)&&(v=(0,hu.parse)(cy(fu,"utf-8"))??{});Yw=process.env.HOME??"/tmp",nn=v.instance?.id??"hive",mu=t=>lu(nn,t),Me=v.instance?.portBase??3100,Ye=v.instance?.ports??{},hy={instance:{id:nn,portBase:Me},business:{name:v.business?.name??g("BUSINESS_NAME",""),description:v.business?.description??"",location:v.business?.location??"",ownerName:v.business?.owner?.name??"",ownerRole:v.business?.owner?.role??""},slack:{appToken:uu("SLACK_APP_TOKEN"),botToken:uu("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",v.slack?.auditChannel??""),localMcpServer:!!(v.slack?.localMcpServer??!1)},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},linear:{apiKey:g("LINEAR_API_KEY",""),teamId:g("LINEAR_TEAM_ID","")},clickup:{apiToken:g("CLICKUP_API_TOKEN","")},github:{repo:g("GITHUB_REPO",""),token:g("GH_TOKEN","")},brave:{apiKey:g("BRAVE_API_KEY","")},taskLedger:{apiUrl:g("TASK_LEDGER_API_URL","http://localhost:3002"),agentKeys:Object.fromEntries(Object.entries(process.env).filter(([t])=>t.startsWith("TASK_LEDGER_KEY_")).map(([t,e])=>[t.replace("TASK_LEDGER_KEY_","").toLowerCase().replace(/_/g,"-"),e])),apiKey:g("TASK_LEDGER_API_KEY","")},mongo:{uri:g("MONGODB_URI","mongodb://localhost:27017"),dbName:g("MONGODB_DB",`hive_${nn}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{account:g("GOOGLE_ACCOUNT",v.google?.account??""),client:g("GOG_CLIENT",v.google?.client??""),accounts:v.google?.accounts??{},sharedFolder:g("DRIVE_SHARED_FOLDER",v.google?.sharedFolder??v.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",v.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",v.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:v.quo?.lines??{}},sms:{lines:v.sms?.lines??[]},imessage:{enabled:v.imessage?.enabled??!1,slackChannel:v.imessage?.slackChannel??"imessage",hotWindowMs:v.imessage?.hotWindowMs??3e5,coldIntervalMs:v.imessage?.coldIntervalMs??3e5,hotIntervalMs:v.imessage?.hotIntervalMs??1e4},resend:{apiKey:g("RESEND_API_KEY",""),fromAddress:g("RESEND_FROM_ADDRESS",""),defaultCc:g("RESEND_DEFAULT_CC",""),defaultBcc:g("RESEND_DEFAULT_BCC",""),emailDomain:g("RESEND_EMAIL_DOMAIN",v.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",v.resend?.businessName??"")},plugins:v.plugins??[],skillRegistries:v.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash")},permits:{mongoUri:g("PERMITS_MONGO_URI","mongodb://localhost:27017/permits")},recall:{apiKey:g("RECALL_API_KEY",""),region:g("RECALL_API_REGION","us-west-2"),monitorPort:parseInt(g("MEETING_MONITOR_PORT",String(Ye.recall??Me+1)),10),monitorPublicUrl:g("MEETING_MONITOR_PUBLIC_URL",""),webhookSecret:g("RECALL_WEBHOOK_SECRET","")},scheduler:{heartbeatIntervalMs:parseInt(g("HEARTBEAT_INTERVAL_MS","120000"),10)},background:{port:parseInt(g("BG_TASK_PORT",String(Ye.background??Me)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||Nr()},slackInternal:{port:parseInt(g("SLACK_INTERNAL_PORT",String(Ye.slackInternal??Me+6)),10),authToken:g("SLACK_INTERNAL_TOKEN","")||Nr()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(Ye.codeTask??Me+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||Nr(),pluginDirs:py(v.codeTask?.pluginDirs),defaultModel:g("CODE_TASK_MODEL","claude-sonnet-4-6"),defaultMaxTurns:parseInt(g("CODE_TASK_MAX_TURNS","100"),10),defaultMaxBudget:parseFloat(g("CODE_TASK_MAX_BUDGET","5.00")),maxConcurrent:parseInt(g("CODE_TASK_MAX_CONCURRENT","2"),10),maxLifetimeMs:parseInt(g("CODE_TASK_MAX_LIFETIME_MS",String(480*60*1e3)),10),staleGraceMs:parseInt(g("CODE_TASK_STALE_GRACE_MS",String(1800*1e3)),10)},ws:{enabled:g("WS_ENABLED","false")==="true",port:parseInt(g("WS_PORT",String(Ye.ws??Me+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(v.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(Ye.adminApi??Me+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!v.voice?.provider,provider:v.voice?.provider??"",publicUrl:v.voice?.publicUrl??"",phoneNumberId:v.voice?.phoneNumberId??"",assistants:v.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(Ye.voice??Me+5)),10)},autonomy:{externalComms:v.autonomy?.externalComms??ms.externalComms,codeTask:v.autonomy?.codeTask??ms.codeTask,codeAccess:v.autonomy?.codeAccess??ms.codeAccess},modelRouter:{enabled:g("MODEL_ROUTER_ENABLED","true")==="true",model:g("MODEL_ROUTER_MODEL","claude-haiku-4-5-20251001"),timeoutMs:parseInt(g("MODEL_ROUTER_TIMEOUT_MS","8000"),10)},sweeper:{intervalMs:parseInt(g("SWEEPER_INTERVAL_MS","300000"),10),threadTtlMs:parseInt(g("SWEEPER_THREAD_TTL_MS","86400000"),10),taskFileTtlMs:parseInt(g("SWEEPER_TASK_FILE_TTL_MS","604800000"),10),meetingSessionTtlMs:parseInt(g("SWEEPER_MEETING_TTL_MS","3600000"),10),cacheTtlMs:parseInt(g("SWEEPER_CACHE_TTL_MS","3600000"),10),retryMaxAttempts:parseInt(g("SWEEPER_RETRY_MAX_ATTEMPTS","3"),10),retryBaseDelayMs:parseInt(g("SWEEPER_RETRY_BASE_DELAY_MS","30000"),10)},retention:(()=>{let t=v.retention?.paths??{data:7,"agents/*/scratch":7,"agents/*/feeds":7,"agents/*/playwright":3,"agents/*/reports":0,logs:30},e={};for(let[i,r]of Object.entries(t)){if(typeof r!="number"||!Number.isFinite(r)||r<0)throw new Error(`Invalid retention.paths.${i}: must be a non-negative integer (got ${r})`);e[i]={days:r}}let n=Number(v.retention?.defaults?.days??7);if(!Number.isFinite(n)||n<0)throw new Error(`Invalid retention.defaults.days: ${n}`);let s=parseInt(g("RETENTION_INTERVAL_MS",String(v.retention?.intervalMs??168*36e5)),10);if(!Number.isFinite(s)||s<=0)throw new Error(`Invalid retention.intervalMs: must be a positive integer (got ${s})`);return{enabled:!!(v.retention?.enabled??!1),intervalMs:s,defaultDays:n,paths:e}})(),memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(v.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(v.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(v.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(v.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(v.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(v.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(v.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(v.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(v.memory?.reflectionMinTurns??3)),10)},codeIndex:{enabled:v.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(v.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(v.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(v.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:v.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(v.events?.retentionDays??30)),10)},activity:{enabled:(v.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(v.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(v.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(v.activity?.retentionDays??90)),10)},autoDream:{enabled:v.autoDream?.enabled??!0,idleThresholdMinutes:parseInt(g("AUTODREAM_IDLE_THRESHOLD_MINUTES",String(v.autoDream?.idleThresholdMinutes??30)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(v.autoDream?.cooldownMinutes??60)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(v.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(v.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(v.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(v.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(v.autoDream?.maxPromotionsPerRun??10)),10),maxBudgetUsd:parseFloat(g("AUTODREAM_MAX_BUDGET_USD",String(v.autoDream?.maxBudgetUsd??.1)))},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${nn}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${nn}-bg-tasks`)}}});var yu={};J(yu,{runDoctor:()=>vy});import{resolve as Ss}from"node:path";import{existsSync as my,readFileSync as gy}from"node:fs";import{execFileSync as gu}from"node:child_process";async function yy(){try{return{config:(await Promise.resolve().then(()=>(ys(),gs))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}async function vy(t={}){let e=!!t.verbose,n=Zc("com.hive.agent");console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${P}`),console.log(` service path: ${n??"(LaunchAgent plist not found)"}`),console.log("");let s=Vc(Ss(import.meta.dirname,"../../src/config.ts")),{config:i,error:r}=await yy(),o=[{name:"Node.js >= 22",group:"prereq",required:!0,test:()=>parseInt(process.versions.node.split(".")[0])>=22,remedy:"Install Node 22+: brew install node@22 && brew link --overwrite node@22"},{name:"Homebrew",group:"prereq",required:!0,test:()=>en("brew"),remedy:'Install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'},{name:"MongoDB (brew services)",group:"prereq",required:!0,test:()=>Yc("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>_r("http://127.0.0.1:11434/api/tags"),remedy:"brew install ollama && brew services start ollama"},{name:"Ollama models (bge-large, gemma4:e4b)",group:"prereq",required:!0,test:()=>{if(!en("ollama"))return!1;try{let c=gu("ollama",["list"],{encoding:"utf-8"});return c.includes("bge-large")&&c.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>_r("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>en("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>en("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return gu("xcode-select",["-p"],{encoding:"utf-8"}),!0}catch{return!1}},remedy:"xcode-select --install"},{name:"config loads (hive.yaml + required env)",group:"config",required:!0,test:()=>i!==null,remedy:r?`config.ts threw: ${r}. Set missing env vars in <HIVE_HOME>/.env and ensure hive.yaml exists.`:"Check hive.yaml at the hive home and run `hive init` if missing."},...s.map(c=>({name:`env: ${c}`,group:"config",required:!0,test:()=>!!process.env[c],remedy:`Set ${c} in <HIVE_HOME>/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>i?Jc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Start Mongo (`brew services start mongodb-community`) and verify MONGODB_URI."},{name:"At least one agent exists",group:"agents",required:!0,test:()=>i?Qc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:`default agent exists${i?` (${i.defaultAgent})`:""}`,group:"agents",required:!0,test:()=>i?zc(i.mongo.uri,i.mongo.dbName,i.defaultAgent):!1,remedy:i?`Set DEFAULT_AGENT to an existing agent id or seed '${i.defaultAgent}'.`:"Config failed to load \u2014 see Config group."},{name:"LaunchAgent com.hive.agent running",group:"services",required:!0,test:()=>{let c=Gc("com.hive.agent");return c.loaded&&c.state==="running"&&c.pid!==null&&Wc(c.pid)},remedy:(()=>{let c=process.getuid?.()??0;return`launchctl bootstrap gui/${c} ~/Library/LaunchAgents/com.hive.agent.plist && launchctl kickstart -k gui/${c}/com.hive.agent`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>i?Xc(i.slack.botToken):!1,remedy:"Verify SLACK_BOT_TOKEN in .env and that the token still has the expected scopes."},{name:"live plist points at engine entry",group:"services",required:!1,test:async()=>{if(!i)return!0;let c=`com.hive.${i.instance.id}.agent`,f=process.env.HOME??"",u=Ss(f,"Library/LaunchAgents",`${c}.plist`);if(!my(u))return!0;let d=gy(u,"utf-8"),p=Ss(xe,"dist","index.js"),y=Ss(xe,"pkg","server.min.js");return d.includes(p)||d.includes(y)},remedy:"Live plist ProgramArguments does not reference <engineDir>/dist/index.js. Run `hive start --daemon` to regenerate the plist."}],a=!0,l=null;for(let c of o){c.group!==l&&(console.log(`
|
|
228
|
-
${
|
|
222
|
+
`),await zl(),console.log("");let e=Ng(),n=process.env.HOME??"/tmp",s=e??await Og(n),i=Ce(Pe(t,"templates"))?Pe(t,"templates"):Pe(t,"setup","templates");console.log(`Setup will write config to: ${s}`),console.log(`Templates from: ${i}
|
|
223
|
+
`);let r=lt(s,"hive.yaml");Ce(r)&&(((0,Zt.parse)(Ic(r,"utf-8"))??{}).instance?.id||(console.error(`Error: ${r} is missing instance.id. Delete it and run 'hive init' again.`),process.exit(1))),process.env.HIVE_HOME=s;let{runWizard:o}=await Promise.resolve().then(()=>(_c(),Ac));await o(s,i,t)}var Zt,kg,Nc=O(()=>{"use strict";Zt=te(oe(),1);G();Xl();kg=10});var Cc={};Q(Cc,{showStatus:()=>Mg});import{execFileSync as Tc}from"node:child_process";import{existsSync as Lg,readFileSync as Cg}from"node:fs";import{resolve as Pg}from"node:path";async function Mg(){console.log(`Hive home: ${P}`);let t=Pg(P,process.env.HIVE_CONFIG??"hive.yaml");if(!Lg(t)){console.log("Status: not initialized (run 'hive init')");return}let n=((0,Lc.parse)(Cg(t,"utf-8"))??{}).instance?.id??"hive",s=`com.hive.${n}.agent`;console.log(`Instance: ${n}`);try{let r=Tc("launchctl",["list"],{encoding:"utf-8"}).split(`
|
|
224
|
+
`).find(o=>o.includes(s));if(r){let o=r.trim().split(/\s+/),a=o[0],l=o[1];console.log(`Service: running (PID ${a}, last exit ${l})`)}else console.log("Service: not running")}catch{console.log("Service: unknown (could not query launchctl)")}try{Tc("mongosh",["--eval","db.runCommand({ping:1})","--quiet"],{encoding:"utf-8",timeout:5e3}),console.log("MongoDB: connected")}catch{console.log("MongoDB: not reachable")}}var Lc,Pc=O(()=>{"use strict";Lc=te(oe(),1);G()});import{existsSync as Mc,mkdirSync as $g,readdirSync as Dg,renameSync as qg}from"node:fs";import{resolve as ps}from"node:path";function $c(t=P,e=xe){let n=ps(e,"plugins","node_modules"),s=ps(t,"plugins","node_modules");if(!Mc(n))return{moved:[],skipped:!0};let i=Dg(n);if(i.length===0)return{moved:[],skipped:!0};$g(s,{recursive:!0});let r=[];for(let o of i){let a=ps(n,o),l=ps(s,o);Mc(l)||(qg(a,l),r.push(o))}return{moved:r,skipped:!1}}var Dc=O(()=>{"use strict";G()});import{readFileSync as Rg,existsSync as xg}from"node:fs";function hs(t,e){let n=un(t),s=process.env.HIVE_CONFIG||"hive.yaml",i={};xg(n)&&(i=(0,qc.parse)(Rg(n,"utf-8"))??{});let r=i.instance?.id??"hive",o=i.instance?.portBase??3100,a=Object.values(i.instance?.ports??{}),l=Array.from({length:7},(u,f)=>o+f),c=Array.from(new Set([...l,...a])).sort((u,f)=>u-f),d={HIVE_SINGLE_INSTANCE:"1",HIVE_SINGLE_ID:r,HIVE_SINGLE_CONFIG:s,HIVE_SINGLE_LOGS:"logs",HIVE_SINGLE_PORTS:c.join(" "),HIVE_SINGLE_ROOT:t};return e&&(d.HIVE_SINGLE_TAG=e),d}var qc,Ar=O(()=>{"use strict";qc=te(oe(),1);G()});var xc={};Q(xc,{runUpdate:()=>Ug});import{execFileSync as Kg}from"node:child_process";import{readFileSync as Bg,existsSync as Fg}from"node:fs";import{resolve as _r}from"node:path";function Rc(t){try{let e=JSON.parse(Bg(_r(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function Ug(t={}){let e=se(),n=_r(e,".hive"),s=_r(n,"service","deploy.sh");Fg(s)||(console.error(`deploy.sh not found at ${s}.`),console.error("Either the engine isn't populated (.hive/ missing) or this is a dev install."),process.exit(1));let i=Rc(n),r=t.tag??"latest";console.log(`Updating @keepur/hive (current: ${i}, target: ${r})...`);let o=$c();o.moved.length>0&&console.log(` \u2713 Relocated ${o.moved.length} pre-release plugin(s) from .hive/ to plugins/: ${o.moved.join(", ")}`);let a=["--tag="+r];t.instance&&a.push("--instance="+t.instance);let l=hs(e,r);try{Kg(s,a,{stdio:"inherit",env:{...process.env,...l}})}catch{console.error("Update failed. See deploy.sh output above."),process.exit(1)}let c=Rc(n);console.log(i===c?`Already at latest matching tag: ${c}.`:`Updated: ${i} \u2192 ${c}.`)}var Kc=O(()=>{"use strict";G();Dc();Ar()});var Fc={};Q(Fc,{runRollback:()=>Yg});import{execFileSync as jg}from"node:child_process";import{readFileSync as Hg,existsSync as Bc}from"node:fs";import{resolve as ms}from"node:path";function Ir(t){try{let e=JSON.parse(Hg(ms(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function Yg(t={}){let e=se(),n=ms(e,".hive"),s=ms(e,".hive.prev"),i=ms(n,"service","deploy.sh");Bc(i)||(console.error(`deploy.sh not found at ${i}.`),process.exit(1)),Bc(s)||(console.error(`No previous engine at ${s}. Rollback unavailable.`),process.exit(1));let r=hs(e),o=t.instance??r.HIVE_SINGLE_ID,a=Ir(n),l=Ir(s);console.log(`Rolling back ${o}: ${a} \u2192 ${l}`);try{jg(i,["--rollback",`--instance=${o}`],{stdio:"inherit",env:{...process.env,...r}})}catch{console.error("Rollback failed. See deploy.sh output above."),process.exit(1)}let c=Ir(n);console.log(`Rollback complete: ${c}.`)}var Uc=O(()=>{"use strict";G();Ar()});var Hc={};Q(Hc,{runMigrate:()=>Jg});import{execFileSync as Vg}from"node:child_process";import{resolve as jc}from"node:path";import{existsSync as Gg}from"node:fs";import{fileURLToPath as Wg}from"node:url";async function Jg(t){let e=Wg(import.meta.url),n=jc(e,"..",".."),s=jc(n,"install","migrate-0.2.sh");Gg(s)||(console.error(`migrate-0.2.sh not found at ${s}`),console.error("Falling back to the standalone: curl https://.../migrate-0.2.sh | bash -s --"),process.exit(1));let i=t.dryRun?["--dry-run",t.instanceDir]:[t.instanceDir];try{Vg("bash",[s,...i],{stdio:"inherit"})}catch{process.exit(1)}}var Yc=O(()=>{"use strict"});import{execFileSync as Or}from"node:child_process";import{existsSync as Qg,readFileSync as Gc}from"node:fs";import{resolve as zg}from"node:path";function en(t){try{return Or("which",[t],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function Wc(t){try{return Or("brew",["services","list"],{encoding:"utf-8"}).split(`
|
|
225
|
+
`).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function Nr(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}function Jc(t){let e=Gc(t,"utf-8"),n=new Set;for(let s of e.matchAll(/\brequired\(\s*"([A-Z0-9_]+)"\s*\)/g))n.add(s[1]);return[...n].sort()}function Qc(t){let e=process.getuid?.();if(e===void 0)return{loaded:!1,state:"unknown",pid:null};try{let n=Or("launchctl",["print",`gui/${e}/${t}`],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),s=n.match(/state\s*=\s*([^\n]+?)\s*$/m),i=n.match(/pid\s*=\s*(\d+)/),r=s?.[1];return{loaded:!0,state:r==="running"?"running":r==="not running"?"not running":"unknown",pid:i?parseInt(i[1],10):null}}catch{return{loaded:!1,state:"unknown",pid:null}}}function zc(t){try{return process.kill(t,0),!0}catch{return!1}}async function Xc(t,e,n=2e3){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:n});try{return await i.connect(),await i.db(e).command({ping:1}),!0}catch{return!1}finally{await i.close().catch(()=>{})}}async function Zc(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{return await s.connect(),await s.db(e).collection("agent_definitions").estimatedDocumentCount()>0}catch{return!1}finally{await s.close().catch(()=>{})}}async function eu(t,e,n){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:2e3});try{return await i.connect(),await i.db(e).collection("agent_definitions").findOne({id:n})!==null}catch{return!1}finally{await i.close().catch(()=>{})}}async function tu(t){if(!t)return!1;let{WebClient:e}=await import("@slack/web-api");try{return(await new e(t).auth.test()).ok===!0}catch{return!1}}function Vc(t){return t.replace(/^~(?=$|\/)/,process.env.HOME??"")}function nu(t="com.hive.agent"){let e=Vc(`~/Library/LaunchAgents/${t}.plist`);if(!Qg(e))return null;let s=Gc(e,"utf-8").match(/<key>WorkingDirectory<\/key>\s*<string>([^<]+)<\/string>/);return s?zg(Vc(s[1])):null}var su=O(()=>{"use strict"});var cu=S((Yw,ge)=>{var Tr=we("fs"),gs=we("path"),Xg=we("os"),Zg=we("crypto"),iu=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function ey(){return iu[Math.floor(Math.random()*iu.length)]}function ct(t){return typeof t=="string"?!["false","0","no","off",""].includes(t.toLowerCase()):!!t}function ty(){return process.stdout.isTTY}function ny(t){return ty()?`\x1B[2m${t}\x1B[0m`:t}var sy=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function iy(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
|
|
226
|
+
`);let s;for(;(s=sy.exec(n))!=null;){let i=s[1],r=s[2]||"";r=r.trim();let o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(r=r.replace(/\\n/g,`
|
|
227
|
+
`),r=r.replace(/\\r/g,"\r")),e[i]=r}return e}function ry(t){t=t||{};let e=lu(t);t.path=e;let n=x.configDotenv(t);if(!n.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let s=au(t).split(","),i=s.length,r;for(let o=0;o<i;o++)try{let a=s[o].trim(),l=ay(n,a);r=x.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return x.parse(r)}function oy(t){console.error(`\u26A0 ${t}`)}function tn(t){console.log(`\u2506 ${t}`)}function ou(t){console.log(`\u25C7 ${t}`)}function au(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function ay(t,e){let n;try{n=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let s=n.password;if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let r=`DOTENV_VAULT_${i.toUpperCase()}`,o=t.parsed[r];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${r} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:s}}function lu(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)Tr.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=gs.resolve(process.cwd(),".env.vault");return Tr.existsSync(e)?e:null}function ru(t){return t[0]==="~"?gs.join(Xg.homedir(),t.slice(1)):t}function ly(t){let e=ct(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=ct(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&ou("loading env from encrypted .env.vault");let s=x._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),x.populate(i,s,t),{parsed:s}}function cy(t){let e=gs.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=ct(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=ct(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&tn("no encoding is specified (UTF-8 is used by default)");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[ru(t.path)];else{o=[];for(let d of t.path)o.push(ru(d))}let a,l={};for(let d of o)try{let u=x.parse(Tr.readFileSync(d,{encoding:n}));x.populate(l,u,t)}catch(u){i&&tn(`failed to load ${d} ${u.message}`),a=u}let c=x.populate(s,l,t);if(i=ct(s.DOTENV_CONFIG_DEBUG||i),r=ct(s.DOTENV_CONFIG_QUIET||r),i||!r){let d=Object.keys(c).length,u=[];for(let f of o)try{let p=gs.relative(process.cwd(),f);u.push(p)}catch(p){i&&tn(`failed to load ${f} ${p.message}`),a=p}ou(`injected env (${d}) from ${u.join(",")} ${ny(`// tip: ${ey()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function uy(t){if(au(t).length===0)return x.configDotenv(t);let e=lu(t);return e?x._configVault(t):(oy(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),x.configDotenv(t))}function fy(t,e){let n=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),i=s.subarray(0,12),r=s.subarray(-16);s=s.subarray(12,-16);try{let o=Zg.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(r),`${o.update(s)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let d=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw d.code="INVALID_DOTENV_KEY",d}else if(c){let d=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw d.code="DECRYPTION_FAILED",d}else throw o}}function dy(t,e,n={}){let s=!!(n&&n.debug),i=!!(n&&n.override),r={};if(typeof e!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(e))Object.prototype.hasOwnProperty.call(t,o)?(i===!0&&(t[o]=e[o],r[o]=e[o]),s&&tn(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(t[o]=e[o],r[o]=e[o]);return r}var x={configDotenv:cy,_configVault:ly,_parseVault:ry,config:uy,decrypt:fy,parse:iy,populate:dy};ge.exports.configDotenv=x.configDotenv;ge.exports._configVault=x._configVault;ge.exports._parseVault=x._parseVault;ge.exports.config=x.config;ge.exports.decrypt=x.decrypt;ge.exports.parse=x.parse;ge.exports.populate=x.populate;ge.exports=x});var ys,uu=O(()=>{"use strict";ys={externalComms:!0,codeTask:!1,codeAccess:!1}});import{execFileSync as py}from"node:child_process";function fu(t,e){if(process.platform!=="darwin")return"";try{return py("security",["find-generic-password","-s",`hive/${t}/${e}`,"-w"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return""}}var du=O(()=>{"use strict"});var Ss={};Q(Ss,{config:()=>vy});import{readFileSync as hy,existsSync as gu,readdirSync as my,statSync as gy}from"node:fs";import{resolve as Lr}from"node:path";import{randomUUID as Cr}from"node:crypto";function pu(t){let e=process.env[t]||Su(t);if(!e)throw new Error(`Missing required env var: ${t}`);return e}function g(t,e){return process.env[t]||Su(t)||e}function Sy(t){if(t?.length)return t.map(n=>Lr(n.replace(/^~/,process.env.HOME??"/tmp")));let e=Lr(xe,"plugins/claude-code");return gu(e)?my(e).map(n=>Lr(e,n)).filter(n=>gy(n).isDirectory()):[]}var mu,yu,yy,hu,v,tb,nn,Su,Me,Ye,vy,vs=O(()=>{"use strict";mu=te(cu(),1),yu=te(oe(),1);uu();du();G();yy=ro(P);mu.default.config({path:yy});hu=un(P),v={};gu(hu)&&(v=(0,yu.parse)(hy(hu,"utf-8"))??{});tb=process.env.HOME??"/tmp",nn=v.instance?.id??"hive",Su=t=>fu(nn,t),Me=v.instance?.portBase??3100,Ye=v.instance?.ports??{},vy={instance:{id:nn,portBase:Me},business:{name:v.business?.name??g("BUSINESS_NAME",""),description:v.business?.description??"",location:v.business?.location??"",ownerName:v.business?.owner?.name??"",ownerRole:v.business?.owner?.role??""},slack:{appToken:pu("SLACK_APP_TOKEN"),botToken:pu("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",v.slack?.auditChannel??""),localMcpServer:!!(v.slack?.localMcpServer??!1)},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},linear:{apiKey:g("LINEAR_API_KEY",""),teamId:g("LINEAR_TEAM_ID","")},clickup:{apiToken:g("CLICKUP_API_TOKEN","")},github:{repo:g("GITHUB_REPO",""),token:g("GH_TOKEN","")},brave:{apiKey:g("BRAVE_API_KEY","")},taskLedger:{apiUrl:g("TASK_LEDGER_API_URL","http://localhost:3002"),agentKeys:Object.fromEntries(Object.entries(process.env).filter(([t])=>t.startsWith("TASK_LEDGER_KEY_")).map(([t,e])=>[t.replace("TASK_LEDGER_KEY_","").toLowerCase().replace(/_/g,"-"),e])),apiKey:g("TASK_LEDGER_API_KEY","")},mongo:{uri:g("MONGODB_URI","mongodb://localhost:27017"),dbName:g("MONGODB_DB",`hive_${nn}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{account:g("GOOGLE_ACCOUNT",v.google?.account??""),client:g("GOG_CLIENT",v.google?.client??""),accounts:v.google?.accounts??{},sharedFolder:g("DRIVE_SHARED_FOLDER",v.google?.sharedFolder??v.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",v.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",v.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:v.quo?.lines??{}},sms:{lines:v.sms?.lines??[]},imessage:{enabled:v.imessage?.enabled??!1,slackChannel:v.imessage?.slackChannel??"imessage",hotWindowMs:v.imessage?.hotWindowMs??3e5,coldIntervalMs:v.imessage?.coldIntervalMs??3e5,hotIntervalMs:v.imessage?.hotIntervalMs??1e4},resend:{apiKey:g("RESEND_API_KEY",""),fromAddress:g("RESEND_FROM_ADDRESS",""),defaultCc:g("RESEND_DEFAULT_CC",""),defaultBcc:g("RESEND_DEFAULT_BCC",""),emailDomain:g("RESEND_EMAIL_DOMAIN",v.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",v.resend?.businessName??"")},plugins:v.plugins??[],skillRegistries:v.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash")},permits:{mongoUri:g("PERMITS_MONGO_URI","mongodb://localhost:27017/permits")},recall:{apiKey:g("RECALL_API_KEY",""),region:g("RECALL_API_REGION","us-west-2"),monitorPort:parseInt(g("MEETING_MONITOR_PORT",String(Ye.recall??Me+1)),10),monitorPublicUrl:g("MEETING_MONITOR_PUBLIC_URL",""),webhookSecret:g("RECALL_WEBHOOK_SECRET","")},scheduler:{heartbeatIntervalMs:parseInt(g("HEARTBEAT_INTERVAL_MS","120000"),10)},background:{port:parseInt(g("BG_TASK_PORT",String(Ye.background??Me)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||Cr()},slackInternal:{port:parseInt(g("SLACK_INTERNAL_PORT",String(Ye.slackInternal??Me+6)),10),authToken:g("SLACK_INTERNAL_TOKEN","")||Cr()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(Ye.codeTask??Me+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||Cr(),pluginDirs:Sy(v.codeTask?.pluginDirs),defaultModel:g("CODE_TASK_MODEL","claude-sonnet-4-6"),defaultMaxTurns:parseInt(g("CODE_TASK_MAX_TURNS","100"),10),defaultMaxBudget:parseFloat(g("CODE_TASK_MAX_BUDGET","5.00")),maxConcurrent:parseInt(g("CODE_TASK_MAX_CONCURRENT","2"),10),maxLifetimeMs:parseInt(g("CODE_TASK_MAX_LIFETIME_MS",String(480*60*1e3)),10),staleGraceMs:parseInt(g("CODE_TASK_STALE_GRACE_MS",String(1800*1e3)),10)},ws:{enabled:g("WS_ENABLED","false")==="true",port:parseInt(g("WS_PORT",String(Ye.ws??Me+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(v.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(Ye.adminApi??Me+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!v.voice?.provider,provider:v.voice?.provider??"",publicUrl:v.voice?.publicUrl??"",phoneNumberId:v.voice?.phoneNumberId??"",assistants:v.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(Ye.voice??Me+5)),10)},autonomy:{externalComms:v.autonomy?.externalComms??ys.externalComms,codeTask:v.autonomy?.codeTask??ys.codeTask,codeAccess:v.autonomy?.codeAccess??ys.codeAccess},modelRouter:{enabled:g("MODEL_ROUTER_ENABLED","true")==="true",model:g("MODEL_ROUTER_MODEL","claude-haiku-4-5-20251001"),timeoutMs:parseInt(g("MODEL_ROUTER_TIMEOUT_MS","8000"),10)},sweeper:{intervalMs:parseInt(g("SWEEPER_INTERVAL_MS","300000"),10),threadTtlMs:parseInt(g("SWEEPER_THREAD_TTL_MS","86400000"),10),taskFileTtlMs:parseInt(g("SWEEPER_TASK_FILE_TTL_MS","604800000"),10),meetingSessionTtlMs:parseInt(g("SWEEPER_MEETING_TTL_MS","3600000"),10),cacheTtlMs:parseInt(g("SWEEPER_CACHE_TTL_MS","3600000"),10),retryMaxAttempts:parseInt(g("SWEEPER_RETRY_MAX_ATTEMPTS","3"),10),retryBaseDelayMs:parseInt(g("SWEEPER_RETRY_BASE_DELAY_MS","30000"),10)},retention:(()=>{let t=v.retention?.paths??{data:7,"agents/*/scratch":7,"agents/*/feeds":7,"agents/*/playwright":3,"agents/*/reports":0,logs:30},e={};for(let[i,r]of Object.entries(t)){if(typeof r!="number"||!Number.isFinite(r)||r<0)throw new Error(`Invalid retention.paths.${i}: must be a non-negative integer (got ${r})`);e[i]={days:r}}let n=Number(v.retention?.defaults?.days??7);if(!Number.isFinite(n)||n<0)throw new Error(`Invalid retention.defaults.days: ${n}`);let s=parseInt(g("RETENTION_INTERVAL_MS",String(v.retention?.intervalMs??168*36e5)),10);if(!Number.isFinite(s)||s<=0)throw new Error(`Invalid retention.intervalMs: must be a positive integer (got ${s})`);return{enabled:!!(v.retention?.enabled??!1),intervalMs:s,defaultDays:n,paths:e}})(),memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(v.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(v.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(v.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(v.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(v.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(v.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(v.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(v.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(v.memory?.reflectionMinTurns??3)),10)},codeIndex:{enabled:v.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(v.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(v.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(v.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:v.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(v.events?.retentionDays??30)),10)},activity:{enabled:(v.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(v.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(v.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(v.activity?.retentionDays??90)),10)},autoDream:{enabled:v.autoDream?.enabled??!0,idleThresholdMinutes:parseInt(g("AUTODREAM_IDLE_THRESHOLD_MINUTES",String(v.autoDream?.idleThresholdMinutes??30)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(v.autoDream?.cooldownMinutes??60)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(v.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(v.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(v.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(v.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(v.autoDream?.maxPromotionsPerRun??10)),10),maxBudgetUsd:parseFloat(g("AUTODREAM_MAX_BUDGET_USD",String(v.autoDream?.maxBudgetUsd??.1)))},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${nn}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${nn}-bg-tasks`)}}});var wu={};Q(wu,{runDoctor:()=>Ay});import{resolve as ws}from"node:path";import{existsSync as wy,readFileSync as by}from"node:fs";import{execFileSync as vu}from"node:child_process";async function Ey(){try{return{config:(await Promise.resolve().then(()=>(vs(),Ss))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}async function Ay(t={}){let e=!!t.verbose,n=nu("com.hive.agent");console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${P}`),console.log(` service path: ${n??"(LaunchAgent plist not found)"}`),console.log("");let s=Jc(ws(import.meta.dirname,"../../src/config.ts")),{config:i,error:r}=await Ey(),o=[{name:"Node.js >= 22",group:"prereq",required:!0,test:()=>parseInt(process.versions.node.split(".")[0])>=22,remedy:"Install Node 22+: brew install node@22 && brew link --overwrite node@22"},{name:"Homebrew",group:"prereq",required:!0,test:()=>en("brew"),remedy:'Install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'},{name:"MongoDB (brew services)",group:"prereq",required:!0,test:()=>Wc("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>Nr("http://127.0.0.1:11434/api/tags"),remedy:"brew install ollama && brew services start ollama"},{name:"Ollama models (bge-large, gemma4:e4b)",group:"prereq",required:!0,test:()=>{if(!en("ollama"))return!1;try{let c=vu("ollama",["list"],{encoding:"utf-8"});return c.includes("bge-large")&&c.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>Nr("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>en("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>en("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return vu("xcode-select",["-p"],{encoding:"utf-8"}),!0}catch{return!1}},remedy:"xcode-select --install"},{name:"config loads (hive.yaml + required env)",group:"config",required:!0,test:()=>i!==null,remedy:r?`config.ts threw: ${r}. Set missing env vars in <HIVE_HOME>/.env and ensure hive.yaml exists.`:"Check hive.yaml at the hive home and run `hive init` if missing."},...s.map(c=>({name:`env: ${c}`,group:"config",required:!0,test:()=>!!process.env[c],remedy:`Set ${c} in <HIVE_HOME>/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>i?Xc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Start Mongo (`brew services start mongodb-community`) and verify MONGODB_URI."},{name:"At least one agent exists",group:"agents",required:!0,test:()=>i?Zc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:`default agent exists${i?` (${i.defaultAgent})`:""}`,group:"agents",required:!0,test:()=>i?eu(i.mongo.uri,i.mongo.dbName,i.defaultAgent):!1,remedy:i?`Set DEFAULT_AGENT to an existing agent id or seed '${i.defaultAgent}'.`:"Config failed to load \u2014 see Config group."},{name:"LaunchAgent com.hive.agent running",group:"services",required:!0,test:()=>{let c=Qc("com.hive.agent");return c.loaded&&c.state==="running"&&c.pid!==null&&zc(c.pid)},remedy:(()=>{let c=process.getuid?.()??0;return`launchctl bootstrap gui/${c} ~/Library/LaunchAgents/com.hive.agent.plist && launchctl kickstart -k gui/${c}/com.hive.agent`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>i?tu(i.slack.botToken):!1,remedy:"Verify SLACK_BOT_TOKEN in .env and that the token still has the expected scopes."},{name:"live plist points at engine entry",group:"services",required:!1,test:async()=>{if(!i)return!0;let c=`com.hive.${i.instance.id}.agent`,d=process.env.HOME??"",u=ws(d,"Library/LaunchAgents",`${c}.plist`);if(!wy(u))return!0;let f=by(u,"utf-8"),p=ws(xe,"dist","index.js"),y=ws(xe,"pkg","server.min.js");return f.includes(p)||f.includes(y)},remedy:"Live plist ProgramArguments does not reference <engineDir>/dist/index.js. Run `hive start --daemon` to regenerate the plist."}],a=!0,l=null;for(let c of o){c.group!==l&&(console.log(`
|
|
228
|
+
${ky[c.group]}`),l=c.group);let d=await c.test(),u=d?"\u2713":c.required?"\u2717":"\u25CB",f=c.required?"":" (optional)";console.log(` ${u} ${c.name}${f}`),!d&&e&&c.remedy&&console.log(` \u2192 ${c.remedy}`),!d&&c.required&&(a=!1)}a||(console.log(`
|
|
229
229
|
Some required checks failed. Run with --verbose for remedy hints.`),process.exit(1)),console.log(`
|
|
230
|
-
All checks passed.`)}var
|
|
231
|
-
`)}function B(t){return{debug:(e,n)=>
|
|
232
|
-
`);for(let s of n){let i=sn(
|
|
233
|
-
`),o=0;for(;o<r.length;){let a=r[o];if(a.trim()===""){o++;continue}let l=a.match(/^(\w[\w-]*):\s*(.*)/);if(!l){o++;continue}let c=l[1],
|
|
230
|
+
All checks passed.`)}var ky,bu=O(()=>{"use strict";su();G();ky={prereq:"Prereqs",config:"Config",agents:"Agents",services:"Services"}});import{readFileSync as _y,writeFileSync as Iy,existsSync as Oy}from"node:fs";import{resolve as Ny}from"node:path";function $e(){return Ny(P,process.env.HIVE_CONFIG||"hive.yaml")}function le(t){let e=t??$e();return Oy(e)?(0,bs.parse)(_y(e,"utf-8"))??{}:{}}function ut(t,e){let n=e??$e();Iy(n,(0,bs.stringify)(t,{lineWidth:0}))}var bs,Es=O(()=>{"use strict";bs=te(oe(),1);G()});function ks(t,e,n,s){if(Eu[t]<Eu[Ty])return;let i={ts:new Date().toISOString(),level:t,component:e,msg:n,...s};(t==="error"?process.stderr:process.stdout).write(JSON.stringify(i)+`
|
|
231
|
+
`)}function B(t){return{debug:(e,n)=>ks("debug",t,e,n),info:(e,n)=>ks("info",t,e,n),warn:(e,n)=>ks("warn",t,e,n),error:(e,n)=>ks("error",t,e,n)}}var Eu,Ty,ce=O(()=>{"use strict";Eu={debug:0,info:1,warn:2,error:3},Ty=process.env.LOG_LEVEL||"info"});import{execFileSync as Pr}from"node:child_process";function Mr(){let t=le(),n=`com.hive.${t.instanceId??t.id??"hive"}.agent`;try{Pr("launchctl",["list",n],{stdio:"pipe"})}catch{return!1}let s=Pr("id",["-u"],{stdio:"pipe",encoding:"utf-8"}).trim();try{return Pr("launchctl",["kickstart","-k",`gui/${s}/${n}`],{stdio:"pipe"}),ku.info("Hive service restarted",{label:n}),!0}catch(i){return ku.warn("Failed to restart hive service",{label:n,error:String(i)}),!1}}var ku,Au=O(()=>{"use strict";Es();ce();ku=B("hive-restart")});import{readFileSync as Ly}from"node:fs";import{resolve as _u}from"node:path";function Py(){let t=[_u(import.meta.dirname,"..","..","package.json"),_u(import.meta.dirname,"..","package.json")];for(let e of t)try{let n=JSON.parse(Ly(e,"utf-8"));if(n?.name==="@keepur/hive"&&typeof n.hiveApi=="string")return n.hiveApi}catch{continue}return null}var Cy,Iu,As,$r=O(()=>{"use strict";ce();Cy=B("api-version");Iu=Py();Iu||Cy.warn("Could not read hiveApi from package.json; falling back to 1.0.0");As=Iu??"1.0.0"});function Ou(t,e){let n=t.trim();if(n===e)return!0;if(n.startsWith("^")){let s=n.slice(1).split(".").map(Number),i=e.split(".").map(Number);return!(s.length<1||i.length<1||s[0]!==i[0]||(i[1]??0)<(s[1]??0)||(i[1]??0)===(s[1]??0)&&(i[2]??0)<(s[2]??0))}return $y.warn("Unrecognized hiveApi range syntax, accepting",{range:t}),!0}var My,$y,Nu=O(()=>{"use strict";My=te(oe(),1);ce();$r();$y=B("plugin-loader")});var Lu={};Q(Lu,{runPlugin:()=>qy});import{execFileSync as _s}from"node:child_process";import{existsSync as ft,mkdirSync as Dy,readFileSync as qr}from"node:fs";import{resolve as sn,join as Is}from"node:path";function Tu(t,e){let n=Is(t,"..","package.json");if(ft(n))try{let i=JSON.parse(qr(n,"utf-8"));if(typeof i?.version=="string")return i.version}catch{}let s=e;return typeof s?.version=="string"?s.version:"unknown"}async function qy(t,e){switch(t){case"add":return Ry(e);case"remove":return xy(e);case"list":return Ky();default:console.error("Usage: hive plugin <add|list|remove> [package]"),process.exit(1)}}function Ry(t){t||(console.error("Usage: hive plugin add <package-name>"),process.exit(1)),Dy(ue,{recursive:!0});let e=sn(ue,"package.json");ft(e)||_s("npm",["init","-y"],{cwd:ue,stdio:"pipe"}),console.log(`Installing ${t}...`);try{_s("npm",["install",t],{cwd:ue,stdio:"pipe"})}catch(d){console.error(`Failed to install ${t}: ${String(d)}`),process.exit(1)}let n=sn(ue,"node_modules",t),s=Is(n,"plugin.yaml");ft(s)||(console.error(`Not a valid hive plugin \u2014 no plugin.yaml found in ${t}.`),Dr(t),process.exit(1));let i=(0,Rr.parse)(qr(s,"utf-8")),r=i?.hiveApi??i?.["hive-api"];r&&!Ou(r,As)&&(console.error(`Plugin requires hiveApi ${r} but this hive is ${As}.`),Dr(t),process.exit(1));let o=Tu(s,i),a=$e(),l=le(a);if(l.plugins||(l.plugins=[]),!l.plugins.includes(t)){l.plugins.push(t);try{ut(l,a)}catch(d){console.error(`Failed to update hive.yaml: ${String(d)}`),Dr(t),process.exit(1)}console.log("\u2713 Updated hive.yaml")}let c=Mr();console.log(c?"\u2713 Restarting hive... done":"Start hive to activate the plugin."),console.log(`\u2713 Installed ${t} (v${o}${r?`, hiveApi ${r}`:""})`)}function xy(t){t||(console.error("Usage: hive plugin remove <package-name>"),process.exit(1)),ft(ue)||(console.error("No plugins directory found."),process.exit(1)),console.log(`Removing ${t}...`);try{_s("npm",["uninstall",t],{cwd:ue,stdio:"pipe"})}catch(i){console.error(`Failed to uninstall ${t}: ${String(i)}`),process.exit(1)}let e=$e(),n=le(e);if(Array.isArray(n.plugins)){let i=n.plugins.indexOf(t);i>=0&&(n.plugins.splice(i,1),ut(n,e),console.log("\u2713 Updated hive.yaml"))}let s=Mr();console.log(s?"\u2713 Restarting hive... done":"Restart hive to complete removal."),console.log(`Removed ${t}`)}function Ky(){let t=$e(),n=le(t).plugins??[];if(n.length===0){console.log("No plugins configured in hive.yaml.");return}console.log(`Installed plugins:
|
|
232
|
+
`);for(let s of n){let i=sn(ue,"node_modules",s),r=sn(ue,s),o=Is(i,"plugin.yaml"),a=Is(r,"plugin.yaml"),l=null,c=!1;if(ft(o)?l=o:ft(a)&&(l=a,c=!0),!l){console.log(` ${s} \u26A0 not found on disk`);continue}try{let d=(0,Rr.parse)(qr(l,"utf-8")),u=Tu(l,d),f=d?.hiveApi??d?.["hive-api"]??"",p=c?" [in-tree]":"";console.log(` ${s} v${u}${f?` (hiveApi ${f})`:""}${p}`)}catch{console.log(` ${s} \u26A0 failed to read plugin.yaml`)}}}function Dr(t){try{_s("npm",["uninstall",t],{cwd:ue,stdio:"pipe"})}catch{}}var Rr,ue,Cu=O(()=>{"use strict";Rr=te(oe(),1);G();Es();Au();$r();Nu();ue=sn(P,"plugins")});var Du={};Q(Du,{checkoutSha:()=>Hr,findTagForSha:()=>dt,listSkillsInClone:()=>jr,lsRemoteHead:()=>Ur,partialClone:()=>Fr,shallowClone:()=>Br,verifyGitAvailable:()=>rn});import{execFileSync as fe}from"node:child_process";import{existsSync as Pu,readdirSync as By,statSync as Fy,rmSync as xr,mkdtempSync as Mu}from"node:fs";import{join as Ve}from"node:path";import{tmpdir as $u}from"node:os";function rn(){try{fe("git",["--version"],{stdio:"pipe"})}catch{throw new Error("git is required for skill installation but was not found. Install git and retry.")}}function Br(t){let e=Mu(Ve($u(),"hive-skill-install-")),n=Ve(e,"repo"),s=()=>{try{xr(e,{recursive:!0,force:!0})}catch{}};try{fe("git",["clone","--depth","1",t,n],{stdio:"pipe",timeout:6e4});let i=fe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return Kr.debug("Shallow clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function Fr(t){let e=Mu(Ve($u(),"hive-skill-upgrade-")),n=Ve(e,"repo"),s=()=>{try{xr(e,{recursive:!0,force:!0})}catch{}};try{try{fe("git",["clone","--filter=blob:none","--no-checkout",t,n],{stdio:"pipe",timeout:12e4}),fe("git",["checkout","HEAD"],{cwd:n,stdio:"pipe"})}catch(r){Kr.debug("Blobless clone failed, falling back to full clone",{error:String(r)}),xr(n,{recursive:!0,force:!0}),fe("git",["clone",t,n],{stdio:"pipe",timeout:12e4})}let i=fe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return Kr.debug("Partial clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function Ur(t){let n=fe("git",["ls-remote",t,"HEAD"],{stdio:"pipe",encoding:"utf-8",timeout:3e4}).trim().split(" ")[0];if(!n)throw new Error(`Could not determine HEAD for ${t}`);return n}function jr(t){let e=Ve(t,"skills");return Pu(e)?By(e).filter(n=>{try{let s=Ve(e,n);return Fy(s).isDirectory()&&Pu(Ve(s,"SKILL.md"))}catch{return!1}}):[]}function Hr(t,e){fe("git",["checkout",e],{cwd:t,stdio:"pipe"})}function dt(t,e){try{return fe("git",["describe","--tags","--exact-match",e],{cwd:t,stdio:"pipe",encoding:"utf-8"}).trim()||void 0}catch{return}}var Kr,on=O(()=>{"use strict";ce();Kr=B("registry-fetch")});function qu(t){if(t.includes("#skills/")){let n=t.indexOf("#skills/"),s=t.slice(0,n);return{name:t.slice(n+8),inlineUrl:s}}let e=t.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:tree|blob)\/[^/]+\/skills\/([^/]+)/);if(e)return{name:e[3],inlineUrl:`https://github.com/${e[1]}/${e[2]}`};if(t.includes(":")&&!t.includes("://")){let n=t.indexOf(":"),s=t.slice(0,n);return{name:t.slice(n+1),registryName:s}}return{name:t}}function Ru(t,e){if(t.inlineUrl){let i=Uy(t.inlineUrl);return Yr.debug("resolved inline registry",{inlineUrl:t.inlineUrl,name:i}),{name:i,url:t.inlineUrl}}if(t.registryName){let i=e.find(r=>r.name===t.registryName);if(!i)throw new Error(`Unknown registry: "${t.registryName}". Configured registries: ${e.map(r=>r.name).join(", ")}`);return Yr.debug("resolved named registry",{registryName:t.registryName,url:i.url}),{name:i.name,url:i.url}}let n={name:"keepur-default",url:"https://github.com/keepur/hive-skills"},s=e.find(i=>i.default)??e[0]??n;return Yr.debug("resolved default registry",{registryName:s.name,url:s.url}),{name:s.name,url:s.url}}function Uy(t){try{return t.replace(/\.git$/,"").split("/").filter(Boolean).slice(-2).join("-")}catch{return"inline"}}var Yr,xu=O(()=>{"use strict";ce();Yr=B("registry-resolver")});import{join as jy}from"node:path";import{readFileSync as Hy}from"node:fs";function Ku(t,e){let s=Hy(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!s)return e;let i=s[1].match(/^workflow:\s*(.+)$/m);return i?i[1].trim():e}function Bu(t,e,n){return jy(t,e,"skills",n)}var Fu=O(()=>{"use strict"});import{readFileSync as Yy,writeFileSync as Vy}from"node:fs";function Vr(t){let e=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!e)throw new Error("No YAML frontmatter found");let n=e[1],s=e[2],i={name:"",description:"",agents:[]},r=n.split(`
|
|
233
|
+
`),o=0;for(;o<r.length;){let a=r[o];if(a.trim()===""){o++;continue}let l=a.match(/^(\w[\w-]*):\s*(.*)/);if(!l){o++;continue}let c=l[1],d=l[2].trim();if(c==="name")i.name=Ge(d);else if(c==="description")i.description=Ge(d);else if(c==="workflow")i.workflow=Ge(d);else if(c==="agents"){let u=d.match(/^\[([^\]]*)\]$/);if(u)i.agents=u[1].split(",").map(f=>Ge(f.trim())).filter(f=>f.length>0);else if(d==="")for(i.agents=[];o+1<r.length&&r[o+1].match(/^\s+-\s+/);){o++;let f=r[o].replace(/^\s+-\s+/,"").trim();i.agents.push(Ge(f))}else i.agents=[Ge(d)]}else if(c==="origin")for(i.origin=Uu(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;else if(c==="author")for(i.author=Uu(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;o++}return{frontmatter:i,body:s}}function Uu(t,e){let n={},s=e+1;for(;s<t.length&&t[s].match(/^\s+\S/);){let i=t[s].match(/^\s+([\w][\w-]*):\s*(.*)/);if(i){let r=i[2].trim();r==="true"?n[i[1]]=!0:r==="false"?n[i[1]]=!1:n[i[1]]=Ge(r)}s++}return n}function Ge(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):t}function Gr(t,e){let n=[];n.push(`name: ${Os(t.name)}`),n.push(`description: ${Os(t.description)}`);let s=t.agents.join(", ");return n.push(`agents: [${s}]`),t.workflow&&n.push(`workflow: ${Os(t.workflow)}`),t.origin&&(n.push("origin:"),ju(n,t.origin)),t.author&&(n.push("author:"),ju(n,t.author)),`---
|
|
234
234
|
${n.join(`
|
|
235
235
|
`)}
|
|
236
236
|
---
|
|
237
|
-
${e}`}function
|
|
237
|
+
${e}`}function ju(t,e){for(let[n,s]of Object.entries(e))s!==void 0&&t.push(` ${n}: ${Os(String(s))}`)}function Os(t){return t.includes(":")||t.includes("#")||t.includes('"')?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function de(t){let e=Yy(t,"utf-8");return Vr(e)}function Wr(t,e,n){Vy(t,Gr(e,n),"utf-8")}function Hu(t){let e=t.match(/^(---\n)([\s\S]*?)(\n---\n?)([\s\S]*)$/);if(!e)return t;let n=e[1],s=e[2],i=e[3],r=e[4],o=s.split(`
|
|
238
238
|
`),a=[],l=!1;for(let c of o){if(l){if(c.match(/^\s+\S/))continue;l=!1}if(c.match(/^origin:\s*$/)){l=!0;continue}c.match(/^origin:\s+\S/)||a.push(c)}return n+a.join(`
|
|
239
|
-
`)+i+r}var pt=O(()=>{"use strict"});import{createHash as
|
|
239
|
+
`)+i+r}var pt=O(()=>{"use strict"});import{createHash as Gy}from"node:crypto";import{readdirSync as Wy,readFileSync as Jy,statSync as Qy}from"node:fs";import{join as Yu}from"node:path";function an(t){let e=Vu(t).sort(),n=Gy("sha256");for(let s=0;s<e.length;s++){s>0&&n.update("\0");let i=Yu(t,e[s]),r=Jy(i,"utf-8");e[s]==="SKILL.md"?n.update(Hu(r)):n.update(r)}return n.digest("hex")}function Vu(t,e=""){let n=Wy(t),s=[];for(let i of n){let r=Yu(t,i),o=e?`${e}/${i}`:i;Qy(r).isDirectory()?s.push(...Vu(r,o)):s.push(o)}return s}var Jr=O(()=>{"use strict";pt()});import{execFileSync as Ns}from"node:child_process";import{existsSync as Ts,mkdirSync as Qb,unlinkSync as Wu}from"node:fs";import{join as Ju,resolve as Gu}from"node:path";function Qu(t){let e=Gu(t,".hive-state");return{stateDir:e,gitDir:Gu(e,"git")}}function ht(t,e,n,s){let{gitDir:i}=Qu(t);if(!Ts(i)){ln.warn("Instance git not initialized \u2014 skipping state commit");return}let r=Ju(i,"state-index.tmp"),o={...process.env,GIT_DIR:i,GIT_WORK_TREE:t,GIT_INDEX_FILE:r},a=(...l)=>Ns("git",[...l],{cwd:t,env:o,stdio:"pipe",encoding:"utf-8"}).trim();try{a("read-tree","state");for(let p of e)a("add","--force","--",p);try{a("rm","--cached","--ignore-unmatch","-r","--","**/.DS_Store")}catch{}let l=a("write-tree"),c=a("rev-parse","state"),d=a("rev-parse","state^{tree}");if(l===d)return;let u=s?{GIT_AUTHOR_NAME:s,GIT_AUTHOR_EMAIL:`${s}@hive`,GIT_COMMITTER_NAME:s,GIT_COMMITTER_EMAIL:`${s}@hive`}:{GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},f=Ns("git",["commit-tree",l,"-p",c,"-m",n],{env:{...o,...u},encoding:"utf-8"}).trim();a("update-ref","refs/heads/state",f),ln.debug("State branch commit",{message:n,files:e.length})}catch(l){ln.warn("Failed to commit to state branch",{error:String(l),message:n})}finally{try{Ts(r)&&Wu(r)}catch{}}}function zu(t,e,n){let{gitDir:s}=Qu(t);if(!Ts(s))return;let i=Ju(s,"state-index.tmp"),r={...process.env,GIT_DIR:s,GIT_WORK_TREE:t,GIT_INDEX_FILE:i},o=(...a)=>Ns("git",[...a],{cwd:t,env:r,stdio:"pipe",encoding:"utf-8"}).trim();try{o("read-tree","state");for(let u of e)try{o("rm","-r","--cached","--",u)}catch{}let a=o("write-tree"),l=o("rev-parse","state"),c=o("rev-parse","state^{tree}");if(a===c)return;let d=Ns("git",["commit-tree",a,"-p",l,"-m",n],{env:{...r,GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},encoding:"utf-8"}).trim();o("update-ref","refs/heads/state",d),ln.debug("State branch removal commit",{message:n})}catch(a){ln.warn("Failed to commit removal to state branch",{error:String(a)})}finally{try{Ts(i)&&Wu(i)}catch{}}}var ln,Ls=O(()=>{"use strict";ce();ln=B("instance-git")});import{cpSync as zy,existsSync as Xu,mkdirSync as Xy,readFileSync as Zu,writeFileSync as Zy}from"node:fs";import{join as Cs,relative as eS}from"node:path";function tf(t,e,n,s){let i=Br(t);try{let r=Cs(i.dir,"skills",e);if(!Xu(r)){let m=jr(i.dir);throw new Error(`Skill "${e}" not found in registry ${t}. Available skills: ${m.join(", ")||"(none)"}`)}let o=Cs(r,"SKILL.md"),a=Ku(o,e),c=Zu(o,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(c){let m=c[1].match(/^name:\s*(.+)$/m);m&&m[1].trim()!==e&&ef.warn("Registry skill name mismatch \u2014 using directory name",{dirName:e,frontmatterName:m[1].trim()})}let d=Bu(n,a,e);if(Xu(d))throw new Error(`Skill "${e}" is already installed at ${d}. Use "hive skill upgrade ${e}" to update, or "hive skill remove ${e}" first.`);Xy(d,{recursive:!0}),zy(r,d,{recursive:!0});let u=an(d),f=dt(i.dir,i.headSha),{frontmatter:p,body:y}=Vr(Zu(Cs(d,"SKILL.md"),"utf-8"));p.origin={type:"registry",source:t,"base-version":i.headSha,...f?{"base-tag":f}:{},"base-content-hash":u,"installed-at":new Date().toISOString(),modified:!1},Zy(Cs(d,"SKILL.md"),Gr(p,y));let h=eS(s,d);return ht(s,[h],`install: ${a}/${e} from ${t}@${i.headSha.slice(0,8)}`),ef.info("Skill installed",{name:e,workflow:a,version:i.headSha.slice(0,8)}),{name:e,workflow:a,targetPath:d,version:i.headSha}}finally{i.cleanup()}}var ef,nf=O(()=>{"use strict";on();Fu();pt();Jr();Ls();ce();ef=B("skill-install")});import{existsSync as Ms,readFileSync as Qr,cpSync as Ps,mkdirSync as sf,readdirSync as tS,statSync as nS}from"node:fs";import{join as V,relative as zr}from"node:path";function Xr(t,e){if(!Ms(e))return null;for(let n of tS(e)){let s=V(e,n);try{if(!nS(s).isDirectory())continue}catch{continue}let i=V(s,"skills",t);if(Ms(V(i,"SKILL.md")))return{path:i,workflow:n}}return null}async function Zr(t,e,n,s){let i=Xr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed or is not registry-sourced.`);let{frontmatter:r}=de(V(i.path,"SKILL.md")),o=r.origin;if(!o||o.type!=="registry"||!o.source||!o["base-version"])throw new Error(`Skill "${t}" has no registry origin metadata.`);let a=Ur(o.source),l=o["base-version"];if(a===l)return{name:t,action:"up-to-date",oldVersion:l};let c=Fr(o.source);try{let d=V(c.dir,"skills",t);if(!Ms(V(d,"SKILL.md")))return rf.warn("Skill removed from registry \u2014 keeping installed copy",{name:t,source:o.source}),ht(n,[zr(n,i.path)],`upgrade-check: ${i.workflow}/${t} removed from upstream registry`),{name:t,action:"removed-upstream",oldVersion:l};if(!o.modified){Ps(d,i.path,{recursive:!0});let k=an(i.path),I=dt(c.dir,a),{frontmatter:T,body:E}=de(V(i.path,"SKILL.md"));T.origin={...T.origin,"base-version":a,"base-content-hash":k,"installed-at":new Date().toISOString(),modified:!1,...I?{"base-tag":I}:{}},Wr(V(i.path,"SKILL.md"),T,E);let M=zr(n,i.path);return ht(n,[M],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)}`),{name:t,action:"applied",oldVersion:l,newVersion:a}}let u=Qr(V(i.path,"SKILL.md"),"utf-8"),f=Qr(V(d,"SKILL.md"),"utf-8"),p=V(c.dir,".hive-theirs-copy",t);sf(p,{recursive:!0}),Ps(d,p,{recursive:!0});let y;try{Hr(c.dir,l);let k=V(c.dir,"skills",t,"SKILL.md");Ms(k)&&(y=Qr(k,"utf-8"))}catch{}if(await s(u,f,y)==="keep")return{name:t,action:"kept",oldVersion:l};if(!y){let k=V(n,".hive","skill-backups",`${t}-${Date.now()}`);sf(k,{recursive:!0}),Ps(i.path,k,{recursive:!0}),rf.info("Backed up modified skill before upgrade",{backup:k})}Ps(p,i.path,{recursive:!0});let m=an(i.path),w=dt(c.dir,a),{frontmatter:b,body:A}=de(V(i.path,"SKILL.md"));b.origin={...b.origin,"base-version":a,"base-content-hash":m,"installed-at":new Date().toISOString(),modified:!1,...w?{"base-tag":w}:{}},Wr(V(i.path,"SKILL.md"),b,A);let _=zr(n,i.path);return ht(n,[_],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)} (took upstream)`),{name:t,action:"taken",oldVersion:l,newVersion:a}}finally{c.cleanup()}}var rf,eo=O(()=>{"use strict";on();pt();Jr();Ls();ce();rf=B("skill-upgrade")});import{existsSync as of,rmSync as af,readdirSync as sS}from"node:fs";import{join as to,relative as iS}from"node:path";async function cf(t,e,n,s={}){let i=Xr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed.`);let r=to(i.path,"SKILL.md");if(of(r))try{let{frontmatter:l}=de(r);if((l.origin?.modified===!0||l.origin?.type==="agent-authored")&&!s.force){let d=`Warning: ${i.workflow}/${t} has local modifications that will be removed. Your changes are preserved in git history on the 'state' branch. Proceed?`;if(s.confirmFn){if(!await s.confirmFn(d))return lf.info("Skill removal aborted by user",{name:t}),!1}else return console.log(d),console.log("Use --force to skip this prompt."),!1}}catch{}let o=iS(n,i.path);af(i.path,{recursive:!0,force:!0});let a=to(e,i.workflow,"skills");return of(a)&&sS(a).length===0&&af(to(e,i.workflow),{recursive:!0,force:!0}),zu(n,[o],`remove: ${i.workflow}/${t}`),lf.info("Skill removed",{name:t,workflow:i.workflow}),!0}var lf,uf=O(()=>{"use strict";pt();Ls();eo();ce();lf=B("skill-remove")});var df={};Q(df,{runSkill:()=>aS});import{existsSync as ye,readdirSync as mt,readFileSync as rS,statSync as oS}from"node:fs";import{join as De}from"node:path";import{createInterface as ff}from"node:readline";async function aS(t,...e){switch(t){case"add":{rn();let n=e[0];n||(console.error("Usage: hive skill add <name|registry:name|url#skills/name>"),process.exit(1));let{config:s}=await Promise.resolve().then(()=>(vs(),Ss)),i=qu(n),r=Ru(i,s.skillRegistries),o=tf(r.url,i.name,Y,P);console.log(`Installed ${o.workflow}/${o.name} (${o.version.slice(0,8)})`);break}case"list":{e.includes("--available")?(rn(),await cS(e)):lS();break}case"upgrade":{rn();let n=e[0];n||(console.error("Usage: hive skill upgrade <name|--all>"),process.exit(1));let s=async(i,r,o)=>{console.log(`
|
|
240
240
|
--- Your version (installed) ---`),console.log(i.slice(0,500)+(i.length>500?`
|
|
241
241
|
...`:"")),console.log(`
|
|
242
242
|
--- Upstream version (registry) ---`),console.log(r.slice(0,500)+(r.length>500?`
|
|
243
243
|
...`:"")),console.log(o?`
|
|
244
244
|
(Three-way diff available)`:`
|
|
245
|
-
(Two-way comparison \u2014 base version unreachable)`);let a=
|
|
246
|
-
[k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await
|
|
247
|
-
`);for(let e of t.sort()){let n=De(Y,e,"skills");if(ye(n))for(let s of mt(n).sort()){let i=De(n,s,"SKILL.md");if(ye(i))try{let{frontmatter:r}=
|
|
245
|
+
(Two-way comparison \u2014 base version unreachable)`);let a=ff({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`
|
|
246
|
+
[k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await fS(s);else{let i=await Zr(n,Y,P,s);console.log(`${i.name}: ${i.action}`)}break}case"remove":{let n=e[0];n||(console.error("Usage: hive skill remove <name> [--force]"),process.exit(1));let s=e.includes("--force");await cf(n,Y,P,{force:s,confirmFn:async o=>{let a=ff({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`${o} [y/N] `,c)});return a.close(),l.toLowerCase()==="y"}})&&console.log(`Removed ${n}`);break}case"search":{let n=e[0];n||(console.error("Usage: hive skill search <query>"),process.exit(1)),uS(n);break}default:console.error("Usage: hive skill <add|list|upgrade|remove|search> [args]"),process.exit(1)}}function lS(){if(!ye(Y)){console.log("No skills installed.");return}let t=mt(Y).filter(e=>{try{return oS(De(Y,e)).isDirectory()}catch{return!1}});if(t.length===0){console.log("No skills installed.");return}console.log(`Installed skills:
|
|
247
|
+
`);for(let e of t.sort()){let n=De(Y,e,"skills");if(ye(n))for(let s of mt(n).sort()){let i=De(n,s,"SKILL.md");if(ye(i))try{let{frontmatter:r}=de(i),o=r.origin?.type??"unknown",a=r.origin?.modified!==void 0?String(r.origin.modified):"-";console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${o.padEnd(15)} ${a}`)}catch{console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${"?".padEnd(15)} ?`)}}}}async function cS(t){let{shallowClone:e,listSkillsInClone:n}=await Promise.resolve().then(()=>(on(),Du)),{config:s}=await Promise.resolve().then(()=>(vs(),Ss)),i=t.indexOf("--from"),r=i>=0?t[i+1]:void 0,o=r?[{name:r,url:s.skillRegistries.find(a=>a.name===r)?.url??r}]:s.skillRegistries;for(let a of o){console.log(`
|
|
248
248
|
Registry: ${a.name} (${a.url})
|
|
249
|
-
`);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let
|
|
250
|
-
`);for(let r of i){let o=r.default?" (default)":"";console.log(` ${r.name}${o}`),console.log(` ${r.url}`)}break}case"remove":{let s=e[0];s||(console.error("Usage: hive registry remove <name>"),process.exit(1));let i=
|
|
251
|
-
`)),process.exit(1)}var{positionals:qe,values:Se}=
|
|
249
|
+
`);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let d of c.sort()){let u=De(l.dir,"skills",d,"SKILL.md"),y=rS(u,"utf-8").match(/^description:\s*(.+)$/m)?.[1]?.trim()??"";console.log(` ${d.padEnd(30)} ${y}`)}}finally{l.cleanup()}}}function uS(t){let e=t.toLowerCase(),n=!1;if(ye(Y))for(let s of mt(Y)){let i=De(Y,s,"skills");if(ye(i))for(let r of mt(i)){let o=De(i,r,"SKILL.md");if(ye(o))try{let{frontmatter:a}=de(o);(r.toLowerCase().includes(e)||(a.description??"").toLowerCase().includes(e))&&(console.log(` ${r} (${s}) \u2014 ${a.description??""}`),n=!0)}catch{}}}n||console.log("No matching skills found.")}async function fS(t){if(!ye(Y)){console.log("No skills installed.");return}let e=[];for(let n of mt(Y)){let s=De(Y,n,"skills");if(ye(s))for(let i of mt(s).sort()){let r=De(s,i,"SKILL.md");if(ye(r))try{let{frontmatter:o}=de(r);o.origin?.type==="registry"&&e.push(i)}catch{}}}if(e.length===0){console.log("No registry-sourced skills to upgrade.");return}for(let n of e)try{let s=await Zr(n,Y,P,t);console.log(`${s.name}: ${s.action}`)}catch(s){console.error(`${n}: failed \u2014 ${String(s)}`)}}var pf=O(()=>{"use strict";on();xu();nf();eo();uf();pt();G()});var hf={};Q(hf,{runRegistry:()=>dS});async function dS(t,...e){let n=$e();switch(t){case"add":{let s=e[0];s||(console.error("Usage: hive registry add <url> [--as <name>] [--default]"),process.exit(1));let i=e.indexOf("--as"),r=i>=0&&e[i+1]?e[i+1]:pS(s),o=e.includes("--default"),a=le(n);if(a.skillRegistries||(a.skillRegistries=[]),a.skillRegistries.some(l=>l.name===r)&&(console.error(`Registry "${r}" already exists.`),process.exit(1)),o)for(let l of a.skillRegistries)delete l.default;a.skillRegistries.push({name:r,url:s,...o?{default:!0}:{}}),ut(a,n),console.log(`Added registry "${r}" (${s})${o?" [default]":""}`);break}case"list":{let i=le(n).skillRegistries??[];if(i.length===0){console.log("No registries configured. Using built-in default: https://github.com/keepur/hive-skills");return}console.log(`Configured registries:
|
|
250
|
+
`);for(let r of i){let o=r.default?" (default)":"";console.log(` ${r.name}${o}`),console.log(` ${r.url}`)}break}case"remove":{let s=e[0];s||(console.error("Usage: hive registry remove <name>"),process.exit(1));let i=le(n);i.skillRegistries||(console.error("No registries configured."),process.exit(1));let r=i.skillRegistries.findIndex(o=>o.name===s);r<0&&(console.error(`Registry "${s}" not found.`),process.exit(1)),i.skillRegistries.splice(r,1),ut(i,n),console.log(`Removed registry "${s}". Installed skills from this registry are unaffected.`);break}default:console.error("Usage: hive registry <add|list|remove>"),process.exit(1)}}function pS(t){return t.replace(/\.git$/,"").replace(/\/$/,"").split("/").filter(Boolean).slice(-2).join("-").replace(/^github\.com-/,"")}var mf=O(()=>{"use strict";Es()});G();import{parseArgs as hS}from"node:util";import{resolve as Re,join as no}from"node:path";import{existsSync as cn,readFileSync as mS,statSync as gS,readdirSync as yS}from"node:fs";function SS(){let t=se();if(cn(no(t,"hive.yaml")))return t;let e=[`No Hive install found at ${t}.`," Run `hive init` to set up a new instance, or"," pass --config <path/to/hive.yaml> to use an existing one, or"," set HIVE_HOME to an existing install directory."],n=process.env.HOME??"/tmp",s=Re(n,"services","hive"),i=[];if(cn(s))try{for(let r of yS(s)){let o=no(s,r,"hive.yaml");cn(o)&&i.push(no(s,r))}}catch{}i.length>0&&(e.push(""),e.push(`Available installs: ${i.join(", ")}`)),console.error(e.join(`
|
|
251
|
+
`)),process.exit(1)}var{positionals:qe,values:Se}=hS({allowPositionals:!0,options:{help:{type:"boolean",short:"h",default:!1},daemon:{type:"boolean",default:!1},config:{type:"string"},version:{type:"boolean",short:"v",default:!1},verbose:{type:"boolean",default:!1},tag:{type:"string"},instance:{type:"string"}}}),so=qe[0];if(Se.version){let t=JSON.parse(mS(Re(import.meta.dirname,"..","package.json"),"utf-8"));console.log(`hive v${t.version}`),process.exit(0)}(Se.help||!so)&&(console.log(`
|
|
252
252
|
hive \u2014 AI agent platform
|
|
253
253
|
|
|
254
254
|
Usage:
|
|
@@ -280,4 +280,4 @@ Options:
|
|
|
280
280
|
--config <path> Path to hive.yaml
|
|
281
281
|
-v, --version Show version
|
|
282
282
|
-h, --help Show this help
|
|
283
|
-
`),process.exit(0));var
|
|
283
|
+
`),process.exit(0));var $s=Re(import.meta.dirname,"..");if(Se.config){let t=Re(Se.config);if(cn(t)){let e=gS(t);process.env.HIVE_HOME=e.isDirectory()?t:Re(t,"..")}else console.error(`Config not found: ${t}`),process.exit(1)}switch(so){case"init":{let{runSetupWizard:t}=await Promise.resolve().then(()=>(Nc(),Oc));await t($s);break}case"start":{let t=SS();if(Se.daemon){let{startDaemon:e}=await Promise.resolve().then(()=>(us(),cs));await e(t)}else{let{execFileSync:e}=await import("node:child_process"),n=cn(Re($s,"pkg","server.min.js"))?Re($s,"pkg","server.min.js"):Re($s,"dist","index.js");e(process.execPath,[n],{stdio:"inherit",env:{...process.env,HIVE_HOME:t}})}break}case"stop":{let{stopDaemon:t}=await Promise.resolve().then(()=>(us(),cs));await t(se());break}case"status":{let{showStatus:t}=await Promise.resolve().then(()=>(Pc(),Cc));await t();break}case"update":{let{runUpdate:t}=await Promise.resolve().then(()=>(Kc(),xc));await t({tag:Se.tag,instance:Se.instance});break}case"rollback":{let{runRollback:t}=await Promise.resolve().then(()=>(Uc(),Fc));await t({instance:Se.instance});break}case"migrate-0.2":{let t=qe[1];t||(console.error("Usage: hive migrate-0.2 [--dry-run] <instance_dir>"),process.exit(2));let e=process.argv.includes("--dry-run"),{runMigrate:n}=await Promise.resolve().then(()=>(Yc(),Hc));await n({instanceDir:t,dryRun:e});break}case"doctor":{let{runDoctor:t}=await Promise.resolve().then(()=>(bu(),wu));await t({verbose:!!Se.verbose});break}case"plugin":{let t=qe[1],e=qe[2],{runPlugin:n}=await Promise.resolve().then(()=>(Cu(),Lu));await n(t,e);break}case"skill":{let t=qe[1],e=qe.slice(2),{runSkill:n}=await Promise.resolve().then(()=>(pf(),df));await n(t,...e);break}case"registry":{let t=qe[1],e=qe.slice(2),{runRegistry:n}=await Promise.resolve().then(()=>(mf(),hf));await n(t,...e);break}default:console.error(`Unknown command: ${so}`),console.error('Run "hive --help" for usage.'),process.exit(1)}
|