@lucern/sdk 1.0.11 → 1.0.13

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.
Files changed (331) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +24 -27
  3. package/dist/.generated +2 -0
  4. package/dist/accessControl.d.ts +19 -26
  5. package/dist/accessControl.js +195 -1423
  6. package/dist/adminClient.d.ts +52 -59
  7. package/dist/adminClient.js +364 -1142
  8. package/dist/answersClient.d.ts +5 -14
  9. package/dist/answersClient.js +19 -737
  10. package/dist/audience/index.d.ts +18 -18
  11. package/dist/audience/index.js +87 -90
  12. package/dist/audiencesClient.d.ts +19 -27
  13. package/dist/audiencesClient.js +107 -868
  14. package/dist/auditClient.d.ts +8 -15
  15. package/dist/auditClient.js +18 -791
  16. package/dist/authContext.d.ts +11 -16
  17. package/dist/authContext.js +122 -154
  18. package/dist/authDeviceClient.d.ts +8 -17
  19. package/dist/authDeviceClient.js +113 -102
  20. package/dist/beliefs/index.d.ts +16 -67
  21. package/dist/beliefs/index.js +20 -10181
  22. package/dist/beliefs/lifecycle.d.ts +10 -11
  23. package/dist/beliefs/lifecycle.js +78 -80
  24. package/dist/beliefsClient.d.ts +30 -35
  25. package/dist/beliefsClient.js +238 -994
  26. package/dist/boundaryClientSurface.d.ts +11 -16
  27. package/dist/boundaryClientSurface.js +49 -68
  28. package/dist/client.d.ts +82 -113
  29. package/dist/client.js +232 -10155
  30. package/dist/clientAssemblyTypes.d.ts +3 -3
  31. package/dist/clientAssemblyTypes.js +1 -2
  32. package/dist/clientConfig.d.ts +45 -59
  33. package/dist/clientConfig.js +1 -2
  34. package/dist/clientEvidenceCompat.d.ts +24 -14
  35. package/dist/clientEvidenceCompat.js +56 -64
  36. package/dist/clientGraphNamespaces.d.ts +3 -5
  37. package/dist/clientGraphNamespaces.js +170 -245
  38. package/dist/clientHelpers.d.ts +20 -25
  39. package/dist/clientHelpers.js +104 -127
  40. package/dist/clientKnowledgeNamespaces.d.ts +24 -54
  41. package/dist/clientKnowledgeNamespaces.js +506 -506
  42. package/dist/clientLocalHelpers.d.ts +11 -56
  43. package/dist/clientLocalHelpers.js +503 -732
  44. package/dist/clientPlatformNamespaces.d.ts +5 -53
  45. package/dist/clientPlatformNamespaces.js +229 -323
  46. package/dist/clientRuntime.d.ts +5 -53
  47. package/dist/clientRuntime.js +26 -30
  48. package/dist/clientWorkflowNamespaces.d.ts +6 -15
  49. package/dist/clientWorkflowNamespaces.js +529 -596
  50. package/dist/contextClient.d.ts +9 -17
  51. package/dist/contextClient.js +92 -805
  52. package/dist/contextFacade.d.ts +11 -2
  53. package/dist/contextFacade.js +10 -81
  54. package/dist/contextPackCompiler.d.ts +10 -11
  55. package/dist/contextPackCompiler.js +494 -1040
  56. package/dist/contextPackPolicy.d.ts +14 -15
  57. package/dist/contextPackPolicy.js +227 -305
  58. package/dist/contextPackSchema.d.ts +3 -3
  59. package/dist/contextPackSchema.js +169 -176
  60. package/dist/contextTypes.d.ts +14 -15
  61. package/dist/contextTypes.js +1 -2
  62. package/dist/contracts/api-enums.contract.d.ts +29 -30
  63. package/dist/contracts/api-enums.contract.js +162 -88
  64. package/dist/contracts/auth-session.contract.d.ts +13 -14
  65. package/dist/contracts/auth-session.contract.js +55 -52
  66. package/dist/contracts/context-pack.contract.d.ts +54 -55
  67. package/dist/contracts/context-pack.contract.js +160 -88
  68. package/dist/contracts/contextPack.d.ts +2 -1
  69. package/dist/contracts/contextPack.js +1 -97
  70. package/dist/contracts/index.d.ts +11 -12
  71. package/dist/contracts/index.js +10 -854
  72. package/dist/contracts/lens-filter.contract.d.ts +9 -10
  73. package/dist/contracts/lens-filter.contract.js +82 -58
  74. package/dist/contracts/lens-workflow.contract.d.ts +21 -23
  75. package/dist/contracts/lens-workflow.contract.js +48 -117
  76. package/dist/contracts/lensFilter.d.ts +2 -1
  77. package/dist/contracts/lensFilter.js +1 -71
  78. package/dist/contracts/lensWorkflow.d.ts +2 -2
  79. package/dist/contracts/lensWorkflow.js +1 -123
  80. package/dist/contracts/mcpTools.d.ts +16 -18
  81. package/dist/contracts/mcpTools.js +89 -123
  82. package/dist/contracts/prompt.contract.d.ts +4 -5
  83. package/dist/contracts/prompt.contract.js +23 -10
  84. package/dist/contracts/prompt.d.ts +2 -1
  85. package/dist/contracts/prompt.js +1 -11
  86. package/dist/contracts/sdk-tools.contract.d.ts +2 -1
  87. package/dist/contracts/sdk-tools.contract.js +1 -2
  88. package/dist/contracts/sdkTools.d.ts +2 -1
  89. package/dist/contracts/sdkTools.js +1 -26
  90. package/dist/contracts/tool-contracts.d.ts +2 -1
  91. package/dist/contracts/tool-contracts.js +1 -2
  92. package/dist/contracts/workflow-runtime.contract.d.ts +45 -46
  93. package/dist/contracts/workflow-runtime.contract.js +241 -228
  94. package/dist/contracts/workflowRuntime.d.ts +2 -1
  95. package/dist/contracts/workflowRuntime.js +1 -244
  96. package/dist/contradictions/index.d.ts +8 -60
  97. package/dist/contradictions/index.js +11 -10175
  98. package/dist/control-plane.d.ts +17 -24
  99. package/dist/control-plane.js +124 -840
  100. package/dist/controlObjectOwnership.d.ts +19 -20
  101. package/dist/controlObjectOwnership.js +207 -201
  102. package/dist/coreClient.d.ts +23 -28
  103. package/dist/coreClient.js +567 -692
  104. package/dist/customTools.d.ts +17 -21
  105. package/dist/customTools.js +221 -221
  106. package/dist/decisions/index.d.ts +7 -58
  107. package/dist/decisions/index.js +14 -10177
  108. package/dist/decisionsClient.d.ts +25 -32
  109. package/dist/decisionsClient.js +113 -913
  110. package/dist/domainContext.d.ts +2 -1
  111. package/dist/domainContext.js +1 -2
  112. package/dist/edges/index.d.ts +21 -73
  113. package/dist/edges/index.js +12 -10176
  114. package/dist/embeddingsClient.d.ts +22 -30
  115. package/dist/embeddingsClient.js +73 -922
  116. package/dist/eventingClient.d.ts +23 -31
  117. package/dist/eventingClient.js +89 -918
  118. package/dist/events.d.ts +48 -49
  119. package/dist/events.js +257 -241
  120. package/dist/eventsCore.d.ts +20 -29
  121. package/dist/eventsCore.js +86 -830
  122. package/dist/evidence/index.d.ts +42 -61
  123. package/dist/evidence/index.js +13 -10176
  124. package/dist/evidenceClient.d.ts +13 -22
  125. package/dist/evidenceClient.js +34 -751
  126. package/dist/facade/context.d.ts +7 -8
  127. package/dist/facade/context.js +73 -72
  128. package/dist/functionSurface.d.ts +2 -156
  129. package/dist/functionSurface.js +1 -1460
  130. package/dist/functionSurfaceClient.d.ts +2 -9
  131. package/dist/functionSurfaceClient.js +1 -1460
  132. package/dist/gatewayFacades.d.ts +93 -296
  133. package/dist/gatewayFacades.factories.d.ts +209 -14
  134. package/dist/gatewayFacades.factories.js +545 -2228
  135. package/dist/gatewayFacades.js +284 -2627
  136. package/dist/generated/functionSurface.d.ts +149 -0
  137. package/dist/generated/functionSurface.js +749 -0
  138. package/dist/graphAnalysisClient.d.ts +41 -49
  139. package/dist/graphAnalysisClient.js +185 -974
  140. package/dist/graphClient.d.ts +53 -60
  141. package/dist/graphClient.js +219 -1090
  142. package/dist/graphIntel.d.ts +2 -4
  143. package/dist/graphIntel.js +1 -2
  144. package/dist/graphIntelligence.d.ts +4 -2
  145. package/dist/graphIntelligence.js +2 -46
  146. package/dist/graphRecommendationsClient.d.ts +15 -23
  147. package/dist/graphRecommendationsClient.js +70 -849
  148. package/dist/graphStateClassifierClient.d.ts +17 -25
  149. package/dist/graphStateClassifierClient.js +67 -908
  150. package/dist/harnessClient.d.ts +40 -47
  151. package/dist/harnessClient.js +198 -993
  152. package/dist/identityClient.d.ts +25 -33
  153. package/dist/identityClient.js +245 -1186
  154. package/dist/index.d.ts +73 -69
  155. package/dist/index.js +72 -13313
  156. package/dist/infisicalRuntime.d.ts +12 -14
  157. package/dist/infisicalRuntime.js +290 -297
  158. package/dist/jobsClient.d.ts +24 -32
  159. package/dist/jobsClient.js +101 -916
  160. package/dist/learningClient.d.ts +8 -16
  161. package/dist/learningClient.js +45 -809
  162. package/dist/lenses/index.d.ts +13 -65
  163. package/dist/lenses/index.js +11 -10175
  164. package/dist/mcpClient.d.ts +14 -23
  165. package/dist/mcpClient.js +115 -856
  166. package/dist/modelRuntimeClient.d.ts +18 -26
  167. package/dist/modelRuntimeClient.js +74 -894
  168. package/dist/nodes/index.d.ts +7 -58
  169. package/dist/nodes/index.js +14 -10177
  170. package/dist/ontologies/index.d.ts +21 -73
  171. package/dist/ontologies/index.js +14 -10178
  172. package/dist/ontologyClient.d.ts +23 -31
  173. package/dist/ontologyClient.js +138 -924
  174. package/dist/ontologyLinksClient.d.ts +16 -24
  175. package/dist/ontologyLinksClient.js +76 -886
  176. package/dist/opinion.d.ts +5 -6
  177. package/dist/opinion.js +21 -25
  178. package/dist/orgGraphSearchClient.d.ts +19 -27
  179. package/dist/orgGraphSearchClient.js +89 -857
  180. package/dist/packRuntime.d.ts +2 -2
  181. package/dist/packRuntime.js +1 -2
  182. package/dist/packsClient.d.ts +30 -37
  183. package/dist/packsClient.js +131 -906
  184. package/dist/policyClient.d.ts +21 -29
  185. package/dist/policyClient.js +267 -1026
  186. package/dist/proof-attestation.json +1 -1
  187. package/dist/questions/index.d.ts +9 -60
  188. package/dist/questions/index.js +15 -10178
  189. package/dist/realtime/index.d.ts +20 -16
  190. package/dist/realtime/index.js +30 -19
  191. package/dist/realtime/refs.d.ts +4 -6
  192. package/dist/realtime/refs.js +12 -7
  193. package/dist/realtime-refs.d.ts +1 -0
  194. package/dist/realtime-refs.js +1 -0
  195. package/dist/realtime.d.ts +1 -0
  196. package/dist/realtime.js +1 -0
  197. package/dist/reportsClient.d.ts +10 -19
  198. package/dist/reportsClient.js +48 -836
  199. package/dist/schemaClient.d.ts +16 -23
  200. package/dist/schemaClient.js +62 -832
  201. package/dist/sdkSurface.d.ts +18 -25
  202. package/dist/sdkSurface.js +135 -106
  203. package/dist/secrets.d.ts +2 -1
  204. package/dist/secrets.js +1 -2
  205. package/dist/sourcesClient.d.ts +11 -18
  206. package/dist/sourcesClient.js +18 -741
  207. package/dist/telemetryClient.d.ts +22 -30
  208. package/dist/telemetryClient.js +107 -931
  209. package/dist/toolRegistryClient.d.ts +27 -35
  210. package/dist/toolRegistryClient.js +116 -954
  211. package/dist/topics/index.d.ts +13 -64
  212. package/dist/topics/index.js +15 -10178
  213. package/dist/topicsClient.d.ts +19 -27
  214. package/dist/topicsClient.js +106 -894
  215. package/dist/types.d.ts +84 -87
  216. package/dist/types.js +1 -2
  217. package/dist/version.d.ts +2 -3
  218. package/dist/version.js +2 -5
  219. package/dist/workflowClient.d.ts +60 -65
  220. package/dist/workflowClient.js +343 -1219
  221. package/dist/worktrees/index.d.ts +16 -68
  222. package/dist/worktrees/index.js +14 -10178
  223. package/package.json +6 -6
  224. package/dist/accessControl.js.map +0 -1
  225. package/dist/adminClient.js.map +0 -1
  226. package/dist/answersClient.js.map +0 -1
  227. package/dist/audience/index.js.map +0 -1
  228. package/dist/audiencesClient.js.map +0 -1
  229. package/dist/auditClient.js.map +0 -1
  230. package/dist/authContext.js.map +0 -1
  231. package/dist/authDeviceClient.js.map +0 -1
  232. package/dist/beliefs/index.js.map +0 -1
  233. package/dist/beliefs/lifecycle.js.map +0 -1
  234. package/dist/beliefsClient.js.map +0 -1
  235. package/dist/boundaryClientSurface.js.map +0 -1
  236. package/dist/client.js.map +0 -1
  237. package/dist/clientAssemblyTypes.js.map +0 -1
  238. package/dist/clientConfig.js.map +0 -1
  239. package/dist/clientEvidenceCompat.js.map +0 -1
  240. package/dist/clientGraphNamespaces.js.map +0 -1
  241. package/dist/clientHelpers.js.map +0 -1
  242. package/dist/clientKnowledgeNamespaces.js.map +0 -1
  243. package/dist/clientLocalHelpers.js.map +0 -1
  244. package/dist/clientPlatformNamespaces.js.map +0 -1
  245. package/dist/clientRuntime.js.map +0 -1
  246. package/dist/clientWorkflowNamespaces.js.map +0 -1
  247. package/dist/contextClient.js.map +0 -1
  248. package/dist/contextFacade.js.map +0 -1
  249. package/dist/contextPackCompiler.js.map +0 -1
  250. package/dist/contextPackPolicy.js.map +0 -1
  251. package/dist/contextPackSchema.js.map +0 -1
  252. package/dist/contextTypes.js.map +0 -1
  253. package/dist/contracts/api-enums.contract.js.map +0 -1
  254. package/dist/contracts/auth-session.contract.js.map +0 -1
  255. package/dist/contracts/context-pack.contract.js.map +0 -1
  256. package/dist/contracts/contextPack.js.map +0 -1
  257. package/dist/contracts/index.js.map +0 -1
  258. package/dist/contracts/lens-filter.contract.js.map +0 -1
  259. package/dist/contracts/lens-workflow.contract.js.map +0 -1
  260. package/dist/contracts/lensFilter.js.map +0 -1
  261. package/dist/contracts/lensWorkflow.js.map +0 -1
  262. package/dist/contracts/mcpTools.js.map +0 -1
  263. package/dist/contracts/prompt.contract.js.map +0 -1
  264. package/dist/contracts/prompt.js.map +0 -1
  265. package/dist/contracts/sdk-tools.contract.js.map +0 -1
  266. package/dist/contracts/sdkTools.js.map +0 -1
  267. package/dist/contracts/tool-contracts.js.map +0 -1
  268. package/dist/contracts/workflow-runtime.contract.js.map +0 -1
  269. package/dist/contracts/workflowRuntime.js.map +0 -1
  270. package/dist/contradictions/index.js.map +0 -1
  271. package/dist/control-plane.js.map +0 -1
  272. package/dist/controlObjectOwnership.js.map +0 -1
  273. package/dist/coreClient.js.map +0 -1
  274. package/dist/customTools.js.map +0 -1
  275. package/dist/decisions/index.js.map +0 -1
  276. package/dist/decisionsClient.js.map +0 -1
  277. package/dist/domainContext.js.map +0 -1
  278. package/dist/edges/index.js.map +0 -1
  279. package/dist/embeddingsClient.js.map +0 -1
  280. package/dist/eventingClient.js.map +0 -1
  281. package/dist/events.js.map +0 -1
  282. package/dist/eventsCore.js.map +0 -1
  283. package/dist/evidence/index.js.map +0 -1
  284. package/dist/evidenceClient.js.map +0 -1
  285. package/dist/facade/context.js.map +0 -1
  286. package/dist/functionSurface.js.map +0 -1
  287. package/dist/functionSurfaceClient.js.map +0 -1
  288. package/dist/gatewayFacades.factories.js.map +0 -1
  289. package/dist/gatewayFacades.js.map +0 -1
  290. package/dist/graphAnalysisClient.js.map +0 -1
  291. package/dist/graphClient.js.map +0 -1
  292. package/dist/graphIntel.js.map +0 -1
  293. package/dist/graphIntelligence.js.map +0 -1
  294. package/dist/graphRecommendationsClient.js.map +0 -1
  295. package/dist/graphStateClassifierClient.js.map +0 -1
  296. package/dist/harnessClient.js.map +0 -1
  297. package/dist/identityClient.js.map +0 -1
  298. package/dist/index.js.map +0 -1
  299. package/dist/infisicalRuntime.js.map +0 -1
  300. package/dist/jobsClient.js.map +0 -1
  301. package/dist/learningClient.js.map +0 -1
  302. package/dist/lenses/index.js.map +0 -1
  303. package/dist/mcpClient.js.map +0 -1
  304. package/dist/modelRuntimeClient.js.map +0 -1
  305. package/dist/nodes/index.js.map +0 -1
  306. package/dist/ontologies/index.js.map +0 -1
  307. package/dist/ontologyClient.js.map +0 -1
  308. package/dist/ontologyLinksClient.js.map +0 -1
  309. package/dist/opinion.js.map +0 -1
  310. package/dist/orgGraphSearchClient.js.map +0 -1
  311. package/dist/packRuntime.js.map +0 -1
  312. package/dist/packsClient.js.map +0 -1
  313. package/dist/policyClient.js.map +0 -1
  314. package/dist/questions/index.js.map +0 -1
  315. package/dist/realtime/index.js.map +0 -1
  316. package/dist/realtime/refs.js.map +0 -1
  317. package/dist/reportsClient.js.map +0 -1
  318. package/dist/schemaClient.js.map +0 -1
  319. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +0 -22
  320. package/dist/sdkSurface.js.map +0 -1
  321. package/dist/secrets.js.map +0 -1
  322. package/dist/sourcesClient.js.map +0 -1
  323. package/dist/telemetryClient.js.map +0 -1
  324. package/dist/tool-contracts-BUiL9P6z.d.ts +0 -22
  325. package/dist/toolRegistryClient.js.map +0 -1
  326. package/dist/topics/index.js.map +0 -1
  327. package/dist/topicsClient.js.map +0 -1
  328. package/dist/types.js.map +0 -1
  329. package/dist/version.js.map +0 -1
  330. package/dist/workflowClient.js.map +0 -1
  331. package/dist/worktrees/index.js.map +0 -1
