@lucern/sdk 0.2.0-alpha.12 → 0.2.0-alpha.2

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 (317) hide show
  1. package/README.md +166 -609
  2. package/dist/index.js +3539 -6269
  3. package/dist/index.js.map +1 -1
  4. package/dist/{contracts → lucern/contracts/src}/auth-session.contract.d.ts +12 -14
  5. package/dist/{contracts → lucern/contracts/src}/context-pack.contract.d.ts +58 -56
  6. package/dist/{contracts → lucern/contracts/src}/lens-filter.contract.d.ts +8 -10
  7. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +84 -0
  8. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +151 -0
  9. package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +161 -0
  10. package/dist/lucern/mcp-server/src/context-pack-policy.d.ts +119 -0
  11. package/dist/lucern/mcp-server/src/context-pack-schema.d.ts +18 -0
  12. package/dist/lucern/modules/graph-primitives/src/ontology-matching.d.ts +78 -0
  13. package/dist/lucern/modules/graph-primitives/src/text-matching.d.ts +53 -0
  14. package/dist/lucern/packages/client-core/src/beliefs.d.ts +30 -0
  15. package/dist/lucern/packages/client-core/src/context.d.ts +29 -0
  16. package/dist/lucern/packages/client-core/src/contradictions.d.ts +11 -0
  17. package/dist/lucern/packages/client-core/src/edges.d.ts +11 -0
  18. package/dist/lucern/packages/client-core/src/events.d.ts +9 -0
  19. package/dist/lucern/packages/client-core/src/evidence.d.ts +21 -0
  20. package/dist/lucern/packages/client-core/src/graph.d.ts +17 -0
  21. package/dist/lucern/packages/client-core/src/identity.d.ts +7 -0
  22. package/dist/lucern/packages/client-core/src/ids.d.ts +7 -0
  23. package/dist/lucern/packages/client-core/src/ontologies.d.ts +13 -0
  24. package/dist/lucern/packages/client-core/src/questions.d.ts +39 -0
  25. package/dist/lucern/packages/client-core/src/search.d.ts +7 -0
  26. package/dist/lucern/packages/client-core/src/tasks.d.ts +13 -0
  27. package/dist/lucern/packages/client-core/src/topics.d.ts +17 -0
  28. package/dist/lucern/packages/client-core/src/webhooks.d.ts +35 -0
  29. package/dist/lucern/packages/client-core/src/worktrees.d.ts +17 -0
  30. package/dist/lucern/packages/domain-beliefs/src/beliefs.d.ts +283 -0
  31. package/dist/lucern/packages/domain-beliefs/src/index.d.ts +1 -0
  32. package/dist/lucern/packages/domain-context/src/compile.d.ts +11 -0
  33. package/dist/{contextPackCompiler.d.ts → lucern/packages/domain-context/src/context-pack-compiler.d.ts} +10 -11
  34. package/dist/lucern/packages/domain-context/src/index.d.ts +4 -0
  35. package/dist/lucern/packages/domain-context/src/ports.d.ts +58 -0
  36. package/dist/lucern/packages/domain-context/src/public-types.d.ts +1 -0
  37. package/dist/lucern/packages/domain-edges/src/contradictions.d.ts +59 -0
  38. package/dist/lucern/packages/domain-edges/src/edges.d.ts +91 -0
  39. package/dist/lucern/packages/domain-edges/src/index.d.ts +2 -0
  40. package/dist/lucern/packages/domain-evidence/src/evidence.d.ts +115 -0
  41. package/dist/lucern/packages/domain-evidence/src/index.d.ts +1 -0
  42. package/dist/lucern/packages/domain-graph/src/graph.d.ts +150 -0
  43. package/dist/lucern/packages/domain-identity/src/index.d.ts +1 -0
  44. package/dist/lucern/packages/domain-identity/src/whoami.d.ts +13 -0
  45. package/dist/lucern/packages/domain-ontologies/src/ontologies.d.ts +123 -0
  46. package/dist/lucern/packages/domain-questions/src/index.d.ts +1 -0
  47. package/dist/lucern/packages/domain-questions/src/questions.d.ts +147 -0
  48. package/dist/lucern/packages/domain-search/src/search.d.ts +97 -0
  49. package/dist/lucern/packages/domain-tasks/src/index.d.ts +1 -0
  50. package/dist/lucern/packages/domain-tasks/src/tasks.d.ts +102 -0
  51. package/dist/lucern/packages/domain-topics/src/index.d.ts +1 -0
  52. package/dist/lucern/packages/domain-topics/src/topics.d.ts +147 -0
  53. package/dist/lucern/packages/domain-worktrees/src/index.d.ts +1 -0
  54. package/dist/lucern/packages/domain-worktrees/src/worktrees.d.ts +185 -0
  55. package/dist/lucern/packages/events/src/index.d.ts +4 -0
  56. package/dist/lucern/packages/events/src/matching.d.ts +3 -0
  57. package/dist/lucern/packages/events/src/outbox.d.ts +15 -0
  58. package/dist/lucern/packages/events/src/types.d.ts +151 -0
  59. package/dist/lucern/packages/events/src/webhooks.d.ts +9 -0
  60. package/dist/lucern/packages/sdk-typescript/src/facade/beliefs.d.ts +15 -0
  61. package/dist/lucern/packages/sdk-typescript/src/facade/context.d.ts +12 -0
  62. package/dist/lucern/packages/sdk-typescript/src/facade/contradictions.d.ts +7 -0
  63. package/dist/lucern/packages/sdk-typescript/src/facade/edges.d.ts +7 -0
  64. package/dist/lucern/packages/sdk-typescript/src/facade/events.d.ts +6 -0
  65. package/dist/lucern/packages/sdk-typescript/src/facade/evidence.d.ts +21 -0
  66. package/dist/lucern/packages/sdk-typescript/src/facade/graph.d.ts +10 -0
  67. package/dist/lucern/packages/sdk-typescript/src/facade/identity.d.ts +5 -0
  68. package/dist/lucern/packages/sdk-typescript/src/facade/ontologies.d.ts +8 -0
  69. package/dist/lucern/packages/sdk-typescript/src/facade/questions.d.ts +39 -0
  70. package/dist/lucern/packages/sdk-typescript/src/facade/search.d.ts +5 -0
  71. package/dist/lucern/packages/sdk-typescript/src/facade/tasks.d.ts +8 -0
  72. package/dist/lucern/packages/sdk-typescript/src/facade/topics.d.ts +10 -0
  73. package/dist/lucern/packages/sdk-typescript/src/facade/webhooks.d.ts +16 -0
  74. package/dist/lucern/packages/sdk-typescript/src/facade/worktrees.d.ts +10 -0
  75. package/dist/lucern/packages/sdk-typescript/src/index.d.ts +28 -0
  76. package/dist/packages/sdk/src/adminClient.d.ts +89 -0
  77. package/dist/packages/sdk/src/answersClient.d.ts +5 -0
  78. package/dist/{audiencesClient.d.ts → packages/sdk/src/audiencesClient.d.ts} +18 -30
  79. package/dist/packages/sdk/src/auditClient.d.ts +21 -0
  80. package/dist/packages/sdk/src/beliefsClient.d.ts +52 -0
  81. package/dist/packages/sdk/src/client.d.ts +1558 -0
  82. package/dist/packages/sdk/src/contextClient.d.ts +9 -0
  83. package/dist/packages/sdk/src/contracts/api-enums.contract.d.ts +58 -0
  84. package/dist/{controlObjectOwnership.d.ts → packages/sdk/src/controlObjectOwnership.d.ts} +18 -35
  85. package/dist/{coreClient.d.ts → packages/sdk/src/coreClient.d.ts} +14 -38
  86. package/dist/packages/sdk/src/customTools.d.ts +65 -0
  87. package/dist/packages/sdk/src/decisionsClient.d.ts +97 -0
  88. package/dist/packages/sdk/src/graphClient.d.ts +191 -0
  89. package/dist/{harnessClient.d.ts → packages/sdk/src/harnessClient.d.ts} +33 -127
  90. package/dist/packages/sdk/src/identityClient.d.ts +104 -0
  91. package/dist/packages/sdk/src/index.d.ts +28 -0
  92. package/dist/packages/sdk/src/learningClient.d.ts +37 -0
  93. package/dist/{mcpParityClient.d.ts → packages/sdk/src/mcpParityClient.d.ts} +5 -11
  94. package/dist/packages/sdk/src/mcpParitySurface.d.ts +8 -0
  95. package/dist/{ontologyClient.d.ts → packages/sdk/src/ontologyClient.d.ts} +22 -44
  96. package/dist/packages/sdk/src/packsClient.d.ts +101 -0
  97. package/dist/{policyClient.d.ts → packages/sdk/src/policyClient.d.ts} +18 -113
  98. package/dist/packages/sdk/src/reportsClient.d.ts +31 -0
  99. package/dist/packages/sdk/src/schemaClient.d.ts +54 -0
  100. package/dist/packages/sdk/src/sdkSurface.d.ts +55 -0
  101. package/dist/packages/sdk/src/topicsClient.d.ts +45 -0
  102. package/dist/packages/sdk/src/types.d.ts +470 -0
  103. package/dist/packages/sdk/src/version.d.ts +2 -0
  104. package/dist/packages/sdk/src/workflowClient.d.ts +252 -0
  105. package/package.json +37 -92
  106. package/CHANGELOG.md +0 -13
  107. package/dist/adminClient.d.ts +0 -409
  108. package/dist/adminClient.js +0 -755
  109. package/dist/adminClient.js.map +0 -1
  110. package/dist/answersClient.d.ts +0 -23
  111. package/dist/answersClient.js +0 -333
  112. package/dist/answersClient.js.map +0 -1
  113. package/dist/audience/index.d.ts +0 -38
  114. package/dist/audience/index.js +0 -110
  115. package/dist/audience/index.js.map +0 -1
  116. package/dist/audiencesClient.js +0 -472
  117. package/dist/audiencesClient.js.map +0 -1
  118. package/dist/auditClient.d.ts +0 -29
  119. package/dist/auditClient.js +0 -386
  120. package/dist/auditClient.js.map +0 -1
  121. package/dist/beliefs/index.d.ts +0 -465
  122. package/dist/beliefs/index.js +0 -6433
  123. package/dist/beliefs/index.js.map +0 -1
  124. package/dist/beliefs/lifecycle.d.ts +0 -24
  125. package/dist/beliefs/lifecycle.js +0 -98
  126. package/dist/beliefs/lifecycle.js.map +0 -1
  127. package/dist/beliefsClient.d.ts +0 -241
  128. package/dist/beliefsClient.js +0 -646
  129. package/dist/beliefsClient.js.map +0 -1
  130. package/dist/client.d.ts +0 -2398
  131. package/dist/client.js +0 -6411
  132. package/dist/client.js.map +0 -1
  133. package/dist/contextClient.d.ts +0 -27
  134. package/dist/contextClient.js +0 -396
  135. package/dist/contextClient.js.map +0 -1
  136. package/dist/contextFacade.d.ts +0 -2
  137. package/dist/contextFacade.js +0 -73
  138. package/dist/contextFacade.js.map +0 -1
  139. package/dist/contextPackCompiler.js +0 -1091
  140. package/dist/contextPackCompiler.js.map +0 -1
  141. package/dist/contextPackPolicy.d.ts +0 -84
  142. package/dist/contextPackPolicy.js +0 -347
  143. package/dist/contextPackPolicy.js.map +0 -1
  144. package/dist/contextPackSchema.d.ts +0 -7
  145. package/dist/contextPackSchema.js +0 -203
  146. package/dist/contextPackSchema.js.map +0 -1
  147. package/dist/contextTypes.d.ts +0 -135
  148. package/dist/contextTypes.js +0 -3
  149. package/dist/contextTypes.js.map +0 -1
  150. package/dist/contracts/api-enums.contract.d.ts +0 -81
  151. package/dist/contracts/api-enums.contract.js +0 -98
  152. package/dist/contracts/api-enums.contract.js.map +0 -1
  153. package/dist/contracts/auth-session.contract.js +0 -48
  154. package/dist/contracts/auth-session.contract.js.map +0 -1
  155. package/dist/contracts/context-pack.contract.js +0 -98
  156. package/dist/contracts/context-pack.contract.js.map +0 -1
  157. package/dist/contracts/contextPack.d.ts +0 -1
  158. package/dist/contracts/contextPack.js +0 -98
  159. package/dist/contracts/contextPack.js.map +0 -1
  160. package/dist/contracts/index.d.ts +0 -9
  161. package/dist/contracts/index.js +0 -4928
  162. package/dist/contracts/index.js.map +0 -1
  163. package/dist/contracts/lens-filter.contract.js +0 -71
  164. package/dist/contracts/lens-filter.contract.js.map +0 -1
  165. package/dist/contracts/lens-workflow.contract.d.ts +0 -87
  166. package/dist/contracts/lens-workflow.contract.js +0 -123
  167. package/dist/contracts/lens-workflow.contract.js.map +0 -1
  168. package/dist/contracts/lensFilter.d.ts +0 -1
  169. package/dist/contracts/lensFilter.js +0 -71
  170. package/dist/contracts/lensFilter.js.map +0 -1
  171. package/dist/contracts/lensWorkflow.d.ts +0 -2
  172. package/dist/contracts/lensWorkflow.js +0 -123
  173. package/dist/contracts/lensWorkflow.js.map +0 -1
  174. package/dist/contracts/mcp-tools.contract.d.ts +0 -1
  175. package/dist/contracts/mcp-tools.contract.js +0 -3016
  176. package/dist/contracts/mcp-tools.contract.js.map +0 -1
  177. package/dist/contracts/mcpTools.d.ts +0 -1
  178. package/dist/contracts/mcpTools.js +0 -3016
  179. package/dist/contracts/mcpTools.js.map +0 -1
  180. package/dist/contracts/prompt.contract.d.ts +0 -26
  181. package/dist/contracts/prompt.contract.js +0 -12
  182. package/dist/contracts/prompt.contract.js.map +0 -1
  183. package/dist/contracts/prompt.d.ts +0 -1
  184. package/dist/contracts/prompt.js +0 -12
  185. package/dist/contracts/prompt.js.map +0 -1
  186. package/dist/contracts/sdk-tools.contract.d.ts +0 -2
  187. package/dist/contracts/sdk-tools.contract.js +0 -4164
  188. package/dist/contracts/sdk-tools.contract.js.map +0 -1
  189. package/dist/contracts/sdkTools.d.ts +0 -2
  190. package/dist/contracts/sdkTools.js +0 -4164
  191. package/dist/contracts/sdkTools.js.map +0 -1
  192. package/dist/contracts/workflow-runtime.contract.d.ts +0 -163
  193. package/dist/contracts/workflow-runtime.contract.js +0 -245
  194. package/dist/contracts/workflow-runtime.contract.js.map +0 -1
  195. package/dist/contracts/workflowRuntime.d.ts +0 -1
  196. package/dist/contracts/workflowRuntime.js +0 -245
  197. package/dist/contracts/workflowRuntime.js.map +0 -1
  198. package/dist/contradictions/index.d.ts +0 -158
  199. package/dist/contradictions/index.js +0 -6427
  200. package/dist/contradictions/index.js.map +0 -1
  201. package/dist/controlObjectOwnership.js +0 -215
  202. package/dist/controlObjectOwnership.js.map +0 -1
  203. package/dist/coreClient.js +0 -339
  204. package/dist/coreClient.js.map +0 -1
  205. package/dist/customTools.d.ts +0 -88
  206. package/dist/customTools.js +0 -248
  207. package/dist/customTools.js.map +0 -1
  208. package/dist/decisions/index.d.ts +0 -68
  209. package/dist/decisions/index.js +0 -6429
  210. package/dist/decisions/index.js.map +0 -1
  211. package/dist/decisionsClient.d.ts +0 -111
  212. package/dist/decisionsClient.js +0 -522
  213. package/dist/decisionsClient.js.map +0 -1
  214. package/dist/domainContext.d.ts +0 -1
  215. package/dist/domainContext.js +0 -3
  216. package/dist/domainContext.js.map +0 -1
  217. package/dist/edges/index.d.ts +0 -204
  218. package/dist/edges/index.js +0 -6428
  219. package/dist/edges/index.js.map +0 -1
  220. package/dist/events.d.ts +0 -178
  221. package/dist/events.js +0 -251
  222. package/dist/events.js.map +0 -1
  223. package/dist/eventsCore.d.ts +0 -49
  224. package/dist/eventsCore.js +0 -429
  225. package/dist/eventsCore.js.map +0 -1
  226. package/dist/evidence/index.d.ts +0 -295
  227. package/dist/evidence/index.js +0 -6428
  228. package/dist/evidence/index.js.map +0 -1
  229. package/dist/evidenceClient.d.ts +0 -119
  230. package/dist/evidenceClient.js +0 -350
  231. package/dist/evidenceClient.js.map +0 -1
  232. package/dist/facade/context.d.ts +0 -18
  233. package/dist/facade/context.js +0 -73
  234. package/dist/facade/context.js.map +0 -1
  235. package/dist/gatewayFacades.d.ts +0 -589
  236. package/dist/gatewayFacades.js +0 -2006
  237. package/dist/gatewayFacades.js.map +0 -1
  238. package/dist/graphClient.d.ts +0 -271
  239. package/dist/graphClient.js +0 -698
  240. package/dist/graphClient.js.map +0 -1
  241. package/dist/harnessClient.js +0 -607
  242. package/dist/harnessClient.js.map +0 -1
  243. package/dist/identityClient.d.ts +0 -140
  244. package/dist/identityClient.js +0 -497
  245. package/dist/identityClient.js.map +0 -1
  246. package/dist/index.d.ts +0 -45
  247. package/dist/learningClient.d.ts +0 -46
  248. package/dist/learningClient.js +0 -409
  249. package/dist/learningClient.js.map +0 -1
  250. package/dist/lenses/index.d.ts +0 -194
  251. package/dist/lenses/index.js +0 -6427
  252. package/dist/lenses/index.js.map +0 -1
  253. package/dist/mcpParityClient.js +0 -516
  254. package/dist/mcpParityClient.js.map +0 -1
  255. package/dist/mcpParitySurface.d.ts +0 -12
  256. package/dist/mcpParitySurface.js +0 -65
  257. package/dist/mcpParitySurface.js.map +0 -1
  258. package/dist/mcpTools-DPZxowDX.d.ts +0 -254
  259. package/dist/nodes/index.d.ts +0 -62
  260. package/dist/nodes/index.js +0 -6429
  261. package/dist/nodes/index.js.map +0 -1
  262. package/dist/ontologies/index.d.ts +0 -178
  263. package/dist/ontologies/index.js +0 -6430
  264. package/dist/ontologies/index.js.map +0 -1
  265. package/dist/ontologyClient.js +0 -513
  266. package/dist/ontologyClient.js.map +0 -1
  267. package/dist/opinion.d.ts +0 -11
  268. package/dist/opinion.js +0 -35
  269. package/dist/opinion.js.map +0 -1
  270. package/dist/packRuntime.d.ts +0 -2
  271. package/dist/packRuntime.js +0 -3
  272. package/dist/packRuntime.js.map +0 -1
  273. package/dist/packsClient.d.ts +0 -131
  274. package/dist/packsClient.js +0 -525
  275. package/dist/packsClient.js.map +0 -1
  276. package/dist/policyClient.js +0 -625
  277. package/dist/policyClient.js.map +0 -1
  278. package/dist/questions/index.d.ts +0 -297
  279. package/dist/questions/index.js +0 -6430
  280. package/dist/questions/index.js.map +0 -1
  281. package/dist/realtime/index.d.ts +0 -29
  282. package/dist/realtime/index.js +0 -23
  283. package/dist/realtime/index.js.map +0 -1
  284. package/dist/realtime/refs.d.ts +0 -17
  285. package/dist/realtime/refs.js +0 -9
  286. package/dist/realtime/refs.js.map +0 -1
  287. package/dist/reportsClient.d.ts +0 -41
  288. package/dist/reportsClient.js +0 -418
  289. package/dist/reportsClient.js.map +0 -1
  290. package/dist/schemaClient.d.ts +0 -64
  291. package/dist/schemaClient.js +0 -434
  292. package/dist/schemaClient.js.map +0 -1
  293. package/dist/sdkSurface.d.ts +0 -61
  294. package/dist/sdkSurface.js +0 -112
  295. package/dist/sdkSurface.js.map +0 -1
  296. package/dist/sdkTools-CwXJDACb.d.ts +0 -150
  297. package/dist/sourcesClient.d.ts +0 -24
  298. package/dist/sourcesClient.js +0 -339
  299. package/dist/sourcesClient.js.map +0 -1
  300. package/dist/topics/index.d.ts +0 -68
  301. package/dist/topics/index.js +0 -6428
  302. package/dist/topics/index.js.map +0 -1
  303. package/dist/topicsClient.d.ts +0 -84
  304. package/dist/topicsClient.js +0 -492
  305. package/dist/topicsClient.js.map +0 -1
  306. package/dist/types.d.ts +0 -715
  307. package/dist/types.js +0 -3
  308. package/dist/types.js.map +0 -1
  309. package/dist/version.d.ts +0 -4
  310. package/dist/version.js +0 -6
  311. package/dist/version.js.map +0 -1
  312. package/dist/workflowClient.d.ts +0 -316
  313. package/dist/workflowClient.js +0 -830
  314. package/dist/workflowClient.js.map +0 -1
  315. package/dist/worktrees/index.d.ts +0 -210
  316. package/dist/worktrees/index.js +0 -6430
  317. package/dist/worktrees/index.js.map +0 -1
