@lucern/sdk 0.3.0-alpha.7 → 0.3.0-alpha.8

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 (41) hide show
  1. package/README.md +4 -4
  2. package/dist/beliefs/index.js +31 -19
  3. package/dist/beliefs/index.js.map +1 -1
  4. package/dist/client.d.ts +1 -1
  5. package/dist/client.js +31 -19
  6. package/dist/client.js.map +1 -1
  7. package/dist/contextClient.d.ts +4 -3
  8. package/dist/contextClient.js +30 -18
  9. package/dist/contextClient.js.map +1 -1
  10. package/dist/contextFacade.js +25 -16
  11. package/dist/contextFacade.js.map +1 -1
  12. package/dist/contextTypes.d.ts +2 -0
  13. package/dist/contradictions/index.js +31 -19
  14. package/dist/contradictions/index.js.map +1 -1
  15. package/dist/decisions/index.js +31 -19
  16. package/dist/decisions/index.js.map +1 -1
  17. package/dist/edges/index.js +31 -19
  18. package/dist/edges/index.js.map +1 -1
  19. package/dist/evidence/index.js +31 -19
  20. package/dist/evidence/index.js.map +1 -1
  21. package/dist/facade/context.d.ts +2 -1
  22. package/dist/facade/context.js +25 -16
  23. package/dist/facade/context.js.map +1 -1
  24. package/dist/index.js +56 -35
  25. package/dist/index.js.map +1 -1
  26. package/dist/lenses/index.js +31 -19
  27. package/dist/lenses/index.js.map +1 -1
  28. package/dist/nodes/index.js +31 -19
  29. package/dist/nodes/index.js.map +1 -1
  30. package/dist/ontologies/index.js +31 -19
  31. package/dist/ontologies/index.js.map +1 -1
  32. package/dist/questions/index.js +31 -19
  33. package/dist/questions/index.js.map +1 -1
  34. package/dist/topics/index.js +31 -19
  35. package/dist/topics/index.js.map +1 -1
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/dist/version.js.map +1 -1
  39. package/dist/worktrees/index.js +31 -19
  40. package/dist/worktrees/index.js.map +1 -1
  41. package/package.json +4 -4
@@ -12,7 +12,8 @@ type ContextFacadeConfig = {
12
12
  transport: ContextFacadeTransport;
13
13
  };
