@lucern/sdk 0.2.0-alpha.6 → 0.2.0-alpha.7
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/.turbo/turbo-build.log +7 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +13 -0
- package/examples/README.md +69 -0
- package/examples/contradiction.ts +94 -0
- package/examples/investigation-context.ts +118 -0
- package/examples/questions-and-tasks.ts +55 -0
- package/examples/quickstart.ts +97 -0
- package/examples/shared.ts +318 -0
- package/examples/strict-public-types.ts +143 -0
- package/examples/worktree-lifecycle.ts +79 -0
- package/package.json +16 -58
- package/src/README.md +6 -0
- package/src/adminClient.ts +789 -0
- package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
- package/src/audiencesClient.ts +209 -0
- package/src/auditClient.ts +50 -0
- package/src/beliefsClient.ts +319 -0
- package/src/client.ts +2647 -0
- package/src/contextClient.ts +130 -0
- package/{dist/lib/platform/sdk/contextFacade.d.ts → src/contextFacade.ts} +6 -1
- package/src/contextPackCompiler.ts +828 -0
- package/src/contextPackSchema.ts +251 -0
- package/src/contextTypes.ts +153 -0
- package/src/contracts/api-enums.contract.ts +202 -0
- package/src/contracts/auth-session.contract.ts +109 -0
- package/src/contracts/context-pack.contract.ts +700 -0
- package/src/contracts/contextPack.ts +1 -0
- package/src/contracts/index.ts +10 -0
- package/src/contracts/lens-filter.contract.ts +183 -0
- package/src/contracts/lens-workflow.contract.ts +162 -0
- package/src/contracts/lensFilter.ts +1 -0
- package/src/contracts/lensWorkflow.ts +1 -0
- package/src/contracts/mcp-tools.contract.ts +3636 -0
- package/src/contracts/mcpTools.ts +1 -0
- package/src/contracts/prompt.contract.ts +50 -0
- package/src/contracts/prompt.ts +1 -0
- package/src/contracts/sdk-tools.contract.ts +1457 -0
- package/src/contracts/sdkTools.ts +1 -0
- package/src/contracts/workflow-runtime.contract.ts +440 -0
- package/src/contracts/workflowRuntime.ts +1 -0
- package/src/controlObjectOwnership.ts +286 -0
- package/src/coreClient.ts +570 -0
- package/src/customTools.ts +398 -0
- package/src/decisionsClient.ts +286 -0
- package/src/domainContext.ts +15 -0
- package/src/events.ts +531 -0
- package/src/eventsCore.ts +168 -0
- package/src/facade/beliefs.ts +83 -0
- package/src/facade/context.ts +110 -0
- package/src/facade/contradictions.ts +29 -0
- package/src/facade/edges.ts +30 -0
- package/src/facade/events.ts +23 -0
- package/src/facade/evidence.ts +41 -0
- package/src/facade/graph.ts +38 -0
- package/src/facade/identity.ts +16 -0
- package/src/facade/ontologies.ts +34 -0
- package/src/facade/questions.ts +59 -0
- package/src/facade/search.ts +16 -0
- package/src/facade/tasks.ts +37 -0
- package/src/facade/topics.ts +42 -0
- package/src/facade/webhooks.ts +58 -0
- package/src/facade/worktrees.ts +51 -0
- package/src/gatewayFacades.ts +1666 -0
- package/src/graphClient.ts +529 -0
- package/src/harnessClient.ts +585 -0
- package/src/identityClient.ts +278 -0
- package/src/learningClient.ts +95 -0
- package/src/mcpParityClient.ts +240 -0
- package/src/mcpParitySurface.ts +70 -0
- package/src/ontologyClient.ts +275 -0
- package/src/packRuntime.ts +3 -0
- package/src/packsClient.ts +260 -0
- package/src/policyClient.ts +572 -0
- package/src/realtime/index.ts +51 -0
- package/src/realtime/refs.ts +17 -0
- package/src/reportsClient.ts +99 -0
- package/src/schemaClient.ts +129 -0
- package/src/sdkSurface.ts +190 -0
- package/src/topicsClient.ts +243 -0
- package/src/types.ts +807 -0
- package/src/workflowClient.ts +826 -0
- package/tsconfig.json +9 -0
- package/dist/.generated +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/lib/platform/auth/credentials.d.ts +0 -5
- package/dist/lib/platform/auth/credentials.js +0 -40
- package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
- package/dist/lib/platform/sdk/audiencesClient.js +0 -111
- package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
- package/dist/lib/platform/sdk/auditClient.js +0 -21
- package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.d.ts +0 -2369
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextFacade.js +0 -10
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.d.ts +0 -83
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
- package/dist/lib/platform/sdk/decisionsClient.js +0 -129
- package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
- package/dist/lib/platform/sdk/domainContext.js +0 -1
- package/dist/lib/platform/sdk/events.d.ts +0 -176
- package/dist/lib/platform/sdk/events.js +0 -261
- package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
- package/dist/lib/platform/sdk/eventsCore.js +0 -13
- package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.js +0 -49
- package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
- package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
- package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
- package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
- package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
- package/dist/lib/platform/sdk/ontologyClient.js +0 -161
- package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
- package/dist/lib/platform/sdk/packRuntime.js +0 -1
- package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
- package/dist/lib/platform/sdk/policyClient.js +0 -277
- package/dist/lib/platform/sdk/promptCatalog.js +0 -1
- package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
- package/dist/lib/platform/sdk/reportsClient.js +0 -64
- package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
- package/dist/lib/platform/sdk/schemaClient.js +0 -71
- package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
- package/dist/lib/platform/sdk/sdkSurface.js +0 -140
- package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.d.ts +0 -692
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
- package/dist/lib/platform/sdk/workflowClient.js +0 -366
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
- package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
- package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
- package/dist/lucern/contracts/src/auth.contract.js +0 -57
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
- package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
- package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
- package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/events-types.contract.js +0 -8
- package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
- package/dist/lucern/contracts/src/events.contract.js +0 -159
- package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
- package/dist/lucern/contracts/src/gateway.contract.js +0 -19
- package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
- package/dist/lucern/contracts/src/ids.contract.js +0 -24
- package/dist/lucern/contracts/src/index.d.ts +0 -29
- package/dist/lucern/contracts/src/index.js +0 -29
- package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
- package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
- package/dist/lucern/contracts/src/prompt.contract.d.ts +0 -24
- package/dist/lucern/contracts/src/prompt.contract.js +0 -24
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
- package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
- package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
- package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
- package/dist/realtime-refs.d.ts +0 -1
- package/dist/realtime-refs.js +0 -1
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +0 -1
- /package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +0 -0
- /package/{dist/lib/platform/sdk/promptCatalog.d.ts → src/promptCatalog.ts} +0 -0
- /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/** All recognized control object kinds in the ownership model. */
|
|
2
|
+
export const CONTROL_OBJECT_KINDS = [
|
|
3
|
+
"tenant",
|
|
4
|
+
"workspace",
|
|
5
|
+
"principal",
|
|
6
|
+
"tool",
|
|
7
|
+
"pack",
|
|
8
|
+
"ontology",
|
|
9
|
+
"belief",
|
|
10
|
+
"policy_rule",
|
|
11
|
+
] as const;
|
|
12
|
+
/** A kind of control object (tenant, workspace, principal, tool, etc.). */
|
|
13
|
+
export type ControlObjectKind = (typeof CONTROL_OBJECT_KINDS)[number];
|
|
14
|
+
|
|
15
|
+
/** Canonical ownership scopes: platform, tenant, workspace, or resource. */
|
|
16
|
+
export const CONTROL_OBJECT_OWNER_SCOPES = [
|
|
17
|
+
"platform",
|
|
18
|
+
"tenant",
|
|
19
|
+
"workspace",
|
|
20
|
+
"resource",
|
|
21
|
+
] as const;
|
|
22
|
+
/** The scope level that canonically owns a control object. */
|
|
23
|
+
export type ControlObjectOwnerScope =
|
|
24
|
+
(typeof CONTROL_OBJECT_OWNER_SCOPES)[number];
|
|
25
|
+
|
|
26
|
+
/** UI surfaces authorized to edit control objects. */
|
|
27
|
+
export const CONTROL_OBJECT_EDIT_SURFACES = [
|
|
28
|
+
"platform_admin",
|
|
29
|
+
"tenant_admin",
|
|
30
|
+
"workspace_admin",
|
|
31
|
+
"graph_worktree",
|
|
32
|
+
] as const;
|
|
33
|
+
/** A UI surface authorized to mutate a control object (platform admin, tenant admin, etc.). */
|
|
34
|
+
export type ControlObjectEditSurface =
|
|
35
|
+
(typeof CONTROL_OBJECT_EDIT_SURFACES)[number];
|
|
36
|
+
|
|
37
|
+
/** Rules governing how control object configuration flows through the scope hierarchy. */
|
|
38
|
+
export const CONTROL_OBJECT_INHERITANCE_RULES = [
|
|
39
|
+
"none",
|
|
40
|
+
"platform_seed_to_tenant",
|
|
41
|
+
"tenant_default_to_workspace",
|
|
42
|
+
"workspace_narrowing_only",
|
|
43
|
+
"pack_overlay_to_tenant",
|
|
44
|
+
"topic_lineage_to_resource",
|
|
45
|
+
] as const;
|
|
46
|
+
/** How a control object's configuration propagates through scope hierarchy. */
|
|
47
|
+
export type ControlObjectInheritanceRule =
|
|
48
|
+
(typeof CONTROL_OBJECT_INHERITANCE_RULES)[number];
|
|
49
|
+
|
|
50
|
+
/** Scope of impact when a control object is modified. */
|
|
51
|
+
export const CONTROL_OBJECT_BLAST_RADII = [
|
|
52
|
+
"platform",
|
|
53
|
+
"tenant",
|
|
54
|
+
"workspace",
|
|
55
|
+
"resource",
|
|
56
|
+
] as const;
|
|
57
|
+
/** The furthest scope impacted by a mutation to a control object. */
|
|
58
|
+
export type ControlObjectBlastRadius = (typeof CONTROL_OBJECT_BLAST_RADII)[number];
|
|
59
|
+
|
|
60
|
+
/** A single row in the ownership matrix describing who owns, edits, and inherits a control object. */
|
|
61
|
+
export type ControlObjectOwnershipCase = {
|
|
62
|
+
caseKey: string;
|
|
63
|
+
caseLabel: string;
|
|
64
|
+
kind: ControlObjectKind;
|
|
65
|
+
canonicalOwnerScope: ControlObjectOwnerScope;
|
|
66
|
+
editSurface: ControlObjectEditSurface;
|
|
67
|
+
inheritanceRule: ControlObjectInheritanceRule;
|
|
68
|
+
blastRadius: ControlObjectBlastRadius;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Full ownership matrix keyed by control object kind. */
|
|
72
|
+
export type ControlObjectOwnershipMatrix = Record<
|
|
73
|
+
ControlObjectKind,
|
|
74
|
+
readonly ControlObjectOwnershipCase[]
|
|
75
|
+
>;
|
|
76
|
+
|
|
77
|
+
/** Versioned ownership contract bundling all enums, the matrix, and flattened rows. */
|
|
78
|
+
export type ControlObjectOwnershipContract = {
|
|
79
|
+
version: "1.0.0";
|
|
80
|
+
kinds: readonly ControlObjectKind[];
|
|
81
|
+
ownerScopes: readonly ControlObjectOwnerScope[];
|
|
82
|
+
editSurfaces: readonly ControlObjectEditSurface[];
|
|
83
|
+
inheritanceRules: readonly ControlObjectInheritanceRule[];
|
|
84
|
+
blastRadii: readonly ControlObjectBlastRadius[];
|
|
85
|
+
matrix: ControlObjectOwnershipMatrix;
|
|
86
|
+
rows: readonly ControlObjectOwnershipCase[];
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
function defineCases<const T extends readonly ControlObjectOwnershipCase[]>(
|
|
90
|
+
cases: T
|
|
91
|
+
): T {
|
|
92
|
+
return cases;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Static ownership matrix mapping each control object kind to its ownership cases. */
|
|
96
|
+
export const CONTROL_OBJECT_OWNERSHIP_MATRIX = {
|
|
97
|
+
tenant: defineCases([
|
|
98
|
+
{
|
|
99
|
+
caseKey: "platform-record",
|
|
100
|
+
caseLabel: "Platform Record",
|
|
101
|
+
kind: "tenant",
|
|
102
|
+
canonicalOwnerScope: "platform",
|
|
103
|
+
editSurface: "platform_admin",
|
|
104
|
+
inheritanceRule: "none",
|
|
105
|
+
blastRadius: "tenant",
|
|
106
|
+
},
|
|
107
|
+
]),
|
|
108
|
+
workspace: defineCases([
|
|
109
|
+
{
|
|
110
|
+
caseKey: "tenant-workspace",
|
|
111
|
+
caseLabel: "Tenant Workspace",
|
|
112
|
+
kind: "workspace",
|
|
113
|
+
canonicalOwnerScope: "tenant",
|
|
114
|
+
editSurface: "tenant_admin",
|
|
115
|
+
inheritanceRule: "tenant_default_to_workspace",
|
|
116
|
+
blastRadius: "workspace",
|
|
117
|
+
},
|
|
118
|
+
]),
|
|
119
|
+
principal: defineCases([
|
|
120
|
+
{
|
|
121
|
+
caseKey: "tenant-principal",
|
|
122
|
+
caseLabel: "Tenant Principal",
|
|
123
|
+
kind: "principal",
|
|
124
|
+
canonicalOwnerScope: "tenant",
|
|
125
|
+
editSurface: "tenant_admin",
|
|
126
|
+
inheritanceRule: "workspace_narrowing_only",
|
|
127
|
+
blastRadius: "resource",
|
|
128
|
+
},
|
|
129
|
+
]),
|
|
130
|
+
tool: defineCases([
|
|
131
|
+
{
|
|
132
|
+
caseKey: "platform-core",
|
|
133
|
+
caseLabel: "Platform Core",
|
|
134
|
+
kind: "tool",
|
|
135
|
+
canonicalOwnerScope: "platform",
|
|
136
|
+
editSurface: "platform_admin",
|
|
137
|
+
inheritanceRule: "platform_seed_to_tenant",
|
|
138
|
+
blastRadius: "platform",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
caseKey: "tenant-custom",
|
|
142
|
+
caseLabel: "Tenant Custom",
|
|
143
|
+
kind: "tool",
|
|
144
|
+
canonicalOwnerScope: "tenant",
|
|
145
|
+
editSurface: "tenant_admin",
|
|
146
|
+
inheritanceRule: "tenant_default_to_workspace",
|
|
147
|
+
blastRadius: "tenant",
|
|
148
|
+
},
|
|
149
|
+
]),
|
|
150
|
+
pack: defineCases([
|
|
151
|
+
{
|
|
152
|
+
caseKey: "platform-definition",
|
|
153
|
+
caseLabel: "Platform Definition",
|
|
154
|
+
kind: "pack",
|
|
155
|
+
canonicalOwnerScope: "platform",
|
|
156
|
+
editSurface: "platform_admin",
|
|
157
|
+
inheritanceRule: "platform_seed_to_tenant",
|
|
158
|
+
blastRadius: "platform",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
caseKey: "tenant-installation",
|
|
162
|
+
caseLabel: "Tenant Installation",
|
|
163
|
+
kind: "pack",
|
|
164
|
+
canonicalOwnerScope: "tenant",
|
|
165
|
+
editSurface: "tenant_admin",
|
|
166
|
+
inheritanceRule: "platform_seed_to_tenant",
|
|
167
|
+
blastRadius: "tenant",
|
|
168
|
+
},
|
|
169
|
+
]),
|
|
170
|
+
ontology: defineCases([
|
|
171
|
+
{
|
|
172
|
+
caseKey: "platform-base",
|
|
173
|
+
caseLabel: "Platform Base",
|
|
174
|
+
kind: "ontology",
|
|
175
|
+
canonicalOwnerScope: "platform",
|
|
176
|
+
editSurface: "platform_admin",
|
|
177
|
+
inheritanceRule: "platform_seed_to_tenant",
|
|
178
|
+
blastRadius: "platform",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
caseKey: "pack-overlay",
|
|
182
|
+
caseLabel: "Pack Overlay",
|
|
183
|
+
kind: "ontology",
|
|
184
|
+
canonicalOwnerScope: "platform",
|
|
185
|
+
editSurface: "platform_admin",
|
|
186
|
+
inheritanceRule: "pack_overlay_to_tenant",
|
|
187
|
+
blastRadius: "platform",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
caseKey: "tenant-extension",
|
|
191
|
+
caseLabel: "Tenant Extension",
|
|
192
|
+
kind: "ontology",
|
|
193
|
+
canonicalOwnerScope: "tenant",
|
|
194
|
+
editSurface: "tenant_admin",
|
|
195
|
+
inheritanceRule: "topic_lineage_to_resource",
|
|
196
|
+
blastRadius: "tenant",
|
|
197
|
+
},
|
|
198
|
+
]),
|
|
199
|
+
belief: defineCases([
|
|
200
|
+
{
|
|
201
|
+
caseKey: "topic-resource",
|
|
202
|
+
caseLabel: "Topic Resource",
|
|
203
|
+
kind: "belief",
|
|
204
|
+
canonicalOwnerScope: "resource",
|
|
205
|
+
editSurface: "graph_worktree",
|
|
206
|
+
inheritanceRule: "topic_lineage_to_resource",
|
|
207
|
+
blastRadius: "resource",
|
|
208
|
+
},
|
|
209
|
+
]),
|
|
210
|
+
policy_rule: defineCases([
|
|
211
|
+
{
|
|
212
|
+
caseKey: "platform-baseline",
|
|
213
|
+
caseLabel: "Platform Baseline",
|
|
214
|
+
kind: "policy_rule",
|
|
215
|
+
canonicalOwnerScope: "platform",
|
|
216
|
+
editSurface: "platform_admin",
|
|
217
|
+
inheritanceRule: "platform_seed_to_tenant",
|
|
218
|
+
blastRadius: "platform",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
caseKey: "tenant-bundle",
|
|
222
|
+
caseLabel: "Tenant Bundle",
|
|
223
|
+
kind: "policy_rule",
|
|
224
|
+
canonicalOwnerScope: "tenant",
|
|
225
|
+
editSurface: "tenant_admin",
|
|
226
|
+
inheritanceRule: "tenant_default_to_workspace",
|
|
227
|
+
blastRadius: "tenant",
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
caseKey: "workspace-override",
|
|
231
|
+
caseLabel: "Workspace Override",
|
|
232
|
+
kind: "policy_rule",
|
|
233
|
+
canonicalOwnerScope: "workspace",
|
|
234
|
+
editSurface: "workspace_admin",
|
|
235
|
+
inheritanceRule: "none",
|
|
236
|
+
blastRadius: "workspace",
|
|
237
|
+
},
|
|
238
|
+
]),
|
|
239
|
+
} as const satisfies ControlObjectOwnershipMatrix;
|
|
240
|
+
|
|
241
|
+
function flattenOwnershipMatrix(
|
|
242
|
+
matrix: ControlObjectOwnershipMatrix
|
|
243
|
+
): ControlObjectOwnershipCase[] {
|
|
244
|
+
return CONTROL_OBJECT_KINDS.flatMap((kind) => [...matrix[kind]]);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Flattened array of all ownership cases across all control object kinds. */
|
|
248
|
+
export const CONTROL_OBJECT_OWNERSHIP_ROWS = Object.freeze(
|
|
249
|
+
flattenOwnershipMatrix(CONTROL_OBJECT_OWNERSHIP_MATRIX)
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
/** The canonical ownership contract exposed by the SDK. */
|
|
253
|
+
export const CONTROL_OBJECT_OWNERSHIP_CONTRACT = {
|
|
254
|
+
version: "1.0.0",
|
|
255
|
+
kinds: CONTROL_OBJECT_KINDS,
|
|
256
|
+
ownerScopes: CONTROL_OBJECT_OWNER_SCOPES,
|
|
257
|
+
editSurfaces: CONTROL_OBJECT_EDIT_SURFACES,
|
|
258
|
+
inheritanceRules: CONTROL_OBJECT_INHERITANCE_RULES,
|
|
259
|
+
blastRadii: CONTROL_OBJECT_BLAST_RADII,
|
|
260
|
+
matrix: CONTROL_OBJECT_OWNERSHIP_MATRIX,
|
|
261
|
+
rows: CONTROL_OBJECT_OWNERSHIP_ROWS,
|
|
262
|
+
} as const satisfies ControlObjectOwnershipContract;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* List ownership cases for one control-object kind or the full matrix.
|
|
266
|
+
*/
|
|
267
|
+
export function listControlObjectOwnershipCases(
|
|
268
|
+
kind?: ControlObjectKind
|
|
269
|
+
): readonly ControlObjectOwnershipCase[] {
|
|
270
|
+
if (!kind) {
|
|
271
|
+
return CONTROL_OBJECT_OWNERSHIP_ROWS;
|
|
272
|
+
}
|
|
273
|
+
return CONTROL_OBJECT_OWNERSHIP_MATRIX[kind];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Get a specific ownership case by kind and case key.
|
|
278
|
+
*/
|
|
279
|
+
export function getControlObjectOwnershipCase(
|
|
280
|
+
kind: ControlObjectKind,
|
|
281
|
+
caseKey: string
|
|
282
|
+
): ControlObjectOwnershipCase | undefined {
|
|
283
|
+
return CONTROL_OBJECT_OWNERSHIP_MATRIX[kind].find(
|
|
284
|
+
(ownershipCase) => ownershipCase.caseKey === caseKey
|
|
285
|
+
);
|
|
286
|
+
}
|