@cat-factory/kernel 0.134.0 → 0.135.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.
@@ -33,6 +33,16 @@ export interface PlatformDurationStats {
33
33
  avgMs: number | null;
34
34
  minMs: number | null;
35
35
  maxMs: number | null;
36
+ /**
37
+ * Discrete (nearest-rank) duration percentiles (ms), or null when no terminal runs. Both
38
+ * facades compute the SAME nearest-rank value: Postgres via `percentile_disc`, SQLite via
39
+ * the `row_number()/count()` cumulative-fraction order-statistic workaround (D1/SQLite has
40
+ * no percentile aggregate) — the conformance suite pins that the two agree. `p50Ms` is the
41
+ * median; the tail percentiles surface slow-run outliers the average hides.
42
+ */
43
+ p50Ms: number | null;
44
+ p90Ms: number | null;
45
+ p99Ms: number | null;
36
46
  }
37
47
  export interface PlatformMetricsRepository {
38
48
  /**
@@ -56,7 +66,11 @@ export interface PlatformMetricsRepository {
56
66
  * `running`, `blocked`, `paused`, or `pending` right now — the queue/park depth.
57
67
  */
58
68
  activeAndParkedCounts(accountId: string): Promise<PlatformLiveCounts>;
59
- /** Wall-clock duration stats over terminal runs created in the window. */
69
+ /**
70
+ * Wall-clock duration stats over terminal runs created in the window: count, avg/min/max,
71
+ * and the discrete p50/p90/p99 percentiles — all over the SAME filtered row set in ONE
72
+ * aggregate query (never a second scan to add the percentiles).
73
+ */
60
74
  durationStatsSince(accountId: string, sinceEpochMs: number): Promise<PlatformDurationStats>;
61
75
  }
62
76
  //# sourceMappingURL=platform-metrics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-metrics.d.ts","sourceRoot":"","sources":["../../src/ports/platform-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAgBtD,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAA;IAClB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,KA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,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;CAC5F"}
1
+ {"version":3,"file":"platform-metrics.d.ts","sourceRoot":"","sources":["../../src/ports/platform-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAgBtD,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAA;IAClB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4FAA4F;AAC5F,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,qFAAqF;IACrF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IACxF;;;;OAIG;IACH,eAAe,CACb,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAA;IACnC;;;OAGG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAA;IAC9F;;;OAGG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACrE;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;CAC5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/kernel",
3
- "version": "0.134.0",
3
+ "version": "0.135.0",
4
4
  "description": "Shared vocabulary, pure logic, and port interfaces for the Agent Architecture Board.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "ai": "^6.0.224",
28
- "@cat-factory/contracts": "0.140.0"
28
+ "@cat-factory/contracts": "0.142.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@vitest/coverage-v8": "^4.1.10",