@gencode/cli 0.0.9 → 0.0.10

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.
Files changed (97) hide show
  1. package/dist/bin.d.ts +4 -6
  2. package/dist/bin.js +1 -17
  3. package/dist/program-CUSjxuYI.js +6 -0
  4. package/dist/program.d.ts +6 -7
  5. package/dist/program.js +1 -37
  6. package/package.json +3 -3
  7. package/dist/auth.d.ts +0 -4
  8. package/dist/auth.d.ts.map +0 -1
  9. package/dist/auth.js +0 -9
  10. package/dist/auth.js.map +0 -1
  11. package/dist/bin.d.ts.map +0 -1
  12. package/dist/bin.js.map +0 -1
  13. package/dist/commands/agents.d.ts +0 -10
  14. package/dist/commands/agents.d.ts.map +0 -1
  15. package/dist/commands/agents.js +0 -319
  16. package/dist/commands/agents.js.map +0 -1
  17. package/dist/commands/bootstrap.d.ts +0 -12
  18. package/dist/commands/bootstrap.d.ts.map +0 -1
  19. package/dist/commands/bootstrap.js +0 -25
  20. package/dist/commands/bootstrap.js.map +0 -1
  21. package/dist/commands/commands.d.ts +0 -12
  22. package/dist/commands/commands.d.ts.map +0 -1
  23. package/dist/commands/commands.js +0 -37
  24. package/dist/commands/commands.js.map +0 -1
  25. package/dist/commands/memory.d.ts +0 -14
  26. package/dist/commands/memory.d.ts.map +0 -1
  27. package/dist/commands/memory.js +0 -173
  28. package/dist/commands/memory.js.map +0 -1
  29. package/dist/commands/plugins.d.ts +0 -3
  30. package/dist/commands/plugins.d.ts.map +0 -1
  31. package/dist/commands/plugins.js +0 -228
  32. package/dist/commands/plugins.js.map +0 -1
  33. package/dist/commands/run.d.ts +0 -29
  34. package/dist/commands/run.d.ts.map +0 -1
  35. package/dist/commands/run.js +0 -341
  36. package/dist/commands/run.js.map +0 -1
  37. package/dist/commands/sessions.d.ts +0 -14
  38. package/dist/commands/sessions.d.ts.map +0 -1
  39. package/dist/commands/sessions.js +0 -30
  40. package/dist/commands/sessions.js.map +0 -1
  41. package/dist/config.d.ts +0 -21
  42. package/dist/config.d.ts.map +0 -1
  43. package/dist/config.js +0 -33
  44. package/dist/config.js.map +0 -1
  45. package/dist/events/agent-progress.d.ts +0 -58
  46. package/dist/events/agent-progress.d.ts.map +0 -1
  47. package/dist/events/agent-progress.js +0 -2
  48. package/dist/events/agent-progress.js.map +0 -1
  49. package/dist/events/composite-sink.d.ts +0 -9
  50. package/dist/events/composite-sink.d.ts.map +0 -1
  51. package/dist/events/composite-sink.js +0 -17
  52. package/dist/events/composite-sink.js.map +0 -1
  53. package/dist/events/event-sink.d.ts +0 -6
  54. package/dist/events/event-sink.d.ts.map +0 -1
  55. package/dist/events/event-sink.js +0 -2
  56. package/dist/events/event-sink.js.map +0 -1
  57. package/dist/events/http-callback-sink.d.ts +0 -11
  58. package/dist/events/http-callback-sink.d.ts.map +0 -1
  59. package/dist/events/http-callback-sink.js +0 -68
  60. package/dist/events/http-callback-sink.js.map +0 -1
  61. package/dist/events/types.d.ts +0 -75
  62. package/dist/events/types.d.ts.map +0 -1
  63. package/dist/events/types.js +0 -2
  64. package/dist/events/types.js.map +0 -1
  65. package/dist/events/websocket-auth.d.ts +0 -8
  66. package/dist/events/websocket-auth.d.ts.map +0 -1
  67. package/dist/events/websocket-auth.js +0 -9
  68. package/dist/events/websocket-auth.js.map +0 -1
  69. package/dist/events/websocket-sink.d.ts +0 -17
  70. package/dist/events/websocket-sink.d.ts.map +0 -1
  71. package/dist/events/websocket-sink.js +0 -143
  72. package/dist/events/websocket-sink.js.map +0 -1
  73. package/dist/gensign_node_bg.wasm +0 -0
  74. package/dist/logger.d.ts +0 -30
  75. package/dist/logger.d.ts.map +0 -1
  76. package/dist/logger.js +0 -59
  77. package/dist/logger.js.map +0 -1
  78. package/dist/output.d.ts +0 -21
  79. package/dist/output.d.ts.map +0 -1
  80. package/dist/output.js +0 -99
  81. package/dist/output.js.map +0 -1
  82. package/dist/pkg-path.d.ts +0 -6
  83. package/dist/pkg-path.d.ts.map +0 -1
  84. package/dist/pkg-path.js +0 -8
  85. package/dist/pkg-path.js.map +0 -1
  86. package/dist/plugins-config.d.ts +0 -5
  87. package/dist/plugins-config.d.ts.map +0 -1
  88. package/dist/plugins-config.js +0 -30
  89. package/dist/plugins-config.js.map +0 -1
  90. package/dist/program-glxy0j6y.js +0 -765
  91. package/dist/program-glxy0j6y.js.map +0 -1
  92. package/dist/program.d.ts.map +0 -1
  93. package/dist/program.js.map +0 -1
  94. package/dist/utils/message-input.d.ts +0 -72
  95. package/dist/utils/message-input.d.ts.map +0 -1
  96. package/dist/utils/message-input.js +0 -117
  97. package/dist/utils/message-input.js.map +0 -1
