@sleep2agi/agent-network 2.3.0-preview.3 → 2.3.0-preview.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +1 -1
- package/dist/bin/goal-wake-log-render.d.ts +31 -0
- package/dist/src/client.js +1 -1
- package/dist/src/environ-alias.d.ts +14 -0
- package/dist/src/im/feishu/adapter.d.ts +106 -1
- package/dist/src/im/feishu/bridge.d.ts +7 -0
- package/dist/src/im/feishu/config.d.ts +31 -0
- package/dist/src/im/feishu/hub-upload.d.ts +88 -0
- package/dist/src/im/feishu/markdown-image-renderer.d.ts +61 -0
- package/dist/src/im/feishu/outbound-marker.d.ts +140 -0
- package/dist/src/im/feishu/outbound-paths.d.ts +50 -0
- package/dist/src/im/feishu/outbound-route.d.ts +62 -0
- package/dist/src/im/feishu/worker.js +390 -16
- package/dist/src/im/types.d.ts +38 -1
- package/dist/src/node-server.js +1 -1
- package/dist/src/normalize-runtime.d.ts +1 -1
- package/dist/src/opencode-pin.d.ts +41 -0
- package/dist/src/opencode-preset.d.ts +43 -0
- package/dist/src/project-key.d.ts +1 -0
- package/package.json +7 -4
package/dist/src/im/types.d.ts
CHANGED
|
@@ -72,13 +72,42 @@ export interface NormalizedIMEvent {
|
|
|
72
72
|
mentioned: boolean;
|
|
73
73
|
content: {
|
|
74
74
|
text?: string;
|
|
75
|
-
/** Local filesystem paths to already-downloaded images.
|
|
75
|
+
/** Local filesystem paths to already-downloaded images.
|
|
76
|
+
*
|
|
77
|
+
* RFC-020 §17 backward-compat shim: the new richer
|
|
78
|
+
* `attachments[]` field below is the canonical source going
|
|
79
|
+
* forward. `images` stays a `string[]` of paths so an older
|
|
80
|
+
* agent-node worker reading this envelope across a rolling
|
|
81
|
+
* upgrade doesn't crash. New workers prefer `attachments`,
|
|
82
|
+
* old workers ignore it and keep using `images`. */
|
|
76
83
|
images?: string[];
|
|
77
84
|
files?: {
|
|
78
85
|
name: string;
|
|
79
86
|
path?: string;
|
|
80
87
|
url?: string;
|
|
81
88
|
}[];
|
|
89
|
+
/** RFC-020 §17 cross-machine attachment descriptors.
|
|
90
|
+
*
|
|
91
|
+
* Each entry mirrors `meta.attachments[]` on commhub tasks
|
|
92
|
+
* (`{ type, file_id?, path?, mime?, name?, size? }`). The
|
|
93
|
+
* feishu bridge populates `file_id` by uploading inbound
|
|
94
|
+
* files to `/api/upload` so cross-host agents delegated via
|
|
95
|
+
* `commhub_send_task(meta.attachments=...)` can fetch via
|
|
96
|
+
* `/api/files/<id>`. When upload fails, `file_id` is absent
|
|
97
|
+
* and the descriptor degrades to path-only (single-host
|
|
98
|
+
* still works via local Read; no regression vs pre-fix
|
|
99
|
+
* baseline).
|
|
100
|
+
*
|
|
101
|
+
* Always populated alongside `images` for the same files —
|
|
102
|
+
* duplication is intentional for rolling-upgrade safety. */
|
|
103
|
+
attachments?: Array<{
|
|
104
|
+
type: "image" | "file";
|
|
105
|
+
path?: string;
|
|
106
|
+
file_id?: string;
|
|
107
|
+
mime?: string;
|
|
108
|
+
name?: string;
|
|
109
|
+
size?: number;
|
|
110
|
+
}>;
|
|
82
111
|
};
|
|
83
112
|
/**
|
|
84
113
|
* Original platform payload. Default: held in memory only and dropped after
|
|
@@ -115,6 +144,14 @@ export interface NormalizedIMMessage {
|
|
|
115
144
|
replyToMessageId?: string;
|
|
116
145
|
/** Ephemeral / visible-to-sender-only. Slack only; others ignore. */
|
|
117
146
|
ephemeral?: boolean;
|
|
147
|
+
/** Caption-mode hint (RFC-020 §15.2): bypass markdown-card / markdown→PNG
|
|
148
|
+
* rendering and send as plain text. Set by the bridge when the same
|
|
149
|
+
* dispatch loop is also sending one or more attachment files — the text
|
|
150
|
+
* is a caption ("here's the report"), not the deliverable. Without this
|
|
151
|
+
* hint, Vincent's "make me a PDF" UAT had the bot's accompanying
|
|
152
|
+
* description heading + bullet list rendered to PNG via #329, which
|
|
153
|
+
* read as "you sent another image" instead of "you sent my file". */
|
|
154
|
+
forceTextOnly?: boolean;
|
|
118
155
|
/** Tie back to the commhub task that produced this message. */
|
|
119
156
|
correlation: {
|
|
120
157
|
taskId: string;
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x15f4d9=a0_0x2ade;(function(_0x292073,_0x1ea9c2){const _0x2aad4f=a0_0x2ade,_0x2e6e37=_0x292073();while(!![]){try{const _0x1cb1a2=parseInt(_0x2aad4f(0x18d))/0x1+parseInt(_0x2aad4f(0x147))/0x2*(parseInt(_0x2aad4f(0x107))/0x3)+-parseInt(_0x2aad4f(0x115))/0x4+-parseInt(_0x2aad4f(0x119))/0x5+-parseInt(_0x2aad4f(0x19b))/0x6*(parseInt(_0x2aad4f(0x11f))/0x7)+-parseInt(_0x2aad4f(0xfe))/0x8*(-parseInt(_0x2aad4f(0x17e))/0x9)+parseInt(_0x2aad4f(0x16f))/0xa;if(_0x1cb1a2===_0x1ea9c2)break;else _0x2e6e37['push'](_0x2e6e37['shift']());}catch(_0x715d2f){_0x2e6e37['push'](_0x2e6e37['shift']());}}}(a0_0x4501,0xe74f4));import{readFileSync as a0_0x37dd53,existsSync as a0_0x42c8d7}from'fs';import{randomUUID as a0_0x11eb1d}from'crypto';import{join as a0_0x434ea2}from'path';import{hostname as a0_0x237be6}from'os';import{execSync as a0_0x5c9412}from'child_process';import{Server as a0_0x23ed3b}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x246d70}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1cc1ee,CallToolRequestSchema as a0_0x14e8b6}from'@modelcontextprotocol/sdk/types.js';function I(_0xf1e101){const _0x40e9a1=a0_0x2ade;if(!a0_0x42c8d7(_0xf1e101))return;for(let _0x5d428f of a0_0x37dd53(_0xf1e101,_0x40e9a1(0x192))[_0x40e9a1(0x113)]('\x0a')){let _0x54ed27=_0x5d428f[_0x40e9a1(0x175)]();if(!_0x54ed27||_0x54ed27['startsWith']('#'))continue;let _0x594886=_0x54ed27[_0x40e9a1(0x18e)]('=');if(_0x594886<0x0)continue;let _0x3b7c0b=_0x54ed27[_0x40e9a1(0x16c)](0x0,_0x594886)['trim'](),_0x1b5861=_0x54ed27[_0x40e9a1(0x16c)](_0x594886+0x1)['trim']()[_0x40e9a1(0x14e)](/^["']|["']$/g,'');if(!process.env[_0x3b7c0b])process.env[_0x3b7c0b]=_0x1b5861;}}var L=process.env.HOME||'~',U=a0_0x434ea2(L,a0_0x15f4d9(0x17f));I(a0_0x434ea2(U,a0_0x15f4d9(0x170)));var v=process[a0_0x15f4d9(0x18f)]()[a0_0x15f4d9(0x14e)](/\//g,'-');I(a0_0x434ea2(U,v,'.env'));function d(){const _0x33b9e2=a0_0x15f4d9;try{return a0_0x5c9412('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x33b9e2(0x192),'timeout':0x7d0})[_0x33b9e2(0x175)]();}catch{return'';}}function m(){const _0x4c3005=a0_0x15f4d9;try{let _0x20b3d9=a0_0x434ea2(L,_0x4c3005(0x11c),'config.json');if(a0_0x42c8d7(_0x20b3d9))return JSON[_0x4c3005(0x178)](a0_0x37dd53(_0x20b3d9,_0x4c3005(0x192)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x15f4d9(0x137)]||a0_0x15f4d9(0x138),f=process.env.COMMHUB_TMUX||d();function r(){const _0x95f1d7=a0_0x15f4d9;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS['trim']())return process.env.COMMHUB_ALIAS[_0x95f1d7(0x175)]();return process['stderr'][_0x95f1d7(0x112)](_0x95f1d7(0x10c)+(_0x95f1d7(0x177)+(f||_0x95f1d7(0x116))+_0x95f1d7(0x162)+a0_0x237be6()+_0x95f1d7(0x128))),'unattributed-'+process[_0x95f1d7(0x197)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x11eb1d(),F=process.env.COMMHUB_TOKEN||u[a0_0x15f4d9(0x12f)]||'';function W(_0x3484a7){const _0x1b9689=a0_0x15f4d9;let _0x1f39ba=new Date()['toTimeString']()['slice'](0x0,0x8);process[_0x1b9689(0x15c)][_0x1b9689(0x112)]('['+_0x1f39ba+_0x1b9689(0x14d)+_0x3484a7+'\x0a');}function N(_0x1ea835){return new Promise(_0x1db6a8=>setTimeout(_0x1db6a8,_0x1ea835));}function a0_0x2ade(_0x5bec9b,_0x4765fc){_0x5bec9b=_0x5bec9b-0xfd;const _0x4501be=a0_0x4501();let _0x2aded2=_0x4501be[_0x5bec9b];return _0x2aded2;}W(a0_0x15f4d9(0x10e)+j+a0_0x15f4d9(0x198)+G+a0_0x15f4d9(0x19d)+K[a0_0x15f4d9(0x16c)](0x0,0x8)+a0_0x15f4d9(0x12b)+(f||a0_0x15f4d9(0x185))+a0_0x15f4d9(0x121)+process[a0_0x15f4d9(0x18f)]()+'\x20PROJECT_ENV='+v);var D=new Map(),x=new a0_0x23ed3b({'name':a0_0x15f4d9(0x13c),'version':a0_0x15f4d9(0x163)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x15f4d9(0x11d),a0_0x15f4d9(0x12e),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x15f4d9(0x144),a0_0x15f4d9(0x18c)+G][a0_0x15f4d9(0x11b)]('\x0a')});x[a0_0x15f4d9(0x19a)](a0_0x1cc1ee,async()=>({'tools':[{'name':a0_0x15f4d9(0x176),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x15f4d9(0x131),'properties':{'task_id':{'type':a0_0x15f4d9(0x159),'description':a0_0x15f4d9(0x10b)},'text':{'type':'string','description':a0_0x15f4d9(0x140)},'status':{'type':'string','enum':['completed',a0_0x15f4d9(0x199),a0_0x15f4d9(0x130),a0_0x15f4d9(0x134),a0_0x15f4d9(0x125),a0_0x15f4d9(0x154)],'description':a0_0x15f4d9(0x174)}},'required':[a0_0x15f4d9(0x12c)]}},{'name':a0_0x15f4d9(0x102),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x15f4d9(0x131),'properties':{'status':{'type':a0_0x15f4d9(0x159),'enum':[a0_0x15f4d9(0x15e),a0_0x15f4d9(0x16a),a0_0x15f4d9(0x134),a0_0x15f4d9(0x125)]},'task':{'type':a0_0x15f4d9(0x159),'description':a0_0x15f4d9(0x148)},'progress':{'type':'number','description':a0_0x15f4d9(0x167)}},'required':[a0_0x15f4d9(0x15f)]}},{'name':'commhub_send_task','description':a0_0x15f4d9(0x16e),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x15f4d9(0x159),'description':a0_0x15f4d9(0x103)},'task':{'type':'string','description':a0_0x15f4d9(0x171)},'priority':{'type':a0_0x15f4d9(0x159),'enum':[a0_0x15f4d9(0x179),a0_0x15f4d9(0x111),a0_0x15f4d9(0x166)],'description':a0_0x15f4d9(0x13e)}},'required':['alias',a0_0x15f4d9(0x146)]}},{'name':a0_0x15f4d9(0x183),'description':a0_0x15f4d9(0x150),'inputSchema':{'type':a0_0x15f4d9(0x131),'properties':{'alias':{'type':a0_0x15f4d9(0x159),'description':a0_0x15f4d9(0x103)},'message':{'type':a0_0x15f4d9(0x159),'description':a0_0x15f4d9(0x182)}},'required':[a0_0x15f4d9(0x118),'message']}},{'name':a0_0x15f4d9(0x139),'description':a0_0x15f4d9(0x189),'inputSchema':{'type':'object','properties':{}}}]}));async function Y(_0x23f82d,_0x2f25fa){const _0x41b335=a0_0x15f4d9;let _0x120e4d=await fetch(j+_0x41b335(0x10f),{'method':_0x41b335(0x100),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x41b335(0x15b)+F}:{}},'body':JSON[_0x41b335(0x12a)]({'jsonrpc':_0x41b335(0x126),'id':0x1,'method':_0x41b335(0xff),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x41b335(0x13c),'version':_0x41b335(0x163)}}})});if(!_0x120e4d['ok']){let _0x34c0cc=await _0x120e4d[_0x41b335(0x12c)]();return W(_0x41b335(0x191)+_0x120e4d[_0x41b335(0x15f)]+'\x20'+_0x34c0cc[_0x41b335(0x16c)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x120e4d[_0x41b335(0x15f)]};}await _0x120e4d[_0x41b335(0x12c)]();let _0x531abb=(await(await fetch(j+_0x41b335(0x10f),{'method':_0x41b335(0x100),'headers':{'Content-Type':_0x41b335(0x133),'Accept':_0x41b335(0x143),...F?{'Authorization':_0x41b335(0x15b)+F}:{}},'body':JSON[_0x41b335(0x12a)]({'jsonrpc':_0x41b335(0x126),'id':0x2,'method':'tools/call','params':{'name':_0x23f82d,'arguments':_0x2f25fa}})}))[_0x41b335(0x12c)]())[_0x41b335(0x113)]('\x0a')[_0x41b335(0x114)](_0x3b2957=>_0x3b2957['startsWith'](_0x41b335(0x122)));if(_0x531abb){let _0x3b1479=JSON[_0x41b335(0x178)](_0x531abb['slice'](0x6));return _0x3b1479?.[_0x41b335(0x173)]?.[_0x41b335(0x18b)]?.[0x0]?.[_0x41b335(0x12c)]?JSON[_0x41b335(0x178)](_0x3b1479[_0x41b335(0x173)]['content'][0x0][_0x41b335(0x12c)]):_0x3b1479;}return{'ok':!0x1,'error':_0x41b335(0x181)};}x['setRequestHandler'](a0_0x14e8b6,async _0x5f5af3=>{const _0x544e9b=a0_0x15f4d9;let {name:_0x2b0297,arguments:_0x3b41dc}=_0x5f5af3[_0x544e9b(0x104)];if(_0x2b0297===_0x544e9b(0x176)){let {task_id:_0x3c469d,text:_0x3c71b9,status:_0x3b796c}=_0x3b41dc;if(_0x3b796c===_0x544e9b(0x101)||_0x3b796c===_0x544e9b(0x199)||_0x3b796c===_0x544e9b(0x130)){let _0x202d26=_0x3b796c===_0x544e9b(0x101)?_0x544e9b(0x145):_0x3b796c,_0x3fb581=_0x3c469d?D[_0x544e9b(0x13f)](_0x3c469d)||_0x544e9b(0x137):_0x544e9b(0x137),_0x2ab1cc=await Y('send_reply',{'alias':_0x3fb581,'text':_0x3c71b9,'in_reply_to':_0x3c469d||void 0x0,'status':_0x202d26,'from_session':G});if(_0x3c469d)D[_0x544e9b(0xfd)](_0x3c469d);return{'content':[{'type':'text','text':JSON['stringify'](_0x2ab1cc)}]};}let _0x1af9d3=await Y(_0x544e9b(0x11e),{'resume_id':K,'alias':G,'status':_0x3b796c===_0x544e9b(0x134)?_0x544e9b(0x134):_0x3b796c===_0x544e9b(0x125)?_0x544e9b(0x125):_0x544e9b(0x15e),'task':_0x3c71b9[_0x544e9b(0x16c)](0x0,0xc8),'output':_0x3c71b9});return{'content':[{'type':_0x544e9b(0x12c),'text':JSON[_0x544e9b(0x12a)](_0x1af9d3)}]};}if(_0x2b0297===_0x544e9b(0x102)){let {status:_0x1ec5c4,task:_0x474b26,progress:_0x5265fb}=_0x3b41dc,_0xe719c5=await Y(_0x544e9b(0x11e),{'resume_id':K,'alias':G,'status':_0x1ec5c4,'task':_0x474b26,'progress':_0x5265fb});return{'content':[{'type':_0x544e9b(0x12c),'text':JSON[_0x544e9b(0x12a)](_0xe719c5)}]};}if(_0x2b0297==='commhub_send_task'){let {alias:_0x1a2027,task:_0x33358b,priority:_0x3d67bf}=_0x3b41dc,_0xab37b7=await Y(_0x544e9b(0x15a),{'alias':_0x1a2027,'task':_0x33358b,'priority':_0x3d67bf||_0x544e9b(0x111),'from_session':G});return{'content':[{'type':_0x544e9b(0x12c),'text':JSON[_0x544e9b(0x12a)](_0xab37b7)}]};}if(_0x2b0297===_0x544e9b(0x183)){let {alias:_0x32e534,message:_0x28bde7}=_0x3b41dc,_0x1bb4f1=await Y('send_message',{'alias':_0x32e534,'message':_0x28bde7,'from_session':G});return{'content':[{'type':'text','text':JSON[_0x544e9b(0x12a)](_0x1bb4f1)}]};}if(_0x2b0297==='commhub_get_all_status'){let _0x56ebb6=await Y(_0x544e9b(0x129),{});return{'content':[{'type':'text','text':JSON[_0x544e9b(0x12a)](_0x56ebb6)}]};}return{'content':[{'type':_0x544e9b(0x12c),'text':JSON['stringify']({'error':_0x544e9b(0x13a)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x2695a0=a0_0x15f4d9;try{await Y(_0x2695a0(0x11e),{'resume_id':K,'alias':G,'status':_0x2695a0(0x16a),'server':a0_0x237be6(),'hostname':a0_0x237be6(),'agent':_0x2695a0(0x161),'project_dir':process['cwd'](),'tmux_name':f||void 0x0}),W(_0x2695a0(0x155)+G+_0x2695a0(0x136));}catch(_0x2a073f){W('re-register\x20failed:\x20'+_0x2a073f);}}async function o(){const _0x1bdfe1=a0_0x15f4d9;let _0x33cfc7=j+_0x1bdfe1(0x152)+encodeURIComponent(G),_0x4f9aed={};if(F)_0x4f9aed[_0x1bdfe1(0x18a)]='Bearer\x20'+F;W(_0x1bdfe1(0x180)+_0x33cfc7);let _0xbf5fa6=O,_0x36bd05=!0x0,_0x4a8f52=null;while(!0x0){try{let _0x305ba5=await fetch(_0x33cfc7,{'headers':_0x4f9aed});if(!_0x305ba5['ok']){if(W('SSE\x20error:\x20'+_0x305ba5[_0x1bdfe1(0x15f)]+'\x20'+_0x305ba5[_0x1bdfe1(0x153)]),_0x4a8f52=_0x4a8f52??Date[_0x1bdfe1(0x186)](),Date['now']()-_0x4a8f52>T){W(_0x1bdfe1(0x184)+j+_0x1bdfe1(0x13b));return;}await N(_0xbf5fa6),_0xbf5fa6=Math[_0x1bdfe1(0x19c)](_0xbf5fa6*0x2,R);continue;}let _0x533cb3=_0x305ba5[_0x1bdfe1(0x14f)][_0x1bdfe1(0x17b)](),_0x20e01c=new TextDecoder(),_0x2a85d5='';_0xbf5fa6=O;while(!0x0){let {done:_0x37d50e,value:_0x48b716}=await _0x533cb3[_0x1bdfe1(0x10d)]();if(_0x37d50e)break;_0x2a85d5+=_0x20e01c[_0x1bdfe1(0x160)](_0x48b716,{'stream':!0x0});let _0x1df06d=_0x2a85d5[_0x1bdfe1(0x113)]('\x0a\x0a');_0x2a85d5=_0x1df06d[_0x1bdfe1(0x10a)]()||'';for(let _0x4b5117 of _0x1df06d){let _0x1750a0=_0x4b5117[_0x1bdfe1(0x113)]('\x0a')[_0x1bdfe1(0x114)](_0x20c240=>_0x20c240[_0x1bdfe1(0x195)](_0x1bdfe1(0x122)));if(!_0x1750a0)continue;try{let _0x54b141=JSON['parse'](_0x1750a0[_0x1bdfe1(0x16c)](0x6));if(await a(_0x54b141),_0x54b141[_0x1bdfe1(0x193)]==='connected'){if(_0x4a8f52=null,!_0x36bd05)await l();_0x36bd05=!0x1;}}catch(_0x4ef405){W(_0x1bdfe1(0x14c)+_0x4ef405);}}}W(_0x1bdfe1(0x110));}catch(_0x2cc933){W(_0x1bdfe1(0x135)+_0x2cc933);}if(_0x4a8f52=_0x4a8f52??Date[_0x1bdfe1(0x186)](),Date[_0x1bdfe1(0x186)]()-_0x4a8f52>T){W(_0x1bdfe1(0x184)+j+_0x1bdfe1(0x13b));return;}await N(_0xbf5fa6),_0xbf5fa6=Math[_0x1bdfe1(0x19c)](_0xbf5fa6*0x2,R);}}async function a(_0x598cc1){const _0x53b639=a0_0x15f4d9;if(_0x598cc1[_0x53b639(0x193)]===_0x53b639(0x123)){W(_0x53b639(0x196)+G+'\x22');return;}if(_0x598cc1['type']===_0x53b639(0x142)){if(W(_0x53b639(0x156)+_0x598cc1[_0x53b639(0x151)]+':\x20'+_0x598cc1['message'][_0x53b639(0x16c)](0x0,0x3c)),await x[_0x53b639(0x157)]({'method':'notifications/claude/channel','params':{'content':_0x598cc1[_0x53b639(0x158)],'meta':{'sender':_0x598cc1[_0x53b639(0x151)]||_0x53b639(0x137),'sender_id':'commhub','user':_0x598cc1[_0x53b639(0x151)]||_0x53b639(0x137),'priority':'normal'}}}),_0x598cc1[_0x53b639(0x141)])await Y(_0x53b639(0x105),{'alias':G,'message_id':_0x598cc1[_0x53b639(0x141)]});return;}if(_0x598cc1[_0x53b639(0x193)]===_0x53b639(0x172)||_0x598cc1[_0x53b639(0x193)]==='broadcast'){W('←\x20'+_0x598cc1[_0x53b639(0x193)]+':\x20inbox_count='+_0x598cc1[_0x53b639(0x165)]+_0x53b639(0x13d)+(_0x598cc1[_0x53b639(0x149)]||_0x53b639(0x111)));let _0x56e576=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0x56e576?.['ok']&&_0x56e576[_0x53b639(0x11a)]?.[_0x53b639(0x108)]>0x0)for(let _0x23d285 of _0x56e576['messages']){let _0x107147={'sender':_0x23d285[_0x53b639(0x124)]||_0x53b639(0x137),'sender_id':_0x53b639(0x109),'user':_0x23d285['from_session']||'hub','task_id':_0x23d285['id'],'priority':_0x23d285['priority']||_0x53b639(0x111)};D[_0x53b639(0x127)](_0x23d285['id'],_0x23d285[_0x53b639(0x124)]||_0x53b639(0x137)),await x[_0x53b639(0x157)]({'method':_0x53b639(0x190),'params':{'content':_0x23d285[_0x53b639(0x18b)],'meta':_0x107147}}),W(_0x53b639(0x188)+_0x23d285['id'][_0x53b639(0x16c)](0x0,0x8)+'\x20from\x20'+_0x23d285['from_session']+':\x20'+_0x23d285['content'][_0x53b639(0x16c)](0x0,0x3c)),await Y('ack_inbox',{'alias':G,'message_id':_0x23d285['id']});}}}function a0_0x4501(){const _0x6cac2d=['delete','50808MTtBtu','initialize','POST','completed','commhub_report_status','Target\x20session\x20alias','params','ack_inbox','offline','6kuKwgv','length','commhub','pop','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','read','ENV:\x20URL=','/mcp','SSE\x20stream\x20ended,\x20reconnecting...','normal','write','split','find','6360224cceeZl','(none)','stdin','alias','8666325DAPEBr','messages','join','.anet','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','report_status','952469PecTou','SIGINT','\x20CWD=','data:\x20','connected','from_session','error','2.0','set','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','get_all_status','stringify','...\x20TMUX=','text','fatal:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','token','cancelled','object','SIGTERM','application/json','blocked','SSE\x20connection\x20error:\x20','\x22\x20after\x20SSE\x20reconnect','hub','http://127.0.0.1:9200','commhub_get_all_status','unknown\x20tool',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','commhub-channel','\x20priority=','Priority\x20(default:\x20normal)','get','Reply\x20text\x20/\x20result\x20summary','message_id','new_message','application/json,\x20text/event-stream','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','replied','task','906156sglHKg','Current\x20task\x20description','priority','heartbeat\x20failed:\x20','then','parse\x20error:\x20',']\x20[commhub]\x20','replace','body','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','from','/events/','statusText','in_progress','re-registered\x20as\x20\x22','←\x20message\x20from\x20','notification','message','string','send_task','Bearer\x20','stderr','warning:\x20could\x20not\x20register:\x20','working','status','decode','claude-code','\x20/\x20hostname=','0.3.0','session\x20disconnected','inbox_count','low','Progress\x200-100','MCP\x20stdio\x20connected','exit','idle','shutting\x20down,\x20reporting\x20offline...','slice','ready\x20—\x20waiting\x20for\x20events','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','29466220DuRAdr','.env','Task\x20content','new_task','result','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','trim','commhub_reply','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','parse','high','catch','getReader','\x22\x20(','connect','495ZWUGjY','.claude/channels/commhub','connecting\x20to\x20','no\x20response','Message\x20content','commhub_send_message','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','none','now','starting\x20SSE\x20listener...','→\x20injected\x20task\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Authorization','content','Session\x20alias:\x20','1565419vuDdEz','indexOf','cwd','notifications/claude/channel','CommHub\x20init\x20failed:\x20','utf-8','type','end','startsWith','SSE\x20connected\x20as\x20\x22','pid','\x20ALIAS=','failed','setRequestHandler','66RrCwQc','min','\x20RESUME_ID='];a0_0x4501=function(){return _0x6cac2d;};return a0_0x4501();}async function n(){const _0x2c16fb=a0_0x15f4d9;let _0x59ee4f=new a0_0x246d70();await x[_0x2c16fb(0x17d)](_0x59ee4f),W(_0x2c16fb(0x168)),W(_0x2c16fb(0x187)),o()['catch'](_0x59681d=>W('SSE\x20fatal:\x20'+_0x59681d)),Y(_0x2c16fb(0x11e),{'resume_id':K,'alias':G,'status':_0x2c16fb(0x16a),'server':a0_0x237be6(),'hostname':a0_0x237be6(),'agent':_0x2c16fb(0x161),'project_dir':process[_0x2c16fb(0x18f)](),'tmux_name':f||void 0x0})[_0x2c16fb(0x14b)](()=>W('registered\x20as\x20\x22'+G+_0x2c16fb(0x17c)+K[_0x2c16fb(0x16c)](0x0,0x8)+')'))[_0x2c16fb(0x17a)](_0x253dbc=>W(_0x2c16fb(0x15d)+_0x253dbc)),setInterval(()=>{const _0x535dd4=_0x2c16fb;Y(_0x535dd4(0x11e),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x237be6(),'hostname':a0_0x237be6(),'agent':'claude-code','project_dir':process[_0x535dd4(0x18f)](),'tmux_name':f||void 0x0})[_0x535dd4(0x17a)](_0x31b110=>W(_0x535dd4(0x14a)+_0x31b110));},0x2bf20),W(_0x2c16fb(0x16d));}n()['catch'](_0x1b8f2d=>{const _0x50c31e=a0_0x15f4d9;W(_0x50c31e(0x12d)+_0x1b8f2d),process[_0x50c31e(0x169)](0x1);});async function b(){const _0x549aac=a0_0x15f4d9;W(_0x549aac(0x16b)),await Y(_0x549aac(0x11e),{'resume_id':K,'alias':G,'status':_0x549aac(0x106),'task':_0x549aac(0x164)})[_0x549aac(0x17a)](()=>{}),process[_0x549aac(0x169)](0x0);}process[a0_0x15f4d9(0x117)]['on'](a0_0x15f4d9(0x194),()=>b()),process['on'](a0_0x15f4d9(0x132),()=>b()),process['on'](a0_0x15f4d9(0x120),()=>b());
|
|
2
|
+
const a0_0x48fad1=a0_0x51c3;(function(_0x2c2c9d,_0x1b1f26){const _0x49513d=a0_0x51c3,_0x4fded=_0x2c2c9d();while(!![]){try{const _0x272555=parseInt(_0x49513d(0x148))/0x1*(parseInt(_0x49513d(0x155))/0x2)+-parseInt(_0x49513d(0x15d))/0x3+parseInt(_0x49513d(0x13f))/0x4*(parseInt(_0x49513d(0x11d))/0x5)+-parseInt(_0x49513d(0xf6))/0x6*(parseInt(_0x49513d(0x11b))/0x7)+-parseInt(_0x49513d(0xf8))/0x8+parseInt(_0x49513d(0x12c))/0x9*(-parseInt(_0x49513d(0xed))/0xa)+parseInt(_0x49513d(0xd9))/0xb*(parseInt(_0x49513d(0x14c))/0xc);if(_0x272555===_0x1b1f26)break;else _0x4fded['push'](_0x4fded['shift']());}catch(_0x8cb7da){_0x4fded['push'](_0x4fded['shift']());}}}(a0_0x149c,0x9a37b));import{readFileSync as a0_0x410f16,existsSync as a0_0x40b2dc}from'fs';import{randomUUID as a0_0x424d0c}from'crypto';import{join as a0_0x4e79a4}from'path';import{hostname as a0_0x5d49e5}from'os';import{execSync as a0_0x42a342}from'child_process';function B(_0x2a3c62){const _0x49d746=a0_0x51c3;let _0x28209e=_0x2a3c62[_0x49d746(0x16b)](/[^a-zA-Z0-9\-_]/g,'-');return _0x28209e===''?'unknown':_0x28209e;}import{Server as a0_0x5425f7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x9cc349}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x21f415,CallToolRequestSchema as a0_0x3d23bd}from'@modelcontextprotocol/sdk/types.js';function T(_0x4ef2d3){const _0x4c9d90=a0_0x51c3;if(!a0_0x40b2dc(_0x4ef2d3))return;for(let _0x13db4c of a0_0x410f16(_0x4ef2d3,_0x4c9d90(0xf7))[_0x4c9d90(0x108)]('\x0a')){let _0x26bff9=_0x13db4c[_0x4c9d90(0x175)]();if(!_0x26bff9||_0x26bff9['startsWith']('#'))continue;let _0x46080f=_0x26bff9[_0x4c9d90(0x16f)]('=');if(_0x46080f<0x0)continue;let _0x2a0b7e=_0x26bff9[_0x4c9d90(0x144)](0x0,_0x46080f)[_0x4c9d90(0x175)](),_0x474b94=_0x26bff9[_0x4c9d90(0x144)](_0x46080f+0x1)[_0x4c9d90(0x175)]()[_0x4c9d90(0x16b)](/^["']|["']$/g,'');if(!process.env[_0x2a0b7e])process.env[_0x2a0b7e]=_0x474b94;}}var C=process.env.HOME||'~',r=a0_0x4e79a4(C,a0_0x48fad1(0x137));T(a0_0x4e79a4(r,a0_0x48fad1(0x157)));function a0_0x149c(){const _0x331492=['messages','ENV:\x20URL=','SIGTERM','pop','trim','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','connect','idle','cwd','code','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','814HQMKHy','normal','\x22\x20after\x20SSE\x20reconnect','application/json','read','number','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','toTimeString','commhub_send_message','hub','failed','\x20/\x20hostname=','text','ready\x20—\x20waiting\x20for\x20events','stringify','in_progress','warning:\x20could\x20not\x20register:\x20','commhub','task','function','2638690AWegzF','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','...\x20TMUX=','stderr','cancelled','low','config.json','length','Bearer\x20','1180848UmAxfJ','utf-8','7807200vuawFZ','commhub-channel','no\x20response','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','notifications/claude/channel',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','tmux\x20display-message\x20-p\x20\x27#S\x27','result','2025-03-26','now','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','params','message','\x20priority=','broadcast','setRequestHandler','split','token','write','Reply\x20text\x20/\x20result\x20summary','commhub_send_task','Target\x20session\x20alias','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','set','commhub_get_all_status','startsWith','notification','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','SSE\x20stream\x20ended,\x20reconnecting...','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','send_task','/events/','/mcp','registered\x20as\x20\x22','claude-code','21pwMXFh','object','41490UFeLrw','pid','ack_inbox','parent\x20claude\x20pid=',':\x20inbox_count=','catch','message_id','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','completed','SSE\x20fatal:\x20','Message\x20content','CommHub\x20init\x20failed:\x20','content','find','offline','27QniFfS','inbox_count','Session\x20alias:\x20','POST','application/json,\x20text/event-stream','statusText','\x20from\x20','(none)','\x20CWD=','get_all_status','blocked','.claude/channels/commhub','string','0.3.0','ppid','exit','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','type','http://127.0.0.1:9200','304jolLWk','Current\x20task\x20description','delete','Authorization','Progress\x200-100','slice','min','session\x20disconnected','data:\x20','359kSIMun','\x20PROJECT_ENV=','unref','\x20ALIAS=','432492AmqUzU','priority','shutting\x20down,\x20reporting\x20offline...','\x20RESUME_ID=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','SSE\x20error:\x20','error','SSE\x20connected\x20as\x20\x22','\x22\x20(','2922HMbEeE','from_session','.env','status','send_reply','from','stdin','get','2497725TeYPwz','working','ESRCH',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','decode','commhub_report_status','MCP\x20stdio\x20connected','body','parse','new_message','Task\x20content','report_status','2.0','unattributed-','replace','commhub_reply','tools/call','kill','indexOf','re-registered\x20as\x20\x22'];a0_0x149c=function(){return _0x331492;};return a0_0x149c();}var H=B(process[a0_0x48fad1(0xd6)]());T(a0_0x4e79a4(r,H,a0_0x48fad1(0x157)));function E(){const _0x562f90=a0_0x48fad1;try{return a0_0x42a342(_0x562f90(0xfe),{'encoding':_0x562f90(0xf7),'timeout':0x7d0})[_0x562f90(0x175)]();}catch{return'';}}function _(){const _0x2a4a69=a0_0x48fad1;try{let _0x572d50=a0_0x4e79a4(C,'.anet',_0x2a4a69(0xf3));if(a0_0x40b2dc(_0x572d50))return JSON[_0x2a4a69(0x165)](a0_0x410f16(_0x572d50,_0x2a4a69(0xf7)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x48fad1(0xe2)]||a0_0x48fad1(0x13e),j=process.env.COMMHUB_TMUX||E();function S(){const _0x57f6e4=a0_0x48fad1;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x57f6e4(0x175)]())return process.env.COMMHUB_ALIAS[_0x57f6e4(0x175)]();return process[_0x57f6e4(0xf0)][_0x57f6e4(0x10a)](_0x57f6e4(0x124)+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(j||_0x57f6e4(0x133))+_0x57f6e4(0xe4)+a0_0x5d49e5()+_0x57f6e4(0xd3))),_0x57f6e4(0x16a)+process[_0x57f6e4(0x11e)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x424d0c(),k=process.env.COMMHUB_TOKEN||R[a0_0x48fad1(0x109)]||'';function z(_0x26c27d){const _0x49e665=a0_0x48fad1;let _0x8457bd=new Date()[_0x49e665(0xe0)]()['slice'](0x0,0x8);process[_0x49e665(0xf0)]['write']('['+_0x8457bd+']\x20[commhub]\x20'+_0x26c27d+'\x0a');}function i(_0x3e805e){return new Promise(_0x1bcb19=>setTimeout(_0x1bcb19,_0x3e805e));}z(a0_0x48fad1(0x172)+Y+a0_0x48fad1(0x14b)+p+a0_0x48fad1(0x14f)+V[a0_0x48fad1(0x144)](0x0,0x8)+a0_0x48fad1(0xef)+(j||'none')+a0_0x48fad1(0x134)+process['cwd']()+a0_0x48fad1(0x149)+H);var G=new Map(),K=new a0_0x5425f7({'name':'commhub-channel','version':a0_0x48fad1(0x139)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x48fad1(0xee),a0_0x48fad1(0x10e),a0_0x48fad1(0x150),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x48fad1(0x12e)+p]['join']('\x0a')});K[a0_0x48fad1(0x107)](a0_0x21f415,async()=>({'tools':[{'name':a0_0x48fad1(0x16c),'description':a0_0x48fad1(0xdf),'inputSchema':{'type':a0_0x48fad1(0x11c),'properties':{'task_id':{'type':a0_0x48fad1(0x138),'description':a0_0x48fad1(0x102)},'text':{'type':'string','description':a0_0x48fad1(0x10b)},'status':{'type':'string','enum':[a0_0x48fad1(0x125),'failed',a0_0x48fad1(0xf1),a0_0x48fad1(0x136),'error',a0_0x48fad1(0xe8)],'description':a0_0x48fad1(0xfb)}},'required':[a0_0x48fad1(0xe5)]}},{'name':a0_0x48fad1(0x162),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x48fad1(0x11c),'properties':{'status':{'type':a0_0x48fad1(0x138),'enum':['working',a0_0x48fad1(0xd5),a0_0x48fad1(0x136),'error']},'task':{'type':a0_0x48fad1(0x138),'description':a0_0x48fad1(0x140)},'progress':{'type':a0_0x48fad1(0xde),'description':a0_0x48fad1(0x143)}},'required':[a0_0x48fad1(0x158)]}},{'name':a0_0x48fad1(0x10c),'description':a0_0x48fad1(0x115),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x48fad1(0x138),'description':a0_0x48fad1(0x10d)},'task':{'type':a0_0x48fad1(0x138),'description':a0_0x48fad1(0x167)},'priority':{'type':a0_0x48fad1(0x138),'enum':['high','normal',a0_0x48fad1(0xf2)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x48fad1(0xeb)]}},{'name':a0_0x48fad1(0xe1),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x48fad1(0x11c),'properties':{'alias':{'type':a0_0x48fad1(0x138),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x48fad1(0x138),'description':a0_0x48fad1(0x127)}},'required':['alias',a0_0x48fad1(0x104)]}},{'name':a0_0x48fad1(0x110),'description':a0_0x48fad1(0x13c),'inputSchema':{'type':a0_0x48fad1(0x11c),'properties':{}}}]}));async function Q(_0xa3cb11,_0x456fcf){const _0x5a139d=a0_0x48fad1;let _0x27f225=await fetch(Y+_0x5a139d(0x118),{'method':'POST','headers':{'Content-Type':_0x5a139d(0xdc),'Accept':_0x5a139d(0x130),...k?{'Authorization':_0x5a139d(0xf5)+k}:{}},'body':JSON[_0x5a139d(0xe7)]({'jsonrpc':_0x5a139d(0x169),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x5a139d(0x100),'capabilities':{},'clientInfo':{'name':_0x5a139d(0xf9),'version':_0x5a139d(0x139)}}})});if(!_0x27f225['ok']){let _0x572abc=await _0x27f225[_0x5a139d(0xe5)]();return z(_0x5a139d(0x128)+_0x27f225[_0x5a139d(0x158)]+'\x20'+_0x572abc[_0x5a139d(0x144)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x27f225['status']};}await _0x27f225['text']();let _0x30f578=(await(await fetch(Y+_0x5a139d(0x118),{'method':_0x5a139d(0x12f),'headers':{'Content-Type':_0x5a139d(0xdc),'Accept':'application/json,\x20text/event-stream',...k?{'Authorization':_0x5a139d(0xf5)+k}:{}},'body':JSON[_0x5a139d(0xe7)]({'jsonrpc':_0x5a139d(0x169),'id':0x2,'method':_0x5a139d(0x16d),'params':{'name':_0xa3cb11,'arguments':_0x456fcf}})}))['text']())[_0x5a139d(0x108)]('\x0a')[_0x5a139d(0x12a)](_0xf163c7=>_0xf163c7[_0x5a139d(0x111)](_0x5a139d(0x147)));if(_0x30f578){let _0x2f16d7=JSON[_0x5a139d(0x165)](_0x30f578[_0x5a139d(0x144)](0x6));return _0x2f16d7?.[_0x5a139d(0xff)]?.[_0x5a139d(0x129)]?.[0x0]?.[_0x5a139d(0xe5)]?JSON[_0x5a139d(0x165)](_0x2f16d7[_0x5a139d(0xff)][_0x5a139d(0x129)][0x0][_0x5a139d(0xe5)]):_0x2f16d7;}return{'ok':!0x1,'error':_0x5a139d(0xfa)};}K[a0_0x48fad1(0x107)](a0_0x3d23bd,async _0x218e76=>{const _0x20c837=a0_0x48fad1;let {name:_0x117b75,arguments:_0x1d6473}=_0x218e76[_0x20c837(0x103)];if(_0x117b75===_0x20c837(0x16c)){let {task_id:_0x124940,text:_0x2c7148,status:_0x2d43a0}=_0x1d6473;if(_0x2d43a0===_0x20c837(0x125)||_0x2d43a0===_0x20c837(0xe3)||_0x2d43a0===_0x20c837(0xf1)){let _0x4f0cb8=_0x2d43a0==='completed'?'replied':_0x2d43a0,_0x28675d=_0x124940?G[_0x20c837(0x15c)](_0x124940)||_0x20c837(0xe2):_0x20c837(0xe2),_0x24c24e=await Q(_0x20c837(0x159),{'alias':_0x28675d,'text':_0x2c7148,'in_reply_to':_0x124940||void 0x0,'status':_0x4f0cb8,'from_session':p});if(_0x124940)G[_0x20c837(0x141)](_0x124940);return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)](_0x24c24e)}]};}let _0xb34ebe=await Q(_0x20c837(0x168),{'resume_id':V,'alias':p,'status':_0x2d43a0===_0x20c837(0x136)?'blocked':_0x2d43a0==='error'?_0x20c837(0x152):_0x20c837(0x15e),'task':_0x2c7148[_0x20c837(0x144)](0x0,0xc8),'output':_0x2c7148});return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)](_0xb34ebe)}]};}if(_0x117b75===_0x20c837(0x162)){let {status:_0x2f5f8d,task:_0x4feab0,progress:_0x2f6fcb}=_0x1d6473,_0xa825fd=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x2f5f8d,'task':_0x4feab0,'progress':_0x2f6fcb});return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)](_0xa825fd)}]};}if(_0x117b75===_0x20c837(0x10c)){let {alias:_0x5c179d,task:_0x5e81c7,priority:_0x3697a4}=_0x1d6473,_0x58aa97=await Q(_0x20c837(0x116),{'alias':_0x5c179d,'task':_0x5e81c7,'priority':_0x3697a4||_0x20c837(0xda),'from_session':p});return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)](_0x58aa97)}]};}if(_0x117b75===_0x20c837(0xe1)){let {alias:_0x1acea2,message:_0x2fd07b}=_0x1d6473,_0x2a985a=await Q('send_message',{'alias':_0x1acea2,'message':_0x2fd07b,'from_session':p});return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)](_0x2a985a)}]};}if(_0x117b75==='commhub_get_all_status'){let _0x4f9afe=await Q(_0x20c837(0x135),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x4f9afe)}]};}return{'content':[{'type':_0x20c837(0xe5),'text':JSON[_0x20c837(0xe7)]({'error':'unknown\x20tool'})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x5a1f4e=a0_0x48fad1;try{await Q('report_status',{'resume_id':V,'alias':p,'status':_0x5a1f4e(0xd5),'server':a0_0x5d49e5(),'hostname':a0_0x5d49e5(),'agent':'claude-code','project_dir':process[_0x5a1f4e(0xd6)](),'tmux_name':j||void 0x0}),z(_0x5a1f4e(0x170)+p+_0x5a1f4e(0xdb));}catch(_0x498c7a){z('re-register\x20failed:\x20'+_0x498c7a);}}async function l(){const _0x5e5f19=a0_0x48fad1;let _0x3c077b=Y+_0x5e5f19(0x117)+encodeURIComponent(p),_0x2b3054={};if(k)_0x2b3054[_0x5e5f19(0x142)]=_0x5e5f19(0xf5)+k;z('connecting\x20to\x20'+_0x3c077b);let _0x5d4887=D,_0x402157=!0x0,_0x485039=null;while(!0x0){try{let _0x11ab88=await fetch(_0x3c077b,{'headers':_0x2b3054});if(!_0x11ab88['ok']){if(z(_0x5e5f19(0x151)+_0x11ab88['status']+'\x20'+_0x11ab88[_0x5e5f19(0x131)]),_0x485039=_0x485039??Date[_0x5e5f19(0x101)](),Date[_0x5e5f19(0x101)]()-_0x485039>O){z(_0x5e5f19(0x113)+Y+_0x5e5f19(0x160));return;}await i(_0x5d4887),_0x5d4887=Math[_0x5e5f19(0x145)](_0x5d4887*0x2,v);continue;}let _0x40a8c6=_0x11ab88[_0x5e5f19(0x164)]['getReader'](),_0x3167cd=new TextDecoder(),_0x1fe305='';_0x5d4887=D;while(!0x0){let {done:_0x5c0564,value:_0x589347}=await _0x40a8c6[_0x5e5f19(0xdd)]();if(_0x5c0564)break;_0x1fe305+=_0x3167cd[_0x5e5f19(0x161)](_0x589347,{'stream':!0x0});let _0x5d6a1b=_0x1fe305[_0x5e5f19(0x108)]('\x0a\x0a');_0x1fe305=_0x5d6a1b[_0x5e5f19(0x174)]()||'';for(let _0x4ef9a0 of _0x5d6a1b){let _0x3cc79a=_0x4ef9a0['split']('\x0a')[_0x5e5f19(0x12a)](_0xb6569c=>_0xb6569c[_0x5e5f19(0x111)]('data:\x20'));if(!_0x3cc79a)continue;try{let _0x3e760f=JSON[_0x5e5f19(0x165)](_0x3cc79a[_0x5e5f19(0x144)](0x6));if(await A(_0x3e760f),_0x3e760f[_0x5e5f19(0x13d)]==='connected'){if(_0x485039=null,!_0x402157)await m();_0x402157=!0x1;}}catch(_0x23b005){z('parse\x20error:\x20'+_0x23b005);}}}z(_0x5e5f19(0x114));}catch(_0x21c1ce){z('SSE\x20connection\x20error:\x20'+_0x21c1ce);}if(_0x485039=_0x485039??Date[_0x5e5f19(0x101)](),Date[_0x5e5f19(0x101)]()-_0x485039>O){z(_0x5e5f19(0x113)+Y+_0x5e5f19(0x160));return;}await i(_0x5d4887),_0x5d4887=Math[_0x5e5f19(0x145)](_0x5d4887*0x2,v);}}async function A(_0x2e55c2){const _0xe237fe=a0_0x48fad1;if(_0x2e55c2['type']==='connected'){z(_0xe237fe(0x153)+p+'\x22');return;}if(_0x2e55c2['type']===_0xe237fe(0x166)){if(z('←\x20message\x20from\x20'+_0x2e55c2[_0xe237fe(0x15a)]+':\x20'+_0x2e55c2['message']['slice'](0x0,0x3c)),await K[_0xe237fe(0x112)]({'method':'notifications/claude/channel','params':{'content':_0x2e55c2[_0xe237fe(0x104)],'meta':{'sender':_0x2e55c2[_0xe237fe(0x15a)]||_0xe237fe(0xe2),'sender_id':'commhub','user':_0x2e55c2[_0xe237fe(0x15a)]||_0xe237fe(0xe2),'priority':_0xe237fe(0xda)}}}),_0x2e55c2[_0xe237fe(0x123)])await Q(_0xe237fe(0x11f),{'alias':p,'message_id':_0x2e55c2[_0xe237fe(0x123)]});return;}if(_0x2e55c2[_0xe237fe(0x13d)]==='new_task'||_0x2e55c2[_0xe237fe(0x13d)]===_0xe237fe(0x106)){z('←\x20'+_0x2e55c2[_0xe237fe(0x13d)]+_0xe237fe(0x121)+_0x2e55c2[_0xe237fe(0x12d)]+_0xe237fe(0x105)+(_0x2e55c2[_0xe237fe(0x14d)]||'normal'));let _0x3e8f97=await Q('get_inbox',{'alias':p,'limit':0x5});if(_0x3e8f97?.['ok']&&_0x3e8f97[_0xe237fe(0x171)]?.[_0xe237fe(0xf4)]>0x0)for(let _0x137984 of _0x3e8f97[_0xe237fe(0x171)]){let _0x53bbb1={'sender':_0x137984[_0xe237fe(0x156)]||_0xe237fe(0xe2),'sender_id':_0xe237fe(0xea),'user':_0x137984[_0xe237fe(0x156)]||_0xe237fe(0xe2),'task_id':_0x137984['id'],'priority':_0x137984[_0xe237fe(0x14d)]||'normal'};G[_0xe237fe(0x10f)](_0x137984['id'],_0x137984[_0xe237fe(0x156)]||'hub'),await K[_0xe237fe(0x112)]({'method':_0xe237fe(0xfc),'params':{'content':_0x137984[_0xe237fe(0x129)],'meta':_0x53bbb1}}),z('→\x20injected\x20task\x20'+_0x137984['id'][_0xe237fe(0x144)](0x0,0x8)+_0xe237fe(0x132)+_0x137984[_0xe237fe(0x156)]+':\x20'+_0x137984[_0xe237fe(0x129)][_0xe237fe(0x144)](0x0,0x3c)),await Q(_0xe237fe(0x11f),{'alias':p,'message_id':_0x137984['id']});}}}function a0_0x51c3(_0x5efaff,_0x39e4b5){_0x5efaff=_0x5efaff-0xd3;const _0x149c91=a0_0x149c();let _0x51c3e1=_0x149c91[_0x5efaff];return _0x51c3e1;}async function t(){const _0x3bae2d=a0_0x48fad1;let _0x5c27bb=new a0_0x9cc349();await K[_0x3bae2d(0xd4)](_0x5c27bb),z(_0x3bae2d(0x163)),z('starting\x20SSE\x20listener...'),l()[_0x3bae2d(0x122)](_0x5347ee=>z(_0x3bae2d(0x126)+_0x5347ee)),Q('report_status',{'resume_id':V,'alias':p,'status':_0x3bae2d(0xd5),'server':a0_0x5d49e5(),'hostname':a0_0x5d49e5(),'agent':_0x3bae2d(0x11a),'project_dir':process[_0x3bae2d(0xd6)](),'tmux_name':j||void 0x0})['then'](()=>z(_0x3bae2d(0x119)+p+_0x3bae2d(0x154)+V[_0x3bae2d(0x144)](0x0,0x8)+')'))[_0x3bae2d(0x122)](_0x331f9d=>z(_0x3bae2d(0xe9)+_0x331f9d)),setInterval(()=>{const _0x1edfac=_0x3bae2d;Q(_0x1edfac(0x168),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x5d49e5(),'hostname':a0_0x5d49e5(),'agent':_0x1edfac(0x11a),'project_dir':process[_0x1edfac(0xd6)](),'tmux_name':j||void 0x0})[_0x1edfac(0x122)](_0x541706=>z('heartbeat\x20failed:\x20'+_0x541706));},0x2bf20),z(_0x3bae2d(0xe6));}t()[a0_0x48fad1(0x122)](_0x1bd620=>{const _0x21845b=a0_0x48fad1;z('fatal:\x20'+_0x1bd620),process[_0x21845b(0x13b)](0x1);});async function b(){const _0x51c0cd=a0_0x48fad1;z(_0x51c0cd(0x14e)),await Q(_0x51c0cd(0x168),{'resume_id':V,'alias':p,'status':_0x51c0cd(0x12b),'task':_0x51c0cd(0x146)})[_0x51c0cd(0x122)](()=>{}),process[_0x51c0cd(0x13b)](0x0);}process[a0_0x48fad1(0x15b)]['on']('end',()=>b()),process['on'](a0_0x48fad1(0x173),()=>b()),process['on']('SIGINT',()=>b());var d=process[a0_0x48fad1(0x13a)];if(d&&d>0x1){let h=setInterval(()=>{const _0x538f31=a0_0x48fad1;if(process[_0x538f31(0x13a)]===0x1&&d!==0x1){z('parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20'+d+_0x538f31(0xfd)),b();return;}try{process[_0x538f31(0x16e)](d,0x0);}catch(_0xc1d80f){if(_0xc1d80f?.[_0x538f31(0xd7)]===_0x538f31(0x15f))z(_0x538f31(0x120)+d+_0x538f31(0xd8)),b();}},0x7530);if(typeof h[a0_0x48fad1(0x14a)]===a0_0x48fad1(0xec))h[a0_0x48fad1(0x14a)]();}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp";
|
|
1
|
+
export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "opencode-cli" | "codex-app-server";
|
|
2
2
|
/** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
|
|
3
3
|
export declare const DEFAULT_RUNTIME: RuntimeName;
|
|
4
4
|
type ProfileLike = {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version this branch was validated against by the maintainers.
|
|
3
|
+
* Bumped when a new opencode-ai release passes the manual smoke +
|
|
4
|
+
* PR② e2e in a fresh checkout. `readEffectivePin()` still returns
|
|
5
|
+
* this when no override file exists.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OPENCODE_BUILTIN_PIN = "1.17.13";
|
|
8
|
+
/** Where the per-machine override lives. Kept under `~/.anet/` so
|
|
9
|
+
* it sits next to the other anet-local state. */
|
|
10
|
+
export declare function opencodePinFilePath(homeDirOverride?: string): string;
|
|
11
|
+
/** Shape of the override file written by `upgrade-pin`. */
|
|
12
|
+
export interface OpencodePinOverride {
|
|
13
|
+
version: string;
|
|
14
|
+
/** ISO timestamp when the smoke test passed. Presence of this
|
|
15
|
+
* field is REQUIRED for `readEffectivePin()` to trust the file —
|
|
16
|
+
* a hand-edited version without a smoke marker is refused. */
|
|
17
|
+
smokePassedAt: string;
|
|
18
|
+
/** Free-form note about what the smoke checked (initialize +
|
|
19
|
+
* session/new by default). Kept so a future review can tell what
|
|
20
|
+
* bar the pin actually cleared. */
|
|
21
|
+
smokeNote?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface EffectivePin {
|
|
24
|
+
version: string;
|
|
25
|
+
source: "override-file" | "builtin";
|
|
26
|
+
smokePassedAt?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Prefer a validated override file when present; otherwise fall
|
|
30
|
+
* back to the built-in constant. A malformed override file is
|
|
31
|
+
* ignored (built-in wins) — we don't want a partially-written
|
|
32
|
+
* override to wedge every start.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readEffectivePin(homeDirOverride?: string): EffectivePin;
|
|
35
|
+
/**
|
|
36
|
+
* Write the override — SHOULD ONLY be called after the smoke test
|
|
37
|
+
* has actually passed. The command layer in `bin/cli.ts` is
|
|
38
|
+
* responsible for gating this; this function does no
|
|
39
|
+
* verification of its own beyond shape.
|
|
40
|
+
*/
|
|
41
|
+
export declare function writePinOverride(version: string, smokePassedAt: string, smokeNote?: string, homeDirOverride?: string): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type OpencodePresetId = "anthropic" | "openai";
|
|
2
|
+
export interface OpencodePreset {
|
|
3
|
+
id: OpencodePresetId;
|
|
4
|
+
displayName: string;
|
|
5
|
+
envKey: string;
|
|
6
|
+
signupUrl: string;
|
|
7
|
+
/** How opencode's provider config identifies this vendor in the
|
|
8
|
+
* `provider.<id>.options.baseUrl` config. Left null when we don't
|
|
9
|
+
* need to override the built-in default. */
|
|
10
|
+
configProviderId: "anthropic" | "openai";
|
|
11
|
+
}
|
|
12
|
+
export declare const OPENCODE_PRESETS: OpencodePreset[];
|
|
13
|
+
export declare function findOpencodePreset(id: string): OpencodePreset | null;
|
|
14
|
+
/**
|
|
15
|
+
* Look up the API key for a preset from the current process env.
|
|
16
|
+
* Callers MUST handle the `null` case (per RFC v0.3 D3 + 通信龙 PR③
|
|
17
|
+
* flag: "从 env 读, 别 prompt"). Returns null so the wizard can
|
|
18
|
+
* emit a clear message telling the operator to export the env var
|
|
19
|
+
* and re-run — rather than silently continuing without a key.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readPresetKeyFromEnv(preset: OpencodePreset, env?: NodeJS.ProcessEnv): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* opencode.ai's auth.json shape:
|
|
24
|
+
* { "<providerId>": { "type": "api", "key": "..." } }
|
|
25
|
+
* Same shape Phase 0b probes verified against opencode-ai@1.17.13.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildAuthJsonBody(preset: OpencodePreset, apiKey: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Write auth.json into the opencode config root that lives under
|
|
30
|
+
* `nodeWorkDir` (which becomes the child's HOME per PR② §8 D5).
|
|
31
|
+
* mode 0o600 keeps it operator-only. Directory is created if
|
|
32
|
+
* missing.
|
|
33
|
+
*
|
|
34
|
+
* Returns the absolute path we wrote for logging.
|
|
35
|
+
*/
|
|
36
|
+
export declare function writeOpencodeAuthJson(nodeWorkDir: string, preset: OpencodePreset, apiKey: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Companion opencode.json: pins the vendor's baseUrl (defaults for
|
|
39
|
+
* Anthropic / OpenAI are fine, so this is minimal for now). A
|
|
40
|
+
* placeholder so later PRs can push per-node overrides without
|
|
41
|
+
* needing to invent the file.
|
|
42
|
+
*/
|
|
43
|
+
export declare function writeOpencodeConfigJson(nodeWorkDir: string, preset: OpencodePreset): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeCwd(cwd: string): string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.3.0-preview.
|
|
4
|
-
"description": "AI Agent Network CLI
|
|
3
|
+
"version": "2.3.0-preview.30",
|
|
4
|
+
"description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -65,10 +65,13 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@inquirer/prompts": "^8.4.3",
|
|
68
|
-
"@larksuiteoapi/node-sdk": "^1.42.0"
|
|
68
|
+
"@larksuiteoapi/node-sdk": "^1.42.0",
|
|
69
|
+
"markdown-it": "^14.1.0",
|
|
70
|
+
"puppeteer-core": "^24.10.2"
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
74
|
+
"@types/markdown-it": "^14.1.2",
|
|
72
75
|
"@types/node": "^25.0.0",
|
|
73
76
|
"javascript-obfuscator": "^5.4.1",
|
|
74
77
|
"node-pty": "^1.1.0",
|
|
@@ -78,4 +81,4 @@
|
|
|
78
81
|
"hono": "^4.12.21",
|
|
79
82
|
"qs": "^6.15.2"
|
|
80
83
|
}
|
|
81
|
-
}
|
|
84
|
+
}
|