@sleep2agi/agent-network 2.2.7-preview.5 → 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_0x136191=a0_0x11ac;(function(_0xffaa2a,_0x1da0cc){const _0x465bc6=a0_0x11ac,_0x1fa4be=_0xffaa2a();while(!![]){try{const _0x478bbe=parseInt(_0x465bc6(0x15e))/0x1*(-parseInt(_0x465bc6(0x141))/0x2)+parseInt(_0x465bc6(0x182))/0x3*(-parseInt(_0x465bc6(0x1ae))/0x4)+-parseInt(_0x465bc6(0x1a6))/0x5*(parseInt(_0x465bc6(0x14f))/0x6)+parseInt(_0x465bc6(0x1b5))/0x7+parseInt(_0x465bc6(0x1c0))/0x8+parseInt(_0x465bc6(0x19e))/0x9+-parseInt(_0x465bc6(0x190))/0xa*(-parseInt(_0x465bc6(0x189))/0xb);if(_0x478bbe===_0x1da0cc)break;else _0x1fa4be['push'](_0x1fa4be['shift']());}catch(_0x21f9a8){_0x1fa4be['push'](_0x1fa4be['shift']());}}}(a0_0x3f03,0x3e979));function a0_0x3f03(){const _0x2f29b2=['split',']\x20[commhub]\x20','send_task','commhub_report_status','370PHTlwf','toTimeString','\x20PROJECT_ENV=','Target\x20session\x20alias','body','error','idle','priority','1352060OWrQyj','startsWith','0.3.0','message','SSE\x20connection\x20error:\x20','delete','getReader','1071756oqmdNG','initialize','←\x20message\x20from\x20','\x20ALIAS=','commhub','parse','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','task','report_status','parse\x20error:\x20','decode','1215200wvufJN','heartbeat\x20failed:\x20','params','no\x20response','status','Message\x20content','\x20RESUME_ID=','/mcp','SSE\x20error:\x20','normal','object','init\x20failed:\x20','message_id','broadcast','replied','stderr','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','32IAebYI','notification','shutting\x20down,\x20reporting\x20offline...','end','config.json','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','SSE\x20fatal:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','utf-8','result','session\x20disconnected','connected','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','MCP\x20stdio\x20connected','13878WWeGcQ','ENV:\x20URL=','length','2.0','none','send_message','warning:\x20could\x20not\x20register:\x20','number','blocked','low','\x20priority=','completed','from','content','application/json,\x20text/event-stream','9189ZfmkDW','indexOf','Progress\x200-100','Task\x20content','/events/','data:\x20','commhub_get_all_status','high','\x20CWD=','unknown\x20tool','CommHub\x20init\x20failed:\x20','failed','slice','in_progress','connect','stdin','stringify','commhub-channel','fatal:\x20','connecting\x20to\x20','Priority\x20(default:\x20normal)','registered\x20as\x20\x22','tmux\x20display-message\x20-p\x20\x27#S\x27','Bearer\x20','trim','pop','get_all_status','text','type','catch','messages','SIGTERM','\x22\x20(','inbox_count','...\x20TMUX=','SSE\x20stream\x20ended,\x20reconnecting...','3qOwwYZ','working','Reply\x20text\x20/\x20result\x20summary','alias','hub','claude-code','tools/call','506JABeei','commhub_send_message','.env','application/json','statusText','cancelled','POST','86290HeQmIo','commhub_reply','notifications/claude/channel','read','string','find','get_inbox','cwd','Authorization','ready\x20—\x20waiting\x20for\x20events','then','from_session','Session\x20alias:\x20','.anet','1895724cyjalZ','\x20from\x20','http://127.0.0.1:9200','join'];a0_0x3f03=function(){return _0x2f29b2;};return a0_0x3f03();}function a0_0x11ac(_0x2e2bf2,_0x2b818d){_0x2e2bf2=_0x2e2bf2-0x131;const _0x3f0389=a0_0x3f03();let _0x11ac45=_0x3f0389[_0x2e2bf2];return _0x11ac45;}import{readFileSync as a0_0x1da6b2,existsSync as a0_0x2a1224}from'fs';import{randomUUID as a0_0x2fc8c5}from'crypto';import{join as a0_0x11b8fb}from'path';import{hostname as a0_0x4db030}from'os';import{execSync as a0_0x43ea20}from'child_process';import{Server as a0_0x5f56a9}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x238602}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x353a7e,CallToolRequestSchema as a0_0xba9472}from'@modelcontextprotocol/sdk/types.js';function p(_0x148f40){const _0x540fce=a0_0x11ac;if(!a0_0x2a1224(_0x148f40))return;for(let _0x10dd56 of a0_0x1da6b2(_0x148f40,'utf-8')[_0x540fce(0x1a2)]('\x0a')){let _0x23d7e9=_0x10dd56['trim']();if(!_0x23d7e9||_0x23d7e9[_0x540fce(0x1af)]('#'))continue;let _0x3b3c4f=_0x23d7e9[_0x540fce(0x15f)]('=');if(_0x3b3c4f<0x0)continue;let _0x518fd1=_0x23d7e9[_0x540fce(0x16a)](0x0,_0x3b3c4f)['trim'](),_0x3e3b92=_0x23d7e9['slice'](_0x3b3c4f+0x1)['trim']()['replace'](/^["']|["']$/g,'');if(!process.env[_0x518fd1])process.env[_0x518fd1]=_0x3e3b92;}}var C=process.env.HOME||'~',T=a0_0x11b8fb(C,'.claude/channels/commhub');p(a0_0x11b8fb(T,a0_0x136191(0x18b)));var L=process[a0_0x136191(0x197)]()['replace'](/\//g,'-');p(a0_0x11b8fb(T,L,'.env'));function U(){const _0x481c03=a0_0x136191;try{return a0_0x43ea20(_0x481c03(0x174),{'encoding':_0x481c03(0x149),'timeout':0x7d0})[_0x481c03(0x176)]();}catch{return'';}}function v(){const _0x2f1d55=a0_0x136191;try{let _0x4b24a2=a0_0x11b8fb(C,_0x2f1d55(0x19d),_0x2f1d55(0x145));if(a0_0x2a1224(_0x4b24a2))return JSON[_0x2f1d55(0x1ba)](a0_0x1da6b2(_0x4b24a2,_0x2f1d55(0x149)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x136191(0x186)]||a0_0x136191(0x1a0),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4db030(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2fc8c5(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x1b1b36){const _0x4d13c3=a0_0x136191;let _0x96ee0b=new Date()[_0x4d13c3(0x1a7)]()[_0x4d13c3(0x16a)](0x0,0x8);process[_0x4d13c3(0x13f)]['write']('['+_0x96ee0b+_0x4d13c3(0x1a3)+_0x1b1b36+'\x0a');}function h(_0x2678d3){return new Promise(_0x6eb160=>setTimeout(_0x6eb160,_0x2678d3));}Y(a0_0x136191(0x150)+f+a0_0x136191(0x1b8)+Z+a0_0x136191(0x136)+w[a0_0x136191(0x16a)](0x0,0x8)+a0_0x136191(0x180)+(j||a0_0x136191(0x153))+a0_0x136191(0x166)+process[a0_0x136191(0x197)]()+a0_0x136191(0x1a8)+L);var k=new Map(),K=new a0_0x5f56a9({'name':a0_0x136191(0x16f),'version':a0_0x136191(0x1b0)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x136191(0x148),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x136191(0x19c)+Z][a0_0x136191(0x1a1)]('\x0a')});K['setRequestHandler'](a0_0x353a7e,async()=>({'tools':[{'name':a0_0x136191(0x191),'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_0x136191(0x194),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x136191(0x194),'description':a0_0x136191(0x184)},'status':{'type':a0_0x136191(0x194),'enum':[a0_0x136191(0x15a),'failed',a0_0x136191(0x18e),a0_0x136191(0x157),a0_0x136191(0x1ab),a0_0x136191(0x16b)],'description':a0_0x136191(0x1bb)}},'required':[a0_0x136191(0x179)]}},{'name':'commhub_report_status','description':a0_0x136191(0x14d),'inputSchema':{'type':a0_0x136191(0x13a),'properties':{'status':{'type':a0_0x136191(0x194),'enum':['working','idle',a0_0x136191(0x157),a0_0x136191(0x1ab)]},'task':{'type':a0_0x136191(0x194),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x136191(0x156),'description':a0_0x136191(0x160)}},'required':[a0_0x136191(0x134)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x136191(0x194),'description':a0_0x136191(0x1a9)},'task':{'type':a0_0x136191(0x194),'description':a0_0x136191(0x161)},'priority':{'type':'string','enum':[a0_0x136191(0x165),'normal',a0_0x136191(0x158)],'description':a0_0x136191(0x172)}},'required':[a0_0x136191(0x185),a0_0x136191(0x1bc)]}},{'name':a0_0x136191(0x18a),'description':a0_0x136191(0x140),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x136191(0x194),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x136191(0x194),'description':a0_0x136191(0x135)}},'required':[a0_0x136191(0x185),a0_0x136191(0x1b1)]}},{'name':a0_0x136191(0x164),'description':a0_0x136191(0x146),'inputSchema':{'type':a0_0x136191(0x13a),'properties':{}}}]}));async function P(_0x24af1a,_0x23b645){const _0x1b2153=a0_0x136191;let _0x545090=await fetch(f+_0x1b2153(0x137),{'method':_0x1b2153(0x18f),'headers':{'Content-Type':_0x1b2153(0x18c),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1b2153(0x152),'id':0x1,'method':_0x1b2153(0x1b6),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x1b2153(0x1b0)}}})});if(!_0x545090['ok']){let _0x4f9fd8=await _0x545090[_0x1b2153(0x179)]();return Y(_0x1b2153(0x168)+_0x545090[_0x1b2153(0x134)]+'\x20'+_0x4f9fd8['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1b2153(0x13b)+_0x545090[_0x1b2153(0x134)]};}await _0x545090['text']();let _0x223b96=(await(await fetch(f+_0x1b2153(0x137),{'method':'POST','headers':{'Content-Type':_0x1b2153(0x18c),'Accept':_0x1b2153(0x15d),...X?{'Authorization':_0x1b2153(0x175)+X}:{}},'body':JSON[_0x1b2153(0x16e)]({'jsonrpc':_0x1b2153(0x152),'id':0x2,'method':_0x1b2153(0x188),'params':{'name':_0x24af1a,'arguments':_0x23b645}})}))['text']())[_0x1b2153(0x1a2)]('\x0a')[_0x1b2153(0x195)](_0x4416c4=>_0x4416c4[_0x1b2153(0x1af)](_0x1b2153(0x163)));if(_0x223b96){let _0x4b346d=JSON['parse'](_0x223b96['slice'](0x6));return _0x4b346d?.['result']?.['content']?.[0x0]?.[_0x1b2153(0x179)]?JSON[_0x1b2153(0x1ba)](_0x4b346d[_0x1b2153(0x14a)]['content'][0x0][_0x1b2153(0x179)]):_0x4b346d;}return{'ok':!0x1,'error':_0x1b2153(0x133)};}K['setRequestHandler'](a0_0xba9472,async _0x19ceaf=>{const _0x24f0e7=a0_0x136191;let {name:_0x146bee,arguments:_0x3f4165}=_0x19ceaf[_0x24f0e7(0x132)];if(_0x146bee===_0x24f0e7(0x191)){let {task_id:_0x554fa6,text:_0x58eaeb,status:_0x5b1688}=_0x3f4165;if(_0x5b1688==='completed'||_0x5b1688===_0x24f0e7(0x169)||_0x5b1688===_0x24f0e7(0x18e)){let _0x4dc1ea=_0x5b1688===_0x24f0e7(0x15a)?_0x24f0e7(0x13e):_0x5b1688,_0x5cb756=_0x554fa6?k['get'](_0x554fa6)||_0x24f0e7(0x186):_0x24f0e7(0x186),_0x3630e5=await P('send_reply',{'alias':_0x5cb756,'text':_0x58eaeb,'in_reply_to':_0x554fa6||void 0x0,'status':_0x4dc1ea,'from_session':Z});if(_0x554fa6)k[_0x24f0e7(0x1b3)](_0x554fa6);return{'content':[{'type':_0x24f0e7(0x179),'text':JSON['stringify'](_0x3630e5)}]};}let _0x29d5bb=await P(_0x24f0e7(0x1bd),{'resume_id':w,'alias':Z,'status':_0x5b1688===_0x24f0e7(0x157)?_0x24f0e7(0x157):_0x5b1688===_0x24f0e7(0x1ab)?_0x24f0e7(0x1ab):_0x24f0e7(0x183),'task':_0x58eaeb['slice'](0x0,0xc8),'output':_0x58eaeb});return{'content':[{'type':_0x24f0e7(0x179),'text':JSON['stringify'](_0x29d5bb)}]};}if(_0x146bee===_0x24f0e7(0x1a5)){let {status:_0x4735bf,task:_0x1dcecc,progress:_0x338a10}=_0x3f4165,_0xdc632=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4735bf,'task':_0x1dcecc,'progress':_0x338a10});return{'content':[{'type':_0x24f0e7(0x179),'text':JSON[_0x24f0e7(0x16e)](_0xdc632)}]};}if(_0x146bee==='commhub_send_task'){let {alias:_0x3cf8d0,task:_0x443ca9,priority:_0x5adf7d}=_0x3f4165,_0xc15b9e=await P(_0x24f0e7(0x1a4),{'alias':_0x3cf8d0,'task':_0x443ca9,'priority':_0x5adf7d||_0x24f0e7(0x139),'from_session':Z});return{'content':[{'type':_0x24f0e7(0x179),'text':JSON[_0x24f0e7(0x16e)](_0xc15b9e)}]};}if(_0x146bee===_0x24f0e7(0x18a)){let {alias:_0x1ad55b,message:_0x6ec507}=_0x3f4165,_0x415a4a=await P(_0x24f0e7(0x154),{'alias':_0x1ad55b,'message':_0x6ec507,'from_session':Z});return{'content':[{'type':_0x24f0e7(0x179),'text':JSON[_0x24f0e7(0x16e)](_0x415a4a)}]};}if(_0x146bee===_0x24f0e7(0x164)){let _0x2f565e=await P(_0x24f0e7(0x178),{});return{'content':[{'type':_0x24f0e7(0x179),'text':JSON[_0x24f0e7(0x16e)](_0x2f565e)}]};}return{'content':[{'type':_0x24f0e7(0x179),'text':JSON[_0x24f0e7(0x16e)]({'error':_0x24f0e7(0x167)})}]};});async function u(){const _0x2f63d6=a0_0x136191;let _0x109237=f+_0x2f63d6(0x162)+encodeURIComponent(Z),_0x494b8e={};if(X)_0x494b8e[_0x2f63d6(0x198)]=_0x2f63d6(0x175)+X;Y(_0x2f63d6(0x171)+_0x109237);while(!0x0){try{let _0x1fe32a=await fetch(_0x109237,{'headers':_0x494b8e});if(!_0x1fe32a['ok']){Y(_0x2f63d6(0x138)+_0x1fe32a[_0x2f63d6(0x134)]+'\x20'+_0x1fe32a[_0x2f63d6(0x18d)]),await h(0x1388);continue;}let _0x4d9603=_0x1fe32a[_0x2f63d6(0x1aa)][_0x2f63d6(0x1b4)](),_0x3b5c66=new TextDecoder(),_0x28d4d9='';while(!0x0){let {done:_0x5a3eb0,value:_0x530c95}=await _0x4d9603[_0x2f63d6(0x193)]();if(_0x5a3eb0)break;_0x28d4d9+=_0x3b5c66[_0x2f63d6(0x1bf)](_0x530c95,{'stream':!0x0});let _0x4bad7b=_0x28d4d9[_0x2f63d6(0x1a2)]('\x0a\x0a');_0x28d4d9=_0x4bad7b[_0x2f63d6(0x177)]()||'';for(let _0x4708cf of _0x4bad7b){let _0x5e3ed9=_0x4708cf[_0x2f63d6(0x1a2)]('\x0a')['find'](_0x22fc41=>_0x22fc41['startsWith']('data:\x20'));if(!_0x5e3ed9)continue;try{let _0x357556=JSON[_0x2f63d6(0x1ba)](_0x5e3ed9['slice'](0x6));await S(_0x357556);}catch(_0x1abd0e){Y(_0x2f63d6(0x1be)+_0x1abd0e);}}}Y(_0x2f63d6(0x181));}catch(_0x37190f){Y(_0x2f63d6(0x1b2)+_0x37190f);}await h(0xbb8);}}async function S(_0x5b9e4b){const _0x3e2acb=a0_0x136191;if(_0x5b9e4b[_0x3e2acb(0x17a)]===_0x3e2acb(0x14c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x5b9e4b[_0x3e2acb(0x17a)]==='new_message'){if(Y(_0x3e2acb(0x1b7)+_0x5b9e4b['from']+':\x20'+_0x5b9e4b[_0x3e2acb(0x1b1)][_0x3e2acb(0x16a)](0x0,0x3c)),await K[_0x3e2acb(0x142)]({'method':_0x3e2acb(0x192),'params':{'content':_0x5b9e4b[_0x3e2acb(0x1b1)],'meta':{'sender':_0x5b9e4b['from']||_0x3e2acb(0x186),'sender_id':_0x3e2acb(0x1b9),'user':_0x5b9e4b[_0x3e2acb(0x15b)]||_0x3e2acb(0x186),'priority':_0x3e2acb(0x139)}}}),_0x5b9e4b[_0x3e2acb(0x13c)])await P('ack_inbox',{'alias':Z,'message_id':_0x5b9e4b[_0x3e2acb(0x13c)]});return;}if(_0x5b9e4b[_0x3e2acb(0x17a)]==='new_task'||_0x5b9e4b['type']===_0x3e2acb(0x13d)){Y('←\x20'+_0x5b9e4b['type']+':\x20inbox_count='+_0x5b9e4b[_0x3e2acb(0x17f)]+_0x3e2acb(0x159)+(_0x5b9e4b['priority']||_0x3e2acb(0x139)));let _0x2d6b8b=await P(_0x3e2acb(0x196),{'alias':Z,'limit':0x5});if(_0x2d6b8b?.['ok']&&_0x2d6b8b[_0x3e2acb(0x17c)]?.[_0x3e2acb(0x151)]>0x0)for(let _0x1e2554 of _0x2d6b8b[_0x3e2acb(0x17c)]){let _0x36b342={'sender':_0x1e2554[_0x3e2acb(0x19b)]||_0x3e2acb(0x186),'sender_id':_0x3e2acb(0x1b9),'user':_0x1e2554['from_session']||'hub','task_id':_0x1e2554['id'],'priority':_0x1e2554[_0x3e2acb(0x1ad)]||_0x3e2acb(0x139)};k['set'](_0x1e2554['id'],_0x1e2554['from_session']||_0x3e2acb(0x186)),await K['notification']({'method':_0x3e2acb(0x192),'params':{'content':_0x1e2554[_0x3e2acb(0x15c)],'meta':_0x36b342}}),Y('→\x20injected\x20task\x20'+_0x1e2554['id']['slice'](0x0,0x8)+_0x3e2acb(0x19f)+_0x1e2554[_0x3e2acb(0x19b)]+':\x20'+_0x1e2554[_0x3e2acb(0x15c)][_0x3e2acb(0x16a)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x1e2554['id']});}}}async function A(){const _0x4ddc60=a0_0x136191;let _0x3ff88d=new a0_0x238602();await K[_0x4ddc60(0x16c)](_0x3ff88d),Y(_0x4ddc60(0x14e)),Y('starting\x20SSE\x20listener...'),u()[_0x4ddc60(0x17b)](_0x2e8eea=>Y(_0x4ddc60(0x147)+_0x2e8eea)),P(_0x4ddc60(0x1bd),{'resume_id':w,'alias':Z,'status':_0x4ddc60(0x1ac),'server':a0_0x4db030(),'hostname':a0_0x4db030(),'agent':'claude-code','project_dir':process[_0x4ddc60(0x197)](),'tmux_name':j||void 0x0})[_0x4ddc60(0x19a)](()=>Y(_0x4ddc60(0x173)+Z+_0x4ddc60(0x17e)+w[_0x4ddc60(0x16a)](0x0,0x8)+')'))[_0x4ddc60(0x17b)](_0x2fc726=>Y(_0x4ddc60(0x155)+_0x2fc726)),setInterval(()=>{const _0x464fbe=_0x4ddc60;P('report_status',{'resume_id':w,'alias':Z,'status':_0x464fbe(0x1ac),'server':a0_0x4db030(),'hostname':a0_0x4db030(),'agent':_0x464fbe(0x187),'project_dir':process[_0x464fbe(0x197)](),'tmux_name':j||void 0x0})['catch'](_0x18f5e1=>Y(_0x464fbe(0x131)+_0x18f5e1));},0x2bf20),Y(_0x4ddc60(0x199));}A()[a0_0x136191(0x17b)](_0x5b44ce=>{const _0x502d57=a0_0x136191;Y(_0x502d57(0x170)+_0x5b44ce),process['exit'](0x1);});async function N(){const _0x5b9899=a0_0x136191;Y(_0x5b9899(0x143)),await P(_0x5b9899(0x1bd),{'resume_id':w,'alias':Z,'status':'offline','task':_0x5b9899(0x14b)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x136191(0x16d)]['on'](a0_0x136191(0x144),()=>N()),process['on'](a0_0x136191(0x17d),()=>N()),process['on']('SIGINT',()=>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",
|