package/dist/bin.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env node
2
- /**
3
- * CLI entrypoint for @gencode/cli.
4
- */
5
- import "./pkg-path.js";
6
- //# sourceMappingURL=bin.d.ts.map
1
+ //#region src/pkg-path.d.ts
2
+ declare global {
3
+ var getPkgPath: (() => string) | undefined;
4
+ }
package/dist/bin.js CHANGED
@@ -1,18 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * CLI entrypoint for @gencode/cli.
4
- */
5
- import "./pkg-path.js";
6
- import { createProgram } from "./program.js";
7
- import { logger } from "./logger.js";
8
- const STARTUP_TIME = Date.now();
9
- logger.info(`AIMax CLI starting (pid=${process.pid})`);
10
- const program = createProgram();
11
- program.parseAsync(process.argv).catch((err) => {
12
- logger.error(`Unexpected error: ${err.message}`);
13
- process.exit(1);
14
- }).finally(() => {
15
- const uptime = Date.now() - STARTUP_TIME;
16
- logger.info(`AIMax CLI exited (total uptime: ${uptime}ms)`);
17
- });
18
- //# sourceMappingURL=bin.js.map
2
+ import{r as e,t}from"./program-CUSjxuYI.js";function n(){globalThis.getPkgPath||(globalThis.getPkgPath=()=>`@wizard/aimax`)}n();const r=Date.now();e.info(`AIMax CLI starting (pid=${process.pid})`),t().parseAsync(process.argv).catch(t=>{e.error(`Unexpected error: ${t.message}`),process.exit(1)}).finally(()=>{let t=Date.now()-r;e.info(`AIMax CLI exited (total uptime: ${t}ms)`)});export{};
@@ -0,0 +1,6 @@
1
+ import{createRequire as e}from"node:module";import{Command as t}from"commander";import{bootstrapMountLayout as n,createBuiltinMemoryProvider as r,ensureBootstrapMountLayout as i,initializePluginSystem as a,listAvailableSlashCommands as o,listSessionSummaries as s,loadSkillsWithPluginDirs as c,normalizePluginsConfig as l,resolveMemoryProvider as ee,runAgent as u}from"@gencode/agents";import d from"node:path";import te from"gensign-node";import f from"node:fs/promises";import{addAgent as ne,addBinding as re,getAgentConfig as p,listAgents as ie,listBindings as m,loadAgentsConfig as h,normalizeAgentId as g,removeAgent as ae,removeBindings as _,resolveAgentDir as v,resolveDefaultAgentId as y,updateAgentIdentity as oe}from"@gencode/agents/config";function se(e){process.stdout.write(e)}function b(e){process.stdout.write(e+`
2
+ `)}function x(e){process.stderr.write(e+`
3
+ `)}function S(e){switch(e.type){case`start`:b(`\n[start] ${e.message}`);break;case`text`:se(e.text);break;case`bootstrap`:b(`\n[bootstrap:${e.phase}] ${e.dataDir}`);break;case`session_reset`:b(`\n[session:${e.action}] ${e.message}`);break;case`tool_start`:b(`\n[tool:${e.name}] ${JSON.stringify(e.input)}`);break;case`tool_end`:b(`[tool:${e.name}] ${e.isError?`ERROR`:`OK`} ${e.output.slice(0,200)}`);break;case`compaction`:b(`\n[compaction] ${e.reason}`);break;case`skill_used`:b(`\n[skill] ${e.skillName} agent=${e.agent} task=${e.taskId}`);break;case`error`:x(`\n[error] ${e.message}`);break;case`subagent_spawn`:b(`\n[subagent:spawn]${e.label?` "${e.label}"`:``} ${e.task}`);break;case`subagent_complete`:b(`[subagent:${e.status}] ${e.task}`);break}}function ce(e,t){if(t===`json`){b(JSON.stringify(e,null,2));return}b(`
4
+ `),b(`session: ${e.sessionId}`),b(`duration: ${e.durationMs}ms`),b(`tokens: input=${e.usage.input} output=${e.usage.output} total=${e.usage.total}`),e.error&&x(`error: ${e.error}`)}function le(e,t){if(t===`json`){b(JSON.stringify(e,null,2));return}if(e.length===0){b(`No sessions found.`);return}for(let t of e){let e=t.createdAt?new Date(t.createdAt).toLocaleString():`unknown`;b(`${t.id} ${e} [${t.channel}] ${t.title}`)}}function ue(e,t){if(t===`json`){b(JSON.stringify(e,null,2));return}b(`Bootstrap completed.`),b(`dataDir: ${e.dataDir}`),b(`created dirs: ${e.createdDirs.length}`),b(`created files: ${e.createdFiles.length}`),b(`skipped dirs: ${e.skippedDirs.length}`),b(`skipped files: ${e.skippedFiles.length}`)}function de(e){e.command(`bootstrap`).description(`Initialize the data directory with required directories and templates`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`--output <format>`,`Output format: text (default) or json`,`text`).action(async e=>{let t=e.output===`json`?`json`:`text`;try{ue(await n(e.dataDir),t)}catch(e){x(`Error bootstrapping data directory: ${e.message}`),process.exit(1)}})}function fe(e){return te.sm4_encrypt_ecb(e)}function C(e){return fe(e)}function pe(e={}){let t=e.baseUrl??process.env.AIMAX_BASE_URL,n=process.env.AIMAX_AUTH_TOKEN,r=e.authToken?C(e.authToken):n?C(n):e.apiKey??process.env.AIMAX_API_KEY,i=e.model??process.env.AIMAX_MODEL,a=[];if(t||a.push(`--base-url / AIMAX_BASE_URL`),r||a.push(`--api-key / AIMAX_API_KEY`),i||a.push(`--model / AIMAX_MODEL`),a.length>0)throw Error(`Missing required LLM configuration: ${a.join(`, `)}`);return{baseUrl:t,apiKey:r,model:i,contextWindow:e.contextWindow??(process.env.AIMAX_CONTEXT_WINDOW?Number(process.env.AIMAX_CONTEXT_WINDOW):void 0)}}function w(e,t){return t?d.resolve(t):d.join(e,`.aimax`,`plugins.json`)}async function T(e,t){let n=w(e,t);try{let e=await f.readFile(n,`utf-8`);return JSON.parse(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}async function E(e,t,n){let r=w(e,n);await f.mkdir(d.dirname(r),{recursive:!0}),await f.writeFile(r,JSON.stringify(t,null,2),`utf-8`)}function D(e){return typeof e==`object`&&!!e}function O(e){return D(e)&&e.type===`text`&&typeof e.text==`string`&&(e.textSignature===void 0||typeof e.textSignature==`string`)}function k(e){return D(e)&&e.type===`image`&&typeof e.data==`string`&&typeof e.mimeType==`string`}function me(e){return D(e)&&e.type===`thinking`&&typeof e.thinking==`string`&&(e.thinkingSignature===void 0||typeof e.thinkingSignature==`string`)&&(e.redacted===void 0||typeof e.redacted==`boolean`)}function A(e){return D(e)&&e.type===`toolCall`&&typeof e.id==`string`&&typeof e.name==`string`&&D(e.arguments)&&(e.thoughtSignature===void 0||typeof e.thoughtSignature==`string`)}function j(e){return typeof e==`string`||Array.isArray(e)&&e.every(e=>O(e)||k(e))}function M(e){return Array.isArray(e)&&e.every(e=>O(e)||me(e)||A(e))}function N(e){return D(e)&&typeof e.input==`number`&&typeof e.output==`number`&&typeof e.cacheRead==`number`&&typeof e.cacheWrite==`number`&&typeof e.totalTokens==`number`&&D(e.cost)&&typeof e.cost.input==`number`&&typeof e.cost.output==`number`&&typeof e.cost.cacheRead==`number`&&typeof e.cost.cacheWrite==`number`&&typeof e.cost.total==`number`}function P(e){return!D(e)||typeof e.role!=`string`?!1:e.role===`user`?j(e.content):e.role===`assistant`?M(e.content)&&typeof e.api==`string`&&typeof e.provider==`string`&&typeof e.model==`string`&&N(e.usage)&&(e.stopReason===`stop`||e.stopReason===`length`||e.stopReason===`toolUse`||e.stopReason===`error`||e.stopReason===`aborted`)&&(e.errorMessage===void 0||typeof e.errorMessage==`string`):e.role===`toolResult`?typeof e.toolCallId==`string`&&typeof e.toolName==`string`&&Array.isArray(e.content)&&e.content.every(e=>O(e)||k(e))&&typeof e.isError==`boolean`:!1}async function F(e){let t;try{t=await f.readFile(e,`utf-8`)}catch(e){throw Error(`Failed to read message file: ${e.message}`)}let n;try{n=JSON.parse(t)}catch(e){throw Error(`Invalid JSON in message file: ${e.message}`)}let r=Array.isArray(n)?n:[n];if(r.length===0||!r.every(e=>P(e)))throw Error(`Message file must contain one Message object or an array of Message objects`);return r}async function I(e){if(!!e.message==!!e.fromFile)throw Error(`Exactly one of --message or --from-file must be provided`);return e.fromFile?{kind:`messages`,messages:await F(e.fromFile)}:{kind:`text`,message:e.message}}let L=function(e){return e.INFO=`INFO`,e.ERROR=`ERROR`,e.WARN=`WARN`,e}({});function R(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}.${String(e.getMilliseconds()).padStart(3,`0`)}`}function z(e){if(!e)return``;let t=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}=${JSON.stringify(t)}`);return t.length>0?` ${t.join(` `)}`:``}function B(e,t,n){let r=R();process.stderr.write(`[${r}] [${e}] ${t}${z(n)}\n`)}const V={info:(e,t)=>B(L.INFO,e,t),warn:(e,t)=>B(L.WARN,e,t),error:(e,t)=>B(L.ERROR,e,t)};var he=class{startTime;name;constructor(e){this.name=e,this.startTime=Date.now()}end(){let e=Date.now()-this.startTime;return V.info(`${this.name} completed in ${e}ms`),e}},ge=class{constructor(e){this.sinks=e}async send(e){await Promise.allSettled(this.sinks.map(async t=>{await t.send(e)}))}async close(){await Promise.allSettled(this.sinks.map(async e=>{await e.close()}))}},_e=class{constructor(e){this.url=e}async send(e){await this.post(this.toPayload(e))}async close(){}async post(e){let t=Date.now(),n=ve(e);V.info(`sending callback event`,{callbackUrl:this.url,...n});let r=await fetch(this.url,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),i=Date.now()-t;if(!r.ok)throw V.error(`callback event failed`,{callbackUrl:this.url,httpStatus:r.status,durationMs:i,...n}),Error(`Callback failed with status ${r.status}`);V.info(`callback event delivered`,{callbackUrl:this.url,httpStatus:r.status,durationMs:i,...n})}toPayload(e){switch(e.type){case`start`:return e;case`progress`:return e;case`done`:return e;case`error`:return e;case`session_reset`:return e;default:{let t=e;throw Error(`Unsupported callback event: ${JSON.stringify(t)}`)}}}};function ve(e){return{eventType:e.type,sessionId:e.sessionId,messageId:e.messageId,channel:e.channel,progressType:e.type===`progress`?e.event.type:void 0}}function ye(e,t){if(t.kind===`none`)return e;let n=new URL(e);return n.searchParams.set(`authToken`,t.token),n.toString()}function H(){let e=globalThis.WebSocket;if(!e)throw Error(`WebSocket is not available in this runtime`);return e}function be(e){return e?{kind:`query_token`,token:e}:{kind:`none`}}var xe=class{socket=null;connectPromise=null;enabled=!0;textSequence=0;constructor(e,t,n){this.url=e,this.events=t,this.authToken=n}async send(e){let t=this.toEnvelope(e);if(!(!t||!this.enabled))try{await this.ensureConnected();let e=H();if(!this.socket||this.socket.readyState!==e.OPEN)return;this.socket.send(JSON.stringify(t))}catch{this.enabled=!1}}async close(){this.enabled=!1;let e=this.socket;if(this.socket=null,this.connectPromise=null,!e)return;let t=H();e.readyState!==t.CLOSED&&await new Promise(t=>{e.once(`close`,()=>t()),e.close()})}async ensureConnected(){if(!this.enabled)return;let e=H();if(this.socket&&this.socket.readyState===e.OPEN)return;if(this.connectPromise){await this.connectPromise;return}let t=new e(ye(this.url,be(this.authToken)));this.connectPromise=new Promise((e,n)=>{t.once(`open`,()=>{this.socket=t,t.on(`close`,()=>{this.socket===t&&(this.socket=null)}),e()}),t.once(`error`,e=>{n(e)})});try{await this.connectPromise}finally{this.connectPromise=null}}toEnvelope(e){let t=new Date().toISOString();switch(e.type){case`start`:return this.events.has(`start`)?{...e,timestamp:t}:null;case`done`:return this.events.has(`done`)?{...e,timestamp:t}:null;case`error`:return this.events.has(`error`)?{...e,timestamp:t}:null;case`session_reset`:return null;case`progress`:return e.event.type===`text`?this.events.has(`text`)?(this.textSequence+=1,{type:`text`,sessionId:e.sessionId,messageId:e.messageId,channel:e.channel,timestamp:t,sequence:this.textSequence,delta:e.event.text}):null:this.events.has(`progress`)?{type:`progress`,sessionId:e.sessionId,messageId:e.messageId,channel:e.channel,timestamp:t,event:e.event}:null;default:{let t=e;throw Error(`Unsupported stream event: ${JSON.stringify(t)}`)}}}};const U=[`start`,`text`,`done`,`error`],Se=[`H5`,`WEB`,`KLPA`,`CRON`,`EIP_ASSISTANT`];function Ce(e){if(!e?.trim())return new Set(U);let t=e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),n=new Set([`start`,`text`,`progress`,`done`,`error`]),r=new Set;for(let e of t){if(!n.has(e))throw Error(`Invalid stream event: ${e}. Must be one of start,text,progress,done,error`);r.add(e)}return r.size>0?r:new Set(U)}function we(e){let t=e.dataDir??process.env.AIMAX_DATA_DIR;if(!t)throw Error(`Data directory must be specified via --data-dir option or AIMAX_DATA_DIR environment variable`);return t}function Te(e){let t=e??`WEB`;if(!Se.includes(t))throw Error(`Invalid channel: ${t}. Must be 'H5', 'WEB', 'KLPA', 'CRON', or 'EIP_ASSISTANT'`);return t}async function Ee(e){let t=we(e),n=Te(e.channel),r=pe({baseUrl:e.baseUrl,apiKey:e.apiKey,authToken:e.authToken,model:e.model,contextWindow:e.contextWindow?Number(e.contextWindow):void 0}),i=await I({message:e.message,fromFile:e.fromFile});return{dataDir:t,channel:n,format:e.output===`json`?`json`:`text`,timeoutMs:e.timeout?Number(e.timeout):void 0,llm:r,input:i}}function De(e){let t=[];return e.callbackUrl&&t.push(new _e(e.callbackUrl)),e.streamUrl&&t.push(new xe(e.streamUrl,Ce(e.streamEvents),e.streamAuthToken)),new ge(t)}async function W(e,t){V.info(`dispatching external event`,Ve(t)),await e.sink.send(t)}function G(e,t,n){return{sink:e,channel:t,defaultMessageId:n}}function Oe(){let e=new AbortController,t=()=>e.abort();return process.once(`SIGTERM`,t),process.once(`SIGINT`,t),{controller:e,cleanup:()=>{process.off(`SIGTERM`,t),process.off(`SIGINT`,t)}}}function ke(e){return{activeSessionId:e??`pending`,finalResult:null}}function Ae(e,t){e.activeSessionId=t.sessionId??e.activeSessionId}function je(e,t){return e.messageId??t}async function Me(e,t,n){if(await K(t,e.format,n.activeSessionId,e.dataDir,`checking`),(await i(e.dataDir)).performedBootstrap){await K(t,e.format,n.activeSessionId,e.dataDir,`initializing`),await K(t,e.format,n.activeSessionId,e.dataDir,`initialized`);return}await K(t,e.format,n.activeSessionId,e.dataDir,`ready`)}async function K(e,t,n,r,i){let a={type:`bootstrap`,phase:i,dataDir:r};t===`text`&&S(a),await W(e,{sessionId:n,channel:e.channel,messageId:e.defaultMessageId,type:`progress`,event:a})}function Ne(e,t,n){return async r=>{Ae(n,r),e.format===`text`&&S(r);let i=je(r,t.defaultMessageId);if(r.type===`start`){await W(t,{sessionId:n.activeSessionId,channel:e.channel,messageId:i,type:`start`,message:r.message});return}if(r.type===`session_reset`){await W(t,{sessionId:n.activeSessionId,channel:e.channel,messageId:i,type:`session_reset`,action:r.action,previousSessionId:r.previousSessionId,message:r.message});return}await W(t,{sessionId:n.activeSessionId,channel:e.channel,messageId:i,type:`progress`,event:r})}}function Pe(e,t,n,r,i){let a={dataDir:t.dataDir,sessionId:e.sessionId,messageId:e.messageId,channel:t.channel,llm:t.llm,timeoutMs:t.timeoutMs,abortSignal:n.signal,plugins:i?{config:i,dataDir:t.dataDir,workspaceDir:d.join(t.dataDir,`workspace`),bundledDir:process.env.AIMAX_PLUGINS_BUNDLED_DIR,llmAllowlist:i.llmAllowlist}:void 0,onProgress:r};return t.input.kind===`messages`?{...a,messages:t.input.messages}:{...a,message:t.input.message}}async function Fe(e,t,n,r){if(t.activeSessionId=r.sessionId,t.finalResult=r,r.error){await W(e,{sessionId:r.sessionId,channel:e.channel,messageId:n,type:`error`,message:r.error});return}await W(e,{sessionId:r.sessionId,channel:e.channel,messageId:n,type:`done`,result:{text:r.text,usage:r.usage,durationMs:r.durationMs,error:r.error}})}async function Ie(e,t,n,r){await W(e,{sessionId:t.finalResult?.sessionId??t.activeSessionId,channel:e.channel,messageId:n,type:`error`,message:`Fatal: ${r.message}`})}function Le(e,t){V.info(`run command started`,{channel:t.channel,dataDir:t.dataDir,sessionId:e.sessionId??`new`,messageId:e.messageId,output:t.format,hasCallback:!!e.callbackUrl,hasStream:!!e.streamUrl})}function Re(e,t,n){ce(t,n),t.error?V.error(`run command failed: ${t.error}`):V.info(`run command succeeded`),e.end(),process.exit(t.error?1:0)}function ze(e,t){V.error(`run command error: ${t.message}`),x(`Fatal: ${t.message}`),e.end(),process.exit(1)}async function Be(e){let t=new he(`run command`),{controller:n,cleanup:r}=Oe(),i=null,a=e.channel??`WEB`,o=ke(e.sessionId);try{let r=await Ee(e);a=r.channel,Le(e,r),i=De(e),V.info(`external sink configured`,{callbackUrl:e.callbackUrl,streamUrl:e.streamUrl,streamEvents:e.streamEvents});let s=G(i,r.channel,e.messageId);await Me(r,s,o);let c=await T(r.dataDir,e.pluginsConfig),l=await u(Pe(e,r,n,Ne(r,s,o),c));await Fe(s,o,e.messageId,l),Re(t,l,r.format)}catch(n){let r=n;i&&await Ie(G(i,a,e.messageId),o,e.messageId,r),ze(t,r)}finally{await i?.close(),r()}}function Ve(e){return{eventType:e.type,sessionId:e.sessionId,messageId:e.messageId,channel:e.channel,progressType:e.type===`progress`?e.event.type:void 0,textLength:e.type===`done`?e.result.text.length:void 0,hasError:e.type===`error`?!0:e.type===`done`?!!e.result.error:void 0}}function He(e){e.command(`run`).description(`Run an agent task`).option(`-d, --data-dir <path>`,`Data directory path (overrides AIMAX_DATA_DIR)`).option(`--message <text>`,`User message to send to the agent`).option(`--from-file <path>`,`Load structured Message JSON from a file`).option(`-s, --session-id <id>`,`Resume an existing session by ID`).option(`--message-id <id>`,`Message ID for correlating events`).option(`-c, --channel <channel>`,`Channel type: H5 | WEB | KLPA | CRON | EIP_ASSISTANT (default: WEB)`,`WEB`).option(`--base-url <url>`,`LLM API base URL (overrides AIMAX_BASE_URL)`).option(`--api-key <key>`,`LLM API key (overrides AIMAX_API_KEY)`).option(`--auth-token <token>`,`Auth token used to generate the API key (highest priority)`).option(`--model <name>`,`LLM model name (overrides AIMAX_MODEL)`).option(`--context-window <n>`,`LLM context window size`).option(`--callback-url <url>`,`HTTP callback URL for progress events`).option(`--stream-url <url>`,`WebSocket URL for streaming text events`).option(`--stream-auth-token <token>`,`Auth token for WebSocket streaming`).option(`--stream-events <list>`,`Comma-separated stream events: start,text,progress,done,error`).option(`--timeout <ms>`,`Execution timeout in milliseconds (default: 600000)`).option(`--output <format>`,`Output format: text (default) or json`,`text`).option(`--plugins-config <path>`,`Plugins config file path`).action(async e=>{await Be(e)})}function Ue(e){e.command(`sessions`).description(`List sessions for a data directory`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`-c, --channel <channel>`,`Filter by channel type: H5 | WEB | KLPA | CRON | EIP_ASSISTANT`).option(`--output <format>`,`Output format: text (default) or json`,`text`).action(async e=>{let t=e.output===`json`?`json`:`text`;e.channel&&e.channel!==`H5`&&e.channel!==`WEB`&&e.channel!==`KLPA`&&e.channel!==`CRON`&&e.channel!==`EIP_ASSISTANT`&&(x(`Invalid channel: ${e.channel}. Must be 'H5', 'WEB', 'KLPA', 'CRON', or 'EIP_ASSISTANT'`),process.exit(1));try{le(await s(e.dataDir,e.channel),t)}catch(e){x(`Error listing sessions: ${e.message}`),process.exit(1)}})}function We(e,t){let n=[];return n.push(`backend: ${e.backend}`),n.push(`provider: ${e.provider}${e.model?` (${e.model})`:``}`),typeof e.files==`number`&&n.push(`files: ${e.files}`),typeof e.chunks==`number`&&n.push(`chunks: ${e.chunks}`),typeof e.dirty==`boolean`&&n.push(`dirty: ${e.dirty}`),e.dbPath&&n.push(`db: ${e.dbPath}`),e.sources?.length&&n.push(`sources: ${e.sources.join(`, `)}`),t&&(e.fts&&(n.push(`fts: enabled=${e.fts.enabled} available=${e.fts.available}`),e.fts.error&&n.push(`fts_error: ${e.fts.error}`)),e.vector&&(n.push(`vector: enabled=${e.vector.enabled} available=${e.vector.available??`unknown`}`),e.vector.dims&&n.push(`vector_dims: ${e.vector.dims}`),e.vector.loadError&&n.push(`vector_error: ${e.vector.loadError}`)),e.cache&&n.push(`cache: enabled=${e.cache.enabled} entries=${e.cache.entries??0}`)),n.join(`
5
+ `)}function q(e){let t=d.join(e.dataDir,`.aimax`),n=ee({providerId:e.provider,pluginId:e.providerPlugin,dataDir:e.dataDir,memoryDir:t});return n?n.provider:r({dataDir:e.dataDir,memoryDir:t},{includeSessions:e.includeSessions})}function Ge(e){let t=e.command(`memory`).description(`Manage semantic memory indexing and search`);t.command(`status`).description(`Show memory index status`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`--deep`,`Probe embedding/vector availability`).option(`--index`,`Run a refresh before reporting status`).option(`--include-sessions`,`Include session transcripts in indexing`).option(`--provider <id>`,`Memory provider id`).option(`--provider-plugin <id>`,`Memory provider plugin id`).option(`--verbose`,`Verbose output`).option(`--output <format>`,`Output format: text (default) or json`,`text`).action(async e=>{let t=e.output===`json`?`json`:`text`;try{let n=q({dataDir:e.dataDir,provider:e.provider,providerPlugin:e.providerPlugin,includeSessions:e.includeSessions});e.index&&n.sync&&await n.sync(`cli-status`);let r=n.status();e.deep&&((r.custom??={}).note=`deep probe is only supported by builtin provider`),b(t===`json`?JSON.stringify(r,null,2):We(r,e.deep))}catch(e){x(`Error getting memory status: ${e.message}`),process.exit(1)}}),t.command(`index`).description(`Reindex memory files`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`--include-sessions`,`Include session transcripts in indexing`).option(`--provider <id>`,`Memory provider id`).option(`--provider-plugin <id>`,`Memory provider plugin id`).option(`--verbose`,`Verbose output`).action(async e=>{try{let t=q({dataDir:e.dataDir,provider:e.provider,providerPlugin:e.providerPlugin,includeSessions:e.includeSessions});t.sync&&await t.sync(`cli-index`),b(`Memory index refreshed.`)}catch(e){x(`Error indexing memory: ${e.message}`),process.exit(1)}}),t.command(`search [query]`).description(`Search semantic memory`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`--query <text>`,`Search query`).option(`--include-sessions`,`Include session transcripts in search`).option(`--provider <id>`,`Memory provider id`).option(`--provider-plugin <id>`,`Memory provider plugin id`).option(`--output <format>`,`Output format: text (default) or json`,`text`).action(async(e,t)=>{let n=t.output===`json`?`json`:`text`,r=t.query?.trim()||e?.trim();r||(x(`Query is required: provide [query] or --query <text>`),process.exit(1));try{let e=await q({dataDir:t.dataDir,provider:t.provider,providerPlugin:t.providerPlugin,includeSessions:t.includeSessions}).search(r);if(n===`json`){b(JSON.stringify(e,null,2));return}if(e.length===0){b(`No results found for: ${r}`);return}b(e.map(e=>{let t=`${e.path}:${e.startLine}-${e.endLine} (${e.score.toFixed(4)}) ${e.snippet}`;return e.citation?`${t}\n${e.citation}`:t}).join(`
6
+ `))}catch(e){x(`Error searching memory: ${e.message}`),process.exit(1)}})}function J(e){return`${e.match.accountId?`${e.match.channel}:${e.match.accountId}`:e.match.channel} -> ${e.agentId}`}function Ke(e){return async t=>{let n=await h(t),r=ie(n),i=m(n);if(y(n),e.json){console.log(JSON.stringify({agents:r,bindings:i},null,2));return}console.log(`Agents:`);for(let e of r){let n=e.default?` (default)`:``,r=e.name&&e.name!==e.id?`${e.id}${n} (${e.name})`:`${e.id}${n}`;if(console.log(` - ${r}`),e.identity?.emoji||e.identity?.name){let t=[e.identity.emoji,e.identity.name].filter(Boolean).join(` `);console.log(` Identity: ${t}`)}let a=v(t,e.id);if(console.log(` Agent dir: ${a}`),e.model){let t=typeof e.model==`string`?e.model:e.model.primary;console.log(` Model: ${t}`)}let o=i.filter(t=>t.agentId===e.id);if(o.length>0){console.log(` Routing rules:`);for(let e of o)console.log(` - ${J(e)}`)}}}}function qe(e,t){return async n=>{p(await h(n),g(e))&&(console.error(`Agent "${e}" already exists.`),process.exit(1)),await ne(n,{id:e,name:t.name,model:t.model,default:t.default})||(console.error(`Agent "${e}" already exists.`),process.exit(1));let r=v(n,e);console.log(`Agent "${e}" added successfully.`),console.log(` Agent dir: ${r}`)}}function Je(e){return async t=>{let n=p(await h(t),g(e));n||(console.error(`Agent "${e}" not found.`),process.exit(1)),n.default===!0&&(console.error(`Cannot delete default agent "${e}".`),process.exit(1)),await ae(t,e)||(console.error(`Failed to delete agent "${e}".`),process.exit(1)),console.log(`Agent "${e}" deleted.`)}}function Ye(e){return async t=>{let n=await h(t),r=e.agent??y(n);p(n,r)||(console.error(`Agent "${r}" not found.`),process.exit(1)),(!e.bind||e.bind.length===0)&&(console.error(`Please specify --bind <channel>[:<account>]`),process.exit(1));for(let n of e.bind){let[e,...i]=n.split(`:`),a=i.join(`:`),o=[`H5`,`WEB`,`KLPA`,`CRON`,`EIP_ASSISTANT`];o.includes(e)||(console.error(`Invalid channel: ${e}`),console.error(`Valid channels: ${o.join(`, `)}`),process.exit(1)),await re(t,{agentId:r,match:{channel:e,accountId:a||void 0}}),console.log(`Binding added: ${n} -> ${r}`)}}}function Xe(e){return async t=>{let n=await h(t),r=e.agent??y(n);if(p(n,r)||(console.error(`Agent "${r}" not found.`),process.exit(1)),e.all){let e=await _(t,r,`*`);console.log(`Removed ${e} binding(s) for agent "${r}".`)}else if(e.bind&&e.bind.length>0){let n=0;for(let i of e.bind){let[e,...a]=i.split(`:`),o=await _(t,r,e,a.join(`:`)||void 0);o>0?(console.log(`Binding removed: ${i} -> ${r}`),n+=o):console.log(`No binding found: ${i} -> ${r}`)}}else console.error(`Please specify --bind <channel>[:<account>] or --all`),process.exit(1)}}function Ze(e){return async t=>{let n=m(await h(t));if(e.agent&&(n=n.filter(t=>t.agentId===e.agent)),e.json){console.log(JSON.stringify(n,null,2));return}if(n.length===0){console.log(`No bindings configured.`);return}console.log(`Routing bindings:`);for(let e of n)console.log(` ${J(e)}`)}}function Qe(e){return async t=>{let n=await h(t),r=e.agent??y(n);p(n,r)||(console.error(`Agent "${r}" not found.`),process.exit(1)),await oe(t,r,{name:e.name,emoji:e.emoji,avatar:e.avatar})||(console.error(`Failed to update identity for agent "${r}".`),process.exit(1)),console.log(`Identity updated for agent "${r}".`)}}function Y(e,t){let n=e.command(`agents`).description(`Manage agents`);n.command(`list`).description(`List all configured agents`).option(`-j, --json`,`Output as JSON`).option(`-b, --bindings`,`Show detailed binding rules`).action(async e=>{let n=t();await Ke(e)(n)}),n.command(`add <id>`).description(`Add a new agent`).option(`-n, --name <name>`,`Display name`).option(`-m, --model <model>`,`Model identifier`).option(`--default`,`Mark as default agent`).action(async(e,n)=>{let r=t();await qe(e,n)(r)}),n.command(`delete <id>`).description(`Delete an agent`).action(async e=>{let n=t();await Je(e)(n)}),n.command(`bind`).description(`Bind a channel to an agent`).option(`-a, --agent <id>`,`Target agent ID`).option(`-b, --bind <channel...>`,`Channel binding (e.g., WEB, KLPA:ops)`).action(async e=>{let n=t();await Ye(e)(n)}),n.command(`unbind`).description(`Unbind a channel from an agent`).option(`-a, --agent <id>`,`Target agent ID`).option(`-b, --bind <channel...>`,`Channel binding to remove`).option(`--all`,`Remove all bindings for the agent`).action(async e=>{let n=t();await Xe(e)(n)}),n.command(`bindings`).description(`List routing bindings`).option(`-a, --agent <id>`,`Filter by agent ID`).option(`-j, --json`,`Output as JSON`).action(async e=>{let n=t();await Ze(e)(n)}),n.command(`set-identity`).description(`Set agent identity`).option(`-a, --agent <id>`,`Target agent ID`).option(`-n, --name <name>`,`Agent name`).option(`-e, --emoji <emoji>`,`Agent emoji`).option(`--avatar <path>`,`Avatar path`).action(async e=>{let n=t();await Qe(e)(n)})}function X(e){return d.join(e,`workspace`)}function Z(){let e=process.env.AIMAX_PLUGINS_BUNDLED_DIR;return e&&e.trim()||void 0}function $e(e){if(e.length===0){b(`No plugins discovered.`);return}for(let t of e){let e=t.status.padEnd(8,` `);b(`${t.id} ${e} ${t.origin} ${t.source}`)}}function et(e){b(`id: ${e.id}`),b(`status: ${e.status}`),b(`origin: ${e.origin}`),b(`source: ${e.source}`),b(`enabled: ${e.enabled}`),e.error&&b(`error: ${e.error}`),b(`tools: ${e.toolCount}`),b(`hooks: ${e.hookCount}`),e.skills.length>0&&b(`skills: ${e.skills.join(`, `)}`)}function Q(e){return Array.from(new Set((e??[]).map(e=>e.trim()).filter(Boolean)))}function tt(e){if(e.length===0){b(`LLM allowlist is empty.`);return}for(let t of e)b(t)}function nt(e,t){let n=e.command(`plugins`).description(`Manage AIMax plugins`),r=e=>e.option(`--plugins-config <path>`,`Plugins config file path`);r(n.command(`list`)).description(`List discovered plugins`).option(`-d, --data-dir <path>`,`Data directory path`).action(async e=>{let n=e.dataDir??t();$e(a({config:await T(n,e.pluginsConfig),dataDir:n,workspaceDir:X(n),bundledDir:Z()}).registry.plugins)}),r(n.command(`info`)).description(`Show plugin details`).argument(`<id>`,`Plugin id`).option(`-d, --data-dir <path>`,`Data directory path`).action(async(e,n)=>{let r=n.dataDir??t(),i=a({config:await T(r,n.pluginsConfig),dataDir:r,workspaceDir:X(r),bundledDir:Z()}).registry.plugins.find(t=>t.id===e);i||(x(`Plugin not found: ${e}`),process.exit(1)),et(i)}),r(n.command(`enable`)).description(`Enable a plugin`).argument(`<id>`,`Plugin id`).option(`-d, --data-dir <path>`,`Data directory path`).action(async(e,n)=>{let r=n.dataDir??t(),i=await T(r,n.pluginsConfig)??{},o=l(i);a({config:i,dataDir:r,workspaceDir:X(r),bundledDir:Z()}).registry.plugins.some(t=>t.id===e)||(x(`Plugin not found: ${e}`),process.exit(1)),await E(r,{...i,entries:{...i.entries,[e]:{...i.entries?.[e]??{},enabled:!0}}},n.pluginsConfig),b(`Enabled ${e}`),o.allow.length>0&&!o.allow.includes(e)&&b(`Note: plugins.allow is set; add this plugin id to allowlist if needed.`)}),r(n.command(`disable`)).description(`Disable a plugin`).argument(`<id>`,`Plugin id`).option(`-d, --data-dir <path>`,`Data directory path`).action(async(e,n)=>{let r=n.dataDir??t(),i=await T(r,n.pluginsConfig)??{};a({config:i,dataDir:r,workspaceDir:X(r),bundledDir:Z()}).registry.plugins.some(t=>t.id===e)||(x(`Plugin not found: ${e}`),process.exit(1)),await E(r,{...i,entries:{...i.entries,[e]:{...i.entries?.[e]??{},enabled:!1}}},n.pluginsConfig),b(`Disabled ${e}`)}),r(n.command(`doctor`)).description(`Validate plugin configuration`).option(`-d, --data-dir <path>`,`Data directory path`).action(async e=>{let n=e.dataDir??t(),r=a({config:await T(n,e.pluginsConfig),dataDir:n,workspaceDir:X(n),bundledDir:Z()});if(r.diagnostics.length===0){b(`No plugin issues detected.`);return}for(let e of r.diagnostics)b(`${e.level===`error`?`ERROR`:`WARN`}${e.pluginId?` ${e.pluginId}`:``}: ${e.message}`);r.diagnostics.some(e=>e.level===`error`)&&process.exit(1)});let i=n.command(`llm-allow`).description(`Manage plugin LLM allowlist`);r(i.command(`list`)).description(`List LLM allowlist entries`).option(`-d, --data-dir <path>`,`Data directory path`).action(async e=>{tt(Q((await T(e.dataDir??t(),e.pluginsConfig))?.llmAllowlist))}),r(i.command(`add`)).description(`Add entries to the LLM allowlist (plugin id or tool name)`).argument(`<entry...>`,`Plugin id or tool name`).option(`-d, --data-dir <path>`,`Data directory path`).action(async(e,n)=>{let r=n.dataDir??t(),i=await T(r,n.pluginsConfig)??{},a=Q([...i.llmAllowlist??[],...e]);await E(r,{...i,llmAllowlist:a},n.pluginsConfig),b(`LLM allowlist updated (${a.length} entries).`)}),r(i.command(`remove`)).description(`Remove entries from the LLM allowlist`).argument(`<entry...>`,`Plugin id or tool name`).option(`-d, --data-dir <path>`,`Data directory path`).action(async(e,n)=>{let r=n.dataDir??t(),i=await T(r,n.pluginsConfig)??{},a=new Set(e.map(e=>e.trim()).filter(Boolean)),o=Q(i.llmAllowlist).filter(e=>!a.has(e));await E(r,{...i,llmAllowlist:o},n.pluginsConfig),b(`LLM allowlist updated (${o.length} entries).`)}),r(i.command(`clear`)).description(`Clear the LLM allowlist`).option(`-d, --data-dir <path>`,`Data directory path`).action(async e=>{let n=e.dataDir??t();await E(n,{...await T(n,e.pluginsConfig)??{},llmAllowlist:[]},e.pluginsConfig),b(`LLM allowlist cleared.`)})}function rt(e){e.command(`commands`).description(`List available slash commands for a data directory`).requiredOption(`-d, --data-dir <path>`,`Data directory path`).option(`--output <format>`,`Output format: text (default) or json`,`text`).action(async e=>{let t=e.output===`json`?`json`:`text`;try{let n=o(await c(e.dataDir,[]));if(t===`json`){b(JSON.stringify(n,null,2));return}b(`Commands`),b(` builtin: ${n.builtin.map(e=>e.name).join(` | `)}`),n.skillCommands.length>0?b(` skills: ${n.skillCommands.map(e=>e.name).join(` | `)}`):b(` skills: (none)`)}catch(e){x(`Error listing commands: ${e.message}`),process.exit(1)}})}const it=e(import.meta.url)(`../package.json`);function $(){return process.env.AIMAX_DATA_DIR||process.cwd()}function at(){let e=new t;return e.name(`aimax`).description(`AIMax CLI — runs agent tasks in a containerized environment`).version(it.version),He(e),Ue(e),rt(e),de(e),Ge(e),Y(e,$),nt(e,$),e}export{$ as n,V as r,at as t};
package/dist/program.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- /**
2
- * Commander program setup for @gencode/cli.
3
- * Exported separately from the binary entrypoint to allow unit testing.
4
- */
5
1
  import { Command } from "commander";
