agents-can-communicate 0.7.0 → 0.8.0
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 +3 -1
- package/bin/entrypoints/acc-bootstrap.mjs +6 -48
- package/bin/entrypoints/acc-claude-channel.mjs +47 -157
- package/docs/ADAPTER_AUTHORING.md +41 -10
- package/docs/ARCHITECTURE.md +28 -13
- package/docs/CAPABILITIES.md +19 -16
- package/docs/CLI.md +60 -14
- package/docs/CONCEPTS.md +12 -4
- package/docs/CONFIGURATION.md +18 -11
- package/docs/GETTING_STARTED.md +15 -12
- package/docs/GLOSSARY.md +2 -1
- package/docs/HOW_IT_WORKS.md +8 -4
- package/docs/PROTOCOL.md +56 -6
- package/docs/RELEASING.md +3 -2
- package/docs/SECURITY_MODEL.md +14 -1
- package/docs/TROUBLESHOOTING.md +64 -27
- package/docs/UPGRADING.md +49 -8
- package/docs/WHY_ACC.md +5 -3
- package/node_modules/@agents-can-communicate/adapter-antigravity/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-antigravity/plugin/plugin.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-antigravity/plugin/skills/acc/SKILL.md +8 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/certification.json +14 -73
- package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/certification-provenance.json +29 -71
- package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/delivery/claude-code-2.1.282-product-evidence.json +161 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/delivery/claude-code-2.1.282.json +28 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/inbox-wake-2.1.282.json +44 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +5 -2
- package/node_modules/@agents-can-communicate/adapter-claude-code/plugin/skills/acc/SKILL.md +8 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/adapter.mjs +25 -30
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/hooks.mjs +6 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-contract.mjs +10 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-delivery.mjs +254 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-endpoint.mjs +166 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-registry.mjs +71 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-settings.mjs +109 -0
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/install.mjs +25 -31
- package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-codex/plugin/skills/acc/SKILL.md +8 -0
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/skills/acc/SKILL.md +8 -0
- 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-grok/plugin/skills/acc/SKILL.md +8 -0
- package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-kimi/plugin/skills/acc/SKILL.md +8 -0
- package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
- package/node_modules/@agents-can-communicate/adapter-sdk/src/context-projector.mjs +15 -2
- package/node_modules/@agents-can-communicate/adapter-sdk/src/events.mjs +16 -3
- package/node_modules/@agents-can-communicate/adapter-sdk/src/hook-shim.mjs +4 -3
- package/node_modules/@agents-can-communicate/adapter-sdk/src/index.mjs +1 -1
- package/node_modules/@agents-can-communicate/adapter-sdk/src/native-activation.mjs +4 -14
- package/node_modules/@agents-can-communicate/adapter-sdk/src/native-delivery.mjs +23 -11
- package/node_modules/@agents-can-communicate/adapter-sdk/src/native-vocabulary.mjs +5 -1
- package/node_modules/@agents-can-communicate/cli/package.json +1 -1
- package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +8 -6
- package/node_modules/@agents-can-communicate/cli/src/install-command.mjs +8 -23
- package/node_modules/@agents-can-communicate/cli/src/install-delivery-consent.mjs +3 -4
- package/node_modules/@agents-can-communicate/cli/src/main.mjs +39 -10
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/entry.mjs +7 -43
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/launchers.mjs +5 -3
- package/node_modules/@agents-can-communicate/cli/src/managed-runtime/refresh.mjs +3 -4
- package/node_modules/@agents-can-communicate/cli/src/native-delivery-status.mjs +2 -2
- package/node_modules/@agents-can-communicate/core/package.json +1 -1
- package/node_modules/@agents-can-communicate/core/src/conversations.mjs +2 -2
- package/node_modules/@agents-can-communicate/core/src/next-turn-delivery.mjs +21 -4
- package/node_modules/@agents-can-communicate/core/src/receipts.mjs +66 -10
- package/node_modules/@agents-can-communicate/core/src/sessions.mjs +25 -2
- package/node_modules/@agents-can-communicate/core/src/status.mjs +38 -1
- package/node_modules/@agents-can-communicate/core/src/sync.mjs +11 -2
- package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
- package/node_modules/@agents-can-communicate/delivery-router/src/router.mjs +24 -7
- package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
- package/node_modules/@agents-can-communicate/hook-runner/src/native-attempt.mjs +6 -8
- package/node_modules/@agents-can-communicate/hook-runner/src/native-binding.mjs +24 -11
- package/node_modules/@agents-can-communicate/hook-runner/src/runner.mjs +21 -12
- package/node_modules/@agents-can-communicate/installer/package.json +1 -1
- package/node_modules/@agents-can-communicate/installer/src/apply.mjs +19 -5
- package/node_modules/@agents-can-communicate/installer/src/detect.mjs +3 -7
- package/node_modules/@agents-can-communicate/installer/src/index.mjs +4 -7
- package/node_modules/@agents-can-communicate/installer/src/native-activation.mjs +23 -61
- package/node_modules/@agents-can-communicate/installer/src/ownership.mjs +7 -1
- package/node_modules/@agents-can-communicate/installer/src/plan.mjs +15 -5
- package/node_modules/@agents-can-communicate/installer/src/shell-bootstrap.mjs +10 -133
- package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
- package/node_modules/@agents-can-communicate/mcp-server/src/tools.mjs +5 -3
- package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
- package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
- package/node_modules/@agents-can-communicate/storage-filesystem/src/atomic-json.mjs +6 -1
- package/package.json +1 -1
- package/bin/acc-bootstrap.mjs +0 -7
- package/bin/acc-claude-channel.mjs +0 -10
- package/bin/entrypoints/claude-channel-binding.mjs +0 -46
- package/bin/entrypoints/claude-channel-stdio.mjs +0 -29
- package/node_modules/@agents-can-communicate/adapter-claude-code/plugin/.mcp.json +0 -8
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/channel.mjs +0 -381
- package/node_modules/@agents-can-communicate/adapter-claude-code/src/native-delivery.mjs +0 -232
- package/node_modules/@agents-can-communicate/installer/src/bootstrap-runtime.mjs +0 -150
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
|
-
import { createReadStream } from "node:fs";
|
|
4
|
-
import { mkdir, readFile, realpath, rename, stat, writeFile } from "node:fs/promises";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
|
|
7
|
-
import { evaluateNativeEligibility, ownVersion } from "@agents-can-communicate/adapter-sdk";
|
|
8
|
-
|
|
9
|
-
// The launch-time check behind an owned shell shim. It answers one closed
|
|
10
|
-
// question - may this exact executable receive native delivery? - from the
|
|
11
|
-
// static minimum, a read-only adapter probe, and a keyed cache under ACC's own
|
|
12
|
-
// data home. It never throws: a shim that cannot decide launches the vendor
|
|
13
|
-
// command untouched, and this module is what makes "cannot decide" cheap.
|
|
14
|
-
//
|
|
15
|
-
// The cache key is the executable's identity - resolved path, symlink target,
|
|
16
|
-
// inode, size, mtime, and full sha256 - plus platform and this ACC runtime's
|
|
17
|
-
// version. A vendor upgrade, replacement, or changed certification contract is
|
|
18
|
-
// therefore a miss. A cached failure is short-lived; a repaired client is
|
|
19
|
-
// never disabled for long.
|
|
20
|
-
|
|
21
|
-
export const BOOTSTRAP_CACHE_SCHEMA = 1;
|
|
22
|
-
export const SUPPORTED_TTL_MS = 6 * 60 * 60 * 1_000;
|
|
23
|
-
export const FAILED_TTL_MS = 5 * 60 * 1_000;
|
|
24
|
-
const DEFAULT_TIMEOUT_MS = 750;
|
|
25
|
-
const VERSION = /(?:^|[^0-9A-Za-z])v?(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)(?:\b|$)/;
|
|
26
|
-
|
|
27
|
-
export const cachePathFor = (dataHome, adapterId) =>
|
|
28
|
-
path.join(dataHome, "acc", "native-bootstrap", `${adapterId}.json`);
|
|
29
|
-
|
|
30
|
-
function sha256File(file) {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const hash = createHash("sha256");
|
|
33
|
-
createReadStream(file).on("data", chunk => hash.update(chunk))
|
|
34
|
-
.on("error", reject).on("end", () => resolve(`sha256:${hash.digest("hex")}`));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function executableIdentity(realExecutable) {
|
|
39
|
-
const target = await realpath(realExecutable);
|
|
40
|
-
const facts = await stat(target);
|
|
41
|
-
if (!facts.isFile()) throw new Error("not a file");
|
|
42
|
-
return { path: realExecutable, target, inode: facts.ino, size: facts.size,
|
|
43
|
-
mtimeMs: Math.floor(facts.mtimeMs), executableFingerprint: await sha256File(target) };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function withTimeout(work, ms, label) {
|
|
47
|
-
let timer = null;
|
|
48
|
-
const deadline = new Promise((_resolve, reject) => {
|
|
49
|
-
timer = setTimeout(() => reject(Object.assign(new Error(`${label} timed out`),
|
|
50
|
-
{ code: "ETIMEDOUT" })), ms);
|
|
51
|
-
});
|
|
52
|
-
return Promise.race([work, deadline]).finally(() => clearTimeout(timer));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Read-only: the client's own version command, nothing else.
|
|
56
|
-
export function defaultReadVersion({ realExecutable, versionArgs, timeoutMs }) {
|
|
57
|
-
return new Promise(resolve => {
|
|
58
|
-
execFile(realExecutable, versionArgs, { timeout: timeoutMs, windowsHide: true },
|
|
59
|
-
(error, stdout, stderr) => {
|
|
60
|
-
if (error !== null) return resolve(null);
|
|
61
|
-
resolve(VERSION.exec(`${stdout}${stderr}`)?.[1] ?? null);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const sameIdentity = (left, right) => left !== undefined && right !== undefined
|
|
67
|
-
&& ["path", "target", "inode", "size", "mtimeMs", "executableFingerprint"]
|
|
68
|
-
.every(key => left[key] === right[key]);
|
|
69
|
-
|
|
70
|
-
async function loadCache(file) {
|
|
71
|
-
try {
|
|
72
|
-
const record = JSON.parse(await readFile(file, "utf8"));
|
|
73
|
-
return record?.schemaVersion === BOOTSTRAP_CACHE_SCHEMA ? record : null;
|
|
74
|
-
} catch {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function saveCache(file, record) {
|
|
80
|
-
await mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
81
|
-
const temporary = `${file}.${process.pid}.tmp`;
|
|
82
|
-
await writeFile(temporary, `${JSON.stringify(record, null, 2)}\n`, { mode: 0o600 });
|
|
83
|
-
await rename(temporary, file);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const closedOutcome = (supported, reasonCode) => Object.freeze({ supported, reasonCode });
|
|
87
|
-
|
|
88
|
-
export async function checkNativeBootstrap({ adapter, realExecutable, platform, dataHome,
|
|
89
|
-
timeoutMs = DEFAULT_TIMEOUT_MS, clock = { now: () => new Date().toISOString() },
|
|
90
|
-
readVersion = defaultReadVersion, accVersion }) {
|
|
91
|
-
try {
|
|
92
|
-
if (adapter?.nativeDelivery === undefined || typeof adapter.probeNativeDelivery !== "function") {
|
|
93
|
-
return closedOutcome(false, "native_delivery_unsupported");
|
|
94
|
-
}
|
|
95
|
-
const identity = await executableIdentity(realExecutable);
|
|
96
|
-
const file = cachePathFor(dataHome, adapter.id);
|
|
97
|
-
const now = Date.parse(clock.now());
|
|
98
|
-
const runtimeVersion = accVersion === undefined
|
|
99
|
-
? await ownVersion(import.meta.url) : accVersion;
|
|
100
|
-
const runtimeVersionKnown = typeof runtimeVersion === "string" && runtimeVersion !== "";
|
|
101
|
-
const cached = await loadCache(file);
|
|
102
|
-
if (cached !== null && cached.adapterId === adapter.id && cached.platform === platform
|
|
103
|
-
&& runtimeVersionKnown && cached.accVersion === runtimeVersion
|
|
104
|
-
&& sameIdentity(cached.identity, identity) && Date.parse(cached.expiresAt) > now) {
|
|
105
|
-
return closedOutcome(cached.supported, cached.reasonCode);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const clientVersion = await withTimeout(readVersion({ realExecutable: identity.target,
|
|
109
|
-
versionArgs: adapter.client?.versionArgs ?? ["--version"], timeoutMs }), timeoutMs,
|
|
110
|
-
"version probe").catch(() => null);
|
|
111
|
-
let probe = null;
|
|
112
|
-
let reasonCode = null;
|
|
113
|
-
if (clientVersion !== null) {
|
|
114
|
-
try {
|
|
115
|
-
probe = await withTimeout(adapter.probeNativeDelivery({ realExecutable: identity.target,
|
|
116
|
-
timeoutMs }), timeoutMs, "native probe");
|
|
117
|
-
} catch (error) {
|
|
118
|
-
probe = null;
|
|
119
|
-
reasonCode = error?.code === "ETIMEDOUT" ? "probe_timeout" : "feature_probe_failed";
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
let eligibility;
|
|
123
|
-
try {
|
|
124
|
-
eligibility = evaluateNativeEligibility(adapter, { clientVersion, platform, probe });
|
|
125
|
-
} catch {
|
|
126
|
-
// A malformed probe is an adapter bug, and still not a reason to change
|
|
127
|
-
// the user's launch: it fails closed like any other probe failure.
|
|
128
|
-
eligibility = { eligible: false, reasonCode: "feature_probe_failed" };
|
|
129
|
-
}
|
|
130
|
-
const supported = eligibility.eligible === true;
|
|
131
|
-
// A probe that timed out or threw is reported as such rather than as the
|
|
132
|
-
// generic verdict the missing probe would otherwise produce.
|
|
133
|
-
const outcomeReason = supported ? null : (reasonCode ?? eligibility.reasonCode
|
|
134
|
-
?? "feature_probe_failed");
|
|
135
|
-
// Only closed facts are stored: identity, versions, the eligibility verdict.
|
|
136
|
-
// Never command output, never a message body.
|
|
137
|
-
await saveCache(file, {
|
|
138
|
-
schemaVersion: BOOTSTRAP_CACHE_SCHEMA, adapterId: adapter.id, platform, identity,
|
|
139
|
-
accVersion: runtimeVersionKnown ? runtimeVersion : null,
|
|
140
|
-
clientVersion, supported, reasonCode: outcomeReason,
|
|
141
|
-
protocolContract: supported ? eligibility.protocolContract : null,
|
|
142
|
-
modes: supported ? [...eligibility.modes] : [],
|
|
143
|
-
checkedAt: new Date(now).toISOString(),
|
|
144
|
-
expiresAt: new Date(now + (supported ? SUPPORTED_TTL_MS : FAILED_TTL_MS)).toISOString(),
|
|
145
|
-
}).catch(() => null);
|
|
146
|
-
return closedOutcome(supported, outcomeReason);
|
|
147
|
-
} catch {
|
|
148
|
-
return closedOutcome(false, "feature_probe_failed");
|
|
149
|
-
}
|
|
150
|
-
}
|