agentica 0.12.9 → 0.12.12
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 +21 -8
- package/package.json +7 -6
package/bin/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
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.3_@samchon+openapi@3.1.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.3_@samchon+openapi@3.1.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.3_@samchon+openapi@3.1.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:n}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/command.js"),{CommanderError:o,InvalidArgumentError:s}=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 n).program=t,t.Argument=i,t.Command=n,t.CommanderError=o,t.Help=a,t.InvalidArgumentError=s,t.InvalidOptionArgumentError=s,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,n=r("child_process"),o=r("path"),s=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:d,DualOptions:m}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js"),{suggestSimilar:g}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/suggestSimilar.js");class _ 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,n=r;"object"==typeof i&&null!==i&&(n=i,i=null),n=n||{};let[,o,s]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(o);return(i&&(a.description(i),a._executableHandler=!0),n.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(n.noHelp||n.hidden),a._executableFile=n.executableFile||null,s&&a.arguments(s),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),i)?this:a}createCommand(e){return new _(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
|
+
- 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 n=this.createArgument(e,t);return"function"==typeof r?n.default(i).argParser(r):n.default(r),this.addArgument(n),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
|
+
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,n)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);let o=this.getOptionValue(r);if(null!==t&&e.parseArg)try{t=e.parseArg(t,o)}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,o));null==t&&(t=!e.negate&&(!!e.isBoolean()||!!e.optional||"")),this.setOptionValueWithSource(r,t,n)};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,n){if("object"==typeof t&&t instanceof u)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),"function"==typeof i)o.default(n).argParser(i);else if(i instanceof RegExp){let e=i;i=(t,r)=>{let i=e.exec(t);return i?i[0]:r},o.default(n).argParser(i)}else o.default(i);return this.addOption(o)}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 y(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=o.resolve(e,t);if(s.existsSync(r))return r;if(l.includes(o.extname(t)))return;let i=l.find(e=>s.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=s.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=o.resolve(o.dirname(e),u)}if(u){let t=p(u,h);if(!t&&!e._executableFile&&this._scriptPath){let r=o.basename(this._scriptPath,o.extname(this._scriptPath));r!==this._name&&(t=p(u,`${r}-${e._name}`))}h=t||h}i=l.includes(o.extname(h)),"win32"!==a.platform?i?(t.unshift(h),t=b(a.execArgv).concat(t),r=n.spawn(a.argv[0],t,{stdio:"inherit"})):r=n.spawn(h,t,{stdio:"inherit"}):(t.unshift(h),t=b(a.execArgv).concat(t),r=n.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 d=this._exitCallback;d?r.on("close",()=>{d(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
|
+
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
6
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
7
|
+
- ${t}`)}if("EACCES"===t.code)throw Error(`'${h}' not executable`);if(d){let e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,d(e)}else a.exit(1)}),this.runningCommand=r}_dispatchSubcommand(e,t,r){let i;let n=this._findCommand(e);return n||this.help({error:!0}),i=this._chainOrCallSubCommandHook(i,n,"preSubcommand"),i=this._chainOrCall(i,()=>{if(!n._executableHandler)return n._parseCommand(t,r);this._executeSubCommand(n,t.concat(r))})}_checkNumberOfArguments(){this._args.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),(!(this._args.length>0)||!this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,r)=>{let i=t;if(null!==t&&e.parseArg)try{i=e.parseArg(t,r)}catch(r){if("commander.invalidArgument"===r.code){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}return i};this._checkNumberOfArguments();let t=[];this._args.forEach((r,i)=>{let n=r.defaultValue;r.variadic?i<this.args.length?(n=this.args.slice(i),r.parseArg&&(n=n.reduce((t,i)=>e(r,i,t),r.defaultValue))):void 0===n&&(n=[]):i<this.args.length&&(n=this.args[i],r.parseArg&&(n=e(r,n,r.defaultValue))),t[i]=n}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return y(this).reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{i.push({hookedCommand:e,callback:t})})}),"postAction"===t&&i.reverse(),i.forEach(e=>{r=this._chainOrCall(r,()=>e.callback(e.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return void 0!==this._lifeCycleHooks[r]&&this._lifeCycleHooks[r].forEach(e=>{i=this._chainOrCall(i,()=>e(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return 1===e.length&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return f(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),f(this,r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},n=`command:${this.name()}`;if(this._actionHandler){let r;return i(),this._processArguments(),r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(n,e,t)})),r=this._chainOrCallHooks(r,"postAction")}if(this.parent&&this.parent.listenerCount(n))i(),this._processArguments(),this.parent.emit(n,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():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),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(){for(let e=this;e;e=e.parent)e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let r=e.find(e=>t.conflictsWith.includes(e.attributeName()));r&&this._conflictingOption(t,r)})}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){let t=[],r=[],i=t,n=e.slice();function o(e){return e.length>1&&"-"===e[0]}let s=null;for(;n.length;){let e=n.shift();if("--"===e){i===r&&i.push(e),i.push(...n);break}if(s&&!o(e)){this.emit(`option:${s.name()}`,e);continue}if(s=null,o(e)){let t=this._findOption(e);if(t){if(t.required){let e=n.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;n.length>0&&!o(n[0])&&(e=n.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);s=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){let t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),n.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){let t=e.indexOf("="),r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(o(e)&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===r.length){if(this._findCommand(e)){t.push(e),n.length>0&&r.push(...n);break}if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e),n.length>0&&t.push(...n);break}if(this._defaultCommandName){r.push(e),n.length>0&&r.push(...n);break}}if(this._passThroughOptions){i.push(e),n.length>0&&i.push(...n);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return y(this).reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
8
|
+
`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
9
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,n=r.code||"commander.error";this._exit(i,n,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new m(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(r=>void 0!==r.implied&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"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 r=e=>{let t=e.attributeName(),r=this.getOptionValue(t),i=this.options.find(e=>e.negate&&t===e.attributeName()),n=this.options.find(e=>!e.negate&&t===e.attributeName());return i&&(void 0===i.presetArg&&!1===r||void 0!==i.presetArg&&r===i.presetArg)?i:n||e},i=e=>{let t=r(e),i=t.attributeName();return"env"===this.getOptionValueSource(i)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},n=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(n,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],i=this;do{let e=i.createHelp().visibleOptions(i).filter(e=>e.long).map(e=>e.long);r=r.concat(e),i=i.parent}while(i&&!i._enablePositionalOptions);t=g(e,r)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this._args.length,r=this.parent?` for '${this.name()}'`:"",i=`error: too many arguments${r}. Expected ${t} argument${1===t?"":"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(e=>{r.push(e.name()),e.alias()&&r.push(e.alias())}),t=g(e,r)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
10
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;let e=this._args.map(e=>p(e));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=o.basename(e,o.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){let t;let r={error:!!(e=e||{}).error};return t=r.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),r.write=e.write||t,r.command=this,r}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);let r=this._getHelpContext(e);y(this).reverse().forEach(e=>e.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t&&"string"!=typeof(i=t(i))&&!Buffer.isBuffer(i))throw Error("outputHelp callback must return a string or a Buffer");r.write(i),this.emit(this._helpLongFlag),this.emit("afterHelp",r),y(this).forEach(e=>e.emit("afterAllHelp",r))}helpOption(e,t){if("boolean"==typeof e)return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let r=d(this._helpFlags);return this._helpShortFlag=r.shortFlag,this._helpLongFlag=r.longFlag,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
11
|
+
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,e=>{let r;(r="function"==typeof t?t({error:e.error,command:e.command}):t)&&e.write(`${r}
|
|
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",n="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])?n=r[3]:i=r[3]):null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=r[1],i=r[3],n=r[4]),t&&"0"!==n)?`${t}=${i}:${parseInt(n)+1}`:e})}function y(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}t.Command=_},"../../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(/([^ ]+) *(.*)/),n=e.createCommand(r).helpOption(!1);n.description(e._helpCommandDescription),i&&n.arguments(i),t.push(n)}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 n;n=r?i?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(n)}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 n(e,n){if(n){let o=`${e.padEnd(r+2)}${n}`;return t.wrap(o,i-2,r+2)}return e}function o(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${t.commandUsage(e)}`,""],a=t.commandDescription(e);a.length>0&&(s=s.concat([t.wrap(a,i,0),""]));let l=t.visibleArguments(e).map(e=>n(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(s=s.concat(["Arguments:",o(l),""]));let p=t.visibleOptions(e).map(e=>n(t.optionTerm(e),t.optionDescription(e)));if(p.length>0&&(s=s.concat(["Options:",o(p),""])),this.showGlobalOptions){let r=t.visibleGlobalOptions(e).map(e=>n(t.optionTerm(e),t.optionDescription(e)));r.length>0&&(s=s.concat(["Global Options:",o(r),""]))}let c=t.visibleCommands(e).map(e=>n(t.subcommandTerm(e),t.subcommandDescription(e)));return c.length>0&&(s=s.concat(["Commands:",o(c),""])),s.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 n=RegExp(`[\\n][ \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+`);if(e.match(n))return e;let o=t-r;if(o<i)return e;let s=e.slice(0,r),a=e.slice(r).replace("\r\n","\n"),l=" ".repeat(r),p=`\\s\u200B`,c=RegExp(`
|
|
13
|
+
|.{1,${o-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g");return s+(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 n(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=n(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=n,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=[],n=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 n=1;n<=e.length;n++){let o=1;o=+(e[n-1]!==t[i-1]),r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+o),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}(e,t),o=Math.max(e.length,t.length);(o-r)/o>.4&&(r<n?(n=r,i=[t]):r===n&&i.push(t))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1)?`
|
|
14
|
+
(Did you mean one of ${i.join(", ")}?)`:1===i.length?`
|
|
15
|
+
(Did you mean ${i[0]}?)`:""}},"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.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:n,InvalidArgumentError:o,InvalidOptionArgumentError:s,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,d,m,g,_=__webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js");let f=require("fs/promises");var b=__webpack_require__.n(f);let y=require("inquirer");var v=__webpack_require__.n(y),w=__webpack_require__("path"),O=__webpack_require__.n(w),x=__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 b().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=["openai","typia","dotenv","@agentica/core",...t.services.map(e=>`@wrtnlabs/connector-${e}`)];console.log("\uD83D\uDE80 Installing existing dependencies..."),(0,x.execSync)(`${e} install`,{cwd:t.projectPath,stdio:"inherit"}),i.forEach(e=>{console.log(`🚀 Installing ${e}...`),(0,x.execSync)(r(e),{cwd:t.projectPath,stdio:"inherit"})}),["ts-node","typescript","ts-patch"].forEach(e=>{console.log(`🚀 Installing ${e}...`),(0,x.execSync)(`${r(e)} -D`,{cwd:t.projectPath,stdio:"inherit"})})}}(h||(h={}));let k=require("giget"),C=require("node:path");var j=__webpack_require__.n(C);let A=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`
|
|
3
16
|
import { Agentica } from "@agentica/core";
|
|
4
17
|
import typia from "typia";
|
|
5
18
|
import dotenv from "dotenv";
|
|
@@ -17,15 +30,15 @@ export const agent = new Agentica({
|
|
|
17
30
|
model: "gpt-4o-mini",
|
|
18
31
|
},
|
|
19
32
|
controllers: [
|
|
20
|
-
${
|
|
33
|
+
${i}
|
|
21
34
|
],
|
|
22
35
|
});
|
|
23
|
-
`},e.create=e=>
|
|
36
|
+
`},e.create=e=>i=>{switch(e){case"import":return r(i);case"connector":return t(i)}};let t=e=>e.services.map(e=>{let t=A(e);return`{
|
|
24
37
|
name: "${t} Connector",
|
|
25
38
|
protocol: "class",
|
|
26
39
|
application: typia.llm.application<${t}Service, "chatgpt">(),
|
|
27
40
|
execute: new ${t}Service(),
|
|
28
|
-
}`}).join(",\n"),r=e=>e.services.map(e=>`import { ${
|
|
41
|
+
}`}).join(",\n"),r=e=>e.services.map(e=>`import { ${A(e)}Service } from "@wrtnlabs/connector-${e}";`).join("\n")}(u||(u={})),function(e){e.create=async e=>{await b().writeFile(O().join(e.projectPath,"tsconfig.json"),t),console.log("✅ tsconfig.json created")};let t=`{
|
|
29
42
|
"compilerOptions": {
|
|
30
43
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
31
44
|
/* Projects */
|
|
@@ -134,8 +147,8 @@ export const agent = new Agentica({
|
|
|
134
147
|
}
|
|
135
148
|
]
|
|
136
149
|
}
|
|
137
|
-
}`}(
|
|
138
|
-
`;await
|
|
150
|
+
}`}(d||(d={}));var S=__webpack_require__("fs"),E=__webpack_require__.n(S);let $=e=>{if(E().existsSync(e.projectPath))throw Error(`${O().basename(e.projectPath)} directory already exists.`);E().mkdirSync(e.projectPath)},T=require("node:util");function P(e){return(0,T.styleText)("blueBright",e)}function H(e){return(0,T.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 ${P("Application")}`,key:"standalone",runner:async e=>{$({projectPath:e.projectPath}),await Promise.all([h.create({projectName:e.projectName,projectPath:e.projectPath}),d.create({projectPath:e.projectPath})]),await b().mkdir(j().join(e.projectPath,"src"),{recursive:!1});let t=u.createAll({services:e.services});await r({filePath:j().join(e.projectPath,"src/index.ts"),taskName:"Agentica code",content:t}),await i(e)}},nodejs:{title:`NodeJS ${P("Agent Server")}`,key:"nodejs",runner:async e=>t("nodejs")(e)(async()=>{let t=j().join(e.projectPath,"src/index.ts"),r=await b().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 ${P("Agent Server")}`,key:"nestjs",runner:async e=>t("nestjs")(e)(async()=>{let t=j().join(e.projectPath,"src/controllers/chat/ChatController.ts"),r=await b().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},react:{title:`React ${P("Client Application")}`,key:"react",runner:async t=>{await e.writeTemplate("react",t.projectName)}}};let t=t=>n=>async o=>{await e.writeTemplate(t,n.projectName);let s=u.create("import")({services:n.services}),a=u.create("connector")({services:n.services}),{indexFilePath:l,indexFileContent:p}=await o(),c=p.replace("/// INSERT IMPORT HERE",s).replace("/// INSERT CONTROLLER HERE",a);await r({filePath:l,taskName:"Agentica code",content:c}),await i(n)},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 b().writeFile(e.filePath,t),console.log(`✅ ${e.taskName} created`)},i=async e=>{let t=`OPENAI_API_KEY=${e.openAIKey}
|
|
151
|
+
`;await b().writeFile(j().join(e.projectPath,".env"),t),console.log("✅ .env created")};e.writeTemplate=async(e,t)=>{await (0,k.downloadTemplate)(`github:wrtnlabs/agentica.template.${e}`,{dir:t}),console.log("✅ Template downloaded");let r=j().join(t,".github/dependabot.yml");await b().access(r).then(()=>!0).catch(()=>!1)&&await b().rm(r)}}(m||(m={}));var F=__webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js");let D=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&&F._isFormatDateTime(e.time),r=e=>"object"==typeof e.package&&null!==e.package&&i(e.package),i=e=>"string"==typeof e.name,n=(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,n)=>("object"==typeof t&&null!==t||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+n+"]",expected:"__type",value:t},e))&&o(t,r+".objects["+n+"]",i)||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+n+"]",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&&(F._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)),o=(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))&&s(t.package,r+'["package"]',i)||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e),s=(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))&&n(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),[]}},V=e=>[{type:"list",name:"packageManager",message:"Package Manager",choices:["npm","pnpm",{name:`yarn (berry ${P("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 b().access(O().join(process.cwd(),e)).then(()=>!0).catch(()=>!1)){console.error(`❌ Project ${H(e)} already exists`);return}let n=V({services:"react"===t.project?[]:(await D()).sort((e,t)=>e.name.localeCompare(t.name)),options:t}),o=await v().prompt(n),s={...o,...t.project?{projectType:t.project}:{},...o.services?{services:o.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,n)=>"string"==typeof t||_._assertGuard(i,{method:"typia.assert",path:r+".services["+n+"]",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,n)=>(!1===i(t)&&(e=n,((t,i,n=!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)})()(s);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(`
|
|
139
152
|
🎉 Project ${e} created`),console.log(`
|
|
140
|
-
⚠️ ${(
|
|
141
|
-
❌ The value of ${
|
|
153
|
+
⚠️ ${(r="Note:",(0,T.styleText)("yellow",r))} Please implement constructor values for each controller generated in agent.ts or index.ts`)}e.execute=t}(g||(g={})),(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(`
|
|
154
|
+
❌ The value of ${H("--project")} is required`);return}g.execute({projectName:e,options:t})}),console.log("--------------------------------"),console.log(` 🚀 Agentica ${P("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});
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentica",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
4
4
|
"main": "bin/index.js",
|
|
5
5
|
"typings": "bin/index.d.ts",
|
|
6
6
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
7
7
|
"bin": "bin/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./bin/index.js"
|
|
10
|
+
},
|
|
8
11
|
"scripts": {
|
|
9
12
|
"prepare": "ts-patch install",
|
|
10
13
|
"build": "rslib build",
|
|
@@ -39,12 +42,8 @@
|
|
|
39
42
|
"bin"
|
|
40
43
|
],
|
|
41
44
|
"dependencies": {
|
|
42
|
-
"commander": "^10.0.0",
|
|
43
|
-
"comment-json": "^4.2.3",
|
|
44
45
|
"giget": "^1",
|
|
45
|
-
"inquirer": "^8.2.5"
|
|
46
|
-
"package-manager-detector": "^0.2.0",
|
|
47
|
-
"typia": "^8.0.0"
|
|
46
|
+
"inquirer": "^8.2.5"
|
|
48
47
|
},
|
|
49
48
|
"engines": {
|
|
50
49
|
"node": ">=20.12.0"
|
|
@@ -57,8 +56,10 @@
|
|
|
57
56
|
"@ryoppippi/unplugin-typia": "^1.2.0",
|
|
58
57
|
"@types/inquirer": "^9.0.3",
|
|
59
58
|
"@types/node": "^20.14.8",
|
|
59
|
+
"commander": "^10.0.0",
|
|
60
60
|
"ts-node": "^10.9.2",
|
|
61
61
|
"ts-patch": "^3.3.0",
|
|
62
|
+
"typia": "^8.0.0",
|
|
62
63
|
"typescript": "~5.8.2"
|
|
63
64
|
}
|
|
64
65
|
}
|