@lucern/sdk 0.3.0-alpha.7 → 0.3.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/beliefs/index.d.ts +1 -0
- package/dist/beliefs/index.js +51 -27
- package/dist/beliefs/index.js.map +1 -1
- package/dist/client.d.ts +6 -3
- package/dist/client.js +51 -27
- package/dist/client.js.map +1 -1
- package/dist/clientHelpers.d.ts +21 -2
- package/dist/clientHelpers.js +16 -1
- package/dist/clientHelpers.js.map +1 -1
- package/dist/contextClient.d.ts +4 -3
- package/dist/contextClient.js +30 -18
- package/dist/contextClient.js.map +1 -1
- package/dist/contextFacade.js +25 -16
- package/dist/contextFacade.js.map +1 -1
- package/dist/contextTypes.d.ts +2 -0
- package/dist/contradictions/index.d.ts +1 -0
- package/dist/contradictions/index.js +51 -27
- package/dist/contradictions/index.js.map +1 -1
- package/dist/decisions/index.d.ts +1 -0
- package/dist/decisions/index.js +51 -27
- package/dist/decisions/index.js.map +1 -1
- package/dist/edges/index.d.ts +1 -0
- package/dist/edges/index.js +51 -27
- package/dist/edges/index.js.map +1 -1
- package/dist/evidence/index.d.ts +1 -0
- package/dist/evidence/index.js +51 -27
- package/dist/evidence/index.js.map +1 -1
- package/dist/facade/context.d.ts +2 -1
- package/dist/facade/context.js +25 -16
- package/dist/facade/context.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +76 -43
- package/dist/index.js.map +1 -1
- package/dist/lenses/index.d.ts +1 -0
- package/dist/lenses/index.js +51 -27
- package/dist/lenses/index.js.map +1 -1
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +51 -27
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +1 -0
- package/dist/ontologies/index.js +51 -27
- package/dist/ontologies/index.js.map +1 -1
- package/dist/questions/index.d.ts +1 -0
- package/dist/questions/index.js +51 -27
- package/dist/questions/index.js.map +1 -1
- package/dist/topics/index.d.ts +1 -0
- package/dist/topics/index.js +51 -27
- package/dist/topics/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/worktrees/index.d.ts +1 -0
- package/dist/worktrees/index.js +51 -27
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +4 -4
package/dist/facade/context.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ type ContextFacadeConfig = {
|
|
|
12
12
|
transport: ContextFacadeTransport;
|
|
13
13
|
};
|
|
14
14
|
declare function createContextFacade(config: ContextFacadeConfig): {
|
|
15
|
-
compile(
|
|
15
|
+
compile(topicIdOrInput?: string | CompileContextInput, input?: CompileContextInput): Promise<PublicCompiledContext>;
|
|
16
|
+
compileByQuery(input?: CompileContextInput): Promise<PublicCompiledContext>;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export { CompileContextInput, type ContextClientRequest, type ContextFacadeConfig, type ContextFacadeTransport, PublicCompiledContext, createContextFacade };
|
package/dist/facade/context.js
CHANGED
|
@@ -8,50 +8,55 @@ function cleanNumber(value) {
|
|
|
8
8
|
function cleanBoolean(value) {
|
|
9
9
|
return typeof value === "boolean" ? value : void 0;
|
|
10
10
|
}
|
|
11
|
-
function buildCompileContextRequest(
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
12
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
13
|
+
const payload = {};
|
|
14
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString(topicIdOrInput) : cleanString(effectiveInput.topicId);
|
|
15
|
+
if (topicId) {
|
|
16
|
+
payload.topicId = topicId;
|
|
17
|
+
}
|
|
18
|
+
const query = cleanString(effectiveInput.query);
|
|
14
19
|
if (query) {
|
|
15
20
|
payload.query = query;
|
|
16
21
|
}
|
|
17
|
-
const budget = cleanNumber(
|
|
22
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
18
23
|
if (budget !== void 0) {
|
|
19
24
|
payload.budget = budget;
|
|
20
25
|
}
|
|
21
|
-
const ranking = cleanString(
|
|
26
|
+
const ranking = cleanString(effectiveInput.ranking) ?? cleanString(effectiveInput.rankingProfile);
|
|
22
27
|
if (ranking) {
|
|
23
28
|
payload.ranking = ranking;
|
|
24
29
|
}
|
|
25
|
-
const limit = cleanNumber(
|
|
30
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
26
31
|
if (limit !== void 0) {
|
|
27
32
|
payload.limit = limit;
|
|
28
33
|
}
|
|
29
|
-
const maxDepth = cleanNumber(
|
|
34
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
30
35
|
if (maxDepth !== void 0) {
|
|
31
36
|
payload.maxDepth = maxDepth;
|
|
32
37
|
}
|
|
33
|
-
const includeEntities = cleanBoolean(
|
|
38
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
34
39
|
if (includeEntities !== void 0) {
|
|
35
40
|
payload.includeEntities = includeEntities;
|
|
36
41
|
}
|
|
37
|
-
const mode = cleanString(
|
|
42
|
+
const mode = cleanString(effectiveInput.mode);
|
|
38
43
|
if (mode) {
|
|
39
44
|
payload.mode = mode;
|
|
40
45
|
}
|
|
41
|
-
const includeFailures = cleanBoolean(
|
|
46
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
42
47
|
if (includeFailures !== void 0) {
|
|
43
48
|
payload.includeFailures = includeFailures;
|
|
44
49
|
}
|
|
45
|
-
const worktreeId = cleanString(
|
|
50
|
+
const worktreeId = cleanString(effectiveInput.worktreeId);
|
|
46
51
|
if (worktreeId) {
|
|
47
52
|
payload.worktreeId = worktreeId;
|
|
48
53
|
}
|
|
49
|
-
const sessionId = cleanString(
|
|
54
|
+
const sessionId = cleanString(effectiveInput.sessionId);
|
|
50
55
|
if (sessionId) {
|
|
51
56
|
payload.sessionId = sessionId;
|
|
52
57
|
}
|
|
53
|
-
if (Array.isArray(
|
|
54
|
-
payload.packWeightOverrides =
|
|
58
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
59
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
55
60
|
}
|
|
56
61
|
return {
|
|
57
62
|
path: "/api/platform/v1/context/compile",
|
|
@@ -61,8 +66,12 @@ function buildCompileContextRequest(topicId, input = {}) {
|
|
|
61
66
|
}
|
|
62
67
|
function createContextFacade(config) {
|
|
63
68
|
return {
|
|
64
|
-
compile(
|
|
65
|
-
const request = buildCompileContextRequest(
|
|
69
|
+
compile(topicIdOrInput = {}, input = {}) {
|
|
70
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
71
|
+
return config.transport.request(request);
|
|
72
|
+
},
|
|
73
|
+
compileByQuery(input = {}) {
|
|
74
|
+
const request = buildCompileContextRequest(input);
|
|
66
75
|
return config.transport.request(request);
|
|
67
76
|
}
|
|
68
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/facade/context.ts"],"names":[],"mappings":";AAgBA,SAAS,YAAY,KAAA,EAAoC;AACvD,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,IAAA,GAAO,MAAA,GAAS,CAAA,GACtD,KAAA,CAAM,IAAA,EAAK,GACX,MAAA;AACN;AAEA,SAAS,YAAY,KAAA,EAAoC;AACvD,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,OAAO,QAAA,CAAS,KAAK,IAAI,KAAA,GAAQ,MAAA;AACvE;AAEA,SAAS,aAAa,KAAA,EAAqC;AACzD,EAAA,OAAO,OAAO,KAAA,KAAU,SAAA,GAAY,KAAA,GAAQ,MAAA;AAC9C;AAEA,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../src/facade/context.ts"],"names":[],"mappings":";AAgBA,SAAS,YAAY,KAAA,EAAoC;AACvD,E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CAAoB,SAAS,CAAA,EAC5C;AACA,IAAA,OAAA,CAAQ,sBAAsB,cAAA,CAAe,mBAAA;AAAA,EAC/C;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,kCAAA;AAAA,IACN,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EAAM;AAAA,GACR;AACF;AAEO,SAAS,oBAAoB,MAAA,EAA6B;AAC/D,EAAA,OAAO;AAAA,IACL,QACE,cAAA,GAA+C,EAAC,EAChD,KAAA,GAA6B,EAAC,EAC9B;AACA,MAAA,MAAM,OAAA,GAAU,0BAAA,CAA2B,cAAA,EAAgB,KAAK,CAAA;AAChE,MAAA,OAAO,MAAA,CAAO,SAAA,CAAU,OAAA,CAA+B,OAAO,CAAA;AAAA,IAChE,CAAA;AAAA,IACA,cAAA,CAAe,KAAA,GAA6B,EAAC,EAAG;AAC9C,MAAA,MAAM,OAAA,GAAU,2BAA2B,KAAK,CAAA;AAChD,MAAA,OAAO,MAAA,CAAO,SAAA,CAAU,OAAA,CAA+B,OAAO,CAAA;AAAA,IAChE;AAAA,GACF;AACF","file":"context.js","sourcesContent":["import type { CompileContextInput, PublicCompiledContext } from \"../contextTypes\";\n\nexport type ContextClientRequest = {\n path: \"/api/platform/v1/context/compile\";\n method: \"POST\";\n body: Record<string, unknown>;\n};\n\nexport type ContextFacadeTransport = {\n request<T>(request: ContextClientRequest): Promise<T>;\n};\n\nexport type ContextFacadeConfig = {\n transport: ContextFacadeTransport;\n};\n\nfunction cleanString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0\n ? value.trim()\n : undefined;\n}\n\nfunction cleanNumber(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nfunction cleanBoolean(value: unknown): boolean | undefined {\n return typeof value === \"boolean\" ? value : undefined;\n}\n\nfunction buildCompileContextRequest(\n topicIdOrInput: string | CompileContextInput = {},\n input: CompileContextInput = {}\n): ContextClientRequest {\n const effectiveInput =\n typeof topicIdOrInput === \"string\" ? input : topicIdOrInput;\n const payload: Record<string, unknown> = {};\n\n const topicId =\n typeof topicIdOrInput === \"string\"\n ? cleanString(topicIdOrInput)\n : cleanString(effectiveInput.topicId);\n if (topicId) {\n payload.topicId = topicId;\n }\n\n const query = cleanString(effectiveInput.query);\n if (query) {\n payload.query = query;\n }\n\n const budget =\n cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);\n if (budget !== undefined) {\n payload.budget = budget;\n }\n\n const ranking =\n cleanString(effectiveInput.ranking) ?? cleanString(effectiveInput.rankingProfile);\n if (ranking) {\n payload.ranking = ranking;\n }\n\n const limit = cleanNumber(effectiveInput.limit);\n if (limit !== undefined) {\n payload.limit = limit;\n }\n\n const maxDepth = cleanNumber(effectiveInput.maxDepth);\n if (maxDepth !== undefined) {\n payload.maxDepth = maxDepth;\n }\n\n const includeEntities = cleanBoolean(effectiveInput.includeEntities);\n if (includeEntities !== undefined) {\n payload.includeEntities = includeEntities;\n }\n\n const mode = cleanString(effectiveInput.mode);\n if (mode) {\n payload.mode = mode;\n }\n\n const includeFailures = cleanBoolean(effectiveInput.includeFailures);\n if (includeFailures !== undefined) {\n payload.includeFailures = includeFailures;\n }\n\n const worktreeId = cleanString(effectiveInput.worktreeId);\n if (worktreeId) {\n payload.worktreeId = worktreeId;\n }\n\n const sessionId = cleanString(effectiveInput.sessionId);\n if (sessionId) {\n payload.sessionId = sessionId;\n }\n\n if (\n Array.isArray(effectiveInput.packWeightOverrides) &&\n effectiveInput.packWeightOverrides.length > 0\n ) {\n payload.packWeightOverrides = effectiveInput.packWeightOverrides;\n }\n\n return {\n path: \"/api/platform/v1/context/compile\",\n method: \"POST\",\n body: payload,\n };\n}\n\nexport function createContextFacade(config: ContextFacadeConfig) {\n return {\n compile(\n topicIdOrInput: string | CompileContextInput = {},\n input: CompileContextInput = {}\n ) {\n const request = buildCompileContextRequest(topicIdOrInput, input);\n return config.transport.request<PublicCompiledContext>(request);\n },\n compileByQuery(input: CompileContextInput = {}) {\n const request = buildCompileContextRequest(input);\n return config.transport.request<PublicCompiledContext>(request);\n },\n };\n}\n\nexport type { CompileContextInput, PublicCompiledContext };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export { AddWorktreeInput, AdvanceWorktreePhaseInput, BulkCreateWorktreesInput,
|
|
|
59
59
|
export * from '@lucern/contracts/tool-contracts';
|
|
60
60
|
import './mcpClient.js';
|
|
61
61
|
import '@lucern/contracts/mcp-gateway-boundary.contract';
|
|
62
|
+
import './clientHelpers.js';
|
|
62
63
|
import './contextPackPolicy.js';
|
|
63
64
|
import 'zod';
|
|
64
65
|
import './boundaryClientSurface.js';
|
package/dist/index.js
CHANGED
|
@@ -4166,50 +4166,55 @@ function cleanNumber(value) {
|
|
|
4166
4166
|
function cleanBoolean(value) {
|
|
4167
4167
|
return typeof value === "boolean" ? value : void 0;
|
|
4168
4168
|
}
|
|
4169
|
-
function buildCompileContextRequest(
|
|
4170
|
-
const
|
|
4171
|
-
const
|
|
4169
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
4170
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
4171
|
+
const payload = {};
|
|
4172
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
4173
|
+
if (topicId) {
|
|
4174
|
+
payload.topicId = topicId;
|
|
4175
|
+
}
|
|
4176
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
4172
4177
|
if (query5) {
|
|
4173
4178
|
payload.query = query5;
|
|
4174
4179
|
}
|
|
4175
|
-
const budget = cleanNumber(
|
|
4180
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
4176
4181
|
if (budget !== void 0) {
|
|
4177
4182
|
payload.budget = budget;
|
|
4178
4183
|
}
|
|
4179
|
-
const ranking = cleanString4(
|
|
4184
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
4180
4185
|
if (ranking) {
|
|
4181
4186
|
payload.ranking = ranking;
|
|
4182
4187
|
}
|
|
4183
|
-
const limit = cleanNumber(
|
|
4188
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
4184
4189
|
if (limit !== void 0) {
|
|
4185
4190
|
payload.limit = limit;
|
|
4186
4191
|
}
|
|
4187
|
-
const maxDepth = cleanNumber(
|
|
4192
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
4188
4193
|
if (maxDepth !== void 0) {
|
|
4189
4194
|
payload.maxDepth = maxDepth;
|
|
4190
4195
|
}
|
|
4191
|
-
const includeEntities = cleanBoolean(
|
|
4196
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
4192
4197
|
if (includeEntities !== void 0) {
|
|
4193
4198
|
payload.includeEntities = includeEntities;
|
|
4194
4199
|
}
|
|
4195
|
-
const mode = cleanString4(
|
|
4200
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
4196
4201
|
if (mode) {
|
|
4197
4202
|
payload.mode = mode;
|
|
4198
4203
|
}
|
|
4199
|
-
const includeFailures = cleanBoolean(
|
|
4204
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
4200
4205
|
if (includeFailures !== void 0) {
|
|
4201
4206
|
payload.includeFailures = includeFailures;
|
|
4202
4207
|
}
|
|
4203
|
-
const worktreeId = cleanString4(
|
|
4208
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
4204
4209
|
if (worktreeId) {
|
|
4205
4210
|
payload.worktreeId = worktreeId;
|
|
4206
4211
|
}
|
|
4207
|
-
const sessionId = cleanString4(
|
|
4212
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
4208
4213
|
if (sessionId) {
|
|
4209
4214
|
payload.sessionId = sessionId;
|
|
4210
4215
|
}
|
|
4211
|
-
if (Array.isArray(
|
|
4212
|
-
payload.packWeightOverrides =
|
|
4216
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
4217
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
4213
4218
|
}
|
|
4214
4219
|
return {
|
|
4215
4220
|
path: "/api/platform/v1/context/compile",
|
|
@@ -4221,13 +4226,20 @@ function createContextClient(config = {}) {
|
|
|
4221
4226
|
const gateway = createGatewayRequestClient(config);
|
|
4222
4227
|
return {
|
|
4223
4228
|
/**
|
|
4224
|
-
* Compile a focused reasoning context pack
|
|
4225
|
-
* @param
|
|
4229
|
+
* Compile a focused reasoning context pack.
|
|
4230
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
4226
4231
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
4227
4232
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
4228
4233
|
*/
|
|
4229
|
-
async compile(
|
|
4230
|
-
const request = buildCompileContextRequest(
|
|
4234
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
4235
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
4236
|
+
return gateway.request({
|
|
4237
|
+
...request,
|
|
4238
|
+
body: request.body
|
|
4239
|
+
});
|
|
4240
|
+
},
|
|
4241
|
+
async compileByQuery(input = {}) {
|
|
4242
|
+
const request = buildCompileContextRequest(input);
|
|
4231
4243
|
return gateway.request({
|
|
4232
4244
|
...request,
|
|
4233
4245
|
body: request.body
|
|
@@ -6616,6 +6628,21 @@ function createSchemaClient(config = {}) {
|
|
|
6616
6628
|
}
|
|
6617
6629
|
|
|
6618
6630
|
// src/clientHelpers.ts
|
|
6631
|
+
function normalizeCustomNamespace(namespace) {
|
|
6632
|
+
return namespace.trim() || "custom";
|
|
6633
|
+
}
|
|
6634
|
+
function normalizeCustomToolPayload(input) {
|
|
6635
|
+
return input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
6636
|
+
}
|
|
6637
|
+
function resolveCustomToolFullName(name) {
|
|
6638
|
+
return name.includes(".") ? name : `custom.${name}`;
|
|
6639
|
+
}
|
|
6640
|
+
function buildBeliefsRefinePayload(textOrInput, rationale) {
|
|
6641
|
+
return typeof textOrInput === "string" ? { text: textOrInput, rationale } : { text: textOrInput.text, rationale: textOrInput.rationale };
|
|
6642
|
+
}
|
|
6643
|
+
function buildBeliefsArchivePayload(input) {
|
|
6644
|
+
return typeof input === "string" ? { reason: input } : input ? { reason: input.reason ?? input.rationale } : void 0;
|
|
6645
|
+
}
|
|
6619
6646
|
function asNodeArray(data) {
|
|
6620
6647
|
const rows = asListItems(data, "nodes");
|
|
6621
6648
|
if (rows.length > 0) {
|
|
@@ -6993,7 +7020,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
6993
7020
|
}
|
|
6994
7021
|
|
|
6995
7022
|
// src/version.ts
|
|
6996
|
-
var LUCERN_SDK_VERSION = "0.3.0-alpha.
|
|
7023
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.9";
|
|
6997
7024
|
|
|
6998
7025
|
// src/workflowClient.ts
|
|
6999
7026
|
function normalizeLensQuery(value) {
|
|
@@ -7514,11 +7541,11 @@ function createLucernClient(config = {}) {
|
|
|
7514
7541
|
}
|
|
7515
7542
|
}
|
|
7516
7543
|
const invokeCustomTool = async (fullName, input = {}) => {
|
|
7517
|
-
const payload =
|
|
7544
|
+
const payload = normalizeCustomToolPayload(input);
|
|
7518
7545
|
return invokeRegisteredCustomTool(fullName, payload, { source: "sdk" });
|
|
7519
7546
|
};
|
|
7520
7547
|
const getCustomNamespace = (namespace) => {
|
|
7521
|
-
const normalized = namespace
|
|
7548
|
+
const normalized = normalizeCustomNamespace(namespace);
|
|
7522
7549
|
const cached = customNamespaceCache.get(normalized);
|
|
7523
7550
|
if (cached) {
|
|
7524
7551
|
return cached;
|
|
@@ -7978,10 +8005,7 @@ function createLucernClient(config = {}) {
|
|
|
7978
8005
|
return beliefsFacade.get(nodeId).then(exposeGatewayData);
|
|
7979
8006
|
},
|
|
7980
8007
|
refine(nodeId, textOrInput, rationale) {
|
|
7981
|
-
const payload =
|
|
7982
|
-
text: textOrInput.text,
|
|
7983
|
-
rationale: textOrInput.rationale
|
|
7984
|
-
};
|
|
8008
|
+
const payload = buildBeliefsRefinePayload(textOrInput, rationale);
|
|
7985
8009
|
return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
|
|
7986
8010
|
},
|
|
7987
8011
|
updateConfidence(nodeId, input) {
|
|
@@ -8019,7 +8043,7 @@ function createLucernClient(config = {}) {
|
|
|
8019
8043
|
}).then(exposeGatewayData);
|
|
8020
8044
|
},
|
|
8021
8045
|
archive(nodeId, input) {
|
|
8022
|
-
const payload =
|
|
8046
|
+
const payload = buildBeliefsArchivePayload(input);
|
|
8023
8047
|
return beliefsFacade.archive(nodeId, payload).then(exposeGatewayData);
|
|
8024
8048
|
},
|
|
8025
8049
|
list(args) {
|
|
@@ -9059,7 +9083,7 @@ function createLucernClient(config = {}) {
|
|
|
9059
9083
|
list: listRegisteredCustomTools,
|
|
9060
9084
|
clear: clearRegisteredCustomTools,
|
|
9061
9085
|
invoke(name, input = {}) {
|
|
9062
|
-
const fullName = name
|
|
9086
|
+
const fullName = resolveCustomToolFullName(name);
|
|
9063
9087
|
return invokeCustomTool(fullName, input);
|
|
9064
9088
|
},
|
|
9065
9089
|
namespace: getCustomNamespace
|
|
@@ -9158,50 +9182,55 @@ function cleanNumber2(value) {
|
|
|
9158
9182
|
function cleanBoolean2(value) {
|
|
9159
9183
|
return typeof value === "boolean" ? value : void 0;
|
|
9160
9184
|
}
|
|
9161
|
-
function buildCompileContextRequest2(
|
|
9162
|
-
const
|
|
9163
|
-
const
|
|
9185
|
+
function buildCompileContextRequest2(topicIdOrInput = {}, input = {}) {
|
|
9186
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
9187
|
+
const payload = {};
|
|
9188
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString6(topicIdOrInput) : cleanString6(effectiveInput.topicId);
|
|
9189
|
+
if (topicId) {
|
|
9190
|
+
payload.topicId = topicId;
|
|
9191
|
+
}
|
|
9192
|
+
const query5 = cleanString6(effectiveInput.query);
|
|
9164
9193
|
if (query5) {
|
|
9165
9194
|
payload.query = query5;
|
|
9166
9195
|
}
|
|
9167
|
-
const budget = cleanNumber2(
|
|
9196
|
+
const budget = cleanNumber2(effectiveInput.budget) ?? cleanNumber2(effectiveInput.tokenBudget);
|
|
9168
9197
|
if (budget !== void 0) {
|
|
9169
9198
|
payload.budget = budget;
|
|
9170
9199
|
}
|
|
9171
|
-
const ranking = cleanString6(
|
|
9200
|
+
const ranking = cleanString6(effectiveInput.ranking) ?? cleanString6(effectiveInput.rankingProfile);
|
|
9172
9201
|
if (ranking) {
|
|
9173
9202
|
payload.ranking = ranking;
|
|
9174
9203
|
}
|
|
9175
|
-
const limit = cleanNumber2(
|
|
9204
|
+
const limit = cleanNumber2(effectiveInput.limit);
|
|
9176
9205
|
if (limit !== void 0) {
|
|
9177
9206
|
payload.limit = limit;
|
|
9178
9207
|
}
|
|
9179
|
-
const maxDepth = cleanNumber2(
|
|
9208
|
+
const maxDepth = cleanNumber2(effectiveInput.maxDepth);
|
|
9180
9209
|
if (maxDepth !== void 0) {
|
|
9181
9210
|
payload.maxDepth = maxDepth;
|
|
9182
9211
|
}
|
|
9183
|
-
const includeEntities = cleanBoolean2(
|
|
9212
|
+
const includeEntities = cleanBoolean2(effectiveInput.includeEntities);
|
|
9184
9213
|
if (includeEntities !== void 0) {
|
|
9185
9214
|
payload.includeEntities = includeEntities;
|
|
9186
9215
|
}
|
|
9187
|
-
const mode = cleanString6(
|
|
9216
|
+
const mode = cleanString6(effectiveInput.mode);
|
|
9188
9217
|
if (mode) {
|
|
9189
9218
|
payload.mode = mode;
|
|
9190
9219
|
}
|
|
9191
|
-
const includeFailures = cleanBoolean2(
|
|
9220
|
+
const includeFailures = cleanBoolean2(effectiveInput.includeFailures);
|
|
9192
9221
|
if (includeFailures !== void 0) {
|
|
9193
9222
|
payload.includeFailures = includeFailures;
|
|
9194
9223
|
}
|
|
9195
|
-
const worktreeId = cleanString6(
|
|
9224
|
+
const worktreeId = cleanString6(effectiveInput.worktreeId);
|
|
9196
9225
|
if (worktreeId) {
|
|
9197
9226
|
payload.worktreeId = worktreeId;
|
|
9198
9227
|
}
|
|
9199
|
-
const sessionId = cleanString6(
|
|
9228
|
+
const sessionId = cleanString6(effectiveInput.sessionId);
|
|
9200
9229
|
if (sessionId) {
|
|
9201
9230
|
payload.sessionId = sessionId;
|
|
9202
9231
|
}
|
|
9203
|
-
if (Array.isArray(
|
|
9204
|
-
payload.packWeightOverrides =
|
|
9232
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
9233
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
9205
9234
|
}
|
|
9206
9235
|
return {
|
|
9207
9236
|
path: "/api/platform/v1/context/compile",
|
|
@@ -9211,8 +9240,12 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
9211
9240
|
}
|
|
9212
9241
|
function createContextFacade(config) {
|
|
9213
9242
|
return {
|
|
9214
|
-
compile(
|
|
9215
|
-
const request = buildCompileContextRequest2(
|
|
9243
|
+
compile(topicIdOrInput = {}, input = {}) {
|
|
9244
|
+
const request = buildCompileContextRequest2(topicIdOrInput, input);
|
|
9245
|
+
return config.transport.request(request);
|
|
9246
|
+
},
|
|
9247
|
+
compileByQuery(input = {}) {
|
|
9248
|
+
const request = buildCompileContextRequest2(input);
|
|
9216
9249
|
return config.transport.request(request);
|
|
9217
9250
|
}
|
|
9218
9251
|
};
|