agentica 0.12.14 → 0.12.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +3 -3
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"../../node_modules/.pnpm/typia@8.0.
|
|
2
|
+
let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js":function(e,t,r){"use strict";t._assertGuard=void 0;let i=r("../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs");t._assertGuard=(e,t,r)=>{if(!0===e){if(r)throw r(t);throw new i.TypeGuardError(t)}return!1}},"../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js":function(e,t){"use strict";t._isFormatDateTime=void 0,t._isFormatDateTime=e=>r.test(e);let r=/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i},child_process:function(e){"use strict";e.exports=require("child_process")},events:function(e){"use strict";e.exports=require("events")},fs:function(e){"use strict";e.exports=require("fs")},path:function(e){"use strict";e.exports=require("path")},process:function(e){"use strict";e.exports=require("process")},prettier:function(e){"use strict";e.exports=import("prettier")},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/index.js":function(e,t,r){let{Argument:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js"),{Command:s}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/command.js"),{CommanderError:n,InvalidArgumentError:o}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js"),{Help:a}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js"),{Option:l}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js");(t=e.exports=new s).program=t,t.Argument=i,t.Command=s,t.CommanderError=n,t.Help=a,t.InvalidArgumentError=o,t.InvalidOptionArgumentError=o,t.Option=l},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js":function(e,t,r){let{InvalidArgumentError:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js");t.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){let t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/command.js":function(e,t,r){let i=r("events").EventEmitter,s=r("child_process"),n=r("path"),o=r("fs"),a=r("process"),{Argument:l,humanReadableArgName:p}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js"),{CommanderError:c}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js"),{Help:h}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js"),{Option:u,splitOptionFlags:m,DualOptions:d}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js"),{suggestSimilar:_}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/suggestSimilar.js");class g extends i{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],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:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,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}command(e,t,r){let i=t,s=r;"object"==typeof i&&null!==i&&(s=i,i=null),s=s||{};let[,n,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(n);return(i&&(a.description(i),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,o&&a.arguments(o),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),i)?this:a}createCommand(e){return new g(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
3
3
|
- specify the name in Command constructor or using .name()`);return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){let s=this.createArgument(e,t);return"function"==typeof r?s.default(i).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this._args.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return!1===e?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof e&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
4
4
|
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if("commander.executeSubCommandAsync"!==e.code)throw e},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new c(e,t,r)),a.exit(e)}action(e){return this._actionHandler=t=>{let r=this._args.length,i=t.slice(0,r);return this._storeOptionsAsProperties?i[r]=this:i[r]=this.opts(),i.push(this),e.apply(this,i)},this}createOption(e,t){return new u(e,t)}addOption(e){let t=e.name(),r=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(r,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(r,e.defaultValue,"default");this.options.push(e);let i=(t,i,s)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);let n=this.getOptionValue(r);if(null!==t&&e.parseArg)try{t=e.parseArg(t,n)}catch(e){if("commander.invalidArgument"===e.code){let t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}else null!==t&&e.variadic&&(t=e._concatValue(t,n));null==t&&(t=!e.negate&&(!!e.isBoolean()||!!e.optional||"")),this.setOptionValueWithSource(r,t,s)};return this.on("option:"+t,t=>{let r=`error: option '${e.flags}' argument '${t}' is invalid.`;i(t,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{let r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;i(t,r,"env")}),this}_optionEx(e,t,r,i,s){if("object"==typeof t&&t instanceof u)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let n=this.createOption(t,r);if(n.makeOptionMandatory(!!e.mandatory),"function"==typeof i)n.default(s).argParser(i);else if(i instanceof RegExp){let e=i;i=(t,r)=>{let i=e.exec(t);return i?i[0]:r},n.default(s).argParser(i)}else n.default(i);return this.addOption(n)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:!0},e,t,r,i)}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){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return v(this).forEach(r=>{void 0!==r.getOptionValueSource(e)&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){let r;if(void 0!==e&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");switch(t=t||{},void 0===e&&(e=a.argv,a.versions&&a.versions.electron&&(t.from="electron")),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){let r;t=t.slice();let i=!1,l=[".js",".ts",".tsx",".mjs",".cjs"];function p(e,t){let r=n.resolve(e,t);if(o.existsSync(r))return r;if(l.includes(n.extname(t)))return;let i=l.find(e=>o.existsSync(`${r}${e}`));if(i)return`${r}${i}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let h=e._executableFile||`${this._name}-${e._name}`,u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=n.resolve(n.dirname(e),u)}if(u){let t=p(u,h);if(!t&&!e._executableFile&&this._scriptPath){let r=n.basename(this._scriptPath,n.extname(this._scriptPath));r!==this._name&&(t=p(u,`${r}-${e._name}`))}h=t||h}i=l.includes(n.extname(h)),"win32"!==a.platform?i?(t.unshift(h),t=b(a.execArgv).concat(t),r=s.spawn(a.argv[0],t,{stdio:"inherit"})):r=s.spawn(h,t,{stdio:"inherit"}):(t.unshift(h),t=b(a.execArgv).concat(t),r=s.spawn(a.execPath,t,{stdio:"inherit"})),r.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===r.killed&&null===r.exitCode&&r.kill(e)})});let m=this._exitCallback;m?r.on("close",()=>{m(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):r.on("close",a.exit.bind(a)),r.on("error",t=>{if("ENOENT"===t.code){let t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";throw Error(`'${h}' does not exist
|
|
5
5
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -12,7 +12,7 @@ Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,e=>{let
|
|
|
12
12
|
`)}),this}}function f(e,t){e._hasHelpOption&&t.find(t=>t===e._helpLongFlag||t===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function b(e){return e.map(e=>{let t,r;if(!e.startsWith("--inspect"))return e;let i="127.0.0.1",s="9229";return(null!==(r=e.match(/^(--inspect(-brk)?)$/))?t=r[1]:null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=r[1],/^\d+$/.test(r[3])?s=r[3]:i=r[3]):null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=r[1],i=r[3],s=r[4]),t&&"0"!==s)?`${t}=${i}:${parseInt(s)+1}`:e})}function v(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}t.Command=g},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js":function(e,t){class r extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=r,t.InvalidArgumentError=class extends r{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js":function(e,t,r){let{humanReadableArgName:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js");t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden);if(e._hasImplicitHelpCommand()){let[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(r).helpOption(!1);s.description(e._helpCommandDescription),i&&s.arguments(i),t.push(s)}return this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let r=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let s;s=r?i?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let e=r.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return(e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(e=>e.description))?e._args:[]}subcommandTerm(e){let t=e._args.map(e=>i(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,r)=>Math.max(e,t.subcommandTerm(r).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,r)=>Math.max(e,t.optionTerm(r).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,r)=>Math.max(e,t.optionTerm(r).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,r)=>Math.max(e,t.argumentTerm(r).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let t=e.parent;t;t=t.parent)r=t.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0)?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth||80;function s(e,s){if(s){let n=`${e.padEnd(r+2)}${s}`;return t.wrap(n,i-2,r+2)}return e}function n(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let o=[`Usage: ${t.commandUsage(e)}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.wrap(a,i,0),""]));let l=t.visibleArguments(e).map(e=>s(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(o=o.concat(["Arguments:",n(l),""]));let p=t.visibleOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));if(p.length>0&&(o=o.concat(["Options:",n(p),""])),this.showGlobalOptions){let r=t.visibleGlobalOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));r.length>0&&(o=o.concat(["Global Options:",n(r),""]))}let c=t.visibleCommands(e).map(e=>s(t.subcommandTerm(e),t.subcommandDescription(e)));return c.length>0&&(o=o.concat(["Commands:",n(c),""])),o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,i=40){let s=RegExp(`[\\n][ \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+`);if(e.match(s))return e;let n=t-r;if(n<i)return e;let o=e.slice(0,r),a=e.slice(r).replace("\r\n","\n"),l=" ".repeat(r),p=`\\s\u200B`,c=RegExp(`
|
|
13
13
|
|.{1,${n-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g");return o+(a.match(c)||[]).map((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd()).join("\n")}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js":function(e,t,r){let{InvalidArgumentError:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js");function s(e){let t,r;let i=e.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(t=i.shift()),r=i.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}t.Option=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 r=s(e);this.short=r.shortFlag,this.long=r.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"string"==typeof e&&(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)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.splitOptionFlags=s,t.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let i=this.negativeOptions.get(r).presetArg;return t.negate===((void 0!==i&&i)===e)}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/suggestSimilar.js":function(e,t){t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let i=[],s=3;return(t.forEach(t=>{if(t.length<=1)return;let r=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=t.length;e++)r[0][e]=e;for(let i=1;i<=t.length;i++)for(let s=1;s<=e.length;s++){let n=1;n=+(e[s-1]!==t[i-1]),r[s][i]=Math.min(r[s-1][i]+1,r[s][i-1]+1,r[s-1][i-1]+n),s>1&&i>1&&e[s-1]===t[i-2]&&e[s-2]===t[i-1]&&(r[s][i]=Math.min(r[s][i],r[s-2][i-2]+1))}return r[e.length][t.length]}(e,t),n=Math.max(e.length,t.length);(n-r)/n>.4&&(r<s?(s=r,i=[t]):r===s&&i.push(t))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1)?`
|
|
14
14
|
(Did you mean one of ${i.join(", ")}?)`:1===i.length?`
|
|
15
|
-
(Did you mean ${i[0]}?)`:""}},"../../node_modules/.pnpm/typia@8.0.
|
|
15
|
+
(Did you mean ${i[0]}?)`:""}},"../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs":function(e,t,r){"use strict";r.r(t),r.d(t,{TypeGuardError:()=>i});class i extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(e){super(e.message||`Error on ${e.method}(): invalid type${e.path?` on ${e.path}`:""}, expect to be ${e.expected}`);let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.method=e.method,this.path=e.path,this.expected=e.expected,this.value=e.value}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";let{program:e,createCommand:t,createArgument:r,createOption:i,CommanderError:s,InvalidArgumentError:n,InvalidOptionArgumentError:o,Command:a,Argument:l,Option:p,Help:c}=__webpack_require__("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/index.js");var h,u,m,d,_=__webpack_require__("../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js");let g=require("fs/promises");var f=__webpack_require__.n(g);let b=require("inquirer");var v=__webpack_require__.n(b),y=__webpack_require__("path"),O=__webpack_require__.n(y),w=__webpack_require__("child_process");!function(e){e.create=async e=>{let t={name:e.projectName,version:"0.0.1",description:"",scripts:{prepare:"ts-patch install",build:"tsc",dev:"ts-node src/index.ts",start:"node dist/index.js"}};await f().writeFile(O().join(e.projectPath,"package.json"),JSON.stringify(t,null,2)),console.log("✅ package.json created")},e.installPackage=e=>t=>{let r=t=>{switch(e){case"npm":return`npm install ${t}`;case"yarn":return`yarn add ${t}`;case"pnpm":return`pnpm add ${t}`;case"bun":return`bun add ${t}`;default:throw Error(`Unsupported package manager: ${e}`)}},i=t.services.map(e=>`@wrtnlabs/connector-${e}`);console.log("\uD83D\uDE80 Installing existing dependencies..."),(0,w.execSync)(`${e} install`,{cwd:t.projectPath,stdio:"inherit"}),i.forEach(e=>{console.log(`🚀 Installing ${e}...`),(0,w.execSync)(r(e),{cwd:t.projectPath,stdio:"inherit"})})}}(h||(h={}));let A=require("giget"),C=require("node:path");var x=__webpack_require__.n(C);let j=e=>e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("");!function(e){e.createAll=t=>{let r=e.create("import")({services:t.services}),i=e.create("connector")({services:t.services});return`
|
|
16
16
|
import { Agentica } from "@agentica/core";
|
|
17
17
|
import typia from "typia";
|
|
18
18
|
import dotenv from "dotenv";
|
|
@@ -39,7 +39,7 @@ export const agent = new Agentica({
|
|
|
39
39
|
application: typia.llm.application<${t}Service, "chatgpt">(),
|
|
40
40
|
execute: new ${t}Service(),
|
|
41
41
|
}`}).join(",\n"),r=e=>e.services.map(e=>`import { ${j(e)}Service } from "@wrtnlabs/connector-${e}";`).join("\n")}(u||(u={}));let k=require("node:util");function $(e){return(0,k.styleText)("blueBright",e)}function E(e){return(0,k.styleText)("redBright",e)}!function(e){e.execute=t=>{let r=e.PROJECT[t].runner;if(!r)throw Error(`Not supported project type: ${t}`);return r},e.PROJECT={standalone:{title:`Standalone ${$("Application")}`,key:"standalone",runner:async e=>t("standalone")(e)(async()=>{let t=x().join(e.projectPath,"src/index.ts"),r=await f().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},nodejs:{title:`NodeJS ${$("Agent Server")}`,key:"nodejs",runner:async e=>t("nodejs")(e)(async()=>{let t=x().join(e.projectPath,"src/index.ts"),r=await f().readFile(t,"utf-8").then(t=>0!==e.services.length?t.replace(/import { BbsArticleService }.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,"controllers: [/// INSERT CONTROLLER HERE],\n"):t);return{indexFilePath:t,indexFileContent:r}})},nestjs:{title:`NestJS ${$("Agent Server")}`,key:"nestjs",runner:async e=>t("nestjs")(e)(async()=>{let t=x().join(e.projectPath,"src/controllers/chat/ChatController.ts"),r=await f().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},react:{title:`React ${$("Client Application")}`,key:"react",runner:async t=>{await e.writeTemplate("react",t.projectName)}}};let t=t=>s=>async n=>{await e.writeTemplate(t,s.projectName);let o=u.create("import")({services:s.services}),a=u.create("connector")({services:s.services}),{indexFilePath:l,indexFileContent:p}=await n(),c=p.replace("/// INSERT IMPORT HERE",o).replace("/// INSERT CONTROLLER HERE",a);await r({filePath:l,taskName:"Agentica code",content:c}),await i(s)},r=async e=>{let t=await Promise.resolve().then(__webpack_require__.bind(__webpack_require__,"prettier")).then(t=>t.format(e.content,{parser:"typescript"})).catch(()=>e.content);await f().writeFile(e.filePath,t),console.log(`✅ ${e.taskName} created`)},i=async e=>{let t=`OPENAI_API_KEY=${e.openAIKey}
|
|
42
|
-
`;await f().writeFile(x().join(e.projectPath,".env"),t),console.log("✅ .env created")};e.writeTemplate=async(e,t)=>{await (0,A.downloadTemplate)(`github:wrtnlabs/agentica.template.${e}`,{dir:t}),console.log("✅ Template downloaded");let r=x().join(t,".github/dependabot.yml");await f().access(r).then(()=>!0).catch(()=>!1)&&await f().rm(r)}}(m||(m={}));var S=__webpack_require__("../../node_modules/.pnpm/typia@8.0.
|
|
42
|
+
`;await f().writeFile(x().join(e.projectPath,".env"),t),console.log("✅ .env created")};e.writeTemplate=async(e,t)=>{await (0,A.downloadTemplate)(`github:wrtnlabs/agentica.template.${e}`,{dir:t}),console.log("✅ Template downloaded");let r=x().join(t,".github/dependabot.yml");await f().access(r).then(()=>!0).catch(()=>!1)&&await f().rm(r)}}(m||(m={}));var S=__webpack_require__("../../node_modules/.pnpm/typia@8.0.0_@samchon+openapi@3.0.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js");let H=async()=>{try{let e=await fetch("https://registry.npmjs.org/-/v1/search?text=scope:@wrtnlabs&size=10000"),t=await e.json();return(()=>{let e;let t=e=>Array.isArray(e.objects)&&e.objects.every(e=>"object"==typeof e&&null!==e&&r(e))&&"number"==typeof e.total&&"string"==typeof e.time&&S._isFormatDateTime(e.time),r=e=>"object"==typeof e.package&&null!==e.package&&i(e.package),i=e=>"string"==typeof e.name,s=(t,r,i=!0)=>((Array.isArray(t.objects)||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&t.objects.every((t,s)=>("object"==typeof t&&null!==t||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+s+"]",expected:"__type",value:t},e))&&n(t,r+".objects["+s+"]",i)||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+s+"]",expected:"__type",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&("number"==typeof t.total||_._assertGuard(i,{method:"typia.assert",path:r+".total",expected:"number",value:t.total},e))&&("string"==typeof t.time&&(S._isFormatDateTime(t.time)||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'string & Format<"date-time">',value:t.time},e))||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'(string & Format<"date-time">)',value:t.time},e)),n=(t,r,i=!0)=>("object"==typeof t.package&&null!==t.package||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e))&&o(t.package,r+'["package"]',i)||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e),o=(t,r,i=!0)=>"string"==typeof t.name||_._assertGuard(i,{method:"typia.assert",path:r+".name",expected:"string",value:t.name},e),a=e=>"object"==typeof e&&null!==e&&t(e);return(t,r)=>(!1===a(t)&&(e=r,((t,r,i=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))&&s(t,r+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))(t,"$input",!0)),t)})()(t).objects.map(e=>e.package.name).filter(e=>"@wrtnlabs/connector-shared"!==e&&/^@wrtnlabs\/connector-(?:[a-z0-9-]+)+$/.test(e)).map(e=>{let t=e.replace("@wrtnlabs/connector-","");return{name:t.replace("-"," ").toUpperCase(),value:t}})}catch(e){return console.error("Error occurred while fetching package list:",e),[]}},T=e=>[{type:"list",name:"packageManager",message:"Package Manager",choices:["npm","pnpm",{name:`yarn (berry ${$("is not supported")})`,value:"yarn"},"bun"]},e.options.project?null:{type:"list",name:"projectType",message:"Project Type",choices:Object.values(m.PROJECT).map(e=>({name:e.title,value:e.key}))},0===e.services.length?null:{type:"checkbox",name:"services",message:"Embedded Controllers",choices:e.services,when:e=>"react"!==e.projectType},{type:"input",name:"openAIKey",message:"Please enter your OPENAI_API_KEY:"}].filter(e=>null!==e);!function(e){async function t({projectName:e,options:t}){var r;let i=O().join(process.cwd(),e);if(await f().access(O().join(process.cwd(),e)).then(()=>!0).catch(()=>!1)){console.error(`❌ Project ${E(e)} already exists`);return}let s=T({services:"react"===t.project?[]:(await H()).sort((e,t)=>e.name.localeCompare(t.name)),options:t}),n=await v().prompt(s),o={...n,...t.project?{projectType:t.project}:{},...n.services?{services:n.services}:{services:[]}},{packageManager:a,openAIKey:l,projectType:p,services:c}=(()=>{let e;let t=e=>Array.isArray(e.services)&&e.services.every(e=>"string"==typeof e)&&("nodejs"===e.projectType||"nestjs"===e.projectType||"react"===e.projectType||"standalone"===e.projectType)&&("npm"===e.packageManager||"yarn"===e.packageManager||"pnpm"===e.packageManager||"bun"===e.packageManager)&&"string"==typeof e.openAIKey,r=(t,r,i=!0)=>((Array.isArray(t.services)||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&t.services.every((t,s)=>"string"==typeof t||_._assertGuard(i,{method:"typia.assert",path:r+".services["+s+"]",expected:"string",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&("nodejs"===t.projectType||"nestjs"===t.projectType||"react"===t.projectType||"standalone"===t.projectType||_._assertGuard(i,{method:"typia.assert",path:r+".projectType",expected:'("nestjs" | "nodejs" | "react" | "standalone")',value:t.projectType},e))&&("npm"===t.packageManager||"yarn"===t.packageManager||"pnpm"===t.packageManager||"bun"===t.packageManager||_._assertGuard(i,{method:"typia.assert",path:r+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:t.packageManager},e))&&("string"==typeof t.openAIKey||_._assertGuard(i,{method:"typia.assert",path:r+".openAIKey",expected:"string",value:t.openAIKey},e)),i=e=>"object"==typeof e&&null!==e&&t(e);return(t,s)=>(!1===i(t)&&(e=s,((t,i,s=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))&&r(t,i+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))(t,"$input",!0)),t)})()(o);await m.execute(p)({projectName:e,projectPath:i,openAIKey:l,services:c}),process.chdir(i),console.log("\uD83D\uDCE6 Package installation in progress..."),h.installPackage(a)({projectPath:i,services:c}),console.log(`
|
|
43
43
|
🎉 Project ${e} created`),console.log(`
|
|
44
44
|
⚠️ ${(r="Note:",(0,k.styleText)("yellow",r))} Please implement constructor values for each controller generated in agent.ts or index.ts`)}e.execute=t}(d||(d={})),(async function(){let e=new a;e.command("start <directory>").description("Start a new project").option("-p, --project [nodejs|nestjs|react|standalone]","The project type").action(async(e,t)=>{if(!0===t.project){console.error(`
|
|
45
45
|
❌ The value of ${E("--project")} is required`);return}d.execute({projectName:e,options:t})}),console.log("--------------------------------"),console.log(` 🚀 Agentica ${$("Setup Wizard")}`),console.log("--------------------------------"),e.parse(process.argv)})().catch(e=>{console.error(e.message),process.exit(-1)})})();var __webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0});
|