@adcp/sdk 7.8.0 → 7.9.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 (57) hide show
  1. package/AGENTS.md +2 -0
  2. package/bin/adcp.js +3 -1
  3. package/dist/lib/core/AgentClient.d.ts.map +1 -1
  4. package/dist/lib/core/SingleAgentClient.d.ts +8 -0
  5. package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
  6. package/dist/lib/core/SingleAgentClient.js +15 -0
  7. package/dist/lib/core/SingleAgentClient.js.map +1 -1
  8. package/dist/lib/index.d.ts +2 -2
  9. package/dist/lib/index.d.ts.map +1 -1
  10. package/dist/lib/index.js +8 -7
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/protocols/mcp.d.ts.map +1 -1
  13. package/dist/lib/protocols/mcp.js +63 -4
  14. package/dist/lib/protocols/mcp.js.map +1 -1
  15. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  16. package/dist/lib/server/ctx-metadata/backends/pg.d.ts +12 -3
  17. package/dist/lib/server/ctx-metadata/backends/pg.d.ts.map +1 -1
  18. package/dist/lib/server/ctx-metadata/backends/pg.js +59 -23
  19. package/dist/lib/server/ctx-metadata/backends/pg.js.map +1 -1
  20. package/dist/lib/server/ctx-metadata/backends/redis.d.ts +163 -0
  21. package/dist/lib/server/ctx-metadata/backends/redis.d.ts.map +1 -0
  22. package/dist/lib/server/ctx-metadata/backends/redis.js +204 -0
  23. package/dist/lib/server/ctx-metadata/backends/redis.js.map +1 -0
  24. package/dist/lib/server/ctx-metadata/index.d.ts +2 -0
  25. package/dist/lib/server/ctx-metadata/index.d.ts.map +1 -1
  26. package/dist/lib/server/ctx-metadata/index.js +3 -1
  27. package/dist/lib/server/ctx-metadata/index.js.map +1 -1
  28. package/dist/lib/server/idempotency/backends/redis.d.ts +171 -0
  29. package/dist/lib/server/idempotency/backends/redis.d.ts.map +1 -0
  30. package/dist/lib/server/idempotency/backends/redis.js +253 -0
  31. package/dist/lib/server/idempotency/backends/redis.js.map +1 -0
  32. package/dist/lib/server/idempotency/index.d.ts +2 -0
  33. package/dist/lib/server/idempotency/index.d.ts.map +1 -1
  34. package/dist/lib/server/idempotency/index.js +3 -1
  35. package/dist/lib/server/idempotency/index.js.map +1 -1
  36. package/dist/lib/server/idempotency/store.d.ts +44 -0
  37. package/dist/lib/server/idempotency/store.d.ts.map +1 -1
  38. package/dist/lib/server/idempotency/store.js.map +1 -1
  39. package/dist/lib/server/index.d.ts +4 -4
  40. package/dist/lib/server/index.d.ts.map +1 -1
  41. package/dist/lib/server/index.js +3 -1
  42. package/dist/lib/server/index.js.map +1 -1
  43. package/dist/lib/signing/redis-replay-store.d.ts +180 -0
  44. package/dist/lib/signing/redis-replay-store.d.ts.map +1 -0
  45. package/dist/lib/signing/redis-replay-store.js +270 -0
  46. package/dist/lib/signing/redis-replay-store.js.map +1 -0
  47. package/dist/lib/signing/server.d.ts +1 -0
  48. package/dist/lib/signing/server.d.ts.map +1 -1
  49. package/dist/lib/signing/server.js +4 -2
  50. package/dist/lib/signing/server.js.map +1 -1
  51. package/dist/lib/utils/redis-default-prefix-warn.d.ts +60 -0
  52. package/dist/lib/utils/redis-default-prefix-warn.d.ts.map +1 -0
  53. package/dist/lib/utils/redis-default-prefix-warn.js +95 -0
  54. package/dist/lib/utils/redis-default-prefix-warn.js.map +1 -0
  55. package/dist/lib/version.d.ts +3 -3
  56. package/dist/lib/version.js +3 -3
  57. package/package.json +8 -2
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /**
3
+ * Shared default-prefix-on-db-0 warning helper for Redis backends.
4
+ *
5
+ * Every Redis-backed SDK store (idempotency, ctx-metadata, replay)
6
+ * prefixes its keys (`"adcp:idem:"`, `"adcp:ctx_meta:"`, `"adcp:replay:"`)
7
+ * so a shared Redis instance can host multiple AdCP servers — or AdCP
8
+ * alongside other apps — without collision. But two AdCP deployments
9
+ * sharing the *same* db with the *same* default prefix collide on any
10
+ * overlapping principal/account/keyid namespace.
11
+ *
12
+ * This helper emits a one-time `console.warn` at backend construction
13
+ * when the default prefix meets a node-redis client we can confidently
14
+ * identify as being on db 0 (the most likely signal of a shared,
15
+ * non-dedicated Redis). Once per process across every backend that uses
16
+ * it — operators standing up multiple Redis backends shouldn't see N
17
+ * identical warnings.
18
+ *
19
+ * Best-effort: stays silent for escape-hatch clients (ioredis, Upstash,
20
+ * test doubles) where we can't introspect the db index. Prefer
21
+ * false-negative over a noisy false-positive warning.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.detectNodeRedisDbIndex = detectNodeRedisDbIndex;
25
+ exports.maybeWarnOnSharedRedisPrefix = maybeWarnOnSharedRedisPrefix;
26
+ exports.__resetDefaultPrefixWarningForTests = __resetDefaultPrefixWarningForTests;
27
+ let hasWarnedAboutDefaultPrefix = false;
28
+ /**
29
+ * Detect the Redis db index when the client is a node-redis v4/v5
30
+ * `RedisClientType`. Returns `null` for clients we can't introspect.
31
+ *
32
+ * Reads `client.options.database` (numeric, present when the client was
33
+ * constructed with `createClient({ database: N })`) or parses the path
34
+ * component of `client.options.url`. Escape-hatch clients (no `options`
35
+ * object of the canonical shape) return `null` and skip the warn.
36
+ */
37
+ function detectNodeRedisDbIndex(client) {
38
+ if (!client || typeof client !== 'object')
39
+ return null;
40
+ const opts = client.options;
41
+ if (!opts || typeof opts !== 'object')
42
+ return null;
43
+ if (typeof opts.database === 'number')
44
+ return opts.database;
45
+ if (typeof opts.url === 'string') {
46
+ try {
47
+ const u = new URL(opts.url);
48
+ if (u.protocol !== 'redis:' && u.protocol !== 'rediss:')
49
+ return null;
50
+ const path = u.pathname.replace(/^\//, '');
51
+ if (path === '')
52
+ return 0;
53
+ const n = Number(path);
54
+ return Number.isInteger(n) && n >= 0 ? n : null;
55
+ }
56
+ catch {
57
+ return null;
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ /**
63
+ * Emit the one-time warn if (a) the caller used the default `keyPrefix`,
64
+ * (b) didn't pass `suppress`, (c) we can confidently see db 0 from the
65
+ * client. Otherwise silent.
66
+ *
67
+ * **Once per process.** All Redis backends share the warn flag — an
68
+ * adopter who configures three Redis-backed stores against the same
69
+ * misconfigured Redis sees one warning total, not three.
70
+ */
71
+ function maybeWarnOnSharedRedisPrefix(options) {
72
+ if (options.callerKeyPrefix !== undefined)
73
+ return;
74
+ if (options.suppress)
75
+ return;
76
+ if (hasWarnedAboutDefaultPrefix)
77
+ return;
78
+ if (detectNodeRedisDbIndex(options.client) !== 0)
79
+ return;
80
+ hasWarnedAboutDefaultPrefix = true;
81
+ console.warn(`${options.backendName}: using the default keyPrefix "${options.defaultKeyPrefix}" against Redis db 0. ` +
82
+ `If this Redis db is shared with another AdCP deployment (or other apps), the per-tenant scope ` +
83
+ `segment alone is not enough to prevent cross-deployment collision. Set a deployment-unique ` +
84
+ `keyPrefix (e.g., "${options.defaultKeyPrefix}prod-eu:") or use a dedicated Redis db. ` +
85
+ `Pass { suppressDefaultPrefixWarning: true } to silence this once you've confirmed isolation.`);
86
+ }
87
+ /**
88
+ * Test-only escape hatch to reset the once-warn flag between test runs.
89
+ * Not exported through any public index — adopters can't reach it from
90
+ * outside the SDK.
91
+ */
92
+ function __resetDefaultPrefixWarningForTests() {
93
+ hasWarnedAboutDefaultPrefix = false;
94
+ }
95
+ //# sourceMappingURL=redis-default-prefix-warn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis-default-prefix-warn.js","sourceRoot":"","sources":["../../../src/lib/utils/redis-default-prefix-warn.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAaH,wDAkBC;AAwBD,oEAcC;AAOD,kFAEC;AA5ED,IAAI,2BAA2B,GAAG,KAAK,CAAC;AAExC;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,MAAe;IACpD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,IAA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,CAAC,WAAW,kCAAkC,OAAO,CAAC,gBAAgB,wBAAwB;QACtG,gGAAgG;QAChG,6FAA6F;QAC7F,qBAAqB,OAAO,CAAC,gBAAgB,0CAA0C;QACvF,8FAA8F,CACjG,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,mCAAmC;IACjD,2BAA2B,GAAG,KAAK,CAAC;AACtC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AdCP SDK library version
3
3
  */
4
- export declare const LIBRARY_VERSION = "7.8.0";
4
+ export declare const LIBRARY_VERSION = "7.9.0";
5
5
  /**
6
6
  * AdCP specification version this library is built for
7
7
  */
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
33
33
  * Full version information
34
34
  */
35
35
  export declare const VERSION_INFO: {
36
- readonly library: "7.8.0";
36
+ readonly library: "7.9.0";
37
37
  readonly adcp: "3.0.12";
38
38
  readonly compatibleVersions: readonly ["v2.5", "v2.6", "v3", "3.0.0-beta.1", "3.0.0-beta.3", "3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12"];
39
- readonly generatedAt: "2026-05-19T14:15:41.473Z";
39
+ readonly generatedAt: "2026-05-19T21:56:04.707Z";
40
40
  };
41
41
  /**
42
42
  * Get the AdCP specification version this library is built for
@@ -11,7 +11,7 @@ exports.parseAdcpMajorVersion = parseAdcpMajorVersion;
11
11
  /**
12
12
  * AdCP SDK library version
13
13
  */
14
- exports.LIBRARY_VERSION = '7.8.0';
14
+ exports.LIBRARY_VERSION = '7.9.0';
15
15
  /**
16
16
  * AdCP specification version this library is built for
17
17
  */
@@ -53,10 +53,10 @@ exports.COMPATIBLE_ADCP_VERSIONS = [
53
53
  * Full version information
54
54
  */
55
55
  exports.VERSION_INFO = {
56
- library: '7.8.0',
56
+ library: '7.9.0',
57
57
  adcp: '3.0.12',
58
58
  compatibleVersions: exports.COMPATIBLE_ADCP_VERSIONS,
59
- generatedAt: '2026-05-19T14:15:41.473Z',
59
+ generatedAt: '2026-05-19T21:56:04.707Z',
60
60
  };
61
61
  /**
62
62
  * Get the AdCP specification version this library is built for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adcp/sdk",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
5
5
  "workspaces": [
6
6
  ".",
@@ -270,7 +270,8 @@
270
270
  "registry:validate-pending": "tsx src/registry/cron.ts --pending",
271
271
  "registry:mcp": "tsx src/registry/mcp-server.ts",
272
272
  "format": "prettier --write \"./**/*.{css,html,js,ts,tsx,json}\"",
273
- "format:check": "prettier --check \"./**/*.{css,html,js,ts,tsx,json}\""
273
+ "format:check": "prettier --check \"./**/*.{css,html,js,ts,tsx,json}\"",
274
+ "review:codex": "bash scripts/codex-review.sh"
274
275
  },
275
276
  "keywords": [
276
277
  "adcp",
@@ -315,6 +316,7 @@
315
316
  "@modelcontextprotocol/sdk": "^1.17.5",
316
317
  "@opentelemetry/api": "^1.0.0",
317
318
  "pg": "^8.0.0",
319
+ "redis": "^4.6.0 || ^5.0.0",
318
320
  "zod": "^4.1.5"
319
321
  },
320
322
  "peerDependenciesMeta": {
@@ -323,6 +325,9 @@
323
325
  },
324
326
  "pg": {
325
327
  "optional": true
328
+ },
329
+ "redis": {
330
+ "optional": true
326
331
  }
327
332
  },
328
333
  "devDependencies": {
@@ -342,6 +347,7 @@
342
347
  "openapi-typescript": "^7.13.0",
343
348
  "pg": "^8.20.0",
344
349
  "prettier": "^3.6.2",
350
+ "redis": "^4.7.0",
345
351
  "tar": "^7.5.13",
346
352
  "ts-to-zod": "^5.0.1",
347
353
  "tsx": "^4.6.0",