2
+
3
+ //#region src/program.d.ts
6
4
  /**
7
5
  * Resolves the data directory from environment or current working directory.
8
6
  */
9
- export declare function getDataDir(): string;
10
- export declare function createProgram(): Command;
11
- //# sourceMappingURL=program.d.ts.map
7
+ declare function getDataDir(): string;
8
+ declare function createProgram(): Command;
9
+ //#endregion
10
+ export { createProgram, getDataDir };
package/dist/program.js CHANGED
@@ -1,37 +1 @@
1
- /**
2
- * Commander program setup for @gencode/cli.
3
- * Exported separately from the binary entrypoint to allow unit testing.
4
- */
5
- import { Command } from "commander";
6
- import { registerBootstrapCommand } from "./commands/bootstrap.js";
7
- import { registerRunCommand } from "./commands/run.js";
8
- import { registerSessionsCommand } from "./commands/sessions.js";
9
- import { registerMemoryCommand } from "./commands/memory.js";
10
- import { registerAgentsCommands } from "./commands/agents.js";
11
- import { registerPluginsCommand } from "./commands/plugins.js";
12
- import { registerCommandsCommand } from "./commands/commands.js";
13
- import { createRequire } from "node:module";
14
- const require = createRequire(import.meta.url);
15
- const cliPackage = require("../package.json");
16
- /**
17
- * Resolves the data directory from environment or current working directory.
18
- */
19
- export function getDataDir() {
20
- return process.env.AIMAX_DATA_DIR || process.cwd();
21
- }
22
- export function createProgram() {
23
- const program = new Command();
24
- program
25
- .name("aimax")
26
- .description("AIMax CLI — runs agent tasks in a containerized environment")
27
- .version(cliPackage.version);
28
- registerRunCommand(program);
29
- registerSessionsCommand(program);
30
- registerCommandsCommand(program);
31
- registerBootstrapCommand(program);
32
- registerMemoryCommand(program);
33
- registerAgentsCommands(program, getDataDir);
34
- registerPluginsCommand(program, getDataDir);
35
- return program;
36
- }
37
- //# sourceMappingURL=program.js.map
1
+ import{n as e,t}from"./program-CUSjxuYI.js";export{t as createProgram,e as getDataDir};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gencode/cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "aimax": "./dist/bin.js"
@@ -21,7 +21,7 @@
21
21
  "commander": "^14.0.3",
