@keepur/hive 0.8.2 → 0.9.0

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/pkg/cli.min.js CHANGED
@@ -1,123 +1,123 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __hiveCreateRequire } from 'module'; const require = __hiveCreateRequire(import.meta.url);
3
- var td=Object.create;var Gs=Object.defineProperty;var nd=Object.getOwnPropertyDescriptor;var sd=Object.getOwnPropertyNames;var id=Object.getPrototypeOf,rd=Object.prototype.hasOwnProperty;var ke=(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 v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Y=(t,e)=>{for(var n in e)Gs(t,n,{get:e[n],enumerable:!0})},od=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sd(e))!rd.call(t,i)&&i!==n&&Gs(t,i,{get:()=>e[i],enumerable:!(s=nd(e,i))||s.enumerable});return t};var oe=(t,e,n)=>(n=t!=null?td(id(t)):{},od(e||!t||!t.__esModule?Gs(n,"default",{value:t,enumerable:!0}):n,t));var T=v(F=>{"use strict";var Vs=Symbol.for("yaml.alias"),bo=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),ko=Symbol.for("yaml.pair"),Ws=Symbol.for("yaml.scalar"),vn=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),ad=t=>!!t&&typeof t=="object"&&t[me]===Vs,ld=t=>!!t&&typeof t=="object"&&t[me]===bo,cd=t=>!!t&&typeof t=="object"&&t[me]===Sn,ud=t=>!!t&&typeof t=="object"&&t[me]===ko,Eo=t=>!!t&&typeof t=="object"&&t[me]===Ws,fd=t=>!!t&&typeof t=="object"&&t[me]===vn;function Ao(t){if(t&&typeof t=="object")switch(t[me]){case Sn:case vn:return!0}return!1}function dd(t){if(t&&typeof t=="object")switch(t[me]){case Vs:case Sn:case Ws:case vn:return!0}return!1}var pd=t=>(Eo(t)||Ao(t))&&!!t.anchor;F.ALIAS=Vs;F.DOC=bo;F.MAP=Sn;F.NODE_TYPE=me;F.PAIR=ko;F.SCALAR=Ws;F.SEQ=vn;F.hasAnchor=pd;F.isAlias=ad;F.isCollection=Ao;F.isDocument=ld;F.isMap=cd;F.isNode=dd;F.isPair=ud;F.isScalar=Eo;F.isSeq=fd});var Et=v(Js=>{"use strict";var R=T(),W=Symbol("break visit"),Io=Symbol("skip children"),ae=Symbol("remove node");function wn(t,e){let n=_o(e);R.isDocument(t)?Xe(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):Xe(null,t,n,Object.freeze([]))}wn.BREAK=W;wn.SKIP=Io;wn.REMOVE=ae;function Xe(t,e,n,s){let i=Oo(t,e,n,s);if(R.isNode(i)||R.isPair(i))return To(t,s,i),Xe(t,i,n,s);if(typeof i!="symbol"){if(R.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=Xe(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ae&&(e.items.splice(r,1),r-=1)}}}else if(R.isPair(e)){s=Object.freeze(s.concat(e));let r=Xe("key",e.key,n,s);if(r===W)return W;r===ae&&(e.key=null);let o=Xe("value",e.value,n,s);if(o===W)return W;o===ae&&(e.value=null)}}return i}async function bn(t,e){let n=_o(e);R.isDocument(t)?await Ze(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):await Ze(null,t,n,Object.freeze([]))}bn.BREAK=W;bn.SKIP=Io;bn.REMOVE=ae;async function Ze(t,e,n,s){let i=await Oo(t,e,n,s);if(R.isNode(i)||R.isPair(i))return To(t,s,i),Ze(t,i,n,s);if(typeof i!="symbol"){if(R.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ze(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ae&&(e.items.splice(r,1),r-=1)}}}else if(R.isPair(e)){s=Object.freeze(s.concat(e));let r=await Ze("key",e.key,n,s);if(r===W)return W;r===ae&&(e.key=null);let o=await Ze("value",e.value,n,s);if(o===W)return W;o===ae&&(e.value=null)}}return i}function _o(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 Oo(t,e,n,s){if(typeof n=="function")return n(t,e,s);if(R.isMap(e))return n.Map?.(t,e,s);if(R.isSeq(e))return n.Seq?.(t,e,s);if(R.isPair(e))return n.Pair?.(t,e,s);if(R.isScalar(e))return n.Scalar?.(t,e,s);if(R.isAlias(e))return n.Alias?.(t,e,s)}function To(t,e,n){let s=e[e.length-1];if(R.isCollection(s))s.items[t]=n;else if(R.isPair(s))t==="key"?s.key=n:s.value=n;else if(R.isDocument(s))s.contents=n;else{let i=R.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Js.visit=wn;Js.visitAsync=bn});var Qs=v(Co=>{"use strict";var No=T(),hd=Et(),md={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gd=t=>t.replace(/[!,[\]{}]/g,e=>md[e]),At=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+gd(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&&No.isNode(e.contents)){let r={};hd.visit(e.contents,(o,a)=>{No.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
- `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};Co.Directives=At});var kn=v(It=>{"use strict";var Lo=T(),yd=Et();function Sd(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 $o(t){let e=new Set;return yd.visit(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function Po(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function vd(t,e){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=$o(t));let o=Po(e,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(Lo.isScalar(o.node)||Lo.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}}It.anchorIsValid=Sd;It.anchorNames=$o;It.createNodeAnchors=vd;It.findNewAnchor=Po});var zs=v(Mo=>{"use strict";function _t(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=_t(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=_t(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=_t(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=_t(t,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return t.call(e,n,s)}Mo.applyReviver=_t});var Ee=v(qo=>{"use strict";var wd=T();function Do(t,e,n){if(Array.isArray(t))return t.map((s,i)=>Do(s,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!wd.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}qo.toJS=Do});var En=v(xo=>{"use strict";var bd=zs(),Ro=T(),kd=Ee(),Xs=class{constructor(e){Object.defineProperty(this,Ro.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(!Ro.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=kd.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?bd.applyReviver(r,{"":a},"",a):a}};xo.NodeBase=Xs});var Ot=v(Ko=>{"use strict";var Ed=kn(),Ad=Et(),et=T(),Id=En(),_d=Ee(),Zs=class extends Id.NodeBase{constructor(e){super(et.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=[],Ad.visit(e,{Node:(r,o)=>{(et.isAlias(o)||et.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||(_d.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=An(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(Ed.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 An(t,e,n){if(et.isAlias(e)){let s=e.resolve(t),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(et.isCollection(e)){let s=0;for(let i of e.items){let r=An(t,i,n);r>s&&(s=r)}return s}else if(et.isPair(e)){let s=An(t,e.key,n),i=An(t,e.value,n);return Math.max(s,i)}return 1}Ko.Alias=Zs});var M=v(ei=>{"use strict";var Od=T(),Td=En(),Nd=Ee(),Cd=t=>!t||typeof t!="function"&&typeof t!="object",Ae=class extends Td.NodeBase{constructor(e){super(Od.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Nd.toJS(this.value,e,n)}toString(){return String(this.value)}};Ae.BLOCK_FOLDED="BLOCK_FOLDED";Ae.BLOCK_LITERAL="BLOCK_LITERAL";Ae.PLAIN="PLAIN";Ae.QUOTE_DOUBLE="QUOTE_DOUBLE";Ae.QUOTE_SINGLE="QUOTE_SINGLE";ei.Scalar=Ae;ei.isScalarValue=Cd});var Tt=v(Fo=>{"use strict";var Ld=Ot(),xe=T(),Bo=M(),$d="tag:yaml.org,2002:";function Pd(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 Md(t,e,n){if(xe.isDocument(t)&&(t=t.contents),xe.isNode(t))return t;if(xe.isPair(t)){let f=n.schema[xe.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(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 Ld.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=$d+e.slice(2));let c=Pd(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Bo.Scalar(t);return l&&(l.node=f),f}c=t instanceof Map?o[xe.MAP]:Symbol.iterator in Object(t)?o[xe.SEQ]:o[xe.MAP]}r&&(r(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new Bo.Scalar(t);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}Fo.createNode=Md});var _n=v(In=>{"use strict";var Dd=Tt(),le=T(),qd=En();function ti(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 Dd.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 Uo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,ni=class extends qd.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=>le.isNode(s)||le.isPair(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Uo(e))this.add(n);else{let[s,...i]=e,r=this.get(s,!0);if(le.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,ti(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(le.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&&le.isScalar(r)?r.value:r:le.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!le.isPair(n))return!1;let s=n.value;return s==null||e&&le.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 le.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(le.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,ti(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};In.Collection=ni;In.collectionFromPath=ti;In.isEmptyPath=Uo});var Nt=v(On=>{"use strict";var Rd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function si(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var xd=(t,e,n)=>t.endsWith(`
3
+ var rd=Object.create;var Gs=Object.defineProperty;var od=Object.getOwnPropertyDescriptor;var ad=Object.getOwnPropertyNames;var ld=Object.getPrototypeOf,cd=Object.prototype.hasOwnProperty;var ke=(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 T=(t,e)=>()=>(t&&(e=t(t=0)),e);var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Y=(t,e)=>{for(var n in e)Gs(t,n,{get:e[n],enumerable:!0})},ud=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ad(e))!cd.call(t,i)&&i!==n&&Gs(t,i,{get:()=>e[i],enumerable:!(s=od(e,i))||s.enumerable});return t};var oe=(t,e,n)=>(n=t!=null?rd(ld(t)):{},ud(e||!t||!t.__esModule?Gs(n,"default",{value:t,enumerable:!0}):n,t));var O=w(U=>{"use strict";var Vs=Symbol.for("yaml.alias"),bo=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),ko=Symbol.for("yaml.pair"),Ws=Symbol.for("yaml.scalar"),vn=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),fd=t=>!!t&&typeof t=="object"&&t[me]===Vs,dd=t=>!!t&&typeof t=="object"&&t[me]===bo,pd=t=>!!t&&typeof t=="object"&&t[me]===Sn,hd=t=>!!t&&typeof t=="object"&&t[me]===ko,Eo=t=>!!t&&typeof t=="object"&&t[me]===Ws,md=t=>!!t&&typeof t=="object"&&t[me]===vn;function Ao(t){if(t&&typeof t=="object")switch(t[me]){case Sn:case vn:return!0}return!1}function gd(t){if(t&&typeof t=="object")switch(t[me]){case Vs:case Sn:case Ws:case vn:return!0}return!1}var yd=t=>(Eo(t)||Ao(t))&&!!t.anchor;U.ALIAS=Vs;U.DOC=bo;U.MAP=Sn;U.NODE_TYPE=me;U.PAIR=ko;U.SCALAR=Ws;U.SEQ=vn;U.hasAnchor=yd;U.isAlias=fd;U.isCollection=Ao;U.isDocument=dd;U.isMap=pd;U.isNode=gd;U.isPair=hd;U.isScalar=Eo;U.isSeq=md});var Et=w(Js=>{"use strict";var q=O(),W=Symbol("break visit"),Io=Symbol("skip children"),ae=Symbol("remove node");function wn(t,e){let n=_o(e);q.isDocument(t)?Xe(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):Xe(null,t,n,Object.freeze([]))}wn.BREAK=W;wn.SKIP=Io;wn.REMOVE=ae;function Xe(t,e,n,s){let i=To(t,e,n,s);if(q.isNode(i)||q.isPair(i))return Oo(t,s,i),Xe(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=Xe(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ae&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=Xe("key",e.key,n,s);if(r===W)return W;r===ae&&(e.key=null);let o=Xe("value",e.value,n,s);if(o===W)return W;o===ae&&(e.value=null)}}return i}async function bn(t,e){let n=_o(e);q.isDocument(t)?await Ze(null,t.contents,n,Object.freeze([t]))===ae&&(t.contents=null):await Ze(null,t,n,Object.freeze([]))}bn.BREAK=W;bn.SKIP=Io;bn.REMOVE=ae;async function Ze(t,e,n,s){let i=await To(t,e,n,s);if(q.isNode(i)||q.isPair(i))return Oo(t,s,i),Ze(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 Ze(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===W)return W;o===ae&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=await Ze("key",e.key,n,s);if(r===W)return W;r===ae&&(e.key=null);let o=await Ze("value",e.value,n,s);if(o===W)return W;o===ae&&(e.value=null)}}return i}function _o(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 To(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 Oo(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`)}}Js.visit=wn;Js.visitAsync=bn});var Qs=w(Co=>{"use strict";var No=O(),Sd=Et(),vd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},wd=t=>t.replace(/[!,[\]{}]/g,e=>vd[e]),At=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+wd(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&&No.isNode(e.contents)){let r={};Sd.visit(e.contents,(o,a)=>{No.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
+ `)}};At.defaultYaml={explicit:!1,version:"1.2"};At.defaultTags={"!!":"tag:yaml.org,2002:"};Co.Directives=At});var kn=w(It=>{"use strict";var $o=O(),bd=Et();function kd(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 Lo(t){let e=new Set;return bd.visit(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function Mo(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function Ed(t,e){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=Lo(t));let o=Mo(e,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&($o.isScalar(o.node)||$o.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}}It.anchorIsValid=kd;It.anchorNames=Lo;It.createNodeAnchors=Ed;It.findNewAnchor=Mo});var zs=w(Po=>{"use strict";function _t(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=_t(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=_t(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=_t(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=_t(t,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return t.call(e,n,s)}Po.applyReviver=_t});var Ee=w(Ro=>{"use strict";var Ad=O();function Do(t,e,n){if(Array.isArray(t))return t.map((s,i)=>Do(s,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Ad.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}Ro.toJS=Do});var En=w(xo=>{"use strict";var Id=zs(),qo=O(),_d=Ee(),Xs=class{constructor(e){Object.defineProperty(this,qo.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(!qo.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=_d.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?Id.applyReviver(r,{"":a},"",a):a}};xo.NodeBase=Xs});var Tt=w(Ko=>{"use strict";var Td=kn(),Od=Et(),et=O(),Nd=En(),Cd=Ee(),Zs=class extends Nd.NodeBase{constructor(e){super(et.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=[],Od.visit(e,{Node:(r,o)=>{(et.isAlias(o)||et.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||(Cd.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=An(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(Td.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 An(t,e,n){if(et.isAlias(e)){let s=e.resolve(t),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(et.isCollection(e)){let s=0;for(let i of e.items){let r=An(t,i,n);r>s&&(s=r)}return s}else if(et.isPair(e)){let s=An(t,e.key,n),i=An(t,e.value,n);return Math.max(s,i)}return 1}Ko.Alias=Zs});var P=w(ei=>{"use strict";var $d=O(),Ld=En(),Md=Ee(),Pd=t=>!t||typeof t!="function"&&typeof t!="object",Ae=class extends Ld.NodeBase{constructor(e){super($d.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:Md.toJS(this.value,e,n)}toString(){return String(this.value)}};Ae.BLOCK_FOLDED="BLOCK_FOLDED";Ae.BLOCK_LITERAL="BLOCK_LITERAL";Ae.PLAIN="PLAIN";Ae.QUOTE_DOUBLE="QUOTE_DOUBLE";Ae.QUOTE_SINGLE="QUOTE_SINGLE";ei.Scalar=Ae;ei.isScalarValue=Pd});var Ot=w(Uo=>{"use strict";var Dd=Tt(),xe=O(),Bo=P(),Rd="tag:yaml.org,2002:";function qd(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 xd(t,e,n){if(xe.isDocument(t)&&(t=t.contents),xe.isNode(t))return t;if(xe.isPair(t)){let f=n.schema[xe.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(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 Dd.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=Rd+e.slice(2));let c=qd(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Bo.Scalar(t);return l&&(l.node=f),f}c=t instanceof Map?o[xe.MAP]:Symbol.iterator in Object(t)?o[xe.SEQ]:o[xe.MAP]}r&&(r(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new Bo.Scalar(t);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}Uo.createNode=xd});var _n=w(In=>{"use strict";var Kd=Ot(),le=O(),Bd=En();function ti(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 Kd.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 Fo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,ni=class extends Bd.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=>le.isNode(s)||le.isPair(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Fo(e))this.add(n);else{let[s,...i]=e,r=this.get(s,!0);if(le.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,ti(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(le.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&&le.isScalar(r)?r.value:r:le.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!le.isPair(n))return!1;let s=n.value;return s==null||e&&le.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 le.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(le.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,ti(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};In.Collection=ni;In.collectionFromPath=ti;In.isEmptyPath=Fo});var Nt=w(Tn=>{"use strict";var Ud=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function si(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Fd=(t,e,n)=>t.endsWith(`
5
5
  `)?si(n,e):n.includes(`
6
6
  `)?`
7
- `+si(n,e):(t.endsWith(" ")?"":" ")+n;On.indentComment=si;On.lineComment=xd;On.stringifyComment=Rd});var Ho=v(Ct=>{"use strict";var Kd="flow",ii="block",Tn="quoted";function Bd(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=[],u={},f=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):f=i-s);let d,p,y=!1,h=-1,m=-1,w=-1;n===ii&&(h=jo(t,h,e.length),h!==-1&&(f=h+l));for(let A;A=t[h+=1];){if(n===Tn&&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===`
7
+ `+si(n,e):(t.endsWith(" ")?"":" ")+n;Tn.indentComment=si;Tn.lineComment=Fd;Tn.stringifyComment=Ud});var Ho=w(Ct=>{"use strict";var jd="flow",ii="block",On="quoted";function Hd(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=[],u={},f=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):f=i-s);let d,p,y=!1,h=-1,m=-1,v=-1;n===ii&&(h=jo(t,h,e.length),h!==-1&&(f=h+l));for(let A;A=t[h+=1];){if(n===On&&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}v=h}if(A===`
8
8
  `)n===ii&&(h=jo(t,h,e.length)),f=h+e.length+l,d=void 0;else{if(A===" "&&p&&p!==" "&&p!==`
9
9
  `&&p!==" "){let I=t[h+1];I&&I!==" "&&I!==`
10
- `&&I!==" "&&(d=h)}if(h>=f)if(d)c.push(d),f=d+l,d=void 0;else if(n===Tn){for(;p===" "||p===" ";)p=A,A=t[h+=1],y=!0;let I=h>w+1?h-2:m-1;if(u[I])return t;c.push(I),u[I]=!0,f=I+l,d=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 I=c[A],E=c[A+1]||t.length;I===0?b=`
11
- ${e}${t.slice(0,E)}`:(n===Tn&&u[I]&&(b+=`${t[I]}\\`),b+=`
10
+ `&&I!==" "&&(d=h)}if(h>=f)if(d)c.push(d),f=d+l,d=void 0;else if(n===On){for(;p===" "||p===" ";)p=A,A=t[h+=1],y=!0;let I=h>v+1?h-2:m-1;if(u[I])return t;c.push(I),u[I]=!0,f=I+l,d=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 I=c[A],E=c[A+1]||t.length;I===0?b=`
11
+ ${e}${t.slice(0,E)}`:(n===On&&u[I]&&(b+=`${t[I]}\\`),b+=`
12
12
  ${e}${t.slice(I+1,E)}`)}return b}function jo(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}Ct.FOLD_BLOCK=ii;Ct.FOLD_FLOW=Kd;Ct.FOLD_QUOTED=Tn;Ct.foldFlowLines=Bd});var $t=v(Yo=>{"use strict";var te=M(),Ie=Ho(),Cn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ln=t=>/^(%|---|\.\.\.)/m.test(t);function Fd(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 Lt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Ln(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 u=n.substr(l+2,4);switch(u){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:u.substr(0,2)==="00"?o+="\\x"+u.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)+`
13
+ `);s=e,i=e+1,r=t[i]}return s}Ct.FOLD_BLOCK=ii;Ct.FOLD_FLOW=jd;Ct.FOLD_QUOTED=On;Ct.foldFlowLines=Hd});var Lt=w(Yo=>{"use strict";var te=P(),Ie=Ho(),Cn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),$n=t=>/^(%|---|\.\.\.)/m.test(t);function Yd(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 $t(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||($n(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 u=n.substr(l+2,4);switch(u){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:u.substr(0,2)==="00"?o+="\\x"+u.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
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:Ie.foldFlowLines(o,r,Ie.FOLD_QUOTED,Cn(e,!1))}function ri(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
18
- `)||/[ \t]\n|\n[ \t]/.test(t))return Lt(t,e);let n=e.indent||(Ln(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
19
- ${n}`)+"'";return e.implicitKey?s:Ie.foldFlowLines(s,n,Ie.FOLD_FLOW,Cn(e,!1))}function tt(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=Lt;else{let i=t.includes('"'),r=t.includes("'");i&&!r?s=ri:r&&!i?s=Lt:s=n?ri:Lt}return s(t,e)}var oi;try{oi=new RegExp(`(^|(?<!
18
+ `)||/[ \t]\n|\n[ \t]/.test(t))return $t(t,e);let n=e.indent||($n(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
19
+ ${n}`)+"'";return e.implicitKey?s:Ie.foldFlowLines(s,n,Ie.FOLD_FLOW,Cn(e,!1))}function tt(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=$t;else{let i=t.includes('"'),r=t.includes("'");i&&!r?s=ri:r&&!i?s=$t:s=n?ri:$t}return s(t,e)}var oi;try{oi=new RegExp(`(^|(?<!
20
20
  ))
21
21
  +(?!
22
- |$)`,"g")}catch{oi=/\n+(?!\n|$)/g}function Nn({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 tt(n,s);let c=s.indent||(s.forceBlockIndent||Ln(n)?" ":""),u=o==="literal"?!0:o==="folded"||e===te.Scalar.BLOCK_FOLDED?!1:e===te.Scalar.BLOCK_LITERAL?!0:!Fd(n,l,c.length);if(!n)return u?`|
22
+ |$)`,"g")}catch{oi=/\n+(?!\n|$)/g}function Nn({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 tt(n,s);let c=s.indent||(s.forceBlockIndent||$n(n)?" ":""),u=o==="literal"?!0:o==="folded"||e===te.Scalar.BLOCK_FOLDED?!1:e===te.Scalar.BLOCK_LITERAL?!0:!Yd(n,l,c.length);if(!n)return u?`|
23
23
  `:`>
24
24
  `;let f,d;for(d=n.length;d>0;--d){let E=n[d-1];if(E!==`
25
25
  `&&E!==" "&&E!==" ")break}let p=n.substring(d),y=p.indexOf(`
26
26
  `);y===-1?f="-":n===p||y!==p.length-1?(f="+",r&&r()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
27
- `&&(p=p.slice(0,-1)),p=p.replace(oi,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<n.length;++m){let E=n[m];if(E===" ")h=!0;else if(E===`
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 I=(h?c?"2":"1":"")+f;if(t&&(I+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let E=n.replace(/\n+/g,`
27
+ `&&(p=p.slice(0,-1)),p=p.replace(oi,`$&${c}`));let h=!1,m,v=-1;for(m=0;m<n.length;++m){let E=n[m];if(E===" ")h=!0;else if(E===`
28
+ `)v=m;else break}let b=n.substring(0,v<m?v+1:m);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let I=(h?c?"2":"1":"")+f;if(t&&(I+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let E=n.replace(/\n+/g,`
29
29
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),_=!1,C=Cn(s,!0);o!=="folded"&&e!==te.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{_=!0});let k=Ie.foldFlowLines(`${b}${E}${p}`,c,Ie.FOLD_BLOCK,C);if(!_)return`>${I}
30
30
  ${c}${k}`}return n=n.replace(/\n+/g,`$&${c}`),`|${I}
31
- ${c}${b}${n}${p}`}function Ud(t,e,n,s){let{type:i,value:r}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&r.includes(`
31
+ ${c}${b}${n}${p}`}function Gd(t,e,n,s){let{type:i,value:r}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&r.includes(`
32
32
  `)||u&&/[[\]{},]/.test(r))return tt(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||u||!r.includes(`
33
33
  `)?tt(r,e):Nn(t,e,n,s);if(!a&&!u&&i!==te.Scalar.PLAIN&&r.includes(`
34
- `))return Nn(t,e,n,s);if(Ln(r)){if(l==="")return e.forceBlockIndent=!0,Nn(t,e,n,s);if(a&&l===c)return tt(r,e)}let f=r.replace(/\n+/g,`$&
35
- ${l}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(d)||p?.some(d))return tt(r,e)}return a?f:Ie.foldFlowLines(f,l,Ie.FOLD_FLOW,Cn(e,!1))}function jd(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!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=te.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return i||r?tt(o.value,e):Nn(o,e,n,s);case te.Scalar.QUOTE_DOUBLE:return Lt(o.value,e);case te.Scalar.QUOTE_SINGLE:return ri(o.value,e);case te.Scalar.PLAIN:return Ud(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Yo.stringifyString=jd});var Pt=v(ai=>{"use strict";var Hd=kn(),_e=T(),Yd=Nt(),Gd=$t();function Vd(t,e){let n=Object.assign({blockQuote:!0,commentString:Yd.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 Wd(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(_e.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 Jd(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(_e.isScalar(t)||_e.isCollection(t))&&t.anchor;r&&Hd.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 Qd(t,e,n,s){if(_e.isPair(t))return t.toString(e,n,s);if(_e.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=_e.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=Wd(e.doc.schema.tags,r));let o=Jd(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):_e.isScalar(r)?Gd.stringifyString(r,e,n,s):r.toString(e,n,s);return o?_e.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
36
- ${e.indent}${a}`:a}ai.createStringifyContext=Vd;ai.stringify=Qd});var Jo=v(Wo=>{"use strict";var ge=T(),Go=M(),Vo=Pt(),Mt=Nt();function zd({key:t,value:e},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,d=ge.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===Go.Scalar.BLOCK_FOLDED||t.type===Go.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:a+l});let y=!1,h=!1,m=Vo.stringify(t,n,()=>y=!0,()=>h=!0);if(!p&&!n.inFlow&&m.length>1024){if(f)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&&!f||e==null&&p)return m=`? ${m}`,d&&!y?m+=Mt.lineComment(m,n.indent,c(d)):h&&i&&i(),m;y&&(d=null),p?(d&&(m+=Mt.lineComment(m,n.indent,c(d))),m=`? ${m}
37
- ${a}:`):(m=`${m}:`,d&&(m+=Mt.lineComment(m,n.indent,c(d))));let w,b,A;ge.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&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),h=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let I=!1,E=Vo.stringify(e,n,()=>I=!0,()=>h=!0),_=" ";if(d||w||b){if(_=w?`
34
+ `))return Nn(t,e,n,s);if($n(r)){if(l==="")return e.forceBlockIndent=!0,Nn(t,e,n,s);if(a&&l===c)return tt(r,e)}let f=r.replace(/\n+/g,`$&
35
+ ${l}`);if(o){let d=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(d)||p?.some(d))return tt(r,e)}return a?f:Ie.foldFlowLines(f,l,Ie.FOLD_FLOW,Cn(e,!1))}function Vd(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!==te.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=te.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case te.Scalar.BLOCK_FOLDED:case te.Scalar.BLOCK_LITERAL:return i||r?tt(o.value,e):Nn(o,e,n,s);case te.Scalar.QUOTE_DOUBLE:return $t(o.value,e);case te.Scalar.QUOTE_SINGLE:return ri(o.value,e);case te.Scalar.PLAIN:return Gd(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Yo.stringifyString=Vd});var Mt=w(ai=>{"use strict";var Wd=kn(),_e=O(),Jd=Nt(),Qd=Lt();function zd(t,e){let n=Object.assign({blockQuote:!0,commentString:Jd.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 Xd(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(_e.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 Zd(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(_e.isScalar(t)||_e.isCollection(t))&&t.anchor;r&&Wd.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 ep(t,e,n,s){if(_e.isPair(t))return t.toString(e,n,s);if(_e.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=_e.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=Xd(e.doc.schema.tags,r));let o=Zd(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):_e.isScalar(r)?Qd.stringifyString(r,e,n,s):r.toString(e,n,s);return o?_e.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
36
+ ${e.indent}${a}`:a}ai.createStringifyContext=zd;ai.stringify=ep});var Jo=w(Wo=>{"use strict";var ge=O(),Go=P(),Vo=Mt(),Pt=Nt();function tp({key:t,value:e},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,d=ge.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ge.isCollection(t)||!ge.isNode(t)&&typeof t=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!t||d&&e==null&&!n.inFlow||ge.isCollection(t)||(ge.isScalar(t)?t.type===Go.Scalar.BLOCK_FOLDED||t.type===Go.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:a+l});let y=!1,h=!1,m=Vo.stringify(t,n,()=>y=!0,()=>h=!0);if(!p&&!n.inFlow&&m.length>1024){if(f)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&&!f||e==null&&p)return m=`? ${m}`,d&&!y?m+=Pt.lineComment(m,n.indent,c(d)):h&&i&&i(),m;y&&(d=null),p?(d&&(m+=Pt.lineComment(m,n.indent,c(d))),m=`? ${m}
37
+ ${a}:`):(m=`${m}:`,d&&(m+=Pt.lineComment(m,n.indent,c(d))));let v,b,A;ge.isNode(e)?(v=!!e.spaceBefore,b=e.commentBefore,A=e.comment):(v=!1,b=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!p&&!d&&ge.isScalar(e)&&(n.indentAtStart=m.length+1),h=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ge.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let I=!1,E=Vo.stringify(e,n,()=>I=!0,()=>h=!0),_=" ";if(d||v||b){if(_=v?`
38
38
  `:"",b){let C=c(b);_+=`
39
- ${Mt.indentComment(C,n.indent)}`}E===""&&!n.inFlow?_===`
39
+ ${Pt.indentComment(C,n.indent)}`}E===""&&!n.inFlow?_===`
40
40
  `&&A&&(_=`
41
41
 
42
42
  `):_+=`
43
43
  ${n.indent}`}else if(!p&&ge.isCollection(e)){let C=E[0],k=E.indexOf(`
44
- `),P=k!==-1,be=n.inFlow??e.flow??e.items.length===0;if(P||!be){let ze=!1;if(P&&(C==="&"||C==="!")){let q=E.indexOf(" ");C==="&"&&q!==-1&&q<k&&E[q+1]==="!"&&(q=E.indexOf(" ",q+1)),(q===-1||k<q)&&(ze=!0)}ze||(_=`
44
+ `),M=k!==-1,be=n.inFlow??e.flow??e.items.length===0;if(M||!be){let ze=!1;if(M&&(C==="&"||C==="!")){let R=E.indexOf(" ");C==="&"&&R!==-1&&R<k&&E[R+1]==="!"&&(R=E.indexOf(" ",R+1)),(R===-1||k<R)&&(ze=!0)}ze||(_=`
45
45
  ${n.indent}`)}}else(E===""||E[0]===`
46
- `)&&(_="");return m+=_+E,n.inFlow?I&&s&&s():A&&!I?m+=Mt.lineComment(m,n.indent,c(A)):h&&i&&i(),m}Wo.stringifyPair=zd});var ci=v(li=>{"use strict";var Qo=ke("process");function Xd(t,...e){t==="debug"&&console.log(...e)}function Zd(t,e){(t==="debug"||t==="warn")&&(typeof Qo.emitWarning=="function"?Qo.emitWarning(e):console.warn(e))}li.debug=Xd;li.warn=Zd});var Dn=v(Mn=>{"use strict";var Dt=T(),zo=M(),$n="<<",Pn={identify:t=>t===$n||typeof t=="symbol"&&t.description===$n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zo.Scalar(Symbol($n)),{addToJSMap:Xo}),stringify:()=>$n},ep=(t,e)=>(Pn.identify(e)||Dt.isScalar(e)&&(!e.type||e.type===zo.Scalar.PLAIN)&&Pn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Pn.tag&&n.default);function Xo(t,e,n){if(n=t&&Dt.isAlias(n)?n.resolve(t.doc):n,Dt.isSeq(n))for(let s of n.items)ui(t,e,s);else if(Array.isArray(n))for(let s of n)ui(t,e,s);else ui(t,e,n)}function ui(t,e,n){let s=t&&Dt.isAlias(n)?n.resolve(t.doc):n;if(!Dt.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}Mn.addMergeToJSMap=Xo;Mn.isMergeKey=ep;Mn.merge=Pn});var di=v(ta=>{"use strict";var tp=ci(),Zo=Dn(),np=Pt(),ea=T(),fi=Ee();function sp(t,e,{key:n,value:s}){if(ea.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(Zo.isMergeKey(t,n))Zo.addMergeToJSMap(t,e,s);else{let i=fi.toJS(n,"",t);if(e instanceof Map)e.set(i,fi.toJS(s,i,t));else if(e instanceof Set)e.add(i);else{let r=ip(n,i,t),o=fi.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 ip(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ea.isNode(t)&&n?.doc){let s=np.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)+'..."'),tp.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)}ta.addPairToJSMap=sp});var Oe=v(pi=>{"use strict";var na=Tt(),rp=Jo(),op=di(),qn=T();function ap(t,e,n){let s=na.createNode(t,void 0,n),i=na.createNode(e,void 0,n);return new Rn(s,i)}var Rn=class t{constructor(e,n=null){Object.defineProperty(this,qn.NODE_TYPE,{value:qn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return qn.isNode(n)&&(n=n.clone(e)),qn.isNode(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return op.addPairToJSMap(n,s,this)}toString(e,n,s){return e?.doc?rp.stringifyPair(this,e,n,s):JSON.stringify(this)}};pi.Pair=Rn;pi.createPair=ap});var hi=v(ia=>{"use strict";var Ke=T(),sa=Pt(),xn=Nt();function lp(t,e,n){return(e.inFlow??t.flow?up:cp)(t,e,n)}function cp({comment:t,items:e},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:r,type:null}),f=!1,d=[];for(let y=0;y<e.length;++y){let h=e[y],m=null;if(Ke.isNode(h))!f&&h.spaceBefore&&d.push(""),Kn(n,d,h.commentBefore,f),h.comment&&(m=h.comment);else if(Ke.isPair(h)){let b=Ke.isNode(h.key)?h.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Kn(n,d,b.commentBefore,f))}f=!1;let w=sa.stringify(h,u,()=>m=null,()=>f=!0);m&&(w+=xn.lineComment(w,r,c(m))),f&&m&&(f=!1),d.push(s+w)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let y=1;y<d.length;++y){let h=d[y];p+=h?`
46
+ `)&&(_="");return m+=_+E,n.inFlow?I&&s&&s():A&&!I?m+=Pt.lineComment(m,n.indent,c(A)):h&&i&&i(),m}Wo.stringifyPair=tp});var ci=w(li=>{"use strict";var Qo=ke("process");function np(t,...e){t==="debug"&&console.log(...e)}function sp(t,e){(t==="debug"||t==="warn")&&(typeof Qo.emitWarning=="function"?Qo.emitWarning(e):console.warn(e))}li.debug=np;li.warn=sp});var Dn=w(Pn=>{"use strict";var Dt=O(),zo=P(),Ln="<<",Mn={identify:t=>t===Ln||typeof t=="symbol"&&t.description===Ln,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new zo.Scalar(Symbol(Ln)),{addToJSMap:Xo}),stringify:()=>Ln},ip=(t,e)=>(Mn.identify(e)||Dt.isScalar(e)&&(!e.type||e.type===zo.Scalar.PLAIN)&&Mn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Mn.tag&&n.default);function Xo(t,e,n){if(n=t&&Dt.isAlias(n)?n.resolve(t.doc):n,Dt.isSeq(n))for(let s of n.items)ui(t,e,s);else if(Array.isArray(n))for(let s of n)ui(t,e,s);else ui(t,e,n)}function ui(t,e,n){let s=t&&Dt.isAlias(n)?n.resolve(t.doc):n;if(!Dt.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}Pn.addMergeToJSMap=Xo;Pn.isMergeKey=ip;Pn.merge=Mn});var di=w(ta=>{"use strict";var rp=ci(),Zo=Dn(),op=Mt(),ea=O(),fi=Ee();function ap(t,e,{key:n,value:s}){if(ea.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(Zo.isMergeKey(t,n))Zo.addMergeToJSMap(t,e,s);else{let i=fi.toJS(n,"",t);if(e instanceof Map)e.set(i,fi.toJS(s,i,t));else if(e instanceof Set)e.add(i);else{let r=lp(n,i,t),o=fi.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 lp(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ea.isNode(t)&&n?.doc){let s=op.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)+'..."'),rp.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)}ta.addPairToJSMap=ap});var Te=w(pi=>{"use strict";var na=Ot(),cp=Jo(),up=di(),Rn=O();function fp(t,e,n){let s=na.createNode(t,void 0,n),i=na.createNode(e,void 0,n);return new qn(s,i)}var qn=class t{constructor(e,n=null){Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return Rn.isNode(n)&&(n=n.clone(e)),Rn.isNode(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return up.addPairToJSMap(n,s,this)}toString(e,n,s){return e?.doc?cp.stringifyPair(this,e,n,s):JSON.stringify(this)}};pi.Pair=qn;pi.createPair=fp});var hi=w(ia=>{"use strict";var Ke=O(),sa=Mt(),xn=Nt();function dp(t,e,n){return(e.inFlow??t.flow?hp:pp)(t,e,n)}function pp({comment:t,items:e},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:r,type:null}),f=!1,d=[];for(let y=0;y<e.length;++y){let h=e[y],m=null;if(Ke.isNode(h))!f&&h.spaceBefore&&d.push(""),Kn(n,d,h.commentBefore,f),h.comment&&(m=h.comment);else if(Ke.isPair(h)){let b=Ke.isNode(h.key)?h.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Kn(n,d,b.commentBefore,f))}f=!1;let v=sa.stringify(h,u,()=>m=null,()=>f=!0);m&&(v+=xn.lineComment(v,r,c(m))),f&&m&&(f=!1),d.push(s+v)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let y=1;y<d.length;++y){let h=d[y];p+=h?`
47
47
  ${l}${h}`:`
48
48
  `}}return t?(p+=`
49
- `+xn.indentComment(c(t),l),a&&a()):f&&o&&o(),p}function up({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,u=0,f=[];for(let y=0;y<t.length;++y){let h=t[y],m=null;if(Ke.isNode(h))h.spaceBefore&&f.push(""),Kn(e,f,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Ke.isPair(h)){let b=Ke.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&f.push(""),Kn(e,f,b.commentBefore,!1),b.comment&&(c=!0));let A=Ke.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=sa.stringify(h,l,()=>m=null);c||(c=f.length>u||w.includes(`
50
- `)),y<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((b,A)=>b+A.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=xn.lineComment(w,s,a(m))),f.push(w),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!c){let y=f.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=d;for(let h of f)y+=h?`
49
+ `+xn.indentComment(c(t),l),a&&a()):f&&o&&o(),p}function hp({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,u=0,f=[];for(let y=0;y<t.length;++y){let h=t[y],m=null;if(Ke.isNode(h))h.spaceBefore&&f.push(""),Kn(e,f,h.commentBefore,!1),h.comment&&(m=h.comment);else if(Ke.isPair(h)){let b=Ke.isNode(h.key)?h.key:null;b&&(b.spaceBefore&&f.push(""),Kn(e,f,b.commentBefore,!1),b.comment&&(c=!0));let A=Ke.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 v=sa.stringify(h,l,()=>m=null);c||(c=f.length>u||v.includes(`
50
+ `)),y<t.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((b,A)=>b+A.length+2,2)+(v.length+2)>e.options.lineWidth)),c&&(v+=",")),m&&(v+=xn.lineComment(v,s,a(m))),f.push(v),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!c){let y=f.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=d;for(let h of f)y+=h?`
51
51
  ${r}${i}${h}`:`
52
52
  `;return`${y}
53
- ${i}${p}`}else return`${d}${o}${f.join(" ")}${o}${p}`}function Kn({indent:t,options:{commentString:e}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=xn.indentComment(e(s),t);n.push(r.trimStart())}}ia.stringifyCollection=lp});var Ne=v(gi=>{"use strict";var fp=hi(),dp=di(),pp=_n(),Te=T(),Bn=Oe(),hp=M();function qt(t,e){let n=Te.isScalar(e)?e.value:e;for(let s of t)if(Te.isPair(s)&&(s.key===e||s.key===n||Te.isScalar(s.key)&&s.key.value===n))return s}var mi=class extends pp.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Te.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(Bn.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;Te.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new Bn.Pair(e,e?.value):s=new Bn.Pair(e.key,e.value);let i=qt(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Te.isScalar(i.value)&&hp.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=qt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=qt(this.items,e)?.value;return(!n&&Te.isScalar(i)?i.value:i)??void 0}has(e){return!!qt(this.items,e)}set(e,n){this.add(new Bn.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)dp.addPairToJSMap(n,i,r);return i}toString(e,n,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Te.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})),fp.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};gi.YAMLMap=mi;gi.findPair=qt});var nt=v(oa=>{"use strict";var mp=T(),ra=Ne(),gp={collection:"map",default:!0,nodeClass:ra.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return mp.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>ra.YAMLMap.from(t,e,n)};oa.map=gp});var Ce=v(aa=>{"use strict";var yp=Tt(),Sp=hi(),vp=_n(),Un=T(),wp=M(),bp=Ee(),yi=class extends vp.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Un.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Fn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=Fn(e);if(typeof s!="number")return;let i=this.items[s];return!n&&Un.isScalar(i)?i.value:i}has(e){let n=Fn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=Fn(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Un.isScalar(i)&&wp.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(bp.toJS(r,String(i++),n));return s}toString(e,n,s){return e?Sp.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(yp.createNode(a,void 0,s))}}return r}};function Fn(t){let e=Un.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}aa.YAMLSeq=yi});var st=v(ca=>{"use strict";var kp=T(),la=Ce(),Ep={collection:"seq",default:!0,nodeClass:la.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return kp.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>la.YAMLSeq.from(t,e,n)};ca.seq=Ep});var Rt=v(ua=>{"use strict";var Ap=$t(),Ip={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),Ap.stringifyString(t,e,n,s)}};ua.string=Ip});var jn=v(pa=>{"use strict";var fa=M(),da={identify:t=>t==null,createNode:()=>new fa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new fa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&da.test.test(t)?t:e.options.nullStr};pa.nullTag=da});var Si=v(ma=>{"use strict";var _p=M(),ha={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new _p.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ha.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};ma.boolTag=ha});var it=v(ga=>{"use strict";function Op({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}ga.stringifyNumber=Op});var wi=v(Hn=>{"use strict";var Tp=M(),vi=it(),Np={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},Cp={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():vi.stringifyNumber(t)}},Lp={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 Tp.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:vi.stringifyNumber};Hn.float=Lp;Hn.floatExp=Cp;Hn.floatNaN=Np});var ki=v(Gn=>{"use strict";var ya=it(),Yn=t=>typeof t=="bigint"||Number.isInteger(t),bi=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function Sa(t,e,n){let{value:s}=t;return Yn(s)&&s>=0?n+s.toString(e):ya.stringifyNumber(t)}var $p={identify:t=>Yn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>bi(t,2,8,n),stringify:t=>Sa(t,8,"0o")},Pp={identify:Yn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>bi(t,0,10,n),stringify:ya.stringifyNumber},Mp={identify:t=>Yn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>bi(t,2,16,n),stringify:t=>Sa(t,16,"0x")};Gn.int=Pp;Gn.intHex=Mp;Gn.intOct=$p});var wa=v(va=>{"use strict";var Dp=nt(),qp=jn(),Rp=st(),xp=Rt(),Kp=Si(),Ei=wi(),Ai=ki(),Bp=[Dp.map,Rp.seq,xp.string,qp.nullTag,Kp.boolTag,Ai.intOct,Ai.int,Ai.intHex,Ei.floatNaN,Ei.floatExp,Ei.float];va.schema=Bp});var Ea=v(ka=>{"use strict";var Fp=M(),Up=nt(),jp=st();function ba(t){return typeof t=="bigint"||Number.isInteger(t)}var Vn=({value:t})=>JSON.stringify(t),Hp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Vn},{identify:t=>t==null,createNode:()=>new Fp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Vn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Vn},{identify:ba,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})=>ba(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:Vn}],Yp={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Gp=[Up.map,jp.seq].concat(Hp,Yp);ka.schema=Gp});var _i=v(Aa=>{"use strict";var xt=ke("buffer"),Ii=M(),Vp=$t(),Wp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof xt.Buffer=="function")return xt.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 xt.Buffer=="function")a=o instanceof xt.Buffer?o.toString("base64"):xt.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=Ii.Scalar.BLOCK_LITERAL),e!==Ii.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,d=0;f<c;++f,d+=l)u[f]=a.substr(d,l);a=u.join(e===Ii.Scalar.BLOCK_LITERAL?`
54
- `:" ")}return Vp.stringifyString({comment:t,type:e,value:a},s,i,r)}};Aa.binary=Wp});var Qn=v(Jn=>{"use strict";var Wn=T(),Oi=Oe(),Jp=M(),Qp=Ce();function Ia(t,e){if(Wn.isSeq(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!Wn.isPair(s)){if(Wn.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new Oi.Pair(new Jp.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
53
+ ${i}${p}`}else return`${d}${o}${f.join(" ")}${o}${p}`}function Kn({indent:t,options:{commentString:e}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=xn.indentComment(e(s),t);n.push(r.trimStart())}}ia.stringifyCollection=dp});var Ne=w(gi=>{"use strict";var mp=hi(),gp=di(),yp=_n(),Oe=O(),Bn=Te(),Sp=P();function Rt(t,e){let n=Oe.isScalar(e)?e.value:e;for(let s of t)if(Oe.isPair(s)&&(s.key===e||s.key===n||Oe.isScalar(s.key)&&s.key.value===n))return s}var mi=class extends yp.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Oe.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(Bn.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;Oe.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new Bn.Pair(e,e?.value):s=new Bn.Pair(e.key,e.value);let i=Rt(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);Oe.isScalar(i.value)&&Sp.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=Rt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Rt(this.items,e)?.value;return(!n&&Oe.isScalar(i)?i.value:i)??void 0}has(e){return!!Rt(this.items,e)}set(e,n){this.add(new Bn.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)gp.addPairToJSMap(n,i,r);return i}toString(e,n,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Oe.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})),mp.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};gi.YAMLMap=mi;gi.findPair=Rt});var nt=w(oa=>{"use strict";var vp=O(),ra=Ne(),wp={collection:"map",default:!0,nodeClass:ra.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return vp.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>ra.YAMLMap.from(t,e,n)};oa.map=wp});var Ce=w(aa=>{"use strict";var bp=Ot(),kp=hi(),Ep=_n(),Fn=O(),Ap=P(),Ip=Ee(),yi=class extends Ep.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Fn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Un(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=Un(e);if(typeof s!="number")return;let i=this.items[s];return!n&&Fn.isScalar(i)?i.value:i}has(e){let n=Un(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=Un(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Fn.isScalar(i)&&Ap.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(Ip.toJS(r,String(i++),n));return s}toString(e,n,s){return e?kp.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(bp.createNode(a,void 0,s))}}return r}};function Un(t){let e=Fn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}aa.YAMLSeq=yi});var st=w(ca=>{"use strict";var _p=O(),la=Ce(),Tp={collection:"seq",default:!0,nodeClass:la.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return _p.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>la.YAMLSeq.from(t,e,n)};ca.seq=Tp});var qt=w(ua=>{"use strict";var Op=Lt(),Np={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),Op.stringifyString(t,e,n,s)}};ua.string=Np});var jn=w(pa=>{"use strict";var fa=P(),da={identify:t=>t==null,createNode:()=>new fa.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new fa.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&da.test.test(t)?t:e.options.nullStr};pa.nullTag=da});var Si=w(ma=>{"use strict";var Cp=P(),ha={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Cp.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&ha.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};ma.boolTag=ha});var it=w(ga=>{"use strict";function $p({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}ga.stringifyNumber=$p});var wi=w(Hn=>{"use strict";var Lp=P(),vi=it(),Mp={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},Pp={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():vi.stringifyNumber(t)}},Dp={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 Lp.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:vi.stringifyNumber};Hn.float=Dp;Hn.floatExp=Pp;Hn.floatNaN=Mp});var ki=w(Gn=>{"use strict";var ya=it(),Yn=t=>typeof t=="bigint"||Number.isInteger(t),bi=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function Sa(t,e,n){let{value:s}=t;return Yn(s)&&s>=0?n+s.toString(e):ya.stringifyNumber(t)}var Rp={identify:t=>Yn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>bi(t,2,8,n),stringify:t=>Sa(t,8,"0o")},qp={identify:Yn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>bi(t,0,10,n),stringify:ya.stringifyNumber},xp={identify:t=>Yn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>bi(t,2,16,n),stringify:t=>Sa(t,16,"0x")};Gn.int=qp;Gn.intHex=xp;Gn.intOct=Rp});var wa=w(va=>{"use strict";var Kp=nt(),Bp=jn(),Up=st(),Fp=qt(),jp=Si(),Ei=wi(),Ai=ki(),Hp=[Kp.map,Up.seq,Fp.string,Bp.nullTag,jp.boolTag,Ai.intOct,Ai.int,Ai.intHex,Ei.floatNaN,Ei.floatExp,Ei.float];va.schema=Hp});var Ea=w(ka=>{"use strict";var Yp=P(),Gp=nt(),Vp=st();function ba(t){return typeof t=="bigint"||Number.isInteger(t)}var Vn=({value:t})=>JSON.stringify(t),Wp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Vn},{identify:t=>t==null,createNode:()=>new Yp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Vn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Vn},{identify:ba,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})=>ba(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:Vn}],Jp={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Qp=[Gp.map,Vp.seq].concat(Wp,Jp);ka.schema=Qp});var _i=w(Aa=>{"use strict";var xt=ke("buffer"),Ii=P(),zp=Lt(),Xp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof xt.Buffer=="function")return xt.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 xt.Buffer=="function")a=o instanceof xt.Buffer?o.toString("base64"):xt.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=Ii.Scalar.BLOCK_LITERAL),e!==Ii.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,d=0;f<c;++f,d+=l)u[f]=a.substr(d,l);a=u.join(e===Ii.Scalar.BLOCK_LITERAL?`
54
+ `:" ")}return zp.stringifyString({comment:t,type:e,value:a},s,i,r)}};Aa.binary=Xp});var Qn=w(Jn=>{"use strict";var Wn=O(),Ti=Te(),Zp=P(),eh=Ce();function Ia(t,e){if(Wn.isSeq(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!Wn.isPair(s)){if(Wn.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new Ti.Pair(new Zp.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]=Wn.isPair(s)?s:new Oi.Pair(s)}}else e("Expected a sequence for this tag");return t}function _a(t,e,n){let{replacer:s}=n,i=new Qp.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(Oi.createPair(a,l,n))}return i}var zp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ia,createNode:_a};Jn.createPairs=_a;Jn.pairs=zp;Jn.resolvePairs=Ia});var Ci=v(Ni=>{"use strict";var Oa=T(),Ti=Ee(),Kt=Ne(),Xp=Ce(),Ta=Qn(),Be=class t extends Xp.YAMLSeq{constructor(){super(),this.add=Kt.YAMLMap.prototype.add.bind(this),this.delete=Kt.YAMLMap.prototype.delete.bind(this),this.get=Kt.YAMLMap.prototype.get.bind(this),this.has=Kt.YAMLMap.prototype.has.bind(this),this.set=Kt.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(Oa.isPair(i)?(r=Ti.toJS(i.key,"",n),o=Ti.toJS(i.value,r,n)):r=Ti.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=Ta.createPairs(e,n,s),r=new this;return r.items=i.items,r}};Be.tag="tag:yaml.org,2002:omap";var Zp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Ta.resolvePairs(t,e),s=[];for(let{key:i}of n.items)Oa.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Be,n)},createNode:(t,e,n)=>Be.from(t,e,n)};Ni.YAMLOMap=Be;Ni.omap=Zp});var Pa=v(Li=>{"use strict";var Na=M();function Ca({value:t,source:e},n){return e&&(t?La:$a).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var La={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 Na.Scalar(!0),stringify:Ca},$a={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 Na.Scalar(!1),stringify:Ca};Li.falseTag=$a;Li.trueTag=La});var Ma=v(zn=>{"use strict";var eh=M(),$i=it(),th={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:$i.stringifyNumber},nh={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():$i.stringifyNumber(t)}},sh={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 eh.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:$i.stringifyNumber};zn.float=sh;zn.floatExp=nh;zn.floatNaN=th});var qa=v(Ft=>{"use strict";var Da=it(),Bt=t=>typeof t=="bigint"||Number.isInteger(t);function Xn(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 Pi(t,e,n){let{value:s}=t;if(Bt(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return Da.stringifyNumber(t)}var ih={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Xn(t,2,2,n),stringify:t=>Pi(t,2,"0b")},rh={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Xn(t,1,8,n),stringify:t=>Pi(t,8,"0")},oh={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Xn(t,0,10,n),stringify:Da.stringifyNumber},ah={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Xn(t,2,16,n),stringify:t=>Pi(t,16,"0x")};Ft.int=oh;Ft.intBin=ih;Ft.intHex=ah;Ft.intOct=rh});var Di=v(Mi=>{"use strict";var ts=T(),Zn=Oe(),es=Ne(),Fe=class t extends es.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;ts.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Zn.Pair(e.key,null):n=new Zn.Pair(e,null),es.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=es.findPair(this.items,e);return!n&&ts.isPair(s)?ts.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=es.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Zn.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(Zn.createPair(o,null,s));return r}};Fe.tag="tag:yaml.org,2002:set";var lh={collection:"map",identify:t=>t instanceof Set,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Fe.from(t,e,n),resolve(t,e){if(ts.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Fe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Mi.YAMLSet=Fe;Mi.set=lh});var Ri=v(ns=>{"use strict";var ch=it();function qi(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 Ra(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return ch.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 uh={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})=>qi(t,n),stringify:Ra},fh={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=>qi(t,!1),stringify:Ra},xa={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(xa.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),u=e[8];if(u&&u!=="Z"){let f=qi(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ns.floatTime=fh;ns.intTime=uh;ns.timestamp=xa});var Fa=v(Ba=>{"use strict";var dh=nt(),ph=jn(),hh=st(),mh=Rt(),gh=_i(),Ka=Pa(),xi=Ma(),ss=qa(),yh=Dn(),Sh=Ci(),vh=Qn(),wh=Di(),Ki=Ri(),bh=[dh.map,hh.seq,mh.string,ph.nullTag,Ka.trueTag,Ka.falseTag,ss.intBin,ss.intOct,ss.int,ss.intHex,xi.floatNaN,xi.floatExp,xi.float,gh.binary,yh.merge,Sh.omap,vh.pairs,wh.set,Ki.intTime,Ki.floatTime,Ki.timestamp];Ba.schema=bh});var za=v(Ui=>{"use strict";var Ya=nt(),kh=jn(),Ga=st(),Eh=Rt(),Ah=Si(),Bi=wi(),Fi=ki(),Ih=wa(),_h=Ea(),Va=_i(),Ut=Dn(),Wa=Ci(),Ja=Qn(),Ua=Fa(),Qa=Di(),is=Ri(),ja=new Map([["core",Ih.schema],["failsafe",[Ya.map,Ga.seq,Eh.string]],["json",_h.schema],["yaml11",Ua.schema],["yaml-1.1",Ua.schema]]),Ha={binary:Va.binary,bool:Ah.boolTag,float:Bi.float,floatExp:Bi.floatExp,floatNaN:Bi.floatNaN,floatTime:is.floatTime,int:Fi.int,intHex:Fi.intHex,intOct:Fi.intOct,intTime:is.intTime,map:Ya.map,merge:Ut.merge,null:kh.nullTag,omap:Wa.omap,pairs:Ja.pairs,seq:Ga.seq,set:Qa.set,timestamp:is.timestamp},Oh={"tag:yaml.org,2002:binary":Va.binary,"tag:yaml.org,2002:merge":Ut.merge,"tag:yaml.org,2002:omap":Wa.omap,"tag:yaml.org,2002:pairs":Ja.pairs,"tag:yaml.org,2002:set":Qa.set,"tag:yaml.org,2002:timestamp":is.timestamp};function Th(t,e,n){let s=ja.get(e);if(s&&!t)return n&&!s.includes(Ut.merge)?s.concat(Ut.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(ja.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(Ut.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Ha[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ha).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Ui.coreKnownTags=Oh;Ui.getTags=Th});var Yi=v(Xa=>{"use strict";var ji=T(),Nh=nt(),Ch=st(),Lh=Rt(),rs=za(),$h=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Hi=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?rs.getTags(e,"compat"):e?rs.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?rs.coreKnownTags:{},this.tags=rs.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ji.MAP,{value:Nh.map}),Object.defineProperty(this,ji.SCALAR,{value:Lh.string}),Object.defineProperty(this,ji.SEQ,{value:Ch.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?$h:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Xa.Schema=Hi});var el=v(Za=>{"use strict";var Ph=T(),Gi=Pt(),jt=Nt();function Mh(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=Gi.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift(jt.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(Ph.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let u=r(t.contents.commentBefore);n.push(jt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=Gi.stringify(t.contents,i,()=>a=null,l);a&&(c+=jt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Gi.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]=Wn.isPair(s)?s:new Ti.Pair(s)}}else e("Expected a sequence for this tag");return t}function _a(t,e,n){let{replacer:s}=n,i=new eh.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(Ti.createPair(a,l,n))}return i}var th={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ia,createNode:_a};Jn.createPairs=_a;Jn.pairs=th;Jn.resolvePairs=Ia});var Ci=w(Ni=>{"use strict";var Ta=O(),Oi=Ee(),Kt=Ne(),nh=Ce(),Oa=Qn(),Be=class t extends nh.YAMLSeq{constructor(){super(),this.add=Kt.YAMLMap.prototype.add.bind(this),this.delete=Kt.YAMLMap.prototype.delete.bind(this),this.get=Kt.YAMLMap.prototype.get.bind(this),this.has=Kt.YAMLMap.prototype.has.bind(this),this.set=Kt.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(Ta.isPair(i)?(r=Oi.toJS(i.key,"",n),o=Oi.toJS(i.value,r,n)):r=Oi.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=Oa.createPairs(e,n,s),r=new this;return r.items=i.items,r}};Be.tag="tag:yaml.org,2002:omap";var sh={collection:"seq",identify:t=>t instanceof Map,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Oa.resolvePairs(t,e),s=[];for(let{key:i}of n.items)Ta.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Be,n)},createNode:(t,e,n)=>Be.from(t,e,n)};Ni.YAMLOMap=Be;Ni.omap=sh});var Ma=w($i=>{"use strict";var Na=P();function Ca({value:t,source:e},n){return e&&(t?$a:La).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var $a={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 Na.Scalar(!0),stringify:Ca},La={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 Na.Scalar(!1),stringify:Ca};$i.falseTag=La;$i.trueTag=$a});var Pa=w(zn=>{"use strict";var ih=P(),Li=it(),rh={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},oh={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():Li.stringifyNumber(t)}},ah={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 ih.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:Li.stringifyNumber};zn.float=ah;zn.floatExp=oh;zn.floatNaN=rh});var Ra=w(Ut=>{"use strict";var Da=it(),Bt=t=>typeof t=="bigint"||Number.isInteger(t);function Xn(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 Mi(t,e,n){let{value:s}=t;if(Bt(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return Da.stringifyNumber(t)}var lh={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Xn(t,2,2,n),stringify:t=>Mi(t,2,"0b")},ch={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Xn(t,1,8,n),stringify:t=>Mi(t,8,"0")},uh={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Xn(t,0,10,n),stringify:Da.stringifyNumber},fh={identify:Bt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Xn(t,2,16,n),stringify:t=>Mi(t,16,"0x")};Ut.int=uh;Ut.intBin=lh;Ut.intHex=fh;Ut.intOct=ch});var Di=w(Pi=>{"use strict";var ts=O(),Zn=Te(),es=Ne(),Ue=class t extends es.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;ts.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Zn.Pair(e.key,null):n=new Zn.Pair(e,null),es.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=es.findPair(this.items,e);return!n&&ts.isPair(s)?ts.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=es.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Zn.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(Zn.createPair(o,null,s));return r}};Ue.tag="tag:yaml.org,2002:set";var dh={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(ts.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}};Pi.YAMLSet=Ue;Pi.set=dh});var qi=w(ns=>{"use strict";var ph=it();function Ri(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 qa(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return ph.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 hh={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})=>Ri(t,n),stringify:qa},mh={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=>Ri(t,!1),stringify:qa},xa={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(xa.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),u=e[8];if(u&&u!=="Z"){let f=Ri(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ns.floatTime=mh;ns.intTime=hh;ns.timestamp=xa});var Ua=w(Ba=>{"use strict";var gh=nt(),yh=jn(),Sh=st(),vh=qt(),wh=_i(),Ka=Ma(),xi=Pa(),ss=Ra(),bh=Dn(),kh=Ci(),Eh=Qn(),Ah=Di(),Ki=qi(),Ih=[gh.map,Sh.seq,vh.string,yh.nullTag,Ka.trueTag,Ka.falseTag,ss.intBin,ss.intOct,ss.int,ss.intHex,xi.floatNaN,xi.floatExp,xi.float,wh.binary,bh.merge,kh.omap,Eh.pairs,Ah.set,Ki.intTime,Ki.floatTime,Ki.timestamp];Ba.schema=Ih});var za=w(Fi=>{"use strict";var Ya=nt(),_h=jn(),Ga=st(),Th=qt(),Oh=Si(),Bi=wi(),Ui=ki(),Nh=wa(),Ch=Ea(),Va=_i(),Ft=Dn(),Wa=Ci(),Ja=Qn(),Fa=Ua(),Qa=Di(),is=qi(),ja=new Map([["core",Nh.schema],["failsafe",[Ya.map,Ga.seq,Th.string]],["json",Ch.schema],["yaml11",Fa.schema],["yaml-1.1",Fa.schema]]),Ha={binary:Va.binary,bool:Oh.boolTag,float:Bi.float,floatExp:Bi.floatExp,floatNaN:Bi.floatNaN,floatTime:is.floatTime,int:Ui.int,intHex:Ui.intHex,intOct:Ui.intOct,intTime:is.intTime,map:Ya.map,merge:Ft.merge,null:_h.nullTag,omap:Wa.omap,pairs:Ja.pairs,seq:Ga.seq,set:Qa.set,timestamp:is.timestamp},$h={"tag:yaml.org,2002:binary":Va.binary,"tag:yaml.org,2002:merge":Ft.merge,"tag:yaml.org,2002:omap":Wa.omap,"tag:yaml.org,2002:pairs":Ja.pairs,"tag:yaml.org,2002:set":Qa.set,"tag:yaml.org,2002:timestamp":is.timestamp};function Lh(t,e,n){let s=ja.get(e);if(s&&!t)return n&&!s.includes(Ft.merge)?s.concat(Ft.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(ja.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(Ft.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Ha[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ha).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Fi.coreKnownTags=$h;Fi.getTags=Lh});var Yi=w(Xa=>{"use strict";var ji=O(),Mh=nt(),Ph=st(),Dh=qt(),rs=za(),Rh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Hi=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?rs.getTags(e,"compat"):e?rs.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?rs.coreKnownTags:{},this.tags=rs.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ji.MAP,{value:Mh.map}),Object.defineProperty(this,ji.SCALAR,{value:Dh.string}),Object.defineProperty(this,ji.SEQ,{value:Ph.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Rh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Xa.Schema=Hi});var el=w(Za=>{"use strict";var qh=O(),Gi=Mt(),jt=Nt();function xh(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=Gi.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift(jt.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(qh.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let u=r(t.contents.commentBefore);n.push(jt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=Gi.stringify(t.contents,i,()=>a=null,l);a&&(c+=jt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Gi.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=r(t.comment);l.includes(`
57
57
  `)?(n.push("..."),n.push(jt.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(jt.indentComment(r(l),"")))}return n.join(`
58
58
  `)+`
59
- `}Za.stringifyDocument=Mh});var Ht=v(tl=>{"use strict";var Dh=Ot(),rt=_n(),Z=T(),qh=Oe(),Rh=Ee(),xh=Yi(),Kh=el(),Vi=kn(),Bh=zs(),Fh=Tt(),Wi=Qs(),Ji=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 Wi.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){ot(this.contents)&&this.contents.add(e)}addIn(e,n){ot(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=Vi.anchorNames(this);e.anchor=!n||s.has(n)?Vi.findNewAnchor(n||"a",s):n}return new Dh.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:u}=s??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=Vi.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=Fh.createNode(e,u,y);return a&&Z.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,n,s={}){let i=this.createNode(e,null,s),r=this.createNode(n,null,s);return new qh.Pair(i,r)}delete(e){return ot(this.contents)?this.contents.delete(e):!1}deleteIn(e){return rt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ot(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 rt.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 rt.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=rt.collectionFromPath(this.schema,[e],n):ot(this.contents)&&this.contents.set(e,n)}setIn(e,n){rt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=rt.collectionFromPath(this.schema,Array.from(e),n):ot(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 Wi.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 Wi.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 xh.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=Rh.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?Bh.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 Kh.stringifyDocument(this,e)}};function ot(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}tl.Document=Ji});var Vt=v(Gt=>{"use strict";var Yt=class extends Error{constructor(e,n,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=n}},Qi=class extends Yt{constructor(e,n,s){super("YAMLParseError",e,n,s)}},zi=class extends Yt{constructor(e,n,s){super("YAMLWarning",e,n,s)}},Uh=(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
59
+ `}Za.stringifyDocument=xh});var Ht=w(tl=>{"use strict";var Kh=Tt(),rt=_n(),Z=O(),Bh=Te(),Uh=Ee(),Fh=Yi(),jh=el(),Vi=kn(),Hh=zs(),Yh=Ot(),Wi=Qs(),Ji=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 Wi.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){ot(this.contents)&&this.contents.add(e)}addIn(e,n){ot(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=Vi.anchorNames(this);e.anchor=!n||s.has(n)?Vi.findNewAnchor(n||"a",s):n}return new Kh.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,v=n.filter(m).map(String);v.length>0&&(n=n.concat(v)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=s??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=Vi.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=Yh.createNode(e,u,y);return a&&Z.isCollection(h)&&(h.flow=!0),d(),h}createPair(e,n,s={}){let i=this.createNode(e,null,s),r=this.createNode(n,null,s);return new Bh.Pair(i,r)}delete(e){return ot(this.contents)?this.contents.delete(e):!1}deleteIn(e){return rt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ot(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 rt.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 rt.isEmptyPath(e)?this.contents!==void 0:Z.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=rt.collectionFromPath(this.schema,[e],n):ot(this.contents)&&this.contents.set(e,n)}setIn(e,n){rt.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=rt.collectionFromPath(this.schema,Array.from(e),n):ot(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 Wi.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 Wi.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 Fh.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=Uh.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:c,res:u}of a.anchors.values())r(u,c);return typeof o=="function"?Hh.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 jh.stringifyDocument(this,e)}};function ot(t){if(Z.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}tl.Document=Ji});var Vt=w(Gt=>{"use strict";var Yt=class extends Error{constructor(e,n,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=n}},Qi=class extends Yt{constructor(e,n,s){super("YAMLParseError",e,n,s)}},zi=class extends Yt{constructor(e,n,s){super("YAMLWarning",e,n,s)}},Gh=(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
- `}};Gt.YAMLError=Yt;Gt.YAMLParseError=Qi;Gt.YAMLWarning=zi;Gt.prettifyError=Uh});var Wt=v(nl=>{"use strict";function jh(t,{flow:e,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",p=!1,y=!1,h=null,m=null,w=null,b=null,A=null,I=null,E=null;for(let k of t)switch(y&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),h&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),k.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&k.source.includes(" ")&&(h=k),u=!0;break;case"comment":{u||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let P=k.source.substring(1)||" ";f?f+=d+P:f=P,d="",c=!1;break}case"newline":c?f?f+=k.source:(!I||n!=="seq-item-ind")&&(l=!0):d+=k.source,c=!0,p=!0,(m||w)&&(b=k),u=!0;break;case"anchor":m&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,E??(E=k.offset),c=!1,u=!1,y=!0;break;case"tag":{w&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,E??(E=k.offset),c=!1,u=!1,y=!0;break}case n:(m||w)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),I&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),I=k,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){A&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=k,c=!1,u=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,u=!1}let _=t[t.length-1],C=_?_.offset+_.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:I,spaceBefore:l,comment:f,hasNewline:p,anchor:m,tag:w,newlineAfterProp:b,end:C,start:E??C}}nl.resolveProps=jh});var os=v(sl=>{"use strict";function Xi(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(Xi(e.key)||Xi(e.value))return!0}return!1;default:return!0}}sl.containsNewline=Xi});var Zi=v(il=>{"use strict";var Hh=os();function Yh(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&Hh.containsNewline(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}il.flowIndentCheck=Yh});var er=v(ol=>{"use strict";var rl=T();function Gh(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||rl.isScalar(r)&&rl.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,n))}ol.mapIncludes=Gh});var dl=v(fl=>{"use strict";var al=Oe(),Vh=Ne(),ll=Wt(),Wh=os(),cl=Zi(),Jh=er(),ul="All mapping items must start at the same column";function Qh({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??Vh.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let u of s.items){let{start:f,key:d,sep:p,value:y}=u,h=ll.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!h.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==s.indent&&i(l,"BAD_INDENT",ul)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
66
- `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Wh.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(l,"BAD_INDENT",ul);n.atKey=!0;let w=h.end,b=d?t(n,d,h,i):e(n,w,f,null,h,i);n.schema.compat&&cl.flowIndentCheck(s.indent,d,i),n.atKey=!1,Jh.mapIncludes(n,a.items,b)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let A=ll.resolveProps(p??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:i,parentIndent:s.indent,startOnNewline:!d||d.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 I=y?t(n,y,A,i):e(n,l,p,null,A,i);n.schema.compat&&cl.flowIndentCheck(s.indent,y,i),l=I.range[2];let E=new al.Pair(b,I);n.options.keepSourceTokens&&(E.srcToken=u),a.items.push(E)}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 I=new al.Pair(b);n.options.keepSourceTokens&&(I.srcToken=u),a.items.push(I)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}fl.resolveBlockMap=Qh});var hl=v(pl=>{"use strict";var zh=Ce(),Xh=Wt(),Zh=Zi();function em({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??zh.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:u,value:f}of s.items){let d=Xh.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(n,f,d,i):e(n,d.end,u,null,d,i);n.schema.compat&&Zh.flowIndentCheck(s.indent,f,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}pl.resolveBlockSeq=em});var at=v(ml=>{"use strict";function tm(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 u=l.substring(1)||" ";i?i+=o+u:i=u,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}}ml.resolveEnd=tm});var vl=v(Sl=>{"use strict";var nm=T(),sm=Oe(),gl=Ne(),im=Ce(),rm=at(),yl=Wt(),om=os(),am=er(),tr="Block collections are not allowed within flow collections",nr=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lm({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?gl.YAMLMap:im.YAMLSeq),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=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:I,value:E}=w,_=yl.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:A??I?.[0],offset:f,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!I&&!E){m===0&&_.comma?i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),_.comment&&(c.comment?c.comment+=`
68
- `+_.comment:c.comment=_.comment),f=_.end;continue}!o&&n.options.strict&&om.containsNewline(A)&&i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)_.comma&&i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(_.comma||i(_.start,"MISSING_CHAR",`Missing , between ${a} items`),_.comment){let C="";e:for(let k of b)switch(k.type){case"comma":case"space":break;case"comment":C=k.source.substring(1);break e;default:break e}if(C){let k=c.items[c.items.length-1];nm.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
69
- `+C:k.comment=C,_.comment=_.comment.substring(C.length+1)}}if(!o&&!I&&!_.found){let C=E?t(n,E,_,i):e(n,_.end,I,null,_,i);c.items.push(C),f=C.range[2],nr(E)&&i(C.range,"BLOCK_IN_FLOW",tr)}else{n.atKey=!0;let C=_.end,k=A?t(n,A,_,i):e(n,C,b,null,_,i);nr(A)&&i(k.range,"BLOCK_IN_FLOW",tr),n.atKey=!1;let P=yl.resolveProps(I??[],{flow:a,indicator:"map-value-ind",next:E,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(P.found){if(!o&&!_.found&&n.options.strict){if(I)for(let q of I){if(q===P.found)break;if(q.type==="newline"){i(q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}_.start<P.found.offset-1024&&i(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(P.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let be=E?t(n,E,P,i):P.found?e(n,P.end,I,null,P,i):null;be?nr(E)&&i(be.range,"BLOCK_IN_FLOW",tr):P.comment&&(k.comment?k.comment+=`
70
- `+P.comment:k.comment=P.comment);let ze=new sm.Pair(k,be);if(n.options.keepSourceTokens&&(ze.srcToken=w),o){let q=c;am.mapIncludes(n,q.items,k)&&i(C,"DUPLICATE_KEY","Map keys must be unique"),q.items.push(ze)}else{let q=new gl.YAMLMap(n.schema);q.flow=!0,q.items.push(ze);let wo=(be??k).range;q.range=[k.range[0],wo[1],wo[2]],c.items.push(q)}f=be?be.range[2]:P.end}}let d=o?"}":"]",[p,...y]=s.end,h=f;if(p?.source===d)h=p.offset+p.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=u?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let m=rm.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}Sl.resolveFlowCollection=lm});var bl=v(wl=>{"use strict";var cm=T(),um=M(),fm=Ne(),dm=Ce(),pm=dl(),hm=hl(),mm=vl();function sr(t,e,n,s,i,r){let o=n.type==="block-map"?pm.resolveBlockMap(t,e,n,s,r):n.type==="block-seq"?hm.resolveBlockSeq(t,e,n,s,r):mm.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 gm(t,e,n,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=s,y=d&&r?d.offset>r.offset?d:r:d??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===fm.YAMLMap.tagName&&a==="map"||o===dm.YAMLSeq.tagName&&a==="seq")return sr(t,e,n,i,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),sr(t,e,n,i,o)}let c=sr(t,e,n,i,o,l),u=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,f=cm.isNode(u)?u:new um.Scalar(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}wl.composeCollection=gm});var rr=v(kl=>{"use strict";var ir=M();function ym(t,e,n){let s=e.offset,i=Sm(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?ir.Scalar.BLOCK_FOLDED:ir.Scalar.BLOCK_LITERAL,o=e.source?vm(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,u=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),u=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 f="",d="",p=!1;for(let h=0;h<u;++h)f+=o[h][0].slice(l)+`
73
- `;for(let h=u;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 I=`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",I),m=""}r===ir.Scalar.BLOCK_LITERAL?(f+=d+m.slice(l)+w,d=`
74
- `):m.length>l||w[0]===" "?(d===" "?d=`
64
+ `}};Gt.YAMLError=Yt;Gt.YAMLParseError=Qi;Gt.YAMLWarning=zi;Gt.prettifyError=Gh});var Wt=w(nl=>{"use strict";function Vh(t,{flow:e,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",p=!1,y=!1,h=null,m=null,v=null,b=null,A=null,I=null,E=null;for(let k of t)switch(y&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),h&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),k.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&k.source.includes(" ")&&(h=k),u=!0;break;case"comment":{u||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=k.source.substring(1)||" ";f?f+=d+M:f=M,d="",c=!1;break}case"newline":c?f?f+=k.source:(!I||n!=="seq-item-ind")&&(l=!0):d+=k.source,c=!0,p=!0,(m||v)&&(b=k),u=!0;break;case"anchor":m&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,E??(E=k.offset),c=!1,u=!1,y=!0;break;case"tag":{v&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),v=k,E??(E=k.offset),c=!1,u=!1,y=!0;break}case n:(m||v)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),I&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),I=k,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){A&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=k,c=!1,u=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,u=!1}let _=t[t.length-1],C=_?_.offset+_.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:I,spaceBefore:l,comment:f,hasNewline:p,anchor:m,tag:v,newlineAfterProp:b,end:C,start:E??C}}nl.resolveProps=Vh});var os=w(sl=>{"use strict";function Xi(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(Xi(e.key)||Xi(e.value))return!0}return!1;default:return!0}}sl.containsNewline=Xi});var Zi=w(il=>{"use strict";var Wh=os();function Jh(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&Wh.containsNewline(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}il.flowIndentCheck=Jh});var er=w(ol=>{"use strict";var rl=O();function Qh(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||rl.isScalar(r)&&rl.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,n))}ol.mapIncludes=Qh});var dl=w(fl=>{"use strict";var al=Te(),zh=Ne(),ll=Wt(),Xh=os(),cl=Zi(),Zh=er(),ul="All mapping items must start at the same column";function em({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??zh.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let u of s.items){let{start:f,key:d,sep:p,value:y}=u,h=ll.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!h.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==s.indent&&i(l,"BAD_INDENT",ul)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
66
+ `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Xh.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(l,"BAD_INDENT",ul);n.atKey=!0;let v=h.end,b=d?t(n,d,h,i):e(n,v,f,null,h,i);n.schema.compat&&cl.flowIndentCheck(s.indent,d,i),n.atKey=!1,Zh.mapIncludes(n,a.items,b)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let A=ll.resolveProps(p??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:i,parentIndent:s.indent,startOnNewline:!d||d.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 I=y?t(n,y,A,i):e(n,l,p,null,A,i);n.schema.compat&&cl.flowIndentCheck(s.indent,y,i),l=I.range[2];let E=new al.Pair(b,I);n.options.keepSourceTokens&&(E.srcToken=u),a.items.push(E)}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 I=new al.Pair(b);n.options.keepSourceTokens&&(I.srcToken=u),a.items.push(I)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}fl.resolveBlockMap=em});var hl=w(pl=>{"use strict";var tm=Ce(),nm=Wt(),sm=Zi();function im({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??tm.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:u,value:f}of s.items){let d=nm.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(n,f,d,i):e(n,d.end,u,null,d,i);n.schema.compat&&sm.flowIndentCheck(s.indent,f,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}pl.resolveBlockSeq=im});var at=w(ml=>{"use strict";function rm(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 u=l.substring(1)||" ";i?i+=o+u:i=u,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}}ml.resolveEnd=rm});var vl=w(Sl=>{"use strict";var om=O(),am=Te(),gl=Ne(),lm=Ce(),cm=at(),yl=Wt(),um=os(),fm=er(),tr="Block collections are not allowed within flow collections",nr=t=>t&&(t.type==="block-map"||t.type==="block-seq");function dm({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?gl.YAMLMap:lm.YAMLSeq),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=s.offset+s.start.source.length;for(let m=0;m<s.items.length;++m){let v=s.items[m],{start:b,key:A,sep:I,value:E}=v,_=yl.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:A??I?.[0],offset:f,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!I&&!E){m===0&&_.comma?i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),_.comment&&(c.comment?c.comment+=`
68
+ `+_.comment:c.comment=_.comment),f=_.end;continue}!o&&n.options.strict&&um.containsNewline(A)&&i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)_.comma&&i(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(_.comma||i(_.start,"MISSING_CHAR",`Missing , between ${a} items`),_.comment){let C="";e:for(let k of b)switch(k.type){case"comma":case"space":break;case"comment":C=k.source.substring(1);break e;default:break e}if(C){let k=c.items[c.items.length-1];om.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
69
+ `+C:k.comment=C,_.comment=_.comment.substring(C.length+1)}}if(!o&&!I&&!_.found){let C=E?t(n,E,_,i):e(n,_.end,I,null,_,i);c.items.push(C),f=C.range[2],nr(E)&&i(C.range,"BLOCK_IN_FLOW",tr)}else{n.atKey=!0;let C=_.end,k=A?t(n,A,_,i):e(n,C,b,null,_,i);nr(A)&&i(k.range,"BLOCK_IN_FLOW",tr),n.atKey=!1;let M=yl.resolveProps(I??[],{flow:a,indicator:"map-value-ind",next:E,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(M.found){if(!o&&!_.found&&n.options.strict){if(I)for(let R of I){if(R===M.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}_.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 E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let be=E?t(n,E,M,i):M.found?e(n,M.end,I,null,M,i):null;be?nr(E)&&i(be.range,"BLOCK_IN_FLOW",tr):M.comment&&(k.comment?k.comment+=`
70
+ `+M.comment:k.comment=M.comment);let ze=new am.Pair(k,be);if(n.options.keepSourceTokens&&(ze.srcToken=v),o){let R=c;fm.mapIncludes(n,R.items,k)&&i(C,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(ze)}else{let R=new gl.YAMLMap(n.schema);R.flow=!0,R.items.push(ze);let wo=(be??k).range;R.range=[k.range[0],wo[1],wo[2]],c.items.push(R)}f=be?be.range[2]:M.end}}let d=o?"}":"]",[p,...y]=s.end,h=f;if(p?.source===d)h=p.offset+p.source.length;else{let m=a[0].toUpperCase()+a.substring(1),v=u?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",v),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let m=cm.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}Sl.resolveFlowCollection=dm});var bl=w(wl=>{"use strict";var pm=O(),hm=P(),mm=Ne(),gm=Ce(),ym=dl(),Sm=hl(),vm=vl();function sr(t,e,n,s,i,r){let o=n.type==="block-map"?ym.resolveBlockMap(t,e,n,s,r):n.type==="block-seq"?Sm.resolveBlockSeq(t,e,n,s,r):vm.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 wm(t,e,n,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=s,y=d&&r?d.offset>r.offset?d:r:d??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===mm.YAMLMap.tagName&&a==="map"||o===gm.YAMLSeq.tagName&&a==="seq")return sr(t,e,n,i,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),sr(t,e,n,i,o)}let c=sr(t,e,n,i,o,l),u=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,f=pm.isNode(u)?u:new hm.Scalar(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}wl.composeCollection=wm});var rr=w(kl=>{"use strict";var ir=P();function bm(t,e,n){let s=e.offset,i=km(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?ir.Scalar.BLOCK_FOLDED:ir.Scalar.BLOCK_LITERAL,o=e.source?Em(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,u=0;for(let h=0;h<a;++h){let[m,v]=o[h];if(v===""||v==="\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),u=h,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+v.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>l&&(a=h+1);let f="",d="",p=!1;for(let h=0;h<u;++h)f+=o[h][0].slice(l)+`
73
+ `;for(let h=u;h<a;++h){let[m,v]=o[h];c+=m.length+v.length+1;let b=v[v.length-1]==="\r";if(b&&(v=v.slice(0,-1)),v&&m.length<l){let I=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-v.length-(b?2:1),"BAD_INDENT",I),m=""}r===ir.Scalar.BLOCK_LITERAL?(f+=d+m.slice(l)+v,d=`
74
+ `):m.length>l||v[0]===" "?(d===" "?d=`
75
75
  `:!p&&d===`
76
76
  `&&(d=`
77
77
 
78
- `),f+=d+m.slice(l)+w,d=`
79
- `,p=!0):w===""?d===`
78
+ `),f+=d+m.slice(l)+v,d=`
79
+ `,p=!0):v===""?d===`
80
80
  `?f+=`
81
81
  `:d=`
82
- `:(f+=d+w,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)f+=`
82
+ `:(f+=d+v,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)f+=`
83
83
  `+o[h][0].slice(l);f[f.length-1]!==`
84
84
  `&&(f+=`
85
85
  `);break;default:f+=`
86
- `}let y=s+i.length+e.source.length;return{value:f,type:r,comment:i.comment,range:[s,y,y]}}function Sm({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 d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let y=Number(p);!o&&y?o=y:l===-1&&(l=t+d)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":n&&!c&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),f+=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"&&(f+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:u,length:f}}function vm(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}kl.resolveBlockScalar=ym});var ar=v(Al=>{"use strict";var or=M(),wm=at();function bm(t,e,n){let{offset:s,type:i,source:r,end:o}=t,a,l,c=(d,p,y)=>n(s+d,p,y);switch(i){case"scalar":a=or.Scalar.PLAIN,l=km(r,c);break;case"single-quoted-scalar":a=or.Scalar.QUOTE_SINGLE,l=Em(r,c);break;case"double-quoted-scalar":a=or.Scalar.QUOTE_DOUBLE,l=Am(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 u=s+r.length,f=wm.resolveEnd(o,u,e,n);return{value:l,type:a,comment:f.comment,range:[s,u,f.offset]}}function km(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}`),El(t)}function Em(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),El(t.slice(1,-1)).replace(/''/g,"'")}function El(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
86
+ `}let y=s+i.length+e.source.length;return{value:f,type:r,comment:i.comment,range:[s,y,y]}}function km({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 d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let y=Number(p);!o&&y?o=y:l===-1&&(l=t+d)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":n&&!c&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),f+=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"&&(f+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:u,length:f}}function Em(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}kl.resolveBlockScalar=bm});var ar=w(Al=>{"use strict";var or=P(),Am=at();function Im(t,e,n){let{offset:s,type:i,source:r,end:o}=t,a,l,c=(d,p,y)=>n(s+d,p,y);switch(i){case"scalar":a=or.Scalar.PLAIN,l=_m(r,c);break;case"single-quoted-scalar":a=or.Scalar.QUOTE_SINGLE,l=Tm(r,c);break;case"double-quoted-scalar":a=or.Scalar.QUOTE_DOUBLE,l=Om(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 u=s+r.length,f=Am.resolveEnd(o,u,e,n);return{value:l,type:a,comment:f.comment,range:[s,u,f.offset]}}function _m(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}`),El(t)}function Tm(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),El(t.slice(1,-1)).replace(/''/g,"'")}function El(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 Am(t,e){let n="";for(let s=1;s<t.length-1;++s){let i=t[s];if(!(i==="\r"&&t[s+1]===`
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 Om(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}=Im(t,s);n+=r,s=o}else if(i==="\\"){let r=t[++s],o=_m[r];if(o)n+=o;else if(r===`
92
+ `){let{fold:r,offset:o}=Nm(t,s);n+=r,s=o}else if(i==="\\"){let r=t[++s],o=Cm[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+=Om(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!==`
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+=$m(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 Im(t,e){let n="",s=t[e+1];for(;(s===" "||s===" "||s===`
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 Nm(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 _m={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 Om(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)}Al.resolveFlowScalar=bm});var Ol=v(_l=>{"use strict";var Ue=T(),Il=M(),Tm=rr(),Nm=ar();function Cm(t,e,n,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Tm.resolveBlockScalar(t,e,s):Nm.resolveFlowScalar(e,t.options.strict,s),l=n?t.directives.tagName(n.source,f=>s(n,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[Ue.SCALAR]:l?c=Lm(t.schema,i,l,n,s):e.type==="scalar"?c=$m(t,i,e,s):c=t.schema[Ue.SCALAR];let u;try{let f=c.resolve(i,d=>s(n??e,"TAG_RESOLVE_FAILED",d),t.options);u=Ue.isScalar(f)?f:new Il.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);s(n??e,"TAG_RESOLVE_FAILED",d),u=new Il.Scalar(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function Lm(t,e,n,s,i){if(n==="!")return t[Ue.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[Ue.SCALAR])}function $m({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[Ue.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[Ue.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}_l.composeScalar=Cm});var Nl=v(Tl=>{"use strict";function Pm(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}Tl.emptyScalarPosition=Pm});var $l=v(cr=>{"use strict";var Mm=Ot(),Dm=T(),qm=bl(),Cl=Ol(),Rm=at(),xm=Nl(),Km={composeNode:Ll,composeEmptyNode:lr};function Ll(t,e,n,s){let i=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,c,u=!0;switch(e.type){case"alias":c=Bm(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=Cl.composeScalar(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=qm.composeCollection(Km,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);s(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=lr(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&&(!Dm.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&&u&&(c.srcToken=e),c}function lr(t,e,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:xm.emptyScalarPosition(e,n,s),indent:-1,source:""},f=Cl.composeScalar(t,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function Bm({options:t},{offset:e,source:n,end:s},i){let r=new Mm.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=Rm.resolveEnd(s,o,t.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}cr.composeEmptyNode=lr;cr.composeNode=Ll});var Dl=v(Ml=>{"use strict";var Fm=Ht(),Pl=$l(),Um=at(),jm=Wt();function Hm(t,e,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},t),l=new Fm.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=jm.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Pl.composeNode(c,i,u,o):Pl.composeEmptyNode(c,u.end,s,null,u,o);let f=l.contents.range[2],d=Um.resolveEnd(r,f,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,f,d.offset],l}Ml.composeDoc=Hm});var fr=v(xl=>{"use strict";var Ym=ke("process"),Gm=Qs(),Vm=Ht(),Jt=Vt(),ql=T(),Wm=Dl(),Jm=at();function Qt(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 Rl(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?`
100
+ `),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Cm={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 $m(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)}Al.resolveFlowScalar=Im});var Tl=w(_l=>{"use strict";var Fe=O(),Il=P(),Lm=rr(),Mm=ar();function Pm(t,e,n,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Lm.resolveBlockScalar(t,e,s):Mm.resolveFlowScalar(e,t.options.strict,s),l=n?t.directives.tagName(n.source,f=>s(n,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[Fe.SCALAR]:l?c=Dm(t.schema,i,l,n,s):e.type==="scalar"?c=Rm(t,i,e,s):c=t.schema[Fe.SCALAR];let u;try{let f=c.resolve(i,d=>s(n??e,"TAG_RESOLVE_FAILED",d),t.options);u=Fe.isScalar(f)?f:new Il.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);s(n??e,"TAG_RESOLVE_FAILED",d),u=new Il.Scalar(i)}return u.range=a,u.source=i,r&&(u.type=r),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function Dm(t,e,n,s,i){if(n==="!")return t[Fe.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[Fe.SCALAR])}function Rm({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[Fe.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[Fe.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}_l.composeScalar=Pm});var Nl=w(Ol=>{"use strict";function qm(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}Ol.emptyScalarPosition=qm});var Ll=w(cr=>{"use strict";var xm=Tt(),Km=O(),Bm=bl(),Cl=Tl(),Um=at(),Fm=Nl(),jm={composeNode:$l,composeEmptyNode:lr};function $l(t,e,n,s){let i=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,c,u=!0;switch(e.type){case"alias":c=Hm(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=Cl.composeScalar(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Bm.composeCollection(jm,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);s(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=lr(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&&(!Km.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&&u&&(c.srcToken=e),c}function lr(t,e,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:Fm.emptyScalarPosition(e,n,s),indent:-1,source:""},f=Cl.composeScalar(t,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function Hm({options:t},{offset:e,source:n,end:s},i){let r=new xm.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=Um.resolveEnd(s,o,t.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}cr.composeEmptyNode=lr;cr.composeNode=$l});var Dl=w(Pl=>{"use strict";var Ym=Ht(),Ml=Ll(),Gm=at(),Vm=Wt();function Wm(t,e,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},t),l=new Ym.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=Vm.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Ml.composeNode(c,i,u,o):Ml.composeEmptyNode(c,u.end,s,null,u,o);let f=l.contents.range[2],d=Gm.resolveEnd(r,f,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,f,d.offset],l}Pl.composeDoc=Wm});var fr=w(xl=>{"use strict";var Jm=ke("process"),Qm=Qs(),zm=Ht(),Jt=Vt(),Rl=O(),Xm=Dl(),Zm=at();function Qt(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 ql(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 ur=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=Qt(n);r?this.warnings.push(new Jt.YAMLWarning(o,s,i)):this.errors.push(new Jt.YAMLParseError(o,s,i))},this.directives=new Gm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:i}=Rl(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(ql.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ql.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
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 ur=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=Qt(n);r?this.warnings.push(new Jt.YAMLWarning(o,s,i)):this.errors.push(new Jt.YAMLParseError(o,s,i))},this.directives=new Qm.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:i}=ql(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(Rl.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Rl.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:Rl(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(Ym.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,s,i)=>{let r=Qt(e);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Wm.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 Jt.YAMLParseError(Qt(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 Jt.YAMLParseError(Qt(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=Jm.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 Jt.YAMLParseError(Qt(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 Vm.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}}};xl.Composer=ur});var Fl=v(as=>{"use strict";var Qm=rr(),zm=ar(),Xm=Vt(),Kl=$t();function Zm(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 Xm.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return zm.resolveFlowScalar(t,e,s);case"block-scalar":return Qm.resolveBlockScalar({options:{strict:e}},t,s)}}return null}function eg(t,e){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=Kl.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:`
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:ql(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(Jm.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,s,i)=>{let r=Qt(e);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Xm.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 Jt.YAMLParseError(Qt(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 Jt.YAMLParseError(Qt(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=Zm.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 Jt.YAMLParseError(Qt(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 zm.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}}};xl.Composer=ur});var Ul=w(as=>{"use strict";var eg=rr(),tg=ar(),ng=Vt(),Kl=Lt();function sg(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 ng.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return tg.resolveFlowScalar(t,e,s);case"block-scalar":return eg.resolveBlockScalar({options:{strict:e}},t,s)}}return null}function ig(t,e){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=Kl.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
110
  `),u=a.substring(0,c),f=a.substring(c+1)+`
111
111
  `,d=[{type:"block-scalar-header",offset:r,indent:s,source:u}];return Bl(d,l)||d.push({type:"newline",offset:-1,indent:s,source:`
112
- `}),{type:"block-scalar",offset:r,indent:s,props:d,source:f}}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 tg(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=Kl.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">":ng(t,l);break;case'"':dr(t,l,"double-quoted-scalar");break;case"'":dr(t,l,"single-quoted-scalar");break;default:dr(t,l,"scalar")}}function ng(t,e){let n=e.indexOf(`
112
+ `}),{type:"block-scalar",offset:r,indent:s,props:d,source:f}}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 rg(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=Kl.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">":og(t,l);break;case'"':dr(t,l,"double-quoted-scalar");break;case"'":dr(t,l,"single-quoted-scalar");break;default:dr(t,l,"scalar")}}function og(t,e){let n=e.indexOf(`
113
113
  `),s=e.substring(0,n),i=e.substring(n+1)+`
114
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}];Bl(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
115
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 Bl(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 dr(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})}}}as.createScalarToken=eg;as.resolveAsScalar=Zm;as.setScalarValue=tg});var jl=v(Ul=>{"use strict";var sg=t=>"type"in t?cs(t):ls(t);function cs(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=cs(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=ls(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=ls(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=ls(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 ls({start:t,key:e,sep:n,value:s}){let i="";for(let r of t)i+=r.source;if(e&&(i+=cs(e)),n)for(let r of n)i+=r.source;return s&&(i+=cs(s)),i}Ul.stringify=sg});var Vl=v(Gl=>{"use strict";var pr=Symbol("break visit"),ig=Symbol("skip children"),Hl=Symbol("remove item");function je(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Yl(Object.freeze([]),t,e)}je.BREAK=pr;je.SKIP=ig;je.REMOVE=Hl;je.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};je.parentCollection=(t,e)=>{let n=je.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 Yl(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=Yl(Object.freeze(t.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===pr)return pr;a===Hl&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}Gl.visit=je});var us=v(J=>{"use strict";var hr=Fl(),rg=jl(),og=Vl(),mr="\uFEFF",gr="",yr="",Sr="",ag=t=>!!t&&"items"in t,lg=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function cg(t){switch(t){case mr:return"<BOM>";case gr:return"<DOC>";case yr:return"<FLOW_END>";case Sr:return"<SCALAR>";default:return JSON.stringify(t)}}function ug(t){switch(t){case mr:return"byte-order-mark";case gr:return"doc-mode";case yr:return"flow-error-end";case Sr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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})}}}as.createScalarToken=ig;as.resolveAsScalar=sg;as.setScalarValue=rg});var jl=w(Fl=>{"use strict";var ag=t=>"type"in t?cs(t):ls(t);function cs(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=cs(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=ls(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=ls(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=ls(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 ls({start:t,key:e,sep:n,value:s}){let i="";for(let r of t)i+=r.source;if(e&&(i+=cs(e)),n)for(let r of n)i+=r.source;return s&&(i+=cs(s)),i}Fl.stringify=ag});var Vl=w(Gl=>{"use strict";var pr=Symbol("break visit"),lg=Symbol("skip children"),Hl=Symbol("remove item");function je(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Yl(Object.freeze([]),t,e)}je.BREAK=pr;je.SKIP=lg;je.REMOVE=Hl;je.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};je.parentCollection=(t,e)=>{let n=je.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 Yl(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=Yl(Object.freeze(t.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===pr)return pr;a===Hl&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}Gl.visit=je});var us=w(J=>{"use strict";var hr=Ul(),cg=jl(),ug=Vl(),mr="\uFEFF",gr="",yr="",Sr="",fg=t=>!!t&&"items"in t,dg=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function pg(t){switch(t){case mr:return"<BOM>";case gr:return"<DOC>";case yr:return"<FLOW_END>";case Sr:return"<SCALAR>";default:return JSON.stringify(t)}}function hg(t){switch(t){case mr:return"byte-order-mark";case gr:return"doc-mode";case yr:return"flow-error-end";case Sr: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}J.createScalarToken=hr.createScalarToken;J.resolveAsScalar=hr.resolveAsScalar;J.setScalarValue=hr.setScalarValue;J.stringify=rg.stringify;J.visit=og.visit;J.BOM=mr;J.DOCUMENT=gr;J.FLOW_END=yr;J.SCALAR=Sr;J.isCollection=ag;J.isScalar=lg;J.prettyToken=cg;J.tokenType=ug});var br=v(Jl=>{"use strict";var zt=us();function ne(t){switch(t){case void 0:case" ":case`
119
- `:case"\r":case" ":return!0;default:return!1}}var Wl=new Set("0123456789ABCDEFabcdef"),fg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),fs=new Set(",[]{}"),dg=new Set(` ,[]{}
120
- \r `),vr=t=>!t||dg.has(t),wr=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===`
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=hr.createScalarToken;J.resolveAsScalar=hr.resolveAsScalar;J.setScalarValue=hr.setScalarValue;J.stringify=cg.stringify;J.visit=ug.visit;J.BOM=mr;J.DOCUMENT=gr;J.FLOW_END=yr;J.SCALAR=Sr;J.isCollection=fg;J.isScalar=dg;J.prettyToken=pg;J.tokenType=hg});var br=w(Jl=>{"use strict";var zt=us();function ne(t){switch(t){case void 0:case" ":case`
119
+ `:case"\r":case" ":return!0;default:return!1}}var Wl=new Set("0123456789ABCDEFabcdef"),mg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),fs=new Set(",[]{}"),gg=new Set(` ,[]{}
120
+ \r `),vr=t=>!t||gg.has(t),wr=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===`
@@ -132,17 +132,17 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
132
132
  `&&r>=this.pos&&r+1+n>a)e=r;else break}while(!0);return yield zt.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(ne(r)||e&&fs.has(r))break;n=s}else if(ne(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
133
133
  `?(s+=1,i=`
134
134
  `,r=this.buffer[s+1]):n=s),r==="#"||e&&fs.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&&fs.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zt.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(vr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(ne(n)||e&&fs.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(;!ne(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(fg.has(n))n=this.buffer[++e];else if(n==="%"&&Wl.has(this.buffer[e+1])&&Wl.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===`
135
+ `){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&fs.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zt.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(vr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(ne(n)||e&&fs.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(;!ne(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(mg.has(n))n=this.buffer[++e];else if(n==="%"&&Wl.has(this.buffer[e+1])&&Wl.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)}};Jl.Lexer=wr});var Er=v(Ql=>{"use strict";var kr=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}}}};Ql.LineCounter=kr});var Ir=v(tc=>{"use strict";var pg=ke("process"),zl=us(),hg=br();function Le(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Xl(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 ec(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 ds(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 lt(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 Zl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Le(e.start,"explicit-key-ind")&&!Le(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ec(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 Ar=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 hg.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,pg.env.LOG_TOKENS&&console.log("|",zl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=zl.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"&&Zl(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&&Xl(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":{Xl(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=ds(this.peek(2)),s=lt(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(`
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)}};Jl.Lexer=wr});var Er=w(Ql=>{"use strict";var kr=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}}}};Ql.LineCounter=kr});var Ir=w(tc=>{"use strict";var yg=ke("process"),zl=us(),Sg=br();function $e(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Xl(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 ec(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 ds(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 lt(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 Zl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!$e(e.start,"explicit-key-ind")&&!$e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ec(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 Ar=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 Sg.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,yg.env.LOG_TOKENS&&console.log("|",zl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=zl.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"&&Zl(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&&Xl(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":{Xl(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=ds(this.peek(2)),s=lt(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(Le(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(ec(n.key)&&!Le(n.sep,"newline")){let o=lt(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(Le(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=lt(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]}):Le(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&&!Le(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||Le(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=ds(s),r=lt(i);Zl(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(`
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($e(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(ec(n.key)&&!$e(n.sep,"newline")){let o=lt(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($e(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=lt(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]}):$e(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&&!$e(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||$e(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=ds(s),r=lt(i);Zl(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=ds(e),s=lt(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=ds(e),s=lt(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())}}};tc.Parser=Ar});var oc=v(Zt=>{"use strict";var nc=fr(),mg=Ht(),Xt=Vt(),gg=ci(),yg=T(),Sg=Er(),sc=Ir();function ic(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Sg.LineCounter||null,prettyErrors:e}}function vg(t,e={}){let{lineCounter:n,prettyErrors:s}=ic(e),i=new sc.Parser(n?.addNewLine),r=new nc.Composer(e),o=Array.from(r.compose(i.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(Xt.prettifyError(t,n)),a.warnings.forEach(Xt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function rc(t,e={}){let{lineCounter:n,prettyErrors:s}=ic(e),i=new sc.Parser(n?.addNewLine),r=new nc.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 Xt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Xt.prettifyError(t,n)),o.warnings.forEach(Xt.prettifyError(t,n))),o}function wg(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=rc(t,n);if(!i)return null;if(i.warnings.forEach(r=>gg.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 bg(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 yg.isDocument(t)&&!s?t.toString(n):new mg.Document(t,s,n).toString(n)}Zt.parse=wg;Zt.parseAllDocuments=vg;Zt.parseDocument=rc;Zt.stringify=bg});var ce=v(L=>{"use strict";var kg=fr(),Eg=Ht(),Ag=Yi(),_r=Vt(),Ig=Ot(),$e=T(),_g=Oe(),Og=M(),Tg=Ne(),Ng=Ce(),Cg=us(),Lg=br(),$g=Er(),Pg=Ir(),ps=oc(),ac=Et();L.Composer=kg.Composer;L.Document=Eg.Document;L.Schema=Ag.Schema;L.YAMLError=_r.YAMLError;L.YAMLParseError=_r.YAMLParseError;L.YAMLWarning=_r.YAMLWarning;L.Alias=Ig.Alias;L.isAlias=$e.isAlias;L.isCollection=$e.isCollection;L.isDocument=$e.isDocument;L.isMap=$e.isMap;L.isNode=$e.isNode;L.isPair=$e.isPair;L.isScalar=$e.isScalar;L.isSeq=$e.isSeq;L.Pair=_g.Pair;L.Scalar=Og.Scalar;L.YAMLMap=Tg.YAMLMap;L.YAMLSeq=Ng.YAMLSeq;L.CST=Cg;L.Lexer=Lg.Lexer;L.LineCounter=$g.LineCounter;L.Parser=Pg.Parser;L.parse=ps.parse;L.parseAllDocuments=ps.parseAllDocuments;L.parseDocument=ps.parseDocument;L.stringify=ps.stringify;L.visit=ac.visit;L.visitAsync=ac.visitAsync});import{existsSync as Mg}from"node:fs";import{dirname as Dg,resolve as se}from"node:path";function He(){if(process.env.HIVE_HOME)return se(process.env.HIVE_HOME);let t=se(process.cwd());for(;;){if(Mg(se(t,"hive.yaml")))return t;let e=Dg(t);if(e===t)break;t=e}return se(qg,"hive")}function hs(t){let e=process.env.HIVE_CONFIG||"hive.yaml";return se(t,e)}function lc(t){let n=(process.env.HIVE_CONFIG||"hive.yaml").match(/^hive-(.+)\.yaml$/)?.[1];return se(t,n?`.env-${n}`:".env")}var qg,$,G,Ye,Rg,Rw,cc,Q=O(()=>{"use strict";qg=process.env.HOME??"/tmp";$=He(),G=se($,"skills"),Ye=se($,".hive"),Rg=se($,".hive-state"),Rw=se(Rg,"git"),cc=se(import.meta.dirname,"..","seeds")});import{execFileSync as x}from"node:child_process";import{writeFileSync as xg,unlinkSync as Kg}from"node:fs";import{resolve as Bg}from"node:path";import{tmpdir as Fg}from"node:os";function Or(t){try{return x("which",[t],en),!0}catch{return!1}}function uc(t){try{return x("brew",["list",t],en),!0}catch{return!1}}function Ug(t){try{return x("brew",["services","list"],en).split(`
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=ds(e),s=lt(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=ds(e),s=lt(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())}}};tc.Parser=Ar});var oc=w(Zt=>{"use strict";var nc=fr(),vg=Ht(),Xt=Vt(),wg=ci(),bg=O(),kg=Er(),sc=Ir();function ic(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new kg.LineCounter||null,prettyErrors:e}}function Eg(t,e={}){let{lineCounter:n,prettyErrors:s}=ic(e),i=new sc.Parser(n?.addNewLine),r=new nc.Composer(e),o=Array.from(r.compose(i.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(Xt.prettifyError(t,n)),a.warnings.forEach(Xt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function rc(t,e={}){let{lineCounter:n,prettyErrors:s}=ic(e),i=new sc.Parser(n?.addNewLine),r=new nc.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 Xt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Xt.prettifyError(t,n)),o.warnings.forEach(Xt.prettifyError(t,n))),o}function Ag(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=rc(t,n);if(!i)return null;if(i.warnings.forEach(r=>wg.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 Ig(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 bg.isDocument(t)&&!s?t.toString(n):new vg.Document(t,s,n).toString(n)}Zt.parse=Ag;Zt.parseAllDocuments=Eg;Zt.parseDocument=rc;Zt.stringify=Ig});var ce=w($=>{"use strict";var _g=fr(),Tg=Ht(),Og=Yi(),_r=Vt(),Ng=Tt(),Le=O(),Cg=Te(),$g=P(),Lg=Ne(),Mg=Ce(),Pg=us(),Dg=br(),Rg=Er(),qg=Ir(),ps=oc(),ac=Et();$.Composer=_g.Composer;$.Document=Tg.Document;$.Schema=Og.Schema;$.YAMLError=_r.YAMLError;$.YAMLParseError=_r.YAMLParseError;$.YAMLWarning=_r.YAMLWarning;$.Alias=Ng.Alias;$.isAlias=Le.isAlias;$.isCollection=Le.isCollection;$.isDocument=Le.isDocument;$.isMap=Le.isMap;$.isNode=Le.isNode;$.isPair=Le.isPair;$.isScalar=Le.isScalar;$.isSeq=Le.isSeq;$.Pair=Cg.Pair;$.Scalar=$g.Scalar;$.YAMLMap=Lg.YAMLMap;$.YAMLSeq=Mg.YAMLSeq;$.CST=Pg;$.Lexer=Dg.Lexer;$.LineCounter=Rg.LineCounter;$.Parser=qg.Parser;$.parse=ps.parse;$.parseAllDocuments=ps.parseAllDocuments;$.parseDocument=ps.parseDocument;$.stringify=ps.stringify;$.visit=ac.visit;$.visitAsync=ac.visitAsync});import{existsSync as xg}from"node:fs";import{dirname as Kg,resolve as se}from"node:path";function He(){if(process.env.HIVE_HOME)return se(process.env.HIVE_HOME);let t=se(process.cwd());for(;;){if(xg(se(t,"hive.yaml")))return t;let e=Kg(t);if(e===t)break;t=e}return se(Bg,"hive")}function hs(t){let e=process.env.HIVE_CONFIG||"hive.yaml";return se(t,e)}function lc(t){let n=(process.env.HIVE_CONFIG||"hive.yaml").match(/^hive-(.+)\.yaml$/)?.[1];return se(t,n?`.env-${n}`:".env")}var Bg,L,G,Ye,Ug,Uw,cc,Q=T(()=>{"use strict";Bg=process.env.HOME??"/tmp";L=He(),G=se(L,"skills"),Ye=se(L,".hive"),Ug=se(L,".hive-state"),Uw=se(Ug,"git"),cc=se(import.meta.dirname,"..","seeds")});import{execFileSync as x}from"node:child_process";import{writeFileSync as Fg,unlinkSync as jg}from"node:fs";import{resolve as Hg}from"node:path";import{tmpdir as Yg}from"node:os";function Tr(t){try{return x("which",[t],en),!0}catch{return!1}}function uc(t){try{return x("brew",["list",t],en),!0}catch{return!1}}function Gg(t){try{return x("brew",["services","list"],en).split(`
142
142
  `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function fc(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 dc(){console.log(`Checking prerequisites...
143
- `);let t=0;for(let e of jg){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(`
143
+ `);let t=0;for(let e of Vg){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 en,jg,pc=O(()=>{"use strict";en={encoding:"utf-8",stdio:"pipe"};jg=[{name:"Xcode CLI Tools",required:!0,check:()=>{try{return x("xcode-select",["-p"],en),!0}catch{return!1}},install:()=>{console.log(" Installing Xcode CLI Tools (this opens a system dialog)..."),x("xcode-select",["--install"],{stdio:"inherit"}),console.log(" Complete the installation dialog, then re-run 'hive init'."),process.exit(0)}},{name:"Homebrew",required:!0,check:()=>Or("brew"),install:()=>{console.log(" Installing Homebrew...");let t=Bg(Fg(),"brew-install.sh"),e=x("curl",["-fsSL","https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"],{encoding:"utf-8"});xg(t,e,{mode:493}),x("/bin/bash",[t],{stdio:"inherit"}),Kg(t)}},{name:"Node.js >= 22",required:!0,check:()=>parseInt(process.versions.node.split(".")[0])>=22,install:()=>{console.log(" Installing Node.js via Homebrew..."),x("brew",["install","node"],{stdio:"inherit"})}},{name:"MongoDB",required:!0,check:()=>Ug("mongodb-community"),install:()=>{uc("mongodb-community")||(console.log(" Tapping mongodb/brew..."),x("brew",["tap","mongodb/brew"],{stdio:"inherit"}),console.log(" Installing mongodb-community..."),x("brew",["install","mongodb-community"],{stdio:"inherit"})),console.log(" Starting MongoDB..."),x("brew",["services","start","mongodb-community"],{stdio:"inherit"})}},{name:"Ollama",required:!0,check:()=>fc("http://127.0.0.1:11434/api/tags"),install:()=>{console.log(" Installing Ollama..."),x("brew",["install","ollama"],{stdio:"inherit"}),x("brew",["services","start","ollama"],{stdio:"inherit"})}},{name:"Ollama models (bge-large, gemma4:e4b)",required:!0,check:()=>{if(!Or("ollama"))return!1;try{let t=x("ollama",["list"],en);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)..."),x("ollama",["pull","bge-large"],{stdio:"inherit"}),console.log(" Pulling gemma4:e4b (~9.6 GB)..."),x("ollama",["pull","gemma4:e4b"],{stdio:"inherit"})}},{name:"Qdrant",required:!0,check:()=>fc("http://127.0.0.1:6333/"),install:()=>{uc("qdrant")||(console.log(" Installing Qdrant..."),x("brew",["install","qdrant/tap/qdrant"],{stdio:"inherit"})),console.log(" Starting Qdrant..."),x("brew",["services","start","qdrant"],{stdio:"inherit"})}},{name:"gh CLI",required:!1,check:()=>Or("gh"),install:()=>{console.log(" Installing gh CLI..."),x("brew",["install","gh"],{stdio:"inherit"})}}]});import{existsSync as ms,mkdirSync as Tr,statSync as Hg}from"node:fs";import{execFileSync as hc}from"node:child_process";import{resolve as tn,dirname as Yg}from"node:path";function mc(t,e,n={}){let s=tn(e,".hive");if(ms(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.`);Tr(s,{recursive:!0});for(let i of Gg){let r=tn(t,i);if(!ms(r))continue;let o=tn(s,i);Tr(Yg(o),{recursive:!0});let a=Hg(r).isDirectory(),l=a?`${r}/`:r,c=a?`${o}/`:o;a&&Tr(o,{recursive:!0}),hc("rsync",["-a",l,c])}n.skipInstall||Nr(s)}function Nr(t){ms(tn(t,"package.json"))&&(ms(tn(t,"node_modules"))||hc("npm",["install","--omit=dev","--no-audit","--no-fund","--no-progress"],{cwd:t,stdio:"inherit"}))}var Gg,gc=O(()=>{"use strict";Gg=["pkg","seeds","templates","scripts/honeypot","install","service","package.json"]});function Cr(t,e){let n=e.split("."),s=t;for(let i of n)if(s=s?.[i],s===void 0)return;return s}function yc(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,yc(Cr(e,i))?r:"")),t=t.replace(/\{\{\^([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>(n=!0,yc(Cr(e,i))?"":r));return t=t.replace(/\{\{([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}/g,(s,i)=>{let r=Cr(e,i);return r===void 0?s:String(r)}),t}var vc=O(()=>{"use strict"});function wc(t){return nn.find(e=>e.fields.some(n=>n.key===t))}var nn,Lr=O(()=>{"use strict";nn=[{server:"brave-search",title:"Brave Search",description:"Web search via the Brave Search API (free tier available).",helpUrl:"https://api.search.brave.com/",kind:"secret",fields:[{key:"BRAVE_API_KEY",label:"Brave API Key"}]},{server:"linear",title:"Linear",description:"Issue tracking and project management.",helpUrl:"https://linear.app/settings/api",kind:"secret",fields:[{key:"LINEAR_API_KEY",label:"Linear Personal API Key"}]},{server:"github-issues",title:"GitHub",description:"GitHub issue tracking (gh CLI / personal access token).",helpUrl:"https://github.com/settings/tokens",kind:"secret",fields:[{key:"GH_TOKEN",label:"GitHub Personal Access Token"}]},{server:"clickup",title:"ClickUp",description:"ClickUp task management.",helpUrl:"https://app.clickup.com/settings/apps",kind:"secret",fields:[{key:"CLICKUP_API_TOKEN",label:"ClickUp API Token"}]},{server:"quo",title:"Quo (OpenPhone) SMS",description:"Send and receive SMS via OpenPhone / Quo.",helpUrl:"https://www.openphone.com/ (Settings \u2192 API)",kind:"secret",fields:[{key:"QUO_API_KEY",label:"Quo API Key"}]},{server:"voice",title:"Vapi (Voice)",description:"Outbound phone calls via Vapi.ai.",helpUrl:"https://dashboard.vapi.ai/account/api-keys",kind:"secret",fields:[{key:"VAPI_API_KEY",label:"Vapi API Key"}]},{server:"recall",title:"Recall.ai",description:"Meeting bot \u2014 join calls, get transcripts.",helpUrl:"https://www.recall.ai/ (Dashboard \u2192 API Keys)",kind:"secret",fields:[{key:"RECALL_API_KEY",label:"Recall API Key"}]},{server:"resend",title:"Resend (Email)",description:"Send outbound email with attachments.",helpUrl:"https://resend.com/api-keys",kind:"secret",fields:[{key:"RESEND_API_KEY",label:"Resend API Key"}]},{server:"gemini",title:"Gemini (Image OCR)",description:"Google Gemini API for image OCR / vision (used by file ingestion).",helpUrl:"https://aistudio.google.com/apikey",kind:"secret",fields:[{key:"GEMINI_API_KEY",label:"Gemini API Key"}]},{server:"google",title:"Google (Gmail / Calendar / Drive)",description:"Gmail, Calendar, and Drive access. Uses OAuth via the gog CLI \u2014 not a static API key.",helpUrl:"https://github.com/keepur/gog",kind:"oauth",fields:[],oauthInstructions:"Google access uses OAuth, not an API key. After setup, run `gog auth add <your-account@gmail.com>` to authenticate one or more accounts, then set `GOOGLE_ACCOUNT` (or `google.accounts.<agent-id>` in hive.yaml) so agents know which mailbox to use."}]});import{execFileSync as bc}from"node:child_process";function kc(t,e){bc("honeypot",["set",t,e],{stdio:["pipe","pipe","pipe"]})}function Ec(t){try{return bc("honeypot",["get",t],{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}async function Ac(t){let e=[],n=[];t.log(""),t.log("These are optional integrations. You can add any/all of them later"),t.log("with `hive credentials add <KEY>`. Skipping is fine.");for(let s of nn){if(t.log(""),t.log(`\u2500\u2500 ${s.title} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),t.log(` ${s.description}`),t.log(` Get a key: ${s.helpUrl}`),s.kind==="oauth"){t.log(""),t.log(` ${s.oauthInstructions??""}`),await t.confirm("Continue",!0),n.push(s.server);continue}if(s.fields.every(a=>t.hasSecret(a.key))&&(t.log(" \u2713 already configured"),!await t.confirm("Replace existing value?",!1))){e.push(s.server);continue}if(!await t.confirm("Provide a key now?",!1)){n.push(s.server);continue}let o=!0;for(let a of s.fields){let l=a.secret===!1?await t.ask(a.label):await t.askSecret(a.label);if(!l){t.log(` \u26A0 Empty value for ${a.key} \u2014 skipping ${s.server}.`),o=!1;break}try{t.setSecret(a.key,l)}catch(c){t.log(` \u26A0 Failed to store ${a.key}: ${c instanceof Error?c.message:String(c)}`),o=!1;break}}o?(e.push(s.server),t.log(` \u2713 ${s.server} stored in Honeypot`)):n.push(s.server)}return t.log(""),t.log("\u2500\u2500 Credentials summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),t.log(` Configured (${e.length}): ${e.join(", ")||"(none)"}`),t.log(` Skipped (${n.length}): ${n.join(", ")||"(none)"}`),t.log(" Run `hive credentials list` later to review, `hive credentials add <KEY>` to add more."),{configured:e,skipped:n}}var Ic=O(()=>{"use strict";Lr()});var ys={};Y(ys,{buildPlist:()=>Cc,getInstanceId:()=>Tc,getLabel:()=>rn,getLaunchAgentLink:()=>Pr,getPlistPath:()=>Nc,startDaemon:()=>Qg,stopDaemon:()=>zg});import{execFileSync as gs}from"node:child_process";import{existsSync as sn,readFileSync as Vg,writeFileSync as Wg,mkdirSync as $r,symlinkSync as Jg,unlinkSync as _c}from"node:fs";import{resolve as ue}from"node:path";function Tc(t){let e=ue(t,process.env.HIVE_CONFIG??"hive.yaml");return sn(e)?((0,Oc.parse)(Vg(e,"utf-8"))??{}).instance?.id??"hive":"hive"}function rn(t){return`com.hive.${Tc(t)}.agent`}function Nc(t){return ue(t,"service",`${rn(t)}.plist`)}function Pr(t){let e=process.env.HOME??"/tmp";return ue(e,"Library","LaunchAgents",`${rn(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"?>
145
+ All prerequisites ready.`)}var en,Vg,pc=T(()=>{"use strict";en={encoding:"utf-8",stdio:"pipe"};Vg=[{name:"Xcode CLI Tools",required:!0,check:()=>{try{return x("xcode-select",["-p"],en),!0}catch{return!1}},install:()=>{console.log(" Installing Xcode CLI Tools (this opens a system dialog)..."),x("xcode-select",["--install"],{stdio:"inherit"}),console.log(" Complete the installation dialog, then re-run 'hive init'."),process.exit(0)}},{name:"Homebrew",required:!0,check:()=>Tr("brew"),install:()=>{console.log(" Installing Homebrew...");let t=Hg(Yg(),"brew-install.sh"),e=x("curl",["-fsSL","https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"],{encoding:"utf-8"});Fg(t,e,{mode:493}),x("/bin/bash",[t],{stdio:"inherit"}),jg(t)}},{name:"Node.js >= 22",required:!0,check:()=>parseInt(process.versions.node.split(".")[0])>=22,install:()=>{console.log(" Installing Node.js via Homebrew..."),x("brew",["install","node"],{stdio:"inherit"})}},{name:"MongoDB",required:!0,check:()=>Gg("mongodb-community"),install:()=>{uc("mongodb-community")||(console.log(" Tapping mongodb/brew..."),x("brew",["tap","mongodb/brew"],{stdio:"inherit"}),console.log(" Installing mongodb-community..."),x("brew",["install","mongodb-community"],{stdio:"inherit"})),console.log(" Starting MongoDB..."),x("brew",["services","start","mongodb-community"],{stdio:"inherit"})}},{name:"Ollama",required:!0,check:()=>fc("http://127.0.0.1:11434/api/tags"),install:()=>{console.log(" Installing Ollama..."),x("brew",["install","ollama"],{stdio:"inherit"}),x("brew",["services","start","ollama"],{stdio:"inherit"})}},{name:"Ollama models (bge-large, gemma4:e4b)",required:!0,check:()=>{if(!Tr("ollama"))return!1;try{let t=x("ollama",["list"],en);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)..."),x("ollama",["pull","bge-large"],{stdio:"inherit"}),console.log(" Pulling gemma4:e4b (~9.6 GB)..."),x("ollama",["pull","gemma4:e4b"],{stdio:"inherit"})}},{name:"Qdrant",required:!0,check:()=>fc("http://127.0.0.1:6333/"),install:()=>{uc("qdrant")||(console.log(" Installing Qdrant..."),x("brew",["install","qdrant/tap/qdrant"],{stdio:"inherit"})),console.log(" Starting Qdrant..."),x("brew",["services","start","qdrant"],{stdio:"inherit"})}},{name:"gh CLI",required:!1,check:()=>Tr("gh"),install:()=>{console.log(" Installing gh CLI..."),x("brew",["install","gh"],{stdio:"inherit"})}}]});import{existsSync as ms,mkdirSync as Or,statSync as Wg}from"node:fs";import{execFileSync as hc}from"node:child_process";import{resolve as tn,dirname as Jg}from"node:path";function mc(t,e,n={}){let s=tn(e,".hive");if(ms(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.`);Or(s,{recursive:!0});for(let i of Qg){let r=tn(t,i);if(!ms(r))continue;let o=tn(s,i);Or(Jg(o),{recursive:!0});let a=Wg(r).isDirectory(),l=a?`${r}/`:r,c=a?`${o}/`:o;a&&Or(o,{recursive:!0}),hc("rsync",["-a",l,c])}n.skipInstall||Nr(s)}function Nr(t){ms(tn(t,"package.json"))&&(ms(tn(t,"node_modules"))||hc("npm",["install","--omit=dev","--no-audit","--no-fund","--no-progress"],{cwd:t,stdio:"inherit"}))}var Qg,gc=T(()=>{"use strict";Qg=["pkg","seeds","templates","scripts/honeypot","install","service","package.json"]});function Cr(t,e){let n=e.split("."),s=t;for(let i of n)if(s=s?.[i],s===void 0)return;return s}function yc(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,yc(Cr(e,i))?r:"")),t=t.replace(/\{\{\^([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>(n=!0,yc(Cr(e,i))?"":r));return t=t.replace(/\{\{([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}/g,(s,i)=>{let r=Cr(e,i);return r===void 0?s:String(r)}),t}var vc=T(()=>{"use strict"});function wc(t){return nn.find(e=>e.fields.some(n=>n.key===t))}var nn,$r=T(()=>{"use strict";nn=[{server:"brave-search",title:"Brave Search",description:"Web search via the Brave Search API (free tier available).",helpUrl:"https://api.search.brave.com/",kind:"secret",fields:[{key:"BRAVE_API_KEY",label:"Brave API Key"}]},{server:"linear",title:"Linear",description:"Issue tracking and project management.",helpUrl:"https://linear.app/settings/api",kind:"secret",fields:[{key:"LINEAR_API_KEY",label:"Linear Personal API Key"}]},{server:"github-issues",title:"GitHub",description:"GitHub issue tracking (gh CLI / personal access token).",helpUrl:"https://github.com/settings/tokens",kind:"secret",fields:[{key:"GH_TOKEN",label:"GitHub Personal Access Token"}]},{server:"clickup",title:"ClickUp",description:"ClickUp task management.",helpUrl:"https://app.clickup.com/settings/apps",kind:"secret",fields:[{key:"CLICKUP_API_TOKEN",label:"ClickUp API Token"}]},{server:"quo",title:"Quo (OpenPhone) SMS",description:"Send and receive SMS via OpenPhone / Quo.",helpUrl:"https://www.openphone.com/ (Settings \u2192 API)",kind:"secret",fields:[{key:"QUO_API_KEY",label:"Quo API Key"}]},{server:"voice",title:"Vapi (Voice)",description:"Outbound phone calls via Vapi.ai.",helpUrl:"https://dashboard.vapi.ai/account/api-keys",kind:"secret",fields:[{key:"VAPI_API_KEY",label:"Vapi API Key"}]},{server:"recall",title:"Recall.ai",description:"Meeting bot \u2014 join calls, get transcripts.",helpUrl:"https://www.recall.ai/ (Dashboard \u2192 API Keys)",kind:"secret",fields:[{key:"RECALL_API_KEY",label:"Recall API Key"}]},{server:"resend",title:"Resend (Email)",description:"Send outbound email with attachments.",helpUrl:"https://resend.com/api-keys",kind:"secret",fields:[{key:"RESEND_API_KEY",label:"Resend API Key"}]},{server:"gemini",title:"Gemini (Image OCR)",description:"Google Gemini API for image OCR / vision (used by file ingestion).",helpUrl:"https://aistudio.google.com/apikey",kind:"secret",fields:[{key:"GEMINI_API_KEY",label:"Gemini API Key"}]},{server:"google",title:"Google (Gmail / Calendar / Drive)",description:"Gmail, Calendar, and Drive access. Uses OAuth via the gog CLI \u2014 not a static API key.",helpUrl:"https://github.com/keepur/gog",kind:"oauth",fields:[],oauthInstructions:"Google access uses OAuth, not an API key. After setup, run `gog auth add <your-account@gmail.com>` to authenticate one or more accounts, then assign them in hive.yaml under `google.accounts.<agent-id>` \u2014 a string for a single account, a list for multi-account agents (first entry is the default)."}]});import{execFileSync as bc}from"node:child_process";function kc(t,e){bc("honeypot",["set",t,e],{stdio:["pipe","pipe","pipe"]})}function Ec(t){try{return bc("honeypot",["get",t],{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}async function Ac(t){let e=[],n=[];t.log(""),t.log("These are optional integrations. You can add any/all of them later"),t.log("with `hive credentials add <KEY>`. Skipping is fine.");for(let s of nn){if(t.log(""),t.log(`\u2500\u2500 ${s.title} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),t.log(` ${s.description}`),t.log(` Get a key: ${s.helpUrl}`),s.kind==="oauth"){t.log(""),t.log(` ${s.oauthInstructions??""}`),await t.confirm("Continue",!0),n.push(s.server);continue}if(s.fields.every(a=>t.hasSecret(a.key))&&(t.log(" \u2713 already configured"),!await t.confirm("Replace existing value?",!1))){e.push(s.server);continue}if(!await t.confirm("Provide a key now?",!1)){n.push(s.server);continue}let o=!0;for(let a of s.fields){let l=a.secret===!1?await t.ask(a.label):await t.askSecret(a.label);if(!l){t.log(` \u26A0 Empty value for ${a.key} \u2014 skipping ${s.server}.`),o=!1;break}try{t.setSecret(a.key,l)}catch(c){t.log(` \u26A0 Failed to store ${a.key}: ${c instanceof Error?c.message:String(c)}`),o=!1;break}}o?(e.push(s.server),t.log(` \u2713 ${s.server} stored in Honeypot`)):n.push(s.server)}return t.log(""),t.log("\u2500\u2500 Credentials summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),t.log(` Configured (${e.length}): ${e.join(", ")||"(none)"}`),t.log(` Skipped (${n.length}): ${n.join(", ")||"(none)"}`),t.log(" Run `hive credentials list` later to review, `hive credentials add <KEY>` to add more."),{configured:e,skipped:n}}var Ic=T(()=>{"use strict";$r()});var ys={};Y(ys,{buildPlist:()=>Cc,getInstanceId:()=>Oc,getLabel:()=>rn,getLaunchAgentLink:()=>Mr,getPlistPath:()=>Nc,startDaemon:()=>ey,stopDaemon:()=>ty});import{execFileSync as gs}from"node:child_process";import{existsSync as sn,readFileSync as zg,writeFileSync as Xg,mkdirSync as Lr,symlinkSync as Zg,unlinkSync as _c}from"node:fs";import{resolve as ue}from"node:path";function Oc(t){let e=ue(t,process.env.HIVE_CONFIG??"hive.yaml");return sn(e)?((0,Tc.parse)(zg(e,"utf-8"))??{}).instance?.id??"hive":"hive"}function rn(t){return`com.hive.${Oc(t)}.agent`}function Nc(t){return ue(t,"service",`${rn(t)}.plist`)}function Mr(t){let e=process.env.HOME??"/tmp";return ue(e,"Library","LaunchAgents",`${rn(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,23 +186,23 @@ All prerequisites ready.`)}var en,jg,pc=O(()=>{"use strict";en={encoding:"utf-8"
186
186
  <string>${a}/hive.err</string>
187
187
  </dict>
188
188
  </plist>
189
- `}async function Qg(t){let e=rn(t),n=Nc(t),s=Pr(t),i=ue(t,"service"),r=ue(t,"logs"),o=ue(t,".hive");$r(i,{recursive:!0}),$r(r,{recursive:!0});let a=gs("which",["node"],{encoding:"utf-8"}).trim(),l=sn(ue(o,"pkg","server.min.js"))?ue(o,"pkg","server.min.js"):ue(o,"dist","index.js"),c=process.env.HOME??"/tmp",u=process.env.PATH??"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",f=Cc({label:e,nodePath:a,serverPath:l,hiveHome:t,home:c,pathEnv:u,logsDir:r});Wg(n,f),console.log(`Generated plist: ${n}`);let d=ue(s,"..");$r(d,{recursive:!0}),sn(s)&&_c(s),Jg(n,s);try{gs("launchctl",["unload",s],{stdio:"pipe"})}catch{}try{gs("launchctl",["load",s],{stdio:"inherit"}),console.log(`Started ${e}`)}catch{throw new Error(`Failed to start ${e}. Check: launchctl list | grep hive`)}}async function zg(t){let e=Pr(t),n=rn(t);if(!sn(e)){console.log(`No LaunchAgent found for ${n}`);return}try{gs("launchctl",["unload",e],{stdio:"inherit"}),console.log(`Stopped ${n}`)}catch{console.error(`Failed to stop ${n}`)}try{sn(e)&&_c(e),console.log(`Removed ${e}`)}catch{}}var Oc,Ss=O(()=>{"use strict";Oc=oe(ce(),1)});var Yc={};Y(Yc,{runWizard:()=>ty});import{createInterface as Xg}from"node:readline";import{readFileSync as ct,writeFileSync as Fc,existsSync as j,readdirSync as Zg}from"node:fs";import{execFileSync as H}from"node:child_process";import{resolve as ye,join as U}from"node:path";import{MongoClient as Mr}from"mongodb";function N(t,e=""){let n=e?`${t} [${e}]: `:`${t}: `;return new Promise(s=>{Uc.question(n,i=>{s(i.trim()||e)})})}async function K(t,e=!0){return(await N(`${t} (${e?"Y/n":"y/N"})`,e?"y":"n")).toLowerCase().startsWith("y")}function ey(){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 z(t){console.log(""),console.log(`\u2500\u2500 ${t} ${"\u2500".repeat(Math.max(0,44-t.length))}`),console.log("")}function jc(){if(!j(vs))return{};let t={};for(let e of ct(vs,"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 on(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}`);Fc(vs,e.join(`
189
+ `}async function ey(t){let e=rn(t),n=Nc(t),s=Mr(t),i=ue(t,"service"),r=ue(t,"logs"),o=ue(t,".hive");Lr(i,{recursive:!0}),Lr(r,{recursive:!0});let a=gs("which",["node"],{encoding:"utf-8"}).trim(),l=sn(ue(o,"pkg","server.min.js"))?ue(o,"pkg","server.min.js"):ue(o,"dist","index.js"),c=process.env.HOME??"/tmp",u=process.env.PATH??"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",f=Cc({label:e,nodePath:a,serverPath:l,hiveHome:t,home:c,pathEnv:u,logsDir:r});Xg(n,f),console.log(`Generated plist: ${n}`);let d=ue(s,"..");Lr(d,{recursive:!0}),sn(s)&&_c(s),Zg(n,s);try{gs("launchctl",["unload",s],{stdio:"pipe"})}catch{}try{gs("launchctl",["load",s],{stdio:"inherit"}),console.log(`Started ${e}`)}catch{throw new Error(`Failed to start ${e}. Check: launchctl list | grep hive`)}}async function ty(t){let e=Mr(t),n=rn(t);if(!sn(e)){console.log(`No LaunchAgent found for ${n}`);return}try{gs("launchctl",["unload",e],{stdio:"inherit"}),console.log(`Stopped ${n}`)}catch{console.error(`Failed to stop ${n}`)}try{sn(e)&&_c(e),console.log(`Removed ${e}`)}catch{}}var Tc,Ss=T(()=>{"use strict";Tc=oe(ce(),1)});var Yc={};Y(Yc,{runWizard:()=>ry});import{createInterface as ny}from"node:readline";import{readFileSync as ct,writeFileSync as Uc,existsSync as j,readdirSync as sy}from"node:fs";import{execFileSync as H}from"node:child_process";import{resolve as ye,join as F}from"node:path";import{MongoClient as Pr}from"mongodb";function N(t,e=""){let n=e?`${t} [${e}]: `:`${t}: `;return new Promise(s=>{Fc.question(n,i=>{s(i.trim()||e)})})}async function K(t,e=!0){return(await N(`${t} (${e?"Y/n":"y/N"})`,e?"y":"n")).toLowerCase().startsWith("y")}function iy(){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 z(t){console.log(""),console.log(`\u2500\u2500 ${t} ${"\u2500".repeat(Math.max(0,44-t.length))}`),console.log("")}function jc(){if(!j(vs))return{};let t={};for(let e of ct(vs,"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 on(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:"# 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}`);Uc(vs,e.join(`
191
191
  `)+`
192
- `)}function Hc(){return j(ws)?(0,ut.parse)(ct(ws,"utf-8"))??{}:{}}function an(t){Fc(ws,(0,ut.stringify)(t))}function Lc(t){return!!(t.business?.name&&t.business?.owner?.name)}function $c(t){return!!(t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)}async function Pc(){let t=process.env.MONGODB_DB;if(!t)return!1;try{let e=new Mr(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 Mc(t){return j(ye(import.meta.dirname,"..","pkg","server.min.js"))?!0:j(ye(t,"dist","index.js"))}async function ty(t,e,n){vs=U(t,".env"),ws=U(t,"hive.yaml");let s=j(ye(n,"pkg","server.min.js"));ey();let i=jc(),r=Hc(),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(Lc(r)&&a.push("Business info"),$c(i)&&a.push("Slack"),await Pc()&&a.push("Agent setup"),Mc(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 N("Press Enter to begin...");if(Lc(r)?(console.log(`Business: ${r.business.name} (${r.business.owner.name}, ${r.business.owner.role})`),await K("Redo business info?",!1)?await Dc(r):console.log(" \u2713 Skipped")):await Dc(r),$c(i)?(console.log("Slack: \u2713 tokens configured"),await K("Redo Slack setup?",!1)?await qc(i,n):console.log(" \u2713 Skipped")):await qc(i,n),z("Anthropic"),i.ANTHROPIC_API_KEY?(console.log("Anthropic API key: \u2713 configured"),await K("Change it?",!1)?await Rc(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 Rc(i):(console.log(" \u2713 Using existing Claude authentication"),on(i))),z("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 N("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await N("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 N("Line name (e.g. main, personal)"),b=await N("Phone Number ID (PNxxx)"),A=await N("Phone number (e.g. (555) 123-4567)"),I=await N("Label (e.g. Jane's Line)"),E=await N("Slack channel for incoming SMS",`sms-${w}`);y[w]={id:b,number:A,label:I},p.push({id:b,label:I,number:A,slackChannel:E}),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
- Authenticated accounts:`),console.log(` ${h.replace(/\n/g,`
195
- `)}`))}catch{}if(console.log(""),await K("Authenticate a Google account now?",!0)){let h=!0;for(;h;){let m=await N("Google account email");console.log(`
196
- Opening browser for ${m}...`),console.log(` Complete the OAuth flow in your browser, then come back here.
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 N("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 N("Which system? (linear / clickup)","");p.toLowerCase().startsWith("l")?(i.LINEAR_API_KEY=await N("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 N("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.")}on(i),an(r),console.log(`
198
- \u2713 Configuration saved (.env + hive.yaml)`),z("Third-Party Credentials"),console.log("Hive can integrate with several third-party services (Linear, Brave Search,"),console.log("ClickUp, Resend, etc.). Provide API keys now to seed them into the macOS"),console.log("Keychain (Honeypot), or skip and add later via `hive credentials add <KEY>`."),await Ac({ask:(p,y)=>N(p,y),askSecret:p=>N(p),confirm:(p,y)=>K(p,y),log:p=>console.log(p),setSecret:kc,hasSecret:Ec}),z("Plugins");let f=U(t,"plugins");if(j(f)){let p=Zg(f).filter(y=>j(U(f,y,"plugin.yaml")));if(p.length>0){console.log(`Available plugins:
199
- `);for(let m of p){let w=(0,ut.parse)(ct(U(f,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${w.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",h=await N("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(an(r),await Pc()?(console.log(`
200
- Chief of Staff agent: \u2713 already set up`),await K("Regenerate agent from template?",!1)?await xc(r):console.log(" \u2713 Skipped")):await xc(r),await ny(r),z("Memory (MongoDB)"),await sy(r,e),s||(z("Build"),Mc(t)?(console.log("Build output exists."),await K("Rebuild?",!0)?await Kc(n):console.log(" \u2713 Skipped")):await Kc(n)),!s){z("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 Bc(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 Bc(p,n))}if(s){z("Engine");let p=ye(t,".hive");j(p)?(Nr(p),console.log(` \u2713 Engine already populated at ${p} (deps verified)`)):(mc(n,t),console.log(` \u2713 Engine populated at ${p}`))}if(z("Service"),await K("Install Hive as a LaunchAgent (starts on login)?"))try{let{startDaemon:p}=await Promise.resolve().then(()=>(Ss(),ys));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(""),Uc.close()}async function Dc(t){z("Your Business");let e=await N("Business name",t.business?.name||""),n=await N("What does your business do? (one sentence)",t.business?.description||""),s=await N("Location (city, state)",t.business?.location||""),i=await N("Timezone (e.g. America/New_York)",t.business?.timezone||""),r=await N("Business hours (e.g. 9 AM - 5 PM)",t.business?.businessHours||"9 AM - 5 PM"),o=await N("Your name",t.business?.owner?.name||""),a=await N("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}},an(t),console.log(`
201
- \u2713 Business info saved (hive.yaml)`)}async function qc(t,e){z("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(ye(e,"pkg","setup","slack-manifest.yaml"))?ye(e,"pkg","setup","slack-manifest.yaml"):ye(e,"setup","slack-manifest.yaml");if(console.log(ct(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 N("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 N("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 N("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 N("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(`
192
+ `)}function Hc(){return j(ws)?(0,ut.parse)(ct(ws,"utf-8"))??{}:{}}function an(t){Uc(ws,(0,ut.stringify)(t))}function $c(t){return!!(t.business?.name&&t.business?.owner?.name)}function Lc(t){return!!(t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)}async function Mc(){let t=process.env.MONGODB_DB;if(!t)return!1;try{let e=new Pr(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(ye(import.meta.dirname,"..","pkg","server.min.js"))?!0:j(ye(t,"dist","index.js"))}async function ry(t,e,n){vs=F(t,".env"),ws=F(t,"hive.yaml");let s=j(ye(n,"pkg","server.min.js"));iy();let i=jc(),r=Hc(),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($c(r)&&a.push("Business info"),Lc(i)&&a.push("Slack"),await Mc()&&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 N("Press Enter to begin...");if($c(r)?(console.log(`Business: ${r.business.name} (${r.business.owner.name}, ${r.business.owner.role})`),await K("Redo business info?",!1)?await Dc(r):console.log(" \u2713 Skipped")):await Dc(r),Lc(i)?(console.log("Slack: \u2713 tokens configured"),await K("Redo Slack setup?",!1)?await Rc(i,n):console.log(" \u2713 Skipped")):await Rc(i,n),z("Anthropic"),i.ANTHROPIC_API_KEY?(console.log("Anthropic API key: \u2713 configured"),await K("Change it?",!1)?await qc(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 qc(i):(console.log(" \u2713 Using existing Claude authentication"),on(i))),z("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 N("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await N("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 v=await N("Line name (e.g. main, personal)"),b=await N("Phone Number ID (PNxxx)"),A=await N("Phone number (e.g. (555) 123-4567)"),I=await N("Label (e.g. Jane's Line)"),E=await N("Slack channel for incoming SMS",`sms-${v}`);y[v]={id:b,number:A,label:I},p.push({id:b,label:I,number:A,slackChannel:E}),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 m=H("gog",["auth","list"],{encoding:"utf-8",stdio:"pipe"}).trim();m&&!m.includes("no accounts")&&(console.log(`
194
+ Authenticated accounts:`),console.log(` ${m.replace(/\n/g,`
195
+ `)}`))}catch{}if(console.log(""),await K("Authenticate a Google account now?",!0)){let m=!0;for(;m;){let v=await N("Google account email");console.log(`
196
+ Opening browser for ${v}...`),console.log(` Complete the OAuth flow in your browser, then come back here.
197
+ `);try{H("gog",["auth","add",v],{stdio:"inherit"}),console.log(` \u2713 ${v} authenticated`)}catch{console.log(` \u26A0 Authentication failed for ${v}. You can retry later: gog auth add ${v}`)}m=await K("Authenticate another Google account?",!1)}}let h=await N("Primary Google account to verify gog auth (you'll wire per-agent assignments in hive.yaml later)","");if(h)try{H("gog",["gmail","search","is:unread","-a",h,"--json","--results-only","--no-input"],{encoding:"utf-8",timeout:15e3}),console.log(` \u2713 Gmail access verified for ${h}`),console.log(" \u2192 Next: add this account to hive.yaml under `google.accounts.<agent-id>` for any agent that should reach it.")}catch{console.log(" \u26A0 Could not verify Gmail access \u2014 check authentication later")}}}if(await K("Enable project management integration?",!1)){let p=await N("Which system? (linear / clickup)","");p.toLowerCase().startsWith("l")?(i.LINEAR_API_KEY=await N("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 N("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.")}on(i),an(r),console.log(`
198
+ \u2713 Configuration saved (.env + hive.yaml)`),z("Third-Party Credentials"),console.log("Hive can integrate with several third-party services (Linear, Brave Search,"),console.log("ClickUp, Resend, etc.). Provide API keys now to seed them into the macOS"),console.log("Keychain (Honeypot), or skip and add later via `hive credentials add <KEY>`."),await Ac({ask:(p,y)=>N(p,y),askSecret:p=>N(p),confirm:(p,y)=>K(p,y),log:p=>console.log(p),setSecret:kc,hasSecret:Ec}),z("Plugins");let f=F(t,"plugins");if(j(f)){let p=sy(f).filter(y=>j(F(f,y,"plugin.yaml")));if(p.length>0){console.log(`Available plugins:
199
+ `);for(let m of p){let v=(0,ut.parse)(ct(F(f,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${v.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",h=await N("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(an(r),await Mc()?(console.log(`
200
+ Chief of Staff agent: \u2713 already set up`),await K("Regenerate agent from template?",!1)?await xc(r):console.log(" \u2713 Skipped")):await xc(r),await oy(r),z("Memory (MongoDB)"),await ay(r,e),s||(z("Build"),Pc(t)?(console.log("Build output exists."),await K("Rebuild?",!0)?await Kc(n):console.log(" \u2713 Skipped")):await Kc(n)),!s){z("Deploy");let p=F(process.env.HOME??"/tmp","services","hive");j(F(p,"package.json"))?(console.log(`Deploy directory exists: ${p}`),await K("Sync latest build and config?",!0)?await Bc(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 Bc(p,n))}if(s){z("Engine");let p=ye(t,".hive");j(p)?(Nr(p),console.log(` \u2713 Engine already populated at ${p} (deps verified)`)):(mc(n,t),console.log(` \u2713 Engine populated at ${p}`))}if(z("Service"),await K("Install Hive as a LaunchAgent (starts on login)?"))try{let{startDaemon:p}=await Promise.resolve().then(()=>(Ss(),ys));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(""),Fc.close()}async function Dc(t){z("Your Business");let e=await N("Business name",t.business?.name||""),n=await N("What does your business do? (one sentence)",t.business?.description||""),s=await N("Location (city, state)",t.business?.location||""),i=await N("Timezone (e.g. America/New_York)",t.business?.timezone||""),r=await N("Business hours (e.g. 9 AM - 5 PM)",t.business?.businessHours||"9 AM - 5 PM"),o=await N("Your name",t.business?.owner?.name||""),a=await N("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}},an(t),console.log(`
201
+ \u2713 Business info saved (hive.yaml)`)}async function Rc(t,e){z("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(ye(e,"pkg","setup","slack-manifest.yaml"))?ye(e,"pkg","setup","slack-manifest.yaml"):ye(e,"setup","slack-manifest.yaml");if(console.log(ct(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 N("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 N("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 N("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 N("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?)`)}on(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 Rc(t){console.log("Get your API key from: https://console.anthropic.com/settings/keys"),console.log(""),t.ANTHROPIC_API_KEY=await N("Anthropic API Key (sk-ant-...)",t.ANTHROPIC_API_KEY||""),on(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 xc(t){z("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 N("Name your Chief of Staff","Chief"),n=await N("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},an(t);let s=ye(cc,"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,ut.parse)(ct(s,"utf-8"));i.name=e,i.channels=[n];let r=process.env.MONGODB_URI||"mongodb://localhost:27017",a=Hc().instance?.id??"hive",l=process.env.MONGODB_DB||`hive_${a}`;try{let c=new Mr(r);await c.connect();let f=c.db(l).collection("agent_definitions");if(await f.findOne({_id:i._id}))console.log(` Agent "${i._id}" already exists in DB \u2014 updating name and channel.`),await f.updateOne({_id:i._id},{$set:{name:e,channels:[n],updatedAt:new Date,updatedBy:"setup-wizard"}});else{let p=new Date;await f.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 ny(t){z("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.
204
+ \u26A0 Could not validate Slack token (no network?)`)}on(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 qc(t){console.log("Get your API key from: https://console.anthropic.com/settings/keys"),console.log(""),t.ANTHROPIC_API_KEY=await N("Anthropic API Key (sk-ant-...)",t.ANTHROPIC_API_KEY||""),on(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 xc(t){z("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 N("Name your Chief of Staff","Chief"),n=await N("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},an(t);let s=ye(cc,"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,ut.parse)(ct(s,"utf-8"));i.name=e,i.channels=[n];let r=process.env.MONGODB_URI||"mongodb://localhost:27017",a=Hc().instance?.id??"hive",l=process.env.MONGODB_DB||`hive_${a}`;try{let c=new Pr(r);await c.connect();let f=c.db(l).collection("agent_definitions");if(await f.findOne({_id:i._id}))console.log(` Agent "${i._id}" already exists in DB \u2014 updating name and channel.`),await f.updateOne({_id:i._id},{$set:{name:e,channels:[n],updatedAt:new Date,updatedBy:"setup-wizard"}});else{let p=new Date;await f.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 oy(t){z("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(`
@@ -210,58 +210,60 @@ Chief of Staff agent: \u2713 already set up`),await K("Regenerate agent from tem
210
210
  `),console.log("Default: OFF. You can enable later by setting EXTERNAL_COMMS_ENABLED=true"),console.log(`in .env and restarting Hive.
211
211
  `),t.constitution.cosCanContactExternal=await K("Enable external communications now?",!1);let i=jc();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")),on(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)"),an(t),console.log(`
213
- \u2713 Constitution preferences saved (hive.yaml)`)}async function sy(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 Mr(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
213
+ \u2713 Constitution preferences saved (hive.yaml)`)}async function ay(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 Pr(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 -->",u=U(e,"constitution-bootstrap.md.tpl");if(j(u)){let f=ct(u,"utf-8"),d=Sc(f,{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=d.indexOf(c);w===-1?y=d:y=d.slice(0,w)+m}else y=d}else y=d;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 Kc(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 Bc(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=ye(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 ut,vs,ws,Uc,Gc=O(()=>{"use strict";ut=oe(ce(),1);gc();vc();Ic();Q();vs="",ws="",Uc=Xg({input:process.stdin,output:process.stdout})});var Wc={};Y(Wc,{runSetupWizard:()=>my});import{mkdirSync as iy,existsSync as Pe,readFileSync as Vc,writeFileSync as ry,readdirSync as oy}from"node:fs";import{resolve as Me,join as ft}from"node:path";import{createInterface as ay}from"node:readline";import{execFileSync as ly}from"node:child_process";function uy(t){try{return ly("lsof",["-iTCP:"+t,"-sTCP:LISTEN","-t"],{stdio:["ignore","pipe","ignore"],encoding:"utf-8"}).trim().length>0}catch(e){return e.code==="ENOENT",!1}}function fy(t){let e=new Set,n=Me(t,"services","hive");if(Pe(n))for(let s of oy(n)){let i=ft(n,s,"hive.yaml");if(Pe(i))try{let o=((0,ln.parse)(Vc(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<cy;r++)if(uy(s+r)){i=!0;break}if(!i)return s}return 3100}function dy(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function Dr(t,e,n=""){let s=n?`${e} [${n}]: `:`${e}: `;return new Promise(i=>t.question(s,r=>i(r.trim()||n)))}async function py(t){let e=ay({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 Dr(e,"Business name (e.g. your company)");n||(console.error("Business name is required."),process.exit(1));let s=dy(n)||"hive",i=await Dr(e,"Instance ID (short slug, used for the mongo db name)",s),r=Me(t,"services","hive",i),o=Me(await Dr(e,"Install location",r));Pe(ft(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)),iy(o,{recursive:!0});let a=fy(t),l={instance:{id:i,type:"business",portBase:a},business:{name:n}};return ry(ft(o,"hive.yaml"),(0,ln.stringify)(l)),console.log(`
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 -->",u=F(e,"constitution-bootstrap.md.tpl");if(j(u)){let f=ct(u,"utf-8"),d=Sc(f,{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),v=d.indexOf(c);v===-1?y=d:y=d.slice(0,v)+m}else y=d}else y=d;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 Kc(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 Bc(t,e){let{mkdirSync:n}=await import("node:fs");if(j(F(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=ye(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=F(e,".env");if(j(s)){let{copyFileSync:o}=await import("node:fs");o(s,F(t,".env")),console.log(" \u2713 .env")}let i=F(e,"hive.yaml");if(j(i)){let{copyFileSync:o}=await import("node:fs");o(i,F(t,"hive.yaml")),console.log(" \u2713 hive.yaml")}let r=F(e,"dist");j(r)&&(H("rsync",["-a","--delete",`${r}/`,`${F(t,"dist")}/`],{stdio:"pipe"}),console.log(" \u2713 dist/")),n(F(t,"logs"),{recursive:!0}),console.log(`
216
+ \u2713 Deploy directory ready: ${t}`)}var ut,vs,ws,Fc,Gc=T(()=>{"use strict";ut=oe(ce(),1);gc();vc();Ic();Q();vs="",ws="",Fc=ny({input:process.stdin,output:process.stdout})});var Wc={};Y(Wc,{runSetupWizard:()=>vy});import{mkdirSync as ly,existsSync as Me,readFileSync as Vc,writeFileSync as cy,readdirSync as uy}from"node:fs";import{resolve as Pe,join as ft}from"node:path";import{createInterface as fy}from"node:readline";import{execFileSync as dy}from"node:child_process";function hy(t){try{return dy("lsof",["-iTCP:"+t,"-sTCP:LISTEN","-t"],{stdio:["ignore","pipe","ignore"],encoding:"utf-8"}).trim().length>0}catch(e){return e.code==="ENOENT",!1}}function my(t){let e=new Set,n=Pe(t,"services","hive");if(Me(n))for(let s of uy(n)){let i=ft(n,s,"hive.yaml");if(Me(i))try{let o=((0,ln.parse)(Vc(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<py;r++)if(hy(s+r)){i=!0;break}if(!i)return s}return 3100}function gy(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function Dr(t,e,n=""){let s=n?`${e} [${n}]: `:`${e}: `;return new Promise(i=>t.question(s,r=>i(r.trim()||n)))}async function yy(t){let e=fy({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 Dr(e,"Business name (e.g. your company)");n||(console.error("Business name is required."),process.exit(1));let s=gy(n)||"hive",i=await Dr(e,"Instance ID (short slug, used for the mongo db name)",s),r=Pe(t,"services","hive",i),o=Pe(await Dr(e,"Install location",r));Me(ft(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)),ly(o,{recursive:!0});let a=my(t),l={instance:{id:i,type:"business",portBase:a},business:{name:n}};return cy(ft(o,"hive.yaml"),(0,ln.stringify)(l)),console.log(`
219
219
  \u2713 Created ${o}/hive.yaml (instance.id: ${i}, portBase: ${a})
220
- `),o}finally{e.close()}}function hy(){if(process.env.HIVE_HOME){let e=Me(process.env.HIVE_HOME);return Pe(ft(e,"hive.yaml")),e}if(Pe(Me(process.cwd(),"hive.yaml")))return process.cwd();let t=He();return Pe(ft(t,"hive.yaml"))?t:null}async function my(t){console.log(`
220
+ `),o}finally{e.close()}}function Sy(){if(process.env.HIVE_HOME){let e=Pe(process.env.HIVE_HOME);return Me(ft(e,"hive.yaml")),e}if(Me(Pe(process.cwd(),"hive.yaml")))return process.cwd();let t=He();return Me(ft(t,"hive.yaml"))?t:null}async function vy(t){console.log(`
221
221
  Hive Setup Wizard
222
- `),await dc(),console.log("");let e=hy(),n=process.env.HOME??"/tmp",s=e??await py(n),i=Pe(Me(t,"templates"))?Me(t,"templates"):Me(t,"setup","templates");console.log(`Setup will write config to: ${s}`),console.log(`Templates from: ${i}
223
- `);let r=ft(s,"hive.yaml");Pe(r)&&(((0,ln.parse)(Vc(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(()=>(Gc(),Yc));await o(s,i,t)}var ln,cy,Jc=O(()=>{"use strict";ln=oe(ce(),1);Q();pc();cy=10});var Xc={};Y(Xc,{showStatus:()=>vy});import{execFileSync as Qc}from"node:child_process";import{existsSync as gy,readFileSync as yy}from"node:fs";import{resolve as Sy}from"node:path";async function vy(){console.log(`Hive home: ${$}`);let t=Sy($,process.env.HIVE_CONFIG??"hive.yaml");if(!gy(t)){console.log("Status: not initialized (run 'hive init')");return}let n=((0,zc.parse)(yy(t,"utf-8"))??{}).instance?.id??"hive",s=`com.hive.${n}.agent`;console.log(`Instance: ${n}`);try{let r=Qc("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{Qc("mongosh",["--eval","db.runCommand({ping:1})","--quiet"],{encoding:"utf-8",timeout:5e3}),console.log("MongoDB: connected")}catch{console.log("MongoDB: not reachable")}}var zc,Zc=O(()=>{"use strict";zc=oe(ce(),1);Q()});import{existsSync as eu,mkdirSync as wy,readdirSync as by,renameSync as ky}from"node:fs";import{resolve as bs}from"node:path";function tu(t=$,e=Ye){let n=bs(e,"plugins","node_modules"),s=bs(t,"plugins","node_modules");if(!eu(n))return{moved:[],skipped:!0};let i=by(n);if(i.length===0)return{moved:[],skipped:!0};wy(s,{recursive:!0});let r=[];for(let o of i){let a=bs(n,o),l=bs(s,o);eu(l)||(ky(a,l),r.push(o))}return{moved:r,skipped:!1}}var nu=O(()=>{"use strict";Q()});import{readFileSync as Ey,existsSync as Ay}from"node:fs";function ks(t,e){let n=hs(t),s=process.env.HIVE_CONFIG||"hive.yaml",i={};Ay(n)&&(i=(0,su.parse)(Ey(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},(f,d)=>o+d),c=Array.from(new Set([...l,...a])).sort((f,d)=>f-d),u={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&&(u.HIVE_SINGLE_TAG=e),u}var su,qr=O(()=>{"use strict";su=oe(ce(),1);Q()});var cu=v((Tb,Se)=>{var Rr=ke("fs"),Es=ke("path"),Iy=ke("os"),_y=ke("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 Oy(){return iu[Math.floor(Math.random()*iu.length)]}function dt(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 Cy=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Ly(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
225
- `);let s;for(;(s=Cy.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,`
226
- `),r=r.replace(/\\r/g,"\r")),e[i]=r}return e}function $y(t){t=t||{};let e=lu(t);t.path=e;let n=B.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=My(n,a);r=B.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return B.parse(r)}function Py(t){console.error(`\u26A0 ${t}`)}function cn(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 My(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)Rr.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Es.resolve(process.cwd(),".env.vault");return Rr.existsSync(e)?e:null}function ru(t){return t[0]==="~"?Es.join(Iy.homedir(),t.slice(1)):t}function Dy(t){let e=dt(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=dt(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&ou("loading env from encrypted .env.vault");let s=B._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),B.populate(i,s,t),{parsed:s}}function qy(t){let e=Es.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=dt(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=dt(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&cn("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 u of t.path)o.push(ru(u))}let a,l={};for(let u of o)try{let f=B.parse(Rr.readFileSync(u,{encoding:n}));B.populate(l,f,t)}catch(f){i&&cn(`failed to load ${u} ${f.message}`),a=f}let c=B.populate(s,l,t);if(i=dt(s.DOTENV_CONFIG_DEBUG||i),r=dt(s.DOTENV_CONFIG_QUIET||r),i||!r){let u=Object.keys(c).length,f=[];for(let d of o)try{let p=Es.relative(process.cwd(),d);f.push(p)}catch(p){i&&cn(`failed to load ${d} ${p.message}`),a=p}ou(`injected env (${u}) from ${f.join(",")} ${Ny(`// tip: ${Oy()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function Ry(t){if(au(t).length===0)return B.configDotenv(t);let e=lu(t);return e?B._configVault(t):(Py(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),B.configDotenv(t))}function xy(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=_y.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 u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(c){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function Ky(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&&cn(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 B={configDotenv:qy,_configVault:Dy,_parseVault:$y,config:Ry,decrypt:xy,parse:Ly,populate:Ky};Se.exports.configDotenv=B.configDotenv;Se.exports._configVault=B._configVault;Se.exports._parseVault=B._parseVault;Se.exports.config=B.config;Se.exports.decrypt=B.decrypt;Se.exports.parse=B.parse;Se.exports.populate=B.populate;Se.exports=B});var As,uu=O(()=>{"use strict";As={externalComms:!0,codeTask:!1,codeAccess:!1}});import{execFileSync as By}from"node:child_process";function fu(t,e){if(process.platform!=="darwin")return"";try{return By("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 pt={};Y(pt,{config:()=>Gy});import{readFileSync as Fy,existsSync as gu,readdirSync as Uy,statSync as jy}from"node:fs";import{resolve as xr}from"node:path";import{randomUUID as Kr}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 Yy(t){if(t?.length)return t.map(n=>xr(n.replace(/^~/,process.env.HOME??"/tmp")));let e=xr(Ye,"plugins/claude-code");return gu(e)?Uy(e).map(n=>xr(e,n)).filter(n=>jy(n).isDirectory()):[]}var mu,yu,Hy,hu,S,xb,un,Su,De,Ge,Gy,ht=O(()=>{"use strict";mu=oe(cu(),1),yu=oe(ce(),1);uu();du();Q();Hy=lc($);mu.default.config({path:Hy});hu=hs($),S={};gu(hu)&&(S=(0,yu.parse)(Fy(hu,"utf-8"))??{});xb=process.env.HOME??"/tmp",un=S.instance?.id??"hive",Su=t=>fu(un,t),De=S.instance?.portBase??3100,Ge=S.instance?.ports??{},Gy={instance:{id:un,portBase:De},business:{name:S.business?.name??g("BUSINESS_NAME",""),description:S.business?.description??"",location:S.business?.location??"",ownerName:S.business?.owner?.name??"",ownerRole:S.business?.owner?.role??""},slack:{appToken:pu("SLACK_APP_TOKEN"),botToken:pu("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",S.slack?.auditChannel??""),localMcpServer:!!(S.slack?.localMcpServer??!1)},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},openai:{agentModel:g("OPENAI_AGENT_MODEL","")},codex:{agentModel:g("CODEX_AGENT_MODEL","gpt-5.4-mini")},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_${un}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{account:g("GOOGLE_ACCOUNT",S.google?.account??""),client:g("GOG_CLIENT",S.google?.client??""),accounts:S.google?.accounts??{},sharedFolder:g("DRIVE_SHARED_FOLDER",S.google?.sharedFolder??S.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",S.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",S.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:S.quo?.lines??{}},sms:{lines:S.sms?.lines??[]},imessage:{enabled:S.imessage?.enabled??!1,slackChannel:S.imessage?.slackChannel??"imessage",hotWindowMs:S.imessage?.hotWindowMs??3e5,coldIntervalMs:S.imessage?.coldIntervalMs??3e5,hotIntervalMs:S.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",S.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",S.resend?.businessName??"")},plugins:S.plugins??[],skillRegistries:S.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],operatorSkillsRepo:S.operatorSkillsRepo?{url:String(S.operatorSkillsRepo.url),branch:S.operatorSkillsRepo.branch?String(S.operatorSkillsRepo.branch):"main"}:null,gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash"),agentModel:g("GEMINI_AGENT_MODEL","")},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(Ge.recall??De+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(Ge.background??De)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||Kr()},slackInternal:{port:parseInt(g("SLACK_INTERNAL_PORT",String(Ge.slackInternal??De+6)),10),authToken:g("SLACK_INTERNAL_TOKEN","")||Kr()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(Ge.codeTask??De+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||Kr(),pluginDirs:Yy(S.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(Ge.ws??De+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(S.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(Ge.adminApi??De+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!S.voice?.provider,provider:S.voice?.provider??"",publicUrl:S.voice?.publicUrl??"",phoneNumberId:S.voice?.phoneNumberId??"",assistants:S.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(Ge.voice??De+5)),10)},autonomy:{externalComms:S.autonomy?.externalComms??As.externalComms,codeTask:S.autonomy?.codeTask??As.codeTask,codeAccess:S.autonomy?.codeAccess??As.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=S.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(S.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(S.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:!!(S.retention?.enabled??!1),intervalMs:s,defaultDays:n,paths:e}})(),memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(S.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(S.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(S.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(S.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(S.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(S.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(S.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(S.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(S.memory?.reflectionMinTurns??3)),10)},codeIndex:{enabled:S.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(S.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(S.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(S.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:S.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(S.events?.retentionDays??30)),10)},activity:{enabled:(S.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(S.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(S.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(S.activity?.retentionDays??90)),10)},autoDream:{enabled:S.autoDream?.enabled??!1,quietPeriodMinutes:parseInt(g("AUTODREAM_QUIET_PERIOD_MINUTES",String(S.autoDream?.quietPeriodMinutes??S.autoDream?.idleThresholdMinutes??120)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(S.autoDream?.cooldownMinutes??1440)),10),minNewMemories:parseInt(g("AUTODREAM_MIN_NEW_MEMORIES",String(S.autoDream?.minNewMemories??10)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(S.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(S.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(S.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(S.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(S.autoDream?.maxPromotionsPerRun??2)),10),maxRunBudgetUsd:parseFloat(g("AUTODREAM_MAX_RUN_BUDGET_USD",String(S.autoDream?.maxRunBudgetUsd??S.autoDream?.maxBudgetUsd??.05))),maxCallBudgetUsd:parseFloat(g("AUTODREAM_MAX_CALL_BUDGET_USD",String(S.autoDream?.maxCallBudgetUsd??S.autoDream?.maxBudgetUsd??.01)))},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${un}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${un}-bg-tasks`)}}});function Is(t,e,n,s){if(vu[t]<vu[Vy])return;let i={ts:new Date().toISOString(),level:t,component:e,msg:n,...s};(t==="error"?process.stderr:process.stdout).write(JSON.stringify(i)+`
227
- `)}function D(t){return{debug:(e,n)=>Is("debug",t,e,n),info:(e,n)=>Is("info",t,e,n),warn:(e,n)=>Is("warn",t,e,n),error:(e,n)=>Is("error",t,e,n)}}var vu,Vy,ie=O(()=>{"use strict";vu={debug:0,info:1,warn:2,error:3},Vy=process.env.LOG_LEVEL||"info"});var Eu={};Y(Eu,{checkoutSha:()=>Hr,findTagForSha:()=>gt,listSkillsInClone:()=>dn,lsRemoteHead:()=>jr,partialClone:()=>Ur,shallowClone:()=>fn,verifyGitAvailable:()=>mt});import{execFileSync as fe}from"node:child_process";import{existsSync as wu,readdirSync as Wy,statSync as Jy,rmSync as Br,mkdtempSync as bu}from"node:fs";import{join as Ve}from"node:path";import{tmpdir as ku}from"node:os";function mt(){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 fn(t){let e=bu(Ve(ku(),"hive-skill-install-")),n=Ve(e,"repo"),s=()=>{try{Br(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 Fr.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 Ur(t){let e=bu(Ve(ku(),"hive-skill-upgrade-")),n=Ve(e,"repo"),s=()=>{try{Br(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){Fr.debug("Blobless clone failed, falling back to full clone",{error:String(r)}),Br(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 Fr.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 jr(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 dn(t){let e=Ve(t,"skills");return wu(e)?Wy(e).filter(n=>{try{let s=Ve(e,n);return Jy(s).isDirectory()&&wu(Ve(s,"SKILL.md"))}catch{return!1}}):[]}function Hr(t,e){fe("git",["checkout",e],{cwd:t,stdio:"pipe"})}function gt(t,e){try{return fe("git",["describe","--tags","--exact-match",e],{cwd:t,stdio:"pipe",encoding:"utf-8"}).trim()||void 0}catch{return}}var Fr,yt=O(()=>{"use strict";ie();Fr=D("registry-fetch")});import{join as Qy}from"node:path";import{readFileSync as zy}from"node:fs";function Au(t,e){let s=zy(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 Iu(t,e,n){return Qy(t,e,"skills",n)}var _u=O(()=>{"use strict"});import{readFileSync as Xy,writeFileSync as Zy}from"node:fs";function Yr(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(`
228
- `),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],u=l[2].trim();if(c==="name")i.name=We(u);else if(c==="description")i.description=We(u);else if(c==="workflow")i.workflow=We(u);else if(c==="agents"){let f=u.match(/^\[([^\]]*)\]$/);if(f)i.agents=f[1].split(",").map(d=>We(d.trim())).filter(d=>d.length>0);else if(u==="")for(i.agents=[];o+1<r.length&&r[o+1].match(/^\s+-\s+/);){o++;let d=r[o].replace(/^\s+-\s+/,"").trim();i.agents.push(We(d))}else i.agents=[We(u)]}else if(c==="origin")for(i.origin=Ou(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;else if(c==="author")for(i.author=Ou(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;o++}return{frontmatter:i,body:s}}function Ou(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]]=We(r)}s++}return n}function We(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: ${_s(t.name)}`),n.push(`description: ${_s(t.description)}`);let s=t.agents.join(", ");return n.push(`agents: [${s}]`),t.workflow&&n.push(`workflow: ${_s(t.workflow)}`),t.origin&&(n.push("origin:"),Tu(n,t.origin)),t.author&&(n.push("author:"),Tu(n,t.author)),`---
222
+ `),await dc(),console.log("");let e=Sy(),n=process.env.HOME??"/tmp",s=e??await yy(n),i=Me(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=ft(s,"hive.yaml");Me(r)&&(((0,ln.parse)(Vc(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(()=>(Gc(),Yc));await o(s,i,t)}var ln,py,Jc=T(()=>{"use strict";ln=oe(ce(),1);Q();pc();py=10});var Xc={};Y(Xc,{showStatus:()=>Ey});import{execFileSync as Qc}from"node:child_process";import{existsSync as wy,readFileSync as by}from"node:fs";import{resolve as ky}from"node:path";async function Ey(){console.log(`Hive home: ${L}`);let t=ky(L,process.env.HIVE_CONFIG??"hive.yaml");if(!wy(t)){console.log("Status: not initialized (run 'hive init')");return}let n=((0,zc.parse)(by(t,"utf-8"))??{}).instance?.id??"hive",s=`com.hive.${n}.agent`;console.log(`Instance: ${n}`);try{let r=Qc("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{Qc("mongosh",["--eval","db.runCommand({ping:1})","--quiet"],{encoding:"utf-8",timeout:5e3}),console.log("MongoDB: connected")}catch{console.log("MongoDB: not reachable")}}var zc,Zc=T(()=>{"use strict";zc=oe(ce(),1);Q()});import{existsSync as eu,mkdirSync as Ay,readdirSync as Iy,renameSync as _y}from"node:fs";import{resolve as bs}from"node:path";function tu(t=L,e=Ye){let n=bs(e,"plugins","node_modules"),s=bs(t,"plugins","node_modules");if(!eu(n))return{moved:[],skipped:!0};let i=Iy(n);if(i.length===0)return{moved:[],skipped:!0};Ay(s,{recursive:!0});let r=[];for(let o of i){let a=bs(n,o),l=bs(s,o);eu(l)||(_y(a,l),r.push(o))}return{moved:r,skipped:!1}}var nu=T(()=>{"use strict";Q()});import{readFileSync as Ty,existsSync as Oy}from"node:fs";function ks(t,e){let n=hs(t),s=process.env.HIVE_CONFIG||"hive.yaml",i={};Oy(n)&&(i=(0,su.parse)(Ty(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},(f,d)=>o+d),c=Array.from(new Set([...l,...a])).sort((f,d)=>f-d),u={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&&(u.HIVE_SINGLE_TAG=e),u}var su,Rr=T(()=>{"use strict";su=oe(ce(),1);Q()});var cu=w((Lb,Se)=>{var qr=ke("fs"),Es=ke("path"),Ny=ke("os"),Cy=ke("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 $y(){return iu[Math.floor(Math.random()*iu.length)]}function dt(t){return typeof t=="string"?!["false","0","no","off",""].includes(t.toLowerCase()):!!t}function Ly(){return process.stdout.isTTY}function My(t){return Ly()?`\x1B[2m${t}\x1B[0m`:t}var Py=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Dy(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
225
+ `);let s;for(;(s=Py.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,`
226
+ `),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=B.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=xy(n,a);r=B.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return B.parse(r)}function qy(t){console.error(`\u26A0 ${t}`)}function cn(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 xy(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)qr.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Es.resolve(process.cwd(),".env.vault");return qr.existsSync(e)?e:null}function ru(t){return t[0]==="~"?Es.join(Ny.homedir(),t.slice(1)):t}function Ky(t){let e=dt(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=dt(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&ou("loading env from encrypted .env.vault");let s=B._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),B.populate(i,s,t),{parsed:s}}function By(t){let e=Es.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=dt(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=dt(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&cn("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 u of t.path)o.push(ru(u))}let a,l={};for(let u of o)try{let f=B.parse(qr.readFileSync(u,{encoding:n}));B.populate(l,f,t)}catch(f){i&&cn(`failed to load ${u} ${f.message}`),a=f}let c=B.populate(s,l,t);if(i=dt(s.DOTENV_CONFIG_DEBUG||i),r=dt(s.DOTENV_CONFIG_QUIET||r),i||!r){let u=Object.keys(c).length,f=[];for(let d of o)try{let p=Es.relative(process.cwd(),d);f.push(p)}catch(p){i&&cn(`failed to load ${d} ${p.message}`),a=p}ou(`injected env (${u}) from ${f.join(",")} ${My(`// tip: ${$y()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function Uy(t){if(au(t).length===0)return B.configDotenv(t);let e=lu(t);return e?B._configVault(t):(qy(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),B.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=Cy.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 u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(c){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw o}}function jy(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&&cn(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 B={configDotenv:By,_configVault:Ky,_parseVault:Ry,config:Uy,decrypt:Fy,parse:Dy,populate:jy};Se.exports.configDotenv=B.configDotenv;Se.exports._configVault=B._configVault;Se.exports._parseVault=B._parseVault;Se.exports.config=B.config;Se.exports.decrypt=B.decrypt;Se.exports.parse=B.parse;Se.exports.populate=B.populate;Se.exports=B});var As,uu=T(()=>{"use strict";As={externalComms:!0,codeTask:!1,codeAccess:!1}});import{execFileSync as Hy}from"node:child_process";function fu(t,e){if(process.platform!=="darwin")return"";try{return Hy("security",["find-generic-password","-s",`hive/${t}/${e}`,"-w"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return""}}var du=T(()=>{"use strict"});var pt={};Y(pt,{config:()=>Qy,normalizeGoogleAccounts:()=>Su,warnIfLegacyGoogleAccount:()=>vu});import{readFileSync as Yy,existsSync as gu,readdirSync as Gy,statSync as Vy}from"node:fs";import{resolve as xr}from"node:path";import{randomUUID as Kr}from"node:crypto";function pu(t){let e=process.env[t]||wu(t);if(!e)throw new Error(`Missing required env var: ${t}`);return e}function g(t,e){return process.env[t]||wu(t)||e}function Su(t){if(!t||typeof t!="object"||Array.isArray(t))return{};let e={};for(let[n,s]of Object.entries(t))if(typeof s=="string"&&s.trim())e[n]=[s.trim()];else if(Array.isArray(s)){let i=s.filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim());i.length>0&&(e[n]=i)}return e}function vu(t){let e=t?.google;e&&typeof e=="object"&&"account"in e&&console.warn("[config] `google.account` is deprecated and unused; use `google.accounts.<agentId>` (string for single account, string[] for multi-account) to grant Google access per agent.")}function Jy(t){if(t?.length)return t.map(n=>xr(n.replace(/^~/,process.env.HOME??"/tmp")));let e=xr(Ye,"plugins/claude-code");return gu(e)?Gy(e).map(n=>xr(e,n)).filter(n=>Vy(n).isDirectory()):[]}var mu,yu,Wy,hu,S,Fb,un,wu,De,Ge,Qy,ht=T(()=>{"use strict";mu=oe(cu(),1),yu=oe(ce(),1);uu();du();Q();Wy=lc(L);mu.default.config({path:Wy});hu=hs(L),S={};gu(hu)&&(S=(0,yu.parse)(Yy(hu,"utf-8"))??{});vu(S);Fb=process.env.HOME??"/tmp",un=S.instance?.id??"hive",wu=t=>fu(un,t),De=S.instance?.portBase??3100,Ge=S.instance?.ports??{},Qy={instance:{id:un,portBase:De},business:{name:S.business?.name??g("BUSINESS_NAME",""),description:S.business?.description??"",location:S.business?.location??"",ownerName:S.business?.owner?.name??"",ownerRole:S.business?.owner?.role??""},slack:{appToken:pu("SLACK_APP_TOKEN"),botToken:pu("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",S.slack?.auditChannel??""),localMcpServer:!!(S.slack?.localMcpServer??!1)},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},openai:{agentModel:g("OPENAI_AGENT_MODEL","")},codex:{agentModel:g("CODEX_AGENT_MODEL","gpt-5.4-mini")},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_${un}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{client:g("GOG_CLIENT",S.google?.client??""),accounts:Su(S.google?.accounts),sharedFolder:g("DRIVE_SHARED_FOLDER",S.google?.sharedFolder??S.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",S.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",S.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:S.quo?.lines??{}},sms:{lines:S.sms?.lines??[]},imessage:{enabled:S.imessage?.enabled??!1,slackChannel:S.imessage?.slackChannel??"imessage",hotWindowMs:S.imessage?.hotWindowMs??3e5,coldIntervalMs:S.imessage?.coldIntervalMs??3e5,hotIntervalMs:S.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",S.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",S.resend?.businessName??"")},plugins:S.plugins??[],skillRegistries:S.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],operatorSkillsRepo:S.operatorSkillsRepo?{url:String(S.operatorSkillsRepo.url),branch:S.operatorSkillsRepo.branch?String(S.operatorSkillsRepo.branch):"main"}:null,gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash"),agentModel:g("GEMINI_AGENT_MODEL","")},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(Ge.recall??De+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(Ge.background??De)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||Kr()},slackInternal:{port:parseInt(g("SLACK_INTERNAL_PORT",String(Ge.slackInternal??De+6)),10),authToken:g("SLACK_INTERNAL_TOKEN","")||Kr()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(Ge.codeTask??De+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||Kr(),pluginDirs:Jy(S.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(Ge.ws??De+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(S.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(Ge.adminApi??De+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!S.voice?.provider,provider:S.voice?.provider??"",publicUrl:S.voice?.publicUrl??"",phoneNumberId:S.voice?.phoneNumberId??"",assistants:S.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(Ge.voice??De+5)),10)},autonomy:{externalComms:S.autonomy?.externalComms??As.externalComms,codeTask:S.autonomy?.codeTask??As.codeTask,codeAccess:S.autonomy?.codeAccess??As.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=S.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(S.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(S.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:!!(S.retention?.enabled??!1),intervalMs:s,defaultDays:n,paths:e}})(),memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(S.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(S.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(S.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(S.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(S.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(S.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(S.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(S.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(S.memory?.reflectionMinTurns??3)),10),spendWarnThresholdUsd:parseFloat(g("MEMORY_SPEND_WARN_THRESHOLD_USD",String(S.memory?.spendWarnThresholdUsd??5))),writeGuards:{burst:{enabled:S.memory?.writeGuards?.burst?.enabled??!0,windowMinutes:parseInt(g("MEMORY_WRITE_GUARD_BURST_WINDOW_MINUTES",String(S.memory?.writeGuards?.burst?.windowMinutes??1440)),10),similarityThreshold:parseFloat(g("MEMORY_WRITE_GUARD_BURST_SIMILARITY",String(S.memory?.writeGuards?.burst?.similarityThreshold??.92))),topK:parseInt(g("MEMORY_WRITE_GUARD_BURST_TOPK",String(S.memory?.writeGuards?.burst?.topK??5)),10)},oversize:{enabled:S.memory?.writeGuards?.oversize?.enabled??!0,maxChars:parseInt(g("MEMORY_WRITE_GUARD_OVERSIZE_MAX_CHARS",String(S.memory?.writeGuards?.oversize?.maxChars??6e3)),10)},rawDump:{enabled:S.memory?.writeGuards?.rawDump?.enabled??!0,jsonTokenThreshold:parseInt(g("MEMORY_WRITE_GUARD_RAWDUMP_JSON_TOKENS",String(S.memory?.writeGuards?.rawDump?.jsonTokenThreshold??300)),10),monolithCharThreshold:parseInt(g("MEMORY_WRITE_GUARD_RAWDUMP_MONOLITH_CHARS",String(S.memory?.writeGuards?.rawDump?.monolithCharThreshold??2e3)),10)}}},codeIndex:{enabled:S.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(S.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(S.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(S.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:S.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(S.events?.retentionDays??30)),10)},activity:{enabled:(S.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(S.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(S.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(S.activity?.retentionDays??90)),10)},autoDream:{enabled:S.autoDream?.enabled??!0,quietPeriodMinutes:parseInt(g("AUTODREAM_QUIET_PERIOD_MINUTES",String(S.autoDream?.quietPeriodMinutes??S.autoDream?.idleThresholdMinutes??120)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(S.autoDream?.cooldownMinutes??1440)),10),minNewMemories:parseInt(g("AUTODREAM_MIN_NEW_MEMORIES",String(S.autoDream?.minNewMemories??10)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(S.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(S.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(S.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(S.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(S.autoDream?.maxPromotionsPerRun??2)),10),maxRunBudgetUsd:parseFloat(g("AUTODREAM_MAX_RUN_BUDGET_USD",String(S.autoDream?.maxRunBudgetUsd??S.autoDream?.maxBudgetUsd??.05))),maxCallBudgetUsd:parseFloat(g("AUTODREAM_MAX_CALL_BUDGET_USD",String(S.autoDream?.maxCallBudgetUsd??S.autoDream?.maxBudgetUsd??.01))),coldSummaryPageSize:parseInt(g("AUTODREAM_COLD_SUMMARY_PAGE_SIZE",String(S.autoDream?.coldSummaryPageSize??20)),10),coldSummaryPromptTokenBudget:parseInt(g("AUTODREAM_COLD_SUMMARY_PROMPT_TOKEN_BUDGET",String(S.autoDream?.coldSummaryPromptTokenBudget??8e3)),10)},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${un}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${un}-bg-tasks`)}}});function Is(t,e,n,s){if(bu[t]<bu[zy])return;let i={ts:new Date().toISOString(),level:t,component:e,msg:n,...s};(t==="error"?process.stderr:process.stdout).write(JSON.stringify(i)+`
227
+ `)}function D(t){return{debug:(e,n)=>Is("debug",t,e,n),info:(e,n)=>Is("info",t,e,n),warn:(e,n)=>Is("warn",t,e,n),error:(e,n)=>Is("error",t,e,n)}}var bu,zy,ie=T(()=>{"use strict";bu={debug:0,info:1,warn:2,error:3},zy=process.env.LOG_LEVEL||"info"});var Iu={};Y(Iu,{checkoutSha:()=>Hr,findTagForSha:()=>gt,listSkillsInClone:()=>dn,lsRemoteHead:()=>jr,partialClone:()=>Fr,shallowClone:()=>fn,verifyGitAvailable:()=>mt});import{execFileSync as fe}from"node:child_process";import{existsSync as ku,readdirSync as Xy,statSync as Zy,rmSync as Br,mkdtempSync as Eu}from"node:fs";import{join as Ve}from"node:path";import{tmpdir as Au}from"node:os";function mt(){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 fn(t){let e=Eu(Ve(Au(),"hive-skill-install-")),n=Ve(e,"repo"),s=()=>{try{Br(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 Ur.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=Eu(Ve(Au(),"hive-skill-upgrade-")),n=Ve(e,"repo"),s=()=>{try{Br(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){Ur.debug("Blobless clone failed, falling back to full clone",{error:String(r)}),Br(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 Ur.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 jr(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 dn(t){let e=Ve(t,"skills");return ku(e)?Xy(e).filter(n=>{try{let s=Ve(e,n);return Zy(s).isDirectory()&&ku(Ve(s,"SKILL.md"))}catch{return!1}}):[]}function Hr(t,e){fe("git",["checkout",e],{cwd:t,stdio:"pipe"})}function gt(t,e){try{return fe("git",["describe","--tags","--exact-match",e],{cwd:t,stdio:"pipe",encoding:"utf-8"}).trim()||void 0}catch{return}}var Ur,yt=T(()=>{"use strict";ie();Ur=D("registry-fetch")});import{join as eS}from"node:path";import{readFileSync as tS}from"node:fs";function _u(t,e){let s=tS(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 Tu(t,e,n){return eS(t,e,"skills",n)}var Ou=T(()=>{"use strict"});import{readFileSync as nS,writeFileSync as sS}from"node:fs";function Yr(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(`
228
+ `),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],u=l[2].trim();if(c==="name")i.name=We(u);else if(c==="description")i.description=We(u);else if(c==="workflow")i.workflow=We(u);else if(c==="agents"){let f=u.match(/^\[([^\]]*)\]$/);if(f)i.agents=f[1].split(",").map(d=>We(d.trim())).filter(d=>d.length>0);else if(u==="")for(i.agents=[];o+1<r.length&&r[o+1].match(/^\s+-\s+/);){o++;let d=r[o].replace(/^\s+-\s+/,"").trim();i.agents.push(We(d))}else i.agents=[We(u)]}else if(c==="origin")for(i.origin=Nu(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;else if(c==="author")for(i.author=Nu(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;o++}return{frontmatter:i,body:s}}function Nu(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]]=We(r)}s++}return n}function We(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: ${_s(t.name)}`),n.push(`description: ${_s(t.description)}`);let s=t.agents.join(", ");return n.push(`agents: [${s}]`),t.workflow&&n.push(`workflow: ${_s(t.workflow)}`),t.origin&&(n.push("origin:"),Cu(n,t.origin)),t.author&&(n.push("author:"),Cu(n,t.author)),`---
229
229
  ${n.join(`
230
230
  `)}
231
231
  ---
232
- ${e}`}function Tu(t,e){for(let[n,s]of Object.entries(e))s!==void 0&&t.push(` ${n}: ${_s(String(s))}`)}function _s(t){return t.includes(":")||t.includes("#")||t.includes('"')?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function ee(t){let e=Xy(t,"utf-8");return Yr(e)}function Vr(t,e,n){Zy(t,Gr(e,n),"utf-8")}function Nu(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(`
232
+ ${e}`}function Cu(t,e){for(let[n,s]of Object.entries(e))s!==void 0&&t.push(` ${n}: ${_s(String(s))}`)}function _s(t){return t.includes(":")||t.includes("#")||t.includes('"')?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function ee(t){let e=nS(t,"utf-8");return Yr(e)}function Vr(t,e,n){sS(t,Gr(e,n),"utf-8")}function $u(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(`
233
233
  `),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(`
234
- `)+i+r}var Je=O(()=>{"use strict"});import{createHash as eS}from"node:crypto";import{readdirSync as tS,readFileSync as nS,statSync as sS}from"node:fs";import{join as Cu}from"node:path";function pn(t){let e=Lu(t).sort(),n=eS("sha256");for(let s=0;s<e.length;s++){s>0&&n.update("\0");let i=Cu(t,e[s]),r=nS(i,"utf-8");e[s]==="SKILL.md"?n.update(Nu(r)):n.update(r)}return n.digest("hex")}function Lu(t,e=""){let n=tS(t),s=[];for(let i of n){let r=Cu(t,i),o=e?`${e}/${i}`:i;sS(r).isDirectory()?s.push(...Lu(r,o)):s.push(o)}return s}var Wr=O(()=>{"use strict";Je()});import{execFileSync as Os}from"node:child_process";import{existsSync as Ts,mkdirSync as sk,unlinkSync as Pu}from"node:fs";import{join as Mu,resolve as $u}from"node:path";function Du(t){let e=$u(t,".hive-state");return{stateDir:e,gitDir:$u(e,"git")}}function St(t,e,n,s){let{gitDir:i}=Du(t);if(!Ts(i)){hn.warn("Instance git not initialized \u2014 skipping state commit");return}let r=Mu(i,"state-index.tmp"),o={...process.env,GIT_DIR:i,GIT_WORK_TREE:t,GIT_INDEX_FILE:r},a=(...l)=>Os("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"),u=a("rev-parse","state^{tree}");if(l===u)return;let f=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"},d=Os("git",["commit-tree",l,"-p",c,"-m",n],{env:{...o,...f},encoding:"utf-8"}).trim();a("update-ref","refs/heads/state",d),hn.debug("State branch commit",{message:n,files:e.length})}catch(l){hn.warn("Failed to commit to state branch",{error:String(l),message:n})}finally{try{Ts(r)&&Pu(r)}catch{}}}function qu(t,e,n){let{gitDir:s}=Du(t);if(!Ts(s))return;let i=Mu(s,"state-index.tmp"),r={...process.env,GIT_DIR:s,GIT_WORK_TREE:t,GIT_INDEX_FILE:i},o=(...a)=>Os("git",[...a],{cwd:t,env:r,stdio:"pipe",encoding:"utf-8"}).trim();try{o("read-tree","state");for(let f of e)try{o("rm","-r","--cached","--",f)}catch{}let a=o("write-tree"),l=o("rev-parse","state"),c=o("rev-parse","state^{tree}");if(a===c)return;let u=Os("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",u),hn.debug("State branch removal commit",{message:n})}catch(a){hn.warn("Failed to commit removal to state branch",{error:String(a)})}finally{try{Ts(i)&&Pu(i)}catch{}}}var hn,Ns=O(()=>{"use strict";ie();hn=D("instance-git")});import{cpSync as iS,existsSync as Ru,mkdirSync as rS,readFileSync as xu,writeFileSync as oS}from"node:fs";import{join as Cs,relative as aS}from"node:path";function Ls(t,e,n,s){let i=fn(t);try{let r=Cs(i.dir,"skills",e);if(!Ru(r)){let m=dn(i.dir);throw new Error(`Skill "${e}" not found in registry ${t}. Available skills: ${m.join(", ")||"(none)"}`)}let o=Cs(r,"SKILL.md"),a=Au(o,e),c=xu(o,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(c){let m=c[1].match(/^name:\s*(.+)$/m);m&&m[1].trim()!==e&&Ku.warn("Registry skill name mismatch \u2014 using directory name",{dirName:e,frontmatterName:m[1].trim()})}let u=Iu(n,a,e);if(Ru(u))throw new Error(`Skill "${e}" is already installed at ${u}. Use "hive skill upgrade ${e}" to update, or "hive skill remove ${e}" first.`);rS(u,{recursive:!0}),iS(r,u,{recursive:!0});let f=pn(u),d=gt(i.dir,i.headSha),{frontmatter:p,body:y}=Yr(xu(Cs(u,"SKILL.md"),"utf-8"));p.origin={type:"registry",source:t,"base-version":i.headSha,...d?{"base-tag":d}:{},"base-content-hash":f,"installed-at":new Date().toISOString(),modified:!1},oS(Cs(u,"SKILL.md"),Gr(p,y));let h=aS(s,u);return St(s,[h],`install: ${a}/${e} from ${t}@${i.headSha.slice(0,8)}`),Ku.info("Skill installed",{name:e,workflow:a,version:i.headSha.slice(0,8)}),{name:e,workflow:a,targetPath:u,version:i.headSha}}finally{i.cleanup()}}var Ku,Jr=O(()=>{"use strict";yt();_u();Je();Wr();Ns();ie();Ku=D("skill-install")});import{existsSync as Ps,readFileSync as Qr,cpSync as $s,mkdirSync as Bu,readdirSync as lS,statSync as cS}from"node:fs";import{join as V,relative as zr}from"node:path";function Xr(t,e){if(!Ps(e))return null;for(let n of lS(e)){let s=V(e,n);try{if(!cS(s).isDirectory())continue}catch{continue}let i=V(s,"skills",t);if(Ps(V(i,"SKILL.md")))return{path:i,workflow:n}}return null}async function mn(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}=ee(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=jr(o.source),l=o["base-version"];if(a===l)return{name:t,action:"up-to-date",oldVersion:l};let c=Ur(o.source);try{let u=V(c.dir,"skills",t);if(!Ps(V(u,"SKILL.md")))return Fu.warn("Skill removed from registry \u2014 keeping installed copy",{name:t,source:o.source}),St(n,[zr(n,i.path)],`upgrade-check: ${i.workflow}/${t} removed from upstream registry`),{name:t,action:"removed-upstream",oldVersion:l};if(!o.modified){$s(u,i.path,{recursive:!0});let E=pn(i.path),_=gt(c.dir,a),{frontmatter:C,body:k}=ee(V(i.path,"SKILL.md"));C.origin={...C.origin,"base-version":a,"base-content-hash":E,"installed-at":new Date().toISOString(),modified:!1,..._?{"base-tag":_}:{}},Vr(V(i.path,"SKILL.md"),C,k);let P=zr(n,i.path);return St(n,[P],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)}`),{name:t,action:"applied",oldVersion:l,newVersion:a}}let f=Qr(V(i.path,"SKILL.md"),"utf-8"),d=Qr(V(u,"SKILL.md"),"utf-8"),p=V(c.dir,".hive-theirs-copy",t);Bu(p,{recursive:!0}),$s(u,p,{recursive:!0});let y;try{Hr(c.dir,l);let E=V(c.dir,"skills",t,"SKILL.md");Ps(E)&&(y=Qr(E,"utf-8"))}catch{}if(await s(f,d,y)==="keep")return{name:t,action:"kept",oldVersion:l};if(!y){let E=V(n,".hive","skill-backups",`${t}-${Date.now()}`);Bu(E,{recursive:!0}),$s(i.path,E,{recursive:!0}),Fu.info("Backed up modified skill before upgrade",{backup:E})}$s(p,i.path,{recursive:!0});let m=pn(i.path),w=gt(c.dir,a),{frontmatter:b,body:A}=ee(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}:{}},Vr(V(i.path,"SKILL.md"),b,A);let I=zr(n,i.path);return St(n,[I],`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 Fu,Ms=O(()=>{"use strict";yt();Je();Wr();Ns();ie();Fu=D("skill-upgrade")});import{existsSync as Uu,rmSync as ju,readdirSync as uS}from"node:fs";import{join as Zr,relative as fS}from"node:path";async function Ds(t,e,n,s={}){let i=Xr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed.`);let r=Zr(i.path,"SKILL.md");if(Uu(r))try{let{frontmatter:l}=ee(r);if((l.origin?.modified===!0||l.origin?.type==="agent-authored")&&!s.force){let u=`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(u))return Hu.info("Skill removal aborted by user",{name:t}),!1}else return console.log(u),console.log("Use --force to skip this prompt."),!1}}catch{}let o=fS(n,i.path);ju(i.path,{recursive:!0,force:!0});let a=Zr(e,i.workflow,"skills");return Uu(a)&&uS(a).length===0&&ju(Zr(e,i.workflow),{recursive:!0,force:!0}),qu(n,[o],`remove: ${i.workflow}/${t}`),Hu.info("Skill removed",{name:t,workflow:i.workflow}),!0}var Hu,eo=O(()=>{"use strict";Je();Ns();Ms();ie();Hu=D("skill-remove")});import{readdirSync as Yu,statSync as Gu,existsSync as to}from"node:fs";import{join as qs}from"node:path";function Vu(t){if(!to(t))return[];let e=[];for(let n of Yu(t)){let s=qs(t,n);if(!Gu(s).isDirectory())continue;let i=qs(s,"skills");if(to(i))for(let r of Yu(i)){let o=qs(i,r);if(!Gu(o).isDirectory())continue;let a=qs(o,"SKILL.md");if(!to(a))continue;let l;try{let{frontmatter:c}=ee(a);l=c.origin}catch{}e.push({name:r,workflow:n,skillMdPath:a,origin:l})}}return e}function Wu(t,e){return t.filter(n=>n.origin?.source===e)}var Ju=O(()=>{"use strict";Je()});var Qu={};Y(Qu,{syncOperatorSkills:()=>no});import{join as dS}from"node:path";async function no(t,e,n={}){let s={headSha:"",installed:[],upgraded:[],upToDate:[],modifiedSkipped:[],orphaned:[],pruned:[],errors:[]};ve.info("Sync starting",{repo:t,dryRun:!!n.dryRun});let i=dS(e,"skills"),r=fn(t);s.headSha=r.headSha;try{let o=dn(r.dir),a=Vu(i),l=Wu(a,t);for(let c of o){let u=l.find(f=>f.name===c);if(!u){if(n.dryRun){s.installed.push(c);continue}try{Ls(t,c,i,e),s.installed.push(c),ve.info("Installed",{skill:c})}catch(f){s.errors.push({skill:c,error:String(f)}),ve.warn("Install failed",{skill:c,err:f})}continue}if(u.origin?.modified===!0){s.modifiedSkipped.push(c),ve.info("Skipped (customer-modified)",{skill:c});continue}if(!u.origin?.["base-version"]){s.errors.push({skill:c,error:"origin.source matches operator repo but base-version is missing. Reinstall with 'hive skill add' or remove and re-sync."});continue}if(u.origin["base-version"]===r.headSha){s.upToDate.push(c);continue}if(n.dryRun){s.upgraded.push(c);continue}try{await mn(c,i,e,pS),s.upgraded.push(c),ve.info("Upgraded",{skill:c})}catch(f){s.errors.push({skill:c,error:String(f)}),ve.warn("Upgrade failed",{skill:c,err:f})}}for(let c of l)if(!o.includes(c.name)&&(s.orphaned.push(c.name),n.prune&&!n.dryRun))try{await Ds(c.name,i,e,{force:!0}),s.pruned.push(c.name),ve.info("Pruned orphan",{skill:c.name})}catch(u){s.errors.push({skill:c.name,error:String(u)}),ve.warn("Prune failed",{skill:c.name,err:u})}}finally{r.cleanup()}return ve.info("Sync complete",{installed:s.installed.length,upgraded:s.upgraded.length,upToDate:s.upToDate.length,modifiedSkipped:s.modifiedSkipped.length,orphaned:s.orphaned.length,pruned:s.pruned.length,errors:s.errors.length}),s}var ve,pS,so=O(()=>{"use strict";yt();Jr();Ms();eo();Ju();ie();ve=D("skill-sync"),pS=async()=>{throw new Error("Sync hit a 3-way merge conflict \u2014 this should not happen because customer-modified skills are pre-filtered. File a bug.")}});var Xu={};Y(Xu,{runUpdate:()=>yS});import{execFileSync as hS}from"node:child_process";import{readFileSync as mS,existsSync as gS}from"node:fs";import{resolve as io}from"node:path";function zu(t){try{let e=JSON.parse(mS(io(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function yS(t={}){let e=He(),n=io(e,".hive"),s=io(n,"service","deploy.sh");gS(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=zu(n),r=t.tag??"latest";console.log(`Updating @keepur/hive (current: ${i}, target: ${r})...`);let o=tu();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=ks(e,r);try{hS(s,a,{stdio:"inherit",env:{...process.env,...l}})}catch{console.error("Update failed. See deploy.sh output above."),process.exit(1)}let c=zu(n);console.log(i===c?`Already at latest matching tag: ${c}.`:`Updated: ${i} \u2192 ${c}.`);try{let{config:u}=await Promise.resolve().then(()=>(ht(),pt));if(u.operatorSkillsRepo){console.log(""),console.log("Syncing skills from operator repo...");let{syncOperatorSkills:f}=await Promise.resolve().then(()=>(so(),Qu)),d=await f(u.operatorSkillsRepo.url,e);d.installed.length||d.upgraded.length?console.log(` installed: ${d.installed.length}, upgraded: ${d.upgraded.length}, up-to-date: ${d.upToDate.length}`):console.log(" all skills up to date"),d.errors.length&&console.warn(` ${d.errors.length} skill(s) failed to sync \u2014 re-run 'hive skill sync' manually`)}}catch(u){console.warn(`Post-upgrade skill sync failed (non-fatal): ${u}`),console.warn("Re-run manually with: hive skill sync")}}var Zu=O(()=>{"use strict";Q();nu();qr()});var tf={};Y(tf,{runRollback:()=>wS});import{execFileSync as SS}from"node:child_process";import{readFileSync as vS,existsSync as ef}from"node:fs";import{resolve as Rs}from"node:path";function ro(t){try{let e=JSON.parse(vS(Rs(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function wS(t={}){let e=He(),n=Rs(e,".hive"),s=Rs(e,".hive.prev"),i=Rs(n,"service","deploy.sh");ef(i)||(console.error(`deploy.sh not found at ${i}.`),process.exit(1)),ef(s)||(console.error(`No previous engine at ${s}. Rollback unavailable.`),process.exit(1));let r=ks(e),o=t.instance??r.HIVE_SINGLE_ID,a=ro(n),l=ro(s);console.log(`Rolling back ${o}: ${a} \u2192 ${l}`);try{SS(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=ro(n);console.log(`Rollback complete: ${c}.`)}var nf=O(()=>{"use strict";Q();qr()});var rf={};Y(rf,{runMigrate:()=>AS});import{execFileSync as bS}from"node:child_process";import{resolve as sf}from"node:path";import{existsSync as kS}from"node:fs";import{fileURLToPath as ES}from"node:url";async function AS(t){let e=ES(import.meta.url),n=sf(e,"..",".."),s=sf(n,"install","migrate-0.2.sh");kS(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{bS("bash",[s,...i],{stdio:"inherit"})}catch{process.exit(1)}}var of=O(()=>{"use strict"});import{execFileSync as oo}from"node:child_process";import{existsSync as IS,readFileSync as lf}from"node:fs";import{resolve as _S}from"node:path";function gn(t){try{return oo("which",[t],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function cf(t){try{return oo("brew",["services","list"],{encoding:"utf-8"}).split(`
235
- `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function ao(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 uf(t){let e=lf(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 ff(t){let e=process.getuid?.();if(e===void 0)return{loaded:!1,state:"unknown",pid:null};try{let n=oo("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 df(t){try{return process.kill(t,0),!0}catch{return!1}}async function pf(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 hf(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 mf(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").findOne({isDefault:!0})!==null}catch{return!1}finally{await s.close().catch(()=>{})}}async function gf(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}}async function yf(t,e,n=10080*60*1e3){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:2e3});try{await i.connect();let r=new Date(Date.now()-n),o=i.db(e).collection("agent_turn_telemetry").aggregate([{$match:{createdAt:{$gte:r}}},{$group:{_id:"$agentId",turns:{$sum:1},inputTokens:{$sum:"$inputTokens"},cacheReadTokens:{$sum:"$cacheReadTokens"},cacheCreationTokens:{$sum:"$cacheCreationTokens"},ephemeral5mTokens:{$sum:{$ifNull:["$ephemeral5mTokens",0]}},ephemeral1hTokens:{$sum:{$ifNull:["$ephemeral1hTokens",0]}}}},{$sort:{_id:1}}]),a=[];for await(let l of o){let c=l.inputTokens+l.cacheReadTokens+l.cacheCreationTokens;a.push({agentId:l._id,turns:l.turns,cacheReadTokens:l.cacheReadTokens,cacheCreationTokens:l.cacheCreationTokens,inputTokens:l.inputTokens,ephemeral5mTokens:l.ephemeral5mTokens,ephemeral1hTokens:l.ephemeral1hTokens,hitRate:c>0?l.cacheReadTokens/c:null})}return a}catch{return[]}finally{await i.close().catch(()=>{})}}function Sf(t){return t===null?"no data":`${(t*100).toFixed(1)}%`}async function vf(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{await s.connect();let i=await s.db(e).collection("telemetry").findOne({kind:"prefix_cache_stats"});if(!i)return null;let r=i.updatedAt instanceof Date?i.updatedAt:null;return{hits:i.hits??0,misses:i.misses??0,entryCount:i.entryCount??0,lastBuildP99Ms:i.lastBuildP99Ms??0,oldestEntryAgeMs:i.oldestEntryAgeMs??0,staleSeconds:r?Math.round((Date.now()-r.getTime())/1e3):null}}catch{return null}finally{await s.close().catch(()=>{})}}async function wf(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{return await s.connect(),(await s.db(e).collection("telemetry").find({kind:"spawn_coordinator_stats"}).toArray()).filter(r=>typeof r.agentId=="string").map(r=>{let o=r.updatedAt instanceof Date?r.updatedAt:null;return{agentId:r.agentId,activeSpawns:r.activeSpawns??0,budget:r.budget??0,budgetSource:r.budgetSource??"default",saturationCount:r.saturationCount??0,lastSaturationAt:r.lastSaturationAt??null,lastSpawnAt:r.lastSpawnAt??null,lastError:r.lastError??null,stopped:r.stopped??!1,staleSeconds:o?Math.round((Date.now()-o.getTime())/1e3):null}}).sort((r,o)=>r.agentId.localeCompare(o.agentId))}catch{return[]}finally{await s.close().catch(()=>{})}}function af(t){return t.replace(/^~(?=$|\/)/,process.env.HOME??"")}function bf(t="com.hive.agent"){let e=af(`~/Library/LaunchAgents/${t}.plist`);if(!IS(e))return null;let s=lf(e,"utf-8").match(/<key>WorkingDirectory<\/key>\s*<string>([^<]+)<\/string>/);return s?_S(af(s[1])):null}var kf=O(()=>{"use strict"});var Nf={};Y(Nf,{renderPrefixCacheSection:()=>_f,renderPromptCacheSection:()=>Tf,renderSpawnCoordinatorSection:()=>Of,resolveRequiredEnvVars:()=>If,runDoctor:()=>NS});import{resolve as vt}from"node:path";import{existsSync as lo,readFileSync as Af}from"node:fs";import{execFileSync as Ef}from"node:child_process";async function OS(){try{return{config:(await Promise.resolve().then(()=>(ht(),pt))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}function If(t){let e=[vt(t,"required-env.json"),vt(t,"..","required-env.json")];for(let s of e)if(lo(s))try{let i=JSON.parse(Af(s,"utf-8"));if(Array.isArray(i.requiredEnv)&&i.requiredEnv.every(r=>typeof r=="string"))return i.requiredEnv}catch{}let n=vt(t,"..","..","src","config.ts");return lo(n)?uf(n):[]}function _f(t,e=console.log){if(e(`
236
- Prefix cache (live engine)`),!t){e(" \u25CB no heartbeat yet \u2014 start the engine and re-check");return}let n=t.hits+t.misses,s=n>0?`${(t.hits/n*100).toFixed(1)}%`:"no data",i=t.staleSeconds===null?"?":`${t.staleSeconds}s ago`;e(` hits=${t.hits} misses=${t.misses} hit-rate=${s} entries=${t.entryCount} p99-build=${t.lastBuildP99Ms}ms oldest=${Math.round(t.oldestEntryAgeMs/1e3)}s (heartbeat ${i})`),t.staleSeconds!==null&&t.staleSeconds>120&&e(" \u26A0 heartbeat is stale \u2014 engine may not be running, or stats writer is failing"),t.oldestEntryAgeMs>1440*60*1e3&&e(" \u26A0 oldest entry > 24h \u2014 possible invalidation gap, file an issue if persistent")}function Of(t,e=console.log){if(e(`
237
- Spawn coordinator (live engine, per agent)`),t.length===0){e(" \u25CB no heartbeat yet \u2014 start the engine and re-check");return}for(let n of t){let s=n.staleSeconds===null?"?":`${n.staleSeconds}s ago`,i=[];n.stopped&&i.push("STOPPED"),n.staleSeconds!==null&&n.staleSeconds>120&&i.push("stale-heartbeat");let r=i.length>0?` [${i.join(",")}]`:"",o=n.lastSaturationAt===null?"never":`${Math.round((Date.now()-n.lastSaturationAt)/1e3)}s ago`;e(` ${n.agentId}: active=${n.activeSpawns} budget=${n.budget} (source=${n.budgetSource}) saturations=${n.saturationCount} (last ${o})${r} (heartbeat ${s})`),n.lastError&&e(` last error: ${n.lastError}`)}}function Tf(t,e=console.log){if(e(`
238
- Prompt cache (last 7 days)`),t.length===0){e(" \u25CB no telemetry yet \u2014 let the hive run for a window and re-check");return}for(let n of t){let s=n.ephemeral5mTokens>0||n.ephemeral1hTokens>0?` (5m=${n.ephemeral5mTokens}, 1h=${n.ephemeral1hTokens})`:"";e(` ${n.agentId}: hit=${Sf(n.hitRate)} read=${n.cacheReadTokens} create=${n.cacheCreationTokens}${s} input=${n.inputTokens} turns=${n.turns}`)}}async function NS(t={}){let e=!!t.verbose,n=If(import.meta.dirname),{config:s,error:i}=await OS(),r=s?`com.hive.${s.instance.id}.agent`:"com.hive.agent",o=bf(r);console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${$}`),console.log(` service path: ${o??"(LaunchAgent plist not found)"}`),console.log("");let a=[{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:()=>gn("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:()=>cf("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>ao("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(!gn("ollama"))return!1;try{let u=Ef("ollama",["list"],{encoding:"utf-8"});return u.includes("bge-large")&&u.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>ao("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>gn("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>gn("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return Ef("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:()=>s!==null,remedy:i?`config.ts threw: ${i}. 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."},...n.map(u=>({name:`env: ${u}`,group:"config",required:!0,test:()=>!!process.env[u],remedy:`Set ${u} in <HIVE_HOME>/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>s?pf(s.mongo.uri,s.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:()=>s?hf(s.mongo.uri,s.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:"default agent flagged (isDefault: true)",group:"agents",required:!0,test:()=>s?mf(s.mongo.uri,s.mongo.dbName):!1,remedy:s?"Set `isDefault: true` on the instance's default agent via `admin_agent_update`.":"Config failed to load \u2014 see Config group."},{name:s?`LaunchAgent com.hive.${s.instance.id}.agent running`:"LaunchAgent running",group:"services",required:!0,test:()=>{if(!s)return!1;let u=`com.hive.${s.instance.id}.agent`,f=ff(u);return f.loaded&&f.state==="running"&&f.pid!==null&&df(f.pid)},remedy:(()=>{let u=process.getuid?.()??0,f=s?`com.hive.${s.instance.id}.agent`:"com.hive.agent";return`launchctl bootstrap gui/${u} ~/Library/LaunchAgents/${f}.plist && launchctl kickstart -k gui/${u}/${f}`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>s?gf(s.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(!s)return!0;let u=`com.hive.${s.instance.id}.agent`,f=process.env.HOME??"",d=vt(f,"Library/LaunchAgents",`${u}.plist`);if(!lo(d))return!0;let p=Af(d,"utf-8"),y=vt(Ye,"dist","index.js"),h=vt(Ye,"pkg","server.min.js");return p.includes(y)||p.includes(h)},remedy:"Live plist ProgramArguments does not reference <engineDir>/dist/index.js. Run `hive start --daemon` to regenerate the plist."}],l=!0,c=null;for(let u of a){u.group!==c&&(console.log(`
239
- ${TS[u.group]}`),c=u.group);let f=await u.test(),d=f?"\u2713":u.required?"\u2717":"\u25CB",p=u.required?"":" (optional)";console.log(` ${d} ${u.name}${p}`),!f&&e&&u.remedy&&console.log(` \u2192 ${u.remedy}`),!f&&u.required&&(l=!1)}if(s){let u=await yf(s.mongo.uri,s.mongo.dbName);Tf(u);let f=await vf(s.mongo.uri,s.mongo.dbName);_f(f);let d=await wf(s.mongo.uri,s.mongo.dbName);Of(d)}else console.log(`
234
+ `)+i+r}var Je=T(()=>{"use strict"});import{createHash as iS}from"node:crypto";import{readdirSync as rS,readFileSync as oS,statSync as aS}from"node:fs";import{join as Lu}from"node:path";function pn(t){let e=Mu(t).sort(),n=iS("sha256");for(let s=0;s<e.length;s++){s>0&&n.update("\0");let i=Lu(t,e[s]),r=oS(i,"utf-8");e[s]==="SKILL.md"?n.update($u(r)):n.update(r)}return n.digest("hex")}function Mu(t,e=""){let n=rS(t),s=[];for(let i of n){let r=Lu(t,i),o=e?`${e}/${i}`:i;aS(r).isDirectory()?s.push(...Mu(r,o)):s.push(o)}return s}var Wr=T(()=>{"use strict";Je()});import{execFileSync as Ts}from"node:child_process";import{existsSync as Os,mkdirSync as ak,unlinkSync as Du}from"node:fs";import{join as Ru,resolve as Pu}from"node:path";function qu(t){let e=Pu(t,".hive-state");return{stateDir:e,gitDir:Pu(e,"git")}}function St(t,e,n,s){let{gitDir:i}=qu(t);if(!Os(i)){hn.warn("Instance git not initialized \u2014 skipping state commit");return}let r=Ru(i,"state-index.tmp"),o={...process.env,GIT_DIR:i,GIT_WORK_TREE:t,GIT_INDEX_FILE:r},a=(...l)=>Ts("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"),u=a("rev-parse","state^{tree}");if(l===u)return;let f=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"},d=Ts("git",["commit-tree",l,"-p",c,"-m",n],{env:{...o,...f},encoding:"utf-8"}).trim();a("update-ref","refs/heads/state",d),hn.debug("State branch commit",{message:n,files:e.length})}catch(l){hn.warn("Failed to commit to state branch",{error:String(l),message:n})}finally{try{Os(r)&&Du(r)}catch{}}}function xu(t,e,n){let{gitDir:s}=qu(t);if(!Os(s))return;let i=Ru(s,"state-index.tmp"),r={...process.env,GIT_DIR:s,GIT_WORK_TREE:t,GIT_INDEX_FILE:i},o=(...a)=>Ts("git",[...a],{cwd:t,env:r,stdio:"pipe",encoding:"utf-8"}).trim();try{o("read-tree","state");for(let f of e)try{o("rm","-r","--cached","--",f)}catch{}let a=o("write-tree"),l=o("rev-parse","state"),c=o("rev-parse","state^{tree}");if(a===c)return;let u=Ts("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",u),hn.debug("State branch removal commit",{message:n})}catch(a){hn.warn("Failed to commit removal to state branch",{error:String(a)})}finally{try{Os(i)&&Du(i)}catch{}}}var hn,Ns=T(()=>{"use strict";ie();hn=D("instance-git")});import{cpSync as lS,existsSync as Ku,mkdirSync as cS,readFileSync as Bu,writeFileSync as uS}from"node:fs";import{join as Cs,relative as fS}from"node:path";function $s(t,e,n,s){let i=fn(t);try{let r=Cs(i.dir,"skills",e);if(!Ku(r)){let m=dn(i.dir);throw new Error(`Skill "${e}" not found in registry ${t}. Available skills: ${m.join(", ")||"(none)"}`)}let o=Cs(r,"SKILL.md"),a=_u(o,e),c=Bu(o,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(c){let m=c[1].match(/^name:\s*(.+)$/m);m&&m[1].trim()!==e&&Uu.warn("Registry skill name mismatch \u2014 using directory name",{dirName:e,frontmatterName:m[1].trim()})}let u=Tu(n,a,e);if(Ku(u))throw new Error(`Skill "${e}" is already installed at ${u}. Use "hive skill upgrade ${e}" to update, or "hive skill remove ${e}" first.`);cS(u,{recursive:!0}),lS(r,u,{recursive:!0});let f=pn(u),d=gt(i.dir,i.headSha),{frontmatter:p,body:y}=Yr(Bu(Cs(u,"SKILL.md"),"utf-8"));p.origin={type:"registry",source:t,"base-version":i.headSha,...d?{"base-tag":d}:{},"base-content-hash":f,"installed-at":new Date().toISOString(),modified:!1},uS(Cs(u,"SKILL.md"),Gr(p,y));let h=fS(s,u);return St(s,[h],`install: ${a}/${e} from ${t}@${i.headSha.slice(0,8)}`),Uu.info("Skill installed",{name:e,workflow:a,version:i.headSha.slice(0,8)}),{name:e,workflow:a,targetPath:u,version:i.headSha}}finally{i.cleanup()}}var Uu,Jr=T(()=>{"use strict";yt();Ou();Je();Wr();Ns();ie();Uu=D("skill-install")});import{existsSync as Ms,readFileSync as Qr,cpSync as Ls,mkdirSync as Fu,readdirSync as dS,statSync as pS}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 dS(e)){let s=V(e,n);try{if(!pS(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 mn(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}=ee(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=jr(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 u=V(c.dir,"skills",t);if(!Ms(V(u,"SKILL.md")))return ju.warn("Skill removed from registry \u2014 keeping installed copy",{name:t,source:o.source}),St(n,[zr(n,i.path)],`upgrade-check: ${i.workflow}/${t} removed from upstream registry`),{name:t,action:"removed-upstream",oldVersion:l};if(!o.modified){Ls(u,i.path,{recursive:!0});let E=pn(i.path),_=gt(c.dir,a),{frontmatter:C,body:k}=ee(V(i.path,"SKILL.md"));C.origin={...C.origin,"base-version":a,"base-content-hash":E,"installed-at":new Date().toISOString(),modified:!1,..._?{"base-tag":_}:{}},Vr(V(i.path,"SKILL.md"),C,k);let M=zr(n,i.path);return St(n,[M],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)}`),{name:t,action:"applied",oldVersion:l,newVersion:a}}let f=Qr(V(i.path,"SKILL.md"),"utf-8"),d=Qr(V(u,"SKILL.md"),"utf-8"),p=V(c.dir,".hive-theirs-copy",t);Fu(p,{recursive:!0}),Ls(u,p,{recursive:!0});let y;try{Hr(c.dir,l);let E=V(c.dir,"skills",t,"SKILL.md");Ms(E)&&(y=Qr(E,"utf-8"))}catch{}if(await s(f,d,y)==="keep")return{name:t,action:"kept",oldVersion:l};if(!y){let E=V(n,".hive","skill-backups",`${t}-${Date.now()}`);Fu(E,{recursive:!0}),Ls(i.path,E,{recursive:!0}),ju.info("Backed up modified skill before upgrade",{backup:E})}Ls(p,i.path,{recursive:!0});let m=pn(i.path),v=gt(c.dir,a),{frontmatter:b,body:A}=ee(V(i.path,"SKILL.md"));b.origin={...b.origin,"base-version":a,"base-content-hash":m,"installed-at":new Date().toISOString(),modified:!1,...v?{"base-tag":v}:{}},Vr(V(i.path,"SKILL.md"),b,A);let I=zr(n,i.path);return St(n,[I],`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 ju,Ps=T(()=>{"use strict";yt();Je();Wr();Ns();ie();ju=D("skill-upgrade")});import{existsSync as Hu,rmSync as Yu,readdirSync as hS}from"node:fs";import{join as Zr,relative as mS}from"node:path";async function Ds(t,e,n,s={}){let i=Xr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed.`);let r=Zr(i.path,"SKILL.md");if(Hu(r))try{let{frontmatter:l}=ee(r);if((l.origin?.modified===!0||l.origin?.type==="agent-authored")&&!s.force){let u=`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(u))return Gu.info("Skill removal aborted by user",{name:t}),!1}else return console.log(u),console.log("Use --force to skip this prompt."),!1}}catch{}let o=mS(n,i.path);Yu(i.path,{recursive:!0,force:!0});let a=Zr(e,i.workflow,"skills");return Hu(a)&&hS(a).length===0&&Yu(Zr(e,i.workflow),{recursive:!0,force:!0}),xu(n,[o],`remove: ${i.workflow}/${t}`),Gu.info("Skill removed",{name:t,workflow:i.workflow}),!0}var Gu,eo=T(()=>{"use strict";Je();Ns();Ps();ie();Gu=D("skill-remove")});import{readdirSync as Vu,statSync as Wu,existsSync as to}from"node:fs";import{join as Rs}from"node:path";function Ju(t){if(!to(t))return[];let e=[];for(let n of Vu(t)){let s=Rs(t,n);if(!Wu(s).isDirectory())continue;let i=Rs(s,"skills");if(to(i))for(let r of Vu(i)){let o=Rs(i,r);if(!Wu(o).isDirectory())continue;let a=Rs(o,"SKILL.md");if(!to(a))continue;let l;try{let{frontmatter:c}=ee(a);l=c.origin}catch{}e.push({name:r,workflow:n,skillMdPath:a,origin:l})}}return e}function Qu(t,e){return t.filter(n=>n.origin?.source===e)}var zu=T(()=>{"use strict";Je()});var Xu={};Y(Xu,{syncOperatorSkills:()=>no});import{join as gS}from"node:path";async function no(t,e,n={}){let s={headSha:"",installed:[],upgraded:[],upToDate:[],modifiedSkipped:[],orphaned:[],pruned:[],errors:[]};ve.info("Sync starting",{repo:t,dryRun:!!n.dryRun});let i=gS(e,"skills"),r=fn(t);s.headSha=r.headSha;try{let o=dn(r.dir),a=Ju(i),l=Qu(a,t);for(let c of o){let u=l.find(f=>f.name===c);if(!u){if(n.dryRun){s.installed.push(c);continue}try{$s(t,c,i,e),s.installed.push(c),ve.info("Installed",{skill:c})}catch(f){s.errors.push({skill:c,error:String(f)}),ve.warn("Install failed",{skill:c,err:f})}continue}if(u.origin?.modified===!0){s.modifiedSkipped.push(c),ve.info("Skipped (customer-modified)",{skill:c});continue}if(!u.origin?.["base-version"]){s.errors.push({skill:c,error:"origin.source matches operator repo but base-version is missing. Reinstall with 'hive skill add' or remove and re-sync."});continue}if(u.origin["base-version"]===r.headSha){s.upToDate.push(c);continue}if(n.dryRun){s.upgraded.push(c);continue}try{await mn(c,i,e,yS),s.upgraded.push(c),ve.info("Upgraded",{skill:c})}catch(f){s.errors.push({skill:c,error:String(f)}),ve.warn("Upgrade failed",{skill:c,err:f})}}for(let c of l)if(!o.includes(c.name)&&(s.orphaned.push(c.name),n.prune&&!n.dryRun))try{await Ds(c.name,i,e,{force:!0}),s.pruned.push(c.name),ve.info("Pruned orphan",{skill:c.name})}catch(u){s.errors.push({skill:c.name,error:String(u)}),ve.warn("Prune failed",{skill:c.name,err:u})}}finally{r.cleanup()}return ve.info("Sync complete",{installed:s.installed.length,upgraded:s.upgraded.length,upToDate:s.upToDate.length,modifiedSkipped:s.modifiedSkipped.length,orphaned:s.orphaned.length,pruned:s.pruned.length,errors:s.errors.length}),s}var ve,yS,so=T(()=>{"use strict";yt();Jr();Ps();eo();zu();ie();ve=D("skill-sync"),yS=async()=>{throw new Error("Sync hit a 3-way merge conflict \u2014 this should not happen because customer-modified skills are pre-filtered. File a bug.")}});var ef={};Y(ef,{runUpdate:()=>bS});import{execFileSync as SS}from"node:child_process";import{readFileSync as vS,existsSync as wS}from"node:fs";import{resolve as io}from"node:path";function Zu(t){try{let e=JSON.parse(vS(io(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function bS(t={}){let e=He(),n=io(e,".hive"),s=io(n,"service","deploy.sh");wS(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=Zu(n),r=t.tag??"latest";console.log(`Updating @keepur/hive (current: ${i}, target: ${r})...`);let o=tu();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=ks(e,r);try{SS(s,a,{stdio:"inherit",env:{...process.env,...l}})}catch{console.error("Update failed. See deploy.sh output above."),process.exit(1)}let c=Zu(n);console.log(i===c?`Already at latest matching tag: ${c}.`:`Updated: ${i} \u2192 ${c}.`);try{let{config:u}=await Promise.resolve().then(()=>(ht(),pt));if(u.operatorSkillsRepo){console.log(""),console.log("Syncing skills from operator repo...");let{syncOperatorSkills:f}=await Promise.resolve().then(()=>(so(),Xu)),d=await f(u.operatorSkillsRepo.url,e);d.installed.length||d.upgraded.length?console.log(` installed: ${d.installed.length}, upgraded: ${d.upgraded.length}, up-to-date: ${d.upToDate.length}`):console.log(" all skills up to date"),d.errors.length&&console.warn(` ${d.errors.length} skill(s) failed to sync \u2014 re-run 'hive skill sync' manually`)}}catch(u){console.warn(`Post-upgrade skill sync failed (non-fatal): ${u}`),console.warn("Re-run manually with: hive skill sync")}}var tf=T(()=>{"use strict";Q();nu();Rr()});var sf={};Y(sf,{runRollback:()=>AS});import{execFileSync as kS}from"node:child_process";import{readFileSync as ES,existsSync as nf}from"node:fs";import{resolve as qs}from"node:path";function ro(t){try{let e=JSON.parse(ES(qs(t,"package.json"),"utf-8"));return typeof e.version=="string"?e.version:"unknown"}catch{return"unknown"}}async function AS(t={}){let e=He(),n=qs(e,".hive"),s=qs(e,".hive.prev"),i=qs(n,"service","deploy.sh");nf(i)||(console.error(`deploy.sh not found at ${i}.`),process.exit(1)),nf(s)||(console.error(`No previous engine at ${s}. Rollback unavailable.`),process.exit(1));let r=ks(e),o=t.instance??r.HIVE_SINGLE_ID,a=ro(n),l=ro(s);console.log(`Rolling back ${o}: ${a} \u2192 ${l}`);try{kS(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=ro(n);console.log(`Rollback complete: ${c}.`)}var rf=T(()=>{"use strict";Q();Rr()});var af={};Y(af,{runMigrate:()=>OS});import{execFileSync as IS}from"node:child_process";import{resolve as of}from"node:path";import{existsSync as _S}from"node:fs";import{fileURLToPath as TS}from"node:url";async function OS(t){let e=TS(import.meta.url),n=of(e,"..",".."),s=of(n,"install","migrate-0.2.sh");_S(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{IS("bash",[s,...i],{stdio:"inherit"})}catch{process.exit(1)}}var lf=T(()=>{"use strict"});import{execFileSync as oo}from"node:child_process";import{existsSync as NS,readFileSync as uf}from"node:fs";import{resolve as CS}from"node:path";function gn(t){try{return oo("which",[t],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function ff(t){try{return oo("brew",["services","list"],{encoding:"utf-8"}).split(`
235
+ `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function ao(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 df(t){let e=uf(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 pf(t){let e=process.getuid?.();if(e===void 0)return{loaded:!1,state:"unknown",pid:null};try{let n=oo("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 hf(t){try{return process.kill(t,0),!0}catch{return!1}}async function mf(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 gf(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 yf(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").findOne({isDefault:!0})!==null}catch{return!1}finally{await s.close().catch(()=>{})}}async function Sf(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}}async function vf(t,e,n=10080*60*1e3){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:2e3});try{await i.connect();let r=new Date(Date.now()-n),o=i.db(e).collection("agent_turn_telemetry").aggregate([{$match:{createdAt:{$gte:r}}},{$group:{_id:"$agentId",turns:{$sum:1},inputTokens:{$sum:"$inputTokens"},cacheReadTokens:{$sum:"$cacheReadTokens"},cacheCreationTokens:{$sum:"$cacheCreationTokens"},ephemeral5mTokens:{$sum:{$ifNull:["$ephemeral5mTokens",0]}},ephemeral1hTokens:{$sum:{$ifNull:["$ephemeral1hTokens",0]}}}},{$sort:{_id:1}}]),a=[];for await(let l of o){let c=l.inputTokens+l.cacheReadTokens+l.cacheCreationTokens;a.push({agentId:l._id,turns:l.turns,cacheReadTokens:l.cacheReadTokens,cacheCreationTokens:l.cacheCreationTokens,inputTokens:l.inputTokens,ephemeral5mTokens:l.ephemeral5mTokens,ephemeral1hTokens:l.ephemeral1hTokens,hitRate:c>0?l.cacheReadTokens/c:null})}return a}catch{return[]}finally{await i.close().catch(()=>{})}}function wf(t){return t===null?"no data":`${(t*100).toFixed(1)}%`}async function bf(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{await s.connect();let i=await s.db(e).collection("telemetry").findOne({kind:"prefix_cache_stats"});if(!i)return null;let r=i.updatedAt instanceof Date?i.updatedAt:null;return{hits:i.hits??0,misses:i.misses??0,entryCount:i.entryCount??0,lastBuildP99Ms:i.lastBuildP99Ms??0,oldestEntryAgeMs:i.oldestEntryAgeMs??0,staleSeconds:r?Math.round((Date.now()-r.getTime())/1e3):null}}catch{return null}finally{await s.close().catch(()=>{})}}async function kf(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{return await s.connect(),(await s.db(e).collection("telemetry").find({kind:"spawn_coordinator_stats"}).toArray()).filter(r=>typeof r.agentId=="string").map(r=>{let o=r.updatedAt instanceof Date?r.updatedAt:null;return{agentId:r.agentId,activeSpawns:r.activeSpawns??0,budget:r.budget??0,budgetSource:r.budgetSource??"default",saturationCount:r.saturationCount??0,lastSaturationAt:r.lastSaturationAt??null,lastSpawnAt:r.lastSpawnAt??null,lastError:r.lastError??null,stopped:r.stopped??!1,staleSeconds:o?Math.round((Date.now()-o.getTime())/1e3):null}}).sort((r,o)=>r.agentId.localeCompare(o.agentId))}catch{return[]}finally{await s.close().catch(()=>{})}}async function Ef(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{await s.connect();let i=await s.db(e).collection("telemetry").find({kind:"memory_lifecycle_stats"}).sort({agentId:1}).toArray(),r=Date.now();return i.map(o=>{let a=o.consolidation,l=a?.cursor?{createdAt:a.cursor.createdAt instanceof Date?a.cursor.createdAt:new Date(a.cursor.createdAt),lastId:String(a.cursor.lastId??"")}:null;return{agentId:o.agentId??"<unknown>",counts:o.counts??{hot:0,warm:0,cold:0},summarizedNotPurged:o.summarizedNotPurged??0,needsReview:o.needsReview??0,oldestColdAgeDays:o.oldestColdAgeDays??null,consolidation:a?{...a,cursor:l}:{phase:"idle",topic:null,cursor:null,lastAttemptAt:null,lastSuccessAt:null,lastError:null,lastRunSpentUsd:null,cumulativeSpentUsd30d:0},staleSeconds:o.updatedAt instanceof Date?Math.round((r-o.updatedAt.getTime())/1e3):null}})}catch{return[]}finally{await s.close().catch(()=>{})}}function cf(t){return t.replace(/^~(?=$|\/)/,process.env.HOME??"")}function Af(t="com.hive.agent"){let e=cf(`~/Library/LaunchAgents/${t}.plist`);if(!NS(e))return null;let s=uf(e,"utf-8").match(/<key>WorkingDirectory<\/key>\s*<string>([^<]+)<\/string>/);return s?CS(cf(s[1])):null}var If=T(()=>{"use strict"});var Mf={};Y(Mf,{renderMemoryLifecycleSection:()=>$f,renderPrefixCacheSection:()=>Nf,renderPromptCacheSection:()=>Lf,renderSpawnCoordinatorSection:()=>Cf,resolveRequiredEnvVars:()=>Of,runDoctor:()=>MS});import{resolve as vt}from"node:path";import{existsSync as lo,readFileSync as Tf}from"node:fs";import{execFileSync as _f}from"node:child_process";async function $S(){try{return{config:(await Promise.resolve().then(()=>(ht(),pt))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}function Of(t){let e=[vt(t,"required-env.json"),vt(t,"..","required-env.json")];for(let s of e)if(lo(s))try{let i=JSON.parse(Tf(s,"utf-8"));if(Array.isArray(i.requiredEnv)&&i.requiredEnv.every(r=>typeof r=="string"))return i.requiredEnv}catch{}let n=vt(t,"..","..","src","config.ts");return lo(n)?df(n):[]}function Nf(t,e=console.log){if(e(`
236
+ Prefix cache (live engine)`),!t){e(" \u25CB no heartbeat yet \u2014 start the engine and re-check");return}let n=t.hits+t.misses,s=n>0?`${(t.hits/n*100).toFixed(1)}%`:"no data",i=t.staleSeconds===null?"?":`${t.staleSeconds}s ago`;e(` hits=${t.hits} misses=${t.misses} hit-rate=${s} entries=${t.entryCount} p99-build=${t.lastBuildP99Ms}ms oldest=${Math.round(t.oldestEntryAgeMs/1e3)}s (heartbeat ${i})`),t.staleSeconds!==null&&t.staleSeconds>120&&e(" \u26A0 heartbeat is stale \u2014 engine may not be running, or stats writer is failing"),t.oldestEntryAgeMs>1440*60*1e3&&e(" \u26A0 oldest entry > 24h \u2014 possible invalidation gap, file an issue if persistent")}function Cf(t,e=console.log){if(e(`
237
+ Spawn coordinator (live engine, per agent)`),t.length===0){e(" \u25CB no heartbeat yet \u2014 start the engine and re-check");return}for(let n of t){let s=n.staleSeconds===null?"?":`${n.staleSeconds}s ago`,i=[];n.stopped&&i.push("STOPPED"),n.staleSeconds!==null&&n.staleSeconds>120&&i.push("stale-heartbeat");let r=i.length>0?` [${i.join(",")}]`:"",o=n.lastSaturationAt===null?"never":`${Math.round((Date.now()-n.lastSaturationAt)/1e3)}s ago`;e(` ${n.agentId}: active=${n.activeSpawns} budget=${n.budget} (source=${n.budgetSource}) saturations=${n.saturationCount} (last ${o})${r} (heartbeat ${s})`),n.lastError&&e(` last error: ${n.lastError}`)}}function $f(t,e=console.log,n=5){if(t.length!==0){e(`
238
+ Memory lifecycle (per agent):`);for(let s of t){let i=s.consolidation,r=s.staleSeconds!==null&&s.staleSeconds>300?" \u26A0 heartbeat stale":"",o=i.cumulativeSpentUsd30d>n?` \u26A0 spend $${i.cumulativeSpentUsd30d.toFixed(2)}/30d`:"",a=i.lastError?` \u26A0 lastError: ${i.lastError.slice(0,60)}`:"",l=s.oldestColdAgeDays!==null?` (oldest ${s.oldestColdAgeDays}d)`:"";if(e(` ${s.agentId}: hot=${s.counts.hot} warm=${s.counts.warm} cold=${s.counts.cold}${l}, summarized-not-purged=${s.summarizedNotPurged}, needsReview=${s.needsReview}${r}${o}${a}`),i.phase!=="idle"){let c=i.cursor?.createdAt?new Date(i.cursor.createdAt).toISOString().slice(0,10):"\u2014";e(` phase=${i.phase} topic="${i.topic??""}" cursor=${c}`)}i.lastSuccessAt&&e(` last success ${i.lastSuccessAt.toISOString()} | last attempt ${i.lastAttemptAt?.toISOString()??"\u2014"}`)}}}function Lf(t,e=console.log){if(e(`
239
+ Prompt cache (last 7 days)`),t.length===0){e(" \u25CB no telemetry yet \u2014 let the hive run for a window and re-check");return}for(let n of t){let s=n.ephemeral5mTokens>0||n.ephemeral1hTokens>0?` (5m=${n.ephemeral5mTokens}, 1h=${n.ephemeral1hTokens})`:"";e(` ${n.agentId}: hit=${wf(n.hitRate)} read=${n.cacheReadTokens} create=${n.cacheCreationTokens}${s} input=${n.inputTokens} turns=${n.turns}`)}}async function MS(t={}){let e=!!t.verbose,n=Of(import.meta.dirname),{config:s,error:i}=await $S(),r=s?`com.hive.${s.instance.id}.agent`:"com.hive.agent",o=Af(r);console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${L}`),console.log(` service path: ${o??"(LaunchAgent plist not found)"}`),console.log("");let a=[{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:()=>gn("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:()=>ff("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>ao("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(!gn("ollama"))return!1;try{let u=_f("ollama",["list"],{encoding:"utf-8"});return u.includes("bge-large")&&u.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>ao("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>gn("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>gn("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return _f("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:()=>s!==null,remedy:i?`config.ts threw: ${i}. 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."},...n.map(u=>({name:`env: ${u}`,group:"config",required:!0,test:()=>!!process.env[u],remedy:`Set ${u} in <HIVE_HOME>/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>s?mf(s.mongo.uri,s.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:()=>s?gf(s.mongo.uri,s.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:"default agent flagged (isDefault: true)",group:"agents",required:!0,test:()=>s?yf(s.mongo.uri,s.mongo.dbName):!1,remedy:s?"Set `isDefault: true` on the instance's default agent via `admin_agent_update`.":"Config failed to load \u2014 see Config group."},{name:s?`LaunchAgent com.hive.${s.instance.id}.agent running`:"LaunchAgent running",group:"services",required:!0,test:()=>{if(!s)return!1;let u=`com.hive.${s.instance.id}.agent`,f=pf(u);return f.loaded&&f.state==="running"&&f.pid!==null&&hf(f.pid)},remedy:(()=>{let u=process.getuid?.()??0,f=s?`com.hive.${s.instance.id}.agent`:"com.hive.agent";return`launchctl bootstrap gui/${u} ~/Library/LaunchAgents/${f}.plist && launchctl kickstart -k gui/${u}/${f}`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>s?Sf(s.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(!s)return!0;let u=`com.hive.${s.instance.id}.agent`,f=process.env.HOME??"",d=vt(f,"Library/LaunchAgents",`${u}.plist`);if(!lo(d))return!0;let p=Tf(d,"utf-8"),y=vt(Ye,"dist","index.js"),h=vt(Ye,"pkg","server.min.js");return p.includes(y)||p.includes(h)},remedy:"Live plist ProgramArguments does not reference <engineDir>/dist/index.js. Run `hive start --daemon` to regenerate the plist."}],l=!0,c=null;for(let u of a){u.group!==c&&(console.log(`
240
+ ${LS[u.group]}`),c=u.group);let f=await u.test(),d=f?"\u2713":u.required?"\u2717":"\u25CB",p=u.required?"":" (optional)";console.log(` ${d} ${u.name}${p}`),!f&&e&&u.remedy&&console.log(` \u2192 ${u.remedy}`),!f&&u.required&&(l=!1)}if(s){let u=await vf(s.mongo.uri,s.mongo.dbName);Lf(u);let f=await bf(s.mongo.uri,s.mongo.dbName);Nf(f);let d=await kf(s.mongo.uri,s.mongo.dbName);Cf(d);let p=await Ef(s.mongo.uri,s.mongo.dbName);$f(p,console.log,s.memory.spendWarnThresholdUsd??5)}else console.log(`
240
241
  Prompt cache (last 7 days)`),console.log(" \u25CB skipped: config not loaded"),console.log(`
241
242
  Prefix cache (live engine)`),console.log(" \u25CB skipped: config not loaded"),console.log(`
242
- Spawn coordinator (live engine, per agent)`),console.log(" \u25CB skipped: config not loaded");l||(console.log(`
243
+ Spawn coordinator (live engine, per agent)`),console.log(" \u25CB skipped: config not loaded"),console.log(`
244
+ Memory lifecycle: skipped (config not loaded)`);l||(console.log(`
243
245
  Some required checks failed. Run with --verbose for remedy hints.`),process.exit(1)),console.log(`
244
- All checks passed.`)}var TS,Cf=O(()=>{"use strict";kf();Q();TS={prereq:"Prereqs",config:"Config",agents:"Agents",services:"Services"}});import{readFileSync as CS,writeFileSync as LS,existsSync as $S}from"node:fs";import{resolve as PS}from"node:path";function qe(){return PS($,process.env.HIVE_CONFIG||"hive.yaml")}function de(t){let e=t??qe();return $S(e)?(0,xs.parse)(CS(e,"utf-8"))??{}:{}}function wt(t,e){let n=e??qe();LS(n,(0,xs.stringify)(t,{lineWidth:0}))}var xs,Ks=O(()=>{"use strict";xs=oe(ce(),1);Q()});import{execFileSync as co}from"node:child_process";function uo(){let t=de(),n=`com.hive.${t.instanceId??t.id??"hive"}.agent`;try{co("launchctl",["list",n],{stdio:"pipe"})}catch{return!1}let s=co("id",["-u"],{stdio:"pipe",encoding:"utf-8"}).trim();try{return co("launchctl",["kickstart","-k",`gui/${s}/${n}`],{stdio:"pipe"}),Lf.info("Hive service restarted",{label:n}),!0}catch(i){return Lf.warn("Failed to restart hive service",{label:n,error:String(i)}),!1}}var Lf,$f=O(()=>{"use strict";Ks();ie();Lf=D("hive-restart")});import{readFileSync as MS}from"node:fs";import{resolve as Pf}from"node:path";function qS(){let t=[Pf(import.meta.dirname,"..","..","package.json"),Pf(import.meta.dirname,"..","package.json")];for(let e of t)try{let n=JSON.parse(MS(e,"utf-8"));if(n?.name==="@keepur/hive"&&typeof n.hiveApi=="string")return n.hiveApi}catch{continue}return null}var DS,Mf,Bs,fo=O(()=>{"use strict";ie();DS=D("api-version");Mf=qS();Mf||DS.warn("Could not read hiveApi from package.json; falling back to 1.0.0");Bs=Mf??"1.0.0"});var Df=O(()=>{"use strict"});function qf(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 xS.warn("Unrecognized hiveApi range syntax, accepting",{range:t}),!0}var RS,xS,Rf=O(()=>{"use strict";RS=oe(ce(),1);ie();Df();fo();xS=D("plugin-loader")});var Kf={};Y(Kf,{runPlugin:()=>BS});import{execFileSync as Fs}from"node:child_process";import{existsSync as bt,mkdirSync as KS,readFileSync as ho}from"node:fs";import{resolve as yn,join as Us}from"node:path";function xf(t,e){let n=Us(t,"..","package.json");if(bt(n))try{let i=JSON.parse(ho(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 BS(t,e){switch(t){case"add":return FS(e);case"remove":return US(e);case"list":return jS();default:console.error("Usage: hive plugin <add|list|remove> [package]"),process.exit(1)}}function FS(t){t||(console.error("Usage: hive plugin add <package-name>"),process.exit(1)),KS(pe,{recursive:!0});let e=yn(pe,"package.json");bt(e)||Fs("npm",["init","-y"],{cwd:pe,stdio:"pipe"}),console.log(`Installing ${t}...`);try{Fs("npm",["install",t],{cwd:pe,stdio:"pipe"})}catch(u){console.error(`Failed to install ${t}: ${String(u)}`),process.exit(1)}let n=yn(pe,"node_modules",t),s=Us(n,"plugin.yaml");bt(s)||(console.error(`Not a valid hive plugin \u2014 no plugin.yaml found in ${t}.`),po(t),process.exit(1));let i=(0,mo.parse)(ho(s,"utf-8")),r=i?.hiveApi??i?.["hive-api"];r&&!qf(r,Bs)&&(console.error(`Plugin requires hiveApi ${r} but this hive is ${Bs}.`),po(t),process.exit(1));let o=xf(s,i),a=qe(),l=de(a);if(l.plugins||(l.plugins=[]),!l.plugins.includes(t)){l.plugins.push(t);try{wt(l,a)}catch(u){console.error(`Failed to update hive.yaml: ${String(u)}`),po(t),process.exit(1)}console.log("\u2713 Updated hive.yaml")}let c=uo();console.log(c?"\u2713 Restarting hive... done":"Start hive to activate the plugin."),console.log(`\u2713 Installed ${t} (v${o}${r?`, hiveApi ${r}`:""})`)}function US(t){t||(console.error("Usage: hive plugin remove <package-name>"),process.exit(1)),bt(pe)||(console.error("No plugins directory found."),process.exit(1)),console.log(`Removing ${t}...`);try{Fs("npm",["uninstall",t],{cwd:pe,stdio:"pipe"})}catch(i){console.error(`Failed to uninstall ${t}: ${String(i)}`),process.exit(1)}let e=qe(),n=de(e);if(Array.isArray(n.plugins)){let i=n.plugins.indexOf(t);i>=0&&(n.plugins.splice(i,1),wt(n,e),console.log("\u2713 Updated hive.yaml"))}let s=uo();console.log(s?"\u2713 Restarting hive... done":"Restart hive to complete removal."),console.log(`Removed ${t}`)}function jS(){let t=qe(),n=de(t).plugins??[];if(n.length===0){console.log("No plugins configured in hive.yaml.");return}console.log(`Installed plugins:
245
- `);for(let s of n){let i=yn(pe,"node_modules",s),r=yn(pe,s),o=Us(i,"plugin.yaml"),a=Us(r,"plugin.yaml"),l=null,c=!1;if(bt(o)?l=o:bt(a)&&(l=a,c=!0),!l){console.log(` ${s} \u26A0 not found on disk`);continue}try{let u=(0,mo.parse)(ho(l,"utf-8")),f=xf(l,u),d=u?.hiveApi??u?.["hive-api"]??"",p=c?" [in-tree]":"";console.log(` ${s} v${f}${d?` (hiveApi ${d})`:""}${p}`)}catch{console.log(` ${s} \u26A0 failed to read plugin.yaml`)}}}function po(t){try{Fs("npm",["uninstall",t],{cwd:pe,stdio:"pipe"})}catch{}}var mo,pe,Bf=O(()=>{"use strict";mo=oe(ce(),1);Q();Ks();$f();fo();Rf();pe=yn($,"plugins")});function Ff(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 Uf(t,e){if(t.inlineUrl){let i=HS(t.inlineUrl);return go.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 go.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 go.debug("resolved default registry",{registryName:s.name,url:s.url}),{name:s.name,url:s.url}}function HS(t){try{return t.replace(/\.git$/,"").split("/").filter(Boolean).slice(-2).join("-")}catch{return"inline"}}var go,jf=O(()=>{"use strict";ie();go=D("registry-resolver")});var Yf={};Y(Yf,{runSkill:()=>VS});import{existsSync as we,readdirSync as kt,readFileSync as YS,statSync as GS}from"node:fs";import{join as Re}from"node:path";import{createInterface as Hf}from"node:readline";async function VS(t,...e){switch(t){case"add":{mt();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(()=>(ht(),pt)),i=Ff(n),r=Uf(i,s.skillRegistries),o=Ls(r.url,i.name,G,$);console.log(`Installed ${o.workflow}/${o.name} (${o.version.slice(0,8)})`);break}case"list":{e.includes("--available")?(mt(),await QS(e)):JS();break}case"upgrade":{mt();let n=e[0];n||(console.error("Usage: hive skill upgrade <name|--all>"),process.exit(1));let s=async(i,r,o)=>{console.log(`
246
+ All checks passed.`)}var LS,Pf=T(()=>{"use strict";If();Q();LS={prereq:"Prereqs",config:"Config",agents:"Agents",services:"Services"}});import{readFileSync as PS,writeFileSync as DS,existsSync as RS}from"node:fs";import{resolve as qS}from"node:path";function Re(){return qS(L,process.env.HIVE_CONFIG||"hive.yaml")}function de(t){let e=t??Re();return RS(e)?(0,xs.parse)(PS(e,"utf-8"))??{}:{}}function wt(t,e){let n=e??Re();DS(n,(0,xs.stringify)(t,{lineWidth:0}))}var xs,Ks=T(()=>{"use strict";xs=oe(ce(),1);Q()});import{execFileSync as co}from"node:child_process";function uo(){let t=de(),n=`com.hive.${t.instanceId??t.id??"hive"}.agent`;try{co("launchctl",["list",n],{stdio:"pipe"})}catch{return!1}let s=co("id",["-u"],{stdio:"pipe",encoding:"utf-8"}).trim();try{return co("launchctl",["kickstart","-k",`gui/${s}/${n}`],{stdio:"pipe"}),Df.info("Hive service restarted",{label:n}),!0}catch(i){return Df.warn("Failed to restart hive service",{label:n,error:String(i)}),!1}}var Df,Rf=T(()=>{"use strict";Ks();ie();Df=D("hive-restart")});import{readFileSync as xS}from"node:fs";import{resolve as qf}from"node:path";function BS(){let t=[qf(import.meta.dirname,"..","..","package.json"),qf(import.meta.dirname,"..","package.json")];for(let e of t)try{let n=JSON.parse(xS(e,"utf-8"));if(n?.name==="@keepur/hive"&&typeof n.hiveApi=="string")return n.hiveApi}catch{continue}return null}var KS,xf,Bs,fo=T(()=>{"use strict";ie();KS=D("api-version");xf=BS();xf||KS.warn("Could not read hiveApi from package.json; falling back to 1.0.0");Bs=xf??"1.0.0"});var Kf=T(()=>{"use strict"});function Bf(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 FS.warn("Unrecognized hiveApi range syntax, accepting",{range:t}),!0}var US,FS,Uf=T(()=>{"use strict";US=oe(ce(),1);ie();Kf();fo();FS=D("plugin-loader")});var jf={};Y(jf,{runPlugin:()=>HS});import{execFileSync as Us}from"node:child_process";import{existsSync as bt,mkdirSync as jS,readFileSync as ho}from"node:fs";import{resolve as yn,join as Fs}from"node:path";function Ff(t,e){let n=Fs(t,"..","package.json");if(bt(n))try{let i=JSON.parse(ho(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 HS(t,e){switch(t){case"add":return YS(e);case"remove":return GS(e);case"list":return VS();default:console.error("Usage: hive plugin <add|list|remove> [package]"),process.exit(1)}}function YS(t){t||(console.error("Usage: hive plugin add <package-name>"),process.exit(1)),jS(pe,{recursive:!0});let e=yn(pe,"package.json");bt(e)||Us("npm",["init","-y"],{cwd:pe,stdio:"pipe"}),console.log(`Installing ${t}...`);try{Us("npm",["install",t],{cwd:pe,stdio:"pipe"})}catch(u){console.error(`Failed to install ${t}: ${String(u)}`),process.exit(1)}let n=yn(pe,"node_modules",t),s=Fs(n,"plugin.yaml");bt(s)||(console.error(`Not a valid hive plugin \u2014 no plugin.yaml found in ${t}.`),po(t),process.exit(1));let i=(0,mo.parse)(ho(s,"utf-8")),r=i?.hiveApi??i?.["hive-api"];r&&!Bf(r,Bs)&&(console.error(`Plugin requires hiveApi ${r} but this hive is ${Bs}.`),po(t),process.exit(1));let o=Ff(s,i),a=Re(),l=de(a);if(l.plugins||(l.plugins=[]),!l.plugins.includes(t)){l.plugins.push(t);try{wt(l,a)}catch(u){console.error(`Failed to update hive.yaml: ${String(u)}`),po(t),process.exit(1)}console.log("\u2713 Updated hive.yaml")}let c=uo();console.log(c?"\u2713 Restarting hive... done":"Start hive to activate the plugin."),console.log(`\u2713 Installed ${t} (v${o}${r?`, hiveApi ${r}`:""})`)}function GS(t){t||(console.error("Usage: hive plugin remove <package-name>"),process.exit(1)),bt(pe)||(console.error("No plugins directory found."),process.exit(1)),console.log(`Removing ${t}...`);try{Us("npm",["uninstall",t],{cwd:pe,stdio:"pipe"})}catch(i){console.error(`Failed to uninstall ${t}: ${String(i)}`),process.exit(1)}let e=Re(),n=de(e);if(Array.isArray(n.plugins)){let i=n.plugins.indexOf(t);i>=0&&(n.plugins.splice(i,1),wt(n,e),console.log("\u2713 Updated hive.yaml"))}let s=uo();console.log(s?"\u2713 Restarting hive... done":"Restart hive to complete removal."),console.log(`Removed ${t}`)}function VS(){let t=Re(),n=de(t).plugins??[];if(n.length===0){console.log("No plugins configured in hive.yaml.");return}console.log(`Installed plugins:
247
+ `);for(let s of n){let i=yn(pe,"node_modules",s),r=yn(pe,s),o=Fs(i,"plugin.yaml"),a=Fs(r,"plugin.yaml"),l=null,c=!1;if(bt(o)?l=o:bt(a)&&(l=a,c=!0),!l){console.log(` ${s} \u26A0 not found on disk`);continue}try{let u=(0,mo.parse)(ho(l,"utf-8")),f=Ff(l,u),d=u?.hiveApi??u?.["hive-api"]??"",p=c?" [in-tree]":"";console.log(` ${s} v${f}${d?` (hiveApi ${d})`:""}${p}`)}catch{console.log(` ${s} \u26A0 failed to read plugin.yaml`)}}}function po(t){try{Us("npm",["uninstall",t],{cwd:pe,stdio:"pipe"})}catch{}}var mo,pe,Hf=T(()=>{"use strict";mo=oe(ce(),1);Q();Ks();Rf();fo();Uf();pe=yn(L,"plugins")});function Yf(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 Gf(t,e){if(t.inlineUrl){let i=WS(t.inlineUrl);return go.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 go.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 go.debug("resolved default registry",{registryName:s.name,url:s.url}),{name:s.name,url:s.url}}function WS(t){try{return t.replace(/\.git$/,"").split("/").filter(Boolean).slice(-2).join("-")}catch{return"inline"}}var go,Vf=T(()=>{"use strict";ie();go=D("registry-resolver")});var Jf={};Y(Jf,{runSkill:()=>zS});import{existsSync as we,readdirSync as kt,readFileSync as JS,statSync as QS}from"node:fs";import{join as qe}from"node:path";import{createInterface as Wf}from"node:readline";async function zS(t,...e){switch(t){case"add":{mt();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(()=>(ht(),pt)),i=Yf(n),r=Gf(i,s.skillRegistries),o=$s(r.url,i.name,G,L);console.log(`Installed ${o.workflow}/${o.name} (${o.version.slice(0,8)})`);break}case"list":{e.includes("--available")?(mt(),await ev(e)):ZS();break}case"upgrade":{mt();let n=e[0];n||(console.error("Usage: hive skill upgrade <name|--all>"),process.exit(1));let s=async(i,r,o)=>{console.log(`
246
248
  --- Your version (installed) ---`),console.log(i.slice(0,500)+(i.length>500?`
247
249
  ...`:"")),console.log(`
248
250
  --- Upstream version (registry) ---`),console.log(r.slice(0,500)+(r.length>500?`
249
251
  ...`:"")),console.log(o?`
250
252
  (Three-way diff available)`:`
251
- (Two-way comparison \u2014 base version unreachable)`);let a=Hf({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`
252
- [k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await XS(s);else{let i=await mn(n,G,$,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 Ds(n,G,$,{force:s,confirmFn:async o=>{let a=Hf({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)),zS(n);break}case"sync":{mt();let{config:n}=await Promise.resolve().then(()=>(ht(),pt));n.operatorSkillsRepo||(console.error("No operatorSkillsRepo configured in hive.yaml. Set:"),console.error(""),console.error(" operatorSkillsRepo:"),console.error(" url: https://github.com/<operator>/<repo>"),console.error(""),process.exit(1));let s=process.argv.includes("--dry-run"),i=process.argv.includes("--prune"),r=await no(n.operatorSkillsRepo.url,$,{dryRun:s,prune:i});WS(r,{dryRun:s,prune:i}),r.errors.length>0&&process.exit(1);break}default:console.error(`Usage: hive skill <add|list|upgrade|remove|search|sync> [args]
253
+ (Two-way comparison \u2014 base version unreachable)`);let a=Wf({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`
254
+ [k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await nv(s);else{let i=await mn(n,G,L,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 Ds(n,G,L,{force:s,confirmFn:async o=>{let a=Wf({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)),tv(n);break}case"sync":{mt();let{config:n}=await Promise.resolve().then(()=>(ht(),pt));n.operatorSkillsRepo||(console.error("No operatorSkillsRepo configured in hive.yaml. Set:"),console.error(""),console.error(" operatorSkillsRepo:"),console.error(" url: https://github.com/<operator>/<repo>"),console.error(""),process.exit(1));let s=process.argv.includes("--dry-run"),i=process.argv.includes("--prune"),r=await no(n.operatorSkillsRepo.url,L,{dryRun:s,prune:i});XS(r,{dryRun:s,prune:i}),r.errors.length>0&&process.exit(1);break}default:console.error(`Usage: hive skill <add|list|upgrade|remove|search|sync> [args]
253
255
 
254
256
  sync [--dry-run] [--prune]
255
257
  Sync customer-space skills with the configured operatorSkillsRepo.
256
258
  Installs missing, upgrades stale, leaves customer-modified alone.
257
259
  --dry-run: report changes without applying.
258
260
  --prune: remove customer-space skills sourced from this repo
259
- but no longer present in it.`),process.exit(1)}}function WS(t,e){let n=e.dryRun?"(dry-run) ":"";if(console.log(`${n}Sync result @ ${t.headSha.slice(0,8)}:`),t.installed.length&&console.log(` installed (${t.installed.length}): ${t.installed.join(", ")}`),t.upgraded.length&&console.log(` upgraded (${t.upgraded.length}): ${t.upgraded.join(", ")}`),t.upToDate.length&&console.log(` up to date: ${t.upToDate.length}`),t.modifiedSkipped.length&&console.log(` customer-modified (skipped): ${t.modifiedSkipped.join(", ")}`),t.orphaned.length&&(console.log(` orphaned (${t.orphaned.length}): ${t.orphaned.join(", ")}`),e.prune||console.log(" re-run with --prune to remove orphans")),t.pruned.length&&console.log(` pruned: ${t.pruned.join(", ")}`),t.errors.length){console.log(` errors (${t.errors.length}):`);for(let s of t.errors)console.log(` ${s.skill}: ${s.error}`)}}function JS(){if(!we(G)){console.log("No skills installed.");return}let t=kt(G).filter(e=>{try{return GS(Re(G,e)).isDirectory()}catch{return!1}});if(t.length===0){console.log("No skills installed.");return}console.log(`Installed skills:
260
- `);for(let e of t.sort()){let n=Re(G,e,"skills");if(we(n))for(let s of kt(n).sort()){let i=Re(n,s,"SKILL.md");if(we(i))try{let{frontmatter:r}=ee(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 QS(t){let{shallowClone:e,listSkillsInClone:n}=await Promise.resolve().then(()=>(yt(),Eu)),{config:s}=await Promise.resolve().then(()=>(ht(),pt)),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(`
261
+ but no longer present in it.`),process.exit(1)}}function XS(t,e){let n=e.dryRun?"(dry-run) ":"";if(console.log(`${n}Sync result @ ${t.headSha.slice(0,8)}:`),t.installed.length&&console.log(` installed (${t.installed.length}): ${t.installed.join(", ")}`),t.upgraded.length&&console.log(` upgraded (${t.upgraded.length}): ${t.upgraded.join(", ")}`),t.upToDate.length&&console.log(` up to date: ${t.upToDate.length}`),t.modifiedSkipped.length&&console.log(` customer-modified (skipped): ${t.modifiedSkipped.join(", ")}`),t.orphaned.length&&(console.log(` orphaned (${t.orphaned.length}): ${t.orphaned.join(", ")}`),e.prune||console.log(" re-run with --prune to remove orphans")),t.pruned.length&&console.log(` pruned: ${t.pruned.join(", ")}`),t.errors.length){console.log(` errors (${t.errors.length}):`);for(let s of t.errors)console.log(` ${s.skill}: ${s.error}`)}}function ZS(){if(!we(G)){console.log("No skills installed.");return}let t=kt(G).filter(e=>{try{return QS(qe(G,e)).isDirectory()}catch{return!1}});if(t.length===0){console.log("No skills installed.");return}console.log(`Installed skills:
262
+ `);for(let e of t.sort()){let n=qe(G,e,"skills");if(we(n))for(let s of kt(n).sort()){let i=qe(n,s,"SKILL.md");if(we(i))try{let{frontmatter:r}=ee(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 ev(t){let{shallowClone:e,listSkillsInClone:n}=await Promise.resolve().then(()=>(yt(),Iu)),{config:s}=await Promise.resolve().then(()=>(ht(),pt)),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(`
261
263
  Registry: ${a.name} (${a.url})
262
- `);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let u of c.sort()){let f=Re(l.dir,"skills",u,"SKILL.md"),y=YS(f,"utf-8").match(/^description:\s*(.+)$/m)?.[1]?.trim()??"";console.log(` ${u.padEnd(30)} ${y}`)}}finally{l.cleanup()}}}function zS(t){let e=t.toLowerCase(),n=!1;if(we(G))for(let s of kt(G)){let i=Re(G,s,"skills");if(we(i))for(let r of kt(i)){let o=Re(i,r,"SKILL.md");if(we(o))try{let{frontmatter:a}=ee(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 XS(t){if(!we(G)){console.log("No skills installed.");return}let e=[];for(let n of kt(G)){let s=Re(G,n,"skills");if(we(s))for(let i of kt(s).sort()){let r=Re(s,i,"SKILL.md");if(we(r))try{let{frontmatter:o}=ee(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 mn(n,G,$,t);console.log(`${s.name}: ${s.action}`)}catch(s){console.error(`${n}: failed \u2014 ${String(s)}`)}}var Gf=O(()=>{"use strict";yt();jf();Jr();Ms();eo();so();Je();Q()});var Vf={};Y(Vf,{runRegistry:()=>ZS});async function ZS(t,...e){let n=qe();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]:ev(s),o=e.includes("--default"),a=de(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}:{}}),wt(a,n),console.log(`Added registry "${r}" (${s})${o?" [default]":""}`);break}case"list":{let i=de(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:
263
- `);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=de(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),wt(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 ev(t){return t.replace(/\.git$/,"").replace(/\/$/,"").split("/").filter(Boolean).slice(-2).join("-").replace(/^github\.com-/,"")}var Wf=O(()=>{"use strict";Ks()});var zf={};Y(zf,{defaultCliIO:()=>Qf,runCredentialsCommand:()=>nv});import{execFileSync as yo}from"node:child_process";import{createInterface as tv}from"node:readline";function Qf(){let t=tv({input:process.stdin,output:process.stdout});return{ask:e=>new Promise(n=>t.question(`${e}: `,s=>n(s.trim()))),log:e=>console.log(e),setSecret:(e,n)=>yo("honeypot",["set",e,n],{stdio:["pipe","pipe","pipe"]}),removeSecret:e=>yo("honeypot",["rm",e],{stdio:["pipe","pipe","pipe"]}),hasSecret:e=>{try{return yo("honeypot",["get",e],{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}},close:()=>t.close()}}async function nv(t,e,n=Qf()){try{switch(t){case void 0:case"list":case"ls":return sv(n);case"add":return await iv(e[0],n);case"remove":case"rm":case"delete":return rv(e[0],n);case"help":case"--help":case"-h":return Jf(n);default:return n.log(`Unknown subcommand: ${t}`),Jf(n)}}finally{n.close?.()}}function Jf(t){return t.log("Usage:"),t.log(" hive credentials list Show curated keys and which are set"),t.log(" hive credentials add <KEY> Set or rotate a credential"),t.log(" hive credentials remove <KEY> Delete a credential"),t.log(""),t.log("Credentials are stored in macOS Keychain under hive/<instanceId>/<KEY>."),0}function sv(t){t.log("Third-party credentials (curated registry):"),t.log("");for(let e of nn){if(e.kind==="oauth"){t.log(` -- ${e.server.padEnd(20)} oauth \u2014 ${e.helpUrl}`);continue}for(let n of e.fields){let i=t.hasSecret(n.key)?"ok":"--";t.log(` ${i} ${n.key.padEnd(24)} (${e.server})`)}}return t.log(""),t.log("Add or rotate: hive credentials add <KEY>"),t.log("Remove: hive credentials remove <KEY>"),0}async function iv(t,e){if(!t)return e.log("Usage: hive credentials add <KEY>"),1;let n=wc(t);if(!n)return e.log(`Unknown key: ${t}.`),e.log("Run `hive credentials list` to see known keys."),1;if(n.kind==="oauth")return e.log(`${n.server} uses OAuth, not a static API key.`),n.oauthInstructions&&e.log(n.oauthInstructions),1;let s=n.fields.find(r=>r.key===t);e.log(`${n.title} \u2014 ${n.description}`),e.log(`Get a key: ${n.helpUrl}`);let i=await e.ask(s.label);if(!i)return e.log("Empty value \u2014 aborting."),1;try{e.setSecret(t,i)}catch(r){return e.log(`Failed to store ${t}: ${r instanceof Error?r.message:String(r)}`),1}return e.log(`\u2713 ${t} stored in Honeypot.`),0}function rv(t,e){if(!t)return e.log("Usage: hive credentials remove <KEY>"),1;if(!e.hasSecret(t))return e.log(`${t} is not set \u2014 nothing to remove.`),1;try{e.removeSecret(t)}catch(n){return e.log(`Failed to remove ${t}: ${n instanceof Error?n.message:String(n)}`),1}return e.log(`- ${t} removed from Honeypot.`),0}var Xf=O(()=>{"use strict";Lr()});import{parseArgs as ov}from"node:util";import{dirname as av,resolve as X,join as Ys}from"node:path";import{existsSync as Qe,readFileSync as lv,statSync as cv,readdirSync as uv}from"node:fs";function ed(){if(process.env.HIVE_HOME)return X(process.env.HIVE_HOME);let t=X(process.cwd());for(;;){if(Qe(X(t,"hive.yaml")))return t;let e=av(t);if(e===t)break;t=e}return X(process.env.HOME??"/tmp","hive")}function fv(){let t=ed();if(Qe(Ys(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=X(n,"services","hive"),i=[];if(Qe(s))try{for(let r of uv(s)){let o=Ys(s,r,"hive.yaml");Qe(o)&&i.push(Ys(s,r))}}catch{}i.length>0&&(e.push(""),e.push(`Available installs: ${i.join(", ")}`)),console.error(e.join(`
264
- `)),process.exit(1)}var{positionals:he,values:re}=ov({allowPositionals:!0,strict:!1,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=he[0];function vo(t,e){if(typeof e=="string")return e;let n=process.argv.slice(2);for(let s=0;s<n.length;s+=1){let i=n[s];if(i===`--${t}`){let r=n[s+1];return r&&!r.startsWith("--")?r:void 0}if(i?.startsWith(`--${t}=`))return i.slice(t.length+3)}}function dv(t,e){return e?!0:process.argv.slice(2).includes(`--${t}`)}var Zf=vo("config",typeof re.config=="string"?re.config:void 0),pv=vo("tag",typeof re.tag=="string"?re.tag:void 0),js=vo("instance",typeof re.instance=="string"?re.instance:void 0),hv=dv("verbose",typeof re.verbose=="boolean"?re.verbose:void 0);if(re.version){let t=JSON.parse(lv(X(import.meta.dirname,"..","package.json"),"utf-8"));console.log(`hive v${t.version}`),process.exit(0)}(re.help||!So)&&(console.log(`
264
+ `);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let u of c.sort()){let f=qe(l.dir,"skills",u,"SKILL.md"),y=JS(f,"utf-8").match(/^description:\s*(.+)$/m)?.[1]?.trim()??"";console.log(` ${u.padEnd(30)} ${y}`)}}finally{l.cleanup()}}}function tv(t){let e=t.toLowerCase(),n=!1;if(we(G))for(let s of kt(G)){let i=qe(G,s,"skills");if(we(i))for(let r of kt(i)){let o=qe(i,r,"SKILL.md");if(we(o))try{let{frontmatter:a}=ee(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 nv(t){if(!we(G)){console.log("No skills installed.");return}let e=[];for(let n of kt(G)){let s=qe(G,n,"skills");if(we(s))for(let i of kt(s).sort()){let r=qe(s,i,"SKILL.md");if(we(r))try{let{frontmatter:o}=ee(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 mn(n,G,L,t);console.log(`${s.name}: ${s.action}`)}catch(s){console.error(`${n}: failed \u2014 ${String(s)}`)}}var Qf=T(()=>{"use strict";yt();Vf();Jr();Ps();eo();so();Je();Q()});var zf={};Y(zf,{runRegistry:()=>sv});async function sv(t,...e){let n=Re();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]:iv(s),o=e.includes("--default"),a=de(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}:{}}),wt(a,n),console.log(`Added registry "${r}" (${s})${o?" [default]":""}`);break}case"list":{let i=de(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:
265
+ `);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=de(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),wt(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 iv(t){return t.replace(/\.git$/,"").replace(/\/$/,"").split("/").filter(Boolean).slice(-2).join("-").replace(/^github\.com-/,"")}var Xf=T(()=>{"use strict";Ks()});var td={};Y(td,{defaultCliIO:()=>ed,runCredentialsCommand:()=>ov});import{execFileSync as yo}from"node:child_process";import{createInterface as rv}from"node:readline";function ed(){let t=rv({input:process.stdin,output:process.stdout});return{ask:e=>new Promise(n=>t.question(`${e}: `,s=>n(s.trim()))),log:e=>console.log(e),setSecret:(e,n)=>yo("honeypot",["set",e,n],{stdio:["pipe","pipe","pipe"]}),removeSecret:e=>yo("honeypot",["rm",e],{stdio:["pipe","pipe","pipe"]}),hasSecret:e=>{try{return yo("honeypot",["get",e],{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}},close:()=>t.close()}}async function ov(t,e,n=ed()){try{switch(t){case void 0:case"list":case"ls":return av(n);case"add":return await lv(e[0],n);case"remove":case"rm":case"delete":return cv(e[0],n);case"help":case"--help":case"-h":return Zf(n);default:return n.log(`Unknown subcommand: ${t}`),Zf(n)}}finally{n.close?.()}}function Zf(t){return t.log("Usage:"),t.log(" hive credentials list Show curated keys and which are set"),t.log(" hive credentials add <KEY> Set or rotate a credential"),t.log(" hive credentials remove <KEY> Delete a credential"),t.log(""),t.log("Credentials are stored in macOS Keychain under hive/<instanceId>/<KEY>."),0}function av(t){t.log("Third-party credentials (curated registry):"),t.log("");for(let e of nn){if(e.kind==="oauth"){t.log(` -- ${e.server.padEnd(20)} oauth \u2014 ${e.helpUrl}`);continue}for(let n of e.fields){let i=t.hasSecret(n.key)?"ok":"--";t.log(` ${i} ${n.key.padEnd(24)} (${e.server})`)}}return t.log(""),t.log("Add or rotate: hive credentials add <KEY>"),t.log("Remove: hive credentials remove <KEY>"),0}async function lv(t,e){if(!t)return e.log("Usage: hive credentials add <KEY>"),1;let n=wc(t);if(!n)return e.log(`Unknown key: ${t}.`),e.log("Run `hive credentials list` to see known keys."),1;if(n.kind==="oauth")return e.log(`${n.server} uses OAuth, not a static API key.`),n.oauthInstructions&&e.log(n.oauthInstructions),1;let s=n.fields.find(r=>r.key===t);e.log(`${n.title} \u2014 ${n.description}`),e.log(`Get a key: ${n.helpUrl}`);let i=await e.ask(s.label);if(!i)return e.log("Empty value \u2014 aborting."),1;try{e.setSecret(t,i)}catch(r){return e.log(`Failed to store ${t}: ${r instanceof Error?r.message:String(r)}`),1}return e.log(`\u2713 ${t} stored in Honeypot.`),0}function cv(t,e){if(!t)return e.log("Usage: hive credentials remove <KEY>"),1;if(!e.hasSecret(t))return e.log(`${t} is not set \u2014 nothing to remove.`),1;try{e.removeSecret(t)}catch(n){return e.log(`Failed to remove ${t}: ${n instanceof Error?n.message:String(n)}`),1}return e.log(`- ${t} removed from Honeypot.`),0}var nd=T(()=>{"use strict";$r()});import{parseArgs as uv}from"node:util";import{dirname as fv,resolve as X,join as Ys}from"node:path";import{existsSync as Qe,readFileSync as dv,statSync as pv,readdirSync as hv}from"node:fs";function id(){if(process.env.HIVE_HOME)return X(process.env.HIVE_HOME);let t=X(process.cwd());for(;;){if(Qe(X(t,"hive.yaml")))return t;let e=fv(t);if(e===t)break;t=e}return X(process.env.HOME??"/tmp","hive")}function mv(){let t=id();if(Qe(Ys(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=X(n,"services","hive"),i=[];if(Qe(s))try{for(let r of hv(s)){let o=Ys(s,r,"hive.yaml");Qe(o)&&i.push(Ys(s,r))}}catch{}i.length>0&&(e.push(""),e.push(`Available installs: ${i.join(", ")}`)),console.error(e.join(`
266
+ `)),process.exit(1)}var{positionals:he,values:re}=uv({allowPositionals:!0,strict:!1,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=he[0];function vo(t,e){if(typeof e=="string")return e;let n=process.argv.slice(2);for(let s=0;s<n.length;s+=1){let i=n[s];if(i===`--${t}`){let r=n[s+1];return r&&!r.startsWith("--")?r:void 0}if(i?.startsWith(`--${t}=`))return i.slice(t.length+3)}}function gv(t,e){return e?!0:process.argv.slice(2).includes(`--${t}`)}var sd=vo("config",typeof re.config=="string"?re.config:void 0),yv=vo("tag",typeof re.tag=="string"?re.tag:void 0),js=vo("instance",typeof re.instance=="string"?re.instance:void 0),Sv=gv("verbose",typeof re.verbose=="boolean"?re.verbose:void 0);if(re.version){let t=JSON.parse(dv(X(import.meta.dirname,"..","package.json"),"utf-8"));console.log(`hive v${t.version}`),process.exit(0)}(re.help||!So)&&(console.log(`
265
267
  hive \u2014 AI agent platform
266
268
 
267
269
  Usage:
@@ -297,4 +299,4 @@ Options:
297
299
  --config <path> Path to hive.yaml
298
300
  -v, --version Show version
299
301
  -h, --help Show this help
300
- `),process.exit(0));var Hs=X(import.meta.dirname,"..");if(typeof Zf=="string"){let t=X(Zf);if(Qe(t)){let e=cv(t);process.env.HIVE_HOME=e.isDirectory()?t:X(t,"..")}else console.error(`Config not found: ${t}`),process.exit(1)}function mv(t){let e=process.env.HOME??"/tmp",n=X(e,"services","hive",t);return Qe(Ys(n,"hive.yaml"))?n:null}switch(So){case"init":{let{runSetupWizard:t}=await Promise.resolve().then(()=>(Jc(),Wc));await t(Hs);break}case"start":{let t=fv();if(re.daemon){let{startDaemon:e}=await Promise.resolve().then(()=>(Ss(),ys));await e(t)}else{let{execFileSync:e}=await import("node:child_process"),n=Qe(X(Hs,"pkg","server.min.js"))?X(Hs,"pkg","server.min.js"):X(Hs,"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(()=>(Ss(),ys));await t(ed());break}case"status":{let{showStatus:t}=await Promise.resolve().then(()=>(Zc(),Xc));await t();break}case"update":{let{runUpdate:t}=await Promise.resolve().then(()=>(Zu(),Xu));await t({tag:pv,instance:js});break}case"rollback":{let{runRollback:t}=await Promise.resolve().then(()=>(nf(),tf));await t({instance:js});break}case"migrate-0.2":{let t=he[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(()=>(of(),rf));await n({instanceDir:t,dryRun:e});break}case"doctor":{if(!process.env.HIVE_HOME&&typeof js=="string"){let e=mv(js);e&&(process.env.HIVE_HOME=e)}let{runDoctor:t}=await Promise.resolve().then(()=>(Cf(),Nf));await t({verbose:hv});break}case"plugin":{let t=he[1],e=he[2],{runPlugin:n}=await Promise.resolve().then(()=>(Bf(),Kf));await n(t,e);break}case"skill":{let t=he[1],e=he.slice(2),{runSkill:n}=await Promise.resolve().then(()=>(Gf(),Yf));await n(t,...e);break}case"registry":{let t=he[1],e=he.slice(2),{runRegistry:n}=await Promise.resolve().then(()=>(Wf(),Vf));await n(t,...e);break}case"credentials":{let t=he[1],e=he.slice(2),{runCredentialsCommand:n}=await Promise.resolve().then(()=>(Xf(),zf)),s=await n(t,e);process.exit(s);break}default:console.error(`Unknown command: ${So}`),console.error('Run "hive --help" for usage.'),process.exit(1)}
302
+ `),process.exit(0));var Hs=X(import.meta.dirname,"..");if(typeof sd=="string"){let t=X(sd);if(Qe(t)){let e=pv(t);process.env.HIVE_HOME=e.isDirectory()?t:X(t,"..")}else console.error(`Config not found: ${t}`),process.exit(1)}function vv(t){let e=process.env.HOME??"/tmp",n=X(e,"services","hive",t);return Qe(Ys(n,"hive.yaml"))?n:null}switch(So){case"init":{let{runSetupWizard:t}=await Promise.resolve().then(()=>(Jc(),Wc));await t(Hs);break}case"start":{let t=mv();if(re.daemon){let{startDaemon:e}=await Promise.resolve().then(()=>(Ss(),ys));await e(t)}else{let{execFileSync:e}=await import("node:child_process"),n=Qe(X(Hs,"pkg","server.min.js"))?X(Hs,"pkg","server.min.js"):X(Hs,"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(()=>(Ss(),ys));await t(id());break}case"status":{let{showStatus:t}=await Promise.resolve().then(()=>(Zc(),Xc));await t();break}case"update":{let{runUpdate:t}=await Promise.resolve().then(()=>(tf(),ef));await t({tag:yv,instance:js});break}case"rollback":{let{runRollback:t}=await Promise.resolve().then(()=>(rf(),sf));await t({instance:js});break}case"migrate-0.2":{let t=he[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(()=>(lf(),af));await n({instanceDir:t,dryRun:e});break}case"doctor":{if(!process.env.HIVE_HOME&&typeof js=="string"){let e=vv(js);e&&(process.env.HIVE_HOME=e)}let{runDoctor:t}=await Promise.resolve().then(()=>(Pf(),Mf));await t({verbose:Sv});break}case"plugin":{let t=he[1],e=he[2],{runPlugin:n}=await Promise.resolve().then(()=>(Hf(),jf));await n(t,e);break}case"skill":{let t=he[1],e=he.slice(2),{runSkill:n}=await Promise.resolve().then(()=>(Qf(),Jf));await n(t,...e);break}case"registry":{let t=he[1],e=he.slice(2),{runRegistry:n}=await Promise.resolve().then(()=>(Xf(),zf));await n(t,...e);break}case"credentials":{let t=he[1],e=he.slice(2),{runCredentialsCommand:n}=await Promise.resolve().then(()=>(nd(),td)),s=await n(t,e);process.exit(s);break}default:console.error(`Unknown command: ${So}`),console.error('Run "hive --help" for usage.'),process.exit(1)}