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.
Files changed (97) hide show
  1. package/README.md +3 -1
  2. package/bin/entrypoints/acc-bootstrap.mjs +6 -48
  3. package/bin/entrypoints/acc-claude-channel.mjs +47 -157
  4. package/docs/ADAPTER_AUTHORING.md +41 -10
  5. package/docs/ARCHITECTURE.md +28 -13
  6. package/docs/CAPABILITIES.md +19 -16
  7. package/docs/CLI.md +60 -14
  8. package/docs/CONCEPTS.md +12 -4
  9. package/docs/CONFIGURATION.md +18 -11
  10. package/docs/GETTING_STARTED.md +15 -12
  11. package/docs/GLOSSARY.md +2 -1
  12. package/docs/HOW_IT_WORKS.md +8 -4
  13. package/docs/PROTOCOL.md +56 -6
  14. package/docs/RELEASING.md +3 -2
  15. package/docs/SECURITY_MODEL.md +14 -1
  16. package/docs/TROUBLESHOOTING.md +64 -27
  17. package/docs/UPGRADING.md +49 -8
  18. package/docs/WHY_ACC.md +5 -3
  19. package/node_modules/@agents-can-communicate/adapter-antigravity/package.json +1 -1
  20. package/node_modules/@agents-can-communicate/adapter-antigravity/plugin/plugin.json +1 -1
  21. package/node_modules/@agents-can-communicate/adapter-antigravity/plugin/skills/acc/SKILL.md +8 -0
  22. package/node_modules/@agents-can-communicate/adapter-claude-code/certification.json +14 -73
  23. package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/certification-provenance.json +29 -71
  24. package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/delivery/claude-code-2.1.282-product-evidence.json +161 -0
  25. package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/delivery/claude-code-2.1.282.json +28 -0
  26. package/node_modules/@agents-can-communicate/adapter-claude-code/fixtures/inbox-wake-2.1.282.json +44 -0
  27. package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +5 -2
  28. package/node_modules/@agents-can-communicate/adapter-claude-code/plugin/skills/acc/SKILL.md +8 -0
  29. package/node_modules/@agents-can-communicate/adapter-claude-code/src/adapter.mjs +25 -30
  30. package/node_modules/@agents-can-communicate/adapter-claude-code/src/hooks.mjs +6 -0
  31. package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-contract.mjs +10 -0
  32. package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-delivery.mjs +254 -0
  33. package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-endpoint.mjs +166 -0
  34. package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-registry.mjs +71 -0
  35. package/node_modules/@agents-can-communicate/adapter-claude-code/src/inbox-settings.mjs +109 -0
  36. package/node_modules/@agents-can-communicate/adapter-claude-code/src/install.mjs +25 -31
  37. package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
  38. package/node_modules/@agents-can-communicate/adapter-codex/plugin/skills/acc/SKILL.md +8 -0
  39. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
  40. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/skills/acc/SKILL.md +8 -0
  41. package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
  42. package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
  43. package/node_modules/@agents-can-communicate/adapter-grok/plugin/skills/acc/SKILL.md +8 -0
  44. package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
  45. package/node_modules/@agents-can-communicate/adapter-kimi/plugin/skills/acc/SKILL.md +8 -0
  46. package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
  47. package/node_modules/@agents-can-communicate/adapter-sdk/src/context-projector.mjs +15 -2
  48. package/node_modules/@agents-can-communicate/adapter-sdk/src/events.mjs +16 -3
  49. package/node_modules/@agents-can-communicate/adapter-sdk/src/hook-shim.mjs +4 -3
  50. package/node_modules/@agents-can-communicate/adapter-sdk/src/index.mjs +1 -1
  51. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-activation.mjs +4 -14
  52. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-delivery.mjs +23 -11
  53. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-vocabulary.mjs +5 -1
  54. package/node_modules/@agents-can-communicate/cli/package.json +1 -1
  55. package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +8 -6
  56. package/node_modules/@agents-can-communicate/cli/src/install-command.mjs +8 -23
  57. package/node_modules/@agents-can-communicate/cli/src/install-delivery-consent.mjs +3 -4
  58. package/node_modules/@agents-can-communicate/cli/src/main.mjs +39 -10
  59. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/entry.mjs +7 -43
  60. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/launchers.mjs +5 -3
  61. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/refresh.mjs +3 -4
  62. package/node_modules/@agents-can-communicate/cli/src/native-delivery-status.mjs +2 -2
  63. package/node_modules/@agents-can-communicate/core/package.json +1 -1
  64. package/node_modules/@agents-can-communicate/core/src/conversations.mjs +2 -2
  65. package/node_modules/@agents-can-communicate/core/src/next-turn-delivery.mjs +21 -4
  66. package/node_modules/@agents-can-communicate/core/src/receipts.mjs +66 -10
  67. package/node_modules/@agents-can-communicate/core/src/sessions.mjs +25 -2
  68. package/node_modules/@agents-can-communicate/core/src/status.mjs +38 -1
  69. package/node_modules/@agents-can-communicate/core/src/sync.mjs +11 -2
  70. package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
  71. package/node_modules/@agents-can-communicate/delivery-router/src/router.mjs +24 -7
  72. package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
  73. package/node_modules/@agents-can-communicate/hook-runner/src/native-attempt.mjs +6 -8
  74. package/node_modules/@agents-can-communicate/hook-runner/src/native-binding.mjs +24 -11
  75. package/node_modules/@agents-can-communicate/hook-runner/src/runner.mjs +21 -12
  76. package/node_modules/@agents-can-communicate/installer/package.json +1 -1
  77. package/node_modules/@agents-can-communicate/installer/src/apply.mjs +19 -5
  78. package/node_modules/@agents-can-communicate/installer/src/detect.mjs +3 -7
  79. package/node_modules/@agents-can-communicate/installer/src/index.mjs +4 -7
  80. package/node_modules/@agents-can-communicate/installer/src/native-activation.mjs +23 -61
  81. package/node_modules/@agents-can-communicate/installer/src/ownership.mjs +7 -1
  82. package/node_modules/@agents-can-communicate/installer/src/plan.mjs +15 -5
  83. package/node_modules/@agents-can-communicate/installer/src/shell-bootstrap.mjs +10 -133
  84. package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
  85. package/node_modules/@agents-can-communicate/mcp-server/src/tools.mjs +5 -3
  86. package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
  87. package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
  88. package/node_modules/@agents-can-communicate/storage-filesystem/src/atomic-json.mjs +6 -1
  89. package/package.json +1 -1
  90. package/bin/acc-bootstrap.mjs +0 -7
  91. package/bin/acc-claude-channel.mjs +0 -10
  92. package/bin/entrypoints/claude-channel-binding.mjs +0 -46
  93. package/bin/entrypoints/claude-channel-stdio.mjs +0 -29
  94. package/node_modules/@agents-can-communicate/adapter-claude-code/plugin/.mcp.json +0 -8
  95. package/node_modules/@agents-can-communicate/adapter-claude-code/src/channel.mjs +0 -381
  96. package/node_modules/@agents-can-communicate/adapter-claude-code/src/native-delivery.mjs +0 -232
  97. 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
- }