agents-can-communicate 0.4.0 → 0.4.2

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 (56) hide show
  1. package/README.md +102 -73
  2. package/bin/entrypoints/hook-output.mjs +7 -3
  3. package/docs/ADAPTER_AUTHORING.md +11 -1
  4. package/docs/ARCHITECTURE.md +9 -1
  5. package/docs/CAPABILITIES.md +1 -1
  6. package/docs/CLI.md +27 -5
  7. package/docs/GETTING_STARTED.md +20 -8
  8. package/docs/RELEASING.md +1 -1
  9. package/docs/SECURITY_MODEL.md +3 -1
  10. package/docs/TROUBLESHOOTING.md +69 -7
  11. package/docs/UPGRADING.md +51 -4
  12. package/docs/index.md +2 -2
  13. package/node_modules/@agents-can-communicate/adapter-claude-code/package.json +1 -1
  14. package/node_modules/@agents-can-communicate/adapter-claude-code/src/adapter.mjs +3 -3
  15. package/node_modules/@agents-can-communicate/adapter-claude-code/src/install.mjs +10 -0
  16. package/node_modules/@agents-can-communicate/adapter-codex/package.json +1 -1
  17. package/node_modules/@agents-can-communicate/adapter-codex/src/app-server-client.mjs +1 -1
  18. package/node_modules/@agents-can-communicate/adapter-codex/src/native-delivery.mjs +1 -1
  19. package/node_modules/@agents-can-communicate/adapter-gemini-cli/extension/gemini-extension.json +1 -1
  20. package/node_modules/@agents-can-communicate/adapter-gemini-cli/package.json +1 -1
  21. package/node_modules/@agents-can-communicate/adapter-grok/package.json +1 -1
  22. package/node_modules/@agents-can-communicate/adapter-grok/plugin/skills/acc/SKILL.md +22 -9
  23. package/node_modules/@agents-can-communicate/adapter-grok/src/adapter.mjs +5 -3
  24. package/node_modules/@agents-can-communicate/adapter-grok/src/hooks.mjs +9 -0
  25. package/node_modules/@agents-can-communicate/adapter-kimi/package.json +1 -1
  26. package/node_modules/@agents-can-communicate/adapter-sdk/package.json +1 -1
  27. package/node_modules/@agents-can-communicate/adapter-sdk/src/index.mjs +2 -0
  28. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-attempt-writer.mjs +64 -0
  29. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-attempt.mjs +65 -0
  30. package/node_modules/@agents-can-communicate/adapter-sdk/src/native-vocabulary.mjs +1 -0
  31. package/node_modules/@agents-can-communicate/cli/package.json +1 -1
  32. package/node_modules/@agents-can-communicate/cli/src/doctor-command.mjs +17 -52
  33. package/node_modules/@agents-can-communicate/cli/src/help.mjs +1 -1
  34. package/node_modules/@agents-can-communicate/cli/src/install-command.mjs +22 -46
  35. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/command.mjs +1 -0
  36. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/install.mjs +6 -1
  37. package/node_modules/@agents-can-communicate/cli/src/managed-runtime/state.mjs +1 -0
  38. package/node_modules/@agents-can-communicate/cli/src/native-delivery-status.mjs +88 -0
  39. package/node_modules/@agents-can-communicate/cli/src/native-session-diagnostics.mjs +64 -0
  40. package/node_modules/@agents-can-communicate/cli/src/runtime-paths.mjs +1 -1
  41. package/node_modules/@agents-can-communicate/core/package.json +1 -1
  42. package/node_modules/@agents-can-communicate/delivery-router/package.json +1 -1
  43. package/node_modules/@agents-can-communicate/hook-runner/package.json +1 -1
  44. package/node_modules/@agents-can-communicate/hook-runner/src/native-attempt.mjs +43 -0
  45. package/node_modules/@agents-can-communicate/hook-runner/src/owner-context.mjs +30 -0
  46. package/node_modules/@agents-can-communicate/hook-runner/src/runner.mjs +28 -41
  47. package/node_modules/@agents-can-communicate/installer/package.json +1 -1
  48. package/node_modules/@agents-can-communicate/installer/src/delivery-diagnostics.mjs +36 -0
  49. package/node_modules/@agents-can-communicate/installer/src/detect.mjs +23 -10
  50. package/node_modules/@agents-can-communicate/installer/src/index.mjs +3 -1
  51. package/node_modules/@agents-can-communicate/installer/src/live-policy.mjs +10 -3
  52. package/node_modules/@agents-can-communicate/installer/src/plan.mjs +6 -1
  53. package/node_modules/@agents-can-communicate/mcp-server/package.json +1 -1
  54. package/node_modules/@agents-can-communicate/protocol/package.json +1 -1
  55. package/node_modules/@agents-can-communicate/storage-filesystem/package.json +1 -1
  56. package/package.json +1 -1
