@lucern/sdk 0.2.0-alpha.4 → 0.2.0-alpha.5

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 (155) hide show
  1. package/README.md +31 -0
  2. package/dist/.generated +2 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +3 -8894
  5. package/dist/lib/platform/auth/credentials.d.ts +5 -0
  6. package/dist/lib/platform/auth/credentials.js +40 -0
  7. package/dist/lib/platform/sdk/adminClient.d.ts +404 -0
  8. package/dist/lib/platform/sdk/adminClient.js +384 -0
  9. package/dist/lib/platform/sdk/answersClient.d.ts +16 -0
  10. package/dist/lib/platform/sdk/answersClient.js +21 -0
  11. package/dist/{packages/sdk/src → lib/platform/sdk}/audiencesClient.d.ts +6 -0
  12. package/dist/lib/platform/sdk/audiencesClient.js +111 -0
  13. package/dist/{packages/sdk/src → lib/platform/sdk}/auditClient.d.ts +3 -0
  14. package/dist/lib/platform/sdk/auditClient.js +21 -0
  15. package/dist/lib/platform/sdk/beliefsClient.d.ts +157 -0
  16. package/dist/lib/platform/sdk/beliefsClient.js +124 -0
  17. package/dist/{packages/sdk/src → lib/platform/sdk}/client.d.ts +957 -146
  18. package/dist/lib/platform/sdk/client.js +1831 -0
  19. package/dist/lib/platform/sdk/contextClient.d.ts +21 -0
  20. package/dist/lib/platform/sdk/contextClient.js +86 -0
  21. package/dist/{lucern/packages/domain-context/src/context-pack-compiler.d.ts → lib/platform/sdk/contextPackCompiler.d.ts} +2 -3
  22. package/dist/lib/platform/sdk/contextPackCompiler.js +534 -0
  23. package/dist/lib/platform/sdk/contextTypes.d.ts +133 -0
  24. package/dist/lib/platform/sdk/contextTypes.js +1 -0
  25. package/dist/{packages/sdk/src → lib/platform/sdk}/controlObjectOwnership.d.ts +15 -0
  26. package/dist/lib/platform/sdk/controlObjectOwnership.js +220 -0
  27. package/dist/{packages/sdk/src → lib/platform/sdk}/coreClient.d.ts +19 -0
  28. package/dist/lib/platform/sdk/coreClient.js +366 -0
  29. package/dist/{packages/sdk/src → lib/platform/sdk}/customTools.d.ts +21 -3
  30. package/dist/lib/platform/sdk/customTools.js +247 -0
  31. package/dist/{packages/sdk/src → lib/platform/sdk}/decisionsClient.d.ts +9 -0
  32. package/dist/lib/platform/sdk/decisionsClient.js +129 -0
  33. package/dist/lib/platform/sdk/domainContext.d.ts +1 -0
  34. package/dist/lib/platform/sdk/domainContext.js +1 -0
  35. package/dist/{lucern/packages/events/src/types.d.ts → lib/platform/sdk/events.d.ts} +25 -0
  36. package/dist/lib/platform/sdk/events.js +261 -0
  37. package/dist/lib/platform/sdk/gatewayFacades.d.ts +586 -0
  38. package/dist/lib/platform/sdk/gatewayFacades.js +845 -0
  39. package/dist/{packages/sdk/src → lib/platform/sdk}/graphClient.d.ts +75 -0
  40. package/dist/lib/platform/sdk/graphClient.js +235 -0
  41. package/dist/{packages/sdk/src → lib/platform/sdk}/harnessClient.d.ts +90 -1
  42. package/dist/lib/platform/sdk/harnessClient.js +219 -0
  43. package/dist/{packages/sdk/src → lib/platform/sdk}/identityClient.d.ts +45 -15
  44. package/dist/lib/platform/sdk/identityClient.js +131 -0
  45. package/dist/{packages/sdk/src → lib/platform/sdk}/index.d.ts +21 -3
  46. package/dist/lib/platform/sdk/index.js +46 -0
  47. package/dist/{packages/sdk/src → lib/platform/sdk}/learningClient.d.ts +3 -0
  48. package/dist/lib/platform/sdk/learningClient.js +53 -0
  49. package/dist/{packages/sdk/src → lib/platform/sdk}/mcpParityClient.d.ts +1 -0
  50. package/dist/lib/platform/sdk/mcpParityClient.js +196 -0
  51. package/dist/{packages/sdk/src → lib/platform/sdk}/mcpParitySurface.d.ts +2 -0
  52. package/dist/lib/platform/sdk/mcpParitySurface.js +57 -0
  53. package/dist/{packages/sdk/src → lib/platform/sdk}/ontologyClient.d.ts +16 -0
  54. package/dist/lib/platform/sdk/ontologyClient.js +161 -0
  55. package/dist/lib/platform/sdk/packRuntime.d.ts +1 -0
  56. package/dist/lib/platform/sdk/packRuntime.js +1 -0
  57. package/dist/{packages/sdk/src → lib/platform/sdk}/packsClient.d.ts +25 -0
  58. package/dist/lib/platform/sdk/packsClient.js +157 -0
  59. package/dist/{packages/sdk/src → lib/platform/sdk}/policyClient.d.ts +90 -1
  60. package/dist/lib/platform/sdk/policyClient.js +277 -0
  61. package/dist/lib/platform/sdk/promptCatalog.d.ts +1 -0
  62. package/dist/lib/platform/sdk/promptCatalog.js +1 -0
  63. package/dist/{packages/sdk/src → lib/platform/sdk}/reportsClient.d.ts +3 -0
  64. package/dist/lib/platform/sdk/reportsClient.js +64 -0
  65. package/dist/{packages/sdk/src → lib/platform/sdk}/schemaClient.d.ts +5 -0
  66. package/dist/lib/platform/sdk/schemaClient.js +71 -0
  67. package/dist/{packages/sdk/src → lib/platform/sdk}/sdkSurface.d.ts +1 -0
  68. package/dist/lib/platform/sdk/sdkSurface.js +140 -0
  69. package/dist/{packages/sdk/src → lib/platform/sdk}/topicsClient.d.ts +33 -0
  70. package/dist/lib/platform/sdk/topicsClient.js +118 -0
  71. package/dist/{packages/sdk/src → lib/platform/sdk}/types.d.ts +224 -2
  72. package/dist/lib/platform/sdk/types.js +1 -0
  73. package/dist/lib/platform/sdk/version.js +2 -0
  74. package/dist/{packages/sdk/src → lib/platform/sdk}/workflowClient.d.ts +63 -2
  75. package/dist/lib/platform/sdk/workflowClient.js +366 -0
  76. package/dist/lucern/contracts/src/api-enums.contract.d.ts +58 -0
  77. package/dist/lucern/contracts/src/api-enums.contract.js +147 -0
  78. package/dist/lucern/contracts/src/lens-filter.contract.js +95 -0
  79. package/dist/lucern/contracts/src/lens-workflow.contract.js +54 -0
  80. package/dist/lucern/contracts/src/mcp-tools.contract.js +3281 -0
  81. package/package.json +17 -3
  82. package/dist/index.js.map +0 -1
  83. package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -53
  84. package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
  85. package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
  86. package/dist/lucern/mcp-server/src/context-pack-policy.d.ts +0 -119
  87. package/dist/lucern/mcp-server/src/context-pack-schema.d.ts +0 -18
  88. package/dist/lucern/modules/graph-primitives/src/ontology-matching.d.ts +0 -78
  89. package/dist/lucern/modules/graph-primitives/src/text-matching.d.ts +0 -53
  90. package/dist/lucern/packages/client-core/src/beliefs.d.ts +0 -30
  91. package/dist/lucern/packages/client-core/src/context.d.ts +0 -29
  92. package/dist/lucern/packages/client-core/src/contradictions.d.ts +0 -11
  93. package/dist/lucern/packages/client-core/src/edges.d.ts +0 -11
  94. package/dist/lucern/packages/client-core/src/events.d.ts +0 -9
  95. package/dist/lucern/packages/client-core/src/evidence.d.ts +0 -21
  96. package/dist/lucern/packages/client-core/src/graph.d.ts +0 -17
  97. package/dist/lucern/packages/client-core/src/identity.d.ts +0 -7
  98. package/dist/lucern/packages/client-core/src/ids.d.ts +0 -7
  99. package/dist/lucern/packages/client-core/src/ontologies.d.ts +0 -13
  100. package/dist/lucern/packages/client-core/src/questions.d.ts +0 -39
  101. package/dist/lucern/packages/client-core/src/search.d.ts +0 -7
  102. package/dist/lucern/packages/client-core/src/tasks.d.ts +0 -13
  103. package/dist/lucern/packages/client-core/src/topics.d.ts +0 -17
  104. package/dist/lucern/packages/client-core/src/webhooks.d.ts +0 -35
  105. package/dist/lucern/packages/client-core/src/worktrees.d.ts +0 -17
  106. package/dist/lucern/packages/domain-beliefs/src/beliefs.d.ts +0 -283
  107. package/dist/lucern/packages/domain-beliefs/src/index.d.ts +0 -1
  108. package/dist/lucern/packages/domain-context/src/compile.d.ts +0 -11
  109. package/dist/lucern/packages/domain-context/src/index.d.ts +0 -4
  110. package/dist/lucern/packages/domain-context/src/ports.d.ts +0 -58
  111. package/dist/lucern/packages/domain-context/src/public-types.d.ts +0 -1
  112. package/dist/lucern/packages/domain-edges/src/contradictions.d.ts +0 -59
  113. package/dist/lucern/packages/domain-edges/src/edges.d.ts +0 -91
  114. package/dist/lucern/packages/domain-edges/src/index.d.ts +0 -2
  115. package/dist/lucern/packages/domain-evidence/src/evidence.d.ts +0 -115
  116. package/dist/lucern/packages/domain-evidence/src/index.d.ts +0 -1
  117. package/dist/lucern/packages/domain-graph/src/graph.d.ts +0 -150
  118. package/dist/lucern/packages/domain-identity/src/index.d.ts +0 -1
  119. package/dist/lucern/packages/domain-identity/src/whoami.d.ts +0 -13
  120. package/dist/lucern/packages/domain-ontologies/src/ontologies.d.ts +0 -123
  121. package/dist/lucern/packages/domain-questions/src/index.d.ts +0 -1
  122. package/dist/lucern/packages/domain-questions/src/questions.d.ts +0 -147
  123. package/dist/lucern/packages/domain-search/src/search.d.ts +0 -97
  124. package/dist/lucern/packages/domain-tasks/src/index.d.ts +0 -1
  125. package/dist/lucern/packages/domain-tasks/src/tasks.d.ts +0 -102
  126. package/dist/lucern/packages/domain-topics/src/index.d.ts +0 -1
  127. package/dist/lucern/packages/domain-topics/src/topics.d.ts +0 -147
  128. package/dist/lucern/packages/domain-worktrees/src/index.d.ts +0 -1
  129. package/dist/lucern/packages/domain-worktrees/src/worktrees.d.ts +0 -185
  130. package/dist/lucern/packages/events/src/index.d.ts +0 -4
  131. package/dist/lucern/packages/events/src/matching.d.ts +0 -3
  132. package/dist/lucern/packages/events/src/outbox.d.ts +0 -15
  133. package/dist/lucern/packages/events/src/webhooks.d.ts +0 -9
  134. package/dist/lucern/packages/sdk-typescript/src/facade/beliefs.d.ts +0 -15
  135. package/dist/lucern/packages/sdk-typescript/src/facade/context.d.ts +0 -12
  136. package/dist/lucern/packages/sdk-typescript/src/facade/contradictions.d.ts +0 -7
  137. package/dist/lucern/packages/sdk-typescript/src/facade/edges.d.ts +0 -7
  138. package/dist/lucern/packages/sdk-typescript/src/facade/events.d.ts +0 -6
  139. package/dist/lucern/packages/sdk-typescript/src/facade/evidence.d.ts +0 -21
  140. package/dist/lucern/packages/sdk-typescript/src/facade/graph.d.ts +0 -10
  141. package/dist/lucern/packages/sdk-typescript/src/facade/identity.d.ts +0 -5
  142. package/dist/lucern/packages/sdk-typescript/src/facade/ontologies.d.ts +0 -8
  143. package/dist/lucern/packages/sdk-typescript/src/facade/questions.d.ts +0 -39
  144. package/dist/lucern/packages/sdk-typescript/src/facade/search.d.ts +0 -5
  145. package/dist/lucern/packages/sdk-typescript/src/facade/tasks.d.ts +0 -8
  146. package/dist/lucern/packages/sdk-typescript/src/facade/topics.d.ts +0 -10
  147. package/dist/lucern/packages/sdk-typescript/src/facade/webhooks.d.ts +0 -16
  148. package/dist/lucern/packages/sdk-typescript/src/facade/worktrees.d.ts +0 -10
  149. package/dist/lucern/packages/sdk-typescript/src/index.d.ts +0 -28
  150. package/dist/packages/sdk/src/adminClient.d.ts +0 -89
  151. package/dist/packages/sdk/src/answersClient.d.ts +0 -5
  152. package/dist/packages/sdk/src/beliefsClient.d.ts +0 -52
  153. package/dist/packages/sdk/src/contextClient.d.ts +0 -9
  154. package/dist/packages/sdk/src/contracts/api-enums.contract.d.ts +0 -79
  155. /package/dist/{packages/sdk/src → lib/platform/sdk}/version.d.ts +0 -0
