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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.turbo/turbo-build.log +7 -0
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +13 -0
  4. package/examples/README.md +69 -0
  5. package/examples/contradiction.ts +94 -0
  6. package/examples/investigation-context.ts +118 -0
  7. package/examples/questions-and-tasks.ts +55 -0
  8. package/examples/quickstart.ts +97 -0
  9. package/examples/shared.ts +318 -0
  10. package/examples/strict-public-types.ts +143 -0
  11. package/examples/worktree-lifecycle.ts +79 -0
  12. package/package.json +16 -59
  13. package/src/README.md +6 -0
  14. package/src/adminClient.ts +789 -0
  15. package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
  16. package/src/audiencesClient.ts +209 -0
  17. package/src/auditClient.ts +50 -0
  18. package/src/beliefsClient.ts +319 -0
  19. package/src/client.ts +2647 -0
  20. package/src/contextClient.ts +130 -0
  21. package/src/contextFacade.ts +15 -0
  22. package/src/contextPackCompiler.ts +828 -0
  23. package/src/contextPackSchema.ts +251 -0
  24. package/src/contextTypes.ts +153 -0
  25. package/src/contracts/api-enums.contract.ts +202 -0
  26. package/src/contracts/auth-session.contract.ts +109 -0
  27. package/src/contracts/context-pack.contract.ts +700 -0
  28. package/src/contracts/contextPack.ts +1 -0
  29. package/src/contracts/index.ts +10 -0
  30. package/src/contracts/lens-filter.contract.ts +183 -0
  31. package/src/contracts/lens-workflow.contract.ts +162 -0
  32. package/src/contracts/lensFilter.ts +1 -0
  33. package/src/contracts/lensWorkflow.ts +1 -0
  34. package/src/contracts/mcp-tools.contract.ts +3636 -0
  35. package/src/contracts/mcpTools.ts +1 -0
  36. package/src/contracts/prompt.contract.ts +50 -0
  37. package/src/contracts/prompt.ts +1 -0
  38. package/src/contracts/sdk-tools.contract.ts +1457 -0
  39. package/src/contracts/sdkTools.ts +1 -0
  40. package/src/contracts/workflow-runtime.contract.ts +440 -0
  41. package/src/contracts/workflowRuntime.ts +1 -0
  42. package/src/controlObjectOwnership.ts +286 -0
  43. package/src/coreClient.ts +570 -0
  44. package/src/customTools.ts +398 -0
  45. package/src/decisionsClient.ts +286 -0
  46. package/src/domainContext.ts +15 -0
  47. package/src/events.ts +531 -0
  48. package/src/eventsCore.ts +168 -0
  49. package/src/facade/beliefs.ts +83 -0
  50. package/src/facade/context.ts +110 -0
  51. package/src/facade/contradictions.ts +29 -0
  52. package/src/facade/edges.ts +30 -0
  53. package/src/facade/events.ts +23 -0
  54. package/src/facade/evidence.ts +41 -0
  55. package/src/facade/graph.ts +38 -0
  56. package/src/facade/identity.ts +16 -0
  57. package/src/facade/ontologies.ts +34 -0
  58. package/src/facade/questions.ts +59 -0
  59. package/src/facade/search.ts +16 -0
  60. package/src/facade/tasks.ts +37 -0
  61. package/src/facade/topics.ts +42 -0
  62. package/src/facade/webhooks.ts +58 -0
  63. package/src/facade/worktrees.ts +51 -0
  64. package/src/gatewayFacades.ts +1666 -0
  65. package/src/graphClient.ts +529 -0
  66. package/src/harnessClient.ts +585 -0
  67. package/src/identityClient.ts +278 -0
  68. package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +3 -0
  69. package/src/learningClient.ts +95 -0
  70. package/src/mcpParityClient.ts +240 -0
  71. package/src/mcpParitySurface.ts +70 -0
  72. package/src/ontologyClient.ts +275 -0
  73. package/src/packRuntime.ts +3 -0
  74. package/src/packsClient.ts +260 -0
  75. package/src/policyClient.ts +572 -0
  76. package/src/promptCatalog.ts +1 -0
  77. package/src/realtime/index.ts +51 -0
  78. package/src/realtime/refs.ts +17 -0
  79. package/src/reportsClient.ts +99 -0
  80. package/src/schemaClient.ts +129 -0
  81. package/src/sdkSurface.ts +190 -0
  82. package/src/topicsClient.ts +243 -0
  83. package/src/types.ts +807 -0
  84. package/src/workflowClient.ts +826 -0
  85. package/tsconfig.json +9 -0
  86. package/dist/.generated +0 -2
  87. package/dist/index.d.ts +0 -3
  88. package/dist/index.js +0 -3
  89. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  90. package/dist/lib/platform/auth/credentials.js +0 -40
  91. package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
  92. package/dist/lib/platform/sdk/adminClient.js +0 -384
  93. package/dist/lib/platform/sdk/answersClient.js +0 -21
  94. package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
  95. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  96. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  97. package/dist/lib/platform/sdk/auditClient.js +0 -21
  98. package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
  99. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  100. package/dist/lib/platform/sdk/client.d.ts +0 -2369
  101. package/dist/lib/platform/sdk/client.js +0 -1831
  102. package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
  103. package/dist/lib/platform/sdk/contextClient.js +0 -86
  104. package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
  105. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  106. package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
  107. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  108. package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
  109. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  110. package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
  111. package/dist/lib/platform/sdk/coreClient.js +0 -366
  112. package/dist/lib/platform/sdk/customTools.d.ts +0 -83
  113. package/dist/lib/platform/sdk/customTools.js +0 -247
  114. package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
  115. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  116. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  117. package/dist/lib/platform/sdk/domainContext.js +0 -1
  118. package/dist/lib/platform/sdk/events.d.ts +0 -176
  119. package/dist/lib/platform/sdk/events.js +0 -261
  120. package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
  121. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  122. package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
  123. package/dist/lib/platform/sdk/graphClient.js +0 -235
  124. package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
  125. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  126. package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
  127. package/dist/lib/platform/sdk/identityClient.js +0 -131
  128. package/dist/lib/platform/sdk/index.js +0 -46
  129. package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
  130. package/dist/lib/platform/sdk/learningClient.js +0 -53
  131. package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
  132. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  133. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  134. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  135. package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
  136. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  137. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  138. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  139. package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
  140. package/dist/lib/platform/sdk/packsClient.js +0 -157
  141. package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
  142. package/dist/lib/platform/sdk/policyClient.js +0 -277
  143. package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
  144. package/dist/lib/platform/sdk/promptCatalog.js +0 -1
  145. package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
  146. package/dist/lib/platform/sdk/reportsClient.js +0 -64
  147. package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
  148. package/dist/lib/platform/sdk/schemaClient.js +0 -71
  149. package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
  150. package/dist/lib/platform/sdk/sdkSurface.js +0 -140
  151. package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
  152. package/dist/lib/platform/sdk/topicsClient.js +0 -118
  153. package/dist/lib/platform/sdk/types.d.ts +0 -692
  154. package/dist/lib/platform/sdk/types.js +0 -1
  155. package/dist/lib/platform/sdk/version.d.ts +0 -2
  156. package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
  157. package/dist/lib/platform/sdk/workflowClient.js +0 -366
  158. package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
  159. package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
  160. package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
  161. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  162. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  163. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  164. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  165. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  166. /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