14
14
  declare function createContextFacade(config: ContextFacadeConfig): {
15
- compile(topicId: string, input?: CompileContextInput): Promise<PublicCompiledContext>;
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 };
@@ -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(topicId, input = {}) {
12
- const payload = { topicId };
13
- const query = cleanString(input.query);
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(input.budget) ?? cleanNumber(input.tokenBudget);
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(input.ranking) ?? cleanString(input.rankingProfile);
26
+ const ranking = cleanString(effectiveInput.ranking) ?? cleanString(effectiveInput.rankingProfile);
22
27
  if (ranking) {
23
28
  payload.ranking = ranking;
24
29
  }
25
- const limit = cleanNumber(input.limit);
30
+ const limit = cleanNumber(effectiveInput.limit);
26
31
  if (limit !== void 0) {
27
32
  payload.limit = limit;
28
33
  }
29
- const maxDepth = cleanNumber(input.maxDepth);
34
+ const maxDepth = cleanNumber(effectiveInput.maxDepth);
30
35
  if (maxDepth !== void 0) {
31
36
  payload.maxDepth = maxDepth;
32
37
  }
33
- const includeEntities = cleanBoolean(input.includeEntities);
38
+ const includeEntities = cleanBoolean(effectiveInput.includeEntities);
34
39
  if (includeEntities !== void 0) {
35
40
  payload.includeEntities = includeEntities;
36
41
  }
37
- const mode = cleanString(input.mode);
42
+ const mode = cleanString(effectiveInput.mode);
38
43
  if (mode) {
39
44
  payload.mode = mode;
40
45
  }
41
- const includeFailures = cleanBoolean(input.includeFailures);
46
+ const includeFailures = cleanBoolean(effectiveInput.includeFailures);
42
47
  if (includeFailures !== void 0) {
43
48
  payload.includeFailures = includeFailures;
44
49
  }
45
- const worktreeId = cleanString(input.worktreeId);
50
+ const worktreeId = cleanString(effectiveInput.worktreeId);
46
51
  if (worktreeId) {
47
52
  payload.worktreeId = worktreeId;
48
53
  }
49
- const sessionId = cleanString(input.sessionId);
54
+ const sessionId = cleanString(effectiveInput.sessionId);
50
55
  if (sessionId) {
51
56
  payload.sessionId = sessionId;
52
57
  }
53
- if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
54
- payload.packWeightOverrides = input.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(topicId, input = {}) {
65
- const request = buildCompileContextRequest(topicId, input);
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,YA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,OAAO;AAAA,IACL,OAAA,CAAQ,OAAA,EAAiB,KAAA,GAA6B,EAAC,EAAG;AACxD,MAAA,MAAM,OAAA,GAAU,0BAAA,CAA2B,OAAA,EAAS,KAAK,CAAA;AACzD,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 topicId: string,\n input: CompileContextInput = {}\n): ContextClientRequest {\n const payload: Record<string, unknown> = { topicId };\n\n const query = cleanString(input.query);\n if (query) {\n payload.query = query;\n }\n\n const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);\n if (budget !== undefined) {\n payload.budget = budget;\n }\n\n const ranking = cleanString(input.ranking) ?? cleanString(input.rankingProfile);\n if (ranking) {\n payload.ranking = ranking;\n }\n\n const limit = cleanNumber(input.limit);\n if (limit !== undefined) {\n payload.limit = limit;\n }\n\n const maxDepth = cleanNumber(input.maxDepth);\n if (maxDepth !== undefined) {\n payload.maxDepth = maxDepth;\n }\n\n const includeEntities = cleanBoolean(input.includeEntities);\n if (includeEntities !== undefined) {\n payload.includeEntities = includeEntities;\n }\n\n const mode = cleanString(input.mode);\n if (mode) {\n payload.mode = mode;\n }\n\n const includeFailures = cleanBoolean(input.includeFailures);\n if (includeFailures !== undefined) {\n payload.includeFailures = includeFailures;\n }\n\n const worktreeId = cleanString(input.worktreeId);\n if (worktreeId) {\n payload.worktreeId = worktreeId;\n }\n\n const sessionId = cleanString(input.sessionId);\n if (sessionId) {\n payload.sessionId = sessionId;\n }\n\n if (\n Array.isArray(input.packWeightOverrides) &&\n input.packWeightOverrides.length > 0\n ) {\n payload.packWeightOverrides = input.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(topicId: string, input: CompileContextInput = {}) {\n const request = buildCompileContextRequest(topicId, input);\n return config.transport.request<PublicCompiledContext>(request);\n },\n };\n}\n\nexport type { CompileContextInput, PublicCompiledContext };\n"]}
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,2BACP,cAAA,GAA+C,EAAC,EAChD,KAAA,GAA6B,EAAC,EACR;AACtB,EAAA,MAAM,cAAA,GACJ,OAAO,cAAA,KAAmB,QAAA,GAAW,KAAA,GAAQ,cAAA;AAC/C,EAAA,MAAM,UAAmC,EAAC;AAE1C,EAAA,MAAM,OAAA,GACJ,OAAO,cAAA,KAAmB,QAAA,GACtB,YAAY,cA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AU,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.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(topicId, input = {}) {
4170
- const payload = { topicId };
4171
- const query5 = cleanString4(input.query);
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(input.budget) ?? cleanNumber(input.tokenBudget);
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(input.ranking) ?? cleanString4(input.rankingProfile);
4184
+ const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
4180
4185
  if (ranking) {
4181
4186
  payload.ranking = ranking;
4182
4187
  }
4183
- const limit = cleanNumber(input.limit);
4188
+ const limit = cleanNumber(effectiveInput.limit);
4184
4189
  if (limit !== void 0) {
4185
4190
  payload.limit = limit;
4186
4191
  }
4187
- const maxDepth = cleanNumber(input.maxDepth);
4192
+ const maxDepth = cleanNumber(effectiveInput.maxDepth);
4188
4193
  if (maxDepth !== void 0) {
4189
4194
  payload.maxDepth = maxDepth;
4190
4195
  }
4191
- const includeEntities = cleanBoolean(input.includeEntities);
4196
+ const includeEntities = cleanBoolean(effectiveInput.includeEntities);
4192
4197
  if (includeEntities !== void 0) {
4193
4198
  payload.includeEntities = includeEntities;
4194
4199
  }
4195
- const mode = cleanString4(input.mode);
4200
+ const mode = cleanString4(effectiveInput.mode);
4196
4201
  if (mode) {
4197
4202
  payload.mode = mode;
4198
4203
  }
4199
- const includeFailures = cleanBoolean(input.includeFailures);
4204
+ const includeFailures = cleanBoolean(effectiveInput.includeFailures);
4200
4205
  if (includeFailures !== void 0) {
4201
4206
  payload.includeFailures = includeFailures;
4202
4207
  }
4203
- const worktreeId = cleanString4(input.worktreeId);
4208
+ const worktreeId = cleanString4(effectiveInput.worktreeId);
4204
4209
  if (worktreeId) {
4205
4210
  payload.worktreeId = worktreeId;
4206
4211
  }
4207
- const sessionId = cleanString4(input.sessionId);
4212
+ const sessionId = cleanString4(effectiveInput.sessionId);
4208
4213
  if (sessionId) {
4209
4214
  payload.sessionId = sessionId;
4210
4215
  }
4211
- if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
4212
- payload.packWeightOverrides = input.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 for a topic scope.
4225
- * @param topicId - The topic to compile context for.
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(topicId, input = {}) {
4230
- const request = buildCompileContextRequest(topicId, input);
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
@@ -6993,7 +7005,7 @@ function createToolRegistryClient(config = {}) {
6993
7005
  }
6994
7006
 
6995
7007
  // src/version.ts
6996
- var LUCERN_SDK_VERSION = "0.3.0-alpha.7";
7008
+ var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
6997
7009
 
6998
7010
  // src/workflowClient.ts
6999
7011
  function normalizeLensQuery(value) {
@@ -9158,50 +9170,55 @@ function cleanNumber2(value) {
9158
9170
  function cleanBoolean2(value) {
9159
9171
  return typeof value === "boolean" ? value : void 0;
9160
9172
  }
9161
- function buildCompileContextRequest2(topicId, input = {}) {
9162
- const payload = { topicId };
9163
- const query5 = cleanString6(input.query);
9173
+ function buildCompileContextRequest2(topicIdOrInput = {}, input = {}) {
9174
+ const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
9175
+ const payload = {};
9176
+ const topicId = typeof topicIdOrInput === "string" ? cleanString6(topicIdOrInput) : cleanString6(effectiveInput.topicId);
9177
+ if (topicId) {
9178
+ payload.topicId = topicId;
9179
+ }
9180
+ const query5 = cleanString6(effectiveInput.query);
9164
9181
  if (query5) {
9165
9182
  payload.query = query5;
9166
9183
  }
9167
- const budget = cleanNumber2(input.budget) ?? cleanNumber2(input.tokenBudget);
9184
+ const budget = cleanNumber2(effectiveInput.budget) ?? cleanNumber2(effectiveInput.tokenBudget);
9168
9185
  if (budget !== void 0) {
9169
9186
  payload.budget = budget;
9170
9187
  }
9171
- const ranking = cleanString6(input.ranking) ?? cleanString6(input.rankingProfile);
9188
+ const ranking = cleanString6(effectiveInput.ranking) ?? cleanString6(effectiveInput.rankingProfile);
9172
9189
  if (ranking) {
9173
9190
  payload.ranking = ranking;
9174
9191
  }
9175
- const limit = cleanNumber2(input.limit);
9192
+ const limit = cleanNumber2(effectiveInput.limit);
9176
9193
  if (limit !== void 0) {
9177
9194
  payload.limit = limit;
9178
9195
  }
9179
- const maxDepth = cleanNumber2(input.maxDepth);
9196
+ const maxDepth = cleanNumber2(effectiveInput.maxDepth);
9180
9197
  if (maxDepth !== void 0) {
9181
9198
  payload.maxDepth = maxDepth;
9182
9199
  }
9183
- const includeEntities = cleanBoolean2(input.includeEntities);
9200
+ const includeEntities = cleanBoolean2(effectiveInput.includeEntities);
9184
9201
  if (includeEntities !== void 0) {
9185
9202
  payload.includeEntities = includeEntities;
9186
9203
  }
9187
- const mode = cleanString6(input.mode);
9204
+ const mode = cleanString6(effectiveInput.mode);
9188
9205
  if (mode) {
9189
9206
  payload.mode = mode;
9190
9207
  }
9191
- const includeFailures = cleanBoolean2(input.includeFailures);
9208
+ const includeFailures = cleanBoolean2(effectiveInput.includeFailures);
9192
9209
  if (includeFailures !== void 0) {
9193
9210
  payload.includeFailures = includeFailures;
9194
9211
  }
9195
- const worktreeId = cleanString6(input.worktreeId);
9212
+ const worktreeId = cleanString6(effectiveInput.worktreeId);
9196
9213
  if (worktreeId) {
9197
9214
  payload.worktreeId = worktreeId;
9198
9215
  }
9199
- const sessionId = cleanString6(input.sessionId);
9216
+ const sessionId = cleanString6(effectiveInput.sessionId);
9200
9217
  if (sessionId) {
9201
9218
  payload.sessionId = sessionId;
9202
9219
  }
9203
- if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
9204
- payload.packWeightOverrides = input.packWeightOverrides;
9220
+ if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
9221
+ payload.packWeightOverrides = effectiveInput.packWeightOverrides;
9205
9222
  }
9206
9223
  return {
9207
9224
  path: "/api/platform/v1/context/compile",
@@ -9211,8 +9228,12 @@ function buildCompileContextRequest2(topicId, input = {}) {
9211
9228
  }
9212
9229
  function createContextFacade(config) {
9213
9230
  return {
9214
- compile(topicId, input = {}) {
9215
- const request = buildCompileContextRequest2(topicId, input);
9231
+ compile(topicIdOrInput = {}, input = {}) {
9232
+ const request = buildCompileContextRequest2(topicIdOrInput, input);
9233
+ return config.transport.request(request);
9234
+ },
9235
+ compileByQuery(input = {}) {
9236
+ const request = buildCompileContextRequest2(input);
9216
9237
  return config.transport.request(request);
9217
9238
  }
9218
9239
  };