@@ -0,0 +1,196 @@
1
+ import { createGatewayRequestClient, randomIdempotencyKey, } from "./coreClient.js";
2
+ function withSdkSessionId(args, sessionId) {
3
+ return {
4
+ ...(args ?? {}),
5
+ __sdkSessionId: sessionId,
6
+ };
7
+ }
8
+ /**
9
+ * Thin typed bridge for MCP-only SDK parity methods.
10
+ *
11
+ * These methods map 1:1 to the Lucern MCP handlers and execute through the
12
+ * platform gateway so the SDK can cover the full control-plane surface.
13
+ */
14
+ export function createMcpParityClient(config = {}) {
15
+ const gateway = createGatewayRequestClient(config);
16
+ const sessionId = crypto.randomUUID();
17
+ function executeRead(toolName, args) {
18
+ return gateway.request({
19
+ path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
20
+ method: "POST",
21
+ body: withSdkSessionId(args, sessionId),
22
+ });
23
+ }
24
+ function executeMutation(toolName, args, idempotencyKey) {
25
+ return gateway.request({
26
+ path: `/api/platform/v1/mcp-tools/${encodeURIComponent(toolName)}`,
27
+ method: "POST",
28
+ body: withSdkSessionId(args, sessionId),
29
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
30
+ });
31
+ }
32
+ return {
33
+ sessionId,
34
+ listTopics(args = {}) {
35
+ return executeRead("list_topics", args);
36
+ },
37
+ createTopic(args, idempotencyKey) {
38
+ return executeMutation("create_topic", args, idempotencyKey);
39
+ },
40
+ getTopic(args) {
41
+ return executeRead("get_topic", args);
42
+ },
43
+ getTopicTree(args) {
44
+ return executeRead("get_topic_tree", args);
45
+ },
46
+ activateWorktree(args, idempotencyKey) {
47
+ return executeMutation("activate_worktree", args, idempotencyKey);
48
+ },
49
+ updateWorktreeMetadata(args, idempotencyKey) {
50
+ return executeMutation("update_worktree_metadata", args, idempotencyKey);
51
+ },
52
+ updateWorktreeTargets(args, idempotencyKey) {
53
+ return executeMutation("update_worktree_targets", args, idempotencyKey);
54
+ },
55
+ listAllWorktrees(args = {}) {
56
+ return executeRead("list_all_worktrees", args);
57
+ },
58
+ pipelineSnapshot(args) {
59
+ return executeRead("pipeline_snapshot", args);
60
+ },
61
+ recordScopeLearning(args, idempotencyKey) {
62
+ return executeMutation("record_scope_learning", args, idempotencyKey);
63
+ },
64
+ discover(args) {
65
+ return executeRead("discover", args);
66
+ },
67
+ analyzeTopicDensity(args) {
68
+ return executeRead("analyze_topic_density", args);
69
+ },
70
+ applyAutoBranching(args, idempotencyKey) {
71
+ return executeMutation("apply_auto_branching", args, idempotencyKey);
72
+ },
73
+ seedBeliefLattice(args = {}, idempotencyKey) {
74
+ return executeMutation("seed_belief_lattice", args, idempotencyKey);
75
+ },
76
+ getLatticeCoverage(args = {}) {
77
+ return executeRead("get_lattice_coverage", args);
78
+ },
79
+ matchEntityType(args) {
80
+ return executeRead("match_entity_type", args);
81
+ },
82
+ discoverEntityConnections(args) {
83
+ return executeRead("discover_entity_connections", args);
84
+ },
85
+ triggerBeliefReview(args, idempotencyKey) {
86
+ return executeMutation("trigger_belief_review", args, idempotencyKey);
87
+ },
88
+ listOntologies(args = {}) {
89
+ return executeRead("list_ontologies", args);
90
+ },
91
+ getOntology(args) {
92
+ return executeRead("get_ontology", args);
93
+ },
94
+ applyOntology(args, idempotencyKey) {
95
+ return executeMutation("apply_ontology", args, idempotencyKey);
96
+ },
97
+ createOntology(args, idempotencyKey) {
98
+ return executeMutation("create_ontology", args, idempotencyKey);
99
+ },
100
+ updateOntology(args, idempotencyKey) {
101
+ return executeMutation("update_ontology", args, idempotencyKey);
102
+ },
103
+ archiveOntology(args, idempotencyKey) {
104
+ return executeMutation("archive_ontology", args, idempotencyKey);
105
+ },
106
+ createOntologyVersion(args, idempotencyKey) {
107
+ return executeMutation("create_ontology_version", args, idempotencyKey);
108
+ },
109
+ publishOntologyVersion(args, idempotencyKey) {
110
+ return executeMutation("publish_ontology_version", args, idempotencyKey);
111
+ },
112
+ deprecateOntologyVersion(args, idempotencyKey) {
113
+ return executeMutation("deprecate_ontology_version", args, idempotencyKey);
114
+ },
115
+ resolveEffectiveOntology(args) {
116
+ return executeRead("resolve_effective_ontology", args);
117
+ },
118
+ registerSession(args = {}, idempotencyKey) {
119
+ return executeMutation("register_session", args, idempotencyKey);
120
+ },
121
+ heartbeatSession(args = {}, idempotencyKey) {
122
+ return executeMutation("heartbeat_session", args, idempotencyKey);
123
+ },
124
+ endSession(args = {}, idempotencyKey) {
125
+ return executeMutation("end_session", args, idempotencyKey);
126
+ },
127
+ listActiveSessions(args = {}) {
128
+ return executeRead("list_active_sessions", args);
129
+ },
130
+ sendAgentMessage(args, idempotencyKey) {
131
+ return executeMutation("send_agent_message", args, idempotencyKey);
132
+ },
133
+ broadcastMessage(args, idempotencyKey) {
134
+ return executeMutation("broadcast_message", args, idempotencyKey);
135
+ },
136
+ getAgentInbox(args = {}) {
137
+ return executeRead("get_agent_inbox", args);
138
+ },
139
+ claimFiles(args, idempotencyKey) {
140
+ return executeMutation("claim_files", args, idempotencyKey);
141
+ },
142
+ listTasks(args) {
143
+ return executeRead("list_tasks", args);
144
+ },
145
+ createAnswer(args, idempotencyKey) {
146
+ return executeMutation("create_answer", args, idempotencyKey);
147
+ },
148
+ getAnswer(args) {
149
+ return executeRead("get_answer", args);
150
+ },
151
+ flagContradiction(args, idempotencyKey) {
152
+ return executeMutation("flag_contradiction", args, idempotencyKey);
153
+ },
154
+ ingestObservation(args, idempotencyKey) {
155
+ return executeMutation("ingest_observation", args, idempotencyKey);
156
+ },
157
+ getObservationContext(args) {
158
+ return executeRead("get_observation_context", args);
159
+ },
160
+ getCodeContext(args) {
161
+ return executeRead("get_code_context", args);
162
+ },
163
+ getChangeHistory(args) {
164
+ return executeRead("get_change_history", args);
165
+ },
166
+ recordAttempt(args, idempotencyKey) {
167
+ return executeMutation("record_attempt", args, idempotencyKey);
168
+ },
169
+ getFailureLog(args) {
170
+ return executeRead("get_failure_log", args);
171
+ },
172
+ createEpistemicContract(args, idempotencyKey) {
173
+ return executeMutation("create_epistemic_contract", args, idempotencyKey);
174
+ },
175
+ evaluateContract(args, idempotencyKey) {
176
+ return executeMutation("evaluate_contract", args, idempotencyKey);
177
+ },
178
+ getContractStatus(args) {
179
+ return executeRead("get_contract_status", args);
180
+ },
181
+ checkPermission(args) {
182
+ return executeRead("check_permission", args);
183
+ },
184
+ filterByPermission(args) {
185
+ return executeRead("filter_by_permission", args);
186
+ },
187
+ manageWritePolicy(args, idempotencyKey) {
188
+ return args.action === "set"
189
+ ? executeMutation("manage_write_policy", args, idempotencyKey)
190
+ : executeRead("manage_write_policy", args);
191
+ },
192
+ generateSessionHandoff(args) {
193
+ return executeRead("generate_session_handoff", args);
194
+ },
195
+ };
196
+ }
@@ -1,8 +1,10 @@
1
+ /** Descriptor mapping an MCP tool name to its SDK method path and read/mutation classification. */
1
2
  export type McpParityMethod = {
2
3
  toolName: string;
3
4
  methodPath: string;
4
5
  kind: "read" | "mutation";
5
6
  };
