@cat-factory/kernel 0.341.0 → 0.342.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.
@@ -9,6 +9,18 @@ export interface NotificationRepository {
9
9
  * a re-driven run doesn't stack identical cards on the same block.
10
10
  */
11
11
  findOpenByBlock(workspaceId: string, blockId: string, type: NotificationType): Promise<Notification | null>;
12
+ /**
13
+ * Every open notification on ONE block, newest first, of ANY type.
14
+ *
15
+ * The narrow read behind "does this block already have a card telling the human something is
16
+ * waiting". The engine used to answer that by pulling the workspace's WHOLE open inbox (each
17
+ * row's `body` + `payload` JSON) on every run-state transition and filtering in JS, which grows
18
+ * with the workspace's un-actioned inbox rather than with the block. `type` is deliberately not
19
+ * a parameter here: the caller asks whether ANY card points at the block, so narrowing to one
20
+ * type would raise a duplicate beside a card of a different type. Served by the existing
21
+ * `(workspace_id, block_id, type, status)` index on its leading columns.
22
+ */
23
+ listOpenByBlock(workspaceId: string, blockId: string): Promise<Notification[]>;
12
24
  /**
13
25
  * The open, BLOCK-LESS notification of `type` for a workspace (`block_id IS NULL`), if any.
14
26
  * The block-less analogue of {@link findOpenByBlock}: it de-duplicates deployment/workspace-
@@ -78,6 +90,20 @@ export interface NotificationRepository {
78
90
  * re-deliver each for the real-time inbox re-render. Nothing matches → empty array.
79
91
  */
80
92
  escalateStaleOpen(workspaceId: string, cutoff: number): Promise<Notification[]>;
93
+ /**
94
+ * Dismiss EVERY open, block-less notification of `type` for a workspace in ONE statement,
95
+ * returning the dismissed rows so the caller can re-deliver each for the real-time inbox
96
+ * re-render. Nothing open → empty array.
97
+ *
98
+ * Plural on purpose. A block-less card has no unique index to lean on: the partial index that
99
+ * makes the block-scoped raise atomic exempts them, because NULLs are distinct in a unique
100
+ * index, so `raise` still de-dupes them with a read-before-write and two sweeps racing on one
101
+ * workspace can leave two open rows. A clear that settled only the newest would leave the other
102
+ * open forever, and the escalation sweep would later flip it red for a condition that has since
103
+ * cleared: the exact lingering-stale-alert failure the clear exists to prevent. Settling the
104
+ * whole set is therefore both the clear AND the heal, and costs one indexed write either way.
105
+ */
106
+ dismissOpenByType(workspaceId: string, type: NotificationType, resolvedAt: number): Promise<Notification[]>;
81
107
  /**
82
108
  * Prune resolved notifications (status `acted`/`dismissed`) whose `resolvedAt` is at or
83
109
  * before `cutoff`, across all workspaces, returning the number of rows removed. The
@@ -1 +1 @@
1
- {"version":3,"file":"notification-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/notification-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAMxE,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAClE,iGAAiG;IACjG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IACtD;;;OAGG;IACH,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IACzF;;;;;;;;;OASG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAA;IAClG;;;;;;;;;;;;OAYG;IACH,gBAAgB,CACd,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAA;IACrC;sDACkD;IAClD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE;;;;;;;;;OASG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IACjG;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IAC1F;;;;;OAKG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IAC/E;;;;;;;;OAQG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACzD"}
1
+ {"version":3,"file":"notification-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/notification-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAMxE,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAClE,iGAAiG;IACjG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IACtD;;;OAGG;IACH,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAC/B;;;;;;;;;;OAUG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,E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C,MAAM,CAAC,CAAA;CACzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/kernel",
3
- "version": "0.341.0",
3
+ "version": "0.342.0",
4
4
  "description": "Shared vocabulary, pure logic, and port interfaces for the Agent Architecture Board.",
5
5
  "repository": {
6
6
  "type": "git",