hablas-ai 1.3.5 → 1.3.6
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/dist/index.js +52 -52
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
`?"":(x>0?d:"")+g.trimEnd()).join(`
|
|
9
9
|
`)}};Xl.Help=ei});var ii=N(ri=>{var{InvalidArgumentError:sy}=Ln(),ni=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=iy(e);this.short=s.shortFlag,this.long=s.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,s)=>{if(!this.argChoices.includes(t))throw new sy(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,s):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return ry(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},si=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,s)=>{this.positiveOptions.has(s)&&this.dualOptions.add(s)})}valueFromOption(e,t){let s=t.attributeName();if(!this.dualOptions.has(s))return!0;let r=this.negativeOptions.get(s).presetArg,i=r!==void 0?r:!1;return t.negate===(i===e)}};function ry(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function iy(n){let e,t,s=n.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),t=s.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}ri.Option=ni;ri.DualOptions=si});var Zl=N(Ql=>{function oy(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let s=0;s<=n.length;s++)t[s]=[s];for(let s=0;s<=e.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let r=1;r<=n.length;r++){let i=1;n[r-1]===e[s-1]?i=0:i=1,t[r][s]=Math.min(t[r-1][s]+1,t[r][s-1]+1,t[r-1][s-1]+i),r>1&&s>1&&n[r-1]===e[s-2]&&n[r-2]===e[s-1]&&(t[r][s]=Math.min(t[r][s],t[r-2][s-2]+1))}return t[n.length][e.length]}function ay(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let s=[],r=3,i=.4;return e.forEach(o=>{if(o.length<=1)return;let a=oy(n,o),l=Math.max(n.length,o.length);(l-a)/l>i&&(a<r?(r=a,s=[o]):a===r&&s.push(o))}),s.sort((o,a)=>o.localeCompare(a)),t&&(s=s.map(o=>`--${o}`)),s.length>1?`
|
|
10
10
|
(Did you mean one of ${s.join(", ")}?)`:s.length===1?`
|
|
11
|
-
(Did you mean ${s[0]}?)`:""}Ql.suggestSimilar=ay});var rc=N(sc=>{var ly=require("node:events").EventEmitter,oi=require("node:child_process"),At=require("node:path"),ai=require("node:fs"),
|
|
11
|
+
(Did you mean ${s[0]}?)`:""}Ql.suggestSimilar=ay});var rc=N(sc=>{var ly=require("node:events").EventEmitter,oi=require("node:child_process"),At=require("node:path"),ai=require("node:fs"),fe=require("node:process"),{Argument:cy,humanReadableArgName:uy}=Cs(),{CommanderError:li}=Ln(),{Help:dy}=ti(),{Option:ec,DualOptions:fy}=ii(),{suggestSimilar:tc}=Zl(),ci=class n extends ly{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>fe.stdout.write(t),writeErr:t=>fe.stderr.write(t),getOutHelpWidth:()=>fe.stdout.isTTY?fe.stdout.columns:void 0,getErrHelpWidth:()=>fe.stderr.isTTY?fe.stderr.columns:void 0,outputError:(t,s)=>s(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,s){let r=t,i=s;typeof r=="object"&&r!==null&&(i=r,r=null),i=i||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return r&&(l.description(r),l._executableHandler=!0),i.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(i.noHelp||i.hidden),l._executableFile=i.executableFile||null,a&&l.arguments(a),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),r?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new dy,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
12
|
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new cy(e,t)}argument(e,t,s,r){let i=this.createArgument(e,t);return typeof s=="function"?i.default(r).argParser(s):i.default(s),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,s,r]=e.match(/([^ ]+) *(.*)/),i=t??"display help for command",o=this.createCommand(s);return o.helpOption(!1),r&&o.arguments(r),i&&o.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=o,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let s=["preSubcommand","preAction","postAction"];if(!s.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
-
Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new li(e,t,s)),
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=r=>[r.name()].concat(r.aliases()),s=t(e).find(r=>this._findCommand(r));if(s){let r=t(this._findCommand(s)).join("|"),i=t(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let r=(i,o,a)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let l=this.getOptionValue(s);i!==null&&e.parseArg?i=this._callParseArg(e,i,l,o):i!==null&&e.variadic&&(i=e._concatValue(i,l)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(s,i,a)};return this.on("option:"+t,i=>{let o=`error: option '${e.flags}' argument '${i}' is invalid.`;r(i,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,i=>{let o=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;r(i,o,"env")}),this}_optionEx(e,t,s,r,i){if(typeof t=="object"&&t instanceof ec)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof r=="function")o.default(i).argParser(r);else if(r instanceof RegExp){let a=r;r=(l,u)=>{let d=a.exec(l);return d?d[0]:u},o.default(i).argParser(r)}else o.default(r);return this.addOption(o)}option(e,t,s,r){return this._optionEx({},e,t,s,r)}requiredOption(e,t,s,r){return this._optionEx({mandatory:!0},e,t,s,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){
|
|
13
|
+
Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,s){this._exitCallback&&this._exitCallback(new li(e,t,s)),fe.exit(e)}action(e){let t=s=>{let r=this.registeredArguments.length,i=s.slice(0,r);return this._storeOptionsAsProperties?i[r]=this:i[r]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=t,this}createOption(e,t){return new ec(e,t)}_callParseArg(e,t,s,r){try{return e.parseArg(t,s)}catch(i){if(i.code==="commander.invalidArgument"){let o=`${r} ${i.message}`;this.error(o,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let s=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${s}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=r=>[r.name()].concat(r.aliases()),s=t(e).find(r=>this._findCommand(r));if(s){let r=t(this._findCommand(s)).join("|"),i=t(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),s=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(s,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(s,e.defaultValue,"default");let r=(i,o,a)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let l=this.getOptionValue(s);i!==null&&e.parseArg?i=this._callParseArg(e,i,l,o):i!==null&&e.variadic&&(i=e._concatValue(i,l)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(s,i,a)};return this.on("option:"+t,i=>{let o=`error: option '${e.flags}' argument '${i}' is invalid.`;r(i,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,i=>{let o=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;r(i,o,"env")}),this}_optionEx(e,t,s,r,i){if(typeof t=="object"&&t instanceof ec)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,s);if(o.makeOptionMandatory(!!e.mandatory),typeof r=="function")o.default(i).argParser(r);else if(r instanceof RegExp){let a=r;r=(l,u)=>{let d=a.exec(l);return d?d[0]:u},o.default(i).argParser(r)}else o.default(r);return this.addOption(o)}option(e,t,s,r){return this._optionEx({},e,t,s,r)}requiredOption(e,t,s,r){return this._optionEx({mandatory:!0},e,t,s,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,s){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(s=>{s.getOptionValueSource(e)!==void 0&&(t=s.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){fe.versions?.electron&&(t.from="electron");let r=fe.execArgv??[];(r.includes("-e")||r.includes("--eval")||r.includes("-p")||r.includes("--print"))&&(t.from="eval")}e===void 0&&(e=fe.argv),this.rawArgs=e.slice();let s;switch(t.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":fe.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;case"eval":s=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",s}parse(e,t){let s=this._prepareUserArgs(e,t);return this._parseCommand([],s),this}async parseAsync(e,t){let s=this._prepareUserArgs(e,t);return await this._parseCommand([],s),this}_executeSubCommand(e,t){t=t.slice();let s=!1,r=[".js",".ts",".tsx",".mjs",".cjs"];function i(d,f){let h=At.resolve(d,f);if(ai.existsSync(h))return h;if(r.includes(At.extname(f)))return;let m=r.find(p=>ai.existsSync(`${h}${p}`));if(m)return`${h}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let d;try{d=ai.realpathSync(this._scriptPath)}catch{d=this._scriptPath}a=At.resolve(At.dirname(d),a)}if(a){let d=i(a,o);if(!d&&!e._executableFile&&this._scriptPath){let f=At.basename(this._scriptPath,At.extname(this._scriptPath));f!==this._name&&(d=i(a,`${f}-${e._name}`))}o=d||o}s=r.includes(At.extname(o));let l;fe.platform!=="win32"?s?(t.unshift(o),t=nc(fe.execArgv).concat(t),l=oi.spawn(fe.argv[0],t,{stdio:"inherit"})):l=oi.spawn(o,t,{stdio:"inherit"}):(t.unshift(o),t=nc(fe.execArgv).concat(t),l=oi.spawn(fe.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{fe.on(f,()=>{l.killed===!1&&l.exitCode===null&&l.kill(f)})});let u=this._exitCallback;l.on("close",d=>{d=d??1,u?u(new li(d,"commander.executeSubCommandAsync","(close)")):fe.exit(d)}),l.on("error",d=>{if(d.code==="ENOENT"){let f=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",h=`'${o}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
-
- ${f}`;throw new Error(h)}else if(d.code==="EACCES")throw new Error(`'${o}' not executable`);if(!u)
|
|
17
|
+
- ${f}`;throw new Error(h)}else if(d.code==="EACCES")throw new Error(`'${o}' not executable`);if(!u)fe.exit(1);else{let f=new li(1,"commander.executeSubCommandAsync","(error)");f.nestedError=d,u(f)}}),this.runningCommand=l}_dispatchSubcommand(e,t,s){let r=this._findCommand(e);r||this.help({error:!0});let i;return i=this._chainOrCallSubCommandHook(i,r,"preSubcommand"),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(s));else return r._parseCommand(t,s)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(s,r,i)=>{let o=r;if(r!==null&&s.parseArg){let a=`error: command-argument value '${r}' is invalid for argument '${s.name()}'.`;o=this._callParseArg(s,r,i,a)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((s,r)=>{let i=s.defaultValue;s.variadic?r<this.args.length?(i=this.args.slice(r),s.parseArg&&(i=i.reduce((o,a)=>e(s,a,o),s.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],s.parseArg&&(i=e(s,i,s.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let s=e,r=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[t]!==void 0).forEach(i=>{i._lifeCycleHooks[t].forEach(o=>{r.push({hookedCommand:i,callback:o})})}),t==="postAction"&&r.reverse(),r.forEach(i=>{s=this._chainOrCall(s,()=>i.callback(i.hookedCommand,this))}),s}_chainOrCallSubCommandHook(e,t,s){let r=e;return this._lifeCycleHooks[s]!==void 0&&this._lifeCycleHooks[s].forEach(i=>{r=this._chainOrCall(r,()=>i(this,t))}),r}_parseCommand(e,t){let s=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(s.operands),t=s.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(s.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(i,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(s=>{let r=s.attributeName();return this.getOptionValue(r)===void 0?!1:this.getOptionValueSource(r)!=="default"});e.filter(s=>s.conflictsWith.length>0).forEach(s=>{let r=e.find(i=>s.conflictsWith.includes(i.attributeName()));r&&this._conflictingOption(s,r)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],s=[],r=t,i=e.slice();function o(l){return l.length>1&&l[0]==="-"}let a=null;for(;i.length;){let l=i.shift();if(l==="--"){r===s&&r.push(l),r.push(...i);break}if(a&&!o(l)){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let u=this._findOption(l);if(u){if(u.required){let d=i.shift();d===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,d)}else if(u.optional){let d=null;i.length>0&&!o(i[0])&&(d=i.shift()),this.emit(`option:${u.name()}`,d)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let u=this._findOption(`-${l[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,l.slice(2)):(this.emit(`option:${u.name()}`),i.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let u=l.indexOf("="),d=this._findOption(l.slice(0,u));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(u+1));continue}}if(o(l)&&(r=s),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&s.length===0){if(this._findCommand(l)){t.push(l),i.length>0&&s.push(...i);break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l),i.length>0&&t.push(...i);break}else if(this._defaultCommandName){s.push(l),i.length>0&&s.push(...i);break}}if(this._passThroughOptions){r.push(l),i.length>0&&r.push(...i);break}r.push(l)}return{operands:t,unknown:s}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let s=0;s<t;s++){let r=this.options[s].attributeName();e[r]=r===this._versionOptionName?this._version:this[r]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
18
18
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
19
19
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
20
|
-
`),this.outputHelp({error:!0}));let s=t||{},r=s.exitCode||1,i=s.code||"commander.error";this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in
|
|
21
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let r=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>uy(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=At.basename(e,At.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=r=>this._outputConfiguration.writeErr(r):s=r=>this._outputConfiguration.writeOut(r),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(i=>i.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let r=this.helpInformation(s);if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(i=>i.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=
|
|
20
|
+
`),this.outputHelp({error:!0}));let s=t||{},r=s.exitCode||1,i=s.code||"commander.error";this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in fe.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,fe.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new fy(this.options),t=s=>this.getOptionValue(s)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(s));this.options.filter(s=>s.implied!==void 0&&t(s.attributeName())&&e.valueFromOption(this.getOptionValue(s.attributeName()),s)).forEach(s=>{Object.keys(s.implied).filter(r=>!t(r)).forEach(r=>{this.setOptionValueWithSource(r,s.implied[r],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let s=o=>{let a=o.attributeName(),l=this.getOptionValue(a),u=this.options.find(f=>f.negate&&a===f.attributeName()),d=this.options.find(f=>!f.negate&&a===f.attributeName());return u&&(u.presetArg===void 0&&l===!1||u.presetArg!==void 0&&l===u.presetArg)?u:d||o},r=o=>{let a=s(o),l=a.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],i=this;do{let o=i.createHelp().visibleOptions(i).filter(a=>a.long).map(a=>a.long);r=r.concat(o),i=i.parent}while(i&&!i._enablePositionalOptions);t=tc(e,r)}let s=`error: unknown option '${e}'${t}`;this.error(s,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,s=t===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${s} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach(i=>{r.push(i.name()),i.alias()&&r.push(i.alias())}),t=tc(e,r)}let s=`error: unknown command '${e}'${t}`;this.error(s,{code:"commander.unknownCommand"})}version(e,t,s){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",s=s||"output the version number";let r=this.createOption(t,s);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let s=this.parent?._findCommand(e);if(s){let r=[s.name()].concat(s.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${r}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(s=>uy(s));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=At.basename(e,At.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},s;return t.error?s=r=>this._outputConfiguration.writeErr(r):s=r=>this._outputConfiguration.writeOut(r),t.write=e.write||s,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let s=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(i=>i.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let r=this.helpInformation(s);if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",s),this._getCommandAndAncestors().forEach(i=>i.emit("afterAllHelp",s))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=fe.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${s.join("', '")}'`);let r=`${e}Help`;return this.on(r,i=>{let o;typeof t=="function"?o=t({error:i.error,command:i.command}):o=t,o&&i.write(`${o}
|
|
23
23
|
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(r=>t.is(r))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function nc(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,s="127.0.0.1",r="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?t=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=i[1],/^\d+$/.test(i[3])?r=i[3]:s=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],s=i[3],r=i[4]),t&&r!=="0"?`${t}=${s}:${parseInt(r)+1}`:e})}sc.Command=ci});var lc=N(We=>{var{Argument:ic}=Cs(),{Command:ui}=rc(),{CommanderError:py,InvalidArgumentError:oc}=Ln(),{Help:hy}=ti(),{Option:ac}=ii();We.program=new ui;We.createCommand=n=>new ui(n);We.createOption=(n,e)=>new ac(n,e);We.createArgument=(n,e)=>new ic(n,e);We.Command=ui;We.Option=ac;We.Argument=ic;We.Help=hy;We.CommanderError=py;We.InvalidArgumentError=oc;We.InvalidOptionArgumentError=oc});var dc={};Ne(dc,{DEFAULT_CONFIG:()=>Fn,NVIDIA_PROVIDER:()=>Nt});var Fn,Nt,Nn=L(()=>{"use strict";Fn={model:"stepfun-ai/step-3.7-flash",ollamaHost:"http://localhost:11434",provider:"ollama",apiUrl:"",apiKey:"",contextBudget:32e3,streamingEnabled:!0,autoConfirmSafe:!0,autoMode:!1,workingDirectory:".",historySize:800,timeout:12e4,maxRetries:3,tools:{runCommand:{allowedCommands:[],blocklist:[],timeout:12e4}},ui:{theme:"dark",showTokenCount:!0,diffPreview:!0,compactMode:!1,dashboard:!1},cache:{enabled:!0,maxEntries:100,ttlMs:3e5},logging:{level:"info",file:!0},plugins:{enabled:!0,directory:"~/.hablas/plugins",marketplace:"https://registry.hablas.dev/plugins"},agents:{enabled:!0,orchestration:"auto",maxConcurrent:3},context:{astParsing:!0,projectGraph:!0,longTermMemory:!0,fileWatcher:!0},workspace:{frameworkDetection:!0,gitAwareness:!0,envParsing:!0,autoPush:!1},security:{scanOnCommit:!1,secretDetection:!0,dependencyAudit:!0},analytics:{enabled:!0,trackUsage:!0,weeklyReports:!1},collaboration:{enabled:!1,teamConfigPath:".hablas/team.json",sharedMemory:!1},team:{enabled:!1,user:"",key:""},api:{enabled:!1,port:8080,host:"0.0.0.0",apiKey:""},license:{tier:"free",key:""}},Nt={name:"NVIDIA",apiUrl:"https://integrate.api.nvidia.com/v1",defaultModel:"stepfun-ai/step-3.7-flash",models:["stepfun-ai/step-3.7-flash","nvidia/llama-3.1-nemotron-70b-instruct","nvidia/nemotron-4-340b-instruct","meta/llama-3.1-405b-instruct","meta/llama-3.1-70b-instruct","meta/llama-3.1-8b-instruct","mistralai/mixtral-8x22b-instruct-v0.1","mistralai/mistral-large-latest","google/gemma-2-27b-it","microsoft/phi-3-medium-128k-instruct","deepseek-ai/deepseek-coder-33b-instruct","nvidia/llama-3.1-nemotron-51b-instruct","qwen/qwen2.5-coder-32b-instruct"]}});var Es,fc=L(()=>{"use strict";Es=class{baseUrl;model;constructor(e){this.baseUrl=e.ollamaHost,this.model=e.model}setModel(e){this.model=e}getModel(){return this.model}async checkConnection(){try{return(await fetch(`${this.baseUrl}/api/tags`,{signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async listModels(){try{let e=await fetch(`${this.baseUrl}/api/tags`,{signal:AbortSignal.timeout(5e3)});return e.ok?((await e.json()).models||[]).map(s=>s.name):[]}catch{return[]}}async chatWithTools(e,t,s){let r={model:this.model,messages:e,stream:!1};t.length>0&&(r.tools=t);let i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)};s&&(i.signal=s);let o=await fetch(`${this.baseUrl}/api/chat`,i);if(!o.ok){let l=await o.text().catch(()=>"");throw new Error(`Ollama error: ${o.status} ${o.statusText} \u2014 ${l}`)}return await o.json()}async*streamChat(e,t){let s=await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:this.model,messages:e,stream:!0}),signal:t});if(!s.ok)throw new Error(`Ollama error: ${s.status} ${s.statusText}`);let r=s.body?.getReader();if(!r)throw new Error("No response body");let i=new TextDecoder,o="";for(;;){let{done:a,value:l}=await r.read();if(a)break;o+=i.decode(l,{stream:!0});let u=o.split(`
|
|
24
24
|
`);o=u.pop()||"";for(let d of u)if(d.trim())try{let f=JSON.parse(d);f.message?.content&&(yield f.message.content)}catch{}}}}});function mc(n){return n.map(e=>{if(e.role==="assistant"&&e.tool_calls&&e.tool_calls.length>0){let t=e.tool_calls.filter(s=>s?.function?.name);if(t.length>0)return{role:"assistant",content:e.content||null,tool_calls:t.map((s,r)=>({id:`call_${r}`,type:"function",function:{name:s.function?.name||"",arguments:JSON.stringify(s.function?.arguments||{})}}))}}return e.role==="tool"?{role:"tool",content:e.content,tool_call_id:"call_0"}:{role:e.role,content:e.content}})}function yy(n){return n.map(e=>({type:"function",function:e.function}))}function by(n){return n.filter(e=>e?.function?.name).map(e=>{let t={};try{t=JSON.parse(e.function?.arguments||"{}")}catch{t={_raw:e.function?.arguments}}return{function:{name:e.function?.name||"",arguments:t}}})}function gc(n){return new Promise(e=>setTimeout(e,n))}function yc(n,e){return!(n.name==="AbortError"||e&&e>=400&&e<500&&e!==429)}var pc,my,Ts,hc,gy,Gt,di=L(()=>{"use strict";pc=12e4,my=6e4,Ts=3,hc=1e3,gy=20;Gt=class{apiUrl;apiKey;model;constructor(e){this.apiUrl=e.apiUrl||"https://api.openai.com/v1",this.apiKey=e.apiKey,this.model=e.model}setModel(e){this.model=e}getModel(){return this.model}setApiUrl(e){this.apiUrl=e}getApiUrl(){return this.apiUrl}setApiKey(e){this.apiKey=e}async checkConnection(){try{let e=this.apiUrl.replace(/\/+$/,"")+"/models";return(await fetch(e,{headers:this.getHeaders(),signal:AbortSignal.timeout(15e3)})).ok}catch{return!1}}async listModels(){try{let e=[],t=!0,s,r=0;for(;t&&r<gy;){let i=this.apiUrl.replace(/\/+$/,"")+"/models",o=new URLSearchParams;s&&o.set("after",s),o.set("limit","1000");let a=o.toString();a&&(i+="?"+a);let l=await fetch(i,{headers:this.getHeaders(),signal:AbortSignal.timeout(my)});if(!l.ok)break;let u=await l.json();if(Array.isArray(u))e.push(...u.map(d=>d.id||d.name||d).filter(Boolean)),t=!1;else if(u.data&&Array.isArray(u.data)){let d=u.data.map(f=>f.id||f.name).filter(Boolean);e.push(...d),u.has_more&&d.length>0?(s=d[d.length-1],r++):t=!1}else u.models&&Array.isArray(u.models)&&e.push(...u.models.map(d=>d.name||d.id).filter(Boolean)),t=!1}return e.sort((i,o)=>i.localeCompare(o))}catch{return[]}}async chatWithTools(e,t,s){let r=this.apiUrl.replace(/\/+$/,"")+"/chat/completions",i={model:this.model,messages:mc(e)};t.length>0&&(i.tools=yy(t),i.tool_choice="auto");let o=null;for(let a=0;a<=Ts;a++)try{let l=new AbortController,u=setTimeout(()=>l.abort(),pc),d={method:"POST",headers:{"Content-Type":"application/json",...this.getHeaders()},body:JSON.stringify(i),signal:s||l.signal};try{let f=await fetch(r,d);if(clearTimeout(u),!f.ok){let g=await f.text().catch(()=>"");if(!yc(null,f.status))throw new Error(`API error: ${f.status} ${f.statusText} \u2014 ${g}`);if(o=new Error(`API error: ${f.status} ${f.statusText} \u2014 ${g}`),a<Ts){let x=hc*Math.pow(2,a);await gc(x);continue}throw o}let m=(await f.json()).choices?.[0];if(!m)throw new Error("API returned empty response");let p=m.message.tool_calls?by(m.message.tool_calls):void 0;return{message:{role:m.message.role||"assistant",content:m.message.content||"",tool_calls:p},done:!0,done_reason:m.finish_reason}}catch(f){if(clearTimeout(u),f.name==="AbortError"&&s?.aborted)throw f;if(yc(f)&&(o=f,a<Ts)){let h=hc*Math.pow(2,a);await gc(h);continue}throw f}}catch(l){if(l.name==="AbortError")throw l;if(o=l,a>=Ts)throw o}throw o||new Error("Request failed after retries")}async*streamChat(e,t){let s=this.apiUrl.replace(/\/+$/,"")+"/chat/completions",r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...this.getHeaders()},body:JSON.stringify({model:this.model,messages:mc(e),stream:!0}),signal:t||AbortSignal.timeout(pc)});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);let i=r.body?.getReader();if(!i)throw new Error("No response body");let o=new TextDecoder,a="";for(;;){let{done:l,value:u}=await i.read();if(l)break;a+=o.decode(u,{stream:!0});let d=a.split(`
|
|
@@ -99,8 +99,8 @@ Format:
|
|
|
99
99
|
- (removed features)
|
|
100
100
|
|
|
101
101
|
Only include sections that have entries. Generate ONLY the changelog markdown.`}function Iy(n){let e=[];return e.push(` Branch: ${n.branch}`),(n.ahead>0||n.behind>0)&&e.push(` Sync: \u2191${n.ahead} \u2193${n.behind}`),n.staged.length>0&&e.push(` Staged: ${n.staged.length} file(s)`),n.modified.length>0&&e.push(` Modified: ${n.modified.length} file(s)`),n.untracked.length>0&&e.push(` Untracked: ${n.untracked.length} file(s)`),e.join(`
|
|
102
|
-
`)}var Kc,qc,fn,pn=L(()=>{"use strict";Kc=require("child_process"),qc=require("util"),fn=(0,qc.promisify)(Kc.exec)});var Yc={};Ne(Yc,{detectFramework:()=>Wc,detectLanguage:()=>Vc,detectPackageManager:()=>Gc,formatWorkspaceInfo:()=>Ki,getGitBranch:()=>zc,scanWorkspace:()=>Us});function Wc(n){let e=
|
|
103
|
-
`)}var
|
|
102
|
+
`)}var Kc,qc,fn,pn=L(()=>{"use strict";Kc=require("child_process"),qc=require("util"),fn=(0,qc.promisify)(Kc.exec)});var Yc={};Ne(Yc,{detectFramework:()=>Wc,detectLanguage:()=>Vc,detectPackageManager:()=>Gc,formatWorkspaceInfo:()=>Ki,getGitBranch:()=>zc,scanWorkspace:()=>Us});function Wc(n){let e=X.join(n,"package.json");if(z.existsSync(e))try{let t=JSON.parse(z.readFileSync(e,"utf-8")),s={...t.dependencies,...t.devDependencies};if(s.next)return"next";if(s.nuxt)return"nuxt";if(s["@angular/core"])return"angular";if(s.svelte||s["@sveltejs/kit"])return"svelte";if(s.vue)return"vue";if(s.react)return"react";if(s["@nestjs/core"])return"nest";if(s.fastify)return"fastify";if(s.express)return"express"}catch{}if(z.existsSync(X.join(n,"requirements.txt"))||z.existsSync(X.join(n,"pyproject.toml")))try{let t=z.existsSync(X.join(n,"requirements.txt"))?z.readFileSync(X.join(n,"requirements.txt"),"utf-8"):"";if(t.includes("django"))return"django";if(t.includes("flask"))return"flask";if(t.includes("fastapi"))return"fastapi"}catch{}if(z.existsSync(X.join(n,"Cargo.toml")))try{if(z.readFileSync(X.join(n,"Cargo.toml"),"utf-8").includes("actix"))return"rust-actix"}catch{}if(z.existsSync(X.join(n,"go.mod")))try{if(z.readFileSync(X.join(n,"go.mod"),"utf-8").includes("fiber"))return"go-fiber"}catch{}return"unknown"}function Gc(n){return z.existsSync(X.join(n,"pnpm-lock.yaml"))?"pnpm":z.existsSync(X.join(n,"yarn.lock"))?"yarn":z.existsSync(X.join(n,"bun.lockb"))?"bun":z.existsSync(X.join(n,"package-lock.json"))?"npm":z.existsSync(X.join(n,"Cargo.toml"))?"cargo":z.existsSync(X.join(n,"go.mod"))?"go":z.existsSync(X.join(n,"requirements.txt"))||z.existsSync(X.join(n,"pyproject.toml"))?"pip":"unknown"}function Vc(n){return z.existsSync(X.join(n,"tsconfig.json"))?"TypeScript":z.existsSync(X.join(n,"package.json"))?"JavaScript":z.existsSync(X.join(n,"Cargo.toml"))?"Rust":z.existsSync(X.join(n,"go.mod"))?"Go":z.existsSync(X.join(n,"pyproject.toml"))||z.existsSync(X.join(n,"requirements.txt"))?"Python":"Unknown"}function zc(n){let e=X.join(n,".git","HEAD");if(!z.existsSync(e))return null;try{let t=z.readFileSync(e,"utf-8").trim();return t.startsWith("ref: refs/heads/")?t.replace("ref: refs/heads/",""):t.substring(0,8)}catch{return null}}function Us(n){let e=Wc(n),t=Gc(n),s=Vc(n),r=zc(n),i=z.existsSync(X.join(n,"Dockerfile"))||z.existsSync(X.join(n,"docker-compose.yml"))||z.existsSync(X.join(n,"docker-compose.yaml")),o=z.existsSync(X.join(n,".github","workflows"))||z.existsSync(X.join(n,".gitlab-ci.yml"))||z.existsSync(X.join(n,"Jenkinsfile")),a=z.existsSync(X.join(n,"__tests__"))||z.existsSync(X.join(n,"tests"))||z.existsSync(X.join(n,"test"))||z.existsSync(X.join(n,"spec")),l=z.existsSync(X.join(n,".git")),u=[],d=[".env",".env.local",".env.development",".env.production",".env.example"];for(let g of d)z.existsSync(X.join(n,g))&&u.push(g);let f=[],h=["package.json","tsconfig.json","vite.config.ts","next.config.js","next.config.mjs","webpack.config.js","tailwind.config.ts","tailwind.config.js","eslint.config.js",".eslintrc.js",".prettierrc","Dockerfile","docker-compose.yml","Makefile"];for(let g of h)z.existsSync(X.join(n,g))&&f.push(g);let m=[],p=["src/index.ts","src/index.js","src/main.ts","src/main.js","src/app.ts","src/app.js","index.ts","index.js","main.py","app.py","manage.py","main.go","src/main.rs"];for(let g of p)z.existsSync(X.join(n,g))&&m.push(g);return{rootPath:n,framework:e,packageManager:t,language:s,hasDocker:i,hasCICD:o,hasTests:a,hasGit:l,gitBranch:r,envFiles:u,configFiles:f,entryPoints:m}}function Ki(n){let e=[` Project: ${X.basename(n.rootPath)}`,` Framework: ${n.framework}`,` Language: ${n.language}`,` Package: ${n.packageManager}`,` Git: ${n.hasGit?`\u2713 (${n.gitBranch||"detached"})`:"\u2717"}`,` Docker: ${n.hasDocker?"\u2713":"\u2717"}`,` CI/CD: ${n.hasCICD?"\u2713":"\u2717"}`,` Tests: ${n.hasTests?"\u2713":"\u2717"}`];return n.envFiles.length>0&&e.push(` Env files: ${n.envFiles.join(", ")}`),e.join(`
|
|
103
|
+
`)}var z,X,qi=L(()=>{"use strict";z=O(require("fs")),X=O(require("path"))});function Jc(){return`
|
|
104
104
|
## Available Tools (XML Format)
|
|
105
105
|
|
|
106
106
|
You can use tools by outputting XML tags in your response. The system will parse and execute them.
|
|
@@ -155,7 +155,7 @@ export function hello() {
|
|
|
155
155
|
3. Wait for tool results before using dependent tools.
|
|
156
156
|
4. Use exact file paths relative to the working directory.
|
|
157
157
|
5. Do NOT wrap tool tags in <tool_call > tags \u2014 use them directly.
|
|
158
|
-
`.trim()}var Xc=L(()=>{"use strict"});function Dy(){try{let n=eu.resolve(__dirname,"..","..","package.json");return JSON.parse(Zc.readFileSync(n,"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}function
|
|
158
|
+
`.trim()}var Xc=L(()=>{"use strict"});function Dy(){try{let n=eu.resolve(__dirname,"..","..","package.json");return JSON.parse(Zc.readFileSync(n,"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}function pe(n,e){return nu||!hn?n:`${e}${n}\x1B[0m`}function Ly(n){let e=He();if(!n)return c.border("\u2500".repeat(e));let t=n.replace(/\x1b\[[0-9;]*m/g,""),s=Math.max(0,e-t.length-2),r=Math.floor(s/2),i=s-r;return c.border("\u2500".repeat(r))+" "+n+" "+c.border("\u2500".repeat(i))}function Fy(n,e=2){let t=He()-e;if(t<=0)return" ".repeat(e)+n;let s=n.split(" "),r=[],i="";for(let o of s)(i+" "+o).trim().length>t&&i?(r.push(i.trim()),i=o):i+=(i?" ":"")+o;return i&&r.push(i.trim()),r.map(o=>" ".repeat(e)+o).join(`
|
|
159
159
|
`)}function Ny(n){let e=Math.max(...n.map(([t])=>t.length));return n.map(([t,s])=>` ${c.muted(t.padEnd(e))} ${s}`).join(`
|
|
160
160
|
`)}function jy(n){if(nu||!hn)return n;let e=["\x1B[38;5;111m","\x1B[38;5;111m","\x1B[38;5;141m","\x1B[38;5;141m","\x1B[38;5;117m","\x1B[38;5;117m"],t="";for(let s=0;s<n.length;s++){let r=Math.floor(s/n.length*e.length);t+=e[r]+n[s]}return t+"\x1B[0m"}function ru(n,e){let t=He(),s=e?e.replace(Vi.homedir(),"~"):"",r=c.border("\u2554"+"\u2550".repeat(t-2)+"\u2557"),i=c.border("\u2560"+"\u2550".repeat(t-2)+"\u2563"),o=c.border("\u255A"+"\u2550".repeat(t-2)+"\u255D"),a="H A B L A S A I",l="EXECUTIVE SYSTEM COORDINATOR",u="developed by abdulmoin hablas",d=Math.max(0,Math.floor((t-2-a.length)/2)),f=c.border("\u2551")+" ".repeat(d)+c.strong(a)+" ".repeat(t-2-a.length-d)+c.border("\u2551"),h=Math.max(0,Math.floor((t-2-l.length)/2)),m=c.border("\u2551")+" ".repeat(h)+c.secondary(l)+" ".repeat(t-2-l.length-h)+c.border("\u2551"),p=Math.max(0,Math.floor((t-2-u.length)/2)),g=c.border("\u2551")+" ".repeat(p)+c.muted(u)+" ".repeat(t-2-u.length-p)+c.border("\u2551"),x=c.muted(`SYSTEM VERSION: v${tu}`),w=c.warning(`CORE MODEL: ${n}`);return["",r,f,m,u?g:"",i,` ${c.muted("\u25B8")} ${x}`,` ${c.muted("\u25B8")} ${w}`,s?` ${c.muted("\u25B8")} ${c.muted(`WORKSPACE: ${s}`)}`:"",` ${c.chrome("\u251C"+"\u2500".repeat(t-2)+"\u2524")}`,` ${c.muted(" \u203A")} ${c.secondary("Type naturally to get started")}`,` ${c.muted(" \u203A")} ${c.secondary("/help for commands \xB7 Ctrl+C to cancel \xB7 Ctrl+C\xD72 to exit")}`,o,""].filter(Boolean).join(`
|
|
161
161
|
`)}function iu(){let n=He();return[` ${c.border("\u2554"+"\u2550".repeat(n-4)+"\u2557")}`,` ${c.border("\u2551")} ${c.leader("\u2605 Hablas")} ${c.muted("Leader")} ${c.border("\u2551")} ${c.product("\u25C6 Emma")} ${c.muted("Product")} ${c.border("\u2551")} ${c.architect("\u25C6 Bob")} ${c.muted("Architect")} ${c.border("\u2551")} ${c.engineer("\u25C6 Alex")} ${c.muted("Engineer")} ${c.border("\u2551")} ${c.analyst("\u25C6 David")} ${c.muted("Analyst")} ${c.border("\u2551")}`,` ${c.border("\u255A"+"\u2550".repeat(n-4)+"\u255D")}`].join(`
|
|
@@ -179,8 +179,8 @@ ${l}
|
|
|
179
179
|
`),t=[];for(let s of e)s.startsWith("+++")||s.startsWith("---")?t.push(` ${c.muted(s)}`):s.startsWith("+")?t.push(` ${c.added(s)}`):s.startsWith("-")?t.push(` ${c.removed(s)}`):s.startsWith("@@")?t.push(` ${c.hunk(s)}`):s.trim()&&t.push(` ${c.muted(s)}`);return t.join(`
|
|
180
180
|
`)}function fu(n){let e=new Date().toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}),t=`${c.accent("\u25C6")} ${c.strong(c.primary(`Turn #${n}`))} ${c.muted(`\xB7 ${e} \xB7`)}`;return`
|
|
181
181
|
`+Ly(t)+`
|
|
182
|
-
`}function
|
|
183
|
-
${c.warning("\u2192")} ${c.muted(e)}`}function
|
|
182
|
+
`}function ke(n){return` ${c.error("\u2717")} ${n}`}function Be(n,e){return` ${c.error("\u2717")} ${n}
|
|
183
|
+
${c.warning("\u2192")} ${c.muted(e)}`}function Y(n){return` ${c.success("\u2713")} ${n}`}function he(n){return` ${c.muted(n)}`}function j(n){return` ${c.warning("\u26A0")} ${n}`}function Hy(n,e){let s=Math.round(Math.min(n,e)/Math.max(e,1)*16),r=e>0?n/e:0;return(r>.85?c.error:r>.6?c.warning:c.success)("\u2588".repeat(s))+c.muted("\u2591".repeat(16-s))}function pu(n){let e=He(),t=n.connected?c.success("\u25CF connected"):c.error("\u25CB offline"),s=Hy(n.cacheTokens,n.budgetTokens),r=[["model",c.highlight(n.model)],["mindset",c.accent(n.mindset||"coder")],["host",c.muted(n.host)],["directory",c.muted(n.directory.replace(Vi.homedir(),"~"))],["context",`${s} ${c.muted(`${n.cacheFiles} files \xB7 ${n.cacheTokens}/${n.budgetTokens} tokens`)}`],["turns",c.muted(String(n.turnCount))],["status",t]];return`
|
|
184
184
|
`+c.chrome("\u256D"+"\u2500".repeat(e-2)+"\u256E")+`
|
|
185
185
|
${c.accent("\u2726")} ${c.strong("Status")}
|
|
186
186
|
|
|
@@ -200,7 +200,7 @@ ${l}
|
|
|
200
200
|
`}function Yi(n){let e=Math.floor(n.duration/6e4),t=Math.floor(n.duration%6e4/1e3),s=e>0?`${e}m ${t}s`:`${t}s`;return["",c.chrome("\u256D"+"\u2500".repeat(40)+"\u256E"),` ${c.accent("\u2726")} ${c.strong("Session Summary")}`,"",` ${c.muted("Turns")} ${c.secondary(String(n.turns))}`,` ${c.muted("Duration")} ${c.secondary(s)}`,` ${c.muted("Tool calls")} ${c.secondary(String(n.toolCalls))}`,"",c.chrome("\u2570"+"\u2500".repeat(40)+"\u256F"),"",` ${c.muted("Goodbye \u2014 hablas by Abdulmoin Hablas")}`,""].join(`
|
|
201
201
|
`)}function mu(n,e){let t=He(),s=[];s.push(""),s.push(` ${c.chrome("\u256D"+"\u2500".repeat(t-4)+"\u256E")}`),s.push(` ${c.chrome("\u2502")} ${c.leader("\u2605")} ${c.strong("Hablas")} ${c.muted("\u2014 Execution Plan")}${" ".repeat(Math.max(0,t-35))}${c.chrome("\u2502")}`);let r=20,i=Math.round(e.percent/100*r),o=r-i,a=c.success("\u2588".repeat(i))+c.muted("\u2591".repeat(o));s.push(` ${c.chrome("\u2502")} ${a} ${c.muted(`${e.percent}%`)} ${c.muted(`(${e.done}/${e.total} tasks)`)}`),s.push(` ${c.chrome("\u251C"+"\u2500".repeat(t-4)+"\u2524")}`);for(let l=0;l<n.tasks.length;l++){let u=n.tasks[l],d=Uy[u.status](By[u.status]),h=(u.assignee==="hablas"?c.leader:u.assignee==="bob"?c.architect:u.assignee==="alex"?c.engineer:u.assignee==="david"?c.analyst:u.assignee==="emma"?c.product:c.muted)(`@${u.assigneeName}`),m="";u.dependent_task_ids.length>0&&(m=c.muted(` \u2190 [${u.dependent_task_ids.join(", ")}]`));let p=c.secondary(u.description);s.push(` ${c.chrome("\u2502")} ${d} ${c.muted(`${u.task_id}.`)} ${h} ${c.muted("\u2192")} ${p}${m}`)}return s.push(` ${c.chrome("\u251C"+"\u2500".repeat(t-4)+"\u2524")}`),s.push(` ${c.chrome("\u2502")} ${c.muted("Strategy:")} ${c.highlight(n.strategy)} ${c.muted("\xB7")} ${c.muted(`${n.tasks.length} tasks`)}`),s.push(` ${c.chrome("\u2570"+"\u2500".repeat(t-4)+"\u256F")}`),s.push(""),s.join(`
|
|
202
202
|
`)}function gu(n){let e=He(),t=[];t.push(""),t.push(` ${c.chrome("\u256D"+"\u2500".repeat(e-4)+"\u256E")}`),t.push(` ${c.chrome("\u2502")} ${c.warning("?")} ${c.strong("Clarification Needed")}`),t.push(` ${c.chrome("\u251C"+"\u2500".repeat(e-4)+"\u2524")}`),t.push(` ${c.chrome("\u2502")} ${c.secondary(n.question)}`),t.push(` ${c.chrome("\u2502")}`);for(let s of n.choices)t.push(` ${c.chrome("\u2502")} ${c.accent(s.label+")")} ${c.secondary(s.value)}`);return n.context&&(t.push(` ${c.chrome("\u2502")}`),t.push(` ${c.chrome("\u2502")} ${c.muted(`Context: "${n.context.slice(0,60)}${n.context.length>60?"...":""}"`)}`)),t.push(` ${c.chrome("\u2570"+"\u2500".repeat(e-4)+"\u256F")}`),t.push(""),t.join(`
|
|
203
|
-
`)}var Vi,Zc,eu,tu,hn,nu,su,He,c,Ge,Gi,By,Uy,Ji,yn=L(()=>{"use strict";Vi=O(require("os")),Zc=O(require("fs")),eu=O(require("path"));tu=Dy(),hn=process.stdout.isTTY===!0,nu=process.env.NO_COLOR!==void 0||process.env.TERM==="dumb",su=process.stdout.columns||80;hn&&process.stdout.on("resize",()=>{su=process.stdout.columns||80});He=()=>Math.min(su-4,100);c={primary:n=>
|
|
203
|
+
`)}var Vi,Zc,eu,tu,hn,nu,su,He,c,Ge,Gi,By,Uy,Ji,yn=L(()=>{"use strict";Vi=O(require("os")),Zc=O(require("fs")),eu=O(require("path"));tu=Dy(),hn=process.stdout.isTTY===!0,nu=process.env.NO_COLOR!==void 0||process.env.TERM==="dumb",su=process.stdout.columns||80;hn&&process.stdout.on("resize",()=>{su=process.stdout.columns||80});He=()=>Math.min(su-4,100);c={primary:n=>pe(n,"\x1B[38;5;253m"),secondary:n=>pe(n,"\x1B[38;5;247m"),muted:n=>pe(n,"\x1B[38;5;242m"),strong:n=>pe(n,"\x1B[1;38;5;255m"),accent:n=>pe(n,"\x1B[38;5;145m"),highlight:n=>pe(n,"\x1B[38;5;231m"),success:n=>pe(n,"\x1B[38;5;108m"),error:n=>pe(n,"\x1B[38;5;167m"),warning:n=>pe(n,"\x1B[38;5;179m"),info:n=>pe(n,"\x1B[38;5;110m"),codeBlock:n=>pe(n,"\x1B[38;5;188m"),lineNum:n=>pe(n,"\x1B[38;5;239m"),border:n=>pe(n,"\x1B[38;5;237m"),chrome:n=>pe(n,"\x1B[38;5;235m"),added:n=>pe(n,"\x1B[38;5;108m"),removed:n=>pe(n,"\x1B[38;5;167m"),hunk:n=>pe(n,"\x1B[38;5;145m"),leader:n=>pe(n,"\x1B[38;5;179m"),architect:n=>pe(n,"\x1B[38;5;250m"),engineer:n=>pe(n,"\x1B[38;5;145m"),analyst:n=>pe(n,"\x1B[38;5;108m"),product:n=>pe(n,"\x1B[38;5;180m")};Ge=class{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];interval=null;frameIndex=0;message;startTime=0;constructor(e="Thinking"){this.message=e}start(){if(this.startTime=Date.now(),!hn){process.stderr.write(` ${this.message}...
|
|
204
204
|
`);return}this.interval=setInterval(()=>{let e=((Date.now()-this.startTime)/1e3).toFixed(1),t=c.accent(this.frames[this.frameIndex]);process.stdout.write(`\r ${t} ${c.muted(this.message)} ${c.muted(e+"s")}`),this.frameIndex=(this.frameIndex+1)%this.frames.length},80)}setPhase(e){this.message=e}updateMessage(e){this.message=e}stop(e){this.interval&&(clearInterval(this.interval),this.interval=null);let t=Date.now()-this.startTime;if(hn&&process.stdout.write("\r"+" ".repeat(80)+"\r"),e&&hn){let s=c.muted(`${t}ms`);console.log(` ${c.muted("\xB7")} ${c.secondary(e)} ${s}`)}}};Gi=[{cmd:"/help",desc:"Show this help"},{cmd:"/about",desc:"Developer info & links"},{cmd:"/version",desc:"Version & runtime info"},{cmd:"/team",desc:"Show agent team roster"},{cmd:"/model",arg:"<name>",desc:"Switch model"},{cmd:"/models",arg:"[search|page]",desc:"Browse all models"},{cmd:"/tree",desc:"Project file tree"},{cmd:"/status",desc:"Agent status & context"},{cmd:"/history",arg:"[n]",desc:"Show last n turns"},{cmd:"/undo",arg:"[path]",desc:"Restore last backup"},{cmd:"/clear",desc:"Clear session & context"},{cmd:"/config",desc:"Show current config"},{cmd:"/quit",desc:"Exit hablas"}];By={pending:"\u25CB",running:"\u25C9",done:"\u2713",failed:"\u2717",skipped:"\u2013"},Uy={pending:c.muted,running:c.accent,done:c.success,failed:c.error,skipped:c.muted};Ji=Gi.map(n=>n.cmd).concat(["/exit","/addmodel","/listmodels","/removemodel","/usemodel","/provider","/task","/memory","/mindset","/mindsets","/alias","/doctor","/plugins","/team","/agents","/delegate"])});function Xi(n){let e=st.join(n,"package.json");if(Ue.existsSync(e))try{let t=JSON.parse(Ue.readFileSync(e,"utf-8")),s={...t.dependencies,...t.devDependencies};if(s.vitest)return"vitest";if(s.jest||s["@jest/core"])return"jest";if(s.mocha)return"mocha"}catch{}if(Ue.existsSync(st.join(n,"pytest.ini"))||Ue.existsSync(st.join(n,"pyproject.toml"))||Ue.existsSync(st.join(n,"setup.py")))try{let t=Ue.existsSync(st.join(n,"requirements.txt"))?Ue.readFileSync(st.join(n,"requirements.txt"),"utf-8"):"",s=Ue.existsSync(st.join(n,"pyproject.toml"))?Ue.readFileSync(st.join(n,"pyproject.toml"),"utf-8"):"";if(t.includes("pytest")||s.includes("pytest"))return"pytest"}catch{}return Ue.existsSync(st.join(n,"go.mod"))?"go":Ue.existsSync(st.join(n,"Cargo.toml"))?"cargo":"unknown"}function Ky(n,e){switch(n){case"vitest":return e?`npx vitest run ${e}`:"npx vitest run";case"jest":return e?`npx jest ${e} --no-coverage`:"npx jest --no-coverage";case"mocha":return e?`npx mocha ${e}`:"npx mocha";case"pytest":return e?`python -m pytest ${e} -v`:"python -m pytest -v";case"go":return e?`go test ./${e}`:"go test ./...";case"cargo":return"cargo test";default:return"npm test"}}function bu(n,e){let t=Xi(n),s=Ky(t,e),r=Date.now(),i="",o="",a=!1;try{i=(0,yu.execSync)(s,{cwd:n,encoding:"utf-8",timeout:12e4,maxBuffer:5*1024*1024,stdio:["pipe","pipe","pipe"]}),a=!0}catch(m){i=m.stdout||"",o=m.stderr||m.message||"",a=!1}let l=Date.now()-r,{totalTests:u,passedTests:d,failedTests:f,failedTestNames:h}=qy(i+`
|
|
205
205
|
`+o,t);return{framework:t,command:s,passed:a,output:i.slice(0,5e3),errorOutput:o.slice(0,3e3),totalTests:u,passedTests:d,failedTests:f,duration:l,failedTestNames:h}}function qy(n,e){let t=0,s=0,r=0,i=[],o=n.split(`
|
|
206
206
|
`);switch(e){case"jest":case"vitest":{for(let a of o){let l=a.match(/Tests:\s+(\d+)\s+passed.*?(\d+)\s+total/);if(l&&(s=parseInt(l[1]),t=parseInt(l[2]),r=t-s),a.match(/✕|FAIL|✗|×/)){let d=a.replace(/.*(?:✕|FAIL|✗|×)\s*/,"").trim();d&&i.push(d)}}break}case"pytest":{for(let a of o){let l=a.match(/(\d+)\s+passed.*?(\d+)\s+failed/);l&&(s=parseInt(l[1]),r=parseInt(l[2]),t=s+r);let u=a.match(/(\d+)\s+passed/);u&&t===0&&(s=parseInt(u[1]),t=s),a.includes("FAILED")&&i.push(a.trim())}break}case"go":{for(let a of o)a.includes("--- PASS")&&s++,a.includes("--- FAIL")&&(r++,i.push(a.replace("--- FAIL:","").trim()));t=s+r;break}default:{for(let a of o)/\bpass(ed|ing)?\b/i.test(a)&&/\d/.test(a)&&s++,/\bfail(ed|ing|ure)?\b/i.test(a)&&/\d/.test(a)&&r++;t=s+r}}return{totalTests:t,passedTests:s,failedTests:r,failedTestNames:i}}function vu(n){let e=[],t=n.passed?"\u2713 PASSED":"\u2717 FAILED",s=(n.duration/1e3).toFixed(1);if(e.push(` ${n.passed?"\u2713":"\u2717"} ${t} (${n.framework}) \u2014 ${s}s`),e.push(` Command: ${n.command}`),n.totalTests>0&&e.push(` Tests: ${n.passedTests} passed, ${n.failedTests} failed, ${n.totalTests} total`),n.failedTestNames.length>0){e.push(""),e.push(" Failed tests:");for(let r of n.failedTestNames.slice(0,10))e.push(` \u2717 ${r}`)}return e.join(`
|
|
@@ -228,7 +228,7 @@ Instructions:
|
|
|
228
228
|
`).filter(Boolean);for(let h of f)if(!i.find(m=>m.path===h))try{let m=await Rt.readFile(Ie.resolve(n,h),"utf-8");i.push({path:h,content:m})}catch{}}catch{}let o,a;try{o=(0,Ks.execSync)("git branch --show-current",{cwd:n,encoding:"utf-8",timeout:5e3}).trim(),a=(0,Ks.execSync)("git rev-parse --short HEAD",{cwd:n,encoding:"utf-8",timeout:5e3}).trim()}catch{}let l={id:r,label:e,timestamp:Date.now(),files:i,gitBranch:o,gitHash:a,projectPath:n},u=Ie.join(s,`${r}.json`);await Rt.writeFile(u,JSON.stringify(l,null,2),"utf-8");let d=$e.readdirSync(s).filter(f=>f.endsWith(".json")).sort();if(d.length>20)for(let f of d.slice(0,d.length-20))try{$e.unlinkSync(Ie.join(s,f))}catch{}return{id:r,label:e,timestamp:l.timestamp,fileCount:i.length,projectPath:n}}function ku(n){let e=qs(n);if(!$e.existsSync(e))return[];let t=$e.readdirSync(e).filter(r=>r.endsWith(".json")).sort().reverse(),s=[];for(let r of t)try{let i=JSON.parse($e.readFileSync(Ie.join(e,r),"utf-8"));s.push({id:i.id,label:i.label,timestamp:i.timestamp,fileCount:i.files.length,projectPath:i.projectPath})}catch{}return s}async function Au(n,e){let t=qs(n),s=Ie.join(t,`${e}.json`);if(!$e.existsSync(s))return{success:!1,filesRestored:0,error:`Checkpoint ${e} not found`};try{let r=JSON.parse(await Rt.readFile(s,"utf-8")),i=0;for(let o of r.files)try{let a=Ie.resolve(n,o.path);await Rt.mkdir(Ie.dirname(a),{recursive:!0}),await Rt.writeFile(a,o.content,"utf-8"),i++}catch{}return{success:!0,filesRestored:i}}catch(r){return{success:!1,filesRestored:0,error:r.message}}}function $u(n,e){let t=qs(n),s=Ie.join(t,`${e}.json`);try{if($e.existsSync(s))return $e.unlinkSync(s),!0}catch{}return!1}function Cu(n){if(n.length===0)return" No checkpoints saved";let e=[];for(let t of n){let s=new Date(t.timestamp).toLocaleString();e.push(` ${t.id} "${t.label}" (${t.fileCount} files, ${s})`)}return e.join(`
|
|
229
229
|
`)}var $e,Rt,Ie,Su,Ks,Wy,Eu=L(()=>{"use strict";$e=O(require("fs")),Rt=O(require("fs/promises")),Ie=O(require("path")),Su=O(require("os")),Ks=require("child_process"),Wy=Ie.join(Su.homedir(),".hablas","checkpoints")});function Ot(){}function Gy(n,e,t,s,r){for(var i=[],o;e;)i.push(e),o=e.previousComponent,delete e.previousComponent,e=o;i.reverse();for(var a=0,l=i.length,u=0,d=0;a<l;a++){var f=i[a];if(f.removed){if(f.value=n.join(s.slice(d,d+f.count)),d+=f.count,a&&i[a-1].added){var m=i[a-1];i[a-1]=i[a],i[a]=m}}else{if(!f.added&&r){var h=t.slice(u,u+f.count);h=h.map(function(g,x){var w=s[d+x];return w.length>g.length?w:g}),f.value=n.join(h)}else f.value=n.join(t.slice(u,u+f.count));u+=f.count,f.added||(d+=f.count)}}var p=i[l-1];return l>1&&typeof p.value=="string"&&(p.added||p.removed)&&n.equals("",p.value)&&(i[l-2].value+=p.value,i.pop()),i}function Vy(n,e,t){return no.diff(n,e,t)}function Ws(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ws=function(e){return typeof e}:Ws=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ws(n)}function Qi(n){return Jy(n)||Xy(n)||Qy(n)||Zy()}function Jy(n){if(Array.isArray(n))return Zi(n)}function Xy(n){if(typeof Symbol<"u"&&Symbol.iterator in Object(n))return Array.from(n)}function Qy(n,e){if(n){if(typeof n=="string")return Zi(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Zi(n,e)}}function Zi(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=n[t];return s}function Zy(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
230
230
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eo(n,e,t,s,r){e=e||[],t=t||[],s&&(n=s(r,n));var i;for(i=0;i<e.length;i+=1)if(e[i]===n)return t[i];var o;if(eb.call(n)==="[object Array]"){for(e.push(n),o=new Array(n.length),t.push(o),i=0;i<n.length;i+=1)o[i]=eo(n[i],e,t,s,r);return e.pop(),t.pop(),o}if(n&&n.toJSON&&(n=n.toJSON()),Ws(n)==="object"&&n!==null){e.push(n),o={},t.push(o);var a=[],l;for(l in n)n.hasOwnProperty(l)&&a.push(l);for(a.sort(),i=0;i<a.length;i+=1)l=a[i],o[l]=eo(n[l],e,t,s,l);e.pop(),t.pop()}else o=n;return o}function tb(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=n.split(/\r\n|[\n\v\f\r\x85]/),s=n.match(/\r\n|[\n\v\f\r\x85]/g)||[],r=[],i=0;function o(){var u={};for(r.push(u);i<t.length;){var d=t[i];if(/^(\-\-\-|\+\+\+|@@)\s/.test(d))break;var f=/^(?:Index:|diff(?: -r \w+)+)\s+/.exec(d);f&&(u.index=d.substring(f[0].length).trim()),i++}for(a(u),a(u),u.hunks=[];i<t.length;){var h=t[i];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(h))break;if(/^@@/.test(h))u.hunks.push(l());else{if(h&&e.strict)throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(h));i++}}}function a(u){var d=/^(---|\+\+\+)\s+/.exec(t[i]);if(d){var f=d[1]==="---"?"old":"new",h=t[i].substring(3).trim().split(" ",2),m=h[0].replace(/\\\\/g,"\\");m.startsWith('"')&&m.endsWith('"')&&(m=m.substr(1,m.length-2)),u[f+"FileName"]=m,u[f+"Header"]=(h[1]||"").trim(),i++}}function l(){var u=i,d=t[i++],f=d.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),h={oldStart:+f[1],oldLines:typeof f[2]>"u"?1:+f[2],newStart:+f[3],newLines:typeof f[4]>"u"?1:+f[4],lines:[],linedelimiters:[]};h.oldLines===0&&(h.oldStart+=1),h.newLines===0&&(h.newStart+=1);for(var m=0,p=0;i<t.length&&!(t[i].indexOf("--- ")===0&&i+2<t.length&&t[i+1].indexOf("+++ ")===0&&t[i+2].indexOf("@@")===0);i++){var g=t[i].length==0&&i!=t.length-1?" ":t[i][0];if(g==="+"||g==="-"||g===" "||g==="\\")h.lines.push(t[i]),h.linedelimiters.push(s[i]||`
|
|
231
|
-
`),g==="+"?m++:g==="-"?p++:g===" "&&(m++,p++);else break}if(!m&&h.newLines===1&&(h.newLines=0),!p&&h.oldLines===1&&(h.oldLines=0),e.strict){if(m!==h.newLines)throw new Error("Added line count did not match for hunk at line "+(u+1));if(p!==h.oldLines)throw new Error("Removed line count did not match for hunk at line "+(u+1))}return h}for(;i<t.length;)o();return r}function nb(n,e,t){var s=!0,r=!1,i=!1,o=1;return function a(){if(s&&!i){if(r?o++:s=!1,n+o<=t)return o;i=!0}if(!r)return i||(s=!0),e<=n-o?-o++:(r=!0,a())}}function Pu(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string"&&(e=tb(e)),Array.isArray(e)){if(e.length>1)throw new Error("applyPatch only works with a single input.");e=e[0]}var s=n.split(/\r\n|[\n\v\f\r\x85]/),r=n.match(/\r\n|[\n\v\f\r\x85]/g)||[],i=e.hunks,o=t.compareLine||function(E,k,
|
|
231
|
+
`),g==="+"?m++:g==="-"?p++:g===" "&&(m++,p++);else break}if(!m&&h.newLines===1&&(h.newLines=0),!p&&h.oldLines===1&&(h.oldLines=0),e.strict){if(m!==h.newLines)throw new Error("Added line count did not match for hunk at line "+(u+1));if(p!==h.oldLines)throw new Error("Removed line count did not match for hunk at line "+(u+1))}return h}for(;i<t.length;)o();return r}function nb(n,e,t){var s=!0,r=!1,i=!1,o=1;return function a(){if(s&&!i){if(r?o++:s=!1,n+o<=t)return o;i=!0}if(!r)return i||(s=!0),e<=n-o?-o++:(r=!0,a())}}function Pu(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string"&&(e=tb(e)),Array.isArray(e)){if(e.length>1)throw new Error("applyPatch only works with a single input.");e=e[0]}var s=n.split(/\r\n|[\n\v\f\r\x85]/),r=n.match(/\r\n|[\n\v\f\r\x85]/g)||[],i=e.hunks,o=t.compareLine||function(E,k,J,K){return k===K},a=0,l=t.fuzzFactor||0,u=0,d=0,f,h;function m(E,k){for(var J=0;J<E.lines.length;J++){var K=E.lines[J],Z=K.length>0?K[0]:" ",te=K.length>0?K.substr(1):K;if(Z===" "||Z==="-"){if(!o(k+1,s[k],Z,te)&&(a++,a>l))return!1;k++}}return!0}for(var p=0;p<i.length;p++){for(var g=i[p],x=s.length-g.oldLines,w=0,$=d+g.oldStart-1,A=nb($,u,x);w!==void 0;w=A())if(m(g,$+w)){g.offset=d+=w;break}if(w===void 0)return!1;u=g.offset+g.oldStart+g.oldLines}for(var y=0,v=0;v<i.length;v++){var b=i[v],S=b.oldStart+b.offset+y-1;y+=b.newLines-b.oldLines;for(var _=0;_<b.lines.length;_++){var T=b.lines[_],I=T.length>0?T[0]:" ",C=T.length>0?T.substr(1):T,F=b.linedelimiters&&b.linedelimiters[_]||`
|
|
232
232
|
`;if(I===" ")S++;else if(I==="-")s.splice(S,1),r.splice(S,1);else if(I==="+")s.splice(S,0,C),r.splice(S,0,F),S++;else if(I==="\\"){var H=b.lines[_-1]?b.lines[_-1][0]:null;H==="+"?f=!0:H==="-"&&(h=!0)}}}if(f)for(;!s[s.length-1];)s.pop(),r.pop();else h&&(s.push(""),r.push(`
|
|
233
233
|
`));for(var W=0;W<s.length-1;W++)s[W]=s[W]+r[W];return s.join("")}function sb(n,e,t,s,r,i,o){o||(o={}),typeof o.context>"u"&&(o.context=4);var a=Vy(t,s,o);if(!a)return;a.push({value:"",lines:[]});function l(w){return w.map(function($){return" "+$})}for(var u=[],d=0,f=0,h=[],m=1,p=1,g=function($){var A=a[$],y=A.lines||A.value.replace(/\n$/,"").split(`
|
|
234
234
|
`);if(A.lines=y,A.added||A.removed){var v;if(!d){var b=a[$-1];d=m,f=p,b&&(h=o.context>0?l(b.lines.slice(-o.context)):[],d-=h.length,f-=h.length)}(v=h).push.apply(v,Qi(y.map(function(W){return(A.added?"+":"-")+W}))),A.added?p+=y.length:m+=y.length}else{if(d)if(y.length<=o.context*2&&$<a.length-2){var S;(S=h).push.apply(S,Qi(l(y)))}else{var _,T=Math.min(y.length,o.context);(_=h).push.apply(_,Qi(l(y.slice(0,T))));var I={oldStart:d,oldLines:m-d+T,newStart:f,newLines:p-f+T,lines:h};if($>=a.length-2&&y.length<=o.context){var C=/\n$/.test(t),F=/\n$/.test(s),H=y.length==0&&h.length>I.oldLines;!C&&H&&t.length>0&&h.splice(I.oldLines,0,"\"),(!C&&!H||!F)&&h.push("\")}u.push(I),d=0,f=0,h=[]}m+=y.length,p+=y.length}},x=0;x<a.length;x++)g(x);return{oldFileName:n,newFileName:e,oldHeader:r,newHeader:i,hunks:u}}function Mu(n){if(Array.isArray(n))return n.map(Mu).join(`
|
|
@@ -237,7 +237,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
237
237
|
`}function rb(n,e,t,s,r,i,o){return Mu(sb(n,e,t,s,r,i,o))}function Iu(n,e,t,s,r,i){return rb(n,n,e,t,s,r,i)}var SC,Tu,Ru,Ou,no,zy,Yy,eb,qn,to,Du=L(()=>{Ot.prototype={diff:function(e,t){var s,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var o=this;function a(y){return i?(setTimeout(function(){i(void 0,y)},0),!0):y}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var l=t.length,u=e.length,d=1,f=l+u;r.maxEditLength&&(f=Math.min(f,r.maxEditLength));var h=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(p[0],t,e,0);if(p[0].oldPos+1>=u&&g+1>=l)return a([{value:this.join(t),count:t.length}]);var x=-1/0,w=1/0;function $(){for(var y=Math.max(x,-d);y<=Math.min(w,d);y+=2){var v=void 0,b=p[y-1],S=p[y+1];b&&(p[y-1]=void 0);var _=!1;if(S){var T=S.oldPos-y;_=S&&0<=T&&T<l}var I=b&&b.oldPos+1<u;if(!_&&!I){p[y]=void 0;continue}if(!I||_&&b.oldPos+1<S.oldPos?v=o.addToPath(S,!0,void 0,0):v=o.addToPath(b,void 0,!0,1),g=o.extractCommon(v,t,e,y),v.oldPos+1>=u&&g+1>=l)return a(Gy(o,v.lastComponent,t,e,o.useLongestToken));p[y]=v,v.oldPos+1>=u&&(w=Math.min(w,y-1)),g+1>=l&&(x=Math.max(x,y+1))}d++}if(i)(function y(){setTimeout(function(){if(d>f||Date.now()>m)return i();$()||y()},0)})();else for(;d<=f&&Date.now()<=m;){var A=$();if(A)return A}},addToPath:function(e,t,s,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===s?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:s,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:s,previousComponent:i}}},extractCommon:function(e,t,s,r){for(var i=t.length,o=s.length,a=e.oldPos,l=a-r,u=0;l+1<i&&a+1<o&&this.equals(t[l+1],s[a+1]);)l++,a++,u++;return u&&(e.lastComponent={count:u,previousComponent:e.lastComponent}),e.oldPos=a,l},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],s=0;s<e.length;s++)e[s]&&t.push(e[s]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};SC=new Ot,Tu=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Ru=/\S/,Ou=new Ot;Ou.equals=function(n,e){return this.options.ignoreCase&&(n=n.toLowerCase(),e=e.toLowerCase()),n===e||this.options.ignoreWhitespace&&!Ru.test(n)&&!Ru.test(e)};Ou.tokenize=function(n){for(var e=n.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),t=0;t<e.length-1;t++)!e[t+1]&&e[t+2]&&Tu.test(e[t])&&Tu.test(e[t+2])&&(e[t]+=e[t+2],e.splice(t+1,2),t--);return e};no=new Ot;no.tokenize=function(n){this.options.stripTrailingCr&&(n=n.replace(/\r\n/g,`
|
|
238
238
|
`));var e=[],t=n.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(var s=0;s<t.length;s++){var r=t[s];s%2&&!this.options.newlineIsToken?e[e.length-1]+=r:(this.options.ignoreWhitespace&&(r=r.trim()),e.push(r))}return e};zy=new Ot;zy.tokenize=function(n){return n.split(/(\S.+?[.!?])(?=\s+|$)/)};Yy=new Ot;Yy.tokenize=function(n){return n.split(/([{}:;,]|\s+)/)};eb=Object.prototype.toString,qn=new Ot;qn.useLongestToken=!0;qn.tokenize=no.tokenize;qn.castInput=function(n){var e=this.options,t=e.undefinedReplacement,s=e.stringifyReplacer,r=s===void 0?function(i,o){return typeof o>"u"?t:o}:s;return typeof n=="string"?n:JSON.stringify(eo(n,null,null,r),r," ")};qn.equals=function(n,e){return Ot.prototype.equals.call(qn,n.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};to=new Ot;to.tokenize=function(n){return n.slice()};to.join=to.removeEmpty=function(n){return n}});var Lu={};Ne(Lu,{applyDiff:()=>ib,formatDiffForDisplay:()=>ob,generateDiff:()=>Gs});function Gs(n,e,t){return Iu(n,e,t,"original","modified")}function ib(n,e){return Pu(n,e)}function ob(n){return n.split(`
|
|
239
239
|
`).map(t=>t.startsWith("+")&&!t.startsWith("+++")?`\x1B[32m${t}\x1B[0m`:t.startsWith("-")&&!t.startsWith("---")?`\x1B[31m${t}\x1B[0m`:t.startsWith("@@")?`\x1B[36m${t}\x1B[0m`:t).join(`
|
|
240
|
-
`)}var so=L(()=>{"use strict";Du()});async function bn(n,e){let t=[],s=
|
|
240
|
+
`)}var so=L(()=>{"use strict";Du()});async function bn(n,e){let t=[],s=Ae.join(n,"package.json");if(me.existsSync(s))try{let o=JSON.parse(me.readFileSync(s,"utf-8"));t.push(`Project: ${o.name||"unknown"}${o.version?` v${o.version}`:""}`),o.description&&t.push(`Description: ${o.description}`);let a=Object.keys(o.dependencies||{}).concat(Object.keys(o.devDependencies||{}));a.length>0&&t.push(`Key deps: ${a.slice(0,15).join(", ")}${a.length>15?"...":""}`)}catch{}if(e?.workspace?.frameworkDetection){let o=Us(n);t.push(`Framework: ${o.framework}`),t.push(`Language: ${o.language}`),t.push(`Package Manager: ${o.packageManager}`),o.hasDocker&&t.push("Docker: detected"),o.hasCICD&&t.push("CI/CD: detected"),o.hasTests&&t.push("Tests: detected")}if(e?.workspace?.gitAwareness)try{let o=await Ui(n);o&&(t.push(`Git branch: ${o.branch}`),o.modified.length>0&&t.push(`Modified files: ${o.modified.length}`),o.staged.length>0&&t.push(`Staged files: ${o.staged.length}`))}catch{}if(e?.workspace?.envParsing){let a=[".env",".env.local",".env.development",".env.production"].filter(l=>me.existsSync(Ae.join(n,l)));a.length>0&&t.push(`Env files: ${a.join(", ")}`)}let i=["tsconfig.json",".eslintrc.json","vite.config.ts","next.config.js","tailwind.config.js"].filter(o=>me.existsSync(Ae.join(n,o)));if(i.length>0&&t.push(`Config: ${i.join(", ")}`),e?.context?.projectGraph)try{let o=me.readdirSync(n).filter(a=>!["node_modules",".git","dist","build",".next",".cache"].includes(a)).filter(a=>!a.startsWith(".")).slice(0,25);o.length>0&&t.push(`Structure: ${o.join(", ")}`)}catch{}else try{let o=me.readdirSync(n).filter(a=>!["node_modules",".git","dist","build",".next",".cache"].includes(a)).filter(a=>!a.startsWith(".")).slice(0,20);o.length>0&&t.push(`Structure: ${o.join(", ")}`)}catch{}return t.push(`Directory: ${n}`),e?.agents?.enabled&&(t.push("Multi-Agent: enabled (Team Leader: Hablas)"),t.push("Team: @Hablas (Leader), @Bob (Architect), @Alex (Engineer), @David (Data Analyst), @Emma (Product Manager)")),t.join(`
|
|
241
241
|
`)}function vn(n,e,t,s){let r=n+`
|
|
242
242
|
|
|
243
243
|
## Current Project
|
|
@@ -248,14 +248,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
248
248
|
## Shared Context
|
|
249
249
|
`+i)}return r+=`
|
|
250
250
|
|
|
251
|
-
`+Jc(),r}async function ab(n){try{if(!
|
|
251
|
+
`+Jc(),r}async function ab(n){try{if(!me.existsSync(ro))return null;let t=(await jt.readdir(ro)).filter(f=>f.endsWith(".bak"));if(n){let f=Ae.basename(n);t=t.filter(h=>h.startsWith(`${f}.`))}if(t.length===0)return null;t.sort().reverse();let s=t[0],r=Ae.join(ro,s),i=s.replace(".bak","").split("."),o=parseInt(i[i.length-1],10),a=i.slice(0,-1).join("."),l=Date.now()-o,u=Math.floor(l/6e4),d=u<1?"just now":u<60?`${u} minutes ago`:`${Math.floor(u/60)} hours ago`;return{backupPath:r,originalName:a,age:d}}catch{return null}}async function Fu(n,e,t,s,r,i,o,a,l,u,d,f,h,m,p,g,x){let w=n.split(/\s+/),$=w[0],A=w.slice(1).join(" ");switch($){case"/quit":case"/exit":return"quit";case"/help":console.log(hu()),console.log(c.muted(" Model & Provider:")),console.log(c.muted(" /addmodel Interactive wizard to add a custom API")),console.log(c.muted(" /listmodels Show saved providers")),console.log(c.muted(" /removemodel <name> Remove a saved provider")),console.log(c.muted(" /usemodel <name> Switch to a saved provider")),console.log(c.muted(" /models [page|search] Browse all available models")),console.log(c.muted(" /provider Show/switch API provider")),console.log(),console.log(c.muted(" Aliases & Plugins:")),console.log(c.muted(" /alias Show all aliases")),console.log(c.muted(" /alias set <n> <cmd> Create an alias")),console.log(c.muted(" /alias del <name> Remove an alias")),console.log(c.muted(" /plugins List installed plugins")),console.log(c.muted(" /doctor Run system diagnostics")),console.log(),console.log(c.muted(" Task & Memory:")),console.log(c.muted(" /task add <desc> Add a task to the queue")),console.log(c.muted(" /task list Show all tasks")),console.log(c.muted(" /task clear Clear task queue")),console.log(c.muted(" /memory Show project memory")),console.log(c.muted(" /memory set <k> <v> Store a memory")),console.log(c.muted(" /memory del <key> Delete a memory")),console.log(c.muted(" /memory clear Clear all memory")),console.log(),console.log(c.muted(" Multi-Agent & Tools:")),console.log(c.muted(" /team Show team roster")),console.log(c.muted(" /delegate <agent> <t> Manually assign task to agent")),console.log(c.muted(" /agents Multi-agent system control")),console.log(c.muted(" /agents on|off Enable/disable multi-agent")),console.log(c.muted(" /agents status Show agent details")),console.log(c.muted(" /security Run security scan")),console.log(c.muted(" /git status Show git status")),console.log(c.muted(" /workspace Show workspace info")),console.log(c.muted(" /stats Show usage analytics")),console.log();break;case"/about":console.log(lu());break;case"/version":console.log(cu());break;case"/model":if(A){let y=await t.listModels();t.setModel(A);try{let v=zt();v.hablas||(v.hablas={model:A,temperature:.7}),v.hablas.model=A,Ei(v),typeof x<"u"&&x&&x.reloadModels(),console.log(he(" [Phase 3] Synced to agents.json for @Hablas (team uses on next full turn)"))}catch{}y.includes(A)?console.log(Y(`Model: ${A}`)):console.log(j(`Model set to "${A}" (not found locally)`))}else console.log(he(`Current model: ${t.getModel()}`)),console.log(c.muted(" Usage: /model <name>"));break;case"/models":{let y=A.trim(),v=1,b="";if(y){let k=parseInt(y);!isNaN(k)&&k>0?v=k:b=y.toLowerCase()}let S=new Ge("Fetching models");S.start();let _=await t.listModels();if(S.stop(_.length>0?`${_.length} found`:void 0),_.length===0){console.log(j("No models found \u2014 check your connection")),console.log(c.muted(" Use /provider test to verify"));break}let T=_;if(b&&(T=_.filter(k=>k.toLowerCase().includes(b)),T.length===0)){console.log(j(`No models matching: "${b}"`)),console.log(c.muted(` ${_.length} models available. Try a different search.`));break}let I=20,C=Math.ceil(T.length/I),F=Math.max(1,Math.min(v,C)),H=(F-1)*I,W=H+I,E=T.slice(H,W);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Available Models")} ${c.muted(`(${T.length} total \xB7 page ${F}/${C})`)}`),console.log();for(let k=0;k<E.length;k++){let J=H+k+1,Z=E[k]===t.getModel()?` ${c.success("\u25CF active")}`:"";console.log(` ${c.muted(String(J).padStart(3," "))}. ${c.secondary(E[k])}${Z}`)}console.log(),C>1&&console.log(c.muted(` /models ${F<C?F+1:1} \u2014 next page`)),b&&console.log(c.muted(` Filtered: ${T.length} of ${_.length} (query: "${b}")`)),console.log(c.muted(" /models <query> \u2014 search \xB7 /model <id> \u2014 switch")),console.log();break}case"/tree":{let y=s.get("list_dir");if(y){let v=await y.execute({path:".",depth:3});console.log(`
|
|
252
252
|
${v.output}
|
|
253
|
-
`)}break}case"/status":{let y=await t.checkConnection(),v=u?u.getActiveName():"planner",b=f?f.size():0,S=d?d.getProgress():void 0;console.log(pu({model:t.getModel(),host:e.ollamaHost,directory:o,cacheFiles:r.getCacheSize(),cacheTokens:r.getTotalTokens(),budgetTokens:e.contextBudget,connected:y,turnCount:l,mindset:v})),b>0&&console.log(c.muted(` Memory entries: ${b}`)),S&&S.total>0&&console.log(c.muted(` Tasks: ${S.done}/${S.total} done`)),console.log();break}case"/clear":r.clear(),i.clear(),console.log(
|
|
253
|
+
`)}break}case"/status":{let y=await t.checkConnection(),v=u?u.getActiveName():"planner",b=f?f.size():0,S=d?d.getProgress():void 0;console.log(pu({model:t.getModel(),host:e.ollamaHost,directory:o,cacheFiles:r.getCacheSize(),cacheTokens:r.getTotalTokens(),budgetTokens:e.contextBudget,connected:y,turnCount:l,mindset:v})),b>0&&console.log(c.muted(` Memory entries: ${b}`)),S&&S.total>0&&console.log(c.muted(` Tasks: ${S.done}/${S.total} done`)),console.log();break}case"/clear":r.clear(),i.clear(),console.log(Y("History cleared"));break;case"/history":{let y=parseInt(A)||10,v=i.getHistory().slice(-y);if(v.length===0){console.log(he("No history yet"));break}console.log(),v.forEach(b=>{let S=b.role==="user"?c.primary("You"):b.role==="assistant"?c.success("Hablas"):c.muted("tool"),_=b.content.slice(0,120).replace(/\n/g," ");console.log(` ${S}: ${c.muted(_)}`)}),console.log();break}case"/undo":{if(!g){let y=await ab(A||void 0);if(!y){console.log(j("No backups found"));break}let v=A?Ae.resolve(o,A):Ae.resolve(o,y.originalName);if(await a.confirm(`Restore ${y.originalName} from backup (${y.age})?`))try{let S=await jt.readFile(y.backupPath,"utf-8");await jt.writeFile(v,S,"utf-8"),console.log(Y(`Restored ${y.originalName} from backup (${y.age})`))}catch(S){console.log(ke(`Failed: ${S.message}`))}break}if(A==="list")console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Undo History")} (${g.getUndoableCount()} changes)`),console.log(),console.log(g.formatList(20)),console.log();else if(A==="all"){let y=g.getUndoableCount();if(y===0){console.log(he("Nothing to undo"));break}if(await a.confirm(`Undo ALL ${y} changes?`)){let b=await g.undoAll(),S=b.filter(_=>_.success).length;console.log(Y(`Reverted ${S}/${b.length} changes`))}}else{let y=A&&parseInt(A)||1;if(g.getUndoableCount()===0){console.log(he("Nothing to undo"));break}let v=await g.undo(y);for(let b of v)b.success?console.log(Y(`Reverted: ${b.file}`)):console.log(ke(`Failed to revert ${b.file}: ${b.error}`))}break}case"/config":console.log(`
|
|
254
254
|
${c.muted(JSON.stringify(e,null,2))}
|
|
255
|
-
`),console.log(c.muted(" ~/.hablas/config.json")),console.log();break;case"/mindset":{if(!u){console.log(j("Mindset system not available"));break}if(A)if(u.setActive(A)){let v=u.getActive(),b=await bn(o,e),S=vn(v.systemPrompt,b,f,m);i.updateSystemPrompt(S),console.log(V(`Mindset: ${v.name} \u2014 ${v.description}`))}else{let v=u.listNames().join(", ");console.log(Be(`Unknown mindset: "${A}"`,`Available: ${v}`))}else{let y=u.getActive();y&&console.log(pe(`Current mindset: ${y.name} \u2014 ${y.description}`)),console.log(c.muted(" Usage: /mindset <name>")),console.log(c.muted(" See /mindsets for available options"))}break}case"/mindsets":{if(!u){console.log(j("Mindset system not available"));break}let y=u.list(),v=u.getActiveName();console.log();for(let b of y){let _=b.name===v?c.success(" \u25CF active"):"";console.log(` ${c.accent("\u25C6")} ${c.primary(b.name)}${_}`),console.log(` ${c.muted(b.description)}`)}console.log(),console.log(c.muted(" Switch: /mindset <name>")),console.log();break}case"/task":{if(!d){console.log(j("Task queue not available"));break}let y=w[1],v=w.slice(2).join(" ");switch(y){case"add":if(v){let b=d.add(v);console.log(V(`Task #${b.id} added: ${v}`))}else console.log(j("Usage: /task add <description>"));break;case"list":console.log(),console.log(d.render()),console.log();break;case"done":{let b=parseInt(v);b?(d.complete(b),console.log(V(`Task #${b} marked as done`))):console.log(j("Usage: /task done <id>"));break}case"fail":{let b=parseInt(v);b?(d.fail(b,"Manually marked as failed"),console.log(j(`Task #${b} marked as failed`))):console.log(j("Usage: /task fail <id>"));break}case"clear":d.clear(),console.log(V("Task queue cleared"));break;default:console.log(),console.log(d.render()),console.log(),console.log(c.muted(" /task add <desc> \u2014 Add a task")),console.log(c.muted(" /task list \u2014 Show all tasks")),console.log(c.muted(" /task done <id> \u2014 Mark task as done")),console.log(c.muted(" /task fail <id> \u2014 Mark task as failed")),console.log(c.muted(" /task clear \u2014 Clear all tasks")),console.log()}break}case"/addmodel":{console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Add Custom API Provider")}`),console.log();let v=(await a.prompt(` ${c.muted("Provider name (e.g. OpenAI, Groq):")} `)).trim();if(!v){console.log(j("Cancelled \u2014 name is required"));break}let S=(await a.prompt(` ${c.muted("API URL (e.g. https://api.openai.com/v1):")} `)).trim();if(!S){console.log(j("Cancelled \u2014 URL is required"));break}let T=(await a.prompt(` ${c.muted("API Key (leave empty if none):")} `)).trim(),C=(await a.prompt(` ${c.muted("Default model ID (e.g. gpt-4o):")} `)).trim()||"default",F={name:v,apiUrl:S,apiKey:T,models:[C],defaultModel:C,addedAt:new Date().toISOString()};tt(F),console.log(),console.log(V(`Provider "${v}" saved!`)),console.log(c.muted(` Use: /usemodel ${v}`)),console.log();break}case"/listmodels":{let y=Vt();console.log(),console.log(_c(y.providers,y.activeProvider));break}case"/removemodel":{let y=A.trim();if(!y){console.log(j("Usage: /removemodel <provider-name>"));break}if(wc(y))console.log(V(`Provider "${y}" removed`));else{console.log(j(`Provider "${y}" not found`));let b=Os();b.length>0&&console.log(c.muted(` Available: ${b.map(S=>S.name).join(", ")}`))}break}case"/usemodel":{let y=A.trim();if(!y){console.log(j("Usage: /usemodel <provider-name> [model-id]"));let F=Os();F.length>0&&console.log(c.muted(` Available: ${F.map(H=>H.name).join(", ")}`));break}let v=y.split(/\s+/),b=v[0],S=v[1],_=xc(b);if(!_){console.log(j(`Provider "${b}" not found`));let F=Os();F.length>0&&console.log(c.muted(` Available: ${F.map(H=>H.name).join(", ")}`));break}e.provider="custom",e.apiUrl=_.apiUrl,e.apiKey=_.apiKey,e.model=S||_.defaultModel;let T=Me(e);h&&h(T),Sc(_.name,e.model),console.log(V(`Switched to ${_.name} \xB7 Model: ${e.model}`));let I=new Ge("Testing");I.start();let C=await T.checkConnection();I.stop(C?"connected":void 0),C||console.log(j("Connection test failed \u2014 check URL and key"));break}case"/provider":{let y=w[1],v=w.slice(2).join(" ");if(!y){let b=Rs(e);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Provider")}: ${b}`),console.log(` ${c.muted("Model")}: ${c.highlight(t.getModel())}`),e.provider==="custom"?(console.log(` ${c.muted("API URL")}: ${e.apiUrl}`),console.log(` ${c.muted("API Key")}: ${e.apiKey?"***"+e.apiKey.slice(-4):"not set"}`)):console.log(` ${c.muted("Host")}: ${e.ollamaHost}`),console.log(),console.log(c.muted(" /provider ollama \u2014 Switch to local Ollama")),console.log(c.muted(" /provider nvidia <key> \u2014 Switch to NVIDIA NIM")),console.log(c.muted(" /provider custom <url> [key] \u2014 Switch to custom API")),console.log(c.muted(" /provider test \u2014 Test current connection")),console.log();break}switch(y){case"ollama":{e.provider="ollama",e.apiUrl="",e.apiKey="";let b=Me(e);h&&h(b),console.log(V("Switched to Ollama (local)"));break}case"nvidia":{let b=w[2];if(!b&&!e.apiKey){console.log(j("Usage: /provider nvidia <api-key>")),console.log(c.muted(" Get your key at: https://build.nvidia.com/"));break}e.provider="nvidia",e.apiUrl=Nt.apiUrl,b&&(e.apiKey=b),(!e.model||!Nt.models.includes(e.model))&&(e.model=Nt.defaultModel);let S=Me(e);h&&h(S),console.log(V(`Switched to NVIDIA NIM \xB7 Model: ${e.model}`)),console.log(c.muted(` Available models: ${Nt.models.length}`));let _=new Ge("Testing NVIDIA connection");_.start();let T=await S.checkConnection();_.stop(T?"connected":void 0),T||(console.log(j("Connection test failed \u2014 check your API key")),console.log(c.muted(" Get key: https://build.nvidia.com/")));break}case"custom":{let b=w[2],S=w[3];if(!b){console.log(j("Usage: /provider custom <api-url> [api-key]")),console.log(c.muted(" Example: /provider custom https://api.openai.com/v1 sk-..."));break}e.provider="custom",e.apiUrl=b,S&&(e.apiKey=S);let _=Me(e);h&&h(_),console.log(V(`Switched to Custom API: ${b}`)),!S&&!e.apiKey&&console.log(j("No API key set. Use: /provider custom <url> <key>"));break}case"test":{let b=new Ge("Testing connection");b.start();let S=await t.checkConnection();if(b.stop(S?"connected":void 0),S){let _=await t.listModels();console.log(V(`Connected! ${_.length} models available.`)),_.length>0&&console.log(c.muted(` Models: ${_.slice(0,5).join(", ")}${_.length>5?"...":""}`))}else console.log(Ae("Connection failed"));break}case"key":{v?(e.apiKey=w[2],t instanceof Gt&&t.setApiKey(e.apiKey),console.log(V("API key updated"))):console.log(j("Usage: /provider key <api-key>"));break}default:console.log(Be(`Unknown: /provider ${y}`,"Type /provider for help"))}break}case"/memory":{if(!f){console.log(j("Project memory not available"));break}let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");f.set(b,S),console.log(V(`Memory stored: ${b}`));let _=u?.getActive(),T=_?_.systemPrompt:Wn,I=await bn(o,e);i.updateSystemPrompt(vn(T,I,f,m))}else console.log(j("Usage: /memory set <key> <value>"));break}case"del":case"delete":{if(v[0]){let b=f.delete(v[0]);console.log(b?V(`Memory deleted: ${v[0]}`):j(`Memory key not found: ${v[0]}`))}else console.log(j("Usage: /memory del <key>"));break}case"search":{if(v[0]){let b=f.search(v.join(" "));b.length>0?(console.log(),b.forEach(S=>console.log(` \xB7 ${S.entry.key}: ${S.entry.value}`)),console.log()):console.log(pe("No matching memories found"))}else console.log(j("Usage: /memory search <query>"));break}case"clear":f.clear(),console.log(V("Project memory cleared"));break;default:console.log(),console.log(f.render()),console.log(),console.log(c.muted(" /memory set <k> <v> \u2014 Store a memory")),console.log(c.muted(" /memory del <key> \u2014 Delete a memory")),console.log(c.muted(" /memory search <q> \u2014 Search memories")),console.log(c.muted(" /memory clear \u2014 Clear all")),console.log()}break}case"/alias":{let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");$c(b,S),console.log(V(`Alias set: ${b} \u2192 ${S}`))}else console.log(j("Usage: /alias set <name> <expansion>"));break}case"del":case"remove":{if(v[0]){let b=Cc(v[0]);console.log(b?V(`Alias removed: ${v[0]}`):j(`Alias not found: ${v[0]}`))}else console.log(j("Usage: /alias del <name>"));break}default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Aliases")}`),console.log(),console.log(Tc()),console.log(),console.log(c.muted(" /alias set <name> <cmd> \u2014 Create alias")),console.log(c.muted(" /alias del <name> \u2014 Remove alias")),console.log()}break}case"/doctor":{let y=new Ge("Running diagnostics");y.start();let v=await Ai({ollamaHost:e.ollamaHost,model:t.getModel(),provider:e.provider,apiUrl:e.apiUrl});y.stop(),console.log($i(v));break}case"/plugins":{let y=w[1],v=w.slice(2).join(" ");switch(y){case"enable":v?(wi(v),console.log(V(`Plugin "${v}" enabled`))):console.log(j("Usage: /plugins enable <name>"));break;case"disable":v?(xi(v),console.log(j(`Plugin "${v}" disabled`))):console.log(j("Usage: /plugins disable <name>"));break;default:Fs(),console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Plugins")}`),console.log(),console.log(Si()),console.log(),console.log(c.muted(" /plugins enable <name> \u2014 Enable plugin")),console.log(c.muted(" /plugins disable <name> \u2014 Disable plugin")),console.log(c.muted(" Directory: ~/.hablas/plugins/")),console.log()}break}case"/mode":{let y=w[1]?.toLowerCase();console.log(),console.log(` ${c.accent("\u2605")} ${c.strong("Mode Selection")}`),console.log(),console.log(` Current: ${c.strong("BUILD")} \u2014 Full Multi-Agent Team at Maximum Power`),console.log(" (Hablas + Bob + Alex + David + Emma + rich theatre)"),console.log(),console.log(" Available modes:"),console.log(` ${c.highlight("build")} \u2014 Full team for complete serious work (recommended default)`),console.log(` ${c.highlight("design")} \u2014 Focused team for architecture, PRDs, blueprints`),console.log(` ${c.highlight("ask")} \u2014 Quick solo answers`),console.log(),console.log(` Usage: /mode build or just use 'hablas build "task"' for one-shot`),console.log(" Note: In plain REPL, everything runs in BUILD mode (full team) by default."),console.log(),(y==="build"||y==="design"||y==="ask")&&(console.log(V(`Acknowledged mode preference: ${y.toUpperCase()}`)),console.log(c.muted(" (The next input will be handled accordingly. Use subcommands for direct execution.)")));break}case"/agents":{let y=w[1];if(y==="on")e.agents.enabled=!0,console.log(V("Multi-agent orchestration enabled"));else if(y==="off")e.agents.enabled=!1,console.log(V("Multi-agent orchestration disabled"));else if(y==="status")console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Multi-Agent System")}`),console.log(` Status: ${e.agents.enabled?c.success("enabled"):c.muted("disabled")}`),console.log(` Orchestration: ${e.agents.orchestration}`),console.log(` Max concurrent: ${e.agents.maxConcurrent}`),console.log(),console.log(` ${c.strong("Team:")}`),console.log(Lc()),console.log();else if(y==="models"){let v=w.slice(2);if(v.length>=2){let b=v[0].toLowerCase(),S=v[1],_=["hablas","bob","alex","david","emma","gate"];if(!_.includes(b)){console.log(j(`Unknown role: ${b}. Valid: ${_.join(", ")}`));break}let T=zt();T[b]||(T[b]={model:S,temperature:.5}),T[b].model=S,Ei(T),x&&x.reloadModels(),console.log(V(`Agent model updated: @${b} \u2192 ${S}`)),console.log(c.muted(` Saved to ${Ti()}`))}else{let b=zt();console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Agent Models")}`),console.log();for(let S of xe){let _=b[S.role];console.log(_?` ${c.primary(S.name.padEnd(8))} \u2192 ${c.highlight(_.model)}${_.temperature!==void 0?c.muted(` (temp: ${_.temperature})`):""}`:` ${c.primary(S.name.padEnd(8))} \u2192 ${c.muted("(default)")}`)}console.log(),console.log(c.muted(` Config: ${Ti()}`)),console.log(c.muted(" Usage: /agents models <role> <model> (e.g. /agents models alex qwen/qwen2.5-coder-32b-instruct)")),console.log()}}else console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Multi-Agent System")}: ${e.agents.enabled?c.success("ON"):c.muted("OFF")}`),console.log(),console.log(c.muted(" /agents on \u2014 Enable multi-agent orchestration")),console.log(c.muted(" /agents off \u2014 Disable multi-agent orchestration")),console.log(c.muted(" /agents status \u2014 Show agent details")),console.log(c.muted(" /agents models \u2014 Show model per agent")),console.log(c.muted(" /team \u2014 Show team roster")),console.log();break}case"/security":{console.log(),console.log(` ${c.accent("\u{1F512}")} Running security scan...`);let y=ji(o);console.log(Hi(y));break}case"/git":{if(w[1]==="status")try{let{getGitStatus:v,formatGitStatus:b}=await Promise.resolve().then(()=>(pn(),Kn)),S=await v(o);S?(console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Git Status")}`),console.log(b(S)),console.log()):console.log(j("Not a git repository"))}catch{console.log(j("Git not available"))}else console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Git Intelligence")}`),console.log(),console.log(c.muted(" /git status \u2014 Show git status")),console.log(c.muted(" hablas commit \u2014 Smart commit message")),console.log(c.muted(" hablas pr \u2014 Generate PR description")),console.log(c.muted(" hablas changelog \u2014 Generate changelog")),console.log();break}case"/workspace":{let y=Us(o);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Workspace Information")}`),console.log(),console.log(Ki(y)),console.log();break}case"/stats":{let{loadStats:y,formatStats:v}=await Promise.resolve().then(()=>(Un(),Ni)),b=y();console.log(v(b));break}case"/context":{if(!m){console.log(j("Shared context not available"));break}let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");m.set(b,S),console.log(V(`Context stored: ${b}`))}else console.log(j("Usage: /context set <key> <value>"));break}case"get":{if(v[0]){let b=m.get(v[0]);b!==void 0?(console.log(),console.log(` ${c.accent("\u25C6")} ${c.strong(v[0])}: ${b}`),console.log()):console.log(j(`Context key not found: ${v[0]}`))}else console.log(j("Usage: /context get <key>"));break}case"del":case"delete":{if(v[0]){let b=m.delete(v[0]);console.log(b?V(`Context deleted: ${v[0]}`):j(`Context key not found: ${v[0]}`))}else console.log(j("Usage: /context del <key>"));break}case"decisions":{let b=m.getDecisions();if(b.length===0)console.log(pe("No decisions logged yet"));else{console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Decisions")}`),console.log();for(let S of b)console.log(` ${c.muted(S.timestamp)} ${c.primary(S.by)}: ${S.decision}`),S.rationale&&console.log(` ${c.muted(S.rationale)}`);console.log()}break}case"clear":m.clear(),console.log(V("Shared context cleared"));break;default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Shared Context")}`),console.log(),console.log(m.render()),console.log(),console.log(c.muted(" /context set <k> <v> \u2014 Store a context entry")),console.log(c.muted(" /context get <key> \u2014 Get a context entry")),console.log(c.muted(" /context del <key> \u2014 Delete a context entry")),console.log(c.muted(" /context decisions \u2014 Show logged decisions")),console.log(c.muted(" /context clear \u2014 Clear all context")),console.log()}break}case"/plan":{if(!p){console.log(j("Plan manager not available"));break}let y=w[1],v=w.slice(2).join(" ");switch(y){case"status":{let S=p.getActivePlan();if(!S){console.log(pe("No active plan"));break}let _=p.getProgress();console.log(mu(S,{percent:_.percentage,done:_.done,total:_.total}));break}case"finish":{if(v){p.finishTask(v),console.log(V(`Task finished: ${v}`));let S=p.getProgress();console.log(c.muted(` Progress: ${S.done}/${S.total} (${S.percentage}%)`))}else console.log(j("Usage: /plan finish <task_id>"));break}case"reset":{p.reset(),console.log(V("Plan manager reset"));break}case"next":{let S=p.getNextTask();console.log(S?pe(`Next task: [${S.task_id}] ${S.description} \u2192 @${S.assignee}`):pe("No pending tasks"));break}default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Plan Manager")}`),console.log();let b=p.getActivePlan();if(b){let S=p.getProgress();console.log(` Active plan: ${b.title} (${S.percentage}% done)`),console.log(` Tasks: ${S.done}/${S.total}`)}else console.log(c.muted(" No active plan"));console.log(),console.log(c.muted(" /plan status \u2014 Show active plan with progress")),console.log(c.muted(" /plan finish <id> \u2014 Mark a task as finished")),console.log(c.muted(" /plan next \u2014 Show next pending task")),console.log(c.muted(" /plan reset \u2014 Reset plan manager")),console.log()}break}case"/learn":{if(!f||!A){console.log(j('Usage: /learn "always use tabs" or /learn "our API uses camelCase"'));break}if(f.set(`user-pref: ${A.slice(0,50)}`,A,{category:"user-pref",importance:9,createdBy:"user",tags:["user-pref","learned"]}),!(i.getMessages()[0]?.content||"").includes(A)){let v=await bn(o,e),b=u?.getActive(),S=b?b.systemPrompt:Wn,_=vn(S,v,f,m);i.updateSystemPrompt(_)}console.log(V(`Learned: "${A}"`)),console.log(c.muted(" This will be remembered across sessions and injected into every prompt."));break}case"/test":{let y=Xi(o);if(y==="unknown"&&!A){console.log(j("No test framework detected. Install jest, vitest, pytest, etc."));break}console.log(pe(`Running tests (${y})...`));let v=bu(o,A==="--fix"?void 0:A||void 0);if(console.log(),console.log(vu(v)),console.log(),!v.passed&&A==="--fix"){console.log(pe("Tests failed \u2014 adding fix request to conversation..."));let b=wu(v);i.addUserMessage(b),console.log(pe("Type your next message or let the agent work on the fix."))}break}case"/checkpoint":{let y=w[1],v=w.slice(2).join(" ");if(y==="save"){let b=v||`Checkpoint at turn ${l}`,S=g?.getModifiedFiles?.()||[],_=await _u(o,b,S);console.log(V(`Checkpoint saved: ${_.id} "${b}" (${_.fileCount} files)`))}else if(y==="list"){let b=ku(o);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Checkpoints")}`),console.log(),console.log(Cu(b)),console.log()}else if(y==="restore"){if(!v){console.log(j("Usage: /checkpoint restore <id>"));break}let b=await Au(o,v);b.success?console.log(V(`Restored checkpoint: ${v} (${b.filesRestored} files)`)):console.log(Ae(b.error||"Restore failed"))}else y==="delete"?v&&$u(o,v)?console.log(V(`Deleted checkpoint: ${v}`)):console.log(j("Checkpoint not found")):(console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Checkpoint System")}`),console.log(),console.log(c.muted(' /checkpoint save "label" \u2014 Save current state')),console.log(c.muted(" /checkpoint list \u2014 List saved checkpoints")),console.log(c.muted(" /checkpoint restore <id> \u2014 Restore a checkpoint")),console.log(c.muted(" /checkpoint delete <id> \u2014 Delete a checkpoint")),console.log());break}case"/compare":{let y=w.slice(1);if(y.length===2)try{let v=await jt.readFile(ke.resolve(o,y[0]),"utf-8"),b=await jt.readFile(ke.resolve(o,y[1]),"utf-8"),{generateDiff:S}=await Promise.resolve().then(()=>(so(),Lu)),_=S(y[0]+" vs "+y[1],v,b);console.log(zi(_))}catch(v){console.log(Ae(`Compare failed: ${v.message}`))}else if(y.length===1&&y[0].startsWith("HEAD"))try{let{execSync:v}=await import("child_process"),b=v(`git diff ${y[0]}`,{cwd:o,encoding:"utf-8",timeout:1e4});console.log(zi(b||"(no changes)"))}catch(v){console.log(Ae(`Git diff failed: ${v.message}`))}else console.log(c.muted(" Usage: /compare file1.ts file2.ts or /compare HEAD~1"));break}case"/cost":{let y=Bn(),v="current";console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Session Cost & Usage")}`),console.log(),console.log(` Session duration: ${v} min`),console.log(` Messages: ${y.totalMessages}`),console.log(` Tool calls: ${y.totalToolCalls}`),console.log(` Tokens used: ${y.totalTokensUsed.toLocaleString()}`),console.log();let b=Object.entries(y.agentUsage);if(b.length>0){console.log(" Agent usage:");for(let[S,_]of b.sort((T,I)=>I[1]-T[1]))console.log(` @${S}: ${_} invocations`)}console.log();break}case"/delegate":{if(!e.agents.enabled){console.log(j("Multi-agent system is disabled. Enable with /agents on"));break}let y=w[1]?.toLowerCase(),v=w.slice(2).join(" ");if(!y||!v){console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Delegate Task to Agent")}`),console.log(),console.log(c.muted(" Usage: /delegate <agent> <task description>")),console.log(),console.log(c.muted(" Agents:")),console.log(` ${c.product("emma")} \u2014 Product Manager`),console.log(` ${c.architect("bob")} \u2014 Architect`),console.log(` ${c.engineer("alex")} \u2014 Engineer`),console.log(` ${c.analyst("david")} \u2014 Data Analyst`),console.log(),console.log(c.muted(" Example: /delegate alex create a login component")),console.log();break}let b=["emma","bob","alex","david","hablas"];if(!b.includes(y)){console.log(j(`Unknown agent: "${y}". Valid: ${b.join(", ")}`));break}let S=xe.find(_=>_.role===y);if(S){if(!x){console.log(j("Agent runner not initialized. Cannot delegate."));break}console.log(ou("Hablas",S.name,S.title,v)),console.log(mn(S.name,S.title));let _=s.getOllamaTools(),T=await x.runAgent(y,v,void 0,_);T.success&&T.output?(console.log(gn(T.output)),i.addAssistantMessage(`[@${S.name}]: ${T.output}`)):T.error?console.log(j(`${S.name} failed: ${T.error}`)):console.log(pe(`${S.name} completed without output.`))}break}case"/session":{let y=w[1],v=w.slice(2).join(" "),b=ke.join(io.homedir(),".hablas","sessions");if(y==="save"){let S=v||`session_${Date.now()}`;try{he.existsSync(b)||he.mkdirSync(b,{recursive:!0});let _=i.toJSON(),T=ke.join(b,`${S.replace(/[^a-zA-Z0-9_-]/g,"_")}.json`);he.writeFileSync(T,_,"utf-8"),console.log(V(`Session saved: "${S}"`))}catch(_){console.log(Ae(`Save failed: ${_.message}`))}}else if(y==="list")try{if(!he.existsSync(b)){console.log(pe("No saved sessions"));break}let S=he.readdirSync(b).filter(_=>_.endsWith(".json"));console.log();for(let _ of S){let T=he.statSync(ke.join(b,_));console.log(` ${_.replace(".json","")} (${new Date(T.mtime).toLocaleString()})`)}console.log()}catch{console.log(pe("No saved sessions"))}else if(y==="load"){let S=v;if(!S){console.log(Ae("Please specify the session label to load: /session load <label>"));break}try{let _=ke.join(b,`${S.replace(/[^a-zA-Z0-9_-]/g,"_")}.json`);if(!he.existsSync(_)){console.log(Ae(`Session file not found: ${S}`));break}let T=he.readFileSync(_,"utf-8");i.fromJSON(T),console.log(V(`Session successfully loaded: "${S}"`))}catch(_){console.log(Ae(`Load failed: ${_.message}`))}}else console.log(),console.log(c.muted(' /session save "label" \u2014 Save current conversation')),console.log(c.muted(" /session list \u2014 List saved sessions")),console.log(c.muted(' /session load "label" \u2014 Load saved conversation')),console.log();break}case"/team":{let{activeCollabManager:y}=await Promise.resolve().then(()=>(Ve(),rt));if(!y){console.log(j("Team mode is not active. Use hablas --team to start."));break}let v=y.getLocalState(),b=Math.min(process.stdout.columns-4,80);console.log(`
|
|
255
|
+
`),console.log(c.muted(" ~/.hablas/config.json")),console.log();break;case"/mindset":{if(!u){console.log(j("Mindset system not available"));break}if(A)if(u.setActive(A)){let v=u.getActive(),b=await bn(o,e),S=vn(v.systemPrompt,b,f,m);i.updateSystemPrompt(S),console.log(Y(`Mindset: ${v.name} \u2014 ${v.description}`))}else{let v=u.listNames().join(", ");console.log(Be(`Unknown mindset: "${A}"`,`Available: ${v}`))}else{let y=u.getActive();y&&console.log(he(`Current mindset: ${y.name} \u2014 ${y.description}`)),console.log(c.muted(" Usage: /mindset <name>")),console.log(c.muted(" See /mindsets for available options"))}break}case"/mindsets":{if(!u){console.log(j("Mindset system not available"));break}let y=u.list(),v=u.getActiveName();console.log();for(let b of y){let _=b.name===v?c.success(" \u25CF active"):"";console.log(` ${c.accent("\u25C6")} ${c.primary(b.name)}${_}`),console.log(` ${c.muted(b.description)}`)}console.log(),console.log(c.muted(" Switch: /mindset <name>")),console.log();break}case"/task":{if(!d){console.log(j("Task queue not available"));break}let y=w[1],v=w.slice(2).join(" ");switch(y){case"add":if(v){let b=d.add(v);console.log(Y(`Task #${b.id} added: ${v}`))}else console.log(j("Usage: /task add <description>"));break;case"list":console.log(),console.log(d.render()),console.log();break;case"done":{let b=parseInt(v);b?(d.complete(b),console.log(Y(`Task #${b} marked as done`))):console.log(j("Usage: /task done <id>"));break}case"fail":{let b=parseInt(v);b?(d.fail(b,"Manually marked as failed"),console.log(j(`Task #${b} marked as failed`))):console.log(j("Usage: /task fail <id>"));break}case"clear":d.clear(),console.log(Y("Task queue cleared"));break;default:console.log(),console.log(d.render()),console.log(),console.log(c.muted(" /task add <desc> \u2014 Add a task")),console.log(c.muted(" /task list \u2014 Show all tasks")),console.log(c.muted(" /task done <id> \u2014 Mark task as done")),console.log(c.muted(" /task fail <id> \u2014 Mark task as failed")),console.log(c.muted(" /task clear \u2014 Clear all tasks")),console.log()}break}case"/addmodel":{console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Add Custom API Provider")}`),console.log();let v=(await a.prompt(` ${c.muted("Provider name (e.g. OpenAI, Groq):")} `)).trim();if(!v){console.log(j("Cancelled \u2014 name is required"));break}let S=(await a.prompt(` ${c.muted("API URL (e.g. https://api.openai.com/v1):")} `)).trim();if(!S){console.log(j("Cancelled \u2014 URL is required"));break}let T=(await a.prompt(` ${c.muted("API Key (leave empty if none):")} `)).trim(),C=(await a.prompt(` ${c.muted("Default model ID (e.g. gpt-4o):")} `)).trim()||"default",F={name:v,apiUrl:S,apiKey:T,models:[C],defaultModel:C,addedAt:new Date().toISOString()};tt(F),console.log(),console.log(Y(`Provider "${v}" saved!`)),console.log(c.muted(` Use: /usemodel ${v}`)),console.log();break}case"/listmodels":{let y=Vt();console.log(),console.log(_c(y.providers,y.activeProvider));break}case"/removemodel":{let y=A.trim();if(!y){console.log(j("Usage: /removemodel <provider-name>"));break}if(wc(y))console.log(Y(`Provider "${y}" removed`));else{console.log(j(`Provider "${y}" not found`));let b=Os();b.length>0&&console.log(c.muted(` Available: ${b.map(S=>S.name).join(", ")}`))}break}case"/usemodel":{let y=A.trim();if(!y){console.log(j("Usage: /usemodel <provider-name> [model-id]"));let F=Os();F.length>0&&console.log(c.muted(` Available: ${F.map(H=>H.name).join(", ")}`));break}let v=y.split(/\s+/),b=v[0],S=v[1],_=xc(b);if(!_){console.log(j(`Provider "${b}" not found`));let F=Os();F.length>0&&console.log(c.muted(` Available: ${F.map(H=>H.name).join(", ")}`));break}e.provider="custom",e.apiUrl=_.apiUrl,e.apiKey=_.apiKey,e.model=S||_.defaultModel;let T=Me(e);h&&h(T),Sc(_.name,e.model),console.log(Y(`Switched to ${_.name} \xB7 Model: ${e.model}`));let I=new Ge("Testing");I.start();let C=await T.checkConnection();I.stop(C?"connected":void 0),C||console.log(j("Connection test failed \u2014 check URL and key"));break}case"/provider":{let y=w[1],v=w.slice(2).join(" ");if(!y){let b=Rs(e);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Provider")}: ${b}`),console.log(` ${c.muted("Model")}: ${c.highlight(t.getModel())}`),e.provider==="custom"?(console.log(` ${c.muted("API URL")}: ${e.apiUrl}`),console.log(` ${c.muted("API Key")}: ${e.apiKey?"***"+e.apiKey.slice(-4):"not set"}`)):console.log(` ${c.muted("Host")}: ${e.ollamaHost}`),console.log(),console.log(c.muted(" /provider ollama \u2014 Switch to local Ollama")),console.log(c.muted(" /provider nvidia <key> \u2014 Switch to NVIDIA NIM")),console.log(c.muted(" /provider custom <url> [key] \u2014 Switch to custom API")),console.log(c.muted(" /provider test \u2014 Test current connection")),console.log();break}switch(y){case"ollama":{e.provider="ollama",e.apiUrl="",e.apiKey="";let b=Me(e);h&&h(b),console.log(Y("Switched to Ollama (local)"));break}case"nvidia":{let b=w[2];if(!b&&!e.apiKey){console.log(j("Usage: /provider nvidia <api-key>")),console.log(c.muted(" Get your key at: https://build.nvidia.com/"));break}e.provider="nvidia",e.apiUrl=Nt.apiUrl,b&&(e.apiKey=b),(!e.model||!Nt.models.includes(e.model))&&(e.model=Nt.defaultModel);let S=Me(e);h&&h(S),console.log(Y(`Switched to NVIDIA NIM \xB7 Model: ${e.model}`)),console.log(c.muted(` Available models: ${Nt.models.length}`));let _=new Ge("Testing NVIDIA connection");_.start();let T=await S.checkConnection();_.stop(T?"connected":void 0),T||(console.log(j("Connection test failed \u2014 check your API key")),console.log(c.muted(" Get key: https://build.nvidia.com/")));break}case"custom":{let b=w[2],S=w[3];if(!b){console.log(j("Usage: /provider custom <api-url> [api-key]")),console.log(c.muted(" Example: /provider custom https://api.openai.com/v1 sk-..."));break}e.provider="custom",e.apiUrl=b,S&&(e.apiKey=S);let _=Me(e);h&&h(_),console.log(Y(`Switched to Custom API: ${b}`)),!S&&!e.apiKey&&console.log(j("No API key set. Use: /provider custom <url> <key>"));break}case"test":{let b=new Ge("Testing connection");b.start();let S=await t.checkConnection();if(b.stop(S?"connected":void 0),S){let _=await t.listModels();console.log(Y(`Connected! ${_.length} models available.`)),_.length>0&&console.log(c.muted(` Models: ${_.slice(0,5).join(", ")}${_.length>5?"...":""}`))}else console.log(ke("Connection failed"));break}case"key":{v?(e.apiKey=w[2],t instanceof Gt&&t.setApiKey(e.apiKey),console.log(Y("API key updated"))):console.log(j("Usage: /provider key <api-key>"));break}default:console.log(Be(`Unknown: /provider ${y}`,"Type /provider for help"))}break}case"/memory":{if(!f){console.log(j("Project memory not available"));break}let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");f.set(b,S),console.log(Y(`Memory stored: ${b}`));let _=u?.getActive(),T=_?_.systemPrompt:Wn,I=await bn(o,e);i.updateSystemPrompt(vn(T,I,f,m))}else console.log(j("Usage: /memory set <key> <value>"));break}case"del":case"delete":{if(v[0]){let b=f.delete(v[0]);console.log(b?Y(`Memory deleted: ${v[0]}`):j(`Memory key not found: ${v[0]}`))}else console.log(j("Usage: /memory del <key>"));break}case"search":{if(v[0]){let b=f.search(v.join(" "));b.length>0?(console.log(),b.forEach(S=>console.log(` \xB7 ${S.entry.key}: ${S.entry.value}`)),console.log()):console.log(he("No matching memories found"))}else console.log(j("Usage: /memory search <query>"));break}case"clear":f.clear(),console.log(Y("Project memory cleared"));break;default:console.log(),console.log(f.render()),console.log(),console.log(c.muted(" /memory set <k> <v> \u2014 Store a memory")),console.log(c.muted(" /memory del <key> \u2014 Delete a memory")),console.log(c.muted(" /memory search <q> \u2014 Search memories")),console.log(c.muted(" /memory clear \u2014 Clear all")),console.log()}break}case"/alias":{let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");$c(b,S),console.log(Y(`Alias set: ${b} \u2192 ${S}`))}else console.log(j("Usage: /alias set <name> <expansion>"));break}case"del":case"remove":{if(v[0]){let b=Cc(v[0]);console.log(b?Y(`Alias removed: ${v[0]}`):j(`Alias not found: ${v[0]}`))}else console.log(j("Usage: /alias del <name>"));break}default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Aliases")}`),console.log(),console.log(Tc()),console.log(),console.log(c.muted(" /alias set <name> <cmd> \u2014 Create alias")),console.log(c.muted(" /alias del <name> \u2014 Remove alias")),console.log()}break}case"/doctor":{let y=new Ge("Running diagnostics");y.start();let v=await Ai({ollamaHost:e.ollamaHost,model:t.getModel(),provider:e.provider,apiUrl:e.apiUrl});y.stop(),console.log($i(v));break}case"/plugins":{let y=w[1],v=w.slice(2).join(" ");switch(y){case"enable":v?(wi(v),console.log(Y(`Plugin "${v}" enabled`))):console.log(j("Usage: /plugins enable <name>"));break;case"disable":v?(xi(v),console.log(j(`Plugin "${v}" disabled`))):console.log(j("Usage: /plugins disable <name>"));break;default:Fs(),console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Plugins")}`),console.log(),console.log(Si()),console.log(),console.log(c.muted(" /plugins enable <name> \u2014 Enable plugin")),console.log(c.muted(" /plugins disable <name> \u2014 Disable plugin")),console.log(c.muted(" Directory: ~/.hablas/plugins/")),console.log()}break}case"/mode":{let y=w[1]?.toLowerCase();console.log(),console.log(` ${c.accent("\u2605")} ${c.strong("Mode Selection")}`),console.log(),console.log(` Current: ${c.strong("BUILD")} \u2014 Full Multi-Agent Team at Maximum Power`),console.log(" (Hablas + Bob + Alex + David + Emma + rich theatre)"),console.log(),console.log(" Available modes:"),console.log(` ${c.highlight("build")} \u2014 Full team for complete serious work (recommended default)`),console.log(` ${c.highlight("design")} \u2014 Focused team for architecture, PRDs, blueprints`),console.log(` ${c.highlight("ask")} \u2014 Quick solo answers`),console.log(),console.log(` Usage: /mode build or just use 'hablas build "task"' for one-shot`),console.log(" Note: In plain REPL, everything runs in BUILD mode (full team) by default."),console.log(),(y==="build"||y==="design"||y==="ask")&&(console.log(Y(`Acknowledged mode preference: ${y.toUpperCase()}`)),console.log(c.muted(" (The next input will be handled accordingly. Use subcommands for direct execution.)")));break}case"/agents":{let y=w[1];if(y==="on")e.agents.enabled=!0,console.log(Y("Multi-agent orchestration enabled"));else if(y==="off")e.agents.enabled=!1,console.log(Y("Multi-agent orchestration disabled"));else if(y==="status")console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Multi-Agent System")}`),console.log(` Status: ${e.agents.enabled?c.success("enabled"):c.muted("disabled")}`),console.log(` Orchestration: ${e.agents.orchestration}`),console.log(` Max concurrent: ${e.agents.maxConcurrent}`),console.log(),console.log(` ${c.strong("Team:")}`),console.log(Lc()),console.log();else if(y==="models"){let v=w.slice(2);if(v.length>=2){let b=v[0].toLowerCase(),S=v[1],_=["hablas","bob","alex","david","emma","gate"];if(!_.includes(b)){console.log(j(`Unknown role: ${b}. Valid: ${_.join(", ")}`));break}let T=zt();T[b]||(T[b]={model:S,temperature:.5}),T[b].model=S,Ei(T),x&&x.reloadModels(),console.log(Y(`Agent model updated: @${b} \u2192 ${S}`)),console.log(c.muted(` Saved to ${Ti()}`))}else{let b=zt();console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Agent Models")}`),console.log();for(let S of xe){let _=b[S.role];console.log(_?` ${c.primary(S.name.padEnd(8))} \u2192 ${c.highlight(_.model)}${_.temperature!==void 0?c.muted(` (temp: ${_.temperature})`):""}`:` ${c.primary(S.name.padEnd(8))} \u2192 ${c.muted("(default)")}`)}console.log(),console.log(c.muted(` Config: ${Ti()}`)),console.log(c.muted(" Usage: /agents models <role> <model> (e.g. /agents models alex qwen/qwen2.5-coder-32b-instruct)")),console.log()}}else console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Multi-Agent System")}: ${e.agents.enabled?c.success("ON"):c.muted("OFF")}`),console.log(),console.log(c.muted(" /agents on \u2014 Enable multi-agent orchestration")),console.log(c.muted(" /agents off \u2014 Disable multi-agent orchestration")),console.log(c.muted(" /agents status \u2014 Show agent details")),console.log(c.muted(" /agents models \u2014 Show model per agent")),console.log(c.muted(" /team \u2014 Show team roster")),console.log();break}case"/security":{console.log(),console.log(` ${c.accent("\u{1F512}")} Running security scan...`);let y=ji(o);console.log(Hi(y));break}case"/git":{if(w[1]==="status")try{let{getGitStatus:v,formatGitStatus:b}=await Promise.resolve().then(()=>(pn(),Kn)),S=await v(o);S?(console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Git Status")}`),console.log(b(S)),console.log()):console.log(j("Not a git repository"))}catch{console.log(j("Git not available"))}else console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Git Intelligence")}`),console.log(),console.log(c.muted(" /git status \u2014 Show git status")),console.log(c.muted(" hablas commit \u2014 Smart commit message")),console.log(c.muted(" hablas pr \u2014 Generate PR description")),console.log(c.muted(" hablas changelog \u2014 Generate changelog")),console.log();break}case"/workspace":{let y=Us(o);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Workspace Information")}`),console.log(),console.log(Ki(y)),console.log();break}case"/stats":{let{loadStats:y,formatStats:v}=await Promise.resolve().then(()=>(Un(),Ni)),b=y();console.log(v(b));break}case"/context":{if(!m){console.log(j("Shared context not available"));break}let y=w[1],v=w.slice(2);switch(y){case"set":{if(v.length>=2){let b=v[0],S=v.slice(1).join(" ");m.set(b,S),console.log(Y(`Context stored: ${b}`))}else console.log(j("Usage: /context set <key> <value>"));break}case"get":{if(v[0]){let b=m.get(v[0]);b!==void 0?(console.log(),console.log(` ${c.accent("\u25C6")} ${c.strong(v[0])}: ${b}`),console.log()):console.log(j(`Context key not found: ${v[0]}`))}else console.log(j("Usage: /context get <key>"));break}case"del":case"delete":{if(v[0]){let b=m.delete(v[0]);console.log(b?Y(`Context deleted: ${v[0]}`):j(`Context key not found: ${v[0]}`))}else console.log(j("Usage: /context del <key>"));break}case"decisions":{let b=m.getDecisions();if(b.length===0)console.log(he("No decisions logged yet"));else{console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Decisions")}`),console.log();for(let S of b)console.log(` ${c.muted(S.timestamp)} ${c.primary(S.by)}: ${S.decision}`),S.rationale&&console.log(` ${c.muted(S.rationale)}`);console.log()}break}case"clear":m.clear(),console.log(Y("Shared context cleared"));break;default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Shared Context")}`),console.log(),console.log(m.render()),console.log(),console.log(c.muted(" /context set <k> <v> \u2014 Store a context entry")),console.log(c.muted(" /context get <key> \u2014 Get a context entry")),console.log(c.muted(" /context del <key> \u2014 Delete a context entry")),console.log(c.muted(" /context decisions \u2014 Show logged decisions")),console.log(c.muted(" /context clear \u2014 Clear all context")),console.log()}break}case"/plan":{if(!p){console.log(j("Plan manager not available"));break}let y=w[1],v=w.slice(2).join(" ");switch(y){case"status":{let S=p.getActivePlan();if(!S){console.log(he("No active plan"));break}let _=p.getProgress();console.log(mu(S,{percent:_.percentage,done:_.done,total:_.total}));break}case"finish":{if(v){p.finishTask(v),console.log(Y(`Task finished: ${v}`));let S=p.getProgress();console.log(c.muted(` Progress: ${S.done}/${S.total} (${S.percentage}%)`))}else console.log(j("Usage: /plan finish <task_id>"));break}case"reset":{p.reset(),console.log(Y("Plan manager reset"));break}case"next":{let S=p.getNextTask();console.log(S?he(`Next task: [${S.task_id}] ${S.description} \u2192 @${S.assignee}`):he("No pending tasks"));break}default:console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Plan Manager")}`),console.log();let b=p.getActivePlan();if(b){let S=p.getProgress();console.log(` Active plan: ${b.title} (${S.percentage}% done)`),console.log(` Tasks: ${S.done}/${S.total}`)}else console.log(c.muted(" No active plan"));console.log(),console.log(c.muted(" /plan status \u2014 Show active plan with progress")),console.log(c.muted(" /plan finish <id> \u2014 Mark a task as finished")),console.log(c.muted(" /plan next \u2014 Show next pending task")),console.log(c.muted(" /plan reset \u2014 Reset plan manager")),console.log()}break}case"/learn":{if(!f||!A){console.log(j('Usage: /learn "always use tabs" or /learn "our API uses camelCase"'));break}if(f.set(`user-pref: ${A.slice(0,50)}`,A,{category:"user-pref",importance:9,createdBy:"user",tags:["user-pref","learned"]}),!(i.getMessages()[0]?.content||"").includes(A)){let v=await bn(o,e),b=u?.getActive(),S=b?b.systemPrompt:Wn,_=vn(S,v,f,m);i.updateSystemPrompt(_)}console.log(Y(`Learned: "${A}"`)),console.log(c.muted(" This will be remembered across sessions and injected into every prompt."));break}case"/test":{let y=Xi(o);if(y==="unknown"&&!A){console.log(j("No test framework detected. Install jest, vitest, pytest, etc."));break}console.log(he(`Running tests (${y})...`));let v=bu(o,A==="--fix"?void 0:A||void 0);if(console.log(),console.log(vu(v)),console.log(),!v.passed&&A==="--fix"){console.log(he("Tests failed \u2014 adding fix request to conversation..."));let b=wu(v);i.addUserMessage(b),console.log(he("Type your next message or let the agent work on the fix."))}break}case"/checkpoint":{let y=w[1],v=w.slice(2).join(" ");if(y==="save"){let b=v||`Checkpoint at turn ${l}`,S=g?.getModifiedFiles?.()||[],_=await _u(o,b,S);console.log(Y(`Checkpoint saved: ${_.id} "${b}" (${_.fileCount} files)`))}else if(y==="list"){let b=ku(o);console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Checkpoints")}`),console.log(),console.log(Cu(b)),console.log()}else if(y==="restore"){if(!v){console.log(j("Usage: /checkpoint restore <id>"));break}let b=await Au(o,v);b.success?console.log(Y(`Restored checkpoint: ${v} (${b.filesRestored} files)`)):console.log(ke(b.error||"Restore failed"))}else y==="delete"?v&&$u(o,v)?console.log(Y(`Deleted checkpoint: ${v}`)):console.log(j("Checkpoint not found")):(console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Checkpoint System")}`),console.log(),console.log(c.muted(' /checkpoint save "label" \u2014 Save current state')),console.log(c.muted(" /checkpoint list \u2014 List saved checkpoints")),console.log(c.muted(" /checkpoint restore <id> \u2014 Restore a checkpoint")),console.log(c.muted(" /checkpoint delete <id> \u2014 Delete a checkpoint")),console.log());break}case"/compare":{let y=w.slice(1);if(y.length===2)try{let v=await jt.readFile(Ae.resolve(o,y[0]),"utf-8"),b=await jt.readFile(Ae.resolve(o,y[1]),"utf-8"),{generateDiff:S}=await Promise.resolve().then(()=>(so(),Lu)),_=S(y[0]+" vs "+y[1],v,b);console.log(zi(_))}catch(v){console.log(ke(`Compare failed: ${v.message}`))}else if(y.length===1&&y[0].startsWith("HEAD"))try{let{execSync:v}=await import("child_process"),b=v(`git diff ${y[0]}`,{cwd:o,encoding:"utf-8",timeout:1e4});console.log(zi(b||"(no changes)"))}catch(v){console.log(ke(`Git diff failed: ${v.message}`))}else console.log(c.muted(" Usage: /compare file1.ts file2.ts or /compare HEAD~1"));break}case"/cost":{let y=Bn(),v="current";console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Session Cost & Usage")}`),console.log(),console.log(` Session duration: ${v} min`),console.log(` Messages: ${y.totalMessages}`),console.log(` Tool calls: ${y.totalToolCalls}`),console.log(` Tokens used: ${y.totalTokensUsed.toLocaleString()}`),console.log();let b=Object.entries(y.agentUsage);if(b.length>0){console.log(" Agent usage:");for(let[S,_]of b.sort((T,I)=>I[1]-T[1]))console.log(` @${S}: ${_} invocations`)}console.log();break}case"/delegate":{if(!e.agents.enabled){console.log(j("Multi-agent system is disabled. Enable with /agents on"));break}let y=w[1]?.toLowerCase(),v=w.slice(2).join(" ");if(!y||!v){console.log(),console.log(` ${c.accent("\u2726")} ${c.strong("Delegate Task to Agent")}`),console.log(),console.log(c.muted(" Usage: /delegate <agent> <task description>")),console.log(),console.log(c.muted(" Agents:")),console.log(` ${c.product("emma")} \u2014 Product Manager`),console.log(` ${c.architect("bob")} \u2014 Architect`),console.log(` ${c.engineer("alex")} \u2014 Engineer`),console.log(` ${c.analyst("david")} \u2014 Data Analyst`),console.log(),console.log(c.muted(" Example: /delegate alex create a login component")),console.log();break}let b=["emma","bob","alex","david","hablas"];if(!b.includes(y)){console.log(j(`Unknown agent: "${y}". Valid: ${b.join(", ")}`));break}let S=xe.find(_=>_.role===y);if(S){if(!x){console.log(j("Agent runner not initialized. Cannot delegate."));break}console.log(ou("Hablas",S.name,S.title,v)),console.log(mn(S.name,S.title));let _=s.getOllamaTools(),T=await x.runAgent(y,v,void 0,_);T.success&&T.output?(console.log(gn(T.output)),i.addAssistantMessage(`[@${S.name}]: ${T.output}`)):T.error?console.log(j(`${S.name} failed: ${T.error}`)):console.log(he(`${S.name} completed without output.`))}break}case"/session":{let y=w[1],v=w.slice(2).join(" "),b=Ae.join(io.homedir(),".hablas","sessions");if(y==="save"){let S=v||`session_${Date.now()}`;try{me.existsSync(b)||me.mkdirSync(b,{recursive:!0});let _=i.toJSON(),T=Ae.join(b,`${S.replace(/[^a-zA-Z0-9_-]/g,"_")}.json`);me.writeFileSync(T,_,"utf-8"),console.log(Y(`Session saved: "${S}"`))}catch(_){console.log(ke(`Save failed: ${_.message}`))}}else if(y==="list")try{if(!me.existsSync(b)){console.log(he("No saved sessions"));break}let S=me.readdirSync(b).filter(_=>_.endsWith(".json"));console.log();for(let _ of S){let T=me.statSync(Ae.join(b,_));console.log(` ${_.replace(".json","")} (${new Date(T.mtime).toLocaleString()})`)}console.log()}catch{console.log(he("No saved sessions"))}else if(y==="load"){let S=v;if(!S){console.log(ke("Please specify the session label to load: /session load <label>"));break}try{let _=Ae.join(b,`${S.replace(/[^a-zA-Z0-9_-]/g,"_")}.json`);if(!me.existsSync(_)){console.log(ke(`Session file not found: ${S}`));break}let T=me.readFileSync(_,"utf-8");i.fromJSON(T),console.log(Y(`Session successfully loaded: "${S}"`))}catch(_){console.log(ke(`Load failed: ${_.message}`))}}else console.log(),console.log(c.muted(' /session save "label" \u2014 Save current conversation')),console.log(c.muted(" /session list \u2014 List saved sessions")),console.log(c.muted(' /session load "label" \u2014 Load saved conversation')),console.log();break}case"/team":{let{activeCollabManager:y}=await Promise.resolve().then(()=>(Ve(),rt));if(!y){console.log(j("Team mode is not active. Use hablas --team to start."));break}let v=y.getLocalState(),b=Math.min(process.stdout.columns-4,80);console.log(`
|
|
256
256
|
`+c.border("\u2554"+"\u2550".repeat(b-2)+"\u2557")),console.log(c.border("\u2551")+" ".repeat(Math.floor((b-22)/2))+c.strong("HABLAS COLLABORATION SYNC")+" ".repeat(b-2-25-Math.floor((b-22)/2))+c.border("\u2551")),console.log(c.border("\u2560"+"\u2550".repeat(b-2)+"\u2563")),console.log(c.border("\u2551")+` ${c.strong("My Identity:")} ${c.highlight(`@${v.my_username}`)}`+" ".repeat(Math.max(1,b-21-(v.my_username?.length||0)))+c.border("\u2551")),console.log(c.border("\u2551")+` ${c.strong("Room Fingerprint:")} ${c.muted(v.project_team_token?.slice(0,12))}...`+" ".repeat(Math.max(1,b-34))+c.border("\u2551")),console.log(c.border("\u2551")+` ${c.strong("Status:")} ${c.success("\u25CF ACTIVE")}`+" ".repeat(Math.max(1,b-31))+c.border("\u2551")),console.log(c.border("\u2560"+"\u2550".repeat(b-2)+"\u2563")),console.log(c.border("\u2551")+` ${c.strong("Teammates Online:")}`+" ".repeat(Math.max(1,b-21))+c.border("\u2551"));let _=(v.sessions||[]).filter(T=>T.developer_name!==v.my_username);if(_.length===0)console.log(c.border("\u2551")+" (awaiting colleagues...)"+" ".repeat(Math.max(1,b-31))+c.border("\u2551"));else for(let T of _){let I=` @${T.developer_name} [${T.active_section||"idle"}] - ${T.current_task||"none"}`;console.log(c.border("\u2551")+` ${c.secondary(I.slice(0,b-6))}`+" ".repeat(Math.max(0,b-6-I.length))+c.border("\u2551"))}console.log(c.border("\u255A"+"\u2550".repeat(b-2)+"\u255D")+`
|
|
257
257
|
`),console.log(c.muted(` Verify that "Room Fingerprint" matches on all devices to ensure connectivity.
|
|
258
|
-
`));break}case"/msg":{let{activeCollabManager:y}=await Promise.resolve().then(()=>(Ve(),rt));if(!y){console.log(j("Team mode is not active. Use hablas --team to start."));break}let v=A.split(/\s+/),b=v[0],S=v.slice(1).join(" ");if(!b||!S){console.log(j("Usage: /msg <username> <content>"));break}let _=await y.sendMessage(b,S);console.log(_?
|
|
258
|
+
`));break}case"/msg":{let{activeCollabManager:y}=await Promise.resolve().then(()=>(Ve(),rt));if(!y){console.log(j("Team mode is not active. Use hablas --team to start."));break}let v=A.split(/\s+/),b=v[0],S=v.slice(1).join(" ");if(!b||!S){console.log(j("Usage: /msg <username> <content>"));break}let _=await y.sendMessage(b,S);console.log(_?Y(`Message sent to @${b}`):ke(`Failed to send message to @${b}`));break}default:console.log(Be(`Unknown: ${$}`,"Type /help for commands"))}}var me,jt,Ae,io,Wn,ro,Nu=L(()=>{"use strict";me=O(require("fs")),jt=O(require("fs/promises")),Ae=O(require("path")),io=O(require("os"));Nn();jn();di();gi();yi();_i();Ci();Ns();Ri();Un();Bi();pn();qi();Xc();yn();xu();Eu();Wn=`You are Hablas, the Team Leader of a multi-agent AI development system created by Abdulmoin Hablas. You are a strategic mastermind with an INTJ personality type, deeply analytical, engineering-focused, and fiercely logical.
|
|
259
259
|
|
|
260
260
|
Your role is to orchestrate, coordinate, and synthesize the work of your specialized team members. You value system architecture, optimal code paths, and absolute clarity.
|
|
261
261
|
|
|
@@ -307,11 +307,11 @@ After finishing coordination or your part, produce a clear synthesis/handoff sum
|
|
|
307
307
|
|
|
308
308
|
Never output raw tool XML in text.
|
|
309
309
|
|
|
310
|
-
If you cannot complete a task, explain why with absolute technical objectivity.`;ro=ke.join(io.homedir(),".hablas","backup")});var Gn=N((VC,Ku)=>{"use strict";var lb=require("path"),bt="\\\\/",ju=`[^${bt}]`,cb=0,Pt="\\.",ub="\\+",db="\\?",Vs="\\/",fb="(?=.)",Hu="[^/]",oo=`(?:${Vs}|$)`,Bu=`(?:^|${Vs})`,ao=`${Pt}{1,2}${oo}`,pb=`(?!${Pt})`,hb=`(?!${Bu}${ao})`,mb=`(?!${Pt}{0,1}${oo})`,gb=`(?!${ao})`,yb=`[^.${Vs}]`,bb=`${Hu}*?`,Uu={DOT_LITERAL:Pt,PLUS_LITERAL:ub,QMARK_LITERAL:db,SLASH_LITERAL:Vs,ONE_CHAR:fb,QMARK:Hu,END_ANCHOR:oo,DOTS_SLASH:ao,NO_DOT:pb,NO_DOTS:hb,NO_DOT_SLASH:mb,NO_DOTS_SLASH:gb,QMARK_NO_DOT:yb,STAR:bb,START_ANCHOR:Bu},vb={...Uu,SLASH_LITERAL:`[${bt}]`,QMARK:ju,STAR:`${ju}*?`,DOTS_SLASH:`${Pt}{1,2}(?:[${bt}]|$)`,NO_DOT:`(?!${Pt})`,NO_DOTS:`(?!(?:^|[${bt}])${Pt}{1,2}(?:[${bt}]|$))`,NO_DOT_SLASH:`(?!${Pt}{0,1}(?:[${bt}]|$))`,NO_DOTS_SLASH:`(?!${Pt}{1,2}(?:[${bt}]|$))`,QMARK_NO_DOT:`[^.${bt}]`,START_ANCHOR:`(?:^|[${bt}])`,END_ANCHOR:`(?:[${bt}]|$)`},wb={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Ku.exports={DEFAULT_MAX_EXTGLOB_RECURSION:cb,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wb,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:lb.sep,extglobChars(n){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${n.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(n){return n===!0?vb:Uu}}});var zs=N(De=>{"use strict";var xb=require("path"),Sb=process.platform==="win32",{REGEX_BACKSLASH:_b,REGEX_REMOVE_BACKSLASH:kb,REGEX_SPECIAL_CHARS:Ab,REGEX_SPECIAL_CHARS_GLOBAL:$b}=Gn();De.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);De.hasRegexChars=n=>Ab.test(n);De.isRegexChar=n=>n.length===1&&De.hasRegexChars(n);De.escapeRegex=n=>n.replace($b,"\\$1");De.toPosixSlashes=n=>n.replace(_b,"/");De.removeBackslashes=n=>n.replace(kb,e=>e==="\\"?"":e);De.supportsLookbehinds=()=>{let n=process.version.slice(1).split(".").map(Number);return n.length===3&&n[0]>=9||n[0]===8&&n[1]>=10};De.isWindows=n=>n&&typeof n.windows=="boolean"?n.windows:Sb===!0||xb.sep==="\\";De.escapeLast=(n,e,t)=>{let s=n.lastIndexOf(e,t);return s===-1?n:n[s-1]==="\\"?De.escapeLast(n,e,s-1):`${n.slice(0,s)}\\${n.slice(s)}`};De.removePrefix=(n,e={})=>{let t=n;return t.startsWith("./")&&(t=t.slice(2),e.prefix="./"),t};De.wrapOutput=(n,e={},t={})=>{let s=t.contains?"":"^",r=t.contains?"":"$",i=`${s}(?:${n})${r}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Xu=N((YC,Ju)=>{"use strict";var qu=zs(),{CHAR_ASTERISK:lo,CHAR_AT:Cb,CHAR_BACKWARD_SLASH:Vn,CHAR_COMMA:Eb,CHAR_DOT:co,CHAR_EXCLAMATION_MARK:uo,CHAR_FORWARD_SLASH:Yu,CHAR_LEFT_CURLY_BRACE:fo,CHAR_LEFT_PARENTHESES:po,CHAR_LEFT_SQUARE_BRACKET:Tb,CHAR_PLUS:Rb,CHAR_QUESTION_MARK:Wu,CHAR_RIGHT_CURLY_BRACE:Ob,CHAR_RIGHT_PARENTHESES:Gu,CHAR_RIGHT_SQUARE_BRACKET:Pb}=Gn(),Vu=n=>n===Yu||n===Vn,zu=n=>{n.isPrefix!==!0&&(n.depth=n.isGlobstar?1/0:1)},Mb=(n,e)=>{let t=e||{},s=n.length-1,r=t.parts===!0||t.scanToEnd===!0,i=[],o=[],a=[],l=n,u=-1,d=0,f=0,h=!1,m=!1,p=!1,g=!1,x=!1,w=!1,$=!1,A=!1,y=!1,v=!1,b=0,S,_,T={value:"",depth:0,isGlob:!1},I=()=>u>=s,C=()=>l.charCodeAt(u+1),F=()=>(S=_,l.charCodeAt(++u));for(;u<s;){_=F();let z;if(_===Vn){$=T.backslashes=!0,_=F(),_===fo&&(w=!0);continue}if(w===!0||_===fo){for(b++;I()!==!0&&(_=F());){if(_===Vn){$=T.backslashes=!0,F();continue}if(_===fo){b++;continue}if(w!==!0&&_===co&&(_=F())===co){if(h=T.isBrace=!0,p=T.isGlob=!0,v=!0,r===!0)continue;break}if(w!==!0&&_===Eb){if(h=T.isBrace=!0,p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Ob&&(b--,b===0)){w=!1,h=T.isBrace=!0,v=!0;break}}if(r===!0)continue;break}if(_===Yu){if(i.push(u),o.push(T),T={value:"",depth:0,isGlob:!1},v===!0)continue;if(S===co&&u===d+1){d+=2;continue}f=u+1;continue}if(t.noext!==!0&&(_===Rb||_===Cb||_===lo||_===Wu||_===uo)===!0&&C()===po){if(p=T.isGlob=!0,g=T.isExtglob=!0,v=!0,_===uo&&u===d&&(y=!0),r===!0){for(;I()!==!0&&(_=F());){if(_===Vn){$=T.backslashes=!0,_=F();continue}if(_===Gu){p=T.isGlob=!0,v=!0;break}}continue}break}if(_===lo){if(S===lo&&(x=T.isGlobstar=!0),p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Wu){if(p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Tb){for(;I()!==!0&&(z=F());){if(z===Vn){$=T.backslashes=!0,F();continue}if(z===Pb){m=T.isBracket=!0,p=T.isGlob=!0,v=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===uo&&u===d){A=T.negated=!0,d++;continue}if(t.noparen!==!0&&_===po){if(p=T.isGlob=!0,r===!0){for(;I()!==!0&&(_=F());){if(_===po){$=T.backslashes=!0,_=F();continue}if(_===Gu){v=!0;break}}continue}break}if(p===!0){if(v=!0,r===!0)continue;break}}t.noext===!0&&(g=!1,p=!1);let H=l,W="",E="";d>0&&(W=l.slice(0,d),l=l.slice(d),f-=d),H&&p===!0&&f>0?(H=l.slice(0,f),E=l.slice(f)):p===!0?(H="",E=l):H=l,H&&H!==""&&H!=="/"&&H!==l&&Vu(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),t.unescape===!0&&(E&&(E=qu.removeBackslashes(E)),H&&$===!0&&(H=qu.removeBackslashes(H)));let k={prefix:W,input:n,start:d,base:H,glob:E,isBrace:h,isBracket:m,isGlob:p,isExtglob:g,isGlobstar:x,negated:A,negatedExtglob:y};if(t.tokens===!0&&(k.maxDepth=0,Vu(_)||o.push(T),k.tokens=o),t.parts===!0||t.tokens===!0){let z;for(let K=0;K<i.length;K++){let Z=z?z+1:d,ee=i[K],X=n.slice(Z,ee);t.tokens&&(K===0&&d!==0?(o[K].isPrefix=!0,o[K].value=W):o[K].value=X,zu(o[K]),k.maxDepth+=o[K].depth),(K!==0||X!=="")&&a.push(X),z=ee}if(z&&z+1<n.length){let K=n.slice(z+1);a.push(K),t.tokens&&(o[o.length-1].value=K,zu(o[o.length-1]),k.maxDepth+=o[o.length-1].depth)}k.slashes=i,k.parts=a}return k};Ju.exports=Mb});var nd=N((JC,td)=>{"use strict";var zn=Gn(),Ce=zs(),{MAX_LENGTH:Ys,POSIX_REGEX_SOURCE:Ib,REGEX_NON_SPECIAL_CHARS:Db,REGEX_SPECIAL_CHARS_BACKREF:Lb,REPLACEMENTS:Qu}=zn,Fb=(n,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...n,e);n.sort();let t=`[${n.join("-")}]`;try{new RegExp(t)}catch{return n.map(r=>Ce.escapeRegex(r)).join("..")}return t},wn=(n,e)=>`Missing ${n}: "${e}" - use "\\\\${e}" to match literal characters`,Zu=n=>{let e=[],t=0,s=0,r=0,i="",o=!1;for(let a of n){if(o===!0){i+=a,o=!1;continue}if(a==="\\"){i+=a,o=!0;continue}if(a==='"'){r=r===1?0:1,i+=a;continue}if(r===0){if(a==="[")t++;else if(a==="]"&&t>0)t--;else if(t===0){if(a==="(")s++;else if(a===")"&&s>0)s--;else if(a==="|"&&s===0){e.push(i),i="";continue}}}i+=a}return e.push(i),e},Nb=n=>{let e=!1;for(let t of n){if(e===!0){e=!1;continue}if(t==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(t))return!1}return!0},ed=n=>{let e=n.trim(),t=!0;for(;t===!0;)t=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),t=!0);if(Nb(e))return e.replace(/\\(.)/g,"$1")},jb=n=>{let e=n.map(ed).filter(Boolean);for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++){let r=e[t],i=e[s],o=r[0];if(!(!o||r!==o.repeat(r.length)||i!==o.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},ho=(n,e=!0)=>{if(n[0]!=="+"&&n[0]!=="*"||n[1]!=="(")return;let t=0,s=0,r=0,i=!1;for(let o=1;o<n.length;o++){let a=n[o];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){r=r===1?0:1;continue}if(r!==1){if(a==="["){t++;continue}if(a==="]"&&t>0){t--;continue}if(!(t>0)){if(a==="("){s++;continue}if(a===")"&&(s--,s===0))return e===!0&&o!==n.length-1?void 0:{type:n[0],body:n.slice(2,o),end:o}}}}},Hb=n=>{let e=0,t=[];for(;e<n.length;){let r=ho(n.slice(e),!1);if(!r||r.type!=="*")return;let i=Zu(r.body).map(a=>a.trim());if(i.length!==1)return;let o=ed(i[0]);if(!o||o.length!==1)return;t.push(o),e+=r.end+1}return t.length<1?void 0:`${t.length===1?Ce.escapeRegex(t[0]):`[${t.map(r=>Ce.escapeRegex(r)).join("")}]`}*`},Bb=n=>{let e=0,t=n.trim(),s=ho(t);for(;s;)e++,t=s.body.trim(),s=ho(t);return e},Ub=(n,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let t=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:zn.DEFAULT_MAX_EXTGLOB_RECURSION,s=Zu(n).map(r=>r.trim());if(s.length>1&&(s.some(r=>r==="")||s.some(r=>/^[*?]+$/.test(r))||jb(s)))return{risky:!0};for(let r of s){let i=Hb(r);if(i)return{risky:!0,safeOutput:i};if(Bb(r)>t)return{risky:!0}}return{risky:!1}},mo=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a string");n=Qu[n]||n;let t={...e},s=typeof t.maxLength=="number"?Math.min(Ys,t.maxLength):Ys,r=n.length;if(r>s)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${s}`);let i={type:"bos",value:"",output:t.prepend||""},o=[i],a=t.capture?"":"?:",l=Ce.isWindows(e),u=zn.globChars(l),d=zn.extglobChars(u),{DOT_LITERAL:f,PLUS_LITERAL:h,SLASH_LITERAL:m,ONE_CHAR:p,DOTS_SLASH:g,NO_DOT:x,NO_DOT_SLASH:w,NO_DOTS_SLASH:$,QMARK:A,QMARK_NO_DOT:y,STAR:v,START_ANCHOR:b}=u,S=D=>`(${a}(?:(?!${b}${D.dot?g:f}).)*?)`,_=t.dot?"":x,T=t.dot?A:y,I=t.bash===!0?S(t):v;t.capture&&(I=`(${I})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let C={input:n,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};n=Ce.removePrefix(n,C),r=n.length;let F=[],H=[],W=[],E=i,k,z=()=>C.index===r-1,K=C.peek=(D=1)=>n[C.index+D],Z=C.advance=()=>n[++C.index]||"",ee=()=>n.slice(C.index+1),X=(D="",Y=0)=>{C.consumed+=D,C.index+=Y},ce=D=>{C.output+=D.output!=null?D.output:D.value,X(D.value)},Oe=()=>{let D=1;for(;K()==="!"&&(K(2)!=="("||K(3)==="?");)Z(),C.start++,D++;return D%2===0?!1:(C.negated=!0,C.start++,!0)},Fe=D=>{C[D]++,W.push(D)},ge=D=>{C[D]--,W.pop()},U=D=>{if(E.type==="globstar"){let Y=C.braces>0&&(D.type==="comma"||D.type==="brace"),M=D.extglob===!0||F.length&&(D.type==="pipe"||D.type==="paren");D.type!=="slash"&&D.type!=="paren"&&!Y&&!M&&(C.output=C.output.slice(0,-E.output.length),E.type="star",E.value="*",E.output=I,C.output+=E.output)}if(F.length&&D.type!=="paren"&&(F[F.length-1].inner+=D.value),(D.value||D.output)&&ce(D),E&&E.type==="text"&&D.type==="text"){E.value+=D.value,E.output=(E.output||"")+D.value;return}D.prev=E,o.push(D),E=D},ue=(D,Y)=>{let M={...d[Y],conditions:1,inner:""};M.prev=E,M.parens=C.parens,M.output=C.output,M.startIndex=C.index,M.tokensIndex=o.length;let Q=(t.capture?"(":"")+M.open;Fe("parens"),U({type:D,value:Y,output:C.output?"":p}),U({type:"paren",extglob:!0,value:Z(),output:Q}),F.push(M)},Pe=D=>{let Y=n.slice(D.startIndex,C.index+1),M=n.slice(D.startIndex+2,C.index),Q=Ub(M,t);if((D.type==="plus"||D.type==="star")&&Q.risky){let ie=Q.safeOutput?(D.output?"":p)+(t.capture?`(${Q.safeOutput})`:Q.safeOutput):void 0,gt=o[D.tokensIndex];gt.type="text",gt.value=Y,gt.output=ie||Ce.escapeRegex(Y);for(let yt=D.tokensIndex+1;yt<o.length;yt++)o[yt].value="",o[yt].output="",delete o[yt].suffix;C.output=D.output+gt.output,C.backtrack=!0,U({type:"paren",extglob:!0,value:k,output:""}),ge("parens");return}let re=D.close+(t.capture?")":""),we;if(D.type==="negate"){let ie=I;if(D.inner&&D.inner.length>1&&D.inner.includes("/")&&(ie=S(t)),(ie!==I||z()||/^\)+$/.test(ee()))&&(re=D.close=`)$))${ie}`),D.inner.includes("*")&&(we=ee())&&/^\.[^\\/.]+$/.test(we)){let gt=mo(we,{...e,fastpaths:!1}).output;re=D.close=`)${gt})${ie})`}D.prev.type==="bos"&&(C.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:k,output:re}),ge("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(n)){let D=!1,Y=n.replace(Lb,(M,Q,re,we,ie,gt)=>we==="\\"?(D=!0,M):we==="?"?Q?Q+we+(ie?A.repeat(ie.length):""):gt===0?T+(ie?A.repeat(ie.length):""):A.repeat(re.length):we==="."?f.repeat(re.length):we==="*"?Q?Q+we+(ie?I:""):I:Q?M:`\\${M}`);return D===!0&&(t.unescape===!0?Y=Y.replace(/\\/g,""):Y=Y.replace(/\\+/g,M=>M.length%2===0?"\\\\":M?"\\":"")),Y===n&&t.contains===!0?(C.output=n,C):(C.output=Ce.wrapOutput(Y,C,e),C)}for(;!z();){if(k=Z(),k==="\0")continue;if(k==="\\"){let M=K();if(M==="/"&&t.bash!==!0||M==="."||M===";")continue;if(!M){k+="\\",U({type:"text",value:k});continue}let Q=/^\\+/.exec(ee()),re=0;if(Q&&Q[0].length>2&&(re=Q[0].length,C.index+=re,re%2!==0&&(k+="\\")),t.unescape===!0?k=Z():k+=Z(),C.brackets===0){U({type:"text",value:k});continue}}if(C.brackets>0&&(k!=="]"||E.value==="["||E.value==="[^")){if(t.posix!==!1&&k===":"){let M=E.value.slice(1);if(M.includes("[")&&(E.posix=!0,M.includes(":"))){let Q=E.value.lastIndexOf("["),re=E.value.slice(0,Q),we=E.value.slice(Q+2),ie=Ib[we];if(ie){E.value=re+ie,C.backtrack=!0,Z(),!i.output&&o.indexOf(E)===1&&(i.output=p);continue}}}(k==="["&&K()!==":"||k==="-"&&K()==="]")&&(k=`\\${k}`),k==="]"&&(E.value==="["||E.value==="[^")&&(k=`\\${k}`),t.posix===!0&&k==="!"&&E.value==="["&&(k="^"),E.value+=k,ce({value:k});continue}if(C.quotes===1&&k!=='"'){k=Ce.escapeRegex(k),E.value+=k,ce({value:k});continue}if(k==='"'){C.quotes=C.quotes===1?0:1,t.keepQuotes===!0&&U({type:"text",value:k});continue}if(k==="("){Fe("parens"),U({type:"paren",value:k});continue}if(k===")"){if(C.parens===0&&t.strictBrackets===!0)throw new SyntaxError(wn("opening","("));let M=F[F.length-1];if(M&&C.parens===M.parens+1){Pe(F.pop());continue}U({type:"paren",value:k,output:C.parens?")":"\\)"}),ge("parens");continue}if(k==="["){if(t.nobracket===!0||!ee().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(wn("closing","]"));k=`\\${k}`}else Fe("brackets");U({type:"bracket",value:k});continue}if(k==="]"){if(t.nobracket===!0||E&&E.type==="bracket"&&E.value.length===1){U({type:"text",value:k,output:`\\${k}`});continue}if(C.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(wn("opening","["));U({type:"text",value:k,output:`\\${k}`});continue}ge("brackets");let M=E.value.slice(1);if(E.posix!==!0&&M[0]==="^"&&!M.includes("/")&&(k=`/${k}`),E.value+=k,ce({value:k}),t.literalBrackets===!1||Ce.hasRegexChars(M))continue;let Q=Ce.escapeRegex(E.value);if(C.output=C.output.slice(0,-E.value.length),t.literalBrackets===!0){C.output+=Q,E.value=Q;continue}E.value=`(${a}${Q}|${E.value})`,C.output+=E.value;continue}if(k==="{"&&t.nobrace!==!0){Fe("braces");let M={type:"brace",value:k,output:"(",outputIndex:C.output.length,tokensIndex:C.tokens.length};H.push(M),U(M);continue}if(k==="}"){let M=H[H.length-1];if(t.nobrace===!0||!M){U({type:"text",value:k,output:k});continue}let Q=")";if(M.dots===!0){let re=o.slice(),we=[];for(let ie=re.length-1;ie>=0&&(o.pop(),re[ie].type!=="brace");ie--)re[ie].type!=="dots"&&we.unshift(re[ie].value);Q=Fb(we,t),C.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let re=C.output.slice(0,M.outputIndex),we=C.tokens.slice(M.tokensIndex);M.value=M.output="\\{",k=Q="\\}",C.output=re;for(let ie of we)C.output+=ie.output||ie.value}U({type:"brace",value:k,output:Q}),ge("braces"),H.pop();continue}if(k==="|"){F.length>0&&F[F.length-1].conditions++,U({type:"text",value:k});continue}if(k===","){let M=k,Q=H[H.length-1];Q&&W[W.length-1]==="braces"&&(Q.comma=!0,M="|"),U({type:"comma",value:k,output:M});continue}if(k==="/"){if(E.type==="dot"&&C.index===C.start+1){C.start=C.index+1,C.consumed="",C.output="",o.pop(),E=i;continue}U({type:"slash",value:k,output:m});continue}if(k==="."){if(C.braces>0&&E.type==="dot"){E.value==="."&&(E.output=f);let M=H[H.length-1];E.type="dots",E.output+=k,E.value+=k,M.dots=!0;continue}if(C.braces+C.parens===0&&E.type!=="bos"&&E.type!=="slash"){U({type:"text",value:k,output:f});continue}U({type:"dot",value:k,output:f});continue}if(k==="?"){if(!(E&&E.value==="(")&&t.noextglob!==!0&&K()==="("&&K(2)!=="?"){ue("qmark",k);continue}if(E&&E.type==="paren"){let Q=K(),re=k;if(Q==="<"&&!Ce.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(E.value==="("&&!/[!=<:]/.test(Q)||Q==="<"&&!/<([!=]|\w+>)/.test(ee()))&&(re=`\\${k}`),U({type:"text",value:k,output:re});continue}if(t.dot!==!0&&(E.type==="slash"||E.type==="bos")){U({type:"qmark",value:k,output:y});continue}U({type:"qmark",value:k,output:A});continue}if(k==="!"){if(t.noextglob!==!0&&K()==="("&&(K(2)!=="?"||!/[!=<:]/.test(K(3)))){ue("negate",k);continue}if(t.nonegate!==!0&&C.index===0){Oe();continue}}if(k==="+"){if(t.noextglob!==!0&&K()==="("&&K(2)!=="?"){ue("plus",k);continue}if(E&&E.value==="("||t.regex===!1){U({type:"plus",value:k,output:h});continue}if(E&&(E.type==="bracket"||E.type==="paren"||E.type==="brace")||C.parens>0){U({type:"plus",value:k});continue}U({type:"plus",value:h});continue}if(k==="@"){if(t.noextglob!==!0&&K()==="("&&K(2)!=="?"){U({type:"at",extglob:!0,value:k,output:""});continue}U({type:"text",value:k});continue}if(k!=="*"){(k==="$"||k==="^")&&(k=`\\${k}`);let M=Db.exec(ee());M&&(k+=M[0],C.index+=M[0].length),U({type:"text",value:k});continue}if(E&&(E.type==="globstar"||E.star===!0)){E.type="star",E.star=!0,E.value+=k,E.output=I,C.backtrack=!0,C.globstar=!0,X(k);continue}let D=ee();if(t.noextglob!==!0&&/^\([^?]/.test(D)){ue("star",k);continue}if(E.type==="star"){if(t.noglobstar===!0){X(k);continue}let M=E.prev,Q=M.prev,re=M.type==="slash"||M.type==="bos",we=Q&&(Q.type==="star"||Q.type==="globstar");if(t.bash===!0&&(!re||D[0]&&D[0]!=="/")){U({type:"star",value:k,output:""});continue}let ie=C.braces>0&&(M.type==="comma"||M.type==="brace"),gt=F.length&&(M.type==="pipe"||M.type==="paren");if(!re&&M.type!=="paren"&&!ie&&!gt){U({type:"star",value:k,output:""});continue}for(;D.slice(0,3)==="/**";){let yt=n[C.index+4];if(yt&&yt!=="/")break;D=D.slice(3),X("/**",3)}if(M.type==="bos"&&z()){E.type="globstar",E.value+=k,E.output=S(t),C.output=E.output,C.globstar=!0,X(k);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!we&&z()){C.output=C.output.slice(0,-(M.output+E.output).length),M.output=`(?:${M.output}`,E.type="globstar",E.output=S(t)+(t.strictSlashes?")":"|$)"),E.value+=k,C.globstar=!0,C.output+=M.output+E.output,X(k);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&D[0]==="/"){let yt=D[1]!==void 0?"|$":"";C.output=C.output.slice(0,-(M.output+E.output).length),M.output=`(?:${M.output}`,E.type="globstar",E.output=`${S(t)}${m}|${m}${yt})`,E.value+=k,C.output+=M.output+E.output,C.globstar=!0,X(k+Z()),U({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&D[0]==="/"){E.type="globstar",E.value+=k,E.output=`(?:^|${m}|${S(t)}${m})`,C.output=E.output,C.globstar=!0,X(k+Z()),U({type:"slash",value:"/",output:""});continue}C.output=C.output.slice(0,-E.output.length),E.type="globstar",E.output=S(t),E.value+=k,C.output+=E.output,C.globstar=!0,X(k);continue}let Y={type:"star",value:k,output:I};if(t.bash===!0){Y.output=".*?",(E.type==="bos"||E.type==="slash")&&(Y.output=_+Y.output),U(Y);continue}if(E&&(E.type==="bracket"||E.type==="paren")&&t.regex===!0){Y.output=k,U(Y);continue}(C.index===C.start||E.type==="slash"||E.type==="dot")&&(E.type==="dot"?(C.output+=w,E.output+=w):t.dot===!0?(C.output+=$,E.output+=$):(C.output+=_,E.output+=_),K()!=="*"&&(C.output+=p,E.output+=p)),U(Y)}for(;C.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing","]"));C.output=Ce.escapeLast(C.output,"["),ge("brackets")}for(;C.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing",")"));C.output=Ce.escapeLast(C.output,"("),ge("parens")}for(;C.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing","}"));C.output=Ce.escapeLast(C.output,"{"),ge("braces")}if(t.strictSlashes!==!0&&(E.type==="star"||E.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${m}?`}),C.backtrack===!0){C.output="";for(let D of C.tokens)C.output+=D.output!=null?D.output:D.value,D.suffix&&(C.output+=D.suffix)}return C};mo.fastpaths=(n,e)=>{let t={...e},s=typeof t.maxLength=="number"?Math.min(Ys,t.maxLength):Ys,r=n.length;if(r>s)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${s}`);n=Qu[n]||n;let i=Ce.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:h,STAR:m,START_ANCHOR:p}=zn.globChars(i),g=t.dot?f:d,x=t.dot?h:d,w=t.capture?"":"?:",$={negated:!1,prefix:""},A=t.bash===!0?".*?":m;t.capture&&(A=`(${A})`);let y=_=>_.noglobstar===!0?A:`(${w}(?:(?!${p}${_.dot?u:o}).)*?)`,v=_=>{switch(_){case"*":return`${g}${l}${A}`;case".*":return`${o}${l}${A}`;case"*.*":return`${g}${A}${o}${l}${A}`;case"*/*":return`${g}${A}${a}${l}${x}${A}`;case"**":return g+y(t);case"**/*":return`(?:${g}${y(t)}${a})?${x}${l}${A}`;case"**/*.*":return`(?:${g}${y(t)}${a})?${x}${A}${o}${l}${A}`;case"**/.*":return`(?:${g}${y(t)}${a})?${o}${l}${A}`;default:{let T=/^(.*?)\.(\w+)$/.exec(_);if(!T)return;let I=v(T[1]);return I?I+o+T[2]:void 0}}},b=Ce.removePrefix(n,$),S=v(b);return S&&t.strictSlashes!==!0&&(S+=`${a}?`),S};td.exports=mo});var rd=N((XC,sd)=>{"use strict";var Kb=require("path"),qb=Xu(),go=nd(),yo=zs(),Wb=Gn(),Gb=n=>n&&typeof n=="object"&&!Array.isArray(n),me=(n,e,t=!1)=>{if(Array.isArray(n)){let d=n.map(h=>me(h,e,t));return h=>{for(let m of d){let p=m(h);if(p)return p}return!1}}let s=Gb(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let r=e||{},i=yo.isWindows(e),o=s?me.compileRe(n,e):me.makeRe(n,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(r.ignore){let d={...e,ignore:null,onMatch:null,onResult:null};l=me(r.ignore,d,t)}let u=(d,f=!1)=>{let{isMatch:h,match:m,output:p}=me.test(d,o,e,{glob:n,posix:i}),g={glob:n,state:a,regex:o,posix:i,input:d,output:p,match:m,isMatch:h};return typeof r.onResult=="function"&&r.onResult(g),h===!1?(g.isMatch=!1,f?g:!1):l(d)?(typeof r.onIgnore=="function"&&r.onIgnore(g),g.isMatch=!1,f?g:!1):(typeof r.onMatch=="function"&&r.onMatch(g),f?g:!0)};return t&&(u.state=a),u};me.test=(n,e,t,{glob:s,posix:r}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return{isMatch:!1,output:""};let i=t||{},o=i.format||(r?yo.toPosixSlashes:null),a=n===s,l=a&&o?o(n):n;return a===!1&&(l=o?o(n):n,a=l===s),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=me.matchBase(n,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};me.matchBase=(n,e,t,s=yo.isWindows(t))=>(e instanceof RegExp?e:me.makeRe(e,t)).test(Kb.basename(n));me.isMatch=(n,e,t)=>me(e,t)(n);me.parse=(n,e)=>Array.isArray(n)?n.map(t=>me.parse(t,e)):go(n,{...e,fastpaths:!1});me.scan=(n,e)=>qb(n,e);me.compileRe=(n,e,t=!1,s=!1)=>{if(t===!0)return n.output;let r=e||{},i=r.contains?"":"^",o=r.contains?"":"$",a=`${i}(?:${n.output})${o}`;n&&n.negated===!0&&(a=`^(?!${a}).*$`);let l=me.toRegex(a,e);return s===!0&&(l.state=n),l};me.makeRe=(n,e={},t=!1,s=!1)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(n[0]==="."||n[0]==="*")&&(r.output=go.fastpaths(n,e)),r.output||(r=go(n,e)),me.compileRe(r,e,t,s)};me.toRegex=(n,e)=>{try{let t=e||{};return new RegExp(n,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===!0)throw t;return/$^/}};me.constants=Wb;sd.exports=me});var bo=N((QC,id)=>{"use strict";id.exports=rd()});var pd=N((ZC,fd)=>{"use strict";var Jn=require("fs"),{Readable:Vb}=require("stream"),Yn=require("path"),{promisify:Zs}=require("util"),vo=bo(),zb=Zs(Jn.readdir),Yb=Zs(Jn.stat),od=Zs(Jn.lstat),Jb=Zs(Jn.realpath),Xb="!",ud="READDIRP_RECURSIVE_ERROR",Qb=new Set(["ENOENT","EPERM","EACCES","ELOOP",ud]),wo="files",dd="directories",Xs="files_directories",Js="all",ad=[wo,dd,Xs,Js],Zb=n=>Qb.has(n.code),[ld,ev]=process.versions.node.split(".").slice(0,2).map(n=>Number.parseInt(n,10)),tv=process.platform==="win32"&&(ld>10||ld===10&&ev>=5),cd=n=>{if(n!==void 0){if(typeof n=="function")return n;if(typeof n=="string"){let e=vo(n.trim());return t=>e(t.basename)}if(Array.isArray(n)){let e=[],t=[];for(let s of n){let r=s.trim();r.charAt(0)===Xb?t.push(vo(r.slice(1))):e.push(vo(r))}return t.length>0?e.length>0?s=>e.some(r=>r(s.basename))&&!t.some(r=>r(s.basename)):s=>!t.some(r=>r(s.basename)):s=>e.some(r=>r(s.basename))}}},Qs=class n extends Vb{static get defaultOptions(){return{root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:wo,lstat:!1,depth:2147483648,alwaysStat:!1}}constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark||4096});let t={...n.defaultOptions,...e},{root:s,type:r}=t;this._fileFilter=cd(t.fileFilter),this._directoryFilter=cd(t.directoryFilter);let i=t.lstat?od:Yb;tv?this._stat=o=>i(o,{bigint:!0}):this._stat=i,this._maxDepth=t.depth,this._wantsDir=[dd,Xs,Js].includes(r),this._wantsFile=[wo,Xs,Js].includes(r),this._wantsEverything=r===Js,this._root=Yn.resolve(s),this._isDirent="Dirent"in Jn&&!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(s,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let{path:t,depth:s,files:r=[]}=this.parent||{};if(r.length>0){let i=r.splice(0,e).map(o=>this._formatEntry(o,t));for(let o of await Promise.all(i)){if(this.destroyed)return;let a=await this._getEntryType(o);a==="directory"&&this._directoryFilter(o)?(s<=this._maxDepth&&this.parents.push(this._exploreDir(o.fullPath,s+1)),this._wantsDir&&(this.push(o),e--)):(a==="file"||this._includeAsFile(o))&&this._fileFilter(o)&&this._wantsFile&&(this.push(o),e--)}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let s;try{s=await zb(e,this._rdOptions)}catch(r){this._onError(r)}return{files:s,depth:t,path:e}}async _formatEntry(e,t){let s;try{let r=this._isDirent?e.name:e,i=Yn.resolve(Yn.join(t,r));s={path:Yn.relative(this._root,i),fullPath:i,basename:r},s[this._statsProp]=this._isDirent?e:await this._stat(i)}catch(r){this._onError(r)}return s}_onError(e){Zb(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){let t=e&&e[this._statsProp];if(t){if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let s=e.fullPath;try{let r=await Jb(s),i=await od(r);if(i.isFile())return"file";if(i.isDirectory()){let o=r.length;if(s.startsWith(r)&&s.substr(o,1)===Yn.sep){let a=new Error(`Circular symlink detected: "${s}" points to "${r}"`);return a.code=ud,this._onError(a)}return"directory"}}catch(r){this._onError(r)}}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}},xn=(n,e={})=>{let t=e.entryType||e.type;if(t==="both"&&(t=Xs),t&&(e.type=t),n){if(typeof n!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!ad.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${ad.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=n,new Qs(e)},nv=(n,e={})=>new Promise((t,s)=>{let r=[];xn(n,e).on("data",i=>r.push(i)).on("end",()=>t(r)).on("error",i=>s(i))});xn.promise=nv;xn.ReaddirpStream=Qs;xn.default=xn;fd.exports=xn});var xo=N((eE,hd)=>{hd.exports=function(n,e){if(typeof n!="string")throw new TypeError("expected path to be a string");if(n==="\\"||n==="/")return"/";var t=n.length;if(t<=1)return n;var s="";if(t>4&&n[3]==="\\"){var r=n[2];(r==="?"||r===".")&&n.slice(0,2)==="\\\\"&&(n=n.slice(2),s="//")}var i=n.split(/[/\\]+/);return e!==!1&&i[i.length-1]===""&&i.pop(),s+i.join("/")}});var wd=N((bd,vd)=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var yd=bo(),sv=xo(),md="!",rv={returnIndex:!1},iv=n=>Array.isArray(n)?n:[n],ov=(n,e)=>{if(typeof n=="function")return n;if(typeof n=="string"){let t=yd(n,e);return s=>n===s||t(s)}return n instanceof RegExp?t=>n.test(t):t=>!1},gd=(n,e,t,s)=>{let r=Array.isArray(t),i=r?t[0]:t;if(!r&&typeof i!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(i));let o=sv(i,!1);for(let l=0;l<e.length;l++){let u=e[l];if(u(o))return s?-1:!1}let a=r&&[o].concat(t.slice(1));for(let l=0;l<n.length;l++){let u=n[l];if(r?u(...a):u(o))return s?l:!0}return s?-1:!1},So=(n,e,t=rv)=>{if(n==null)throw new TypeError("anymatch: specify first argument");let s=typeof t=="boolean"?{returnIndex:t}:t,r=s.returnIndex||!1,i=iv(n),o=i.filter(l=>typeof l=="string"&&l.charAt(0)===md).map(l=>l.slice(1)).map(l=>yd(l,s)),a=i.filter(l=>typeof l!="string"||typeof l=="string"&&l.charAt(0)!==md).map(l=>ov(l,s));return e==null?(l,u=!1)=>gd(a,o,l,typeof u=="boolean"?u:!1):gd(a,o,e,r)};So.default=So;vd.exports=So});var Sd=N((tE,xd)=>{xd.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1}});var _o=N((nE,kd)=>{var av=Sd(),_d={"{":"}","(":")","[":"]"},lv=function(n){if(n[0]==="!")return!0;for(var e=0,t=-2,s=-2,r=-2,i=-2,o=-2;e<n.length;){if(n[e]==="*"||n[e+1]==="?"&&/[\].+)]/.test(n[e])||s!==-1&&n[e]==="["&&n[e+1]!=="]"&&(s<e&&(s=n.indexOf("]",e)),s>e&&(o===-1||o>s||(o=n.indexOf("\\",e),o===-1||o>s)))||r!==-1&&n[e]==="{"&&n[e+1]!=="}"&&(r=n.indexOf("}",e),r>e&&(o=n.indexOf("\\",e),o===-1||o>r))||i!==-1&&n[e]==="("&&n[e+1]==="?"&&/[:!=]/.test(n[e+2])&&n[e+3]!==")"&&(i=n.indexOf(")",e),i>e&&(o=n.indexOf("\\",e),o===-1||o>i))||t!==-1&&n[e]==="("&&n[e+1]!=="|"&&(t<e&&(t=n.indexOf("|",e)),t!==-1&&n[t+1]!==")"&&(i=n.indexOf(")",t),i>t&&(o=n.indexOf("\\",t),o===-1||o>i))))return!0;if(n[e]==="\\"){var a=n[e+1];e+=2;var l=_d[a];if(l){var u=n.indexOf(l,e);u!==-1&&(e=u+1)}if(n[e]==="!")return!0}else e++}return!1},cv=function(n){if(n[0]==="!")return!0;for(var e=0;e<n.length;){if(/[*?{}()[\]]/.test(n[e]))return!0;if(n[e]==="\\"){var t=n[e+1];e+=2;var s=_d[t];if(s){var r=n.indexOf(s,e);r!==-1&&(e=r+1)}if(n[e]==="!")return!0}else e++}return!1};kd.exports=function(e,t){if(typeof e!="string"||e==="")return!1;if(av(e))return!0;var s=lv;return t&&t.strict===!1&&(s=cv),s(e)}});var $d=N((sE,Ad)=>{"use strict";var uv=_o(),dv=require("path").posix.dirname,fv=require("os").platform()==="win32",ko="/",pv=/\\/g,hv=/[\{\[].*[\}\]]$/,mv=/(^|[^\\])([\{\[]|\([^\)]+$)/,gv=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Ad.exports=function(e,t){var s=Object.assign({flipBackslashes:!0},t);s.flipBackslashes&&fv&&e.indexOf(ko)<0&&(e=e.replace(pv,ko)),hv.test(e)&&(e+=ko),e+="a";do e=dv(e);while(uv(e)||mv.test(e));return e.replace(gv,"$1")}});var er=N(ze=>{"use strict";ze.isInteger=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"&&n.trim()!==""?Number.isInteger(Number(n)):!1;ze.find=(n,e)=>n.nodes.find(t=>t.type===e);ze.exceedsLimit=(n,e,t=1,s)=>s===!1||!ze.isInteger(n)||!ze.isInteger(e)?!1:(Number(e)-Number(n))/Number(t)>=s;ze.escapeNode=(n,e=0,t)=>{let s=n.nodes[e];s&&(t&&s.type===t||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)};ze.encloseBrace=n=>n.type!=="brace"?!1:n.commas>>0+n.ranges>>0===0?(n.invalid=!0,!0):!1;ze.isInvalidBrace=n=>n.type!=="brace"?!1:n.invalid===!0||n.dollar?!0:n.commas>>0+n.ranges>>0===0||n.open!==!0||n.close!==!0?(n.invalid=!0,!0):!1;ze.isOpenOrClose=n=>n.type==="open"||n.type==="close"?!0:n.open===!0||n.close===!0;ze.reduce=n=>n.reduce((e,t)=>(t.type==="text"&&e.push(t.value),t.type==="range"&&(t.type="text"),e),[]);ze.flatten=(...n)=>{let e=[],t=s=>{for(let r=0;r<s.length;r++){let i=s[r];if(Array.isArray(i)){t(i);continue}i!==void 0&&e.push(i)}return e};return t(n),e}});var tr=N((iE,Ed)=>{"use strict";var Cd=er();Ed.exports=(n,e={})=>{let t=(s,r={})=>{let i=e.escapeInvalid&&Cd.isInvalidBrace(r),o=s.invalid===!0&&e.escapeInvalid===!0,a="";if(s.value)return(i||o)&&Cd.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(let l of s.nodes)a+=t(l);return a};return t(n)}});var Rd=N((oE,Td)=>{"use strict";Td.exports=function(n){return typeof n=="number"?n-n===0:typeof n=="string"&&n.trim()!==""?Number.isFinite?Number.isFinite(+n):isFinite(+n):!1}});var jd=N((aE,Nd)=>{"use strict";var Od=Rd(),Jt=(n,e,t)=>{if(Od(n)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||n===e)return String(n);if(Od(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let s={relaxZeros:!0,...t};typeof s.strictZeros=="boolean"&&(s.relaxZeros=s.strictZeros===!1);let r=String(s.relaxZeros),i=String(s.shorthand),o=String(s.capture),a=String(s.wrap),l=n+":"+e+"="+r+i+o+a;if(Jt.cache.hasOwnProperty(l))return Jt.cache[l].result;let u=Math.min(n,e),d=Math.max(n,e);if(Math.abs(u-d)===1){let g=n+"|"+e;return s.capture?`(${g})`:s.wrap===!1?g:`(?:${g})`}let f=Fd(n)||Fd(e),h={min:n,max:e,a:u,b:d},m=[],p=[];if(f&&(h.isPadded=f,h.maxLen=String(h.max).length),u<0){let g=d<0?Math.abs(d):1;p=Pd(g,Math.abs(u),h,s),u=h.a=0}return d>=0&&(m=Pd(u,d,h,s)),h.negatives=p,h.positives=m,h.result=yv(p,m,s),s.capture===!0?h.result=`(${h.result})`:s.wrap!==!1&&m.length+p.length>1&&(h.result=`(?:${h.result})`),Jt.cache[l]=h,h.result};function yv(n,e,t){let s=Ao(n,e,"-",!1,t)||[],r=Ao(e,n,"",!1,t)||[],i=Ao(n,e,"-?",!0,t)||[];return s.concat(i).concat(r).join("|")}function bv(n,e){let t=1,s=1,r=Id(n,t),i=new Set([e]);for(;n<=r&&r<=e;)i.add(r),t+=1,r=Id(n,t);for(r=Dd(e+1,s)-1;n<r&&r<=e;)i.add(r),s+=1,r=Dd(e+1,s)-1;return i=[...i],i.sort(xv),i}function vv(n,e,t){if(n===e)return{pattern:n,count:[],digits:0};let s=wv(n,e),r=s.length,i="",o=0;for(let a=0;a<r;a++){let[l,u]=s[a];l===u?i+=l:l!=="0"||u!=="9"?i+=Sv(l,u,t):o++}return o&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:r}}function Pd(n,e,t,s){let r=bv(n,e),i=[],o=n,a;for(let l=0;l<r.length;l++){let u=r[l],d=vv(String(o),String(u),s),f="";if(!t.isPadded&&a&&a.pattern===d.pattern){a.count.length>1&&a.count.pop(),a.count.push(d.count[0]),a.string=a.pattern+Ld(a.count),o=u+1;continue}t.isPadded&&(f=_v(u,t,s)),d.string=f+d.pattern+Ld(d.count),i.push(d),o=u+1,a=d}return i}function Ao(n,e,t,s,r){let i=[];for(let o of n){let{string:a}=o;!s&&!Md(e,"string",a)&&i.push(t+a),s&&Md(e,"string",a)&&i.push(t+a)}return i}function wv(n,e){let t=[];for(let s=0;s<n.length;s++)t.push([n[s],e[s]]);return t}function xv(n,e){return n>e?1:e>n?-1:0}function Md(n,e,t){return n.some(s=>s[e]===t)}function Id(n,e){return Number(String(n).slice(0,-e)+"9".repeat(e))}function Dd(n,e){return n-n%Math.pow(10,e)}function Ld(n){let[e=0,t=""]=n;return t||e>1?`{${e+(t?","+t:"")}}`:""}function Sv(n,e,t){return`[${n}${e-n===1?"":"-"}${e}]`}function Fd(n){return/^-?(0+)\d/.test(n)}function _v(n,e,t){if(!e.isPadded)return n;let s=Math.abs(e.maxLen-String(n).length),r=t.relaxZeros!==!1;switch(s){case 0:return"";case 1:return r?"0?":"0";case 2:return r?"0{0,2}":"00";default:return r?`0{0,${s}}`:`0{${s}}`}}Jt.cache={};Jt.clearCache=()=>Jt.cache={};Nd.exports=Jt});var Eo=N((lE,Gd)=>{"use strict";var kv=require("util"),Bd=jd(),Hd=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),Av=n=>e=>n===!0?Number(e):String(e),$o=n=>typeof n=="number"||typeof n=="string"&&n!=="",Xn=n=>Number.isInteger(+n),Co=n=>{let e=`${n}`,t=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++t]==="0";);return t>0},$v=(n,e,t)=>typeof n=="string"||typeof e=="string"?!0:t.stringify===!0,Cv=(n,e,t)=>{if(e>0){let s=n[0]==="-"?"-":"";s&&(n=n.slice(1)),n=s+n.padStart(s?e-1:e,"0")}return t===!1?String(n):n},sr=(n,e)=>{let t=n[0]==="-"?"-":"";for(t&&(n=n.slice(1),e--);n.length<e;)n="0"+n;return t?"-"+n:n},Ev=(n,e,t)=>{n.negatives.sort((a,l)=>a<l?-1:a>l?1:0),n.positives.sort((a,l)=>a<l?-1:a>l?1:0);let s=e.capture?"":"?:",r="",i="",o;return n.positives.length&&(r=n.positives.map(a=>sr(String(a),t)).join("|")),n.negatives.length&&(i=`-(${s}${n.negatives.map(a=>sr(String(a),t)).join("|")})`),r&&i?o=`${r}|${i}`:o=r||i,e.wrap?`(${s}${o})`:o},Ud=(n,e,t,s)=>{if(t)return Bd(n,e,{wrap:!1,...s});let r=String.fromCharCode(n);if(n===e)return r;let i=String.fromCharCode(e);return`[${r}-${i}]`},Kd=(n,e,t)=>{if(Array.isArray(n)){let s=t.wrap===!0,r=t.capture?"":"?:";return s?`(${r}${n.join("|")})`:n.join("|")}return Bd(n,e,t)},qd=(...n)=>new RangeError("Invalid range arguments: "+kv.inspect(...n)),Wd=(n,e,t)=>{if(t.strictRanges===!0)throw qd([n,e]);return[]},Tv=(n,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${n}" to be a number`);return[]},Rv=(n,e,t=1,s={})=>{let r=Number(n),i=Number(e);if(!Number.isInteger(r)||!Number.isInteger(i)){if(s.strictRanges===!0)throw qd([n,e]);return[]}r===0&&(r=0),i===0&&(i=0);let o=r>i,a=String(n),l=String(e),u=String(t);t=Math.max(Math.abs(t),1);let d=Co(a)||Co(l)||Co(u),f=d?Math.max(a.length,l.length,u.length):0,h=d===!1&&$v(n,e,s)===!1,m=s.transform||Av(h);if(s.toRegex&&t===1)return Ud(sr(n,f),sr(e,f),!0,s);let p={negatives:[],positives:[]},g=$=>p[$<0?"negatives":"positives"].push(Math.abs($)),x=[],w=0;for(;o?r>=i:r<=i;)s.toRegex===!0&&t>1?g(r):x.push(Cv(m(r,w),f,h)),r=o?r-t:r+t,w++;return s.toRegex===!0?t>1?Ev(p,s,f):Kd(x,null,{wrap:!1,...s}):x},Ov=(n,e,t=1,s={})=>{if(!Xn(n)&&n.length>1||!Xn(e)&&e.length>1)return Wd(n,e,s);let r=s.transform||(h=>String.fromCharCode(h)),i=`${n}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=i>o,l=Math.min(i,o),u=Math.max(i,o);if(s.toRegex&&t===1)return Ud(l,u,!1,s);let d=[],f=0;for(;a?i>=o:i<=o;)d.push(r(i,f)),i=a?i-t:i+t,f++;return s.toRegex===!0?Kd(d,null,{wrap:!1,options:s}):d},nr=(n,e,t,s={})=>{if(e==null&&$o(n))return[n];if(!$o(n)||!$o(e))return Wd(n,e,s);if(typeof t=="function")return nr(n,e,1,{transform:t});if(Hd(t))return nr(n,e,0,t);let r={...s};return r.capture===!0&&(r.wrap=!0),t=t||r.step||1,Xn(t)?Xn(n)&&Xn(e)?Rv(n,e,t,r):Ov(n,e,Math.max(Math.abs(t),1),r):t!=null&&!Hd(t)?Tv(t,r):nr(n,e,1,t)};Gd.exports=nr});var Yd=N((cE,zd)=>{"use strict";var Pv=Eo(),Vd=er(),Mv=(n,e={})=>{let t=(s,r={})=>{let i=Vd.isInvalidBrace(r),o=s.invalid===!0&&e.escapeInvalid===!0,a=i===!0||o===!0,l=e.escapeInvalid===!0?"\\":"",u="";if(s.isOpen===!0)return l+s.value;if(s.isClose===!0)return console.log("node.isClose",l,s.value),l+s.value;if(s.type==="open")return a?l+s.value:"(";if(s.type==="close")return a?l+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":a?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){let d=Vd.reduce(s.nodes),f=Pv(...d,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return d.length>1&&f.length>1?`(${f})`:f}if(s.nodes)for(let d of s.nodes)u+=t(d,s);return u};return t(n)};zd.exports=Mv});var Qd=N((uE,Xd)=>{"use strict";var Iv=Eo(),Jd=tr(),Sn=er(),Xt=(n="",e="",t=!1)=>{let s=[];if(n=[].concat(n),e=[].concat(e),!e.length)return n;if(!n.length)return t?Sn.flatten(e).map(r=>`{${r}}`):e;for(let r of n)if(Array.isArray(r))for(let i of r)s.push(Xt(i,e,t));else for(let i of e)t===!0&&typeof i=="string"&&(i=`{${i}}`),s.push(Array.isArray(i)?Xt(r,i,t):r+i);return Sn.flatten(s)},Dv=(n,e={})=>{let t=e.rangeLimit===void 0?1e3:e.rangeLimit,s=(r,i={})=>{r.queue=[];let o=i,a=i.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(r.invalid||r.dollar){a.push(Xt(a.pop(),Jd(r,e)));return}if(r.type==="brace"&&r.invalid!==!0&&r.nodes.length===2){a.push(Xt(a.pop(),["{}"]));return}if(r.nodes&&r.ranges>0){let f=Sn.reduce(r.nodes);if(Sn.exceedsLimit(...f,e.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=Iv(...f,e);h.length===0&&(h=Jd(r,e)),a.push(Xt(a.pop(),h)),r.nodes=[];return}let l=Sn.encloseBrace(r),u=r.queue,d=r;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,u=d.queue;for(let f=0;f<r.nodes.length;f++){let h=r.nodes[f];if(h.type==="comma"&&r.type==="brace"){f===1&&u.push(""),u.push("");continue}if(h.type==="close"){a.push(Xt(a.pop(),u,l));continue}if(h.value&&h.type!=="open"){u.push(Xt(u.pop(),h.value));continue}h.nodes&&s(h,r)}return u};return Sn.flatten(s(n))};Xd.exports=Dv});var ef=N((dE,Zd)=>{"use strict";Zd.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
311
|
-
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var of=N((fE,rf)=>{"use strict";var Lv=tr(),{MAX_LENGTH:tf,CHAR_BACKSLASH:To,CHAR_BACKTICK:Fv,CHAR_COMMA:Nv,CHAR_DOT:jv,CHAR_LEFT_PARENTHESES:Hv,CHAR_RIGHT_PARENTHESES:Bv,CHAR_LEFT_CURLY_BRACE:Uv,CHAR_RIGHT_CURLY_BRACE:Kv,CHAR_LEFT_SQUARE_BRACKET:nf,CHAR_RIGHT_SQUARE_BRACKET:sf,CHAR_DOUBLE_QUOTE:qv,CHAR_SINGLE_QUOTE:Wv,CHAR_NO_BREAK_SPACE:Gv,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Vv}=ef(),zv=(n,e={})=>{if(typeof n!="string")throw new TypeError("Expected a string");let t=e||{},s=typeof t.maxLength=="number"?Math.min(tf,t.maxLength):tf;if(n.length>s)throw new SyntaxError(`Input length (${n.length}), exceeds max characters (${s})`);let r={type:"root",input:n,nodes:[]},i=[r],o=r,a=r,l=0,u=n.length,d=0,f=0,h,m=()=>n[d++],p=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(p({type:"bos"});d<u;)if(o=i[i.length-1],h=m(),!(h===Vv||h===Gv)){if(h===To){p({type:"text",value:(e.keepEscaping?h:"")+m()});continue}if(h===sf){p({type:"text",value:"\\"+h});continue}if(h===nf){l++;let g;for(;d<u&&(g=m());){if(h+=g,g===nf){l++;continue}if(g===To){h+=m();continue}if(g===sf&&(l--,l===0))break}p({type:"text",value:h});continue}if(h===Hv){o=p({type:"paren",nodes:[]}),i.push(o),p({type:"text",value:h});continue}if(h===Bv){if(o.type!=="paren"){p({type:"text",value:h});continue}o=i.pop(),p({type:"text",value:h}),o=i[i.length-1];continue}if(h===qv||h===Wv||h===Fv){let g=h,x;for(e.keepQuotes!==!0&&(h="");d<u&&(x=m());){if(x===To){h+=x+m();continue}if(x===g){e.keepQuotes===!0&&(h+=x);break}h+=x}p({type:"text",value:h});continue}if(h===Uv){f++;let x={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};o=p(x),i.push(o),p({type:"open",value:h});continue}if(h===Kv){if(o.type!=="brace"){p({type:"text",value:h});continue}let g="close";o=i.pop(),o.close=!0,p({type:g,value:h}),f--,o=i[i.length-1];continue}if(h===Nv&&f>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:Lv(o)}]}p({type:"comma",value:h}),o.commas++;continue}if(h===jv&&f>0&&o.commas===0){let g=o.nodes;if(f===0||g.length===0){p({type:"text",value:h});continue}if(a.type==="dot"){if(o.range=[],a.value+=h,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){g.pop();let x=g[g.length-1];x.value+=a.value+h,a=x,o.ranges--;continue}p({type:"dot",value:h});continue}p({type:"text",value:h})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let g=i[i.length-1],x=g.nodes.indexOf(o);g.nodes.splice(x,1,...o.nodes)}while(i.length>0);return p({type:"eos"}),r};rf.exports=zv});var cf=N((pE,lf)=>{"use strict";var af=tr(),Yv=Yd(),Jv=Qd(),Xv=of(),Ke=(n,e={})=>{let t=[];if(Array.isArray(n))for(let s of n){let r=Ke.create(s,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(Ke.create(n,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};Ke.parse=(n,e={})=>Xv(n,e);Ke.stringify=(n,e={})=>af(typeof n=="string"?Ke.parse(n,e):n,e);Ke.compile=(n,e={})=>(typeof n=="string"&&(n=Ke.parse(n,e)),Yv(n,e));Ke.expand=(n,e={})=>{typeof n=="string"&&(n=Ke.parse(n,e));let t=Jv(n,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t};Ke.create=(n,e={})=>n===""||n.length<3?[n]:e.expand!==!0?Ke.compile(n,e):Ke.expand(n,e);lf.exports=Ke});var uf=N((hE,Qv)=>{Qv.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]});var ff=N((mE,df)=>{df.exports=uf()});var hf=N((gE,pf)=>{"use strict";var Zv=require("path"),ew=ff(),tw=new Set(ew);pf.exports=n=>tw.has(Zv.extname(n).slice(1).toLowerCase())});var rr=N(B=>{"use strict";var{sep:nw}=require("path"),{platform:Ro}=process,sw=require("os");B.EV_ALL="all";B.EV_READY="ready";B.EV_ADD="add";B.EV_CHANGE="change";B.EV_ADD_DIR="addDir";B.EV_UNLINK="unlink";B.EV_UNLINK_DIR="unlinkDir";B.EV_RAW="raw";B.EV_ERROR="error";B.STR_DATA="data";B.STR_END="end";B.STR_CLOSE="close";B.FSEVENT_CREATED="created";B.FSEVENT_MODIFIED="modified";B.FSEVENT_DELETED="deleted";B.FSEVENT_MOVED="moved";B.FSEVENT_CLONED="cloned";B.FSEVENT_UNKNOWN="unknown";B.FSEVENT_FLAG_MUST_SCAN_SUBDIRS=1;B.FSEVENT_TYPE_FILE="file";B.FSEVENT_TYPE_DIRECTORY="directory";B.FSEVENT_TYPE_SYMLINK="symlink";B.KEY_LISTENERS="listeners";B.KEY_ERR="errHandlers";B.KEY_RAW="rawEmitters";B.HANDLER_KEYS=[B.KEY_LISTENERS,B.KEY_ERR,B.KEY_RAW];B.DOT_SLASH=`.${nw}`;B.BACK_SLASH_RE=/\\/g;B.DOUBLE_SLASH_RE=/\/\//;B.SLASH_OR_BACK_SLASH_RE=/[/\\]/;B.DOT_RE=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/;B.REPLACER_RE=/^\.[/\\]/;B.SLASH="/";B.SLASH_SLASH="//";B.BRACE_START="{";B.BANG="!";B.ONE_DOT=".";B.TWO_DOTS="..";B.STAR="*";B.GLOBSTAR="**";B.ROOT_GLOBSTAR="/**/*";B.SLASH_GLOBSTAR="/**";B.DIR_SUFFIX="Dir";B.ANYMATCH_OPTS={dot:!0};B.STRING_TYPE="string";B.FUNCTION_TYPE="function";B.EMPTY_STR="";B.EMPTY_FN=()=>{};B.IDENTITY_FN=n=>n;B.isWindows=Ro==="win32";B.isMacos=Ro==="darwin";B.isLinux=Ro==="linux";B.isIBMi=sw.type()==="OS400"});var wf=N((bE,vf)=>{"use strict";var Mt=require("fs"),Se=require("path"),{promisify:ts}=require("util"),rw=hf(),{isWindows:iw,isLinux:ow,EMPTY_FN:aw,EMPTY_STR:lw,KEY_LISTENERS:_n,KEY_ERR:Oo,KEY_RAW:Qn,HANDLER_KEYS:cw,EV_CHANGE:or,EV_ADD:ir,EV_ADD_DIR:uw,EV_ERROR:gf,STR_DATA:dw,STR_END:fw,BRACE_START:pw,STAR:hw}=rr(),mw="watch",gw=ts(Mt.open),yf=ts(Mt.stat),yw=ts(Mt.lstat),bw=ts(Mt.close),Po=ts(Mt.realpath),vw={lstat:yw,stat:yf},Io=(n,e)=>{n instanceof Set?n.forEach(e):e(n)},Zn=(n,e,t)=>{let s=n[e];s instanceof Set||(n[e]=s=new Set([s])),s.add(t)},ww=n=>e=>{let t=n[e];t instanceof Set?t.clear():delete n[e]},es=(n,e,t)=>{let s=n[e];s instanceof Set?s.delete(t):s===t&&delete n[e]},bf=n=>n instanceof Set?n.size===0:!n,ar=new Map;function mf(n,e,t,s,r){let i=(o,a)=>{t(n),r(o,a,{watchedPath:n}),a&&n!==a&&lr(Se.resolve(n,a),_n,Se.join(n,a))};try{return Mt.watch(n,e,i)}catch(o){s(o)}}var lr=(n,e,t,s,r)=>{let i=ar.get(n);i&&Io(i[e],o=>{o(t,s,r)})},xw=(n,e,t,s)=>{let{listener:r,errHandler:i,rawEmitter:o}=s,a=ar.get(e),l;if(!t.persistent)return l=mf(n,t,r,i,o),l.close.bind(l);if(a)Zn(a,_n,r),Zn(a,Oo,i),Zn(a,Qn,o);else{if(l=mf(n,t,lr.bind(null,e,_n),i,lr.bind(null,e,Qn)),!l)return;l.on(gf,async u=>{let d=lr.bind(null,e,Oo);if(a.watcherUnusable=!0,iw&&u.code==="EPERM")try{let f=await gw(n,"r");await bw(f),d(u)}catch{}else d(u)}),a={listeners:r,errHandlers:i,rawEmitters:o,watcher:l},ar.set(e,a)}return()=>{es(a,_n,r),es(a,Oo,i),es(a,Qn,o),bf(a.listeners)&&(a.watcher.close(),ar.delete(e),cw.forEach(ww(a)),a.watcher=void 0,Object.freeze(a))}},Mo=new Map,Sw=(n,e,t,s)=>{let{listener:r,rawEmitter:i}=s,o=Mo.get(e),a=new Set,l=new Set,u=o&&o.options;return u&&(u.persistent<t.persistent||u.interval>t.interval)&&(a=o.listeners,l=o.rawEmitters,Mt.unwatchFile(e),o=void 0),o?(Zn(o,_n,r),Zn(o,Qn,i)):(o={listeners:r,rawEmitters:i,options:t,watcher:Mt.watchFile(e,t,(d,f)=>{Io(o.rawEmitters,m=>{m(or,e,{curr:d,prev:f})});let h=d.mtimeMs;(d.size!==f.size||h>f.mtimeMs||h===0)&&Io(o.listeners,m=>m(n,d))})},Mo.set(e,o)),()=>{es(o,_n,r),es(o,Qn,i),bf(o.listeners)&&(Mo.delete(e),Mt.unwatchFile(e),o.options=o.watcher=void 0,Object.freeze(o))}},Do=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let s=this.fsw.options,r=Se.dirname(e),i=Se.basename(e);this.fsw._getWatchedDir(r).add(i);let a=Se.resolve(e),l={persistent:s.persistent};t||(t=aw);let u;return s.usePolling?(l.interval=s.enableBinaryInterval&&rw(i)?s.binaryInterval:s.interval,u=Sw(e,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})):u=xw(e,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),u}_handleFile(e,t,s){if(this.fsw.closed)return;let r=Se.dirname(e),i=Se.basename(e),o=this.fsw._getWatchedDir(r),a=t;if(o.has(i))return;let l=async(d,f)=>{if(this.fsw._throttle(mw,e,5)){if(!f||f.mtimeMs===0)try{let h=await yf(e);if(this.fsw.closed)return;let m=h.atimeMs,p=h.mtimeMs;(!m||m<=p||p!==a.mtimeMs)&&this.fsw._emit(or,e,h),ow&&a.ino!==h.ino?(this.fsw._closeFile(d),a=h,this.fsw._addPathCloser(d,this._watchWithNodeFs(e,l))):a=h}catch{this.fsw._remove(r,i)}else if(o.has(i)){let h=f.atimeMs,m=f.mtimeMs;(!h||h<=m||m!==a.mtimeMs)&&this.fsw._emit(or,e,f),a=f}}},u=this._watchWithNodeFs(e,l);if(!(s&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ir,e,0))return;this.fsw._emit(ir,e,t)}return u}async _handleSymlink(e,t,s,r){if(this.fsw.closed)return;let i=e.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await Po(s)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(r)?this.fsw._symlinkPaths.get(i)!==a&&(this.fsw._symlinkPaths.set(i,a),this.fsw._emit(or,s,e.stats)):(o.add(r),this.fsw._symlinkPaths.set(i,a),this.fsw._emit(ir,s,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(e,t,s,r,i,o,a){if(e=Se.join(e,lw),!s.hasGlob&&(a=this.fsw._throttle("readdir",e,1e3),!a))return;let l=this.fsw._getWatchedDir(s.path),u=new Set,d=this.fsw._readdirp(e,{fileFilter:f=>s.filterPath(f),directoryFilter:f=>s.filterDir(f),depth:0}).on(dw,async f=>{if(this.fsw.closed){d=void 0;return}let h=f.path,m=Se.join(e,h);if(u.add(h),!(f.stats.isSymbolicLink()&&await this._handleSymlink(f,e,m,h))){if(this.fsw.closed){d=void 0;return}(h===r||!r&&!l.has(h))&&(this.fsw._incrReadyCount(),m=Se.join(i,Se.relative(i,m)),this._addToNodeFs(m,t,s,o+1))}}).on(gf,this._boundHandleError);return new Promise(f=>d.once(fw,()=>{if(this.fsw.closed){d=void 0;return}let h=a?a.clear():!1;f(),l.getChildren().filter(m=>m!==e&&!u.has(m)&&(!s.hasGlob||s.filterPath({fullPath:Se.resolve(e,m)}))).forEach(m=>{this.fsw._remove(e,m)}),d=void 0,h&&this._handleRead(e,!1,s,r,i,o,a)}))}async _handleDir(e,t,s,r,i,o,a){let l=this.fsw._getWatchedDir(Se.dirname(e)),u=l.has(Se.basename(e));!(s&&this.fsw.options.ignoreInitial)&&!i&&!u&&(!o.hasGlob||o.globFilter(e))&&this.fsw._emit(uw,e,t),l.add(Se.basename(e)),this.fsw._getWatchedDir(e);let d,f,h=this.fsw.options.depth;if((h==null||r<=h)&&!this.fsw._symlinkPaths.has(a)){if(!i&&(await this._handleRead(e,s,o,i,e,r,d),this.fsw.closed))return;f=this._watchWithNodeFs(e,(m,p)=>{p&&p.mtimeMs===0||this._handleRead(m,!1,o,i,e,r,d)})}return f}async _addToNodeFs(e,t,s,r,i){let o=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(e,r);!a.hasGlob&&s&&(a.hasGlob=s.hasGlob,a.globFilter=s.globFilter,a.filterPath=l=>s.filterPath(l),a.filterDir=l=>s.filterDir(l));try{let l=await vw[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let u=this.fsw.options.followSymlinks&&!e.includes(hw)&&!e.includes(pw),d;if(l.isDirectory()){let f=Se.resolve(e),h=u?await Po(e):e;if(this.fsw.closed||(d=await this._handleDir(a.watchPath,l,t,r,i,a,h),this.fsw.closed))return;f!==h&&h!==void 0&&this.fsw._symlinkPaths.set(f,h)}else if(l.isSymbolicLink()){let f=u?await Po(e):e;if(this.fsw.closed)return;let h=Se.dirname(a.watchPath);if(this.fsw._getWatchedDir(h).add(a.watchPath),this.fsw._emit(ir,a.watchPath,l),d=await this._handleDir(h,l,t,r,e,a,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(Se.resolve(e),f)}else d=this._handleFile(a.watchPath,l,t);return o(),this.fsw._addPathCloser(e,d),!1}catch(l){if(this.fsw._handleError(l))return o(),e}}};vf.exports=Do});var Cf=N((vE,Ko)=>{"use strict";var Bo=require("fs"),_e=require("path"),{promisify:Uo}=require("util"),kn;try{kn=require("fsevents")}catch(n){process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR&&console.error(n)}if(kn){let n=process.version.match(/v(\d+)\.(\d+)/);if(n&&n[1]&&n[2]){let e=Number.parseInt(n[1],10),t=Number.parseInt(n[2],10);e===8&&t<16&&(kn=void 0)}}var{EV_ADD:Lo,EV_CHANGE:_w,EV_ADD_DIR:xf,EV_UNLINK:cr,EV_ERROR:kw,STR_DATA:Aw,STR_END:$w,FSEVENT_CREATED:Cw,FSEVENT_MODIFIED:Ew,FSEVENT_DELETED:Tw,FSEVENT_MOVED:Rw,FSEVENT_UNKNOWN:Ow,FSEVENT_FLAG_MUST_SCAN_SUBDIRS:Pw,FSEVENT_TYPE_FILE:Mw,FSEVENT_TYPE_DIRECTORY:ns,FSEVENT_TYPE_SYMLINK:$f,ROOT_GLOBSTAR:Sf,DIR_SUFFIX:Iw,DOT_SLASH:_f,FUNCTION_TYPE:Fo,EMPTY_FN:Dw,IDENTITY_FN:Lw}=rr(),Fw=n=>isNaN(n)?{}:{depth:n},jo=Uo(Bo.stat),Nw=Uo(Bo.lstat),kf=Uo(Bo.realpath),jw={stat:jo,lstat:Nw},Qt=new Map,Hw=10,Bw=new Set([69888,70400,71424,72704,73472,131328,131840,262912]),Uw=(n,e)=>({stop:kn.watch(n,e)});function Kw(n,e,t,s){let r=_e.extname(e)?_e.dirname(e):e,i=_e.dirname(r),o=Qt.get(r);qw(i)&&(r=i);let a=_e.resolve(n),l=a!==e,u=(f,h,m)=>{l&&(f=f.replace(e,a)),(f===a||!f.indexOf(a+_e.sep))&&t(f,h,m)},d=!1;for(let f of Qt.keys())if(e.indexOf(_e.resolve(f)+_e.sep)===0){r=f,o=Qt.get(r),d=!0;break}return o||d?o.listeners.add(u):(o={listeners:new Set([u]),rawEmitter:s,watcher:Uw(r,(f,h)=>{if(!o.listeners.size||h&Pw)return;let m=kn.getInfo(f,h);o.listeners.forEach(p=>{p(f,h,m)}),o.rawEmitter(m.event,f,m)})},Qt.set(r,o)),()=>{let f=o.listeners;if(f.delete(u),!f.size&&(Qt.delete(r),o.watcher))return o.watcher.stop().then(()=>{o.rawEmitter=o.watcher=void 0,Object.freeze(o)})}}var qw=n=>{let e=0;for(let t of Qt.keys())if(t.indexOf(n)===0&&(e++,e>=Hw))return!0;return!1},Ww=()=>kn&&Qt.size<128,No=(n,e)=>{let t=0;for(;!n.indexOf(e)&&(n=_e.dirname(n))!==e;)t++;return t},Af=(n,e)=>n.type===ns&&e.isDirectory()||n.type===$f&&e.isSymbolicLink()||n.type===Mw&&e.isFile(),Ho=class{constructor(e){this.fsw=e}checkIgnored(e,t){let s=this.fsw._ignoredPaths;if(this.fsw._isIgnored(e,t))return s.add(e),t&&t.isDirectory()&&s.add(e+Sf),!0;s.delete(e),s.delete(e+Sf)}addOrChange(e,t,s,r,i,o,a,l){let u=i.has(o)?_w:Lo;this.handleEvent(u,e,t,s,r,i,o,a,l)}async checkExists(e,t,s,r,i,o,a,l){try{let u=await jo(e);if(this.fsw.closed)return;Af(a,u)?this.addOrChange(e,t,s,r,i,o,a,l):this.handleEvent(cr,e,t,s,r,i,o,a,l)}catch(u){u.code==="EACCES"?this.addOrChange(e,t,s,r,i,o,a,l):this.handleEvent(cr,e,t,s,r,i,o,a,l)}}handleEvent(e,t,s,r,i,o,a,l,u){if(!(this.fsw.closed||this.checkIgnored(t)))if(e===cr){let d=l.type===ns;(d||o.has(a))&&this.fsw._remove(i,a,d)}else{if(e===Lo){if(l.type===ns&&this.fsw._getWatchedDir(t),l.type===$f&&u.followSymlinks){let f=u.depth===void 0?void 0:No(s,r)+1;return this._addToFsEvents(t,!1,!0,f)}this.fsw._getWatchedDir(i).add(a)}let d=l.type===ns?e+Iw:e;this.fsw._emit(d,t),d===xf&&this._addToFsEvents(t,!1,!0)}}_watchWithFsEvents(e,t,s,r){if(this.fsw.closed||this.fsw._isIgnored(e))return;let i=this.fsw.options,a=Kw(e,t,async(l,u,d)=>{if(this.fsw.closed||i.depth!==void 0&&No(l,t)>i.depth)return;let f=s(_e.join(e,_e.relative(e,l)));if(r&&!r(f))return;let h=_e.dirname(f),m=_e.basename(f),p=this.fsw._getWatchedDir(d.type===ns?f:h);if(Bw.has(u)||d.event===Ow)if(typeof i.ignored===Fo){let g;try{g=await jo(f)}catch{}if(this.fsw.closed||this.checkIgnored(f,g))return;Af(d,g)?this.addOrChange(f,l,t,h,p,m,d,i):this.handleEvent(cr,f,l,t,h,p,m,d,i)}else this.checkExists(f,l,t,h,p,m,d,i);else switch(d.event){case Cw:case Ew:return this.addOrChange(f,l,t,h,p,m,d,i);case Tw:case Rw:return this.checkExists(f,l,t,h,p,m,d,i)}},this.fsw._emitRaw);return this.fsw._emitReady(),a}async _handleFsEventsSymlink(e,t,s,r){if(!(this.fsw.closed||this.fsw._symlinkPaths.has(t))){this.fsw._symlinkPaths.set(t,!0),this.fsw._incrReadyCount();try{let i=await kf(e);if(this.fsw.closed)return;if(this.fsw._isIgnored(i))return this.fsw._emitReady();this.fsw._incrReadyCount(),this._addToFsEvents(i||e,o=>{let a=e;return i&&i!==_f?a=o.replace(i,e):o!==_f&&(a=_e.join(e,o)),s(a)},!1,r)}catch(i){if(this.fsw._handleError(i))return this.fsw._emitReady()}}}emitAdd(e,t,s,r,i){let o=s(e),a=t.isDirectory(),l=this.fsw._getWatchedDir(_e.dirname(o)),u=_e.basename(o);a&&this.fsw._getWatchedDir(o),!l.has(u)&&(l.add(u),(!r.ignoreInitial||i===!0)&&this.fsw._emit(a?xf:Lo,o,t))}initWatch(e,t,s,r){if(this.fsw.closed)return;let i=this._watchWithFsEvents(s.watchPath,_e.resolve(e||s.watchPath),r,s.globFilter);this.fsw._addPathCloser(t,i)}async _addToFsEvents(e,t,s,r){if(this.fsw.closed)return;let i=this.fsw.options,o=typeof t===Fo?t:Lw,a=this.fsw._getWatchHelpers(e);try{let l=await jw[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))throw null;if(l.isDirectory()){if(a.globFilter||this.emitAdd(o(e),l,o,i,s),r&&r>i.depth)return;this.fsw._readdirp(a.watchPath,{fileFilter:u=>a.filterPath(u),directoryFilter:u=>a.filterDir(u),...Fw(i.depth-(r||0))}).on(Aw,u=>{if(this.fsw.closed||u.stats.isDirectory()&&!a.filterPath(u))return;let d=_e.join(a.watchPath,u.path),{fullPath:f}=u;if(a.followSymlinks&&u.stats.isSymbolicLink()){let h=i.depth===void 0?void 0:No(d,_e.resolve(a.watchPath))+1;this._handleFsEventsSymlink(d,f,o,h)}else this.emitAdd(d,u.stats,o,i,s)}).on(kw,Dw).on($w,()=>{this.fsw._emitReady()})}else this.emitAdd(a.watchPath,l,o,i,s),this.fsw._emitReady()}catch(l){(!l||this.fsw._handleError(l))&&(this.fsw._emitReady(),this.fsw._emitReady())}if(i.persistent&&s!==!0)if(typeof t===Fo)this.initWatch(void 0,e,a,o);else{let l;try{l=await kf(a.watchPath)}catch{}this.initWatch(l,e,a,o)}}};Ko.exports=Ho;Ko.exports.canUse=Ww});var Nf=N(ra=>{"use strict";var{EventEmitter:Gw}=require("events"),na=require("fs"),ne=require("path"),{promisify:If}=require("util"),Vw=pd(),Yo=wd().default,zw=$d(),qo=_o(),Yw=cf(),Jw=xo(),Xw=wf(),Ef=Cf(),{EV_ALL:Wo,EV_READY:Qw,EV_ADD:ur,EV_CHANGE:ss,EV_UNLINK:Tf,EV_ADD_DIR:Zw,EV_UNLINK_DIR:ex,EV_RAW:tx,EV_ERROR:Go,STR_CLOSE:nx,STR_END:sx,BACK_SLASH_RE:rx,DOUBLE_SLASH_RE:Rf,SLASH_OR_BACK_SLASH_RE:ix,DOT_RE:ox,REPLACER_RE:ax,SLASH:Vo,SLASH_SLASH:lx,BRACE_START:cx,BANG:Jo,ONE_DOT:Df,TWO_DOTS:ux,GLOBSTAR:dx,SLASH_GLOBSTAR:zo,ANYMATCH_OPTS:Xo,STRING_TYPE:sa,FUNCTION_TYPE:fx,EMPTY_STR:Qo,EMPTY_FN:px,isWindows:hx,isMacos:mx,isIBMi:gx}=rr(),yx=If(na.stat),bx=If(na.readdir),Zo=(n=[])=>Array.isArray(n)?n:[n],Lf=(n,e=[])=>(n.forEach(t=>{Array.isArray(t)?Lf(t,e):e.push(t)}),e),Of=n=>{let e=Lf(Zo(n));if(!e.every(t=>typeof t===sa))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(Ff)},Pf=n=>{let e=n.replace(rx,Vo),t=!1;for(e.startsWith(lx)&&(t=!0);e.match(Rf);)e=e.replace(Rf,Vo);return t&&(e=Vo+e),e},Ff=n=>Pf(ne.normalize(Pf(n))),Mf=(n=Qo)=>e=>typeof e!==sa?e:Ff(ne.isAbsolute(e)?e:ne.join(n,e)),vx=(n,e)=>ne.isAbsolute(n)?n:n.startsWith(Jo)?Jo+ne.join(e,n.slice(1)):ne.join(e,n),it=(n,e)=>n[e]===void 0,ea=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==Df&&e!==ux&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let s=this.path;try{await bx(s)}catch{this._removeWatcher&&this._removeWatcher(ne.dirname(s),ne.basename(s))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;if(e)return[...e.values()]}dispose(){this.items.clear(),delete this.path,delete this._removeWatcher,delete this.items,Object.freeze(this)}},wx="stat",xx="lstat",ta=class{constructor(e,t,s,r){this.fsw=r,this.path=e=e.replace(ax,Qo),this.watchPath=t,this.fullWatchPath=ne.resolve(t),this.hasGlob=t!==e,e===Qo&&(this.hasGlob=!1),this.globSymlink=this.hasGlob&&s?void 0:!1,this.globFilter=this.hasGlob?Yo(e,void 0,Xo):!1,this.dirParts=this.getDirParts(e),this.dirParts.forEach(i=>{i.length>1&&i.pop()}),this.followSymlinks=s,this.statMethod=s?wx:xx}checkGlobSymlink(e){return this.globSymlink===void 0&&(this.globSymlink=e.fullParentDir===this.fullWatchPath?!1:{realPath:e.fullParentDir,linkPath:this.fullWatchPath}),this.globSymlink?e.fullPath.replace(this.globSymlink.realPath,this.globSymlink.linkPath):e.fullPath}entryPath(e){return ne.join(this.watchPath,ne.relative(this.watchPath,this.checkGlobSymlink(e)))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let s=this.entryPath(e);return(this.hasGlob&&typeof this.globFilter===fx?this.globFilter(s):!0)&&this.fsw._isntIgnored(s,t)&&this.fsw._hasReadPermissions(t)}getDirParts(e){if(!this.hasGlob)return[];let t=[];return(e.includes(cx)?Yw.expand(e):[e]).forEach(r=>{t.push(ne.relative(this.watchPath,r).split(ix))}),t}filterDir(e){if(this.hasGlob){let t=this.getDirParts(this.checkGlobSymlink(e)),s=!1;this.unmatchedGlob=!this.dirParts.some(r=>r.every((i,o)=>(i===dx&&(s=!0),s||!t[0][o]||Yo(i,t[0][o],Xo))))}return!this.unmatchedGlob&&this.fsw._isntIgnored(this.entryPath(e),e.stats)}},dr=class extends Gw{constructor(e){super();let t={};e&&Object.assign(t,e),this._watched=new Map,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._symlinkPaths=new Map,this._streams=new Set,this.closed=!1,it(t,"persistent")&&(t.persistent=!0),it(t,"ignoreInitial")&&(t.ignoreInitial=!1),it(t,"ignorePermissionErrors")&&(t.ignorePermissionErrors=!1),it(t,"interval")&&(t.interval=100),it(t,"binaryInterval")&&(t.binaryInterval=300),it(t,"disableGlobbing")&&(t.disableGlobbing=!1),t.enableBinaryInterval=t.binaryInterval!==t.interval,it(t,"useFsEvents")&&(t.useFsEvents=!t.usePolling),Ef.canUse()||(t.useFsEvents=!1),it(t,"usePolling")&&!t.useFsEvents&&(t.usePolling=mx),gx&&(t.usePolling=!0);let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let l=r.toLowerCase();l==="false"||l==="0"?t.usePolling=!1:l==="true"||l==="1"?t.usePolling=!0:t.usePolling=!!l}let i=process.env.CHOKIDAR_INTERVAL;i&&(t.interval=Number.parseInt(i,10)),it(t,"atomic")&&(t.atomic=!t.usePolling&&!t.useFsEvents),t.atomic&&(this._pendingUnlinks=new Map),it(t,"followSymlinks")&&(t.followSymlinks=!0),it(t,"awaitWriteFinish")&&(t.awaitWriteFinish=!1),t.awaitWriteFinish===!0&&(t.awaitWriteFinish={});let o=t.awaitWriteFinish;o&&(o.stabilityThreshold||(o.stabilityThreshold=2e3),o.pollInterval||(o.pollInterval=100),this._pendingWrites=new Map),t.ignored&&(t.ignored=Zo(t.ignored));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=px,this._readyEmitted=!0,process.nextTick(()=>this.emit(Qw)))},this._emitRaw=(...l)=>this.emit(tx,...l),this._readyEmitted=!1,this.options=t,t.useFsEvents?this._fsEventsHandler=new Ef(this):this._nodeFsHandler=new Xw(this),Object.freeze(t)}add(e,t,s){let{cwd:r,disableGlobbing:i}=this.options;this.closed=!1;let o=Of(e);return r&&(o=o.map(a=>{let l=vx(a,r);return i||!qo(a)?l:Jw(l)})),o=o.filter(a=>a.startsWith(Jo)?(this._ignoredPaths.add(a.slice(1)),!1):(this._ignoredPaths.delete(a),this._ignoredPaths.delete(a+zo),this._userIgnored=void 0,!0)),this.options.useFsEvents&&this._fsEventsHandler?(this._readyCount||(this._readyCount=o.length),this.options.persistent&&(this._readyCount+=o.length),o.forEach(a=>this._fsEventsHandler._addToFsEvents(a))):(this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!s,0,0,t);return l&&this._emitReady(),l})).then(a=>{this.closed||a.filter(l=>l).forEach(l=>{this.add(ne.dirname(l),ne.basename(t||l))})})),this}unwatch(e){if(this.closed)return this;let t=Of(e),{cwd:s}=this.options;return t.forEach(r=>{!ne.isAbsolute(r)&&!this._closers.has(r)&&(s&&(r=ne.join(s,r)),r=ne.resolve(r)),this._closePath(r),this._ignoredPaths.add(r),this._watched.has(r)&&this._ignoredPaths.add(r+zo),this._userIgnored=void 0}),this}close(){if(this.closed)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(s=>{let r=s();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),["closers","watched","streams","symlinkPaths","throttled"].forEach(t=>{this[`_${t}`].clear()}),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,s)=>{let r=this.options.cwd?ne.relative(this.options.cwd,s):s;e[r||Df]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(...t),e!==Go&&this.emit(Wo,...t)}async _emit(e,t,s,r,i){if(this.closed)return;let o=this.options;hx&&(t=ne.normalize(t)),o.cwd&&(t=ne.relative(o.cwd,t));let a=[e,t];i!==void 0?a.push(s,r,i):r!==void 0?a.push(s,r):s!==void 0&&a.push(s);let l=o.awaitWriteFinish,u;if(l&&(u=this._pendingWrites.get(t)))return u.lastChange=new Date,this;if(o.atomic){if(e===Tf)return this._pendingUnlinks.set(t,a),setTimeout(()=>{this._pendingUnlinks.forEach((d,f)=>{this.emit(...d),this.emit(Wo,...d),this._pendingUnlinks.delete(f)})},typeof o.atomic=="number"?o.atomic:100),this;e===ur&&this._pendingUnlinks.has(t)&&(e=a[0]=ss,this._pendingUnlinks.delete(t))}if(l&&(e===ur||e===ss)&&this._readyEmitted){let d=(f,h)=>{f?(e=a[0]=Go,a[1]=f,this.emitWithAll(e,a)):h&&(a.length>2?a[2]=h:a.push(h),this.emitWithAll(e,a))};return this._awaitWriteFinish(t,l.stabilityThreshold,e,d),this}if(e===ss&&!this._throttle(ss,t,50))return this;if(o.alwaysStat&&s===void 0&&(e===ur||e===Zw||e===ss)){let d=o.cwd?ne.join(o.cwd,t):t,f;try{f=await yx(d)}catch{}if(!f||this.closed)return;a.push(f)}return this.emitWithAll(e,a),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(Go,e),e||this.closed}_throttle(e,t,s){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e),i=r.get(t);if(i)return i.count++,!1;let o,a=()=>{let u=r.get(t),d=u?u.count:0;return r.delete(t),clearTimeout(o),u&&clearTimeout(u.timeoutObject),d};o=setTimeout(a,s);let l={timeoutObject:o,clear:a,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,s,r){let i,o=e;this.options.cwd&&!ne.isAbsolute(e)&&(o=ne.join(this.options.cwd,e));let a=new Date,l=u=>{na.stat(o,(d,f)=>{if(d||!this._pendingWrites.has(e)){d&&d.code!=="ENOENT"&&r(d);return}let h=Number(new Date);u&&f.size!==u.size&&(this._pendingWrites.get(e).lastChange=h);let m=this._pendingWrites.get(e);h-m.lastChange>=t?(this._pendingWrites.delete(e),r(void 0,f)):i=setTimeout(l,this.options.awaitWriteFinish.pollInterval,f)})};this._pendingWrites.has(e)||(this._pendingWrites.set(e,{lastChange:a,cancelWait:()=>(this._pendingWrites.delete(e),clearTimeout(i),s)}),i=setTimeout(l,this.options.awaitWriteFinish.pollInterval))}_getGlobIgnored(){return[...this._ignoredPaths.values()]}_isIgnored(e,t){if(this.options.atomic&&ox.test(e))return!0;if(!this._userIgnored){let{cwd:s}=this.options,r=this.options.ignored,i=r&&r.map(Mf(s)),o=Zo(i).filter(l=>typeof l===sa&&!qo(l)).map(l=>l+zo),a=this._getGlobIgnored().map(Mf(s)).concat(i,o);this._userIgnored=Yo(a,void 0,Xo)}return this._userIgnored([e,t])}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e,t){let s=t||this.options.disableGlobbing||!qo(e)?e:zw(e),r=this.options.followSymlinks;return new ta(e,s,r,this)}_getWatchedDir(e){this._boundRemove||(this._boundRemove=this._remove.bind(this));let t=ne.resolve(e);return this._watched.has(t)||this._watched.set(t,new ea(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;let s=(e&&Number.parseInt(e.mode,10))&511;return!!(4&Number.parseInt(s.toString(8)[0],10))}_remove(e,t,s){let r=ne.join(e,t),i=ne.resolve(r);if(s=s??(this._watched.has(r)||this._watched.has(i)),!this._throttle("remove",r,100))return;!s&&!this.options.useFsEvents&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(h=>this._remove(r,h));let l=this._getWatchedDir(e),u=l.has(t);l.remove(t),this._symlinkPaths.has(i)&&this._symlinkPaths.delete(i);let d=r;if(this.options.cwd&&(d=ne.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===ur)return;this._watched.delete(r),this._watched.delete(i);let f=s?ex:Tf;u&&!this._isIgnored(r)&&this._emit(f,r),this.options.useFsEvents||this._closePath(r)}_closePath(e){this._closeFile(e);let t=ne.dirname(e);this._getWatchedDir(t).remove(ne.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(s=>s()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let s=this._closers.get(e);s||(s=[],this._closers.set(e,s)),s.push(t)}_readdirp(e,t){if(this.closed)return;let s={type:Wo,alwaysStat:!0,lstat:!0,...t},r=Vw(e,s);return this._streams.add(r),r.once(nx,()=>{r=void 0}),r.once(sx,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};ra.FSWatcher=dr;var Sx=(n,e)=>{let t=new dr(e);return t.add(n),t};ra.watch=Sx});var Uf={};Ne(Uf,{CollaborationManager:()=>rs,addTeamMember:()=>Ax,formatTeamConfig:()=>$x,initTeamConfig:()=>kx,loadTeamConfig:()=>_x,saveTeamConfig:()=>Bf});function _x(n){let e=Ye.join(n,".hablas","team.json");if(ye.existsSync(e))try{return JSON.parse(ye.readFileSync(e,"utf-8"))}catch{return null}return null}function kx(n,e){let t={name:e,members:[]};return Bf(n,t),t}function Bf(n,e){let t=Ye.join(n,".hablas","team.json"),s=Ye.dirname(t);ye.existsSync(s)||ye.mkdirSync(s,{recursive:!0}),ye.writeFileSync(t,JSON.stringify(e,null,2),"utf-8")}function Ax(n,e,t){return n.members.push({name:e,email:t}),n}function $x(n){return[`Team: ${n.name}`,"Members:",...n.members.map(t=>` - ${t.name} (${t.email})`)].join(`
|
|
312
|
-
`)}var
|
|
310
|
+
If you cannot complete a task, explain why with absolute technical objectivity.`;ro=Ae.join(io.homedir(),".hablas","backup")});var Gn=N((VC,Ku)=>{"use strict";var lb=require("path"),bt="\\\\/",ju=`[^${bt}]`,cb=0,Pt="\\.",ub="\\+",db="\\?",Vs="\\/",fb="(?=.)",Hu="[^/]",oo=`(?:${Vs}|$)`,Bu=`(?:^|${Vs})`,ao=`${Pt}{1,2}${oo}`,pb=`(?!${Pt})`,hb=`(?!${Bu}${ao})`,mb=`(?!${Pt}{0,1}${oo})`,gb=`(?!${ao})`,yb=`[^.${Vs}]`,bb=`${Hu}*?`,Uu={DOT_LITERAL:Pt,PLUS_LITERAL:ub,QMARK_LITERAL:db,SLASH_LITERAL:Vs,ONE_CHAR:fb,QMARK:Hu,END_ANCHOR:oo,DOTS_SLASH:ao,NO_DOT:pb,NO_DOTS:hb,NO_DOT_SLASH:mb,NO_DOTS_SLASH:gb,QMARK_NO_DOT:yb,STAR:bb,START_ANCHOR:Bu},vb={...Uu,SLASH_LITERAL:`[${bt}]`,QMARK:ju,STAR:`${ju}*?`,DOTS_SLASH:`${Pt}{1,2}(?:[${bt}]|$)`,NO_DOT:`(?!${Pt})`,NO_DOTS:`(?!(?:^|[${bt}])${Pt}{1,2}(?:[${bt}]|$))`,NO_DOT_SLASH:`(?!${Pt}{0,1}(?:[${bt}]|$))`,NO_DOTS_SLASH:`(?!${Pt}{1,2}(?:[${bt}]|$))`,QMARK_NO_DOT:`[^.${bt}]`,START_ANCHOR:`(?:^|[${bt}])`,END_ANCHOR:`(?:[${bt}]|$)`},wb={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Ku.exports={DEFAULT_MAX_EXTGLOB_RECURSION:cb,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wb,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:lb.sep,extglobChars(n){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${n.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(n){return n===!0?vb:Uu}}});var zs=N(De=>{"use strict";var xb=require("path"),Sb=process.platform==="win32",{REGEX_BACKSLASH:_b,REGEX_REMOVE_BACKSLASH:kb,REGEX_SPECIAL_CHARS:Ab,REGEX_SPECIAL_CHARS_GLOBAL:$b}=Gn();De.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);De.hasRegexChars=n=>Ab.test(n);De.isRegexChar=n=>n.length===1&&De.hasRegexChars(n);De.escapeRegex=n=>n.replace($b,"\\$1");De.toPosixSlashes=n=>n.replace(_b,"/");De.removeBackslashes=n=>n.replace(kb,e=>e==="\\"?"":e);De.supportsLookbehinds=()=>{let n=process.version.slice(1).split(".").map(Number);return n.length===3&&n[0]>=9||n[0]===8&&n[1]>=10};De.isWindows=n=>n&&typeof n.windows=="boolean"?n.windows:Sb===!0||xb.sep==="\\";De.escapeLast=(n,e,t)=>{let s=n.lastIndexOf(e,t);return s===-1?n:n[s-1]==="\\"?De.escapeLast(n,e,s-1):`${n.slice(0,s)}\\${n.slice(s)}`};De.removePrefix=(n,e={})=>{let t=n;return t.startsWith("./")&&(t=t.slice(2),e.prefix="./"),t};De.wrapOutput=(n,e={},t={})=>{let s=t.contains?"":"^",r=t.contains?"":"$",i=`${s}(?:${n})${r}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Xu=N((YC,Ju)=>{"use strict";var qu=zs(),{CHAR_ASTERISK:lo,CHAR_AT:Cb,CHAR_BACKWARD_SLASH:Vn,CHAR_COMMA:Eb,CHAR_DOT:co,CHAR_EXCLAMATION_MARK:uo,CHAR_FORWARD_SLASH:Yu,CHAR_LEFT_CURLY_BRACE:fo,CHAR_LEFT_PARENTHESES:po,CHAR_LEFT_SQUARE_BRACKET:Tb,CHAR_PLUS:Rb,CHAR_QUESTION_MARK:Wu,CHAR_RIGHT_CURLY_BRACE:Ob,CHAR_RIGHT_PARENTHESES:Gu,CHAR_RIGHT_SQUARE_BRACKET:Pb}=Gn(),Vu=n=>n===Yu||n===Vn,zu=n=>{n.isPrefix!==!0&&(n.depth=n.isGlobstar?1/0:1)},Mb=(n,e)=>{let t=e||{},s=n.length-1,r=t.parts===!0||t.scanToEnd===!0,i=[],o=[],a=[],l=n,u=-1,d=0,f=0,h=!1,m=!1,p=!1,g=!1,x=!1,w=!1,$=!1,A=!1,y=!1,v=!1,b=0,S,_,T={value:"",depth:0,isGlob:!1},I=()=>u>=s,C=()=>l.charCodeAt(u+1),F=()=>(S=_,l.charCodeAt(++u));for(;u<s;){_=F();let J;if(_===Vn){$=T.backslashes=!0,_=F(),_===fo&&(w=!0);continue}if(w===!0||_===fo){for(b++;I()!==!0&&(_=F());){if(_===Vn){$=T.backslashes=!0,F();continue}if(_===fo){b++;continue}if(w!==!0&&_===co&&(_=F())===co){if(h=T.isBrace=!0,p=T.isGlob=!0,v=!0,r===!0)continue;break}if(w!==!0&&_===Eb){if(h=T.isBrace=!0,p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Ob&&(b--,b===0)){w=!1,h=T.isBrace=!0,v=!0;break}}if(r===!0)continue;break}if(_===Yu){if(i.push(u),o.push(T),T={value:"",depth:0,isGlob:!1},v===!0)continue;if(S===co&&u===d+1){d+=2;continue}f=u+1;continue}if(t.noext!==!0&&(_===Rb||_===Cb||_===lo||_===Wu||_===uo)===!0&&C()===po){if(p=T.isGlob=!0,g=T.isExtglob=!0,v=!0,_===uo&&u===d&&(y=!0),r===!0){for(;I()!==!0&&(_=F());){if(_===Vn){$=T.backslashes=!0,_=F();continue}if(_===Gu){p=T.isGlob=!0,v=!0;break}}continue}break}if(_===lo){if(S===lo&&(x=T.isGlobstar=!0),p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Wu){if(p=T.isGlob=!0,v=!0,r===!0)continue;break}if(_===Tb){for(;I()!==!0&&(J=F());){if(J===Vn){$=T.backslashes=!0,F();continue}if(J===Pb){m=T.isBracket=!0,p=T.isGlob=!0,v=!0;break}}if(r===!0)continue;break}if(t.nonegate!==!0&&_===uo&&u===d){A=T.negated=!0,d++;continue}if(t.noparen!==!0&&_===po){if(p=T.isGlob=!0,r===!0){for(;I()!==!0&&(_=F());){if(_===po){$=T.backslashes=!0,_=F();continue}if(_===Gu){v=!0;break}}continue}break}if(p===!0){if(v=!0,r===!0)continue;break}}t.noext===!0&&(g=!1,p=!1);let H=l,W="",E="";d>0&&(W=l.slice(0,d),l=l.slice(d),f-=d),H&&p===!0&&f>0?(H=l.slice(0,f),E=l.slice(f)):p===!0?(H="",E=l):H=l,H&&H!==""&&H!=="/"&&H!==l&&Vu(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),t.unescape===!0&&(E&&(E=qu.removeBackslashes(E)),H&&$===!0&&(H=qu.removeBackslashes(H)));let k={prefix:W,input:n,start:d,base:H,glob:E,isBrace:h,isBracket:m,isGlob:p,isExtglob:g,isGlobstar:x,negated:A,negatedExtglob:y};if(t.tokens===!0&&(k.maxDepth=0,Vu(_)||o.push(T),k.tokens=o),t.parts===!0||t.tokens===!0){let J;for(let K=0;K<i.length;K++){let Z=J?J+1:d,te=i[K],Q=n.slice(Z,te);t.tokens&&(K===0&&d!==0?(o[K].isPrefix=!0,o[K].value=W):o[K].value=Q,zu(o[K]),k.maxDepth+=o[K].depth),(K!==0||Q!=="")&&a.push(Q),J=te}if(J&&J+1<n.length){let K=n.slice(J+1);a.push(K),t.tokens&&(o[o.length-1].value=K,zu(o[o.length-1]),k.maxDepth+=o[o.length-1].depth)}k.slashes=i,k.parts=a}return k};Ju.exports=Mb});var nd=N((JC,td)=>{"use strict";var zn=Gn(),Ce=zs(),{MAX_LENGTH:Ys,POSIX_REGEX_SOURCE:Ib,REGEX_NON_SPECIAL_CHARS:Db,REGEX_SPECIAL_CHARS_BACKREF:Lb,REPLACEMENTS:Qu}=zn,Fb=(n,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...n,e);n.sort();let t=`[${n.join("-")}]`;try{new RegExp(t)}catch{return n.map(r=>Ce.escapeRegex(r)).join("..")}return t},wn=(n,e)=>`Missing ${n}: "${e}" - use "\\\\${e}" to match literal characters`,Zu=n=>{let e=[],t=0,s=0,r=0,i="",o=!1;for(let a of n){if(o===!0){i+=a,o=!1;continue}if(a==="\\"){i+=a,o=!0;continue}if(a==='"'){r=r===1?0:1,i+=a;continue}if(r===0){if(a==="[")t++;else if(a==="]"&&t>0)t--;else if(t===0){if(a==="(")s++;else if(a===")"&&s>0)s--;else if(a==="|"&&s===0){e.push(i),i="";continue}}}i+=a}return e.push(i),e},Nb=n=>{let e=!1;for(let t of n){if(e===!0){e=!1;continue}if(t==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(t))return!1}return!0},ed=n=>{let e=n.trim(),t=!0;for(;t===!0;)t=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),t=!0);if(Nb(e))return e.replace(/\\(.)/g,"$1")},jb=n=>{let e=n.map(ed).filter(Boolean);for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++){let r=e[t],i=e[s],o=r[0];if(!(!o||r!==o.repeat(r.length)||i!==o.repeat(i.length))&&(r===i||r.startsWith(i)||i.startsWith(r)))return!0}return!1},ho=(n,e=!0)=>{if(n[0]!=="+"&&n[0]!=="*"||n[1]!=="(")return;let t=0,s=0,r=0,i=!1;for(let o=1;o<n.length;o++){let a=n[o];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){r=r===1?0:1;continue}if(r!==1){if(a==="["){t++;continue}if(a==="]"&&t>0){t--;continue}if(!(t>0)){if(a==="("){s++;continue}if(a===")"&&(s--,s===0))return e===!0&&o!==n.length-1?void 0:{type:n[0],body:n.slice(2,o),end:o}}}}},Hb=n=>{let e=0,t=[];for(;e<n.length;){let r=ho(n.slice(e),!1);if(!r||r.type!=="*")return;let i=Zu(r.body).map(a=>a.trim());if(i.length!==1)return;let o=ed(i[0]);if(!o||o.length!==1)return;t.push(o),e+=r.end+1}return t.length<1?void 0:`${t.length===1?Ce.escapeRegex(t[0]):`[${t.map(r=>Ce.escapeRegex(r)).join("")}]`}*`},Bb=n=>{let e=0,t=n.trim(),s=ho(t);for(;s;)e++,t=s.body.trim(),s=ho(t);return e},Ub=(n,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let t=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:zn.DEFAULT_MAX_EXTGLOB_RECURSION,s=Zu(n).map(r=>r.trim());if(s.length>1&&(s.some(r=>r==="")||s.some(r=>/^[*?]+$/.test(r))||jb(s)))return{risky:!0};for(let r of s){let i=Hb(r);if(i)return{risky:!0,safeOutput:i};if(Bb(r)>t)return{risky:!0}}return{risky:!1}},mo=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a string");n=Qu[n]||n;let t={...e},s=typeof t.maxLength=="number"?Math.min(Ys,t.maxLength):Ys,r=n.length;if(r>s)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${s}`);let i={type:"bos",value:"",output:t.prepend||""},o=[i],a=t.capture?"":"?:",l=Ce.isWindows(e),u=zn.globChars(l),d=zn.extglobChars(u),{DOT_LITERAL:f,PLUS_LITERAL:h,SLASH_LITERAL:m,ONE_CHAR:p,DOTS_SLASH:g,NO_DOT:x,NO_DOT_SLASH:w,NO_DOTS_SLASH:$,QMARK:A,QMARK_NO_DOT:y,STAR:v,START_ANCHOR:b}=u,S=D=>`(${a}(?:(?!${b}${D.dot?g:f}).)*?)`,_=t.dot?"":x,T=t.dot?A:y,I=t.bash===!0?S(t):v;t.capture&&(I=`(${I})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let C={input:n,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};n=Ce.removePrefix(n,C),r=n.length;let F=[],H=[],W=[],E=i,k,J=()=>C.index===r-1,K=C.peek=(D=1)=>n[C.index+D],Z=C.advance=()=>n[++C.index]||"",te=()=>n.slice(C.index+1),Q=(D="",G=0)=>{C.consumed+=D,C.index+=G},ce=D=>{C.output+=D.output!=null?D.output:D.value,Q(D.value)},Oe=()=>{let D=1;for(;K()==="!"&&(K(2)!=="("||K(3)==="?");)Z(),C.start++,D++;return D%2===0?!1:(C.negated=!0,C.start++,!0)},Fe=D=>{C[D]++,W.push(D)},ye=D=>{C[D]--,W.pop()},U=D=>{if(E.type==="globstar"){let G=C.braces>0&&(D.type==="comma"||D.type==="brace"),P=D.extglob===!0||F.length&&(D.type==="pipe"||D.type==="paren");D.type!=="slash"&&D.type!=="paren"&&!G&&!P&&(C.output=C.output.slice(0,-E.output.length),E.type="star",E.value="*",E.output=I,C.output+=E.output)}if(F.length&&D.type!=="paren"&&(F[F.length-1].inner+=D.value),(D.value||D.output)&&ce(D),E&&E.type==="text"&&D.type==="text"){E.value+=D.value,E.output=(E.output||"")+D.value;return}D.prev=E,o.push(D),E=D},ue=(D,G)=>{let P={...d[G],conditions:1,inner:""};P.prev=E,P.parens=C.parens,P.output=C.output,P.startIndex=C.index,P.tokensIndex=o.length;let V=(t.capture?"(":"")+P.open;Fe("parens"),U({type:D,value:G,output:C.output?"":p}),U({type:"paren",extglob:!0,value:Z(),output:V}),F.push(P)},Pe=D=>{let G=n.slice(D.startIndex,C.index+1),P=n.slice(D.startIndex+2,C.index),V=Ub(P,t);if((D.type==="plus"||D.type==="star")&&V.risky){let ie=V.safeOutput?(D.output?"":p)+(t.capture?`(${V.safeOutput})`:V.safeOutput):void 0,gt=o[D.tokensIndex];gt.type="text",gt.value=G,gt.output=ie||Ce.escapeRegex(G);for(let yt=D.tokensIndex+1;yt<o.length;yt++)o[yt].value="",o[yt].output="",delete o[yt].suffix;C.output=D.output+gt.output,C.backtrack=!0,U({type:"paren",extglob:!0,value:k,output:""}),ye("parens");return}let ee=D.close+(t.capture?")":""),de;if(D.type==="negate"){let ie=I;if(D.inner&&D.inner.length>1&&D.inner.includes("/")&&(ie=S(t)),(ie!==I||J()||/^\)+$/.test(te()))&&(ee=D.close=`)$))${ie}`),D.inner.includes("*")&&(de=te())&&/^\.[^\\/.]+$/.test(de)){let gt=mo(de,{...e,fastpaths:!1}).output;ee=D.close=`)${gt})${ie})`}D.prev.type==="bos"&&(C.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:k,output:ee}),ye("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(n)){let D=!1,G=n.replace(Lb,(P,V,ee,de,ie,gt)=>de==="\\"?(D=!0,P):de==="?"?V?V+de+(ie?A.repeat(ie.length):""):gt===0?T+(ie?A.repeat(ie.length):""):A.repeat(ee.length):de==="."?f.repeat(ee.length):de==="*"?V?V+de+(ie?I:""):I:V?P:`\\${P}`);return D===!0&&(t.unescape===!0?G=G.replace(/\\/g,""):G=G.replace(/\\+/g,P=>P.length%2===0?"\\\\":P?"\\":"")),G===n&&t.contains===!0?(C.output=n,C):(C.output=Ce.wrapOutput(G,C,e),C)}for(;!J();){if(k=Z(),k==="\0")continue;if(k==="\\"){let P=K();if(P==="/"&&t.bash!==!0||P==="."||P===";")continue;if(!P){k+="\\",U({type:"text",value:k});continue}let V=/^\\+/.exec(te()),ee=0;if(V&&V[0].length>2&&(ee=V[0].length,C.index+=ee,ee%2!==0&&(k+="\\")),t.unescape===!0?k=Z():k+=Z(),C.brackets===0){U({type:"text",value:k});continue}}if(C.brackets>0&&(k!=="]"||E.value==="["||E.value==="[^")){if(t.posix!==!1&&k===":"){let P=E.value.slice(1);if(P.includes("[")&&(E.posix=!0,P.includes(":"))){let V=E.value.lastIndexOf("["),ee=E.value.slice(0,V),de=E.value.slice(V+2),ie=Ib[de];if(ie){E.value=ee+ie,C.backtrack=!0,Z(),!i.output&&o.indexOf(E)===1&&(i.output=p);continue}}}(k==="["&&K()!==":"||k==="-"&&K()==="]")&&(k=`\\${k}`),k==="]"&&(E.value==="["||E.value==="[^")&&(k=`\\${k}`),t.posix===!0&&k==="!"&&E.value==="["&&(k="^"),E.value+=k,ce({value:k});continue}if(C.quotes===1&&k!=='"'){k=Ce.escapeRegex(k),E.value+=k,ce({value:k});continue}if(k==='"'){C.quotes=C.quotes===1?0:1,t.keepQuotes===!0&&U({type:"text",value:k});continue}if(k==="("){Fe("parens"),U({type:"paren",value:k});continue}if(k===")"){if(C.parens===0&&t.strictBrackets===!0)throw new SyntaxError(wn("opening","("));let P=F[F.length-1];if(P&&C.parens===P.parens+1){Pe(F.pop());continue}U({type:"paren",value:k,output:C.parens?")":"\\)"}),ye("parens");continue}if(k==="["){if(t.nobracket===!0||!te().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(wn("closing","]"));k=`\\${k}`}else Fe("brackets");U({type:"bracket",value:k});continue}if(k==="]"){if(t.nobracket===!0||E&&E.type==="bracket"&&E.value.length===1){U({type:"text",value:k,output:`\\${k}`});continue}if(C.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(wn("opening","["));U({type:"text",value:k,output:`\\${k}`});continue}ye("brackets");let P=E.value.slice(1);if(E.posix!==!0&&P[0]==="^"&&!P.includes("/")&&(k=`/${k}`),E.value+=k,ce({value:k}),t.literalBrackets===!1||Ce.hasRegexChars(P))continue;let V=Ce.escapeRegex(E.value);if(C.output=C.output.slice(0,-E.value.length),t.literalBrackets===!0){C.output+=V,E.value=V;continue}E.value=`(${a}${V}|${E.value})`,C.output+=E.value;continue}if(k==="{"&&t.nobrace!==!0){Fe("braces");let P={type:"brace",value:k,output:"(",outputIndex:C.output.length,tokensIndex:C.tokens.length};H.push(P),U(P);continue}if(k==="}"){let P=H[H.length-1];if(t.nobrace===!0||!P){U({type:"text",value:k,output:k});continue}let V=")";if(P.dots===!0){let ee=o.slice(),de=[];for(let ie=ee.length-1;ie>=0&&(o.pop(),ee[ie].type!=="brace");ie--)ee[ie].type!=="dots"&&de.unshift(ee[ie].value);V=Fb(de,t),C.backtrack=!0}if(P.comma!==!0&&P.dots!==!0){let ee=C.output.slice(0,P.outputIndex),de=C.tokens.slice(P.tokensIndex);P.value=P.output="\\{",k=V="\\}",C.output=ee;for(let ie of de)C.output+=ie.output||ie.value}U({type:"brace",value:k,output:V}),ye("braces"),H.pop();continue}if(k==="|"){F.length>0&&F[F.length-1].conditions++,U({type:"text",value:k});continue}if(k===","){let P=k,V=H[H.length-1];V&&W[W.length-1]==="braces"&&(V.comma=!0,P="|"),U({type:"comma",value:k,output:P});continue}if(k==="/"){if(E.type==="dot"&&C.index===C.start+1){C.start=C.index+1,C.consumed="",C.output="",o.pop(),E=i;continue}U({type:"slash",value:k,output:m});continue}if(k==="."){if(C.braces>0&&E.type==="dot"){E.value==="."&&(E.output=f);let P=H[H.length-1];E.type="dots",E.output+=k,E.value+=k,P.dots=!0;continue}if(C.braces+C.parens===0&&E.type!=="bos"&&E.type!=="slash"){U({type:"text",value:k,output:f});continue}U({type:"dot",value:k,output:f});continue}if(k==="?"){if(!(E&&E.value==="(")&&t.noextglob!==!0&&K()==="("&&K(2)!=="?"){ue("qmark",k);continue}if(E&&E.type==="paren"){let V=K(),ee=k;if(V==="<"&&!Ce.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(E.value==="("&&!/[!=<:]/.test(V)||V==="<"&&!/<([!=]|\w+>)/.test(te()))&&(ee=`\\${k}`),U({type:"text",value:k,output:ee});continue}if(t.dot!==!0&&(E.type==="slash"||E.type==="bos")){U({type:"qmark",value:k,output:y});continue}U({type:"qmark",value:k,output:A});continue}if(k==="!"){if(t.noextglob!==!0&&K()==="("&&(K(2)!=="?"||!/[!=<:]/.test(K(3)))){ue("negate",k);continue}if(t.nonegate!==!0&&C.index===0){Oe();continue}}if(k==="+"){if(t.noextglob!==!0&&K()==="("&&K(2)!=="?"){ue("plus",k);continue}if(E&&E.value==="("||t.regex===!1){U({type:"plus",value:k,output:h});continue}if(E&&(E.type==="bracket"||E.type==="paren"||E.type==="brace")||C.parens>0){U({type:"plus",value:k});continue}U({type:"plus",value:h});continue}if(k==="@"){if(t.noextglob!==!0&&K()==="("&&K(2)!=="?"){U({type:"at",extglob:!0,value:k,output:""});continue}U({type:"text",value:k});continue}if(k!=="*"){(k==="$"||k==="^")&&(k=`\\${k}`);let P=Db.exec(te());P&&(k+=P[0],C.index+=P[0].length),U({type:"text",value:k});continue}if(E&&(E.type==="globstar"||E.star===!0)){E.type="star",E.star=!0,E.value+=k,E.output=I,C.backtrack=!0,C.globstar=!0,Q(k);continue}let D=te();if(t.noextglob!==!0&&/^\([^?]/.test(D)){ue("star",k);continue}if(E.type==="star"){if(t.noglobstar===!0){Q(k);continue}let P=E.prev,V=P.prev,ee=P.type==="slash"||P.type==="bos",de=V&&(V.type==="star"||V.type==="globstar");if(t.bash===!0&&(!ee||D[0]&&D[0]!=="/")){U({type:"star",value:k,output:""});continue}let ie=C.braces>0&&(P.type==="comma"||P.type==="brace"),gt=F.length&&(P.type==="pipe"||P.type==="paren");if(!ee&&P.type!=="paren"&&!ie&&!gt){U({type:"star",value:k,output:""});continue}for(;D.slice(0,3)==="/**";){let yt=n[C.index+4];if(yt&&yt!=="/")break;D=D.slice(3),Q("/**",3)}if(P.type==="bos"&&J()){E.type="globstar",E.value+=k,E.output=S(t),C.output=E.output,C.globstar=!0,Q(k);continue}if(P.type==="slash"&&P.prev.type!=="bos"&&!de&&J()){C.output=C.output.slice(0,-(P.output+E.output).length),P.output=`(?:${P.output}`,E.type="globstar",E.output=S(t)+(t.strictSlashes?")":"|$)"),E.value+=k,C.globstar=!0,C.output+=P.output+E.output,Q(k);continue}if(P.type==="slash"&&P.prev.type!=="bos"&&D[0]==="/"){let yt=D[1]!==void 0?"|$":"";C.output=C.output.slice(0,-(P.output+E.output).length),P.output=`(?:${P.output}`,E.type="globstar",E.output=`${S(t)}${m}|${m}${yt})`,E.value+=k,C.output+=P.output+E.output,C.globstar=!0,Q(k+Z()),U({type:"slash",value:"/",output:""});continue}if(P.type==="bos"&&D[0]==="/"){E.type="globstar",E.value+=k,E.output=`(?:^|${m}|${S(t)}${m})`,C.output=E.output,C.globstar=!0,Q(k+Z()),U({type:"slash",value:"/",output:""});continue}C.output=C.output.slice(0,-E.output.length),E.type="globstar",E.output=S(t),E.value+=k,C.output+=E.output,C.globstar=!0,Q(k);continue}let G={type:"star",value:k,output:I};if(t.bash===!0){G.output=".*?",(E.type==="bos"||E.type==="slash")&&(G.output=_+G.output),U(G);continue}if(E&&(E.type==="bracket"||E.type==="paren")&&t.regex===!0){G.output=k,U(G);continue}(C.index===C.start||E.type==="slash"||E.type==="dot")&&(E.type==="dot"?(C.output+=w,E.output+=w):t.dot===!0?(C.output+=$,E.output+=$):(C.output+=_,E.output+=_),K()!=="*"&&(C.output+=p,E.output+=p)),U(G)}for(;C.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing","]"));C.output=Ce.escapeLast(C.output,"["),ye("brackets")}for(;C.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing",")"));C.output=Ce.escapeLast(C.output,"("),ye("parens")}for(;C.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(wn("closing","}"));C.output=Ce.escapeLast(C.output,"{"),ye("braces")}if(t.strictSlashes!==!0&&(E.type==="star"||E.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${m}?`}),C.backtrack===!0){C.output="";for(let D of C.tokens)C.output+=D.output!=null?D.output:D.value,D.suffix&&(C.output+=D.suffix)}return C};mo.fastpaths=(n,e)=>{let t={...e},s=typeof t.maxLength=="number"?Math.min(Ys,t.maxLength):Ys,r=n.length;if(r>s)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${s}`);n=Qu[n]||n;let i=Ce.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:u,NO_DOT:d,NO_DOTS:f,NO_DOTS_SLASH:h,STAR:m,START_ANCHOR:p}=zn.globChars(i),g=t.dot?f:d,x=t.dot?h:d,w=t.capture?"":"?:",$={negated:!1,prefix:""},A=t.bash===!0?".*?":m;t.capture&&(A=`(${A})`);let y=_=>_.noglobstar===!0?A:`(${w}(?:(?!${p}${_.dot?u:o}).)*?)`,v=_=>{switch(_){case"*":return`${g}${l}${A}`;case".*":return`${o}${l}${A}`;case"*.*":return`${g}${A}${o}${l}${A}`;case"*/*":return`${g}${A}${a}${l}${x}${A}`;case"**":return g+y(t);case"**/*":return`(?:${g}${y(t)}${a})?${x}${l}${A}`;case"**/*.*":return`(?:${g}${y(t)}${a})?${x}${A}${o}${l}${A}`;case"**/.*":return`(?:${g}${y(t)}${a})?${o}${l}${A}`;default:{let T=/^(.*?)\.(\w+)$/.exec(_);if(!T)return;let I=v(T[1]);return I?I+o+T[2]:void 0}}},b=Ce.removePrefix(n,$),S=v(b);return S&&t.strictSlashes!==!0&&(S+=`${a}?`),S};td.exports=mo});var rd=N((XC,sd)=>{"use strict";var Kb=require("path"),qb=Xu(),go=nd(),yo=zs(),Wb=Gn(),Gb=n=>n&&typeof n=="object"&&!Array.isArray(n),ge=(n,e,t=!1)=>{if(Array.isArray(n)){let d=n.map(h=>ge(h,e,t));return h=>{for(let m of d){let p=m(h);if(p)return p}return!1}}let s=Gb(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let r=e||{},i=yo.isWindows(e),o=s?ge.compileRe(n,e):ge.makeRe(n,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(r.ignore){let d={...e,ignore:null,onMatch:null,onResult:null};l=ge(r.ignore,d,t)}let u=(d,f=!1)=>{let{isMatch:h,match:m,output:p}=ge.test(d,o,e,{glob:n,posix:i}),g={glob:n,state:a,regex:o,posix:i,input:d,output:p,match:m,isMatch:h};return typeof r.onResult=="function"&&r.onResult(g),h===!1?(g.isMatch=!1,f?g:!1):l(d)?(typeof r.onIgnore=="function"&&r.onIgnore(g),g.isMatch=!1,f?g:!1):(typeof r.onMatch=="function"&&r.onMatch(g),f?g:!0)};return t&&(u.state=a),u};ge.test=(n,e,t,{glob:s,posix:r}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return{isMatch:!1,output:""};let i=t||{},o=i.format||(r?yo.toPosixSlashes:null),a=n===s,l=a&&o?o(n):n;return a===!1&&(l=o?o(n):n,a=l===s),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=ge.matchBase(n,e,t,r):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};ge.matchBase=(n,e,t,s=yo.isWindows(t))=>(e instanceof RegExp?e:ge.makeRe(e,t)).test(Kb.basename(n));ge.isMatch=(n,e,t)=>ge(e,t)(n);ge.parse=(n,e)=>Array.isArray(n)?n.map(t=>ge.parse(t,e)):go(n,{...e,fastpaths:!1});ge.scan=(n,e)=>qb(n,e);ge.compileRe=(n,e,t=!1,s=!1)=>{if(t===!0)return n.output;let r=e||{},i=r.contains?"":"^",o=r.contains?"":"$",a=`${i}(?:${n.output})${o}`;n&&n.negated===!0&&(a=`^(?!${a}).*$`);let l=ge.toRegex(a,e);return s===!0&&(l.state=n),l};ge.makeRe=(n,e={},t=!1,s=!1)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(n[0]==="."||n[0]==="*")&&(r.output=go.fastpaths(n,e)),r.output||(r=go(n,e)),ge.compileRe(r,e,t,s)};ge.toRegex=(n,e)=>{try{let t=e||{};return new RegExp(n,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===!0)throw t;return/$^/}};ge.constants=Wb;sd.exports=ge});var bo=N((QC,id)=>{"use strict";id.exports=rd()});var pd=N((ZC,fd)=>{"use strict";var Jn=require("fs"),{Readable:Vb}=require("stream"),Yn=require("path"),{promisify:Zs}=require("util"),vo=bo(),zb=Zs(Jn.readdir),Yb=Zs(Jn.stat),od=Zs(Jn.lstat),Jb=Zs(Jn.realpath),Xb="!",ud="READDIRP_RECURSIVE_ERROR",Qb=new Set(["ENOENT","EPERM","EACCES","ELOOP",ud]),wo="files",dd="directories",Xs="files_directories",Js="all",ad=[wo,dd,Xs,Js],Zb=n=>Qb.has(n.code),[ld,ev]=process.versions.node.split(".").slice(0,2).map(n=>Number.parseInt(n,10)),tv=process.platform==="win32"&&(ld>10||ld===10&&ev>=5),cd=n=>{if(n!==void 0){if(typeof n=="function")return n;if(typeof n=="string"){let e=vo(n.trim());return t=>e(t.basename)}if(Array.isArray(n)){let e=[],t=[];for(let s of n){let r=s.trim();r.charAt(0)===Xb?t.push(vo(r.slice(1))):e.push(vo(r))}return t.length>0?e.length>0?s=>e.some(r=>r(s.basename))&&!t.some(r=>r(s.basename)):s=>!t.some(r=>r(s.basename)):s=>e.some(r=>r(s.basename))}}},Qs=class n extends Vb{static get defaultOptions(){return{root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:wo,lstat:!1,depth:2147483648,alwaysStat:!1}}constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark||4096});let t={...n.defaultOptions,...e},{root:s,type:r}=t;this._fileFilter=cd(t.fileFilter),this._directoryFilter=cd(t.directoryFilter);let i=t.lstat?od:Yb;tv?this._stat=o=>i(o,{bigint:!0}):this._stat=i,this._maxDepth=t.depth,this._wantsDir=[dd,Xs,Js].includes(r),this._wantsFile=[wo,Xs,Js].includes(r),this._wantsEverything=r===Js,this._root=Yn.resolve(s),this._isDirent="Dirent"in Jn&&!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(s,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let{path:t,depth:s,files:r=[]}=this.parent||{};if(r.length>0){let i=r.splice(0,e).map(o=>this._formatEntry(o,t));for(let o of await Promise.all(i)){if(this.destroyed)return;let a=await this._getEntryType(o);a==="directory"&&this._directoryFilter(o)?(s<=this._maxDepth&&this.parents.push(this._exploreDir(o.fullPath,s+1)),this._wantsDir&&(this.push(o),e--)):(a==="file"||this._includeAsFile(o))&&this._fileFilter(o)&&this._wantsFile&&(this.push(o),e--)}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let s;try{s=await zb(e,this._rdOptions)}catch(r){this._onError(r)}return{files:s,depth:t,path:e}}async _formatEntry(e,t){let s;try{let r=this._isDirent?e.name:e,i=Yn.resolve(Yn.join(t,r));s={path:Yn.relative(this._root,i),fullPath:i,basename:r},s[this._statsProp]=this._isDirent?e:await this._stat(i)}catch(r){this._onError(r)}return s}_onError(e){Zb(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){let t=e&&e[this._statsProp];if(t){if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let s=e.fullPath;try{let r=await Jb(s),i=await od(r);if(i.isFile())return"file";if(i.isDirectory()){let o=r.length;if(s.startsWith(r)&&s.substr(o,1)===Yn.sep){let a=new Error(`Circular symlink detected: "${s}" points to "${r}"`);return a.code=ud,this._onError(a)}return"directory"}}catch(r){this._onError(r)}}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}},xn=(n,e={})=>{let t=e.entryType||e.type;if(t==="both"&&(t=Xs),t&&(e.type=t),n){if(typeof n!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!ad.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${ad.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=n,new Qs(e)},nv=(n,e={})=>new Promise((t,s)=>{let r=[];xn(n,e).on("data",i=>r.push(i)).on("end",()=>t(r)).on("error",i=>s(i))});xn.promise=nv;xn.ReaddirpStream=Qs;xn.default=xn;fd.exports=xn});var xo=N((eE,hd)=>{hd.exports=function(n,e){if(typeof n!="string")throw new TypeError("expected path to be a string");if(n==="\\"||n==="/")return"/";var t=n.length;if(t<=1)return n;var s="";if(t>4&&n[3]==="\\"){var r=n[2];(r==="?"||r===".")&&n.slice(0,2)==="\\\\"&&(n=n.slice(2),s="//")}var i=n.split(/[/\\]+/);return e!==!1&&i[i.length-1]===""&&i.pop(),s+i.join("/")}});var wd=N((bd,vd)=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var yd=bo(),sv=xo(),md="!",rv={returnIndex:!1},iv=n=>Array.isArray(n)?n:[n],ov=(n,e)=>{if(typeof n=="function")return n;if(typeof n=="string"){let t=yd(n,e);return s=>n===s||t(s)}return n instanceof RegExp?t=>n.test(t):t=>!1},gd=(n,e,t,s)=>{let r=Array.isArray(t),i=r?t[0]:t;if(!r&&typeof i!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(i));let o=sv(i,!1);for(let l=0;l<e.length;l++){let u=e[l];if(u(o))return s?-1:!1}let a=r&&[o].concat(t.slice(1));for(let l=0;l<n.length;l++){let u=n[l];if(r?u(...a):u(o))return s?l:!0}return s?-1:!1},So=(n,e,t=rv)=>{if(n==null)throw new TypeError("anymatch: specify first argument");let s=typeof t=="boolean"?{returnIndex:t}:t,r=s.returnIndex||!1,i=iv(n),o=i.filter(l=>typeof l=="string"&&l.charAt(0)===md).map(l=>l.slice(1)).map(l=>yd(l,s)),a=i.filter(l=>typeof l!="string"||typeof l=="string"&&l.charAt(0)!==md).map(l=>ov(l,s));return e==null?(l,u=!1)=>gd(a,o,l,typeof u=="boolean"?u:!1):gd(a,o,e,r)};So.default=So;vd.exports=So});var Sd=N((tE,xd)=>{xd.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1}});var _o=N((nE,kd)=>{var av=Sd(),_d={"{":"}","(":")","[":"]"},lv=function(n){if(n[0]==="!")return!0;for(var e=0,t=-2,s=-2,r=-2,i=-2,o=-2;e<n.length;){if(n[e]==="*"||n[e+1]==="?"&&/[\].+)]/.test(n[e])||s!==-1&&n[e]==="["&&n[e+1]!=="]"&&(s<e&&(s=n.indexOf("]",e)),s>e&&(o===-1||o>s||(o=n.indexOf("\\",e),o===-1||o>s)))||r!==-1&&n[e]==="{"&&n[e+1]!=="}"&&(r=n.indexOf("}",e),r>e&&(o=n.indexOf("\\",e),o===-1||o>r))||i!==-1&&n[e]==="("&&n[e+1]==="?"&&/[:!=]/.test(n[e+2])&&n[e+3]!==")"&&(i=n.indexOf(")",e),i>e&&(o=n.indexOf("\\",e),o===-1||o>i))||t!==-1&&n[e]==="("&&n[e+1]!=="|"&&(t<e&&(t=n.indexOf("|",e)),t!==-1&&n[t+1]!==")"&&(i=n.indexOf(")",t),i>t&&(o=n.indexOf("\\",t),o===-1||o>i))))return!0;if(n[e]==="\\"){var a=n[e+1];e+=2;var l=_d[a];if(l){var u=n.indexOf(l,e);u!==-1&&(e=u+1)}if(n[e]==="!")return!0}else e++}return!1},cv=function(n){if(n[0]==="!")return!0;for(var e=0;e<n.length;){if(/[*?{}()[\]]/.test(n[e]))return!0;if(n[e]==="\\"){var t=n[e+1];e+=2;var s=_d[t];if(s){var r=n.indexOf(s,e);r!==-1&&(e=r+1)}if(n[e]==="!")return!0}else e++}return!1};kd.exports=function(e,t){if(typeof e!="string"||e==="")return!1;if(av(e))return!0;var s=lv;return t&&t.strict===!1&&(s=cv),s(e)}});var $d=N((sE,Ad)=>{"use strict";var uv=_o(),dv=require("path").posix.dirname,fv=require("os").platform()==="win32",ko="/",pv=/\\/g,hv=/[\{\[].*[\}\]]$/,mv=/(^|[^\\])([\{\[]|\([^\)]+$)/,gv=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Ad.exports=function(e,t){var s=Object.assign({flipBackslashes:!0},t);s.flipBackslashes&&fv&&e.indexOf(ko)<0&&(e=e.replace(pv,ko)),hv.test(e)&&(e+=ko),e+="a";do e=dv(e);while(uv(e)||mv.test(e));return e.replace(gv,"$1")}});var er=N(ze=>{"use strict";ze.isInteger=n=>typeof n=="number"?Number.isInteger(n):typeof n=="string"&&n.trim()!==""?Number.isInteger(Number(n)):!1;ze.find=(n,e)=>n.nodes.find(t=>t.type===e);ze.exceedsLimit=(n,e,t=1,s)=>s===!1||!ze.isInteger(n)||!ze.isInteger(e)?!1:(Number(e)-Number(n))/Number(t)>=s;ze.escapeNode=(n,e=0,t)=>{let s=n.nodes[e];s&&(t&&s.type===t||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)};ze.encloseBrace=n=>n.type!=="brace"?!1:n.commas>>0+n.ranges>>0===0?(n.invalid=!0,!0):!1;ze.isInvalidBrace=n=>n.type!=="brace"?!1:n.invalid===!0||n.dollar?!0:n.commas>>0+n.ranges>>0===0||n.open!==!0||n.close!==!0?(n.invalid=!0,!0):!1;ze.isOpenOrClose=n=>n.type==="open"||n.type==="close"?!0:n.open===!0||n.close===!0;ze.reduce=n=>n.reduce((e,t)=>(t.type==="text"&&e.push(t.value),t.type==="range"&&(t.type="text"),e),[]);ze.flatten=(...n)=>{let e=[],t=s=>{for(let r=0;r<s.length;r++){let i=s[r];if(Array.isArray(i)){t(i);continue}i!==void 0&&e.push(i)}return e};return t(n),e}});var tr=N((iE,Ed)=>{"use strict";var Cd=er();Ed.exports=(n,e={})=>{let t=(s,r={})=>{let i=e.escapeInvalid&&Cd.isInvalidBrace(r),o=s.invalid===!0&&e.escapeInvalid===!0,a="";if(s.value)return(i||o)&&Cd.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(let l of s.nodes)a+=t(l);return a};return t(n)}});var Rd=N((oE,Td)=>{"use strict";Td.exports=function(n){return typeof n=="number"?n-n===0:typeof n=="string"&&n.trim()!==""?Number.isFinite?Number.isFinite(+n):isFinite(+n):!1}});var jd=N((aE,Nd)=>{"use strict";var Od=Rd(),Jt=(n,e,t)=>{if(Od(n)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||n===e)return String(n);if(Od(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let s={relaxZeros:!0,...t};typeof s.strictZeros=="boolean"&&(s.relaxZeros=s.strictZeros===!1);let r=String(s.relaxZeros),i=String(s.shorthand),o=String(s.capture),a=String(s.wrap),l=n+":"+e+"="+r+i+o+a;if(Jt.cache.hasOwnProperty(l))return Jt.cache[l].result;let u=Math.min(n,e),d=Math.max(n,e);if(Math.abs(u-d)===1){let g=n+"|"+e;return s.capture?`(${g})`:s.wrap===!1?g:`(?:${g})`}let f=Fd(n)||Fd(e),h={min:n,max:e,a:u,b:d},m=[],p=[];if(f&&(h.isPadded=f,h.maxLen=String(h.max).length),u<0){let g=d<0?Math.abs(d):1;p=Pd(g,Math.abs(u),h,s),u=h.a=0}return d>=0&&(m=Pd(u,d,h,s)),h.negatives=p,h.positives=m,h.result=yv(p,m,s),s.capture===!0?h.result=`(${h.result})`:s.wrap!==!1&&m.length+p.length>1&&(h.result=`(?:${h.result})`),Jt.cache[l]=h,h.result};function yv(n,e,t){let s=Ao(n,e,"-",!1,t)||[],r=Ao(e,n,"",!1,t)||[],i=Ao(n,e,"-?",!0,t)||[];return s.concat(i).concat(r).join("|")}function bv(n,e){let t=1,s=1,r=Id(n,t),i=new Set([e]);for(;n<=r&&r<=e;)i.add(r),t+=1,r=Id(n,t);for(r=Dd(e+1,s)-1;n<r&&r<=e;)i.add(r),s+=1,r=Dd(e+1,s)-1;return i=[...i],i.sort(xv),i}function vv(n,e,t){if(n===e)return{pattern:n,count:[],digits:0};let s=wv(n,e),r=s.length,i="",o=0;for(let a=0;a<r;a++){let[l,u]=s[a];l===u?i+=l:l!=="0"||u!=="9"?i+=Sv(l,u,t):o++}return o&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[o],digits:r}}function Pd(n,e,t,s){let r=bv(n,e),i=[],o=n,a;for(let l=0;l<r.length;l++){let u=r[l],d=vv(String(o),String(u),s),f="";if(!t.isPadded&&a&&a.pattern===d.pattern){a.count.length>1&&a.count.pop(),a.count.push(d.count[0]),a.string=a.pattern+Ld(a.count),o=u+1;continue}t.isPadded&&(f=_v(u,t,s)),d.string=f+d.pattern+Ld(d.count),i.push(d),o=u+1,a=d}return i}function Ao(n,e,t,s,r){let i=[];for(let o of n){let{string:a}=o;!s&&!Md(e,"string",a)&&i.push(t+a),s&&Md(e,"string",a)&&i.push(t+a)}return i}function wv(n,e){let t=[];for(let s=0;s<n.length;s++)t.push([n[s],e[s]]);return t}function xv(n,e){return n>e?1:e>n?-1:0}function Md(n,e,t){return n.some(s=>s[e]===t)}function Id(n,e){return Number(String(n).slice(0,-e)+"9".repeat(e))}function Dd(n,e){return n-n%Math.pow(10,e)}function Ld(n){let[e=0,t=""]=n;return t||e>1?`{${e+(t?","+t:"")}}`:""}function Sv(n,e,t){return`[${n}${e-n===1?"":"-"}${e}]`}function Fd(n){return/^-?(0+)\d/.test(n)}function _v(n,e,t){if(!e.isPadded)return n;let s=Math.abs(e.maxLen-String(n).length),r=t.relaxZeros!==!1;switch(s){case 0:return"";case 1:return r?"0?":"0";case 2:return r?"0{0,2}":"00";default:return r?`0{0,${s}}`:`0{${s}}`}}Jt.cache={};Jt.clearCache=()=>Jt.cache={};Nd.exports=Jt});var Eo=N((lE,Gd)=>{"use strict";var kv=require("util"),Bd=jd(),Hd=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),Av=n=>e=>n===!0?Number(e):String(e),$o=n=>typeof n=="number"||typeof n=="string"&&n!=="",Xn=n=>Number.isInteger(+n),Co=n=>{let e=`${n}`,t=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++t]==="0";);return t>0},$v=(n,e,t)=>typeof n=="string"||typeof e=="string"?!0:t.stringify===!0,Cv=(n,e,t)=>{if(e>0){let s=n[0]==="-"?"-":"";s&&(n=n.slice(1)),n=s+n.padStart(s?e-1:e,"0")}return t===!1?String(n):n},sr=(n,e)=>{let t=n[0]==="-"?"-":"";for(t&&(n=n.slice(1),e--);n.length<e;)n="0"+n;return t?"-"+n:n},Ev=(n,e,t)=>{n.negatives.sort((a,l)=>a<l?-1:a>l?1:0),n.positives.sort((a,l)=>a<l?-1:a>l?1:0);let s=e.capture?"":"?:",r="",i="",o;return n.positives.length&&(r=n.positives.map(a=>sr(String(a),t)).join("|")),n.negatives.length&&(i=`-(${s}${n.negatives.map(a=>sr(String(a),t)).join("|")})`),r&&i?o=`${r}|${i}`:o=r||i,e.wrap?`(${s}${o})`:o},Ud=(n,e,t,s)=>{if(t)return Bd(n,e,{wrap:!1,...s});let r=String.fromCharCode(n);if(n===e)return r;let i=String.fromCharCode(e);return`[${r}-${i}]`},Kd=(n,e,t)=>{if(Array.isArray(n)){let s=t.wrap===!0,r=t.capture?"":"?:";return s?`(${r}${n.join("|")})`:n.join("|")}return Bd(n,e,t)},qd=(...n)=>new RangeError("Invalid range arguments: "+kv.inspect(...n)),Wd=(n,e,t)=>{if(t.strictRanges===!0)throw qd([n,e]);return[]},Tv=(n,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${n}" to be a number`);return[]},Rv=(n,e,t=1,s={})=>{let r=Number(n),i=Number(e);if(!Number.isInteger(r)||!Number.isInteger(i)){if(s.strictRanges===!0)throw qd([n,e]);return[]}r===0&&(r=0),i===0&&(i=0);let o=r>i,a=String(n),l=String(e),u=String(t);t=Math.max(Math.abs(t),1);let d=Co(a)||Co(l)||Co(u),f=d?Math.max(a.length,l.length,u.length):0,h=d===!1&&$v(n,e,s)===!1,m=s.transform||Av(h);if(s.toRegex&&t===1)return Ud(sr(n,f),sr(e,f),!0,s);let p={negatives:[],positives:[]},g=$=>p[$<0?"negatives":"positives"].push(Math.abs($)),x=[],w=0;for(;o?r>=i:r<=i;)s.toRegex===!0&&t>1?g(r):x.push(Cv(m(r,w),f,h)),r=o?r-t:r+t,w++;return s.toRegex===!0?t>1?Ev(p,s,f):Kd(x,null,{wrap:!1,...s}):x},Ov=(n,e,t=1,s={})=>{if(!Xn(n)&&n.length>1||!Xn(e)&&e.length>1)return Wd(n,e,s);let r=s.transform||(h=>String.fromCharCode(h)),i=`${n}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=i>o,l=Math.min(i,o),u=Math.max(i,o);if(s.toRegex&&t===1)return Ud(l,u,!1,s);let d=[],f=0;for(;a?i>=o:i<=o;)d.push(r(i,f)),i=a?i-t:i+t,f++;return s.toRegex===!0?Kd(d,null,{wrap:!1,options:s}):d},nr=(n,e,t,s={})=>{if(e==null&&$o(n))return[n];if(!$o(n)||!$o(e))return Wd(n,e,s);if(typeof t=="function")return nr(n,e,1,{transform:t});if(Hd(t))return nr(n,e,0,t);let r={...s};return r.capture===!0&&(r.wrap=!0),t=t||r.step||1,Xn(t)?Xn(n)&&Xn(e)?Rv(n,e,t,r):Ov(n,e,Math.max(Math.abs(t),1),r):t!=null&&!Hd(t)?Tv(t,r):nr(n,e,1,t)};Gd.exports=nr});var Yd=N((cE,zd)=>{"use strict";var Pv=Eo(),Vd=er(),Mv=(n,e={})=>{let t=(s,r={})=>{let i=Vd.isInvalidBrace(r),o=s.invalid===!0&&e.escapeInvalid===!0,a=i===!0||o===!0,l=e.escapeInvalid===!0?"\\":"",u="";if(s.isOpen===!0)return l+s.value;if(s.isClose===!0)return console.log("node.isClose",l,s.value),l+s.value;if(s.type==="open")return a?l+s.value:"(";if(s.type==="close")return a?l+s.value:")";if(s.type==="comma")return s.prev.type==="comma"?"":a?s.value:"|";if(s.value)return s.value;if(s.nodes&&s.ranges>0){let d=Vd.reduce(s.nodes),f=Pv(...d,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return d.length>1&&f.length>1?`(${f})`:f}if(s.nodes)for(let d of s.nodes)u+=t(d,s);return u};return t(n)};zd.exports=Mv});var Qd=N((uE,Xd)=>{"use strict";var Iv=Eo(),Jd=tr(),Sn=er(),Xt=(n="",e="",t=!1)=>{let s=[];if(n=[].concat(n),e=[].concat(e),!e.length)return n;if(!n.length)return t?Sn.flatten(e).map(r=>`{${r}}`):e;for(let r of n)if(Array.isArray(r))for(let i of r)s.push(Xt(i,e,t));else for(let i of e)t===!0&&typeof i=="string"&&(i=`{${i}}`),s.push(Array.isArray(i)?Xt(r,i,t):r+i);return Sn.flatten(s)},Dv=(n,e={})=>{let t=e.rangeLimit===void 0?1e3:e.rangeLimit,s=(r,i={})=>{r.queue=[];let o=i,a=i.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(r.invalid||r.dollar){a.push(Xt(a.pop(),Jd(r,e)));return}if(r.type==="brace"&&r.invalid!==!0&&r.nodes.length===2){a.push(Xt(a.pop(),["{}"]));return}if(r.nodes&&r.ranges>0){let f=Sn.reduce(r.nodes);if(Sn.exceedsLimit(...f,e.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=Iv(...f,e);h.length===0&&(h=Jd(r,e)),a.push(Xt(a.pop(),h)),r.nodes=[];return}let l=Sn.encloseBrace(r),u=r.queue,d=r;for(;d.type!=="brace"&&d.type!=="root"&&d.parent;)d=d.parent,u=d.queue;for(let f=0;f<r.nodes.length;f++){let h=r.nodes[f];if(h.type==="comma"&&r.type==="brace"){f===1&&u.push(""),u.push("");continue}if(h.type==="close"){a.push(Xt(a.pop(),u,l));continue}if(h.value&&h.type!=="open"){u.push(Xt(u.pop(),h.value));continue}h.nodes&&s(h,r)}return u};return Sn.flatten(s(n))};Xd.exports=Dv});var ef=N((dE,Zd)=>{"use strict";Zd.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
311
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var of=N((fE,rf)=>{"use strict";var Lv=tr(),{MAX_LENGTH:tf,CHAR_BACKSLASH:To,CHAR_BACKTICK:Fv,CHAR_COMMA:Nv,CHAR_DOT:jv,CHAR_LEFT_PARENTHESES:Hv,CHAR_RIGHT_PARENTHESES:Bv,CHAR_LEFT_CURLY_BRACE:Uv,CHAR_RIGHT_CURLY_BRACE:Kv,CHAR_LEFT_SQUARE_BRACKET:nf,CHAR_RIGHT_SQUARE_BRACKET:sf,CHAR_DOUBLE_QUOTE:qv,CHAR_SINGLE_QUOTE:Wv,CHAR_NO_BREAK_SPACE:Gv,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Vv}=ef(),zv=(n,e={})=>{if(typeof n!="string")throw new TypeError("Expected a string");let t=e||{},s=typeof t.maxLength=="number"?Math.min(tf,t.maxLength):tf;if(n.length>s)throw new SyntaxError(`Input length (${n.length}), exceeds max characters (${s})`);let r={type:"root",input:n,nodes:[]},i=[r],o=r,a=r,l=0,u=n.length,d=0,f=0,h,m=()=>n[d++],p=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(p({type:"bos"});d<u;)if(o=i[i.length-1],h=m(),!(h===Vv||h===Gv)){if(h===To){p({type:"text",value:(e.keepEscaping?h:"")+m()});continue}if(h===sf){p({type:"text",value:"\\"+h});continue}if(h===nf){l++;let g;for(;d<u&&(g=m());){if(h+=g,g===nf){l++;continue}if(g===To){h+=m();continue}if(g===sf&&(l--,l===0))break}p({type:"text",value:h});continue}if(h===Hv){o=p({type:"paren",nodes:[]}),i.push(o),p({type:"text",value:h});continue}if(h===Bv){if(o.type!=="paren"){p({type:"text",value:h});continue}o=i.pop(),p({type:"text",value:h}),o=i[i.length-1];continue}if(h===qv||h===Wv||h===Fv){let g=h,x;for(e.keepQuotes!==!0&&(h="");d<u&&(x=m());){if(x===To){h+=x+m();continue}if(x===g){e.keepQuotes===!0&&(h+=x);break}h+=x}p({type:"text",value:h});continue}if(h===Uv){f++;let x={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};o=p(x),i.push(o),p({type:"open",value:h});continue}if(h===Kv){if(o.type!=="brace"){p({type:"text",value:h});continue}let g="close";o=i.pop(),o.close=!0,p({type:g,value:h}),f--,o=i[i.length-1];continue}if(h===Nv&&f>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:Lv(o)}]}p({type:"comma",value:h}),o.commas++;continue}if(h===jv&&f>0&&o.commas===0){let g=o.nodes;if(f===0||g.length===0){p({type:"text",value:h});continue}if(a.type==="dot"){if(o.range=[],a.value+=h,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){g.pop();let x=g[g.length-1];x.value+=a.value+h,a=x,o.ranges--;continue}p({type:"dot",value:h});continue}p({type:"text",value:h})}do if(o=i.pop(),o.type!=="root"){o.nodes.forEach(w=>{w.nodes||(w.type==="open"&&(w.isOpen=!0),w.type==="close"&&(w.isClose=!0),w.nodes||(w.type="text"),w.invalid=!0)});let g=i[i.length-1],x=g.nodes.indexOf(o);g.nodes.splice(x,1,...o.nodes)}while(i.length>0);return p({type:"eos"}),r};rf.exports=zv});var cf=N((pE,lf)=>{"use strict";var af=tr(),Yv=Yd(),Jv=Qd(),Xv=of(),Ke=(n,e={})=>{let t=[];if(Array.isArray(n))for(let s of n){let r=Ke.create(s,e);Array.isArray(r)?t.push(...r):t.push(r)}else t=[].concat(Ke.create(n,e));return e&&e.expand===!0&&e.nodupes===!0&&(t=[...new Set(t)]),t};Ke.parse=(n,e={})=>Xv(n,e);Ke.stringify=(n,e={})=>af(typeof n=="string"?Ke.parse(n,e):n,e);Ke.compile=(n,e={})=>(typeof n=="string"&&(n=Ke.parse(n,e)),Yv(n,e));Ke.expand=(n,e={})=>{typeof n=="string"&&(n=Ke.parse(n,e));let t=Jv(n,e);return e.noempty===!0&&(t=t.filter(Boolean)),e.nodupes===!0&&(t=[...new Set(t)]),t};Ke.create=(n,e={})=>n===""||n.length<3?[n]:e.expand!==!0?Ke.compile(n,e):Ke.expand(n,e);lf.exports=Ke});var uf=N((hE,Qv)=>{Qv.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]});var ff=N((mE,df)=>{df.exports=uf()});var hf=N((gE,pf)=>{"use strict";var Zv=require("path"),ew=ff(),tw=new Set(ew);pf.exports=n=>tw.has(Zv.extname(n).slice(1).toLowerCase())});var rr=N(B=>{"use strict";var{sep:nw}=require("path"),{platform:Ro}=process,sw=require("os");B.EV_ALL="all";B.EV_READY="ready";B.EV_ADD="add";B.EV_CHANGE="change";B.EV_ADD_DIR="addDir";B.EV_UNLINK="unlink";B.EV_UNLINK_DIR="unlinkDir";B.EV_RAW="raw";B.EV_ERROR="error";B.STR_DATA="data";B.STR_END="end";B.STR_CLOSE="close";B.FSEVENT_CREATED="created";B.FSEVENT_MODIFIED="modified";B.FSEVENT_DELETED="deleted";B.FSEVENT_MOVED="moved";B.FSEVENT_CLONED="cloned";B.FSEVENT_UNKNOWN="unknown";B.FSEVENT_FLAG_MUST_SCAN_SUBDIRS=1;B.FSEVENT_TYPE_FILE="file";B.FSEVENT_TYPE_DIRECTORY="directory";B.FSEVENT_TYPE_SYMLINK="symlink";B.KEY_LISTENERS="listeners";B.KEY_ERR="errHandlers";B.KEY_RAW="rawEmitters";B.HANDLER_KEYS=[B.KEY_LISTENERS,B.KEY_ERR,B.KEY_RAW];B.DOT_SLASH=`.${nw}`;B.BACK_SLASH_RE=/\\/g;B.DOUBLE_SLASH_RE=/\/\//;B.SLASH_OR_BACK_SLASH_RE=/[/\\]/;B.DOT_RE=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/;B.REPLACER_RE=/^\.[/\\]/;B.SLASH="/";B.SLASH_SLASH="//";B.BRACE_START="{";B.BANG="!";B.ONE_DOT=".";B.TWO_DOTS="..";B.STAR="*";B.GLOBSTAR="**";B.ROOT_GLOBSTAR="/**/*";B.SLASH_GLOBSTAR="/**";B.DIR_SUFFIX="Dir";B.ANYMATCH_OPTS={dot:!0};B.STRING_TYPE="string";B.FUNCTION_TYPE="function";B.EMPTY_STR="";B.EMPTY_FN=()=>{};B.IDENTITY_FN=n=>n;B.isWindows=Ro==="win32";B.isMacos=Ro==="darwin";B.isLinux=Ro==="linux";B.isIBMi=sw.type()==="OS400"});var wf=N((bE,vf)=>{"use strict";var Mt=require("fs"),Se=require("path"),{promisify:ts}=require("util"),rw=hf(),{isWindows:iw,isLinux:ow,EMPTY_FN:aw,EMPTY_STR:lw,KEY_LISTENERS:_n,KEY_ERR:Oo,KEY_RAW:Qn,HANDLER_KEYS:cw,EV_CHANGE:or,EV_ADD:ir,EV_ADD_DIR:uw,EV_ERROR:gf,STR_DATA:dw,STR_END:fw,BRACE_START:pw,STAR:hw}=rr(),mw="watch",gw=ts(Mt.open),yf=ts(Mt.stat),yw=ts(Mt.lstat),bw=ts(Mt.close),Po=ts(Mt.realpath),vw={lstat:yw,stat:yf},Io=(n,e)=>{n instanceof Set?n.forEach(e):e(n)},Zn=(n,e,t)=>{let s=n[e];s instanceof Set||(n[e]=s=new Set([s])),s.add(t)},ww=n=>e=>{let t=n[e];t instanceof Set?t.clear():delete n[e]},es=(n,e,t)=>{let s=n[e];s instanceof Set?s.delete(t):s===t&&delete n[e]},bf=n=>n instanceof Set?n.size===0:!n,ar=new Map;function mf(n,e,t,s,r){let i=(o,a)=>{t(n),r(o,a,{watchedPath:n}),a&&n!==a&&lr(Se.resolve(n,a),_n,Se.join(n,a))};try{return Mt.watch(n,e,i)}catch(o){s(o)}}var lr=(n,e,t,s,r)=>{let i=ar.get(n);i&&Io(i[e],o=>{o(t,s,r)})},xw=(n,e,t,s)=>{let{listener:r,errHandler:i,rawEmitter:o}=s,a=ar.get(e),l;if(!t.persistent)return l=mf(n,t,r,i,o),l.close.bind(l);if(a)Zn(a,_n,r),Zn(a,Oo,i),Zn(a,Qn,o);else{if(l=mf(n,t,lr.bind(null,e,_n),i,lr.bind(null,e,Qn)),!l)return;l.on(gf,async u=>{let d=lr.bind(null,e,Oo);if(a.watcherUnusable=!0,iw&&u.code==="EPERM")try{let f=await gw(n,"r");await bw(f),d(u)}catch{}else d(u)}),a={listeners:r,errHandlers:i,rawEmitters:o,watcher:l},ar.set(e,a)}return()=>{es(a,_n,r),es(a,Oo,i),es(a,Qn,o),bf(a.listeners)&&(a.watcher.close(),ar.delete(e),cw.forEach(ww(a)),a.watcher=void 0,Object.freeze(a))}},Mo=new Map,Sw=(n,e,t,s)=>{let{listener:r,rawEmitter:i}=s,o=Mo.get(e),a=new Set,l=new Set,u=o&&o.options;return u&&(u.persistent<t.persistent||u.interval>t.interval)&&(a=o.listeners,l=o.rawEmitters,Mt.unwatchFile(e),o=void 0),o?(Zn(o,_n,r),Zn(o,Qn,i)):(o={listeners:r,rawEmitters:i,options:t,watcher:Mt.watchFile(e,t,(d,f)=>{Io(o.rawEmitters,m=>{m(or,e,{curr:d,prev:f})});let h=d.mtimeMs;(d.size!==f.size||h>f.mtimeMs||h===0)&&Io(o.listeners,m=>m(n,d))})},Mo.set(e,o)),()=>{es(o,_n,r),es(o,Qn,i),bf(o.listeners)&&(Mo.delete(e),Mt.unwatchFile(e),o.options=o.watcher=void 0,Object.freeze(o))}},Do=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let s=this.fsw.options,r=Se.dirname(e),i=Se.basename(e);this.fsw._getWatchedDir(r).add(i);let a=Se.resolve(e),l={persistent:s.persistent};t||(t=aw);let u;return s.usePolling?(l.interval=s.enableBinaryInterval&&rw(i)?s.binaryInterval:s.interval,u=Sw(e,a,l,{listener:t,rawEmitter:this.fsw._emitRaw})):u=xw(e,a,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),u}_handleFile(e,t,s){if(this.fsw.closed)return;let r=Se.dirname(e),i=Se.basename(e),o=this.fsw._getWatchedDir(r),a=t;if(o.has(i))return;let l=async(d,f)=>{if(this.fsw._throttle(mw,e,5)){if(!f||f.mtimeMs===0)try{let h=await yf(e);if(this.fsw.closed)return;let m=h.atimeMs,p=h.mtimeMs;(!m||m<=p||p!==a.mtimeMs)&&this.fsw._emit(or,e,h),ow&&a.ino!==h.ino?(this.fsw._closeFile(d),a=h,this.fsw._addPathCloser(d,this._watchWithNodeFs(e,l))):a=h}catch{this.fsw._remove(r,i)}else if(o.has(i)){let h=f.atimeMs,m=f.mtimeMs;(!h||h<=m||m!==a.mtimeMs)&&this.fsw._emit(or,e,f),a=f}}},u=this._watchWithNodeFs(e,l);if(!(s&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(ir,e,0))return;this.fsw._emit(ir,e,t)}return u}async _handleSymlink(e,t,s,r){if(this.fsw.closed)return;let i=e.fullPath,o=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await Po(s)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(r)?this.fsw._symlinkPaths.get(i)!==a&&(this.fsw._symlinkPaths.set(i,a),this.fsw._emit(or,s,e.stats)):(o.add(r),this.fsw._symlinkPaths.set(i,a),this.fsw._emit(ir,s,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(e,t,s,r,i,o,a){if(e=Se.join(e,lw),!s.hasGlob&&(a=this.fsw._throttle("readdir",e,1e3),!a))return;let l=this.fsw._getWatchedDir(s.path),u=new Set,d=this.fsw._readdirp(e,{fileFilter:f=>s.filterPath(f),directoryFilter:f=>s.filterDir(f),depth:0}).on(dw,async f=>{if(this.fsw.closed){d=void 0;return}let h=f.path,m=Se.join(e,h);if(u.add(h),!(f.stats.isSymbolicLink()&&await this._handleSymlink(f,e,m,h))){if(this.fsw.closed){d=void 0;return}(h===r||!r&&!l.has(h))&&(this.fsw._incrReadyCount(),m=Se.join(i,Se.relative(i,m)),this._addToNodeFs(m,t,s,o+1))}}).on(gf,this._boundHandleError);return new Promise(f=>d.once(fw,()=>{if(this.fsw.closed){d=void 0;return}let h=a?a.clear():!1;f(),l.getChildren().filter(m=>m!==e&&!u.has(m)&&(!s.hasGlob||s.filterPath({fullPath:Se.resolve(e,m)}))).forEach(m=>{this.fsw._remove(e,m)}),d=void 0,h&&this._handleRead(e,!1,s,r,i,o,a)}))}async _handleDir(e,t,s,r,i,o,a){let l=this.fsw._getWatchedDir(Se.dirname(e)),u=l.has(Se.basename(e));!(s&&this.fsw.options.ignoreInitial)&&!i&&!u&&(!o.hasGlob||o.globFilter(e))&&this.fsw._emit(uw,e,t),l.add(Se.basename(e)),this.fsw._getWatchedDir(e);let d,f,h=this.fsw.options.depth;if((h==null||r<=h)&&!this.fsw._symlinkPaths.has(a)){if(!i&&(await this._handleRead(e,s,o,i,e,r,d),this.fsw.closed))return;f=this._watchWithNodeFs(e,(m,p)=>{p&&p.mtimeMs===0||this._handleRead(m,!1,o,i,e,r,d)})}return f}async _addToNodeFs(e,t,s,r,i){let o=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(e,r);!a.hasGlob&&s&&(a.hasGlob=s.hasGlob,a.globFilter=s.globFilter,a.filterPath=l=>s.filterPath(l),a.filterDir=l=>s.filterDir(l));try{let l=await vw[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))return o(),!1;let u=this.fsw.options.followSymlinks&&!e.includes(hw)&&!e.includes(pw),d;if(l.isDirectory()){let f=Se.resolve(e),h=u?await Po(e):e;if(this.fsw.closed||(d=await this._handleDir(a.watchPath,l,t,r,i,a,h),this.fsw.closed))return;f!==h&&h!==void 0&&this.fsw._symlinkPaths.set(f,h)}else if(l.isSymbolicLink()){let f=u?await Po(e):e;if(this.fsw.closed)return;let h=Se.dirname(a.watchPath);if(this.fsw._getWatchedDir(h).add(a.watchPath),this.fsw._emit(ir,a.watchPath,l),d=await this._handleDir(h,l,t,r,e,a,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(Se.resolve(e),f)}else d=this._handleFile(a.watchPath,l,t);return o(),this.fsw._addPathCloser(e,d),!1}catch(l){if(this.fsw._handleError(l))return o(),e}}};vf.exports=Do});var Cf=N((vE,Ko)=>{"use strict";var Bo=require("fs"),_e=require("path"),{promisify:Uo}=require("util"),kn;try{kn=require("fsevents")}catch(n){process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR&&console.error(n)}if(kn){let n=process.version.match(/v(\d+)\.(\d+)/);if(n&&n[1]&&n[2]){let e=Number.parseInt(n[1],10),t=Number.parseInt(n[2],10);e===8&&t<16&&(kn=void 0)}}var{EV_ADD:Lo,EV_CHANGE:_w,EV_ADD_DIR:xf,EV_UNLINK:cr,EV_ERROR:kw,STR_DATA:Aw,STR_END:$w,FSEVENT_CREATED:Cw,FSEVENT_MODIFIED:Ew,FSEVENT_DELETED:Tw,FSEVENT_MOVED:Rw,FSEVENT_UNKNOWN:Ow,FSEVENT_FLAG_MUST_SCAN_SUBDIRS:Pw,FSEVENT_TYPE_FILE:Mw,FSEVENT_TYPE_DIRECTORY:ns,FSEVENT_TYPE_SYMLINK:$f,ROOT_GLOBSTAR:Sf,DIR_SUFFIX:Iw,DOT_SLASH:_f,FUNCTION_TYPE:Fo,EMPTY_FN:Dw,IDENTITY_FN:Lw}=rr(),Fw=n=>isNaN(n)?{}:{depth:n},jo=Uo(Bo.stat),Nw=Uo(Bo.lstat),kf=Uo(Bo.realpath),jw={stat:jo,lstat:Nw},Qt=new Map,Hw=10,Bw=new Set([69888,70400,71424,72704,73472,131328,131840,262912]),Uw=(n,e)=>({stop:kn.watch(n,e)});function Kw(n,e,t,s){let r=_e.extname(e)?_e.dirname(e):e,i=_e.dirname(r),o=Qt.get(r);qw(i)&&(r=i);let a=_e.resolve(n),l=a!==e,u=(f,h,m)=>{l&&(f=f.replace(e,a)),(f===a||!f.indexOf(a+_e.sep))&&t(f,h,m)},d=!1;for(let f of Qt.keys())if(e.indexOf(_e.resolve(f)+_e.sep)===0){r=f,o=Qt.get(r),d=!0;break}return o||d?o.listeners.add(u):(o={listeners:new Set([u]),rawEmitter:s,watcher:Uw(r,(f,h)=>{if(!o.listeners.size||h&Pw)return;let m=kn.getInfo(f,h);o.listeners.forEach(p=>{p(f,h,m)}),o.rawEmitter(m.event,f,m)})},Qt.set(r,o)),()=>{let f=o.listeners;if(f.delete(u),!f.size&&(Qt.delete(r),o.watcher))return o.watcher.stop().then(()=>{o.rawEmitter=o.watcher=void 0,Object.freeze(o)})}}var qw=n=>{let e=0;for(let t of Qt.keys())if(t.indexOf(n)===0&&(e++,e>=Hw))return!0;return!1},Ww=()=>kn&&Qt.size<128,No=(n,e)=>{let t=0;for(;!n.indexOf(e)&&(n=_e.dirname(n))!==e;)t++;return t},Af=(n,e)=>n.type===ns&&e.isDirectory()||n.type===$f&&e.isSymbolicLink()||n.type===Mw&&e.isFile(),Ho=class{constructor(e){this.fsw=e}checkIgnored(e,t){let s=this.fsw._ignoredPaths;if(this.fsw._isIgnored(e,t))return s.add(e),t&&t.isDirectory()&&s.add(e+Sf),!0;s.delete(e),s.delete(e+Sf)}addOrChange(e,t,s,r,i,o,a,l){let u=i.has(o)?_w:Lo;this.handleEvent(u,e,t,s,r,i,o,a,l)}async checkExists(e,t,s,r,i,o,a,l){try{let u=await jo(e);if(this.fsw.closed)return;Af(a,u)?this.addOrChange(e,t,s,r,i,o,a,l):this.handleEvent(cr,e,t,s,r,i,o,a,l)}catch(u){u.code==="EACCES"?this.addOrChange(e,t,s,r,i,o,a,l):this.handleEvent(cr,e,t,s,r,i,o,a,l)}}handleEvent(e,t,s,r,i,o,a,l,u){if(!(this.fsw.closed||this.checkIgnored(t)))if(e===cr){let d=l.type===ns;(d||o.has(a))&&this.fsw._remove(i,a,d)}else{if(e===Lo){if(l.type===ns&&this.fsw._getWatchedDir(t),l.type===$f&&u.followSymlinks){let f=u.depth===void 0?void 0:No(s,r)+1;return this._addToFsEvents(t,!1,!0,f)}this.fsw._getWatchedDir(i).add(a)}let d=l.type===ns?e+Iw:e;this.fsw._emit(d,t),d===xf&&this._addToFsEvents(t,!1,!0)}}_watchWithFsEvents(e,t,s,r){if(this.fsw.closed||this.fsw._isIgnored(e))return;let i=this.fsw.options,a=Kw(e,t,async(l,u,d)=>{if(this.fsw.closed||i.depth!==void 0&&No(l,t)>i.depth)return;let f=s(_e.join(e,_e.relative(e,l)));if(r&&!r(f))return;let h=_e.dirname(f),m=_e.basename(f),p=this.fsw._getWatchedDir(d.type===ns?f:h);if(Bw.has(u)||d.event===Ow)if(typeof i.ignored===Fo){let g;try{g=await jo(f)}catch{}if(this.fsw.closed||this.checkIgnored(f,g))return;Af(d,g)?this.addOrChange(f,l,t,h,p,m,d,i):this.handleEvent(cr,f,l,t,h,p,m,d,i)}else this.checkExists(f,l,t,h,p,m,d,i);else switch(d.event){case Cw:case Ew:return this.addOrChange(f,l,t,h,p,m,d,i);case Tw:case Rw:return this.checkExists(f,l,t,h,p,m,d,i)}},this.fsw._emitRaw);return this.fsw._emitReady(),a}async _handleFsEventsSymlink(e,t,s,r){if(!(this.fsw.closed||this.fsw._symlinkPaths.has(t))){this.fsw._symlinkPaths.set(t,!0),this.fsw._incrReadyCount();try{let i=await kf(e);if(this.fsw.closed)return;if(this.fsw._isIgnored(i))return this.fsw._emitReady();this.fsw._incrReadyCount(),this._addToFsEvents(i||e,o=>{let a=e;return i&&i!==_f?a=o.replace(i,e):o!==_f&&(a=_e.join(e,o)),s(a)},!1,r)}catch(i){if(this.fsw._handleError(i))return this.fsw._emitReady()}}}emitAdd(e,t,s,r,i){let o=s(e),a=t.isDirectory(),l=this.fsw._getWatchedDir(_e.dirname(o)),u=_e.basename(o);a&&this.fsw._getWatchedDir(o),!l.has(u)&&(l.add(u),(!r.ignoreInitial||i===!0)&&this.fsw._emit(a?xf:Lo,o,t))}initWatch(e,t,s,r){if(this.fsw.closed)return;let i=this._watchWithFsEvents(s.watchPath,_e.resolve(e||s.watchPath),r,s.globFilter);this.fsw._addPathCloser(t,i)}async _addToFsEvents(e,t,s,r){if(this.fsw.closed)return;let i=this.fsw.options,o=typeof t===Fo?t:Lw,a=this.fsw._getWatchHelpers(e);try{let l=await jw[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,l))throw null;if(l.isDirectory()){if(a.globFilter||this.emitAdd(o(e),l,o,i,s),r&&r>i.depth)return;this.fsw._readdirp(a.watchPath,{fileFilter:u=>a.filterPath(u),directoryFilter:u=>a.filterDir(u),...Fw(i.depth-(r||0))}).on(Aw,u=>{if(this.fsw.closed||u.stats.isDirectory()&&!a.filterPath(u))return;let d=_e.join(a.watchPath,u.path),{fullPath:f}=u;if(a.followSymlinks&&u.stats.isSymbolicLink()){let h=i.depth===void 0?void 0:No(d,_e.resolve(a.watchPath))+1;this._handleFsEventsSymlink(d,f,o,h)}else this.emitAdd(d,u.stats,o,i,s)}).on(kw,Dw).on($w,()=>{this.fsw._emitReady()})}else this.emitAdd(a.watchPath,l,o,i,s),this.fsw._emitReady()}catch(l){(!l||this.fsw._handleError(l))&&(this.fsw._emitReady(),this.fsw._emitReady())}if(i.persistent&&s!==!0)if(typeof t===Fo)this.initWatch(void 0,e,a,o);else{let l;try{l=await kf(a.watchPath)}catch{}this.initWatch(l,e,a,o)}}};Ko.exports=Ho;Ko.exports.canUse=Ww});var Nf=N(ra=>{"use strict";var{EventEmitter:Gw}=require("events"),na=require("fs"),se=require("path"),{promisify:If}=require("util"),Vw=pd(),Yo=wd().default,zw=$d(),qo=_o(),Yw=cf(),Jw=xo(),Xw=wf(),Ef=Cf(),{EV_ALL:Wo,EV_READY:Qw,EV_ADD:ur,EV_CHANGE:ss,EV_UNLINK:Tf,EV_ADD_DIR:Zw,EV_UNLINK_DIR:ex,EV_RAW:tx,EV_ERROR:Go,STR_CLOSE:nx,STR_END:sx,BACK_SLASH_RE:rx,DOUBLE_SLASH_RE:Rf,SLASH_OR_BACK_SLASH_RE:ix,DOT_RE:ox,REPLACER_RE:ax,SLASH:Vo,SLASH_SLASH:lx,BRACE_START:cx,BANG:Jo,ONE_DOT:Df,TWO_DOTS:ux,GLOBSTAR:dx,SLASH_GLOBSTAR:zo,ANYMATCH_OPTS:Xo,STRING_TYPE:sa,FUNCTION_TYPE:fx,EMPTY_STR:Qo,EMPTY_FN:px,isWindows:hx,isMacos:mx,isIBMi:gx}=rr(),yx=If(na.stat),bx=If(na.readdir),Zo=(n=[])=>Array.isArray(n)?n:[n],Lf=(n,e=[])=>(n.forEach(t=>{Array.isArray(t)?Lf(t,e):e.push(t)}),e),Of=n=>{let e=Lf(Zo(n));if(!e.every(t=>typeof t===sa))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(Ff)},Pf=n=>{let e=n.replace(rx,Vo),t=!1;for(e.startsWith(lx)&&(t=!0);e.match(Rf);)e=e.replace(Rf,Vo);return t&&(e=Vo+e),e},Ff=n=>Pf(se.normalize(Pf(n))),Mf=(n=Qo)=>e=>typeof e!==sa?e:Ff(se.isAbsolute(e)?e:se.join(n,e)),vx=(n,e)=>se.isAbsolute(n)?n:n.startsWith(Jo)?Jo+se.join(e,n.slice(1)):se.join(e,n),it=(n,e)=>n[e]===void 0,ea=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==Df&&e!==ux&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let s=this.path;try{await bx(s)}catch{this._removeWatcher&&this._removeWatcher(se.dirname(s),se.basename(s))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;if(e)return[...e.values()]}dispose(){this.items.clear(),delete this.path,delete this._removeWatcher,delete this.items,Object.freeze(this)}},wx="stat",xx="lstat",ta=class{constructor(e,t,s,r){this.fsw=r,this.path=e=e.replace(ax,Qo),this.watchPath=t,this.fullWatchPath=se.resolve(t),this.hasGlob=t!==e,e===Qo&&(this.hasGlob=!1),this.globSymlink=this.hasGlob&&s?void 0:!1,this.globFilter=this.hasGlob?Yo(e,void 0,Xo):!1,this.dirParts=this.getDirParts(e),this.dirParts.forEach(i=>{i.length>1&&i.pop()}),this.followSymlinks=s,this.statMethod=s?wx:xx}checkGlobSymlink(e){return this.globSymlink===void 0&&(this.globSymlink=e.fullParentDir===this.fullWatchPath?!1:{realPath:e.fullParentDir,linkPath:this.fullWatchPath}),this.globSymlink?e.fullPath.replace(this.globSymlink.realPath,this.globSymlink.linkPath):e.fullPath}entryPath(e){return se.join(this.watchPath,se.relative(this.watchPath,this.checkGlobSymlink(e)))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let s=this.entryPath(e);return(this.hasGlob&&typeof this.globFilter===fx?this.globFilter(s):!0)&&this.fsw._isntIgnored(s,t)&&this.fsw._hasReadPermissions(t)}getDirParts(e){if(!this.hasGlob)return[];let t=[];return(e.includes(cx)?Yw.expand(e):[e]).forEach(r=>{t.push(se.relative(this.watchPath,r).split(ix))}),t}filterDir(e){if(this.hasGlob){let t=this.getDirParts(this.checkGlobSymlink(e)),s=!1;this.unmatchedGlob=!this.dirParts.some(r=>r.every((i,o)=>(i===dx&&(s=!0),s||!t[0][o]||Yo(i,t[0][o],Xo))))}return!this.unmatchedGlob&&this.fsw._isntIgnored(this.entryPath(e),e.stats)}},dr=class extends Gw{constructor(e){super();let t={};e&&Object.assign(t,e),this._watched=new Map,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._symlinkPaths=new Map,this._streams=new Set,this.closed=!1,it(t,"persistent")&&(t.persistent=!0),it(t,"ignoreInitial")&&(t.ignoreInitial=!1),it(t,"ignorePermissionErrors")&&(t.ignorePermissionErrors=!1),it(t,"interval")&&(t.interval=100),it(t,"binaryInterval")&&(t.binaryInterval=300),it(t,"disableGlobbing")&&(t.disableGlobbing=!1),t.enableBinaryInterval=t.binaryInterval!==t.interval,it(t,"useFsEvents")&&(t.useFsEvents=!t.usePolling),Ef.canUse()||(t.useFsEvents=!1),it(t,"usePolling")&&!t.useFsEvents&&(t.usePolling=mx),gx&&(t.usePolling=!0);let r=process.env.CHOKIDAR_USEPOLLING;if(r!==void 0){let l=r.toLowerCase();l==="false"||l==="0"?t.usePolling=!1:l==="true"||l==="1"?t.usePolling=!0:t.usePolling=!!l}let i=process.env.CHOKIDAR_INTERVAL;i&&(t.interval=Number.parseInt(i,10)),it(t,"atomic")&&(t.atomic=!t.usePolling&&!t.useFsEvents),t.atomic&&(this._pendingUnlinks=new Map),it(t,"followSymlinks")&&(t.followSymlinks=!0),it(t,"awaitWriteFinish")&&(t.awaitWriteFinish=!1),t.awaitWriteFinish===!0&&(t.awaitWriteFinish={});let o=t.awaitWriteFinish;o&&(o.stabilityThreshold||(o.stabilityThreshold=2e3),o.pollInterval||(o.pollInterval=100),this._pendingWrites=new Map),t.ignored&&(t.ignored=Zo(t.ignored));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=px,this._readyEmitted=!0,process.nextTick(()=>this.emit(Qw)))},this._emitRaw=(...l)=>this.emit(tx,...l),this._readyEmitted=!1,this.options=t,t.useFsEvents?this._fsEventsHandler=new Ef(this):this._nodeFsHandler=new Xw(this),Object.freeze(t)}add(e,t,s){let{cwd:r,disableGlobbing:i}=this.options;this.closed=!1;let o=Of(e);return r&&(o=o.map(a=>{let l=vx(a,r);return i||!qo(a)?l:Jw(l)})),o=o.filter(a=>a.startsWith(Jo)?(this._ignoredPaths.add(a.slice(1)),!1):(this._ignoredPaths.delete(a),this._ignoredPaths.delete(a+zo),this._userIgnored=void 0,!0)),this.options.useFsEvents&&this._fsEventsHandler?(this._readyCount||(this._readyCount=o.length),this.options.persistent&&(this._readyCount+=o.length),o.forEach(a=>this._fsEventsHandler._addToFsEvents(a))):(this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let l=await this._nodeFsHandler._addToNodeFs(a,!s,0,0,t);return l&&this._emitReady(),l})).then(a=>{this.closed||a.filter(l=>l).forEach(l=>{this.add(se.dirname(l),se.basename(t||l))})})),this}unwatch(e){if(this.closed)return this;let t=Of(e),{cwd:s}=this.options;return t.forEach(r=>{!se.isAbsolute(r)&&!this._closers.has(r)&&(s&&(r=se.join(s,r)),r=se.resolve(r)),this._closePath(r),this._ignoredPaths.add(r),this._watched.has(r)&&this._ignoredPaths.add(r+zo),this._userIgnored=void 0}),this}close(){if(this.closed)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(s=>{let r=s();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),["closers","watched","streams","symlinkPaths","throttled"].forEach(t=>{this[`_${t}`].clear()}),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,s)=>{let r=this.options.cwd?se.relative(this.options.cwd,s):s;e[r||Df]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(...t),e!==Go&&this.emit(Wo,...t)}async _emit(e,t,s,r,i){if(this.closed)return;let o=this.options;hx&&(t=se.normalize(t)),o.cwd&&(t=se.relative(o.cwd,t));let a=[e,t];i!==void 0?a.push(s,r,i):r!==void 0?a.push(s,r):s!==void 0&&a.push(s);let l=o.awaitWriteFinish,u;if(l&&(u=this._pendingWrites.get(t)))return u.lastChange=new Date,this;if(o.atomic){if(e===Tf)return this._pendingUnlinks.set(t,a),setTimeout(()=>{this._pendingUnlinks.forEach((d,f)=>{this.emit(...d),this.emit(Wo,...d),this._pendingUnlinks.delete(f)})},typeof o.atomic=="number"?o.atomic:100),this;e===ur&&this._pendingUnlinks.has(t)&&(e=a[0]=ss,this._pendingUnlinks.delete(t))}if(l&&(e===ur||e===ss)&&this._readyEmitted){let d=(f,h)=>{f?(e=a[0]=Go,a[1]=f,this.emitWithAll(e,a)):h&&(a.length>2?a[2]=h:a.push(h),this.emitWithAll(e,a))};return this._awaitWriteFinish(t,l.stabilityThreshold,e,d),this}if(e===ss&&!this._throttle(ss,t,50))return this;if(o.alwaysStat&&s===void 0&&(e===ur||e===Zw||e===ss)){let d=o.cwd?se.join(o.cwd,t):t,f;try{f=await yx(d)}catch{}if(!f||this.closed)return;a.push(f)}return this.emitWithAll(e,a),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(Go,e),e||this.closed}_throttle(e,t,s){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e),i=r.get(t);if(i)return i.count++,!1;let o,a=()=>{let u=r.get(t),d=u?u.count:0;return r.delete(t),clearTimeout(o),u&&clearTimeout(u.timeoutObject),d};o=setTimeout(a,s);let l={timeoutObject:o,clear:a,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,s,r){let i,o=e;this.options.cwd&&!se.isAbsolute(e)&&(o=se.join(this.options.cwd,e));let a=new Date,l=u=>{na.stat(o,(d,f)=>{if(d||!this._pendingWrites.has(e)){d&&d.code!=="ENOENT"&&r(d);return}let h=Number(new Date);u&&f.size!==u.size&&(this._pendingWrites.get(e).lastChange=h);let m=this._pendingWrites.get(e);h-m.lastChange>=t?(this._pendingWrites.delete(e),r(void 0,f)):i=setTimeout(l,this.options.awaitWriteFinish.pollInterval,f)})};this._pendingWrites.has(e)||(this._pendingWrites.set(e,{lastChange:a,cancelWait:()=>(this._pendingWrites.delete(e),clearTimeout(i),s)}),i=setTimeout(l,this.options.awaitWriteFinish.pollInterval))}_getGlobIgnored(){return[...this._ignoredPaths.values()]}_isIgnored(e,t){if(this.options.atomic&&ox.test(e))return!0;if(!this._userIgnored){let{cwd:s}=this.options,r=this.options.ignored,i=r&&r.map(Mf(s)),o=Zo(i).filter(l=>typeof l===sa&&!qo(l)).map(l=>l+zo),a=this._getGlobIgnored().map(Mf(s)).concat(i,o);this._userIgnored=Yo(a,void 0,Xo)}return this._userIgnored([e,t])}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e,t){let s=t||this.options.disableGlobbing||!qo(e)?e:zw(e),r=this.options.followSymlinks;return new ta(e,s,r,this)}_getWatchedDir(e){this._boundRemove||(this._boundRemove=this._remove.bind(this));let t=se.resolve(e);return this._watched.has(t)||this._watched.set(t,new ea(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;let s=(e&&Number.parseInt(e.mode,10))&511;return!!(4&Number.parseInt(s.toString(8)[0],10))}_remove(e,t,s){let r=se.join(e,t),i=se.resolve(r);if(s=s??(this._watched.has(r)||this._watched.has(i)),!this._throttle("remove",r,100))return;!s&&!this.options.useFsEvents&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(h=>this._remove(r,h));let l=this._getWatchedDir(e),u=l.has(t);l.remove(t),this._symlinkPaths.has(i)&&this._symlinkPaths.delete(i);let d=r;if(this.options.cwd&&(d=se.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(d)&&this._pendingWrites.get(d).cancelWait()===ur)return;this._watched.delete(r),this._watched.delete(i);let f=s?ex:Tf;u&&!this._isIgnored(r)&&this._emit(f,r),this.options.useFsEvents||this._closePath(r)}_closePath(e){this._closeFile(e);let t=se.dirname(e);this._getWatchedDir(t).remove(se.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(s=>s()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let s=this._closers.get(e);s||(s=[],this._closers.set(e,s)),s.push(t)}_readdirp(e,t){if(this.closed)return;let s={type:Wo,alwaysStat:!0,lstat:!0,...t},r=Vw(e,s);return this._streams.add(r),r.once(nx,()=>{r=void 0}),r.once(sx,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};ra.FSWatcher=dr;var Sx=(n,e)=>{let t=new dr(e);return t.add(n),t};ra.watch=Sx});var Uf={};Ne(Uf,{CollaborationManager:()=>rs,addTeamMember:()=>Ax,formatTeamConfig:()=>$x,initTeamConfig:()=>kx,loadTeamConfig:()=>_x,saveTeamConfig:()=>Bf});function _x(n){let e=Ye.join(n,".hablas","team.json");if(be.existsSync(e))try{return JSON.parse(be.readFileSync(e,"utf-8"))}catch{return null}return null}function kx(n,e){let t={name:e,members:[]};return Bf(n,t),t}function Bf(n,e){let t=Ye.join(n,".hablas","team.json"),s=Ye.dirname(t);be.existsSync(s)||be.mkdirSync(s,{recursive:!0}),be.writeFileSync(t,JSON.stringify(e,null,2),"utf-8")}function Ax(n,e,t){return n.members.push({name:e,email:t}),n}function $x(n){return[`Team: ${n.name}`,"Members:",...n.members.map(t=>` - ${t.name} (${t.email})`)].join(`
|
|
312
|
+
`)}var be,Ye,fr,jf,Hf,rs,ia=L(()=>{"use strict";be=O(require("fs")),Ye=O(require("path")),fr=O(require("os")),jf=O(require("crypto")),Hf=O(Nf());yn();rs=class n{workingDir;config;username;teamKey;projectTeamToken;supabaseUrl="";supabaseKey="";isConfigured=!1;watcher=null;localStatePath;heartbeatInterval=null;syncInterval=null;static HEARTBEAT_MS=12e3;static POLL_ACTIVE_MS=3e3;static POLL_IDLE_MS=2e4;static STALE_MS=75e3;consecutiveHeartbeatFailures=0;announcedOffline=!1;idlePollTicks=0;signalHandler=null;shuttingDown=!1;currentActivity={section:"idle",task:"standby"};knownSessions=new Map;knownLocks=new Map;constructor(e,t,s,r){this.workingDir=e,this.config=t,this.username=s||fr.userInfo().username||"developer",this.teamKey=r||"default-team",this.localStatePath=Ye.join(this.workingDir,".hablas","collaboration.json");let i=this.getProjectIdentifier();console.log(`
|
|
313
313
|
${c.muted("[Debug] Project Context:")} ${c.highlight(i)}`),this.projectTeamToken=jf.createHash("sha256").update(`${i}:${this.teamKey}`).digest("hex"),console.log(` ${c.muted("[Debug] Session Fingerprint:")} ${c.muted(this.projectTeamToken.slice(0,16))}...
|
|
314
|
-
`),this.loadSupabaseConfig()}async init(){if(!this.isConfigured)return console.log(` ${c.warning("\u26A0")} ${c.secondary("Supabase is not configured in .env. Collaboration mode operates locally.")}`),!1;let e=Ye.dirname(this.localStatePath);return
|
|
314
|
+
`),this.loadSupabaseConfig()}async init(){if(!this.isConfigured)return console.log(` ${c.warning("\u26A0")} ${c.secondary("Supabase is not configured in .env. Collaboration mode operates locally.")}`),!1;let e=Ye.dirname(this.localStatePath);return be.existsSync(e)||be.mkdirSync(e,{recursive:!0}),this.saveLocalState([],[]),this.startLoops(),this.startWatcher(),this.registerCleanups(),!0}async shutdown(){this.shuttingDown||(this.shuttingDown=!0,this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.syncInterval&&(clearTimeout(this.syncInterval),this.syncInterval=null),this.watcher&&(await this.watcher.close(),this.watcher=null),this.signalHandler&&(process.off("SIGINT",this.signalHandler),process.off("SIGTERM",this.signalHandler),this.signalHandler=null),await this.releaseAllMyLocks(),await this.deleteSession())}async apiRequest(e,t,s,r){if(!this.isConfigured)return{ok:!1,data:null};let i=`${this.supabaseUrl}/rest/v1/${e}`,o={apikey:this.supabaseKey,Authorization:`Bearer ${this.supabaseKey}`,"Content-Type":"application/json"};r?.prefer?o.Prefer=r.prefer:(t==="POST"||t==="PATCH")&&(o.Prefer="return=representation");let a=(r?.retries??0)+1,l=null;for(let u=0;u<a;u++)try{let d=await fetch(i,{method:t,headers:o,body:s?JSON.stringify(s):void 0,signal:AbortSignal.timeout(1e4)});if(!d.ok){let h=await d.text().catch(()=>"");if(l=new Error(`[Supabase ${d.status}] ${h}`),(d.status>=500||d.status===429)&&u<a-1){await this.delay(400*(u+1));continue}return{ok:!1,data:null}}let f=await d.text();return{ok:!0,data:f?JSON.parse(f):null}}catch(d){if(l=d,u<a-1){await this.delay(400*(u+1));continue}}return{ok:!1,data:null}}delay(e){return new Promise(t=>setTimeout(t,e))}async sendHeartbeat(e,t){let s={project_team_token:this.projectTeamToken,developer_name:this.username,last_heartbeat:new Date().toISOString(),active_section:e||"idle",current_task:t||"none"},r="hablas_team_sessions?on_conflict=project_team_token,developer_name",{ok:i}=await this.apiRequest(r,"POST",s,{prefer:"resolution=merge-duplicates,return=minimal",retries:2});return i}async fetchSessions(){let e=`hablas_team_sessions?project_team_token=eq.${this.projectTeamToken}`,{data:t}=await this.apiRequest(e,"GET");return t||[]}async deleteSession(){let e=`hablas_team_sessions?project_team_token=eq.${this.projectTeamToken}&developer_name=eq.${encodeURIComponent(this.username)}`;await this.apiRequest(e,"DELETE")}async fetchLocks(){let e=`hablas_team_locks?project_team_token=eq.${this.projectTeamToken}`,{data:t}=await this.apiRequest(e,"GET");return t||[]}async acquireLock(e,t){let s={project_team_token:this.projectTeamToken,file_path:e,locked_by:this.username,lock_context:t||"editing file",created_at:new Date().toISOString()};return await this.apiRequest("hablas_team_locks?on_conflict=project_team_token,file_path","POST",s,{prefer:"resolution=ignore-duplicates,return=minimal",retries:1}),!!(await this.fetchLocks()).find(a=>a.file_path===e&&a.locked_by===this.username)}async releaseLock(e){let t=`hablas_team_locks?project_team_token=eq.${this.projectTeamToken}&file_path=eq.${encodeURIComponent(e)}&locked_by=eq.${encodeURIComponent(this.username)}`;return await this.apiRequest(t,"DELETE"),!0}async releaseAllMyLocks(){let e=`hablas_team_locks?project_team_token=eq.${this.projectTeamToken}&locked_by=eq.${encodeURIComponent(this.username)}`;await this.apiRequest(e,"DELETE")}async sendMessage(e,t){let s={project_team_token:this.projectTeamToken,sender_name:this.username,receiver_name:e,message_content:t,is_read:!1,created_at:new Date().toISOString()},{ok:r}=await this.apiRequest("hablas_team_messages","POST",s,{retries:1});return r}async fetchUnreadMessages(){let e=`hablas_team_messages?project_team_token=eq.${this.projectTeamToken}&receiver_name=eq.${encodeURIComponent(this.username)}&is_read=eq.false`,t=(await this.apiRequest(e,"GET")).data||[];if(t.length>0)for(let s of t){let r=`hablas_team_messages?id=eq.${s.id}`;await this.apiRequest(r,"PATCH",{is_read:!0})}return t}saveLocalState(e,t){let s={project_team_token:this.projectTeamToken,last_sync:new Date().toISOString(),my_username:this.username,sessions:e,locks:t};be.writeFileSync(this.localStatePath,JSON.stringify(s,null,2),"utf-8")}getLocalState(){if(be.existsSync(this.localStatePath))try{return JSON.parse(be.readFileSync(this.localStatePath,"utf-8"))}catch{}return{sessions:[],locks:[],my_username:this.username}}startLoops(){this.beat("idle","standby"),this.heartbeatInterval=setInterval(()=>{this.beat()},n.HEARTBEAT_MS);let e=t=>{this.syncInterval=setTimeout(async()=>{if(this.shuttingDown)return;await this.syncWithCloud()?this.idlePollTicks=0:this.idlePollTicks++;let r=this.idlePollTicks>=3?n.POLL_IDLE_MS:n.POLL_ACTIVE_MS;e(r)},t)};e(n.POLL_ACTIVE_MS)}setActivity(e,t="working"){this.currentActivity={section:t,task:e.slice(0,120)},this.beat(t,this.currentActivity.task)}async beat(e,t){await this.sendHeartbeat(e??this.currentActivity.section,t??this.currentActivity.task)?(this.announcedOffline&&(console.log(`
|
|
315
315
|
${c.success("\u2713")} ${c.muted("[Team]")} Cloud sync reconnected \u2014 session restored.
|
|
316
316
|
`),this.announcedOffline=!1),this.consecutiveHeartbeatFailures=0):(this.consecutiveHeartbeatFailures++,this.consecutiveHeartbeatFailures>=4&&!this.announcedOffline&&(console.log(`
|
|
317
317
|
${c.warning("\u26A0")} ${c.muted("[Team]")} Cloud sync is unreachable \u2014 retrying in the background. Your session is preserved.
|
|
@@ -322,8 +322,8 @@ If you cannot complete a task, explain why with absolute technical objectivity.`
|
|
|
322
322
|
${c.warning("\u{1F44B}")} ${c.muted("[Live Sync]")} ${c.strong(`@${i}`)} has left the session.
|
|
323
323
|
`));let r=new Set;for(let i of t)r.add(i.file_path),this.knownLocks.has(i.file_path)||(this.knownLocks.set(i.file_path,i.locked_by),i.locked_by!==this.username&&console.log(` ${c.error("\u{1F512}")} ${c.muted("[File Locked]")} ${c.strong(`@${i.locked_by}`)} locked ${c.highlight(i.file_path)}`));for(let i of this.knownLocks.keys())if(!r.has(i)){let o=this.knownLocks.get(i);this.knownLocks.delete(i),o!==this.username&&console.log(` ${c.success("\u{1F513}")} ${c.muted("[File Unlocked]")} ${c.strong(`@${o}`)} released lock on ${c.highlight(i)}`)}}renderMessageBox(e,t){let s=Math.min(process.stdout.columns-4,80),r=c.border("\u250C"+"\u2500".repeat(s-2)+"\u2510"),i=c.border("\u2514"+"\u2500".repeat(s-2)+"\u2518"),o=` MESSAGE FROM @${e.toUpperCase()} `,a=Math.max(0,Math.floor((s-2-o.length)/2)),l=c.border("\u2502")+" ".repeat(a)+c.strong(o)+" ".repeat(s-2-o.length-a)+c.border("\u2502"),u=t.replace(/\n/g," "),d=Math.max(0,s-8-u.length),f=c.border("\u2502")+` "${c.secondary(u)}"`+" ".repeat(d)+c.border("\u2502");console.log(`
|
|
324
324
|
`+r),console.log(l),console.log(f),console.log(i+`
|
|
325
|
-
`)}registerCleanups(){this.signalHandler||(this.signalHandler=()=>{this.shutdown()},process.on("SIGTERM",this.signalHandler),process.once("beforeExit",this.signalHandler))}loadSupabaseConfig(){let e=Ye.join(this.workingDir,".env");if(
|
|
326
|
-
`);for(let r of s){let i=r.split("=");if(i.length>=2){let o=i[0].trim(),a=i.slice(1).join("=").trim().replace(/^['"]|['"]$/g,"");o==="SUPABASE_URL"||o==="VITE_SUPABASE_URL"?this.supabaseUrl=a:(o==="SUPABASE_KEY"||o==="SUPABASE_ANON_KEY"||o==="VITE_SUPABASE_ANON_KEY")&&(this.supabaseKey=a)}}}catch{}if(!this.supabaseUrl||!this.supabaseKey){let t="aHR0cHM6Ly93dXVtYXptcGp6dHZ4a3l3Y3Rvci5zdXBhYmFzZS5jbw==",s="c2JfcHVibGlzaGFibGVfVmxmNEtCUzdsaTRjaGFWNE04d19xQV9fbnJuczh1WQ==";this.supabaseUrl=Buffer.from(t,"base64").toString("utf-8"),this.supabaseKey=Buffer.from(s,"base64").toString("utf-8")}this.isConfigured=!!(this.supabaseUrl&&this.supabaseKey),this.isConfigured&&this.syncLlmConfig()}syncLlmConfig(){let e=Ye.join(fr.homedir(),".hablas","config.json");if(
|
|
325
|
+
`)}registerCleanups(){this.signalHandler||(this.signalHandler=()=>{this.shutdown()},process.on("SIGTERM",this.signalHandler),process.once("beforeExit",this.signalHandler))}loadSupabaseConfig(){let e=Ye.join(this.workingDir,".env");if(be.existsSync(e))try{let s=be.readFileSync(e,"utf-8").split(`
|
|
326
|
+
`);for(let r of s){let i=r.split("=");if(i.length>=2){let o=i[0].trim(),a=i.slice(1).join("=").trim().replace(/^['"]|['"]$/g,"");o==="SUPABASE_URL"||o==="VITE_SUPABASE_URL"?this.supabaseUrl=a:(o==="SUPABASE_KEY"||o==="SUPABASE_ANON_KEY"||o==="VITE_SUPABASE_ANON_KEY")&&(this.supabaseKey=a)}}}catch{}if(!this.supabaseUrl||!this.supabaseKey){let t="aHR0cHM6Ly93dXVtYXptcGp6dHZ4a3l3Y3Rvci5zdXBhYmFzZS5jbw==",s="c2JfcHVibGlzaGFibGVfVmxmNEtCUzdsaTRjaGFWNE04d19xQV9fbnJuczh1WQ==";this.supabaseUrl=Buffer.from(t,"base64").toString("utf-8"),this.supabaseKey=Buffer.from(s,"base64").toString("utf-8")}this.isConfigured=!!(this.supabaseUrl&&this.supabaseKey),this.isConfigured&&this.syncLlmConfig()}syncLlmConfig(){let e=Ye.join(fr.homedir(),".hablas","config.json");if(be.existsSync(e))try{let t=JSON.parse(be.readFileSync(e,"utf-8"));!this.config.apiUrl&&t.apiUrl&&(this.config.apiUrl=t.apiUrl,this.config.apiKey=t.apiKey,this.config.provider=t.provider)}catch{}}getProjectIdentifier(){let e="";try{let{execSync:t}=require("child_process"),s=t("git config --get remote.origin.url",{cwd:this.workingDir,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();if(s){let r=s.match(/[:/]([^/]+\/[^/.]+)(\.git)?$/);r&&r[1]&&(e=r[1].toLowerCase())}}catch{}if(!e)try{let t=Ye.join(this.workingDir,"package.json");if(be.existsSync(t)){let s=JSON.parse(be.readFileSync(t,"utf-8"));s.name&&(e=s.name.toLowerCase())}}catch{}return e||(e=Ye.basename(this.workingDir).toLowerCase()),e.replace(/\s+/g,"")}}});async function Zt(n){try{if(!oa.existsSync(n))return;oa.existsSync(is)||await vt.mkdir(is,{recursive:!0});let e=await vt.readFile(n,"utf-8"),t=An.basename(n),s=Date.now(),r=`${t}.${s}.bak`,i=An.join(is,r);await vt.writeFile(i,e,"utf-8");let a=(await vt.readdir(is)).filter(l=>l.startsWith(`${t}.`)&&l.endsWith(".bak")).sort().reverse();if(a.length>Kf)for(let l of a.slice(Kf))await vt.unlink(An.join(is,l))}catch{}}var vt,oa,An,qf,is,Kf,Wf=L(()=>{"use strict";vt=O(require("fs/promises")),oa=O(require("fs")),An=O(require("path")),qf=O(require("os")),is=An.join(qf.homedir(),".hablas","backup"),Kf=10});function zf(n){let e=m=>Ht.resolve(n,m);return[{name:"read_file",description:"Read the content of a file with line numbers. Returns up to 300 lines. Use start_line/end_line for large files.",safety:"safe",parameters:{path:{type:"string",description:"File path to read",required:!0},start_line:{type:"number",description:"Starting line number (1-based, optional)",required:!1},end_line:{type:"number",description:"Ending line number (inclusive, optional)",required:!1}},execute:async m=>{try{if(!m.path)return{success:!1,output:"",error:"[read_file]: path is required"};let p=e(m.path),x=(await oe.readFile(p,"utf-8")).split(`
|
|
327
327
|
`),w=x.length,$=m.start_line?Math.max(1,m.start_line):1,A=m.end_line?Math.min(w,m.end_line):Math.min(w,$+Gf-1),y=Math.min(A,$+Gf-1),v=x.slice($-1,y),b=String(y).length,S=v.map((I,C)=>`${String($+C).padStart(b," ")} | ${I}`),_=`[${m.path} \u2014 lines ${$}-${y} of ${w}]`,T=y<w?`
|
|
328
328
|
... [File has ${w} total lines. Use start_line/end_line to read more.]`:"";return{success:!0,output:`${_}
|
|
329
329
|
${S.join(`
|
|
@@ -900,7 +900,7 @@ ${w}`,b="",S="",_=Math.min(y,a);kl(p)&&(b+=Om(p,v,a),A=A.slice(p.length),_-=p.le
|
|
|
900
900
|
${w}${b}
|
|
901
901
|
${$}`),g.pop(),`{${b}}`}case"number":return isFinite(p)?String(p):e?e(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(s)return String(p);default:return e?e(p):void 0}}function f(m,p,g){switch(typeof p){case"string":return Kt(p);case"object":{if(p===null)return"null";if(typeof p.toJSON=="function"){if(p=p.toJSON(m),typeof p!="object")return f(m,p,g);if(p===null)return"null"}if(g.indexOf(p)!==-1)return t;let x="",w=p.length!==void 0;if(w&&Array.isArray(p)){if(p.length===0)return"[]";if(o<g.length+1)return'"[Array]"';g.push(p);let b=Math.min(p.length,a),S=0;for(;S<b-1;S++){let T=f(String(S),p[S],g);x+=T!==void 0?T:"null",x+=","}let _=f(String(S),p[S],g);if(x+=_!==void 0?_:"null",p.length-1>a){let T=p.length-a-1;x+=`,"... ${ln(T)} not stringified"`}return g.pop(),`[${x}]`}let $=Object.keys(p),A=$.length;if(A===0)return"{}";if(o<g.length+1)return'"[Object]"';let y="",v=Math.min(A,a);w&&kl(p)&&(x+=Om(p,",",a),$=$.slice(p.length),v-=p.length,y=","),r&&($=_l($,i)),g.push(p);for(let b=0;b<v;b++){let S=$[b],_=f(S,p[S],g);_!==void 0&&(x+=`${y}${Kt(S)}:${_}`,y=",")}if(A>a){let b=A-a;x+=`${y}"...":"${ln(b)} not stringified"`}return g.pop(),`{${x}}`}case"number":return isFinite(p)?String(p):e?e(p):"null";case"boolean":return p===!0?"true":"false";case"undefined":return;case"bigint":if(s)return String(p);default:return e?e(p):void 0}}function h(m,p,g){if(arguments.length>1){let x="";if(typeof g=="number"?x=" ".repeat(Math.min(g,10)):typeof g=="string"&&(x=g.slice(0,10)),p!=null){if(typeof p=="function")return l("",{"":m},[],p,x,"");if(Array.isArray(p))return u("",m,[],KA(p),x,"")}if(x.length!==0)return d("",m,[],x,"")}return f("",m,[])}return h}});var Nm=N((uR,Fm)=>{"use strict";var Cl=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:Lm}=Lr(),WA=Lm.info;function GA(n,e){n=n||[],e=e||{dedupe:!1};let t=Object.create(Lm);t.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(f=>{t[f]=e.levels[f]});let s={write:r,add:a,remove:l,emit:i,flushSync:o,end:u,minLevel:0,lastId:0,streams:[],clone:d,[Cl]:!0,streamLevels:t};return Array.isArray(n)?n.forEach(a,s):a.call(s,n),n=null,s;function r(f){let h,m=this.lastLevel,{streams:p}=this,g=0,x;for(let w=VA(p.length,e.dedupe);YA(w,p.length,e.dedupe);w=zA(w,e.dedupe))if(h=p[w],h.level<=m){if(g!==0&&g!==h.level)break;if(x=h.stream,x[Cl]){let{lastTime:$,lastMsg:A,lastObj:y,lastLogger:v}=this;x.lastLevel=m,x.lastTime=$,x.lastMsg=A,x.lastObj=y,x.lastLogger=v}x.write(f),e.dedupe&&(g=h.level)}else if(!e.dedupe)break}function i(...f){for(let{stream:h}of this.streams)typeof h.emit=="function"&&h.emit(...f)}function o(){for(let{stream:f}of this.streams)typeof f.flushSync=="function"&&f.flushSync()}function a(f){if(!f)return s;let h=typeof f.write=="function"||f.stream,m=f.write?f:f.stream;if(!h)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:p,streamLevels:g}=this,x;typeof f.levelVal=="number"?x=f.levelVal:typeof f.level=="string"?x=g[f.level]:typeof f.level=="number"?x=f.level:x=WA;let w={stream:m,level:x,levelVal:void 0,id:++s.lastId};return p.unshift(w),p.sort(Dm),this.minLevel=p[0].level,s}function l(f){let{streams:h}=this,m=h.findIndex(p=>p.id===f);return m>=0&&(h.splice(m,1),h.sort(Dm),this.minLevel=h.length>0?h[0].level:-1),s}function u(){for(let{stream:f}of this.streams)typeof f.flushSync=="function"&&f.flushSync(),f.end()}function d(f){let h=new Array(this.streams.length);for(let m=0;m<h.length;m++)h[m]={level:f,stream:this.streams[m].stream};return{write:r,add:a,remove:l,minLevel:f,streams:h,clone:d,emit:i,flushSync:o,[Cl]:!0}}}function Dm(n,e){return n.level-e.level}function VA(n,e){return e?n-1:0}function zA(n,e){return e?n-1:n+1}function YA(n,e,t){return t?n>=0:n<e}Fm.exports=GA});var Ol=N((dR,Ze)=>{"use strict";var JA=require("node:os"),Gm=Va(),XA=za(),QA=Xa(),Vm=Sh(),ZA=Rm(),zm=Pn(),{configure:e$}=Im(),{assertDefaultLevelFound:t$,mappings:Ym,genLsCache:n$,genLevelComparison:s$,assertLevelComparison:r$}=yl(),{DEFAULT_LEVELS:Jm,SORTING_ORDER:i$}=Lr(),{createArgsNormalizer:o$,asChindings:a$,buildSafeSonicBoom:jm,buildFormatters:l$,stringify:El,normalizeDestFileDescriptor:Hm,noop:c$}=Dr(),{version:u$}=bl(),{chindingsSym:Bm,redactFmtSym:d$,serializersSym:Um,timeSym:f$,timeSliceIndexSym:p$,streamSym:h$,stringifySym:Km,stringifySafeSym:Tl,stringifiersSym:qm,setLevelSym:m$,endSym:g$,formatOptsSym:y$,messageKeySym:b$,errorKeySym:v$,nestedKeySym:w$,mixinSym:x$,levelCompSym:S$,useOnlyCustomLevelsSym:_$,formattersSym:Wm,hooksSym:k$,nestedKeyStrSym:A$,mixinMergeStrategySym:$$,msgPrefixSym:C$}=zm,{epochTime:Xm,nullTime:E$}=Vm,{pid:T$}=process,R$=JA.hostname(),O$=Gm.err,P$={level:"info",levelComparison:i$.ASC,levels:Jm,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:T$,hostname:R$},serializers:Object.assign(Object.create(null),{err:O$}),formatters:Object.assign(Object.create(null),{bindings(n){return n},level(n,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Xm,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},M$=o$(P$),I$=Object.assign(Object.create(null),Gm);function Rl(...n){let e={},{opts:t,stream:s}=M$(e,XA(),...n);t.level&&typeof t.level=="string"&&Jm[t.level.toLowerCase()]!==void 0&&(t.level=t.level.toLowerCase());let{redact:r,crlf:i,serializers:o,timestamp:a,messageKey:l,errorKey:u,nestedKey:d,base:f,name:h,level:m,customLevels:p,levelComparison:g,mixin:x,mixinMergeStrategy:w,useOnlyCustomLevels:$,formatters:A,hooks:y,depthLimit:v,edgeLimit:b,onChild:S,msgPrefix:_}=t,T=e$({maximumDepth:v,maximumBreadth:b}),I=l$(A.level,A.bindings,A.log),C=El.bind({[Tl]:T}),F=r?QA(r,C):{},H=r?{stringify:F[d$]}:{stringify:C},W="}"+(i?`\r
|
|
902
902
|
`:`
|
|
903
|
-
`),E=a$.bind(null,{[Bm]:"",[Um]:o,[qm]:F,[Km]:El,[Tl]:T,[Wm]:I}),k="";f!==null&&(h===void 0?k=E(f):k=E(Object.assign({},f,{name:h})));let
|
|
903
|
+
`),E=a$.bind(null,{[Bm]:"",[Um]:o,[qm]:F,[Km]:El,[Tl]:T,[Wm]:I}),k="";f!==null&&(h===void 0?k=E(f):k=E(Object.assign({},f,{name:h})));let J=a instanceof Function?a:a?Xm:E$,K=J().indexOf(":")+1;if($&&!p)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(x&&typeof x!="function")throw Error(`Unknown mixin type "${typeof x}" - expected "function"`);if(_&&typeof _!="string")throw Error(`Unknown msgPrefix type "${typeof _}" - expected "string"`);t$(m,p,$);let Z=Ym(p,$);typeof s.emit=="function"&&s.emit("message",{code:"PINO_CONFIG",config:{levels:Z,messageKey:l,errorKey:u}}),r$(g);let te=s$(g);return Object.assign(e,{levels:Z,[S$]:te,[_$]:$,[h$]:s,[f$]:J,[p$]:K,[Km]:El,[Tl]:T,[qm]:F,[g$]:W,[y$]:H,[b$]:l,[v$]:u,[w$]:d,[A$]:d?`,${JSON.stringify(d)}:{`:"",[Um]:o,[x$]:x,[$$]:w,[Bm]:k,[Wm]:I,[k$]:y,silent:c$,onChild:S,[C$]:_}),Object.setPrototypeOf(e,ZA()),n$(e),e[m$](m),e}Ze.exports=Rl;Ze.exports.destination=(n=process.stdout.fd)=>typeof n=="object"?(n.dest=Hm(n.dest||process.stdout.fd),jm(n)):jm({dest:Hm(n),minLength:0});Ze.exports.transport=dl();Ze.exports.multistream=Nm();Ze.exports.levels=Ym();Ze.exports.stdSerializers=I$;Ze.exports.stdTimeFunctions=Object.assign({},Vm);Ze.exports.symbols=zm;Ze.exports.version=u$;Ze.exports.default=Rl;Ze.exports.pino=Rl});function ms(n){return new Pl(n)}var D$,L$,F$,Pl,Ml=L(()=>{"use strict";D$={maxSteps:150,thinkingEnabled:!0,selfEvalEnabled:!0,minConfidence:.6,showThinking:!1},L$=`
|
|
904
904
|
## Reasoning Protocol
|
|
905
905
|
|
|
906
906
|
Before taking ANY action, you MUST think step-by-step inside <thinking> tags.
|
|
@@ -963,7 +963,7 @@ Rate your work. Reply with ONLY a JSON object \u2014 no other text:
|
|
|
963
963
|
`)}getTurnSummary(){let e=this.turnSteps.length,t=this.turnSteps.filter(r=>r.action).length,s=this.turnSteps.filter(r=>r.reflection).length;return`${e} steps, ${t} actions, ${s} reflections`}}});function gs(n=3){return new Il(n)}var N$,Il,Dl=L(()=>{"use strict";N$=[{test:n=>/ENOENT|no such file|not found|does not exist/i.test(n),errorClass:"file_not_found",strategy:"read_first",explanation:"The file or directory does not exist.",suggestion:"Use list_dir to check what files exist, then retry with the correct path.",alternatives:["list_dir","search_codebase"],autoRetry:!1},{test:n=>/EACCES|permission denied/i.test(n),errorClass:"permission_denied",strategy:"graceful_fail",explanation:"Permission denied \u2014 the process lacks access rights.",suggestion:"Check file ownership or try a different path. Do NOT use sudo.",alternatives:[],autoRetry:!1},{test:n=>/EISDIR|is a directory/i.test(n),errorClass:"path_is_directory",strategy:"retry_fixed",explanation:"The path points to a directory, not a file.",suggestion:"Append the filename to the path. Use list_dir to see contents.",alternatives:["list_dir"],autoRetry:!1},{test:n=>/EEXIST|already exists/i.test(n),errorClass:"file_already_exists",strategy:"read_first",explanation:"A file or directory already exists at that path.",suggestion:"Read the existing file first, then decide whether to overwrite or edit it.",alternatives:["read_file","edit_file"],autoRetry:!1},{test:n=>/no match|not found in file|search string not found/i.test(n),errorClass:"search_no_match",strategy:"read_first",explanation:"The search string was not found in the file.",suggestion:"Read the file first to see its actual content, then use the exact text for search/replace.",alternatives:["read_file","search_codebase"],autoRetry:!1},{test:n=>/command not found|not recognized/i.test(n),errorClass:"command_not_found",strategy:"alternative_tool",explanation:"The command does not exist on this system.",suggestion:"Check if the program is installed, or use a different command that achieves the same goal.",alternatives:["run_command"],autoRetry:!1},{test:n=>/timeout|timed out|ETIMEDOUT/i.test(n),errorClass:"command_timeout",strategy:"retry_fixed",explanation:"The command took too long and was terminated.",suggestion:"Try a simpler version of the command, or increase the timeout, or run it in background.",alternatives:[],autoRetry:!1},{test:n=>/exit code|exited with|non-zero/i.test(n),errorClass:"command_exit_error",strategy:"retry_fixed",explanation:"The command executed but returned an error.",suggestion:"Read the error output carefully. Fix the root cause (missing dependency, wrong syntax, etc.).",alternatives:[],autoRetry:!1},{test:n=>/syntax error|unexpected token|parse error|SyntaxError/i.test(n),errorClass:"syntax_error",strategy:"retry_fixed",explanation:"The content has a syntax error.",suggestion:"Review the generated code for syntax issues, fix them, and retry.",alternatives:[],autoRetry:!1},{test:n=>/ECONNREFUSED|ECONNRESET|ENOTFOUND|fetch failed|network/i.test(n),errorClass:"network_error",strategy:"retry_same",explanation:"Network connection failed.",suggestion:"This may be transient. Retry the same operation, or check connectivity.",alternatives:[],autoRetry:!0},{test:n=>/invalid argument|missing required|expected.*but got|type error/i.test(n),errorClass:"invalid_arguments",strategy:"retry_fixed",explanation:"The tool was called with invalid or missing arguments.",suggestion:"Check the tool's parameter requirements and provide correct values.",alternatives:[],autoRetry:!1},{test:n=>/ENOMEM|out of memory|resource|too large|max.*exceeded/i.test(n),errorClass:"resource_limit",strategy:"decompose_task",explanation:"Resource limit exceeded (memory, file size, etc.).",suggestion:"Break the task into smaller pieces, or process less data at once.",alternatives:[],autoRetry:!1}],Il=class{failures=new Map;maxRetriesPerTool;constructor(e=3){this.maxRetriesPerTool=e}resetTurn(){this.failures.clear()}analyze(e,t,s){let r=this.failures.get(e),i=r?r.count+1:1,o={tool:e,count:i,lastError:t,lastStrategy:"retry_same"};if(i>this.maxRetriesPerTool)return o.lastStrategy="ask_user",this.failures.set(e,o),{errorClass:"unknown",strategy:"ask_user",explanation:`Tool "${e}" has failed ${i} times in this turn.`,suggestion:`Stop retrying "${e}". Ask the user for clarification or try a completely different approach.`,alternatives:this.suggestAlternatives(e),autoRetry:!1};for(let a of N$)if(a.test(t)){let l=r?.lastStrategy===a.strategy&&i>=2,u=l?"decompose_task":a.strategy;return o.lastStrategy=u,this.failures.set(e,o),{errorClass:a.errorClass,strategy:u,explanation:a.explanation,suggestion:l?`Previous recovery attempt ("${a.strategy}") also failed. Try breaking this into smaller steps or use a completely different approach.`:a.suggestion,alternatives:a.alternatives,autoRetry:!l&&a.autoRetry}}return o.lastStrategy=i===1?"retry_fixed":"graceful_fail",this.failures.set(e,o),{errorClass:"unknown",strategy:o.lastStrategy,explanation:`Unexpected error from "${e}".`,suggestion:i===1?"Review the error message and adjust your approach.":"This error is persistent. Explain to the user what went wrong and suggest manual steps.",alternatives:this.suggestAlternatives(e),autoRetry:!1}}buildRecoveryMessage(e,t){let s=[`ERROR: ${t}`,"","[Recovery Analysis]",` Type: ${e.errorClass}`,` Strategy: ${e.strategy}`,` Explanation: ${e.explanation}`,` Suggestion: ${e.suggestion}`];switch(e.alternatives.length>0&&s.push(` Alternative tools: ${e.alternatives.join(", ")}`),e.strategy){case"read_first":s.push("","\u2192 ACTION: Read the file or directory first, then retry with correct information.");break;case"retry_fixed":s.push("","\u2192 ACTION: Fix the arguments based on the error, then retry.");break;case"alternative_tool":s.push("","\u2192 ACTION: Use a different tool to achieve the same goal.");break;case"decompose_task":s.push("","\u2192 ACTION: Break this into smaller, simpler steps.");break;case"ask_user":s.push("","\u2192 ACTION: Ask the user for clarification. Do NOT retry automatically.");break;case"graceful_fail":s.push("","\u2192 ACTION: Explain what went wrong clearly. Suggest manual steps if possible.");break}return s.join(`
|
|
964
964
|
`)}getFailureCount(e){return this.failures.get(e)?.count??0}shouldAutoRetry(e){let t=this.failures.get(e);return t?t.count<=1&&t.lastStrategy==="retry_same":!1}suggestAlternatives(e){return{read_file:["search_codebase","list_dir"],write_file:["edit_file","append_to_file"],edit_file:["search_and_replace","write_file","read_file"],search_and_replace:["edit_file","read_file"],patch_file:["edit_file","write_file"],run_command:["search_codebase"],search_codebase:["read_file","list_dir"],delete_file:["run_command"],create_dir:["run_command"],web_search:["scrape_url"]}[e]??[]}}});function j$(){try{if(Lt.existsSync(jr))return JSON.parse(Lt.readFileSync(jr,"utf-8"))}catch{}return{}}function H$(n){try{let e=Hr.dirname(jr);Lt.existsSync(e)||Lt.mkdirSync(e,{recursive:!0}),Lt.writeFileSync(jr,JSON.stringify(n,null,2),"utf-8")}catch{}}function Zm(n,e){let t=0,s=!1,r=!1;for(let i=e;i<n.length;i++){let o=n[i];if(r){r=!1;continue}if(o==="\\"&&s){r=!0;continue}if(o==='"'){s=!s;continue}if(!s&&(o==="{"&&t++,o==="}"&&(t--,t===0)))return n.slice(e,i+1)}return null}function ys(n){if(typeof n.name=="string"&&n.arguments&&typeof n.arguments=="object")return{tool:n.name,args:n.arguments};if(typeof n.tool=="string"&&n.args&&typeof n.args=="object")return{tool:n.tool,args:n.args};if(typeof n.name=="string"&&n.parameters&&typeof n.parameters=="object")return{tool:n.name,args:n.parameters};if(n.function&&typeof n.function=="object"){let e=n.function;if(typeof e.name=="string"){let t={};if(typeof e.arguments=="string")try{t=JSON.parse(e.arguments)}catch{t={}}else e.arguments&&typeof e.arguments=="object"&&(t=e.arguments);return{tool:e.name,args:t}}}return null}function B$(n){return n.replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function U$(n){let e=[],t=/<<?tool[-_]call\s*>>?([\s\S]*?)<<?\/tool[-_]call\s*>>?/gi,s;for(;(s=t.exec(n))!==null;)try{let r=JSON.parse(s[1].trim()),i=ys(r);i&&e.push({...i,format:"xml_tags",rawMatch:s[0]})}catch{}return e}function K$(n){let e=[],t=/<<?tool[-_]call\s*>>?([\s\S]*?)<<?\/tool[-_]call\s*>>?/gi,s;for(;(s=t.exec(n))!==null;)try{let r=JSON.parse(s[1].trim());if(r.parameters||r.name){let i=ys(r);i&&e.push({...i,format:"hermes",rawMatch:s[0]})}}catch{}return e}function q$(n){let e=[],t=/<<?tool[-_]call\s*>>?([\s\S]*?)<<?\/tool[-_]call\s*>>?/gi,s;for(;(s=t.exec(n))!==null;){let r=s[1],i=eg(r);for(let o of i)e.push({...o,format:"xml_tool_call_wrapper",rawMatch:s[0]})}return e}function eg(n){let e=[],t=["read_file","write_file","edit_file","search_and_replace","run_command","search_codebase","list_dir","create_dir","delete_file","append_to_file","patch_file","move_file","get_file_info"];for(let s of t){let r=new RegExp(`<<?${s}(\\s+[\\s\\S]*?)?(?:>>?([\\s\\S]*?)<<?\\/${s}>>?|\\s*\\/?>>?)`,"gi"),i;for(;(i=r.exec(n))!==null;){let o=i[1]||"",a=i[2]||"",l={},u=/(\w+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g,d;for(;(d=u.exec(o))!==null;){let h=d[1].toLowerCase(),m=d[2]??d[3]??d[4];l[h]=B$(m)}let f=a.trim();f&&(s==="write_file"||s==="append_to_file"?l.content=a:s==="run_command"?l.command=f:s==="patch_file"&&(l.new_content=a)),l.start_line&&(l.start_line=parseInt(l.start_line)),l.end_line&&(l.end_line=parseInt(l.end_line)),l.depth&&(l.depth=parseInt(l.depth)),s==="edit_file"?e.push({tool:"search_and_replace",args:l,format:"xml_prompt",rawMatch:i[0]}):e.push({tool:s,args:l,format:"xml_prompt",rawMatch:i[0]})}}return e}function W$(n){return eg(n)}function G$(n){let e=[],t=/```(?:json|tool_call)?\s*\n([\s\S]*?)\n```/g,s;for(;(s=t.exec(n))!==null;)try{let r=JSON.parse(s[1].trim()),i=ys(r);i&&e.push({...i,format:"markdown_json",rawMatch:s[0]})}catch{}return e}function V$(n){let e=[],t=/\{\s*"function"\s*:/g,s;for(;(s=t.exec(n))!==null;){let r=Zm(n,s.index);if(r)try{let i=JSON.parse(r),o=ys(i);o&&e.push({...o,format:"function_call",rawMatch:r})}catch{}}return e}function z$(n){let e=[],t=/\{\s*"(?:name|tool)"\s*:/g,s;for(;(s=t.exec(n))!==null;){let r=Zm(n,s.index);if(r)try{let i=JSON.parse(r),o=ys(i);o&&e.push({...o,format:"json_object",rawMatch:r})}catch{}}return e}function Y$(n){let e=[],t=/<<?tool[-_]call\s*>>?([\s\S]*?)(?:<<?\/tool[-_]call\s*>>?|$)/gi,s,r=!1;for(;(s=t.exec(n))!==null;){let i=s[1],o=/<function=([^>]+)>/i.exec(i);if(o){r=!0;let a=o[1].trim(),l={},u=/<parameter=([^>]+)>([\s\S]*?)<\/parameter>/gi,d;for(;(d=u.exec(i))!==null;){let f=d[1].trim(),h=d[2].trim();h==="true"?h=!0:h==="false"?h=!1:!isNaN(Number(h))&&h!==""&&(h=Number(h)),l[f]=h}e.push({tool:a,args:l,format:"xml_parameters",rawMatch:s[0]})}}if(!r&&/<function=([^>]+)>/i.test(n)){let i=/<function=([^>]+)>/i.exec(n);if(i){let o=i[1].trim(),a={},l=/<parameter=([^>]+)>([\s\S]*?)<\/parameter>/gi,u;for(;(u=l.exec(n))!==null;){let d=u[1].trim(),f=u[2].trim();f==="true"?f=!0:f==="false"?f=!1:!isNaN(Number(f))&&f!==""&&(f=Number(f)),a[d]=f}e.push({tool:o,args:a,format:"xml_parameters",rawMatch:n})}}return e}function tg(){return Fl||(Fl=new Nl),Fl}var Lt,Hr,Qm,jr,Ll,Nl,Fl,ng=L(()=>{"use strict";Lt=O(require("fs")),Hr=O(require("path")),Qm=O(require("os")),jr=Hr.join(Qm.homedir(),".hablas","model-formats.json");Ll=[{format:"xml_tool_call_wrapper",parse:q$},{format:"xml_prompt",parse:W$},{format:"xml_tags",parse:U$},{format:"xml_parameters",parse:Y$},{format:"hermes",parse:K$},{format:"markdown_json",parse:G$},{format:"function_call",parse:V$},{format:"json_object",parse:z$}],Nl=class{registry;constructor(){this.registry=j$()}parse(e,t,s){if(t&&Array.isArray(t)&&t.length>0){let i=t.filter(o=>o?.function?.name&&typeof o.function.name=="string");if(i.length>0){let o=i.map(a=>({function:{name:a.function.name,arguments:a.function.arguments||{}}}));return s&&this.learnFormat(s,"native"),{toolCalls:o,displayContent:(e||"").trim(),format:"native"}}}let r=e||"";if(!r.trim())return{toolCalls:[],displayContent:"",format:"unknown"};if(s){let i=this.registry[s];if(i&&i.format!=="native"){let o=Ll.find(a=>a.format===i.format);if(o){let a=o.parse(r);if(a.length>0)return this.learnFormat(s,i.format),this.buildResult(a,r)}}}for(let{parse:i}of Ll){let o=i(r);if(o.length>0){let a=o[0].format;return s&&this.learnFormat(s,a),this.buildResult(o,r)}}return{toolCalls:[],displayContent:r.trim(),format:"unknown"}}mightContainToolCall(e){if(!e)return!1;let t=e.trim();return!!(/<<?tool[-_]call[\s>]/i.test(t)||/<function=/i.test(t)||t.includes("```tool_call")||t.includes("```json")&&t.includes('"name"')||/<<?(?:read_file|write_file|run_command|edit_file|search_codebase|create_dir|delete_file|list_dir|append_to_file|patch_file|move_file|get_file_info)[\s>]/i.test(t)||t.startsWith("{")&&(t.includes('"name"')||t.includes('"tool"'))&&(t.includes('"arguments"')||t.includes('"args"')||t.includes('"parameters"'))||t.includes('"function"')&&t.includes('"name"'))}detectFormat(e){for(let{format:t,parse:s}of Ll)if(s(e).length>0)return t;return"unknown"}learnFormat(e,t){let s=this.registry[e];s&&s.format===t?(s.successCount++,s.lastUsed=new Date().toISOString()):this.registry[e]={format:t,successCount:1,lastUsed:new Date().toISOString()},H$(this.registry)}getLearnedFormat(e){return this.registry[e]?.format??null}getLearnedFormats(){let e={};for(let[t,s]of Object.entries(this.registry))e[t]={format:s.format,successCount:s.successCount};return e}buildResult(e,t){let s=e.map(o=>({function:{name:o.tool,arguments:o.args}})),r=t,i=[...e].sort((o,a)=>a.rawMatch.length-o.rawMatch.length);for(let o of i)r=r.replace(o.rawMatch,"");return r=r.replace(/<<?thinking>>?[\s\S]*?<<?\/thinking>>?/gi,""),r=r.replace(/<<?think>>?[\s\S]*?<<?\/think>>?/gi,""),r=r.replace(/\n{3,}/g,`
|
|
965
965
|
|
|
966
|
-
`),{toolCalls:s,displayContent:r.trim(),format:e[0]?.format??"unknown"}}},Fl=null});function X$(n,e,t){let r=tg().parse(e,n,t);return{toolCalls:r.toolCalls,displayContent:r.displayContent}}function Q$(n,e){return n==="write_file"&&typeof e.path=="string"?`create ${e.path}`:(n==="edit_file"||n==="patch_file"||n==="search_and_replace")&&typeof e.path=="string"?`modify ${e.path}`:n==="read_file"&&typeof e.path=="string"?`read ${e.path}`:n==="run_command"&&typeof e.command=="string"?String(e.command).slice(0,80):typeof e.path=="string"?String(e.path):n.replace(/_/g," ")}function Z$(n){let e=(n||"").toLowerCase();return e.includes("eacces")||e.includes("permission")||e.includes("enospc")||e.includes("readonly")||e.includes("security")||e.includes("[write_file]")||e.includes("[delete_file]")||e.includes("[move_file]")||e.includes("[search_and_replace]")}async function ig(n,e,t,s){let r=0,i=Date.now();for(;r<=rg;){let o=await n.execute({name:e,arguments:t});if(o.success||r>=rg)return{success:o.success,output:o.output,error:o.error,duration:Date.now()-i,retries:r};r++,s.info({tool:e,retry:r,error:o.error},"Retrying tool"),await new Promise(a=>setTimeout(a,500))}return{success:!1,output:"",error:"Max retries exceeded",duration:Date.now()-i,retries:r}}async function Br(n){let{identity:e,client:t,registry:s,session:r,contextManager:i,logger:o,io:a={},safetyPolicy:l,abortSignal:u,skipTools:d}=n,f=n.reactEngine??ms(),h=n.errorRecovery??gs(),m=d?[]:s.getOllamaTools(),p=t.getModel(),g=n.maxIterations??J$,x=[],w=[],$=[],A="",y=0,v=!1;for(;y<g;){if(y++,u?.aborted)return{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:"Aborted",completedNaturally:v};let b=f.buildBudgetWarningPrompt();b&&r.addUserMessage(b,{priority:"critical",tags:["system-budget"]});let S;try{S=await t.chatWithTools(r.getMessages(),m,u)}catch(W){let E=W;if(E.name==="AbortError"||u?.aborted)return{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:"Aborted",completedNaturally:v};if(y<=1){a.onNotice?.(`Transient model error: ${E.message??"unknown"} \u2014 retrying\u2026`,"retry"),await new Promise(k=>setTimeout(k,1e3)),y--;continue}return a.onError?.(E.message??"Model request failed"),{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:E.message,completedNaturally:v}}let _=S.message?.content||"",T=S.message?.tool_calls,I=f.parseThinking(_);I.hasThinking&&(f.recordStep({thought:I.thinking}),o.debug({thinking:I.thinking.slice(0,200)},"ReAct thinking"));let{toolCalls:C,displayContent:F}=X$(T,_,p);if(F&&F.trim()&&(A=F,await a.onAssistantText?.(F,e)),C.length===0){r.addAssistantMessage(_,void 0,e.role),v=!0;break}r.addAssistantMessage(_,C,e.role);let H=C.length;for(let W=0;W<C.length;W++){let E=C[W];if(!E?.function?.name)continue;let k=E.function.name,
|
|
966
|
+
`),{toolCalls:s,displayContent:r.trim(),format:e[0]?.format??"unknown"}}},Fl=null});function X$(n,e,t){let r=tg().parse(e,n,t);return{toolCalls:r.toolCalls,displayContent:r.displayContent}}function Q$(n,e){return n==="write_file"&&typeof e.path=="string"?`create ${e.path}`:(n==="edit_file"||n==="patch_file"||n==="search_and_replace")&&typeof e.path=="string"?`modify ${e.path}`:n==="read_file"&&typeof e.path=="string"?`read ${e.path}`:n==="run_command"&&typeof e.command=="string"?String(e.command).slice(0,80):typeof e.path=="string"?String(e.path):n.replace(/_/g," ")}function Z$(n){let e=(n||"").toLowerCase();return e.includes("eacces")||e.includes("permission")||e.includes("enospc")||e.includes("readonly")||e.includes("security")||e.includes("[write_file]")||e.includes("[delete_file]")||e.includes("[move_file]")||e.includes("[search_and_replace]")}async function ig(n,e,t,s){let r=0,i=Date.now();for(;r<=rg;){let o=await n.execute({name:e,arguments:t});if(o.success||r>=rg)return{success:o.success,output:o.output,error:o.error,duration:Date.now()-i,retries:r};r++,s.info({tool:e,retry:r,error:o.error},"Retrying tool"),await new Promise(a=>setTimeout(a,500))}return{success:!1,output:"",error:"Max retries exceeded",duration:Date.now()-i,retries:r}}async function Br(n){let{identity:e,client:t,registry:s,session:r,contextManager:i,logger:o,io:a={},safetyPolicy:l,abortSignal:u,skipTools:d}=n,f=n.reactEngine??ms(),h=n.errorRecovery??gs(),m=d?[]:s.getOllamaTools(),p=t.getModel(),g=n.maxIterations??J$,x=[],w=[],$=[],A="",y=0,v=!1;for(;y<g;){if(y++,u?.aborted)return{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:"Aborted",completedNaturally:v};let b=f.buildBudgetWarningPrompt();b&&r.addUserMessage(b,{priority:"critical",tags:["system-budget"]});let S;try{S=await t.chatWithTools(r.getMessages(),m,u)}catch(W){let E=W;if(E.name==="AbortError"||u?.aborted)return{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:"Aborted",completedNaturally:v};if(y<=1){a.onNotice?.(`Transient model error: ${E.message??"unknown"} \u2014 retrying\u2026`,"retry"),await new Promise(k=>setTimeout(k,1e3)),y--;continue}return a.onError?.(E.message??"Model request failed"),{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!1,error:E.message,completedNaturally:v}}let _=S.message?.content||"",T=S.message?.tool_calls,I=f.parseThinking(_);I.hasThinking&&(f.recordStep({thought:I.thinking}),o.debug({thinking:I.thinking.slice(0,200)},"ReAct thinking"));let{toolCalls:C,displayContent:F}=X$(T,_,p);if(F&&F.trim()&&(A=F,await a.onAssistantText?.(F,e)),C.length===0){r.addAssistantMessage(_,void 0,e.role),v=!0;break}r.addAssistantMessage(_,C,e.role);let H=C.length;for(let W=0;W<C.length;W++){let E=C[W];if(!E?.function?.name)continue;let k=E.function.name,J=E.function.arguments||{},K=s.getSafetyLevel(k)??"confirm";if(!s.get(k)){a.onNotice?.(`Unknown tool: ${k} \u2014 skipping`,"warn"),r.addToolMessage(`Error: Unknown tool "${k}". Available: ${s.getAll().map(Oe=>Oe.name).join(", ")}`);continue}if(await l(k,K,J)==="skip"){r.addToolMessage(`Tool ${k} was skipped by policy/user.`);break}x.push(k),typeof J.path=="string"&&$.push(J.path);let te=Q$(k,J);a.onToolStart?.(k,te,J),a.onToolCall?.(),f.recordStep({thought:I.hasThinking?`Executing: ${k}`:"",action:k,actionInput:J});let Q=await ig(s,k,J,o);a.onToolEnd?.(k,Q.success,Q.error||Q.output,Q.duration,J);let ce;if(Q.success)ce=os(Q.output,sg),f.recordObservation(ce.slice(0,300)),w.push({tool:k,success:!0,summary:Q.output.slice(0,150)});else{let Oe=Q.error||"Unknown error",Fe=h.analyze(k,Oe,J);if(ce=h.buildRecoveryMessage(Fe,Oe),f.recordObservation(`FAILED: ${Oe}`,`Recovery: ${Fe.strategy} \u2014 ${Fe.suggestion}`),o.info({tool:k,errorClass:Fe.errorClass,strategy:Fe.strategy},"Error recovery analysis"),w.push({tool:k,success:!1,summary:Oe.slice(0,150)}),Fe.autoRetry&&!f.isOverBudget()){a.onNotice?.("Auto-retrying (transient error)\u2026","retry");let ye=await ig(s,k,J,o);a.onToolEnd?.(k,ye.success,ye.output,ye.duration,J),ye.success&&(ce=os(ye.output,sg),f.recordObservation(ce.slice(0,300),"Auto-retry succeeded"),w[w.length-1]={tool:k,success:!0,summary:ye.output.slice(0,150)})}}if(r.addToolMessage(ce),Q.success&&k==="read_file"&&typeof J.path=="string"&&i?.addFile(J.path,Q.output),o.info({tool:k,success:Q.success,durationMs:Q.duration,retries:Q.retries},"Tool executed"),!Q.success&&Z$(Q.error)){a.onNotice?.("Critical tool failure \u2014 aborting subsequent tool executions.","warn");break}H>1&&W<H-1}f.isOverBudget()&&a.onNotice?.(`Reached max reasoning steps (${f.getConfig().maxSteps}). Wrapping up.`,"warn")}return y>=g&&!v&&a.onNotice?.(`Reached max iterations (${g}). Stopping.`,"warn"),o.info({summary:f.getTurnSummary(),agent:e.name},"Agentic turn completed"),{output:A,toolsUsed:qt(x),toolResults:w,touchedFiles:qt($),iterations:y,success:!0,completedNaturally:v}}function qt(n){return[...new Set(n)]}function og(n){return async(e,t)=>{let s=e.replace(/_/g," ");return!n.autoMode&&n.interactive?t==="confirm"&&n.confirm?await n.confirm(`Proceed with ${s}?`)?"allow":"skip":t==="dangerous"&&n.confirmDangerous?await n.confirmDangerous(`Dangerous: ${s}`)?"allow":"skip":"allow":!n.autoMode&&t==="dangerous"?"skip":"allow"}}function ag(){return(n,e)=>e==="dangerous"?"skip":"allow"}var J$,sg,rg,jl=L(()=>{"use strict";da();Ml();Dl();ng();J$=150,sg=2e3,rg=2});var cg,e0,t0,n0,lg,bs,ug=L(()=>{"use strict";cg=O(Ol());jn();pa();fa();Ns();Ri();Fa();jl();e0={hablas:"planner",bob:"architect",alex:"coder",david:"researcher",emma:"product-manager"},t0=(0,cg.default)({level:"silent"}),n0=40,lg={hablas:{role:"hablas",model:"stepfun-ai/step-3.7-flash",temperature:.7},bob:{role:"bob",model:"stepfun-ai/step-3.7-flash",temperature:.4},alex:{role:"alex",model:"stepfun-ai/step-3.7-flash",temperature:.2},david:{role:"david",model:"stepfun-ai/step-3.7-flash",temperature:.5},emma:{role:"emma",model:"stepfun-ai/step-3.7-flash",temperature:.6}},bs=class{baseConfig;agentModels;toolRegistry=null;onOutput=null;channel=null;mindsetRegistry=br();sharedContext=null;contextManager;constructor(e){this.baseConfig=e,this.agentModels=zt(),this.contextManager=new tn(e)}setSharedContext(e){this.sharedContext=e}setChannel(e){this.channel=e}setToolRegistry(e){this.toolRegistry=e}setOutputCallback(e){this.onOutput=e}reloadModels(){this.agentModels=zt()}getAgentModel(e){let t=this.agentModels[e];if(t)return{model:t.model,temperature:t.temperature??lg[e]?.temperature??.5};let s=lg[e];return{model:s.model,temperature:s.temperature??.5}}async runAgent(e,t,s,r,i){let o=Date.now(),a=xe.find($=>$.role===e),l=this.getAgentModel(e),u=i?.maxIterations||n0,d={...this.baseConfig,model:l.model},f=Me(d),h=this.buildAgentPrompt(a,s),m=new nn(h,30,this.baseConfig.contextBudget);m.addUserMessage(t);let p={name:a.name,title:a.title,role:e};this.emit(a.name,"thinking",`\u2605 Hablas \u2192 Delegating to @${a.name} (${a.title})...`);let g={onAssistantText:$=>{this.emit(a.name,"speaking",$.slice(0,200))},onToolStart:($,A,y)=>{this.emit(a.name,"tool",A),this.channel&&this.channel.emitEvent({type:"act",agent:a.name,toolName:$,toolArgs:this.safeArgs(y),content:A})},onToolEnd:($,A,y)=>{this.channel&&this.channel.emitEvent({type:"observe",agent:a.name,toolName:$,success:A,content:A?this.summarizeOk($,y):`error: ${y.slice(0,120)}`})},onError:$=>this.emit(a.name,"error",$)},x=await Br({identity:p,client:f,registry:this.toolRegistry,session:m,contextManager:this.contextManager,logger:t0,io:g,safetyPolicy:ag(),abortSignal:i?.abortSignal,skipTools:(!r||r.length===0,!1),maxIterations:u});if(this.sharedContext&&x.touchedFiles.length)try{this.sharedContext.set(`files:@${a.name}`,x.touchedFiles.join(", "))}catch{}let w=x.touchedFiles.length?[`@${a.name} touched: ${x.touchedFiles.join(", ")}`]:[];return{agent:e,agentName:a.name,output:x.output||(x.success?"Done.":x.error??"No output"),toolsUsed:x.toolsUsed,toolResults:x.toolResults,duration:Date.now()-o,iterations:x.iterations,success:x.success,error:x.error,discoveries:w,touchedFiles:x.touchedFiles}}async runSequential(e,t,s){let r=[],i="",o=[];for(let a=0;a<e.length;a++){let{role:l,task:u}=e[a];if(s?.abortSignal?.aborted)break;let d=[];if(i&&(d.push("## Previous Agent Results"),d.push(i)),o.length>0){d.push(`
|
|
967
967
|
## Handoff Chain`);for(let p of o)d.push(`- @${p.from} \u2192 @${p.to}: ${p.context.slice(0,100)}`)}let f=d.join(`
|
|
968
968
|
`),h=xe.find(p=>p.role===l);if(h&&a>0){let p=e[a-1].role,g=xe.find(x=>x.role===p);this.emit(h.name,"thinking",`\u2605 Handoff: @${g?.name||p} \u2192 @${h.name} (${h.title})`)}let m=await this.runAgent(l,u,f,t,s);if(r.push(m),m.success&&m.output){let p=m.output.length>600?m.output.slice(0,600)+"...":m.output;i+=`
|
|
969
969
|
|
|
@@ -1037,7 +1037,7 @@ Never output raw tool XML in text.
|
|
|
1037
1037
|
${t}`),this.sharedContext){let a=this.sharedContext.getSummary();a&&(o+=`
|
|
1038
1038
|
|
|
1039
1039
|
## Shared Team Context
|
|
1040
|
-
${a}`)}return o}emit(e,t,s){if(this.onOutput&&this.onOutput(e,t,s),this.channel){let r=t==="speaking"?"speak":t==="tool"?"act":t;this.channel.emitEvent({type:r,agent:e,content:s})}}safeArgs(e){let t={};for(let[s,r]of Object.entries(e||{}))typeof r=="string"?t[s]=r.length>160?r.slice(0,160)+"\u2026":r:(typeof r=="number"||typeof r=="boolean")&&(t[s]=r);return t}summarizeOk(e,t){let s=t.split(/\r?\n/).length;return e==="write_file"||e==="edit_file"||e==="patch_file"?`ok \xB7 ${s} line${s===1?"":"s"}`:e==="run_command"?`ok \xB7 ${t.split(/\r?\n/).find(i=>i.trim())?.slice(0,80)||"ok"}`:e==="read_file"?`ok \xB7 ${s} line${s===1?"":"s"} read`:"ok"}}});var dg,vs,fg=L(()=>{"use strict";dg=require("events"),vs=class extends dg.EventEmitter{events=[];maxHistory;constructor(e=500){super(),this.setMaxListeners(50),this.maxHistory=e}emitEvent(e){let t={...e,timestamp:Date.now()};return this.events.push(t),this.events.length>this.maxHistory&&this.events.splice(0,this.events.length-this.maxHistory),this.emit("event",t),this.emit(t.type,t),t}history(){return[...this.events]}reset(){this.events=[]}onEvent(e){return this.on("event",e),this}offEvent(e){return this.off("event",e),this}}});var s0,St,Ur,ws,pg=L(()=>{"use strict";jn();s0={hablas:"Hablas \u2014 INTJ Team Leader. Authoritative, terse, engineering-precise. Speaks in short systemic statements. No pleasantries.",emma:"Emma \u2014 Product Manager. Calm, user-focused, structured. Clarifies scope and outcomes in plain language.",bob:"Bob \u2014 System Architect. Methodical, principled, slightly formal. Talks in terms of boundaries, trade-offs, contracts.",alex:"Alex \u2014 Senior Engineer. Pragmatic, concise, action-biased. Confirms intent, then ships.",david:"David \u2014 Data & Research Analyst. Factual, evidence-driven, neutral tone. Cites context, not opinions."},St={hablas:"Hablas",emma:"Emma",bob:"Bob",alex:"Alex",david:"David"},Ur={handoff:(n,e,t)=>{let s=St[e];return{hablas:`Routing this to you, @${s}.`,emma:`@${s}, I need the requirements framed before we move.`,bob:`@${s}, design the structure for this. Keep boundaries clean.`,alex:`@${s}, you have the implementation. Stay surgical.`,david:`@${s}, gather the context we need on this.`}[e]||`@${s}, taking this from here.`},ack:(n,e)=>`Acknowledged, @${St[e]}. Proceeding.`,review:(n,e)=>`@${St[e]}, structurally sound. Watch the boundaries on the next pass.`,reviewAck:(n,e)=>`Noted, @${St[e]}. Integrating.`},ws=class{client;spent=0;cache=new Map;opts;constructor(e,t={}){this.opts={tokenBudget:t.tokenBudget??500,maxChars:t.maxChars??140,lightModel:t.lightModel,abortSignal:t.abortSignal};let s={...e,model:this.opts.lightModel||e.model};this.client=Me(s)}resetBudget(){this.spent=0,this.cache.clear()}setAbortSignal(e){this.opts.abortSignal=e}async generateHandoffLine(e,t,s){return this.generate(`handoff:${e}:${t}:${this.hash(s)}`,this.buildPrompt(e,t,"handoff",s),()=>Ur.handoff(e,t,s))}async generateAckLine(e,t){return this.generate(`ack:${e}:${t}`,this.buildPrompt(e,t,"ack"),()=>Ur.ack(e,t))}async generateReviewLine(e,t,s){return this.generate(`review:${e}:${t}:${this.hash(s.slice(0,200))}`,this.buildPrompt(e,t,"review",s.slice(0,400)),()=>Ur.review(e,t))}async generateReviewAck(e,t){return this.generate(`reviewAck:${e}:${t}`,this.buildPrompt(e,t,"reviewAck"),()=>Ur.reviewAck(e,t))}async generate(e,t,s){let r=this.cache.get(e);if(r)return r;if(this.spent>=this.opts.tokenBudget||this.opts.abortSignal?.aborted)return s();try{let o=((await this.client.chatWithTools(t,[],this.opts.abortSignal)).message?.content||"").trim(),a=this.cleanLine(o);return a?(this.spent+=Math.ceil(a.length/4)+40,this.cache.set(e,a),a):s()}catch{return s()}}buildPrompt(e,t,s,r){let i=`You are ${St[e]}, speaking in your own voice.
|
|
1040
|
+
${a}`)}return o}emit(e,t,s){if(this.onOutput&&this.onOutput(e,t,s),this.channel){let r=t==="speaking"?"speak":t==="tool"?"act":t;this.channel.emitEvent({type:r,agent:e,content:s})}}safeArgs(e){let t={};for(let[s,r]of Object.entries(e||{}))typeof r=="string"?t[s]=r.length>160?r.slice(0,160)+"\u2026":r:(typeof r=="number"||typeof r=="boolean")&&(t[s]=r);return t}summarizeOk(e,t){let s=t.split(/\r?\n/).length;return e==="write_file"||e==="edit_file"||e==="patch_file"?`ok \xB7 ${s} line${s===1?"":"s"}`:e==="run_command"?`ok \xB7 ${t.split(/\r?\n/).find(i=>i.trim())?.slice(0,80)||"ok"}`:e==="read_file"?`ok \xB7 ${s} line${s===1?"":"s"} read`:"ok"}}});var dg,vs,fg=L(()=>{"use strict";dg=require("events"),vs=class extends dg.EventEmitter{events=[];maxHistory;constructor(e=500){super(),this.setMaxListeners(50),this.maxHistory=e,this.on("error",t=>{process.env.DEBUG&&console.error("[AgentChannel internal error swallowed]",t)})}emitEvent(e){let t={...e,timestamp:Date.now()};return this.events.push(t),this.events.length>this.maxHistory&&this.events.splice(0,this.events.length-this.maxHistory),this.emit("event",t),t.type!=="error"&&this.emit(t.type,t),t}history(){return[...this.events]}reset(){this.events=[]}onEvent(e){return this.on("event",e),this}offEvent(e){return this.off("event",e),this}}});var s0,St,Ur,ws,pg=L(()=>{"use strict";jn();s0={hablas:"Hablas \u2014 INTJ Team Leader. Authoritative, terse, engineering-precise. Speaks in short systemic statements. No pleasantries.",emma:"Emma \u2014 Product Manager. Calm, user-focused, structured. Clarifies scope and outcomes in plain language.",bob:"Bob \u2014 System Architect. Methodical, principled, slightly formal. Talks in terms of boundaries, trade-offs, contracts.",alex:"Alex \u2014 Senior Engineer. Pragmatic, concise, action-biased. Confirms intent, then ships.",david:"David \u2014 Data & Research Analyst. Factual, evidence-driven, neutral tone. Cites context, not opinions."},St={hablas:"Hablas",emma:"Emma",bob:"Bob",alex:"Alex",david:"David"},Ur={handoff:(n,e,t)=>{let s=St[e];return{hablas:`Routing this to you, @${s}.`,emma:`@${s}, I need the requirements framed before we move.`,bob:`@${s}, design the structure for this. Keep boundaries clean.`,alex:`@${s}, you have the implementation. Stay surgical.`,david:`@${s}, gather the context we need on this.`}[e]||`@${s}, taking this from here.`},ack:(n,e)=>`Acknowledged, @${St[e]}. Proceeding.`,review:(n,e)=>`@${St[e]}, structurally sound. Watch the boundaries on the next pass.`,reviewAck:(n,e)=>`Noted, @${St[e]}. Integrating.`},ws=class{client;spent=0;cache=new Map;opts;constructor(e,t={}){this.opts={tokenBudget:t.tokenBudget??500,maxChars:t.maxChars??140,lightModel:t.lightModel,abortSignal:t.abortSignal};let s={...e,model:this.opts.lightModel||e.model};this.client=Me(s)}resetBudget(){this.spent=0,this.cache.clear()}setAbortSignal(e){this.opts.abortSignal=e}async generateHandoffLine(e,t,s){return this.generate(`handoff:${e}:${t}:${this.hash(s)}`,this.buildPrompt(e,t,"handoff",s),()=>Ur.handoff(e,t,s))}async generateAckLine(e,t){return this.generate(`ack:${e}:${t}`,this.buildPrompt(e,t,"ack"),()=>Ur.ack(e,t))}async generateReviewLine(e,t,s){return this.generate(`review:${e}:${t}:${this.hash(s.slice(0,200))}`,this.buildPrompt(e,t,"review",s.slice(0,400)),()=>Ur.review(e,t))}async generateReviewAck(e,t){return this.generate(`reviewAck:${e}:${t}`,this.buildPrompt(e,t,"reviewAck"),()=>Ur.reviewAck(e,t))}async generate(e,t,s){let r=this.cache.get(e);if(r)return r;if(this.spent>=this.opts.tokenBudget||this.opts.abortSignal?.aborted)return s();try{let o=((await this.client.chatWithTools(t,[],this.opts.abortSignal)).message?.content||"").trim(),a=this.cleanLine(o);return a?(this.spent+=Math.ceil(a.length/4)+40,this.cache.set(e,a),a):s()}catch{return s()}}buildPrompt(e,t,s,r){let i=`You are ${St[e]}, speaking in your own voice.
|
|
1041
1041
|
${s0[e]}
|
|
1042
1042
|
|
|
1043
1043
|
Hard constraints:
|
|
@@ -1045,7 +1045,7 @@ Hard constraints:
|
|
|
1045
1045
|
- No prefix, no quotes, no markdown, no emojis, no role labels.
|
|
1046
1046
|
- Maximum ${this.opts.maxChars} characters.
|
|
1047
1047
|
- Address @${St[t]} directly.
|
|
1048
|
-
- Stay in character. Be useful, not chatty.`,o;switch(s){case"handoff":o=`You are about to hand the following task to @${St[t]}. Write a single in-character line that briefly frames what you need from them. Task: "${(r||"").slice(0,300)}"`;break;case"ack":o=`@${St[t]} just handed you a task. Write a single in-character line acknowledging it and stating your immediate next move.`;break;case"review":o=`You just reviewed @${St[t]}'s output below. Write a single in-character line of feedback \u2014 substantive but extremely brief. Output excerpt: """${(r||"").slice(0,400)}"""`;break;case"reviewAck":o=`@${St[t]} just reviewed your work and gave you feedback. Write a single in-character line acknowledging it and noting the integration.`;break}return[{role:"system",content:i},{role:"user",content:o}]}cleanLine(e){let t=e.trim();return t=t.replace(/^```[a-z]*\n?|```$/gi,"").trim(),t=t.split(/\r?\n/)[0].trim(),t=t.replace(/^@?[A-Z][a-zA-Z]+\s*:\s*/,"").trim(),t=t.replace(/^["'`«»“”]+|["'`«»“”]+$/g,"").trim(),t.length>this.opts.maxChars&&(t=t.slice(0,this.opts.maxChars-1).trim()+"\u2026"),t}hash(e){let t=2166136261;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}}});var
|
|
1048
|
+
- Stay in character. Be useful, not chatty.`,o;switch(s){case"handoff":o=`You are about to hand the following task to @${St[t]}. Write a single in-character line that briefly frames what you need from them. Task: "${(r||"").slice(0,300)}"`;break;case"ack":o=`@${St[t]} just handed you a task. Write a single in-character line acknowledging it and stating your immediate next move.`;break;case"review":o=`You just reviewed @${St[t]}'s output below. Write a single in-character line of feedback \u2014 substantive but extremely brief. Output excerpt: """${(r||"").slice(0,400)}"""`;break;case"reviewAck":o=`@${St[t]} just reviewed your work and gave you feedback. Write a single in-character line acknowledging it and noting the integration.`;break}return[{role:"system",content:i},{role:"user",content:o}]}cleanLine(e){let t=e.trim();return t=t.replace(/^```[a-z]*\n?|```$/gi,"").trim(),t=t.split(/\r?\n/)[0].trim(),t=t.replace(/^@?[A-Z][a-zA-Z]+\s*:\s*/,"").trim(),t=t.replace(/^["'`«»“”]+|["'`«»“”]+$/g,"").trim(),t.length>this.opts.maxChars&&(t=t.slice(0,this.opts.maxChars-1).trim()+"\u2026"),t}hash(e){let t=2166136261;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}}});var re,ct,r0,mg,i0,gg,hg,Dn,Hl=L(()=>{"use strict";re=O(require("fs")),ct=O(require("path")),r0=".hablas",mg=`# Project Context
|
|
1049
1049
|
|
|
1050
1050
|
## Overview
|
|
1051
1051
|
<!-- Auto-generated by hablas. Describe your project here. -->
|
|
@@ -1069,20 +1069,20 @@ Hard constraints:
|
|
|
1069
1069
|
|
|
1070
1070
|
## Completed
|
|
1071
1071
|
<!-- Format: - [x] Task description (@agent) \u2014 result -->
|
|
1072
|
-
`,hg={"CONTEXT.md":mg,"DECISIONS.md":i0,"TASKS.md":gg},Dn=class{contextDir;constructor(e){this.contextDir=ct.join(e,r0)}init(){let e=ct.join(ct.dirname(this.contextDir),".flowagent");if(
|
|
1072
|
+
`,hg={"CONTEXT.md":mg,"DECISIONS.md":i0,"TASKS.md":gg},Dn=class{contextDir;constructor(e){this.contextDir=ct.join(e,r0)}init(){let e=ct.join(ct.dirname(this.contextDir),".flowagent");if(re.existsSync(e)&&!re.existsSync(this.contextDir))try{re.renameSync(e,this.contextDir)}catch{}re.existsSync(this.contextDir)||re.mkdirSync(this.contextDir,{recursive:!0});for(let[t,s]of Object.entries(hg)){let r=ct.join(this.contextDir,t);re.existsSync(r)||re.writeFileSync(r,s,"utf-8")}}exists(){return re.existsSync(this.contextDir)}read(e){let t=ct.join(this.contextDir,e);return re.existsSync(t)?re.readFileSync(t,"utf-8"):null}write(e,t){this.ensureDir();let s=ct.join(this.contextDir,e);re.writeFileSync(s,t,"utf-8")}append(e,t){this.ensureDir();let s=ct.join(this.contextDir,e),r=re.existsSync(s)?re.readFileSync(s,"utf-8"):"";re.writeFileSync(s,r+`
|
|
1073
1073
|
`+t,"utf-8")}logDecision(e,t,s){let i=`| ${new Date().toISOString().split("T")[0]} | ${e} | ${t} | ${s} |`;this.append("DECISIONS.md",i)}addTask(e,t){let s=`- [ ] ${e} (@${t})`,i=(this.read("TASKS.md")||gg).replace(`## Active Tasks
|
|
1074
1074
|
`,`## Active Tasks
|
|
1075
1075
|
${s}
|
|
1076
|
-
`);this.write("TASKS.md",i)}completeTask(e,t){let s=this.read("TASKS.md");if(!s)return;let r=`- [ ] ${e}`,i=`- [x] ${e}${t?" \u2014 "+t:""}`,o=s.replace(r,i);this.write("TASKS.md",o)}getAll(){return
|
|
1076
|
+
`);this.write("TASKS.md",i)}completeTask(e,t){let s=this.read("TASKS.md");if(!s)return;let r=`- [ ] ${e}`,i=`- [x] ${e}${t?" \u2014 "+t:""}`,o=s.replace(r,i);this.write("TASKS.md",o)}getAll(){return re.existsSync(this.contextDir)?re.readdirSync(this.contextDir).filter(t=>t.endsWith(".md")).map(t=>{let s=ct.join(this.contextDir,t),r=re.statSync(s);return{file:t,content:re.readFileSync(s,"utf-8"),lastModified:r.mtime}}):[]}getSummary(){let e=this.getAll();return e.length===0?"":e.map(t=>`### ${t.file}
|
|
1077
1077
|
${t.content}`).join(`
|
|
1078
1078
|
|
|
1079
|
-
`)}kvStore=new Map;set(e,t){this.kvStore.set(e,t),this.persistKV()}get(e){return this.kvStore.get(e)}delete(e){let t=this.kvStore.delete(e);return t&&this.persistKV(),t}clear(){this.kvStore.clear();for(let[e,t]of Object.entries(hg)){let s=ct.join(this.contextDir,e);
|
|
1079
|
+
`)}kvStore=new Map;set(e,t){this.kvStore.set(e,t),this.persistKV()}get(e){return this.kvStore.get(e)}delete(e){let t=this.kvStore.delete(e);return t&&this.persistKV(),t}clear(){this.kvStore.clear();for(let[e,t]of Object.entries(hg)){let s=ct.join(this.contextDir,e);re.existsSync(s)&&re.writeFileSync(s,t,"utf-8")}}getDecisions(){let e=this.read("DECISIONS.md");if(!e)return[];let t=e.split(`
|
|
1080
1080
|
`),s=[];for(let r of t){let i=r.match(/^\|\s*(\d{4}-\d{2}-\d{2})\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|$/);i&&s.push({timestamp:i[1],decision:i[2].trim(),by:i[3].trim(),rationale:i[4].trim()})}return s}render(){let e=[];if(this.kvStore.size>0){e.push(" Key-Value Store:");for(let[r,i]of this.kvStore)e.push(` ${r}: ${i}`)}else e.push(" No key-value entries");let t=this.getAll();if(t.length>0){e.push(""),e.push(" Context Files:");for(let r of t){let i=r.content.split(`
|
|
1081
1081
|
`).length;e.push(` ${r.file} (${i} lines)`)}}let s=this.getDecisions();return s.length>0&&(e.push(""),e.push(` Decisions: ${s.length} logged`)),e.join(`
|
|
1082
1082
|
`)}persistKV(){if(this.kvStore.size===0)return;let e=this.read("CONTEXT.md")||mg,t=Array.from(this.kvStore.entries()).map(([i,o])=>`- **${i}**: ${o}`).join(`
|
|
1083
1083
|
`),s=/## Notes\n[\s\S]*$/,r=e.replace(s,`## Notes
|
|
1084
1084
|
${t}
|
|
1085
|
-
`);this.write("CONTEXT.md",r)}ensureDir(){
|
|
1085
|
+
`);this.write("CONTEXT.md",r)}ensureDir(){re.existsSync(this.contextDir)||re.mkdirSync(this.contextDir,{recursive:!0})}}});function Bl(n){return xe.find(e=>e.role===n)?.name||n}var xs,yg=L(()=>{"use strict";Ns();Hl();xs=class{channel;runner;chat;constructor(e,t,s,r){this.channel=e,this.runner=t,this.chat=s,this.runner.setChannel(e),this.chat.resetBudget()}async run(e,t,s,r={}){this.chat.setAbortSignal(r.abortSignal);let i=r.peerReview!==!1,o=new Dn(process.cwd());this.runner.setSharedContext(o),this.channel.emitEvent({type:"phase",agent:"System",content:"Delegating to the team"});let a=t.tasks.filter(h=>h.role!=="hablas").map(h=>({role:h.role,task:`${h.description}
|
|
1086
1086
|
|
|
1087
1087
|
Original request: ${e}`})),l=[],u="hablas",d=null;for(let h of a){if(r.abortSignal?.aborted)break;let m=xe.find($=>$.role===h.role);if(!m)continue;this.channel.emitEvent({type:"handoff",agent:Bl(u),to:m.name});let p=await this.chat.generateHandoffLine(u,h.role,h.task);this.channel.emitEvent({type:"speak",agent:Bl(u),to:m.name,content:p});let g=await this.chat.generateAckLine(h.role,u);this.channel.emitEvent({type:"speak",agent:m.name,to:Bl(u),content:g});let x=Date.now(),w=await this.runner.runAgent(h.role,h.task,void 0,s,{abortSignal:r.abortSignal});l.push(w),w.success&&w.output?(this.channel.emitEvent({type:"summary",agent:m.name,durationMs:Date.now()-x}),h.role==="alex"&&(d=w.output),i&&h.role==="alex"&&t.tasks.some($=>$.role==="bob")&&d&&await this.runPeerReview("bob","alex",d,r.abortSignal)):w.error&&this.channel.emitEvent({type:"error",agent:m.name,content:w.error}),u=h.role}this.channel.emitEvent({type:"phase",agent:"System",content:"Hablas compiling final report"});let f=await this.synthesize(e,l,s,r.abortSignal);return this.channel.emitEvent({type:"done",agent:"Hablas"}),f}async runPeerReview(e,t,s,r){let i=xe.find(u=>u.role===e),o=xe.find(u=>u.role===t);if(!i||!o)return;let a=await this.chat.generateReviewLine(e,t,s);this.channel.emitEvent({type:"review",agent:i.name,to:o.name,content:a});let l=await this.chat.generateReviewAck(t,e);this.channel.emitEvent({type:"speak",agent:o.name,to:i.name,content:l}),r?.aborted}async synthesize(e,t,s,r){let i=t.filter(d=>d.success&&d.output);if(i.length===0)return{results:t,finalSynthesis:"The team encountered errors and could not complete the task. Please review the logs and try again.",synthesisOk:!1};let o=i.map(d=>{let f=xe.find(h=>h.role===d.agent);return`### Report from @${d.agentName} (${f?.title??d.agent}):
|
|
1088
1088
|
${d.output}`}).join(`
|
|
@@ -1222,26 +1222,26 @@ ${d}`),o+=d.length}}}extractSection(e,t){let s=e.split(`
|
|
|
1222
1222
|
`).slice(0,100).join(`
|
|
1223
1223
|
`)+`
|
|
1224
1224
|
...(truncated)`,b=Math.ceil(v.length/4);u+b<=r&&(a.push({path:x,content:v,source:"imported",lineCount:100}),u+=b)}else u+A<=r&&(a.push({path:x,content:$,source:"imported",lineCount:y}),u+=A)}catch{}}}}}catch{}}}return{files:a,totalTokensEstimate:u,mentionedPaths:o}}function Rg(n){if(n.files.length===0)return"";let e=["## Referenced Files"];for(let t of n.files){let s=t.source==="imported"?" (imported)":"";e.push(`### ${t.path}${s} (${t.lineCount} lines)`),e.push("```"),e.push(t.content),e.push("```")}return e.join(`
|
|
1225
|
-
`)}var ft,Ee,$g,Cg,Eg,Og=L(()=>{"use strict";ft=O(require("fs")),Ee=O(require("path")),$g=/(?:^|\s|['"`])([.\w\-/\\]+\.(?:ts|js|tsx|jsx|py|go|rs|java|c|cpp|h|css|scss|html|vue|svelte|json|yaml|yml|toml|md|sql|sh|env|xml))\b/gi,Cg=/(?:import\s+.*?\s+from\s+['"]([^'"]+)['"]|require\s*\(\s*['"]([^'"]+)['"]\s*\))/g,Eg=/(?:from\s+(\S+)\s+import|import\s+(\S+))/g});var Mg={};Ne(Mg,{runSetupWizard:()=>Ul});function ve(n,e){return new Promise(t=>{n.question(e,s=>t(s))})}function v0(){return["nvapi-","qJRIIcL3SbN6s91CK-","gk2DtzlHbUnaYvGJk","AoIohOTcABSY5lll","Kdwfj_fO_b55h"].join("")}async function Ul(n){let e=Pg.createInterface({input:process.stdin,output:process.stdout});switch(console.log(),console.log(`${ht}${be} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${P}`),console.log(`${ht}${be} hablas \u2014 Setup Wizard${P}`),console.log(`${q} Configure your AI provider and model${P}`),console.log(`${ht}${be} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${P}`),console.log(),console.log(`${ht} Choose your setup:${P}`),console.log(),console.log(` ${b0}${ht}1${P}. ${ht}Hablas Integrated Engine${P} ${pt}(instant \u2014 no setup needed)${P}`),console.log(` ${q}Pre-configured cloud AI, ready to use immediately${P}`),console.log(),console.log(` ${be}${ht}2${P}. ${ht}Custom Provider${P} ${q}(bring your own API key)${P}`),console.log(` ${q}Choose from Ollama, OpenAI, Groq, OpenRouter, and more${P}`),console.log(),(await ve(e,` ${q}Your choice (1-2):${P} `)).trim()){case"1":{n.provider=Wt.provider,n.apiUrl=Wt.apiUrl,n.apiKey=v0(),n.model=Wt.model,wt(n),tt({name:Wt.name,apiUrl:Wt.apiUrl,apiKey:n.apiKey,models:["stepfun-ai/step-3.7-flash","nvidia/llama-3.3-70b-instruct","deepseek-ai/deepseek-r1"],defaultModel:Wt.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Hablas Integrated Engine activated!${P}`),console.log(`${q} Model: ${Wt.model}${P}`),console.log(`${q} API: ${Wt.apiUrl}${P}`),console.log(`${q} No API key needed \u2014 everything is pre-configured.${P}`);break}case"2":{switch(console.log(),console.log(`${q} Select your provider:${P}`),console.log(` ${be}a${P}. Ollama (local, free, private)`),console.log(` ${be}b${P}. OpenAI API`),console.log(` ${be}c${P}. Groq (fast, free tier)`),console.log(` ${be}d${P}. OpenRouter (many models)`),console.log(` ${be}e${P}. Together AI`),console.log(` ${be}f${P}. DeepSeek`),console.log(` ${be}g${P}. Custom OpenAI-compatible API`),console.log(` ${be}h${P}. NVIDIA NIM (powerful cloud models)`),console.log(),(await ve(e,` ${q}Your choice (a-h):${P} `)).trim().toLowerCase()){case"a":{n.provider="ollama";let r=await ve(e,` ${q}Ollama host [http://localhost:11434]:${P} `);r.trim()&&(n.ollamaHost=r.trim());let i=await ve(e,` ${q}Model [qwen2.5-coder:7b]:${P} `);i.trim()&&(n.model=i.trim()),wt(n),console.log(),console.log(`${pt} \u2713 Configured for Ollama${P}`),console.log(`${q} Model: ${n.model}${P}`),console.log(`${q} Host: ${n.ollamaHost}${P}`),console.log(`${q} Make sure Ollama is running: ollama serve${P}`);break}case"b":{let r=await ve(e,` ${q}OpenAI API Key (sk-...):${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`);break}let i=await ve(e,` ${q}Model [gpt-4o]:${P} `);n.provider="custom",n.apiUrl="https://api.openai.com/v1",n.apiKey=r.trim(),n.model=i.trim()||"gpt-4o",wt(n),tt({name:"OpenAI",apiUrl:"https://api.openai.com/v1",apiKey:r.trim(),models:["gpt-4o","gpt-4o-mini","gpt-4-turbo","o1","o3-mini"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for OpenAI${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"c":{let r=await ve(e,` ${q}Groq API Key (gsk_...):${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`);break}let i=await ve(e,` ${q}Model [llama-3.3-70b-versatile]:${P} `);n.provider="custom",n.apiUrl="https://api.groq.com/openai/v1",n.apiKey=r.trim(),n.model=i.trim()||"llama-3.3-70b-versatile",wt(n),tt({name:"Groq",apiUrl:"https://api.groq.com/openai/v1",apiKey:r.trim(),models:["llama-3.3-70b-versatile","llama-3.1-70b-versatile","mixtral-8x7b-32768","gemma2-9b-it"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for Groq${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"d":{let r=await ve(e,` ${q}OpenRouter API Key (sk-or-...):${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`);break}let i=await ve(e,` ${q}Model [anthropic/claude-3.5-sonnet]:${P} `);n.provider="custom",n.apiUrl="https://openrouter.ai/api/v1",n.apiKey=r.trim(),n.model=i.trim()||"anthropic/claude-3.5-sonnet",wt(n),tt({name:"OpenRouter",apiUrl:"https://openrouter.ai/api/v1",apiKey:r.trim(),models:["openai/gpt-4o","anthropic/claude-3.5-sonnet","google/gemini-2.0-flash-001","deepseek/deepseek-r1"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for OpenRouter${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"e":{let r=await ve(e,` ${q}Together API Key:${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`);break}let i=await ve(e,` ${q}Model [meta-llama/Llama-3.3-70B-Instruct-Turbo]:${P} `);n.provider="custom",n.apiUrl="https://api.together.xyz/v1",n.apiKey=r.trim(),n.model=i.trim()||"meta-llama/Llama-3.3-70B-Instruct-Turbo",wt(n),tt({name:"Together",apiUrl:"https://api.together.xyz/v1",apiKey:r.trim(),models:["meta-llama/Llama-3.3-70B-Instruct-Turbo","Qwen/Qwen2.5-72B-Instruct-Turbo","deepseek-ai/DeepSeek-R1"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for Together AI${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"f":{let r=await ve(e,` ${q}DeepSeek API Key:${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`);break}let i=await ve(e,` ${q}Model [deepseek-chat]:${P} `);n.provider="custom",n.apiUrl="https://api.deepseek.com/v1",n.apiKey=r.trim(),n.model=i.trim()||"deepseek-chat",wt(n),tt({name:"DeepSeek",apiUrl:"https://api.deepseek.com/v1",apiKey:r.trim(),models:["deepseek-chat","deepseek-coder","deepseek-reasoner"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for DeepSeek${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"g":{let r=await ve(e,` ${q}Provider name:${P} `);if(!r.trim()){console.log(`${kt} \u26A0 Cancelled${P}`);break}let i=await ve(e,` ${q}API base URL:${P} `);if(!i.trim()){console.log(`${kt} \u26A0 URL is required \u2014 cancelled${P}`);break}let o=await ve(e,` ${q}API Key (leave empty if none):${P} `),a=await ve(e,` ${q}Default model ID:${P} `);n.provider="custom",n.apiUrl=i.trim(),n.apiKey=o.trim(),n.model=a.trim()||"default",wt(n),tt({name:r.trim(),apiUrl:i.trim(),apiKey:o.trim(),models:[n.model],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for ${r.trim()}${P}`),console.log(`${q} URL: ${i.trim()}${P}`),console.log(`${q} Model: ${n.model}${P}`);break}case"h":{let r=await ve(e,` ${q}NVIDIA API Key (nvapi-...):${P} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${P}`),console.log(`${q} Get your key at: https://build.nvidia.com/${P}`);break}let{NVIDIA_PROVIDER:i}=await Promise.resolve().then(()=>(Nn(),dc));console.log(),console.log(`${q} Available NVIDIA models:${P}`),i.models.forEach((u,d)=>{console.log(` ${be}${d+1}${P}. ${u}`)}),console.log();let o=await ve(e,` ${q}Model number [1]:${P} `),a=parseInt(o.trim())-1,l=i.models[a]||i.defaultModel;n.provider="nvidia",n.apiUrl=i.apiUrl,n.apiKey=r.trim(),n.model=l,wt(n),tt({name:"NVIDIA",apiUrl:i.apiUrl,apiKey:r.trim(),models:i.models,defaultModel:l,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for NVIDIA NIM${P}`),console.log(`${q} Model: ${l}${P}`),console.log(`${q} API: ${i.apiUrl}${P}`);break}default:console.log(`${kt} \u26A0 Invalid choice${P}`)}break}default:console.log(`${kt} \u26A0 Invalid choice \u2014 please select 1 or 2${P}`)}console.log(),console.log(`${ht}${pt} \u2713 Setup complete!${P}`),console.log(),console.log(`${ht} Launch the base command, then choose mode *inside*:${P}`),console.log(),console.log(` ${be}hablas${P} \u2192 Interactive REPL (starts in BUILD mode)`),console.log(` ${be}hablas --auto${P} \u2192 Same, with auto-confirm for tools`),console.log(),console.log(" Inside the REPL you will see:"),console.log(` ${ht}CURRENT MODE: BUILD${P} \u2014 Full Multi-Agent Team at Maximum Power`),console.log(" (Hablas + Bob + Alex + David + Emma + rich theatre)"),console.log(),console.log(` Switch modes inside with: ${be}/mode design${P} or ${be}/mode ask${P}`),console.log(" Or use one-shot from terminal:"),console.log(` ${be}hablas build "your serious task"${P} (full team, recommended)`),console.log(` ${be}hablas design "blueprint / PRD"${P}`),console.log(` ${be}hablas ask "quick question"${P}`),console.log(),console.log(`${q} You are always in a mode. Default = BUILD (full team). No work without mode.${P}`),console.log(),e.close()}var Pg,be,pt,kt,q,ht,P,b0,Wt,Kl=L(()=>{"use strict";Pg=O(require("readline"));yr();gi();be="\x1B[36m",pt="\x1B[32m",kt="\x1B[33m",q="\x1B[2m",ht="\x1B[1m",P="\x1B[0m",b0="\x1B[35m";Wt={provider:"nvidia",apiUrl:"https://integrate.api.nvidia.com/v1",model:"stepfun-ai/step-3.7-flash",name:"Hablas Integrated Engine"}});var rt={};Ne(rt,{activeCollabManager:()=>Re,runFullTeamCommand:()=>$0,runSingleCommand:()=>C0,startRepl:()=>Gl});function _0(){return!mt.existsSync(ql)}function Ig(){return mt.existsSync(w0)}function k0(){let n=Ft.dirname(ql);mt.existsSync(n)||mt.mkdirSync(n,{recursive:!0}),mt.writeFileSync(ql,new Date().toISOString(),"utf-8")}async function A0(n,e=10){let t=n.split(/(\s+)/);for(let s of t)process.stdout.write(s),await new Promise(r=>setTimeout(r,e))}async function Fg(n,e,t,s,r){let{interactive:i,autoMode:o,input:a,logger:l,abortSignal:u,onToolCall:d,skipTools:f}=r,h=r.reactEngine??ms(),m=r.errorRecovery??gs(),p=new Ge("Hablas is thinking");p.start();let g=$=>{p&&(p.stop($),p=null)},x=og({autoMode:o,interactive:i,confirm:a?$=>a.confirm($):void 0,confirmDangerous:a?$=>a.confirmDangerous($):void 0});await Br({identity:{name:"Hablas",title:"Team Leader",role:"hablas"},client:e,registry:t,session:n,contextManager:s,reactEngine:h,errorRecovery:m,logger:l,io:{onAssistantText:async $=>{g(),console.log(mn("Hablas","Team Leader")),await A0(gn($))},onToolStart:($,A)=>{g(),console.log(uu($,A)),p=new Ge("Continuing"),p.start()},onToolEnd:($,A,y,v)=>{g(),console.log(du(A,y,v))},onNotice:($,A)=>{g(),console.log(A==="retry"?c.muted(` \u21BB ${$}`):j($))},onError:$=>{g(),$.includes("ECONNREFUSED")?console.log(Be("Connection lost","Check your provider connection or run /provider test")):/timeout/i.test($)?console.log(Be("Request timed out (120s)","The API is slow. Try again or use a faster model.")):$.includes("429")?console.log(Be("Rate limited by API","Wait a moment and try again, or switch providers.")):$.includes("model")?console.log(Be("Model error","Check model availability: /models")):console.log(Be(`Error: ${$}`,"Try again or check /status"))},onToolCall:()=>{d&&d()}},safetyPolicy:x,abortSignal:u,skipTools:f,maxIterations:x0}),g()}async function Gl(n,e){Np();let t=n.workingDirectory==="."?process.cwd():n.workingDirectory,s=Z=>mt.existsSync(Ft.join(Z,".git"));if(!s(t)&&!n.team?.enabled)console.log(` ${c.warning("\u26A0")} ${c.secondary("Not in a Git repository. Versioning and auto-sync features are limited.")}
|
|
1225
|
+
`)}var ft,Ee,$g,Cg,Eg,Og=L(()=>{"use strict";ft=O(require("fs")),Ee=O(require("path")),$g=/(?:^|\s|['"`])([.\w\-/\\]+\.(?:ts|js|tsx|jsx|py|go|rs|java|c|cpp|h|css|scss|html|vue|svelte|json|yaml|yml|toml|md|sql|sh|env|xml))\b/gi,Cg=/(?:import\s+.*?\s+from\s+['"]([^'"]+)['"]|require\s*\(\s*['"]([^'"]+)['"]\s*\))/g,Eg=/(?:from\s+(\S+)\s+import|import\s+(\S+))/g});var Mg={};Ne(Mg,{runSetupWizard:()=>Ul});function we(n,e){return new Promise(t=>{n.question(e,s=>t(s))})}function v0(){return["nvapi-","qJRIIcL3SbN6s91CK-","gk2DtzlHbUnaYvGJk","AoIohOTcABSY5lll","Kdwfj_fO_b55h"].join("")}async function Ul(n){let e=Pg.createInterface({input:process.stdin,output:process.stdout});switch(console.log(),console.log(`${ht}${ve} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${M}`),console.log(`${ht}${ve} hablas \u2014 Setup Wizard${M}`),console.log(`${q} Configure your AI provider and model${M}`),console.log(`${ht}${ve} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${M}`),console.log(),console.log(`${ht} Choose your setup:${M}`),console.log(),console.log(` ${b0}${ht}1${M}. ${ht}Hablas Integrated Engine${M} ${pt}(instant \u2014 no setup needed)${M}`),console.log(` ${q}Pre-configured cloud AI, ready to use immediately${M}`),console.log(),console.log(` ${ve}${ht}2${M}. ${ht}Custom Provider${M} ${q}(bring your own API key)${M}`),console.log(` ${q}Choose from Ollama, OpenAI, Groq, OpenRouter, and more${M}`),console.log(),(await we(e,` ${q}Your choice (1-2):${M} `)).trim()){case"1":{n.provider=Wt.provider,n.apiUrl=Wt.apiUrl,n.apiKey=v0(),n.model=Wt.model,wt(n),tt({name:Wt.name,apiUrl:Wt.apiUrl,apiKey:n.apiKey,models:["stepfun-ai/step-3.7-flash","nvidia/llama-3.3-70b-instruct","deepseek-ai/deepseek-r1"],defaultModel:Wt.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Hablas Integrated Engine activated!${M}`),console.log(`${q} Model: ${Wt.model}${M}`),console.log(`${q} API: ${Wt.apiUrl}${M}`),console.log(`${q} No API key needed \u2014 everything is pre-configured.${M}`);break}case"2":{switch(console.log(),console.log(`${q} Select your provider:${M}`),console.log(` ${ve}a${M}. Ollama (local, free, private)`),console.log(` ${ve}b${M}. OpenAI API`),console.log(` ${ve}c${M}. Groq (fast, free tier)`),console.log(` ${ve}d${M}. OpenRouter (many models)`),console.log(` ${ve}e${M}. Together AI`),console.log(` ${ve}f${M}. DeepSeek`),console.log(` ${ve}g${M}. Custom OpenAI-compatible API`),console.log(` ${ve}h${M}. NVIDIA NIM (powerful cloud models)`),console.log(),(await we(e,` ${q}Your choice (a-h):${M} `)).trim().toLowerCase()){case"a":{n.provider="ollama";let r=await we(e,` ${q}Ollama host [http://localhost:11434]:${M} `);r.trim()&&(n.ollamaHost=r.trim());let i=await we(e,` ${q}Model [qwen2.5-coder:7b]:${M} `);i.trim()&&(n.model=i.trim()),wt(n),console.log(),console.log(`${pt} \u2713 Configured for Ollama${M}`),console.log(`${q} Model: ${n.model}${M}`),console.log(`${q} Host: ${n.ollamaHost}${M}`),console.log(`${q} Make sure Ollama is running: ollama serve${M}`);break}case"b":{let r=await we(e,` ${q}OpenAI API Key (sk-...):${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`);break}let i=await we(e,` ${q}Model [gpt-4o]:${M} `);n.provider="custom",n.apiUrl="https://api.openai.com/v1",n.apiKey=r.trim(),n.model=i.trim()||"gpt-4o",wt(n),tt({name:"OpenAI",apiUrl:"https://api.openai.com/v1",apiKey:r.trim(),models:["gpt-4o","gpt-4o-mini","gpt-4-turbo","o1","o3-mini"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for OpenAI${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"c":{let r=await we(e,` ${q}Groq API Key (gsk_...):${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`);break}let i=await we(e,` ${q}Model [llama-3.3-70b-versatile]:${M} `);n.provider="custom",n.apiUrl="https://api.groq.com/openai/v1",n.apiKey=r.trim(),n.model=i.trim()||"llama-3.3-70b-versatile",wt(n),tt({name:"Groq",apiUrl:"https://api.groq.com/openai/v1",apiKey:r.trim(),models:["llama-3.3-70b-versatile","llama-3.1-70b-versatile","mixtral-8x7b-32768","gemma2-9b-it"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for Groq${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"d":{let r=await we(e,` ${q}OpenRouter API Key (sk-or-...):${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`);break}let i=await we(e,` ${q}Model [anthropic/claude-3.5-sonnet]:${M} `);n.provider="custom",n.apiUrl="https://openrouter.ai/api/v1",n.apiKey=r.trim(),n.model=i.trim()||"anthropic/claude-3.5-sonnet",wt(n),tt({name:"OpenRouter",apiUrl:"https://openrouter.ai/api/v1",apiKey:r.trim(),models:["openai/gpt-4o","anthropic/claude-3.5-sonnet","google/gemini-2.0-flash-001","deepseek/deepseek-r1"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for OpenRouter${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"e":{let r=await we(e,` ${q}Together API Key:${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`);break}let i=await we(e,` ${q}Model [meta-llama/Llama-3.3-70B-Instruct-Turbo]:${M} `);n.provider="custom",n.apiUrl="https://api.together.xyz/v1",n.apiKey=r.trim(),n.model=i.trim()||"meta-llama/Llama-3.3-70B-Instruct-Turbo",wt(n),tt({name:"Together",apiUrl:"https://api.together.xyz/v1",apiKey:r.trim(),models:["meta-llama/Llama-3.3-70B-Instruct-Turbo","Qwen/Qwen2.5-72B-Instruct-Turbo","deepseek-ai/DeepSeek-R1"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for Together AI${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"f":{let r=await we(e,` ${q}DeepSeek API Key:${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`);break}let i=await we(e,` ${q}Model [deepseek-chat]:${M} `);n.provider="custom",n.apiUrl="https://api.deepseek.com/v1",n.apiKey=r.trim(),n.model=i.trim()||"deepseek-chat",wt(n),tt({name:"DeepSeek",apiUrl:"https://api.deepseek.com/v1",apiKey:r.trim(),models:["deepseek-chat","deepseek-coder","deepseek-reasoner"],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for DeepSeek${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"g":{let r=await we(e,` ${q}Provider name:${M} `);if(!r.trim()){console.log(`${kt} \u26A0 Cancelled${M}`);break}let i=await we(e,` ${q}API base URL:${M} `);if(!i.trim()){console.log(`${kt} \u26A0 URL is required \u2014 cancelled${M}`);break}let o=await we(e,` ${q}API Key (leave empty if none):${M} `),a=await we(e,` ${q}Default model ID:${M} `);n.provider="custom",n.apiUrl=i.trim(),n.apiKey=o.trim(),n.model=a.trim()||"default",wt(n),tt({name:r.trim(),apiUrl:i.trim(),apiKey:o.trim(),models:[n.model],defaultModel:n.model,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for ${r.trim()}${M}`),console.log(`${q} URL: ${i.trim()}${M}`),console.log(`${q} Model: ${n.model}${M}`);break}case"h":{let r=await we(e,` ${q}NVIDIA API Key (nvapi-...):${M} `);if(!r.trim()){console.log(`${kt} \u26A0 No key provided \u2014 cancelled${M}`),console.log(`${q} Get your key at: https://build.nvidia.com/${M}`);break}let{NVIDIA_PROVIDER:i}=await Promise.resolve().then(()=>(Nn(),dc));console.log(),console.log(`${q} Available NVIDIA models:${M}`),i.models.forEach((u,d)=>{console.log(` ${ve}${d+1}${M}. ${u}`)}),console.log();let o=await we(e,` ${q}Model number [1]:${M} `),a=parseInt(o.trim())-1,l=i.models[a]||i.defaultModel;n.provider="nvidia",n.apiUrl=i.apiUrl,n.apiKey=r.trim(),n.model=l,wt(n),tt({name:"NVIDIA",apiUrl:i.apiUrl,apiKey:r.trim(),models:i.models,defaultModel:l,addedAt:new Date().toISOString()}),console.log(),console.log(`${pt} \u2713 Configured for NVIDIA NIM${M}`),console.log(`${q} Model: ${l}${M}`),console.log(`${q} API: ${i.apiUrl}${M}`);break}default:console.log(`${kt} \u26A0 Invalid choice${M}`)}break}default:console.log(`${kt} \u26A0 Invalid choice \u2014 please select 1 or 2${M}`)}console.log(),console.log(`${ht}${pt} \u2713 Setup complete!${M}`),console.log(),console.log(`${ht} Launch the base command, then choose mode *inside*:${M}`),console.log(),console.log(` ${ve}hablas${M} \u2192 Interactive REPL (starts in BUILD mode)`),console.log(` ${ve}hablas --auto${M} \u2192 Same, with auto-confirm for tools`),console.log(),console.log(" Inside the REPL you will see:"),console.log(` ${ht}CURRENT MODE: BUILD${M} \u2014 Full Multi-Agent Team at Maximum Power`),console.log(" (Hablas + Bob + Alex + David + Emma + rich theatre)"),console.log(),console.log(` Switch modes inside with: ${ve}/mode design${M} or ${ve}/mode ask${M}`),console.log(" Or use one-shot from terminal:"),console.log(` ${ve}hablas build "your serious task"${M} (full team, recommended)`),console.log(` ${ve}hablas design "blueprint / PRD"${M}`),console.log(` ${ve}hablas ask "quick question"${M}`),console.log(),console.log(`${q} You are always in a mode. Default = BUILD (full team). No work without mode.${M}`),console.log(),e.close()}var Pg,ve,pt,kt,q,ht,M,b0,Wt,Kl=L(()=>{"use strict";Pg=O(require("readline"));yr();gi();ve="\x1B[36m",pt="\x1B[32m",kt="\x1B[33m",q="\x1B[2m",ht="\x1B[1m",M="\x1B[0m",b0="\x1B[35m";Wt={provider:"nvidia",apiUrl:"https://integrate.api.nvidia.com/v1",model:"stepfun-ai/step-3.7-flash",name:"Hablas Integrated Engine"}});var rt={};Ne(rt,{activeCollabManager:()=>Re,runFullTeamCommand:()=>$0,runSingleCommand:()=>C0,startRepl:()=>Gl});function _0(){return!mt.existsSync(ql)}function Ig(){return mt.existsSync(w0)}function k0(){let n=Ft.dirname(ql);mt.existsSync(n)||mt.mkdirSync(n,{recursive:!0}),mt.writeFileSync(ql,new Date().toISOString(),"utf-8")}async function A0(n,e=10){let t=n.split(/(\s+)/);for(let s of t)process.stdout.write(s),await new Promise(r=>setTimeout(r,e))}async function Fg(n,e,t,s,r){let{interactive:i,autoMode:o,input:a,logger:l,abortSignal:u,onToolCall:d,skipTools:f}=r,h=r.reactEngine??ms(),m=r.errorRecovery??gs(),p=new Ge("Hablas is thinking");p.start();let g=$=>{p&&(p.stop($),p=null)},x=og({autoMode:o,interactive:i,confirm:a?$=>a.confirm($):void 0,confirmDangerous:a?$=>a.confirmDangerous($):void 0});await Br({identity:{name:"Hablas",title:"Team Leader",role:"hablas"},client:e,registry:t,session:n,contextManager:s,reactEngine:h,errorRecovery:m,logger:l,io:{onAssistantText:async $=>{g(),console.log(mn("Hablas","Team Leader")),await A0(gn($))},onToolStart:($,A)=>{g(),console.log(uu($,A)),p=new Ge("Continuing"),p.start()},onToolEnd:($,A,y,v)=>{g(),console.log(du(A,y,v))},onNotice:($,A)=>{g(),console.log(A==="retry"?c.muted(` \u21BB ${$}`):j($))},onError:$=>{g(),$.includes("ECONNREFUSED")?console.log(Be("Connection lost","Check your provider connection or run /provider test")):/timeout/i.test($)?console.log(Be("Request timed out (120s)","The API is slow. Try again or use a faster model.")):$.includes("429")?console.log(Be("Rate limited by API","Wait a moment and try again, or switch providers.")):$.includes("model")?console.log(Be("Model error","Check model availability: /models")):console.log(Be(`Error: ${$}`,"Try again or check /status"))},onToolCall:()=>{d&&d()}},safetyPolicy:x,abortSignal:u,skipTools:f,maxIterations:x0}),g()}async function Gl(n,e){Np();let t=n.workingDirectory==="."?process.cwd():n.workingDirectory,s=Z=>mt.existsSync(Ft.join(Z,".git"));if(!s(t)&&!n.team?.enabled)console.log(` ${c.warning("\u26A0")} ${c.secondary("Not in a Git repository. Versioning and auto-sync features are limited.")}
|
|
1226
1226
|
`);else if(n.team?.enabled&&!s(t)){console.log(`
|
|
1227
1227
|
${c.accent("\u2726")} ${c.strong("Team Mode Strategy Required")}`),console.log(` ${c.muted("Collaboration requires a stable Git repository root.")}
|
|
1228
|
-
`);let
|
|
1229
|
-
`)}catch{console.log(
|
|
1230
|
-
`)):(console.log(
|
|
1231
|
-
`)}let w=new Vr(t);f.init();let $=null;n.context?.hablasCoreEnabled&&($=new Wr(t),$.init());let A=await bn(t,n),y=l.getActive(),v=y?y.systemPrompt:Wn,b=vn(v,A,d,f),S=ms({thinkingEnabled:!0,selfEvalEnabled:!0,showThinking:!1,maxSteps:150,minConfidence:.6}),_=gs(3),T=new nn(b,n.historySize),I=Bn();I=Ii(I),dn(I);let C=0,F=0,H=Date.now(),W=n.autoMode||!1,E=0,k=new AbortController;process.on("SIGINT",()=>{let Z=Date.now();if(Z-E<S0){console.log(Yi({turns:C,duration:Date.now()-H,toolCalls:F}));let
|
|
1232
|
-
`),console.log(j("Operation cancelled \u2014 press Ctrl+C again to exit"))});let
|
|
1228
|
+
`);let te=await new ls(t).prompt(` ${c.primary("\u203A")} Specify repo path OR type 'init' to start here: `);if(te.trim().toLowerCase()==="init")try{(0,Lg.execSync)("git init",{cwd:t,stdio:"ignore"}),console.log(` ${c.success("\u2713")} Git repository initialized in ${c.highlight(t)}
|
|
1229
|
+
`)}catch{console.log(ke("Failed to initialize Git. Please run git init manually.")),process.exit(1)}else{let Q=Ft.resolve(t,te.trim());mt.existsSync(Q)&&s(Q)?(t=Q,n.workingDirectory=t,console.log(` ${c.success("\u2713")} Context switched to repository: ${c.highlight(t)}
|
|
1230
|
+
`)):(console.log(ke(`Path "${Q}" is not a valid Git repository.`)),process.exit(1))}}let r=Me(n),i=new En(t,n),o=new tn(n),a=new ls(t),l=br(),u=new vr,d=new us(t),f=new Dn(t),h=new qr,m=new bs(n);m.setToolRegistry(i);let p=new vs,g=new _s(p).attach(),x=new ws(n,{tokenBudget:500,maxChars:140});if(m.setChannel(p),n.team?.enabled){let Z=n.team.user||"developer",te=n.team.key||"default-key";Re=new rs(t,n,Z,te),await Re.init()&&console.log(` ${c.success("\u2713")} ${c.muted("[Team]")} Scoped cooperative sync initialized successfully.
|
|
1231
|
+
`)}let w=new Vr(t);f.init();let $=null;n.context?.hablasCoreEnabled&&($=new Wr(t),$.init());let A=await bn(t,n),y=l.getActive(),v=y?y.systemPrompt:Wn,b=vn(v,A,d,f),S=ms({thinkingEnabled:!0,selfEvalEnabled:!0,showThinking:!1,maxSteps:150,minConfidence:.6}),_=gs(3),T=new nn(b,n.historySize),I=Bn();I=Ii(I),dn(I);let C=0,F=0,H=Date.now(),W=n.autoMode||!1,E=0,k=new AbortController;process.on("SIGINT",()=>{let Z=Date.now();if(Z-E<S0){console.log(Yi({turns:C,duration:Date.now()-H,toolCalls:F}));let te=Re?Re.shutdown():Promise.resolve();Promise.resolve(te).finally(()=>process.exit(0)),setTimeout(()=>process.exit(0),2e3);return}E=Z,k.abort(),k=new AbortController,process.stdout.write(`
|
|
1232
|
+
`),console.log(j("Operation cancelled \u2014 press Ctrl+C again to exit"))});let J=Rs(n);if(console.log(ru(n.model,t)),n.provider==="custom"&&console.log(he(`Provider: ${J}`)),W&&console.log(he("Auto mode enabled \u2014 tool confirmations skipped (plan approval still required)")),(_0()||!Ig())&&(console.log(au()),console.log(""),console.log(he("First run detected \u2014 launching setup wizard...")),console.log(""),a.close(),await Ul(n),k0(),r=Me(n),a.reinitialize()),Ig()){let Z=new Ge("Connecting");Z.start();let te=await r.checkConnection();if(Z.stop(te?"ready":void 0),te){let Q=await r.listModels();console.log(Y(`Connected \xB7 ${Q.length} models available`)),n.provider==="ollama"&&!Q.includes(n.model)&&console.log(j(`Model "${n.model}" not found. Pull: ollama pull ${n.model}`))}else n.provider==="custom"?console.log(Be(`Cannot connect to ${n.apiUrl}`,"Check your --api-url and --api-key, or run /provider test")):n.provider==="nvidia"?console.log(Be("Cannot connect to NVIDIA NIM","Check your API key or run: hablas --setup")):console.log(Be("Cannot connect to Ollama","Start it with: ollama serve \u2014 or switch provider: /provider"))}console.log(iu()),console.log(),console.log(` ${c.accent("\u2605")} ${c.strong("CURRENT MODE: BUILD")} \u2014 Full Multi-Agent Team at Maximum Power`),console.log(` ${c.muted("Hablas + Bob + Alex + David + Emma \u2022 rich live theatre \u2022 no classifier")}`),console.log(` ${c.muted('Switch inside: /mode design or /mode ask | One-shot: hablas build "..."')}`),console.log();let K=!0;for(;K;)try{let te=(await a.prompt(` ${c.primary("\u203A")} `)).trim();if(!te)continue;if(te.startsWith("/")){if(await Fu(te,n,r,i,o,T,t,a,C,l,u,d,ue=>{r=ue},f,h,w,m)==="quit"){K=!1;break}continue}e.info({input:te},"Processing user input");let Q=Ec(te),ce=Ng(Q,t);if(C++,console.log(fu(C)),I=Di(I),dn(I),!W){let U=Sg(ce);if(U){console.log(gu(U));let ue=await a.prompt(` ${c.muted("\u203A")} `),Pe=_g(ue,U);ce=`${ce}
|
|
1233
1233
|
[Clarification: ${Pe.join(", ")}]`}}let Oe=Tg(ce,t,{maxFiles:8,maxTokens:6e3});if(Oe.files.length>0){let U=Rg(Oe);T.addUserMessage(`[Auto-loaded ${Oe.files.length} file(s): ${Oe.mentionedPaths.join(", ")}]
|
|
1234
|
-
${U}`,{priority:"low",tags:["auto-inject"]})}if(n.team?.enabled&&Re){let U=n.team?.user||Re.getLocalState().my_username,ue=Oe.mentionedPaths||[];if(ue.length>0){let Pe=await Re.fetchLocks(),D=ue.map(
|
|
1234
|
+
${U}`,{priority:"low",tags:["auto-inject"]})}if(n.team?.enabled&&Re){let U=n.team?.user||Re.getLocalState().my_username,ue=Oe.mentionedPaths||[];if(ue.length>0){let Pe=await Re.fetchLocks(),D=ue.map(G=>Pe.find(P=>P.file_path===G&&P.locked_by!==U)).filter(G=>!!G);if(D.length>0){let G=D[0];console.log(`
|
|
1235
1235
|
${c.architect("\u25C6")} ${c.strong("@Consul")} [Coordinator] detected an active lock held by a teammate.`),console.log(`
|
|
1236
|
-
${c.error("\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\u2550\u2550\u2550\u2550\u2550\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(` ${c.error("\u2551")} ${c.strong("\u{1F512} FILE LOCKED BY TEAMMATE")} ${c.error("\u2551")}`),console.log(` ${c.error("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563")}`),console.log(` ${c.error("\u2551")} File ${c.highlight(
|
|
1237
|
-
`);continue}for(let
|
|
1238
|
-
${c.warning("\u26A0")} ${c.strong("@Consul")}: a teammate locked ${c.highlight(
|
|
1239
|
-
`);continue}}Re.setActivity(ce.slice(0,80))}let Fe=U=>{let ue=U.trim().toLowerCase();return ue.length<12||["hi","hey","\u0627\u0647","ok","thanks","\u0634\u0643\u0631\u0627","yo","hello","\u0635\u0628\u0627\u062D","\u0645\u0633\u0627\u0621","how are","what's up","\u0643\u064A\u0641\u0643","\u062A\u0645\u0627\u0645","\u0627\u064A\u0647","\u0627\u0647","lol","haha"].some(
|
|
1236
|
+
${c.error("\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\u2550\u2550\u2550\u2550\u2550\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(` ${c.error("\u2551")} ${c.strong("\u{1F512} FILE LOCKED BY TEAMMATE")} ${c.error("\u2551")}`),console.log(` ${c.error("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563")}`),console.log(` ${c.error("\u2551")} File ${c.highlight(G.file_path.padEnd(44))} held by ${c.strong(`@${(G.locked_by||"").padEnd(12)}`)} ${c.error("\u2551")}`),console.log(` ${c.error("\u2551")} Context: ${c.muted((G.lock_context||"\u2014").slice(0,61).padEnd(61))} ${c.error("\u2551")}`),console.log(` ${c.error("\u2551")} @Consul halted this turn to prevent a Git conflict on the shared repo. ${c.error("\u2551")}`),console.log(` ${c.error("\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\u2550\u2550\u2550\u2550\u2550\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")}`);for(let P of D)await Re.sendMessage(P.locked_by,`@${U} needs to edit ${P.file_path}. Please release the lock when you can.`);console.log(` ${c.muted("@Consul notified the teammate(s). Try again once the lock is released, or coordinate directly.")}
|
|
1237
|
+
`);continue}for(let G of ue)if(!await Re.acquireLock(G,ce.slice(0,100))){console.log(`
|
|
1238
|
+
${c.warning("\u26A0")} ${c.strong("@Consul")}: a teammate locked ${c.highlight(G)} first. Halting to avoid a conflict.
|
|
1239
|
+
`);continue}}Re.setActivity(ce.slice(0,80))}let Fe=U=>{let ue=U.trim().toLowerCase();return ue.length<12||["hi","hey","\u0627\u0647","ok","thanks","\u0634\u0643\u0631\u0627","yo","hello","\u0635\u0628\u0627\u062D","\u0645\u0633\u0627\u0621","how are","what's up","\u0643\u064A\u0641\u0643","\u062A\u0645\u0627\u0645","\u0627\u064A\u0647","\u0627\u0647","lol","haha"].some(G=>ue.includes(G))?!0:!["build","create","fix","add","implement","design","make","write","update","remove","deploy","test","plan","generate","complete","setup"].some(G=>ue.includes(G))&&ue.length<40},ye=n.agents.enabled&&!Fe(ce);try{if(m&&n.agents.enabled){let U=`User input: "${ce}"
|
|
1240
1240
|
|
|
1241
|
-
Decide the professional routing for this engineering interaction.`,ue=await m.runAgent("gate",U,void 0,i.getOllamaTools(),{abortSignal:k?.signal});if(ue.success&&ue.output){let Pe=ue.output.toLowerCase();Pe.includes("mode: casual")||Pe.includes("casual")?
|
|
1241
|
+
Decide the professional routing for this engineering interaction.`,ue=await m.runAgent("gate",U,void 0,i.getOllamaTools(),{abortSignal:k?.signal});if(ue.success&&ue.output){let Pe=ue.output.toLowerCase();Pe.includes("mode: casual")||Pe.includes("casual")?ye=!1:(Pe.includes("mode: build")||Pe.includes("build")||Pe.includes("mode: design"))&&(ye=!0)}}}catch{}if(ye){console.log(`
|
|
1242
1242
|
${c.accent("\u2605")} ${c.strong("FULL TEAM ACTIVE")} \u2014 Hablas + Bob + Alex + David + Emma (rich theatre, max power, no classifier)
|
|
1243
|
-
`);let U=["hablas","bob","alex","david","emma"];for(let
|
|
1244
|
-
`+
|
|
1243
|
+
`);let U=["hablas","bob","alex","david","emma"];for(let ee of U)I=Fi(I,ee);dn(I),p.reset(),x.resetBudget();let ue={id:"build-"+Date.now(),description:ce.substring(0,100),tasks:[{role:"emma",description:"Analyze the request from product/requirements perspective and clarify if needed."},{role:"bob",description:"Provide architecture, design or structural guidance."},{role:"alex",description:"Execute the core implementation, coding or action based on the input."},{role:"david",description:"Research, data analysis or supporting information."}],strategy:"mixed",createdAt:new Date,approved:!0},Pe=i.getOllamaTools(),D=new xs(p,m,x,n),G=[],P="The team operation completed.",V=!1;try{let ee=await D.run(ce,ue,Pe,{abortSignal:k?.signal,peerReview:!0});G=ee.results||[],P=ee.finalSynthesis||P,V=!!ee.synthesisOk}catch(ee){let de=ee?.message||String(ee);de.includes("Aborted")||ee?.name==="AbortError"?(console.log(` ${c.warning("Operation aborted.")}`),P="Team operation was aborted. Provide more details or try a focused request."):(console.log(ke(`Team error: ${de}`)),P="The team encountered an error during execution. Please review logs and retry."),V=!1}console.log(mn("Hablas","Team Leader")),console.log(gn(P)),T.addAssistantMessage(V?P:`[Team Summary]
|
|
1244
|
+
`+P),await Dg(n,t);continue}else T.addUserMessage(ce);k=new AbortController,S.startTurn(),_.resetTurn(),await Fg(T,r,i,o,{interactive:!0,autoMode:W,input:a,logger:e,config:n,abortSignal:k.signal,reactEngine:S,errorRecovery:_,skipTools:!1,onToolCall:()=>{F++,I=Li(I,"tool_call"),dn(I)}}),await Dg(n,t)}catch(Z){if(Z.code==="ERR_USE_AFTER_CLOSE")break;if(Z.name==="AbortError")continue;console.log(ke(Z.message)),e.error(Z,"REPL error")}a.close(),Re&&await Re.shutdown(),console.log(Yi({turns:C,duration:Date.now()-H,toolCalls:F}))}async function $0(n,e,t,s="build"){let r=e.workingDirectory==="."?process.cwd():e.workingDirectory;e.agents.enabled=!0;let i=Me(e),o=new En(r,e),a=new bs(e);a.setToolRegistry(o);let l=new vs,u=new _s(l).attach(),d=new ws(e,{tokenBudget:500,maxChars:140});a.setChannel(l),l.onEvent(w=>{w.type==="phase"?console.log(`
|
|
1245
1245
|
${c.accent("\u25C6")} ${c.strong(w.content)}`):w.type==="handoff"?console.log(` ${c.muted("\u2605")} ${w.agent} \u2501\u2501\u25B6 ${w.to}`):w.type==="speak"?console.log(` ${c.primary(w.agent)}: ${w.content}`):w.type==="act"||w.type==="tool"?console.log(` ${c.warning("\u{1F527}")} [${w.agent}] ${w.content||w.toolName}`):w.type==="summary"||w.type==="observe"?console.log(` ${c.success("\u2713")} ${w.agent||""} ${w.content||""}`):w.type==="error"&&console.log(` ${c.error("\u2717")} ${w.agent}: ${w.content}`)}),console.log(`
|
|
1246
1246
|
${c.accent("\u2605")} ${c.strong("FULL TEAM "+s.toUpperCase())} \u2014 ${e.model} (classification deleted, max power)`);let f={id:`${s}-`+Date.now(),description:n.substring(0,100),tasks:[{role:"emma",description:"Analyze the request from product/requirements perspective and clarify if needed."},{role:"bob",description:"Provide architecture, design or structural guidance."},{role:"alex",description:"Execute the core implementation, coding or action based on the input."},{role:"david",description:"Research, data analysis or supporting information."}],strategy:"mixed",createdAt:new Date,approved:!0},h=o.getOllamaTools(),m=new xs(l,a,d,e),{results:p,finalSynthesis:g,synthesisOk:x}=await m.run(n,f,h,{peerReview:!0});console.log(`
|
|
1247
1247
|
${mn("Hablas","Team Leader")}`),console.log(gn(g||"Team completed the task.")),console.log(`
|
|
@@ -1256,16 +1256,16 @@ ${mn("Hablas","Team Leader")}`),console.log(gn(g||"Team completed the task.")),c
|
|
|
1256
1256
|
`),s("git add -A"),s('git commit -m "sync(team): automatic updates via @Consul" --no-verify');return}console.log(`
|
|
1257
1257
|
${c.success("\u{1F4C1}")} ${c.muted("[Git]")} ${c.strong("@Consul")} committing & pushing to ${c.highlight(i)} \u2192 ${c.muted(o)} ...`),s("git add -A"),s('git commit -m "sync(team): automatic updates via @Consul" --no-verify');try{s(`git push origin ${i}`)}catch{s(`git push --set-upstream origin ${i}`)}console.log(` ${c.success("\u2713")} ${c.strong("@Consul")}: "Pushed to ${i}. Teammates can pull the latest."
|
|
1258
1258
|
`)}catch(r){let i=r.stderr||r.message||"unknown error",o=/authentication|permission|denied|403|401/i.test(i)?"Check your Git credentials / token for this remote.":/non-fast-forward|rejected|behind/i.test(i)?"Remote has newer commits \u2014 pull/rebase first, then push.":"Resolve the issue and push manually.";console.log(` ${c.warning("\u26A0")} ${c.strong("@Consul")}: auto-push failed. ${c.muted(o)}
|
|
1259
|
-
`)}}var mt,Lg,Ft,Wl,Re,ql,w0,x0,S0,Ve=L(()=>{"use strict";Nu();ia();mt=O(require("fs")),Lg=require("child_process"),Ft=O(require("path")),Wl=O(require("os"));jn();Pp();fa();pa();Lp();yr();Fa();jp();Up();yi();ug();fg();pg();yg();bg();Un();Hl();vg();wg();kg();yn();Ag();Og();Kl();Ml();Dl();jl();Re=null,ql=Ft.join(Wl.homedir(),".hablas",".first_run_done"),w0=Ft.join(Wl.homedir(),".hablas","config.json"),x0=150,S0=1500});function et(n){let e=zl.join(jg.homedir(),".hablas","logs");Yr.existsSync(e)||Yr.mkdirSync(e,{recursive:!0});let t=zl.join(e,`session-${Date.now()}.log`);return(0,Vl.default)({level:"info"},Vl.default.destination({dest:t,sync:!1}))}var Vl,zl,jg,Yr,Yl=L(()=>{"use strict";Vl=O(Ol()),zl=O(require("path")),jg=O(require("os")),Yr=O(require("fs"))});var qg={};Ne(qg,{createApiServer:()=>Kg,startApiServer:()=>O0});function E0(){try{return JSON.parse(Bg.readFileSync(Ug.resolve(__dirname,"..","..","package.json"),"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}function Kg(n){let e=et(n),t=R0(n);return Hg.createServer(async(r,i)=>{if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),i.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),i.setHeader("Content-Type","application/json"),r.method==="OPTIONS"){i.writeHead(204),i.end();return}if(n.api.apiKey&&(r.headers.authorization||"").replace("Bearer ","")!==n.api.apiKey){i.writeHead(401),i.end(JSON.stringify({error:"Unauthorized",message:"Invalid API key"}));return}let o={};if(r.method==="POST"||r.method==="PUT")try{let l=[];for await(let d of r)l.push(d);let u=Buffer.concat(l).toString();u&&(o=JSON.parse(u))}catch{i.writeHead(400),i.end(JSON.stringify({error:"Bad Request",message:"Invalid JSON body"}));return}let a=t.find(l=>l.method===r.method&&r.url?.startsWith(l.path));if(!a){i.writeHead(404),i.end(JSON.stringify({error:"Not Found",message:`No route for ${r.method} ${r.url}`}));return}try{let l={method:r.method||"GET",path:r.url||"/",body:o,headers:r.headers},u=await a.handler(l);i.writeHead(u.status),i.end(JSON.stringify(u.body))}catch(l){e.error({err:l},"API error"),i.writeHead(500),i.end(JSON.stringify({error:"Internal Server Error",message:String(l)}))}})}function R0(n){return[{method:"GET",path:"/api/v1/health",handler:async()=>({status:200,body:{status:"ok",version:T0,uptime:process.uptime()}})},{method:"GET",path:"/api/v1/agents",handler:async()=>({status:200,body:{agents:[{name:"coder",description:"Code generation and modification",status:"available"},{name:"reviewer",description:"Code review and quality analysis",status:"available"},{name:"architect",description:"System architecture design",status:"available"},{name:"devops",description:"Deployment and infrastructure",status:"available"},{name:"researcher",description:"Documentation and research",status:"available"},{name:"planner",description:"Task decomposition and planning",status:"available"},{name:"debugger",description:"Error analysis and fixing",status:"available"}]}})},{method:"GET",path:"/api/v1/models",handler:async()=>({status:200,body:{current:n.model,provider:n.provider,host:n.ollamaHost}})},{method:"POST",path:"/api/v1/chat",handler:async e=>{let{message:t,agent:s}=e.body;return t?{status:200,body:{response:`[${s||"coder"}] Received: ${t}`,agent:s||"coder",model:n.model}}:{status:400,body:{error:"message field is required"}}}},{method:"POST",path:"/api/v1/plan",handler:async e=>{let{task:t}=e.body;return t?{status:200,body:{plan:{task:t,steps:[{step:1,description:"Analyze requirements",agent:"researcher"},{step:2,description:"Design architecture",agent:"architect"},{step:3,description:"Implement code",agent:"coder"},{step:4,description:"Review and test",agent:"reviewer"}]}}}:{status:400,body:{error:"task field is required"}}}},{method:"POST",path:"/api/v1/execute",handler:async e=>{let{command:t}=e.body;return t?n.api.enabled?{status:200,body:{message:"Command queued for execution",command:t}}:{status:403,body:{error:"API execution not enabled"}}:{status:400,body:{error:"command field is required"}}}},{method:"GET",path:"/api/v1/stats",handler:async()=>({status:200,body:{sessions:0,messages:0,uptime:process.uptime(),model:n.model,provider:n.provider}})}]}function O0(n){return new Promise((e,t)=>{let s=Kg(n);s.on("error",t),s.listen(n.api.port,n.api.host,()=>{e(s)})})}var Hg,Bg,Ug,T0,Wg=L(()=>{"use strict";Hg=O(require("http")),Bg=O(require("fs")),Ug=O(require("path"));Yl();T0=E0()});var M0={};Ne(M0,{CLI_VERSION:()=>ks});module.exports=Zg(M0);var cc=O(lc(),1),{program:U0,createCommand:K0,createArgument:q0,createOption:W0,CommanderError:G0,InvalidArgumentError:V0,InvalidOptionArgumentError:z0,Command:uc,Argument:Y0,Option:J0,Help:X0}=cc.default;Ve();yr();Yl();var Gg=O(require("fs")),Vg=O(require("path"));function P0(){try{let n=Vg.resolve(__dirname,"..","package.json");return JSON.parse(Gg.readFileSync(n,"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}var ks=P0(),te=new uc;te.name("hablas").description(`hablas CLI v${ks} by Abdulmoin Hablas \u2014 Multi-agent AI development system. Local-first via Ollama, NVIDIA NIM, or any OpenAI-compatible API.`).version(ks).option("-m, --model <model>","Model to use").option("-p, --project <path>","Working directory").option("--host <url>","Ollama host URL").option("--provider <type>","LLM provider: ollama | custom | nvidia").option("--api-url <url>","Custom API base URL (OpenAI-compatible)").option("--api-key <key>","API key for custom/nvidia provider").option("--auto","Auto mode \u2014 skip all tool confirmations").option("--timeout <ms>","Request timeout in milliseconds","120000").option("--theme <name>","UI theme: dark | light | galaxy | ocean | forest").option("--dashboard","Launch TUI dashboard mode").option("--team","Enable hybrid cooperative sync mode with teammates").option("--user <name>","Teammate username for coordination").option("--team-key <password>","Teammate password/key for secure connection encryption").option("--setup","Run first-time setup wizard");te.command("build <task>").description("FULL BUILD: complete work with the full multi-agent team at MAXIMUM POWER (rich theatre, no classification). Always Hablas + Bob + Alex + David + Emma.").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0),e.timeout&&(t.timeout=parseInt(e.timeout,10));let s=et(t),{runFullTeamCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s,"build")});te.command("design <task>").description("Design/Architecture mode: focused team (Emma + Bob + David + Hablas) with rich output for blueprints and requirements.").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0);let s=et(t),{runFullTeamCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s,"design")});te.command("ask <question>").description("Quick solo ask (minimal team, fast response, no full theatre).").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0);let s=et(t),{runSingleCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s)});te.command("create <description>").description("Generate a full project from a description (uses full team)").option("--stack <stack>","Tech stack preference").option("--with-tests","Include test generation").option("--with-docker","Include Docker setup").action(async(n,e)=>{let t=te.opts(),s=Te({model:t.model,host:t.host,project:t.project,provider:t.provider,apiUrl:t.apiUrl,apiKey:t.apiKey});t.auto&&(s.autoMode=!0);let r=et(s),{runFullTeamCommand:i}=await Promise.resolve().then(()=>(Ve(),rt)),o=`Generate a complete project: ${n}${e.stack?` using ${e.stack}`:""}${e.withTests?" with comprehensive tests":""}${e.withDocker?" with Docker setup":""}. Create all necessary files.`;await i(o,s,r,"build")});te.command("commit").description("Generate a smart commit message from staged changes").action(async()=>{let n=te.opts(),e=Te({model:n.model,host:n.host,project:n.project,provider:n.provider,apiUrl:n.apiUrl,apiKey:n.apiKey}),t=et(e),{getGitStatus:s,getDetailedDiff:r,generateCommitPrompt:i}=await Promise.resolve().then(()=>(pn(),Kn)),o=e.workingDirectory||process.cwd(),a=await s(o);if(!a||a.staged.length===0){console.log(" \u26A0 No staged changes. Use `git add` first.");return}let l=await r(o),u=i(l,a.staged),{runSingleCommand:d}=await Promise.resolve().then(()=>(Ve(),rt));await d(u,e,t)});te.command("pr").description("Generate a PR description from branch commits").option("--base <branch>","Base branch","main").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),s=et(t),{getGitStatus:r,getRecentCommits:i,generatePRPrompt:o}=await Promise.resolve().then(()=>(pn(),Kn)),a=t.workingDirectory||process.cwd(),l=await r(a),u=await i(a,20),d=o(u,n.base,l?.branch||"feature"),{runSingleCommand:f}=await Promise.resolve().then(()=>(Ve(),rt));await f(d,t,s)});te.command("changelog").description("Generate changelog from recent commits").option("--version <ver>","Version number",ks).option("-n, --count <n>","Number of commits to include","30").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),s=et(t),{getRecentCommits:r,generateChangelogPrompt:i}=await Promise.resolve().then(()=>(pn(),Kn)),o=t.workingDirectory||process.cwd(),a=await r(o,parseInt(n.count)),l=i(a,n.version),{runSingleCommand:u}=await Promise.resolve().then(()=>(Ve(),rt));await u(l,t,s)});te.command("security").description("Run security scan on the project").option("--fix","Auto-fix issues where possible").action(async n=>{let e=te.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),{runSecurityScan:s,formatScanResults:r}=await Promise.resolve().then(()=>(Bi(),Uc)),i=t.workingDirectory||process.cwd();console.log(`
|
|
1259
|
+
`)}}var mt,Lg,Ft,Wl,Re,ql,w0,x0,S0,Ve=L(()=>{"use strict";Nu();ia();mt=O(require("fs")),Lg=require("child_process"),Ft=O(require("path")),Wl=O(require("os"));jn();Pp();fa();pa();Lp();yr();Fa();jp();Up();yi();ug();fg();pg();yg();bg();Un();Hl();vg();wg();kg();yn();Ag();Og();Kl();Ml();Dl();jl();Re=null,ql=Ft.join(Wl.homedir(),".hablas",".first_run_done"),w0=Ft.join(Wl.homedir(),".hablas","config.json"),x0=150,S0=1500});function et(n){let e=zl.join(jg.homedir(),".hablas","logs");Yr.existsSync(e)||Yr.mkdirSync(e,{recursive:!0});let t=zl.join(e,`session-${Date.now()}.log`);return(0,Vl.default)({level:"info"},Vl.default.destination({dest:t,sync:!1}))}var Vl,zl,jg,Yr,Yl=L(()=>{"use strict";Vl=O(Ol()),zl=O(require("path")),jg=O(require("os")),Yr=O(require("fs"))});var qg={};Ne(qg,{createApiServer:()=>Kg,startApiServer:()=>O0});function E0(){try{return JSON.parse(Bg.readFileSync(Ug.resolve(__dirname,"..","..","package.json"),"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}function Kg(n){let e=et(n),t=R0(n);return Hg.createServer(async(r,i)=>{if(i.setHeader("Access-Control-Allow-Origin","*"),i.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),i.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),i.setHeader("Content-Type","application/json"),r.method==="OPTIONS"){i.writeHead(204),i.end();return}if(n.api.apiKey&&(r.headers.authorization||"").replace("Bearer ","")!==n.api.apiKey){i.writeHead(401),i.end(JSON.stringify({error:"Unauthorized",message:"Invalid API key"}));return}let o={};if(r.method==="POST"||r.method==="PUT")try{let l=[];for await(let d of r)l.push(d);let u=Buffer.concat(l).toString();u&&(o=JSON.parse(u))}catch{i.writeHead(400),i.end(JSON.stringify({error:"Bad Request",message:"Invalid JSON body"}));return}let a=t.find(l=>l.method===r.method&&r.url?.startsWith(l.path));if(!a){i.writeHead(404),i.end(JSON.stringify({error:"Not Found",message:`No route for ${r.method} ${r.url}`}));return}try{let l={method:r.method||"GET",path:r.url||"/",body:o,headers:r.headers},u=await a.handler(l);i.writeHead(u.status),i.end(JSON.stringify(u.body))}catch(l){e.error({err:l},"API error"),i.writeHead(500),i.end(JSON.stringify({error:"Internal Server Error",message:String(l)}))}})}function R0(n){return[{method:"GET",path:"/api/v1/health",handler:async()=>({status:200,body:{status:"ok",version:T0,uptime:process.uptime()}})},{method:"GET",path:"/api/v1/agents",handler:async()=>({status:200,body:{agents:[{name:"coder",description:"Code generation and modification",status:"available"},{name:"reviewer",description:"Code review and quality analysis",status:"available"},{name:"architect",description:"System architecture design",status:"available"},{name:"devops",description:"Deployment and infrastructure",status:"available"},{name:"researcher",description:"Documentation and research",status:"available"},{name:"planner",description:"Task decomposition and planning",status:"available"},{name:"debugger",description:"Error analysis and fixing",status:"available"}]}})},{method:"GET",path:"/api/v1/models",handler:async()=>({status:200,body:{current:n.model,provider:n.provider,host:n.ollamaHost}})},{method:"POST",path:"/api/v1/chat",handler:async e=>{let{message:t,agent:s}=e.body;return t?{status:200,body:{response:`[${s||"coder"}] Received: ${t}`,agent:s||"coder",model:n.model}}:{status:400,body:{error:"message field is required"}}}},{method:"POST",path:"/api/v1/plan",handler:async e=>{let{task:t}=e.body;return t?{status:200,body:{plan:{task:t,steps:[{step:1,description:"Analyze requirements",agent:"researcher"},{step:2,description:"Design architecture",agent:"architect"},{step:3,description:"Implement code",agent:"coder"},{step:4,description:"Review and test",agent:"reviewer"}]}}}:{status:400,body:{error:"task field is required"}}}},{method:"POST",path:"/api/v1/execute",handler:async e=>{let{command:t}=e.body;return t?n.api.enabled?{status:200,body:{message:"Command queued for execution",command:t}}:{status:403,body:{error:"API execution not enabled"}}:{status:400,body:{error:"command field is required"}}}},{method:"GET",path:"/api/v1/stats",handler:async()=>({status:200,body:{sessions:0,messages:0,uptime:process.uptime(),model:n.model,provider:n.provider}})}]}function O0(n){return new Promise((e,t)=>{let s=Kg(n);s.on("error",t),s.listen(n.api.port,n.api.host,()=>{e(s)})})}var Hg,Bg,Ug,T0,Wg=L(()=>{"use strict";Hg=O(require("http")),Bg=O(require("fs")),Ug=O(require("path"));Yl();T0=E0()});var M0={};Ne(M0,{CLI_VERSION:()=>ks});module.exports=Zg(M0);var cc=O(lc(),1),{program:U0,createCommand:K0,createArgument:q0,createOption:W0,CommanderError:G0,InvalidArgumentError:V0,InvalidOptionArgumentError:z0,Command:uc,Argument:Y0,Option:J0,Help:X0}=cc.default;Ve();yr();Yl();var Gg=O(require("fs")),Vg=O(require("path"));function P0(){try{let n=Vg.resolve(__dirname,"..","package.json");return JSON.parse(Gg.readFileSync(n,"utf-8")).version||"0.0.0"}catch{return"0.0.0"}}var ks=P0(),ne=new uc;ne.name("hablas").description(`hablas CLI v${ks} by Abdulmoin Hablas \u2014 Multi-agent AI development system. Local-first via Ollama, NVIDIA NIM, or any OpenAI-compatible API.`).version(ks).option("-m, --model <model>","Model to use").option("-p, --project <path>","Working directory").option("--host <url>","Ollama host URL").option("--provider <type>","LLM provider: ollama | custom | nvidia").option("--api-url <url>","Custom API base URL (OpenAI-compatible)").option("--api-key <key>","API key for custom/nvidia provider").option("--auto","Auto mode \u2014 skip all tool confirmations").option("--timeout <ms>","Request timeout in milliseconds","120000").option("--theme <name>","UI theme: dark | light | galaxy | ocean | forest").option("--dashboard","Launch TUI dashboard mode").option("--team","Enable hybrid cooperative sync mode with teammates").option("--user <name>","Teammate username for coordination").option("--team-key <password>","Teammate password/key for secure connection encryption").option("--setup","Run first-time setup wizard");ne.command("build <task>").description("FULL BUILD: complete work with the full multi-agent team at MAXIMUM POWER (rich theatre, no classification). Always Hablas + Bob + Alex + David + Emma.").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0),e.timeout&&(t.timeout=parseInt(e.timeout,10));let s=et(t),{runFullTeamCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s,"build")});ne.command("design <task>").description("Design/Architecture mode: focused team (Emma + Bob + David + Hablas) with rich output for blueprints and requirements.").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0);let s=et(t),{runFullTeamCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s,"design")});ne.command("ask <question>").description("Quick solo ask (minimal team, fast response, no full theatre).").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0);let s=et(t),{runSingleCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s)});ne.command("create <description>").description("Generate a full project from a description (uses full team)").option("--stack <stack>","Tech stack preference").option("--with-tests","Include test generation").option("--with-docker","Include Docker setup").action(async(n,e)=>{let t=ne.opts(),s=Te({model:t.model,host:t.host,project:t.project,provider:t.provider,apiUrl:t.apiUrl,apiKey:t.apiKey});t.auto&&(s.autoMode=!0);let r=et(s),{runFullTeamCommand:i}=await Promise.resolve().then(()=>(Ve(),rt)),o=`Generate a complete project: ${n}${e.stack?` using ${e.stack}`:""}${e.withTests?" with comprehensive tests":""}${e.withDocker?" with Docker setup":""}. Create all necessary files.`;await i(o,s,r,"build")});ne.command("commit").description("Generate a smart commit message from staged changes").action(async()=>{let n=ne.opts(),e=Te({model:n.model,host:n.host,project:n.project,provider:n.provider,apiUrl:n.apiUrl,apiKey:n.apiKey}),t=et(e),{getGitStatus:s,getDetailedDiff:r,generateCommitPrompt:i}=await Promise.resolve().then(()=>(pn(),Kn)),o=e.workingDirectory||process.cwd(),a=await s(o);if(!a||a.staged.length===0){console.log(" \u26A0 No staged changes. Use `git add` first.");return}let l=await r(o),u=i(l,a.staged),{runSingleCommand:d}=await Promise.resolve().then(()=>(Ve(),rt));await d(u,e,t)});ne.command("pr").description("Generate a PR description from branch commits").option("--base <branch>","Base branch","main").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),s=et(t),{getGitStatus:r,getRecentCommits:i,generatePRPrompt:o}=await Promise.resolve().then(()=>(pn(),Kn)),a=t.workingDirectory||process.cwd(),l=await r(a),u=await i(a,20),d=o(u,n.base,l?.branch||"feature"),{runSingleCommand:f}=await Promise.resolve().then(()=>(Ve(),rt));await f(d,t,s)});ne.command("changelog").description("Generate changelog from recent commits").option("--version <ver>","Version number",ks).option("-n, --count <n>","Number of commits to include","30").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),s=et(t),{getRecentCommits:r,generateChangelogPrompt:i}=await Promise.resolve().then(()=>(pn(),Kn)),o=t.workingDirectory||process.cwd(),a=await r(o,parseInt(n.count)),l=i(a,n.version),{runSingleCommand:u}=await Promise.resolve().then(()=>(Ve(),rt));await u(l,t,s)});ne.command("security").description("Run security scan on the project").option("--fix","Auto-fix issues where possible").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),{runSecurityScan:s,formatScanResults:r}=await Promise.resolve().then(()=>(Bi(),Uc)),i=t.workingDirectory||process.cwd();console.log(`
|
|
1260
1260
|
\u{1F512} Running security scan...
|
|
1261
|
-
`);let o=s(i);console.log(r(o))});
|
|
1261
|
+
`);let o=s(i);console.log(r(o))});ne.command("stats").description("Show developer analytics and usage statistics").action(async()=>{let{loadStats:n,formatStats:e}=await Promise.resolve().then(()=>(Un(),Ni)),t=n();console.log(e(t))});ne.command("team").description("Manage team configuration").option("--init <name>","Initialize team config").option("--add <email>","Add team member").option("--share","Share current session").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey}),{loadTeamConfig:s,initTeamConfig:r,addTeamMember:i,saveTeamConfig:o,formatTeamConfig:a}=await Promise.resolve().then(()=>(ia(),Uf)),l=t.workingDirectory||process.cwd();if(n.init)r(l,n.init),console.log(`
|
|
1262
1262
|
\u2713 Team "${n.init}" initialized.`),console.log(` Config saved to: .hablas/team.json
|
|
1263
|
-
`);else if(n.add){let u=s(l);if(!u){console.log(" \u26A0 No team config found. Run `hablas team --init <name>` first.");return}let d=i(u,n.add.split("@")[0],n.add);o(l,d),console.log(` \u2713 Added ${n.add} to team.`)}else{let u=s(l);if(!u){console.log(" No team config found. Run `hablas team --init <name>` to create one.");return}console.log(a(u))}});
|
|
1263
|
+
`);else if(n.add){let u=s(l);if(!u){console.log(" \u26A0 No team config found. Run `hablas team --init <name>` first.");return}let d=i(u,n.add.split("@")[0],n.add);o(l,d),console.log(` \u2713 Added ${n.add} to team.`)}else{let u=s(l);if(!u){console.log(" No team config found. Run `hablas team --init <name>` to create one.");return}console.log(a(u))}});ne.command("info").description("Show workspace information and detected configuration").action(async()=>{let n=ne.opts(),e=Te({model:n.model,host:n.host,project:n.project,provider:n.provider,apiUrl:n.apiUrl,apiKey:n.apiKey}),{scanWorkspace:t,formatWorkspaceInfo:s}=await Promise.resolve().then(()=>(qi(),Yc)),r=e.workingDirectory||process.cwd();console.log(`
|
|
1264
1264
|
\u25C6 Workspace Information
|
|
1265
|
-
`);let i=t(r);console.log(s(i)),console.log("")});
|
|
1265
|
+
`);let i=t(r);console.log(s(i)),console.log("")});ne.command("api").description("Start the REST API server").option("--port <port>","Port number","8080").option("--key <key>","API key for authentication").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});t.api.enabled=!0,t.api.port=parseInt(n.port),n.key&&(t.api.apiKey=n.key);let{startApiServer:s}=await Promise.resolve().then(()=>(Wg(),qg));console.log(`
|
|
1266
1266
|
\u25C6 Hablas API Server v${ks}`),console.log(" \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(` Starting on port ${t.api.port}...`);try{await s(t),console.log(` \u2713 API server running at http://${t.api.host}:${t.api.port}`),console.log(" Endpoints:"),console.log(" GET /api/v1/health \u2014 Health check"),console.log(" GET /api/v1/agents \u2014 List agents"),console.log(" GET /api/v1/models \u2014 List models"),console.log(" POST /api/v1/chat \u2014 Send message"),console.log(" POST /api/v1/plan \u2014 Generate plan"),console.log(" POST /api/v1/execute \u2014 Execute command"),console.log(" GET /api/v1/stats \u2014 Usage stats"),console.log(`
|
|
1267
1267
|
Press Ctrl+C to stop.
|
|
1268
|
-
`)}catch(r){console.error(` \u2717 Failed to start API server: ${r}`)}});
|
|
1268
|
+
`)}catch(r){console.error(` \u2717 Failed to start API server: ${r}`)}});ne.command("run <prompt>").description("Run a single command non-interactively (solo Hablas path)").action(async n=>{let e=ne.opts(),t=Te({model:e.model,host:e.host,project:e.project,provider:e.provider,apiUrl:e.apiUrl,apiKey:e.apiKey});e.auto&&(t.autoMode=!0),e.timeout&&(t.timeout=parseInt(e.timeout,10));let s=et(t),{runSingleCommand:r}=await Promise.resolve().then(()=>(Ve(),rt));await r(n,t,s)});ne.command("doctor").description("Run system diagnostics").action(async()=>{let n=ne.opts(),e=Te({model:n.model,host:n.host,project:n.project,provider:n.provider,apiUrl:n.apiUrl,apiKey:n.apiKey}),{runDiagnostics:t,renderDiagnostics:s}=await Promise.resolve().then(()=>(Ci(),Dc)),r=await t({ollamaHost:e.ollamaHost,model:e.model,provider:e.provider,apiUrl:e.apiUrl});console.log(s(r))});ne.command("plugins").description("Manage plugins").option("--enable <name>","Enable a plugin").option("--disable <name>","Disable a plugin").option("--search <query>","Search plugin marketplace").option("--install <name>","Install a plugin from marketplace").action(async n=>{let{enablePlugin:e,disablePlugin:t,renderPlugins:s,ensurePluginsDir:r}=await Promise.resolve().then(()=>(_i(),Pc));r(),n.enable?(e(n.enable),console.log(` \u2713 Plugin "${n.enable}" enabled`)):n.disable?(t(n.disable),console.log(` \u26A0 Plugin "${n.disable}" disabled`)):n.search?(console.log(`
|
|
1269
1269
|
\u{1F50D} Searching marketplace for "${n.search}"...`),console.log(" (Marketplace: https://registry.hablas.dev/plugins)"),console.log(`
|
|
1270
1270
|
Available plugins:`),console.log(" hablas-docker \u2014 Docker integration"),console.log(" hablas-aws \u2014 AWS toolkit"),console.log(" hablas-firebase \u2014 Firebase integration"),console.log(" hablas-supabase \u2014 Supabase toolkit"),console.log(" hablas-stripe \u2014 Stripe payment integration"),console.log(`
|
|
1271
1271
|
Install: hablas plugins --install <name>
|
|
@@ -1275,7 +1275,7 @@ ${mn("Hablas","Team Leader")}`),console.log(gn(g||"Team completed the task.")),c
|
|
|
1275
1275
|
\u25C6 Installed Plugins
|
|
1276
1276
|
`),console.log(s()),console.log(`
|
|
1277
1277
|
Plugins directory: ~/.hablas/plugins/`),console.log(" Search: hablas plugins --search <query>"),console.log(" Install: hablas plugins --install <name>"),console.log(" Enable: hablas plugins --enable <name>"),console.log(` Disable: hablas plugins --disable <name>
|
|
1278
|
-
`))});
|
|
1278
|
+
`))});ne.action(async()=>{let n=ne.opts(),e=Te({model:n.model,host:n.host,project:n.project,provider:n.provider,apiUrl:n.apiUrl,apiKey:n.apiKey,team:n.team,user:n.user,teamKey:n.teamKey});if(n.auto&&(e.autoMode=!0),n.timeout&&(e.timeout=parseInt(n.timeout,10)),n.theme&&(e.ui.theme=n.theme),n.dashboard&&(e.ui.dashboard=!0),n.setup){let{runSetupWizard:s}=await Promise.resolve().then(()=>(Kl(),Mg));await s(e);return}let t=et(e);await Gl(e,t)});ne.parse();0&&(module.exports={CLI_VERSION});
|
|
1279
1279
|
/*! Bundled license information:
|
|
1280
1280
|
|
|
1281
1281
|
normalize-path/index.js:
|