@sleep2agi/agent-network 2.3.0-preview.76 → 2.3.0-preview.77
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/dist/bin/cli.js +2 -2
- package/dist/src/active-network-task.d.ts +28 -0
- package/dist/src/channel-task-trace.d.ts +4 -0
- package/dist/src/client.js +1 -1
- package/dist/src/grok-copresence-orchestration.d.ts +5 -0
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/outbound-attachments.d.ts +57 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ActiveNetworkTask {
|
|
2
|
+
taskId: string;
|
|
3
|
+
from: string;
|
|
4
|
+
startedAt: number;
|
|
5
|
+
}
|
|
6
|
+
/** 运行时崩溃没来得及删标记时的兜底:超过这个年龄的标记当不存在。 */
|
|
7
|
+
export declare const ACTIVE_NETWORK_TASK_MAX_AGE_MS: number;
|
|
8
|
+
export declare function parseActiveNetworkTask(raw: string | null | undefined, now: number, maxAgeMs?: number): ActiveNetworkTask | null;
|
|
9
|
+
export type OutboundTool = "commhub_send_task" | "commhub_send_message";
|
|
10
|
+
export type OutboundRewrite = {
|
|
11
|
+
kind: "pass";
|
|
12
|
+
} | {
|
|
13
|
+
kind: "progress_of_active_task";
|
|
14
|
+
taskId: string;
|
|
15
|
+
from: string;
|
|
16
|
+
text: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 只在「目标 alias 恰好是当前网络任务的发起方」时改写;发给别人的照常放行——
|
|
20
|
+
* 模型替任务派活给第三方是合法的协作,不能一刀切。
|
|
21
|
+
*/
|
|
22
|
+
export declare function decideOutboundRewrite(tool: OutboundTool, args: {
|
|
23
|
+
alias?: unknown;
|
|
24
|
+
task?: unknown;
|
|
25
|
+
message?: unknown;
|
|
26
|
+
} | null | undefined, active: ActiveNetworkTask | null): OutboundRewrite;
|
|
27
|
+
/** outbound-only 模式下模型不能自选 high(#1770 第三条):降为 normal,其余原样。 */
|
|
28
|
+
export declare function clampOutboundPriority(priority: unknown, outboundOnly: boolean): "high" | "normal" | "low" | undefined;
|
|
@@ -4,6 +4,10 @@ export declare function sendChannelTaskWithTrace(input: {
|
|
|
4
4
|
priority?: string;
|
|
5
5
|
fromAlias: string;
|
|
6
6
|
networkId?: string | null;
|
|
7
|
+
/** Structured task metadata forwarded verbatim, e.g. { attachments: [...] }.
|
|
8
|
+
* Omitted from the outbound body when absent, so a call without it is
|
|
9
|
+
* unchanged. */
|
|
10
|
+
meta?: Record<string, unknown>;
|
|
7
11
|
}, deps: {
|
|
8
12
|
send: (args: Record<string, unknown>) => Promise<any>;
|
|
9
13
|
log: (line: string) => void;
|
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x5b5018=a0_0x1f56;(function(_0x4c94d9,_0x200b90){const _0x552650=a0_0x1f56,_0x3855a5=_0x4c94d9();while(!![]){try{const _0x4ceeeb=parseInt(_0x552650(0x1e7))/0x1+parseInt(_0x552650(0x1a9))/0x2*(parseInt(_0x552650(0x191))/0x3)+parseInt(_0x552650(0x1d3))/0x4+-parseInt(_0x552650(0x1ec))/0x5*(-parseInt(_0x552650(0x1b5))/0x6)+-parseInt(_0x552650(0x1fe))/0x7*(-parseInt(_0x552650(0x1c1))/0x8)+-parseInt(_0x552650(0x1d1))/0x9*(parseInt(_0x552650(0x1a1))/0xa)+-parseInt(_0x552650(0x1da))/0xb;if(_0x4ceeeb===_0x200b90)break;else _0x3855a5['push'](_0x3855a5['shift']());}catch(_0x10381c){_0x3855a5['push'](_0x3855a5['shift']());}}}(a0_0x1d78,0x4102e));import{EventEmitter as a0_0x3a5e97}from'events';import{hostname as a0_0x346293}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x179c3f,_0x4b399e)=>(_0x179c3f??_0x4b399e)[a0_0x5b5018(0x192)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x5b5018(0x1ef)](0x0,0xf0);function N(_0x181808){const _0x26ad3a=a0_0x5b5018;return(_0x181808 instanceof Error?_0x181808[_0x26ad3a(0x1cf)]:String(_0x181808??_0x26ad3a(0x1fb)))['replace'](K,'[REDACTED]')[_0x26ad3a(0x192)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x26ad3a(0x1ef)](0x0,0xf0);}function O(_0x538dc5,_0x32b550=process.env.ANET_TASK_TRACE_FORMAT===a0_0x5b5018(0x1be)){const _0xbda320=a0_0x5b5018;if(_0x32b550)return JSON[_0xbda320(0x1ad)](_0x538dc5);let _0x56bf12=L(_0x538dc5[_0xbda320(0x208)],_0xbda320(0x1f1)),_0x56d14f=L(_0x538dc5[_0xbda320(0x1d4)],_0xbda320(0x1c9)),_0x97629d=_0x538dc5[_0xbda320(0x1d2)]?_0xbda320(0x1f2)+_0x538dc5[_0xbda320(0x1d2)]+':'+(_0x538dc5['error_message']??''):'';return _0xbda320(0x1ae)+_0x538dc5[_0xbda320(0x196)]+_0xbda320(0x1a4)+L(_0x538dc5[_0xbda320(0x1eb)],_0xbda320(0x18e))+_0xbda320(0x1a0)+L(_0x538dc5['to_alias'],_0xbda320(0x18e))+'\x20task_id='+_0x56d14f+_0xbda320(0x204)+_0x56bf12+'\x20network_id='+L(_0x538dc5[_0xbda320(0x1f5)],'<unknown>')+_0xbda320(0x1d8)+_0x538dc5[_0xbda320(0x200)]+_0xbda320(0x19d)+_0x538dc5['duration_ms']+_0xbda320(0x199)+_0x538dc5[_0xbda320(0x1cc)]+_0x97629d;}function a0_0x1f56(_0x44d478,_0x3b5d0e){_0x44d478=_0x44d478-0x18d;const _0x1d7851=a0_0x1d78();let _0x1f5687=_0x1d7851[_0x44d478];return _0x1f5687;}function U(_0x49b3c5){const _0x11e7cd=a0_0x5b5018;return{'event':{'sending':'task.send.start','delivered':_0x11e7cd(0x1fc),'failed':_0x11e7cd(0x1ee),'acked':_0x11e7cd(0x1ac),'started':_0x11e7cd(0x1ca),'replied':_0x11e7cd(0x1bd),'expired':_0x11e7cd(0x1e3)}[_0x49b3c5[_0x11e7cd(0x196)]],..._0x49b3c5};}function j(_0x24376d){const _0x2beb78=a0_0x5b5018;let _0x21012f=_0x24376d?.[_0x2beb78(0x1d4)]||_0x24376d?.[_0x2beb78(0x1b6)]||_0x24376d?.['id'];if(_0x21012f)return String(_0x21012f);let _0x578288=_0x24376d?.[_0x2beb78(0x1de)]?.[0x0]?.['text'];if(typeof _0x578288!=='string')return null;try{let _0x50658c=JSON[_0x2beb78(0x198)](_0x578288);return _0x50658c?.[_0x2beb78(0x1d4)]||_0x50658c?.['message_id']||_0x50658c?.['id']||null;}catch{return null;}}async function X(_0x315ef5,_0x58898c){const _0x586d64=a0_0x5b5018;let _0x3d1249=_0x58898c[_0x586d64(0x19a)]??Date['now'],_0xf8018e=_0x3d1249(),_0x2b58a9=(_0x1e023a,_0x3a5cf7,_0x418615,_0x5cdbc8)=>{const _0x5be2c1=_0x586d64;_0x58898c[_0x5be2c1(0x1f8)](O(U({'from_alias':_0x315ef5['fromAlias'],'to_alias':_0x315ef5[_0x5be2c1(0x1d5)],'task_id':_0x3a5cf7,'parent_task_id':_0x315ef5[_0x5be2c1(0x1e8)],'network_id':_0x315ef5[_0x5be2c1(0x1c0)],'transport':_0x315ef5['transport'],'status':_0x1e023a,'duration_ms':_0x3d1249()-_0xf8018e,'lifecycle_tracking':_0x315ef5[_0x5be2c1(0x1f0)],..._0x418615!==void 0x0?{'error_code':_0x5cdbc8||_0x5be2c1(0x1e0),'error_message':N(_0x418615)}:{}})));};_0x2b58a9(_0x586d64(0x1e2),null);try{let _0x51a3e6=await _0x58898c[_0x586d64(0x1dd)](),_0x16dd66=j(_0x51a3e6);if(_0x16dd66)_0x2b58a9(_0x586d64(0x1ff),_0x16dd66);else{if(_0x51a3e6?.['ok']===!0x1||_0x51a3e6?.[_0x586d64(0x1c2)])_0x2b58a9('failed',_0x16dd66,_0x51a3e6?.['error']||_0x586d64(0x19e),'send_rejected');else _0x2b58a9(_0x586d64(0x206),null,_0x586d64(0x1d7),'missing_task_id');}return _0x51a3e6;}catch(_0x304de1){throw _0x2b58a9(_0x586d64(0x206),null,_0x304de1,_0x586d64(0x1e0)),_0x304de1;}}async function Y(_0x53c697,_0x400d02){const _0x139447=a0_0x5b5018;return X({'fromAlias':_0x53c697['fromAlias'],'toAlias':_0x53c697[_0x139447(0x1e4)],'parentTaskId':_0x53c697[_0x139447(0x1e8)]||null,'networkId':_0x53c697['networkId']||null,'transport':_0x139447(0x190),'lifecycleTracking':_0x139447(0x1fd)},_0x400d02);}class $ extends a0_0x3a5e97{[a0_0x5b5018(0x194)];[a0_0x5b5018(0x1e4)];[a0_0x5b5018(0x207)];[a0_0x5b5018(0x19c)];[a0_0x5b5018(0x1aa)];[a0_0x5b5018(0x1ea)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];[a0_0x5b5018(0x1b3)]=!0x1;constructor(_0x2977dc){const _0x50f77a=a0_0x5b5018;super();if(this[_0x50f77a(0x194)]=_0x2977dc['url']['replace'](/\/$/,''),this['alias']=_0x2977dc[_0x50f77a(0x1e4)],this['token']=_0x2977dc['token'],this[_0x50f77a(0x19c)]=_0x2977dc[_0x50f77a(0x19c)]||'sdk',this[_0x50f77a(0x1aa)]=_0x50f77a(0x1f6)+_0x2977dc[_0x50f77a(0x1e4)]+'-'+Date['now']()['toString'](0x24),this['heartbeatInterval']=_0x2977dc[_0x50f77a(0x1ea)]??0x2bf20,this[_0x50f77a(0x1f7)]=_0x2977dc[_0x50f77a(0x1f7)]??0xbb8,_0x2977dc[_0x50f77a(0x1f4)]!==!0x1)this[_0x50f77a(0x1c7)]();}[a0_0x5b5018(0x1f8)](_0x428c1c){const _0x1ecf95=a0_0x5b5018;console[_0x1ecf95(0x1f8)]('['+new Date()[_0x1ecf95(0x1d0)]()[_0x1ecf95(0x1ef)](0x0,0x8)+_0x1ecf95(0x1dc)+this[_0x1ecf95(0x1e4)]+']\x20'+_0x428c1c);}async['call'](_0x3d5f9f,_0x8a3e62){const _0x114ed5=a0_0x5b5018;let _0x38ea3c={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this[_0x114ed5(0x207)])_0x38ea3c[_0x114ed5(0x1ab)]=_0x114ed5(0x1c6)+this[_0x114ed5(0x207)];let _0x464b63=await(await fetch(this[_0x114ed5(0x194)]+_0x114ed5(0x18f),{'method':_0x114ed5(0x1b9),'headers':_0x38ea3c,'body':JSON[_0x114ed5(0x1ad)]({'jsonrpc':_0x114ed5(0x1e9),'id':Date['now'](),'method':_0x114ed5(0x1bb),'params':{'name':_0x3d5f9f,'arguments':_0x8a3e62}})}))[_0x114ed5(0x1b0)](),_0x165fe6=_0x464b63[_0x114ed5(0x1cb)](/data: (.+)/),_0x44c99e=_0x165fe6?JSON[_0x114ed5(0x198)](_0x165fe6[0x1]):JSON[_0x114ed5(0x198)](_0x464b63),_0x37b851=_0x44c99e?.[_0x114ed5(0x1c5)]?.[_0x114ed5(0x1de)]?.[0x0]?.[_0x114ed5(0x1b0)];return _0x37b851?JSON[_0x114ed5(0x198)](_0x37b851):_0x44c99e;}async[a0_0x5b5018(0x1c7)](){const _0x44cb1f=a0_0x5b5018;if(this['running'])return;this[_0x44cb1f(0x1b3)]=!0x0,await this[_0x44cb1f(0x196)](_0x44cb1f(0x1d6)),this['log'](_0x44cb1f(0x1bc)),this[_0x44cb1f(0x20a)]=setInterval(()=>{const _0x95180b=_0x44cb1f;this[_0x95180b(0x196)](_0x95180b(0x1d6))[_0x95180b(0x20b)](_0x35e053=>this['log']('heartbeat\x20failed:\x20'+_0x35e053[_0x95180b(0x1cf)]));},this[_0x44cb1f(0x1ea)]),this['connectSSE']();}async['disconnect'](){const _0x4e6cca=a0_0x5b5018;if(this[_0x4e6cca(0x1b3)]=!0x1,this[_0x4e6cca(0x1b4)]?.[_0x4e6cca(0x209)](),this[_0x4e6cca(0x20a)])clearInterval(this['heartbeatTimer']);await this[_0x4e6cca(0x196)](_0x4e6cca(0x1e6))[_0x4e6cca(0x20b)](()=>{}),this[_0x4e6cca(0x1f8)](_0x4e6cca(0x1c4));}async[a0_0x5b5018(0x1dd)](_0x15442e,_0x53a282,_0x4acf7d=a0_0x5b5018(0x1b8)){const _0x4217be=a0_0x5b5018;return Y({'alias':_0x15442e,'fromAlias':this[_0x4217be(0x1e4)]},{'log':_0x5cf6cf=>console[_0x4217be(0x1f8)](_0x5cf6cf),'send':()=>this[_0x4217be(0x1a6)](_0x4217be(0x1ce),{'alias':_0x15442e,'task':_0x53a282,'priority':_0x4acf7d,'from_session':this['alias']})});}async[a0_0x5b5018(0x1cf)](_0x559f15,_0x575fae){return this['call']('send_message',{'alias':_0x559f15,'message':_0x575fae,'from_session':this['alias']});}async[a0_0x5b5018(0x201)](_0x2336e6,_0x26a985,_0x42cf6f='completed'){const _0x1b970e=a0_0x5b5018;return this[_0x1b970e(0x1a6)]('send_reply',{'in_reply_to':_0x2336e6,'text':_0x26a985,'status':_0x42cf6f});}async[a0_0x5b5018(0x196)](_0x164945,_0x5b2cbe){const _0x45a25a=a0_0x5b5018;return this[_0x45a25a(0x1a6)](_0x45a25a(0x197),{'resume_id':this[_0x45a25a(0x1aa)],'alias':this[_0x45a25a(0x1e4)],'status':_0x164945,'server':a0_0x346293(),'hostname':a0_0x346293(),'agent':this['agent'],'project_dir':process[_0x45a25a(0x1cd)](),..._0x5b2cbe});}async[a0_0x5b5018(0x203)](){const _0x31c2f9=a0_0x5b5018;return this[_0x31c2f9(0x1a6)]('get_all_status',{});}async[a0_0x5b5018(0x195)](_0x754ff3,_0x1219fd){const _0x131c38=a0_0x5b5018;return this[_0x131c38(0x1a6)]('broadcast',{'message':_0x754ff3,'filter_server':_0x1219fd?.[_0x131c38(0x193)],'filter_status':_0x1219fd?.[_0x131c38(0x196)]});}async['connectSSE'](){const _0x370ce5=a0_0x5b5018;let _0x1e0768=encodeURIComponent(this[_0x370ce5(0x1e4)]),_0x301dc0=this['url']+_0x370ce5(0x1db)+_0x1e0768,_0x52966f=this['reconnectDelay'];while(this[_0x370ce5(0x1b3)]){try{this[_0x370ce5(0x1b4)]=new AbortController();let _0x2a31cf={'Accept':_0x370ce5(0x19b)};if(this[_0x370ce5(0x207)])_0x2a31cf[_0x370ce5(0x1ab)]='Bearer\x20'+this[_0x370ce5(0x207)];let _0x100cf0=await fetch(_0x301dc0,{'headers':_0x2a31cf,'signal':this[_0x370ce5(0x1b4)][_0x370ce5(0x1a3)]});if(!_0x100cf0['ok']||!_0x100cf0[_0x370ce5(0x18d)]){this['log']('SSE\x20failed:\x20'+_0x100cf0['status']),await this[_0x370ce5(0x1ba)](_0x52966f),_0x52966f=Math[_0x370ce5(0x1c3)](_0x52966f*1.5,0xea60);continue;}_0x52966f=this[_0x370ce5(0x1f7)];let _0x40986f=_0x100cf0[_0x370ce5(0x18d)][_0x370ce5(0x1d9)](),_0x5c8bb4=new TextDecoder(),_0x4154d5='';while(this['running']){let {done:_0x5b54ee,value:_0x6eb12}=await _0x40986f[_0x370ce5(0x1af)]();if(_0x5b54ee)break;_0x4154d5+=_0x5c8bb4[_0x370ce5(0x1e5)](_0x6eb12,{'stream':!0x0});let _0x2afc7a=_0x4154d5[_0x370ce5(0x19f)]('\x0a');_0x4154d5=_0x2afc7a['pop']()||'';for(let _0x409383 of _0x2afc7a){if(!_0x409383[_0x370ce5(0x1df)](_0x370ce5(0x1f9)))continue;try{let _0x143c34=JSON[_0x370ce5(0x198)](_0x409383[_0x370ce5(0x1ef)](0x6));if(_0x143c34['type']===_0x370ce5(0x1b2)){this['log'](_0x370ce5(0x205)),this[_0x370ce5(0x1c8)](_0x370ce5(0x1b2));continue;}if(_0x143c34[_0x370ce5(0x1b7)]===_0x370ce5(0x202)||_0x143c34[_0x370ce5(0x1b7)]===_0x370ce5(0x1e1)||_0x143c34['type']===_0x370ce5(0x195))await this['processInbox']();}catch{}}}}catch(_0x5e8540){if(_0x5e8540[_0x370ce5(0x1a7)]===_0x370ce5(0x1f3))break;this[_0x370ce5(0x1c8)](_0x370ce5(0x1c2),_0x5e8540),this['log'](_0x370ce5(0x1ed)+_0x5e8540[_0x370ce5(0x1cf)]);}if(this[_0x370ce5(0x1b3)])this[_0x370ce5(0x1c8)](_0x370ce5(0x1c4)),this[_0x370ce5(0x1f8)](_0x370ce5(0x1fa)+_0x52966f/0x3e8+_0x370ce5(0x1a5)),await this[_0x370ce5(0x1ba)](_0x52966f),_0x52966f=Math['min'](_0x52966f*1.5,0xea60);}}async['processInbox'](){const _0x1b5ebf=a0_0x5b5018;try{let _0x47f11f=(await this['call'](_0x1b5ebf(0x1a8),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x5ac474 of _0x47f11f)await this[_0x1b5ebf(0x1a6)](_0x1b5ebf(0x1a2),{'alias':this[_0x1b5ebf(0x1e4)],'message_id':_0x5ac474['id']}),this[_0x1b5ebf(0x1f8)]('←\x20'+_0x5ac474[_0x1b5ebf(0x1b1)]+':\x20'+_0x5ac474[_0x1b5ebf(0x1de)][_0x1b5ebf(0x1ef)](0x0,0x3c)),this['emit']('task',_0x5ac474),this[_0x1b5ebf(0x1c8)]('message',_0x5ac474);}catch(_0x5de156){this[_0x1b5ebf(0x1f8)](_0x1b5ebf(0x1bf)+_0x5de156[_0x1b5ebf(0x1cf)]);}}[a0_0x5b5018(0x1ba)](_0x5d0f11){return new Promise(_0x7f22fb=>setTimeout(_0x7f22fb,_0x5d0f11));}}var F=$;function a0_0x1d78(){const _0x4e54fd=['message','toTimeString','9ZnluEq','error_code','1709132SvjIGX','task_id','toAlias','idle','CommHub\x20response\x20omitted\x20task_id','\x20transport=','getReader','11192346JtglbB','/events/',']\x20[commhub:','send','content','startsWith','send_failed','new_message','sending','task.expired','alias','decode','offline','349508qehWZG','parentTaskId','2.0','heartbeatInterval','from_alias','1115UfTLfj','SSE\x20error:\x20','task.send.failed','slice','lifecycleTracking','<missing>','\x20error=','AbortError','autoConnect','network_id','sdk-','reconnectDelay','log','data:\x20','SSE\x20reconnecting\x20in\x20','unknown\x20error','task.send.delivered','not_tracked','1551697zREaAy','delivered','transport','reply','new_task','getAllStatus','\x20parent_task_id=','SSE\x20connected','failed','token','parent_task_id','abort','heartbeatTimer','catch','body','<unknown>','/mcp','mcp_http','12CGMwFq','replace','server','url','broadcast','status','report_status','parse','\x20lifecycle=','now','text/event-stream','agent','\x20duration_ms=','CommHub\x20rejected\x20task','split','\x20to=','4143180REWfyp','ack_inbox','signal','\x20from=','s...','call','name','get_inbox','215122CzZqYF','resumeId','Authorization','task.ack','stringify','[commhub:task]\x20','read','text','from_session','connected','running','sseAbort','7248LFCLKH','message_id','type','normal','POST','sleep','tools/call','registered','task.replied','json','inbox\x20error:\x20','networkId','8hKiFXr','error','min','disconnected','result','Bearer\x20','connect','emit','<pending>','task.started','match','lifecycle_tracking','cwd','send_task'];a0_0x1d78=function(){return _0x4e54fd;};return a0_0x1d78();}export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x51a7aa=a0_0x3294;(function(_0x1699e9,_0x34736d){const _0x2b939e=a0_0x3294,_0x477891=_0x1699e9();while(!![]){try{const _0x2dd3ca=parseInt(_0x2b939e(0x111))/0x1+-parseInt(_0x2b939e(0x115))/0x2*(-parseInt(_0x2b939e(0xfb))/0x3)+parseInt(_0x2b939e(0x10f))/0x4*(-parseInt(_0x2b939e(0x106))/0x5)+-parseInt(_0x2b939e(0xf7))/0x6+parseInt(_0x2b939e(0xdc))/0x7+parseInt(_0x2b939e(0xea))/0x8+-parseInt(_0x2b939e(0xfd))/0x9*(parseInt(_0x2b939e(0x11e))/0xa);if(_0x2dd3ca===_0x34736d)break;else _0x477891['push'](_0x477891['shift']());}catch(_0x3a0930){_0x477891['push'](_0x477891['shift']());}}}(a0_0x1865,0x275f8));import{EventEmitter as a0_0x568d1d}from'events';import{hostname as a0_0x13c3f0}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4dd494,_0x116425)=>(_0x4dd494??_0x116425)[a0_0x51a7aa(0xeb)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x51a7aa(0xef)](0x0,0xf0);function N(_0xc2fc73){const _0x5f12af=a0_0x51a7aa;return(_0xc2fc73 instanceof Error?_0xc2fc73[_0x5f12af(0x100)]:String(_0xc2fc73??_0x5f12af(0xf3)))[_0x5f12af(0xeb)](K,_0x5f12af(0x110))[_0x5f12af(0xeb)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x5f12af(0xef)](0x0,0xf0);}function O(_0x188be5,_0x58b030=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xe96c44=a0_0x51a7aa;if(_0x58b030)return JSON[_0xe96c44(0xee)](_0x188be5);let _0x5d3f0f=L(_0x188be5['parent_task_id'],_0xe96c44(0x149)),_0x1c9c70=L(_0x188be5[_0xe96c44(0x109)],_0xe96c44(0xdb)),_0x3e25dc=_0x188be5[_0xe96c44(0x12a)]?_0xe96c44(0x147)+_0x188be5[_0xe96c44(0x12a)]+':'+(_0x188be5[_0xe96c44(0xf4)]??''):'';return _0xe96c44(0xed)+_0x188be5['status']+_0xe96c44(0xec)+L(_0x188be5[_0xe96c44(0x12e)],'<unknown>')+_0xe96c44(0x138)+L(_0x188be5[_0xe96c44(0x14d)],_0xe96c44(0x150))+_0xe96c44(0xfa)+_0x1c9c70+_0xe96c44(0x108)+_0x5d3f0f+_0xe96c44(0x125)+L(_0x188be5[_0xe96c44(0xe1)],_0xe96c44(0x150))+_0xe96c44(0x10b)+_0x188be5['transport']+'\x20duration_ms='+_0x188be5[_0xe96c44(0x119)]+_0xe96c44(0xf6)+_0x188be5[_0xe96c44(0x151)]+_0x3e25dc;}function U(_0x36dffb){const _0x1c5ca9=a0_0x51a7aa;return{'event':{'sending':_0x1c5ca9(0xe9),'delivered':_0x1c5ca9(0xe6),'failed':'task.send.failed','acked':_0x1c5ca9(0x13f),'started':_0x1c5ca9(0x14b),'replied':'task.replied','expired':'task.expired'}[_0x36dffb[_0x1c5ca9(0xd9)]],..._0x36dffb};}function a0_0x3294(_0x4d5e24,_0x446087){_0x4d5e24=_0x4d5e24-0xd5;const _0x186541=a0_0x1865();let _0x329421=_0x186541[_0x4d5e24];return _0x329421;}function a0_0x1865(){const _0x34132c=['toAlias','abort','\x20network_id=','transport','result','toString','token','error_code','not_tracked','failed','heartbeatInterval','from_alias','url','Bearer\x20','catch','broadcast','tools/call','type','resumeId','missing_task_id','split','\x20to=','getAllStatus','disconnected','send_reply','server','AbortError','autoConnect','task.ack','new_task','application/json','connectSSE','lifecycleTracking','registered','string','alias','\x20error=','processInbox','<missing>','running','task.started','send_rejected','to_alias','ack_inbox','log','<unknown>','lifecycle_tracking','sseAbort','offline',']\x20[commhub:','emit','match','send','completed','status','sending','<pending>','728679fiZzGi','delivered','networkId','new_message','disconnect','network_id','fromAlias','body','Authorization','/events/','task.send.delivered','toTimeString','send_task','task.send.start','116368mmiNwh','replace','\x20from=','[commhub:task]\x20','stringify','slice','parse','POST','text/event-stream','unknown\x20error','error_message','SSE\x20error:\x20','\x20lifecycle=','102036rwrVad','connect','message_id','\x20task_id=','18fiQvvu','heartbeatTimer','27qSQzyS','mcp_http','SSE\x20connected','message','sdk-','data:\x20','error','call','messages','5qvAsvW','connected','\x20parent_task_id=','task_id','CommHub\x20rejected\x20task','\x20transport=','text','inbox\x20error:\x20','min','241448xvtZWj','[REDACTED]','152316yCYpUY','signal','SSE\x20failed:\x20','sdk','54986saHQNt','parentTaskId','agent','heartbeat\x20failed:\x20','duration_ms','reply','pop','send_failed','name','657590ruuAhK','now','reconnectDelay','content','sleep'];a0_0x1865=function(){return _0x34132c;};return a0_0x1865();}function j(_0x476b42){const _0x18aafc=a0_0x51a7aa;let _0x48d102=_0x476b42?.[_0x18aafc(0x109)]||_0x476b42?.[_0x18aafc(0xf9)]||_0x476b42?.['id'];if(_0x48d102)return String(_0x48d102);let _0x1832f1=_0x476b42?.[_0x18aafc(0x121)]?.[0x0]?.[_0x18aafc(0x10c)];if(typeof _0x1832f1!==_0x18aafc(0x145))return null;try{let _0x2c8e2b=JSON[_0x18aafc(0xf0)](_0x1832f1);return _0x2c8e2b?.['task_id']||_0x2c8e2b?.['message_id']||_0x2c8e2b?.['id']||null;}catch{return null;}}async function X(_0x3ec17b,_0x5e47d7){const _0x43a9d7=a0_0x51a7aa;let _0x471f8e=_0x5e47d7[_0x43a9d7(0x11f)]??Date[_0x43a9d7(0x11f)],_0x10f8ac=_0x471f8e(),_0xed2419=(_0x514286,_0x2e346a,_0x29accd,_0x4c623f)=>{const _0x40c675=_0x43a9d7;_0x5e47d7['log'](O(U({'from_alias':_0x3ec17b[_0x40c675(0xe2)],'to_alias':_0x3ec17b[_0x40c675(0x123)],'task_id':_0x2e346a,'parent_task_id':_0x3ec17b[_0x40c675(0x116)],'network_id':_0x3ec17b['networkId'],'transport':_0x3ec17b[_0x40c675(0x126)],'status':_0x514286,'duration_ms':_0x471f8e()-_0x10f8ac,'lifecycle_tracking':_0x3ec17b[_0x40c675(0x143)],..._0x29accd!==void 0x0?{'error_code':_0x4c623f||_0x40c675(0x11c),'error_message':N(_0x29accd)}:{}})));};_0xed2419(_0x43a9d7(0xda),null);try{let _0x31d8f9=await _0x5e47d7[_0x43a9d7(0xd7)](),_0x322482=j(_0x31d8f9);if(_0x322482)_0xed2419(_0x43a9d7(0xdd),_0x322482);else{if(_0x31d8f9?.['ok']===!0x1||_0x31d8f9?.['error'])_0xed2419(_0x43a9d7(0x12c),_0x322482,_0x31d8f9?.[_0x43a9d7(0x103)]||_0x43a9d7(0x10a),_0x43a9d7(0x14c));else _0xed2419(_0x43a9d7(0x12c),null,'CommHub\x20response\x20omitted\x20task_id',_0x43a9d7(0x136));}return _0x31d8f9;}catch(_0x3902fc){throw _0xed2419('failed',null,_0x3902fc,'send_failed'),_0x3902fc;}}async function Y(_0x50e6e7,_0x1cfac4){const _0x60be06=a0_0x51a7aa;return X({'fromAlias':_0x50e6e7[_0x60be06(0xe2)],'toAlias':_0x50e6e7[_0x60be06(0x146)],'parentTaskId':_0x50e6e7[_0x60be06(0x116)]||null,'networkId':_0x50e6e7[_0x60be06(0xde)]||null,'transport':_0x60be06(0xfe),'lifecycleTracking':_0x60be06(0x12b)},_0x1cfac4);}class $ extends a0_0x568d1d{[a0_0x51a7aa(0x12f)];['alias'];[a0_0x51a7aa(0x129)];[a0_0x51a7aa(0x117)];[a0_0x51a7aa(0x135)];[a0_0x51a7aa(0x12d)];[a0_0x51a7aa(0x120)];[a0_0x51a7aa(0xfc)];['sseAbort'];[a0_0x51a7aa(0x14a)]=!0x1;constructor(_0x3623d2){const _0x18ab66=a0_0x51a7aa;super();if(this['url']=_0x3623d2[_0x18ab66(0x12f)][_0x18ab66(0xeb)](/\/$/,''),this[_0x18ab66(0x146)]=_0x3623d2[_0x18ab66(0x146)],this[_0x18ab66(0x129)]=_0x3623d2['token'],this[_0x18ab66(0x117)]=_0x3623d2[_0x18ab66(0x117)]||_0x18ab66(0x114),this[_0x18ab66(0x135)]=_0x18ab66(0x101)+_0x3623d2[_0x18ab66(0x146)]+'-'+Date['now']()[_0x18ab66(0x128)](0x24),this['heartbeatInterval']=_0x3623d2[_0x18ab66(0x12d)]??0x2bf20,this[_0x18ab66(0x120)]=_0x3623d2[_0x18ab66(0x120)]??0xbb8,_0x3623d2[_0x18ab66(0x13e)]!==!0x1)this[_0x18ab66(0xf8)]();}[a0_0x51a7aa(0x14f)](_0x320725){const _0x13c166=a0_0x51a7aa;console[_0x13c166(0x14f)]('['+new Date()[_0x13c166(0xe7)]()['slice'](0x0,0x8)+_0x13c166(0x154)+this[_0x13c166(0x146)]+']\x20'+_0x320725);}async[a0_0x51a7aa(0x104)](_0x44cdc0,_0x168985){const _0xfa472d=a0_0x51a7aa;let _0x1bccde={'Content-Type':_0xfa472d(0x141),'Accept':'application/json,\x20text/event-stream'};if(this[_0xfa472d(0x129)])_0x1bccde[_0xfa472d(0xe4)]=_0xfa472d(0x130)+this[_0xfa472d(0x129)];let _0x32c5b9=await(await fetch(this[_0xfa472d(0x12f)]+'/mcp',{'method':_0xfa472d(0xf1),'headers':_0x1bccde,'body':JSON[_0xfa472d(0xee)]({'jsonrpc':'2.0','id':Date[_0xfa472d(0x11f)](),'method':_0xfa472d(0x133),'params':{'name':_0x44cdc0,'arguments':_0x168985}})}))['text'](),_0x1ec083=_0x32c5b9[_0xfa472d(0xd6)](/data: (.+)/),_0x2d69fb=_0x1ec083?JSON[_0xfa472d(0xf0)](_0x1ec083[0x1]):JSON[_0xfa472d(0xf0)](_0x32c5b9),_0x488e6f=_0x2d69fb?.[_0xfa472d(0x127)]?.[_0xfa472d(0x121)]?.[0x0]?.[_0xfa472d(0x10c)];return _0x488e6f?JSON[_0xfa472d(0xf0)](_0x488e6f):_0x2d69fb;}async['connect'](){const _0x1b0e46=a0_0x51a7aa;if(this[_0x1b0e46(0x14a)])return;this[_0x1b0e46(0x14a)]=!0x0,await this[_0x1b0e46(0xd9)]('idle'),this[_0x1b0e46(0x14f)](_0x1b0e46(0x144)),this[_0x1b0e46(0xfc)]=setInterval(()=>{const _0x422661=_0x1b0e46;this[_0x422661(0xd9)]('idle')[_0x422661(0x131)](_0x1d7af7=>this[_0x422661(0x14f)](_0x422661(0x118)+_0x1d7af7[_0x422661(0x100)]));},this[_0x1b0e46(0x12d)]),this['connectSSE']();}async[a0_0x51a7aa(0xe0)](){const _0x572267=a0_0x51a7aa;if(this[_0x572267(0x14a)]=!0x1,this[_0x572267(0x152)]?.[_0x572267(0x124)](),this['heartbeatTimer'])clearInterval(this[_0x572267(0xfc)]);await this['status'](_0x572267(0x153))[_0x572267(0x131)](()=>{}),this[_0x572267(0x14f)](_0x572267(0x13a));}async[a0_0x51a7aa(0xd7)](_0x6644d8,_0x1155a5,_0x2e9f21='normal'){const _0x5be4ac=a0_0x51a7aa;return Y({'alias':_0x6644d8,'fromAlias':this[_0x5be4ac(0x146)]},{'log':_0x1b2c0a=>console[_0x5be4ac(0x14f)](_0x1b2c0a),'send':()=>this['call'](_0x5be4ac(0xe8),{'alias':_0x6644d8,'task':_0x1155a5,'priority':_0x2e9f21,'from_session':this[_0x5be4ac(0x146)]})});}async['message'](_0x1a55f2,_0x5d0d5b){const _0x16d421=a0_0x51a7aa;return this[_0x16d421(0x104)]('send_message',{'alias':_0x1a55f2,'message':_0x5d0d5b,'from_session':this[_0x16d421(0x146)]});}async[a0_0x51a7aa(0x11a)](_0x2f16d3,_0x1f2abe,_0x525a84=a0_0x51a7aa(0xd8)){const _0x4f51fc=a0_0x51a7aa;return this[_0x4f51fc(0x104)](_0x4f51fc(0x13b),{'in_reply_to':_0x2f16d3,'text':_0x1f2abe,'status':_0x525a84});}async['status'](_0x285456,_0x2476d1){const _0x5cbbc=a0_0x51a7aa;return this['call']('report_status',{'resume_id':this[_0x5cbbc(0x135)],'alias':this[_0x5cbbc(0x146)],'status':_0x285456,'server':a0_0x13c3f0(),'hostname':a0_0x13c3f0(),'agent':this[_0x5cbbc(0x117)],'project_dir':process['cwd'](),..._0x2476d1});}async[a0_0x51a7aa(0x139)](){const _0x3d239c=a0_0x51a7aa;return this[_0x3d239c(0x104)]('get_all_status',{});}async[a0_0x51a7aa(0x132)](_0x2f0664,_0x48b004){const _0x22dd7f=a0_0x51a7aa;return this[_0x22dd7f(0x104)](_0x22dd7f(0x132),{'message':_0x2f0664,'filter_server':_0x48b004?.[_0x22dd7f(0x13c)],'filter_status':_0x48b004?.[_0x22dd7f(0xd9)]});}async[a0_0x51a7aa(0x142)](){const _0x170151=a0_0x51a7aa;let _0x322b64=encodeURIComponent(this[_0x170151(0x146)]),_0x368134=this[_0x170151(0x12f)]+_0x170151(0xe5)+_0x322b64,_0x9c9f95=this[_0x170151(0x120)];while(this[_0x170151(0x14a)]){try{this['sseAbort']=new AbortController();let _0x3655d6={'Accept':_0x170151(0xf2)};if(this['token'])_0x3655d6[_0x170151(0xe4)]=_0x170151(0x130)+this[_0x170151(0x129)];let _0x2e7654=await fetch(_0x368134,{'headers':_0x3655d6,'signal':this[_0x170151(0x152)][_0x170151(0x112)]});if(!_0x2e7654['ok']||!_0x2e7654[_0x170151(0xe3)]){this[_0x170151(0x14f)](_0x170151(0x113)+_0x2e7654[_0x170151(0xd9)]),await this[_0x170151(0x122)](_0x9c9f95),_0x9c9f95=Math[_0x170151(0x10e)](_0x9c9f95*1.5,0xea60);continue;}_0x9c9f95=this['reconnectDelay'];let _0x1f1ee6=_0x2e7654[_0x170151(0xe3)]['getReader'](),_0x159838=new TextDecoder(),_0x3ba221='';while(this[_0x170151(0x14a)]){let {done:_0x4f0e6c,value:_0x1b29fc}=await _0x1f1ee6['read']();if(_0x4f0e6c)break;_0x3ba221+=_0x159838['decode'](_0x1b29fc,{'stream':!0x0});let _0xab35f8=_0x3ba221[_0x170151(0x137)]('\x0a');_0x3ba221=_0xab35f8[_0x170151(0x11b)]()||'';for(let _0x68c76c of _0xab35f8){if(!_0x68c76c['startsWith'](_0x170151(0x102)))continue;try{let _0xbc5a7a=JSON[_0x170151(0xf0)](_0x68c76c[_0x170151(0xef)](0x6));if(_0xbc5a7a[_0x170151(0x134)]==='connected'){this['log'](_0x170151(0xff)),this[_0x170151(0xd5)](_0x170151(0x107));continue;}if(_0xbc5a7a[_0x170151(0x134)]===_0x170151(0x140)||_0xbc5a7a['type']===_0x170151(0xdf)||_0xbc5a7a['type']===_0x170151(0x132))await this[_0x170151(0x148)]();}catch{}}}}catch(_0x2e4f77){if(_0x2e4f77[_0x170151(0x11d)]===_0x170151(0x13d))break;this[_0x170151(0xd5)](_0x170151(0x103),_0x2e4f77),this[_0x170151(0x14f)](_0x170151(0xf5)+_0x2e4f77['message']);}if(this[_0x170151(0x14a)])this[_0x170151(0xd5)](_0x170151(0x13a)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x9c9f95/0x3e8+'s...'),await this[_0x170151(0x122)](_0x9c9f95),_0x9c9f95=Math[_0x170151(0x10e)](_0x9c9f95*1.5,0xea60);}}async[a0_0x51a7aa(0x148)](){const _0x4f402b=a0_0x51a7aa;try{let _0xf35ab8=(await this['call']('get_inbox',{'alias':this[_0x4f402b(0x146)],'limit':0xa}))?.[_0x4f402b(0x105)]||[];for(let _0x42c205 of _0xf35ab8)await this['call'](_0x4f402b(0x14e),{'alias':this[_0x4f402b(0x146)],'message_id':_0x42c205['id']}),this[_0x4f402b(0x14f)]('←\x20'+_0x42c205['from_session']+':\x20'+_0x42c205[_0x4f402b(0x121)][_0x4f402b(0xef)](0x0,0x3c)),this['emit']('task',_0x42c205),this['emit']('message',_0x42c205);}catch(_0x5d1281){this[_0x4f402b(0x14f)](_0x4f402b(0x10d)+_0x5d1281[_0x4f402b(0x100)]);}}[a0_0x51a7aa(0x122)](_0x35b0eb){return new Promise(_0x4c514f=>setTimeout(_0x4c514f,_0x35b0eb));}}var F=$;export{F as default,$ as CommHub};
|
|
@@ -22,6 +22,9 @@ export declare const GROK_COPRESENCE_CHILD_ENV = "ANET_COPRESENCE_BRIDGE";
|
|
|
22
22
|
export interface GrokCopresenceDiagnosis {
|
|
23
23
|
readonly ok: boolean;
|
|
24
24
|
readonly lines: readonly string[];
|
|
25
|
+
/** #1768 —— 非阻断提示:平台能跑,但 agent-node 的能力表说它少了内核层保证。
|
|
26
|
+
* ok=true 时也可能非空;调用方打印它,不退出。 */
|
|
27
|
+
readonly notices: readonly string[];
|
|
25
28
|
}
|
|
26
29
|
/** One block naming every reason this node cannot run the shared TUI, not one
|
|
27
30
|
* exit per reason. A node that is both the wrong runtime AND missing its
|
|
@@ -38,6 +41,8 @@ export interface GrokCopresenceDiagnosis {
|
|
|
38
41
|
* A one-command launcher that lets someone get that far has not saved them
|
|
39
42
|
* anything, so say it in the same breath as every other gap. */
|
|
40
43
|
export declare const GROK_COPRESENCE_PLATFORMS: readonly NodeJS.Platform[];
|
|
44
|
+
/** 能跑但没有内核层强制的平台 —— agent-node 启动时逐条打印 reducedGuarantees,这里只提前说一句。 */
|
|
45
|
+
export declare const GROK_COPRESENCE_REDUCED_GUARANTEE_PLATFORMS: readonly NodeJS.Platform[];
|
|
41
46
|
export declare function diagnoseGrokCopresence(input: {
|
|
42
47
|
runtime: string;
|
|
43
48
|
displayName: string;
|