@cat-factory/kernel 0.219.0 → 0.220.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.
@@ -11,12 +11,39 @@ export interface CapabilityCredentialRecord {
11
11
  * updatedAt }`), so the settings view can list what is configured without decrypting anything.
12
12
  */
13
13
  summary: string;
14
+ /**
15
+ * Optimistic-concurrency revision, bumped on every write. The row is ONE sealed blob, so the
16
+ * per-key writes are read-modify-write over the whole set; the rev is what keeps two operators
17
+ * saving DIFFERENT keys from silently destroying each other's (the loser's save returned
18
+ * success, so nothing would ever look wrong).
19
+ */
20
+ rev: number;
14
21
  createdAt: number;
15
22
  updatedAt: number;
16
23
  }
17
24
  export interface CapabilityCredentialRepository {
18
25
  get(workspaceId: string): Promise<CapabilityCredentialRecord | null>;
26
+ /**
27
+ * Blind whole-set write (the set-replacing PUT, whose semantics ARE last-writer-wins). Inserts
28
+ * with the record's `rev`; on conflict the STORED rev is bumped in SQL (the record's is
29
+ * ignored), so the rev stays monotonic under blind writes and a concurrent `compareAndSwap`
30
+ * whose base predates this write reliably loses.
31
+ */
19
32
  upsert(record: CapabilityCredentialRecord): Promise<void>;
33
+ /**
34
+ * Rev-guarded conditional write for the read-modify-write paths (the per-key put/remove):
35
+ * persists `record` (with `record.rev` already bumped by the caller) ONLY if the stored row
36
+ * still carries `expectedRev`. `expectedRev: null` means "expect NO row": a
37
+ * conflict-do-nothing insert, false when a concurrent writer created one. False ⇒ the caller
38
+ * reloads and re-applies on the winner's snapshot.
39
+ */
40
+ compareAndSwap(record: CapabilityCredentialRecord, expectedRev: number | null): Promise<boolean>;
41
+ /**
42
+ * Rev-guarded delete (a per-key remove that empties the set). False when another writer moved
43
+ * the row first: their write may have added the key back.
44
+ */
45
+ deleteIfRev(workspaceId: string, expectedRev: number): Promise<boolean>;
46
+ /** Blind delete: the whole-set PUT of an empty set, which clears the row by intent. */
20
47
  delete(workspaceId: string): Promise<void>;
21
48
  }
22
49
  //# sourceMappingURL=capability-credential-repositories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capability-credential-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/capability-credential-repositories.ts"],"names":[],"mappings":"AAcA,qFAAqF;AACrF,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAA;IACpE,MAAM,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C"}
1
+ {"version":3,"file":"capability-credential-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/capability-credential-repositories.ts"],"names":[],"mappings":"AAcA,qFAAqF;AACrF,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAA;IACpE;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAChG;;;OAGG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACvE,uFAAuF;IACvF,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/kernel",
3
- "version": "0.219.0",
3
+ "version": "0.220.0",
4
4
  "description": "Shared vocabulary, pure logic, and port interfaces for the Agent Architecture Board.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "ai": "^7.0.47",
28
28
  "yaml": "^2.9.0",
29
- "@cat-factory/contracts": "0.216.0"
29
+ "@cat-factory/contracts": "0.217.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@vitest/coverage-v8": "^4.1.10",