@massa-ai/core 1.59.0 → 1.60.1
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.
|
@@ -36,6 +36,18 @@ export declare class PgObservationStore implements ObservationStore {
|
|
|
36
36
|
private mirror;
|
|
37
37
|
private hydrated;
|
|
38
38
|
private hydrating;
|
|
39
|
+
/**
|
|
40
|
+
* Per-observation-id serialized write chain, and the thing `__drain()` awaits.
|
|
41
|
+
*
|
|
42
|
+
* Before this existed, the persist was an untracked `void (async () => …)()`
|
|
43
|
+
* and `__drain()` was `setTimeout(10)` — a sleep wearing a flush's name,
|
|
44
|
+
* against a docstring that claimed to await in-flight writes. A caller that
|
|
45
|
+
* inserted and then queried PostgreSQL directly was racing the commit on a
|
|
46
|
+
* 10 ms budget, which is why `observation-repository-pg-coverage.test.ts`
|
|
47
|
+
* carried its own extra 120 ms sleep on top and still failed on a loaded CI
|
|
48
|
+
* runner (`SELECT … WHERE id = $1` returned zero rows).
|
|
49
|
+
*/
|
|
50
|
+
private inflight;
|
|
39
51
|
/**
|
|
40
52
|
* Epoch (ms) of the last failed hydration attempt. Used to rate-limit
|
|
41
53
|
* retries so a persistent PG error does not turn every op into a full
|
|
@@ -52,6 +64,17 @@ export declare class PgObservationStore implements ObservationStore {
|
|
|
52
64
|
*/
|
|
53
65
|
private ensureHydrated;
|
|
54
66
|
insert(obs: InsertableObservation): void;
|
|
67
|
+
/**
|
|
68
|
+
* Chain a write onto any in-flight write for the same key so commits land in
|
|
69
|
+
* call order. Different keys stay concurrent. Settled entries are dropped so
|
|
70
|
+
* the map does not grow. Mirrors PgSynapseSessionStore.chainWrite, which
|
|
71
|
+
* mirrors PgJobStore.inflight.
|
|
72
|
+
*
|
|
73
|
+
* The rejection handler is what keeps `insert`'s best-effort contract: a
|
|
74
|
+
* failed persist is logged and swallowed here, never surfaced to the
|
|
75
|
+
* synchronous caller, exactly as the old fire-and-forget try/catch did.
|
|
76
|
+
*/
|
|
77
|
+
private chainWrite;
|
|
55
78
|
listRecent(projectId: string, limit: number): Observation[];
|
|
56
79
|
listBySession(sessionId: string, limit: number): Observation[];
|
|
57
80
|
countByProject(projectId: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation-repository-pg.d.ts","sourceRoot":"","sources":["../../../src/data/memory/observation-repository-pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAmDnC,qBAAa,kBAAmB,YAAW,gBAAgB;IACzD,OAAO,CAAC,MAAM,CAAgB;IAC9B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAA8B;IAC/C;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAElD,OAAO,CAAC,SAAS;IAKjB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAgDtB,MAAM,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"observation-repository-pg.d.ts","sourceRoot":"","sources":["../../../src/data/memory/observation-repository-pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAEhB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAmDnC,qBAAa,kBAAmB,YAAW,gBAAgB;IACzD,OAAO,CAAC,MAAM,CAAgB;IAC9B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAA8B;IAC/C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ,CAAyC;IACzD;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAElD,OAAO,CAAC,SAAS;IAKjB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAgDtB,MAAM,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI;IA4ExC;;;;;;;;;OASG;IACH,OAAO,CAAC,UAAU;IAclB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE;IAS3D,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE;IAS9D,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAOzC,WAAW,IAAI,MAAM;IAIrB,0EAA0E;IACpE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,mEAAmE;IAC7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAU/B"}
|
|
@@ -71,6 +71,18 @@ export class PgObservationStore {
|
|
|
71
71
|
mirror = new Map();
|
|
72
72
|
hydrated = false;
|
|
73
73
|
hydrating = null;
|
|
74
|
+
/**
|
|
75
|
+
* Per-observation-id serialized write chain, and the thing `__drain()` awaits.
|
|
76
|
+
*
|
|
77
|
+
* Before this existed, the persist was an untracked `void (async () => …)()`
|
|
78
|
+
* and `__drain()` was `setTimeout(10)` — a sleep wearing a flush's name,
|
|
79
|
+
* against a docstring that claimed to await in-flight writes. A caller that
|
|
80
|
+
* inserted and then queried PostgreSQL directly was racing the commit on a
|
|
81
|
+
* 10 ms budget, which is why `observation-repository-pg-coverage.test.ts`
|
|
82
|
+
* carried its own extra 120 ms sleep on top and still failed on a loaded CI
|
|
83
|
+
* runner (`SELECT … WHERE id = $1` returned zero rows).
|
|
84
|
+
*/
|
|
85
|
+
inflight = new Map();
|
|
74
86
|
/**
|
|
75
87
|
* Epoch (ms) of the last failed hydration attempt. Used to rate-limit
|
|
76
88
|
* retries so a persistent PG error does not turn every op into a full
|
|
@@ -156,16 +168,12 @@ export class PgObservationStore {
|
|
|
156
168
|
void this.ensureHydrated();
|
|
157
169
|
// Fire-and-forget persist (best-effort, matching PgScheduledJobStore).
|
|
158
170
|
//
|
|
159
|
-
// Ordering
|
|
160
|
-
// `obs.id` fire two independent async IIFEs with no per-id
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
// does not guarantee commit ordering either. Impact is low and bounded:
|
|
166
|
-
// observations are best-effort telemetry, ids are normally unique per
|
|
167
|
-
// event, and the in-memory mirror (the sync read path) is already correct.
|
|
168
|
-
// The nondeterminism only affects same-id concurrent writes to PG.
|
|
171
|
+
// Ordering (2026-07-12, closed 2026-09-21): two concurrent inserts sharing
|
|
172
|
+
// one `obs.id` used to fire two independent async IIFEs with no per-id
|
|
173
|
+
// serialization, so the last-writer-wins ON CONFLICT update could land in
|
|
174
|
+
// call-disorder. The persist is now chained per id through `chainWrite`,
|
|
175
|
+
// the same shape PgJobStore and PgSynapseSessionStore use, so commits for
|
|
176
|
+
// one id land in call order. Different ids stay concurrent.
|
|
169
177
|
//
|
|
170
178
|
// Alias caveat (2026-07-27, BUG-06): the mirror keying above is only as
|
|
171
179
|
// good as the resolver's TTL cache. For a source id this process has never
|
|
@@ -176,52 +184,68 @@ export class PgObservationStore {
|
|
|
176
184
|
// by tests. Closing the cold window entirely would mean making `insert`
|
|
177
185
|
// async, which changes the fire-and-forget contract its hook callers rely
|
|
178
186
|
// on; that is deliberately not done here.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
190
|
-
}
|
|
191
|
-
await prisma.$executeRaw `
|
|
192
|
-
INSERT INTO observations (
|
|
193
|
-
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
194
|
-
) VALUES (
|
|
195
|
-
${obs.id},
|
|
196
|
-
${canonicalProjectId},
|
|
197
|
-
${obs.sessionId},
|
|
198
|
-
${obs.source},
|
|
199
|
-
${obs.category ?? null},
|
|
200
|
-
${obs.payloadJson},
|
|
201
|
-
${obs.importance},
|
|
202
|
-
${obs.createdAt}::bigint,
|
|
203
|
-
${obs.agentId ?? null},
|
|
204
|
-
${obs.attributionSource ?? null}
|
|
205
|
-
)
|
|
206
|
-
ON CONFLICT (id) DO UPDATE SET
|
|
207
|
-
project_id = EXCLUDED.project_id,
|
|
208
|
-
session_id = EXCLUDED.session_id,
|
|
209
|
-
source = EXCLUDED.source,
|
|
210
|
-
category = EXCLUDED.category,
|
|
211
|
-
payload_json = EXCLUDED.payload_json,
|
|
212
|
-
importance = EXCLUDED.importance,
|
|
213
|
-
created_at = EXCLUDED.created_at,
|
|
214
|
-
agent_id = EXCLUDED.agent_id,
|
|
215
|
-
attribution_source = EXCLUDED.attribution_source
|
|
216
|
-
`;
|
|
217
|
-
}
|
|
218
|
-
catch (e) {
|
|
219
|
-
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
220
|
-
id: obs.id,
|
|
221
|
-
error: e.message,
|
|
222
|
-
});
|
|
187
|
+
this.chainWrite(obs.id, async () => {
|
|
188
|
+
const prisma = this.getClient();
|
|
189
|
+
// Resolve canonical project id at the persist seam (spec req 3). The
|
|
190
|
+
// sync mirror initially keeps the caller's id; once the canonical id
|
|
191
|
+
// resolves we overwrite the mirror entry so sync reads (listRecent /
|
|
192
|
+
// countByProject / listBySession) key on the SAME canonical id as the
|
|
193
|
+
// durable row — closing the post-rename read/write split (HAR-07).
|
|
194
|
+
const canonicalProjectId = await getProjectIdentityAliasResolver().resolve(obs.projectId);
|
|
195
|
+
if (canonicalProjectId !== obs.projectId) {
|
|
196
|
+
this.mirror.set(obs.id, { ...obs, projectId: canonicalProjectId });
|
|
223
197
|
}
|
|
224
|
-
|
|
198
|
+
await prisma.$executeRaw `
|
|
199
|
+
INSERT INTO observations (
|
|
200
|
+
id, project_id, session_id, source, category, payload_json, importance, created_at, agent_id, attribution_source
|
|
201
|
+
) VALUES (
|
|
202
|
+
${obs.id},
|
|
203
|
+
${canonicalProjectId},
|
|
204
|
+
${obs.sessionId},
|
|
205
|
+
${obs.source},
|
|
206
|
+
${obs.category ?? null},
|
|
207
|
+
${obs.payloadJson},
|
|
208
|
+
${obs.importance},
|
|
209
|
+
${obs.createdAt}::bigint,
|
|
210
|
+
${obs.agentId ?? null},
|
|
211
|
+
${obs.attributionSource ?? null}
|
|
212
|
+
)
|
|
213
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
214
|
+
project_id = EXCLUDED.project_id,
|
|
215
|
+
session_id = EXCLUDED.session_id,
|
|
216
|
+
source = EXCLUDED.source,
|
|
217
|
+
category = EXCLUDED.category,
|
|
218
|
+
payload_json = EXCLUDED.payload_json,
|
|
219
|
+
importance = EXCLUDED.importance,
|
|
220
|
+
created_at = EXCLUDED.created_at,
|
|
221
|
+
agent_id = EXCLUDED.agent_id,
|
|
222
|
+
attribution_source = EXCLUDED.attribution_source
|
|
223
|
+
`;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Chain a write onto any in-flight write for the same key so commits land in
|
|
228
|
+
* call order. Different keys stay concurrent. Settled entries are dropped so
|
|
229
|
+
* the map does not grow. Mirrors PgSynapseSessionStore.chainWrite, which
|
|
230
|
+
* mirrors PgJobStore.inflight.
|
|
231
|
+
*
|
|
232
|
+
* The rejection handler is what keeps `insert`'s best-effort contract: a
|
|
233
|
+
* failed persist is logged and swallowed here, never surfaced to the
|
|
234
|
+
* synchronous caller, exactly as the old fire-and-forget try/catch did.
|
|
235
|
+
*/
|
|
236
|
+
chainWrite(key, fn) {
|
|
237
|
+
const prev = this.inflight.get(key) ?? Promise.resolve();
|
|
238
|
+
const next = prev.then(fn).catch((e) => {
|
|
239
|
+
logger.warn("PgObservationStore.insert failed (best-effort)", {
|
|
240
|
+
id: key,
|
|
241
|
+
error: e.message,
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
this.inflight.set(key, next);
|
|
245
|
+
void next.then(() => {
|
|
246
|
+
if (this.inflight.get(key) === next)
|
|
247
|
+
this.inflight.delete(key);
|
|
248
|
+
});
|
|
225
249
|
}
|
|
226
250
|
listRecent(projectId, limit) {
|
|
227
251
|
void this.ensureHydrated();
|
|
@@ -256,9 +280,14 @@ export class PgObservationStore {
|
|
|
256
280
|
}
|
|
257
281
|
/** Test helper: await in-flight writes. Not for production use. */
|
|
258
282
|
async __drain() {
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
283
|
+
// Snapshot the pending set ONCE. Re-reading `this.inflight` in a loop would
|
|
284
|
+
// re-await writes that a concurrent caller repopulated during the drain,
|
|
285
|
+
// risking a hang under load. We only owe the caller that the writes
|
|
286
|
+
// in-flight at drain-start have settled.
|
|
287
|
+
const pending = Array.from(this.inflight.values());
|
|
288
|
+
if (pending.length > 0)
|
|
289
|
+
await Promise.allSettled(pending);
|
|
290
|
+
// A short settle delay covers any write queued during the drain.
|
|
262
291
|
await new Promise((r) => setTimeout(r, 10));
|
|
263
292
|
}
|
|
264
293
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation-repository-pg.js","sourceRoot":"","sources":["../../../src/data/memory/observation-repository-pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAwBjF,SAAS,KAAK,CAAC,CAAqC;IAClD,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,OAAO,C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,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3B,uEAAuE;QACvE,EAAE;QACF,2EAA2E;QAC3E,
|
|
1
|
+
{"version":3,"file":"observation-repository-pg.js","sourceRoot":"","sources":["../../../src/data/memory/observation-repository-pg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAwBjF,SAAS,KAAK,CAAC,CAAqC;IAClD,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAmB;IAC7C,MAAM,GAAG,GAAmB;QAC1B,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;QACpC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,kBAAkB,EAAE,CAAC,CAAC,kBAAkB;KACzC,CAAC;IACF,oEAAoE;IACpE,uEAAuE;IACvE,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,MAAM,EAAE,GAA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AAC;QACzE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,WAAW;QACT,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC9B,CAAC;IAED,mEAAmE;IACnE,KAAK,CAAC,OAAO;QACX,4EAA4E;QAC5E,yEAAyE;QACzE,oEAAoE;QACpE,yCAAyC;QACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACnD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1D,iEAAiE;QACjE,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.1",
|
|
4
4
|
"author": "luizgmassa",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@ai-sdk/google": "^3.0.19",
|
|
45
45
|
"@ai-sdk/mistral": "^3.0.17",
|
|
46
46
|
"@ai-sdk/openai": "^3.0.24",
|
|
47
|
-
"@massa-ai/shared": "1.
|
|
47
|
+
"@massa-ai/shared": "1.60.1",
|
|
48
48
|
"@prisma/adapter-pg": "^7.5.0",
|
|
49
49
|
"@prisma/client": "^7.5.0",
|
|
50
50
|
"@prisma/client-runtime-utils": "^7.3.0",
|