22
22
  "gensign-node": "latest",
23
23
  "@gencode/shared": "0.0.2",
24
- "@gencode/agents": "0.0.9"
24
+ "@gencode/agents": "0.0.10"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^22.0.0",
@@ -30,7 +30,7 @@
30
30
  "vitest": "^4.0.18"
31
31
  },
32
32
  "scripts": {
33
- "build": "tsc --project tsconfig.json",
33
+ "build": "tsdown",
34
34
  "test": "vitest run",
35
35
  "test:coverage": "vitest run --coverage",
36
36
  "typecheck": "tsc --noEmit"
package/dist/auth.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare function encryptWithSM4(ticket: string): string;
2
- export declare function generateApiKey(ticket: string): string;
3
- export {};
4
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,OAAO,EAAE,CAAC"}
package/dist/auth.js DELETED
@@ -1,9 +0,0 @@
1
- import gensign from "gensign-node";
2
- export function encryptWithSM4(ticket) {
3
- return gensign.sm4_encrypt_ecb(ticket);
4
- }
5
- export function generateApiKey(ticket) {
6
- return encryptWithSM4(ticket);
7
- }
8
- export {};
9
- //# sourceMappingURL=auth.js.map
package/dist/auth.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,OAAO,EAAE,CAAC"}
package/dist/bin.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,eAAe,CAAC"}
package/dist/bin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,IAAI,CAAC,2BAA2B,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAEvD,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACtD,MAAM,CAAC,KAAK,CAAC,qBAAsB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;IACd,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;IACzC,MAAM,CAAC,IAAI,CAAC,mCAAmC,MAAM,KAAK,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Agents command group for @gencode/cli.
3
- * Manages multi-agent configuration (add, delete, list, bind, unbind, set-identity).
4
- */
5
- import { Command } from "commander";
6
- /**
7
- * Registers all agents subcommands with the program.
8
- */
9
- export declare function registerAgentsCommands(program: Command, getDataDir: () => string): void;
10
- //# sourceMappingURL=agents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0TpC;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,MAAM,GACvB,IAAI,CAmFN"}
@@ -1,319 +0,0 @@
1
- /**
2
- * Agents command group for @gencode/cli.
3
- * Manages multi-agent configuration (add, delete, list, bind, unbind, set-identity).
4
- */
5
- import { Command } from "commander";
6
- import { loadAgentsConfig, saveAgentsConfig, listAgents, listBindings, getAgentConfig, resolveDefaultAgentId, resolveAgentDir, normalizeAgentId, addAgent, removeAgent, addBinding, removeBindings, updateAgentIdentity, } from "@gencode/agents/config";
7
- import fs from "node:fs/promises";
8
- /**
9
- * Formats an agent binding for display.
10
- */
11
- function describeBinding(binding) {
12
- const route = binding.match.accountId
13
- ? `${binding.match.channel}:${binding.match.accountId}`
14
- : binding.match.channel;
15
- return `${route} -> ${binding.agentId}`;
16
- }
17
- /**
18
- * Lists all configured agents.
19
- */
20
- function agentsListAction(options) {
21
- return async (dataDir) => {
22
- const config = await loadAgentsConfig(dataDir);
23
- const agents = listAgents(config);
24
- const bindings = listBindings(config);
25
- const defaultId = resolveDefaultAgentId(config);
26
- if (options.json) {
27
- console.log(JSON.stringify({ agents, bindings }, null, 2));
28
- return;
29
- }
30
- console.log("Agents:");
31
- for (const agent of agents) {
32
- const defaultTag = agent.default ? " (default)" : "";
33
- const header = agent.name && agent.name !== agent.id
34
- ? `${agent.id}${defaultTag} (${agent.name})`
35
- : `${agent.id}${defaultTag}`;
36
- console.log(` - ${header}`);
37
- if (agent.identity?.emoji || agent.identity?.name) {
38
- const identity = [agent.identity.emoji, agent.identity.name]
39
- .filter(Boolean)
40
- .join(" ");
41
- console.log(` Identity: ${identity}`);
42
- }
43
- const agentDir = resolveAgentDir(dataDir, agent.id);
44
- console.log(` Agent dir: ${agentDir}`);
45
- if (agent.model) {
46
- const modelStr = typeof agent.model === "string"
47
- ? agent.model
48
- : agent.model.primary;
49
- console.log(` Model: ${modelStr}`);
50
- }
51
- // 绑定规则
52
- const agentBindings = bindings.filter((b) => b.agentId === agent.id);
53
- if (agentBindings.length > 0) {
54
- console.log(` Routing rules:`);
55
- for (const binding of agentBindings) {
56
- console.log(` - ${describeBinding(binding)}`);
57
- }
58
- }
59
- }
60
- };
61
- }
62
- /**
63
- * Adds a new agent.
64
- */
65
- function agentsAddAction(id, options) {
66
- return async (dataDir) => {
67
- const config = await loadAgentsConfig(dataDir);
68
- // 检查 ID 是否已存在
69
- const normalizedId = normalizeAgentId(id);
70
- if (getAgentConfig(config, normalizedId)) {
71
- console.error(`Agent "${id}" already exists.`);
72
- process.exit(1);
73
- }
74
- const newAgent = {
75
- id,
76
- name: options.name,
77
- model: options.model,
78
- default: options.default,
79
- };
80
- const created = await addAgent(dataDir, newAgent);
81
- if (!created) {
82
- console.error(`Agent "${id}" already exists.`);
83
- process.exit(1);
84
- }
85
- const agentDir = resolveAgentDir(dataDir, id);
86
- console.log(`Agent "${id}" added successfully.`);
87
- console.log(` Agent dir: ${agentDir}`);
88
- };
89
- }
90
- /**
91
- * Deletes an agent.
92
- */
93
- function agentsDeleteAction(id) {
94
- return async (dataDir) => {
95
- const config = await loadAgentsConfig(dataDir);
96
- const normalizedId = normalizeAgentId(id);
97
- const agent = getAgentConfig(config, normalizedId);
98
- if (!agent) {
99
- console.error(`Agent "${id}" not found.`);
100
- process.exit(1);
101
- }
102
- // 不允许删除默认 agent
103
- if (agent.default === true) {
104
- console.error(`Cannot delete default agent "${id}".`);
105
- process.exit(1);
106
- }
107
- const removed = await removeAgent(dataDir, id);
108
- if (!removed) {
109
- console.error(`Failed to delete agent "${id}".`);
110
- process.exit(1);
111
- }
112
- console.log(`Agent "${id}" deleted.`);
113
- };
114
- }
115
- /**
116
- * Binds a channel to an agent.
117
- */
118
- function agentsBindAction(options) {
119
- return async (dataDir) => {
120
- const config = await loadAgentsConfig(dataDir);
121
- const agentId = options.agent ?? resolveDefaultAgentId(config);
122
- // 验证 agent 存在
123
- if (!getAgentConfig(config, agentId)) {
124
- console.error(`Agent "${agentId}" not found.`);
125
- process.exit(1);
126
- }
127
- if (!options.bind || options.bind.length === 0) {
128
- console.error("Please specify --bind <channel>[:<account>]");
129
- process.exit(1);
130
- }
131
- for (const bindSpec of options.bind) {
132
- const [channel, ...rest] = bindSpec.split(":");
133
- const accountId = rest.join(":");
134
- const validChannels = ["H5", "WEB", "KLPA", "CRON", "EIP_ASSISTANT"];
135
- if (!validChannels.includes(channel)) {
136
- console.error(`Invalid channel: ${channel}`);
137
- console.error(`Valid channels: ${validChannels.join(", ")}`);
138
- process.exit(1);
139
- }
140
- const binding = {
141
- agentId,
142
- match: {
143
- channel: channel,
144
- accountId: accountId || undefined,
145
- },
146
- };
147
- await addBinding(dataDir, binding);
148
- console.log(`Binding added: ${bindSpec} -> ${agentId}`);
149
- }
150
- };
151
- }
152
- /**
153
- * Unbinds a channel from an agent.
154
- */
155
- function agentsUnbindAction(options) {
156
- return async (dataDir) => {
157
- const config = await loadAgentsConfig(dataDir);
158
- const agentId = options.agent ?? resolveDefaultAgentId(config);
159
- // 验证 agent 存在
160
- if (!getAgentConfig(config, agentId)) {
161
- console.error(`Agent "${agentId}" not found.`);
162
- process.exit(1);
163
- }
164
- if (options.all) {
165
- // 删除该 agent 的所有绑定
166
- const removed = await removeBindings(dataDir, agentId, "*");
167
- console.log(`Removed ${removed} binding(s) for agent "${agentId}".`);
168
- }
169
- else if (options.bind && options.bind.length > 0) {
170
- // 删除指定绑定
171
- let totalRemoved = 0;
172
- for (const bindSpec of options.bind) {
173
- const [channel, ...rest] = bindSpec.split(":");
174
- const accountId = rest.join(":");
175
- const removed = await removeBindings(dataDir, agentId, channel, accountId || undefined);
176
- if (removed > 0) {
177
- console.log(`Binding removed: ${bindSpec} -> ${agentId}`);
178
- totalRemoved += removed;
179
- }
180
- else {
181
- console.log(`No binding found: ${bindSpec} -> ${agentId}`);
182
- }
183
- }
184
- }
185
- else {
186
- console.error('Please specify --bind <channel>[:<account>] or --all');
187
- process.exit(1);
188
- }
189
- };
190
- }
191
- /**
192
- * Lists routing bindings.
193
- */
194
- function agentsBindingsAction(options) {
195
- return async (dataDir) => {
196
- const config = await loadAgentsConfig(dataDir);
197
- let bindings = listBindings(config);
198
- if (options.agent) {
199
- bindings = bindings.filter((b) => b.agentId === options.agent);
200
- }
201
- if (options.json) {
202
- console.log(JSON.stringify(bindings, null, 2));
203
- return;
204
- }
205
- if (bindings.length === 0) {
206
- console.log("No bindings configured.");
207
- return;
208
- }
209
- console.log("Routing bindings:");
210
- for (const binding of bindings) {
211
- console.log(` ${describeBinding(binding)}`);
212
- }
213
- };
214
- }
215
- /**
216
- * Sets agent identity.
217
- */
218
- function agentsSetIdentityAction(options) {
219
- return async (dataDir) => {
220
- const config = await loadAgentsConfig(dataDir);
221
- const agentId = options.agent ?? resolveDefaultAgentId(config);
222
- // 验证 agent 存在
223
- if (!getAgentConfig(config, agentId)) {
224
- console.error(`Agent "${agentId}" not found.`);
225
- process.exit(1);
226
- }
227
- const updated = await updateAgentIdentity(dataDir, agentId, {
228
- name: options.name,
229
- emoji: options.emoji,
230
- avatar: options.avatar,
231
- });
232
- if (!updated) {
233
- console.error(`Failed to update identity for agent "${agentId}".`);
234
- process.exit(1);
235
- }
236
- console.log(`Identity updated for agent "${agentId}".`);
237
- };
238
- }
239
- /**
240
- * Registers all agents subcommands with the program.
241
- */
242
- export function registerAgentsCommands(program, getDataDir) {
243
- const agentsCmd = program
244
- .command("agents")
245
- .description("Manage agents");
246
- // agents list
247
- agentsCmd
248
- .command("list")
249
- .description("List all configured agents")
250
- .option("-j, --json", "Output as JSON")
251
- .option("-b, --bindings", "Show detailed binding rules")
252
- .action(async (opts) => {
253
- const dataDir = getDataDir();
254
- await agentsListAction(opts)(dataDir);
255
- });
256
- // agents add
257
- agentsCmd
258
- .command("add <id>")
259
- .description("Add a new agent")
260
- .option("-n, --name <name>", "Display name")
261
- .option("-m, --model <model>", "Model identifier")
262
- .option("--default", "Mark as default agent")
263
- .action(async (id, opts) => {
264
- const dataDir = getDataDir();
265
- await agentsAddAction(id, opts)(dataDir);
266
- });
267
- // agents delete
268
- agentsCmd
269
- .command("delete <id>")
270
- .description("Delete an agent")
271
- .action(async (id) => {
272
- const dataDir = getDataDir();
273
- await agentsDeleteAction(id)(dataDir);
274
- });
275
- // agents bind
276
- agentsCmd
277
- .command("bind")
278
- .description("Bind a channel to an agent")
279
- .option("-a, --agent <id>", "Target agent ID")
280
- .option("-b, --bind <channel...>", "Channel binding (e.g., WEB, KLPA:ops)")
281
- .action(async (opts) => {
282
- const dataDir = getDataDir();
283
- await agentsBindAction(opts)(dataDir);
284
- });
285
- // agents unbind
286
- agentsCmd
287
- .command("unbind")
288
- .description("Unbind a channel from an agent")
289
- .option("-a, --agent <id>", "Target agent ID")
290
- .option("-b, --bind <channel...>", "Channel binding to remove")
291
- .option("--all", "Remove all bindings for the agent")
292
- .action(async (opts) => {
293
- const dataDir = getDataDir();
294
- await agentsUnbindAction(opts)(dataDir);
295
- });
296
- // agents bindings
297
- agentsCmd
298
- .command("bindings")
299
- .description("List routing bindings")
300
- .option("-a, --agent <id>", "Filter by agent ID")
301
- .option("-j, --json", "Output as JSON")
302
- .action(async (opts) => {
303
- const dataDir = getDataDir();
304
- await agentsBindingsAction(opts)(dataDir);
305
- });
306
- // agents set-identity
307
- agentsCmd
308
- .command("set-identity")
309
- .description("Set agent identity")
310
- .option("-a, --agent <id>", "Target agent ID")
311
- .option("-n, --name <name>", "Agent name")
312
- .option("-e, --emoji <emoji>", "Agent emoji")
313
- .option("--avatar <path>", "Avatar path")
314
- .action(async (opts) => {
315
- const dataDir = getDataDir();
316
- await agentsSetIdentityAction(opts)(dataDir);
317
- });
318
- }
319
- //# sourceMappingURL=agents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,cAAc,EACd,mBAAmB,GAGpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC;;GAEG;AACH,SAAS,eAAe,CAAC,OAAqB;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS;QACnC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE;QACvD,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;IAC1B,OAAO,GAAG,KAAK,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,OAA+C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SACnB,WAAW,CAAC,uBAAuB,CAAC;SACpC,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;SAChD,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC;SACtC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEL,sBAAsB;IACtB,SAAS;SACN,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;SAC7C,MAAM,CAAC,mBAAmB,EAAE,YAAY,CAAC;SACzC,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;SAC5C,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC;SACxC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * `aimax bootstrap` command — initializes the data directory structure.
3
- */
4
- import type { Command } from "commander";
5
- import { type OutputFormat } from "../output.js";
6
- export type BootstrapOptions = {
7
- dataDir: string;
8
- output?: OutputFormat;
9
- };
10
- /** Registers the `bootstrap` subcommand on the given Commander program */
11
- export declare function registerBootstrapCommand(program: Command): void;
12
- //# sourceMappingURL=bootstrap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/commands/bootstrap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgB/D"}
@@ -1,25 +0,0 @@
1
- /**
2
- * `aimax bootstrap` command — initializes the data directory structure.
3
- */
4
- import { bootstrapMountLayout } from "@gencode/agents";
5
- import { printBootstrapResult, writeError } from "../output.js";
6
- /** Registers the `bootstrap` subcommand on the given Commander program */
7
- export function registerBootstrapCommand(program) {
8
- program
9
- .command("bootstrap")
10
- .description("Initialize the data directory with required directories and templates")
11
- .requiredOption("-d, --data-dir <path>", "Data directory path")
12
- .option("--output <format>", "Output format: text (default) or json", "text")
13
- .action(async (options) => {
14
- const format = options.output === "json" ? "json" : "text";
15
- try {
16
- const result = await bootstrapMountLayout(options.dataDir);
17
- printBootstrapResult(result, format);
18
- }
19
- catch (err) {
20
- writeError(`Error bootstrapping data directory: ${err.message}`);
21
- process.exit(1);
22
- }
23
- });
24
- }
25
- //# sourceMappingURL=bootstrap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/commands/bootstrap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAqB,MAAM,cAAc,CAAC;AAOnF,0EAA0E;AAC1E,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,uEAAuE,CAAC;SACpF,cAAc,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SAC9D,MAAM,CAAC,mBAAmB,EAAE,uCAAuC,EAAE,MAAM,CAAC;SAC5E,MAAM,CAAC,KAAK,EAAE,OAAyB,EAAE,EAAE;QAC1C,MAAM,MAAM,GAAiB,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACzE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3D,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,uCAAwC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * `aimax commands` command — lists available slash commands.
3
- */
4
- import type { Command } from "commander";
5
- import { type OutputFormat } from "../output.js";
6
- export type CommandsOptions = {
7
- dataDir: string;
8
- output?: OutputFormat;
9
- };
10
- /** Registers the `commands` subcommand on the given Commander program */
11
- export declare function registerCommandsCommand(program: Command): void;
12
- //# sourceMappingURL=commands.d.ts.map