7
+ /** Complete registry of MCP tools with SDK parity, mapping tool names to SDK method paths. */
6
8
  export declare const SDK_MCP_PARITY_METHODS: readonly McpParityMethod[];
7
9
  export declare const SDK_MCP_PARITY_METHOD_PATHS: string[];
8
10
  export declare const SDK_MCP_PARITY_TOOL_NAMES: string[];
@@ -0,0 +1,57 @@
1
+ /** Complete registry of MCP tools with SDK parity, mapping tool names to SDK method paths. */
2
+ export const SDK_MCP_PARITY_METHODS = [
3
+ { toolName: "activate_worktree", methodPath: "worktrees.activate", kind: "mutation" },
4
+ { toolName: "update_worktree_metadata", methodPath: "worktrees.updateMetadata", kind: "mutation" },
5
+ { toolName: "update_worktree_targets", methodPath: "worktrees.updateTargets", kind: "mutation" },
6
+ { toolName: "list_all_worktrees", methodPath: "worktrees.listAll", kind: "read" },
7
+ { toolName: "pipeline_snapshot", methodPath: "worktrees.pipelineSnapshot", kind: "read" },
8
+ { toolName: "record_scope_learning", methodPath: "context.recordScopeLearning", kind: "mutation" },
9
+ { toolName: "discover", methodPath: "context.discover", kind: "read" },
10
+ { toolName: "analyze_topic_density", methodPath: "context.analyzeTopicDensity", kind: "read" },
11
+ { toolName: "apply_auto_branching", methodPath: "context.applyAutoBranching", kind: "mutation" },
12
+ { toolName: "seed_belief_lattice", methodPath: "context.seedBeliefLattice", kind: "mutation" },
13
+ { toolName: "get_lattice_coverage", methodPath: "context.getLatticeCoverage", kind: "read" },
14
+ { toolName: "match_entity_type", methodPath: "context.matchEntityType", kind: "read" },
15
+ { toolName: "discover_entity_connections", methodPath: "context.discoverEntityConnections", kind: "read" },
16
+ { toolName: "trigger_belief_review", methodPath: "context.triggerBeliefReview", kind: "mutation" },
17
+ { toolName: "list_ontologies", methodPath: "ontologies.list", kind: "read" },
18
+ { toolName: "get_ontology", methodPath: "ontologies.get", kind: "read" },
19
+ { toolName: "apply_ontology", methodPath: "ontologies.bind", kind: "mutation" },
20
+ { toolName: "create_ontology", methodPath: "ontologies.create", kind: "mutation" },
21
+ { toolName: "update_ontology", methodPath: "ontologies.update", kind: "mutation" },
22
+ { toolName: "archive_ontology", methodPath: "ontologies.archive", kind: "mutation" },
23
+ { toolName: "create_ontology_version", methodPath: "ontologies.createVersion", kind: "mutation" },
24
+ { toolName: "publish_ontology_version", methodPath: "ontologies.publishVersion", kind: "mutation" },
25
+ { toolName: "deprecate_ontology_version", methodPath: "ontologies.deprecateVersion", kind: "mutation" },
26
+ { toolName: "resolve_effective_ontology", methodPath: "ontologies.resolveEffective", kind: "read" },
27
+ { toolName: "register_session", methodPath: "coordination.registerSession", kind: "mutation" },
28
+ { toolName: "heartbeat_session", methodPath: "coordination.heartbeatSession", kind: "mutation" },
29
+ { toolName: "end_session", methodPath: "coordination.endSession", kind: "mutation" },
30
+ { toolName: "list_active_sessions", methodPath: "coordination.listActiveSessions", kind: "read" },
31
+ { toolName: "send_agent_message", methodPath: "coordination.sendAgentMessage", kind: "mutation" },
32
+ { toolName: "broadcast_message", methodPath: "coordination.broadcastMessage", kind: "mutation" },
33
+ { toolName: "get_agent_inbox", methodPath: "coordination.getInbox", kind: "read" },
34
+ { toolName: "claim_files", methodPath: "coordination.claimFiles", kind: "mutation" },
35
+ { toolName: "create_topic", methodPath: "topics.create", kind: "mutation" },
36
+ { toolName: "get_topic", methodPath: "topics.get", kind: "read" },
37
+ { toolName: "get_topic_tree", methodPath: "topics.getTree", kind: "read" },
38
+ { toolName: "list_tasks", methodPath: "tasks.list", kind: "read" },
39
+ { toolName: "create_answer", methodPath: "answers.create", kind: "mutation" },
40
+ { toolName: "get_answer", methodPath: "answers.get", kind: "read" },
41
+ { toolName: "flag_contradiction", methodPath: "contradictions.flag", kind: "mutation" },
42
+ { toolName: "ingest_observation", methodPath: "observations.ingest", kind: "mutation" },
43
+ { toolName: "get_observation_context", methodPath: "observations.getContext", kind: "read" },
44
+ { toolName: "get_code_context", methodPath: "coding.getCodeContext", kind: "read" },
45
+ { toolName: "get_change_history", methodPath: "coding.getChangeHistory", kind: "read" },
46
+ { toolName: "record_attempt", methodPath: "coding.recordAttempt", kind: "mutation" },
47
+ { toolName: "get_failure_log", methodPath: "coding.getFailureLog", kind: "read" },
48
+ { toolName: "create_epistemic_contract", methodPath: "contracts.create", kind: "mutation" },
49
+ { toolName: "evaluate_contract", methodPath: "contracts.evaluate", kind: "mutation" },
50
+ { toolName: "get_contract_status", methodPath: "contracts.getStatus", kind: "read" },
51
+ { toolName: "check_permission", methodPath: "policy.checkPermission", kind: "read" },
52
+ { toolName: "filter_by_permission", methodPath: "policy.filterByPermission", kind: "read" },
53
+ { toolName: "manage_write_policy", methodPath: "policy.manageWritePolicy", kind: "mutation" },
54
+ { toolName: "generate_session_handoff", methodPath: "bootstrap.generateSessionHandoff", kind: "read" },
55
+ ];
56
+ export const SDK_MCP_PARITY_METHOD_PATHS = SDK_MCP_PARITY_METHODS.map((entry) => entry.methodPath);
57
+ export const SDK_MCP_PARITY_TOOL_NAMES = SDK_MCP_PARITY_METHODS.map((entry) => entry.toolName);
@@ -1,10 +1,13 @@
1
1
  import { type GatewayClientConfig, type GatewayScope } from "./coreClient";
