@cat-factory/kernel 0.292.2 → 0.294.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.
- package/dist/domain/catalog.d.ts +4 -0
- package/dist/domain/catalog.d.ts.map +1 -1
- package/dist/domain/catalog.js +45 -15
- package/dist/domain/catalog.js.map +1 -1
- package/dist/domain/risk-policy-tiers.d.ts +52 -0
- package/dist/domain/risk-policy-tiers.d.ts.map +1 -0
- package/dist/domain/risk-policy-tiers.js +81 -0
- package/dist/domain/risk-policy-tiers.js.map +1 -0
- package/dist/domain/seed.d.ts +1 -1
- package/dist/domain/seed.d.ts.map +1 -1
- package/dist/domain/seed.js +89 -1
- package/dist/domain/seed.js.map +1 -1
- package/dist/domain/types.d.ts +1 -1
- package/dist/domain/types.d.ts.map +1 -1
- package/dist/domain/workspace-cascade.d.ts +1 -1
- package/dist/domain/workspace-cascade.d.ts.map +1 -1
- package/dist/domain/workspace-cascade.js +1 -0
- package/dist/domain/workspace-cascade.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/caching.d.ts +22 -5
- package/dist/ports/caching.d.ts.map +1 -1
- package/dist/ports/caching.js.map +1 -1
- package/dist/ports/index.d.ts +1 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/repositories.d.ts +17 -1
- package/dist/ports/repositories.d.ts.map +1 -1
- package/dist/ports/repositories.js.map +1 -1
- package/dist/ports/risk-policy-repositories.d.ts +82 -5
- package/dist/ports/risk-policy-repositories.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import type { RiskPolicy,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { RiskPolicy, RunDefaultScope } from '../domain/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* An ACCOUNT-tier risk policy: every field of a stored policy except the two per-scope DEFAULT
|
|
4
|
+
* claims, which an account row cannot hold.
|
|
5
|
+
*
|
|
6
|
+
* A default is the answer to "which policy governs a task on THIS board that pinned none", and
|
|
7
|
+
* that is a per-board question: one account's boards routinely want different postures, and there
|
|
8
|
+
* is no row an account could flag that would be right for all of them. So the claims stay
|
|
9
|
+
* workspace-tier, the account table has no columns for them, and the type says so rather than
|
|
10
|
+
* carrying two fields every reader would have to know are always false. A board that wants an
|
|
11
|
+
* inherited policy as its default clones it, which is the same click and leaves a row it owns.
|
|
12
|
+
*/
|
|
13
|
+
export type AccountRiskPolicy = Omit<RiskPolicy, 'isDefault' | 'isUnattendedDefault'>;
|
|
14
|
+
/**
|
|
15
|
+
* The three READS every risk-policy consumer makes about a board: one policy by id, the whole
|
|
16
|
+
* library, and a scope's default.
|
|
17
|
+
*
|
|
18
|
+
* Named apart from the repository below because since ADR 0055 the answer is no longer one table's
|
|
19
|
+
* rows: a board's library is its own policies MERGED with the account policies it inherits, and the
|
|
20
|
+
* engine's resolution, the board editor and the two board guards must all read the same merged
|
|
21
|
+
* view. Typing those consumers against this — rather than against the workspace-tier repository
|
|
22
|
+
* they used to hold — is what makes "the picker offered it, so the engine resolves it" a property
|
|
23
|
+
* of the types instead of a discipline. The workspace tier's own repository satisfies it too, which
|
|
24
|
+
* is exactly what a facade with no account tier wired falls back to.
|
|
25
|
+
*/
|
|
26
|
+
export interface WorkspaceRiskPolicyReader {
|
|
27
|
+
/** A policy by id, or null if nothing this board can see defines it. */
|
|
4
28
|
get(workspaceId: string, id: string): Promise<RiskPolicy | null>;
|
|
5
|
-
/**
|
|
29
|
+
/** The whole library (the snapshot, the settings editor, the board guards). */
|
|
6
30
|
list(workspaceId: string): Promise<RiskPolicy[]>;
|
|
7
31
|
/**
|
|
8
32
|
* The workspace's default preset for one scope, or null if none is seeded yet.
|
|
@@ -10,8 +34,13 @@ export interface RiskPolicyRepository {
|
|
|
10
34
|
* The scope is REQUIRED rather than defaulted, so a caller that has not decided which kind of
|
|
11
35
|
* run it is resolving for fails to compile. The alternative reads as correct and silently hands
|
|
12
36
|
* an unwatched run the in-app policy, which is the exact behaviour this parameter exists to fix.
|
|
37
|
+
*
|
|
38
|
+
* Answered from the WORKSPACE tier alone, at either layer that implements this: an account row
|
|
39
|
+
* holds no default claim (see {@link AccountRiskPolicy}).
|
|
13
40
|
*/
|
|
14
|
-
getDefault(workspaceId: string, scope:
|
|
41
|
+
getDefault(workspaceId: string, scope: RunDefaultScope): Promise<RiskPolicy | null>;
|
|
42
|
+
}
|
|
43
|
+
export interface RiskPolicyRepository extends WorkspaceRiskPolicyReader {
|
|
15
44
|
/**
|
|
16
45
|
* Create or replace a preset (keyed by id). Promoting `isDefault` / `isUnattendedDefault`
|
|
17
46
|
* demotes the prior holder of THAT flag, leaving the other scope's default alone.
|
|
@@ -20,4 +49,52 @@ export interface RiskPolicyRepository {
|
|
|
20
49
|
/** Remove a preset by id (no-op if absent). Neither scope's default preset can be removed. */
|
|
21
50
|
remove(workspaceId: string, id: string): Promise<void>;
|
|
22
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The ACCOUNT-tier policy library: postures authored once for a whole account, which every board
|
|
54
|
+
* under it inherits read-only (ADR 0055). Its own table rather than a re-tiering of the workspace
|
|
55
|
+
* one, because the two tiers have different LIFECYCLES: a workspace row is seeded from the built-in
|
|
56
|
+
* catalog when the board is created, carries the board's default claims, and is reclaimed by the
|
|
57
|
+
* board-delete cascade, none of which is true of a shared account row.
|
|
58
|
+
*
|
|
59
|
+
* There is no `getDefault` here on purpose (see {@link AccountRiskPolicy}), and no `reseed`: the
|
|
60
|
+
* built-in catalog is copied into BOARDS, so an account library starts empty and holds exactly what
|
|
61
|
+
* an account admin authored.
|
|
62
|
+
*/
|
|
63
|
+
export interface AccountRiskPolicyRepository {
|
|
64
|
+
/** A policy by id, or null if this account defines none under it. */
|
|
65
|
+
get(accountId: string, id: string): Promise<AccountRiskPolicy | null>;
|
|
66
|
+
/** Every policy this account defines, oldest first (the tier's editor + the board merge). */
|
|
67
|
+
list(accountId: string): Promise<AccountRiskPolicy[]>;
|
|
68
|
+
/**
|
|
69
|
+
* The policies under a SET of ids, in one chunked `IN` query.
|
|
70
|
+
*
|
|
71
|
+
* The batched read exists so resolving a board's library never costs a query per inherited id:
|
|
72
|
+
* the merge reads the whole tier, and the suppression list joins against exactly the ids it
|
|
73
|
+
* holds tombstones for. An empty `ids` is a no-op returning `[]`, never a full-table read.
|
|
74
|
+
*/
|
|
75
|
+
listByIds(accountId: string, ids: string[]): Promise<AccountRiskPolicy[]>;
|
|
76
|
+
/** Create or replace a policy (keyed by id). */
|
|
77
|
+
upsert(accountId: string, policy: AccountRiskPolicy): Promise<void>;
|
|
78
|
+
/** Remove a policy by id (no-op if absent). */
|
|
79
|
+
remove(accountId: string, id: string): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* What a board is HIDING from the account tier: one row per suppressed policy id.
|
|
83
|
+
*
|
|
84
|
+
* A narrow table of its own rather than a tombstone in the policy table, which is the shape the
|
|
85
|
+
* fragment and foundational-service libraries use. Their tombstone earns its place by doing a
|
|
86
|
+
* SECOND job (marking a row removed upstream by a repo sync), and it costs them a rule that a
|
|
87
|
+
* suppression row must never win a merge as an empty override. A risk policy has no upstream sync
|
|
88
|
+
* and ~20 NOT NULL numeric columns, so a tombstone here would mean inventing ceilings for a row
|
|
89
|
+
* that exists only to be absent — and "restore" is then a plain DELETE of a row that asserted one
|
|
90
|
+
* thing, rather than a hard-delete rule protecting against reviving a hollow policy.
|
|
91
|
+
*/
|
|
92
|
+
export interface RiskPolicySuppressionRepository {
|
|
93
|
+
/** The account policy ids this board hides. */
|
|
94
|
+
list(workspaceId: string): Promise<string[]>;
|
|
95
|
+
/** Hide an account policy id. Idempotent: hiding an already-hidden id is a no-op. */
|
|
96
|
+
add(workspaceId: string, policyId: string, at: number): Promise<void>;
|
|
97
|
+
/** Stop hiding an id (no-op if it was not hidden). */
|
|
98
|
+
remove(workspaceId: string, policyId: string): Promise<void>;
|
|
99
|
+
}
|
|
23
100
|
//# sourceMappingURL=risk-policy-repositories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"risk-policy-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/risk-policy-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"risk-policy-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/risk-policy-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAErE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,qBAAqB,CAAC,CAAA;AAUrF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,yBAAyB;IACxC,wEAAwE;IACxE,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;IAChE,+EAA+E;IAC/E,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAChD;;;;;;;;;OASG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;CACpF;AAED,MAAM,WAAW,oBAAqB,SAAQ,yBAAyB;IACrE;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,8FAA8F;IAC9F,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qEAAqE;IACrE,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACrE,6FAA6F;IAC7F,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACrD;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACzE,gDAAgD;IAChD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,+CAA+C;IAC/C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,+BAA+B;IAC9C,+CAA+C;IAC/C,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC5C,qFAAqF;IACrF,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrE,sDAAsD;IACtD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.294.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.58",
|
|
28
28
|
"yaml": "^2.9.0",
|
|
29
|
-
"@cat-factory/contracts": "0.
|
|
29
|
+
"@cat-factory/contracts": "0.303.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@stryker-mutator/core": "9.6.1",
|