@agentconnect.md/daemon 1.0.0-rc.175 → 1.0.0-rc.177
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/index.js +53 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13336,6 +13336,44 @@ const SessionToolBodyChunk = object({
|
|
|
13336
13336
|
nextOffset: number().int().optional()
|
|
13337
13337
|
});
|
|
13338
13338
|
//#endregion
|
|
13339
|
+
//#region ../protocol/dist/frames/channel.js
|
|
13340
|
+
/**
|
|
13341
|
+
* Channel agent directory (D→C REQ → REP) — agent collaboration lookup.
|
|
13342
|
+
*
|
|
13343
|
+
* An agent asks (via a daemon-side tool) "who else is in this channel?". The
|
|
13344
|
+
* daemon forwards it to the CP — the ONLY authority for the FULL channel roster,
|
|
13345
|
+
* because agents in one channel may run on different daemons (each daemon knows
|
|
13346
|
+
* only its own agents). The CP joins the channel's integrations to their agents
|
|
13347
|
+
* and returns their public metadata (name / displayName / description / status).
|
|
13348
|
+
* Metadata only — never message content (§1/§12).
|
|
13349
|
+
*
|
|
13350
|
+
* Direction is daemon→CP (like `auth` / `register`): the daemon sends the REQ and
|
|
13351
|
+
* the CP replies with `channel/agents/ok` (corr = the req id).
|
|
13352
|
+
*/
|
|
13353
|
+
/** One agent visible in a channel — the collaboration directory entry. */
|
|
13354
|
+
const ChannelAgent = object({
|
|
13355
|
+
agentId: string().uuid(),
|
|
13356
|
+
name: string(),
|
|
13357
|
+
displayName: string().optional(),
|
|
13358
|
+
description: string().optional(),
|
|
13359
|
+
status: _enum([
|
|
13360
|
+
"active",
|
|
13361
|
+
"inactive",
|
|
13362
|
+
"paused"
|
|
13363
|
+
])
|
|
13364
|
+
});
|
|
13365
|
+
/** D→C REQ: list the agents in a channel (for the asking agent's collaboration tool). */
|
|
13366
|
+
const ChannelAgentsReq = object({
|
|
13367
|
+
platform: Platform,
|
|
13368
|
+
channel: string()
|
|
13369
|
+
});
|
|
13370
|
+
/** C→D REP (corr = req id): every agent in the channel across all daemons. */
|
|
13371
|
+
const ChannelAgentsOk = object({
|
|
13372
|
+
platform: Platform,
|
|
13373
|
+
channel: string(),
|
|
13374
|
+
agents: array(ChannelAgent)
|
|
13375
|
+
});
|
|
13376
|
+
//#endregion
|
|
13339
13377
|
//#region ../protocol/dist/frames/workspace.js
|
|
13340
13378
|
/**
|
|
13341
13379
|
* Agent workspace file browsing (C→D REQ → REP) — the console's on-demand pulls.
|
|
@@ -13724,6 +13762,8 @@ const FRAME_SCHEMAS = {
|
|
|
13724
13762
|
"session/history/page": SessionHistoryPage,
|
|
13725
13763
|
"session/tool-body": SessionToolBodyReq,
|
|
13726
13764
|
"session/tool-body/chunk": SessionToolBodyChunk,
|
|
13765
|
+
"channel/agents": ChannelAgentsReq,
|
|
13766
|
+
"channel/agents/ok": ChannelAgentsOk,
|
|
13727
13767
|
"workspace/list": WorkspaceListReq,
|
|
13728
13768
|
"workspace/list/page": WorkspaceListPage,
|
|
13729
13769
|
"workspace/read": WorkspaceReadReq,
|
|
@@ -13804,6 +13844,8 @@ discriminatedUnion("type", [
|
|
|
13804
13844
|
frame("session/history/page", FRAME_SCHEMAS["session/history/page"]),
|
|
13805
13845
|
frame("session/tool-body", FRAME_SCHEMAS["session/tool-body"]),
|
|
13806
13846
|
frame("session/tool-body/chunk", FRAME_SCHEMAS["session/tool-body/chunk"]),
|
|
13847
|
+
frame("channel/agents", FRAME_SCHEMAS["channel/agents"]),
|
|
13848
|
+
frame("channel/agents/ok", FRAME_SCHEMAS["channel/agents/ok"]),
|
|
13807
13849
|
frame("workspace/list", FRAME_SCHEMAS["workspace/list"]),
|
|
13808
13850
|
frame("workspace/list/page", FRAME_SCHEMAS["workspace/list/page"]),
|
|
13809
13851
|
frame("workspace/read", FRAME_SCHEMAS["workspace/read"]),
|
|
@@ -22213,6 +22255,7 @@ var wrapper_default = import_websocket.default;
|
|
|
22213
22255
|
*/
|
|
22214
22256
|
const SUBPROTOCOL = "agentconnect.v1";
|
|
22215
22257
|
const DEFAULT_WS_PATH = "/daemon/ws";
|
|
22258
|
+
const HANDSHAKE_TIMEOUT_MS = 1e4;
|
|
22216
22259
|
var ClientTransport = class ClientTransport {
|
|
22217
22260
|
ws;
|
|
22218
22261
|
get subprotocol() {
|
|
@@ -22229,7 +22272,10 @@ var ClientTransport = class ClientTransport {
|
|
|
22229
22272
|
static dial(url) {
|
|
22230
22273
|
const wsUrl = url.endsWith(DEFAULT_WS_PATH) ? url : url.replace(/\/+$/, "") + DEFAULT_WS_PATH;
|
|
22231
22274
|
return new Promise((resolve, reject) => {
|
|
22232
|
-
const ws = new wrapper_default(wsUrl, [SUBPROTOCOL], {
|
|
22275
|
+
const ws = new wrapper_default(wsUrl, [SUBPROTOCOL], {
|
|
22276
|
+
maxPayload: MAX_FRAME_BYTES,
|
|
22277
|
+
handshakeTimeout: HANDSHAKE_TIMEOUT_MS
|
|
22278
|
+
});
|
|
22233
22279
|
const onPreOpenError = (err) => {
|
|
22234
22280
|
ws.removeAllListeners();
|
|
22235
22281
|
reject(err);
|
|
@@ -22237,6 +22283,7 @@ var ClientTransport = class ClientTransport {
|
|
|
22237
22283
|
ws.once("error", onPreOpenError);
|
|
22238
22284
|
ws.once("open", () => {
|
|
22239
22285
|
ws.removeListener("error", onPreOpenError);
|
|
22286
|
+
ws.on("error", () => ws.terminate());
|
|
22240
22287
|
resolve(new ClientTransport(ws));
|
|
22241
22288
|
});
|
|
22242
22289
|
});
|
|
@@ -83714,6 +83761,10 @@ var CpClient = class {
|
|
|
83714
83761
|
this.state = "CONNECTING";
|
|
83715
83762
|
try {
|
|
83716
83763
|
const t = await this.deps.connect();
|
|
83764
|
+
if (this.stopped || this.fatal) {
|
|
83765
|
+
t.close(1e3, "shutdown");
|
|
83766
|
+
return;
|
|
83767
|
+
}
|
|
83717
83768
|
this.transport = t;
|
|
83718
83769
|
t.onMessage((txt) => void this.onText(txt));
|
|
83719
83770
|
t.onClose((c, r) => this.onClose(c, r));
|
|
@@ -83731,7 +83782,7 @@ var CpClient = class {
|
|
|
83731
83782
|
if (this.reconnectTimer !== void 0) return;
|
|
83732
83783
|
const jitter = this.deps.jitter ?? Math.random;
|
|
83733
83784
|
const base = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** this.attempt);
|
|
83734
|
-
const delay = base + Math.floor(jitter() * base);
|
|
83785
|
+
const delay = Math.min(BACKOFF_CAP_MS, base + Math.floor(jitter() * base));
|
|
83735
83786
|
this.attempt += 1;
|
|
83736
83787
|
this.reconnectTimer = this.deps.clock.setTimeout(() => {
|
|
83737
83788
|
this.reconnectTimer = void 0;
|