@easbot/agent 0.2.27 → 0.2.30
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/assets/txt/tool/{gateway-channel.txt → gateway.txt} +17 -17
- package/dist/chunks/acp-SPVCZX63.mjs +16 -0
- package/dist/chunks/adapter-loader-SXX45I3Z.mjs +1 -0
- package/dist/chunks/{agent-52URJRBC.mjs → agent-MZLOGOQI.mjs} +1 -1
- package/dist/chunks/{agent-DIUQQQYM.mjs → agent-NGOXDVCS.mjs} +1 -1
- package/dist/chunks/app-O5NQHNXV.mjs +1 -0
- package/dist/chunks/{auth-DHIUZUBT.mjs → auth-4K3ZL6IZ.mjs} +1 -1
- package/dist/chunks/bootstrap-DR4J35PX.mjs +1 -0
- package/dist/chunks/{build-program-WP5P33JQ.mjs → build-program-P7RW5T4M.mjs} +1 -1
- package/dist/chunks/bus-KR322KXZ.mjs +1 -0
- package/dist/chunks/{chunk-6JRVLYTU.mjs → chunk-4HF47RUG.mjs} +1 -1
- package/dist/chunks/{chunk-NQDXG75V.mjs → chunk-5HMIZBWX.mjs} +2 -2
- package/dist/chunks/{chunk-RRQRZ6MW.mjs → chunk-7GBBUT6F.mjs} +1 -1
- package/dist/chunks/{chunk-3P7JMESZ.mjs → chunk-7P4KNLBL.mjs} +1 -1
- package/dist/chunks/{chunk-47PBZEYM.mjs → chunk-AJ67PJXE.mjs} +1 -1
- package/dist/chunks/{chunk-6M4SMEZK.mjs → chunk-BS7N6B5S.mjs} +1 -1
- package/dist/chunks/{chunk-TMAVGPNZ.mjs → chunk-CTNROYWQ.mjs} +1 -1
- package/dist/chunks/{chunk-ROHSYOEJ.mjs → chunk-LK3TQ5IO.mjs} +1 -1
- package/dist/chunks/{chunk-MMN3J3YS.mjs → chunk-OMJJOGWG.mjs} +211 -211
- package/dist/chunks/{chunk-VCVFFLHV.mjs → chunk-Q4GRHLDQ.mjs} +3 -3
- package/dist/chunks/{chunk-JCC3ZOI6.mjs → chunk-TM2XNUSK.mjs} +1 -1
- package/dist/chunks/{chunk-YCYECTVW.mjs → chunk-Z7TE4DF3.mjs} +1 -1
- package/dist/chunks/{command-5C6WIRH5.mjs → command-O3GFGULS.mjs} +1 -1
- package/dist/chunks/compaction-3MYHNS44.mjs +1 -0
- package/dist/chunks/{config-JVIING4F.mjs → config-LDSDIKTW.mjs} +1 -1
- package/dist/chunks/{confirm-dialog-XBLCGOEC.mjs → confirm-dialog-JSKEM3X2.mjs} +1 -1
- package/dist/chunks/{debug-UKX4WQ3F.mjs → debug-RSDPOIUJ.mjs} +3 -3
- package/dist/chunks/{export-I4GL3OUG.mjs → export-CLUTYBVZ.mjs} +1 -1
- package/dist/chunks/file-ZOJ6S2UR.mjs +1 -0
- package/dist/chunks/gateway-YVMVF6XX.mjs +16 -0
- package/dist/chunks/{generate-ATBLMTBG.mjs → generate-5ZEWLM3X.mjs} +1 -1
- package/dist/chunks/{github-VDDFKDCK.mjs → github-GY4WY3V6.mjs} +1 -1
- package/dist/chunks/global-5ORB5ZJI.mjs +1 -0
- package/dist/chunks/{import-JXNBDWIF.mjs → import-NJ27YSF4.mjs} +1 -1
- package/dist/chunks/installation-Z2BKBIKH.mjs +1 -0
- package/dist/chunks/instance-J5JTNYNN.mjs +1 -0
- package/dist/chunks/loader-LIGT5CRC.mjs +1 -0
- package/dist/chunks/loader-TZZM2FQ7.mjs +1 -0
- package/dist/chunks/lsp-W37T7EBX.mjs +1 -0
- package/dist/chunks/{mcp-WVQBQVTR.mjs → mcp-LU6TQSHT.mjs} +1 -1
- package/dist/chunks/mcp-UXTV2MD5.mjs +1 -0
- package/dist/chunks/models-TNJAQQV6.mjs +1 -0
- package/dist/chunks/{pr-NLGAGRR2.mjs → pr-NWXGDNAA.mjs} +1 -1
- package/dist/chunks/preferences-IPQIZ4PF.mjs +1 -0
- package/dist/chunks/project-XTL74VR6.mjs +1 -0
- package/dist/chunks/prompt-EGX2NAWC.mjs +1 -0
- package/dist/chunks/provider-YEOVG4GT.mjs +1 -0
- package/dist/chunks/registry-5OGN2DD4.mjs +1 -0
- package/dist/chunks/revert-UEWEVDZW.mjs +1 -0
- package/dist/chunks/ripgrep-Z3UZ5FOB.mjs +1 -0
- package/dist/chunks/{run-3YPI6XKG.mjs → run-TJFYT5A2.mjs} +1 -1
- package/dist/chunks/scheduler-GNEGF2HE.mjs +1 -0
- package/dist/chunks/server-K7LUKQBB.mjs +1 -0
- package/dist/chunks/session-DVY2QAPP.mjs +1 -0
- package/dist/chunks/session-HARVTO2S.mjs +1 -0
- package/dist/chunks/{session-4MTNN2T4.mjs → session-YY3OP5DZ.mjs} +1 -1
- package/dist/chunks/{settings-panel-4GBMKF7S.mjs → settings-panel-SM37CCB4.mjs} +1 -1
- package/dist/chunks/share-VULKGSBV.mjs +1 -0
- package/dist/chunks/snapshot-IN2OXNN4.mjs +1 -0
- package/dist/chunks/{stats-KXJDFVQY.mjs → stats-FP5BZIOF.mjs} +1 -1
- package/dist/chunks/storage-OTAVCTZ6.mjs +1 -0
- package/dist/chunks/{tui-YDIPDB2Q.mjs → tui-IZJVGM2K.mjs} +1 -1
- package/dist/chunks/tui-XXGYOYB4.mjs +1 -0
- package/dist/chunks/types-NRDHCKIO.mjs +1 -0
- package/dist/chunks/{update-K6SAKANZ.mjs → update-6CXRBZ6A.mjs} +1 -1
- package/dist/cli.mjs +2 -2
- package/package.json +13 -13
- package/dist/chunks/acp-7YXFQ45K.mjs +0 -16
- package/dist/chunks/adapter-loader-3676SVTM.mjs +0 -1
- package/dist/chunks/app-TR66U2CP.mjs +0 -1
- package/dist/chunks/bootstrap-AD7IUF7M.mjs +0 -1
- package/dist/chunks/bus-CBFYNJXU.mjs +0 -1
- package/dist/chunks/compaction-LD7EJA6I.mjs +0 -1
- package/dist/chunks/file-X44TUOLQ.mjs +0 -1
- package/dist/chunks/gateway-WMMPUO46.mjs +0 -16
- package/dist/chunks/global-EVUKT3AP.mjs +0 -1
- package/dist/chunks/installation-PL26SKTI.mjs +0 -1
- package/dist/chunks/instance-6NPZLEWW.mjs +0 -1
- package/dist/chunks/loader-E7GJBAIA.mjs +0 -1
- package/dist/chunks/loader-PDYDFUCE.mjs +0 -1
- package/dist/chunks/lsp-TAHMSZIF.mjs +0 -1
- package/dist/chunks/mcp-JBQOYJSH.mjs +0 -1
- package/dist/chunks/models-AHPQPXDG.mjs +0 -1
- package/dist/chunks/preferences-H2TY25O6.mjs +0 -1
- package/dist/chunks/project-RYTIRGTX.mjs +0 -1
- package/dist/chunks/prompt-5QAKRVXS.mjs +0 -1
- package/dist/chunks/provider-VPOZDMMP.mjs +0 -1
- package/dist/chunks/registry-SYGK57RE.mjs +0 -1
- package/dist/chunks/revert-QWJ7WVG5.mjs +0 -1
- package/dist/chunks/ripgrep-OHTQKKDR.mjs +0 -1
- package/dist/chunks/scheduler-ZEHS5N2M.mjs +0 -1
- package/dist/chunks/server-LZVS7PBL.mjs +0 -1
- package/dist/chunks/session-DVMBXQNW.mjs +0 -1
- package/dist/chunks/session-SD2Y7TSF.mjs +0 -1
- package/dist/chunks/share-NAAYDAC3.mjs +0 -1
- package/dist/chunks/snapshot-QYVGLPZG.mjs +0 -1
- package/dist/chunks/storage-R2S2HFGM.mjs +0 -1
- package/dist/chunks/tui-MDEMUHXR.mjs +0 -1
- package/dist/chunks/types-TQH77CIP.mjs +0 -1
- /package/dist/assets/txt/tool/{agent-client-chat.txt → agent-client.txt} +0 -0
|
@@ -27,13 +27,13 @@ Returns system status, connections, sessions, subscriptions, and uptime.
|
|
|
27
27
|
### Private Chat
|
|
28
28
|
Use contactUid to send direct messages:
|
|
29
29
|
```
|
|
30
|
-
|
|
30
|
+
gateway(operation="send" contactUid="telegram:123456789" content="Hello!")
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Group Chat
|
|
34
34
|
Use sessionId to send to groups:
|
|
35
35
|
```
|
|
36
|
-
|
|
36
|
+
gateway(operation="send" sessionId="telegram_telegram-main_-100123456_123456" content="Hello group!")
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Session Filtering
|
|
@@ -41,13 +41,13 @@ gateway_channel(operation="send" sessionId="telegram_telegram-main_-100123456_12
|
|
|
41
41
|
Sessions include chat type (private/group) and title:
|
|
42
42
|
```
|
|
43
43
|
# List private chats only
|
|
44
|
-
|
|
44
|
+
gateway(operation="sessions" type="private")
|
|
45
45
|
|
|
46
46
|
# List groups only
|
|
47
|
-
|
|
47
|
+
gateway(operation="sessions" type="group")
|
|
48
48
|
|
|
49
49
|
# List all
|
|
50
|
-
|
|
50
|
+
gateway(operation="sessions" type="all")
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
## Quick Reference
|
|
@@ -69,30 +69,30 @@ gateway_channel(operation="sessions" type="all")
|
|
|
69
69
|
|
|
70
70
|
```
|
|
71
71
|
# Status
|
|
72
|
-
|
|
72
|
+
gateway(operation="status")
|
|
73
73
|
|
|
74
74
|
# Channels
|
|
75
|
-
|
|
75
|
+
gateway(operation="channels")
|
|
76
76
|
|
|
77
77
|
# Sessions (all)
|
|
78
|
-
|
|
78
|
+
gateway(operation="sessions")
|
|
79
79
|
|
|
80
80
|
# Sessions - filter by type
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
gateway(operation="sessions" type="private")
|
|
82
|
+
gateway(operation="sessions" type="group")
|
|
83
83
|
|
|
84
84
|
# Contacts
|
|
85
|
-
|
|
85
|
+
gateway(operation="contacts" platform="telegram")
|
|
86
86
|
|
|
87
87
|
# Send - contactUid (private chat)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
gateway(operation="send" contactUid="telegram:123456789" content="Hello!")
|
|
89
|
+
gateway(operation="send" contactUid="telegram:123456789" content="https://example.com/photo.jpg" messageType="image")
|
|
90
|
+
gateway(operation="send" contactUid="telegram:123456789" content="file:///path/to/document.pdf" messageType="file")
|
|
91
91
|
|
|
92
92
|
# Send - sessionId (group chat)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
gateway(operation="send" sessionId="telegram_telegram-main_-100123456_123456" content="Hello group!")
|
|
94
|
+
gateway(operation="send" sessionId="telegram_telegram-main_-100123456_123456" content="https://example.com/file.pdf" messageType="file")
|
|
95
|
+
gateway(operation="send" sessionId="telegram_telegram-main_-100123456_123456" content="file:///path/to/photo.jpg" messageType="image")
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
## Error Handling
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {a as a$2}from'./chunk-LAHYVX5K.mjs';import {a as a$3}from'./chunk-Z7TE4DF3.mjs';import'./chunk-VII7JKGB.mjs';import {g,e,d,k,i,b,h,c,a as a$4}from'./chunk-M3K32WJV.mjs';import {ob,Q,xa,Na}from'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import {a as a$1}from'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import {a}from'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';import'commander';import L from'path';import {getProxyConfig}from'@easbot/utils';var n=a.create({service:"cli-command-acp"});async function O(s,e){let t=await ob.getACPServerConfig();n.debug("Merging ACP configuration",{baseConfig:{channel:t.channel,port:t.port,hostname:t.hostname,timeout:t.timeout},cliOptions:{channel:e.channel,port:e.port,hostname:e.hostname,timeout:e.timeout}});let r={};if(e.channel!==void 0){let i=e.channel.toLowerCase();Object.values(Q).includes(i)?(r.channel=i,n.debug("CLI override: channel",{value:r.channel})):n.warn("Invalid channel type from command line",{value:e.channel});}if(e.port!==void 0&&(e.port>0&&e.port<=65535?(r.port=e.port,n.debug("CLI override: port",{value:r.port})):n.warn("Invalid port from command line",{value:e.port})),e.hostname!==void 0&&(r.hostname=e.hostname,n.debug("CLI override: hostname",{value:r.hostname})),e.timeout!==void 0&&(e.timeout>0?(r.timeout=e.timeout,n.debug("CLI override: timeout",{value:r.timeout})):n.warn("Invalid timeout from command line",{value:e.timeout})),e.hostname!==void 0||e.port!==void 0){let i=e.hostname??t.hostname??"127.0.0.1",l=e.port??t.port??3e3;t.ws&&(r.ws={...t.ws,url:`ws://${i}:${l}`}),t.http&&(r.http={...t.http,baseUrl:`http://${i}:${l}`}),n.debug("CLI override: ws.url and http.baseUrl updated",{hostname:e.hostname,port:e.port,wsUrl:r.ws?.url,httpBaseUrl:r.http?.baseUrl});}e.timeout!==void 0&&(r.ws||r.http)&&(r.ws&&(r.ws.timeout=e.timeout),r.http&&(r.http.timeout=e.timeout),n.debug("CLI override: ws.timeout and http.timeout updated",{timeout:e.timeout}));let c={...t,...r};return n.debug("Merged ACP configuration",{channel:c.channel,port:c.port,hostname:c.hostname,timeout:c.timeout}),c}async function U(s,e,t){n.info("Starting ACP service",{channel:e.channel,port:e.port,hostname:e.hostname,debug:t.config.debug}),await xa.init({directory:s,printLogs:t.config.print_logs,logLevel:t.config.log_level,channel:e.channel});await xa.ensureACPService(e);console.log(""),console.log(d(a$1("acp.server.started"))),console.log(k(60)),console.log(i(a$1("acp.field.directory"),s,15)),console.log(i(a$1("acp.field.worktree"),Na.project.worktree||"N/A",15)),console.log(i(a$1("acp.field.channel"),e.channel,15));let c$1=b();switch(e.channel){case "websocket":{let l,m="/";if(e.ws?.url)try{let p=new URL(e.ws.url),d=p.port||"3000",_=p.hostname;m=p.pathname||"/",l=`ws://${_}:${d}${m==="/"?"":m}`;}catch{l=e.ws.url;}else l=`ws://${e.hostname}:${e.port}`;console.log(i(a$1("acp.field.ws_url"),l,15)),console.log(i(a$1("acp.field.ws_path"),m,15)),e.ws?(console.log(h(a$1("acp.websocket.config"))),console.log(i(a$1("acp.field.timeout"),`${e.ws.timeout??e.timeout}ms`,15)),console.log(i(a$1("acp.field.batch_size"),`${e.ws.batchSize??10}`,15)),console.log(i(a$1("acp.field.batch_interval"),`${e.ws.batchInterval??50}ms`,15)),console.log(i(a$1("acp.field.heartbeat"),`${e.ws.heartbeatInterval??3e4}ms`,15))):console.log(i(a$1("acp.field.timeout"),`${e.timeout}ms`,15));break}case "http":e.http?.baseUrl?console.log(i(a$1("acp.field.base_url"),e.http.baseUrl,15)):console.log(i(a$1("acp.field.host"),`${e.hostname}:${e.port}`,15)),e.http?.timeout?console.log(i(a$1("acp.field.timeout"),`${e.http.timeout}ms`,15)):console.log(i(a$1("acp.field.timeout"),`${e.timeout}ms`,15));break;case "stdio":console.log(i(a$1("acp.field.mode"),a$1("acp.mode.stdio"),15)),console.log(i(a$1("acp.field.timeout"),`${e.timeout}ms`,15));break;case "local":console.log(i(a$1("acp.field.mode"),a$1("acp.mode.local"),15)),console.log(i(a$1("acp.field.protocol"),a$1("acp.protocol"),15)),console.log(i(a$1("acp.field.timeout"),`${e.timeout}ms`,15));break;default:console.log(i(a$1("acp.field.host"),`${e.hostname}:${e.port}`,15)),console.log(i(a$1("acp.field.timeout"),`${e.timeout}ms`,15));}console.log(i(a$1("acp.field.debug"),t.config.debug?c(c$1,a$4.success,a$1("common.enabled")):c(c$1,a$4.muted,a$1("common.disabled")),15));let i$1=getProxyConfig();if(i$1.enabled){let l=i$1.https||i$1.http||"configured";console.log(i(a$1("acp.field.proxy"),l,15));}console.log(k(60)),console.log(""),n.info("ACPServer started successfully"),N();}function N(){let s=process.env.EASBOT_RUN_MODE==="ephemeral"||!process.stdin.isTTY&&process.env.EASBOT_RUN_MODE!=="persistent",e=async t=>{n.debug(`Received ${t}, shutting down...`),s||console.log(`
|
|
2
|
+
${a$1("acp.shutdown.received",{vars:{signal:t}})}`);try{await xa.destroy(),n.debug("EasbotAdapter state destroyed"),s||console.log(d(a$1("acp.shutdown.completed")));}catch(r){n.error("Error during shutdown",{error:r instanceof Error?r.message:String(r)});}s?process.kill(process.pid,"SIGKILL"):process.exit(0);};process.on("SIGINT",()=>{e("SIGINT").catch(console.error);}),process.on("SIGTERM",()=>{e("SIGTERM").catch(console.error);}),process.stdout.on("error",t=>{(t.code==="EPIPE"||t.code==="EIO")&&(n.info("stdout pipe broken, exiting"),e("stdout-broken").catch(()=>{s?process.kill(process.pid,"SIGKILL"):process.exit(0);}));});}async function M(s,e$1,t){n.debug("ACP command executed",{options:e$1});let r=t?.config?.debug??false,c=t?.config?.print_logs??false,i=t?.config?.log_level??"INFO";n.debug("Global options from context",{debug:t?.config?.debug,print_logs:t?.config?.print_logs,log_level:t?.config?.log_level,isDebug:r,printLogs:c,logLevel:i});try{let l=t.config.directory?L.resolve(t.config.directory):process.cwd();n.debug("Working directory resolved",{directory:l});let m=a$2(l);if(!m.valid)throw n.error("Working directory validation failed",{directory:l,error:m.error}),new Error(`Invalid working directory: ${m.error}`);let p=m.normalizedPath;n.debug("Working directory validated",{validatedDirectory:p}),console.log(g(a$1("acp.directory.resolved",{vars:{cwd:p}}))),await a$3(p,async()=>{let d=await O(p,e$1);if(n.debug("ACP server configuration",{channel:d.channel,port:d.port,hostname:d.hostname,timeout:d.timeout,enabled:d.enabled}),!d.enabled){n.warn("ACP server is disabled by configuration"),console.log(g(a$1("acp.disabled")));return}await U(p,d,t),n.info("ACP server started successfully");});}catch(l){n.error("Failed to start ACP server",{error:l instanceof Error?l.message:String(l)}),console.error(e(a$1("acp.error.start_failed",{vars:{error:l instanceof Error?l.message:String(l)}}))),process.exit(1);}}function ce(s,e){let t=s.command("acp").description(a$1("acp.command.description")).addHelpText("after",`
|
|
3
|
+
|
|
4
|
+
${a$1("acp.help.examples")}
|
|
5
|
+
$ agent acp # ${a$1("acp.help.example.default")}
|
|
6
|
+
$ agent acp --channel http # ${a$1("acp.help.example.http")}
|
|
7
|
+
$ agent acp --port 8080 # ${a$1("acp.help.example.port")}
|
|
8
|
+
$ agent acp --hostname 0.0.0.0 # ${a$1("acp.help.example.hostname")}
|
|
9
|
+
$ agent acp --channel ws --debug # ${a$1("acp.help.example.debug")}
|
|
10
|
+
|
|
11
|
+
${a$1("acp.help.env")}
|
|
12
|
+
ACP_CHANNEL ${a$1("acp.help.env.channel")}
|
|
13
|
+
ACP_PORT ${a$1("acp.help.env.port")}
|
|
14
|
+
ACP_HOSTNAME ${a$1("acp.help.env.hostname")}
|
|
15
|
+
ACP_TIMEOUT ${a$1("acp.help.env.timeout")}
|
|
16
|
+
ACP_ENABLED ${a$1("acp.help.env.enabled")}`);t.option("-c, --channel <type>",a$1("acp.option.channel")).option("-p, --port <number>",a$1("acp.option.port"),r=>parseInt(r,10)).option("-H, --hostname <address>",a$1("acp.option.hostname")).option("-t, --timeout <milliseconds>",a$1("acp.option.timeout"),r=>parseInt(r,10)),t.command("*",{isDefault:true}).action(async()=>{let r=t.opts();await M(t,r,e);});}export{ce as registerAcpCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{U as getACPClientsConfig,T as getACPServerConfig,X as getAcpAgentName,V as getAcpAgentRuntimeConfig,W as getAcpModelConfig,S as loadACPConfig}from'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$4}from'./chunk-TYD2M4SP.mjs';import'./chunk-FXOUIXIL.mjs';import {a as a$3}from'./chunk-
|
|
1
|
+
import {a as a$4}from'./chunk-TYD2M4SP.mjs';import'./chunk-FXOUIXIL.mjs';import {a as a$3}from'./chunk-Z7TE4DF3.mjs';import'./chunk-CQVEAYYW.mjs';import {l,d,e,h,i,b,c,a as a$5}from'./chunk-M3K32WJV.mjs';import'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import {a as a$2}from'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import {a as a$1}from'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';var a=a$1.create({service:"cli-command-agent"});function W(C,c$1){let y=C.command("agent").description(a$2("agent.command.description"));y.command("list").description(a$2("agent.command.list.description")).action(async()=>{await a$3(c$1.config.directory,async()=>{try{a.debug("Listing agents");let{data:o}=await c$1.sdk.app.agents({});if(!o||o.length===0){console.log(l(a$2("agent.list.empty")));return}let r=[...o].sort((n,t)=>{let g="native"in n&&n.native,d="native"in t&&t.native;return g!==d?g?-1:1:n.name.localeCompare(t.name)});console.log(d(a$2("agent.list.success",{vars:{count:o.length}}))),console.log(""),console.log(a$4({columns:[{key:"name",header:a$2("agent.table.header.name"),minWidth:15},{key:"mode",header:a$2("agent.table.header.mode"),minWidth:10},{key:"native",header:a$2("agent.table.header.native"),minWidth:8}],rows:r.map(n=>({name:n.name,mode:"mode"in n&&n.mode||"primary",native:"native"in n&&n.native?a$2("common.yes"):a$2("common.no")})),width:process.stdout.columns||80,border:"unicode"})),a.debug("Agent list displayed",{count:o.length});}catch(o){a.error("Failed to list agents",{error:o instanceof Error?o.message:String(o)}),console.error(e(a$2("agent.list.error"))),process.exit(1);}});}),y.command("info <agent-id>").description(a$2("agent.command.info.description")).action(async o=>{await a$3(c$1.config.directory,async()=>{try{a.debug("Getting agent info",{agentId:o});let{data:r}=await c$1.sdk.app.agents({}),n=r?.find(t=>t.name===o);if(n||(console.error(e(a$2("agent.get.not_found",{vars:{agentId:o}}))),process.exit(1)),console.log(d(a$2("agent.get.success"))),console.log(""),console.log(h(a$2("agent.info.heading"))),console.log(""),console.log(i(a$2("agent.info.field.name")+":",n.name)),console.log(i(a$2("agent.info.field.mode")+":","mode"in n&&n.mode||"primary")),console.log(i(a$2("agent.info.field.native")+":","native"in n&&n.native?a$2("common.yes"):a$2("common.no"))),"permission"in n&&n.permission){console.log(i(a$2("agent.info.field.permission")+":",""));let t=b();console.log(c(t,a$5.muted,JSON.stringify(n.permission,null,2)));}a.debug("Agent info displayed",{agentId:o});}catch(r){a.error("Failed to get agent info",{agentId:o,error:r instanceof Error?r.message:String(r)}),console.error(e(a$2("agent.get.error"))),process.exit(1);}});}),y.command("create").description(a$2("agent.command.create.description")).requiredOption("--name <name>",a$2("agent.command.create.option.name")).option("--mode <mode>",a$2("agent.command.create.option.mode"),"chat").option("--permission <json>",a$2("agent.command.create.option.permission")).action(async o=>{await a$3(c$1.config.directory,async()=>{try{a.debug("Creating agent",{name:o.name,mode:o.mode}),console.log(h(a$2("agent.create.begin")));let{validateAgentName:r,validateAgentMode:n,validateJsonString:t}=await import('./input-validation-FWKKVCYC.mjs');r(o.name)||(a.error("Invalid agent name",{name:o.name}),console.error(e(a$2("agent.create.validation.name"))),process.exit(1));let g=o.mode||"primary";n(g)||(a.error("Invalid agent mode",{mode:o.mode}),console.error(e(a$2("agent.create.validation.mode"))),process.exit(1));let d$1;if(o.permission){let l=t(o.permission,"permission");l||(a.error("Invalid permission JSON format",{permission:o.permission}),console.error(e(a$2("agent.create.error",{vars:{error:"Invalid permission JSON format"}}))),process.exit(1)),d$1=l;}let{data:m}=await c$1.sdk.agent.create({name:o.name,mode:g,permission:d$1});if(m||(console.error(e(a$2("agent.create.error",{vars:{error:"Agent creation failed"}}))),process.exit(1)),console.log(d(a$2("agent.create.success",{vars:{name:m.name}}))),console.log(""),console.log(h(a$2("agent.info.heading"))),console.log(""),console.log(i(a$2("agent.info.field.name")+":",m.name)),console.log(i(a$2("agent.info.field.mode")+":",m.mode??"all")),console.log(i(a$2("agent.info.field.native")+":",m.native?a$2("common.yes"):a$2("common.no"))),m.permission){console.log(i(a$2("agent.info.field.permission")+":",""));let l=b();console.log(c(l,a$5.muted,JSON.stringify(m.permission,null,2)));}a.debug("Agent created successfully",{name:m.name});}catch(r){a.error("Failed to create agent",{name:o.name,error:r instanceof Error?r.message:String(r)}),console.error(e(a$2("agent.create.error",{vars:{error:r instanceof Error?r.message:String(r)}}))),process.exit(1);}});});}export{W as registerAgentCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e}from'./chunk-M3K32WJV.mjs';import {j,fa,k,La}from'./chunk-
|
|
1
|
+
import {e}from'./chunk-M3K32WJV.mjs';import {j,fa,k,La}from'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import {a as a$1}from'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import {a}from'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';import {basename}from'path';import {iife,Identifier}from'@easbot/utils';var D=a.create({service:"debug.agent"});function z(r,o,e$1){(async()=>{D.debug("Getting agent info",{agentName:o});let t=(await r.sdk.agent.get({agentID:o})).data;t||(console.error(e(a$1("debug.agent.error.not_found",{vars:{agentName:o,command:basename(process.execPath)}}))),process.exit(1));let a=t,d=await C(a),i=await P(a,d);if(e$1.tool){let c=d.find(A=>A.id===e$1.tool);c||(console.error(e(a$1("debug.agent.tool.error.not_found",{vars:{toolID:e$1.tool,agentName:o}}))),process.exit(1)),i[e$1.tool]===false&&(console.error(e(a$1("debug.agent.tool.error.disabled",{vars:{toolID:e$1.tool,agentName:o}}))),process.exit(1));let g=T(e$1.params),b=await E(a,r);D.debug("Executing tool",{toolID:e$1.tool,params:g});let y=await c.execute(g,b);console.log(JSON.stringify({tool:e$1.tool,input:g,result:y},null,2));return}let m={...t,tools:i};console.log(JSON.stringify(m,null,2));})();}async function C(r){let o=r.model??await j.defaultModel();return o.providerID||(o={...o,providerID:"default-provider"}),fa.tools(o,r)}async function P(r,o){let e=k.disabled(o.map(t=>t.id),r.permission),s={};for(let t of o)s[t.id]=!e.has(t.id);return s}function T(r){if(!r)return {};let o=r.trim();if(o.length===0)return {};let e=iife(()=>{try{return JSON.parse(o)}catch(s){try{return new Function(`return (${o})`)()}catch(t){throw new Error(a$1("debug.agent.tool.params.parse_error",{vars:{jsonError:s,evalError:t}}))}}});if(!e||typeof e!="object"||Array.isArray(e))throw new Error(a$1("debug.agent.tool.params.must_be_object"));return e}async function E(r,o){let e=await La.create({title:`Debug tool run (${r.name})`}),s=Identifier.ascending("message"),t=r.model??await j.defaultModel();t.providerID||(t={...t,providerID:t.providerID||"default-provider"});let a=Date.now(),d={id:s,sessionID:e.id,role:"assistant",time:{created:a},parentID:s,modelID:t.modelID,providerID:t.providerID,mode:"debug",agent:r.name,path:{cwd:o.config.directory,root:o.config.worktree},cost:0,tokens:{input:0,output:0,reasoning:0,cache:{read:0,write:0}}};await La.updateMessage(d);let i=k.merge(r.permission,e.permission??[]);return {sessionID:e.id,messageID:s,callID:Identifier.ascending("part"),agent:r.name,abort:new AbortController().signal,messages:[],metadata:()=>{},async ask(m){for(let c of m.patterns)if(k.evaluate(m.permission,c,i).action==="deny")throw new k.DeniedError(i)}}}export{z as registerAgentCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{h as createTuiApp,g as getGlobalErrorHandler,e as registerGlobalErrorHandler,f as unregisterGlobalErrorHandler}from'./chunk-Q4GRHLDQ.mjs';import'./chunk-CQVEAYYW.mjs';import'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-TYD2M4SP.mjs';import'./chunk-FXOUIXIL.mjs';import'./chunk-CQVEAYYW.mjs';import {h,g,e,d}from'./chunk-M3K32WJV.mjs';import {a as a$1}from'./chunk-
|
|
1
|
+
import {a as a$2}from'./chunk-TYD2M4SP.mjs';import'./chunk-FXOUIXIL.mjs';import'./chunk-CQVEAYYW.mjs';import {h,g,e,d}from'./chunk-M3K32WJV.mjs';import {a as a$1}from'./chunk-5HMIZBWX.mjs';import {a}from'./chunk-LFYBZHOI.mjs';import'./chunk-X6ISXWBN.mjs';var i=a.create({service:"cli-command-auth"});function E(n,o){let e=n.command("auth").description(a$1("auth.command.description"));e.command("list").description(a$1("auth.command.list.description")).aliases(["ls"]).action(async()=>{i.debug("Listing credentials"),await v(o);}),e.command("login [provider]").description(a$1("auth.command.login.description")).option("--key <key>",a$1("auth.option.key")).action(async(t,g)=>{t?(i.debug("Logging in to provider",{provider:t}),await f(o,t,g.key)):(i.debug("Interactive login"),await y(o));}),e.command("logout <provider>").description(a$1("auth.command.logout.description")).action(async t=>{i.debug("Logging out from provider",{provider:t}),await b(o,t);});}async function v(n){try{let{data:o}=await n.sdk.config.providers({}),e=o?.providers||[];if(console.log(h(a$1("auth.list.title"))),console.log(""),e.length===0){console.log(g(a$1("auth.list.empty")));return}console.log(a$2({columns:[{key:"provider",header:a$1("auth.table.header.provider"),minWidth:20},{key:"type",header:a$1("auth.table.header.type"),minWidth:15}],rows:e.map(t=>({provider:t.name||t.id,type:"configured"})),width:process.stdout.columns||80,border:"unicode"})),i.debug("Credentials listed",{count:e.length});}catch(o){i.error("Failed to list credentials",{error:o instanceof Error?o.message:String(o)}),console.error(e(a$1("auth.list.error",{vars:{error:o instanceof Error?o.message:String(o)}}))),process.exit(1);}}async function f(n,o,e$1){try{e$1||(console.error(e(a$1("auth.login.key_required"))),console.log(g(a$1("auth.login.key_hint"))),process.exit(1)),console.log(h(a$1("auth.login.logging_in",{vars:{provider:o}}))),await n.sdk.auth.set({providerID:o,info:{type:"api",key:e$1}}),console.log(d(a$1("auth.login.success",{vars:{provider:o}}))),i.debug("Login successful",{provider:o});}catch(t){i.error("Login failed",{provider:o,error:t instanceof Error?t.message:String(t)}),console.error(e(a$1("auth.login.error",{vars:{error:t instanceof Error?t.message:String(t)}}))),process.exit(1);}}async function y(n){try{console.log(h(a$1("auth.interactive.title")));let{data:o}=await n.sdk.config.providers({}),e$1=o?.providers||[],t={easbot:0,anthropic:1,openai:2,google:3},g$1=e$1.sort((s,l)=>(t[s.id]??99)-(t[l.id]??99)).map(s=>({value:s.id,label:s.name||s.id,hint:s.id==="easbot"?"recommended":void 0}));console.log(""),console.log(g(a$1("auth.interactive.select_provider"))),console.log(a$2({columns:[{key:"index",header:"#",minWidth:4},{key:"provider",header:a$1("auth.table.header.provider"),minWidth:25},{key:"hint",header:a$1("auth.table.header.hint"),flex:!0}],rows:g$1.map((s,l)=>({index:`${l+1}`,provider:s.label,hint:s.hint||""})),width:process.stdout.columns||80,border:"unicode"})),console.log(""),console.log(g(a$1("auth.interactive.enter_number")));let h$1=g$1[0]?.value;h$1||(console.error(e(a$1("auth.interactive.no_providers"))),process.exit(1)),await f(n,h$1);}catch(o){i.error("Interactive login failed",{error:o instanceof Error?o.message:String(o)}),console.error(e(a$1("auth.login.error",{vars:{error:o instanceof Error?o.message:String(o)}}))),process.exit(1);}}async function b(n,o){try{console.log(h(a$1("auth.logout.logging_out",{vars:{provider:o}}))),await n.sdk.auth.remove({providerID:o}),console.log(d(a$1("auth.logout.success",{vars:{provider:o}}))),i.debug("Logout successful",{provider:o});}catch(e$1){i.error("Logout failed",{provider:o,error:e$1 instanceof Error?e$1.message:String(e$1)}),console.error(e(a$1("auth.logout.error",{vars:{error:e$1 instanceof Error?e$1.message:String(e$1)}}))),process.exit(1);}}export{E as registerAuthCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as bootstrap,b as bootstrapProgram}from'./chunk-Z7TE4DF3.mjs';import'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-4HF47RUG.mjs';import {a as a$1}from'./chunk-XPF2LJT2.mjs';import {Na,va}from'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import {a as a$2}from'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import {b as b$2}from'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import {a}from'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';import {Command}from'commander';import'path';import O from'fs/promises';import {parse}from'jsonc-parser';var y="easbot",h="EASBot - Multi-Agent Collaboration Ecosystem CLI Tool",P="build",x=["main","ops","explorer"];var b=a.create({service:"cli-config"});async function N(n){try{let o=await O.readFile(n,"utf-8");return parse(o)||{}}catch(o){if(o&&typeof o=="object"&&"code"in o){if(o.code==="ENOENT")return {};b.warn("Failed to read config file",{filePath:n,error:o.code});}else b.error("Failed to parse config file",{filePath:n,error:o instanceof Error?o.message:String(o)});return {}}}function T(...n){let o={};for(let t of n)for(let[e,i]of Object.entries(t))i!==void 0&&(typeof i=="object"&&!Array.isArray(i)&&i!==null?o[e]={...o[e],...i}:o[e]=i);return o}function k(){return {server:{port:3e3,hostname:"localhost"},agent:{},model:{},permission:{}}}async function w(n={}){let{cwd:o=process.cwd(),customConfigPath:t}=n,e=k();if(n.sdk)try{let{data:i}=await n.sdk.config.get({});i&&(e=i);}catch{}if(t){let i=await N(t);Object.keys(i).length>0&&(e=T(e,i));}return e.directory=o,e}async function A(n={}){let o=n.cwd||process.cwd(),t=n.root||Na.worktree,e=va({directory:o}),i=await w({cwd:o,root:t,sdk:e,customConfigPath:n.customConfigPath});return {programVersion:b$2.getVersion(),channelOptions:["local","web","api"],agentOptions:`${i.default_agent||P}|${x.join("|")}`,config:i,sdk:e}}var j=[{commands:[{name:"tui",description:"\u542F\u52A8 TUI \u754C\u9762",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./tui-IZJVGM2K.mjs')).registerTuiCommand(n,o);}},{commands:[{name:"run",description:"\u8FD0\u884C\u5355\u6B21\u5BF9\u8BDD",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./run-TJFYT5A2.mjs')).registerRunCommand(n,o);}},{commands:[{name:"generate",description:"\u751F\u6210 OpenAPI \u89C4\u8303",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./generate-5ZEWLM3X.mjs')).registerGenerateCommand(n,o);}},{commands:[{name:"agent",description:"Agent \u7BA1\u7406\u547D\u4EE4",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./agent-MZLOGOQI.mjs')).registerAgentCommands(n,o);}},{commands:[{name:"session",description:"\u4F1A\u8BDD\u7BA1\u7406\u547D\u4EE4",hasSubcommands:true}],register:async({program:n,ctx:o})=>{let{registerSessionCommands:t}=await import('./session-YY3OP5DZ.mjs');t(n,o);}},{commands:[{name:"mcp",description:"MCP \u670D\u52A1\u5668\u7BA1\u7406",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./mcp-LU6TQSHT.mjs')).registerMcpCommands(n,o);}},{commands:[{name:"acp",description:"ACP Agent \u901A\u4FE1\u9002\u914D\u5668\u547D\u4EE4",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./acp-SPVCZX63.mjs')).registerAcpCommand(n,o);}},{commands:[{name:"debug",description:"\u8C03\u8BD5\u548C\u8BCA\u65AD\u5DE5\u5177",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./debug-RSDPOIUJ.mjs')).registerDebugCommands(n,o);}},{commands:[{name:"gateway",description:"Gateway \u670D\u52A1\u7BA1\u7406\u547D\u4EE4",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./gateway-YVMVF6XX.mjs')).registerGatewayCommand(n,o);}},{commands:[{name:"auth",description:"Provider \u51ED\u636E\u7BA1\u7406",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./auth-4K3ZL6IZ.mjs')).registerAuthCommand(n,o);}},{commands:[{name:"export",description:"\u5BFC\u51FA\u4F1A\u8BDD\u6570\u636E",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./export-CLUTYBVZ.mjs')).registerExportCommand(n,o);}},{commands:[{name:"github",description:"GitHub Agent \u7BA1\u7406",hasSubcommands:true}],register:async({program:n,ctx:o})=>{(await import('./github-GY4WY3V6.mjs')).registerGithubCommand(n,o);}},{commands:[{name:"import",description:"\u5BFC\u5165\u4F1A\u8BDD\u6570\u636E",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./import-NJ27YSF4.mjs')).registerImportCommand(n,o);}},{commands:[{name:"pr",description:"PR \u68C0\u51FA\u548C\u4F1A\u8BDD\u5BFC\u5165",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./pr-NWXGDNAA.mjs')).registerPrCommand(n,o);}},{commands:[{name:"stats",description:"Token \u4F7F\u7528\u91CF\u548C\u6210\u672C\u7EDF\u8BA1",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./stats-FP5BZIOF.mjs')).registerStatsCommand(n,o);}},{commands:[{name:"update",description:"\u66F4\u65B0 Easbot CLI",hasSubcommands:false}],register:async({program:n,ctx:o})=>{(await import('./update-6CXRBZ6A.mjs')).registerUpdateCommand(n,o);}}];async function B(n,o,t=process.argv){for(let e of j)await e.register({program:n,ctx:o,argv:t});}async function v(n,o,t=process.argv){await B(n,o,t);}function L(n,o){n.name(a$2("program.name")).description(a$2("program.description")),n.option("--cwd <directory>",a$2("program.option.cwd"),process.cwd()),n.option("--config <path>",a$2("program.option.config")),n.option("--print-logs",a$2("program.option.print_logs")),n.option("--log-level <level>",a$2("program.option.log_level"),"INFO"),n.option("--debug",a$2("program.option.debug")),n.helpOption("-h, --help",a$2("program.help.option")),n.helpCommand("help [command]",a$2("program.help.command")),n.configureHelp({sortSubcommands:true,sortOptions:true,optionTerm:t=>t.flags,subcommandTerm:t=>t.name()}),n.configureOutput({writeOut:t=>{process.stdout.write(E(t));},writeErr:t=>{process.stderr.write(E(t));},outputError:(t,e)=>{e(t);}}),n.addHelpText("afterAll",({command:t})=>t!==n?"":`
|
|
2
2
|
${a$2("program.help.examples")}:
|
|
3
3
|
easbot # ${a$2("help.example.tui")}
|
|
4
4
|
easbot tui --continue # ${a$2("help.example.tui_continue")}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as Bus}from'./chunk-OMJJOGWG.mjs';import'./chunk-LK3TQ5IO.mjs';import'./chunk-ZBRXNYEM.mjs';import'./chunk-CTNROYWQ.mjs';import'./chunk-TM2XNUSK.mjs';import'./chunk-DEZT7DOH.mjs';import'./chunk-AAJAKVQY.mjs';import'./chunk-5HMIZBWX.mjs';import'./chunk-AJ67PJXE.mjs';import'./chunk-7P4KNLBL.mjs';import'./chunk-CJTCCLW4.mjs';import'./chunk-7GBBUT6F.mjs';import'./chunk-LFYBZHOI.mjs';import'./chunk-BS7N6B5S.mjs';import'./chunk-2RSIOAZV.mjs';import'./chunk-X6ISXWBN.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Na}from'./chunk-
|
|
1
|
+
import {Na}from'./chunk-OMJJOGWG.mjs';import {a}from'./chunk-LFYBZHOI.mjs';import {a as a$1}from'./chunk-BS7N6B5S.mjs';import {b as b$1}from'./chunk-X6ISXWBN.mjs';import d from'fs';import u from'path';var P=a.create({service:"cli-plugin"});function S(t,e,r){return {context:t,logger:a,config:r,registerCli(n,o){try{t._pluginCliRegistrations||(t._pluginCliRegistrations=[]),t._pluginCliRegistrations.push({pluginId:e,register:n,commands:o?.commands||[]}),P.debug("Plugin CLI registered",{pluginId:e,commands:o?.commands});}catch(a){throw P.error("Plugin CLI registration failed",{pluginId:e,error:a}),a}},registerCommand(n){try{if(t._pluginCommands||(t._pluginCommands=[]),!n.name||!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(n.name))throw new Error(`Invalid command name: ${n.name}`);let o=t._pluginCommands.find(s=>s.name.toLowerCase()===n.name.toLowerCase());if(o)throw new Error(`Command "${n.name}" is already registered by plugin "${o.pluginId}"`);let a=async s=>{try{return await n.handler(s)}catch(i){return P.error("Plugin command handler failed",{pluginId:e,commandName:n.name,error:i}),{text:`Command failed: ${i instanceof Error?i.message:String(i)}`}}};t._pluginCommands.push({...n,handler:a,pluginId:e}),P.debug("Plugin command registered",{pluginId:e,commandName:n.name});}catch(o){throw P.error("Plugin command registration failed",{pluginId:e,error:o}),o}}}}var g=a.create({service:"cli-plugin-discovery"});async function F(t){if(t.enabled===false)return g.debug("Plugin system is disabled"),[];let e=[],r=new Set;if(t.loadPaths)for(let s of t.loadPaths){let i=await I(s,"npm");for(let l of i)r.has(l.id)||(e.push(l),r.add(l.id));}let n=u.join(Na.directory,".easbot","extensions");if(d.existsSync(n)){let s=await h(n,"workspace");for(let i of s)r.has(i.id)||(e.push(i),r.add(i.id));}let o=u.join(a$1.Path.config,"extensions");if(d.existsSync(o)){let s=await h(o,"global");for(let i of s)r.has(i.id)||(e.push(i),r.add(i.id));}let a=e.filter(s=>t.deny?.includes(s.id)?(g.debug("Plugin denied by blacklist",{pluginId:s.id}),false):t.allow&&t.allow.length>0&&!t.allow.includes(s.id)?(g.debug("Plugin not in whitelist",{pluginId:s.id}),false):true);return g.info("Discovered plugins",{count:a.length,plugins:a.map(s=>s.id)}),a}async function I(t,e){if(!d.existsSync(t))return g.debug("Plugin path does not exist",{pluginPath:t}),[];let r=d.statSync(t);return r.isFile()?A(t,e):r.isDirectory()?h(t,e):[]}async function A(t,e){let r=u.dirname(t),n=u.join(r,"easbot.plugin.json"),o;if(d.existsSync(n))try{o=JSON.parse(d.readFileSync(n,"utf-8"));}catch(s){return g.error("Failed to read plugin manifest",{manifestPath:n,error:s}),[]}let a=o?.id||u.basename(t,u.extname(t));return [{id:a,name:o?.name||a,version:o?.version||"0.0.0",description:o?.description,path:t,source:e,enabled:true,manifest:o}]}async function h(t,e){let r=[];try{let n=d.readdirSync(t,{withFileTypes:!0});for(let o of n){let a=u.join(t,o.name);if(o.isFile()&&(o.name.endsWith(".ts")||o.name.endsWith(".js"))){let s=await A(a,e);r.push(...s);}else if(o.isDirectory()){let s=u.join(a,"easbot.plugin.json");if(!d.existsSync(s)){g.debug("Plugin directory missing manifest",{entryPath:a});continue}let i;try{i=JSON.parse(d.readFileSync(s,"utf-8"));}catch(m){g.error("Failed to read plugin manifest",{manifestPath:s,error:m});continue}let l=i.main||"index.ts",f=u.join(a,l);if(d.existsSync(f))r.push({id:i.id,name:i.name||i.id,version:i.version||"0.0.0",description:i.description,path:f,source:e,enabled:!0,manifest:i});else {let m=["index.js","plugin.ts","plugin.js"],w=!1;for(let E of m){let C=u.join(a,E);if(d.existsSync(C)){r.push({id:i.id,name:i.name||i.id,version:i.version||"0.0.0",description:i.description,path:C,source:e,enabled:!0,manifest:i}),w=!0;break}}w||g.error("Plugin entry file not found",{entryPath:a,entryFile:l});}}}}catch(n){g.error("Failed to read plugin directory",{dirPath:t,error:n});}return r}var c=a.create({service:"cli-plugin-loader"}),b=class{constructor(e){b$1(this,"loadedPlugins",new Map);b$1(this,"context");this.context=e;}async loadAll(e){let r=await F(e),n=await Promise.allSettled(r.map(async i=>{let l=this.context.config.plugins,f=l&&typeof l=="object"&&"entries"in l&&l.entries&&typeof l.entries=="object"?l.entries[i.id]:void 0;if(f&&typeof f=="object"&&"enabled"in f&&f.enabled===false)return c.info("Plugin disabled in config",{pluginId:i.id}),{pluginId:i.id,status:"disabled"};try{return await this.loadPlugin(i),{pluginId:i.id,status:"loaded"}}catch(m){return c.error("Failed to load plugin",{pluginId:i.id,error:m}),{pluginId:i.id,status:"failed",error:m}}})),o=n.filter(i=>i.status==="fulfilled"&&i.value.status==="loaded").length,a=n.filter(i=>i.status==="fulfilled"&&i.value.status==="failed").length,s=n.filter(i=>i.status==="fulfilled"&&i.value.status==="disabled").length;c.info("All plugins processed",{total:r.length,loaded:o,failed:a,disabled:s});}async loadPlugin(e){if(this.loadedPlugins.has(e.id)){c.debug("Plugin already loaded",{pluginId:e.id});return}c.debug("Loading plugin",{pluginId:e.id,path:e.path});try{let r=await import(e.path),n=r.default||r.plugin;if(!n)throw new Error("Plugin module does not export a plugin definition");if(typeof n!="function"&&(typeof n!="object"||!n.register))throw new Error("Plugin must be a function or an object with a register method");this.loadedPlugins.set(e.id,n),await this.initializePlugin(e.id,n),c.info("Plugin loaded successfully",{pluginId:e.id,name:e.name});}catch(r){let n=r instanceof Error?r.message:String(r),o=r instanceof Error?r.stack:void 0;throw c.error("Failed to load plugin module",{pluginId:e.id,path:e.path,error:n,stack:o}),new Error(`Failed to load plugin "${e.id}" from ${e.path}: ${n}`)}}async initializePlugin(e,r){let n=this.context.config.plugins,o=n&&typeof n=="object"&&"entries"in n&&n.entries&&typeof n.entries=="object"?n.entries[e]:void 0,a=(o&&typeof o=="object"&&"config"in o?o.config:{})||{},s=S(this.context,e,a);try{if(typeof r=="function")await r(s);else {let i=r;i.id&&i.id!==e&&c.warn("Plugin ID mismatch",{expected:e,actual:i.id}),await i.register(s);}c.debug("Plugin initialized",{pluginId:e});}catch(i){throw c.error("Plugin initialization failed",{pluginId:e,error:i}),this.loadedPlugins.delete(e),new Error(`Plugin "${e}" initialization failed: ${i instanceof Error?i.message:String(i)}`)}}getPlugin(e){return this.loadedPlugins.get(e)}getLoadedPluginIds(){return Array.from(this.loadedPlugins.keys())}};function H(t){return new b(t)}export{b as a,H as b};
|