@sleep2agi/agent-network 2.2.7-preview.6 → 2.2.8-preview.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.
- package/README.md +228 -90
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/im/types.d.ts +194 -0
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a0_0x126c(_0x9d5e15,_0x454483){_0x9d5e15=_0x9d5e15-0x19f;const _0x2d9f5a=a0_0x2d9f();let _0x126c53=_0x2d9f5a[_0x9d5e15];return _0x126c53;}const a0_0x2a1977=a0_0x126c;(function(_0x1112c6,_0x482e9d){const _0x2af74f=a0_0x126c,_0x88a286=_0x1112c6();while(!![]){try{const _0x1ef32f=parseInt(_0x2af74f(0x1d4))/0x1+parseInt(_0x2af74f(0x1a5))/0x2*(-parseInt(_0x2af74f(0x1e9))/0x3)+parseInt(_0x2af74f(0x1ac))/0x4*(parseInt(_0x2af74f(0x1b6))/0x5)+-parseInt(_0x2af74f(0x1d3))/0x6*(parseInt(_0x2af74f(0x1cf))/0x7)+parseInt(_0x2af74f(0x1a7))/0x8+-parseInt(_0x2af74f(0x1dd))/0x9*(-parseInt(_0x2af74f(0x1c0))/0xa)+-parseInt(_0x2af74f(0x1d9))/0xb;if(_0x1ef32f===_0x482e9d)break;else _0x88a286['push'](_0x88a286['shift']());}catch(_0x1e4549){_0x88a286['push'](_0x88a286['shift']());}}}(a0_0x2d9f,0x8282c));import{EventEmitter as a0_0x55dfd5}from'events';import{hostname as a0_0x13df40}from'os';class T extends a0_0x55dfd5{[a0_0x2a1977(0x1c5)];[a0_0x2a1977(0x1b8)];[a0_0x2a1977(0x1df)];['agent'];['resumeId'];[a0_0x2a1977(0x1d5)];[a0_0x2a1977(0x1ce)];['heartbeatTimer'];['sseAbort'];['running']=!0x1;constructor(_0x52d248){const _0x4fc0c1=a0_0x2a1977;super();if(this[_0x4fc0c1(0x1c5)]=_0x52d248[_0x4fc0c1(0x1c5)][_0x4fc0c1(0x1a8)](/\/$/,''),this[_0x4fc0c1(0x1b8)]=_0x52d248[_0x4fc0c1(0x1b8)],this[_0x4fc0c1(0x1df)]=_0x52d248[_0x4fc0c1(0x1df)],this['agent']=_0x52d248[_0x4fc0c1(0x1a9)]||_0x4fc0c1(0x1d7),this['resumeId']=_0x4fc0c1(0x1b3)+_0x52d248[_0x4fc0c1(0x1b8)]+'-'+Date[_0x4fc0c1(0x1c2)]()['toString'](0x24),this[_0x4fc0c1(0x1d5)]=_0x52d248[_0x4fc0c1(0x1d5)]??0x2bf20,this['reconnectDelay']=_0x52d248[_0x4fc0c1(0x1ce)]??0xbb8,_0x52d248['autoConnect']!==!0x1)this[_0x4fc0c1(0x1e4)]();}['log'](_0x3d4433){const _0x334914=a0_0x2a1977;console[_0x334914(0x1c8)]('['+new Date()[_0x334914(0x19f)]()[_0x334914(0x1de)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x3d4433);}async[a0_0x2a1977(0x1d1)](_0x1942ba,_0x11dd5c){const _0x31f739=a0_0x2a1977;let _0x192176={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x31f739(0x1df)])_0x192176[_0x31f739(0x1f0)]=_0x31f739(0x1c1)+this[_0x31f739(0x1df)];let _0x55a6c0=await(await fetch(this[_0x31f739(0x1c5)]+_0x31f739(0x1a1),{'method':'POST','headers':_0x192176,'body':JSON[_0x31f739(0x1ea)]({'jsonrpc':_0x31f739(0x1ae),'id':Date['now'](),'method':_0x31f739(0x1cb),'params':{'name':_0x1942ba,'arguments':_0x11dd5c}})}))[_0x31f739(0x1e5)](),_0x218020=_0x55a6c0[_0x31f739(0x1aa)](/data: (.+)/),_0x66773d=_0x218020?JSON[_0x31f739(0x1b2)](_0x218020[0x1]):JSON['parse'](_0x55a6c0),_0x5b34a7=_0x66773d?.[_0x31f739(0x1e8)]?.[_0x31f739(0x1b4)]?.[0x0]?.[_0x31f739(0x1e5)];return _0x5b34a7?JSON[_0x31f739(0x1b2)](_0x5b34a7):_0x66773d;}async[a0_0x2a1977(0x1e4)](){const _0x260df2=a0_0x2a1977;if(this[_0x260df2(0x1da)])return;this[_0x260df2(0x1da)]=!0x0,await this['status']('idle'),this[_0x260df2(0x1c8)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x31aaef=_0x260df2;this['status']('idle')[_0x31aaef(0x1bf)](_0x4f9b3a=>this[_0x31aaef(0x1c8)](_0x31aaef(0x1db)+_0x4f9b3a[_0x31aaef(0x1d8)]));},this['heartbeatInterval']),this[_0x260df2(0x1b5)]();}async[a0_0x2a1977(0x1af)](){const _0x20b5f7=a0_0x2a1977;if(this[_0x20b5f7(0x1da)]=!0x1,this[_0x20b5f7(0x1ec)]?.['abort'](),this[_0x20b5f7(0x1cd)])clearInterval(this['heartbeatTimer']);await this[_0x20b5f7(0x1ef)]('offline')[_0x20b5f7(0x1bf)](()=>{}),this[_0x20b5f7(0x1c8)](_0x20b5f7(0x1c3));}async[a0_0x2a1977(0x1be)](_0x16bb5d,_0x267873,_0x255f90='normal'){const _0x6dc0e8=a0_0x2a1977;return this[_0x6dc0e8(0x1d1)](_0x6dc0e8(0x1e6),{'alias':_0x16bb5d,'task':_0x267873,'priority':_0x255f90,'from_session':this['alias']});}async['message'](_0x40c11b,_0xf8289e){const _0x26d5f2=a0_0x2a1977;return this[_0x26d5f2(0x1d1)](_0x26d5f2(0x1cc),{'alias':_0x40c11b,'message':_0xf8289e,'from_session':this[_0x26d5f2(0x1b8)]});}async['reply'](_0x4ea6ce,_0x28209b,_0x5986f3=a0_0x2a1977(0x1a3)){const _0x5d7d49=a0_0x2a1977;return this[_0x5d7d49(0x1d1)]('send_reply',{'in_reply_to':_0x4ea6ce,'text':_0x28209b,'status':_0x5986f3});}async['status'](_0x1d7abf,_0x58a898){const _0x2a500f=a0_0x2a1977;return this['call'](_0x2a500f(0x1c9),{'resume_id':this[_0x2a500f(0x1b7)],'alias':this[_0x2a500f(0x1b8)],'status':_0x1d7abf,'server':a0_0x13df40(),'hostname':a0_0x13df40(),'agent':this[_0x2a500f(0x1a9)],'project_dir':process['cwd'](),..._0x58a898});}async[a0_0x2a1977(0x1bb)](){const _0x3c479a=a0_0x2a1977;return this[_0x3c479a(0x1d1)]('get_all_status',{});}async[a0_0x2a1977(0x1b9)](_0x52199c,_0x206caa){const _0x25bb33=a0_0x2a1977;return this['call'](_0x25bb33(0x1b9),{'message':_0x52199c,'filter_server':_0x206caa?.[_0x25bb33(0x1a0)],'filter_status':_0x206caa?.[_0x25bb33(0x1ef)]});}async['connectSSE'](){const _0x1d4a37=a0_0x2a1977;let _0x1a0baf=encodeURIComponent(this['alias']),_0x55ff5b=this['url']+_0x1d4a37(0x1b0)+_0x1a0baf,_0x2b2287=this['reconnectDelay'];while(this[_0x1d4a37(0x1da)]){try{this[_0x1d4a37(0x1ec)]=new AbortController();let _0x1ae577={'Accept':'text/event-stream'};if(this['token'])_0x1ae577[_0x1d4a37(0x1f0)]=_0x1d4a37(0x1c1)+this[_0x1d4a37(0x1df)];let _0x29da24=await fetch(_0x55ff5b,{'headers':_0x1ae577,'signal':this['sseAbort'][_0x1d4a37(0x1ed)]});if(!_0x29da24['ok']||!_0x29da24[_0x1d4a37(0x1e1)]){this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1a4)+_0x29da24[_0x1d4a37(0x1ef)]),await this['sleep'](_0x2b2287),_0x2b2287=Math[_0x1d4a37(0x1d6)](_0x2b2287*1.5,0xea60);continue;}_0x2b2287=this[_0x1d4a37(0x1ce)];let _0xe9bcc2=_0x29da24[_0x1d4a37(0x1e1)][_0x1d4a37(0x1e0)](),_0x259a32=new TextDecoder(),_0x1d2857='';while(this['running']){let {done:_0x5940fd,value:_0x203cc2}=await _0xe9bcc2[_0x1d4a37(0x1bd)]();if(_0x5940fd)break;_0x1d2857+=_0x259a32[_0x1d4a37(0x1c7)](_0x203cc2,{'stream':!0x0});let _0x94d418=_0x1d2857[_0x1d4a37(0x1e2)]('\x0a');_0x1d2857=_0x94d418[_0x1d4a37(0x1e7)]()||'';for(let _0x386506 of _0x94d418){if(!_0x386506[_0x1d4a37(0x1bc)](_0x1d4a37(0x1d2)))continue;try{let _0xd7aabf=JSON[_0x1d4a37(0x1b2)](_0x386506['slice'](0x6));if(_0xd7aabf[_0x1d4a37(0x1a2)]==='connected'){this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1d0)),this[_0x1d4a37(0x1dc)](_0x1d4a37(0x1eb));continue;}if(_0xd7aabf['type']==='new_task'||_0xd7aabf['type']==='new_message'||_0xd7aabf[_0x1d4a37(0x1a2)]===_0x1d4a37(0x1b9))await this['processInbox']();}catch{}}}}catch(_0x270c39){if(_0x270c39[_0x1d4a37(0x1ee)]==='AbortError')break;this['emit'](_0x1d4a37(0x1a6),_0x270c39),this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1c6)+_0x270c39[_0x1d4a37(0x1d8)]);}if(this[_0x1d4a37(0x1da)])this[_0x1d4a37(0x1dc)](_0x1d4a37(0x1c3)),this[_0x1d4a37(0x1c8)](_0x1d4a37(0x1ad)+_0x2b2287/0x3e8+'s...'),await this['sleep'](_0x2b2287),_0x2b2287=Math['min'](_0x2b2287*1.5,0xea60);}}async[a0_0x2a1977(0x1ba)](){const _0x1c8080=a0_0x2a1977;try{let _0x5b9e23=(await this['call'](_0x1c8080(0x1e3),{'alias':this[_0x1c8080(0x1b8)],'limit':0xa}))?.['messages']||[];for(let _0x31cc99 of _0x5b9e23)await this['call'](_0x1c8080(0x1b1),{'alias':this[_0x1c8080(0x1b8)],'message_id':_0x31cc99['id']}),this[_0x1c8080(0x1c8)]('←\x20'+_0x31cc99[_0x1c8080(0x1ca)]+':\x20'+_0x31cc99['content'][_0x1c8080(0x1de)](0x0,0x3c)),this[_0x1c8080(0x1dc)](_0x1c8080(0x1ab),_0x31cc99),this[_0x1c8080(0x1dc)](_0x1c8080(0x1d8),_0x31cc99);}catch(_0x74ba21){this[_0x1c8080(0x1c8)]('inbox\x20error:\x20'+_0x74ba21['message']);}}[a0_0x2a1977(0x1c4)](_0x4c6cc0){return new Promise(_0x1af24b=>setTimeout(_0x1af24b,_0x4c6cc0));}}function a0_0x2d9f(){const _0x40123b=['running','heartbeat\x20failed:\x20','emit','171JgBUet','slice','token','getReader','body','split','get_inbox','connect','text','send_task','pop','result','861xcpYZt','stringify','connected','sseAbort','signal','name','status','Authorization','toTimeString','server','/mcp','type','completed','SSE\x20failed:\x20','514mghZmq','error','2942152akRBDR','replace','agent','match','task','441576cSaUCf','SSE\x20reconnecting\x20in\x20','2.0','disconnect','/events/','ack_inbox','parse','sdk-','content','connectSSE','20RNOjKf','resumeId','alias','broadcast','processInbox','getAllStatus','startsWith','read','send','catch','525430zmQbmn','Bearer\x20','now','disconnected','sleep','url','SSE\x20error:\x20','decode','log','report_status','from_session','tools/call','send_message','heartbeatTimer','reconnectDelay','1566047KGfRIz','SSE\x20connected','call','data:\x20','12dsPWIs','440020JgOWbo','heartbeatInterval','min','sdk','message','13110999BRRHaN'];a0_0x2d9f=function(){return _0x40123b;};return a0_0x2d9f();}var $=T;export{$ as default,T as CommHub};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC-020 §2.2–2.4 — IM Adapter abstraction + normalized event/message model.
|
|
3
|
+
*
|
|
4
|
+
* Contract layer for the IM platform compatibility layer. Each platform
|
|
5
|
+
* (Feishu / Slack / WhatsApp / WeCom) implements `IMAdapter` against this
|
|
6
|
+
* file; the IM Bridge (commhub-gateway, RFC-020 §2.5) consumes only these
|
|
7
|
+
* normalized shapes and never touches platform SDKs directly.
|
|
8
|
+
*
|
|
9
|
+
* This file is contract only — no runtime behavior. See:
|
|
10
|
+
* docs/rfcs/RFC-020-im-platform-integration.md
|
|
11
|
+
* issue #182 (P0 abstraction tracker)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* How an adapter receives inbound events from its platform.
|
|
15
|
+
*
|
|
16
|
+
* - `socket` — long connection / WebSocket (Feishu WSClient, Slack Socket Mode).
|
|
17
|
+
* Runs agent-local without a public IP. Production preferred for
|
|
18
|
+
* P1 (Feishu) / P2 (Slack).
|
|
19
|
+
* - `webhook` — HTTP callback (WhatsApp Cloud API, WeCom callback). Requires a
|
|
20
|
+
* public HTTPS endpoint; see RFC-020 §5.3.
|
|
21
|
+
* - `polling` — adapter-driven polling. Dev / fallback only, not for production.
|
|
22
|
+
*/
|
|
23
|
+
export type IMIngressMode = "socket" | "webhook" | "polling";
|
|
24
|
+
/**
|
|
25
|
+
* Per-channel binding configuration loaded from
|
|
26
|
+
* `.anet/nodes/<node>/channels/<platform>/config.json`. The Bridge passes this
|
|
27
|
+
* object verbatim to `IMAdapter.init`. Adapter-specific fields live under
|
|
28
|
+
* `platformConfig`; common fields (`allow`, `groupPolicy`, etc.) are read by
|
|
29
|
+
* the Bridge itself.
|
|
30
|
+
*/
|
|
31
|
+
export interface IMChannelConfig {
|
|
32
|
+
platform: string;
|
|
33
|
+
connectionName: string;
|
|
34
|
+
ingressMode: IMIngressMode;
|
|
35
|
+
/** Default group trigger policy (RFC-020 §4.3). Adapter-agnostic. */
|
|
36
|
+
groupPolicy?: "mention" | "command" | "all" | "observe";
|
|
37
|
+
/** "Processing..." placeholder before agent reply (RFC-020 §4.2). */
|
|
38
|
+
ackPlaceholder?: boolean;
|
|
39
|
+
/** Retain raw payload on disk after redaction (RFC-020 §2.3 / §12.10). */
|
|
40
|
+
auditRaw?: boolean;
|
|
41
|
+
/** Per-task timeout in ms; default 5min (RFC-020 §4.5). */
|
|
42
|
+
taskTimeoutMs?: number;
|
|
43
|
+
/** Adapter-specific fields (App ID, signing secret, etc.). */
|
|
44
|
+
platformConfig: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
export interface IMConversationRef {
|
|
47
|
+
platform: string;
|
|
48
|
+
conversationId: string;
|
|
49
|
+
conversationType: "dm" | "group" | "channel" | "thread";
|
|
50
|
+
/** Slack `thread_ts` / Feishu `root_id` — set when replying in-thread. */
|
|
51
|
+
threadRootId?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Inbound IM event after adapter normalization. The Bridge maps this to a
|
|
55
|
+
* commhub task (RFC-020 §4.1) and stores `meta.im` in `tasks.meta_json`
|
|
56
|
+
* (RFC-020 §2.9).
|
|
57
|
+
*/
|
|
58
|
+
export interface NormalizedIMEvent {
|
|
59
|
+
platform: string;
|
|
60
|
+
/** `<node>#<platform>:<connectionName>` — uniquely identifies the binding. */
|
|
61
|
+
connectionId: string;
|
|
62
|
+
/** Feishu tenant / Slack team / WeCom corp / WhatsApp WABA id. */
|
|
63
|
+
tenantId?: string;
|
|
64
|
+
conversation: IMConversationRef;
|
|
65
|
+
sender: {
|
|
66
|
+
id: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
};
|
|
69
|
+
/** Platform message id — core component of `idempotencyKey`. */
|
|
70
|
+
messageId: string;
|
|
71
|
+
/** Was this bot @-mentioned? Drives `triggerPolicy.group`. */
|
|
72
|
+
mentioned: boolean;
|
|
73
|
+
content: {
|
|
74
|
+
text?: string;
|
|
75
|
+
/** Local filesystem paths to already-downloaded images. */
|
|
76
|
+
images?: string[];
|
|
77
|
+
files?: {
|
|
78
|
+
name: string;
|
|
79
|
+
path?: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Original platform payload. Default: held in memory only and dropped after
|
|
85
|
+
* normalization (RFC-020 §2.3 / §12.10) — payloads carry PII (phone numbers,
|
|
86
|
+
* file URLs, user ids). Persisted only when `config.auditRaw === true`, and
|
|
87
|
+
* even then only to a local redacted audit log. Never uploaded to the hub.
|
|
88
|
+
*/
|
|
89
|
+
raw?: unknown;
|
|
90
|
+
receivedAt: number;
|
|
91
|
+
/** `${platform}:${connectionId}:${messageId}` (or platform `event_id`). */
|
|
92
|
+
idempotencyKey: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Outbound message produced by the Bridge in response to a commhub reply,
|
|
96
|
+
* or a P1.5+ active push (RFC-020 §12.9, gated behind a separate
|
|
97
|
+
* `anet im send` tool). The adapter renders this into a platform-specific
|
|
98
|
+
* payload.
|
|
99
|
+
*/
|
|
100
|
+
export interface NormalizedIMMessage {
|
|
101
|
+
target: IMConversationRef;
|
|
102
|
+
/** Plain text (default); split into chunks if it exceeds platform limits. */
|
|
103
|
+
text?: string;
|
|
104
|
+
/** Rich text (Feishu post / Slack mrkdwn). Optional, adapter may degrade. */
|
|
105
|
+
markdown?: string;
|
|
106
|
+
/** Interactive card (Feishu interactive / Slack Block Kit). Post-MVP. */
|
|
107
|
+
card?: unknown;
|
|
108
|
+
/** Local filesystem path to image to send. */
|
|
109
|
+
imagePath?: string;
|
|
110
|
+
files?: {
|
|
111
|
+
name: string;
|
|
112
|
+
path: string;
|
|
113
|
+
}[];
|
|
114
|
+
/** Reply to a specific platform message id. */
|
|
115
|
+
replyToMessageId?: string;
|
|
116
|
+
/** Ephemeral / visible-to-sender-only. Slack only; others ignore. */
|
|
117
|
+
ephemeral?: boolean;
|
|
118
|
+
/** Tie back to the commhub task that produced this message. */
|
|
119
|
+
correlation: {
|
|
120
|
+
taskId: string;
|
|
121
|
+
inReplyTo?: string;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export interface IMAdapterHealth {
|
|
125
|
+
connected: boolean;
|
|
126
|
+
lastEventAt: number | null;
|
|
127
|
+
lastError: string | null;
|
|
128
|
+
/** Optional, when the platform exposes it. */
|
|
129
|
+
rateLimitRemaining?: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Platform adapter contract (RFC-020 §2.2). One implementation per platform.
|
|
133
|
+
* The Bridge owns the lifecycle (init → start → … → stop) and never inspects
|
|
134
|
+
* platform-specific fields beyond what comes back through this interface.
|
|
135
|
+
*/
|
|
136
|
+
export interface IMAdapter {
|
|
137
|
+
readonly platform: string;
|
|
138
|
+
readonly ingressMode: IMIngressMode;
|
|
139
|
+
/** Initialize the platform SDK client. Does not open the connection. */
|
|
140
|
+
init(config: IMChannelConfig): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Begin receiving. `socket` adapters open a long connection; `webhook`
|
|
143
|
+
* adapters register an HTTP route handler with the public ingress.
|
|
144
|
+
* Inbound events flow through `onEvent`.
|
|
145
|
+
*/
|
|
146
|
+
start(onEvent: (event: NormalizedIMEvent) => Promise<void>): Promise<void>;
|
|
147
|
+
/** Stop receiving and release the connection. */
|
|
148
|
+
stop(): Promise<void>;
|
|
149
|
+
/** Send a normalized outbound message. Returns the platform message id. */
|
|
150
|
+
send(message: NormalizedIMMessage): Promise<{
|
|
151
|
+
messageId: string;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Edit a previously-sent message (Feishu / Slack). Used to promote the
|
|
155
|
+
* "processing..." placeholder into the final reply. Optional — adapters
|
|
156
|
+
* without edit support omit this.
|
|
157
|
+
*/
|
|
158
|
+
edit?(target: IMConversationRef, messageId: string, message: NormalizedIMMessage): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Required for `webhook` adapters: verify the inbound request signature /
|
|
161
|
+
* decrypt the payload. Failure must drop the request before it enters
|
|
162
|
+
* commhub (RFC-020 §5.3). `socket` adapters may omit.
|
|
163
|
+
*/
|
|
164
|
+
verifyWebhook?(headers: Record<string, string>, rawBody: Buffer): boolean;
|
|
165
|
+
/** Health probe surfaced to the Dashboard via the Bridge. */
|
|
166
|
+
health(): IMAdapterHealth;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Per-channel persistent state stored at
|
|
170
|
+
* `.anet/nodes/<node>/channels/<platform>/state.db` (sqlite) or
|
|
171
|
+
* `state.jsonl`. Both maps must survive Bridge restart — without them,
|
|
172
|
+
* webhook dedup fails and outbound replies cannot find their IM conversation.
|
|
173
|
+
*/
|
|
174
|
+
export interface IMCorrelationStore {
|
|
175
|
+
/** Dedup webhook retries / socket replays. */
|
|
176
|
+
hasSeen(idempotencyKey: string): Promise<string | null>;
|
|
177
|
+
recordSeen(idempotencyKey: string, taskId: string): Promise<void>;
|
|
178
|
+
/** Outbound routing: from commhub task id back to the IM conversation. */
|
|
179
|
+
getCorrelation(taskId: string): Promise<IMTaskCorrelation | null>;
|
|
180
|
+
putCorrelation(taskId: string, correlation: IMTaskCorrelation): Promise<void>;
|
|
181
|
+
updateStatus(taskId: string, status: IMTaskCorrelation["status"]): Promise<void>;
|
|
182
|
+
/** Periodic GC (default 24h TTL on terminal-state entries). */
|
|
183
|
+
gc(now: number): Promise<{
|
|
184
|
+
removed: number;
|
|
185
|
+
}>;
|
|
186
|
+
}
|
|
187
|
+
export interface IMTaskCorrelation {
|
|
188
|
+
conversationRef: IMConversationRef;
|
|
189
|
+
sourceMessageId: string;
|
|
190
|
+
/** Platform message id of the "processing..." placeholder, if any. */
|
|
191
|
+
placeholderMessageId?: string;
|
|
192
|
+
status: "pending" | "delivered" | "completed" | "failed" | "timeout";
|
|
193
|
+
createdAt: number;
|
|
194
|
+
}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x4e0878=a0_0x493f;(function(_0x2d3bd8,_0x374621){const _0xd8ef50=a0_0x493f,_0x5d4585=_0x2d3bd8();while(!![]){try{const _0x1e90cd=-parseInt(_0xd8ef50(0x230))/0x1*(parseInt(_0xd8ef50(0x21b))/0x2)+-parseInt(_0xd8ef50(0x204))/0x3+parseInt(_0xd8ef50(0x23a))/0x4*(-parseInt(_0xd8ef50(0x1ee))/0x5)+parseInt(_0xd8ef50(0x1f9))/0x6*(-parseInt(_0xd8ef50(0x1fc))/0x7)+-parseInt(_0xd8ef50(0x224))/0x8*(parseInt(_0xd8ef50(0x21f))/0x9)+parseInt(_0xd8ef50(0x26c))/0xa+parseInt(_0xd8ef50(0x20b))/0xb;if(_0x1e90cd===_0x374621)break;else _0x5d4585['push'](_0x5d4585['shift']());}catch(_0x13942f){_0x5d4585['push'](_0x5d4585['shift']());}}}(a0_0x2fb3,0x46442));import{readFileSync as a0_0x30d113,existsSync as a0_0x108cd4}from'fs';import{randomUUID as a0_0x1075f9}from'crypto';import{join as a0_0x524fbf}from'path';import{hostname as a0_0x231ed9}from'os';import{execSync as a0_0x16e811}from'child_process';import{Server as a0_0x46ae47}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x593e29}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x51ba2d,CallToolRequestSchema as a0_0x447501}from'@modelcontextprotocol/sdk/types.js';function p(_0x282a0d){const _0x50477d=a0_0x493f;if(!a0_0x108cd4(_0x282a0d))return;for(let _0x5babe9 of a0_0x30d113(_0x282a0d,_0x50477d(0x221))['split']('\x0a')){let _0x37b66f=_0x5babe9[_0x50477d(0x205)]();if(!_0x37b66f||_0x37b66f[_0x50477d(0x247)]('#'))continue;let _0x1f6876=_0x37b66f['indexOf']('=');if(_0x1f6876<0x0)continue;let _0x2595ba=_0x37b66f[_0x50477d(0x25a)](0x0,_0x1f6876)[_0x50477d(0x205)](),_0x541826=_0x37b66f['slice'](_0x1f6876+0x1)['trim']()[_0x50477d(0x20e)](/^["']|["']$/g,'');if(!process.env[_0x2595ba])process.env[_0x2595ba]=_0x541826;}}var C=process.env.HOME||'~',T=a0_0x524fbf(C,a0_0x4e0878(0x22f));function a0_0x2fb3(){const _0x4be9a9=['→\x20injected\x20task\x20','content',']\x20[commhub]\x20','offline','notification','unknown\x20tool','data:\x20','messages','parse\x20error:\x20','Progress\x200-100','3264210JAwdKS','application/json,\x20text/event-stream','Task\x20content','7RwCFCQ','find','get_all_status','string','stringify','fatal:\x20','join','tools/call','1592781yxxfac','trim','number','cancelled','getReader','then','initialize','25724688QILKjj','type','http://127.0.0.1:9200','replace','send_task','message','cwd','CommHub\x20init\x20failed:\x20','set','tmux\x20display-message\x20-p\x20\x27#S\x27','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','commhub_get_all_status','report_status','task','application/json','new_message','6022PnsJnO','decode','statusText','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','1087173MKgsqc','completed','utf-8','blocked','no\x20response','32tkKXxQ','failed','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','connect','heartbeat\x20failed:\x20','text','hub','inbox_count','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','SSE\x20fatal:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','.claude/channels/commhub','53KVJeWg','Current\x20task\x20description','message_id','alias','starting\x20SSE\x20listener...','.anet','commhub_send_task','low','0.3.0','SIGINT','44Liywxz','Bearer\x20','object','idle','delete','get','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','parse','read','result','...\x20TMUX=','2.0','commhub','startsWith','\x20PROJECT_ENV=','commhub-channel','session\x20disconnected','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','pop','split','\x22\x20(','high','claude-code','\x20ALIAS=','POST','stderr','commhub_report_status','status','2025-03-26','setRequestHandler','\x20CWD=','broadcast','slice','connected','SSE\x20connection\x20error:\x20','from_session','.env','priority','/mcp','exit','catch','init\x20failed:\x20','MCP\x20stdio\x20connected','params','ack_inbox','send_message','new_task','commhub_reply','ENV:\x20URL=','error','1997970VelDTw','send_reply','get_inbox','Priority\x20(default:\x20normal)','commhub_send_message','working','shutting\x20down,\x20reporting\x20offline...','normal','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','body','242210QKEorE'];a0_0x2fb3=function(){return _0x4be9a9;};return a0_0x2fb3();}p(a0_0x524fbf(T,a0_0x4e0878(0x25e)));var L=process[a0_0x4e0878(0x211)]()[a0_0x4e0878(0x20e)](/\//g,'-');p(a0_0x524fbf(T,L,a0_0x4e0878(0x25e)));function a0_0x493f(_0x21a88c,_0x53c5b8){_0x21a88c=_0x21a88c-0x1e5;const _0x2fb3fe=a0_0x2fb3();let _0x493f30=_0x2fb3fe[_0x21a88c];return _0x493f30;}function U(){const _0x2b8e7e=a0_0x4e0878;try{return a0_0x16e811(_0x2b8e7e(0x214),{'encoding':'utf-8','timeout':0x7d0})[_0x2b8e7e(0x205)]();}catch{return'';}}function v(){const _0x3fec0c=a0_0x4e0878;try{let _0x32aea4=a0_0x524fbf(C,_0x3fec0c(0x235),'config.json');if(a0_0x108cd4(_0x32aea4))return JSON[_0x3fec0c(0x241)](a0_0x30d113(_0x32aea4,_0x3fec0c(0x221)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x4e0878(0x20d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x231ed9(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x1075f9(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x42229f){const _0x559626=a0_0x4e0878;let _0x3f9c9c=new Date()['toTimeString']()[_0x559626(0x25a)](0x0,0x8);process[_0x559626(0x253)]['write']('['+_0x3f9c9c+_0x559626(0x1f1)+_0x42229f+'\x0a');}function h(_0x42ac97){return new Promise(_0x4872a1=>setTimeout(_0x4872a1,_0x42ac97));}Y(a0_0x4e0878(0x26a)+f+a0_0x4e0878(0x251)+Z+'\x20RESUME_ID='+w[a0_0x4e0878(0x25a)](0x0,0x8)+a0_0x4e0878(0x244)+(j||'none')+a0_0x4e0878(0x258)+process[a0_0x4e0878(0x211)]()+a0_0x4e0878(0x248)+L);var k=new Map(),K=new a0_0x46ae47({'name':a0_0x4e0878(0x249),'version':a0_0x4e0878(0x238)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4e0878(0x22c),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x4e0878(0x24b),a0_0x4e0878(0x21e),'Session\x20alias:\x20'+Z][a0_0x4e0878(0x202)]('\x0a')});K[a0_0x4e0878(0x257)](a0_0x51ba2d,async()=>({'tools':[{'name':a0_0x4e0878(0x269),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x4e0878(0x23c),'properties':{'task_id':{'type':a0_0x4e0878(0x1ff),'description':a0_0x4e0878(0x1ec)},'text':{'type':a0_0x4e0878(0x1ff),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x4e0878(0x1ff),'enum':[a0_0x4e0878(0x220),'failed',a0_0x4e0878(0x207),a0_0x4e0878(0x222),'error','in_progress'],'description':a0_0x4e0878(0x215)}},'required':[a0_0x4e0878(0x229)]}},{'name':'commhub_report_status','description':a0_0x4e0878(0x240),'inputSchema':{'type':a0_0x4e0878(0x23c),'properties':{'status':{'type':a0_0x4e0878(0x1ff),'enum':[a0_0x4e0878(0x1e9),'idle',a0_0x4e0878(0x222),a0_0x4e0878(0x26b)]},'task':{'type':a0_0x4e0878(0x1ff),'description':a0_0x4e0878(0x231)},'progress':{'type':a0_0x4e0878(0x206),'description':a0_0x4e0878(0x1f8)}},'required':['status']}},{'name':a0_0x4e0878(0x236),'description':a0_0x4e0878(0x226),'inputSchema':{'type':a0_0x4e0878(0x23c),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x4e0878(0x1ff),'description':a0_0x4e0878(0x1fb)},'priority':{'type':a0_0x4e0878(0x1ff),'enum':[a0_0x4e0878(0x24f),a0_0x4e0878(0x1eb),a0_0x4e0878(0x237)],'description':a0_0x4e0878(0x1e7)}},'required':[a0_0x4e0878(0x233),a0_0x4e0878(0x218)]}},{'name':'commhub_send_message','description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x4e0878(0x23c),'properties':{'alias':{'type':a0_0x4e0878(0x1ff),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x4e0878(0x1ff),'description':'Message\x20content'}},'required':[a0_0x4e0878(0x233),a0_0x4e0878(0x210)]}},{'name':'commhub_get_all_status','description':a0_0x4e0878(0x22e),'inputSchema':{'type':a0_0x4e0878(0x23c),'properties':{}}}]}));async function P(_0x1d9ab3,_0x3361a6){const _0x1c6fcc=a0_0x4e0878;let _0x337416=await fetch(f+_0x1c6fcc(0x260),{'method':_0x1c6fcc(0x252),'headers':{'Content-Type':_0x1c6fcc(0x219),'Accept':_0x1c6fcc(0x1fa),...X?{'Authorization':_0x1c6fcc(0x23b)+X}:{}},'body':JSON[_0x1c6fcc(0x200)]({'jsonrpc':_0x1c6fcc(0x245),'id':0x1,'method':_0x1c6fcc(0x20a),'params':{'protocolVersion':_0x1c6fcc(0x256),'capabilities':{},'clientInfo':{'name':_0x1c6fcc(0x249),'version':_0x1c6fcc(0x238)}}})});if(!_0x337416['ok']){let _0xfb464c=await _0x337416[_0x1c6fcc(0x229)]();return Y(_0x1c6fcc(0x212)+_0x337416[_0x1c6fcc(0x255)]+'\x20'+_0xfb464c['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1c6fcc(0x263)+_0x337416[_0x1c6fcc(0x255)]};}await _0x337416[_0x1c6fcc(0x229)]();let _0xcfa19=(await(await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':_0x1c6fcc(0x219),'Accept':_0x1c6fcc(0x1fa),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1c6fcc(0x245),'id':0x2,'method':_0x1c6fcc(0x203),'params':{'name':_0x1d9ab3,'arguments':_0x3361a6}})}))['text']())[_0x1c6fcc(0x24d)]('\x0a')[_0x1c6fcc(0x1fd)](_0x20bc3a=>_0x20bc3a[_0x1c6fcc(0x247)](_0x1c6fcc(0x1f5)));if(_0xcfa19){let _0x1aeabf=JSON['parse'](_0xcfa19['slice'](0x6));return _0x1aeabf?.[_0x1c6fcc(0x243)]?.['content']?.[0x0]?.[_0x1c6fcc(0x229)]?JSON[_0x1c6fcc(0x241)](_0x1aeabf[_0x1c6fcc(0x243)][_0x1c6fcc(0x1f0)][0x0][_0x1c6fcc(0x229)]):_0x1aeabf;}return{'ok':!0x1,'error':_0x1c6fcc(0x223)};}K[a0_0x4e0878(0x257)](a0_0x447501,async _0x4bf531=>{const _0x2dbbba=a0_0x4e0878;let {name:_0x5dbbf1,arguments:_0x4af942}=_0x4bf531[_0x2dbbba(0x265)];if(_0x5dbbf1===_0x2dbbba(0x269)){let {task_id:_0x540cc7,text:_0x2c760a,status:_0x49e543}=_0x4af942;if(_0x49e543==='completed'||_0x49e543===_0x2dbbba(0x225)||_0x49e543===_0x2dbbba(0x207)){let _0x309ba6=_0x49e543===_0x2dbbba(0x220)?'replied':_0x49e543,_0x20c2a9=_0x540cc7?k[_0x2dbbba(0x23f)](_0x540cc7)||'hub':_0x2dbbba(0x22a),_0x5eac94=await P(_0x2dbbba(0x1e5),{'alias':_0x20c2a9,'text':_0x2c760a,'in_reply_to':_0x540cc7||void 0x0,'status':_0x309ba6,'from_session':Z});if(_0x540cc7)k[_0x2dbbba(0x23e)](_0x540cc7);return{'content':[{'type':_0x2dbbba(0x229),'text':JSON[_0x2dbbba(0x200)](_0x5eac94)}]};}let _0x30c7a8=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x49e543==='blocked'?_0x2dbbba(0x222):_0x49e543===_0x2dbbba(0x26b)?_0x2dbbba(0x26b):_0x2dbbba(0x1e9),'task':_0x2c760a[_0x2dbbba(0x25a)](0x0,0xc8),'output':_0x2c760a});return{'content':[{'type':_0x2dbbba(0x229),'text':JSON[_0x2dbbba(0x200)](_0x30c7a8)}]};}if(_0x5dbbf1===_0x2dbbba(0x254)){let {status:_0x4181a7,task:_0xb6a1b1,progress:_0x5767f4}=_0x4af942,_0x7fe192=await P(_0x2dbbba(0x217),{'resume_id':w,'alias':Z,'status':_0x4181a7,'task':_0xb6a1b1,'progress':_0x5767f4});return{'content':[{'type':_0x2dbbba(0x229),'text':JSON[_0x2dbbba(0x200)](_0x7fe192)}]};}if(_0x5dbbf1===_0x2dbbba(0x236)){let {alias:_0x296295,task:_0x2a0c54,priority:_0x28d251}=_0x4af942,_0x53cb65=await P(_0x2dbbba(0x20f),{'alias':_0x296295,'task':_0x2a0c54,'priority':_0x28d251||_0x2dbbba(0x1eb),'from_session':Z});return{'content':[{'type':_0x2dbbba(0x229),'text':JSON['stringify'](_0x53cb65)}]};}if(_0x5dbbf1===_0x2dbbba(0x1e8)){let {alias:_0x5701a5,message:_0x491e1c}=_0x4af942,_0x1efff3=await P(_0x2dbbba(0x267),{'alias':_0x5701a5,'message':_0x491e1c,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x2dbbba(0x200)](_0x1efff3)}]};}if(_0x5dbbf1===_0x2dbbba(0x216)){let _0x332f80=await P(_0x2dbbba(0x1fe),{});return{'content':[{'type':'text','text':JSON[_0x2dbbba(0x200)](_0x332f80)}]};}return{'content':[{'type':_0x2dbbba(0x229),'text':JSON[_0x2dbbba(0x200)]({'error':_0x2dbbba(0x1f4)})}]};});async function u(){const _0x49e99e=a0_0x4e0878;let _0x51e6c8=f+'/events/'+encodeURIComponent(Z),_0x5d5198={};if(X)_0x5d5198['Authorization']=_0x49e99e(0x23b)+X;Y('connecting\x20to\x20'+_0x51e6c8);while(!0x0){try{let _0x4ddd16=await fetch(_0x51e6c8,{'headers':_0x5d5198});if(!_0x4ddd16['ok']){Y('SSE\x20error:\x20'+_0x4ddd16[_0x49e99e(0x255)]+'\x20'+_0x4ddd16[_0x49e99e(0x21d)]),await h(0x1388);continue;}let _0x312d0c=_0x4ddd16[_0x49e99e(0x1ed)][_0x49e99e(0x208)](),_0x4fad1d=new TextDecoder(),_0x239808='';while(!0x0){let {done:_0x1bae69,value:_0x4e3cb2}=await _0x312d0c[_0x49e99e(0x242)]();if(_0x1bae69)break;_0x239808+=_0x4fad1d[_0x49e99e(0x21c)](_0x4e3cb2,{'stream':!0x0});let _0x2dfacc=_0x239808[_0x49e99e(0x24d)]('\x0a\x0a');_0x239808=_0x2dfacc[_0x49e99e(0x24c)]()||'';for(let _0x1e3e5d of _0x2dfacc){let _0x4892e7=_0x1e3e5d[_0x49e99e(0x24d)]('\x0a')['find'](_0x56d9a1=>_0x56d9a1['startsWith'](_0x49e99e(0x1f5)));if(!_0x4892e7)continue;try{let _0x453c94=JSON[_0x49e99e(0x241)](_0x4892e7[_0x49e99e(0x25a)](0x6));await S(_0x453c94);}catch(_0x2236a9){Y(_0x49e99e(0x1f7)+_0x2236a9);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x3fa0fa){Y(_0x49e99e(0x25c)+_0x3fa0fa);}await h(0xbb8);}}async function S(_0x55ef5b){const _0x1ea8d8=a0_0x4e0878;if(_0x55ef5b[_0x1ea8d8(0x20c)]===_0x1ea8d8(0x25b)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x55ef5b[_0x1ea8d8(0x20c)]===_0x1ea8d8(0x21a)){if(Y('←\x20message\x20from\x20'+_0x55ef5b['from']+':\x20'+_0x55ef5b['message'][_0x1ea8d8(0x25a)](0x0,0x3c)),await K[_0x1ea8d8(0x1f3)]({'method':'notifications/claude/channel','params':{'content':_0x55ef5b[_0x1ea8d8(0x210)],'meta':{'sender':_0x55ef5b['from']||_0x1ea8d8(0x22a),'sender_id':'commhub','user':_0x55ef5b['from']||_0x1ea8d8(0x22a),'priority':_0x1ea8d8(0x1eb)}}}),_0x55ef5b['message_id'])await P(_0x1ea8d8(0x266),{'alias':Z,'message_id':_0x55ef5b[_0x1ea8d8(0x232)]});return;}if(_0x55ef5b[_0x1ea8d8(0x20c)]===_0x1ea8d8(0x268)||_0x55ef5b[_0x1ea8d8(0x20c)]===_0x1ea8d8(0x259)){Y('←\x20'+_0x55ef5b[_0x1ea8d8(0x20c)]+':\x20inbox_count='+_0x55ef5b[_0x1ea8d8(0x22b)]+'\x20priority='+(_0x55ef5b[_0x1ea8d8(0x25f)]||'normal'));let _0x488052=await P(_0x1ea8d8(0x1e6),{'alias':Z,'limit':0x5});if(_0x488052?.['ok']&&_0x488052[_0x1ea8d8(0x1f6)]?.['length']>0x0)for(let _0x1ee352 of _0x488052['messages']){let _0x268d73={'sender':_0x1ee352[_0x1ea8d8(0x25d)]||'hub','sender_id':_0x1ea8d8(0x246),'user':_0x1ee352[_0x1ea8d8(0x25d)]||'hub','task_id':_0x1ee352['id'],'priority':_0x1ee352[_0x1ea8d8(0x25f)]||'normal'};k[_0x1ea8d8(0x213)](_0x1ee352['id'],_0x1ee352[_0x1ea8d8(0x25d)]||_0x1ea8d8(0x22a)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x1ee352[_0x1ea8d8(0x1f0)],'meta':_0x268d73}}),Y(_0x1ea8d8(0x1ef)+_0x1ee352['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x1ee352[_0x1ea8d8(0x25d)]+':\x20'+_0x1ee352[_0x1ea8d8(0x1f0)][_0x1ea8d8(0x25a)](0x0,0x3c)),await P(_0x1ea8d8(0x266),{'alias':Z,'message_id':_0x1ee352['id']});}}}async function A(){const _0x2ce520=a0_0x4e0878;let _0x280a70=new a0_0x593e29();await K[_0x2ce520(0x227)](_0x280a70),Y(_0x2ce520(0x264)),Y(_0x2ce520(0x234)),u()[_0x2ce520(0x262)](_0x1e20fb=>Y(_0x2ce520(0x22d)+_0x1e20fb)),P(_0x2ce520(0x217),{'resume_id':w,'alias':Z,'status':_0x2ce520(0x23d),'server':a0_0x231ed9(),'hostname':a0_0x231ed9(),'agent':_0x2ce520(0x250),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x2ce520(0x209)](()=>Y('registered\x20as\x20\x22'+Z+_0x2ce520(0x24e)+w['slice'](0x0,0x8)+')'))[_0x2ce520(0x262)](_0x5d9ab8=>Y('warning:\x20could\x20not\x20register:\x20'+_0x5d9ab8)),setInterval(()=>{const _0x173466=_0x2ce520;P(_0x173466(0x217),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x231ed9(),'hostname':a0_0x231ed9(),'agent':_0x173466(0x250),'project_dir':process[_0x173466(0x211)](),'tmux_name':j||void 0x0})[_0x173466(0x262)](_0x1835b4=>Y(_0x173466(0x228)+_0x1835b4));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x4e0878(0x262)](_0xe50eb8=>{const _0x160179=a0_0x4e0878;Y(_0x160179(0x201)+_0xe50eb8),process['exit'](0x1);});async function N(){const _0x464018=a0_0x4e0878;Y(_0x464018(0x1ea)),await P(_0x464018(0x217),{'resume_id':w,'alias':Z,'status':_0x464018(0x1f2),'task':_0x464018(0x24a)})[_0x464018(0x262)](()=>{}),process[_0x464018(0x261)](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x4e0878(0x239),()=>N());
|
|
2
|
+
const a0_0x12fd92=a0_0xb9af;(function(_0x6b7d2b,_0x345f46){const _0x3a9f25=a0_0xb9af,_0x13b723=_0x6b7d2b();while(!![]){try{const _0x367df2=parseInt(_0x3a9f25(0x135))/0x1+-parseInt(_0x3a9f25(0xf9))/0x2+-parseInt(_0x3a9f25(0xf6))/0x3+-parseInt(_0x3a9f25(0xfc))/0x4*(parseInt(_0x3a9f25(0x136))/0x5)+parseInt(_0x3a9f25(0xfa))/0x6+parseInt(_0x3a9f25(0xcf))/0x7+parseInt(_0x3a9f25(0x12d))/0x8;if(_0x367df2===_0x345f46)break;else _0x13b723['push'](_0x13b723['shift']());}catch(_0x5ad698){_0x13b723['push'](_0x13b723['shift']());}}}(a0_0x27e7,0x34871));import{readFileSync as a0_0x5e37d4,existsSync as a0_0x139094}from'fs';import{randomUUID as a0_0x318c5c}from'crypto';function a0_0xb9af(_0xc5381c,_0x118927){_0xc5381c=_0xc5381c-0xbb;const _0x27e77b=a0_0x27e7();let _0xb9af67=_0x27e77b[_0xc5381c];return _0xb9af67;}import{join as a0_0x4d66b4}from'path';import{hostname as a0_0x9279cc}from'os';import{execSync as a0_0x487d31}from'child_process';import{Server as a0_0x1c6ad5}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4739e1}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4c9982,CallToolRequestSchema as a0_0x12ae3e}from'@modelcontextprotocol/sdk/types.js';function a0_0x27e7(){const _0x2fe38f=['Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','POST','stdin','setRequestHandler','...\x20TMUX=','SSE\x20connected\x20as\x20\x22','delete','Bearer\x20','shutting\x20down,\x20reporting\x20offline...','blocked','init\x20failed:\x20','.anet','/mcp','commhub_reply','number','new_task','397839NXzFbZ','starting\x20SSE\x20listener...','indexOf','393210xyxsOJ','1739604ckvqwD','stderr','1516288BiaspI','SIGTERM','toTimeString','Task\x20content','Session\x20alias:\x20','Target\x20session\x20alias','get','send_task','message_id','send_message','application/json','find','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','message','failed','commhub-channel','claude-code','replace','set','status','2025-03-26','commhub_get_all_status','0.3.0','commhub','length','replied','from_session','Authorization','report_status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','warning:\x20could\x20not\x20register:\x20','text','SSE\x20fatal:\x20','error','ack_inbox','registered\x20as\x20\x22','new_message','connecting\x20to\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','catch','.claude/channels/commhub','token',':\x20inbox_count=','utf-8','get_all_status','slice','read','parse','4426592FRUMNF','\x20from\x20','2.0','working','CommHub\x20init\x20failed:\x20','params','heartbeat\x20failed:\x20','object','7250bQlrYP','5GaoHWX','parse\x20error:\x20','result','stringify','string','then','/events/','commhub_send_message','notification','trim','get_inbox',']\x20[commhub]\x20','\x20priority=','startsWith','broadcast','ENV:\x20URL=','getReader','http://127.0.0.1:9200','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20ALIAS=','data:\x20','completed','SSE\x20error:\x20','end','content','normal','idle','send_reply','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','split','commhub_send_task','hub','write','statusText','\x22\x20(','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','510545AKwiuQ','config.json','notifications/claude/channel','.env','cancelled','\x20PROJECT_ENV=','tmux\x20display-message\x20-p\x20\x27#S\x27','task','priority','\x20CWD=','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','ready\x20—\x20waiting\x20for\x20events','type','exit','cwd','commhub_report_status','low','connect','connected','Message\x20content','decode','messages','from'];a0_0x27e7=function(){return _0x2fe38f;};return a0_0x27e7();}function p(_0x5d90a8){const _0x1511a4=a0_0xb9af;if(!a0_0x139094(_0x5d90a8))return;for(let _0x239be1 of a0_0x5e37d4(_0x5d90a8,_0x1511a4(0x128))[_0x1511a4(0xc8)]('\x0a')){let _0x36cf39=_0x239be1[_0x1511a4(0x13f)]();if(!_0x36cf39||_0x36cf39[_0x1511a4(0x143)]('#'))continue;let _0x386605=_0x36cf39[_0x1511a4(0xf8)]('=');if(_0x386605<0x0)continue;let _0x3d3658=_0x36cf39[_0x1511a4(0x12a)](0x0,_0x386605)[_0x1511a4(0x13f)](),_0x131433=_0x36cf39['slice'](_0x386605+0x1)['trim']()[_0x1511a4(0x10d)](/^["']|["']$/g,'');if(!process.env[_0x3d3658])process.env[_0x3d3658]=_0x131433;}}var C=process.env.HOME||'~',T=a0_0x4d66b4(C,a0_0x12fd92(0x125));p(a0_0x4d66b4(T,a0_0x12fd92(0xd2)));var L=process[a0_0x12fd92(0xdd)]()[a0_0x12fd92(0x10d)](/\//g,'-');p(a0_0x4d66b4(T,L,a0_0x12fd92(0xd2)));function U(){const _0x38c738=a0_0x12fd92;try{return a0_0x487d31(_0x38c738(0xd5),{'encoding':'utf-8','timeout':0x7d0})[_0x38c738(0x13f)]();}catch{return'';}}function v(){const _0x47695b=a0_0x12fd92;try{let _0x2a8eb9=a0_0x4d66b4(C,_0x47695b(0xf1),_0x47695b(0xd0));if(a0_0x139094(_0x2a8eb9))return JSON['parse'](a0_0x5e37d4(_0x2a8eb9,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x12fd92(0xca)]||a0_0x12fd92(0xbb),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x9279cc(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x318c5c(),X=process.env.COMMHUB_TOKEN||H[a0_0x12fd92(0x126)]||'';function Y(_0x30e154){const _0x296e82=a0_0x12fd92;let _0x16ec26=new Date()[_0x296e82(0xfe)]()[_0x296e82(0x12a)](0x0,0x8);process[_0x296e82(0xfb)][_0x296e82(0xcb)]('['+_0x16ec26+_0x296e82(0x141)+_0x30e154+'\x0a');}function h(_0x37ede7){return new Promise(_0x14b114=>setTimeout(_0x14b114,_0x37ede7));}Y(a0_0x12fd92(0x145)+f+a0_0x12fd92(0xbe)+Z+'\x20RESUME_ID='+w[a0_0x12fd92(0x12a)](0x0,0x8)+a0_0x12fd92(0xea)+(j||'none')+a0_0x12fd92(0xd8)+process[a0_0x12fd92(0xdd)]()+a0_0x12fd92(0xd4)+L);var k=new Map(),K=new a0_0x1c6ad5({'name':a0_0x12fd92(0x10b),'version':a0_0x12fd92(0x112)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x12fd92(0xce),a0_0x12fd92(0x122),a0_0x12fd92(0xc7),a0_0x12fd92(0x123),a0_0x12fd92(0x100)+Z]['join']('\x0a')});K[a0_0x12fd92(0xe9)](a0_0x4c9982,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0x108)},'text':{'type':a0_0x12fd92(0x13a),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x12fd92(0x13a),'enum':[a0_0x12fd92(0xc0),a0_0x12fd92(0x10a),a0_0x12fd92(0xd3),a0_0x12fd92(0xef),'error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':a0_0x12fd92(0xde),'description':a0_0x12fd92(0xd9),'inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':[a0_0x12fd92(0x130),a0_0x12fd92(0xc5),a0_0x12fd92(0xef),'error']},'task':{'type':a0_0x12fd92(0x13a),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x12fd92(0xf4),'description':'Progress\x200-100'}},'required':[a0_0x12fd92(0x10f)]}},{'name':a0_0x12fd92(0xc9),'description':a0_0x12fd92(0x119),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{'alias':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0x101)},'task':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0xff)},'priority':{'type':a0_0x12fd92(0x13a),'enum':['high',a0_0x12fd92(0xc4),a0_0x12fd92(0xdf)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x12fd92(0xd6)]}},{'name':a0_0x12fd92(0x13d),'description':a0_0x12fd92(0xbd),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{'alias':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0x101)},'message':{'type':a0_0x12fd92(0x13a),'description':a0_0x12fd92(0xe2)}},'required':['alias',a0_0x12fd92(0x109)]}},{'name':a0_0x12fd92(0x111),'description':a0_0x12fd92(0xe6),'inputSchema':{'type':a0_0x12fd92(0x134),'properties':{}}}]}));async function P(_0x3d8f6a,_0x2451f6){const _0x22f130=a0_0x12fd92;let _0x543b42=await fetch(f+_0x22f130(0xf2),{'method':_0x22f130(0xe7),'headers':{'Content-Type':_0x22f130(0x106),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x22f130(0xed)+X}:{}},'body':JSON[_0x22f130(0x139)]({'jsonrpc':_0x22f130(0x12f),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x22f130(0x110),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':'0.3.0'}}})});if(!_0x543b42['ok']){let _0x90c2bd=await _0x543b42['text']();return Y(_0x22f130(0x131)+_0x543b42['status']+'\x20'+_0x90c2bd[_0x22f130(0x12a)](0x0,0x64)),{'ok':!0x1,'error':_0x22f130(0xf0)+_0x543b42[_0x22f130(0x10f)]};}await _0x543b42[_0x22f130(0x11b)]();let _0x4830a2=(await(await fetch(f+'/mcp',{'method':_0x22f130(0xe7),'headers':{'Content-Type':_0x22f130(0x106),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x22f130(0xed)+X}:{}},'body':JSON[_0x22f130(0x139)]({'jsonrpc':_0x22f130(0x12f),'id':0x2,'method':'tools/call','params':{'name':_0x3d8f6a,'arguments':_0x2451f6}})}))[_0x22f130(0x11b)]())[_0x22f130(0xc8)]('\x0a')[_0x22f130(0x107)](_0x4e85c1=>_0x4e85c1[_0x22f130(0x143)](_0x22f130(0xbf)));if(_0x4830a2){let _0x4219be=JSON['parse'](_0x4830a2[_0x22f130(0x12a)](0x6));return _0x4219be?.[_0x22f130(0x138)]?.[_0x22f130(0xc3)]?.[0x0]?.[_0x22f130(0x11b)]?JSON[_0x22f130(0x12c)](_0x4219be[_0x22f130(0x138)][_0x22f130(0xc3)][0x0]['text']):_0x4219be;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x12fd92(0xe9)](a0_0x12ae3e,async _0x549de7=>{const _0x37ea36=a0_0x12fd92;let {name:_0x31c40f,arguments:_0x10f8fd}=_0x549de7[_0x37ea36(0x132)];if(_0x31c40f===_0x37ea36(0xf3)){let {task_id:_0x4efe,text:_0x4a4267,status:_0x1b7472}=_0x10f8fd;if(_0x1b7472===_0x37ea36(0xc0)||_0x1b7472==='failed'||_0x1b7472==='cancelled'){let _0x2be706=_0x1b7472===_0x37ea36(0xc0)?_0x37ea36(0x115):_0x1b7472,_0x39b38b=_0x4efe?k[_0x37ea36(0x102)](_0x4efe)||_0x37ea36(0xca):_0x37ea36(0xca),_0x5ad692=await P(_0x37ea36(0xc6),{'alias':_0x39b38b,'text':_0x4a4267,'in_reply_to':_0x4efe||void 0x0,'status':_0x2be706,'from_session':Z});if(_0x4efe)k[_0x37ea36(0xec)](_0x4efe);return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x5ad692)}]};}let _0x339078=await P(_0x37ea36(0x118),{'resume_id':w,'alias':Z,'status':_0x1b7472===_0x37ea36(0xef)?'blocked':_0x1b7472===_0x37ea36(0x11d)?_0x37ea36(0x11d):_0x37ea36(0x130),'task':_0x4a4267['slice'](0x0,0xc8),'output':_0x4a4267});return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x339078)}]};}if(_0x31c40f===_0x37ea36(0xde)){let {status:_0x3cfbf8,task:_0x5de56c,progress:_0x427f6a}=_0x10f8fd,_0x51bf54=await P(_0x37ea36(0x118),{'resume_id':w,'alias':Z,'status':_0x3cfbf8,'task':_0x5de56c,'progress':_0x427f6a});return{'content':[{'type':'text','text':JSON[_0x37ea36(0x139)](_0x51bf54)}]};}if(_0x31c40f===_0x37ea36(0xc9)){let {alias:_0x51a2ac,task:_0x52cdcb,priority:_0x2ea18c}=_0x10f8fd,_0x9c223b=await P(_0x37ea36(0x103),{'alias':_0x51a2ac,'task':_0x52cdcb,'priority':_0x2ea18c||'normal','from_session':Z});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x9c223b)}]};}if(_0x31c40f===_0x37ea36(0x13d)){let {alias:_0x453d95,message:_0x48f7eb}=_0x10f8fd,_0x1603a7=await P(_0x37ea36(0x105),{'alias':_0x453d95,'message':_0x48f7eb,'from_session':Z});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x1603a7)}]};}if(_0x31c40f===_0x37ea36(0x111)){let _0x5bf7b6=await P(_0x37ea36(0x129),{});return{'content':[{'type':_0x37ea36(0x11b),'text':JSON[_0x37ea36(0x139)](_0x5bf7b6)}]};}return{'content':[{'type':_0x37ea36(0x11b),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x411db2=a0_0x12fd92;let _0x5a75f6=f+_0x411db2(0x13c)+encodeURIComponent(Z),_0x41f118={};if(X)_0x41f118[_0x411db2(0x117)]='Bearer\x20'+X;Y(_0x411db2(0x121)+_0x5a75f6);while(!0x0){try{let _0x2c59d5=await fetch(_0x5a75f6,{'headers':_0x41f118});if(!_0x2c59d5['ok']){Y(_0x411db2(0xc1)+_0x2c59d5[_0x411db2(0x10f)]+'\x20'+_0x2c59d5[_0x411db2(0xcc)]),await h(0x1388);continue;}let _0x19418c=_0x2c59d5['body'][_0x411db2(0x146)](),_0x512f12=new TextDecoder(),_0x47e9f4='';while(!0x0){let {done:_0x55acaa,value:_0x35aedd}=await _0x19418c[_0x411db2(0x12b)]();if(_0x55acaa)break;_0x47e9f4+=_0x512f12[_0x411db2(0xe3)](_0x35aedd,{'stream':!0x0});let _0xf265bd=_0x47e9f4[_0x411db2(0xc8)]('\x0a\x0a');_0x47e9f4=_0xf265bd[_0x411db2(0xbc)]()||'';for(let _0x5044ae of _0xf265bd){let _0x38faef=_0x5044ae[_0x411db2(0xc8)]('\x0a')[_0x411db2(0x107)](_0x5ec8f9=>_0x5ec8f9[_0x411db2(0x143)]('data:\x20'));if(!_0x38faef)continue;try{let _0x4dc15f=JSON[_0x411db2(0x12c)](_0x38faef['slice'](0x6));await S(_0x4dc15f);}catch(_0x200d96){Y(_0x411db2(0x137)+_0x200d96);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4f0910){Y('SSE\x20connection\x20error:\x20'+_0x4f0910);}await h(0xbb8);}}async function S(_0x3cd753){const _0x132bd6=a0_0x12fd92;if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0xe1)){Y(_0x132bd6(0xeb)+Z+'\x22');return;}if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0x120)){if(Y('←\x20message\x20from\x20'+_0x3cd753[_0x132bd6(0xe5)]+':\x20'+_0x3cd753[_0x132bd6(0x109)][_0x132bd6(0x12a)](0x0,0x3c)),await K[_0x132bd6(0x13e)]({'method':_0x132bd6(0xd1),'params':{'content':_0x3cd753['message'],'meta':{'sender':_0x3cd753['from']||_0x132bd6(0xca),'sender_id':'commhub','user':_0x3cd753[_0x132bd6(0xe5)]||'hub','priority':_0x132bd6(0xc4)}}}),_0x3cd753[_0x132bd6(0x104)])await P(_0x132bd6(0x11e),{'alias':Z,'message_id':_0x3cd753[_0x132bd6(0x104)]});return;}if(_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0xf5)||_0x3cd753[_0x132bd6(0xdb)]===_0x132bd6(0x144)){Y('←\x20'+_0x3cd753[_0x132bd6(0xdb)]+_0x132bd6(0x127)+_0x3cd753['inbox_count']+_0x132bd6(0x142)+(_0x3cd753[_0x132bd6(0xd7)]||_0x132bd6(0xc4)));let _0x402bc6=await P(_0x132bd6(0x140),{'alias':Z,'limit':0x5});if(_0x402bc6?.['ok']&&_0x402bc6['messages']?.[_0x132bd6(0x114)]>0x0)for(let _0xe262b1 of _0x402bc6[_0x132bd6(0xe4)]){let _0x324ed1={'sender':_0xe262b1[_0x132bd6(0x116)]||_0x132bd6(0xca),'sender_id':_0x132bd6(0x113),'user':_0xe262b1[_0x132bd6(0x116)]||'hub','task_id':_0xe262b1['id'],'priority':_0xe262b1[_0x132bd6(0xd7)]||_0x132bd6(0xc4)};k[_0x132bd6(0x10e)](_0xe262b1['id'],_0xe262b1['from_session']||_0x132bd6(0xca)),await K[_0x132bd6(0x13e)]({'method':_0x132bd6(0xd1),'params':{'content':_0xe262b1['content'],'meta':_0x324ed1}}),Y('→\x20injected\x20task\x20'+_0xe262b1['id'][_0x132bd6(0x12a)](0x0,0x8)+_0x132bd6(0x12e)+_0xe262b1[_0x132bd6(0x116)]+':\x20'+_0xe262b1[_0x132bd6(0xc3)][_0x132bd6(0x12a)](0x0,0x3c)),await P(_0x132bd6(0x11e),{'alias':Z,'message_id':_0xe262b1['id']});}}}async function A(){const _0x2838c4=a0_0x12fd92;let _0x138631=new a0_0x4739e1();await K[_0x2838c4(0xe0)](_0x138631),Y('MCP\x20stdio\x20connected'),Y(_0x2838c4(0xf7)),u()[_0x2838c4(0x124)](_0x5097e6=>Y(_0x2838c4(0x11c)+_0x5097e6)),P(_0x2838c4(0x118),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x9279cc(),'hostname':a0_0x9279cc(),'agent':'claude-code','project_dir':process[_0x2838c4(0xdd)](),'tmux_name':j||void 0x0})[_0x2838c4(0x13b)](()=>Y(_0x2838c4(0x11f)+Z+_0x2838c4(0xcd)+w[_0x2838c4(0x12a)](0x0,0x8)+')'))[_0x2838c4(0x124)](_0x4b74b2=>Y(_0x2838c4(0x11a)+_0x4b74b2)),setInterval(()=>{const _0x17869c=_0x2838c4;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x9279cc(),'hostname':a0_0x9279cc(),'agent':_0x17869c(0x10c),'project_dir':process[_0x17869c(0xdd)](),'tmux_name':j||void 0x0})['catch'](_0x2e02f5=>Y(_0x17869c(0x133)+_0x2e02f5));},0x2bf20),Y(_0x2838c4(0xda));}A()['catch'](_0x47e9f5=>{Y('fatal:\x20'+_0x47e9f5),process['exit'](0x1);});async function N(){const _0x3fbdeb=a0_0x12fd92;Y(_0x3fbdeb(0xee)),await P(_0x3fbdeb(0x118),{'resume_id':w,'alias':Z,'status':'offline','task':'session\x20disconnected'})[_0x3fbdeb(0x124)](()=>{}),process[_0x3fbdeb(0xdc)](0x0);}process[a0_0x12fd92(0xe8)]['on'](a0_0x12fd92(0xc2),()=>N()),process['on'](a0_0x12fd92(0xfd),()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8-preview.0",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|