@@ -1,131 +0,0 @@
1
- import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { createListResult, mapGatewayData } from "./sdkSurface.js";
3
- function createIdentityWhoamiClient(config = {}) {
4
- const gateway = createGatewayRequestClient(config);
5
- return {
6
- async whoami() {
7
- return gateway.request({
8
- path: "/api/platform/v1/identity/whoami",
9
- });
10
- },
11
- };
12
- }
13
- export { LucernApiError };
14
- /**
15
- * Create the identity client for principals and API keys.
16
- * @param config - Gateway transport configuration.
17
- * @returns An object with methods for whoami, principal management, and key management.
18
- */
19
- export function createIdentityClient(config = {}) {
20
- const gateway = createGatewayRequestClient(config);
21
- const whoamiClient = createIdentityWhoamiClient(config);
22
- const requestPrincipalWrite = (method, input, idempotencyKey) => gateway.request({
23
- path: "/api/platform/v1/identity/principals",
24
- method,
25
- body: input,
26
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
27
- });
28
- return {
29
- /**
30
- * Resolve the current authenticated identity summary.
31
- */
32
- async whoami() {
33
- return whoamiClient.whoami().then((response) => mapGatewayData(response, (data) => ({
34
- principalId: data.principalId,
35
- principalType: data.principalType,
36
- tenantId: data.tenantId ?? null,
37
- workspaceId: data.workspaceId ?? null,
38
- scopes: Array.isArray(data.scopes) ? data.scopes : [],
39
- roles: Array.isArray(data.roles) ? data.roles : [],
40
- isPlatformAdmin: data.isPlatformAdmin === true,
41
- isTenantAdmin: data.isTenantAdmin === true,
42
- isWorkspaceAdmin: data.isWorkspaceAdmin === true,
43
- authMode: data.authMode,
44
- sessionId: data.sessionId,
45
- delegatedBy: data.delegatedBy,
46
- expiresAt: data.expiresAt,
47
- })));
48
- },
49
- /**
50
- * List principals in the current identity scope.
51
- */
52
- async listPrincipals(query = {}) {
53
- return gateway.request({
54
- path: `/api/platform/v1/identity/principals${toQueryString(query)}`,
55
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "principals")));
56
- },
57
- /**
58
- * Create a principal.
59
- */
60
- async createPrincipal(input, idempotencyKey) {
61
- return requestPrincipalWrite("POST", input, idempotencyKey);
62
- },
63
- /**
64
- * Update a principal.
65
- */
66
- async updatePrincipal(input, idempotencyKey) {
67
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
68
- },
69
- /**
70
- * @deprecated Use createPrincipal or updatePrincipal.
71
- */
72
- async upsertPrincipal(input, idempotencyKey) {
73
- return requestPrincipalWrite("PATCH", input, idempotencyKey);
74
- },
75
- /**
76
- * List keys in the current identity scope.
77
- */
78
- async listKeys(query = {}) {
79
- return gateway.request({
80
- path: `/api/platform/v1/identity/keys${toQueryString(query)}`,
81
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "keys")));
82
- },
83
- /**
84
- * Create an API key.
85
- */
86
- async createKey(input, idempotencyKey) {
87
- return gateway.request({
88
- path: "/api/platform/v1/identity/keys",
89
- method: "POST",
90
- body: input,
91
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
92
- });
93
- },
94
- /**
95
- * Rotate an API key.
96
- */
97
- async rotateKey(keyId, input = {}, idempotencyKey) {
98
- return gateway.request({
99
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/rotate`,
100
- method: "POST",
101
- body: input,
102
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
103
- });
104
- },
105
- /**
106
- * Delete an API key by revoking it.
107
- */
108
- async deleteKey(keyId, input = {}, idempotencyKey) {
109
- return gateway.request({
110
- path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
111
- method: "POST",
112
- body: input,
113
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
114
- });
115
- },
116
- /**
117
- * @deprecated Use deleteKey.
118
- */
119
- async revokeKey(keyId, input = {}, idempotencyKey) {
120
- return this.deleteKey(keyId, input, idempotencyKey);
121
- },
122
- /**
123
- * Search Clerk users by email or display attributes.
124
- */
125
- async searchClerkUsers(q) {
126
- return gateway.request({
127
- path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`,
128
- });
129
- },
130
- };
131
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * @lucern/sdk — The reasoning operating system for AI-native applications.
3
- *
4
- * This is the main entry point. It re-exports all client factories,
5
- * types, contracts, and utilities from domain modules.
6
- *
7
- * @packageDocumentation
8
- */
9
- export * from "./adminClient.js";
10
- export * from "./answersClient.js";
11
- export * from "./audiencesClient.js";
12
- export * from "./auditClient.js";
13
- export * from "./beliefsClient.js";
14
- export * from "./client.js";
15
- export * from "./contextPackCompiler.js";
16
- export * from "./controlObjectOwnership.js";
17
- export * from "./coreClient.js";
18
- export * from "./contextClient.js";
19
- export * from "./contracts/api-enums.contract.js";
20
- export * from "./contracts/auth-session.contract.js";
21
- export { MAX_ENTITY_LIMIT } from "./contracts/contextPack.js";
22
- export * from "./contracts/lensFilter.js";
23
- export * from "./contracts/lensWorkflow.js";
24
- export * from "./contracts/mcpTools.js";
25
- export * from "./contracts/prompt.js";
26
- export * from "./contracts/workflowRuntime.js";
27
- export * from "./domainContext.js";
28
- export * from "./customTools.js";
29
- export * from "./decisionsClient.js";
30
- export * from "./events.js";
31
- export * from "./graphClient.js";
32
- export * from "./harnessClient.js";
33
- export * from "./identityClient.js";
34
- export * from "./learningClient.js";
35
- export * from "./mcpParityClient.js";
36
- export * from "./ontologyClient.js";
37
- export * from "./packRuntime.js";
38
- export * from "./packsClient.js";
39
- export * from "./policyClient.js";
40
- export * from "./reportsClient.js";
41
- export * from "./schemaClient.js";
42
- export * from "./sdkSurface.js";
43
- export * from "./topicsClient.js";
44
- export * from "./types.js";
45
- export * from "./version.js";
46
- export * from "./workflowClient.js";
@@ -1,40 +0,0 @@
1
- import { type GatewayClientConfig } from "./coreClient";
2
- import type { TopicIdentifierInput } from "./types";
3
- /** Configuration for the learning client. */
4
- export type LearningClientConfig = GatewayClientConfig;
5
- /**
6
- * Create the learning client for execution telemetry reads.
7
- * @param config - Gateway transport configuration.
8
- * @returns An object with methods to list executions and retrieve stats.
9
- */
10
- export declare function createLearningClient(config?: LearningClientConfig): {
11
- /**
12
- * List recent execution records.
13
- */
14
- listRecentExecutions(args?: {
15
- namespace?: string;
16
- topicId?: string;
17
- audienceMode?: string;
18
- success?: boolean;
19
- limit?: number;
20
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "executions">>>;
21
- /**
22
- * @deprecated Use listRecentExecutions.
23
- */
24
- getRecentExecutions(args?: {
25
- namespace?: string;
26
- topicId?: string;
27
- audienceMode?: string;
28
- success?: boolean;
29
- limit?: number;
30
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<any, "executions">>>;
31
- /**
32
- * Get aggregate execution statistics.
33
- */
34
- getExecutionStats(args?: {
35
- namespace?: string;
36
- topicId?: string;
37
- audienceMode?: string;
38
- hours?: number;
39
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<unknown>>;
40
- };
@@ -1,53 +0,0 @@
1
- import { createGatewayRequestClient, toQueryString, } from "./coreClient.js";
2
- import { createListResult, mapGatewayData, normalizeTopicQuery } from "./sdkSurface.js";
3
- /**
4
- * Create the learning client for execution telemetry reads.
5
- * @param config - Gateway transport configuration.
6
- * @returns An object with methods to list executions and retrieve stats.
7
- */
8
- export function createLearningClient(config = {}) {
9
- const gateway = createGatewayRequestClient(config);
10
- return {
11
- /**
12
- * List recent execution records.
13
- */
14
- async listRecentExecutions(args = {}) {
15
- return gateway.request({
16
- path: `/api/platform/v1/learning/executions/recent${toQueryString({
17
- ...normalizeTopicQuery(args),
18
- namespace: args.namespace,
19
- audienceMode: args.audienceMode,
20
- success: typeof args.success === "boolean"
21
- ? args.success
22
- ? "true"
23
- : "false"
24
- : undefined,
25
- limit: typeof args.limit === "number" && Number.isFinite(args.limit)
26
- ? String(args.limit)
27
- : undefined,
28
- })}`,
29
- }).then((response) => mapGatewayData(response, (data) => createListResult(Array.isArray(data) ? data : [], "executions")));
30
- },
31
- /**
32
- * @deprecated Use listRecentExecutions.
33
- */
34
- async getRecentExecutions(args = {}) {
35
- return this.listRecentExecutions(args);
36
- },
37
- /**
38
- * Get aggregate execution statistics.
39
- */
40
- async getExecutionStats(args = {}) {
41
- return gateway.request({
42
- path: `/api/platform/v1/learning/executions/stats${toQueryString({
43
- ...normalizeTopicQuery(args),
44
- namespace: args.namespace,
45
- audienceMode: args.audienceMode,
46
- hours: typeof args.hours === "number" && Number.isFinite(args.hours)
47
- ? String(args.hours)
48
- : undefined,
49
- })}`,
50
- });
51
- },
52
- };
53
- }
@@ -1,69 +0,0 @@
1
- import { type GatewayClientConfig, type PlatformGatewaySuccess } from "./coreClient";
2
- import type { JsonObject } from "./types";
3
- /** Configuration for the MCP parity client. Inherits gateway transport settings. */
4
- export type McpParityClientConfig = GatewayClientConfig;
5
- type ToolArgs = JsonObject;
6
- type ToolResult<T = unknown> = Promise<PlatformGatewaySuccess<T>>;
7
- /**
8
- * Thin typed bridge for MCP-only SDK parity methods.
9
- *
10
- * These methods map 1:1 to the Lucern MCP handlers and execute through the
11
- * platform gateway so the SDK can cover the full control-plane surface.
12
- */
13
- export declare function createMcpParityClient(config?: McpParityClientConfig): {
14
- sessionId: `${string}-${string}-${string}-${string}-${string}`;
15
- listTopics(args?: ToolArgs): ToolResult<unknown>;
16
- createTopic(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
17
- getTopic(args: ToolArgs): ToolResult<unknown>;
18
- getTopicTree(args: ToolArgs): ToolResult<unknown>;
19
- activateWorktree(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
20
- updateWorktreeMetadata(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
21
- updateWorktreeTargets(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
22
- listAllWorktrees(args?: ToolArgs): ToolResult<unknown>;
23
- pipelineSnapshot(args: ToolArgs): ToolResult<unknown>;
24
- recordScopeLearning(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
25
- discover(args: ToolArgs): ToolResult<unknown>;
26
- analyzeTopicDensity(args: ToolArgs): ToolResult<unknown>;
27
- applyAutoBranching(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
28
- seedBeliefLattice(args?: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
29
- getLatticeCoverage(args?: ToolArgs): ToolResult<unknown>;
30
- matchEntityType(args: ToolArgs): ToolResult<unknown>;
31
- discoverEntityConnections(args: ToolArgs): ToolResult<unknown>;
32
- triggerBeliefReview(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
33
- listOntologies(args?: ToolArgs): ToolResult<unknown>;
34
- getOntology(args: ToolArgs): ToolResult<unknown>;
35
- applyOntology(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
36
- createOntology(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
37
- updateOntology(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
38
- archiveOntology(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
39
- createOntologyVersion(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
40
- publishOntologyVersion(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
41
- deprecateOntologyVersion(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
42
- resolveEffectiveOntology(args: ToolArgs): ToolResult<unknown>;
43
- registerSession(args?: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
44
- heartbeatSession(args?: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
45
- endSession(args?: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
46
- listActiveSessions(args?: ToolArgs): ToolResult<unknown>;
47
- sendAgentMessage(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
48
- broadcastMessage(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
49
- getAgentInbox(args?: ToolArgs): ToolResult<unknown>;
50
- claimFiles(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
51
- listTasks(args: ToolArgs): ToolResult<unknown>;
52
- createAnswer(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
53
- getAnswer(args: ToolArgs): ToolResult<unknown>;
54
- flagContradiction(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
55
- ingestObservation(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
56
- getObservationContext(args: ToolArgs): ToolResult<unknown>;
57
- getCodeContext(args: ToolArgs): ToolResult<unknown>;
58
- getChangeHistory(args: ToolArgs): ToolResult<unknown>;
59
- recordAttempt(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
60
- getFailureLog(args: ToolArgs): ToolResult<unknown>;
61
- createEpistemicContract(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
62
- evaluateContract(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
63
- getContractStatus(args: ToolArgs): ToolResult<unknown>;
64
- checkPermission(args: ToolArgs): ToolResult<unknown>;
65
- filterByPermission(args: ToolArgs): ToolResult<unknown>;
66
- manageWritePolicy(args: ToolArgs, idempotencyKey?: string): ToolResult<unknown>;
67
- generateSessionHandoff(args: ToolArgs): ToolResult<unknown>;
68
- };
69
- export {};
@@ -1,196 +0,0 @@
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,10 +0,0 @@
1
- /** Descriptor mapping an MCP tool name to its SDK method path and read/mutation classification. */
2
- export type McpParityMethod = {
3
- toolName: string;
4
- methodPath: string;
5
- kind: "read" | "mutation";
6
- };
7
- /** Complete registry of MCP tools with SDK parity, mapping tool names to SDK method paths. */
8
- export declare const SDK_MCP_PARITY_METHODS: readonly McpParityMethod[];
9
- export declare const SDK_MCP_PARITY_METHOD_PATHS: string[];
10
- export declare const SDK_MCP_PARITY_TOOL_NAMES: string[];
@@ -1,57 +0,0 @@
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);