@@ -6,6 +6,8 @@ import { effectiveCapabilities, evaluateNativeEligibility, validateNativeActivat
6
6
 
7
7
  import { resolveExecutable, shellOf, shimDirFor } from "./native-activation.mjs";
8
8
 
9
+ import { describeDeliveryFallback, describeNativeReason } from "./delivery-diagnostics.mjs";
10
+
9
11
  const run = promisify(execFile);
10
12
 
11
13
  // Reasons the client itself will not change within an install: unsupported,
@@ -79,8 +81,14 @@ async function detectNative(adapter, entry, { context, platform, probeTimeoutMs,
79
81
  }
80
82
  if (facts.eligibility.eligible !== true) {
81
83
  const reasonCode = facts.eligibility.reasonCode ?? "feature_probe_failed";
84
+ // A stored policy can be consented to before a service/session exists.
85
+ // No activation is planned until the full probe passes; bootstrap-based
86
+ // clients still need their verified plan to disclose launch changes.
87
+ const consentAvailable = adapter.nativeDelivery.policySource === "installation-record"
88
+ && ["native_endpoint_unavailable", "native_session_unavailable"].includes(reasonCode);
82
89
  return STATIC_REASONS.has(reasonCode)
83
- ? { ...unsupported(reasonCode), ...facts } : degraded(reasonCode, facts);
90
+ ? { ...unsupported(reasonCode), ...facts }
91
+ : { ...degraded(reasonCode, facts), consentAvailable };
84
92
  }
85
93
  let activationPlan;
86
94
  try {
@@ -151,15 +159,20 @@ export async function detectInstallation({ adapters, context, probe = spawnProbe
151
159
  } catch (error) {
152
160
  entry.error = entry.error ?? error.message;
153
161
  }
154
- if (entry.nativeDelivery.state !== "eligible"
155
- && typeof adapter.deliveryFallback?.diagnostic === "string") {
156
- const nextTurnDowngraded = adapter.capabilities?.delivery?.nextTurn === true
157
- && entry.capabilities?.delivery?.nextTurn !== true;
158
- entry.deliveryDiagnostic = nextTurnDowngraded
159
- ? `${adapter.displayName} ${entry.version ?? "unknown version"} has no certified `
160
- + `next-turn delivery on ${platform}; ${adapter.deliveryFallback.diagnostic}`
161
- : adapter.deliveryFallback.diagnostic;
162
- entry.diagnostics.push(entry.deliveryDiagnostic);
162
+ if (entry.nativeDelivery.state !== "eligible") {
163
+ if (adapter.nativeDelivery !== undefined) {
164
+ entry.deliveryDiagnostic = `${adapter.displayName} native delivery: `
165
+ + `${describeNativeReason(entry.nativeDelivery.reasonCode, { clientVersion: entry.version,
166
+ minimumVersion: entry.nativeDelivery.eligibility?.minimumVersion })}; `
167
+ + `fallback: ${describeDeliveryFallback(entry)}`;
168
+ } else if (typeof adapter.deliveryFallback?.diagnostic === "string") {
169
+ const downgraded = adapter.capabilities?.delivery?.nextTurn === true
170
+ && entry.capabilities?.delivery?.nextTurn !== true;
171
+ entry.deliveryDiagnostic = (downgraded
172
+ ? `${adapter.displayName} ${entry.version ?? "unknown version"} has no certified `
173
+ + `next-turn delivery on ${platform}; ` : "") + adapter.deliveryFallback.diagnostic;
174
+ }
175
+ if (entry.deliveryDiagnostic !== null) entry.diagnostics.push(entry.deliveryDiagnostic);
163
176
  }
164
177
  return entry;
165
178
  }));
@@ -12,4 +12,6 @@ export { BLOCK_BEGIN, BLOCK_END, SHIM_MARKER, SHIM_POLICIES, SUPPORTED_SHELLS,
12
12
  shellLiteral, uninstallShellBootstrap, validateShimEntry } from "./shell-bootstrap.mjs";
13
13
  export { LIVE_POLICIES, describeActivation, describeDeactivation, livePolicyOf, rcFileFor,
14
14
  resolveExecutable, shellOf, shimDirFor } from "./native-activation.mjs";
15
- export { readInstalledLivePolicy } from "./live-policy.mjs";
15
+ export { readInstalledLivePolicy, readInstalledLivePolicyState } from "./live-policy.mjs";
16
+ export { describeDeliveryFallback, describeInstallDelivery, describeNativeReason }
17
+ from "./delivery-diagnostics.mjs";
@@ -10,12 +10,19 @@ export const livePolicyOf = install => {
10
10
  ? install.nativeActivation.livePolicy : "off";
11
11
  };
12
12
 
13
- export async function readInstalledLivePolicy({ dataHome, adapterId }) {
13
+ export async function readInstalledLivePolicy(input) {
14
+ return (await readInstalledLivePolicyState(input)).policy;
15
+ }
16
+
17
+ export async function readInstalledLivePolicyState({ dataHome, adapterId }) {
14
18
  try {
15
19
  const record = await loadOwnership({ dataHome });
16
20
  const install = record.installs.find(entry => entry.adapterId === adapterId);
17
- return livePolicyOf(install);
21
+ const raw = Object.hasOwn(install ?? {}, "deliveryPolicy")
22
+ ? install.deliveryPolicy : install?.nativeActivation?.livePolicy;
23
+ return { policy: livePolicyOf(install), policyStatus: raw === undefined ? "missing"
24
+ : !LIVE_POLICIES.includes(raw) ? "invalid" : raw === "off" ? "off" : "enabled" };
18
25
  } catch {
19
- return "off";
26
+ return { policy: "off", policyStatus: "unavailable" };
20
27
  }
21
28
  }
@@ -1,3 +1,5 @@
1
+ import { describeInstallDelivery } from "./delivery-diagnostics.mjs";
2
+
1
3
  import { AccError, EXIT } from "@agents-can-communicate/protocol";
2
4
 
3
5
  import { LIVE_POLICIES, describeActivation, describeDeactivation, planActivationRetirements, rcFileFor, shimDirFor }
@@ -112,6 +114,8 @@ export function planInstallation({ adapters, detected, context, action = "instal
112
114
  ?? `${adapter.displayName ?? adapter.id} cannot receive native delivery `
113
115
  + `(${native?.reasonCode ?? "native_delivery_unsupported"}); durable fallback remains active`
114
116
  : null;
117
+ const deliverySummary = action === "install"
118
+ ? describeInstallDelivery(entry, delivery, effectiveLivePolicy) : null;
115
119
  const installContext = { ...context, requestedLivePolicy: delivery,
116
120
  livePolicy: effectiveLivePolicy };
117
121
  // A consented activation that this run keeps, activates, or takes back.
@@ -143,6 +147,7 @@ export function planInstallation({ adapters, detected, context, action = "instal
143
147
  livePolicy: delivery,
144
148
  effectiveLivePolicy,
145
149
  ...(deliveryDiagnostic === null ? {} : { deliveryDiagnostic }),
150
+ ...(deliverySummary === null ? {} : { deliverySummary }),
146
151
  ...(nativeActivation === null ? {} : { nativeActivation }),
147
152
  ...(deactivation === null ? {} : { deactivation }),
148
153
  artifacts,
@@ -151,7 +156,7 @@ export function planInstallation({ adapters, detected, context, action = "instal
151
156
  summary: [
152
157
  ...(entry.present ? [] : [`${adapter.displayName ?? adapter.id} is no longer on `
153
158
  + "this machine; removing what ACC recorded writing"]),
154
- ...(deliveryDiagnostic === null ? [] : [deliveryDiagnostic]),
159
+ ...(deliverySummary === null ? [] : [deliverySummary]),
155
160
  ...artifacts.filter(a => a.kind === "tree")
156
161
  .map(a => `${action === "install" ? "create" : "remove"} ${a.path}`),
157
162
  ...artifacts.filter(a => a.kind === "merge")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-can-communicate/mcp-server",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-can-communicate/protocol",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-can-communicate/storage-filesystem",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-can-communicate",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Local-first coordination for independently opened AI agent sessions.",
6
6
  "keywords": [