agents-can-communicate 0.5.6 → 0.5.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/bin/entrypoints/acc-claude-channel.mjs +14 -4
- package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/channel.mjs +9 -3
- package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
- package/node_modules/@agents-can-communicate/cli/package.json +1 -1
- package/node_modules/@agents-can-communicate/core/package.json +1 -1
- package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
- package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
- package/node_modules/@agents-can-communicate/installer/package.json +1 -1
- package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
- package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
- package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
- package/package.json +1 -1
|
@@ -11,11 +11,14 @@ import { randomBytes } from "node:crypto";
|
|
|
11
11
|
import { createClaudeCodeAdapter } from "@agents-can-communicate/adapter-claude-code";
|
|
12
12
|
import { listSessionBindings } from "@agents-can-communicate/adapter-sdk";
|
|
13
13
|
import { createCoordinationService } from "@agents-can-communicate/core";
|
|
14
|
+
import { createDeliveryRouter } from "@agents-can-communicate/delivery-router";
|
|
15
|
+
import { readInstalledLivePolicy } from "@agents-can-communicate/installer";
|
|
16
|
+
import { recordAndOffer } from "@agents-can-communicate/mcp-server";
|
|
14
17
|
import { resolveClientPid } from "@agents-can-communicate/hook-runner/client-pid";
|
|
15
18
|
import { readProcessTable } from "@agents-can-communicate/hook-runner/process-table";
|
|
16
19
|
import { createId } from "@agents-can-communicate/protocol";
|
|
17
20
|
import { openFilesystemStore } from "@agents-can-communicate/storage-filesystem";
|
|
18
|
-
import { createGitProbe, discoverWorkspace, platformDataHome, runtimePaths }
|
|
21
|
+
import { ALL_ADAPTERS, createGitProbe, discoverWorkspace, platformDataHome, runtimePaths }
|
|
19
22
|
from "@agents-can-communicate/cli";
|
|
20
23
|
|
|
21
24
|
import { createAccChannel, endpointDir, routeAck, routeReply }
|
|
@@ -105,8 +108,8 @@ export async function resolveWithin({ resolve, deadline, intervalMs = BINDING_PO
|
|
|
105
108
|
async function compose() {
|
|
106
109
|
const descriptor = await discoverWorkspace({ cwd: process.cwd(), env: process.env,
|
|
107
110
|
gitProbe: createGitProbe() });
|
|
108
|
-
const
|
|
109
|
-
|
|
111
|
+
const dataHome = platformDataHome({ platform: process.platform, env: process.env });
|
|
112
|
+
const paths = runtimePaths({ dataHome, workspaceId: descriptor.id, workspaceRoots: descriptor.roots });
|
|
110
113
|
const store = await openFilesystemStore({ root: paths.root, clock, ids,
|
|
111
114
|
workspaceId: descriptor.id });
|
|
112
115
|
const service = createCoordinationService({ store, clock, ids });
|
|
@@ -126,11 +129,18 @@ async function compose() {
|
|
|
126
129
|
return startInertChannel({ write });
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
const deliveryRouter = createDeliveryRouter({ service, adapters: ALL_ADAPTERS(), clock,
|
|
133
|
+
readLivePolicy: ({ adapter }) => readInstalledLivePolicy({ dataHome, adapterId: adapter.id }) });
|
|
129
134
|
const channel = createAccChannel({
|
|
130
135
|
endpointDir: endpointDir(paths.root),
|
|
131
136
|
clientPid: session.clientPid,
|
|
132
137
|
write,
|
|
133
|
-
|
|
138
|
+
// The Channel tool records through its own bound session, then uses the
|
|
139
|
+
// same durable-first offer as ordinary MCP. A successful reply record alone
|
|
140
|
+
// does not deliver it to the peer, and a failed offer must not lose it.
|
|
141
|
+
routeReply: ({ messageId, body }) => recordAndOffer({ router: deliveryRouter,
|
|
142
|
+
selectMessage: value => value.reply,
|
|
143
|
+
record: () => routeReply({ service, session, messageId, body }) }),
|
|
134
144
|
routeAck: ({ messageId }) => routeAck({ service, session, messageId }),
|
|
135
145
|
// This process is the only party that knows the endpoint is still being
|
|
136
146
|
// served, and Claude publishes no heartbeat, so nothing else would move
|
|
@@ -196,11 +196,17 @@ export function createAccChannel({ endpointDir, socketDir = channelSocketDirecto
|
|
|
196
196
|
if (!nonEmpty(args.messageId)) throw new Error(`${name} requires messageId`);
|
|
197
197
|
if (name === "acc_reply" && !nonEmpty(args.body)) throw new Error("acc_reply requires body");
|
|
198
198
|
if (!seen.has(args.messageId)) throw new Error(`${args.messageId} has no delivered message`);
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
const routed = name === "acc_reply"
|
|
200
|
+
? await routeReply({ messageId: args.messageId, body: args.body })
|
|
201
|
+
: await routeAck({ messageId: args.messageId });
|
|
201
202
|
observe({ event: name === "acc_reply" ? "reply_routed" : "ack_routed", at: clock(),
|
|
202
203
|
messageId: args.messageId });
|
|
203
|
-
|
|
204
|
+
if (name === "acc_reply" && routed?.recorded?.reply) {
|
|
205
|
+
const structuredContent = { status: "recorded", messageId: routed.recorded.reply.messageId,
|
|
206
|
+
delivery: routed.delivery };
|
|
207
|
+
return { content: [{ type: "text", text: JSON.stringify(structuredContent) }], structuredContent };
|
|
208
|
+
}
|
|
209
|
+
return { content: [{ type: "text", text: name === "acc_reply" ? "recorded" : "acknowledged" }] };
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
function channelTools() {
|