@@ -21,7 +21,7 @@
21
21
  *
22
22
  * V2 will add `propertyMatchers` here for arbitrary JSON Schema facet queries.
23
23
  */
24
- type EntityTypeFilterV1 = {
24
+ export type EntityTypeFilterV1 = {
25
25
  /** References ontologyVersion.entityTypes[].value, e.g. "company" */
26
26
  entityTypeValue: string;
27
27
  /** Optional subtype narrowing. If omitted or empty, all subtypes match. */
@@ -31,14 +31,14 @@ type EntityTypeFilterV1 = {
31
31
  * Optional scope to restrict which ontology the filter resolves against.
32
32
  * If omitted, resolution uses whatever ontology is active in the workspace.
33
33
  */
34
- type OntologyScope = {
34
+ export type OntologyScope = {
35
35
  /** Restrict to a specific ontology by key, e.g. "vc-investment" */
36
36
  ontologyKey?: string;
37
37
  };
38
38
  /**
39
39
  * Taxonomy filter criteria v1: entity type + subtype matching over ontology.
40
40
  */
41
- type TaxonomyFilterCriteriaV1 = {
41
+ export type TaxonomyFilterCriteriaV1 = {
42
42
  version: 1;
43
43
  kind: "taxonomy";
44
44
  entityTypeFilters: EntityTypeFilterV1[];
@@ -54,10 +54,10 @@ type TaxonomyFilterCriteriaV1 = {
54
54
  * 3. Add a resolver in taxonomy-filter.ts
55
55
  * 4. No schema migration needed — filterCriteria is v.any()
56
56
  */
57
- type LensFilterCriteria = TaxonomyFilterCriteriaV1;
58
- declare function isLensFilterCriteria(value: unknown): value is LensFilterCriteria;
59
- declare function isTaxonomyFilterCriteriaV1(value: unknown): value is TaxonomyFilterCriteriaV1;
60
- type FilterValidationResult = {
57
+ export type LensFilterCriteria = TaxonomyFilterCriteriaV1;
58
+ export declare function isLensFilterCriteria(value: unknown): value is LensFilterCriteria;
59
+ export declare function isTaxonomyFilterCriteriaV1(value: unknown): value is TaxonomyFilterCriteriaV1;
60
+ export type FilterValidationResult = {
61
61
  valid: true;
62
62
  } | {
63
63
  valid: false;
@@ -67,6 +67,5 @@ type FilterValidationResult = {
67
67
  * Validate a filter criteria document at the contract layer.
68
68
  * This runs before persisting to Convex.
69
69
  */
70
- declare function validateFilterCriteria(value: unknown): FilterValidationResult;
71
-
72
- export { type EntityTypeFilterV1, type FilterValidationResult, type LensFilterCriteria, type OntologyScope, type TaxonomyFilterCriteriaV1, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria };
70
+ export declare function validateFilterCriteria(value: unknown): FilterValidationResult;
71
+ //# sourceMappingURL=lens-filter.contract.d.ts.map
@@ -1,72 +1,96 @@
1
- // src/contracts/lens-filter.contract.ts
2
- function isLensFilterCriteria(value) {
3
- return isRecord(value) && typeof value.version === "number" && typeof value.kind === "string";
1
+ /**
2
+ * Lens Filter Criteria Contract
3
+ *
4
+ * Version-discriminated filter DSL for lenses. Each filter criteria document
5
+ * carries a `version` and `kind` discriminator so future shapes can coexist
6
+ * without schema migrations. The Convex `filterCriteria` field remains v.any()
7
+ * — all type enforcement happens here at the TypeScript contract layer.
8
+ *
9
+ * Forward-compatibility guarantees:
10
+ * - `version` field: new versions add fields, never remove or rename existing ones
11
+ * - `kind` field: new filter kinds (temporal, confidence-range) can be added
12
+ * without touching taxonomy code paths
13
+ * - `entityTypeFilters` array items are open to extension in future versions
14
+ * - Resolution logic switches on `version` + `kind` to select the right resolver
15
+ *
16
+ * @module lucern/contracts/src/lens-filter
17
+ */
18
+ // Future: | TemporalFilterCriteriaV1 | ConfidenceRangeFilterCriteriaV1 | ...
19
+ // ---------------------------------------------------------------------------
20
+ // Type guards
21
+ // ---------------------------------------------------------------------------
22
+ export function isLensFilterCriteria(value) {
23
+ return isRecord(value) && typeof value.version === "number" && typeof value.kind === "string";
4
24
  }
5
- function isTaxonomyFilterCriteriaV1(value) {
6
- if (!isLensFilterCriteria(value)) return false;
7
- return value.version === 1 && value.kind === "taxonomy";
25
+ export function isTaxonomyFilterCriteriaV1(value) {
26
+ if (!isLensFilterCriteria(value))
27
+ return false;
28
+ return value.version === 1 && value.kind === "taxonomy";
8
29
  }
9
- function validateFilterCriteria(value) {
10
- if (value === void 0 || value === null) {
11
- return { valid: true };
12
- }
13
- if (!isLensFilterCriteria(value)) {
30
+ /**
31
+ * Validate a filter criteria document at the contract layer.
32
+ * This runs before persisting to Convex.
33
+ */
34
+ export function validateFilterCriteria(value) {
35
+ if (value === undefined || value === null) {
36
+ return { valid: true }; // filterCriteria is optional
37
+ }
38
+ if (!isLensFilterCriteria(value)) {
39
+ return {
40
+ valid: false,
41
+ errors: [
42
+ 'filterCriteria must have numeric "version" and string "kind" fields',
43
+ ],
44
+ };
45
+ }
46
+ if (isTaxonomyFilterCriteriaV1(value)) {
47
+ return validateTaxonomyFilterV1(value);
48
+ }
49
+ // Cast to access properties — TypeScript narrows to `never` when all union
50
+ // members are exhausted, but at runtime unknown version/kind combos are possible.
51
+ const raw = value;
14
52
  return {
15
- valid: false,
16
- errors: [
17
- 'filterCriteria must have numeric "version" and string "kind" fields'
18
- ]
53
+ valid: false,
54
+ errors: [
55
+ `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`,
56
+ ],
19
57
  };
20
- }
21
- if (isTaxonomyFilterCriteriaV1(value)) {
22
- return validateTaxonomyFilterV1(value);
23
- }
24
- const raw = value;
25
- return {
26
- valid: false,
27
- errors: [
28
- `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`
29
- ]
30
- };
31
58
  }
32
59
  function isRecord(value) {
33
- return value !== null && typeof value === "object" && !Array.isArray(value);
60
+ return value !== null && typeof value === "object" && !Array.isArray(value);
34
61
  }
35
62
  function validateTaxonomyFilterV1(criteria) {
36
- const errors = [];
37
- if (!Array.isArray(criteria.entityTypeFilters)) {
38
- errors.push("entityTypeFilters must be an array");
39
- return { valid: false, errors };
40
- }
41
- if (criteria.entityTypeFilters.length === 0) {
42
- errors.push("entityTypeFilters must contain at least one entry");
43
- return { valid: false, errors };
44
- }
45
- for (let i = 0; i < criteria.entityTypeFilters.length; i++) {
46
- const filter = criteria.entityTypeFilters[i];
47
- if (!filter || typeof filter.entityTypeValue !== "string") {
48
- errors.push(
49
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
50
- );
51
- continue;
63
+ const errors = [];
64
+ if (!Array.isArray(criteria.entityTypeFilters)) {
65
+ errors.push("entityTypeFilters must be an array");
66
+ return { valid: false, errors };
52
67
  }
53
- if (filter.entityTypeValue.trim().length === 0) {
54
- errors.push(
55
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
56
- );
68
+ if (criteria.entityTypeFilters.length === 0) {
69
+ errors.push("entityTypeFilters must contain at least one entry");
70
+ return { valid: false, errors };
57
71
  }
58
- if (filter.subtypeValues !== void 0 && !Array.isArray(filter.subtypeValues)) {
59
- errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);
72
+ for (let i = 0; i < criteria.entityTypeFilters.length; i++) {
73
+ const filter = criteria.entityTypeFilters[i];
74
+ if (!filter || typeof filter.entityTypeValue !== "string") {
75
+ errors.push(`entityTypeFilters[${i}].entityTypeValue must be a non-empty string`);
76
+ continue;
77
+ }
78
+ if (filter.entityTypeValue.trim().length === 0) {
79
+ errors.push(`entityTypeFilters[${i}].entityTypeValue must be a non-empty string`);
80
+ }
81
+ if (filter.subtypeValues !== undefined &&
82
+ !Array.isArray(filter.subtypeValues)) {
83
+ errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);
84
+ }
60
85
  }
61
- }
62
- if (criteria.ontologyScope !== void 0) {
63
- if (typeof criteria.ontologyScope !== "object" || criteria.ontologyScope === null) {
64
- errors.push("ontologyScope must be an object");
86
+ if (criteria.ontologyScope !== undefined) {
87
+ if (typeof criteria.ontologyScope !== "object" ||
88
+ criteria.ontologyScope === null) {
89
+ errors.push("ontologyScope must be an object");
90
+ }
65
91
  }
66
- }
67
- return errors.length === 0 ? { valid: true } : { valid: false, errors };
92
+ return errors.length === 0
93
+ ? { valid: true }
94
+ : { valid: false, errors };
68
95
  }
69
-
70
- export { isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria };
71
- //# sourceMappingURL=lens-filter.contract.js.map
72
96
  //# sourceMappingURL=lens-filter.contract.js.map
@@ -1,17 +1,16 @@
1
- export { EntityTypeFilterV1, FilterValidationResult, LensFilterCriteria, OntologyScope, TaxonomyFilterCriteriaV1, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria } from './lens-filter.contract.js';
2
-
3
1
  /**
4
2
  * Canonical lens workflow contract shared across schema, SDK, and MCP surfaces.
5
3
  */
6
-
7
- declare const LENS_PERSPECTIVE_TYPES: readonly ["investigation", "monitoring", "analysis", "comparison", "taxonomy"];
8
- type LensPerspectiveType = (typeof LENS_PERSPECTIVE_TYPES)[number];
9
- declare const LENS_STATUSES: readonly ["draft", "active", "archived"];
10
- type LensStatus = (typeof LENS_STATUSES)[number];
11
- declare const LENS_TASK_TEMPLATE_PRIORITIES: readonly ["critical", "high", "medium", "low"];
12
- type LensTaskTemplatePriority = (typeof LENS_TASK_TEMPLATE_PRIORITIES)[number];
13
- type LensLooseMetadata = Record<string, unknown>;
14
- type LensPromptTemplateReference = {
4
+ export type { LensFilterCriteria, TaxonomyFilterCriteriaV1, EntityTypeFilterV1, OntologyScope, FilterValidationResult, } from "./lens-filter.contract";
5
+ export { validateFilterCriteria, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, } from "./lens-filter.contract";
6
+ export declare const LENS_PERSPECTIVE_TYPES: readonly ["investigation", "monitoring", "analysis", "comparison", "taxonomy"];
7
+ export type LensPerspectiveType = (typeof LENS_PERSPECTIVE_TYPES)[number];
8
+ export declare const LENS_STATUSES: readonly ["draft", "active", "archived"];
9
+ export type LensStatus = (typeof LENS_STATUSES)[number];
10
+ export declare const LENS_TASK_TEMPLATE_PRIORITIES: readonly ["critical", "high", "medium", "low"];
11
+ export type LensTaskTemplatePriority = (typeof LENS_TASK_TEMPLATE_PRIORITIES)[number];
12
+ export type LensLooseMetadata = Record<string, unknown>;
13
+ export type LensPromptTemplateReference = {
15
14
  key: string;
16
15
  promptRef: string;
17
16
  phase?: string;
@@ -20,7 +19,7 @@ type LensPromptTemplateReference = {
20
19
  required?: boolean;
21
20
  metadata?: LensLooseMetadata;
22
21
  };
23
- type LensWorkflowStepTemplate = {
22
+ export type LensWorkflowStepTemplate = {
24
23
  key: string;
25
24
  title: string;
26
25
  description?: string;
@@ -28,14 +27,14 @@ type LensWorkflowStepTemplate = {
28
27
  taskTemplateKeys?: string[];
29
28
  metadata?: LensLooseMetadata;
30
29
  };
31
- type LensWorkflowTemplate = {
30
+ export type LensWorkflowTemplate = {
32
31
  key: string;
33
32
  name: string;
34
33
  description?: string;
35
34
  steps: LensWorkflowStepTemplate[];
36
35
  metadata?: LensLooseMetadata;
37
36
  };
38
- type LensTaskTemplate = {
37
+ export type LensTaskTemplate = {
39
38
  key: string;
40
39
  title: string;
41
40
  description?: string;
@@ -43,14 +42,14 @@ type LensTaskTemplate = {
43
42
  phase?: string;
44
43
  metadata?: LensLooseMetadata;
45
44
  };
46
- type LensQuestionTemplate = {
45
+ export type LensQuestionTemplate = {
47
46
  key: string;
48
47
  text: string;
49
48
  priority?: LensTaskTemplatePriority;
50
49
  linkedBeliefKey?: string;
51
50
  metadata?: LensLooseMetadata;
52
51
  };
53
- type LensBranchMigrationSuggestion = {
52
+ export type LensBranchMigrationSuggestion = {
54
53
  recommendedTool: "create_lens";
55
54
  perspectiveType: LensPerspectiveType;
56
55
  message: string;
@@ -62,26 +61,25 @@ type LensBranchMigrationSuggestion = {
62
61
  perspectiveType: LensPerspectiveType;
63
62
  };
64
63
  };
65
- declare const BRANCH_DEPRECATION_MESSAGE = "Branches are deprecated for operational framing. Create a workspace-scoped lens instead.";
66
- type DeprecatedBranchMetadata = {
64
+ export declare const BRANCH_DEPRECATION_MESSAGE = "Branches are deprecated for operational framing. Create a workspace-scoped lens instead.";
65
+ export type DeprecatedBranchMetadata = {
67
66
  deprecated: true;
68
67
  deprecationMessage: string;
69
68
  lensSuggestion: LensBranchMigrationSuggestion;
70
69
  };
71
- declare function inferLensPerspectiveTypeFromBranchSchema(schema?: string | null): LensPerspectiveType;
72
- declare function migrateBranchToLens(args: {
70
+ export declare function inferLensPerspectiveTypeFromBranchSchema(schema?: string | null): LensPerspectiveType;
71
+ export declare function migrateBranchToLens(args: {
73
72
  name: string;
74
73
  description?: string;
75
74
  topicId?: string;
76
75
  workspaceId?: string;
77
76
  schema?: string | null;
78
77
  }): LensBranchMigrationSuggestion;
79
- declare function buildDeprecatedBranchMetadata(args: {
78
+ export declare function buildDeprecatedBranchMetadata(args: {
80
79
  name: string;
81
80
  description?: string;
82
81
  topicId?: string;
83
82
  workspaceId?: string;
84
83
  schema?: string | null;
85
84
  }): DeprecatedBranchMetadata;
86
-
87
- export { BRANCH_DEPRECATION_MESSAGE, type DeprecatedBranchMetadata, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, type LensBranchMigrationSuggestion, type LensLooseMetadata, type LensPerspectiveType, type LensPromptTemplateReference, type LensQuestionTemplate, type LensStatus, type LensTaskTemplate, type LensTaskTemplatePriority, type LensWorkflowStepTemplate, type LensWorkflowTemplate, buildDeprecatedBranchMetadata, inferLensPerspectiveTypeFromBranchSchema, migrateBranchToLens };
85
+ //# sourceMappingURL=lens-workflow.contract.d.ts.map
@@ -1,124 +1,55 @@
1
- // src/contracts/lens-filter.contract.ts
2
- function isLensFilterCriteria(value) {
3
- return isRecord(value) && typeof value.version === "number" && typeof value.kind === "string";
4
- }
5
- function isTaxonomyFilterCriteriaV1(value) {
6
- if (!isLensFilterCriteria(value)) return false;
7
- return value.version === 1 && value.kind === "taxonomy";
8
- }
9
- function validateFilterCriteria(value) {
10
- if (value === void 0 || value === null) {
11
- return { valid: true };
12
- }
13
- if (!isLensFilterCriteria(value)) {
14
- return {
15
- valid: false,
16
- errors: [
17
- 'filterCriteria must have numeric "version" and string "kind" fields'
18
- ]
19
- };
20
- }
21
- if (isTaxonomyFilterCriteriaV1(value)) {
22
- return validateTaxonomyFilterV1(value);
23
- }
24
- const raw = value;
25
- return {
26
- valid: false,
27
- errors: [
28
- `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`
29
- ]
30
- };
31
- }
32
- function isRecord(value) {
33
- return value !== null && typeof value === "object" && !Array.isArray(value);
34
- }
35
- function validateTaxonomyFilterV1(criteria) {
36
- const errors = [];
37
- if (!Array.isArray(criteria.entityTypeFilters)) {
38
- errors.push("entityTypeFilters must be an array");
39
- return { valid: false, errors };
40
- }
41
- if (criteria.entityTypeFilters.length === 0) {
42
- errors.push("entityTypeFilters must contain at least one entry");
43
- return { valid: false, errors };
44
- }
45
- for (let i = 0; i < criteria.entityTypeFilters.length; i++) {
46
- const filter = criteria.entityTypeFilters[i];
47
- if (!filter || typeof filter.entityTypeValue !== "string") {
48
- errors.push(
49
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
50
- );
51
- continue;
52
- }
53
- if (filter.entityTypeValue.trim().length === 0) {
54
- errors.push(
55
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
56
- );
1
+ /**
2
+ * Canonical lens workflow contract shared across schema, SDK, and MCP surfaces.
3
+ */
4
+ export { validateFilterCriteria, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, } from "./lens-filter.contract.js";
5
+ export const LENS_PERSPECTIVE_TYPES = [
6
+ "investigation",
7
+ "monitoring",
8
+ "analysis",
9
+ "comparison",
10
+ "taxonomy",
11
+ ];
12
+ export const LENS_STATUSES = ["draft", "active", "archived"];
13
+ export const LENS_TASK_TEMPLATE_PRIORITIES = [
14
+ "critical",
15
+ "high",
16
+ "medium",
17
+ "low",
18
+ ];
19
+ export const BRANCH_DEPRECATION_MESSAGE = "Branches are deprecated for operational framing. Create a workspace-scoped lens instead.";
20
+ export function inferLensPerspectiveTypeFromBranchSchema(schema) {
21
+ const normalized = schema?.trim().toLowerCase();
22
+ if (normalized === "phase") {
23
+ return "monitoring";
57
24
  }
58
- if (filter.subtypeValues !== void 0 && !Array.isArray(filter.subtypeValues)) {
59
- errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);
25
+ if (normalized === "axis" || normalized === "dimension") {
26
+ return "comparison";
60
27
  }
61
- }
62
- if (criteria.ontologyScope !== void 0) {
63
- if (typeof criteria.ontologyScope !== "object" || criteria.ontologyScope === null) {
64
- errors.push("ontologyScope must be an object");
28
+ if (normalized === "track") {
29
+ return "investigation";
65
30
  }
66
- }
67
- return errors.length === 0 ? { valid: true } : { valid: false, errors };
31
+ return "analysis";
68
32
  }
69
-
70
- // src/contracts/lens-workflow.contract.ts
71
- var LENS_PERSPECTIVE_TYPES = [
72
- "investigation",
73
- "monitoring",
74
- "analysis",
75
- "comparison",
76
- "taxonomy"
77
- ];
78
- var LENS_STATUSES = ["draft", "active", "archived"];
79
- var LENS_TASK_TEMPLATE_PRIORITIES = [
80
- "critical",
81
- "high",
82
- "medium",
83
- "low"
84
- ];
85
- var BRANCH_DEPRECATION_MESSAGE = "Branches are deprecated for operational framing. Create a workspace-scoped lens instead.";
86
- function inferLensPerspectiveTypeFromBranchSchema(schema) {
87
- const normalized = schema?.trim().toLowerCase();
88
- if (normalized === "phase") {
89
- return "monitoring";
90
- }
91
- if (normalized === "axis" || normalized === "dimension") {
92
- return "comparison";
93
- }
94
- if (normalized === "track") {
95
- return "investigation";
96
- }
97
- return "analysis";
98
- }
99
- function migrateBranchToLens(args) {
100
- const perspectiveType = inferLensPerspectiveTypeFromBranchSchema(args.schema);
101
- return {
102
- recommendedTool: "create_lens",
103
- perspectiveType,
104
- message: "Branches are deprecated for operational framing. Create a workspace-scoped lens with the suggested payload instead.",
105
- suggestedPayload: {
106
- name: args.name,
107
- description: args.description,
108
- topicId: args.topicId,
109
- workspaceId: args.workspaceId,
110
- perspectiveType
111
- }
112
- };
33
+ export function migrateBranchToLens(args) {
34
+ const perspectiveType = inferLensPerspectiveTypeFromBranchSchema(args.schema);
35
+ return {
36
+ recommendedTool: "create_lens",
37
+ perspectiveType,
38
+ message: "Branches are deprecated for operational framing. Create a workspace-scoped lens with the suggested payload instead.",
39
+ suggestedPayload: {
40
+ name: args.name,
41
+ description: args.description,
42
+ topicId: args.topicId,
43
+ workspaceId: args.workspaceId,
44
+ perspectiveType,
45
+ },
46
+ };
113
47
  }
114
- function buildDeprecatedBranchMetadata(args) {
115
- return {
116
- deprecated: true,
117
- deprecationMessage: BRANCH_DEPRECATION_MESSAGE,
118
- lensSuggestion: migrateBranchToLens(args)
119
- };
48
+ export function buildDeprecatedBranchMetadata(args) {
49
+ return {
50
+ deprecated: true,
51
+ deprecationMessage: BRANCH_DEPRECATION_MESSAGE,
52
+ lensSuggestion: migrateBranchToLens(args),
53
+ };
120
54
  }
121
-
122
- export { BRANCH_DEPRECATION_MESSAGE, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, buildDeprecatedBranchMetadata, inferLensPerspectiveTypeFromBranchSchema, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, migrateBranchToLens, validateFilterCriteria };
123
- //# sourceMappingURL=lens-workflow.contract.js.map
124
55
  //# sourceMappingURL=lens-workflow.contract.js.map
@@ -1 +1,2 @@
1
- export { EntityTypeFilterV1, FilterValidationResult, LensFilterCriteria, OntologyScope, TaxonomyFilterCriteriaV1, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria } from './lens-filter.contract.js';
1
+ export * from "./lens-filter.contract";
2
+ //# sourceMappingURL=lensFilter.d.ts.map
@@ -1,72 +1,2 @@
1
- // src/contracts/lens-filter.contract.ts
2
- function isLensFilterCriteria(value) {
3
- return isRecord(value) && typeof value.version === "number" && typeof value.kind === "string";
4
- }
5
- function isTaxonomyFilterCriteriaV1(value) {
6
- if (!isLensFilterCriteria(value)) return false;
7
- return value.version === 1 && value.kind === "taxonomy";
8
- }
9
- function validateFilterCriteria(value) {
10
- if (value === void 0 || value === null) {
11
- return { valid: true };
12
- }
13
- if (!isLensFilterCriteria(value)) {
14
- return {
15
- valid: false,
16
- errors: [
17
- 'filterCriteria must have numeric "version" and string "kind" fields'
18
- ]
19
- };
20
- }
21
- if (isTaxonomyFilterCriteriaV1(value)) {
22
- return validateTaxonomyFilterV1(value);
23
- }
24
- const raw = value;
25
- return {
26
- valid: false,
27
- errors: [
28
- `Unsupported filter criteria: version=${raw.version}, kind=${raw.kind}`
29
- ]
30
- };
31
- }
32
- function isRecord(value) {
33
- return value !== null && typeof value === "object" && !Array.isArray(value);
34
- }
35
- function validateTaxonomyFilterV1(criteria) {
36
- const errors = [];
37
- if (!Array.isArray(criteria.entityTypeFilters)) {
38
- errors.push("entityTypeFilters must be an array");
39
- return { valid: false, errors };
40
- }
41
- if (criteria.entityTypeFilters.length === 0) {
42
- errors.push("entityTypeFilters must contain at least one entry");
43
- return { valid: false, errors };
44
- }
45
- for (let i = 0; i < criteria.entityTypeFilters.length; i++) {
46
- const filter = criteria.entityTypeFilters[i];
47
- if (!filter || typeof filter.entityTypeValue !== "string") {
48
- errors.push(
49
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
50
- );
51
- continue;
52
- }
53
- if (filter.entityTypeValue.trim().length === 0) {
54
- errors.push(
55
- `entityTypeFilters[${i}].entityTypeValue must be a non-empty string`
56
- );
57
- }
58
- if (filter.subtypeValues !== void 0 && !Array.isArray(filter.subtypeValues)) {
59
- errors.push(`entityTypeFilters[${i}].subtypeValues must be an array`);
60
- }
61
- }
62
- if (criteria.ontologyScope !== void 0) {
63
- if (typeof criteria.ontologyScope !== "object" || criteria.ontologyScope === null) {
64
- errors.push("ontologyScope must be an object");
65
- }
66
- }
67
- return errors.length === 0 ? { valid: true } : { valid: false, errors };
68
- }
69
-
70
- export { isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria };
71
- //# sourceMappingURL=lensFilter.js.map
1
+ export * from "./lens-filter.contract.js";
72
2
  //# sourceMappingURL=lensFilter.js.map
@@ -1,2 +1,2 @@
1
- export { BRANCH_DEPRECATION_MESSAGE, DeprecatedBranchMetadata, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LensBranchMigrationSuggestion, LensLooseMetadata, LensPerspectiveType, LensPromptTemplateReference, LensQuestionTemplate, LensStatus, LensTaskTemplate, LensTaskTemplatePriority, LensWorkflowStepTemplate, LensWorkflowTemplate, buildDeprecatedBranchMetadata, inferLensPerspectiveTypeFromBranchSchema, migrateBranchToLens } from './lens-workflow.contract.js';
2
- export { EntityTypeFilterV1, FilterValidationResult, LensFilterCriteria, OntologyScope, TaxonomyFilterCriteriaV1, isLensFilterCriteria, isTaxonomyFilterCriteriaV1, validateFilterCriteria } from './lens-filter.contract.js';
1
+ export * from "./lens-workflow.contract";
2
+ //# sourceMappingURL=lensWorkflow.d.ts.map