@agentconnect.md/daemon 1.0.0-rc.180 → 1.0.0-rc.182
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 +37 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13513,15 +13513,18 @@ const Heartbeat = object({
|
|
|
13513
13513
|
});
|
|
13514
13514
|
/** Converged session lifecycle milestone — protocol §7.2. NOT the message stream. */
|
|
13515
13515
|
const EventSession = object({
|
|
13516
|
-
sessionId: string()
|
|
13516
|
+
sessionId: string(),
|
|
13517
13517
|
agentId: string().uuid(),
|
|
13518
|
-
launchId: string().uuid(),
|
|
13518
|
+
launchId: string().uuid().optional(),
|
|
13519
13519
|
phase: _enum([
|
|
13520
13520
|
"start",
|
|
13521
13521
|
"plan",
|
|
13522
13522
|
"problem",
|
|
13523
13523
|
"end"
|
|
13524
13524
|
]),
|
|
13525
|
+
platform: Platform.optional(),
|
|
13526
|
+
channel: string().optional(),
|
|
13527
|
+
thread: string().optional(),
|
|
13525
13528
|
link: string().optional(),
|
|
13526
13529
|
summary: string().optional(),
|
|
13527
13530
|
ts: string().datetime()
|
|
@@ -24766,6 +24769,7 @@ var SessionManager = class {
|
|
|
24766
24769
|
let rec = this.deps.store.getSession(key);
|
|
24767
24770
|
const host = await this.deps.hostFor(agentId);
|
|
24768
24771
|
const effortOverride = this.deps.store.getEffortOverride(key);
|
|
24772
|
+
let created = false;
|
|
24769
24773
|
if (!rec || !rec.acpSessionId) {
|
|
24770
24774
|
const cwd = await prepareWorkspace(agent);
|
|
24771
24775
|
const mcpServers = this.deps.mcpServersFor?.({
|
|
@@ -24774,6 +24778,7 @@ var SessionManager = class {
|
|
|
24774
24778
|
thread
|
|
24775
24779
|
}) ?? [];
|
|
24776
24780
|
const acpSessionId = await host.newSession(cwd, mcpServers, effortOverride);
|
|
24781
|
+
created = true;
|
|
24777
24782
|
rec = {
|
|
24778
24783
|
key,
|
|
24779
24784
|
agentId,
|
|
@@ -24804,6 +24809,7 @@ var SessionManager = class {
|
|
|
24804
24809
|
thread
|
|
24805
24810
|
}) ?? [];
|
|
24806
24811
|
const acpSessionId = await host.newSession(cwd, mcpServers, effortOverride);
|
|
24812
|
+
created = true;
|
|
24807
24813
|
rec = {
|
|
24808
24814
|
...rec,
|
|
24809
24815
|
acpSessionId,
|
|
@@ -24858,7 +24864,8 @@ var SessionManager = class {
|
|
|
24858
24864
|
this.deps.store.upsertSession(rec);
|
|
24859
24865
|
return {
|
|
24860
24866
|
sessionId: rec.acpSessionId,
|
|
24861
|
-
blocks
|
|
24867
|
+
blocks,
|
|
24868
|
+
created
|
|
24862
24869
|
};
|
|
24863
24870
|
}
|
|
24864
24871
|
};
|
|
@@ -83845,6 +83852,18 @@ var CpClient = class {
|
|
|
83845
83852
|
this.transport?.send(encode(buildEnvelope("usage/report", report)));
|
|
83846
83853
|
}
|
|
83847
83854
|
/**
|
|
83855
|
+
* Report a session's converged milestone + sessionKey echo (D→C `event/session`
|
|
83856
|
+
* EVT, fire-and-forget, latest-wins per `sessionId`). This is what lets the CP
|
|
83857
|
+
* store session metadata so a deep-link detail page (…/sessions/:id) resolves
|
|
83858
|
+
* even when the daemon is offline. Metadata only — never the message stream
|
|
83859
|
+
* (that stays daemon-local, §1/§12). No-op unless READY/DRAINING; a dropped
|
|
83860
|
+
* `start` is re-covered by the next milestone (the CP upsert is latest-wins).
|
|
83861
|
+
*/
|
|
83862
|
+
emitEventSession(event) {
|
|
83863
|
+
if (this.state !== "READY" && this.state !== "DRAINING") return;
|
|
83864
|
+
this.transport?.send(encode(buildEnvelope("event/session", event)));
|
|
83865
|
+
}
|
|
83866
|
+
/**
|
|
83848
83867
|
* Report an integration's channel-membership snapshot (D→C `integration/channels`
|
|
83849
83868
|
* EVT, fire-and-forget, latest-wins). No-op unless READY/DRAINING — the daemon
|
|
83850
83869
|
* re-emits its cached snapshots on each (re)connect (see onReady in daemon.ts),
|
|
@@ -101457,7 +101476,21 @@ var Daemon = class Daemon {
|
|
|
101457
101476
|
});
|
|
101458
101477
|
throw err;
|
|
101459
101478
|
}
|
|
101460
|
-
const { sessionId, blocks } = handled;
|
|
101479
|
+
const { sessionId, blocks, created } = handled;
|
|
101480
|
+
if (created) try {
|
|
101481
|
+
this.cpClient?.emitEventSession({
|
|
101482
|
+
sessionId,
|
|
101483
|
+
agentId,
|
|
101484
|
+
phase: "start",
|
|
101485
|
+
platform: msg.platform,
|
|
101486
|
+
channel: msg.channel,
|
|
101487
|
+
...msg.thread ? { thread: msg.thread } : {},
|
|
101488
|
+
link: this.sessionLink(sessionId),
|
|
101489
|
+
ts: new Date(this.clock.now()).toISOString()
|
|
101490
|
+
});
|
|
101491
|
+
} catch (err) {
|
|
101492
|
+
this.log.debug(`event/session emit failed (session ${sessionId}): ${err.message}`);
|
|
101493
|
+
}
|
|
101461
101494
|
let resolveDone;
|
|
101462
101495
|
const done = new Promise((r) => resolveDone = r);
|
|
101463
101496
|
const p = {
|