@@ -4,13 +4,13 @@
4
4
  * Canonical session lifecycle vocabulary shared by platform gateway auth,
5
5
  * hosted MCP auth, Master Control persistence, and SDK session tokens.
6
6
  */
7
- declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
8
- type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
9
- declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
10
- type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
11
- declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
12
- type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
13
- type SessionDelegationHop = {
7
+ export declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
8
+ export type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
9
+ export declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
10
+ export type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
11
+ export declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
12
+ export type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
13
+ export type SessionDelegationHop = {
14
14
  principalId: string;
15
15
  principalType: SessionPrincipalType;
16
16
  authMode?: SessionAuthMode;
@@ -18,8 +18,8 @@ type SessionDelegationHop = {
18
18
  delegatedAt?: number;
19
19
  reason?: string;
20
20
  };
21
- type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
22
- type SessionAuditEnvelope = {
21
+ export type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
22
+ export type SessionAuditEnvelope = {
23
23
  sessionId: string;
24
24
  authMode: SessionAuthMode;
25
25
  principalId: string;
@@ -42,14 +42,12 @@ type SessionAuditEnvelope = {
42
42
  reason?: string;
43
43
  };
44
44
  };
45
- declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
46
- declare function normalizeDelegationChain(args: {
45
+ export declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
46
+ export declare function normalizeDelegationChain(args: {
47
47
  delegationChain?: readonly SessionDelegationHop[];
48
48
  delegatedBy?: string;
49
49
  delegatedByType?: SessionPrincipalType;
50
50
  delegatedAt?: number;
51
51
  reason?: string;
52
52
  }): SessionDelegationHop[] | undefined;
53
- declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
54
-
55
- export { SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, type SessionAuditEnvelope, type SessionAuditOutcome, type SessionAuthMode, type SessionDelegationHop, type SessionLifecycleStatus, type SessionPrincipalType, inferSessionPrincipalType, lastDelegator, normalizeDelegationChain };
53
+ export declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
@@ -14,7 +14,7 @@
14
14
  * - Changing the version string is BREAKING (consumers check it)
15
15
  */
16
16
  /** Canonical version string. Consumers MUST check this field for compatibility. */
17
- declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
17
+ export declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
18
18
  /**
19
19
  * Available ranking profiles for context-pack assembly.
20
20
  *
@@ -22,9 +22,9 @@ declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
22
22
  * - `weighted_v1`: Multi-signal scoring combining query relevance, recency, confidence,
23
23
  * belief type, priority, and severity with section-specific weight vectors.
24
24
  */
25
- type ContextRankingProfile = "baseline_v1" | "weighted_v1";
26
- declare const CONTEXT_RANKING_PROFILES: readonly ContextRankingProfile[];
27
- declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
25
+ export type ContextRankingProfile = "baseline_v1" | "weighted_v1";
26
+ export declare const CONTEXT_RANKING_PROFILES: readonly ContextRankingProfile[];
27
+ export declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
28
28
  /**
29
29
  * Context compilation mode.
30
30
  *
@@ -32,14 +32,14 @@ declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
32
32
  * - `delta`: Diff-aware — adds failure context, verification obligations,
33
33
  * and worktree ledger analysis to the standard context pack.
34
34
  */
35
- type ContextCompilationMode = "standard" | "delta";
36
- declare const DEFAULT_COMPILATION_MODE: ContextCompilationMode;
35
+ export type ContextCompilationMode = "standard" | "delta";
36
+ export declare const DEFAULT_COMPILATION_MODE: ContextCompilationMode;
37
37
  /**
38
38
  * The five canonical sections of a context pack.
39
39
  * Order matters: invariants are injected first, contradictions last.
40
40
  */
41
- type ContextPackSectionKey = "invariants" | "activeBeliefs" | "openQuestions" | "recentEvidence" | "contradictions";
42
- declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[];
41
+ export type ContextPackSectionKey = "invariants" | "activeBeliefs" | "openQuestions" | "recentEvidence" | "contradictions";
42
+ export declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[];
43
43
  /**
44
44
  * Token budget allocation ratios per section.
45
45
  * These sum to 1.0 and determine how the total tokenBudget is divided.
@@ -51,19 +51,19 @@ declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[];
51
51
  * - recentEvidence (0.17): Implementation context for grounding
52
52
  * - contradictions (0.08): Tension signals, smallest section
53
53
  */
54
- declare const SECTION_BUDGET_RATIOS: Readonly<Record<ContextPackSectionKey, number>>;
54
+ export declare const SECTION_BUDGET_RATIOS: Readonly<Record<ContextPackSectionKey, number>>;
55
55
  /** Minimum allowed token budget. Below this, context packs lose utility. */
56
- declare const MIN_TOKEN_BUDGET = 400;
56
+ export declare const MIN_TOKEN_BUDGET = 400;
57
57
  /** Maximum allowed token budget. Above this, context packs bloat prompts. */
58
- declare const MAX_TOKEN_BUDGET = 8000;
58
+ export declare const MAX_TOKEN_BUDGET = 8000;
59
59
  /** Default token budget when caller does not specify. */
60
- declare const DEFAULT_TOKEN_BUDGET = 1800;
60
+ export declare const DEFAULT_TOKEN_BUDGET = 1800;
61
61
  /** Default max items per section. */
62
- declare const DEFAULT_SECTION_LIMIT = 8;
62
+ export declare const DEFAULT_SECTION_LIMIT = 8;
63
63
  /** Hard ceiling on items per section. */
64
- declare const MAX_SECTION_LIMIT = 25;
64
+ export declare const MAX_SECTION_LIMIT = 25;
65
65
  /** Minimum contradiction section budget floor (tokens). */
66
- declare const MIN_CONTRADICTION_BUDGET = 40;
66
+ export declare const MIN_CONTRADICTION_BUDGET = 40;
67
67
  /**
68
68
  * Weight vectors for the weighted_v1 ranking profile.
69
69
  * Each section has a different signal mix:
@@ -75,7 +75,7 @@ declare const MIN_CONTRADICTION_BUDGET = 40;
75
75
  * - priority: Question priority (critical > high > medium > low)
76
76
  * - severity: Contradiction severity (critical > high > medium > low)
77
77
  */
78
- type RankingWeightVector = {
78
+ export type RankingWeightVector = {
79
79
  query: number;
80
80
  recency: number;
81
81
  confidence?: number;
@@ -83,35 +83,35 @@ type RankingWeightVector = {
83
83
  priority?: number;
84
84
  severity?: number;
85
85
  };
86
- declare const RANKING_WEIGHTS: Readonly<Record<ContextPackSectionKey, RankingWeightVector>>;
86
+ export declare const RANKING_WEIGHTS: Readonly<Record<ContextPackSectionKey, RankingWeightVector>>;
87
87
  /** Recency decay half-life in days. After 30 days, recency score = 0.5. */
88
- declare const RECENCY_HALF_LIFE_DAYS = 30;
88
+ export declare const RECENCY_HALF_LIFE_DAYS = 30;
89
89
  /**
90
90
  * Ranking weight vector for the relatedEntities section.
91
91
  * Entities are ranked by query relevance and connectivity (bridge edge count).
92
92
  * Separate from RANKING_WEIGHTS because entities are not part of the
93
93
  * token-budgeted injection plan.
94
94
  */
95
- declare const ENTITY_RANKING_WEIGHTS: {
95
+ export declare const ENTITY_RANKING_WEIGHTS: {
96
96
  readonly query: 0.4;
97
97
  readonly connectivity: 0.6;
98
98
  };
99
99
  /** Default max entities to include in the context pack. */
100
- declare const DEFAULT_ENTITY_LIMIT = 10;
100
+ export declare const DEFAULT_ENTITY_LIMIT = 10;
101
101
  /** Hard ceiling on entities per context pack. */
102
- declare const MAX_ENTITY_LIMIT = 50;
102
+ export declare const MAX_ENTITY_LIMIT = 50;
103
103
  /**
104
104
  * Bonus multiplier for belief types in ranking.
105
105
  * Invariants get 1.0, unknown types get 0.4.
106
106
  */
107
- declare const BELIEF_TYPE_BONUS: Readonly<Record<string, number>>;
108
- declare const DEFAULT_BELIEF_TYPE_BONUS = 0.4;
109
- declare const PRIORITY_SCORES: Readonly<Record<string, number>>;
110
- declare const DEFAULT_PRIORITY_SCORE = 0.5;
111
- declare const SEVERITY_SCORES: Readonly<Record<string, number>>;
112
- declare const DEFAULT_SEVERITY_SCORE = 0.5;
107
+ export declare const BELIEF_TYPE_BONUS: Readonly<Record<string, number>>;
108
+ export declare const DEFAULT_BELIEF_TYPE_BONUS = 0.4;
109
+ export declare const PRIORITY_SCORES: Readonly<Record<string, number>>;
110
+ export declare const DEFAULT_PRIORITY_SCORE = 0.5;
111
+ export declare const SEVERITY_SCORES: Readonly<Record<string, number>>;
112
+ export declare const DEFAULT_SEVERITY_SCORE = 0.5;
113
113
  /** A ranked belief in the invariants or activeBeliefs section. */
114
- type ContextPackBelief = {
114
+ export type ContextPackBelief = {
115
115
  nodeId: string;
116
116
  canonicalText: string;
117
117
  confidence: number | null;
@@ -124,7 +124,7 @@ type ContextPackBelief = {
124
124
  justification?: string;
125
125
  };
126
126
  /** A ranked question in the openQuestions section. */
127
- type ContextPackQuestion = {
127
+ export type ContextPackQuestion = {
128
128
  questionId: string;
129
129
  text: string;
130
130
  status: string;
@@ -135,7 +135,7 @@ type ContextPackQuestion = {
135
135
  justification?: string;
136
136
  };
137
137
  /** A ranked evidence item in the recentEvidence section. */
138
- type ContextPackEvidence = {
138
+ export type ContextPackEvidence = {
139
139
  nodeId: string;
140
140
  canonicalText: string;
141
141
  sourceUrl: string | null;
@@ -146,7 +146,7 @@ type ContextPackEvidence = {
146
146
  justification?: string;
147
147
  };
148
148
  /** A ranked contradiction in the contradictions section. */
149
- type ContextPackContradiction = {
149
+ export type ContextPackContradiction = {
150
150
  contradictionId: string;
151
151
  severity: string;
152
152
  status: string;
@@ -161,7 +161,7 @@ type ContextPackContradiction = {
161
161
  * to beliefs via bridge edges. They provide the "reality anchor" that makes
162
162
  * the reasoning graph domain-aware.
163
163
  */
164
- type ContextPackEntity = {
164
+ export type ContextPackEntity = {
165
165
  /** Convex document ID of the entity node. */
166
166
  nodeId: string;
167
167
  /** Entity type (e.g., "company", "person", "function"). */
@@ -181,7 +181,7 @@ type ContextPackEntity = {
181
181
  * A lattice seed entry representing a belief that was auto-generated
182
182
  * to cover an ontology entity type within a topic scope.
183
183
  */
184
- type BeliefLatticeSeed = {
184
+ export type BeliefLatticeSeed = {
185
185
  /** The belief node ID that was created or already existed. */
186
186
  beliefNodeId: string;
187
187
  /** The entity type this seed belief covers. */
@@ -192,7 +192,7 @@ type BeliefLatticeSeed = {
192
192
  canonicalText: string;
193
193
  };
194
194
  /** Counts and scoped health signals for the context pack. */
195
- type ContextPackSummary = {
195
+ export type ContextPackSummary = {
196
196
  totalBeliefs: number;
197
197
  invariants: number;
198
198
  openQuestions: number;
@@ -205,7 +205,7 @@ type ContextPackSummary = {
205
205
  query: string | null;
206
206
  };
207
207
  /** A failed approach surfaced from the failure log for anti-repetition. */
208
- type ContextPackFailure = {
208
+ export type ContextPackFailure = {
209
209
  /** Lucern attempt/evidence node ID. */
210
210
  attemptId: string;
211
211
  /** What was tried. */
@@ -218,14 +218,14 @@ type ContextPackFailure = {
218
218
  score: number;
219
219
  };
220
220
  /** Failure context section appended to context packs in delta mode. */
221
- type ContextPackFailureContext = {
221
+ export type ContextPackFailureContext = {
222
222
  /** Ranked failed approaches relevant to the current query. */
223
223
  failures: ContextPackFailure[];
224
224
  /** IDs of items suppressed from other sections due to anti-repetition. */
225
225
  suppressedIds: string[];
226
226
  };
227
227
  /** A verification obligation surfaced by delta compilation. */
228
- type VerificationObligation = {
228
+ export type VerificationObligation = {
229
229
  /** What must be verified. */
230
230
  description: string;
231
231
  /** Source of the obligation (e.g., "belief:xyz confidence drop"). */
@@ -234,7 +234,7 @@ type VerificationObligation = {
234
234
  severity: "critical" | "high" | "medium" | "low";
235
235
  };
236
236
  /** Delta report appended to context packs when mode = "delta". */
237
- type ContextPackDeltaReport = {
237
+ export type ContextPackDeltaReport = {
238
238
  /** Items that changed since the reference point (new, updated, removed). */
239
239
  changedItems: Array<{
240
240
  id: string;
@@ -251,14 +251,14 @@ type ContextPackDeltaReport = {
251
251
  * Per-section weight overrides that domain packs can apply.
252
252
  * Overrides merge with RANKING_WEIGHTS — only specified fields replace defaults.
253
253
  */
254
- type PackWeightOverride = {
254
+ export type PackWeightOverride = {
255
255
  /** Which section to override weights for. */
256
256
  section: ContextPackSectionKey;
257
257
  /** Partial weight vector — only specified fields replace defaults. */
258
258
  weights: Partial<RankingWeightVector>;
259
259
  };
260
260
  /** Token-budgeted section selections for prompt injection. */
261
- type ContextPackInjectionPolicy = {
261
+ export type ContextPackInjectionPolicy = {
262
262
  /** Total token budget for the entire context pack. */
263
263
  tokenBudget: number;
264
264
  /** Estimated tokens consumed across all sections. */
@@ -278,7 +278,7 @@ type ContextPackInjectionPolicy = {
278
278
  }>;
279
279
  };
280
280
  /** Telemetry for context pack assembly. */
281
- type ContextPackDiagnostics = {
281
+ export type ContextPackDiagnostics = {
282
282
  /** Total candidates scored across all sections. */
283
283
  itemsScored: number;
284
284
  /** Ratio of estimatedTokens / tokenBudget. Range [0, 1+]. */
@@ -290,7 +290,7 @@ type ContextPackDiagnostics = {
290
290
  * This preserves the existing external shape while the canonical compiler
291
291
  * contract evolves in parallel as ContextPackV1.
292
292
  */
293
- type PublicContextBelief = {
293
+ export type PublicContextBelief = {
294
294
  beliefId: string;
295
295
  text: string;
296
296
  confidence: number | null;
@@ -300,7 +300,7 @@ type PublicContextBelief = {
300
300
  score: number;
301
301
  justification?: string;
302
302
  };
303
- type PublicContextQuestion = {
303
+ export type PublicContextQuestion = {
304
304
  questionId: string;
305
305
  text: string;
306
306
  status: string;
@@ -309,7 +309,7 @@ type PublicContextQuestion = {
309
309
  score: number;
310
310
  justification?: string;
311
311
  };
312
- type PublicContextEvidence = {
312
+ export type PublicContextEvidence = {
313
313
  evidenceId: string;
314
314
  text: string;
315
315
  sourceUrl?: string | null;
@@ -318,7 +318,7 @@ type PublicContextEvidence = {
318
318
  score: number;
319
319
  justification?: string;
320
320
  };
321
- type PublicContextContradiction = {
321
+ export type PublicContextContradiction = {
322
322
  contradictionId: string;
323
323
  severity: string;
324
324
  status: string;
@@ -326,7 +326,7 @@ type PublicContextContradiction = {
326
326
  score: number;
327
327
  justification?: string;
328
328
  };
329
- type PublicContextEntity = {
329
+ export type PublicContextEntity = {
330
330
  entityId: string;
331
331
  entityType: string;
332
332
  title: string;
@@ -336,7 +336,7 @@ type PublicContextEntity = {
336
336
  score: number;
337
337
  metadata?: Record<string, unknown>;
338
338
  };
339
- type PublicContextInjectionPolicy = {
339
+ export type PublicContextInjectionPolicy = {
340
340
  tokenBudget: number;
341
341
  estimatedTokens: number;
342
342
  sectionBudgets: Record<string, number>;
@@ -349,7 +349,7 @@ type PublicContextInjectionPolicy = {
349
349
  score: number;
350
350
  }>;
351
351
  };
352
- type PublicCompiledContext = {
352
+ export type PublicCompiledContext = {
353
353
  schemaVersion: string;
354
354
  topicId: string;
355
355
  topicName: string;
@@ -400,9 +400,11 @@ type PublicCompiledContext = {
400
400
  * in the output. Adding optional fields is non-breaking; removing or
401
401
  * changing types is breaking (requires version bump).
402
402
  */
403
- type ContextPackV1 = {
403
+ export type ContextPackV1 = {
404
404
  /** Schema version for compatibility checking. */
405
405
  schemaVersion: typeof CONTEXT_PACK_SCHEMA_VERSION;
406
+ /** Deprecated compatibility alias for the requested scope ID. */
407
+ projectId?: string;
406
408
  /** Resolved topic ID after scope resolution. */
407
409
  topicId: string;
408
410
  /** Human-readable topic name. */
@@ -448,11 +450,13 @@ type ContextPackV1 = {
448
450
  };
449
451
  /**
450
452
  * The canonical input schema for `compile_context`.
451
- * `topicId` is the only scope identifier.
453
+ * `topicId` is canonical. `projectId` remains an optional compatibility alias.
452
454
  */
453
- type ContextPackRequestV1 = {
455
+ export type ContextPackRequestV1 = {
454
456
  /** Topic scope ID (required). */
455
457
  topicId: string;
458
+ /** Deprecated compatibility alias for older callers. */
459
+ projectId?: string;
456
460
  /** Focus query for relevance ranking. */
457
461
  query?: string;
458
462
  /** Max items per section. Default: DEFAULT_SECTION_LIMIT. */
@@ -480,13 +484,11 @@ type ContextPackRequestV1 = {
480
484
  * Question statuses that are considered "resolved" (not open).
481
485
  * Used to filter which questions appear in the openQuestions section.
482
486
  */
483
- declare const RESOLVED_QUESTION_STATUSES: readonly string[];
487
+ export declare const RESOLVED_QUESTION_STATUSES: readonly string[];
484
488
  /**
485
489
  * Tokens-per-word multiplier for rough token estimation.
486
490
  * Conservative estimate: ~1.35 tokens per whitespace-delimited word.
487
491
  */
488
- declare const TOKENS_PER_WORD = 1.35;
492
+ export declare const TOKENS_PER_WORD = 1.35;
489
493
  /** Minimum token estimate for any non-empty string. */
490
- declare const MIN_TOKEN_ESTIMATE = 8;
491
-
492
- export { BELIEF_TYPE_BONUS, type BeliefLatticeSeed, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, type ContextCompilationMode, type ContextPackBelief, type ContextPackContradiction, type ContextPackDeltaReport, type ContextPackDiagnostics, type ContextPackEntity, type ContextPackEvidence, type ContextPackFailure, type ContextPackFailureContext, type ContextPackInjectionPolicy, type ContextPackQuestion, type ContextPackRequestV1, type ContextPackSectionKey, type ContextPackSummary, type ContextPackV1, type ContextRankingProfile, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TOKEN_BUDGET, ENTITY_RANKING_WEIGHTS, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, PRIORITY_SCORES, type PackWeightOverride, type PublicCompiledContext, type PublicContextBelief, type PublicContextContradiction, type PublicContextEntity, type PublicContextEvidence, type PublicContextInjectionPolicy, type PublicContextQuestion, RANKING_WEIGHTS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, type RankingWeightVector, SECTION_BUDGET_RATIOS, SEVERITY_SCORES, TOKENS_PER_WORD, type VerificationObligation };
494
+ export declare const MIN_TOKEN_ESTIMATE = 8;
@@ -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,4 @@ 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;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Canonical lens workflow contract shared across schema, SDK, and MCP surfaces.
3
+ */
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 = {
14
+ key: string;
15
+ promptRef: string;
16
+ phase?: string;
17
+ role?: string;
18
+ version?: string;
19
+ required?: boolean;
20
+ metadata?: LensLooseMetadata;
21
+ };
22
+ export type LensWorkflowStepTemplate = {
23
+ key: string;
24
+ title: string;
25
+ description?: string;
26
+ promptTemplateKey?: string;
27
+ taskTemplateKeys?: string[];
28
+ metadata?: LensLooseMetadata;
29
+ };
30
+ export type LensWorkflowTemplate = {
31
+ key: string;
32
+ name: string;
33
+ description?: string;
34
+ steps: LensWorkflowStepTemplate[];
35
+ metadata?: LensLooseMetadata;
36
+ };
37
+ export type LensTaskTemplate = {
38
+ key: string;
39
+ title: string;
40
+ description?: string;
41
+ priority?: LensTaskTemplatePriority;
42
+ phase?: string;
43
+ metadata?: LensLooseMetadata;
44
+ };
45
+ export type LensQuestionTemplate = {
46
+ key: string;
47
+ text: string;
48
+ priority?: LensTaskTemplatePriority;
49
+ linkedBeliefKey?: string;
50
+ metadata?: LensLooseMetadata;
51
+ };
52
+ export type LensBranchMigrationSuggestion = {
53
+ recommendedTool: "create_lens";
54
+ perspectiveType: LensPerspectiveType;
55
+ message: string;
56
+ suggestedPayload: {
57
+ name: string;
58
+ description?: string;
59
+ topicId?: string;
60
+ workspaceId?: string;
61
+ perspectiveType: LensPerspectiveType;
62
+ };
63
+ };
64
+ export declare const BRANCH_DEPRECATION_MESSAGE = "Branches are deprecated for operational framing. Create a workspace-scoped lens instead.";
65
+ export type DeprecatedBranchMetadata = {
66
+ deprecated: true;
67
+ deprecationMessage: string;
68
+ lensSuggestion: LensBranchMigrationSuggestion;
69
+ };
70
+ export declare function inferLensPerspectiveTypeFromBranchSchema(schema?: string | null): LensPerspectiveType;
71
+ export declare function migrateBranchToLens(args: {
72
+ name: string;
73
+ description?: string;
74
+ topicId?: string;
75
+ workspaceId?: string;
76
+ schema?: string | null;
77
+ }): LensBranchMigrationSuggestion;
78
+ export declare function buildDeprecatedBranchMetadata(args: {
79
+ name: string;
80
+ description?: string;
81
+ topicId?: string;
82
+ workspaceId?: string;
83
+ schema?: string | null;
84
+ }): DeprecatedBranchMetadata;
@@ -0,0 +1,151 @@
1
+ /**
2
+ * MCP Tool Contract Definitions
3
+ *
4
+ * Machine-readable source of truth for all Lucern MCP tool names,
5
+ * descriptions, parameters, and response schemas.
6
+ *
7
+ * CONTRACT SURFACE: These definitions are the external API for AI agents.
8
+ * Renaming a tool or changing its description is a BREAKING CHANGE.
9
+ *
10
+ * Git-native naming rules (enforced by lint):
11
+ * 1. Workflow tools use git verbs directly (add_worktree, merge, push, open_pull_request)
12
+ * 2. Knowledge tools use epistemic verbs (create_belief, fork_belief, modulate_confidence)
13
+ * 3. First sentence of description includes the git analog verb
14
+ * 4. Description includes "Like `git X`" parenthetical
15
+ * 5. Parameter names use domain terms (canonicalText, nodeId, confidence)
16
+ */
17
+ export type McpToolContract = {
18
+ /** Stable tool name — breaking change to rename */
19
+ name: string;
20
+ /** Git-semantic description — breaking change to remove git references */
21
+ description: string;
22
+ /** Parameter schema (JSON Schema subset) */
23
+ parameters: Record<string, McpParameterDef>;
24
+ /** Required parameter names */
25
+ required: string[];
26
+ /** Response shape description */
27
+ response: McpResponseDef;
28
+ /** Which Lucern module owns the implementation */
29
+ ownerModule: string;
30
+ /** Ontology primitive this tool operates on */
31
+ ontologyPrimitive: "belief" | "evidence" | "source" | "question" | "judgment" | "worktree" | "branch" | "lens" | "edge" | "graph" | "task" | "policy" | "ontology" | "identity";
32
+ /** MCP surface tier — showcase (front page, every demo) or workhorse (complete CRUD, discovered when building) */
33
+ tier: "showcase" | "workhorse";
34
+ /** Hide this tool from public discovery surfaces. */
35
+ internal?: boolean;
36
+ /** Deprecation notice shown in contract-driven docs and discovery. */
37
+ deprecated?: string;
38
+ };
39
+ export type McpParameterDef = {
40
+ type: "string" | "number" | "boolean" | "array" | "object";
41
+ description: string;
42
+ required?: boolean;
43
+ enum?: string[];
44
+ };
45
+ export type McpResponseDef = {
46
+ description: string;
47
+ fields: Record<string, string>;
48
+ };
49
+ export declare const CREATE_BELIEF: McpToolContract;
50
+ export declare const GET_BELIEF: McpToolContract;
51
+ export declare const REFINE_BELIEF: McpToolContract;
52
+ export declare const MODULATE_CONFIDENCE: McpToolContract;
53
+ export declare const FORK_BELIEF: McpToolContract;
54
+ export declare const ARCHIVE_BELIEF: McpToolContract;
55
+ export declare const CREATE_EPISTEMIC_CONTRACT: McpToolContract;
56
+ export declare const ADD_EVIDENCE: McpToolContract;
57
+ export declare const FLAG_CONTRADICTION: McpToolContract;
58
+ export declare const ADD_WORKTREE: McpToolContract;
59
+ export declare const MERGE: McpToolContract;
60
+ export declare const QUERY_LINEAGE: McpToolContract;
61
+ export declare const GET_CONFIDENCE_HISTORY: McpToolContract;
62
+ export declare const GET_AUDIT_TRAIL: McpToolContract;
63
+ export declare const TRAVERSE_GRAPH: McpToolContract;
64
+ export declare const GET_GRAPH_NEIGHBORHOOD: McpToolContract;
65
+ export declare const TRACE_ENTITY_IMPACT: McpToolContract;
66
+ export declare const SEARCH_BELIEFS: McpToolContract;
67
+ export declare const SEARCH_RESOURCES: McpToolContract;
68
+ export declare const FIND_CONTRADICTIONS: McpToolContract;
69
+ export declare const CREATE_EDGE: McpToolContract;
70
+ export declare const RECORD_JUDGMENT: McpToolContract;
71
+ export declare const CREATE_LENS: McpToolContract;
72
+ export declare const LIST_LENSES: McpToolContract;
73
+ export declare const APPLY_LENS_TO_TOPIC: McpToolContract;
74
+ export declare const REMOVE_LENS_FROM_TOPIC: McpToolContract;
75
+ export declare const PUSH: McpToolContract;
76
+ export declare const OPEN_PULL_REQUEST: McpToolContract;
77
+ export declare const BISECT_CONFIDENCE: McpToolContract;
78
+ export declare const DETECT_CONFIRMATION_BIAS: McpToolContract;
79
+ export declare const GET_GRAPH_STRUCTURE_ANALYSIS: McpToolContract;
80
+ export declare const GET_FALSIFICATION_QUESTIONS: McpToolContract;
81
+ export declare const SEARCH_SOURCES: McpToolContract;
82
+ export declare const EXECUTE_DEEP_RESEARCH: McpToolContract;
83
+ export declare const SEARCH_EVIDENCE: McpToolContract;
84
+ export declare const CREATE_EVIDENCE: McpToolContract;
85
+ export declare const GET_EVIDENCE: McpToolContract;
86
+ export declare const LIST_EVIDENCE: McpToolContract;
87
+ export declare const LINK_EVIDENCE: McpToolContract;
88
+ export declare const LINK_EVIDENCE_TO_BELIEF: McpToolContract;
89
+ export declare const CREATE_QUESTION: McpToolContract;
90
+ export declare const GET_QUESTION: McpToolContract;
91
+ export declare const REFINE_QUESTION: McpToolContract;
92
+ export declare const LIST_QUESTIONS: McpToolContract;
93
+ export declare const ANSWER_QUESTION: McpToolContract;
94
+ export declare const UPDATE_QUESTION_STATUS: McpToolContract;
95
+ export declare const ARCHIVE_QUESTION: McpToolContract;
96
+ export declare const LINK_EVIDENCE_TO_QUESTION: McpToolContract;
97
+ export declare const CREATE_ANSWER: McpToolContract;
98
+ export declare const GET_ANSWER: McpToolContract;
99
+ export declare const GET_HIGH_PRIORITY_QUESTIONS: McpToolContract;
100
+ export declare const FIND_MISSING_QUESTIONS: McpToolContract;
101
+ export declare const LIST_BELIEFS: McpToolContract;
102
+ export declare const LIST_WORKTREES: McpToolContract;
103
+ export declare const LIST_ALL_WORKTREES: McpToolContract;
104
+ export declare const ACTIVATE_WORKTREE: McpToolContract;
105
+ export declare const UPDATE_WORKTREE_TARGETS: McpToolContract;
106
+ export declare const UPDATE_WORKTREE_METADATA: McpToolContract;
107
+ export declare const IDENTITY_WHOAMI: McpToolContract;
108
+ export declare const COMPILE_CONTEXT: McpToolContract;
109
+ export declare const CHECK_PERMISSION: McpToolContract;
110
+ export declare const FILTER_BY_PERMISSION: McpToolContract;
111
+ export declare const INGEST_OBSERVATION: McpToolContract;
112
+ export declare const GET_OBSERVATION_CONTEXT: McpToolContract;
113
+ export declare const CREATE_TASK: McpToolContract;
114
+ export declare const COMPLETE_TASK: McpToolContract;
115
+ export declare const UPDATE_TASK: McpToolContract;
116
+ export declare const LIST_TASKS: McpToolContract;
117
+ export declare const CREATE_TOPIC: McpToolContract;
118
+ export declare const LIST_TOPICS: McpToolContract;
119
+ export declare const GET_TOPIC: McpToolContract;
120
+ export declare const UPDATE_TOPIC: McpToolContract;
121
+ export declare const GET_TOPIC_TREE: McpToolContract;
122
+ export declare const GET_CODE_CONTEXT: McpToolContract;
123
+ export declare const GET_CHANGE_HISTORY: McpToolContract;
124
+ export declare const RECORD_ATTEMPT: McpToolContract;
125
+ export declare const GET_FAILURE_LOG: McpToolContract;
126
+ export declare const GET_TOPIC_COVERAGE: McpToolContract;
127
+ export declare const GET_GRAPH_GAPS: McpToolContract;
128
+ export declare const MANAGE_WRITE_POLICY: McpToolContract;
129
+ export declare const LIST_ONTOLOGIES: McpToolContract;
130
+ export declare const GET_ONTOLOGY: McpToolContract;
131
+ export declare const APPLY_ONTOLOGY: McpToolContract;
132
+ export declare const MATCH_ENTITY_TYPE: McpToolContract;
133
+ export declare const CREATE_ONTOLOGY: McpToolContract;
134
+ export declare const UPDATE_ONTOLOGY: McpToolContract;
135
+ export declare const ARCHIVE_ONTOLOGY: McpToolContract;
136
+ export declare const CREATE_ONTOLOGY_VERSION: McpToolContract;
137
+ export declare const PUBLISH_ONTOLOGY_VERSION: McpToolContract;
138
+ export declare const DEPRECATE_ONTOLOGY_VERSION: McpToolContract;
139
+ export declare const RESOLVE_EFFECTIVE_ONTOLOGY: McpToolContract;
140
+ /** All MCP tool contracts, indexed by name */
141
+ export declare const MCP_TOOL_CONTRACTS: Record<string, McpToolContract>;
142
+ /** Tool names that MUST include git-semantic language in descriptions */
143
+ export declare const GIT_SEMANTIC_REQUIRED_TOOLS: string[];
144
+ /**
145
+ * Lint validation: every tool description must contain "Like `git" or "Like a `git"
146
+ * or reference a git operation in the first sentence.
147
+ */
148
+ export declare function validateGitSemantics(tool: McpToolContract): {
149
+ valid: boolean;
150
+ reason?: string;
151
+ };