@lucern/mcp 0.3.0-alpha.6 → 0.3.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.
- package/dist/cli.js +877 -883
- package/dist/cli.js.map +1 -1
- package/dist/gateway.js +751 -317
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +808 -890
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.js +914 -888
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +505 -161
- package/dist/runtime.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -90,6 +90,9 @@ function hasValue(value) {
|
|
|
90
90
|
}
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
|
+
function isRecord(value) {
|
|
94
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
95
|
+
}
|
|
93
96
|
function normalizeToolExecutionParams(params) {
|
|
94
97
|
const normalized = { ...params };
|
|
95
98
|
for (const aliases of SCOPE_ALIAS_GROUPS) {
|
|
@@ -112,16 +115,19 @@ function parseToolExecutionMetadata(result) {
|
|
|
112
115
|
}
|
|
113
116
|
try {
|
|
114
117
|
const payload = JSON.parse(raw);
|
|
118
|
+
if (!isRecord(payload)) {
|
|
119
|
+
return { isError: Boolean(result.isError) };
|
|
120
|
+
}
|
|
115
121
|
return {
|
|
116
122
|
isError: Boolean(result.isError),
|
|
117
123
|
code: typeof payload.code === "string" ? payload.code : void 0,
|
|
118
124
|
status: typeof payload.status === "number" ? payload.status : void 0,
|
|
119
|
-
correlationId:
|
|
120
|
-
policyTraceId:
|
|
121
|
-
invariant:
|
|
125
|
+
correlationId: optionalStringOrNull(payload.correlationId),
|
|
126
|
+
policyTraceId: optionalStringOrNull(payload.policyTraceId),
|
|
127
|
+
invariant: optionalStringOrNull(payload.invariant)
|
|
122
128
|
};
|
|
123
|
-
} catch {
|
|
124
|
-
return
|
|
129
|
+
} catch (error) {
|
|
130
|
+
return ignoreMalformedToolMetadata(error, result);
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
async function executeToolWithEnvelope(args) {
|
|
@@ -139,6 +145,15 @@ async function executeToolWithEnvelope(args) {
|
|
|
139
145
|
});
|
|
140
146
|
return result;
|
|
141
147
|
}
|
|
148
|
+
function ignoreMalformedToolMetadata(_error, result) {
|
|
149
|
+
return { isError: Boolean(result.isError) };
|
|
150
|
+
}
|
|
151
|
+
function optionalStringOrNull(value) {
|
|
152
|
+
if (typeof value === "string" || value === null) {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
142
157
|
|
|
143
158
|
// src/agentInstructions.ts
|
|
144
159
|
var LUCERN_OBSERVER_PROMPT_NAME = "lucern-observer";
|
|
@@ -187,9 +202,29 @@ function buildLucernObserverPrompt(topicId) {
|
|
|
187
202
|
].join("\n");
|
|
188
203
|
}
|
|
189
204
|
|
|
205
|
+
// ../cli/src/guards.ts
|
|
206
|
+
function isRecord2(value) {
|
|
207
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
208
|
+
}
|
|
209
|
+
function formatUnknownError(error) {
|
|
210
|
+
if (error instanceof Error) {
|
|
211
|
+
return error.message;
|
|
212
|
+
}
|
|
213
|
+
if (typeof error === "string") {
|
|
214
|
+
return error;
|
|
215
|
+
}
|
|
216
|
+
return String(error);
|
|
217
|
+
}
|
|
218
|
+
|
|
190
219
|
// ../cli/src/types.ts
|
|
191
220
|
var EXIT = {
|
|
221
|
+
ok: 0,
|
|
222
|
+
usage: 2,
|
|
223
|
+
auth: 10,
|
|
192
224
|
config: 11,
|
|
225
|
+
api: 20,
|
|
226
|
+
invariant: 30,
|
|
227
|
+
local: 40,
|
|
193
228
|
unexpected: 70
|
|
194
229
|
};
|
|
195
230
|
var CliError = class extends Error {
|
|
@@ -217,6 +252,34 @@ var CliError = class extends Error {
|
|
|
217
252
|
}
|
|
218
253
|
};
|
|
219
254
|
|
|
255
|
+
// ../cli/src/parse.ts
|
|
256
|
+
function parseJsonValue(value, label) {
|
|
257
|
+
try {
|
|
258
|
+
return JSON.parse(value);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
if (error instanceof SyntaxError) {
|
|
261
|
+
throw new CliError({
|
|
262
|
+
code: "USAGE_INVALID_JSON",
|
|
263
|
+
exitCode: EXIT.usage,
|
|
264
|
+
message: `${label} must be valid JSON.`,
|
|
265
|
+
details: formatUnknownError(error)
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function parseJsonRecord(value, label) {
|
|
272
|
+
const parsed = parseJsonValue(value, label);
|
|
273
|
+
if (!isRecord2(parsed)) {
|
|
274
|
+
throw new CliError({
|
|
275
|
+
code: "USAGE_INVALID_JSON",
|
|
276
|
+
exitCode: EXIT.usage,
|
|
277
|
+
message: `${label} must be a JSON object.`
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return parsed;
|
|
281
|
+
}
|
|
282
|
+
|
|
220
283
|
// ../cli/src/config.ts
|
|
221
284
|
var CONFIG_DIR = ".lucern";
|
|
222
285
|
var CREDENTIALS_FILE = "credentials";
|
|
@@ -329,13 +392,21 @@ function readProfilesFile(path3) {
|
|
|
329
392
|
return {};
|
|
330
393
|
}
|
|
331
394
|
try {
|
|
332
|
-
|
|
395
|
+
const parsed = parseJsonRecord(readFileSync(path3, "utf8"), path3);
|
|
396
|
+
if (!isProfilesFile(parsed)) {
|
|
397
|
+
throw new CliError({
|
|
398
|
+
code: "CONFIG_INVALID_PROFILE_FILE",
|
|
399
|
+
exitCode: EXIT.config,
|
|
400
|
+
message: `${path3} must be a JSON object with profile definitions.`
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return parsed;
|
|
333
404
|
} catch (error) {
|
|
334
405
|
throw new CliError({
|
|
335
406
|
code: "CONFIG_INVALID_PROFILE_FILE",
|
|
336
407
|
exitCode: EXIT.config,
|
|
337
408
|
message: `${path3} is not valid JSON.`,
|
|
338
|
-
details: error
|
|
409
|
+
details: formatUnknownError(error)
|
|
339
410
|
});
|
|
340
411
|
}
|
|
341
412
|
}
|
|
@@ -394,12 +465,32 @@ function stripQuotes(value) {
|
|
|
394
465
|
if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
395
466
|
try {
|
|
396
467
|
return JSON.parse(trimmed);
|
|
397
|
-
} catch {
|
|
398
|
-
return
|
|
468
|
+
} catch (error) {
|
|
469
|
+
return ignoreQuotedValueParseError(error, trimmed);
|
|
399
470
|
}
|
|
400
471
|
}
|
|
401
472
|
return trimmed;
|
|
402
473
|
}
|
|
474
|
+
function ignoreQuotedValueParseError(_error, trimmed) {
|
|
475
|
+
return trimmed.slice(1, -1);
|
|
476
|
+
}
|
|
477
|
+
function isProfilesFile(value) {
|
|
478
|
+
if (!isRecord2(value)) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
if (value.activeProfile !== void 0 && typeof value.activeProfile !== "string") {
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
if (value.profiles === void 0) {
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
if (!isRecord2(value.profiles)) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
return Object.values(value.profiles).every(
|
|
491
|
+
(profile) => profile === void 0 || isRecord2(profile)
|
|
492
|
+
);
|
|
493
|
+
}
|
|
403
494
|
|
|
404
495
|
// ../contracts/src/graph-intelligence.contract.ts
|
|
405
496
|
var GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION = "graph_intelligence_query_catalog.v1";
|
|
@@ -5332,6 +5423,11 @@ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
|
5332
5423
|
role: "sdk_dependency",
|
|
5333
5424
|
directTenantImport: false
|
|
5334
5425
|
},
|
|
5426
|
+
{
|
|
5427
|
+
packageName: "@lucern/graph-sync",
|
|
5428
|
+
role: "host_addon_runtime",
|
|
5429
|
+
directTenantImport: true
|
|
5430
|
+
},
|
|
5335
5431
|
{
|
|
5336
5432
|
packageName: "@lucern/identity",
|
|
5337
5433
|
role: "component_runtime",
|
|
@@ -5620,8 +5716,11 @@ function compactRecord(input) {
|
|
|
5620
5716
|
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
5621
5717
|
);
|
|
5622
5718
|
}
|
|
5719
|
+
function isRecord3(value) {
|
|
5720
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5721
|
+
}
|
|
5623
5722
|
function recordValue(value) {
|
|
5624
|
-
return
|
|
5723
|
+
return isRecord3(value) ? value : {};
|
|
5625
5724
|
}
|
|
5626
5725
|
var createEvidenceProjection = defineProjection({
|
|
5627
5726
|
contractName: "create_evidence",
|
|
@@ -6327,9 +6426,16 @@ var ADD_WORKTREE = {
|
|
|
6327
6426
|
},
|
|
6328
6427
|
projectId: {
|
|
6329
6428
|
type: "string",
|
|
6330
|
-
description: "Legacy topicId alias"
|
|
6429
|
+
description: "Legacy topicId alias or resolver hint"
|
|
6430
|
+
},
|
|
6431
|
+
topicId: {
|
|
6432
|
+
type: "string",
|
|
6433
|
+
description: "Optional topic scope hint for resolver validation"
|
|
6434
|
+
},
|
|
6435
|
+
topicHint: {
|
|
6436
|
+
type: "string",
|
|
6437
|
+
description: "Natural-language topic hint for automatic topic resolution"
|
|
6331
6438
|
},
|
|
6332
|
-
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
6333
6439
|
branchId: {
|
|
6334
6440
|
type: "string",
|
|
6335
6441
|
description: "The branch this worktree investigates"
|
|
@@ -6427,6 +6533,22 @@ var ADD_WORKTREE = {
|
|
|
6427
6533
|
type: "string",
|
|
6428
6534
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
6429
6535
|
},
|
|
6536
|
+
tags: {
|
|
6537
|
+
type: "array",
|
|
6538
|
+
description: "Additional topic-resolution tags for the worktree"
|
|
6539
|
+
},
|
|
6540
|
+
touchedPaths: {
|
|
6541
|
+
type: "array",
|
|
6542
|
+
description: "File paths used as topic-resolution signals"
|
|
6543
|
+
},
|
|
6544
|
+
sourceRef: {
|
|
6545
|
+
type: "string",
|
|
6546
|
+
description: "Source reference used as a topic-resolution signal"
|
|
6547
|
+
},
|
|
6548
|
+
sourceKind: {
|
|
6549
|
+
type: "string",
|
|
6550
|
+
description: "Source kind used as a topic-resolution signal"
|
|
6551
|
+
},
|
|
6430
6552
|
campaign: {
|
|
6431
6553
|
type: "number",
|
|
6432
6554
|
description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
|
|
@@ -6464,7 +6586,7 @@ var ADD_WORKTREE = {
|
|
|
6464
6586
|
description: "Timestamp when worktree metadata was last reconciled"
|
|
6465
6587
|
}
|
|
6466
6588
|
},
|
|
6467
|
-
required: ["title"
|
|
6589
|
+
required: ["title"],
|
|
6468
6590
|
response: {
|
|
6469
6591
|
description: "The created worktree",
|
|
6470
6592
|
fields: {
|
|
@@ -8167,18 +8289,60 @@ var CREATE_TASK = {
|
|
|
8167
8289
|
name: "create_task",
|
|
8168
8290
|
description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
|
|
8169
8291
|
parameters: {
|
|
8170
|
-
title: { type: "string", description: "Task
|
|
8292
|
+
title: { type: "string", description: "Task title" },
|
|
8171
8293
|
topicId: { type: "string", description: "Topic scope" },
|
|
8294
|
+
description: {
|
|
8295
|
+
type: "string",
|
|
8296
|
+
description: "Long-form task description"
|
|
8297
|
+
},
|
|
8172
8298
|
taskType: {
|
|
8173
8299
|
type: "string",
|
|
8174
|
-
description: "
|
|
8175
|
-
enum: [
|
|
8300
|
+
description: "Task taxonomy",
|
|
8301
|
+
enum: [
|
|
8302
|
+
"general",
|
|
8303
|
+
"find_evidence",
|
|
8304
|
+
"verify_claim",
|
|
8305
|
+
"research",
|
|
8306
|
+
"review",
|
|
8307
|
+
"interview",
|
|
8308
|
+
"analysis",
|
|
8309
|
+
"track_metrics"
|
|
8310
|
+
]
|
|
8311
|
+
},
|
|
8312
|
+
priority: {
|
|
8313
|
+
type: "string",
|
|
8314
|
+
description: "Priority",
|
|
8315
|
+
enum: ["urgent", "high", "medium", "low"]
|
|
8316
|
+
},
|
|
8317
|
+
status: {
|
|
8318
|
+
type: "string",
|
|
8319
|
+
description: "Initial status (defaults to todo)",
|
|
8320
|
+
enum: ["todo", "in_progress", "blocked", "done"]
|
|
8321
|
+
},
|
|
8322
|
+
linkedWorktreeId: {
|
|
8323
|
+
type: "string",
|
|
8324
|
+
description: "Worktree this task belongs to"
|
|
8325
|
+
},
|
|
8326
|
+
linkedBeliefId: {
|
|
8327
|
+
type: "string",
|
|
8328
|
+
description: "Belief this task supports"
|
|
8176
8329
|
},
|
|
8177
8330
|
linkedQuestionId: {
|
|
8178
8331
|
type: "string",
|
|
8179
8332
|
description: "Question this task addresses"
|
|
8180
8333
|
},
|
|
8181
|
-
|
|
8334
|
+
assigneeId: {
|
|
8335
|
+
type: "string",
|
|
8336
|
+
description: "Principal assigned to the task"
|
|
8337
|
+
},
|
|
8338
|
+
dueDate: {
|
|
8339
|
+
type: "number",
|
|
8340
|
+
description: "Due date as epoch milliseconds"
|
|
8341
|
+
},
|
|
8342
|
+
tags: {
|
|
8343
|
+
type: "array",
|
|
8344
|
+
description: "Free-form string tags"
|
|
8345
|
+
}
|
|
8182
8346
|
},
|
|
8183
8347
|
required: ["title"],
|
|
8184
8348
|
response: {
|
|
@@ -10273,9 +10437,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
|
|
|
10273
10437
|
required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
|
|
10274
10438
|
};
|
|
10275
10439
|
}
|
|
10276
|
-
|
|
10277
|
-
return contract;
|
|
10278
|
-
}
|
|
10440
|
+
var defineFunctionContract = (contract) => contract;
|
|
10279
10441
|
function authUserId(context) {
|
|
10280
10442
|
return context.userId ?? context.principalId ?? "lucern-agent";
|
|
10281
10443
|
}
|
|
@@ -10429,6 +10591,9 @@ var observationContextArgs = z.object({
|
|
|
10429
10591
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
10430
10592
|
status: z.string().optional().describe("Observation status filter.")
|
|
10431
10593
|
});
|
|
10594
|
+
function isRecord4(value) {
|
|
10595
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
10596
|
+
}
|
|
10432
10597
|
var observationInput = (input, context) => withUserId(
|
|
10433
10598
|
compactRecord4({
|
|
10434
10599
|
projectId: input.projectId,
|
|
@@ -10483,8 +10648,8 @@ var contextContracts = [
|
|
|
10483
10648
|
kind: "mutation",
|
|
10484
10649
|
inputProjection: observationInput,
|
|
10485
10650
|
outputProjection: (output, input) => ({
|
|
10486
|
-
...output
|
|
10487
|
-
observationId: output
|
|
10651
|
+
...isRecord4(output) ? output : {},
|
|
10652
|
+
observationId: isRecord4(output) ? output.nodeId : void 0,
|
|
10488
10653
|
observationType: input.observationType
|
|
10489
10654
|
})
|
|
10490
10655
|
},
|
|
@@ -11965,10 +12130,11 @@ var worktreeDecisionGateInputSchema = z.object({
|
|
|
11965
12130
|
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
11966
12131
|
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
11967
12132
|
var addWorktreeArgs = z.object({
|
|
11968
|
-
title: z.string().
|
|
12133
|
+
title: z.string().describe("Human-readable worktree name or objective."),
|
|
11969
12134
|
name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
|
|
11970
|
-
topicId: z.string().describe("
|
|
11971
|
-
projectId: z.string().optional().describe("Legacy topicId alias."),
|
|
12135
|
+
topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
|
|
12136
|
+
projectId: z.string().optional().describe("Legacy topicId alias/hint."),
|
|
12137
|
+
topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
|
|
11972
12138
|
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
11973
12139
|
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
11974
12140
|
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
@@ -11993,6 +12159,10 @@ var addWorktreeArgs = z.object({
|
|
|
11993
12159
|
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
11994
12160
|
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
11995
12161
|
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
12162
|
+
tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
|
|
12163
|
+
touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
|
|
12164
|
+
sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
|
|
12165
|
+
sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
|
|
11996
12166
|
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
11997
12167
|
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
11998
12168
|
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
@@ -12322,8 +12492,46 @@ var worktreesContracts = [
|
|
|
12322
12492
|
args: openPullRequestArgs
|
|
12323
12493
|
})
|
|
12324
12494
|
];
|
|
12325
|
-
|
|
12326
|
-
|
|
12495
|
+
var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
12496
|
+
var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
|
|
12497
|
+
var taskTypeSchema = z.enum([
|
|
12498
|
+
"general",
|
|
12499
|
+
"find_evidence",
|
|
12500
|
+
"verify_claim",
|
|
12501
|
+
"research",
|
|
12502
|
+
"review",
|
|
12503
|
+
"interview",
|
|
12504
|
+
"analysis",
|
|
12505
|
+
"track_metrics"
|
|
12506
|
+
]);
|
|
12507
|
+
var createTaskArgs = z.object({
|
|
12508
|
+
title: z.string().describe("Task title."),
|
|
12509
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12510
|
+
description: z.string().optional().describe("Long-form task description."),
|
|
12511
|
+
taskType: taskTypeSchema.optional().describe("Task taxonomy."),
|
|
12512
|
+
priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
|
|
12513
|
+
status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
|
|
12514
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
|
|
12515
|
+
linkedBeliefId: z.string().optional().describe("Belief this task supports."),
|
|
12516
|
+
linkedQuestionId: z.string().optional().describe("Question this task addresses."),
|
|
12517
|
+
assigneeId: z.string().optional().describe("Principal assigned to the task."),
|
|
12518
|
+
dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
|
|
12519
|
+
tags: z.array(z.string()).optional().describe("Free-form tags.")
|
|
12520
|
+
});
|
|
12521
|
+
var createTaskInput = (input) => compactRecord4({
|
|
12522
|
+
title: input.title,
|
|
12523
|
+
topicId: input.topicId,
|
|
12524
|
+
description: input.description,
|
|
12525
|
+
taskType: input.taskType,
|
|
12526
|
+
priority: input.priority ?? "medium",
|
|
12527
|
+
status: input.status ?? "todo",
|
|
12528
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
12529
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
12530
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
12531
|
+
assigneeId: input.assigneeId,
|
|
12532
|
+
dueDate: input.dueDate,
|
|
12533
|
+
tags: input.tags
|
|
12534
|
+
});
|
|
12327
12535
|
var taskInput = (input) => compactRecord4({
|
|
12328
12536
|
...input,
|
|
12329
12537
|
taskId: input.taskId ?? input.id
|
|
@@ -12355,8 +12563,10 @@ var tasksContracts = [
|
|
|
12355
12563
|
convex: {
|
|
12356
12564
|
module: "tasks",
|
|
12357
12565
|
functionName: "create",
|
|
12358
|
-
kind: "mutation"
|
|
12359
|
-
|
|
12566
|
+
kind: "mutation",
|
|
12567
|
+
inputProjection: createTaskInput
|
|
12568
|
+
},
|
|
12569
|
+
args: createTaskArgs
|
|
12360
12570
|
}),
|
|
12361
12571
|
surfaceContract({
|
|
12362
12572
|
name: "list_tasks",
|
|
@@ -13475,9 +13685,12 @@ var ALL_FUNCTION_CONTRACTS = [
|
|
|
13475
13685
|
];
|
|
13476
13686
|
assertSurfaceCoverage(ALL_FUNCTION_CONTRACTS);
|
|
13477
13687
|
var FUNCTION_SURFACE_CONTRACTS = ALL_FUNCTION_CONTRACTS;
|
|
13478
|
-
new Map(
|
|
13688
|
+
var FUNCTION_CONTRACTS_BY_NAME = new Map(
|
|
13479
13689
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
13480
13690
|
);
|
|
13691
|
+
FUNCTION_CONTRACTS_BY_NAME.get.bind(
|
|
13692
|
+
FUNCTION_CONTRACTS_BY_NAME
|
|
13693
|
+
);
|
|
13481
13694
|
|
|
13482
13695
|
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
13483
13696
|
function isCopyableSeedRequirement(entry) {
|
|
@@ -14123,10 +14336,18 @@ function isInfisicalRuntimeDisabled(env = {}) {
|
|
|
14123
14336
|
}
|
|
14124
14337
|
async function hydrateInfisicalRuntimeEnv(options) {
|
|
14125
14338
|
const env = options.env ?? {};
|
|
14126
|
-
const
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14339
|
+
const baseBootstrap = readInfisicalRuntimeBootstrap(env, options.bootstrap);
|
|
14340
|
+
const bootstrap = baseBootstrap ? {
|
|
14341
|
+
...baseBootstrap,
|
|
14342
|
+
...Object.fromEntries(
|
|
14343
|
+
Object.entries(options.bootstrap ?? {}).filter(
|
|
14344
|
+
([, value]) => value !== void 0
|
|
14345
|
+
)
|
|
14346
|
+
),
|
|
14347
|
+
apiUrl: trimTrailingSlash(
|
|
14348
|
+
options.bootstrap?.apiUrl ?? baseBootstrap.apiUrl
|
|
14349
|
+
)
|
|
14350
|
+
} : null;
|
|
14130
14351
|
if (!bootstrap) {
|
|
14131
14352
|
return {
|
|
14132
14353
|
status: "disabled",
|
|
@@ -14222,16 +14443,6 @@ function normalizeInfisicalEnvironment(value) {
|
|
|
14222
14443
|
}
|
|
14223
14444
|
return "prod";
|
|
14224
14445
|
}
|
|
14225
|
-
function mergeBootstrap(base, overrides) {
|
|
14226
|
-
if (!base) {
|
|
14227
|
-
return null;
|
|
14228
|
-
}
|
|
14229
|
-
return {
|
|
14230
|
-
...base,
|
|
14231
|
-
...compact(overrides ?? {}),
|
|
14232
|
-
apiUrl: trimTrailingSlash(overrides?.apiUrl ?? base.apiUrl)
|
|
14233
|
-
};
|
|
14234
|
-
}
|
|
14235
14446
|
async function loginWithUniversalAuth(bootstrap, fetchImpl) {
|
|
14236
14447
|
const response = await fetchImpl(
|
|
14237
14448
|
`${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
|
|
@@ -14316,14 +14527,18 @@ async function readSecretValue(args) {
|
|
|
14316
14527
|
async function readJson(response) {
|
|
14317
14528
|
try {
|
|
14318
14529
|
return await response.json();
|
|
14319
|
-
} catch {
|
|
14530
|
+
} catch (error) {
|
|
14531
|
+
debugInfisicalRuntimeFallback("response.json", error);
|
|
14320
14532
|
return void 0;
|
|
14321
14533
|
}
|
|
14322
14534
|
}
|
|
14535
|
+
function isRecord5(value) {
|
|
14536
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14537
|
+
}
|
|
14323
14538
|
function readNestedString(value, path3) {
|
|
14324
14539
|
let current = value;
|
|
14325
14540
|
for (const key of path3) {
|
|
14326
|
-
if (!current ||
|
|
14541
|
+
if (!isRecord5(current) || !(key in current)) {
|
|
14327
14542
|
return null;
|
|
14328
14543
|
}
|
|
14329
14544
|
current = current[key];
|
|
@@ -14331,13 +14546,12 @@ function readNestedString(value, path3) {
|
|
|
14331
14546
|
return typeof current === "string" && current.length > 0 ? current : null;
|
|
14332
14547
|
}
|
|
14333
14548
|
function messageFromBody(body4) {
|
|
14334
|
-
if (!body4
|
|
14549
|
+
if (!isRecord5(body4)) {
|
|
14335
14550
|
return "no response body";
|
|
14336
14551
|
}
|
|
14337
|
-
const record = body4;
|
|
14338
14552
|
for (const key of ["message", "error", "errorMessage"]) {
|
|
14339
|
-
if (typeof
|
|
14340
|
-
return
|
|
14553
|
+
if (typeof body4[key] === "string") {
|
|
14554
|
+
return body4[key];
|
|
14341
14555
|
}
|
|
14342
14556
|
}
|
|
14343
14557
|
return JSON.stringify(body4);
|
|
@@ -14357,10 +14571,32 @@ function isTruthyEnv(value) {
|
|
|
14357
14571
|
function trimTrailingSlash(value) {
|
|
14358
14572
|
return value.replace(/\/+$/u, "");
|
|
14359
14573
|
}
|
|
14360
|
-
function
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14574
|
+
function debugInfisicalRuntimeFallback(message, error) {
|
|
14575
|
+
const env = globalThis.process?.env;
|
|
14576
|
+
if (env?.LUCERN_COMPAT_FALLBACK_DEBUG !== "1" && env?.LUCERN_INFISICAL_RUNTIME_DEBUG !== "1") {
|
|
14577
|
+
return;
|
|
14578
|
+
}
|
|
14579
|
+
console.debug(`[infisical-runtime] ${message}`, {
|
|
14580
|
+
error: formatInfisicalRuntimeError(error)
|
|
14581
|
+
});
|
|
14582
|
+
}
|
|
14583
|
+
function formatInfisicalRuntimeError(error) {
|
|
14584
|
+
if (error instanceof Error) {
|
|
14585
|
+
return `${error.name}: ${error.message}`;
|
|
14586
|
+
}
|
|
14587
|
+
if (typeof error === "string") {
|
|
14588
|
+
return error;
|
|
14589
|
+
}
|
|
14590
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
14591
|
+
return String(error);
|
|
14592
|
+
}
|
|
14593
|
+
if (error && typeof error === "object") {
|
|
14594
|
+
const keys = Object.keys(error).slice(0, 5);
|
|
14595
|
+
if (keys.length > 0) {
|
|
14596
|
+
return `Unknown Infisical runtime error object with keys: ${keys.join(", ")}`;
|
|
14597
|
+
}
|
|
14598
|
+
}
|
|
14599
|
+
return "Unknown Infisical runtime error shape";
|
|
14364
14600
|
}
|
|
14365
14601
|
|
|
14366
14602
|
// src/infisical-runtime.ts
|
|
@@ -14670,6 +14906,7 @@ __export(src_exports, {
|
|
|
14670
14906
|
WORKTREE_PHASES: () => WORKTREE_PHASES,
|
|
14671
14907
|
applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
|
|
14672
14908
|
asListItems: () => asListItems,
|
|
14909
|
+
asRecord: () => asRecord,
|
|
14673
14910
|
assertValidWebhookSecret: () => assertValidWebhookSecret,
|
|
14674
14911
|
assertValidWebhookUrl: () => assertValidWebhookUrl,
|
|
14675
14912
|
buildDeprecatedBranchMetadata: () => buildDeprecatedBranchMetadata,
|
|
@@ -14741,6 +14978,7 @@ __export(src_exports, {
|
|
|
14741
14978
|
isLensFilterCriteria: () => isLensFilterCriteria2,
|
|
14742
14979
|
isLucernPrompt: () => isLucernPrompt,
|
|
14743
14980
|
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
14981
|
+
isRecord: () => isRecord7,
|
|
14744
14982
|
isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV12,
|
|
14745
14983
|
lastDelegator: () => lastDelegator,
|
|
14746
14984
|
listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
|
|
@@ -15050,9 +15288,7 @@ function generatePortableRequestId() {
|
|
|
15050
15288
|
8
|
|
15051
15289
|
).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
15052
15290
|
}
|
|
15053
|
-
|
|
15054
|
-
return generatePortableRequestId();
|
|
15055
|
-
}
|
|
15291
|
+
var randomIdempotencyKey = generatePortableRequestId;
|
|
15056
15292
|
function isRetryableStatus(status) {
|
|
15057
15293
|
return status >= 500 || status === 408 || status === 429;
|
|
15058
15294
|
}
|
|
@@ -15117,8 +15353,11 @@ function timeoutError(timeoutMs) {
|
|
|
15117
15353
|
error.name = "AbortError";
|
|
15118
15354
|
return error;
|
|
15119
15355
|
}
|
|
15356
|
+
function isRecord6(value) {
|
|
15357
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15358
|
+
}
|
|
15120
15359
|
function readPolicySummaryFromDetails(details) {
|
|
15121
|
-
if (!
|
|
15360
|
+
if (!isRecord6(details)) {
|
|
15122
15361
|
return null;
|
|
15123
15362
|
}
|
|
15124
15363
|
const directSummary = details.summary;
|
|
@@ -15126,11 +15365,11 @@ function readPolicySummaryFromDetails(details) {
|
|
|
15126
15365
|
return directSummary.trim();
|
|
15127
15366
|
}
|
|
15128
15367
|
const policy = details.policy;
|
|
15129
|
-
if (!
|
|
15368
|
+
if (!isRecord6(policy)) {
|
|
15130
15369
|
return null;
|
|
15131
15370
|
}
|
|
15132
15371
|
const explanation = policy.explanation;
|
|
15133
|
-
if (!
|
|
15372
|
+
if (!isRecord6(explanation)) {
|
|
15134
15373
|
return null;
|
|
15135
15374
|
}
|
|
15136
15375
|
const nestedSummary = explanation.summary;
|
|
@@ -15194,11 +15433,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15194
15433
|
if (!text) {
|
|
15195
15434
|
return null;
|
|
15196
15435
|
}
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
} catch {
|
|
15436
|
+
const parsed = tryParseGatewayEnvelopeJson(text);
|
|
15437
|
+
if (!parsed.ok) {
|
|
15200
15438
|
return null;
|
|
15201
15439
|
}
|
|
15440
|
+
return isRecord6(parsed.value) ? parsed.value : null;
|
|
15202
15441
|
}
|
|
15203
15442
|
function resolveTimeoutMs(method, requestTimeoutMs) {
|
|
15204
15443
|
if (typeof requestTimeoutMs === "number") {
|
|
@@ -15210,16 +15449,31 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15210
15449
|
}
|
|
15211
15450
|
return config.timeoutMs ?? 15e3;
|
|
15212
15451
|
}
|
|
15452
|
+
function tryParseGatewayEnvelopeJson(text) {
|
|
15453
|
+
const trimmed = text.trim();
|
|
15454
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
15455
|
+
return { ok: false, reason: "non-json" };
|
|
15456
|
+
}
|
|
15457
|
+
try {
|
|
15458
|
+
return { ok: true, value: JSON.parse(trimmed) };
|
|
15459
|
+
} catch (error) {
|
|
15460
|
+
if (error instanceof SyntaxError) {
|
|
15461
|
+
return { ok: false, reason: "invalid-json", error };
|
|
15462
|
+
}
|
|
15463
|
+
throw error;
|
|
15464
|
+
}
|
|
15465
|
+
}
|
|
15213
15466
|
function buildApiError(args) {
|
|
15214
15467
|
const failure = args.failure;
|
|
15215
|
-
const legacyError = failure &&
|
|
15468
|
+
const legacyError = failure && isRecord6(failure.error) ? failure.error : failure?.legacyError;
|
|
15216
15469
|
const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
|
|
15217
15470
|
const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
|
|
15218
15471
|
const details = failure?.details ?? legacyError?.details;
|
|
15219
15472
|
const policySummary = readPolicySummaryFromDetails(details);
|
|
15473
|
+
const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
|
|
15220
15474
|
return new LucernApiError({
|
|
15221
15475
|
code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
|
|
15222
|
-
message: policySummary ??
|
|
15476
|
+
message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
|
|
15223
15477
|
status: args.response.status,
|
|
15224
15478
|
invariant: failure?.invariant,
|
|
15225
15479
|
suggestion: failure?.suggestion,
|
|
@@ -15345,8 +15599,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15345
15599
|
}
|
|
15346
15600
|
|
|
15347
15601
|
// ../sdk/src/sdkSurface.ts
|
|
15602
|
+
function isRecord7(value) {
|
|
15603
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15604
|
+
}
|
|
15348
15605
|
function asRecord(value) {
|
|
15349
|
-
return value
|
|
15606
|
+
return isRecord7(value) ? value : {};
|
|
15350
15607
|
}
|
|
15351
15608
|
function cleanString2(value) {
|
|
15352
15609
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
@@ -15407,9 +15664,7 @@ function normalizeNodeWriteInput(value) {
|
|
|
15407
15664
|
}
|
|
15408
15665
|
return next;
|
|
15409
15666
|
}
|
|
15410
|
-
|
|
15411
|
-
return normalizeVerificationStatus(value);
|
|
15412
|
-
}
|
|
15667
|
+
var normalizeNodeVerificationStatus = normalizeVerificationStatus;
|
|
15413
15668
|
function normalizeTopicQuery(value) {
|
|
15414
15669
|
const topicId = cleanString2(value.topicId);
|
|
15415
15670
|
if (!topicId) {
|
|
@@ -15436,7 +15691,10 @@ function createListResult(items, legacyKey) {
|
|
|
15436
15691
|
total: items.length
|
|
15437
15692
|
};
|
|
15438
15693
|
if (legacyKey) {
|
|
15439
|
-
|
|
15694
|
+
return {
|
|
15695
|
+
...result,
|
|
15696
|
+
[legacyKey]: items
|
|
15697
|
+
};
|
|
15440
15698
|
}
|
|
15441
15699
|
return result;
|
|
15442
15700
|
}
|
|
@@ -15480,6 +15738,17 @@ function asTenantVaultSecretArray(data) {
|
|
|
15480
15738
|
}
|
|
15481
15739
|
function createAdminClient(config = {}) {
|
|
15482
15740
|
const gateway = createGatewayRequestClient(config);
|
|
15741
|
+
const getControlObjectOwnership = async () => gateway.request({
|
|
15742
|
+
path: "/api/platform/v1/admin/control-ownership"
|
|
15743
|
+
});
|
|
15744
|
+
const createMembership = async (input, idempotencyKey) => gateway.request({
|
|
15745
|
+
path: "/api/platform/v1/memberships",
|
|
15746
|
+
method: "POST",
|
|
15747
|
+
body: input,
|
|
15748
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15749
|
+
});
|
|
15750
|
+
const updateMembership = createMembership;
|
|
15751
|
+
const upsertMembership = createMembership;
|
|
15483
15752
|
return {
|
|
15484
15753
|
/**
|
|
15485
15754
|
* List tenants visible to the current principal.
|
|
@@ -15511,19 +15780,11 @@ function createAdminClient(config = {}) {
|
|
|
15511
15780
|
/**
|
|
15512
15781
|
* Get the control-object ownership contract.
|
|
15513
15782
|
*/
|
|
15514
|
-
|
|
15515
|
-
return gateway.request({
|
|
15516
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
15517
|
-
});
|
|
15518
|
-
},
|
|
15783
|
+
getControlObjectOwnership,
|
|
15519
15784
|
/**
|
|
15520
15785
|
* @deprecated Use getControlObjectOwnership.
|
|
15521
15786
|
*/
|
|
15522
|
-
|
|
15523
|
-
return gateway.request({
|
|
15524
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
15525
|
-
});
|
|
15526
|
-
},
|
|
15787
|
+
getControlObjectOwnershipContract: getControlObjectOwnership,
|
|
15527
15788
|
/**
|
|
15528
15789
|
* List workspaces for the current admin scope.
|
|
15529
15790
|
*/
|
|
@@ -15570,26 +15831,15 @@ function createAdminClient(config = {}) {
|
|
|
15570
15831
|
/**
|
|
15571
15832
|
* Create a membership.
|
|
15572
15833
|
*/
|
|
15573
|
-
|
|
15574
|
-
return gateway.request({
|
|
15575
|
-
path: "/api/platform/v1/memberships",
|
|
15576
|
-
method: "POST",
|
|
15577
|
-
body: input,
|
|
15578
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15579
|
-
});
|
|
15580
|
-
},
|
|
15834
|
+
createMembership,
|
|
15581
15835
|
/**
|
|
15582
15836
|
* Update a membership.
|
|
15583
15837
|
*/
|
|
15584
|
-
|
|
15585
|
-
return this.createMembership(input, idempotencyKey);
|
|
15586
|
-
},
|
|
15838
|
+
updateMembership,
|
|
15587
15839
|
/**
|
|
15588
15840
|
* @deprecated Use createMembership or updateMembership.
|
|
15589
15841
|
*/
|
|
15590
|
-
|
|
15591
|
-
return this.createMembership(input, idempotencyKey);
|
|
15592
|
-
},
|
|
15842
|
+
upsertMembership,
|
|
15593
15843
|
/**
|
|
15594
15844
|
* List tenant API keys in the current admin scope.
|
|
15595
15845
|
*/
|
|
@@ -15871,115 +16121,111 @@ function createAnswersClient(config = {}) {
|
|
|
15871
16121
|
// ../sdk/src/audiencesClient.ts
|
|
15872
16122
|
function createAudiencesClient(config = {}) {
|
|
15873
16123
|
const gateway = createGatewayRequestClient(config);
|
|
16124
|
+
const listRegistry = async (query5 = {}) => {
|
|
16125
|
+
return gateway.request({
|
|
16126
|
+
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
16127
|
+
...query5,
|
|
16128
|
+
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
16129
|
+
status: query5.status
|
|
16130
|
+
})}`
|
|
16131
|
+
}).then(
|
|
16132
|
+
(response) => mapGatewayData(
|
|
16133
|
+
response,
|
|
16134
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
|
|
16135
|
+
)
|
|
16136
|
+
);
|
|
16137
|
+
};
|
|
16138
|
+
const createRegistryEntry = async (input, idempotencyKey) => {
|
|
16139
|
+
return gateway.request({
|
|
16140
|
+
path: "/api/platform/v1/audiences/registry",
|
|
16141
|
+
method: "POST",
|
|
16142
|
+
body: input,
|
|
16143
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16144
|
+
});
|
|
16145
|
+
};
|
|
16146
|
+
const updateRegistryEntry = createRegistryEntry;
|
|
16147
|
+
const upsertRegistry = createRegistryEntry;
|
|
16148
|
+
const getRegistry = listRegistry;
|
|
16149
|
+
const listGrants = async (query5 = {}) => {
|
|
16150
|
+
return gateway.request({
|
|
16151
|
+
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
16152
|
+
...query5,
|
|
16153
|
+
audienceKey: query5.audienceKey,
|
|
16154
|
+
principalId: query5.principalId,
|
|
16155
|
+
groupId: query5.groupId,
|
|
16156
|
+
status: query5.status
|
|
16157
|
+
})}`
|
|
16158
|
+
}).then(
|
|
16159
|
+
(response) => mapGatewayData(
|
|
16160
|
+
response,
|
|
16161
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
16162
|
+
)
|
|
16163
|
+
);
|
|
16164
|
+
};
|
|
16165
|
+
const createGrant = async (input, idempotencyKey) => {
|
|
16166
|
+
return gateway.request({
|
|
16167
|
+
path: "/api/platform/v1/audiences/grants",
|
|
16168
|
+
method: "POST",
|
|
16169
|
+
body: input,
|
|
16170
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16171
|
+
});
|
|
16172
|
+
};
|
|
16173
|
+
const getGrants = listGrants;
|
|
16174
|
+
const grant = createGrant;
|
|
16175
|
+
const deleteGrant = async (input, idempotencyKey) => {
|
|
16176
|
+
return gateway.request({
|
|
16177
|
+
path: "/api/platform/v1/audiences/grants/revoke",
|
|
16178
|
+
method: "POST",
|
|
16179
|
+
body: input,
|
|
16180
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16181
|
+
});
|
|
16182
|
+
};
|
|
16183
|
+
const revokeGrant = deleteGrant;
|
|
15874
16184
|
return {
|
|
15875
16185
|
/**
|
|
15876
16186
|
* List audience registry entries.
|
|
15877
16187
|
*/
|
|
15878
|
-
|
|
15879
|
-
return gateway.request({
|
|
15880
|
-
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
15881
|
-
...query5,
|
|
15882
|
-
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
15883
|
-
status: query5.status
|
|
15884
|
-
})}`
|
|
15885
|
-
}).then(
|
|
15886
|
-
(response) => mapGatewayData(
|
|
15887
|
-
response,
|
|
15888
|
-
(data) => createListResult(
|
|
15889
|
-
Array.isArray(data) ? data : [],
|
|
15890
|
-
"registryEntries"
|
|
15891
|
-
)
|
|
15892
|
-
)
|
|
15893
|
-
);
|
|
15894
|
-
},
|
|
16188
|
+
listRegistry,
|
|
15895
16189
|
/**
|
|
15896
16190
|
* @deprecated Use listRegistry.
|
|
15897
16191
|
*/
|
|
15898
|
-
|
|
15899
|
-
return this.listRegistry(query5);
|
|
15900
|
-
},
|
|
16192
|
+
getRegistry,
|
|
15901
16193
|
/**
|
|
15902
16194
|
* Create an audience registry entry.
|
|
15903
16195
|
*/
|
|
15904
|
-
|
|
15905
|
-
return gateway.request({
|
|
15906
|
-
path: "/api/platform/v1/audiences/registry",
|
|
15907
|
-
method: "POST",
|
|
15908
|
-
body: input,
|
|
15909
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15910
|
-
});
|
|
15911
|
-
},
|
|
16196
|
+
createRegistryEntry,
|
|
15912
16197
|
/**
|
|
15913
16198
|
* Update an audience registry entry.
|
|
15914
16199
|
*/
|
|
15915
|
-
|
|
15916
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
15917
|
-
},
|
|
16200
|
+
updateRegistryEntry,
|
|
15918
16201
|
/**
|
|
15919
16202
|
* @deprecated Use createRegistryEntry or updateRegistryEntry.
|
|
15920
16203
|
*/
|
|
15921
|
-
|
|
15922
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
15923
|
-
},
|
|
16204
|
+
upsertRegistry,
|
|
15924
16205
|
/**
|
|
15925
16206
|
* List audience grants.
|
|
15926
16207
|
*/
|
|
15927
|
-
|
|
15928
|
-
return gateway.request({
|
|
15929
|
-
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
15930
|
-
...query5,
|
|
15931
|
-
audienceKey: query5.audienceKey,
|
|
15932
|
-
principalId: query5.principalId,
|
|
15933
|
-
groupId: query5.groupId,
|
|
15934
|
-
status: query5.status
|
|
15935
|
-
})}`
|
|
15936
|
-
}).then(
|
|
15937
|
-
(response) => mapGatewayData(
|
|
15938
|
-
response,
|
|
15939
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
15940
|
-
)
|
|
15941
|
-
);
|
|
15942
|
-
},
|
|
16208
|
+
listGrants,
|
|
15943
16209
|
/**
|
|
15944
16210
|
* @deprecated Use listGrants.
|
|
15945
16211
|
*/
|
|
15946
|
-
|
|
15947
|
-
return this.listGrants(query5);
|
|
15948
|
-
},
|
|
16212
|
+
getGrants,
|
|
15949
16213
|
/**
|
|
15950
16214
|
* Create an audience grant.
|
|
15951
16215
|
*/
|
|
15952
|
-
|
|
15953
|
-
return gateway.request({
|
|
15954
|
-
path: "/api/platform/v1/audiences/grants",
|
|
15955
|
-
method: "POST",
|
|
15956
|
-
body: input,
|
|
15957
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15958
|
-
});
|
|
15959
|
-
},
|
|
16216
|
+
createGrant,
|
|
15960
16217
|
/**
|
|
15961
16218
|
* @deprecated Use createGrant.
|
|
15962
16219
|
*/
|
|
15963
|
-
|
|
15964
|
-
return this.createGrant(input, idempotencyKey);
|
|
15965
|
-
},
|
|
16220
|
+
grant,
|
|
15966
16221
|
/**
|
|
15967
16222
|
* Delete an audience grant by revoking it.
|
|
15968
16223
|
*/
|
|
15969
|
-
|
|
15970
|
-
return gateway.request({
|
|
15971
|
-
path: "/api/platform/v1/audiences/grants/revoke",
|
|
15972
|
-
method: "POST",
|
|
15973
|
-
body: input,
|
|
15974
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15975
|
-
});
|
|
15976
|
-
},
|
|
16224
|
+
deleteGrant,
|
|
15977
16225
|
/**
|
|
15978
16226
|
* @deprecated Use deleteGrant.
|
|
15979
16227
|
*/
|
|
15980
|
-
|
|
15981
|
-
return this.deleteGrant(input, idempotencyKey);
|
|
15982
|
-
}
|
|
16228
|
+
revokeGrant
|
|
15983
16229
|
};
|
|
15984
16230
|
}
|
|
15985
16231
|
|
|
@@ -16020,8 +16266,18 @@ function authBaseUrl(config) {
|
|
|
16020
16266
|
return config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
16021
16267
|
}
|
|
16022
16268
|
async function readJson2(response) {
|
|
16023
|
-
|
|
16024
|
-
|
|
16269
|
+
try {
|
|
16270
|
+
const payload = await response.json();
|
|
16271
|
+
return isRecord8(payload) ? payload : {};
|
|
16272
|
+
} catch (error) {
|
|
16273
|
+
return unreadableJsonBodyFallback();
|
|
16274
|
+
}
|
|
16275
|
+
}
|
|
16276
|
+
function unreadableJsonBodyFallback(_error) {
|
|
16277
|
+
return {};
|
|
16278
|
+
}
|
|
16279
|
+
function isRecord8(value) {
|
|
16280
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
16025
16281
|
}
|
|
16026
16282
|
function readString(value) {
|
|
16027
16283
|
const normalized = typeof value === "string" ? value.trim() : "";
|
|
@@ -16063,7 +16319,10 @@ function assertDeviceTokenResponse(payload) {
|
|
|
16063
16319
|
tenant_id: tenantId,
|
|
16064
16320
|
workspace_id: readString(payload.workspace_id),
|
|
16065
16321
|
principal_id: principalId,
|
|
16066
|
-
user: payload.user && typeof payload.user === "
|
|
16322
|
+
user: isRecord8(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
|
|
16323
|
+
id: payload.user.id,
|
|
16324
|
+
principalId: payload.user.principalId
|
|
16325
|
+
} : void 0
|
|
16067
16326
|
};
|
|
16068
16327
|
}
|
|
16069
16328
|
function maybeThrowDeviceError(payload) {
|
|
@@ -16211,12 +16470,12 @@ function createBeliefsClient(config = {}) {
|
|
|
16211
16470
|
body: normalizeModulateConfidenceInput(input),
|
|
16212
16471
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16213
16472
|
});
|
|
16214
|
-
async
|
|
16473
|
+
const getOpinionHistory = async (beliefId) => {
|
|
16215
16474
|
const response = await gateway.request({
|
|
16216
16475
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
|
|
16217
16476
|
});
|
|
16218
16477
|
return mapOpinionHistoryEntriesFromGatewayData(response.data);
|
|
16219
|
-
}
|
|
16478
|
+
};
|
|
16220
16479
|
return {
|
|
16221
16480
|
/**
|
|
16222
16481
|
* Create a belief within a topic scope.
|
|
@@ -16261,13 +16520,9 @@ function createBeliefsClient(config = {}) {
|
|
|
16261
16520
|
* trigger = cause of the score change
|
|
16262
16521
|
* triggeringRef = optional pointer to the evidence or worktree that drove the change
|
|
16263
16522
|
*/
|
|
16264
|
-
|
|
16265
|
-
return getOpinionHistory(beliefId);
|
|
16266
|
-
},
|
|
16523
|
+
getOpinionHistory,
|
|
16267
16524
|
/** @deprecated Use getOpinionHistory(). */
|
|
16268
|
-
|
|
16269
|
-
return getOpinionHistory(beliefId);
|
|
16270
|
-
},
|
|
16525
|
+
getConfidenceHistory: getOpinionHistory,
|
|
16271
16526
|
/**
|
|
16272
16527
|
* Fork a scored belief into a new formulation.
|
|
16273
16528
|
*/
|
|
@@ -16415,6 +16670,9 @@ function cleanOptionalString(value) {
|
|
|
16415
16670
|
const normalized = value?.trim();
|
|
16416
16671
|
return normalized ? normalized : void 0;
|
|
16417
16672
|
}
|
|
16673
|
+
function isRecord9(value) {
|
|
16674
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
16675
|
+
}
|
|
16418
16676
|
function cleanRequiredString(value, label) {
|
|
16419
16677
|
const normalized = cleanOptionalString(value);
|
|
16420
16678
|
if (!normalized) {
|
|
@@ -16454,9 +16712,10 @@ function topicPayload(input, allowed, operation) {
|
|
|
16454
16712
|
};
|
|
16455
16713
|
}
|
|
16456
16714
|
function listResultFromEnvelope(data, legacyKey) {
|
|
16457
|
-
const record = data
|
|
16715
|
+
const record = isRecord9(data) ? data : {};
|
|
16716
|
+
const legacyItems = record[legacyKey];
|
|
16458
16717
|
return createListResult(
|
|
16459
|
-
Array.isArray(
|
|
16718
|
+
Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
|
|
16460
16719
|
legacyKey
|
|
16461
16720
|
);
|
|
16462
16721
|
}
|
|
@@ -16828,7 +17087,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
|
|
|
16828
17087
|
// ../sdk/src/ontologyClient.ts
|
|
16829
17088
|
function createOntologyClient(config = {}) {
|
|
16830
17089
|
const gateway = createGatewayRequestClient(config);
|
|
16831
|
-
|
|
17090
|
+
const client = {
|
|
16832
17091
|
/**
|
|
16833
17092
|
* List ontology definitions matching optional filters.
|
|
16834
17093
|
*/
|
|
@@ -16837,13 +17096,14 @@ function createOntologyClient(config = {}) {
|
|
|
16837
17096
|
path: `/api/platform/v1/ontologies${toQueryString(filters)}`
|
|
16838
17097
|
}).then(
|
|
16839
17098
|
(response) => mapGatewayData(response, (data) => {
|
|
16840
|
-
const record =
|
|
16841
|
-
const ontologies =
|
|
16842
|
-
const
|
|
17099
|
+
const record = asRecord(data);
|
|
17100
|
+
const ontologies = asListItems(data, "ontologies");
|
|
17101
|
+
const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
|
|
17102
|
+
const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
|
|
16843
17103
|
return {
|
|
16844
17104
|
...record,
|
|
16845
|
-
...createListResult(
|
|
16846
|
-
ontologies,
|
|
17105
|
+
...createListResult(definitions, "definitions"),
|
|
17106
|
+
ontologies: definitions,
|
|
16847
17107
|
total
|
|
16848
17108
|
};
|
|
16849
17109
|
})
|
|
@@ -16870,18 +17130,6 @@ function createOntologyClient(config = {}) {
|
|
|
16870
17130
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16871
17131
|
});
|
|
16872
17132
|
},
|
|
16873
|
-
/**
|
|
16874
|
-
* List ontology definitions.
|
|
16875
|
-
*/
|
|
16876
|
-
async listDefinitions(filters = {}) {
|
|
16877
|
-
return this.list(filters);
|
|
16878
|
-
},
|
|
16879
|
-
/**
|
|
16880
|
-
* Get an ontology definition.
|
|
16881
|
-
*/
|
|
16882
|
-
async getDefinition(id) {
|
|
16883
|
-
return this.get(id);
|
|
16884
|
-
},
|
|
16885
17133
|
/**
|
|
16886
17134
|
* Create an ontology definition.
|
|
16887
17135
|
*/
|
|
@@ -16923,7 +17171,7 @@ function createOntologyClient(config = {}) {
|
|
|
16923
17171
|
}).then(
|
|
16924
17172
|
(response) => mapGatewayData(
|
|
16925
17173
|
response,
|
|
16926
|
-
(data) => createListResult(
|
|
17174
|
+
(data) => createListResult(asListItems(data, "versions"), "versions")
|
|
16927
17175
|
)
|
|
16928
17176
|
);
|
|
16929
17177
|
},
|
|
@@ -16971,20 +17219,19 @@ function createOntologyClient(config = {}) {
|
|
|
16971
17219
|
(data) => createListResult(Array.isArray(data) ? data : [], "topics")
|
|
16972
17220
|
)
|
|
16973
17221
|
);
|
|
16974
|
-
},
|
|
16975
|
-
/**
|
|
16976
|
-
* @deprecated Use listTopics.
|
|
16977
|
-
*/
|
|
16978
|
-
async listTopicsByOntology(ontologyId) {
|
|
16979
|
-
return this.listTopics(ontologyId);
|
|
16980
17222
|
}
|
|
16981
17223
|
};
|
|
17224
|
+
return Object.assign(client, {
|
|
17225
|
+
listDefinitions: client.list,
|
|
17226
|
+
getDefinition: client.get,
|
|
17227
|
+
listTopicsByOntology: client.listTopics
|
|
17228
|
+
});
|
|
16982
17229
|
}
|
|
16983
17230
|
|
|
16984
17231
|
// ../sdk/src/graphClient.ts
|
|
16985
17232
|
function createGraphClient(config = {}) {
|
|
16986
17233
|
const gateway = createGatewayRequestClient(config);
|
|
16987
|
-
|
|
17234
|
+
const client = {
|
|
16988
17235
|
/**
|
|
16989
17236
|
* List graph nodes matching the provided filters.
|
|
16990
17237
|
*/
|
|
@@ -16998,13 +17245,7 @@ function createGraphClient(config = {}) {
|
|
|
16998
17245
|
);
|
|
16999
17246
|
},
|
|
17000
17247
|
/**
|
|
17001
|
-
*
|
|
17002
|
-
*/
|
|
17003
|
-
async queryNodes(query5) {
|
|
17004
|
-
return this.listNodes(query5);
|
|
17005
|
-
},
|
|
17006
|
-
/**
|
|
17007
|
-
* Retrieve a single graph node by nodeId or globalId.
|
|
17248
|
+
* Retrieve a single graph node by nodeId or globalId.
|
|
17008
17249
|
*/
|
|
17009
17250
|
async getNode(query5) {
|
|
17010
17251
|
return gateway.request({
|
|
@@ -17113,12 +17354,6 @@ function createGraphClient(config = {}) {
|
|
|
17113
17354
|
)
|
|
17114
17355
|
);
|
|
17115
17356
|
},
|
|
17116
|
-
/**
|
|
17117
|
-
* @deprecated Use listEdges.
|
|
17118
|
-
*/
|
|
17119
|
-
async queryEdges(query5) {
|
|
17120
|
-
return this.listEdges(query5);
|
|
17121
|
-
},
|
|
17122
17357
|
/**
|
|
17123
17358
|
* Create a graph edge.
|
|
17124
17359
|
*/
|
|
@@ -17206,12 +17441,6 @@ function createGraphClient(config = {}) {
|
|
|
17206
17441
|
body: normalizeTopicQuery(query5)
|
|
17207
17442
|
});
|
|
17208
17443
|
},
|
|
17209
|
-
/**
|
|
17210
|
-
* Retrieve a graph neighborhood around a root node.
|
|
17211
|
-
*/
|
|
17212
|
-
async getNeighborhood(query5) {
|
|
17213
|
-
return this.neighborhood(query5);
|
|
17214
|
-
},
|
|
17215
17444
|
/**
|
|
17216
17445
|
* Retrieve the shortest known path between two graph nodes.
|
|
17217
17446
|
*/
|
|
@@ -17229,6 +17458,11 @@ function createGraphClient(config = {}) {
|
|
|
17229
17458
|
});
|
|
17230
17459
|
}
|
|
17231
17460
|
};
|
|
17461
|
+
return Object.assign(client, {
|
|
17462
|
+
queryNodes: client.listNodes,
|
|
17463
|
+
queryEdges: client.listEdges,
|
|
17464
|
+
getNeighborhood: client.neighborhood
|
|
17465
|
+
});
|
|
17232
17466
|
}
|
|
17233
17467
|
|
|
17234
17468
|
// ../sdk/src/identityClient.ts
|
|
@@ -17282,6 +17516,13 @@ function createIdentityClient(config = {}) {
|
|
|
17282
17516
|
body: input,
|
|
17283
17517
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17284
17518
|
});
|
|
17519
|
+
const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17520
|
+
const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
|
|
17521
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
17522
|
+
method: "POST",
|
|
17523
|
+
body: input,
|
|
17524
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17525
|
+
});
|
|
17285
17526
|
return {
|
|
17286
17527
|
/**
|
|
17287
17528
|
* Resolve the current authenticated identity summary.
|
|
@@ -17330,15 +17571,11 @@ function createIdentityClient(config = {}) {
|
|
|
17330
17571
|
/**
|
|
17331
17572
|
* Update a principal.
|
|
17332
17573
|
*/
|
|
17333
|
-
|
|
17334
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17335
|
-
},
|
|
17574
|
+
updatePrincipal,
|
|
17336
17575
|
/**
|
|
17337
17576
|
* @deprecated Use createPrincipal or updatePrincipal.
|
|
17338
17577
|
*/
|
|
17339
|
-
|
|
17340
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17341
|
-
},
|
|
17578
|
+
upsertPrincipal: updatePrincipal,
|
|
17342
17579
|
/**
|
|
17343
17580
|
* List keys in the current identity scope.
|
|
17344
17581
|
*/
|
|
@@ -17377,20 +17614,11 @@ function createIdentityClient(config = {}) {
|
|
|
17377
17614
|
/**
|
|
17378
17615
|
* Delete an API key by revoking it.
|
|
17379
17616
|
*/
|
|
17380
|
-
|
|
17381
|
-
return gateway.request({
|
|
17382
|
-
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
17383
|
-
method: "POST",
|
|
17384
|
-
body: input,
|
|
17385
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17386
|
-
});
|
|
17387
|
-
},
|
|
17617
|
+
deleteKey,
|
|
17388
17618
|
/**
|
|
17389
17619
|
* @deprecated Use deleteKey.
|
|
17390
17620
|
*/
|
|
17391
|
-
|
|
17392
|
-
return this.deleteKey(keyId, input, idempotencyKey);
|
|
17393
|
-
},
|
|
17621
|
+
revokeKey: deleteKey,
|
|
17394
17622
|
/**
|
|
17395
17623
|
* Search Clerk users by email or display attributes.
|
|
17396
17624
|
*/
|
|
@@ -17506,14 +17734,11 @@ function createIdentityClient(config = {}) {
|
|
|
17506
17734
|
}
|
|
17507
17735
|
|
|
17508
17736
|
// ../sdk/src/topicsClient.ts
|
|
17509
|
-
function asRecord3(value) {
|
|
17510
|
-
return value && typeof value === "object" ? value : {};
|
|
17511
|
-
}
|
|
17512
17737
|
function cleanString3(value) {
|
|
17513
17738
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
17514
17739
|
}
|
|
17515
17740
|
function normalizeTopicRecord(value) {
|
|
17516
|
-
const record =
|
|
17741
|
+
const record = asRecord(value);
|
|
17517
17742
|
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
17518
17743
|
return withTopicAlias({
|
|
17519
17744
|
...record,
|
|
@@ -17538,7 +17763,7 @@ function createTopicsClient(config = {}) {
|
|
|
17538
17763
|
})}`
|
|
17539
17764
|
}).then(
|
|
17540
17765
|
(response) => mapGatewayData(response, (data) => {
|
|
17541
|
-
const record =
|
|
17766
|
+
const record = asRecord(data);
|
|
17542
17767
|
const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
|
|
17543
17768
|
return {
|
|
17544
17769
|
...createListResult(items, "topics"),
|
|
@@ -17555,7 +17780,7 @@ function createTopicsClient(config = {}) {
|
|
|
17555
17780
|
}).then(
|
|
17556
17781
|
(response) => mapGatewayData(
|
|
17557
17782
|
response,
|
|
17558
|
-
(data) => normalizeTopicRecord(
|
|
17783
|
+
(data) => normalizeTopicRecord(asRecord(data).topic ?? data)
|
|
17559
17784
|
)
|
|
17560
17785
|
);
|
|
17561
17786
|
},
|
|
@@ -17591,7 +17816,7 @@ function createTopicsClient(config = {}) {
|
|
|
17591
17816
|
)}`
|
|
17592
17817
|
}).then(
|
|
17593
17818
|
(response) => mapGatewayData(response, (data) => {
|
|
17594
|
-
const record =
|
|
17819
|
+
const record = asRecord(data);
|
|
17595
17820
|
return {
|
|
17596
17821
|
tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
|
|
17597
17822
|
};
|
|
@@ -18010,7 +18235,7 @@ function createEventsFacade(config = {}) {
|
|
|
18010
18235
|
function createGraphFacade(config = {}) {
|
|
18011
18236
|
const graphClient = createGraphClient(config);
|
|
18012
18237
|
const gateway = createGatewayRequestClient(config);
|
|
18013
|
-
|
|
18238
|
+
const graphFacade = {
|
|
18014
18239
|
async neighborhood(input) {
|
|
18015
18240
|
return graphClient.neighborhood({
|
|
18016
18241
|
globalId: input.globalId,
|
|
@@ -18018,18 +18243,6 @@ function createGraphFacade(config = {}) {
|
|
|
18018
18243
|
maxDepth: input.maxDepth
|
|
18019
18244
|
});
|
|
18020
18245
|
},
|
|
18021
|
-
async traverse(input) {
|
|
18022
|
-
return graphClient.traverse(input);
|
|
18023
|
-
},
|
|
18024
|
-
async analyze(input = {}) {
|
|
18025
|
-
return graphClient.analyze(input);
|
|
18026
|
-
},
|
|
18027
|
-
async bias(input = {}) {
|
|
18028
|
-
return graphClient.bias(input);
|
|
18029
|
-
},
|
|
18030
|
-
async gaps(input) {
|
|
18031
|
-
return graphClient.gaps(input);
|
|
18032
|
-
},
|
|
18033
18246
|
async falsify(input, idempotencyKey = randomIdempotencyKey()) {
|
|
18034
18247
|
return gateway.request({
|
|
18035
18248
|
path: "/api/platform/v1/graph/falsify",
|
|
@@ -18039,6 +18252,12 @@ function createGraphFacade(config = {}) {
|
|
|
18039
18252
|
});
|
|
18040
18253
|
}
|
|
18041
18254
|
};
|
|
18255
|
+
return Object.assign(graphFacade, {
|
|
18256
|
+
traverse: graphClient.traverse,
|
|
18257
|
+
analyze: graphClient.analyze,
|
|
18258
|
+
bias: graphClient.bias,
|
|
18259
|
+
gaps: graphClient.gaps
|
|
18260
|
+
});
|
|
18042
18261
|
}
|
|
18043
18262
|
function createIdentityFacade(config = {}) {
|
|
18044
18263
|
const identityClient = createIdentityClient(config);
|
|
@@ -18052,15 +18271,12 @@ function createIdentityFacade(config = {}) {
|
|
|
18052
18271
|
function createOntologiesFacade(config = {}) {
|
|
18053
18272
|
const ontologyClient = createOntologyClient(config);
|
|
18054
18273
|
const gateway = createGatewayRequestClient(config);
|
|
18055
|
-
|
|
18274
|
+
const ontologyFacade = {
|
|
18056
18275
|
async get(id) {
|
|
18057
18276
|
return gateway.request({
|
|
18058
18277
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
18059
18278
|
});
|
|
18060
18279
|
},
|
|
18061
|
-
async list(query5 = {}) {
|
|
18062
|
-
return ontologyClient.list(query5);
|
|
18063
|
-
},
|
|
18064
18280
|
async bind(input, idempotencyKey) {
|
|
18065
18281
|
return gateway.request({
|
|
18066
18282
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
|
|
@@ -18080,6 +18296,9 @@ function createOntologiesFacade(config = {}) {
|
|
|
18080
18296
|
});
|
|
18081
18297
|
}
|
|
18082
18298
|
};
|
|
18299
|
+
return Object.assign(ontologyFacade, {
|
|
18300
|
+
list: ontologyClient.list
|
|
18301
|
+
});
|
|
18083
18302
|
}
|
|
18084
18303
|
function createQuestionsFacade(config = {}) {
|
|
18085
18304
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -18272,15 +18491,9 @@ function createTasksFacade(config = {}) {
|
|
|
18272
18491
|
function createTopicsFacade(config = {}) {
|
|
18273
18492
|
const topicsClient = createTopicsClient(config);
|
|
18274
18493
|
return {
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
async get(id) {
|
|
18279
|
-
return topicsClient.get(id);
|
|
18280
|
-
},
|
|
18281
|
-
async list(query5 = {}) {
|
|
18282
|
-
return topicsClient.list(query5);
|
|
18283
|
-
},
|
|
18494
|
+
create: topicsClient.create,
|
|
18495
|
+
get: topicsClient.get,
|
|
18496
|
+
list: topicsClient.list,
|
|
18284
18497
|
async update(input, idempotencyKey) {
|
|
18285
18498
|
const { id, ...rest } = input;
|
|
18286
18499
|
return topicsClient.update(id, rest, idempotencyKey);
|
|
@@ -18296,12 +18509,8 @@ function createTopicsFacade(config = {}) {
|
|
|
18296
18509
|
maxDepth: input.maxDepth
|
|
18297
18510
|
});
|
|
18298
18511
|
},
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
},
|
|
18302
|
-
async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
|
|
18303
|
-
return topicsClient.bulkCreate(input, idempotencyKey);
|
|
18304
|
-
}
|
|
18512
|
+
remove: topicsClient.remove,
|
|
18513
|
+
bulkCreate: topicsClient.bulkCreate
|
|
18305
18514
|
};
|
|
18306
18515
|
}
|
|
18307
18516
|
function createWebhooksFacade(config = {}) {
|
|
@@ -18501,7 +18710,7 @@ function createWorktreesFacade(config = {}) {
|
|
|
18501
18710
|
// ../sdk/src/decisionsClient.ts
|
|
18502
18711
|
function createDecisionsClient(config = {}) {
|
|
18503
18712
|
const gateway = createGatewayRequestClient(config);
|
|
18504
|
-
|
|
18713
|
+
const client = {
|
|
18505
18714
|
/**
|
|
18506
18715
|
* List judgments for a topic scope.
|
|
18507
18716
|
*/
|
|
@@ -18579,12 +18788,6 @@ function createDecisionsClient(config = {}) {
|
|
|
18579
18788
|
})
|
|
18580
18789
|
);
|
|
18581
18790
|
},
|
|
18582
|
-
/**
|
|
18583
|
-
* @deprecated Use listPendingOutcomeReviews.
|
|
18584
|
-
*/
|
|
18585
|
-
async listPendingJudgmentOutcomeReview(query5) {
|
|
18586
|
-
return this.listPendingOutcomeReviews(query5);
|
|
18587
|
-
},
|
|
18588
18791
|
/**
|
|
18589
18792
|
* Get audit integrity checks for judgment transitions.
|
|
18590
18793
|
*/
|
|
@@ -18617,12 +18820,6 @@ function createDecisionsClient(config = {}) {
|
|
|
18617
18820
|
)
|
|
18618
18821
|
);
|
|
18619
18822
|
},
|
|
18620
|
-
/**
|
|
18621
|
-
* @deprecated Use createJudgment.
|
|
18622
|
-
*/
|
|
18623
|
-
async recordJudgment(input, idempotencyKey) {
|
|
18624
|
-
return this.createJudgment(input, idempotencyKey);
|
|
18625
|
-
},
|
|
18626
18823
|
/**
|
|
18627
18824
|
* Update the outcome for an existing judgment.
|
|
18628
18825
|
*/
|
|
@@ -18633,14 +18830,13 @@ function createDecisionsClient(config = {}) {
|
|
|
18633
18830
|
body: input,
|
|
18634
18831
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
18635
18832
|
});
|
|
18636
|
-
},
|
|
18637
|
-
/**
|
|
18638
|
-
* @deprecated Use updateJudgmentOutcome.
|
|
18639
|
-
*/
|
|
18640
|
-
async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
|
|
18641
|
-
return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
|
|
18642
18833
|
}
|
|
18643
18834
|
};
|
|
18835
|
+
return Object.assign(client, {
|
|
18836
|
+
listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
|
|
18837
|
+
recordJudgment: client.createJudgment,
|
|
18838
|
+
recordJudgmentOutcome: client.updateJudgmentOutcome
|
|
18839
|
+
});
|
|
18644
18840
|
}
|
|
18645
18841
|
|
|
18646
18842
|
// ../sdk/src/embeddingsClient.ts
|
|
@@ -19264,7 +19460,7 @@ function createGraphStateClassifierClient(config = {}) {
|
|
|
19264
19460
|
// ../sdk/src/harnessClient.ts
|
|
19265
19461
|
function createHarnessClient(config = {}) {
|
|
19266
19462
|
const gateway = createGatewayRequestClient(config);
|
|
19267
|
-
|
|
19463
|
+
const client = {
|
|
19268
19464
|
/**
|
|
19269
19465
|
* List agent definitions.
|
|
19270
19466
|
*/
|
|
@@ -19297,12 +19493,6 @@ function createHarnessClient(config = {}) {
|
|
|
19297
19493
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
19298
19494
|
});
|
|
19299
19495
|
},
|
|
19300
|
-
/**
|
|
19301
|
-
* @deprecated Use createAgentDefinition.
|
|
19302
|
-
*/
|
|
19303
|
-
async registerAgentDefinition(input, idempotencyKey) {
|
|
19304
|
-
return this.createAgentDefinition(input, idempotencyKey);
|
|
19305
|
-
},
|
|
19306
19496
|
/**
|
|
19307
19497
|
* Update an agent definition.
|
|
19308
19498
|
*/
|
|
@@ -19341,12 +19531,6 @@ function createHarnessClient(config = {}) {
|
|
|
19341
19531
|
)
|
|
19342
19532
|
);
|
|
19343
19533
|
},
|
|
19344
|
-
/**
|
|
19345
|
-
* @deprecated Use listAgentRuns.
|
|
19346
|
-
*/
|
|
19347
|
-
async listRunsForAgent(agentId, scope = {}) {
|
|
19348
|
-
return this.listAgentRuns(agentId, scope);
|
|
19349
|
-
},
|
|
19350
19534
|
/**
|
|
19351
19535
|
* List tool definitions.
|
|
19352
19536
|
*/
|
|
@@ -19379,12 +19563,6 @@ function createHarnessClient(config = {}) {
|
|
|
19379
19563
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
19380
19564
|
});
|
|
19381
19565
|
},
|
|
19382
|
-
/**
|
|
19383
|
-
* @deprecated Use createToolDefinition.
|
|
19384
|
-
*/
|
|
19385
|
-
async registerToolDefinition(input, idempotencyKey) {
|
|
19386
|
-
return this.createToolDefinition(input, idempotencyKey);
|
|
19387
|
-
},
|
|
19388
19566
|
/**
|
|
19389
19567
|
* Update a tool definition.
|
|
19390
19568
|
*/
|
|
@@ -19419,12 +19597,6 @@ function createHarnessClient(config = {}) {
|
|
|
19419
19597
|
)
|
|
19420
19598
|
);
|
|
19421
19599
|
},
|
|
19422
|
-
/**
|
|
19423
|
-
* @deprecated Use listRunEntries.
|
|
19424
|
-
*/
|
|
19425
|
-
async listRunLedgerEntries(scope = {}) {
|
|
19426
|
-
return this.listRunEntries(scope);
|
|
19427
|
-
},
|
|
19428
19600
|
/**
|
|
19429
19601
|
* Create a harness run.
|
|
19430
19602
|
*/
|
|
@@ -19499,6 +19671,12 @@ function createHarnessClient(config = {}) {
|
|
|
19499
19671
|
});
|
|
19500
19672
|
}
|
|
19501
19673
|
};
|
|
19674
|
+
return Object.assign(client, {
|
|
19675
|
+
registerAgentDefinition: client.createAgentDefinition,
|
|
19676
|
+
listRunsForAgent: client.listAgentRuns,
|
|
19677
|
+
registerToolDefinition: client.createToolDefinition,
|
|
19678
|
+
listRunLedgerEntries: client.listRunEntries
|
|
19679
|
+
});
|
|
19502
19680
|
}
|
|
19503
19681
|
|
|
19504
19682
|
// ../sdk/src/jobsClient.ts
|
|
@@ -19626,45 +19804,41 @@ function createJobsClient(config = {}) {
|
|
|
19626
19804
|
// ../sdk/src/learningClient.ts
|
|
19627
19805
|
function createLearningClient(config = {}) {
|
|
19628
19806
|
const gateway = createGatewayRequestClient(config);
|
|
19807
|
+
const listRecentExecutions = async (args = {}) => gateway.request({
|
|
19808
|
+
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
19809
|
+
...normalizeTopicQuery(args),
|
|
19810
|
+
namespace: args.namespace,
|
|
19811
|
+
audienceMode: args.audienceMode,
|
|
19812
|
+
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
19813
|
+
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
19814
|
+
})}`
|
|
19815
|
+
}).then(
|
|
19816
|
+
(response) => mapGatewayData(
|
|
19817
|
+
response,
|
|
19818
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
19819
|
+
)
|
|
19820
|
+
);
|
|
19821
|
+
const getExecutionStats = async (args = {}) => gateway.request({
|
|
19822
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
19823
|
+
...normalizeTopicQuery(args),
|
|
19824
|
+
namespace: args.namespace,
|
|
19825
|
+
audienceMode: args.audienceMode,
|
|
19826
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
19827
|
+
})}`
|
|
19828
|
+
});
|
|
19629
19829
|
return {
|
|
19630
19830
|
/**
|
|
19631
19831
|
* List recent execution records.
|
|
19632
19832
|
*/
|
|
19633
|
-
|
|
19634
|
-
return gateway.request({
|
|
19635
|
-
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
19636
|
-
...normalizeTopicQuery(args),
|
|
19637
|
-
namespace: args.namespace,
|
|
19638
|
-
audienceMode: args.audienceMode,
|
|
19639
|
-
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
19640
|
-
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
19641
|
-
})}`
|
|
19642
|
-
}).then(
|
|
19643
|
-
(response) => mapGatewayData(
|
|
19644
|
-
response,
|
|
19645
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
19646
|
-
)
|
|
19647
|
-
);
|
|
19648
|
-
},
|
|
19833
|
+
listRecentExecutions,
|
|
19649
19834
|
/**
|
|
19650
19835
|
* @deprecated Use listRecentExecutions.
|
|
19651
19836
|
*/
|
|
19652
|
-
|
|
19653
|
-
return this.listRecentExecutions(args);
|
|
19654
|
-
},
|
|
19837
|
+
getRecentExecutions: listRecentExecutions,
|
|
19655
19838
|
/**
|
|
19656
19839
|
* Get aggregate execution statistics.
|
|
19657
19840
|
*/
|
|
19658
|
-
|
|
19659
|
-
return gateway.request({
|
|
19660
|
-
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
19661
|
-
...normalizeTopicQuery(args),
|
|
19662
|
-
namespace: args.namespace,
|
|
19663
|
-
audienceMode: args.audienceMode,
|
|
19664
|
-
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
19665
|
-
})}`
|
|
19666
|
-
});
|
|
19667
|
-
}
|
|
19841
|
+
getExecutionStats
|
|
19668
19842
|
};
|
|
19669
19843
|
}
|
|
19670
19844
|
|
|
@@ -20701,7 +20875,7 @@ function createOrgGraphSearchClient(config = {}) {
|
|
|
20701
20875
|
// ../sdk/src/packsClient.ts
|
|
20702
20876
|
function createPacksClient(config = {}) {
|
|
20703
20877
|
const gateway = createGatewayRequestClient(config);
|
|
20704
|
-
|
|
20878
|
+
const client = {
|
|
20705
20879
|
/**
|
|
20706
20880
|
* List catalog entries for available packs.
|
|
20707
20881
|
*/
|
|
@@ -20715,12 +20889,6 @@ function createPacksClient(config = {}) {
|
|
|
20715
20889
|
)
|
|
20716
20890
|
);
|
|
20717
20891
|
},
|
|
20718
|
-
/**
|
|
20719
|
-
* @deprecated Use listCatalog.
|
|
20720
|
-
*/
|
|
20721
|
-
async getCatalog() {
|
|
20722
|
-
return this.listCatalog();
|
|
20723
|
-
},
|
|
20724
20892
|
/**
|
|
20725
20893
|
* Get the discovery catalog for packs.
|
|
20726
20894
|
*/
|
|
@@ -20750,12 +20918,6 @@ function createPacksClient(config = {}) {
|
|
|
20750
20918
|
)
|
|
20751
20919
|
);
|
|
20752
20920
|
},
|
|
20753
|
-
/**
|
|
20754
|
-
* @deprecated Use listStates.
|
|
20755
|
-
*/
|
|
20756
|
-
async getStates(query5 = {}) {
|
|
20757
|
-
return this.listStates(query5);
|
|
20758
|
-
},
|
|
20759
20921
|
/**
|
|
20760
20922
|
* Get health details for a pack.
|
|
20761
20923
|
*/
|
|
@@ -20779,12 +20941,6 @@ function createPacksClient(config = {}) {
|
|
|
20779
20941
|
)
|
|
20780
20942
|
);
|
|
20781
20943
|
},
|
|
20782
|
-
/**
|
|
20783
|
-
* @deprecated Use listTelemetry.
|
|
20784
|
-
*/
|
|
20785
|
-
async getTelemetry(query5 = {}) {
|
|
20786
|
-
return this.listTelemetry(query5);
|
|
20787
|
-
},
|
|
20788
20944
|
/**
|
|
20789
20945
|
* Create a pack entitlement.
|
|
20790
20946
|
*/
|
|
@@ -20796,18 +20952,6 @@ function createPacksClient(config = {}) {
|
|
|
20796
20952
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
20797
20953
|
});
|
|
20798
20954
|
},
|
|
20799
|
-
/**
|
|
20800
|
-
* Update a pack entitlement.
|
|
20801
|
-
*/
|
|
20802
|
-
async updateEntitlement(input, idempotencyKey) {
|
|
20803
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
20804
|
-
},
|
|
20805
|
-
/**
|
|
20806
|
-
* @deprecated Use createEntitlement or updateEntitlement.
|
|
20807
|
-
*/
|
|
20808
|
-
async upsertEntitlement(input, idempotencyKey) {
|
|
20809
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
20810
|
-
},
|
|
20811
20955
|
/**
|
|
20812
20956
|
* Install a pack.
|
|
20813
20957
|
*/
|
|
@@ -20864,6 +21008,13 @@ function createPacksClient(config = {}) {
|
|
|
20864
21008
|
});
|
|
20865
21009
|
}
|
|
20866
21010
|
};
|
|
21011
|
+
return Object.assign(client, {
|
|
21012
|
+
getCatalog: client.listCatalog,
|
|
21013
|
+
getStates: client.listStates,
|
|
21014
|
+
getTelemetry: client.listTelemetry,
|
|
21015
|
+
updateEntitlement: client.createEntitlement,
|
|
21016
|
+
upsertEntitlement: client.createEntitlement
|
|
21017
|
+
});
|
|
20867
21018
|
}
|
|
20868
21019
|
|
|
20869
21020
|
// ../sdk/src/policyClient.ts
|
|
@@ -20899,6 +21050,14 @@ function asRolePolicyArray(data) {
|
|
|
20899
21050
|
}
|
|
20900
21051
|
return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
|
|
20901
21052
|
}
|
|
21053
|
+
function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
|
|
21054
|
+
const result = {};
|
|
21055
|
+
result.permission = permission;
|
|
21056
|
+
result.allowedTopicIds = allowedTopicIds;
|
|
21057
|
+
result.deniedTopics = deniedTopics;
|
|
21058
|
+
result.count = count;
|
|
21059
|
+
return result;
|
|
21060
|
+
}
|
|
20902
21061
|
function createPolicyClient(config = {}) {
|
|
20903
21062
|
const gateway = createGatewayRequestClient(config);
|
|
20904
21063
|
return {
|
|
@@ -21121,15 +21280,15 @@ function createPolicyClient(config = {}) {
|
|
|
21121
21280
|
});
|
|
21122
21281
|
const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
|
|
21123
21282
|
const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21283
|
+
const result = {};
|
|
21284
|
+
result.success = true;
|
|
21285
|
+
result.data = buildFilterByPermissionResponse(
|
|
21286
|
+
permission,
|
|
21287
|
+
allowedTopicIds,
|
|
21288
|
+
deniedTopics,
|
|
21289
|
+
typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
|
|
21290
|
+
);
|
|
21291
|
+
return result;
|
|
21133
21292
|
}
|
|
21134
21293
|
};
|
|
21135
21294
|
}
|
|
@@ -21137,64 +21296,66 @@ function createPolicyClient(config = {}) {
|
|
|
21137
21296
|
// ../sdk/src/reportsClient.ts
|
|
21138
21297
|
function createReportsClient(config = {}) {
|
|
21139
21298
|
const gateway = createGatewayRequestClient(config);
|
|
21299
|
+
const listTemplates = async (args = {}) => gateway.request({
|
|
21300
|
+
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
21301
|
+
slug: args.slug
|
|
21302
|
+
})}`
|
|
21303
|
+
}).then(
|
|
21304
|
+
(response) => mapGatewayData(response, (data) => {
|
|
21305
|
+
const rows = asListItems(data, "templates");
|
|
21306
|
+
return createListResult(rows, "templates");
|
|
21307
|
+
})
|
|
21308
|
+
);
|
|
21309
|
+
const listReports = async (input, args = {}) => {
|
|
21310
|
+
const topicId = resolveTopicId(input);
|
|
21311
|
+
if (!topicId) {
|
|
21312
|
+
throw new Error("topicId is required");
|
|
21313
|
+
}
|
|
21314
|
+
return gateway.request({
|
|
21315
|
+
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
21316
|
+
{
|
|
21317
|
+
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
21318
|
+
}
|
|
21319
|
+
)}`
|
|
21320
|
+
}).then(
|
|
21321
|
+
(response) => mapGatewayData(
|
|
21322
|
+
response,
|
|
21323
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
21324
|
+
)
|
|
21325
|
+
);
|
|
21326
|
+
};
|
|
21327
|
+
const getReport = async (reportId) => gateway.request({
|
|
21328
|
+
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
21329
|
+
});
|
|
21140
21330
|
return {
|
|
21141
21331
|
/**
|
|
21142
21332
|
* List report templates.
|
|
21143
21333
|
*/
|
|
21144
|
-
|
|
21145
|
-
return gateway.request({
|
|
21146
|
-
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
21147
|
-
slug: args.slug
|
|
21148
|
-
})}`
|
|
21149
|
-
}).then(
|
|
21150
|
-
(response) => mapGatewayData(response, (data) => {
|
|
21151
|
-
const record = data && typeof data === "object" ? data : {};
|
|
21152
|
-
const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
|
|
21153
|
-
return createListResult(rows, "templates");
|
|
21154
|
-
})
|
|
21155
|
-
);
|
|
21156
|
-
},
|
|
21334
|
+
listTemplates,
|
|
21157
21335
|
/**
|
|
21158
21336
|
* @deprecated Use listTemplates.
|
|
21159
21337
|
*/
|
|
21160
|
-
|
|
21161
|
-
return this.listTemplates(args);
|
|
21162
|
-
},
|
|
21338
|
+
getTemplates: listTemplates,
|
|
21163
21339
|
/**
|
|
21164
21340
|
* List reports for a topic scope.
|
|
21165
21341
|
*/
|
|
21166
|
-
|
|
21167
|
-
const topicId = resolveTopicId(input);
|
|
21168
|
-
if (!topicId) {
|
|
21169
|
-
throw new Error("topicId is required");
|
|
21170
|
-
}
|
|
21171
|
-
return gateway.request({
|
|
21172
|
-
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
21173
|
-
{
|
|
21174
|
-
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
21175
|
-
}
|
|
21176
|
-
)}`
|
|
21177
|
-
}).then(
|
|
21178
|
-
(response) => mapGatewayData(
|
|
21179
|
-
response,
|
|
21180
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
21181
|
-
)
|
|
21182
|
-
);
|
|
21183
|
-
},
|
|
21342
|
+
listReports,
|
|
21184
21343
|
/**
|
|
21185
21344
|
* Get a generated report.
|
|
21186
21345
|
*/
|
|
21187
|
-
|
|
21188
|
-
return gateway.request({
|
|
21189
|
-
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
21190
|
-
});
|
|
21191
|
-
}
|
|
21346
|
+
getReport
|
|
21192
21347
|
};
|
|
21193
21348
|
}
|
|
21194
21349
|
|
|
21195
21350
|
// ../sdk/src/schemaClient.ts
|
|
21196
21351
|
function createSchemaClient(config = {}) {
|
|
21197
21352
|
const gateway = createGatewayRequestClient(config);
|
|
21353
|
+
const createEntitlement = (input, idempotencyKey) => gateway.request({
|
|
21354
|
+
path: "/api/platform/v1/schema/entitlements",
|
|
21355
|
+
method: "POST",
|
|
21356
|
+
body: input,
|
|
21357
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21358
|
+
});
|
|
21198
21359
|
return {
|
|
21199
21360
|
/**
|
|
21200
21361
|
* List schema packs.
|
|
@@ -21246,29 +21407,95 @@ function createSchemaClient(config = {}) {
|
|
|
21246
21407
|
/**
|
|
21247
21408
|
* Create a schema entitlement.
|
|
21248
21409
|
*/
|
|
21249
|
-
|
|
21250
|
-
return gateway.request({
|
|
21251
|
-
path: "/api/platform/v1/schema/entitlements",
|
|
21252
|
-
method: "POST",
|
|
21253
|
-
body: input,
|
|
21254
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21255
|
-
});
|
|
21256
|
-
},
|
|
21410
|
+
createEntitlement,
|
|
21257
21411
|
/**
|
|
21258
21412
|
* Update a schema entitlement.
|
|
21259
21413
|
*/
|
|
21260
|
-
|
|
21261
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
21262
|
-
},
|
|
21414
|
+
updateEntitlement: createEntitlement,
|
|
21263
21415
|
/**
|
|
21264
21416
|
* @deprecated Use createEntitlement or updateEntitlement.
|
|
21265
21417
|
*/
|
|
21266
|
-
|
|
21267
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
21268
|
-
}
|
|
21418
|
+
upsertEntitlement: createEntitlement
|
|
21269
21419
|
};
|
|
21270
21420
|
}
|
|
21271
21421
|
|
|
21422
|
+
// ../sdk/src/clientHelpers.ts
|
|
21423
|
+
function asNodeArray(data) {
|
|
21424
|
+
const rows = asListItems(data, "nodes");
|
|
21425
|
+
if (rows.length > 0) {
|
|
21426
|
+
return rows.filter(
|
|
21427
|
+
(value) => Boolean(value) && typeof value === "object"
|
|
21428
|
+
);
|
|
21429
|
+
}
|
|
21430
|
+
if (data && typeof data === "object") {
|
|
21431
|
+
return [data];
|
|
21432
|
+
}
|
|
21433
|
+
return [];
|
|
21434
|
+
}
|
|
21435
|
+
function requireTopicId4(args) {
|
|
21436
|
+
const topicId = resolveTopicId(args);
|
|
21437
|
+
if (!topicId) {
|
|
21438
|
+
throw new Error("topicId is required");
|
|
21439
|
+
}
|
|
21440
|
+
return topicId;
|
|
21441
|
+
}
|
|
21442
|
+
function requireTopicOrProjectId(args) {
|
|
21443
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
21444
|
+
if (!topicId) {
|
|
21445
|
+
throw new Error("topicId is required");
|
|
21446
|
+
}
|
|
21447
|
+
return topicId;
|
|
21448
|
+
}
|
|
21449
|
+
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
21450
|
+
function matchesAuditNodeReference(value, nodeId) {
|
|
21451
|
+
if (Array.isArray(value)) {
|
|
21452
|
+
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
21453
|
+
}
|
|
21454
|
+
if (!value || typeof value !== "object") {
|
|
21455
|
+
return false;
|
|
21456
|
+
}
|
|
21457
|
+
return Object.entries(value).some(([key, entry]) => {
|
|
21458
|
+
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
21459
|
+
return true;
|
|
21460
|
+
}
|
|
21461
|
+
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
21462
|
+
return true;
|
|
21463
|
+
}
|
|
21464
|
+
return matchesAuditNodeReference(entry, nodeId);
|
|
21465
|
+
});
|
|
21466
|
+
}
|
|
21467
|
+
function requireText(args) {
|
|
21468
|
+
const text = resolveText(args);
|
|
21469
|
+
if (!text) {
|
|
21470
|
+
throw new Error("text is required");
|
|
21471
|
+
}
|
|
21472
|
+
return text;
|
|
21473
|
+
}
|
|
21474
|
+
function requireBaseRate(args) {
|
|
21475
|
+
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
21476
|
+
if (baseRate < 0 || baseRate > 1) {
|
|
21477
|
+
throw new Error("baseRate must be within [0, 1].");
|
|
21478
|
+
}
|
|
21479
|
+
return baseRate;
|
|
21480
|
+
}
|
|
21481
|
+
function sdkQueryString(input) {
|
|
21482
|
+
const params = new URLSearchParams();
|
|
21483
|
+
for (const [key, value] of Object.entries(input)) {
|
|
21484
|
+
if (value === void 0 || value === null) {
|
|
21485
|
+
continue;
|
|
21486
|
+
}
|
|
21487
|
+
if (Array.isArray(value)) {
|
|
21488
|
+
if (value.length > 0) {
|
|
21489
|
+
params.set(key, value.join(","));
|
|
21490
|
+
}
|
|
21491
|
+
continue;
|
|
21492
|
+
}
|
|
21493
|
+
params.set(key, String(value));
|
|
21494
|
+
}
|
|
21495
|
+
const serialized = params.toString();
|
|
21496
|
+
return serialized ? `?${serialized}` : "";
|
|
21497
|
+
}
|
|
21498
|
+
|
|
21272
21499
|
// ../sdk/src/telemetryClient.ts
|
|
21273
21500
|
var TELEMETRY_FIELDS = [
|
|
21274
21501
|
"tenantId",
|
|
@@ -21439,6 +21666,16 @@ function query4(input) {
|
|
|
21439
21666
|
cursor: input.cursor
|
|
21440
21667
|
};
|
|
21441
21668
|
}
|
|
21669
|
+
function effectiveToolsQuery(input) {
|
|
21670
|
+
return {
|
|
21671
|
+
...query4(input),
|
|
21672
|
+
callerRole: input.callerRole,
|
|
21673
|
+
surface: input.surface,
|
|
21674
|
+
sessionType: input.sessionType,
|
|
21675
|
+
permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
|
|
21676
|
+
executableOnly: input.executableOnly
|
|
21677
|
+
};
|
|
21678
|
+
}
|
|
21442
21679
|
function writeBody(input, operation) {
|
|
21443
21680
|
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
21444
21681
|
}
|
|
@@ -21467,7 +21704,9 @@ function createToolRegistryClient(config = {}) {
|
|
|
21467
21704
|
},
|
|
21468
21705
|
listEffectiveTools(input) {
|
|
21469
21706
|
return gateway.request({
|
|
21470
|
-
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
21707
|
+
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
21708
|
+
effectiveToolsQuery(input)
|
|
21709
|
+
)}`
|
|
21471
21710
|
}).then(
|
|
21472
21711
|
(response) => mapGatewayData(
|
|
21473
21712
|
response,
|
|
@@ -21558,7 +21797,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
21558
21797
|
}
|
|
21559
21798
|
|
|
21560
21799
|
// ../sdk/src/version.ts
|
|
21561
|
-
var LUCERN_SDK_VERSION = "0.
|
|
21800
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.7";
|
|
21562
21801
|
|
|
21563
21802
|
// ../sdk/src/workflowClient.ts
|
|
21564
21803
|
function normalizeLensQuery(value) {
|
|
@@ -21752,12 +21991,6 @@ function createWorkflowClient(config = {}) {
|
|
|
21752
21991
|
)
|
|
21753
21992
|
);
|
|
21754
21993
|
},
|
|
21755
|
-
/**
|
|
21756
|
-
* @deprecated Use createWorktree.
|
|
21757
|
-
*/
|
|
21758
|
-
async addWorktree(input, idempotencyKey) {
|
|
21759
|
-
return client.createWorktree(input, idempotencyKey);
|
|
21760
|
-
},
|
|
21761
21994
|
/**
|
|
21762
21995
|
* Merge a worktree into the main belief line.
|
|
21763
21996
|
*/
|
|
@@ -21955,54 +22188,19 @@ function createWorkflowClient(config = {}) {
|
|
|
21955
22188
|
body: input,
|
|
21956
22189
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21957
22190
|
});
|
|
21958
|
-
},
|
|
21959
|
-
/**
|
|
21960
|
-
* @deprecated Use createBranch.
|
|
21961
|
-
*/
|
|
21962
|
-
async createPillar(input, idempotencyKey) {
|
|
21963
|
-
return client.createBranch(input, idempotencyKey);
|
|
21964
|
-
},
|
|
21965
|
-
/**
|
|
21966
|
-
* @deprecated Use addWorktree.
|
|
21967
|
-
*/
|
|
21968
|
-
async createSprint(input, idempotencyKey) {
|
|
21969
|
-
return client.createWorktree(input, idempotencyKey);
|
|
21970
|
-
},
|
|
21971
|
-
/**
|
|
21972
|
-
* @deprecated Use merge.
|
|
21973
|
-
*/
|
|
21974
|
-
async completeSprint(worktreeId, input, idempotencyKey) {
|
|
21975
|
-
return client.merge(worktreeId, input, idempotencyKey);
|
|
21976
|
-
},
|
|
21977
|
-
/**
|
|
21978
|
-
* @deprecated Use openPullRequest.
|
|
21979
|
-
*/
|
|
21980
|
-
async requestReview(worktreeId, input, idempotencyKey) {
|
|
21981
|
-
return client.openPullRequest(worktreeId, input, idempotencyKey);
|
|
21982
|
-
},
|
|
21983
|
-
/**
|
|
21984
|
-
* @deprecated Use push.
|
|
21985
|
-
*/
|
|
21986
|
-
async publishFindings(worktreeId, input, idempotencyKey) {
|
|
21987
|
-
return client.push(worktreeId, input, idempotencyKey);
|
|
21988
22191
|
}
|
|
21989
22192
|
};
|
|
21990
|
-
return client
|
|
22193
|
+
return Object.assign(client, {
|
|
22194
|
+
addWorktree: client.createWorktree,
|
|
22195
|
+
createPillar: client.createBranch,
|
|
22196
|
+
createSprint: client.createWorktree,
|
|
22197
|
+
completeSprint: client.merge,
|
|
22198
|
+
requestReview: client.openPullRequest,
|
|
22199
|
+
publishFindings: client.push
|
|
22200
|
+
});
|
|
21991
22201
|
}
|
|
21992
22202
|
|
|
21993
22203
|
// ../sdk/src/client.ts
|
|
21994
|
-
function asNodeArray(data) {
|
|
21995
|
-
const rows = asListItems(data, "nodes");
|
|
21996
|
-
if (rows.length > 0) {
|
|
21997
|
-
return rows.filter(
|
|
21998
|
-
(value) => Boolean(value) && typeof value === "object"
|
|
21999
|
-
);
|
|
22000
|
-
}
|
|
22001
|
-
if (data && typeof data === "object") {
|
|
22002
|
-
return [data];
|
|
22003
|
-
}
|
|
22004
|
-
return [];
|
|
22005
|
-
}
|
|
22006
22204
|
function toGatewayConfig(config) {
|
|
22007
22205
|
return {
|
|
22008
22206
|
baseUrl: config.baseUrl,
|
|
@@ -22030,72 +22228,9 @@ function toGatewayConfig(config) {
|
|
|
22030
22228
|
}
|
|
22031
22229
|
};
|
|
22032
22230
|
}
|
|
22033
|
-
function requireTopicId4(args) {
|
|
22034
|
-
const topicId = resolveTopicId(args);
|
|
22035
|
-
if (!topicId) {
|
|
22036
|
-
throw new Error("topicId is required");
|
|
22037
|
-
}
|
|
22038
|
-
return topicId;
|
|
22039
|
-
}
|
|
22040
|
-
function requireTopicOrProjectId(args) {
|
|
22041
|
-
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
22042
|
-
if (!topicId) {
|
|
22043
|
-
throw new Error("topicId is required");
|
|
22044
|
-
}
|
|
22045
|
-
return topicId;
|
|
22046
|
-
}
|
|
22047
|
-
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
22048
|
-
function matchesAuditNodeReference(value, nodeId) {
|
|
22049
|
-
if (Array.isArray(value)) {
|
|
22050
|
-
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
22051
|
-
}
|
|
22052
|
-
if (!value || typeof value !== "object") {
|
|
22053
|
-
return false;
|
|
22054
|
-
}
|
|
22055
|
-
return Object.entries(value).some(([key, entry]) => {
|
|
22056
|
-
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
22057
|
-
return true;
|
|
22058
|
-
}
|
|
22059
|
-
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
22060
|
-
return true;
|
|
22061
|
-
}
|
|
22062
|
-
return matchesAuditNodeReference(entry, nodeId);
|
|
22063
|
-
});
|
|
22064
|
-
}
|
|
22065
|
-
function requireText(args) {
|
|
22066
|
-
const text = resolveText(args);
|
|
22067
|
-
if (!text) {
|
|
22068
|
-
throw new Error("text is required");
|
|
22069
|
-
}
|
|
22070
|
-
return text;
|
|
22071
|
-
}
|
|
22072
|
-
function requireBaseRate(args) {
|
|
22073
|
-
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
22074
|
-
if (baseRate < 0 || baseRate > 1) {
|
|
22075
|
-
throw new Error("baseRate must be within [0, 1].");
|
|
22076
|
-
}
|
|
22077
|
-
return baseRate;
|
|
22078
|
-
}
|
|
22079
22231
|
function exposeGatewayData(response) {
|
|
22080
22232
|
return Object.assign({}, response, response.data);
|
|
22081
22233
|
}
|
|
22082
|
-
function sdkQueryString(input) {
|
|
22083
|
-
const params = new URLSearchParams();
|
|
22084
|
-
for (const [key, value] of Object.entries(input)) {
|
|
22085
|
-
if (value === void 0 || value === null) {
|
|
22086
|
-
continue;
|
|
22087
|
-
}
|
|
22088
|
-
if (Array.isArray(value)) {
|
|
22089
|
-
if (value.length > 0) {
|
|
22090
|
-
params.set(key, value.join(","));
|
|
22091
|
-
}
|
|
22092
|
-
continue;
|
|
22093
|
-
}
|
|
22094
|
-
params.set(key, String(value));
|
|
22095
|
-
}
|
|
22096
|
-
const serialized = params.toString();
|
|
22097
|
-
return serialized ? `?${serialized}` : "";
|
|
22098
|
-
}
|
|
22099
22234
|
function createLucernClient(config = {}) {
|
|
22100
22235
|
const gatewayConfig = toGatewayConfig(config);
|
|
22101
22236
|
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
@@ -22319,7 +22454,7 @@ function createLucernClient(config = {}) {
|
|
|
22319
22454
|
topicId,
|
|
22320
22455
|
nodeType: "contradiction",
|
|
22321
22456
|
limit: 500
|
|
22322
|
-
}) : args.nodeId ? await graphClient.
|
|
22457
|
+
}) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
|
|
22323
22458
|
const contradictions2 = asNodeArray(response.data).filter((node) => {
|
|
22324
22459
|
const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
|
|
22325
22460
|
if (args.status && status !== args.status) {
|
|
@@ -22499,23 +22634,15 @@ function createLucernClient(config = {}) {
|
|
|
22499
22634
|
}).then(exposeGatewayData);
|
|
22500
22635
|
}
|
|
22501
22636
|
const nodesNamespace = {
|
|
22502
|
-
list
|
|
22503
|
-
return graphClient.listNodes(query5);
|
|
22504
|
-
},
|
|
22637
|
+
list: graphClient.listNodes,
|
|
22505
22638
|
get(input) {
|
|
22506
22639
|
return graphClient.getNode(
|
|
22507
22640
|
typeof input === "string" ? { nodeId: input } : input
|
|
22508
22641
|
);
|
|
22509
22642
|
},
|
|
22510
|
-
create
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
update(input, idempotencyKey) {
|
|
22514
|
-
return graphClient.updateNode(input, idempotencyKey);
|
|
22515
|
-
},
|
|
22516
|
-
batchCreate(input, idempotencyKey) {
|
|
22517
|
-
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
22518
|
-
},
|
|
22643
|
+
create: graphClient.createNode,
|
|
22644
|
+
update: graphClient.updateNode,
|
|
22645
|
+
batchCreate: graphClient.batchCreateNodes,
|
|
22519
22646
|
listByTopicAndType(input) {
|
|
22520
22647
|
return gateway.request({
|
|
22521
22648
|
path: `/api/platform/v1/nodes${sdkQueryString({
|
|
@@ -22540,15 +22667,9 @@ function createLucernClient(config = {}) {
|
|
|
22540
22667
|
})}`
|
|
22541
22668
|
}).then(exposeGatewayData);
|
|
22542
22669
|
},
|
|
22543
|
-
supersede
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
verify(input, idempotencyKey) {
|
|
22547
|
-
return graphClient.verifyNode(input, idempotencyKey);
|
|
22548
|
-
},
|
|
22549
|
-
hardDelete(input, idempotencyKey) {
|
|
22550
|
-
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
22551
|
-
}
|
|
22670
|
+
supersede: graphClient.supersedeNode,
|
|
22671
|
+
verify: graphClient.verifyNode,
|
|
22672
|
+
hardDelete: graphClient.hardDeleteNode
|
|
22552
22673
|
};
|
|
22553
22674
|
const publicationNamespace = {
|
|
22554
22675
|
create(input, idempotencyKey) {
|
|
@@ -22625,9 +22746,7 @@ function createLucernClient(config = {}) {
|
|
|
22625
22746
|
return {
|
|
22626
22747
|
config,
|
|
22627
22748
|
version: LUCERN_SDK_VERSION,
|
|
22628
|
-
search
|
|
22629
|
-
return searchResources(query5, options);
|
|
22630
|
-
},
|
|
22749
|
+
search: searchResources,
|
|
22631
22750
|
events: {
|
|
22632
22751
|
list(query5 = {}) {
|
|
22633
22752
|
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
@@ -22724,9 +22843,7 @@ function createLucernClient(config = {}) {
|
|
|
22724
22843
|
confidenceHistory(nodeId) {
|
|
22725
22844
|
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
22726
22845
|
},
|
|
22727
|
-
opinionHistory
|
|
22728
|
-
return getOpinionHistory(nodeId);
|
|
22729
|
-
},
|
|
22846
|
+
opinionHistory: getOpinionHistory,
|
|
22730
22847
|
createContract(nodeId, input) {
|
|
22731
22848
|
return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
|
|
22732
22849
|
},
|
|
@@ -22980,10 +23097,10 @@ function createLucernClient(config = {}) {
|
|
|
22980
23097
|
}));
|
|
22981
23098
|
},
|
|
22982
23099
|
getHighPriority(args) {
|
|
22983
|
-
return
|
|
23100
|
+
return questionsFacade.list({
|
|
22984
23101
|
topicId: requireTopicId4(args),
|
|
22985
23102
|
status: args.includeAnswered ? void 0 : "open"
|
|
22986
|
-
}).then((data) => {
|
|
23103
|
+
}).then(exposeGatewayData).then((data) => {
|
|
22987
23104
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
22988
23105
|
const rank = (priority) => {
|
|
22989
23106
|
switch (priority) {
|
|
@@ -23013,9 +23130,7 @@ function createLucernClient(config = {}) {
|
|
|
23013
23130
|
},
|
|
23014
23131
|
graph: {
|
|
23015
23132
|
nodes: nodesNamespace,
|
|
23016
|
-
createEdge
|
|
23017
|
-
return graphClient.createEdge(input);
|
|
23018
|
-
},
|
|
23133
|
+
createEdge: graphClient.createEdge,
|
|
23019
23134
|
neighborhood(args) {
|
|
23020
23135
|
return graphFacade.neighborhood({
|
|
23021
23136
|
globalId: args.globalId,
|
|
@@ -23074,7 +23189,7 @@ function createLucernClient(config = {}) {
|
|
|
23074
23189
|
bisectConfidence,
|
|
23075
23190
|
listBeliefs,
|
|
23076
23191
|
detectConfirmationBias(topicId, threshold) {
|
|
23077
|
-
return
|
|
23192
|
+
return graphFacade.bias({
|
|
23078
23193
|
topicId,
|
|
23079
23194
|
threshold,
|
|
23080
23195
|
limit: 200
|
|
@@ -23085,7 +23200,7 @@ function createLucernClient(config = {}) {
|
|
|
23085
23200
|
}));
|
|
23086
23201
|
},
|
|
23087
23202
|
getStructureAnalysis(topicId) {
|
|
23088
|
-
return
|
|
23203
|
+
return graphFacade.analyze({
|
|
23089
23204
|
topicId,
|
|
23090
23205
|
limit: 200
|
|
23091
23206
|
}).then((response) => ({
|
|
@@ -23152,38 +23267,20 @@ function createLucernClient(config = {}) {
|
|
|
23152
23267
|
}
|
|
23153
23268
|
},
|
|
23154
23269
|
judgments: {
|
|
23155
|
-
create
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23160
|
-
|
|
23161
|
-
list(query5) {
|
|
23162
|
-
return decisionsClient.listJudgments(query5);
|
|
23163
|
-
},
|
|
23164
|
-
get(judgmentId) {
|
|
23165
|
-
return decisionsClient.getJudgment(judgmentId);
|
|
23166
|
-
},
|
|
23167
|
-
recordOutcome(judgmentId, input) {
|
|
23168
|
-
return decisionsClient.recordJudgmentOutcome(judgmentId, input);
|
|
23169
|
-
},
|
|
23170
|
-
updateOutcome(judgmentId, input) {
|
|
23171
|
-
return decisionsClient.updateJudgmentOutcome(judgmentId, input);
|
|
23172
|
-
},
|
|
23270
|
+
create: decisionsClient.createJudgment,
|
|
23271
|
+
record: decisionsClient.recordJudgment,
|
|
23272
|
+
list: decisionsClient.listJudgments,
|
|
23273
|
+
get: decisionsClient.getJudgment,
|
|
23274
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
23275
|
+
updateOutcome: decisionsClient.updateJudgmentOutcome,
|
|
23173
23276
|
readiness(topicId) {
|
|
23174
|
-
return decisionsClient.getJudgmentReadiness({
|
|
23175
|
-
topicId
|
|
23176
|
-
});
|
|
23277
|
+
return decisionsClient.getJudgmentReadiness({ topicId });
|
|
23177
23278
|
},
|
|
23178
23279
|
calibration(topicId) {
|
|
23179
|
-
return decisionsClient.getJudgmentCalibration({
|
|
23180
|
-
topicId
|
|
23181
|
-
});
|
|
23280
|
+
return decisionsClient.getJudgmentCalibration({ topicId });
|
|
23182
23281
|
},
|
|
23183
23282
|
pendingOutcomeReview(topicId) {
|
|
23184
|
-
return decisionsClient.listPendingJudgmentOutcomeReview({
|
|
23185
|
-
topicId
|
|
23186
|
-
});
|
|
23283
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
|
|
23187
23284
|
},
|
|
23188
23285
|
transitionAuditIntegrity(args) {
|
|
23189
23286
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
@@ -23193,21 +23290,11 @@ function createLucernClient(config = {}) {
|
|
|
23193
23290
|
}
|
|
23194
23291
|
},
|
|
23195
23292
|
decisions: {
|
|
23196
|
-
create
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
|
|
23201
|
-
},
|
|
23202
|
-
list(query5) {
|
|
23203
|
-
return decisionsClient.listJudgments(query5);
|
|
23204
|
-
},
|
|
23205
|
-
get(decisionId) {
|
|
23206
|
-
return decisionsClient.getJudgment(decisionId);
|
|
23207
|
-
},
|
|
23208
|
-
recordOutcome(decisionId, input) {
|
|
23209
|
-
return decisionsClient.recordJudgmentOutcome(decisionId, input);
|
|
23210
|
-
},
|
|
23293
|
+
create: decisionsClient.createJudgment,
|
|
23294
|
+
record: decisionsClient.recordJudgment,
|
|
23295
|
+
list: decisionsClient.listJudgments,
|
|
23296
|
+
get: decisionsClient.getJudgment,
|
|
23297
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
23211
23298
|
lessons(decisionId, input, idempotencyKey) {
|
|
23212
23299
|
return gateway.request({
|
|
23213
23300
|
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
@@ -23239,21 +23326,11 @@ function createLucernClient(config = {}) {
|
|
|
23239
23326
|
}
|
|
23240
23327
|
},
|
|
23241
23328
|
worktrees: {
|
|
23242
|
-
createBranch
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
},
|
|
23248
|
-
listLenses(query5) {
|
|
23249
|
-
return workflowClient.listLenses(query5);
|
|
23250
|
-
},
|
|
23251
|
-
applyLensToTopic(input) {
|
|
23252
|
-
return workflowClient.applyLensToTopic(input);
|
|
23253
|
-
},
|
|
23254
|
-
removeLensFromTopic(input) {
|
|
23255
|
-
return workflowClient.removeLensFromTopic(input);
|
|
23256
|
-
},
|
|
23329
|
+
createBranch: workflowClient.createBranch,
|
|
23330
|
+
createLens: workflowClient.createLens,
|
|
23331
|
+
listLenses: workflowClient.listLenses,
|
|
23332
|
+
applyLensToTopic: workflowClient.applyLensToTopic,
|
|
23333
|
+
removeLensFromTopic: workflowClient.removeLensFromTopic,
|
|
23257
23334
|
create(input) {
|
|
23258
23335
|
return worktreesFacade.create({
|
|
23259
23336
|
title: input.title,
|
|
@@ -23358,7 +23435,9 @@ function createLucernClient(config = {}) {
|
|
|
23358
23435
|
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
23359
23436
|
(value) => typeof value === "string"
|
|
23360
23437
|
) : void 0;
|
|
23361
|
-
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23438
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23439
|
+
(value) => typeof value === "string"
|
|
23440
|
+
) : void 0;
|
|
23362
23441
|
return worktreesFacade.update({
|
|
23363
23442
|
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
23364
23443
|
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
@@ -23372,7 +23451,23 @@ function createLucernClient(config = {}) {
|
|
|
23372
23451
|
});
|
|
23373
23452
|
},
|
|
23374
23453
|
update(input) {
|
|
23375
|
-
|
|
23454
|
+
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
23455
|
+
(value) => typeof value === "string"
|
|
23456
|
+
) : void 0;
|
|
23457
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23458
|
+
(value) => typeof value === "string"
|
|
23459
|
+
) : void 0;
|
|
23460
|
+
return worktreesFacade.update({
|
|
23461
|
+
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
23462
|
+
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
23463
|
+
campaign: typeof input.campaign === "number" ? input.campaign : void 0,
|
|
23464
|
+
lane: typeof input.lane === "string" ? input.lane : void 0,
|
|
23465
|
+
laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
|
|
23466
|
+
orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
|
|
23467
|
+
dependsOn,
|
|
23468
|
+
blocks,
|
|
23469
|
+
gate: typeof input.gate === "string" ? input.gate : void 0
|
|
23470
|
+
});
|
|
23376
23471
|
},
|
|
23377
23472
|
updateTargets(input) {
|
|
23378
23473
|
return worktreesFacade.updateTargets({
|
|
@@ -23383,9 +23478,7 @@ function createLucernClient(config = {}) {
|
|
|
23383
23478
|
removeQuestionIds: input.removeQuestionIds
|
|
23384
23479
|
});
|
|
23385
23480
|
},
|
|
23386
|
-
listAll
|
|
23387
|
-
return workflowClient.listAllWorktrees(query5);
|
|
23388
|
-
},
|
|
23481
|
+
listAll: workflowClient.listAllWorktrees,
|
|
23389
23482
|
merge(worktreeId, input) {
|
|
23390
23483
|
return worktreesFacade.merge({
|
|
23391
23484
|
id: worktreeId,
|
|
@@ -23393,18 +23486,12 @@ function createLucernClient(config = {}) {
|
|
|
23393
23486
|
summary: input.summary
|
|
23394
23487
|
});
|
|
23395
23488
|
},
|
|
23396
|
-
push
|
|
23397
|
-
|
|
23398
|
-
},
|
|
23399
|
-
openPullRequest(worktreeId, input) {
|
|
23400
|
-
return workflowClient.openPullRequest(worktreeId, input);
|
|
23401
|
-
},
|
|
23489
|
+
push: workflowClient.push,
|
|
23490
|
+
openPullRequest: workflowClient.openPullRequest,
|
|
23402
23491
|
pipelineSnapshot(topicId) {
|
|
23403
23492
|
return functionSurfaceClient.pipelineSnapshot({ topicId });
|
|
23404
23493
|
},
|
|
23405
|
-
complete
|
|
23406
|
-
return worktreesFacade.complete(input, idempotencyKey);
|
|
23407
|
-
},
|
|
23494
|
+
complete: worktreesFacade.complete,
|
|
23408
23495
|
advancePhase(worktreeId, idempotencyKey) {
|
|
23409
23496
|
return worktreesFacade.advancePhase(
|
|
23410
23497
|
{ worktreeId },
|
|
@@ -23417,12 +23504,8 @@ function createLucernClient(config = {}) {
|
|
|
23417
23504
|
idempotencyKey
|
|
23418
23505
|
);
|
|
23419
23506
|
},
|
|
23420
|
-
patchState
|
|
23421
|
-
|
|
23422
|
-
},
|
|
23423
|
-
bulkCreate(input, idempotencyKey) {
|
|
23424
|
-
return worktreesFacade.bulkCreate(input, idempotencyKey);
|
|
23425
|
-
}
|
|
23507
|
+
patchState: worktreesFacade.patchState,
|
|
23508
|
+
bulkCreate: worktreesFacade.bulkCreate
|
|
23426
23509
|
},
|
|
23427
23510
|
context: {
|
|
23428
23511
|
listTopics(query5 = {}) {
|
|
@@ -23433,27 +23516,15 @@ function createLucernClient(config = {}) {
|
|
|
23433
23516
|
type: query5.type
|
|
23434
23517
|
});
|
|
23435
23518
|
},
|
|
23436
|
-
compile
|
|
23437
|
-
|
|
23438
|
-
},
|
|
23439
|
-
recordScopeLearning(input, idempotencyKey) {
|
|
23440
|
-
return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
|
|
23441
|
-
},
|
|
23519
|
+
compile: contextClient.compile,
|
|
23520
|
+
recordScopeLearning: functionSurfaceClient.recordScopeLearning,
|
|
23442
23521
|
discover(input) {
|
|
23443
23522
|
return discoverTopics(input);
|
|
23444
23523
|
},
|
|
23445
|
-
analyzeTopicDensity
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
|
|
23450
|
-
},
|
|
23451
|
-
seedBeliefLattice(input = {}, idempotencyKey) {
|
|
23452
|
-
return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
|
|
23453
|
-
},
|
|
23454
|
-
getLatticeCoverage(input = {}) {
|
|
23455
|
-
return functionSurfaceClient.getLatticeCoverage(input);
|
|
23456
|
-
},
|
|
23524
|
+
analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
|
|
23525
|
+
applyAutoBranching: functionSurfaceClient.applyAutoBranching,
|
|
23526
|
+
seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
|
|
23527
|
+
getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
|
|
23457
23528
|
matchEntityType(input) {
|
|
23458
23529
|
return ontologiesFacade.match(input).then(exposeGatewayData);
|
|
23459
23530
|
},
|
|
@@ -23538,9 +23609,7 @@ function createLucernClient(config = {}) {
|
|
|
23538
23609
|
type: input.type
|
|
23539
23610
|
});
|
|
23540
23611
|
},
|
|
23541
|
-
get
|
|
23542
|
-
return topicsFacade.get(topicId);
|
|
23543
|
-
},
|
|
23612
|
+
get: topicsFacade.get,
|
|
23544
23613
|
create(input) {
|
|
23545
23614
|
return topicsFacade.create({
|
|
23546
23615
|
name: input.name,
|
|
@@ -23585,12 +23654,8 @@ function createLucernClient(config = {}) {
|
|
|
23585
23654
|
maxDepth: query5.maxDepth
|
|
23586
23655
|
});
|
|
23587
23656
|
},
|
|
23588
|
-
remove
|
|
23589
|
-
|
|
23590
|
-
},
|
|
23591
|
-
bulkCreate(input, idempotencyKey) {
|
|
23592
|
-
return topicsFacade.bulkCreate(input, idempotencyKey);
|
|
23593
|
-
}
|
|
23657
|
+
remove: topicsFacade.remove,
|
|
23658
|
+
bulkCreate: topicsFacade.bulkCreate
|
|
23594
23659
|
},
|
|
23595
23660
|
answers: {
|
|
23596
23661
|
create(input) {
|
|
@@ -23689,33 +23754,15 @@ function createLucernClient(config = {}) {
|
|
|
23689
23754
|
raw: ontologyClient
|
|
23690
23755
|
},
|
|
23691
23756
|
coordination: {
|
|
23692
|
-
registerSession
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
listActiveSessions(input = {}) {
|
|
23702
|
-
return functionSurfaceClient.listActiveSessions(input);
|
|
23703
|
-
},
|
|
23704
|
-
sendAgentMessage(input, idempotencyKey) {
|
|
23705
|
-
return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
|
|
23706
|
-
},
|
|
23707
|
-
broadcastMessage(input, idempotencyKey) {
|
|
23708
|
-
return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
|
|
23709
|
-
},
|
|
23710
|
-
getInbox(input = {}) {
|
|
23711
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
23712
|
-
},
|
|
23713
|
-
getAgentInbox(input = {}) {
|
|
23714
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
23715
|
-
},
|
|
23716
|
-
claimFiles(input, idempotencyKey) {
|
|
23717
|
-
return functionSurfaceClient.claimFiles(input, idempotencyKey);
|
|
23718
|
-
}
|
|
23757
|
+
registerSession: functionSurfaceClient.registerSession,
|
|
23758
|
+
heartbeatSession: functionSurfaceClient.heartbeatSession,
|
|
23759
|
+
endSession: functionSurfaceClient.endSession,
|
|
23760
|
+
listActiveSessions: functionSurfaceClient.listActiveSessions,
|
|
23761
|
+
sendAgentMessage: functionSurfaceClient.sendAgentMessage,
|
|
23762
|
+
broadcastMessage: functionSurfaceClient.broadcastMessage,
|
|
23763
|
+
getInbox: functionSurfaceClient.getAgentInbox,
|
|
23764
|
+
getAgentInbox: functionSurfaceClient.getAgentInbox,
|
|
23765
|
+
claimFiles: functionSurfaceClient.claimFiles
|
|
23719
23766
|
},
|
|
23720
23767
|
policy: {
|
|
23721
23768
|
checkPermission(input) {
|
|
@@ -23746,38 +23793,24 @@ function createLucernClient(config = {}) {
|
|
|
23746
23793
|
principalId: typeof input.principalId === "string" ? input.principalId : void 0
|
|
23747
23794
|
});
|
|
23748
23795
|
},
|
|
23796
|
+
// Backward compatibility shim: keep the policy namespace exposing the
|
|
23797
|
+
// historical manageWritePolicy entry point.
|
|
23749
23798
|
manageWritePolicy(input, idempotencyKey) {
|
|
23750
23799
|
return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
|
|
23751
23800
|
},
|
|
23752
23801
|
raw: policyClient
|
|
23753
23802
|
},
|
|
23754
23803
|
observations: {
|
|
23755
|
-
ingest
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
return functionSurfaceClient.ingestObservation(input, idempotencyKey);
|
|
23760
|
-
},
|
|
23761
|
-
getContext(input) {
|
|
23762
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
23763
|
-
},
|
|
23764
|
-
getObservationContext(input) {
|
|
23765
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
23766
|
-
}
|
|
23804
|
+
ingest: functionSurfaceClient.ingestObservation,
|
|
23805
|
+
ingestObservation: functionSurfaceClient.ingestObservation,
|
|
23806
|
+
getContext: functionSurfaceClient.getObservationContext,
|
|
23807
|
+
getObservationContext: functionSurfaceClient.getObservationContext
|
|
23767
23808
|
},
|
|
23768
23809
|
coding: {
|
|
23769
|
-
getCodeContext
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
return functionSurfaceClient.getChangeHistory(input);
|
|
23774
|
-
},
|
|
23775
|
-
recordAttempt(input, idempotencyKey) {
|
|
23776
|
-
return functionSurfaceClient.recordAttempt(input, idempotencyKey);
|
|
23777
|
-
},
|
|
23778
|
-
getFailureLog(input) {
|
|
23779
|
-
return functionSurfaceClient.getFailureLog(input);
|
|
23780
|
-
}
|
|
23810
|
+
getCodeContext: functionSurfaceClient.getCodeContext,
|
|
23811
|
+
getChangeHistory: functionSurfaceClient.getChangeHistory,
|
|
23812
|
+
recordAttempt: functionSurfaceClient.recordAttempt,
|
|
23813
|
+
getFailureLog: functionSurfaceClient.getFailureLog
|
|
23781
23814
|
},
|
|
23782
23815
|
contracts: {
|
|
23783
23816
|
create(input) {
|
|
@@ -23803,9 +23836,7 @@ function createLucernClient(config = {}) {
|
|
|
23803
23836
|
}
|
|
23804
23837
|
},
|
|
23805
23838
|
bootstrap: {
|
|
23806
|
-
generateSessionHandoff
|
|
23807
|
-
return functionSurfaceClient.generateSessionHandoff(input);
|
|
23808
|
-
}
|
|
23839
|
+
generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
|
|
23809
23840
|
},
|
|
23810
23841
|
embeddings: embeddingsClient,
|
|
23811
23842
|
graphAnalysis: graphAnalysisClient,
|
|
@@ -23827,25 +23858,15 @@ function createLucernClient(config = {}) {
|
|
|
23827
23858
|
createAcl: toolRegistryClient.createAcl,
|
|
23828
23859
|
deleteAcl: toolRegistryClient.deleteAcl,
|
|
23829
23860
|
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
23830
|
-
register
|
|
23831
|
-
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
return unregisterCustomTool(fullName);
|
|
23835
|
-
},
|
|
23836
|
-
list() {
|
|
23837
|
-
return listRegisteredCustomTools();
|
|
23838
|
-
},
|
|
23839
|
-
clear() {
|
|
23840
|
-
clearRegisteredCustomTools();
|
|
23841
|
-
},
|
|
23861
|
+
register: registerCustomTool,
|
|
23862
|
+
unregister: unregisterCustomTool,
|
|
23863
|
+
list: listRegisteredCustomTools,
|
|
23864
|
+
clear: clearRegisteredCustomTools,
|
|
23842
23865
|
invoke(name, input = {}) {
|
|
23843
23866
|
const fullName = name.includes(".") ? name : `custom.${name}`;
|
|
23844
23867
|
return invokeCustomTool(fullName, input);
|
|
23845
23868
|
},
|
|
23846
|
-
namespace
|
|
23847
|
-
return getCustomNamespace(namespace);
|
|
23848
|
-
}
|
|
23869
|
+
namespace: getCustomNamespace
|
|
23849
23870
|
},
|
|
23850
23871
|
packs: {
|
|
23851
23872
|
/**
|
|
@@ -23860,27 +23881,13 @@ function createLucernClient(config = {}) {
|
|
|
23860
23881
|
get isInstalled() {
|
|
23861
23882
|
return _packInstalled;
|
|
23862
23883
|
},
|
|
23863
|
-
listCatalog
|
|
23864
|
-
|
|
23865
|
-
|
|
23866
|
-
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
return packsClient.listStates(scope);
|
|
23871
|
-
},
|
|
23872
|
-
states(scope) {
|
|
23873
|
-
return packsClient.getStates(scope);
|
|
23874
|
-
},
|
|
23875
|
-
install(input) {
|
|
23876
|
-
return packsClient.install(input);
|
|
23877
|
-
},
|
|
23878
|
-
enable(input) {
|
|
23879
|
-
return packsClient.enable(input);
|
|
23880
|
-
},
|
|
23881
|
-
disable(input) {
|
|
23882
|
-
return packsClient.disable(input);
|
|
23883
|
-
}
|
|
23884
|
+
listCatalog: packsClient.listCatalog,
|
|
23885
|
+
catalog: packsClient.listCatalog,
|
|
23886
|
+
listStates: packsClient.listStates,
|
|
23887
|
+
states: packsClient.getStates,
|
|
23888
|
+
install: packsClient.install,
|
|
23889
|
+
enable: packsClient.enable,
|
|
23890
|
+
disable: packsClient.disable
|
|
23884
23891
|
},
|
|
23885
23892
|
nodes: nodesNamespace,
|
|
23886
23893
|
identity: {
|
|
@@ -23893,30 +23900,16 @@ function createLucernClient(config = {}) {
|
|
|
23893
23900
|
raw: identityClient
|
|
23894
23901
|
},
|
|
23895
23902
|
mcp: {
|
|
23896
|
-
bootstrapSession
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
},
|
|
23902
|
-
beginBuildSession(input) {
|
|
23903
|
-
return mcpClient.beginBuildSession(input);
|
|
23904
|
-
},
|
|
23905
|
-
evaluateEngineeringContract(input) {
|
|
23906
|
-
return mcpClient.evaluateEngineeringContract(input);
|
|
23907
|
-
},
|
|
23908
|
-
evaluateResearchContract(input) {
|
|
23909
|
-
return mcpClient.evaluateResearchContract(input);
|
|
23910
|
-
}
|
|
23903
|
+
bootstrapSession: mcpClient.bootstrapSession,
|
|
23904
|
+
checkWritePolicy: mcpClient.checkWritePolicy,
|
|
23905
|
+
beginBuildSession: mcpClient.beginBuildSession,
|
|
23906
|
+
evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
|
|
23907
|
+
evaluateResearchContract: mcpClient.evaluateResearchContract
|
|
23911
23908
|
},
|
|
23912
23909
|
auth: {
|
|
23913
23910
|
device: {
|
|
23914
|
-
createCode
|
|
23915
|
-
|
|
23916
|
-
},
|
|
23917
|
-
pollToken(deviceCode) {
|
|
23918
|
-
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
23919
|
-
}
|
|
23911
|
+
createCode: authDeviceClient.createDeviceCode,
|
|
23912
|
+
pollToken: authDeviceClient.pollDeviceToken
|
|
23920
23913
|
}
|
|
23921
23914
|
},
|
|
23922
23915
|
custom: getCustomNamespace("custom"),
|
|
@@ -24102,17 +24095,11 @@ var TOKENS_PER_WORD = 1.35;
|
|
|
24102
24095
|
var MIN_TOKEN_ESTIMATE = 8;
|
|
24103
24096
|
|
|
24104
24097
|
// ../sdk/src/contextPackPolicy.ts
|
|
24105
|
-
function nowMs() {
|
|
24106
|
-
return Date.now();
|
|
24107
|
-
}
|
|
24108
|
-
function normalizeText(text) {
|
|
24109
|
-
return text.trim().toLowerCase();
|
|
24110
|
-
}
|
|
24111
24098
|
function tokenHits(text, tokens) {
|
|
24112
24099
|
if (tokens.length === 0) {
|
|
24113
24100
|
return 1;
|
|
24114
24101
|
}
|
|
24115
|
-
const haystack =
|
|
24102
|
+
const haystack = text.trim().toLowerCase();
|
|
24116
24103
|
let hits = 0;
|
|
24117
24104
|
for (const token of tokens) {
|
|
24118
24105
|
if (haystack.includes(token)) {
|
|
@@ -24127,7 +24114,7 @@ function clamp013(value) {
|
|
|
24127
24114
|
}
|
|
24128
24115
|
return Math.max(0, Math.min(1, value));
|
|
24129
24116
|
}
|
|
24130
|
-
function recencyScore(updatedAt, referenceTimeMs =
|
|
24117
|
+
function recencyScore(updatedAt, referenceTimeMs = Date.now()) {
|
|
24131
24118
|
if (!updatedAt || !Number.isFinite(updatedAt)) {
|
|
24132
24119
|
return 0.25;
|
|
24133
24120
|
}
|
|
@@ -24143,15 +24130,15 @@ function confidenceScore(confidence) {
|
|
|
24143
24130
|
return clamp013(confidence);
|
|
24144
24131
|
}
|
|
24145
24132
|
function priorityScore(priority) {
|
|
24146
|
-
const value =
|
|
24133
|
+
const value = (priority || "").trim().toLowerCase();
|
|
24147
24134
|
return PRIORITY_SCORES[value] ?? DEFAULT_PRIORITY_SCORE;
|
|
24148
24135
|
}
|
|
24149
24136
|
function severityScore(severity) {
|
|
24150
|
-
const value =
|
|
24137
|
+
const value = (severity || "").trim().toLowerCase();
|
|
24151
24138
|
return SEVERITY_SCORES[value] ?? DEFAULT_SEVERITY_SCORE;
|
|
24152
24139
|
}
|
|
24153
24140
|
function beliefTypeBonus(beliefType) {
|
|
24154
|
-
const value =
|
|
24141
|
+
const value = (beliefType || "").trim().toLowerCase();
|
|
24155
24142
|
return BELIEF_TYPE_BONUS[value] ?? DEFAULT_BELIEF_TYPE_BONUS;
|
|
24156
24143
|
}
|
|
24157
24144
|
function resolveEffectiveWeights(overrides) {
|
|
@@ -24177,7 +24164,7 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
24177
24164
|
}
|
|
24178
24165
|
const ts = candidate.updatedAt || candidate.createdAt || null;
|
|
24179
24166
|
if (ts && Number.isFinite(ts)) {
|
|
24180
|
-
const ageDays = Math.max(0,
|
|
24167
|
+
const ageDays = Math.max(0, Date.now() - ts) / (1e3 * 60 * 60 * 24);
|
|
24181
24168
|
if (ageDays < 1) {
|
|
24182
24169
|
parts.push("updated today");
|
|
24183
24170
|
} else if (ageDays < 7) {
|
|
@@ -24202,10 +24189,6 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
24202
24189
|
}
|
|
24203
24190
|
return parts.join(", ");
|
|
24204
24191
|
}
|
|
24205
|
-
function computeBaselineScore(candidate, queryTokens) {
|
|
24206
|
-
const hits = tokenHits(candidate.text, queryTokens);
|
|
24207
|
-
return queryTokens.length === 0 ? 1 : hits;
|
|
24208
|
-
}
|
|
24209
24192
|
function computeWeightedScore(section, candidate, queryTokens, effectiveWeights, referenceTimeMs) {
|
|
24210
24193
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
24211
24194
|
const queryComponent = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(candidate.text, queryTokens) / queryTokens.length);
|
|
@@ -24239,7 +24222,7 @@ function rankContextSection(section, rows, queryTokens, limit, profile, options)
|
|
|
24239
24222
|
queryTokens,
|
|
24240
24223
|
effectiveWeights,
|
|
24241
24224
|
referenceTimeMs
|
|
24242
|
-
) :
|
|
24225
|
+
) : queryTokens.length === 0 ? 1 : tokenHits(row.text, queryTokens);
|
|
24243
24226
|
const result = { ...row, score };
|
|
24244
24227
|
if (includeJustifications && profile === "weighted_v1") {
|
|
24245
24228
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
@@ -24606,18 +24589,21 @@ function normalizeQueryTokens(query5) {
|
|
|
24606
24589
|
function parseRankingProfile(value) {
|
|
24607
24590
|
return value === "baseline_v1" ? "baseline_v1" : "weighted_v1";
|
|
24608
24591
|
}
|
|
24592
|
+
function isRecord10(value) {
|
|
24593
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24594
|
+
}
|
|
24609
24595
|
function beliefTypeOf(node) {
|
|
24610
24596
|
if (typeof node.beliefType === "string") {
|
|
24611
24597
|
return node.beliefType;
|
|
24612
24598
|
}
|
|
24613
|
-
const metadata = node.metadata
|
|
24599
|
+
const metadata = isRecord10(node.metadata) ? node.metadata : {};
|
|
24614
24600
|
if (typeof metadata.beliefType === "string") {
|
|
24615
24601
|
return metadata.beliefType;
|
|
24616
24602
|
}
|
|
24617
24603
|
return "";
|
|
24618
24604
|
}
|
|
24619
24605
|
function questionStatusOf(node) {
|
|
24620
|
-
const metadata = node.metadata
|
|
24606
|
+
const metadata = isRecord10(node.metadata) ? node.metadata : {};
|
|
24621
24607
|
const direct = typeof node.status === "string" ? node.status : "";
|
|
24622
24608
|
const questionStatus = typeof metadata.questionStatus === "string" ? metadata.questionStatus : "";
|
|
24623
24609
|
return (questionStatus || direct || "open").toLowerCase();
|
|
@@ -24633,9 +24619,6 @@ function isOpenQuestion(status) {
|
|
|
24633
24619
|
"belief_forked"
|
|
24634
24620
|
].includes(status);
|
|
24635
24621
|
}
|
|
24636
|
-
function metadataText(payload) {
|
|
24637
|
-
return JSON.stringify(payload).toLowerCase();
|
|
24638
|
-
}
|
|
24639
24622
|
function collectTopicNeighborhood(topics2, rootTopicId, maxDescendantDepth = 2) {
|
|
24640
24623
|
const byId = /* @__PURE__ */ new Map();
|
|
24641
24624
|
const children = /* @__PURE__ */ new Map();
|
|
@@ -24697,11 +24680,10 @@ function dedupeById(rows) {
|
|
|
24697
24680
|
return output;
|
|
24698
24681
|
}
|
|
24699
24682
|
function candidateTimestamp(candidate) {
|
|
24700
|
-
if (!candidate
|
|
24683
|
+
if (!isRecord10(candidate)) {
|
|
24701
24684
|
return 0;
|
|
24702
24685
|
}
|
|
24703
|
-
const
|
|
24704
|
-
const timestamps = [record.updatedAt, record.createdAt, record.generatedAt].filter(
|
|
24686
|
+
const timestamps = [candidate.updatedAt, candidate.createdAt, candidate.generatedAt].filter(
|
|
24705
24687
|
(value) => typeof value === "number" && Number.isFinite(value)
|
|
24706
24688
|
);
|
|
24707
24689
|
return timestamps.length > 0 ? Math.max(...timestamps) : 0;
|
|
@@ -24823,7 +24805,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24823
24805
|
beliefType: beliefTypeOf(belief) || null,
|
|
24824
24806
|
status: belief.status || "active",
|
|
24825
24807
|
updatedAt: belief.updatedAt || belief.createdAt || null,
|
|
24826
|
-
metadataText: belief.metadata && typeof belief.metadata === "object" ?
|
|
24808
|
+
metadataText: belief.metadata && typeof belief.metadata === "object" ? JSON.stringify(belief.metadata).toLowerCase() : ""
|
|
24827
24809
|
}));
|
|
24828
24810
|
const activeBeliefs = rankContextSection(
|
|
24829
24811
|
"activeBeliefs",
|
|
@@ -24855,7 +24837,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24855
24837
|
status,
|
|
24856
24838
|
priority: typeof metadata.priority === "string" ? metadata.priority : "medium",
|
|
24857
24839
|
updatedAt: question.updatedAt || question.createdAt || null,
|
|
24858
|
-
metadataText:
|
|
24840
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
24859
24841
|
};
|
|
24860
24842
|
}).filter((row) => isOpenQuestion(row.status));
|
|
24861
24843
|
const openQuestions = rankContextSection(
|
|
@@ -24887,7 +24869,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24887
24869
|
kind: typeof metadata.kind === "string" && metadata.kind || "observation",
|
|
24888
24870
|
createdAt: item.createdAt || null,
|
|
24889
24871
|
updatedAt: item.updatedAt || item.createdAt || null,
|
|
24890
|
-
metadataText:
|
|
24872
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
24891
24873
|
};
|
|
24892
24874
|
});
|
|
24893
24875
|
const recentEvidence = rankContextSection(
|
|
@@ -24969,7 +24951,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24969
24951
|
let failureContext;
|
|
24970
24952
|
if (snapshot.plan.includeFailures && snapshot.failures) {
|
|
24971
24953
|
const allFailures = snapshot.failures.filter((node) => {
|
|
24972
|
-
const metadata = node.metadata
|
|
24954
|
+
const metadata = isRecord10(node.metadata) ? node.metadata : {};
|
|
24973
24955
|
return metadata.failedApproach === true || metadata.isFailedAttempt === true;
|
|
24974
24956
|
});
|
|
24975
24957
|
const rankedFailures = rankContextSection(
|
|
@@ -24987,7 +24969,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24987
24969
|
);
|
|
24988
24970
|
const failures = rankedFailures.map((row) => {
|
|
24989
24971
|
const original = allFailures.find((node) => String(node._id) === row.id);
|
|
24990
|
-
const metadata = original?.metadata
|
|
24972
|
+
const metadata = isRecord10(original?.metadata) ? original?.metadata : {};
|
|
24991
24973
|
return {
|
|
24992
24974
|
attemptId: row.id,
|
|
24993
24975
|
approach: String(row.text || ""),
|
|
@@ -25471,9 +25453,7 @@ function lastDelegator(delegationChain) {
|
|
|
25471
25453
|
|
|
25472
25454
|
// ../sdk/src/contracts/lens-filter.contract.ts
|
|
25473
25455
|
function isLensFilterCriteria2(value) {
|
|
25474
|
-
|
|
25475
|
-
const obj = value;
|
|
25476
|
-
return typeof obj.version === "number" && typeof obj.kind === "string";
|
|
25456
|
+
return isRecord11(value) && typeof value.version === "number" && typeof value.kind === "string";
|
|
25477
25457
|
}
|
|
25478
25458
|
function isTaxonomyFilterCriteriaV12(value) {
|
|
25479
25459
|
if (!isLensFilterCriteria2(value)) return false;
|
|
@@ -25502,6 +25482,9 @@ function validateFilterCriteria2(value) {
|
|
|
25502
25482
|
]
|
|
25503
25483
|
};
|
|
25504
25484
|
}
|
|
25485
|
+
function isRecord11(value) {
|
|
25486
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25487
|
+
}
|
|
25505
25488
|
function validateTaxonomyFilterV1(criteria) {
|
|
25506
25489
|
const errors = [];
|
|
25507
25490
|
if (!Array.isArray(criteria.entityTypeFilters)) {
|
|
@@ -26008,6 +25991,9 @@ function fromBase64(value) {
|
|
|
26008
25991
|
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
26009
25992
|
return decodeURIComponent(escape(atob(normalized)));
|
|
26010
25993
|
}
|
|
25994
|
+
function isRecord12(value) {
|
|
25995
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
25996
|
+
}
|
|
26011
25997
|
function createEventId() {
|
|
26012
25998
|
const random = typeof globalThis.crypto?.randomUUID === "function" ? globalThis.crypto.randomUUID().replace(/-/g, "") : Array.from(
|
|
26013
25999
|
typeof globalThis.crypto?.getRandomValues === "function" ? globalThis.crypto.getRandomValues(new Uint8Array(16)) : Array.from({ length: 16 }, () => Math.floor(Math.random() * 256)),
|
|
@@ -26056,14 +26042,14 @@ function decodeEventCursor(cursor) {
|
|
|
26056
26042
|
}
|
|
26057
26043
|
try {
|
|
26058
26044
|
const parsed = JSON.parse(fromBase64(cursor.trim()));
|
|
26059
|
-
if (typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
26045
|
+
if (!isRecord12(parsed) || typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
26060
26046
|
return null;
|
|
26061
26047
|
}
|
|
26062
26048
|
return {
|
|
26063
26049
|
timestamp: parsed.timestamp,
|
|
26064
26050
|
eventId: parsed.eventId.trim()
|
|
26065
26051
|
};
|
|
26066
|
-
} catch {
|
|
26052
|
+
} catch (error) {
|
|
26067
26053
|
return null;
|
|
26068
26054
|
}
|
|
26069
26055
|
}
|
|
@@ -26092,7 +26078,7 @@ var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"])
|
|
|
26092
26078
|
function normalizeUrl(url) {
|
|
26093
26079
|
try {
|
|
26094
26080
|
return new URL(url.trim());
|
|
26095
|
-
} catch {
|
|
26081
|
+
} catch (error) {
|
|
26096
26082
|
throw new Error("Webhook URL must be a valid absolute URL.");
|
|
26097
26083
|
}
|
|
26098
26084
|
}
|
|
@@ -27802,18 +27788,22 @@ function createWorktreeHandlers(context) {
|
|
|
27802
27788
|
MCP_TOOL_CONTRACTS.add_worktree,
|
|
27803
27789
|
async (params) => {
|
|
27804
27790
|
const topicId = readTopicId4(params);
|
|
27805
|
-
if (!topicId) {
|
|
27806
|
-
throw new Error("add_worktree requires topicId");
|
|
27807
|
-
}
|
|
27808
27791
|
const result = await workflow.addWorktree({
|
|
27809
27792
|
title: readString3(params, "title", { required: true }),
|
|
27810
27793
|
topicId,
|
|
27794
|
+
topicHint: readString3(params, "topicHint"),
|
|
27811
27795
|
branchId: readString3(params, "branchId"),
|
|
27812
27796
|
objective: readString3(params, "objective"),
|
|
27813
27797
|
hypothesis: readString3(params, "hypothesis"),
|
|
27798
|
+
rationale: readString3(params, "rationale"),
|
|
27799
|
+
worktreeType: readString3(params, "worktreeType"),
|
|
27814
27800
|
beliefIds: readStringArray(params, "beliefIds"),
|
|
27815
27801
|
autoShape: readBoolean(params, "autoShape"),
|
|
27816
27802
|
domainPackId: readString3(params, "domainPackId"),
|
|
27803
|
+
tags: readStringArray(params, "tags"),
|
|
27804
|
+
touchedPaths: readStringArray(params, "touchedPaths"),
|
|
27805
|
+
sourceRef: readString3(params, "sourceRef"),
|
|
27806
|
+
sourceKind: readString3(params, "sourceKind"),
|
|
27817
27807
|
campaign: typeof params.campaign === "number" ? params.campaign : void 0,
|
|
27818
27808
|
lane: readString3(params, "lane"),
|
|
27819
27809
|
laneOrderInCampaign: typeof params.laneOrderInCampaign === "number" ? params.laneOrderInCampaign : void 0,
|
|
@@ -27933,8 +27923,8 @@ function loadMcpSdk() {
|
|
|
27933
27923
|
try {
|
|
27934
27924
|
const dynamicRequire = eval("require");
|
|
27935
27925
|
return dynamicRequire("@modelcontextprotocol/sdk") ?? {};
|
|
27936
|
-
} catch {
|
|
27937
|
-
return
|
|
27926
|
+
} catch (error) {
|
|
27927
|
+
return ignoreMcpSdkLoadError();
|
|
27938
27928
|
}
|
|
27939
27929
|
}
|
|
27940
27930
|
var LUCERN_MCP_RESOURCE_URIS = [
|
|
@@ -28022,11 +28012,11 @@ function deriveCustomToolScopes(customTool) {
|
|
|
28022
28012
|
return uniqueScopes(customTool.metadata.requiredScopes ?? ["custom:execute"]);
|
|
28023
28013
|
}
|
|
28024
28014
|
function createFallbackRuntime() {
|
|
28015
|
+
function noop() {
|
|
28016
|
+
}
|
|
28025
28017
|
return {
|
|
28026
|
-
registerResource:
|
|
28027
|
-
|
|
28028
|
-
registerTool: () => {
|
|
28029
|
-
}
|
|
28018
|
+
registerResource: noop,
|
|
28019
|
+
registerTool: noop
|
|
28030
28020
|
};
|
|
28031
28021
|
}
|
|
28032
28022
|
function createMcpRuntime() {
|
|
@@ -28040,7 +28030,7 @@ function createMcpRuntime() {
|
|
|
28040
28030
|
{ name: "lucern-platform-mcp", version: "1.2.0" },
|
|
28041
28031
|
{ capabilities: { resources: {}, tools: {} } }
|
|
28042
28032
|
);
|
|
28043
|
-
} catch {
|
|
28033
|
+
} catch (error) {
|
|
28044
28034
|
return createFallbackRuntime();
|
|
28045
28035
|
}
|
|
28046
28036
|
}
|
|
@@ -28064,15 +28054,14 @@ function executeWithHandler(_name, handler, contract, params) {
|
|
|
28064
28054
|
}
|
|
28065
28055
|
}
|
|
28066
28056
|
function isMcpToolResult(value) {
|
|
28067
|
-
if (!value
|
|
28057
|
+
if (!isRecord13(value)) {
|
|
28068
28058
|
return false;
|
|
28069
28059
|
}
|
|
28070
|
-
|
|
28071
|
-
if (!Array.isArray(candidate.content)) {
|
|
28060
|
+
if (!Array.isArray(value.content)) {
|
|
28072
28061
|
return false;
|
|
28073
28062
|
}
|
|
28074
|
-
return
|
|
28075
|
-
if (!entry
|
|
28063
|
+
return value.content.every((entry) => {
|
|
28064
|
+
if (!isRecord13(entry)) {
|
|
28076
28065
|
return false;
|
|
28077
28066
|
}
|
|
28078
28067
|
return typeof entry.text === "string";
|
|
@@ -28243,6 +28232,12 @@ function createLucernMcpServer(options) {
|
|
|
28243
28232
|
unimplementedToolNames
|
|
28244
28233
|
};
|
|
28245
28234
|
}
|
|
28235
|
+
function isRecord13(value) {
|
|
28236
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28237
|
+
}
|
|
28238
|
+
function ignoreMcpSdkLoadError(_error) {
|
|
28239
|
+
return {};
|
|
28240
|
+
}
|
|
28246
28241
|
|
|
28247
28242
|
// src/standalone.ts
|
|
28248
28243
|
var OBSERVATION_RESOURCE_TEMPLATE = "lucern://observations/topic/{topicId}";
|
|
@@ -28284,6 +28279,9 @@ function resourceName(uri) {
|
|
|
28284
28279
|
return uri.replace("lucern://", "lucern-").replace(/[{}]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
28285
28280
|
}
|
|
28286
28281
|
function readTemplateVar(variables, key) {
|
|
28282
|
+
if (!isRecord14(variables)) {
|
|
28283
|
+
return;
|
|
28284
|
+
}
|
|
28287
28285
|
const value = variables[key];
|
|
28288
28286
|
if (typeof value === "string") {
|
|
28289
28287
|
return value;
|
|
@@ -28296,7 +28294,7 @@ function readTemplateVar(variables, key) {
|
|
|
28296
28294
|
async function notifyResourceUpdated(server, uri) {
|
|
28297
28295
|
try {
|
|
28298
28296
|
await server.server.sendResourceUpdated({ uri });
|
|
28299
|
-
} catch {
|
|
28297
|
+
} catch (error) {
|
|
28300
28298
|
}
|
|
28301
28299
|
}
|
|
28302
28300
|
function registerResources(server, runtime, observationStore) {
|
|
@@ -28357,10 +28355,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28357
28355
|
mimeType: "application/json"
|
|
28358
28356
|
},
|
|
28359
28357
|
async (_uri, variables) => {
|
|
28360
|
-
const topicId = readTemplateVar(
|
|
28361
|
-
variables,
|
|
28362
|
-
"topicId"
|
|
28363
|
-
);
|
|
28358
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28364
28359
|
const records = topicId ? observationStore.list(topicId, 25) : [];
|
|
28365
28360
|
return {
|
|
28366
28361
|
contents: [
|
|
@@ -28393,9 +28388,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28393
28388
|
mimeType: "application/json"
|
|
28394
28389
|
},
|
|
28395
28390
|
async (_uri, variables) => {
|
|
28396
|
-
const
|
|
28397
|
-
const
|
|
28398
|
-
const query5 = readTemplateVar(values, "query");
|
|
28391
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28392
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28399
28393
|
const matches = topicId && query5 ? observationStore.search(topicId, query5, 25) : [];
|
|
28400
28394
|
return {
|
|
28401
28395
|
contents: [
|
|
@@ -28428,10 +28422,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28428
28422
|
mimeType: "application/json"
|
|
28429
28423
|
},
|
|
28430
28424
|
async (_uri, variables) => {
|
|
28431
|
-
const topicId = readTemplateVar(
|
|
28432
|
-
variables,
|
|
28433
|
-
"topicId"
|
|
28434
|
-
);
|
|
28425
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28435
28426
|
const context = topicId ? observationStore.getContext({ topicId, limit: 12 }) : observationStore.getContext({ topicId: "unknown", limit: 12 });
|
|
28436
28427
|
return {
|
|
28437
28428
|
contents: [
|
|
@@ -28455,9 +28446,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28455
28446
|
mimeType: "application/json"
|
|
28456
28447
|
},
|
|
28457
28448
|
async (_uri, variables) => {
|
|
28458
|
-
const
|
|
28459
|
-
const
|
|
28460
|
-
const query5 = readTemplateVar(values, "query");
|
|
28449
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28450
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28461
28451
|
const context = observationStore.getContext({
|
|
28462
28452
|
topicId: topicId ?? "unknown",
|
|
28463
28453
|
query: query5,
|
|
@@ -28483,7 +28473,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28483
28473
|
await notifyResourceUpdated(server, `lucern://context/topic/${encoded}`);
|
|
28484
28474
|
try {
|
|
28485
28475
|
await server.server.sendResourceListChanged();
|
|
28486
|
-
} catch {
|
|
28476
|
+
} catch (error) {
|
|
28487
28477
|
}
|
|
28488
28478
|
};
|
|
28489
28479
|
return { resourceUris, notifyObservationChanged };
|
|
@@ -28523,15 +28513,14 @@ function registerTools(server, runtime) {
|
|
|
28523
28513
|
inputSchema: shape
|
|
28524
28514
|
},
|
|
28525
28515
|
async (args) => {
|
|
28526
|
-
return handler(args, tool.contract);
|
|
28516
|
+
return handler(isRecord14(args) ? args : {}, tool.contract);
|
|
28527
28517
|
}
|
|
28528
28518
|
);
|
|
28529
28519
|
}
|
|
28530
28520
|
}
|
|
28531
28521
|
function createLucernStandaloneMcpServer(options) {
|
|
28532
28522
|
const observationStore = new McpObservationStore();
|
|
28533
|
-
let notifyObservationChanged =
|
|
28534
|
-
};
|
|
28523
|
+
let notifyObservationChanged = noopAsync;
|
|
28535
28524
|
const runtime = createLucernMcpServer({
|
|
28536
28525
|
...options,
|
|
28537
28526
|
observationStore,
|
|
@@ -28541,7 +28530,7 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28541
28530
|
});
|
|
28542
28531
|
const server = new McpServer({
|
|
28543
28532
|
name: "lucern-mcp",
|
|
28544
|
-
version: "0.
|
|
28533
|
+
version: "0.3.0-alpha.7"
|
|
28545
28534
|
});
|
|
28546
28535
|
registerTools(server, runtime);
|
|
28547
28536
|
const resources = registerResources(server, runtime, observationStore);
|
|
@@ -28564,6 +28553,11 @@ async function startLucernMcpStdioServer(options) {
|
|
|
28564
28553
|
await packageServer.server.connect(transport);
|
|
28565
28554
|
return packageServer;
|
|
28566
28555
|
}
|
|
28556
|
+
function isRecord14(value) {
|
|
28557
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28558
|
+
}
|
|
28559
|
+
async function noopAsync() {
|
|
28560
|
+
}
|
|
28567
28561
|
|
|
28568
28562
|
// src/remote.ts
|
|
28569
28563
|
function resolveAuthMode(auth) {
|
|
@@ -29215,10 +29209,14 @@ function parseToolJson(result) {
|
|
|
29215
29209
|
throw new Error("MCP tool returned no text payload");
|
|
29216
29210
|
}
|
|
29217
29211
|
try {
|
|
29218
|
-
|
|
29212
|
+
const parsed = JSON.parse(textBlock.text);
|
|
29213
|
+
if (!isJsonRecord(parsed)) {
|
|
29214
|
+
throw new Error("MCP tool returned non-object JSON payload.");
|
|
29215
|
+
}
|
|
29216
|
+
return parsed;
|
|
29219
29217
|
} catch (error) {
|
|
29220
29218
|
throw new Error(
|
|
29221
|
-
`Failed to parse MCP tool payload: ${
|
|
29219
|
+
`Failed to parse MCP tool payload: ${describeUnknownValue(error)}`
|
|
29222
29220
|
);
|
|
29223
29221
|
}
|
|
29224
29222
|
}
|
|
@@ -29253,7 +29251,7 @@ async function resolveMcpSessionTenantId() {
|
|
|
29253
29251
|
});
|
|
29254
29252
|
const response = await identity.whoami();
|
|
29255
29253
|
return typeof response.data?.tenantId === "string" && response.data.tenantId.trim().length > 0 ? response.data.tenantId.trim() : void 0;
|
|
29256
|
-
} catch {
|
|
29254
|
+
} catch (error) {
|
|
29257
29255
|
return void 0;
|
|
29258
29256
|
}
|
|
29259
29257
|
}
|
|
@@ -29263,13 +29261,41 @@ async function callMcpTool(client, toolName, args) {
|
|
|
29263
29261
|
arguments: args
|
|
29264
29262
|
});
|
|
29265
29263
|
if (result.isError) {
|
|
29266
|
-
throw new Error(`[${toolName}] ${
|
|
29264
|
+
throw new Error(`[${toolName}] ${describeUnknownValue(result.content || [])}`);
|
|
29267
29265
|
}
|
|
29268
29266
|
return parseToolJson(result);
|
|
29269
29267
|
}
|
|
29270
29268
|
async function closeMcpClient(client) {
|
|
29271
29269
|
await client.close();
|
|
29272
29270
|
}
|
|
29271
|
+
function isJsonRecord(value) {
|
|
29272
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
29273
|
+
}
|
|
29274
|
+
function describeUnknownValue(value) {
|
|
29275
|
+
if (value instanceof Error) {
|
|
29276
|
+
return `${value.name}: ${value.message}`;
|
|
29277
|
+
}
|
|
29278
|
+
if (typeof value === "string") {
|
|
29279
|
+
return value;
|
|
29280
|
+
}
|
|
29281
|
+
if (typeof value === "number") {
|
|
29282
|
+
return "numeric value";
|
|
29283
|
+
}
|
|
29284
|
+
if (typeof value === "boolean") {
|
|
29285
|
+
return "boolean value";
|
|
29286
|
+
}
|
|
29287
|
+
if (value === null) {
|
|
29288
|
+
return "null value";
|
|
29289
|
+
}
|
|
29290
|
+
if (value === void 0) {
|
|
29291
|
+
return "undefined value";
|
|
29292
|
+
}
|
|
29293
|
+
if (Array.isArray(value)) {
|
|
29294
|
+
return "array value";
|
|
29295
|
+
}
|
|
29296
|
+
const keys = Object.keys(value);
|
|
29297
|
+
return keys.length > 0 ? `object with keys: ${keys.slice(0, 5).join(", ")}` : "object";
|
|
29298
|
+
}
|
|
29273
29299
|
|
|
29274
29300
|
// src/discovery.ts
|
|
29275
29301
|
async function loadDiscoveryHandlers() {
|