@lucern/contracts 0.3.0-alpha.1 → 0.3.0-alpha.10
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/CHANGELOG.md +4 -0
- package/dist/component-boundary.contract.d.ts +14 -0
- package/dist/component-boundary.contract.js +155 -0
- package/dist/component-boundary.contract.js.map +1 -0
- package/dist/component-host-boundary.contract.d.ts +41 -0
- package/dist/component-host-boundary.contract.js +54 -0
- package/dist/component-host-boundary.contract.js.map +1 -0
- package/dist/context-pack.contract.d.ts +5 -3
- package/dist/context-pack.contract.js.map +1 -1
- package/dist/{dsl-BgpoVOVQ.d.ts → dsl-djCRfuWC.d.ts} +1 -1
- package/dist/dsl.d.ts +1 -1
- package/dist/dsl.js +1 -4
- package/dist/dsl.js.map +1 -1
- package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
- package/dist/function-registry/beliefs.d.ts +41 -41
- package/dist/function-registry/beliefs.js +709 -31
- package/dist/function-registry/beliefs.js.map +1 -1
- package/dist/function-registry/coding.js +694 -31
- package/dist/function-registry/coding.js.map +1 -1
- package/dist/function-registry/context.d.ts +13 -13
- package/dist/function-registry/context.js +700 -35
- package/dist/function-registry/context.js.map +1 -1
- package/dist/function-registry/contracts.js +665 -28
- package/dist/function-registry/contracts.js.map +1 -1
- package/dist/function-registry/coordination.js +665 -28
- package/dist/function-registry/coordination.js.map +1 -1
- package/dist/function-registry/edges.d.ts +156 -0
- package/dist/function-registry/edges.js +876 -60
- package/dist/function-registry/edges.js.map +1 -1
- package/dist/function-registry/evidence.d.ts +33 -33
- package/dist/function-registry/evidence.js +717 -37
- package/dist/function-registry/evidence.js.map +1 -1
- package/dist/function-registry/graph.d.ts +131 -53
- package/dist/function-registry/graph.js +781 -35
- package/dist/function-registry/graph.js.map +1 -1
- package/dist/function-registry/helpers.d.ts +3 -3
- package/dist/function-registry/helpers.js +665 -28
- package/dist/function-registry/helpers.js.map +1 -1
- package/dist/function-registry/identity.js +665 -28
- package/dist/function-registry/identity.js.map +1 -1
- package/dist/function-registry/index.d.ts +321 -7
- package/dist/function-registry/index.js +1046 -33
- package/dist/function-registry/index.js.map +1 -1
- package/dist/function-registry/judgments.d.ts +9 -9
- package/dist/function-registry/judgments.js +677 -31
- package/dist/function-registry/judgments.js.map +1 -1
- package/dist/function-registry/legacy.js +665 -28
- package/dist/function-registry/legacy.js.map +1 -1
- package/dist/function-registry/lenses.d.ts +17 -17
- package/dist/function-registry/lenses.js +688 -31
- package/dist/function-registry/lenses.js.map +1 -1
- package/dist/function-registry/manifest.d.ts +6 -6
- package/dist/function-registry/manifest.js +18 -2
- package/dist/function-registry/manifest.js.map +1 -1
- package/dist/function-registry/ontologies.d.ts +45 -45
- package/dist/function-registry/ontologies.js +683 -34
- package/dist/function-registry/ontologies.js.map +1 -1
- package/dist/function-registry/pipeline.d.ts +13 -13
- package/dist/function-registry/pipeline.js +674 -31
- package/dist/function-registry/pipeline.js.map +1 -1
- package/dist/function-registry/questions.d.ts +49 -49
- package/dist/function-registry/questions.js +762 -36
- package/dist/function-registry/questions.js.map +1 -1
- package/dist/function-registry/tasks.d.ts +17 -17
- package/dist/function-registry/tasks.js +709 -30
- package/dist/function-registry/tasks.js.map +1 -1
- package/dist/function-registry/topics.d.ts +99 -21
- package/dist/function-registry/topics.js +747 -32
- package/dist/function-registry/topics.js.map +1 -1
- package/dist/function-registry/types.d.ts +1 -1
- package/dist/function-registry/worktrees.d.ts +80 -41
- package/dist/function-registry/worktrees.js +804 -40
- package/dist/function-registry/worktrees.js.map +1 -1
- package/dist/function-registry-input-audit.d.ts +13 -0
- package/dist/function-registry-input-audit.js +166 -0
- package/dist/function-registry-input-audit.js.map +1 -0
- package/dist/gateway.contract.d.ts +2 -0
- package/dist/gateway.contract.js.map +1 -1
- package/dist/generated/convexSchemas.js +4 -3
- package/dist/generated/convexSchemas.js.map +1 -1
- package/dist/generated/schema-manifest.json +49 -3
- package/dist/generated/tableOwnership.d.ts +2 -1
- package/dist/generated/tableOwnership.js +2 -0
- package/dist/generated/tableOwnership.js.map +1 -1
- package/dist/generated/tier-expectations.json +4 -2
- package/dist/graph-intelligence.contract.d.ts +506 -0
- package/dist/graph-intelligence.contract.js +595 -0
- package/dist/graph-intelligence.contract.js.map +1 -0
- package/dist/graph-types/index.d.ts +5 -1
- package/dist/graph-types/index.js +15 -4
- package/dist/graph-types/index.js.map +1 -1
- package/dist/{index-CV-0_VWJ.d.ts → index-O09U2xHk.d.ts} +5 -2
- package/dist/index.d.ts +24 -413
- package/dist/index.js +3286 -136
- package/dist/index.js.map +1 -1
- package/dist/infisical-runtime.contract.d.ts +174 -0
- package/dist/infisical-runtime.contract.js +317 -0
- package/dist/infisical-runtime.contract.js.map +1 -0
- package/dist/lens-filter.contract.js +4 -3
- package/dist/lens-filter.contract.js.map +1 -1
- package/dist/lens-workflow.contract.js +4 -3
- package/dist/lens-workflow.contract.js.map +1 -1
- package/dist/manifests/edge-policy-manifest.d.ts +2 -0
- package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
- package/dist/manifests/edge-policy-manifest.data.js +26 -0
- package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
- package/dist/manifests/edge-policy-manifest.js +92 -0
- package/dist/manifests/edge-policy-manifest.js.map +1 -0
- package/dist/manifests/infisical-runtime-manifest.d.ts +151 -0
- package/dist/manifests/infisical-runtime-manifest.js +316 -0
- package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
- package/dist/manifests/invariant-manifest.d.ts +65 -0
- package/dist/manifests/invariant-manifest.js +18 -0
- package/dist/manifests/invariant-manifest.js.map +1 -0
- package/dist/manifests/invariants/ast-utils.d.ts +14 -0
- package/dist/manifests/invariants/ast-utils.js +54 -0
- package/dist/manifests/invariants/ast-utils.js.map +1 -0
- package/dist/manifests/invariants/index.d.ts +15 -0
- package/dist/manifests/invariants/index.js +183 -0
- package/dist/manifests/invariants/index.js.map +1 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
- package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
- package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
- package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
- package/dist/manifests/tenant-client-manifest.d.ts +322 -0
- package/dist/manifests/tenant-client-manifest.js +432 -0
- package/dist/manifests/tenant-client-manifest.js.map +1 -0
- package/dist/mcp-gateway-boundary.contract.d.ts +181 -0
- package/dist/mcp-gateway-boundary.contract.js +43 -0
- package/dist/mcp-gateway-boundary.contract.js.map +1 -0
- package/dist/projections/check-convex-args-shape.d.ts +3 -0
- package/dist/projections/check-convex-args-shape.js +399 -0
- package/dist/projections/check-convex-args-shape.js.map +1 -0
- package/dist/projections/create-evidence.projection.d.ts +176 -0
- package/dist/projections/create-evidence.projection.js +131 -0
- package/dist/projections/create-evidence.projection.js.map +1 -0
- package/dist/projections/index.d.ts +102 -0
- package/dist/projections/index.js +348 -0
- package/dist/projections/index.js.map +1 -0
- package/dist/projections/list-beliefs.projection.d.ts +36 -0
- package/dist/projections/list-beliefs.projection.js +54 -0
- package/dist/projections/list-beliefs.projection.js.map +1 -0
- package/dist/projections/list-tasks.projection.d.ts +32 -0
- package/dist/projections/list-tasks.projection.js +52 -0
- package/dist/projections/list-tasks.projection.js.map +1 -0
- package/dist/projections/modulate-confidence.projection.d.ts +219 -0
- package/dist/projections/modulate-confidence.projection.js +148 -0
- package/dist/projections/modulate-confidence.projection.js.map +1 -0
- package/dist/projections/projection-dsl.d.ts +11 -0
- package/dist/projections/projection-dsl.js +8 -0
- package/dist/projections/projection-dsl.js.map +1 -0
- package/dist/schema-helpers/enumValidation.js +2 -5
- package/dist/schema-helpers/enumValidation.js.map +1 -1
- package/dist/schema-helpers/spine/nodes/decision.js +2 -1
- package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
- package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
- package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
- package/dist/schemas/component-table-manifest.d.ts +2 -2
- package/dist/schemas/enums.d.ts +5 -2
- package/dist/schemas/enums.js +5 -2
- package/dist/schemas/enums.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +45 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/manifest.d.ts +1030 -890
- package/dist/schemas/manifest.js +44 -3
- package/dist/schemas/manifest.js.map +1 -1
- package/dist/schemas/sl-opinion.d.ts +4 -4
- package/dist/schemas/tables/identity/platform.d.ts +10 -10
- package/dist/schemas/tables/kernel/epistemic.d.ts +6 -6
- package/dist/schemas/tables/kernel/infra.d.ts +4 -4
- package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
- package/dist/schemas/tables/kernel/lens.d.ts +4 -4
- package/dist/schemas/tables/kernel/platform.d.ts +12 -12
- package/dist/schemas/tables/kernel/spine.d.ts +3 -3
- package/dist/schemas/tables/kernel/spine.js +5 -2
- package/dist/schemas/tables/kernel/spine.js.map +1 -1
- package/dist/schemas/tables/kernel/task.d.ts +42 -42
- package/dist/schemas/tables/kernel/topic.js +5 -1
- package/dist/schemas/tables/kernel/topic.js.map +1 -1
- package/dist/schemas/tables/kernel/worktree.d.ts +58 -58
- package/dist/schemas/tables/mc/identity.d.ts +26 -3
- package/dist/schemas/tables/mc/identity.js +35 -1
- package/dist/schemas/tables/mc/identity.js.map +1 -1
- package/dist/schemas/tables/mc/pack.d.ts +20 -20
- package/dist/schemas/tables/mc/registry.d.ts +4 -4
- package/dist/schemas/tables/mc/workspace.d.ts +9 -3
- package/dist/schemas/tables/mc/workspace.js +3 -1
- package/dist/schemas/tables/mc/workspace.js.map +1 -1
- package/dist/sdk-methods.contract.d.ts +2 -2
- package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
- package/dist/sdk-tools.contract.d.ts +2 -2
- package/dist/sdk-tools.contract.js +646 -23
- package/dist/sdk-tools.contract.js.map +1 -1
- package/dist/tenant-bootstrap-seed.contract.d.ts +1101 -0
- package/dist/tenant-bootstrap-seed.contract.js +653 -0
- package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
- package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
- package/dist/tenant-bootstrap-seed.defaults.js +303 -0
- package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
- package/dist/tenant-client.contract.d.ts +349 -0
- package/dist/tenant-client.contract.js +488 -0
- package/dist/tenant-client.contract.js.map +1 -0
- package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BevD9Ho2.d.ts} +36 -2
- package/dist/tool-contracts.d.ts +1 -1
- package/dist/tool-contracts.js +647 -24
- package/dist/tool-contracts.js.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// src/tenant-client.contract.ts
|
|
2
|
+
var TENANT_CLIENT_CONTRACT_VERSION = "2026-04-27";
|
|
3
|
+
var TENANT_CLIENT_AUTH_MODES = [
|
|
4
|
+
"interactive_user",
|
|
5
|
+
"service_principal",
|
|
6
|
+
"tenant_api_key",
|
|
7
|
+
"session_token"
|
|
8
|
+
];
|
|
9
|
+
var TENANT_CLIENT_PRINCIPAL_TYPES = [
|
|
10
|
+
"human",
|
|
11
|
+
"service",
|
|
12
|
+
"agent"
|
|
13
|
+
];
|
|
14
|
+
var TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS = [
|
|
15
|
+
"tenantId",
|
|
16
|
+
"workspaceId",
|
|
17
|
+
"principalId",
|
|
18
|
+
"authMode",
|
|
19
|
+
"scopes"
|
|
20
|
+
];
|
|
21
|
+
var TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS = [
|
|
22
|
+
"principalType",
|
|
23
|
+
"roles",
|
|
24
|
+
"sessionId",
|
|
25
|
+
"delegationChain"
|
|
26
|
+
];
|
|
27
|
+
var TENANT_CLIENT_INSTALL_TOKEN_ENV = "INSTALL_LUCERN_NPM";
|
|
28
|
+
var TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH = "tenants/shared";
|
|
29
|
+
var TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS = [
|
|
30
|
+
"/platform/publish"
|
|
31
|
+
];
|
|
32
|
+
var TENANT_CLIENT_FORBIDDEN_SECRET_ENV = ["NPM_TOKEN"];
|
|
33
|
+
var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
34
|
+
{
|
|
35
|
+
packageName: "@lucern/access-control",
|
|
36
|
+
role: "runtime_entrypoint",
|
|
37
|
+
directTenantImport: true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
packageName: "@lucern/agent",
|
|
41
|
+
role: "platform_runtime",
|
|
42
|
+
directTenantImport: false
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
packageName: "@lucern/auth",
|
|
46
|
+
role: "sdk_dependency",
|
|
47
|
+
directTenantImport: false
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
packageName: "@lucern/cli",
|
|
51
|
+
role: "developer_tool",
|
|
52
|
+
directTenantImport: false
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
packageName: "@lucern/client-core",
|
|
56
|
+
role: "sdk_dependency",
|
|
57
|
+
directTenantImport: false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
packageName: "@lucern/confidence",
|
|
61
|
+
role: "sdk_dependency",
|
|
62
|
+
directTenantImport: false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
packageName: "@lucern/config",
|
|
66
|
+
role: "configuration",
|
|
67
|
+
directTenantImport: false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
packageName: "@lucern/contracts",
|
|
71
|
+
role: "contract_entrypoint",
|
|
72
|
+
directTenantImport: true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
packageName: "@lucern/control-plane",
|
|
76
|
+
role: "platform_runtime",
|
|
77
|
+
directTenantImport: false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
packageName: "@lucern/developer-kit",
|
|
81
|
+
role: "developer_tool",
|
|
82
|
+
directTenantImport: false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
packageName: "@lucern/events",
|
|
86
|
+
role: "sdk_dependency",
|
|
87
|
+
directTenantImport: false
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
packageName: "@lucern/graph-primitives",
|
|
91
|
+
role: "sdk_dependency",
|
|
92
|
+
directTenantImport: false
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
packageName: "@lucern/graph-sync",
|
|
96
|
+
role: "host_addon_runtime",
|
|
97
|
+
directTenantImport: true
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
packageName: "@lucern/identity",
|
|
101
|
+
role: "component_runtime",
|
|
102
|
+
directTenantImport: false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
packageName: "@lucern/mcp",
|
|
106
|
+
role: "runtime_entrypoint",
|
|
107
|
+
directTenantImport: true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
packageName: "@lucern/pack-host",
|
|
111
|
+
role: "platform_runtime",
|
|
112
|
+
directTenantImport: false
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
packageName: "@lucern/pack-installer",
|
|
116
|
+
role: "developer_tool",
|
|
117
|
+
directTenantImport: false
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
packageName: "@lucern/proof-compiler",
|
|
121
|
+
role: "developer_tool",
|
|
122
|
+
directTenantImport: false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
packageName: "@lucern/react",
|
|
126
|
+
role: "runtime_entrypoint",
|
|
127
|
+
directTenantImport: true
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
packageName: "@lucern/reasoning-kernel",
|
|
131
|
+
role: "component_runtime",
|
|
132
|
+
directTenantImport: false
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
packageName: "@lucern/sdk",
|
|
136
|
+
role: "runtime_entrypoint",
|
|
137
|
+
directTenantImport: true
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
packageName: "@lucern/server-core",
|
|
141
|
+
role: "platform_runtime",
|
|
142
|
+
directTenantImport: false
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
packageName: "@lucern/testing",
|
|
146
|
+
role: "test_support",
|
|
147
|
+
directTenantImport: false
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
packageName: "@lucern/types",
|
|
151
|
+
role: "contract_entrypoint",
|
|
152
|
+
directTenantImport: true
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
var TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES = TENANT_CLIENT_INSTALLABLE_PACKAGES.map(
|
|
156
|
+
(entry) => entry.packageName
|
|
157
|
+
);
|
|
158
|
+
var TENANT_CLIENT_INSTALL_PROFILES = [
|
|
159
|
+
{
|
|
160
|
+
id: "core_app_runtime",
|
|
161
|
+
description: "Smallest tenant app/runtime install for typed Lucern API calls plus tool-access policy helpers.",
|
|
162
|
+
packageNames: ["@lucern/sdk", "@lucern/access-control"],
|
|
163
|
+
dependencyField: "dependencies"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "react_app_runtime",
|
|
167
|
+
description: "React tenant app install for hooks, provider, curated graph components, and direct SDK calls.",
|
|
168
|
+
packageNames: ["@lucern/react", "@lucern/sdk", "@lucern/access-control"],
|
|
169
|
+
dependencyField: "dependencies"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "convex_components",
|
|
173
|
+
description: "Tenant Convex host install for binding the Lucern identity and reasoning-kernel components.",
|
|
174
|
+
packageNames: ["@lucern/identity", "@lucern/reasoning-kernel"],
|
|
175
|
+
dependencyField: "dependencies"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: "graph_mirroring_addon",
|
|
179
|
+
description: "Optional tenant Convex host install for Neo4j graph projection, edge topology writes, backfill, health checks, and query proxy helpers.",
|
|
180
|
+
packageNames: ["@lucern/graph-sync"],
|
|
181
|
+
dependencyField: "dependencies"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "operator_cli",
|
|
185
|
+
description: "Developer/operator install for the `lucern` binary, including tenant bootstrap seed commands.",
|
|
186
|
+
packageNames: ["@lucern/cli"],
|
|
187
|
+
dependencyField: "devDependencies"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "mcp_runtime",
|
|
191
|
+
description: "Agent runtime install for the standalone Lucern MCP server and hosted route helpers.",
|
|
192
|
+
packageNames: ["@lucern/mcp"],
|
|
193
|
+
dependencyField: "dependencies"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "contracts_and_types",
|
|
197
|
+
description: "Compile-time contract/type install for codegen, audits, and tenant integration validation.",
|
|
198
|
+
packageNames: ["@lucern/contracts", "@lucern/types"],
|
|
199
|
+
dependencyField: "dependencies"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: "full_suite",
|
|
203
|
+
description: "Full coherent Lucern package suite for design-partner repos that want every published runtime, tool, component, test, and config package pinned together.",
|
|
204
|
+
packageNames: TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES,
|
|
205
|
+
dependencyField: "mixed"
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
var TENANT_CLIENT_PUBLIC_IMPORTS = [
|
|
209
|
+
{
|
|
210
|
+
packageName: "@lucern/sdk",
|
|
211
|
+
surface: "runtime",
|
|
212
|
+
subpaths: "published_exports",
|
|
213
|
+
description: "TypeScript SDK runtime and generated operation namespaces."
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
packageName: "@lucern/react",
|
|
217
|
+
surface: "runtime",
|
|
218
|
+
subpaths: "published_exports",
|
|
219
|
+
description: "React bindings for tenant-owned UI applications."
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
packageName: "@lucern/mcp",
|
|
223
|
+
surface: "runtime",
|
|
224
|
+
subpaths: "published_exports",
|
|
225
|
+
description: "MCP client/server entry points and hosted route helpers."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
packageName: "@lucern/graph-sync",
|
|
229
|
+
surface: "runtime",
|
|
230
|
+
subpaths: "published_exports",
|
|
231
|
+
description: "Optional Neo4j graph mirroring host actions, edge API, query proxy, backfill, and health helpers."
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
packageName: "@lucern/contracts",
|
|
235
|
+
surface: "contract",
|
|
236
|
+
subpaths: "published_exports",
|
|
237
|
+
description: "Published type and manifest contracts."
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
packageName: "@lucern/access-control",
|
|
241
|
+
surface: "runtime",
|
|
242
|
+
subpaths: "published_exports",
|
|
243
|
+
description: "Tenant runtime access-control helpers, including effective tool access."
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
packageName: "@lucern/types",
|
|
247
|
+
surface: "contract",
|
|
248
|
+
subpaths: "published_exports",
|
|
249
|
+
description: "Published type-only helpers for tenant integration code."
|
|
250
|
+
}
|
|
251
|
+
];
|
|
252
|
+
var TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS = [
|
|
253
|
+
{
|
|
254
|
+
packageName: "@lucern/identity",
|
|
255
|
+
importPath: "@lucern/identity/convex.config",
|
|
256
|
+
surface: "component_config",
|
|
257
|
+
description: "Convex component binding config for tenant deployments that install Lucern identity."
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
packageName: "@lucern/reasoning-kernel",
|
|
261
|
+
importPath: "@lucern/reasoning-kernel/convex.config",
|
|
262
|
+
surface: "component_config",
|
|
263
|
+
description: "Convex component binding config for tenant deployments that install the Lucern reasoning kernel."
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
packageName: "@lucern/reasoning-kernel",
|
|
267
|
+
importPath: "@lucern/reasoning-kernel/runtime.config",
|
|
268
|
+
surface: "component_config",
|
|
269
|
+
description: "Runtime config alias for tenant deployments that install the Lucern reasoning kernel."
|
|
270
|
+
}
|
|
271
|
+
];
|
|
272
|
+
function findTenantClientInstallablePackage(packageName) {
|
|
273
|
+
return TENANT_CLIENT_INSTALLABLE_PACKAGES.find(
|
|
274
|
+
(entry) => entry.packageName === packageName
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
function isTenantClientInstallablePackage(packageName) {
|
|
278
|
+
return Boolean(findTenantClientInstallablePackage(packageName));
|
|
279
|
+
}
|
|
280
|
+
var TENANT_CLIENT_REQUIRED_SDK_NAMESPACES = [
|
|
281
|
+
"bootstrap",
|
|
282
|
+
"context",
|
|
283
|
+
"beliefs",
|
|
284
|
+
"evidence",
|
|
285
|
+
"questions",
|
|
286
|
+
"graph",
|
|
287
|
+
"worktrees",
|
|
288
|
+
"topics",
|
|
289
|
+
"edges",
|
|
290
|
+
"contradictions",
|
|
291
|
+
"contracts",
|
|
292
|
+
"graphIntel",
|
|
293
|
+
"graphIntelligence",
|
|
294
|
+
"graphAnalysis",
|
|
295
|
+
"graphRecommendations",
|
|
296
|
+
"orgGraphSearch",
|
|
297
|
+
"embeddings",
|
|
298
|
+
"ontologyLinks",
|
|
299
|
+
"graphStateClassifier",
|
|
300
|
+
"tools",
|
|
301
|
+
"identity",
|
|
302
|
+
"modelRuntime",
|
|
303
|
+
"events",
|
|
304
|
+
"jobs",
|
|
305
|
+
"telemetry"
|
|
306
|
+
];
|
|
307
|
+
var TENANT_CLIENT_CAPABILITIES = [
|
|
308
|
+
{
|
|
309
|
+
id: "identity.bootstrap_session",
|
|
310
|
+
description: "Start a scoped Lucern session for a tenant principal.",
|
|
311
|
+
surfaces: ["@lucern/sdk", "@lucern/mcp"],
|
|
312
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "reasoning.context.compile",
|
|
316
|
+
description: "Compile tenant and workspace scoped reasoning context.",
|
|
317
|
+
surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
|
|
318
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
id: "reasoning.graph.read",
|
|
322
|
+
description: "Read beliefs, evidence, questions, topics, graph edges, and lineage.",
|
|
323
|
+
surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
|
|
324
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: "reasoning.graph.write",
|
|
328
|
+
description: "Create and update graph objects through authorized APIs.",
|
|
329
|
+
surfaces: ["@lucern/sdk", "@lucern/mcp"],
|
|
330
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: "reasoning.graph_intelligence.run",
|
|
334
|
+
description: "Discover and run Graph Intelligence query recipes for structural graph analysis.",
|
|
335
|
+
surfaces: ["@lucern/sdk", "@lucern/cli", "@lucern/mcp"],
|
|
336
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: "reasoning.graph_mirroring.install",
|
|
340
|
+
description: "Install and run the optional Neo4j graph mirror for paid or enterprise tenant deployments.",
|
|
341
|
+
surfaces: ["@lucern/graph-sync", "@lucern/cli"],
|
|
342
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
id: "workflow.worktree_lifecycle",
|
|
346
|
+
description: "Create, review, merge, and close scoped worktrees.",
|
|
347
|
+
surfaces: ["@lucern/sdk", "@lucern/react", "@lucern/mcp"],
|
|
348
|
+
requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS
|
|
349
|
+
}
|
|
350
|
+
];
|
|
351
|
+
var TENANT_CLIENT_ISOLATION_RULES = [
|
|
352
|
+
{
|
|
353
|
+
id: "tenant_workspace_scope_required",
|
|
354
|
+
description: "Runtime operations must resolve both tenantId and workspaceId before reaching Lucern reasoning state."
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
id: "principal_audit_required",
|
|
358
|
+
description: "Runtime operations must carry principalId, authMode, and scopes for audit attribution."
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: "no_private_lucern_imports",
|
|
362
|
+
description: "Tenant code must not import Lucern source, Convex internals, generated adapters, or unpublished package internals."
|
|
363
|
+
}
|
|
364
|
+
];
|
|
365
|
+
var TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS = [
|
|
366
|
+
{
|
|
367
|
+
id: "deep_src_import",
|
|
368
|
+
pattern: "^@lucern/[^/]+/src(?:/|$)",
|
|
369
|
+
description: "Published packages must not be bypassed through src paths."
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: "deep_dist_import",
|
|
373
|
+
pattern: "^@lucern/[^/]+/dist(?:/|$)",
|
|
374
|
+
description: "Published package exports must be used instead of dist file paths."
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: "generated_adapter_import",
|
|
378
|
+
pattern: "^@lucern/[^/]+/(?:adapters/)?_generated(?:/|$)",
|
|
379
|
+
description: "Generated Lucern adapters are internal deployment artifacts."
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: "private_runtime_import",
|
|
383
|
+
pattern: "^@lucern/[^/]+/(?:internal|private)(?:/|$)",
|
|
384
|
+
description: "Internal and private package subpaths are not public SDK API."
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "workspace_source_import",
|
|
388
|
+
pattern: "^(?:packages|modules|services|lucern|apps)/(?:.+/)?src(?:/|$)",
|
|
389
|
+
description: "Tenant clients must not import source files from the Lucern monorepo."
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: "root_alias_lucern_import",
|
|
393
|
+
pattern: "^@/(?:lucern|packages|modules|services|apps)(?:/|$)",
|
|
394
|
+
description: "Tenant clients must not depend on Lucern repo-local path aliases."
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
id: "relative_lucern_source_import",
|
|
398
|
+
pattern: "^\\.\\.?/(?:.+/)?(?:packages|modules|services|lucern|apps)(?:/|$)",
|
|
399
|
+
description: "Tenant clients must not reach back into Lucern source through relative paths."
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "monorepo_path_import",
|
|
403
|
+
pattern: "lucern-repo",
|
|
404
|
+
description: "Absolute imports that name the Lucern repository are not portable tenant code."
|
|
405
|
+
}
|
|
406
|
+
];
|
|
407
|
+
function matchesPublicImport(importPath) {
|
|
408
|
+
const componentConfig = TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.find(
|
|
409
|
+
(entry) => importPath === entry.importPath
|
|
410
|
+
);
|
|
411
|
+
if (componentConfig) {
|
|
412
|
+
return componentConfig;
|
|
413
|
+
}
|
|
414
|
+
return TENANT_CLIENT_PUBLIC_IMPORTS.find(
|
|
415
|
+
(entry) => importPath === entry.packageName || importPath.startsWith(`${entry.packageName}/`)
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function matchesForbiddenPattern(importPath) {
|
|
419
|
+
return TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS.find(
|
|
420
|
+
(entry) => new RegExp(entry.pattern, "u").test(importPath)
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
function classifyTenantClientImport(importPath) {
|
|
424
|
+
const normalizedImportPath = importPath.trim();
|
|
425
|
+
const pattern = matchesForbiddenPattern(normalizedImportPath);
|
|
426
|
+
if (pattern) {
|
|
427
|
+
return {
|
|
428
|
+
importPath: normalizedImportPath,
|
|
429
|
+
decision: "forbidden",
|
|
430
|
+
pattern,
|
|
431
|
+
reason: pattern.description
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const publicImport = matchesPublicImport(normalizedImportPath);
|
|
435
|
+
if (publicImport) {
|
|
436
|
+
return {
|
|
437
|
+
importPath: normalizedImportPath,
|
|
438
|
+
decision: "public",
|
|
439
|
+
publicImport,
|
|
440
|
+
reason: publicImport.description
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
if (normalizedImportPath.startsWith("@lucern/")) {
|
|
444
|
+
return {
|
|
445
|
+
importPath: normalizedImportPath,
|
|
446
|
+
decision: "forbidden",
|
|
447
|
+
reason: "This @lucern package is not part of the tenant client public surface."
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
if (normalizedImportPath.startsWith("./") || normalizedImportPath.startsWith("../")) {
|
|
451
|
+
return {
|
|
452
|
+
importPath: normalizedImportPath,
|
|
453
|
+
decision: "local",
|
|
454
|
+
reason: "Local tenant-owned import."
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
importPath: normalizedImportPath,
|
|
459
|
+
decision: "external",
|
|
460
|
+
reason: "External dependency outside the Lucern package namespace."
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function isTenantClientPublicImport(importPath) {
|
|
464
|
+
return classifyTenantClientImport(importPath).decision === "public";
|
|
465
|
+
}
|
|
466
|
+
function isTenantClientComponentConfigImport(importPath) {
|
|
467
|
+
return TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.some(
|
|
468
|
+
(entry) => importPath === entry.importPath
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
function isTenantClientAllowedImport(importPath) {
|
|
472
|
+
return classifyTenantClientImport(importPath).decision === "public";
|
|
473
|
+
}
|
|
474
|
+
function assertTenantClientImportAllowed(importPath) {
|
|
475
|
+
const classification = classifyTenantClientImport(importPath);
|
|
476
|
+
if (classification.decision !== "forbidden") {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
throw new Error(formatTenantClientImportViolation(classification));
|
|
480
|
+
}
|
|
481
|
+
function formatTenantClientImportViolation(classification) {
|
|
482
|
+
const patternId = classification.pattern ? ` [${classification.pattern.id}]` : "";
|
|
483
|
+
return `Tenant client import is not allowed${patternId}: ${classification.importPath}. ${classification.reason}`;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export { TENANT_CLIENT_AUTH_MODES, TENANT_CLIENT_CAPABILITIES, TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS, TENANT_CLIENT_CONTRACT_VERSION, TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS, TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS, TENANT_CLIENT_FORBIDDEN_SECRET_ENV, TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES, TENANT_CLIENT_INSTALLABLE_PACKAGES, TENANT_CLIENT_INSTALL_PROFILES, TENANT_CLIENT_INSTALL_TOKEN_ENV, TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH, TENANT_CLIENT_ISOLATION_RULES, TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS, TENANT_CLIENT_PRINCIPAL_TYPES, TENANT_CLIENT_PUBLIC_IMPORTS, TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS, TENANT_CLIENT_REQUIRED_SDK_NAMESPACES, assertTenantClientImportAllowed, classifyTenantClientImport, findTenantClientInstallablePackage, formatTenantClientImportViolation, isTenantClientAllowedImport, isTenantClientComponentConfigImport, isTenantClientInstallablePackage, isTenantClientPublicImport };
|
|
487
|
+
//# sourceMappingURL=tenant-client.contract.js.map
|
|
488
|
+
//# sourceMappingURL=tenant-client.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ten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AAA;AAC5D,EAAA,IAAI,cAAA,CAAe,aAAa,WAAA,EAAa;AAC3C,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,IAAI,KAAA,CAAM,iCAAA,CAAkC,cAAc,CAAC,CAAA;AACnE;AAEO,SAAS,kCACd,cAAA,EACQ;AACR,EAAA,MAAM,YAAY,cAAA,CAAe,OAAA,GAC7B,KAAK,cAAA,CAAe,OAAA,CAAQ,EAAE,CAAA,CAAA,CAAA,GAC9B,EAAA;AACJ,EAAA,OAAO,sCAAsC,SAAS,CAAA,EAAA,EAAK,eAAe,UAAU,CAAA,EAAA,EAAK,eAAe,MAAM,CAAA,CAAA;AAChH","file":"tenant-client.contract.js","sourcesContent":["/**\n * Tenant client contract\n *\n * Defines the generic boundary for any customer-owned product that consumes\n * Lucern through the SDK, hosted API, or MCP server. Tenant clients may run\n * their own UI, auth provider, deployment, and data plane, but reasoning\n * operations must enter through the published packages below.\n */\n\nimport type {\n SessionAuthMode,\n SessionPrincipalType,\n} from \"./auth.contract\";\n\nexport const TENANT_CLIENT_CONTRACT_VERSION = \"2026-04-27\" as const;\n\nexport const TENANT_CLIENT_AUTH_MODES = [\n \"interactive_user\",\n \"service_principal\",\n \"tenant_api_key\",\n \"session_token\",\n] as const satisfies readonly SessionAuthMode[];\nexport type TenantClientAuthMode = (typeof TENANT_CLIENT_AUTH_MODES)[number];\n\nexport const TENANT_CLIENT_PRINCIPAL_TYPES = [\n \"human\",\n \"service\",\n \"agent\",\n] as const satisfies readonly SessionPrincipalType[];\nexport type TenantClientPrincipalType =\n (typeof TENANT_CLIENT_PRINCIPAL_TYPES)[number];\n\nexport const TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS = [\n \"tenantId\",\n \"workspaceId\",\n \"principalId\",\n \"authMode\",\n \"scopes\",\n] as const;\nexport type TenantClientRequiredContextField =\n (typeof TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS)[number];\n\nexport const TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS = [\n \"principalType\",\n \"roles\",\n \"sessionId\",\n \"delegationChain\",\n] as const;\nexport type TenantClientOptionalContextField =\n (typeof TENANT_CLIENT_OPTIONAL_CONTEXT_FIELDS)[number];\n\nexport const TENANT_CLIENT_INSTALL_TOKEN_ENV = \"INSTALL_LUCERN_NPM\" as const;\nexport const TENANT_CLIENT_INSTALL_TOKEN_INFISICAL_PATH =\n \"tenants/shared\" as const;\nexport const TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS = [\n \"/platform/publish\",\n] as const;\nexport const TENANT_CLIENT_FORBIDDEN_SECRET_ENV = [\"NPM_TOKEN\"] as const;\nexport type TenantClientForbiddenInstallTokenInfisicalPath =\n (typeof TENANT_CLIENT_FORBIDDEN_INSTALL_TOKEN_INFISICAL_PATHS)[number];\nexport type TenantClientForbiddenSecretEnv =\n (typeof TENANT_CLIENT_FORBIDDEN_SECRET_ENV)[number];\n\nexport const TENANT_CLIENT_INSTALLABLE_PACKAGES = [\n {\n packageName: \"@lucern/access-control\",\n role: \"runtime_entrypoint\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/agent\",\n role: \"platform_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/auth\",\n role: \"sdk_dependency\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/cli\",\n role: \"developer_tool\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/client-core\",\n role: \"sdk_dependency\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/confidence\",\n role: \"sdk_dependency\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/config\",\n role: \"configuration\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/contracts\",\n role: \"contract_entrypoint\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/control-plane\",\n role: \"platform_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/developer-kit\",\n role: \"developer_tool\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/events\",\n role: \"sdk_dependency\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/graph-primitives\",\n role: \"sdk_dependency\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/graph-sync\",\n role: \"host_addon_runtime\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/identity\",\n role: \"component_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/mcp\",\n role: \"runtime_entrypoint\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/pack-host\",\n role: \"platform_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/pack-installer\",\n role: \"developer_tool\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/proof-compiler\",\n role: \"developer_tool\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/react\",\n role: \"runtime_entrypoint\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/reasoning-kernel\",\n role: \"component_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/sdk\",\n role: \"runtime_entrypoint\",\n directTenantImport: true,\n },\n {\n packageName: \"@lucern/server-core\",\n role: \"platform_runtime\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/testing\",\n role: \"test_support\",\n directTenantImport: false,\n },\n {\n packageName: \"@lucern/types\",\n role: \"contract_entrypoint\",\n directTenantImport: true,\n },\n] as const;\nexport type TenantClientInstallablePackage =\n (typeof TENANT_CLIENT_INSTALLABLE_PACKAGES)[number];\nexport type TenantClientPackageRole = TenantClientInstallablePackage[\"role\"];\nexport type TenantClientInstallablePackageName =\n TenantClientInstallablePackage[\"packageName\"];\n\n/**\n * Direct package installs are package.json entries owned by the tenant repo.\n * Direct imports are source-code imports that tenant application code may use.\n *\n * These concepts intentionally differ: `@lucern/cli` is a direct install when a\n * tenant repo needs the `lucern` binary, but it is not a direct application\n * import. `@lucern/reasoning-kernel` and `@lucern/identity` are direct installs\n * for Convex component binding, while tenant app code should only import their\n * explicit component config subpaths.\n */\nexport type TenantClientInstallProfile = {\n id: string;\n description: string;\n packageNames: readonly TenantClientInstallablePackageName[];\n dependencyField: \"dependencies\" | \"devDependencies\" | \"mixed\";\n};\n\nexport const TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES =\n TENANT_CLIENT_INSTALLABLE_PACKAGES.map(\n (entry) => entry.packageName\n ) as readonly TenantClientInstallablePackageName[];\n\nexport const TENANT_CLIENT_INSTALL_PROFILES = [\n {\n id: \"core_app_runtime\",\n description:\n \"Smallest tenant app/runtime install for typed Lucern API calls plus tool-access policy helpers.\",\n packageNames: [\"@lucern/sdk\", \"@lucern/access-control\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"react_app_runtime\",\n description:\n \"React tenant app install for hooks, provider, curated graph components, and direct SDK calls.\",\n packageNames: [\"@lucern/react\", \"@lucern/sdk\", \"@lucern/access-control\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"convex_components\",\n description:\n \"Tenant Convex host install for binding the Lucern identity and reasoning-kernel components.\",\n packageNames: [\"@lucern/identity\", \"@lucern/reasoning-kernel\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"graph_mirroring_addon\",\n description:\n \"Optional tenant Convex host install for Neo4j graph projection, edge topology writes, backfill, health checks, and query proxy helpers.\",\n packageNames: [\"@lucern/graph-sync\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"operator_cli\",\n description:\n \"Developer/operator install for the `lucern` binary, including tenant bootstrap seed commands.\",\n packageNames: [\"@lucern/cli\"],\n dependencyField: \"devDependencies\",\n },\n {\n id: \"mcp_runtime\",\n description:\n \"Agent runtime install for the standalone Lucern MCP server and hosted route helpers.\",\n packageNames: [\"@lucern/mcp\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"contracts_and_types\",\n description:\n \"Compile-time contract/type install for codegen, audits, and tenant integration validation.\",\n packageNames: [\"@lucern/contracts\", \"@lucern/types\"],\n dependencyField: \"dependencies\",\n },\n {\n id: \"full_suite\",\n description:\n \"Full coherent Lucern package suite for design-partner repos that want every published runtime, tool, component, test, and config package pinned together.\",\n packageNames: TENANT_CLIENT_FULL_SUITE_PACKAGE_NAMES,\n dependencyField: \"mixed\",\n },\n] as const satisfies readonly TenantClientInstallProfile[];\nexport type TenantClientInstallProfileId =\n (typeof TENANT_CLIENT_INSTALL_PROFILES)[number][\"id\"];\n\n/**\n * Direct imports tenant-owned product code may use. This is intentionally\n * smaller than TENANT_CLIENT_INSTALLABLE_PACKAGES: several publishable packages\n * are installed as SDK dependencies, tooling, or platform runtimes but should\n * not become the application integration surface.\n */\nexport const TENANT_CLIENT_PUBLIC_IMPORTS = [\n {\n packageName: \"@lucern/sdk\",\n surface: \"runtime\",\n subpaths: \"published_exports\",\n description: \"TypeScript SDK runtime and generated operation namespaces.\",\n },\n {\n packageName: \"@lucern/react\",\n surface: \"runtime\",\n subpaths: \"published_exports\",\n description: \"React bindings for tenant-owned UI applications.\",\n },\n {\n packageName: \"@lucern/mcp\",\n surface: \"runtime\",\n subpaths: \"published_exports\",\n description: \"MCP client/server entry points and hosted route helpers.\",\n },\n {\n packageName: \"@lucern/graph-sync\",\n surface: \"runtime\",\n subpaths: \"published_exports\",\n description:\n \"Optional Neo4j graph mirroring host actions, edge API, query proxy, backfill, and health helpers.\",\n },\n {\n packageName: \"@lucern/contracts\",\n surface: \"contract\",\n subpaths: \"published_exports\",\n description: \"Published type and manifest contracts.\",\n },\n {\n packageName: \"@lucern/access-control\",\n surface: \"runtime\",\n subpaths: \"published_exports\",\n description:\n \"Tenant runtime access-control helpers, including effective tool access.\",\n },\n {\n packageName: \"@lucern/types\",\n surface: \"contract\",\n subpaths: \"published_exports\",\n description: \"Published type-only helpers for tenant integration code.\",\n },\n] as const;\nexport type TenantClientPublicImport =\n (typeof TENANT_CLIENT_PUBLIC_IMPORTS)[number];\nexport type TenantClientPublicPackage =\n TenantClientPublicImport[\"packageName\"];\nexport type TenantClientPublicSurface = TenantClientPublicImport[\"surface\"];\n\nexport const TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS = [\n {\n packageName: \"@lucern/identity\",\n importPath: \"@lucern/identity/convex.config\",\n surface: \"component_config\",\n description:\n \"Convex component binding config for tenant deployments that install Lucern identity.\",\n },\n {\n packageName: \"@lucern/reasoning-kernel\",\n importPath: \"@lucern/reasoning-kernel/convex.config\",\n surface: \"component_config\",\n description:\n \"Convex component binding config for tenant deployments that install the Lucern reasoning kernel.\",\n },\n {\n packageName: \"@lucern/reasoning-kernel\",\n importPath: \"@lucern/reasoning-kernel/runtime.config\",\n surface: \"component_config\",\n description:\n \"Runtime config alias for tenant deployments that install the Lucern reasoning kernel.\",\n },\n] as const;\nexport type TenantClientComponentConfigImport =\n (typeof TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS)[number];\nexport type TenantClientAllowedImport =\n | TenantClientPublicImport\n | TenantClientComponentConfigImport;\n\nexport function findTenantClientInstallablePackage(\n packageName: string\n): TenantClientInstallablePackage | undefined {\n return TENANT_CLIENT_INSTALLABLE_PACKAGES.find(\n (entry) => entry.packageName === packageName\n );\n}\n\nexport function isTenantClientInstallablePackage(packageName: string): boolean {\n return Boolean(findTenantClientInstallablePackage(packageName));\n}\n\nexport const TENANT_CLIENT_REQUIRED_SDK_NAMESPACES = [\n \"bootstrap\",\n \"context\",\n \"beliefs\",\n \"evidence\",\n \"questions\",\n \"graph\",\n \"worktrees\",\n \"topics\",\n \"edges\",\n \"contradictions\",\n \"contracts\",\n \"graphIntel\",\n \"graphIntelligence\",\n \"graphAnalysis\",\n \"graphRecommendations\",\n \"orgGraphSearch\",\n \"embeddings\",\n \"ontologyLinks\",\n \"graphStateClassifier\",\n \"tools\",\n \"identity\",\n \"modelRuntime\",\n \"events\",\n \"jobs\",\n \"telemetry\",\n] as const;\nexport type TenantClientRequiredSdkNamespace =\n (typeof TENANT_CLIENT_REQUIRED_SDK_NAMESPACES)[number];\n\nexport const TENANT_CLIENT_CAPABILITIES = [\n {\n id: \"identity.bootstrap_session\",\n description: \"Start a scoped Lucern session for a tenant principal.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"reasoning.context.compile\",\n description: \"Compile tenant and workspace scoped reasoning context.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/react\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"reasoning.graph.read\",\n description: \"Read beliefs, evidence, questions, topics, graph edges, and lineage.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/react\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"reasoning.graph.write\",\n description: \"Create and update graph objects through authorized APIs.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"reasoning.graph_intelligence.run\",\n description:\n \"Discover and run Graph Intelligence query recipes for structural graph analysis.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/cli\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"reasoning.graph_mirroring.install\",\n description:\n \"Install and run the optional Neo4j graph mirror for paid or enterprise tenant deployments.\",\n surfaces: [\"@lucern/graph-sync\", \"@lucern/cli\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n {\n id: \"workflow.worktree_lifecycle\",\n description: \"Create, review, merge, and close scoped worktrees.\",\n surfaces: [\"@lucern/sdk\", \"@lucern/react\", \"@lucern/mcp\"],\n requiredContextFields: TENANT_CLIENT_REQUIRED_CONTEXT_FIELDS,\n },\n] as const;\nexport type TenantClientCapability =\n (typeof TENANT_CLIENT_CAPABILITIES)[number];\nexport type TenantClientCapabilityId = TenantClientCapability[\"id\"];\n\nexport const TENANT_CLIENT_ISOLATION_RULES = [\n {\n id: \"tenant_workspace_scope_required\",\n description:\n \"Runtime operations must resolve both tenantId and workspaceId before reaching Lucern reasoning state.\",\n },\n {\n id: \"principal_audit_required\",\n description:\n \"Runtime operations must carry principalId, authMode, and scopes for audit attribution.\",\n },\n {\n id: \"no_private_lucern_imports\",\n description:\n \"Tenant code must not import Lucern source, Convex internals, generated adapters, or unpublished package internals.\",\n },\n] as const;\nexport type TenantClientIsolationRule =\n (typeof TENANT_CLIENT_ISOLATION_RULES)[number];\n\nexport const TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS = [\n {\n id: \"deep_src_import\",\n pattern: \"^@lucern/[^/]+/src(?:/|$)\",\n description: \"Published packages must not be bypassed through src paths.\",\n },\n {\n id: \"deep_dist_import\",\n pattern: \"^@lucern/[^/]+/dist(?:/|$)\",\n description:\n \"Published package exports must be used instead of dist file paths.\",\n },\n {\n id: \"generated_adapter_import\",\n pattern: \"^@lucern/[^/]+/(?:adapters/)?_generated(?:/|$)\",\n description:\n \"Generated Lucern adapters are internal deployment artifacts.\",\n },\n {\n id: \"private_runtime_import\",\n pattern: \"^@lucern/[^/]+/(?:internal|private)(?:/|$)\",\n description: \"Internal and private package subpaths are not public SDK API.\",\n },\n {\n id: \"workspace_source_import\",\n pattern: \"^(?:packages|modules|services|lucern|apps)/(?:.+/)?src(?:/|$)\",\n description:\n \"Tenant clients must not import source files from the Lucern monorepo.\",\n },\n {\n id: \"root_alias_lucern_import\",\n pattern: \"^@/(?:lucern|packages|modules|services|apps)(?:/|$)\",\n description:\n \"Tenant clients must not depend on Lucern repo-local path aliases.\",\n },\n {\n id: \"relative_lucern_source_import\",\n pattern: \"^\\\\.\\\\.?/(?:.+/)?(?:packages|modules|services|lucern|apps)(?:/|$)\",\n description:\n \"Tenant clients must not reach back into Lucern source through relative paths.\",\n },\n {\n id: \"monorepo_path_import\",\n pattern: \"lucern-repo\",\n description:\n \"Absolute imports that name the Lucern repository are not portable tenant code.\",\n },\n] as const;\nexport type TenantClientForbiddenImportPattern =\n (typeof TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS)[number];\nexport type TenantClientForbiddenImportPatternId =\n TenantClientForbiddenImportPattern[\"id\"];\n\nexport type TenantClientImportDecision =\n | \"public\"\n | \"forbidden\"\n | \"local\"\n | \"external\";\n\nexport type TenantClientImportClassification = {\n importPath: string;\n decision: TenantClientImportDecision;\n publicImport?: TenantClientAllowedImport;\n pattern?: TenantClientForbiddenImportPattern;\n reason: string;\n};\n\nfunction matchesPublicImport(\n importPath: string\n): TenantClientAllowedImport | undefined {\n const componentConfig = TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.find(\n (entry) => importPath === entry.importPath\n );\n if (componentConfig) {\n return componentConfig;\n }\n\n return TENANT_CLIENT_PUBLIC_IMPORTS.find(\n (entry) =>\n importPath === entry.packageName ||\n importPath.startsWith(`${entry.packageName}/`)\n );\n}\n\nfunction matchesForbiddenPattern(\n importPath: string\n): TenantClientForbiddenImportPattern | undefined {\n return TENANT_CLIENT_FORBIDDEN_IMPORT_PATTERNS.find((entry) =>\n new RegExp(entry.pattern, \"u\").test(importPath)\n );\n}\n\nexport function classifyTenantClientImport(\n importPath: string\n): TenantClientImportClassification {\n const normalizedImportPath = importPath.trim();\n const pattern = matchesForbiddenPattern(normalizedImportPath);\n\n if (pattern) {\n return {\n importPath: normalizedImportPath,\n decision: \"forbidden\",\n pattern,\n reason: pattern.description,\n };\n }\n\n const publicImport = matchesPublicImport(normalizedImportPath);\n if (publicImport) {\n return {\n importPath: normalizedImportPath,\n decision: \"public\",\n publicImport,\n reason: publicImport.description,\n };\n }\n\n if (normalizedImportPath.startsWith(\"@lucern/\")) {\n return {\n importPath: normalizedImportPath,\n decision: \"forbidden\",\n reason:\n \"This @lucern package is not part of the tenant client public surface.\",\n };\n }\n\n if (\n normalizedImportPath.startsWith(\"./\") ||\n normalizedImportPath.startsWith(\"../\")\n ) {\n return {\n importPath: normalizedImportPath,\n decision: \"local\",\n reason: \"Local tenant-owned import.\",\n };\n }\n\n return {\n importPath: normalizedImportPath,\n decision: \"external\",\n reason: \"External dependency outside the Lucern package namespace.\",\n };\n}\n\nexport function isTenantClientPublicImport(importPath: string): boolean {\n return classifyTenantClientImport(importPath).decision === \"public\";\n}\n\nexport function isTenantClientComponentConfigImport(\n importPath: string\n): boolean {\n return TENANT_CLIENT_COMPONENT_CONFIG_IMPORTS.some(\n (entry) => importPath === entry.importPath\n );\n}\n\nexport function isTenantClientAllowedImport(importPath: string): boolean {\n return classifyTenantClientImport(importPath).decision === \"public\";\n}\n\nexport function assertTenantClientImportAllowed(importPath: string): void {\n const classification = classifyTenantClientImport(importPath);\n if (classification.decision !== \"forbidden\") {\n return;\n }\n\n throw new Error(formatTenantClientImportViolation(classification));\n}\n\nexport function formatTenantClientImportViolation(\n classification: TenantClientImportClassification\n): string {\n const patternId = classification.pattern\n ? ` [${classification.pattern.id}]`\n : \"\";\n return `Tenant client import is not allowed${patternId}: ${classification.importPath}. ${classification.reason}`;\n}\n"]}
|