2
2
  import type { JsonObject } from "./types";
3
+ /** Configuration for the ontology client. */
3
4
  export type OntologyClientConfig = GatewayClientConfig;
5
+ /** Input for binding an ontology to a topic. */
4
6
  export type OntologyBindingInput = GatewayScope & {
5
7
  ontologyId: string;
6
8
  topicId: string;
7
9
  };
10
+ /** Input for creating an ontology definition. */
8
11
  export type OntologyDefinitionInput = GatewayScope & {
9
12
  ontologyKey: string;
10
13
  name: string;
@@ -12,11 +15,13 @@ export type OntologyDefinitionInput = GatewayScope & {
12
15
  tenantId?: string;
13
16
  tier?: "platform" | "pack" | "tenant";
14
17
  };
18
+ /** Input for updating mutable fields on an ontology definition. */
15
19
  export type OntologyDefinitionUpdateInput = GatewayScope & {
16
20
  name?: string;
17
21
  description?: string;
18
22
  status?: "draft" | "active" | "deprecated";
19
23
  };
24
+ /** Input for creating a versioned snapshot of entity and edge type definitions. */
20
25
  export type OntologyVersionInput = GatewayScope & {
21
26
  version: string;
22
27
  entityTypes: Array<{
@@ -42,8 +47,13 @@ export type OntologyVersionInput = GatewayScope & {
42
47
  };
43
48
  /**
44
49
  * Create the ontology client for ontology definitions and versions.
50
+ * @param config - Gateway transport configuration.
51
+ * @returns An object with methods to manage ontology definitions, versions, and bindings.
45
52
  */
46
53
  export declare function createOntologyClient(config?: OntologyClientConfig): {
54
+ /**
55
+ * List ontology definitions matching optional filters.
56
+ */
47
57
  list(filters?: GatewayScope & {
48
58
  tenantId?: string;
49
59
  tier?: string;
@@ -54,7 +64,13 @@ export declare function createOntologyClient(config?: OntologyClientConfig): {
54
64
  items: any[];
55
65
  definitions: any[];
56
66
  }>>;
67
+ /**
68
+ * Get an ontology definition by identifier.
69
+ */
57
70
  get(id: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
71
+ /**
72
+ * Bind an ontology definition to a topic.
73
+ */
58
74
  bind(input: OntologyBindingInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
59
75
  /**
60
76
  * List ontology definitions.
@@ -0,0 +1,161 @@
1
+ import { createGatewayRequestClient, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
+ import { createListResult, mapGatewayData } from "./sdkSurface.js";
3
+ /**
4
+ * Create the ontology client for ontology definitions and versions.
5
+ * @param config - Gateway transport configuration.
6
+ * @returns An object with methods to manage ontology definitions, versions, and bindings.
7
+ */
8
+ export function createOntologyClient(config = {}) {
9
+ const gateway = createGatewayRequestClient(config);
10
+ return {
11
+ /**
12
+ * List ontology definitions matching optional filters.
13
+ */
14
+ async list(filters = {}) {
15
+ return gateway
16
+ .request({
17
+ path: `/api/platform/v1/ontologies${toQueryString(filters)}`,
18
+ })
19
+ .then((response) => mapGatewayData(response, (data) => {
20
+ const record = data && typeof data === "object" && !Array.isArray(data)
21
+ ? data
22
+ : {};
23
+ const ontologies = Array.isArray(record.ontologies)
24
+ ? record.ontologies
25
+ : Array.isArray(record.definitions)
26
+ ? record.definitions
27
+ : Array.isArray(data)
28
+ ? data
29
+ : [];
30
+ const total = typeof record.total === "number" && Number.isFinite(record.total)
31
+ ? record.total
32
+ : ontologies.length;
33
+ return {
34
+ ...record,
35
+ ...createListResult(ontologies, "definitions"),
36
+ ontologies,
37
+ total,
38
+ };
39
+ }));
40
+ },
41
+ /**
42
+ * Get an ontology definition by identifier.
43
+ */
44
+ async get(id) {
45
+ return gateway.request({
46
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`,
47
+ });
48
+ },
49
+ /**
50
+ * Bind an ontology definition to a topic.
51
+ */
52
+ async bind(input, idempotencyKey) {
53
+ return gateway.request({
54
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
55
+ method: "POST",
56
+ body: {
57
+ topicId: input.topicId,
58
+ },
59
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
60
+ });
61
+ },
62
+ /**
63
+ * List ontology definitions.
64
+ */
65
+ async listDefinitions(filters = {}) {
66
+ return this.list(filters);
67
+ },
68
+ /**
69
+ * Get an ontology definition.
70
+ */
71
+ async getDefinition(id) {
72
+ return this.get(id);
73
+ },
74
+ /**
75
+ * Create an ontology definition.
76
+ */
77
+ async createDefinition(input, idempotencyKey) {
78
+ return gateway.request({
79
+ path: "/api/platform/v1/ontologies",
80
+ method: "POST",
81
+ body: input,
82
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
83
+ });
84
+ },
85
+ /**
86
+ * Update an ontology definition.
87
+ */
88
+ async updateDefinition(id, input, idempotencyKey) {
89
+ return gateway.request({
90
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`,
91
+ method: "PATCH",
92
+ body: input,
93
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
94
+ });
95
+ },
96
+ /**
97
+ * Archive an ontology definition.
98
+ */
99
+ async archiveDefinition(id, idempotencyKey) {
100
+ return gateway.request({
101
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`,
102
+ method: "DELETE",
103
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
104
+ });
105
+ },
106
+ /**
107
+ * List versions for an ontology definition.
108
+ */
109
+ async listVersions(ontologyId, filters = {}) {
110
+ return gateway.request({
111
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(ontologyId)}/versions${toQueryString(filters)}`,
112
+ }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "versions")));
113
+ },
114
+ /**
115
+ * Create an ontology version.
116
+ */
117
+ async createVersion(ontologyId, input, idempotencyKey) {
118
+ return gateway.request({
119
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(ontologyId)}/versions`,
120
+ method: "POST",
121
+ body: input,
122
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
123
+ });
124
+ },
125
+ /**
126
+ * Publish an ontology version.
127
+ */
128
+ async publishVersion(ontologyId, versionId, idempotencyKey) {
129
+ return gateway.request({
130
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(ontologyId)}/versions/${encodeURIComponent(versionId)}/publish`,
131
+ method: "POST",
132
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
133
+ });
134
+ },
135
+ /**
136
+ * Deprecate an ontology version.
137
+ */
138
+ async deprecateVersion(ontologyId, versionId, idempotencyKey) {
139
+ return gateway.request({
140
+ path: `/api/platform/v1/ontologies/${encodeURIComponent(ontologyId)}/versions/${encodeURIComponent(versionId)}/deprecate`,
141
+ method: "POST",
142
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
143
+ });
144
+ },
145
+ /**
146
+ * List topics directly bound to a specific ontology definition.
147
+ * Uses the topics gateway with ontologyId filter.
148
+ */
149
+ async listTopics(ontologyId) {
150
+ return gateway.request({
151
+ path: `/api/platform/v1/topics?ontologyId=${encodeURIComponent(ontologyId)}`,
152
+ }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "topics")));
153
+ },
154
+ /**
155
+ * @deprecated Use listTopics.
156
+ */
157
+ async listTopicsByOntology(ontologyId) {
158
+ return this.listTopics(ontologyId);
159
+ },
160
+ };
161
+ }
@@ -0,0 +1 @@
1
+ export * from "@/lib/platform/packs";
@@ -0,0 +1 @@
1
+ export * from "@/lib/platform/packs";
@@ -2,28 +2,39 @@ import { type GatewayClientConfig, type GatewayScope, LucernApiError } from "./c
2
2
  import type { JsonObject } from "./types";
3
3
  export { LucernApiError };
4
4
  export type { GatewayScope, PlatformGatewaySuccess } from "./coreClient";
5
+ /** Configuration for the packs client. */
5
6
  export type PacksClientConfig = GatewayClientConfig;
7
+ /** Input for installing a pack into a tenant or workspace scope. */
6
8
  export type PackInstallInput = GatewayScope & {
7
9
  packKey: string;
8
10
  version?: string;
9
11
  autoEnable?: boolean;
10
12
  metadata?: JsonObject;
11
13
  };
14
+ /** Input for enabling a previously installed pack. */
12
15
  export type PackEnableInput = GatewayScope & {
13
16
  packKey: string;
14
17
  metadata?: JsonObject;
15
18
  };
19
+ /** Input for disabling an active pack. */
16
20
  export type PackDisableInput = GatewayScope & {
17
21
  packKey: string;
18
22
  force?: boolean;
19
23
  metadata?: JsonObject;
20
24
  };
25
+ /** Input for uninstalling a pack from a tenant or workspace scope. */
26
+ export type PackUninstallInput = GatewayScope & {
27
+ packKey: string;
28
+ metadata?: JsonObject;
29
+ };
30
+ /** Input for upgrading a pack through the prepare/canary/commit/rollback lifecycle. */
21
31
  export type PackUpgradeInput = GatewayScope & {
22
32
  packKey: string;
23
33
  mode: "prepare" | "canary" | "commit" | "rollback";
24
34
  targetVersion?: string;
25
35
  metadata?: JsonObject;
26
36
  };
37
+ /** Input for creating or updating a pack entitlement record. */
27
38
  export type PackEntitlementInput = GatewayScope & {
28
39
  packKey: string;
29
40
  status: "active" | "disabled" | "revoked";
@@ -34,6 +45,8 @@ export type PackEntitlementInput = GatewayScope & {
34
45
  };
35
46
  /**
36
47
  * Create the packs client for pack catalog, state, and entitlement operations.
48
+ * @param config - Gateway transport configuration.
49
+ * @returns An object with methods to manage pack lifecycle, telemetry, and entitlements.
37
50
  */
38
51
  export declare function createPacksClient(config?: PacksClientConfig): {
39
52
  /**
@@ -44,6 +57,14 @@ export declare function createPacksClient(config?: PacksClientConfig): {
44
57
  * @deprecated Use listCatalog.
45
58
  */
46
59
  getCatalog(): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "catalog">>>;
60
+ /**
61
+ * Get the discovery catalog for packs.
62
+ */
63
+ getDiscoveryCatalog(): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
64
+ /**
65
+ * Get discovery details for a specific pack.
66
+ */
67
+ getDiscoveryDetail(packKey: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
47
68
  /**
48
69
  * List pack states for the current scope.
49
70
  */
@@ -94,6 +115,10 @@ export declare function createPacksClient(config?: PacksClientConfig): {
94
115
  * Disable a pack.
95
116
  */
96
117
  disable(input: PackDisableInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
118
+ /**
119
+ * Uninstall a pack.
120
+ */
121
+ uninstall(input: PackUninstallInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
97
122
  /**
98
123
  * Upgrade a pack.
99
124
  */