@sleep2agi/agent-network 2.2.7-preview.6 → 2.2.7
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
|
-
|
|
1
|
+
const a0_0x5a7ee9=a0_0x45d6;(function(_0x270a2b,_0x50f67e){const _0x21ba01=a0_0x45d6,_0x1a4080=_0x270a2b();while(!![]){try{const _0x152656=-parseInt(_0x21ba01(0x159))/0x1*(-parseInt(_0x21ba01(0x195))/0x2)+-parseInt(_0x21ba01(0x16b))/0x3+-parseInt(_0x21ba01(0x17d))/0x4*(-parseInt(_0x21ba01(0x1a4))/0x5)+parseInt(_0x21ba01(0x166))/0x6*(parseInt(_0x21ba01(0x1a5))/0x7)+-parseInt(_0x21ba01(0x197))/0x8+-parseInt(_0x21ba01(0x161))/0x9+parseInt(_0x21ba01(0x1a1))/0xa*(parseInt(_0x21ba01(0x188))/0xb);if(_0x152656===_0x50f67e)break;else _0x1a4080['push'](_0x1a4080['shift']());}catch(_0x3b817e){_0x1a4080['push'](_0x1a4080['shift']());}}}(a0_0x50d4,0x2fa65));import{EventEmitter as a0_0x3f45ec}from'events';import{hostname as a0_0x30eb10}from'os';class T extends a0_0x3f45ec{[a0_0x5a7ee9(0x168)];[a0_0x5a7ee9(0x178)];[a0_0x5a7ee9(0x160)];[a0_0x5a7ee9(0x15f)];[a0_0x5a7ee9(0x179)];[a0_0x5a7ee9(0x19d)];[a0_0x5a7ee9(0x174)];[a0_0x5a7ee9(0x191)];[a0_0x5a7ee9(0x171)];['running']=!0x1;constructor(_0x1170a1){const _0x4b2c49=a0_0x5a7ee9;super();if(this[_0x4b2c49(0x168)]=_0x1170a1['url'][_0x4b2c49(0x158)](/\/$/,''),this['alias']=_0x1170a1[_0x4b2c49(0x178)],this[_0x4b2c49(0x160)]=_0x1170a1[_0x4b2c49(0x160)],this['agent']=_0x1170a1['agent']||_0x4b2c49(0x193),this[_0x4b2c49(0x179)]=_0x4b2c49(0x199)+_0x1170a1[_0x4b2c49(0x178)]+'-'+Date[_0x4b2c49(0x16e)]()['toString'](0x24),this[_0x4b2c49(0x19d)]=_0x1170a1[_0x4b2c49(0x19d)]??0x2bf20,this[_0x4b2c49(0x174)]=_0x1170a1[_0x4b2c49(0x174)]??0xbb8,_0x1170a1[_0x4b2c49(0x17a)]!==!0x1)this[_0x4b2c49(0x170)]();}[a0_0x5a7ee9(0x181)](_0x3ac9f3){const _0x320da3=a0_0x5a7ee9;console[_0x320da3(0x181)]('['+new Date()[_0x320da3(0x165)]()[_0x320da3(0x173)](0x0,0x8)+']\x20[commhub:'+this[_0x320da3(0x178)]+']\x20'+_0x3ac9f3);}async[a0_0x5a7ee9(0x194)](_0x46f165,_0x197078){const _0xb2f210=a0_0x5a7ee9;let _0x6ece77={'Content-Type':_0xb2f210(0x176),'Accept':_0xb2f210(0x1a3)};if(this['token'])_0x6ece77[_0xb2f210(0x183)]=_0xb2f210(0x18b)+this[_0xb2f210(0x160)];let _0x34af5d=await(await fetch(this['url']+'/mcp',{'method':_0xb2f210(0x19e),'headers':_0x6ece77,'body':JSON[_0xb2f210(0x164)]({'jsonrpc':_0xb2f210(0x192),'id':Date[_0xb2f210(0x16e)](),'method':_0xb2f210(0x163),'params':{'name':_0x46f165,'arguments':_0x197078}})}))['text'](),_0x3559a3=_0x34af5d[_0xb2f210(0x186)](/data: (.+)/),_0x326f07=_0x3559a3?JSON[_0xb2f210(0x182)](_0x3559a3[0x1]):JSON['parse'](_0x34af5d),_0x5e3bf4=_0x326f07?.[_0xb2f210(0x17f)]?.[_0xb2f210(0x169)]?.[0x0]?.[_0xb2f210(0x155)];return _0x5e3bf4?JSON[_0xb2f210(0x182)](_0x5e3bf4):_0x326f07;}async[a0_0x5a7ee9(0x170)](){const _0x2e8564=a0_0x5a7ee9;if(this['running'])return;this[_0x2e8564(0x16d)]=!0x0,await this[_0x2e8564(0x15c)](_0x2e8564(0x17b)),this[_0x2e8564(0x181)](_0x2e8564(0x175)),this[_0x2e8564(0x191)]=setInterval(()=>{const _0x26e97c=_0x2e8564;this['status'](_0x26e97c(0x17b))[_0x26e97c(0x189)](_0x51c855=>this[_0x26e97c(0x181)](_0x26e97c(0x18c)+_0x51c855[_0x26e97c(0x1a0)]));},this[_0x2e8564(0x19d)]),this[_0x2e8564(0x1a6)]();}async[a0_0x5a7ee9(0x19c)](){const _0x1d38f3=a0_0x5a7ee9;if(this[_0x1d38f3(0x16d)]=!0x1,this[_0x1d38f3(0x171)]?.[_0x1d38f3(0x177)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x1d38f3(0x15c)](_0x1d38f3(0x19a))[_0x1d38f3(0x189)](()=>{}),this[_0x1d38f3(0x181)](_0x1d38f3(0x180));}async[a0_0x5a7ee9(0x18a)](_0x2e5270,_0x3312a8,_0x4c0ffb=a0_0x5a7ee9(0x19f)){const _0x5dade5=a0_0x5a7ee9;return this[_0x5dade5(0x194)](_0x5dade5(0x16a),{'alias':_0x2e5270,'task':_0x3312a8,'priority':_0x4c0ffb,'from_session':this[_0x5dade5(0x178)]});}async[a0_0x5a7ee9(0x1a0)](_0x92d30a,_0x12bced){const _0x2ffcfb=a0_0x5a7ee9;return this[_0x2ffcfb(0x194)](_0x2ffcfb(0x185),{'alias':_0x92d30a,'message':_0x12bced,'from_session':this[_0x2ffcfb(0x178)]});}async[a0_0x5a7ee9(0x151)](_0x1cc4fa,_0x1dd68a,_0x398f45=a0_0x5a7ee9(0x152)){return this['call']('send_reply',{'in_reply_to':_0x1cc4fa,'text':_0x1dd68a,'status':_0x398f45});}async['status'](_0x2979d7,_0x449819){const _0x423ee0=a0_0x5a7ee9;return this['call'](_0x423ee0(0x1a2),{'resume_id':this['resumeId'],'alias':this[_0x423ee0(0x178)],'status':_0x2979d7,'server':a0_0x30eb10(),'hostname':a0_0x30eb10(),'agent':this[_0x423ee0(0x15f)],'project_dir':process['cwd'](),..._0x449819});}async[a0_0x5a7ee9(0x1a9)](){const _0xfa47a=a0_0x5a7ee9;return this[_0xfa47a(0x194)](_0xfa47a(0x16f),{});}async[a0_0x5a7ee9(0x1a8)](_0x338909,_0x5e6f9b){const _0x32f70d=a0_0x5a7ee9;return this[_0x32f70d(0x194)](_0x32f70d(0x1a8),{'message':_0x338909,'filter_server':_0x5e6f9b?.['server'],'filter_status':_0x5e6f9b?.[_0x32f70d(0x15c)]});}async['connectSSE'](){const _0x2f5d76=a0_0x5a7ee9;let _0x5ef07d=encodeURIComponent(this[_0x2f5d76(0x178)]),_0xb8dd9c=this[_0x2f5d76(0x168)]+_0x2f5d76(0x162)+_0x5ef07d,_0x34befa=this[_0x2f5d76(0x174)];while(this[_0x2f5d76(0x16d)]){try{this[_0x2f5d76(0x171)]=new AbortController();let _0x1117b8={'Accept':_0x2f5d76(0x190)};if(this[_0x2f5d76(0x160)])_0x1117b8[_0x2f5d76(0x183)]='Bearer\x20'+this[_0x2f5d76(0x160)];let _0xdc81c8=await fetch(_0xb8dd9c,{'headers':_0x1117b8,'signal':this[_0x2f5d76(0x171)][_0x2f5d76(0x15b)]});if(!_0xdc81c8['ok']||!_0xdc81c8['body']){this['log']('SSE\x20failed:\x20'+_0xdc81c8[_0x2f5d76(0x15c)]),await this['sleep'](_0x34befa),_0x34befa=Math[_0x2f5d76(0x187)](_0x34befa*1.5,0xea60);continue;}_0x34befa=this[_0x2f5d76(0x174)];let _0x2d8c89=_0xdc81c8['body'][_0x2f5d76(0x17e)](),_0x24cf48=new TextDecoder(),_0x3b5cf7='';while(this['running']){let {done:_0x543713,value:_0x158b7d}=await _0x2d8c89['read']();if(_0x543713)break;_0x3b5cf7+=_0x24cf48[_0x2f5d76(0x16c)](_0x158b7d,{'stream':!0x0});let _0x277066=_0x3b5cf7['split']('\x0a');_0x3b5cf7=_0x277066['pop']()||'';for(let _0x2dc627 of _0x277066){if(!_0x2dc627[_0x2f5d76(0x167)](_0x2f5d76(0x17c)))continue;try{let _0x5ea6f4=JSON[_0x2f5d76(0x182)](_0x2dc627[_0x2f5d76(0x173)](0x6));if(_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x1aa)){this[_0x2f5d76(0x181)](_0x2f5d76(0x196)),this[_0x2f5d76(0x156)]('connected');continue;}if(_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x198)||_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x18e)||_0x5ea6f4[_0x2f5d76(0x15d)]===_0x2f5d76(0x1a8))await this[_0x2f5d76(0x18f)]();}catch{}}}}catch(_0x4bf752){if(_0x4bf752['name']===_0x2f5d76(0x18d))break;this[_0x2f5d76(0x156)](_0x2f5d76(0x172),_0x4bf752),this[_0x2f5d76(0x181)](_0x2f5d76(0x19b)+_0x4bf752[_0x2f5d76(0x1a0)]);}if(this['running'])this[_0x2f5d76(0x156)](_0x2f5d76(0x180)),this[_0x2f5d76(0x181)](_0x2f5d76(0x15e)+_0x34befa/0x3e8+_0x2f5d76(0x184)),await this[_0x2f5d76(0x154)](_0x34befa),_0x34befa=Math['min'](_0x34befa*1.5,0xea60);}}async[a0_0x5a7ee9(0x18f)](){const _0x46588c=a0_0x5a7ee9;try{let _0x3b3760=(await this[_0x46588c(0x194)](_0x46588c(0x153),{'alias':this['alias'],'limit':0xa}))?.[_0x46588c(0x157)]||[];for(let _0x29c3c2 of _0x3b3760)await this[_0x46588c(0x194)](_0x46588c(0x1a7),{'alias':this[_0x46588c(0x178)],'message_id':_0x29c3c2['id']}),this['log']('←\x20'+_0x29c3c2['from_session']+':\x20'+_0x29c3c2[_0x46588c(0x169)][_0x46588c(0x173)](0x0,0x3c)),this[_0x46588c(0x156)]('task',_0x29c3c2),this['emit'](_0x46588c(0x1a0),_0x29c3c2);}catch(_0x1eab53){this[_0x46588c(0x181)](_0x46588c(0x15a)+_0x1eab53['message']);}}[a0_0x5a7ee9(0x154)](_0xe3ebfa){return new Promise(_0x1383d4=>setTimeout(_0x1383d4,_0xe3ebfa));}}function a0_0x45d6(_0x21a4a5,_0x59120f){_0x21a4a5=_0x21a4a5-0x151;const _0x50d46b=a0_0x50d4();let _0x45d614=_0x50d46b[_0x21a4a5];return _0x45d614;}function a0_0x50d4(){const _0x4f0cb4=['content','send_task','16803wvSNnz','decode','running','now','get_all_status','connect','sseAbort','error','slice','reconnectDelay','registered','application/json','abort','alias','resumeId','autoConnect','idle','data:\x20','40coQgWL','getReader','result','disconnected','log','parse','Authorization','s...','send_message','match','min','2766489UGMKzy','catch','send','Bearer\x20','heartbeat\x20failed:\x20','AbortError','new_message','processInbox','text/event-stream','heartbeatTimer','2.0','sdk','call','72214PKlRBn','SSE\x20connected','1743264ggBfBm','new_task','sdk-','offline','SSE\x20error:\x20','disconnect','heartbeatInterval','POST','normal','message','10MgQYZI','report_status','application/json,\x20text/event-stream','119135HNBEzn','315JxbzDc','connectSSE','ack_inbox','broadcast','getAllStatus','connected','reply','completed','get_inbox','sleep','text','emit','messages','replace','1JFMFmA','inbox\x20error:\x20','signal','status','type','SSE\x20reconnecting\x20in\x20','agent','token','2688831WyXebN','/events/','tools/call','stringify','toTimeString','25542okPrdE','startsWith','url'];a0_0x50d4=function(){return _0x4f0cb4;};return a0_0x50d4();}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_0x40833c=a0_0x1de6;(function(_0x8dc7ff,_0x5c1b25){const _0x2ad476=a0_0x1de6,_0x34afb4=_0x8dc7ff();while(!![]){try{const _0x39010e=-parseInt(_0x2ad476(0x104))/0x1*(parseInt(_0x2ad476(0x108))/0x2)+-parseInt(_0x2ad476(0xec))/0x3*(parseInt(_0x2ad476(0xbb))/0x4)+parseInt(_0x2ad476(0xd0))/0x5*(-parseInt(_0x2ad476(0xf2))/0x6)+-parseInt(_0x2ad476(0xad))/0x7*(-parseInt(_0x2ad476(0xc1))/0x8)+parseInt(_0x2ad476(0xe5))/0x9*(parseInt(_0x2ad476(0xce))/0xa)+parseInt(_0x2ad476(0xdc))/0xb*(parseInt(_0x2ad476(0x111))/0xc)+-parseInt(_0x2ad476(0xe2))/0xd*(-parseInt(_0x2ad476(0x9e))/0xe);if(_0x39010e===_0x5c1b25)break;else _0x34afb4['push'](_0x34afb4['shift']());}catch(_0x47a2c2){_0x34afb4['push'](_0x34afb4['shift']());}}}(a0_0x3f31,0xc5b1a));import{readFileSync as a0_0x14f765,existsSync as a0_0x1aeafd}from'fs';import{randomUUID as a0_0x3819dc}from'crypto';function a0_0x3f31(){const _0x1c2f85=['error','messages','SSE\x20connection\x20error:\x20','1773104ollHyc','broadcast','\x22\x20(','SSE\x20fatal:\x20','stdin','setRequestHandler','shutting\x20down,\x20reporting\x20offline...','fatal:\x20','normal','catch','Current\x20task\x20description','utf-8','application/json','5494690HLTGlu','POST','99445lhxgol','\x20from\x20','\x20ALIAS=','Authorization','startsWith','report_status','pop','stringify','blocked','no\x20response','commhub','heartbeat\x20failed:\x20','66XGWKDE','Reply\x20text\x20/\x20result\x20summary','offline','get_all_status','completed','from_session','1265797zfSbeS',':\x20inbox_count=','ENV:\x20URL=','18LKEWot','status','http://127.0.0.1:9200','hub','claude-code','params','2.0','701169rJNoLE','then','commhub_send_message','none','set','body','6CMVjHt','failed','priority','send_reply','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.claude/channels/commhub','.env','notification','registered\x20as\x20\x22','find','connecting\x20to\x20','session\x20disconnected','CommHub\x20init\x20failed:\x20','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Progress\x200-100','data:\x20','Bearer\x20','type','737421PYzHgZ','tools/call','join','write','4rwdTTr','trim','exit','Session\x20alias:\x20','2025-03-26','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get_inbox','content','replace','476964CnTKrE','working','new_task','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','parse','commhub_report_status','connected','ready\x20—\x20waiting\x20for\x20events','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connected\x20as\x20\x22','MCP\x20stdio\x20connected','cwd','config.json','SSE\x20stream\x20ended,\x20reconnecting...','in_progress','SIGINT','send_task','notifications/claude/channel','commhub_get_all_status','send_message','split','cancelled','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','alias','replied','84OLGuou','slice','←\x20message\x20from\x20','commhub-channel','from','/mcp','\x20PROJECT_ENV=','parse\x20error:\x20','application/json,\x20text/event-stream','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','length','result','token','get','text','49nELbvV','stderr','ack_inbox','commhub_reply','/events/','object','message','idle','string','read',']\x20[commhub]\x20','Message\x20content','delete','commhub_send_task','20NzAYbw','0.3.0','statusText'];a0_0x3f31=function(){return _0x1c2f85;};return a0_0x3f31();}import{join as a0_0x13d10e}from'path';import{hostname as a0_0x569c50}from'os';import{execSync as a0_0x5b612a}from'child_process';import{Server as a0_0x23a3b2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x34239d}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3af468,CallToolRequestSchema as a0_0x18b3f2}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f5266){const _0xd3b58f=a0_0x1de6;if(!a0_0x1aeafd(_0x3f5266))return;for(let _0x1ac711 of a0_0x14f765(_0x3f5266,_0xd3b58f(0xcc))[_0xd3b58f(0x98)]('\x0a')){let _0x1033e3=_0x1ac711[_0xd3b58f(0x109)]();if(!_0x1033e3||_0x1033e3['startsWith']('#'))continue;let _0xb6ff76=_0x1033e3['indexOf']('=');if(_0xb6ff76<0x0)continue;let _0xd61d6f=_0x1033e3['slice'](0x0,_0xb6ff76)['trim'](),_0x47486c=_0x1033e3['slice'](_0xb6ff76+0x1)[_0xd3b58f(0x109)]()[_0xd3b58f(0x110)](/^["']|["']$/g,'');if(!process.env[_0xd61d6f])process.env[_0xd61d6f]=_0x47486c;}}var C=process.env.HOME||'~',T=a0_0x13d10e(C,a0_0x40833c(0xf7));p(a0_0x13d10e(T,a0_0x40833c(0xf8)));var L=process[a0_0x40833c(0x8f)]()[a0_0x40833c(0x110)](/\//g,'-');p(a0_0x13d10e(T,L,a0_0x40833c(0xf8)));function U(){const _0x21837b=a0_0x40833c;try{return a0_0x5b612a('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x21837b(0xcc),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x308008=a0_0x40833c;try{let _0x5eb1c0=a0_0x13d10e(C,'.anet',_0x308008(0x90));if(a0_0x1aeafd(_0x5eb1c0))return JSON[_0x308008(0x88)](a0_0x14f765(_0x5eb1c0,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x40833c(0xe8)]||a0_0x40833c(0xe7),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x569c50(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3819dc(),X=process.env.COMMHUB_TOKEN||H[a0_0x40833c(0xaa)]||'';function Y(_0x54de99){const _0x846eb=a0_0x40833c;let _0xf4c59a=new Date()['toTimeString']()[_0x846eb(0x9f)](0x0,0x8);process[_0x846eb(0xae)][_0x846eb(0x107)]('['+_0xf4c59a+_0x846eb(0xb7)+_0x54de99+'\x0a');}function h(_0x5868b5){return new Promise(_0x425ead=>setTimeout(_0x425ead,_0x5868b5));}function a0_0x1de6(_0x2d5b59,_0x313087){_0x2d5b59=_0x2d5b59-0x85;const _0x3f3188=a0_0x3f31();let _0x1de6dc=_0x3f3188[_0x2d5b59];return _0x1de6dc;}Y(a0_0x40833c(0xe4)+f+a0_0x40833c(0xd2)+Z+'\x20RESUME_ID='+w[a0_0x40833c(0x9f)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x40833c(0xef))+'\x20CWD='+process[a0_0x40833c(0x8f)]()+a0_0x40833c(0xa4)+L);var k=new Map(),K=new a0_0x23a3b2({'name':'commhub-channel','version':a0_0x40833c(0xbc)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x40833c(0xa7),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x40833c(0x9a),a0_0x40833c(0xf6),a0_0x40833c(0x10b)+Z][a0_0x40833c(0x106)]('\x0a')});K['setRequestHandler'](a0_0x3af468,async()=>({'tools':[{'name':a0_0x40833c(0xb0),'description':a0_0x40833c(0x8c),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'task_id':{'type':a0_0x40833c(0xb5),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xdd)},'status':{'type':a0_0x40833c(0xb5),'enum':['completed',a0_0x40833c(0xf3),'cancelled',a0_0x40833c(0xd8),'error',a0_0x40833c(0x92)],'description':a0_0x40833c(0x10d)}},'required':['text']}},{'name':a0_0x40833c(0x89),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'status':{'type':a0_0x40833c(0xb5),'enum':[a0_0x40833c(0x85),a0_0x40833c(0xb4),a0_0x40833c(0xd8),a0_0x40833c(0xbe)]},'task':{'type':a0_0x40833c(0xb5),'description':a0_0x40833c(0xcb)},'progress':{'type':'number','description':a0_0x40833c(0x100)}},'required':[a0_0x40833c(0xe6)]}},{'name':a0_0x40833c(0xba),'description':a0_0x40833c(0x87),'inputSchema':{'type':a0_0x40833c(0xb2),'properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x40833c(0xb5),'description':'Task\x20content'},'priority':{'type':'string','enum':['high','normal','low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x40833c(0x9c),'task']}},{'name':a0_0x40833c(0xee),'description':a0_0x40833c(0x9b),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x40833c(0xb5),'description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x40833c(0xb8)}},'required':[a0_0x40833c(0x9c),a0_0x40833c(0xb3)]}},{'name':a0_0x40833c(0x96),'description':a0_0x40833c(0xff),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x3ee4cf,_0x56d041){const _0x396ddf=a0_0x40833c;let _0x4a229c=await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':_0x396ddf(0xa6),...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON[_0x396ddf(0xd7)]({'jsonrpc':_0x396ddf(0xeb),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x396ddf(0x10c),'capabilities':{},'clientInfo':{'name':_0x396ddf(0xa1),'version':_0x396ddf(0xbc)}}})});if(!_0x4a229c['ok']){let _0x3c1844=await _0x4a229c[_0x396ddf(0xac)]();return Y(_0x396ddf(0xfe)+_0x4a229c[_0x396ddf(0xe6)]+'\x20'+_0x3c1844[_0x396ddf(0x9f)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x4a229c[_0x396ddf(0xe6)]};}await _0x4a229c['text']();let _0x1be050=(await(await fetch(f+_0x396ddf(0xa3),{'method':_0x396ddf(0xcf),'headers':{'Content-Type':_0x396ddf(0xcd),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x396ddf(0x102)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x396ddf(0x105),'params':{'name':_0x3ee4cf,'arguments':_0x56d041}})}))[_0x396ddf(0xac)]())[_0x396ddf(0x98)]('\x0a')[_0x396ddf(0xfb)](_0x42fce8=>_0x42fce8[_0x396ddf(0xd4)](_0x396ddf(0x101)));if(_0x1be050){let _0xd5d3bd=JSON[_0x396ddf(0x88)](_0x1be050[_0x396ddf(0x9f)](0x6));return _0xd5d3bd?.[_0x396ddf(0xa9)]?.[_0x396ddf(0x10f)]?.[0x0]?.['text']?JSON[_0x396ddf(0x88)](_0xd5d3bd[_0x396ddf(0xa9)][_0x396ddf(0x10f)][0x0][_0x396ddf(0xac)]):_0xd5d3bd;}return{'ok':!0x1,'error':_0x396ddf(0xd9)};}K[a0_0x40833c(0xc6)](a0_0x18b3f2,async _0x2841f4=>{const _0x5cc7b4=a0_0x40833c;let {name:_0x87c849,arguments:_0x4b8432}=_0x2841f4[_0x5cc7b4(0xea)];if(_0x87c849===_0x5cc7b4(0xb0)){let {task_id:_0x21a24b,text:_0x4711b2,status:_0x585f4c}=_0x4b8432;if(_0x585f4c===_0x5cc7b4(0xe0)||_0x585f4c===_0x5cc7b4(0xf3)||_0x585f4c===_0x5cc7b4(0x99)){let _0x4827ae=_0x585f4c==='completed'?_0x5cc7b4(0x9d):_0x585f4c,_0x4e57ec=_0x21a24b?k[_0x5cc7b4(0xab)](_0x21a24b)||_0x5cc7b4(0xe8):_0x5cc7b4(0xe8),_0x24982d=await P(_0x5cc7b4(0xf5),{'alias':_0x4e57ec,'text':_0x4711b2,'in_reply_to':_0x21a24b||void 0x0,'status':_0x4827ae,'from_session':Z});if(_0x21a24b)k[_0x5cc7b4(0xb9)](_0x21a24b);return{'content':[{'type':'text','text':JSON['stringify'](_0x24982d)}]};}let _0x41a7c6=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x585f4c===_0x5cc7b4(0xd8)?_0x5cc7b4(0xd8):_0x585f4c===_0x5cc7b4(0xbe)?'error':_0x5cc7b4(0x85),'task':_0x4711b2[_0x5cc7b4(0x9f)](0x0,0xc8),'output':_0x4711b2});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x41a7c6)}]};}if(_0x87c849===_0x5cc7b4(0x89)){let {status:_0x22dedf,task:_0x12f7ac,progress:_0x568235}=_0x4b8432,_0x57072c=await P(_0x5cc7b4(0xd5),{'resume_id':w,'alias':Z,'status':_0x22dedf,'task':_0x12f7ac,'progress':_0x568235});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x57072c)}]};}if(_0x87c849===_0x5cc7b4(0xba)){let {alias:_0x3ce135,task:_0x578862,priority:_0x83b81a}=_0x4b8432,_0x28bf08=await P(_0x5cc7b4(0x94),{'alias':_0x3ce135,'task':_0x578862,'priority':_0x83b81a||_0x5cc7b4(0xc9),'from_session':Z});return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON[_0x5cc7b4(0xd7)](_0x28bf08)}]};}if(_0x87c849===_0x5cc7b4(0xee)){let {alias:_0x1568aa,message:_0x546ab9}=_0x4b8432,_0x5b518e=await P(_0x5cc7b4(0x97),{'alias':_0x1568aa,'message':_0x546ab9,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x5b518e)}]};}if(_0x87c849==='commhub_get_all_status'){let _0x4f460d=await P(_0x5cc7b4(0xdf),{});return{'content':[{'type':'text','text':JSON[_0x5cc7b4(0xd7)](_0x4f460d)}]};}return{'content':[{'type':_0x5cc7b4(0xac),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x364460=a0_0x40833c;let _0x280b6b=f+_0x364460(0xb1)+encodeURIComponent(Z),_0x32f883={};if(X)_0x32f883[_0x364460(0xd3)]=_0x364460(0x102)+X;Y(_0x364460(0xfc)+_0x280b6b);while(!0x0){try{let _0x15c405=await fetch(_0x280b6b,{'headers':_0x32f883});if(!_0x15c405['ok']){Y('SSE\x20error:\x20'+_0x15c405[_0x364460(0xe6)]+'\x20'+_0x15c405[_0x364460(0xbd)]),await h(0x1388);continue;}let _0x47c322=_0x15c405[_0x364460(0xf1)]['getReader'](),_0x185cc6=new TextDecoder(),_0x486f38='';while(!0x0){let {done:_0x1f7f80,value:_0x2c3cd3}=await _0x47c322[_0x364460(0xb6)]();if(_0x1f7f80)break;_0x486f38+=_0x185cc6['decode'](_0x2c3cd3,{'stream':!0x0});let _0x3a8b9d=_0x486f38['split']('\x0a\x0a');_0x486f38=_0x3a8b9d[_0x364460(0xd6)]()||'';for(let _0x54c154 of _0x3a8b9d){let _0x4697a3=_0x54c154['split']('\x0a')[_0x364460(0xfb)](_0x2957dd=>_0x2957dd[_0x364460(0xd4)]('data:\x20'));if(!_0x4697a3)continue;try{let _0x23e3b1=JSON[_0x364460(0x88)](_0x4697a3['slice'](0x6));await S(_0x23e3b1);}catch(_0x1ced78){Y(_0x364460(0xa5)+_0x1ced78);}}}Y(_0x364460(0x91));}catch(_0x12416f){Y(_0x364460(0xc0)+_0x12416f);}await h(0xbb8);}}async function S(_0x59268f){const _0x753b36=a0_0x40833c;if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x8a)){Y(_0x753b36(0x8d)+Z+'\x22');return;}if(_0x59268f[_0x753b36(0x103)]==='new_message'){if(Y(_0x753b36(0xa0)+_0x59268f[_0x753b36(0xa2)]+':\x20'+_0x59268f[_0x753b36(0xb3)][_0x753b36(0x9f)](0x0,0x3c)),await K['notification']({'method':_0x753b36(0x95),'params':{'content':_0x59268f[_0x753b36(0xb3)],'meta':{'sender':_0x59268f[_0x753b36(0xa2)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x59268f[_0x753b36(0xa2)]||'hub','priority':_0x753b36(0xc9)}}}),_0x59268f['message_id'])await P(_0x753b36(0xaf),{'alias':Z,'message_id':_0x59268f['message_id']});return;}if(_0x59268f[_0x753b36(0x103)]===_0x753b36(0x86)||_0x59268f[_0x753b36(0x103)]===_0x753b36(0xc2)){Y('←\x20'+_0x59268f['type']+_0x753b36(0xe3)+_0x59268f['inbox_count']+'\x20priority='+(_0x59268f[_0x753b36(0xf4)]||_0x753b36(0xc9)));let _0x592a86=await P(_0x753b36(0x10e),{'alias':Z,'limit':0x5});if(_0x592a86?.['ok']&&_0x592a86[_0x753b36(0xbf)]?.[_0x753b36(0xa8)]>0x0)for(let _0x3086d3 of _0x592a86[_0x753b36(0xbf)]){let _0x3c8cf7={'sender':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'sender_id':_0x753b36(0xda),'user':_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8),'task_id':_0x3086d3['id'],'priority':_0x3086d3[_0x753b36(0xf4)]||_0x753b36(0xc9)};k[_0x753b36(0xf0)](_0x3086d3['id'],_0x3086d3[_0x753b36(0xe1)]||_0x753b36(0xe8)),await K[_0x753b36(0xf9)]({'method':'notifications/claude/channel','params':{'content':_0x3086d3[_0x753b36(0x10f)],'meta':_0x3c8cf7}}),Y('→\x20injected\x20task\x20'+_0x3086d3['id']['slice'](0x0,0x8)+_0x753b36(0xd1)+_0x3086d3[_0x753b36(0xe1)]+':\x20'+_0x3086d3[_0x753b36(0x10f)][_0x753b36(0x9f)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3086d3['id']});}}}async function A(){const _0x432a8b=a0_0x40833c;let _0x5d32d6=new a0_0x34239d();await K['connect'](_0x5d32d6),Y(_0x432a8b(0x8e)),Y('starting\x20SSE\x20listener...'),u()[_0x432a8b(0xca)](_0xd4595d=>Y(_0x432a8b(0xc4)+_0xd4595d)),P(_0x432a8b(0xd5),{'resume_id':w,'alias':Z,'status':_0x432a8b(0xb4),'server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x432a8b(0xe9),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x432a8b(0xed)](()=>Y(_0x432a8b(0xfa)+Z+_0x432a8b(0xc3)+w[_0x432a8b(0x9f)](0x0,0x8)+')'))[_0x432a8b(0xca)](_0x813b2e=>Y('warning:\x20could\x20not\x20register:\x20'+_0x813b2e)),setInterval(()=>{const _0x6c9884=_0x432a8b;P(_0x6c9884(0xd5),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x569c50(),'hostname':a0_0x569c50(),'agent':_0x6c9884(0xe9),'project_dir':process[_0x6c9884(0x8f)](),'tmux_name':j||void 0x0})['catch'](_0xd6e1d4=>Y(_0x6c9884(0xdb)+_0xd6e1d4));},0x2bf20),Y(_0x432a8b(0x8b));}A()['catch'](_0x49c861=>{const _0xa5070d=a0_0x40833c;Y(_0xa5070d(0xc8)+_0x49c861),process[_0xa5070d(0x10a)](0x1);});async function N(){const _0x46bbdf=a0_0x40833c;Y(_0x46bbdf(0xc7)),await P(_0x46bbdf(0xd5),{'resume_id':w,'alias':Z,'status':_0x46bbdf(0xde),'task':_0x46bbdf(0xfd)})[_0x46bbdf(0xca)](()=>{}),process[_0x46bbdf(0x10a)](0x0);}process[a0_0x40833c(0xc5)]['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x40833c(0x93),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.7
|
|
3
|
+
"version": "2.2.7",
|
|
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",
|