@sleep2agi/agent-node 2.1.0-preview.2 → 2.1.0

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 (2) hide show
  1. package/dist/cli.js +13 -13
  2. package/package.json +2 -4
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as bz}from"node:module";var i=bz(import.meta.url);import{readFileSync as T,existsSync as n,writeFileSync as r,chmodSync as Uz}from"fs";import{join as v}from"path";import{hostname as a,homedir as Dz}from"os";import{mkdirSync as Jz,appendFileSync as Lz}from"fs";var Qz=Dz(),b=process.argv.slice(2),j={},Yz=[],Wz="2.1.0";try{let z=new URL(".",import.meta.url).pathname;for(let Z of["../package.json","../../package.json"])try{let $=JSON.parse(T(v(z,Z),"utf-8"));if($.version){Wz=$.version;break}}catch{}}catch{}for(let z=0;z<b.length;z++){if(b[z]==="--version"||b[z]==="-v")console.log(`agent-node v${Wz}`),process.exit(0);if(b[z]==="-h"||b[z]==="--help")console.log(`
2
+ import{createRequire as Uz}from"node:module";var i=Uz(import.meta.url);import{readFileSync as L,existsSync as r,writeFileSync as n,chmodSync as vz}from"fs";import{join as b}from"path";import{hostname as a,homedir as Dz}from"os";import{mkdirSync as qz,appendFileSync as Lz}from"fs";var Qz=Dz(),U=process.argv.slice(2),j={},Yz=[],Wz="2.1.0";try{let z=new URL(".",import.meta.url).pathname;for(let Z of["../package.json","../../package.json"])try{let $=JSON.parse(L(b(z,Z),"utf-8"));if($.version){Wz=$.version;break}}catch{}}catch{}for(let z=0;z<U.length;z++){if(U[z]==="--version"||U[z]==="-v")console.log(`agent-node v${Wz}`),process.exit(0);if(U[z]==="-h"||U[z]==="--help")console.log(`
3
3
  @sleep2agi/agent-node — AI Agent 节点,一行命令加入 CommHub 网络
4
4
 
5
5
  用法:
@@ -8,8 +8,8 @@ import{createRequire as bz}from"node:module";var i=bz(import.meta.url);import{re
8
8
  选项:
9
9
  --config <path> 配置文件 (.anet/nodes/<name>/config.json)
10
10
  --alias <name> Agent 别名 / CommHub alias (必需)
11
- --runtime <type> claude-agent-sdk (default) | codex-sdk | http-api | minimax
12
- --model <name> AI 模型 (codex: gpt-5.4, http-api: gpt-4o-mini, minimax: MiniMax-M1)
11
+ --runtime <type> claude-agent-sdk (default) | codex-sdk
12
+ --model <name> AI 模型 (claude-agent-sdk: claude-sonnet-4-6, codex-sdk: gpt-5.4)
13
13
  --hub <url> CommHub URL
14
14
  --tools <list> 工具列表,逗号分隔 ("all" = 全部)
15
15
  --max-turns <n> 每任务最大轮次 (default: 5)
@@ -24,19 +24,19 @@ import{createRequire as bz}from"node:module";var i=bz(import.meta.url);import{re
24
24
  Runtime:
25
25
  claude-agent-sdk Claude Agent SDK — Claude/MiniMax/Anthropic 兼容 API
26
26
  codex-sdk Codex SDK — GPT-5.4,复用 codex 登录态
27
- `),process.exit(0);if(b[z]==="--new-session"){j["new-session"]="true";continue}if(b[z]==="--channel"&&z+1<b.length){Yz.push(b[++z]);continue}if(b[z].startsWith("--")&&z+1<b.length)j[b[z].slice(2)]=b[++z]}function Xz(z){return z.replace(/^~(?=\/|$)/,Qz)}function Pz(z){let Z=z.indexOf(":");if(Z<0)return{type:z,raw:z};if(Z===0||Z===z.length-1)throw Error(`invalid channel spec "${z}" (expected type or type:path)`);return{type:z.slice(0,Z),path:Xz(z.slice(Z+1)),raw:z}}function E(z){if(!n(z))return null;try{return JSON.parse(T(z,"utf-8"))}catch{return null}}var J={},R="";if(j.config){let z=j.config.startsWith("/")?j.config:v(process.cwd(),j.config),Z=E(z);if(Z)J=Z,R=z,console.log(`[agent-node] Config: ${z}`)}var F=j.alias||process.env.COMMHUB_ALIAS||process.env.ALIAS||J.alias;if(!j.config&&F){let z=v(process.cwd(),".anet","nodes",F,"config.json"),Z=v(process.cwd(),".anet","profiles",`${F}.json`),$=n(z)?z:Z,Q=E($);if(Q){if(J={...Q,...J},R=$,console.log(`[agent-node] Config: ${$}`),Q.env&&typeof Q.env==="object"){for(let[Y,W]of Object.entries(Q.env))if(!process.env[Y]&&typeof W==="string")process.env[Y]=Xz(W)}}}var N=E(v(Qz,".anet","config.json"))||{};if(N.hub&&!J.hub)J.hub=N.hub;if(N.token&&!J.token)J.token=N.token;if(!j.config&&!Object.keys(J).length){let z=E(v(process.cwd(),".agent-node.json"));if(z)J=z,console.log("[agent-node] 配置: .agent-node.json")}if(!F)console.error(`错误: 必须指定 --alias
28
- 用法: npx @sleep2agi/agent-node --alias "我的Agent"`),process.exit(1);var Bz=j.runtime||process.env.RUNTIME||J.runtime||"claude-agent-sdk",Rz={"claude-agent-sdk":"claude","claude-sdk":"claude","agent-sdk":"claude",claude:"claude","codex-sdk":"codex",codex:"codex","http-api":"http","openai-api":"http",minimax:"http"},k=Rz[Bz]||"claude",Mz=Bz,l=j.url||j.hub||process.env.COMMHUB_URL||J.hub||"http://127.0.0.1:9200",P=j.model||process.env.MODEL||J.model,kz=["Read","Write","Edit","Bash","Glob","Grep","WebSearch","WebFetch"],o=j.tools||(Array.isArray(J.tools)?J.tools.join(","):J.tools)||"",x=o==="all"?kz:o.split(",").filter(Boolean),yz=parseInt(j["max-turns"]||J.flags?.maxTurns||J.maxTurns||"5"),t=parseFloat(j["max-budget"]||J.flags?.maxBudgetUsd||J.maxBudgetUsd||"0"),xz=j["new-session"]==="true",M=xz?"":j.session||J.session||J.resume||J.sessionId||"",S=j.prompt||J.systemPrompt||"",A=process.env.COMMHUB_TOKEN||J.token||N.token||"",g=j["log-dir"]||v(process.cwd(),".anet","nodes",F,"logs"),_z={debug:0,info:1,warn:2,error:3},Nz=_z[j["log-level"]||process.env.LOG_LEVEL||J.logLevel||"info"]??1,O=[...(Array.isArray(J.channels)?J.channels:[]).filter((z)=>!z.startsWith("server:")&&!z.startsWith("plugin:")),...Yz],Vz=O.map((z)=>{try{return Pz(z)}catch(Z){console.error(`[agent-node] ${Z.message}`),process.exit(1)}});function qz(z){if(!R||!z)return;try{let Z=JSON.parse(T(R,"utf-8"));if(Z.session===z)return;Z.session=z,r(R,JSON.stringify(Z,null,2)+`
29
- `),U(`session 写回: ${R} → ${z.slice(0,8)}...`)}catch(Z){C(`writebackSession failed: ${Z.message}`)}}function Az(z){if(!n(z))return;for(let Z of T(z,"utf-8").split(`
30
- `)){let $=Z.trim();if(!$||$.startsWith("#"))continue;let Q=$.indexOf("=");if(Q<=0)continue;let Y=$.slice(0,Q).trim(),W=$.slice(Q+1).trim().replace(/^['"]|['"]$/g,"");if(!process.env[Y])process.env[Y]=W}}function Oz(z){return v(process.cwd(),".anet","nodes",F,"channels",z)}function Cz(z){let Z=z.path||Oz("telegram");Az(v(Z,".env"));let $=process.env.TELEGRAM_BOT_TOKEN||"";if(!$)console.error(`[agent-node] telegram channel needs TELEGRAM_BOT_TOKEN in ${v(Z,".env")}`),process.exit(1);try{Uz(v(Z,".env"),384)}catch{}let Q=E(v(Z,"access.json"))||{},Y=v(Z,"inbox");try{Jz(Y,{recursive:!0})}catch{}return{type:"telegram",dir:Z,inboxDir:Y,token:$,allowFrom:Array.isArray(Q.allowFrom)?Q.allowFrom.map(String):[]}}var h=Vz.filter((z)=>z.type==="telegram").map(Cz),s=Vz.find((z)=>z.type!=="telegram");if(s)console.error(`[agent-node] unsupported channel: ${s.raw}`),process.exit(1);if(h.length>0&&k!=="codex"&&!x.includes("Read"))x.push("Read");try{Jz(g,{recursive:!0})}catch{}function d(z,Z,$){if(Z<Nz)return;let Q=new Date().toTimeString().slice(0,8),Y=z.toUpperCase().padEnd(5),W=`[${Q}] [${Y}] [${F}] ${$}`;console.log(W);try{let V=new Date().toISOString().slice(0,10);Lz(v(g,`${V}.log`),W+`
31
- `)}catch{}}var q=(z)=>d("info",1,z),U=(z)=>d("debug",0,z),C=(z)=>d("warn",2,z),L=(z)=>d("error",3,z);async function I(z,Z,$=3){let Q={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};if(A)Q.Authorization=`Bearer ${A}`;let Y;for(let W=0;W<=$;W++)try{let V=await fetch(`${l}/mcp`,{method:"POST",headers:Q,body:JSON.stringify({jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:z,arguments:Z}})});if(!V.ok&&W<$){Y=Error(`HTTP ${V.status}`),await new Promise((w)=>setTimeout(w,1000*Math.pow(2,W)));continue}let X=await V.text(),B=X.match(/data: (.+)/),G=B?JSON.parse(B[1]):JSON.parse(X),K=G?.result?.content?.[0]?.text;return K?JSON.parse(K):G}catch(V){if(Y=V,W<$)U(`callCommHub(${z}) attempt ${W+1} failed: ${V.message}, retrying...`),await new Promise((X)=>setTimeout(X,1000*Math.pow(2,W)))}throw Y||Error(`callCommHub(${z}) failed after ${$} retries`)}var f=J.node_id||"",Kz=f?`sdk-${f}`:`sdk-${F}-${Date.now().toString(36)}`,Tz=()=>I("report_status",{resume_id:Kz,alias:F,status:"idle",server:a(),hostname:a(),agent:`agent-node:${k}`,project_dir:process.cwd(),node_id:f||void 0,session_id:M||void 0,config_path:R||void 0,channels:O.length?JSON.stringify(O):void 0,model:P||void 0}),c=(z,Z)=>I("report_status",{resume_id:Kz,alias:F,status:z,task:Z,node_id:f||void 0,session_id:u||M||void 0,config_path:R||void 0,channels:O.length?JSON.stringify(O):void 0}),Ez=async()=>(await I("get_inbox",{alias:F,limit:20}))?.messages||[],Iz=(z)=>I("ack_inbox",{alias:F,message_id:z}),uz=(z,Z,$)=>I("send_reply",{alias:z,text:Z,from_session:F,in_reply_to:$||void 0,status:"replied"}),u=M||void 0;async function Sz(z,Z){let{query:$}=await import("@anthropic-ai/claude-agent-sdk"),Q=`你是 ${F},收到来自 ${Z} 的任务:
27
+ `),process.exit(0);if(U[z]==="--new-session"){j["new-session"]="true";continue}if(U[z]==="--channel"&&z+1<U.length){Yz.push(U[++z]);continue}if(U[z].startsWith("--")&&z+1<U.length)j[U[z].slice(2)]=U[++z]}function Xz(z){return z.replace(/^~(?=\/|$)/,Qz)}function Mz(z){let Z=z.indexOf(":");if(Z<0)return{type:z,raw:z};if(Z===0||Z===z.length-1)throw Error(`invalid channel spec "${z}" (expected type or type:path)`);return{type:z.slice(0,Z),path:Xz(z.slice(Z+1)),raw:z}}function T(z){if(!r(z))return null;try{return JSON.parse(L(z,"utf-8"))}catch{return null}}var q={},M="";if(j.config){let z=j.config.startsWith("/")?j.config:b(process.cwd(),j.config),Z=T(z);if(Z)q=Z,M=z,console.log(`[agent-node] Config: ${z}`)}var F=j.alias||process.env.COMMHUB_ALIAS||process.env.ALIAS||q.alias;if(!j.config&&F){let z=b(process.cwd(),".anet","nodes",F,"config.json"),Z=b(process.cwd(),".anet","profiles",`${F}.json`),$=r(z)?z:Z,Q=T($);if(Q){if(q={...Q,...q},M=$,console.log(`[agent-node] Config: ${$}`),Q.env&&typeof Q.env==="object"){for(let[Y,W]of Object.entries(Q.env))if(!process.env[Y]&&typeof W==="string")process.env[Y]=Xz(W)}}}var _=T(b(Qz,".anet","config.json"))||{};if(_.hub&&!q.hub)q.hub=_.hub;if(_.token&&!q.token)q.token=_.token;if(!j.config&&!Object.keys(q).length){let z=T(b(process.cwd(),".agent-node.json"));if(z)q=z,console.log("[agent-node] 配置: .agent-node.json")}if(!F)console.error(`错误: 必须指定 --alias
28
+ 用法: npx @sleep2agi/agent-node --alias "我的Agent"`),process.exit(1);var Bz=j.runtime||process.env.RUNTIME||q.runtime||"claude-agent-sdk",Pz={"claude-agent-sdk":"claude","claude-sdk":"claude","agent-sdk":"claude",claude:"claude","codex-sdk":"codex",codex:"codex"},y=Pz[Bz]||"claude",Rz=Bz,l=j.url||j.hub||process.env.COMMHUB_URL||q.hub||"http://127.0.0.1:9200",P=j.model||process.env.MODEL||q.model,kz=["Read","Write","Edit","Bash","Glob","Grep","WebSearch","WebFetch"],o=j.tools||(Array.isArray(q.tools)?q.tools.join(","):q.tools)||"",x=o==="all"?kz:o.split(",").filter(Boolean),yz=parseInt(j["max-turns"]||q.flags?.maxTurns||q.maxTurns||"5"),t=parseFloat(j["max-budget"]||q.flags?.maxBudgetUsd||q.maxBudgetUsd||"0"),xz=j["new-session"]==="true",R=xz?"":j.session||q.session||q.resume||q.sessionId||"",d=j.prompt||q.systemPrompt||"",N=process.env.COMMHUB_TOKEN||q.token||_.token||"",g=j["log-dir"]||b(process.cwd(),".anet","nodes",F,"logs"),_z={debug:0,info:1,warn:2,error:3},Nz=_z[j["log-level"]||process.env.LOG_LEVEL||q.logLevel||"info"]??1,A=[...(Array.isArray(q.channels)?q.channels:[]).filter((z)=>!z.startsWith("server:")&&!z.startsWith("plugin:")),...Yz],Kz=A.map((z)=>{try{return Mz(z)}catch(Z){console.error(`[agent-node] ${Z.message}`),process.exit(1)}});function Vz(z){if(!M||!z)return;try{let Z=JSON.parse(L(M,"utf-8"));if(Z.session===z)return;Z.session=z,n(M,JSON.stringify(Z,null,2)+`
29
+ `),v(`session 写回: ${M} → ${z.slice(0,8)}...`)}catch(Z){O(`writebackSession failed: ${Z.message}`)}}function Az(z){if(!r(z))return;for(let Z of L(z,"utf-8").split(`
30
+ `)){let $=Z.trim();if(!$||$.startsWith("#"))continue;let Q=$.indexOf("=");if(Q<=0)continue;let Y=$.slice(0,Q).trim(),W=$.slice(Q+1).trim().replace(/^['"]|['"]$/g,"");if(!process.env[Y])process.env[Y]=W}}function Oz(z){return b(process.cwd(),".anet","nodes",F,"channels",z)}function Cz(z){let Z=z.path||Oz("telegram");Az(b(Z,".env"));let $=process.env.TELEGRAM_BOT_TOKEN||"";if(!$)console.error(`[agent-node] telegram channel needs TELEGRAM_BOT_TOKEN in ${b(Z,".env")}`),process.exit(1);try{vz(b(Z,".env"),384)}catch{}let Q=T(b(Z,"access.json"))||{},Y=b(Z,"inbox");try{qz(Y,{recursive:!0})}catch{}return{type:"telegram",dir:Z,inboxDir:Y,token:$,allowFrom:Array.isArray(Q.allowFrom)?Q.allowFrom.map(String):[]}}var u=Kz.filter((z)=>z.type==="telegram").map(Cz),s=Kz.find((z)=>z.type!=="telegram");if(s)console.error(`[agent-node] unsupported channel: ${s.raw}`),process.exit(1);if(u.length>0&&y!=="codex"&&!x.includes("Read"))x.push("Read");try{qz(g,{recursive:!0})}catch{}function c(z,Z,$){if(Z<Nz)return;let Q=new Date().toTimeString().slice(0,8),Y=z.toUpperCase().padEnd(5),W=`[${Q}] [${Y}] [${F}] ${$}`;console.log(W);try{let K=new Date().toISOString().slice(0,10);Lz(b(g,`${K}.log`),W+`
31
+ `)}catch{}}var V=(z)=>c("info",1,z),v=(z)=>c("debug",0,z),O=(z)=>c("warn",2,z),C=(z)=>c("error",3,z);async function E(z,Z,$=3){let Q={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};if(N)Q.Authorization=`Bearer ${N}`;let Y;for(let W=0;W<=$;W++)try{let K=await fetch(`${l}/mcp`,{method:"POST",headers:Q,body:JSON.stringify({jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:z,arguments:Z}})});if(!K.ok&&W<$){Y=Error(`HTTP ${K.status}`),await new Promise((H)=>setTimeout(H,1000*Math.pow(2,W)));continue}let X=await K.text(),B=X.match(/data: (.+)/),G=B?JSON.parse(B[1]):JSON.parse(X),J=G?.result?.content?.[0]?.text;return J?JSON.parse(J):G}catch(K){if(Y=K,W<$)v(`callCommHub(${z}) attempt ${W+1} failed: ${K.message}, retrying...`),await new Promise((X)=>setTimeout(X,1000*Math.pow(2,W)))}throw Y||Error(`callCommHub(${z}) failed after ${$} retries`)}var S=q.node_id||"",Jz=S?`sdk-${S}`:`sdk-${F}-${Date.now().toString(36)}`,Tz=()=>E("report_status",{resume_id:Jz,alias:F,status:"idle",server:a(),hostname:a(),agent:`agent-node:${y}`,project_dir:process.cwd(),node_id:S||void 0,session_id:R||void 0,config_path:M||void 0,channels:A.length?JSON.stringify(A):void 0}),h=(z,Z)=>E("report_status",{resume_id:Jz,alias:F,status:z,task:Z,node_id:S||void 0,session_id:I||R||void 0,config_path:M||void 0,channels:A.length?JSON.stringify(A):void 0}),Ez=async()=>(await E("get_inbox",{alias:F,limit:20}))?.messages||[],Iz=(z)=>E("ack_inbox",{alias:F,message_id:z}),uz=(z,Z,$)=>E("send_reply",{alias:z,text:Z,from_session:F,in_reply_to:$||void 0,status:"replied"}),I=R||void 0;async function Sz(z,Z){let{query:$}=await import("@anthropic-ai/claude-agent-sdk"),Q=`你是 ${F},收到来自 ${Z} 的任务:
32
32
 
33
33
  ${z}
34
34
 
35
- 执行完后简要汇报结果。`,Y={model:P||void 0,tools:x.length?x:void 0,maxTurns:yz,permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,settingSources:[],env:process.env,cwd:process.cwd(),stderr:(X)=>{if(X.trim())U(`[stderr] ${X.trim().slice(0,200)}`)},hooks:{PreToolUse:[{hooks:[async(X)=>{return q(`[tool] ${X.tool_name}(${JSON.stringify(X.tool_input).slice(0,80)})`),{continue:!0}}]}]}};if(t>0)Y.maxBudgetUsd=t;if(S)Y.systemPrompt=S;if(u)Y.resume=u;let W="",V=Date.now();for await(let X of $({prompt:Q,options:Y})){let B=X;if(B.type==="system"&&B.subtype==="init")u=B.session_id,q(`[claude] session=${B.session_id?.slice(0,8)} model=${P||"default"}`),qz(B.session_id);if(B.type==="result"){let G=Date.now()-V,K=B.usage||{};q(`[claude] ${B.subtype} | ${G}ms | $${B.total_cost_usd?.toFixed(4)||"?"} | in=${K.input_tokens||0} out=${K.output_tokens||0} | turns=${B.num_turns}`),W=B.subtype==="success"?B.result||"任务完成":`执行出错: ${B.error||B.result||"未知错误"}`}}return W}var D=null,hz=S||[`你是 ${F},一个 AI Agent 节点,工作目录:${process.cwd()}。`,"你通过通信网络接收任务。收到任务后执行并返回结果。","规则:","1. 只回复有实质内容的结果。",'2. 绝对不要回复"收到""好的""ok""在线""待命""等待任务"等确认消息。',"3. 没有新任务时保持完全沉默,不要主动发任何消息。","4. 不要调用任何通信工具(send_task/send_message 等)。","5. 你的回复会被系统自动发送给任务发送者。"].join(`
36
- `),e={model_auto_compact_token_limit:200000,developer_instructions:hz};async function fz(z,Z,$){let Q;try{({Codex:Q}=await import("@openai/codex-sdk"))}catch{throw Error("@openai/codex-sdk not installed. Run: npm install -g @openai/codex-sdk @openai/codex")}if(!D){let B=new Q({config:e}),K={skipGitRepoCheck:!0,approvalPolicy:"never",model:P||"gpt-5.4",sandboxMode:"danger-full-access",modelReasoningEffort:"low"};if(M)D=B.resumeThread(M,K),q(`codex resumed thread: ${M}`);else D=B.startThread(K)}q(`[codex] model=${P||"gpt-5.4"} thread=${D?.id||"new"}`);let W=z,V=$?.length?[{type:"text",text:W},...$.map((B)=>({type:"local_image",path:B}))]:W,X=Date.now();try{let{events:B}=await D.runStreamed(V),G="",K=null,w=0;for await(let y of B)if(y.type==="item.started"){let H=y.item;U(`[codex] ${H.type}${H.command?`: ${H.command.slice(0,60)}`:H.tool?`: ${H.server}/${H.tool}`:""}`)}else if(y.type==="item.completed"){w++;let H=y.item;if(H.type==="agent_message")G=H.text||"";if(H.type==="command_execution")U(`[codex] cmd exit=${H.exit_code} | ${H.aggregated_output?.slice(0,80)}`);if(H.type==="reasoning")U(`[codex] thinking: ${H.text?.slice(0,80)}`);if(H.type==="mcp_tool_call")U(`[codex] mcp: ${H.server}/${H.tool} → ${H.status}`)}else if(y.type==="turn.completed")K=y.usage;let _=Date.now()-X,vz=K?.input_tokens||0;if(q(`[codex] done | ${_}ms | in=${vz} out=${K?.output_tokens||0} | items=${w}`),D?.id)qz(D.id);return G||"(无回复)"}catch(B){q(`codex thread error: ${B.message}, 重建`),D=new Q({config:e}).startThread({skipGitRepoCheck:!0,approvalPolicy:"never",model:P||"gpt-5.4",sandboxMode:"danger-full-access",modelReasoningEffort:"low"});let K=await D.run(V),w=Date.now()-X;return q(`[codex] retry done | ${w}ms`),K.finalResponse||"(无回复)"}}async function cz(z,Z){let $=process.env.OPENAI_API_KEY||process.env.MINIMAX_CODING_API_KEY||J.apiKey||"",Q=process.env.OPENAI_BASE_URL||J.apiBaseUrl||"https://api.openai.com/v1",Y=P||"gpt-4o-mini";if(!$)return"错误: 需要设置 OPENAI_API_KEY 或 MINIMAX_CODING_API_KEY";let W=S||`你是 ${F},一个 AI 助手。收到来自 ${Z} 的任务后简要执行并汇报。`,V=Date.now();q(`[http-api] model=${Y} base=${Q.replace(/\/v1$/,"")}`);let X=await fetch(`${Q}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$}`},body:JSON.stringify({model:Y,messages:[{role:"system",content:W},{role:"user",content:z}],max_tokens:2000})});if(!X.ok){let _=await X.text();return`HTTP API 错误 ${X.status}: ${_.slice(0,200)}`}let B=await X.json(),G=Date.now()-V,K=B.choices?.[0]?.message?.content||"",w=B.usage;return q(`[http-api] done | ${G}ms | in=${w?.prompt_tokens||0} out=${w?.completion_tokens||0}`),K||"(无回复)"}var zz=Promise.resolve();function Gz(z,Z,$){let Q=async()=>{if(k==="codex")return fz(z,Z,$);if(k==="http")return cz(z,Z);return Sz(z,Z)},Y=zz.then(Q,Q);return zz=Y.then(()=>{},()=>{}),Y}async function pz(z,Z){q(`→ processing [${k}]: ${z.slice(0,80)}`),await c("working",z.slice(0,200));let $;try{$=await Gz(z,Z)}catch(Q){$=`${k} 错误: ${Q.message}`,L(`✗ ${Q.message}`)}return await c("idle"),$}var m={},dz=5000,mz=new Set(["收到","好的","ok","嗯","是的","了解","明白","确认","done","ack","roger","yes","no","在线","待命","正常","保持在线","通信正常","已收到","收到了","好","行","noted","copy","received","understood","等待任务","等待中","等待指令","无新任务","idle","waiting"]);function jz(z,Z=!1){if(!z)return!0;if(!Z){if(z.replace(/[\s\p{P}\p{S}\p{Emoji}]/gu,"").length<3)return!0}let Q=z.trim().replace(/^[\[【].+?[\]】]\s*/,"").trim().toLowerCase().replace(/[\s。!?.!?✅❌👀⏳,,]+$/g,"").trim();if(mz.has(Q))return!0;if(/^[\p{Emoji}\s]+$/u.test(z.trim())&&!/[0-9a-zA-Z#*]/.test(z))return!0;return!1}function nz(z,Z){if(z===F)return"self";if(Z.startsWith(`[${F}]`))return"own-prefix";let $=Date.now();if(m[z]&&$-m[z]<dz)return"cooldown";if(jz(Z))return"low-value-inbound";return null}async function rz(){let z=await Ez();if(!z.length)return;for(let Z of z){let $=Z.from_session||"hub",Q=Z.content,Y=Z.type||"task";if(q(`← [${$}] (${Y}/${Z.priority||"normal"}) ${Q.slice(0,100)}`),await Iz(Z.id),Y!=="task"&&Y!=="broadcast"){U(`skip non-task message: type=${Y}`);continue}let W=nz($,Q);if(W){U(`skip message from ${$}: ${W}`);continue}let V=await pz(Q,$);if(q(`processTask returned: "${V.slice(0,80)}" (${V.length} chars)`),jz(V,!0)){q(`skip reply: low-value (${V.slice(0,30)})`);continue}try{q(`sending reply to ${$} (task ${Z.id.slice(0,8)})...`),await uz($,`[${F}] ${V.slice(0,2000)}`,Z.id),m[$]=Date.now(),q(`→ [${$}] ${V.slice(0,100)}`)}catch(X){C(`reply failed: ${X.message}`)}}}function Fz(z){return String(z.from?.id||z.chat?.id||"")}function wz(z){return z.from?.username||z.from?.first_name||Fz(z)||"telegram"}function lz(z,Z){if(z.allowFrom.length===0)return!0;let $=Fz(Z),Q=Z.from?.username?String(Z.from.username):"";return z.allowFrom.includes($)||!!Q&&z.allowFrom.includes(Q)}async function p(z,Z,$){let Q=await fetch(`${z.apiBase}/${Z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),Y=await Q.json();if(!Y.ok)throw Error(`telegram ${Z} failed: ${Y.description||Q.statusText}`);return Y.result}async function Zz(z,Z,$,Q){let Y=$.match(/[\s\S]{1,4096}/g)||["(无回复)"];for(let W=0;W<Y.length;W++)await p(z,"sendMessage",{chat_id:Z,text:Y[W],...Q&&W===0?{reply_to_message_id:Q}:{}})}async function $z(z,Z,$){let Q=await p(z,"getFile",{file_id:Z}),Y=String(Q.file_path||""),W=await fetch(`${z.fileBase}/${Y}`);if(!W.ok)throw Error(`telegram file download failed: ${W.status} ${W.statusText}`);let V=Y.split(".").pop(),X=($||Y.split("/").pop()||Z).replace(/[^a-zA-Z0-9._-]/g,"_"),B=X.includes(".")||!V?X:`${X}.${V}`,G=v(z.channel.inboxDir,`${Date.now()}_${B}`);return r(G,Buffer.from(await W.arrayBuffer())),G}async function gz(z,Z){let $=Z.text||Z.caption||"",Q=[];if(Array.isArray(Z.photo)&&Z.photo.length>0){let W=Z.photo[Z.photo.length-1],V=await $z(z,W.file_id,`photo_${Z.message_id}.jpg`);Q.push(V)}let Y=String(Z.document?.mime_type||"");if(Z.document&&Y.startsWith("image/")){let W=await $z(z,Z.document.file_id,Z.document.file_name||`image_${Z.message_id}`);Q.push(W)}if(Q.length)$+=`
35
+ 执行完后简要汇报结果。`,Y={model:P||void 0,tools:x.length?x:void 0,maxTurns:yz,permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0,settingSources:[],env:process.env,cwd:process.cwd(),stderr:(X)=>{if(X.trim())v(`[stderr] ${X.trim().slice(0,200)}`)},hooks:{PreToolUse:[{hooks:[async(X)=>{return V(`[tool] ${X.tool_name}(${JSON.stringify(X.tool_input).slice(0,80)})`),{continue:!0}}]}]}};if(t>0)Y.maxBudgetUsd=t;if(d)Y.systemPrompt=d;if(I)Y.resume=I;let W="",K=Date.now();for await(let X of $({prompt:Q,options:Y})){let B=X;if(B.type==="system"&&B.subtype==="init")I=B.session_id,V(`[claude] session=${B.session_id?.slice(0,8)} model=${P||"default"}`),Vz(B.session_id);if(B.type==="result"){let G=Date.now()-K,J=B.usage||{};V(`[claude] ${B.subtype} | ${G}ms | $${B.total_cost_usd?.toFixed(4)||"?"} | in=${J.input_tokens||0} out=${J.output_tokens||0} | turns=${B.num_turns}`),W=B.subtype==="success"?B.result||"任务完成":`执行出错: ${B.error||B.result||"未知错误"}`}}return W}var D=null,hz=d||[`你是 ${F},一个 AI Agent 节点,工作目录:${process.cwd()}。`,"你通过通信网络接收任务。收到任务后执行并返回结果。","规则:","1. 只回复有实质内容的结果。",'2. 绝对不要回复"收到""好的""ok""在线""待命""等待任务"等确认消息。',"3. 没有新任务时保持完全沉默,不要主动发任何消息。","4. 不要调用任何通信工具(send_task/send_message 等)。","5. 你的回复会被系统自动发送给任务发送者。"].join(`
36
+ `),e={model_auto_compact_token_limit:200000,developer_instructions:hz};async function fz(z,Z,$){let Q;try{({Codex:Q}=await import("@openai/codex-sdk"))}catch{throw Error("@openai/codex-sdk not installed. Run: npm install -g @openai/codex-sdk @openai/codex")}if(!D){let B=new Q({config:e}),J={skipGitRepoCheck:!0,approvalPolicy:"never",model:P||"gpt-5.4",sandboxMode:"danger-full-access",modelReasoningEffort:"low"};if(R)D=B.resumeThread(R,J),V(`codex resumed thread: ${R}`);else D=B.startThread(J)}V(`[codex] model=${P||"gpt-5.4"} thread=${D?.id||"new"}`);let W=z,K=$?.length?[{type:"text",text:W},...$.map((B)=>({type:"local_image",path:B}))]:W,X=Date.now();try{let{events:B}=await D.runStreamed(K),G="",J=null,H=0;for await(let k of B)if(k.type==="item.started"){let w=k.item;v(`[codex] ${w.type}${w.command?`: ${w.command.slice(0,60)}`:w.tool?`: ${w.server}/${w.tool}`:""}`)}else if(k.type==="item.completed"){H++;let w=k.item;if(w.type==="agent_message")G=w.text||"";if(w.type==="command_execution")v(`[codex] cmd exit=${w.exit_code} | ${w.aggregated_output?.slice(0,80)}`);if(w.type==="reasoning")v(`[codex] thinking: ${w.text?.slice(0,80)}`);if(w.type==="mcp_tool_call")v(`[codex] mcp: ${w.server}/${w.tool} → ${w.status}`)}else if(k.type==="turn.completed")J=k.usage;let p=Date.now()-X,bz=J?.input_tokens||0;if(V(`[codex] done | ${p}ms | in=${bz} out=${J?.output_tokens||0} | items=${H}`),D?.id)Vz(D.id);return G||"(无回复)"}catch(B){V(`codex thread error: ${B.message}, 重建`),D=new Q({config:e}).startThread({skipGitRepoCheck:!0,approvalPolicy:"never",model:P||"gpt-5.4",sandboxMode:"danger-full-access",modelReasoningEffort:"low"});let J=await D.run(K),H=Date.now()-X;return V(`[codex] retry done | ${H}ms`),J.finalResponse||"(无回复)"}}var zz=Promise.resolve();function Gz(z,Z,$){let Q=async()=>{if(y==="codex")return fz(z,Z,$);return Sz(z,Z)},Y=zz.then(Q,Q);return zz=Y.then(()=>{},()=>{}),Y}async function cz(z,Z){V(`→ processing [${y}]: ${z.slice(0,80)}`),await h("working",z.slice(0,200));let $;try{$=await Gz(z,Z)}catch(Q){$=`${y} 错误: ${Q.message}`,C(`✗ ${Q.message}`)}return await h("idle"),$}var m={},pz=5000,dz=new Set(["收到","好的","ok","嗯","是的","了解","明白","确认","done","ack","roger","yes","no","在线","待命","正常","保持在线","通信正常","已收到","收到了","好","行","noted","copy","received","understood","等待任务","等待中","等待指令","无新任务","idle","waiting"]);function jz(z,Z=!1){if(!z)return!0;if(!Z){if(z.replace(/[\s\p{P}\p{S}\p{Emoji}]/gu,"").length<3)return!0}let Q=z.trim().replace(/^[\[【].+?[\]】]\s*/,"").trim().toLowerCase().replace(/[\s。!?.!?✅❌👀⏳,,]+$/g,"").trim();if(dz.has(Q))return!0;if(/^[\p{Emoji}\s]+$/u.test(z.trim())&&!/[0-9a-zA-Z#*]/.test(z))return!0;return!1}function mz(z,Z){if(z===F)return"self";if(Z.startsWith(`[${F}]`))return"own-prefix";let $=Date.now();if(m[z]&&$-m[z]<pz)return"cooldown";if(jz(Z))return"low-value-inbound";return null}async function rz(){let z=await Ez();if(!z.length)return;for(let Z of z){let $=Z.from_session||"hub",Q=Z.content,Y=Z.type||"task";if(V(`← [${$}] (${Y}/${Z.priority||"normal"}) ${Q.slice(0,100)}`),await Iz(Z.id),Y!=="task"&&Y!=="broadcast"){v(`skip non-task message: type=${Y}`);continue}let W=mz($,Q);if(W){v(`skip message from ${$}: ${W}`);continue}let K=await cz(Q,$);if(V(`processTask returned: "${K.slice(0,80)}" (${K.length} chars)`),jz(K,!0)){V(`skip reply: low-value (${K.slice(0,30)})`);continue}try{V(`sending reply to ${$} (task ${Z.id.slice(0,8)})...`),await uz($,`[${F}] ${K.slice(0,2000)}`,Z.id),m[$]=Date.now(),V(`→ [${$}] ${K.slice(0,100)}`)}catch(X){O(`reply failed: ${X.message}`)}}}function Fz(z){return String(z.from?.id||z.chat?.id||"")}function wz(z){return z.from?.username||z.from?.first_name||Fz(z)||"telegram"}function nz(z,Z){if(z.allowFrom.length===0)return!0;let $=Fz(Z),Q=Z.from?.username?String(Z.from.username):"";return z.allowFrom.includes($)||!!Q&&z.allowFrom.includes(Q)}async function f(z,Z,$){let Q=await fetch(`${z.apiBase}/${Z}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),Y=await Q.json();if(!Y.ok)throw Error(`telegram ${Z} failed: ${Y.description||Q.statusText}`);return Y.result}async function Zz(z,Z,$,Q){let Y=$.match(/[\s\S]{1,4096}/g)||["(无回复)"];for(let W=0;W<Y.length;W++)await f(z,"sendMessage",{chat_id:Z,text:Y[W],...Q&&W===0?{reply_to_message_id:Q}:{}})}async function $z(z,Z,$){let Q=await f(z,"getFile",{file_id:Z}),Y=String(Q.file_path||""),W=await fetch(`${z.fileBase}/${Y}`);if(!W.ok)throw Error(`telegram file download failed: ${W.status} ${W.statusText}`);let K=Y.split(".").pop(),X=($||Y.split("/").pop()||Z).replace(/[^a-zA-Z0-9._-]/g,"_"),B=X.includes(".")||!K?X:`${X}.${K}`,G=b(z.channel.inboxDir,`${Date.now()}_${B}`);return n(G,Buffer.from(await W.arrayBuffer())),G}async function lz(z,Z){let $=Z.text||Z.caption||"",Q=[];if(Array.isArray(Z.photo)&&Z.photo.length>0){let W=Z.photo[Z.photo.length-1],K=await $z(z,W.file_id,`photo_${Z.message_id}.jpg`);Q.push(K)}let Y=String(Z.document?.mime_type||"");if(Z.document&&Y.startsWith("image/")){let W=await $z(z,Z.document.file_id,Z.document.file_name||`image_${Z.message_id}`);Q.push(W)}if(Q.length)$+=`
37
37
 
38
38
  [Telegram 附件已下载]
39
39
  ${Q.map((W)=>`- 图片: ${W}`).join(`
40
- `)}`;return{text:$.trim(),images:Q}}async function iz(z,Z){if(!lz(z.channel,Z))return;let $=Z.chat?.id,Q=Z.message_id,Y=`telegram:${wz(Z)}`,{text:W,images:V}=await gz(z,Z);if(!$||!Q||!W)return;U(`[TG] processing: ${W.slice(0,80)}`);try{let X=await Gz(W,Y,V);await Zz(z,$,X,Q),q(`→ [${Y}] ${X.slice(0,100)}`)}catch(X){L(`telegram task failed: ${X.message}`),await Zz(z,$,`处理出错: ${X.message}`,Q).catch(()=>{})}}async function az(z){let Z={channel:z,apiBase:`https://api.telegram.org/bot${z.token}`,fileBase:`https://api.telegram.org/file/bot${z.token}`,offset:0};try{let X=await p(Z,"getMe",{});q(`Telegram bot: @${X.username} (${X.first_name})`)}catch(X){L(`Telegram token 无效: ${X.message}`),process.exit(1)}let $=v(z.dir,"state.json");try{let X=JSON.parse(T($,"utf-8"));if(X.offset)Z.offset=X.offset,U(`Telegram offset restored: ${Z.offset}`)}catch{}let Q=()=>{try{r($,JSON.stringify({offset:Z.offset})+`
41
- `)}catch{}},Y=!1,W=[];async function V(){if(Y)return;Y=!0;while(W.length){let{msg:X,updateId:B}=W.shift();try{await iz(Z,X),Z.offset=B+1,Q()}catch(G){L(`TG handle: ${G.message}`)}}Y=!1}q(`Telegram polling: ${z.dir}`);while(!0)try{let B=await(await fetch(`${Z.apiBase}/getUpdates?offset=${Z.offset}&timeout=30`)).json();if(!B.ok)throw Error(B.description||"getUpdates failed");for(let G of B.result||[])if(Z.offset=G.update_id+1,G.message){let K=G.message,w=wz(K),_=K.text||K.caption||"";if(q(`← TG [${w}] ${_.slice(0,80)}${K.photo?" +img":""}${K.document?" +file":""}`),K.chat?.id&&K.message_id)p(Z,"setMessageReaction",{chat_id:K.chat.id,message_id:K.message_id,reaction:[{type:"emoji",emoji:W.length>0?"⏳":"\uD83D\uDC40"}]}).catch(()=>{});W.push({msg:K,updateId:G.update_id}),V()}}catch(X){C(`Telegram polling error: ${X.message}`),await new Promise((B)=>setTimeout(B,3000))}}async function oz(){let z=`${l}/events/${encodeURIComponent(F)}`,Z=3000;while(!0){U(`SSE connecting: ${z}`);try{let $={Accept:"text/event-stream","Cache-Control":"no-cache"};if(A)$.Authorization=`Bearer ${A}`;let Q=await fetch(z,{headers:$});if(!Q.ok||!Q.body){if(Q.status===401)L("SSE 401: token 无效或未配置。检查 ~/.anet/config.json 的 token 字段");else C(`SSE failed: ${Q.status}`);await new Promise((X)=>setTimeout(X,Z)),Z=Math.min(Z*1.5,60000);continue}Z=3000;let Y=Q.body.getReader(),W=new TextDecoder,V="";while(!0){let{done:X,value:B}=await Y.read();if(X)break;V+=W.decode(B,{stream:!0});let G=V.split(`
42
- `);V=G.pop()||"";for(let K of G){if(!K.startsWith("data: "))continue;try{let w=JSON.parse(K.slice(6));if(w.type==="connected"){q("SSE connected");continue}if(["new_task","broadcast"].includes(w.type))q(`← SSE ${w.type}`),await rz();if(w.type==="new_reply")q(`← SSE reply from ${w.from||"?"}${w.in_reply_to?` (task ${w.in_reply_to.slice(0,8)})`:""}`)}catch{}}}}catch($){C(`SSE error: ${$.message}`)}U(`SSE reconnecting (${Z/1000}s)...`),await new Promise(($)=>setTimeout($,Z)),Z=Math.min(Z*1.5,60000)}}q("启动");q(` runtime: ${Mz}`);q(` model: ${P||(k==="codex"?"gpt-5.4":"claude-sonnet-4-6")} ${P?"":"(default)"}`);q(` hub: ${l}${A?" (auth)":" (no auth!)"}`);q(` tools: ${x.length?`[${x.join(",")}]`:"(none)"}`);q(` channels:${h.length?` telegram(${h.map((z)=>z.dir).join(",")})`:" (none)"}`);q(` session: ${M||"(new)"}`);q(` log-dir: ${g}`);await Tz();q("已注册到 CommHub");setInterval(()=>c("idle").catch(()=>{}),180000);var Hz=async()=>{q("shutting down..."),await c("offline").catch(()=>{}),process.exit(0)};process.on("SIGINT",Hz);process.on("SIGTERM",Hz);for(let z of h)az(z);oz();
40
+ `)}`;return{text:$.trim(),images:Q}}async function gz(z,Z){if(!nz(z.channel,Z))return;let $=Z.chat?.id,Q=Z.message_id,Y=`telegram:${wz(Z)}`,{text:W,images:K}=await lz(z,Z);if(!$||!Q||!W)return;v(`[TG] processing: ${W.slice(0,80)}`);try{let X=await Gz(W,Y,K);await Zz(z,$,X,Q),V(`→ [${Y}] ${X.slice(0,100)}`)}catch(X){C(`telegram task failed: ${X.message}`),await Zz(z,$,`处理出错: ${X.message}`,Q).catch(()=>{})}}async function iz(z){let Z={channel:z,apiBase:`https://api.telegram.org/bot${z.token}`,fileBase:`https://api.telegram.org/file/bot${z.token}`,offset:0};try{let X=await f(Z,"getMe",{});V(`Telegram bot: @${X.username} (${X.first_name})`)}catch(X){C(`Telegram token 无效: ${X.message}`),process.exit(1)}let $=b(z.dir,"state.json");try{let X=JSON.parse(L($,"utf-8"));if(X.offset)Z.offset=X.offset,v(`Telegram offset restored: ${Z.offset}`)}catch{}let Q=()=>{try{n($,JSON.stringify({offset:Z.offset})+`
41
+ `)}catch{}},Y=!1,W=[];async function K(){if(Y)return;Y=!0;while(W.length){let{msg:X,updateId:B}=W.shift();try{await gz(Z,X),Z.offset=B+1,Q()}catch(G){C(`TG handle: ${G.message}`)}}Y=!1}V(`Telegram polling: ${z.dir}`);while(!0)try{let B=await(await fetch(`${Z.apiBase}/getUpdates?offset=${Z.offset}&timeout=30`)).json();if(!B.ok)throw Error(B.description||"getUpdates failed");for(let G of B.result||[])if(Z.offset=G.update_id+1,G.message){let J=G.message,H=wz(J),p=J.text||J.caption||"";if(V(`← TG [${H}] ${p.slice(0,80)}${J.photo?" +img":""}${J.document?" +file":""}`),J.chat?.id&&J.message_id)f(Z,"setMessageReaction",{chat_id:J.chat.id,message_id:J.message_id,reaction:[{type:"emoji",emoji:W.length>0?"⏳":"\uD83D\uDC40"}]}).catch(()=>{});W.push({msg:J,updateId:G.update_id}),K()}}catch(X){O(`Telegram polling error: ${X.message}`),await new Promise((B)=>setTimeout(B,3000))}}async function az(){let z=`${l}/events/${encodeURIComponent(F)}`,Z=3000;while(!0){v(`SSE connecting: ${z}`);try{let $={Accept:"text/event-stream","Cache-Control":"no-cache"};if(N)$.Authorization=`Bearer ${N}`;let Q=await fetch(z,{headers:$});if(!Q.ok||!Q.body){if(Q.status===401)C("SSE 401: token 无效或未配置。检查 ~/.anet/config.json 的 token 字段");else O(`SSE failed: ${Q.status}`);await new Promise((X)=>setTimeout(X,Z)),Z=Math.min(Z*1.5,60000);continue}Z=3000;let Y=Q.body.getReader(),W=new TextDecoder,K="";while(!0){let{done:X,value:B}=await Y.read();if(X)break;K+=W.decode(B,{stream:!0});let G=K.split(`
42
+ `);K=G.pop()||"";for(let J of G){if(!J.startsWith("data: "))continue;try{let H=JSON.parse(J.slice(6));if(H.type==="connected"){V("SSE connected");continue}if(["new_task","broadcast"].includes(H.type))V(`← SSE ${H.type}`),await rz();if(H.type==="new_reply")V(`← SSE reply from ${H.from||"?"}${H.in_reply_to?` (task ${H.in_reply_to.slice(0,8)})`:""}`)}catch{}}}}catch($){O(`SSE error: ${$.message}`)}v(`SSE reconnecting (${Z/1000}s)...`),await new Promise(($)=>setTimeout($,Z)),Z=Math.min(Z*1.5,60000)}}V("启动");V(` runtime: ${Rz}`);V(` model: ${P||(y==="codex"?"gpt-5.4":"claude-sonnet-4-6")} ${P?"":"(default)"}`);V(` hub: ${l}${N?" (auth)":" (no auth!)"}`);V(` tools: ${x.length?`[${x.join(",")}]`:"(none)"}`);V(` channels:${u.length?` telegram(${u.map((z)=>z.dir).join(",")})`:" (none)"}`);V(` session: ${R||"(new)"}`);V(` log-dir: ${g}`);await Tz();V("已注册到 CommHub");setInterval(()=>h("idle").catch(()=>{}),180000);var Hz=async()=>{V("shutting down..."),await h("offline").catch(()=>{}),process.exit(0)};process.on("SIGINT",Hz);process.on("SIGTERM",Hz);for(let z of u)iz(z);az();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-node",
3
- "version": "2.1.0-preview.2",
3
+ "version": "2.1.0",
4
4
  "description": "One-command AI Agent node for CommHub networks. Claude + Codex dual runtime.",
5
5
  "bin": {
6
6
  "agent-node": "./dist/cli.js"
@@ -42,8 +42,6 @@
42
42
  "@openai/codex-sdk": ">=0.118.0"
43
43
  },
44
44
  "peerDependenciesMeta": {
45
- "@openai/codex-sdk": {
46
- "optional": true
47
- }
45
+ "@openai/codex-sdk": { "optional": true }
48
46
  }
49
47
  }