@adcp/sdk 6.11.0 → 6.12.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 (95) hide show
  1. package/bin/adcp-config.js +7 -1
  2. package/bin/adcp.js +191 -4
  3. package/dist/lib/adapters/index.d.ts +0 -2
  4. package/dist/lib/adapters/index.d.ts.map +1 -1
  5. package/dist/lib/adapters/index.js +1 -8
  6. package/dist/lib/adapters/index.js.map +1 -1
  7. package/dist/lib/index.d.ts +1 -1
  8. package/dist/lib/index.d.ts.map +1 -1
  9. package/dist/lib/index.js +2 -7
  10. package/dist/lib/index.js.map +1 -1
  11. package/dist/lib/mock-server/index.d.ts +2 -0
  12. package/dist/lib/mock-server/index.d.ts.map +1 -1
  13. package/dist/lib/mock-server/index.js +17 -0
  14. package/dist/lib/mock-server/index.js.map +1 -1
  15. package/dist/lib/mock-server/sales-guaranteed/recipe.d.ts +155 -0
  16. package/dist/lib/mock-server/sales-guaranteed/recipe.d.ts.map +1 -0
  17. package/dist/lib/mock-server/sales-guaranteed/recipe.js +107 -0
  18. package/dist/lib/mock-server/sales-guaranteed/recipe.js.map +1 -0
  19. package/dist/lib/mock-server/sales-guaranteed/server.d.ts.map +1 -1
  20. package/dist/lib/mock-server/sales-guaranteed/server.js +212 -0
  21. package/dist/lib/mock-server/sales-guaranteed/server.js.map +1 -1
  22. package/dist/lib/mock-server/sales-non-guaranteed/recipe.d.ts +123 -0
  23. package/dist/lib/mock-server/sales-non-guaranteed/recipe.d.ts.map +1 -0
  24. package/dist/lib/mock-server/sales-non-guaranteed/recipe.js +81 -0
  25. package/dist/lib/mock-server/sales-non-guaranteed/recipe.js.map +1 -0
  26. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  27. package/dist/lib/server/ctx-metadata/index.d.ts +1 -1
  28. package/dist/lib/server/ctx-metadata/index.d.ts.map +1 -1
  29. package/dist/lib/server/ctx-metadata/index.js +3 -1
  30. package/dist/lib/server/ctx-metadata/index.js.map +1 -1
  31. package/dist/lib/server/ctx-metadata/wire-shape.d.ts +21 -0
  32. package/dist/lib/server/ctx-metadata/wire-shape.d.ts.map +1 -1
  33. package/dist/lib/server/ctx-metadata/wire-shape.js +111 -0
  34. package/dist/lib/server/ctx-metadata/wire-shape.js.map +1 -1
  35. package/dist/lib/server/decisioning/context.d.ts +19 -0
  36. package/dist/lib/server/decisioning/context.d.ts.map +1 -1
  37. package/dist/lib/server/decisioning/index.d.ts +3 -0
  38. package/dist/lib/server/decisioning/index.d.ts.map +1 -1
  39. package/dist/lib/server/decisioning/index.js +16 -1
  40. package/dist/lib/server/decisioning/index.js.map +1 -1
  41. package/dist/lib/server/decisioning/platform.d.ts +17 -0
  42. package/dist/lib/server/decisioning/platform.d.ts.map +1 -1
  43. package/dist/lib/server/decisioning/platform.js.map +1 -1
  44. package/dist/lib/server/decisioning/proposal/dispatch.d.ts +203 -0
  45. package/dist/lib/server/decisioning/proposal/dispatch.d.ts.map +1 -0
  46. package/dist/lib/server/decisioning/proposal/dispatch.js +395 -0
  47. package/dist/lib/server/decisioning/proposal/dispatch.js.map +1 -0
  48. package/dist/lib/server/decisioning/proposal/index.d.ts +21 -0
  49. package/dist/lib/server/decisioning/proposal/index.d.ts.map +1 -0
  50. package/dist/lib/server/decisioning/proposal/index.js +37 -0
  51. package/dist/lib/server/decisioning/proposal/index.js.map +1 -0
  52. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts +195 -0
  53. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts.map +1 -0
  54. package/dist/lib/server/decisioning/proposal/lifecycle.js +366 -0
  55. package/dist/lib/server/decisioning/proposal/lifecycle.js.map +1 -0
  56. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts +93 -0
  57. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts.map +1 -0
  58. package/dist/lib/server/decisioning/proposal/mock-manager.js +109 -0
  59. package/dist/lib/server/decisioning/proposal/mock-manager.js.map +1 -0
  60. package/dist/lib/server/decisioning/proposal/store.d.ts +279 -0
  61. package/dist/lib/server/decisioning/proposal/store.d.ts.map +1 -0
  62. package/dist/lib/server/decisioning/proposal/store.js +291 -0
  63. package/dist/lib/server/decisioning/proposal/store.js.map +1 -0
  64. package/dist/lib/server/decisioning/proposal/types.d.ts +394 -0
  65. package/dist/lib/server/decisioning/proposal/types.d.ts.map +1 -0
  66. package/dist/lib/server/decisioning/proposal/types.js +58 -0
  67. package/dist/lib/server/decisioning/proposal/types.js.map +1 -0
  68. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +25 -0
  69. package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
  70. package/dist/lib/server/decisioning/runtime/from-platform.js +198 -15
  71. package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
  72. package/dist/lib/server/index.d.ts +1 -1
  73. package/dist/lib/server/index.d.ts.map +1 -1
  74. package/dist/lib/server/index.js +3 -1
  75. package/dist/lib/server/index.js.map +1 -1
  76. package/dist/lib/testing/client.d.ts.map +1 -1
  77. package/dist/lib/testing/client.js +7 -1
  78. package/dist/lib/testing/client.js.map +1 -1
  79. package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
  80. package/dist/lib/testing/storyboard/task-map.js +1 -0
  81. package/dist/lib/testing/storyboard/task-map.js.map +1 -1
  82. package/dist/lib/testing/storyboard/test-kit.d.ts.map +1 -1
  83. package/dist/lib/testing/storyboard/test-kit.js +4 -0
  84. package/dist/lib/testing/storyboard/test-kit.js.map +1 -1
  85. package/dist/lib/testing/types.d.ts +10 -0
  86. package/dist/lib/testing/types.d.ts.map +1 -1
  87. package/dist/lib/version.d.ts +3 -3
  88. package/dist/lib/version.js +3 -3
  89. package/examples/hello_seller_adapter_guaranteed.ts +29 -2
  90. package/examples/hello_seller_adapter_proposal_mode.ts +575 -0
  91. package/package.json +1 -1
  92. package/dist/lib/adapters/proposal-manager.d.ts +0 -142
  93. package/dist/lib/adapters/proposal-manager.d.ts.map +0 -1
  94. package/dist/lib/adapters/proposal-manager.js +0 -184
  95. package/dist/lib/adapters/proposal-manager.js.map +0 -1
