@htilabs/platform-common-models 0.22.0 → 0.23.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/authz/index.cjs +539 -0
- package/dist/authz/index.cjs.map +1 -0
- package/dist/authz/index.d.cts +210 -0
- package/dist/authz/index.d.ts +210 -0
- package/dist/authz/index.js +507 -0
- package/dist/authz/index.js.map +1 -0
- package/dist/constants/index.d.cts +2 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/cvcs/index.cjs +647 -353
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +658 -362
- package/dist/cvcs/index.d.ts +658 -362
- package/dist/cvcs/index.js +647 -353
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +1 -9
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +7 -15
- package/dist/enums/index.d.ts +7 -15
- package/dist/enums/index.js +1 -9
- package/dist/enums/index.js.map +1 -1
- package/dist/{platform-auth-CvAYFVhK.d.cts → ic-DpKrdgQP.d.cts} +1 -78
- package/dist/{platform-auth-CvAYFVhK.d.ts → ic-DpKrdgQP.d.ts} +1 -78
- package/dist/index.cjs +899 -362
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +893 -362
- package/dist/index.js.map +1 -1
- package/dist/platform-auth-B49Ly57B.d.cts +78 -0
- package/dist/platform-auth-B49Ly57B.d.ts +78 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -1
- package/src/__sot__/README.md +3 -1
- package/src/__sot__/adminRoles.pin.json +122 -0
- package/src/__sot__/adminRoles.published.json +77 -0
- package/src/__sot__/coreFunctionFields.ts +16 -0
- package/src/__sot__/coreFunctions.pin.json +114 -1
- package/src/__sot__/roleFields.ts +137 -0
- package/src/__sot__/userRoles.pin.json +174 -0
- package/src/__sot__/userRoles.published.json +103 -0
- package/src/__tests__/__snapshots__/cvc-sot.snap +5 -5
- package/src/__tests__/admin-roles-canon.test.ts +80 -0
- package/src/__tests__/authz-resolve.test.ts +712 -0
- package/src/__tests__/core-functions-canon.test.ts +62 -12
- package/src/__tests__/cvc-sot-snapshot.test.ts +12 -4
- package/src/__tests__/cvc-status-parser.test.ts +1 -1
- package/src/__tests__/cvc-structural.test.ts +3 -3
- package/src/__tests__/role-vocab-gate.ts +279 -0
- package/src/__tests__/user-roles-canon.test.ts +104 -0
- package/src/authz/index.ts +9 -0
- package/src/authz/resolveEffectiveFunctions.ts +454 -0
- package/src/cvcs/adminRoles.v2.0.0.json +197 -0
- package/src/cvcs/{coreFunctions.v1.2.0.json → coreFunctions.v1.3.0.json} +357 -200
- package/src/cvcs/index.ts +3 -3
- package/src/cvcs/userRoles.v2.0.0.json +296 -0
- package/src/generated/coreFunctionsEvaluable.ts +101 -0
- package/src/generated/cvc-enums.ts +7 -15
- package/src/index.ts +4 -0
- package/src/cvcs/adminRoles.v1.0.0.json +0 -153
- package/src/cvcs/userRoles.v1.0.0.json +0 -203
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @htilabs/platform-common-models — Platform Authorization Constants
|
|
3
|
+
*
|
|
4
|
+
* Enums and labels for the platform role/function permission model.
|
|
5
|
+
* Includes permission states, share view levels, tool codes, role levels,
|
|
6
|
+
* and function implementation statuses.
|
|
7
|
+
*
|
|
8
|
+
* Source: PLATFORM_AUTH_SPEC.md Sections 5 + 6
|
|
9
|
+
*/
|
|
10
|
+
declare const PERMISSION_STATE: {
|
|
11
|
+
/** Role can always perform this function (mandatory, cannot disable). */
|
|
12
|
+
readonly ALWAYS: "ALWAYS";
|
|
13
|
+
/** Default On — user can opt off. */
|
|
14
|
+
readonly PREF_YES: "PREF_YES";
|
|
15
|
+
/** Default Off — user can opt in. */
|
|
16
|
+
readonly PREF_NO: "PREF_NO";
|
|
17
|
+
/** Role is explicitly barred from this function. */
|
|
18
|
+
readonly NEVER: "NEVER";
|
|
19
|
+
};
|
|
20
|
+
type PermissionStateValue = (typeof PERMISSION_STATE)[keyof typeof PERMISSION_STATE];
|
|
21
|
+
declare const PERMISSION_STATE_VALUES: readonly ["ALWAYS", "PREF_YES", "PREF_NO", "NEVER"];
|
|
22
|
+
declare const PERMISSION_STATE_LABELS: Record<PermissionStateValue, string>;
|
|
23
|
+
/** UI display metadata for permission states (colors, icons). */
|
|
24
|
+
declare const PERMISSION_STATE_DISPLAY: Record<PermissionStateValue, {
|
|
25
|
+
label: string;
|
|
26
|
+
color: string;
|
|
27
|
+
bgColor: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
}>;
|
|
30
|
+
declare const SHARE_VIEW: {
|
|
31
|
+
/** System metadata only (partial access). */
|
|
32
|
+
readonly SYS_INFO: "sys_info";
|
|
33
|
+
/** Full case/record content. */
|
|
34
|
+
readonly ALL: "all";
|
|
35
|
+
/** No data access. */
|
|
36
|
+
readonly NONE: "none";
|
|
37
|
+
};
|
|
38
|
+
type ShareViewValue = (typeof SHARE_VIEW)[keyof typeof SHARE_VIEW];
|
|
39
|
+
declare const SHARE_VIEW_VALUES: readonly ["sys_info", "all", "none"];
|
|
40
|
+
declare const SHARE_VIEW_LABELS: Record<ShareViewValue, string>;
|
|
41
|
+
declare const PLATFORM_TOOL: {
|
|
42
|
+
readonly PAVE: "PAVE";
|
|
43
|
+
readonly ECHO: "ECHO";
|
|
44
|
+
readonly LEADS: "LEADS";
|
|
45
|
+
readonly THREAD: "THREAD";
|
|
46
|
+
readonly TRAIL: "TRAIL";
|
|
47
|
+
readonly PLATFORM: "PLATFORM";
|
|
48
|
+
};
|
|
49
|
+
type PlatformToolValue = (typeof PLATFORM_TOOL)[keyof typeof PLATFORM_TOOL];
|
|
50
|
+
declare const PLATFORM_TOOL_VALUES: readonly ["PAVE", "ECHO", "LEADS", "THREAD", "TRAIL", "PLATFORM"];
|
|
51
|
+
declare const PLATFORM_TOOL_LABELS: Record<PlatformToolValue, string>;
|
|
52
|
+
declare const ROLE_LEVEL: {
|
|
53
|
+
/** User-facing roles (staff, volunteers, practitioners). */
|
|
54
|
+
readonly OPERATIONAL: "operational";
|
|
55
|
+
/** Agency-level admin roles. */
|
|
56
|
+
readonly AGENCY: "agency";
|
|
57
|
+
/** Team-level admin roles. */
|
|
58
|
+
readonly TEAM: "team";
|
|
59
|
+
/** HTI-wide platform admin. */
|
|
60
|
+
readonly PLATFORM: "platform";
|
|
61
|
+
/** External governance/oversight roles. */
|
|
62
|
+
readonly OVERSIGHT: "oversight";
|
|
63
|
+
};
|
|
64
|
+
type RoleLevelValue = (typeof ROLE_LEVEL)[keyof typeof ROLE_LEVEL];
|
|
65
|
+
declare const ROLE_LEVEL_VALUES: readonly ["operational", "agency", "team", "platform", "oversight"];
|
|
66
|
+
declare const ROLE_LEVEL_LABELS: Record<RoleLevelValue, string>;
|
|
67
|
+
declare const FUNCTION_STATUS: {
|
|
68
|
+
readonly NOT_STARTED: "Not started";
|
|
69
|
+
readonly DEFINED_NEW: "Defined; new function";
|
|
70
|
+
readonly DEFINED_EXISTING: "Defined; existing PAVE function";
|
|
71
|
+
readonly FUNCTIONAL: "Functional on all apps";
|
|
72
|
+
readonly FUTURE: "Future function (not v1)";
|
|
73
|
+
};
|
|
74
|
+
type FunctionStatusValue = (typeof FUNCTION_STATUS)[keyof typeof FUNCTION_STATUS];
|
|
75
|
+
declare const FUNCTION_STATUS_VALUES: readonly ["Not started", "Defined; new function", "Defined; existing PAVE function", "Functional on all apps", "Future function (not v1)"];
|
|
76
|
+
declare const FUNCTION_STATUS_LABELS: Record<FunctionStatusValue, string>;
|
|
77
|
+
|
|
78
|
+
export { FUNCTION_STATUS as F, PERMISSION_STATE as P, ROLE_LEVEL as R, SHARE_VIEW as S, FUNCTION_STATUS_LABELS as a, FUNCTION_STATUS_VALUES as b, type FunctionStatusValue as c, PERMISSION_STATE_DISPLAY as d, PERMISSION_STATE_LABELS as e, PERMISSION_STATE_VALUES as f, PLATFORM_TOOL as g, PLATFORM_TOOL_LABELS as h, PLATFORM_TOOL_VALUES as i, type PermissionStateValue as j, type PlatformToolValue as k, ROLE_LEVEL_LABELS as l, ROLE_LEVEL_VALUES as m, type RoleLevelValue as n, SHARE_VIEW_LABELS as o, SHARE_VIEW_VALUES as p, type ShareViewValue as q };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @htilabs/platform-common-models — Platform Authorization Constants
|
|
3
|
+
*
|
|
4
|
+
* Enums and labels for the platform role/function permission model.
|
|
5
|
+
* Includes permission states, share view levels, tool codes, role levels,
|
|
6
|
+
* and function implementation statuses.
|
|
7
|
+
*
|
|
8
|
+
* Source: PLATFORM_AUTH_SPEC.md Sections 5 + 6
|
|
9
|
+
*/
|
|
10
|
+
declare const PERMISSION_STATE: {
|
|
11
|
+
/** Role can always perform this function (mandatory, cannot disable). */
|
|
12
|
+
readonly ALWAYS: "ALWAYS";
|
|
13
|
+
/** Default On — user can opt off. */
|
|
14
|
+
readonly PREF_YES: "PREF_YES";
|
|
15
|
+
/** Default Off — user can opt in. */
|
|
16
|
+
readonly PREF_NO: "PREF_NO";
|
|
17
|
+
/** Role is explicitly barred from this function. */
|
|
18
|
+
readonly NEVER: "NEVER";
|
|
19
|
+
};
|
|
20
|
+
type PermissionStateValue = (typeof PERMISSION_STATE)[keyof typeof PERMISSION_STATE];
|
|
21
|
+
declare const PERMISSION_STATE_VALUES: readonly ["ALWAYS", "PREF_YES", "PREF_NO", "NEVER"];
|
|
22
|
+
declare const PERMISSION_STATE_LABELS: Record<PermissionStateValue, string>;
|
|
23
|
+
/** UI display metadata for permission states (colors, icons). */
|
|
24
|
+
declare const PERMISSION_STATE_DISPLAY: Record<PermissionStateValue, {
|
|
25
|
+
label: string;
|
|
26
|
+
color: string;
|
|
27
|
+
bgColor: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
}>;
|
|
30
|
+
declare const SHARE_VIEW: {
|
|
31
|
+
/** System metadata only (partial access). */
|
|
32
|
+
readonly SYS_INFO: "sys_info";
|
|
33
|
+
/** Full case/record content. */
|
|
34
|
+
readonly ALL: "all";
|
|
35
|
+
/** No data access. */
|
|
36
|
+
readonly NONE: "none";
|
|
37
|
+
};
|
|
38
|
+
type ShareViewValue = (typeof SHARE_VIEW)[keyof typeof SHARE_VIEW];
|
|
39
|
+
declare const SHARE_VIEW_VALUES: readonly ["sys_info", "all", "none"];
|
|
40
|
+
declare const SHARE_VIEW_LABELS: Record<ShareViewValue, string>;
|
|
41
|
+
declare const PLATFORM_TOOL: {
|
|
42
|
+
readonly PAVE: "PAVE";
|
|
43
|
+
readonly ECHO: "ECHO";
|
|
44
|
+
readonly LEADS: "LEADS";
|
|
45
|
+
readonly THREAD: "THREAD";
|
|
46
|
+
readonly TRAIL: "TRAIL";
|
|
47
|
+
readonly PLATFORM: "PLATFORM";
|
|
48
|
+
};
|
|
49
|
+
type PlatformToolValue = (typeof PLATFORM_TOOL)[keyof typeof PLATFORM_TOOL];
|
|
50
|
+
declare const PLATFORM_TOOL_VALUES: readonly ["PAVE", "ECHO", "LEADS", "THREAD", "TRAIL", "PLATFORM"];
|
|
51
|
+
declare const PLATFORM_TOOL_LABELS: Record<PlatformToolValue, string>;
|
|
52
|
+
declare const ROLE_LEVEL: {
|
|
53
|
+
/** User-facing roles (staff, volunteers, practitioners). */
|
|
54
|
+
readonly OPERATIONAL: "operational";
|
|
55
|
+
/** Agency-level admin roles. */
|
|
56
|
+
readonly AGENCY: "agency";
|
|
57
|
+
/** Team-level admin roles. */
|
|
58
|
+
readonly TEAM: "team";
|
|
59
|
+
/** HTI-wide platform admin. */
|
|
60
|
+
readonly PLATFORM: "platform";
|
|
61
|
+
/** External governance/oversight roles. */
|
|
62
|
+
readonly OVERSIGHT: "oversight";
|
|
63
|
+
};
|
|
64
|
+
type RoleLevelValue = (typeof ROLE_LEVEL)[keyof typeof ROLE_LEVEL];
|
|
65
|
+
declare const ROLE_LEVEL_VALUES: readonly ["operational", "agency", "team", "platform", "oversight"];
|
|
66
|
+
declare const ROLE_LEVEL_LABELS: Record<RoleLevelValue, string>;
|
|
67
|
+
declare const FUNCTION_STATUS: {
|
|
68
|
+
readonly NOT_STARTED: "Not started";
|
|
69
|
+
readonly DEFINED_NEW: "Defined; new function";
|
|
70
|
+
readonly DEFINED_EXISTING: "Defined; existing PAVE function";
|
|
71
|
+
readonly FUNCTIONAL: "Functional on all apps";
|
|
72
|
+
readonly FUTURE: "Future function (not v1)";
|
|
73
|
+
};
|
|
74
|
+
type FunctionStatusValue = (typeof FUNCTION_STATUS)[keyof typeof FUNCTION_STATUS];
|
|
75
|
+
declare const FUNCTION_STATUS_VALUES: readonly ["Not started", "Defined; new function", "Defined; existing PAVE function", "Functional on all apps", "Future function (not v1)"];
|
|
76
|
+
declare const FUNCTION_STATUS_LABELS: Record<FunctionStatusValue, string>;
|
|
77
|
+
|
|
78
|
+
export { FUNCTION_STATUS as F, PERMISSION_STATE as P, ROLE_LEVEL as R, SHARE_VIEW as S, FUNCTION_STATUS_LABELS as a, FUNCTION_STATUS_VALUES as b, type FunctionStatusValue as c, PERMISSION_STATE_DISPLAY as d, PERMISSION_STATE_LABELS as e, PERMISSION_STATE_VALUES as f, PLATFORM_TOOL as g, PLATFORM_TOOL_LABELS as h, PLATFORM_TOOL_VALUES as i, type PermissionStateValue as j, type PlatformToolValue as k, ROLE_LEVEL_LABELS as l, ROLE_LEVEL_VALUES as m, type RoleLevelValue as n, SHARE_VIEW_LABELS as o, SHARE_VIEW_VALUES as p, type ShareViewValue as q };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { j as AccommodationValue, m as AgeBinReportingValue, n as AppScopeValue, o as ApparentAgeValue, cw as DataQualityValue, cD as FormStatusValue, cE as FormTypeValue, cF as IC13Category, cH as IC13Value, cI as IC22Value, cJ as IC23Value, cK as IC24Value, cL as IC25Value, cM as IC49ReferralOutcomeValue, cN as IC49ReferralVerificationValue, cO as IC49Value, cP as IC4Value, cR as IC56Value, cS as IC57Value, cU as IC58Value, cV as IC59Value, cW as IC5Value, dM as IncidentInvolvementRoleValue, dN as IncidentParticipationRoleValue, dO as InteractionTypeValue, dR as MinorAdultStatusValue, dZ as PersonDisplayCategoryValue, d_ as PersonRoleValue, d$ as PersonTypeValue, e5 as QuestionFormatValue, e6 as QuickStartTemplateId, ef as RecordStateValue, eh as RelationshipConcernValue, ei as RelationshipDynamicValue, ep as SessionStateValue, eq as SubmissionStateValue, eu as UserStatusValue } from '../ic-DpKrdgQP.cjs';
|
|
2
|
+
import { k as PlatformToolValue, c as FunctionStatusValue, n as RoleLevelValue, q as ShareViewValue, j as PermissionStateValue } from '../platform-auth-B49Ly57B.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @htilabs/platform-common-models — Platform Authorization Types
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { j as AccommodationValue, m as AgeBinReportingValue, n as AppScopeValue, o as ApparentAgeValue, cw as DataQualityValue, cD as FormStatusValue, cE as FormTypeValue, cF as IC13Category, cH as IC13Value, cI as IC22Value, cJ as IC23Value, cK as IC24Value, cL as IC25Value, cM as IC49ReferralOutcomeValue, cN as IC49ReferralVerificationValue, cO as IC49Value, cP as IC4Value, cR as IC56Value, cS as IC57Value, cU as IC58Value, cV as IC59Value, cW as IC5Value, dM as IncidentInvolvementRoleValue, dN as IncidentParticipationRoleValue, dO as InteractionTypeValue, dR as MinorAdultStatusValue, dZ as PersonDisplayCategoryValue, d_ as PersonRoleValue, d$ as PersonTypeValue, e5 as QuestionFormatValue, e6 as QuickStartTemplateId, ef as RecordStateValue, eh as RelationshipConcernValue, ei as RelationshipDynamicValue, ep as SessionStateValue, eq as SubmissionStateValue, eu as UserStatusValue } from '../ic-DpKrdgQP.js';
|
|
2
|
+
import { k as PlatformToolValue, c as FunctionStatusValue, n as RoleLevelValue, q as ShareViewValue, j as PermissionStateValue } from '../platform-auth-B49Ly57B.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @htilabs/platform-common-models — Platform Authorization Types
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htilabs/platform-common-models",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Shared constants, types, and models for HTI Labs applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
"types": "./dist/information-scope/index.d.ts",
|
|
67
67
|
"import": "./dist/information-scope/index.js",
|
|
68
68
|
"require": "./dist/information-scope/index.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./authz": {
|
|
71
|
+
"types": "./dist/authz/index.d.ts",
|
|
72
|
+
"import": "./dist/authz/index.js",
|
|
73
|
+
"require": "./dist/authz/index.cjs"
|
|
69
74
|
}
|
|
70
75
|
},
|
|
71
76
|
"files": [
|
package/src/__sot__/README.md
CHANGED
|
@@ -11,8 +11,10 @@ live in other repos:
|
|
|
11
11
|
|---|---|---|
|
|
12
12
|
| `cvcIndex.pin.json` | `htilabstech/prototype` · `Final CVCs/CVC_INDEX.md` | The CVC **number space** — which number belongs to which vocabulary. **Authoritative.** A yaml's self-declared number is not. |
|
|
13
13
|
| `coreIndicators.pin.json` | `htilabstech/prototype` · `data/core_indicators.yaml` | The indicator **catalog** — which indicator codes legitimately exist, **and what the catalog says about each one** (label · definition · family · polarity · severity · is_alert · alert_when, verbatim). |
|
|
14
|
+
| `userRoles.pin.json` | `htilabstech/prototype` · `data/cvcs/core_user_role.yaml` | The CVC-135 **user-role codeset** — which operational roles exist, **what canon says about each one** (label · definition · display_label · platform_tools · flags, verbatim) and canon's **legacy codes** (`legacy_codes`, old → live). `GATE J` (`user-roles-canon.test.ts`) asserts `userRoles.v*.json` restates every one. **Refreshing this pin is half a step:** the SOT JSON is generated from the same yaml by `scripts/gen-user-roles.py <prototype root>` — run it in the same change against the same prototype SHA, bumping the SOT version per `CLAUDE.md`, or GATE J fails (correctly). The generator also maintains `userRoles.published.json`, the append-only ledger of every published key → code, every re-key (`renamed`), every legacy alias (`aliases`) and every withdrawn code (`retired`), which GATE J asserts pair by pair. |
|
|
15
|
+
| `adminRoles.pin.json` | `htilabstech/prototype` · `data/cvcs/core_admin_role.yaml` | The CVC-134 **admin-role codeset** (the control-plane axis) — which admin roles exist, what canon says about each one (label · definition · display_label · required · required_when · reach · scope · plain_language, verbatim) and canon's `legacy_codes`. `GATE K` (`admin-roles-canon.test.ts`) asserts `adminRoles.v*.json` restates every one. Same half-a-step rule as `userRoles`: regenerate with `scripts/gen-admin-roles.py <prototype root>` in the same change; it maintains `adminRoles.published.json`. Both role pins share one projection, `roleFields.ts`, and both generators share one implementation, `scripts/role_vocab.py`; the gates share `role-vocab-gate.ts`. |
|
|
14
16
|
| `scoringEmits.pin.json` | `htilabstech/hti-scoring` · `weights/risk.weights.json` → `emits_by_code` | What the risk pipeline actually **consumes** — what CVC-136 must be able to express. |
|
|
15
|
-
| `coreFunctions.pin.json` | `htilabstech/prototype` · `data/cvcs/core_functions.yaml` | The CVC-133 **function registry** — which permissionable functions exist, **and what canon says about each one** (label · status · category · platform relevance · user/admin relevance · retired, verbatim). The yaml is itself generated there from the Notion export ("the export wins"). `GATE I` (`core-functions-canon.test.ts`) asserts `coreFunctions.v*.json` restates every one; `coreFunctionFields.ts` holds the shared projection + the posture-suffix composition. **Refreshing this pin is half a step:** the SOT JSON is generated from the same yaml by `scripts/gen-core-functions.py <prototype root>` — run it in the same change **against the same prototype checkout at the same SHA** (the pin reads the working tree; the generator reads `origin/main` after a fetch — keep them equal), bumping the SOT version per `CLAUDE.md`, or GATE I fails (correctly). The generator also maintains `coreFunctions.published.json`, the append-only ledger of every published key → code that GATE I asserts pair by pair. |
|
|
17
|
+
| `coreFunctions.pin.json` | `htilabstech/prototype` · `data/cvcs/core_functions.yaml` | The CVC-133 **function registry** — which permissionable functions exist, **and what canon says about each one** (label · status · category · platform relevance · user/admin relevance · v1 · retired, verbatim; since SOT 1.3.0 `v1` / `retired` are also structured booleans on every SOT entry, read by the shared authorization resolver). The yaml is itself generated there from the Notion export ("the export wins"). `GATE I` (`core-functions-canon.test.ts`) asserts `coreFunctions.v*.json` restates every one; `coreFunctionFields.ts` holds the shared projection + the posture-suffix composition. **Refreshing this pin is half a step:** the SOT JSON is generated from the same yaml by `scripts/gen-core-functions.py <prototype root>` — run it in the same change **against the same prototype checkout at the same SHA** (the pin reads the working tree; the generator reads `origin/main` after a fetch — keep them equal), bumping the SOT version per `CLAUDE.md`, or GATE I fails (correctly). The generator also maintains `coreFunctions.published.json`, the append-only ledger of every published key → code that GATE I asserts pair by pair. |
|
|
16
18
|
|
|
17
19
|
(Notion is the fourth SOT: **ratification**. It has no pin because it is a human
|
|
18
20
|
process. Items awaiting it carry `_status.vocabStatus:
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sourceRepo": "htilabstech/prototype",
|
|
3
|
+
"sourceFile": "data/cvcs/core_admin_role.yaml",
|
|
4
|
+
"sourceSha": "d85f05b",
|
|
5
|
+
"codes": [
|
|
6
|
+
"AUD",
|
|
7
|
+
"CIRO",
|
|
8
|
+
"DATA-ADM",
|
|
9
|
+
"GOV-AUD",
|
|
10
|
+
"MEM-ADM",
|
|
11
|
+
"PLT-ADM",
|
|
12
|
+
"PLT-SUP",
|
|
13
|
+
"SUP",
|
|
14
|
+
"TEAM-ADM",
|
|
15
|
+
"TRAIN-ADM"
|
|
16
|
+
],
|
|
17
|
+
"roleFields": {
|
|
18
|
+
"AUD": {
|
|
19
|
+
"label": "Compliance / Auditor",
|
|
20
|
+
"definition": "Read-only audit + de-identified compliance workflows.",
|
|
21
|
+
"display_label": null,
|
|
22
|
+
"required": null,
|
|
23
|
+
"required_when": null,
|
|
24
|
+
"reach": "account",
|
|
25
|
+
"scope": null,
|
|
26
|
+
"plain_language": null
|
|
27
|
+
},
|
|
28
|
+
"CIRO": {
|
|
29
|
+
"label": "Criminal Intelligence Review Officer",
|
|
30
|
+
"definition": "Control-plane governance designation establishing accountability for CI handling: validation rules, periodic review, purge/retention, oversight. Does NOT imply broad case-content visibility. The CI → evidence export approval FUNCTION is exercised by a CIRO (see cross_references.functions).",
|
|
31
|
+
"display_label": "Intel Review Officer",
|
|
32
|
+
"required": null,
|
|
33
|
+
"required_when": "leads_ci_enabled",
|
|
34
|
+
"reach": "account",
|
|
35
|
+
"scope": null,
|
|
36
|
+
"plain_language": null
|
|
37
|
+
},
|
|
38
|
+
"DATA-ADM": {
|
|
39
|
+
"label": "Data & Reporting Admin",
|
|
40
|
+
"definition": "Echo / reporting admin — grant reporting, data exports, reporting configuration — WITHOUT broader account governance.",
|
|
41
|
+
"display_label": null,
|
|
42
|
+
"required": null,
|
|
43
|
+
"required_when": null,
|
|
44
|
+
"reach": "account",
|
|
45
|
+
"scope": null,
|
|
46
|
+
"plain_language": null
|
|
47
|
+
},
|
|
48
|
+
"GOV-AUD": {
|
|
49
|
+
"label": "Governance Auditor",
|
|
50
|
+
"definition": "Opt-in governance spot checks / QA review; redacted-by-default surfaces.",
|
|
51
|
+
"display_label": null,
|
|
52
|
+
"required": null,
|
|
53
|
+
"required_when": null,
|
|
54
|
+
"reach": "account",
|
|
55
|
+
"scope": null,
|
|
56
|
+
"plain_language": null
|
|
57
|
+
},
|
|
58
|
+
"MEM-ADM": {
|
|
59
|
+
"label": "Account Admin (Member Administrator)",
|
|
60
|
+
"definition": "The member-account administrator (Account Admin / \"Member Administrator\"). Required role — at least one per member account.",
|
|
61
|
+
"display_label": "Account Admin",
|
|
62
|
+
"required": true,
|
|
63
|
+
"required_when": null,
|
|
64
|
+
"reach": "account",
|
|
65
|
+
"scope": null,
|
|
66
|
+
"plain_language": null
|
|
67
|
+
},
|
|
68
|
+
"PLT-ADM": {
|
|
69
|
+
"label": "Platform Owner & Admin",
|
|
70
|
+
"definition": "HTI Labs platform control-plane governance.",
|
|
71
|
+
"display_label": "Platform Admin",
|
|
72
|
+
"required": null,
|
|
73
|
+
"required_when": null,
|
|
74
|
+
"reach": "platform",
|
|
75
|
+
"scope": null,
|
|
76
|
+
"plain_language": null
|
|
77
|
+
},
|
|
78
|
+
"PLT-SUP": {
|
|
79
|
+
"label": "Platform Support Admin",
|
|
80
|
+
"definition": "Routine HTI support / debugging (prefer over PLT-ADM for support).",
|
|
81
|
+
"display_label": "Support Admin",
|
|
82
|
+
"required": null,
|
|
83
|
+
"required_when": null,
|
|
84
|
+
"reach": "platform",
|
|
85
|
+
"scope": null,
|
|
86
|
+
"plain_language": null
|
|
87
|
+
},
|
|
88
|
+
"SUP": {
|
|
89
|
+
"label": "Supervisor",
|
|
90
|
+
"definition": "A role a person holds over the specific people they supervise — the seats whose `supervised_by` names them (Crysta 2026-10-02: \"A supervisor is a role that a user takes on over those users that they supervise\"; it relates to people, not to a team, and it is still a role). Day-to-day case workflow oversight for those people: operational triage, case assignment, the needs-action flags on their work, and the notices about items that belong to one of them (a claimed mandatory-report flag that sits unsent goes to that person's supervisor). WITHOUT account governance powers or destructive enforcement; deliberately NARROWER than TEAM-ADM. Always: manage case escalation / needs-action flags, assign/reassign case ownership. Case-record access is NOT required of the role; an account's Member Admin may enable it (Crysta 2026-10-02). Not relevant to the role (SUPERVISOR-RULING 2026-10-07, off the role): team membership, role assignment, training gates — those are team and account setup (Team Admin · Member Admin), not supervision of people. NEVER: user management, sharing configuration, team structure & scoping, bulk transfer, purge, suspend, API keys, platform authorization model. Not a generalized admin or support role. The people supervised may sit on any team or none; supervision does not follow team or account lines.",
|
|
91
|
+
"display_label": null,
|
|
92
|
+
"required": null,
|
|
93
|
+
"required_when": null,
|
|
94
|
+
"reach": "supervised_people",
|
|
95
|
+
"scope": "people",
|
|
96
|
+
"plain_language": "Oversees the WORK of the people they supervise."
|
|
97
|
+
},
|
|
98
|
+
"TEAM-ADM": {
|
|
99
|
+
"label": "Team Admin",
|
|
100
|
+
"definition": "Delegated, team-scoped admin used to operate one-to-many teams as workflow containers. Always: manage team membership + team workflow configuration. Optional-on: assign/reassign cases, manage training gates. Optional-off (delegable by MEM-ADM): user management, role assignment, bulk transfer. NEVER: team structure & admin scoping — so TEAM-ADM cannot expand or redefine its own scope.",
|
|
101
|
+
"display_label": null,
|
|
102
|
+
"required": null,
|
|
103
|
+
"required_when": null,
|
|
104
|
+
"reach": "team",
|
|
105
|
+
"scope": "team",
|
|
106
|
+
"plain_language": "Runs the team's SETUP."
|
|
107
|
+
},
|
|
108
|
+
"TRAIN-ADM": {
|
|
109
|
+
"label": "Training Admin",
|
|
110
|
+
"definition": "Agency-set role that configures training/certification requirements and gates (which modules a role or team must complete), manages training content, and reports on completion. Case-content posture: NONE. NOTE: the canonical Notion row is an empty stub (owner Ava Monte, created by Lauren DeLuca 2026-04-21) — definition drafted here from the codebook's own role-table entry and the training_gate_manage function bounds. ⚑ Crysta to confirm.",
|
|
111
|
+
"display_label": null,
|
|
112
|
+
"required": null,
|
|
113
|
+
"required_when": null,
|
|
114
|
+
"reach": "account",
|
|
115
|
+
"scope": null,
|
|
116
|
+
"plain_language": null
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"legacyCodes": {
|
|
120
|
+
"ACCT-ADM": "MEM-ADM"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_note": "Every key @htilabs/platform-common-models has ever published for admin_roles (CVC-134), with its segment-1 prefix. APPEND-ONLY: a published code never moves or changes meaning. A canon re-key (legacy_codes, old key published) moves the KEY onto the same prefix and is recorded under `renamed`; a canon legacy code this package never published is recorded under `aliases`; a withdrawn code is recorded under `retired` and never reused. Written by scripts/gen-admin-roles.py; read by it and by GATE K (src/__tests__/admin-roles-canon.test.ts). Do not hand-edit.",
|
|
3
|
+
"prefixes": {
|
|
4
|
+
"plt_adm": 1,
|
|
5
|
+
"plt_sup": 2,
|
|
6
|
+
"mem_adm": 3,
|
|
7
|
+
"team_adm": 4,
|
|
8
|
+
"aud": 5,
|
|
9
|
+
"data_adm": 6,
|
|
10
|
+
"gov_aud": 7,
|
|
11
|
+
"ciro": 8,
|
|
12
|
+
"sup": 9,
|
|
13
|
+
"train_adm": 10
|
|
14
|
+
},
|
|
15
|
+
"since": {
|
|
16
|
+
"plt_adm": "1.0.0",
|
|
17
|
+
"plt_sup": "1.0.0",
|
|
18
|
+
"mem_adm": "1.0.0",
|
|
19
|
+
"team_adm": "1.0.0",
|
|
20
|
+
"aud": "1.0.0",
|
|
21
|
+
"data_adm": "1.0.0",
|
|
22
|
+
"gov_aud": "1.0.0",
|
|
23
|
+
"ciro": "1.0.0",
|
|
24
|
+
"sup": "1.0.0",
|
|
25
|
+
"train_adm": "1.0.0"
|
|
26
|
+
},
|
|
27
|
+
"renamed": {},
|
|
28
|
+
"aliases": {
|
|
29
|
+
"acct_adm": {
|
|
30
|
+
"to": "mem_adm",
|
|
31
|
+
"canonical": "ACCT-ADM",
|
|
32
|
+
"version": "2.0.0"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"retired": {
|
|
36
|
+
"missingness_root": {
|
|
37
|
+
"code": "134-000-000-000-000-000-000",
|
|
38
|
+
"successor": null,
|
|
39
|
+
"reason": "missingness (canon declares none)",
|
|
40
|
+
"version": "2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"unknown": {
|
|
43
|
+
"code": "134-000-000-000-000-000-001",
|
|
44
|
+
"successor": null,
|
|
45
|
+
"reason": "missingness (canon declares none)",
|
|
46
|
+
"version": "2.0.0"
|
|
47
|
+
},
|
|
48
|
+
"anonymous": {
|
|
49
|
+
"code": "134-000-000-000-000-000-002",
|
|
50
|
+
"successor": null,
|
|
51
|
+
"reason": "missingness (canon declares none)",
|
|
52
|
+
"version": "2.0.0"
|
|
53
|
+
},
|
|
54
|
+
"data_not_collected": {
|
|
55
|
+
"code": "134-000-000-000-000-000-003",
|
|
56
|
+
"successor": null,
|
|
57
|
+
"reason": "missingness (canon declares none)",
|
|
58
|
+
"version": "2.0.0"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"supersededKeys": [
|
|
62
|
+
"missingness_root",
|
|
63
|
+
"unknown",
|
|
64
|
+
"anonymous",
|
|
65
|
+
"data_not_collected",
|
|
66
|
+
"plt_adm",
|
|
67
|
+
"plt_sup",
|
|
68
|
+
"mem_adm",
|
|
69
|
+
"team_adm",
|
|
70
|
+
"aud",
|
|
71
|
+
"data_adm",
|
|
72
|
+
"gov_aud",
|
|
73
|
+
"ciro",
|
|
74
|
+
"sup",
|
|
75
|
+
"train_adm"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
@@ -35,6 +35,7 @@ export const PROJECTED_FUNCTION_FIELDS = [
|
|
|
35
35
|
"platform_relevance",
|
|
36
36
|
"is_user_relevant",
|
|
37
37
|
"is_admin_relevant",
|
|
38
|
+
"v1",
|
|
38
39
|
"retired",
|
|
39
40
|
] as const;
|
|
40
41
|
|
|
@@ -50,6 +51,12 @@ export interface ProjectedFunctionFields {
|
|
|
50
51
|
readonly platform_relevance: readonly string[];
|
|
51
52
|
readonly is_user_relevant: boolean;
|
|
52
53
|
readonly is_admin_relevant: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Canon's per-row `v1` flag (required on every canon row). Restated as the
|
|
56
|
+
* SOT entry's structured `v1` since 1.3.0; the shared authorization resolver
|
|
57
|
+
* refuses a function unless canon says v1 && !retired.
|
|
58
|
+
*/
|
|
59
|
+
readonly v1: boolean;
|
|
53
60
|
/** Canon's first-class `retired: true` (2026-08-14 Phase 1); a tombstone in the SOT. */
|
|
54
61
|
readonly retired: boolean;
|
|
55
62
|
}
|
|
@@ -75,6 +82,14 @@ export function projectFunctionRow(
|
|
|
75
82
|
);
|
|
76
83
|
return v;
|
|
77
84
|
};
|
|
85
|
+
const requiredBool = (k: string): boolean => {
|
|
86
|
+
const v = row[k];
|
|
87
|
+
if (typeof v !== "boolean")
|
|
88
|
+
throw new Error(
|
|
89
|
+
`core_functions.yaml row ${String(row["code"])}: ${k} is not a boolean`,
|
|
90
|
+
);
|
|
91
|
+
return v;
|
|
92
|
+
};
|
|
78
93
|
const rel = row["platform_relevance"];
|
|
79
94
|
if (!Array.isArray(rel) || !rel.every((x) => typeof x === "string")) {
|
|
80
95
|
throw new Error(
|
|
@@ -89,6 +104,7 @@ export function projectFunctionRow(
|
|
|
89
104
|
platform_relevance: [...(rel as string[])],
|
|
90
105
|
is_user_relevant: bool("is_user_relevant"),
|
|
91
106
|
is_admin_relevant: bool("is_admin_relevant"),
|
|
107
|
+
v1: requiredBool("v1"),
|
|
92
108
|
retired: bool("retired"),
|
|
93
109
|
};
|
|
94
110
|
}
|