@@ -0,0 +1,291 @@
1
+ "use strict";
2
+ /**
3
+ * ProposalStore — per-tenant proposal lifecycle persistence.
4
+ *
5
+ * The single ledger for proposal recipes across the entire lifecycle:
6
+ * draft (in-flight refine iterations) → committed (post-finalize, with
7
+ * `expires_at` hold window) → consumed (post-`create_media_buy`).
8
+ *
9
+ * Ports `adcp-client-python.src/adcp/decisioning/proposal_store.py`.
10
+ *
11
+ * State machine the framework drives:
12
+ *
13
+ * ```
14
+ * ┌──── releaseConsumption ────┐
15
+ * ▼ │
16
+ * putDraft ─► DRAFT ─► commit ─► COMMITTED ─► tryReserveConsumption ─► CONSUMING
17
+ * ▲ │
18
+ * │ │
19
+ * (refine finalizeConsumption
20
+ * iteration) │
21
+ * │ ▼
22
+ * └─ putDraft (overwrite while DRAFT) ─┘ CONSUMED
23
+ * (terminal)
24
+ * ```
25
+ *
26
+ * The `COMMITTED → CONSUMING → CONSUMED` two-phase transition prevents the
27
+ * inventory double-spend race that a check-then-act sequence on `COMMITTED`
28
+ * would expose. Two parallel `create_media_buy(proposal_id=X)` calls cannot
29
+ * both reserve the proposal — the second `tryReserveConsumption` raises
30
+ * `PROPOSAL_NOT_COMMITTED` once the first transitions the record. Adapter
31
+ * dispatch runs against the reservation; on success the framework calls
32
+ * `finalizeConsumption`; on failure `releaseConsumption` rolls back to
33
+ * COMMITTED so the buyer can retry.
34
+ *
35
+ * Transitions outside this graph (commit-from-COMMITTED with mismatched
36
+ * payload, finalize-from-DRAFT, etc.) throw `AdcpError` with `INTERNAL_ERROR`
37
+ * — those are framework / adopter bugs, not buyer-facing rejections.
38
+ *
39
+ * @public
40
+ * @packageDocumentation
41
+ */
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.InMemoryProposalStore = void 0;
44
+ const async_outcome_1 = require("../async-outcome");
45
+ // ---------------------------------------------------------------------------
46
+ // In-memory reference implementation
47
+ // ---------------------------------------------------------------------------
48
+ const DEFAULT_DRAFT_TTL_MS = 24 * 60 * 60 * 1000; // 24h
49
+ const DEFAULT_COMMITTED_GRACE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
50
+ /**
51
+ * Process-local {@link ProposalStore} reference implementation.
52
+ *
53
+ * Storage is a plain `Map` — JS event-loop atomicity covers the critical
54
+ * sections (no preemption between awaits within a method body since there
55
+ * are no awaits). Adequate for local dev, CI, and tests; production
56
+ * deployments wire a durable backing implementing the same interface.
57
+ *
58
+ * Eviction:
59
+ *
60
+ * - Drafts older than `draftTtlMs` (default 24h) are evicted on every
61
+ * read / write.
62
+ * - Committed proposals more than `committedGraceMs` past `expiresAt`
63
+ * (default 7 days) are evicted.
64
+ *
65
+ * Eviction runs lazily — no background timer thread.
66
+ *
67
+ * Cross-tenant safety: `get` and `getByMediaBuyId` honor `expectedAccountId`
68
+ * — cross-tenant probes return `null`, not the raw record.
69
+ *
70
+ * @public
71
+ */
72
+ class InMemoryProposalStore {
73
+ isDurable = false;
74
+ records = new Map();
75
+ // Reverse index keyed by `${accountId}::${mediaBuyId}`. Tenant scoping in
76
+ // the key prevents collisions when adopter media_buy_ids overlap across
77
+ // tenants (sequential IDs, deterministic test fixtures).
78
+ mediaBuyIndex = new Map();
79
+ creationTimes = new Map();
80
+ draftTtlMs;
81
+ committedGraceMs;
82
+ clock;
83
+ constructor(options = {}) {
84
+ this.draftTtlMs = options.draftTtlMs ?? DEFAULT_DRAFT_TTL_MS;
85
+ this.committedGraceMs = options.committedGraceMs ?? DEFAULT_COMMITTED_GRACE_MS;
86
+ this.clock = options.clock ?? (() => new Date());
87
+ }
88
+ mediaBuyKey(accountId, mediaBuyId) {
89
+ return `${accountId}::${mediaBuyId}`;
90
+ }
91
+ evictExpired() {
92
+ const now = this.clock().getTime();
93
+ const toRemove = [];
94
+ for (const [proposalId, record] of this.records) {
95
+ const created = this.creationTimes.get(proposalId)?.getTime() ?? now;
96
+ if (record.state === 'draft') {
97
+ if (now - created > this.draftTtlMs)
98
+ toRemove.push(proposalId);
99
+ }
100
+ else if (record.expiresAt) {
101
+ const deadline = record.expiresAt.getTime() + this.committedGraceMs;
102
+ if (now > deadline)
103
+ toRemove.push(proposalId);
104
+ }
105
+ }
106
+ for (const proposalId of toRemove) {
107
+ const removed = this.records.get(proposalId);
108
+ this.records.delete(proposalId);
109
+ this.creationTimes.delete(proposalId);
110
+ if (removed?.mediaBuyId) {
111
+ this.mediaBuyIndex.delete(this.mediaBuyKey(removed.accountId, removed.mediaBuyId));
112
+ }
113
+ }
114
+ }
115
+ putDraft(args) {
116
+ this.evictExpired();
117
+ const existing = this.records.get(args.proposalId);
118
+ if (existing && existing.state !== 'draft') {
119
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
120
+ recovery: 'terminal',
121
+ message: `Cannot putDraft on proposal ${JSON.stringify(args.proposalId)} in state ` +
122
+ `${JSON.stringify(existing.state)}; refine iterations are only valid on draft ` +
123
+ `proposals. Once committed or consumed, a proposal_id is immutable.`,
124
+ });
125
+ }
126
+ const record = {
127
+ proposalId: args.proposalId,
128
+ accountId: args.accountId,
129
+ state: 'draft',
130
+ recipes: new Map(args.recipes),
131
+ proposalPayload: { ...args.proposalPayload },
132
+ };
133
+ this.records.set(args.proposalId, record);
134
+ // Refine iterations preserve the original creation time so the 24h
135
+ // draft TTL is anchored to the start of the buyer's session, not the
136
+ // most recent iteration.
137
+ if (!this.creationTimes.has(args.proposalId)) {
138
+ this.creationTimes.set(args.proposalId, this.clock());
139
+ }
140
+ }
141
+ get(proposalId, args) {
142
+ this.evictExpired();
143
+ const record = this.records.get(proposalId);
144
+ if (!record)
145
+ return null;
146
+ if (record.accountId !== args.expectedAccountId) {
147
+ // Cross-tenant probe — return null, not raw record.
148
+ return null;
149
+ }
150
+ return record;
151
+ }
152
+ commit(proposalId, args) {
153
+ this.evictExpired();
154
+ const record = this.records.get(proposalId);
155
+ if (!record) {
156
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
157
+ recovery: 'terminal',
158
+ message: `Cannot commit proposal ${JSON.stringify(proposalId)}: not in store. The ` +
159
+ `framework's finalize dispatch must putDraft before commit.`,
160
+ });
161
+ }
162
+ const payload = { ...args.proposalPayload };
163
+ if (record.state === 'committed') {
164
+ const sameDeadline = record.expiresAt?.getTime() === args.expiresAt.getTime();
165
+ const samePayload = JSON.stringify(record.proposalPayload) === JSON.stringify(payload);
166
+ if (sameDeadline && samePayload)
167
+ return;
168
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
169
+ recovery: 'terminal',
170
+ message: `Proposal ${JSON.stringify(proposalId)} already committed with a different ` +
171
+ `expires_at or payload — re-commit with different values is a developer bug.`,
172
+ });
173
+ }
174
+ if (record.state !== 'draft') {
175
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
176
+ recovery: 'terminal',
177
+ message: `Cannot commit proposal ${JSON.stringify(proposalId)} from state ` +
178
+ `${JSON.stringify(record.state)}; commit requires DRAFT.`,
179
+ });
180
+ }
181
+ this.records.set(proposalId, {
182
+ ...record,
183
+ state: 'committed',
184
+ expiresAt: args.expiresAt,
185
+ proposalPayload: payload,
186
+ });
187
+ }
188
+ tryReserveConsumption(proposalId, args) {
189
+ this.evictExpired();
190
+ const record = this.records.get(proposalId);
191
+ // Cross-tenant probe collapses to PROPOSAL_NOT_FOUND — same
192
+ // principal-enumeration defense as `get`.
193
+ if (!record || record.accountId !== args.expectedAccountId) {
194
+ throw new async_outcome_1.AdcpError('PROPOSAL_NOT_FOUND', {
195
+ recovery: 'terminal',
196
+ message: `Proposal ${JSON.stringify(proposalId)} not found.`,
197
+ field: 'proposal_id',
198
+ });
199
+ }
200
+ if (record.state !== 'committed') {
201
+ throw new async_outcome_1.AdcpError('PROPOSAL_NOT_COMMITTED', {
202
+ recovery: 'correctable',
203
+ message: `Proposal ${JSON.stringify(proposalId)} is in state ${JSON.stringify(record.state)}; ` +
204
+ `create_media_buy requires a committed proposal that hasn't been accepted or ` +
205
+ `reserved by another request.`,
206
+ field: 'proposal_id',
207
+ });
208
+ }
209
+ const reserved = { ...record, state: 'consuming' };
210
+ this.records.set(proposalId, reserved);
211
+ return reserved;
212
+ }
213
+ finalizeConsumption(proposalId, args) {
214
+ const record = this.records.get(proposalId);
215
+ if (!record || record.accountId !== args.expectedAccountId) {
216
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
217
+ recovery: 'terminal',
218
+ message: `finalizeConsumption: proposal ${JSON.stringify(proposalId)} not found for ` + `the expected tenant.`,
219
+ });
220
+ }
221
+ if (record.state === 'consumed') {
222
+ // Idempotent on already-CONSUMED with the same mediaBuyId.
223
+ if (record.mediaBuyId === args.mediaBuyId)
224
+ return;
225
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
226
+ recovery: 'terminal',
227
+ message: `Proposal ${JSON.stringify(proposalId)} already consumed by ` +
228
+ `media_buy_id=${JSON.stringify(record.mediaBuyId)}; cannot re-consume as ` +
229
+ `${JSON.stringify(args.mediaBuyId)}.`,
230
+ });
231
+ }
232
+ if (record.state !== 'consuming') {
233
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
234
+ recovery: 'terminal',
235
+ message: `finalizeConsumption requires CONSUMING; proposal ${JSON.stringify(proposalId)} ` +
236
+ `is in ${JSON.stringify(record.state)}. Framework must call ` +
237
+ `tryReserveConsumption first.`,
238
+ });
239
+ }
240
+ this.records.set(proposalId, {
241
+ ...record,
242
+ state: 'consumed',
243
+ mediaBuyId: args.mediaBuyId,
244
+ });
245
+ this.mediaBuyIndex.set(this.mediaBuyKey(record.accountId, args.mediaBuyId), proposalId);
246
+ }
247
+ releaseConsumption(proposalId, args) {
248
+ const record = this.records.get(proposalId);
249
+ if (!record || record.accountId !== args.expectedAccountId) {
250
+ // Idempotent — releasing an unknown id is a no-op so the
251
+ // adapter-failure rollback path can be unconditional.
252
+ return;
253
+ }
254
+ if (record.state === 'committed') {
255
+ // Already rolled back.
256
+ return;
257
+ }
258
+ if (record.state !== 'consuming') {
259
+ throw new async_outcome_1.AdcpError('INTERNAL_ERROR', {
260
+ recovery: 'terminal',
261
+ message: `releaseConsumption requires CONSUMING; proposal ${JSON.stringify(proposalId)} ` +
262
+ `is in ${JSON.stringify(record.state)}.`,
263
+ });
264
+ }
265
+ this.records.set(proposalId, { ...record, state: 'committed' });
266
+ }
267
+ discard(proposalId) {
268
+ const record = this.records.get(proposalId);
269
+ this.records.delete(proposalId);
270
+ this.creationTimes.delete(proposalId);
271
+ if (record?.mediaBuyId) {
272
+ this.mediaBuyIndex.delete(this.mediaBuyKey(record.accountId, record.mediaBuyId));
273
+ }
274
+ }
275
+ getByMediaBuyId(mediaBuyId, args) {
276
+ this.evictExpired();
277
+ const key = this.mediaBuyKey(args.expectedAccountId, mediaBuyId);
278
+ const proposalId = this.mediaBuyIndex.get(key);
279
+ if (!proposalId)
280
+ return null;
281
+ const record = this.records.get(proposalId);
282
+ if (!record) {
283
+ // Index drift — clean up.
284
+ this.mediaBuyIndex.delete(key);
285
+ return null;
286
+ }
287
+ return record;
288
+ }
289
+ }
290
+ exports.InMemoryProposalStore = InMemoryProposalStore;
291
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../../src/lib/server/decisioning/proposal/store.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;AAGH,oDAA6C;AA6J7C,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACxD,MAAM,0BAA0B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAwBrE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,qBAAqB;IACvB,SAAS,GAAG,KAAK,CAAC;IAEV,OAAO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