@lucern/mcp 0.3.0-alpha.6 → 0.3.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +969 -946
- package/dist/cli.js.map +1 -1
- package/dist/gateway.js +756 -322
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +878 -936
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.js +997 -942
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +524 -170
- package/dist/runtime.js.map +1 -1
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -30,9 +30,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
30
30
|
};
|
|
31
31
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
32
32
|
|
|
33
|
+
// ../cli/src/guards.ts
|
|
34
|
+
function isRecord(value) {
|
|
35
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
36
|
+
}
|
|
37
|
+
function formatUnknownError(error) {
|
|
38
|
+
if (error instanceof Error) {
|
|
39
|
+
return error.message;
|
|
40
|
+
}
|
|
41
|
+
if (typeof error === "string") {
|
|
42
|
+
return error;
|
|
43
|
+
}
|
|
44
|
+
return String(error);
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
// ../cli/src/types.ts
|
|
34
48
|
var EXIT = {
|
|
49
|
+
ok: 0,
|
|
50
|
+
usage: 2,
|
|
51
|
+
auth: 10,
|
|
35
52
|
config: 11,
|
|
53
|
+
api: 20,
|
|
54
|
+
invariant: 30,
|
|
55
|
+
local: 40,
|
|
36
56
|
unexpected: 70
|
|
37
57
|
};
|
|
38
58
|
var CliError = class extends Error {
|
|
@@ -60,6 +80,34 @@ var CliError = class extends Error {
|
|
|
60
80
|
}
|
|
61
81
|
};
|
|
62
82
|
|
|
83
|
+
// ../cli/src/parse.ts
|
|
84
|
+
function parseJsonValue(value, label) {
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(value);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (error instanceof SyntaxError) {
|
|
89
|
+
throw new CliError({
|
|
90
|
+
code: "USAGE_INVALID_JSON",
|
|
91
|
+
exitCode: EXIT.usage,
|
|
92
|
+
message: `${label} must be valid JSON.`,
|
|
93
|
+
details: formatUnknownError(error)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function parseJsonRecord(value, label) {
|
|
100
|
+
const parsed = parseJsonValue(value, label);
|
|
101
|
+
if (!isRecord(parsed)) {
|
|
102
|
+
throw new CliError({
|
|
103
|
+
code: "USAGE_INVALID_JSON",
|
|
104
|
+
exitCode: EXIT.usage,
|
|
105
|
+
message: `${label} must be a JSON object.`
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return parsed;
|
|
109
|
+
}
|
|
110
|
+
|
|
63
111
|
// ../cli/src/config.ts
|
|
64
112
|
var CONFIG_DIR = ".lucern";
|
|
65
113
|
var CREDENTIALS_FILE = "credentials";
|
|
@@ -80,9 +128,14 @@ function loadProfile(options) {
|
|
|
80
128
|
const profiles = readProfilesFile(profilesPath());
|
|
81
129
|
const localEnv = options.readLocalEnv === false ? {} : readLocalEnvFiles(options.cwd);
|
|
82
130
|
const mergedEnv = { ...localEnv, ...options.env };
|
|
83
|
-
const selected = options.profileName ?? mergedEnv.LUCERN_PROFILE ?? profiles.activeProfile ?? credentials.LUCERN_PROFILE ?? "default";
|
|
84
|
-
const savedProfile = profiles.profiles?.[selected] ?? {};
|
|
85
131
|
const envProfile = profileFromEnvironment(mergedEnv);
|
|
132
|
+
const hasEnvCredentials = Boolean(
|
|
133
|
+
envProfile.apiKey || envProfile.userToken || envProfile.packKey
|
|
134
|
+
);
|
|
135
|
+
const explicitProfileSelected = options.profileName !== void 0 || mergedEnv.LUCERN_PROFILE !== void 0;
|
|
136
|
+
const selectedProfile = options.profileName ?? mergedEnv.LUCERN_PROFILE ?? profiles.activeProfile ?? credentials.LUCERN_PROFILE ?? "default";
|
|
137
|
+
const selected = hasEnvCredentials && !explicitProfileSelected ? "env" : selectedProfile;
|
|
138
|
+
const savedProfile = hasEnvCredentials && !explicitProfileSelected ? {} : profiles.profiles?.[selectedProfile] ?? {};
|
|
86
139
|
const credentialsProfile = {
|
|
87
140
|
apiKey: credentials.LUCERN_API_KEY,
|
|
88
141
|
userToken: readFirst(credentials, ["LUCERN_SESSION_TOKEN", "LUCERN_USER_TOKEN"]),
|
|
@@ -172,13 +225,21 @@ function readProfilesFile(path2) {
|
|
|
172
225
|
return {};
|
|
173
226
|
}
|
|
174
227
|
try {
|
|
175
|
-
|
|
228
|
+
const parsed = parseJsonRecord(readFileSync(path2, "utf8"), path2);
|
|
229
|
+
if (!isProfilesFile(parsed)) {
|
|
230
|
+
throw new CliError({
|
|
231
|
+
code: "CONFIG_INVALID_PROFILE_FILE",
|
|
232
|
+
exitCode: EXIT.config,
|
|
233
|
+
message: `${path2} must be a JSON object with profile definitions.`
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
return parsed;
|
|
176
237
|
} catch (error) {
|
|
177
238
|
throw new CliError({
|
|
178
239
|
code: "CONFIG_INVALID_PROFILE_FILE",
|
|
179
240
|
exitCode: EXIT.config,
|
|
180
241
|
message: `${path2} is not valid JSON.`,
|
|
181
|
-
details: error
|
|
242
|
+
details: formatUnknownError(error)
|
|
182
243
|
});
|
|
183
244
|
}
|
|
184
245
|
}
|
|
@@ -237,12 +298,32 @@ function stripQuotes(value) {
|
|
|
237
298
|
if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
238
299
|
try {
|
|
239
300
|
return JSON.parse(trimmed);
|
|
240
|
-
} catch {
|
|
241
|
-
return
|
|
301
|
+
} catch (error) {
|
|
302
|
+
return ignoreQuotedValueParseError(error, trimmed);
|
|
242
303
|
}
|
|
243
304
|
}
|
|
244
305
|
return trimmed;
|
|
245
306
|
}
|
|
307
|
+
function ignoreQuotedValueParseError(_error, trimmed) {
|
|
308
|
+
return trimmed.slice(1, -1);
|
|
309
|
+
}
|
|
310
|
+
function isProfilesFile(value) {
|
|
311
|
+
if (!isRecord(value)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
if (value.activeProfile !== void 0 && typeof value.activeProfile !== "string") {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
if (value.profiles === void 0) {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
if (!isRecord(value.profiles)) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
return Object.values(value.profiles).every(
|
|
324
|
+
(profile) => profile === void 0 || isRecord(profile)
|
|
325
|
+
);
|
|
326
|
+
}
|
|
246
327
|
|
|
247
328
|
// ../contracts/src/graph-intelligence.contract.ts
|
|
248
329
|
var GRAPH_INTELLIGENCE_QUERY_CATALOG_VERSION = "graph_intelligence_query_catalog.v1";
|
|
@@ -5175,6 +5256,11 @@ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
|
5175
5256
|
role: "sdk_dependency",
|
|
5176
5257
|
directTenantImport: false
|
|
5177
5258
|
},
|
|
5259
|
+
{
|
|
5260
|
+
packageName: "@lucern/graph-sync",
|
|
5261
|
+
role: "host_addon_runtime",
|
|
5262
|
+
directTenantImport: true
|
|
5263
|
+
},
|
|
5178
5264
|
{
|
|
5179
5265
|
packageName: "@lucern/identity",
|
|
5180
5266
|
role: "component_runtime",
|
|
@@ -5463,8 +5549,11 @@ function compactRecord(input) {
|
|
|
5463
5549
|
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
5464
5550
|
);
|
|
5465
5551
|
}
|
|
5552
|
+
function isRecord2(value) {
|
|
5553
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5554
|
+
}
|
|
5466
5555
|
function recordValue(value) {
|
|
5467
|
-
return
|
|
5556
|
+
return isRecord2(value) ? value : {};
|
|
5468
5557
|
}
|
|
5469
5558
|
var createEvidenceProjection = defineProjection({
|
|
5470
5559
|
contractName: "create_evidence",
|
|
@@ -6170,9 +6259,16 @@ var ADD_WORKTREE = {
|
|
|
6170
6259
|
},
|
|
6171
6260
|
projectId: {
|
|
6172
6261
|
type: "string",
|
|
6173
|
-
description: "Legacy topicId alias"
|
|
6262
|
+
description: "Legacy topicId alias or resolver hint"
|
|
6263
|
+
},
|
|
6264
|
+
topicId: {
|
|
6265
|
+
type: "string",
|
|
6266
|
+
description: "Optional topic scope hint for resolver validation"
|
|
6267
|
+
},
|
|
6268
|
+
topicHint: {
|
|
6269
|
+
type: "string",
|
|
6270
|
+
description: "Natural-language topic hint for automatic topic resolution"
|
|
6174
6271
|
},
|
|
6175
|
-
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
6176
6272
|
branchId: {
|
|
6177
6273
|
type: "string",
|
|
6178
6274
|
description: "The branch this worktree investigates"
|
|
@@ -6270,6 +6366,22 @@ var ADD_WORKTREE = {
|
|
|
6270
6366
|
type: "string",
|
|
6271
6367
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
6272
6368
|
},
|
|
6369
|
+
tags: {
|
|
6370
|
+
type: "array",
|
|
6371
|
+
description: "Additional topic-resolution tags for the worktree"
|
|
6372
|
+
},
|
|
6373
|
+
touchedPaths: {
|
|
6374
|
+
type: "array",
|
|
6375
|
+
description: "File paths used as topic-resolution signals"
|
|
6376
|
+
},
|
|
6377
|
+
sourceRef: {
|
|
6378
|
+
type: "string",
|
|
6379
|
+
description: "Source reference used as a topic-resolution signal"
|
|
6380
|
+
},
|
|
6381
|
+
sourceKind: {
|
|
6382
|
+
type: "string",
|
|
6383
|
+
description: "Source kind used as a topic-resolution signal"
|
|
6384
|
+
},
|
|
6273
6385
|
campaign: {
|
|
6274
6386
|
type: "number",
|
|
6275
6387
|
description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
|
|
@@ -6307,7 +6419,7 @@ var ADD_WORKTREE = {
|
|
|
6307
6419
|
description: "Timestamp when worktree metadata was last reconciled"
|
|
6308
6420
|
}
|
|
6309
6421
|
},
|
|
6310
|
-
required: ["title"
|
|
6422
|
+
required: ["title"],
|
|
6311
6423
|
response: {
|
|
6312
6424
|
description: "The created worktree",
|
|
6313
6425
|
fields: {
|
|
@@ -7804,15 +7916,15 @@ var IDENTITY_WHOAMI = {
|
|
|
7804
7916
|
};
|
|
7805
7917
|
var COMPILE_CONTEXT = {
|
|
7806
7918
|
name: "compile_context",
|
|
7807
|
-
description: "Compile a focused reasoning context
|
|
7919
|
+
description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
|
|
7808
7920
|
parameters: {
|
|
7809
7921
|
topicId: {
|
|
7810
7922
|
type: "string",
|
|
7811
|
-
description: "
|
|
7923
|
+
description: "Optional topic scope ID. Omit to resolve the topic from query."
|
|
7812
7924
|
},
|
|
7813
7925
|
query: {
|
|
7814
7926
|
type: "string",
|
|
7815
|
-
description: "
|
|
7927
|
+
description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
|
|
7816
7928
|
},
|
|
7817
7929
|
budget: {
|
|
7818
7930
|
type: "number",
|
|
@@ -7836,7 +7948,7 @@ var COMPILE_CONTEXT = {
|
|
|
7836
7948
|
description: "Include related ontological entities in the compiled result"
|
|
7837
7949
|
}
|
|
7838
7950
|
},
|
|
7839
|
-
required: [
|
|
7951
|
+
required: [],
|
|
7840
7952
|
response: {
|
|
7841
7953
|
description: "Compiled context pack for the requested topic",
|
|
7842
7954
|
fields: {
|
|
@@ -8010,18 +8122,60 @@ var CREATE_TASK = {
|
|
|
8010
8122
|
name: "create_task",
|
|
8011
8123
|
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.",
|
|
8012
8124
|
parameters: {
|
|
8013
|
-
title: { type: "string", description: "Task
|
|
8125
|
+
title: { type: "string", description: "Task title" },
|
|
8014
8126
|
topicId: { type: "string", description: "Topic scope" },
|
|
8127
|
+
description: {
|
|
8128
|
+
type: "string",
|
|
8129
|
+
description: "Long-form task description"
|
|
8130
|
+
},
|
|
8015
8131
|
taskType: {
|
|
8016
8132
|
type: "string",
|
|
8017
|
-
description: "
|
|
8018
|
-
enum: [
|
|
8133
|
+
description: "Task taxonomy",
|
|
8134
|
+
enum: [
|
|
8135
|
+
"general",
|
|
8136
|
+
"find_evidence",
|
|
8137
|
+
"verify_claim",
|
|
8138
|
+
"research",
|
|
8139
|
+
"review",
|
|
8140
|
+
"interview",
|
|
8141
|
+
"analysis",
|
|
8142
|
+
"track_metrics"
|
|
8143
|
+
]
|
|
8144
|
+
},
|
|
8145
|
+
priority: {
|
|
8146
|
+
type: "string",
|
|
8147
|
+
description: "Priority",
|
|
8148
|
+
enum: ["urgent", "high", "medium", "low"]
|
|
8149
|
+
},
|
|
8150
|
+
status: {
|
|
8151
|
+
type: "string",
|
|
8152
|
+
description: "Initial status (defaults to todo)",
|
|
8153
|
+
enum: ["todo", "in_progress", "blocked", "done"]
|
|
8154
|
+
},
|
|
8155
|
+
linkedWorktreeId: {
|
|
8156
|
+
type: "string",
|
|
8157
|
+
description: "Worktree this task belongs to"
|
|
8158
|
+
},
|
|
8159
|
+
linkedBeliefId: {
|
|
8160
|
+
type: "string",
|
|
8161
|
+
description: "Belief this task supports"
|
|
8019
8162
|
},
|
|
8020
8163
|
linkedQuestionId: {
|
|
8021
8164
|
type: "string",
|
|
8022
8165
|
description: "Question this task addresses"
|
|
8023
8166
|
},
|
|
8024
|
-
|
|
8167
|
+
assigneeId: {
|
|
8168
|
+
type: "string",
|
|
8169
|
+
description: "Principal assigned to the task"
|
|
8170
|
+
},
|
|
8171
|
+
dueDate: {
|
|
8172
|
+
type: "number",
|
|
8173
|
+
description: "Due date as epoch milliseconds"
|
|
8174
|
+
},
|
|
8175
|
+
tags: {
|
|
8176
|
+
type: "array",
|
|
8177
|
+
description: "Free-form string tags"
|
|
8178
|
+
}
|
|
8025
8179
|
},
|
|
8026
8180
|
required: ["title"],
|
|
8027
8181
|
response: {
|
|
@@ -10116,9 +10270,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
|
|
|
10116
10270
|
required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
|
|
10117
10271
|
};
|
|
10118
10272
|
}
|
|
10119
|
-
|
|
10120
|
-
return contract;
|
|
10121
|
-
}
|
|
10273
|
+
var defineFunctionContract = (contract) => contract;
|
|
10122
10274
|
function authUserId(context) {
|
|
10123
10275
|
return context.userId ?? context.principalId ?? "lucern-agent";
|
|
10124
10276
|
}
|
|
@@ -10272,6 +10424,9 @@ var observationContextArgs = z.object({
|
|
|
10272
10424
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
10273
10425
|
status: z.string().optional().describe("Observation status filter.")
|
|
10274
10426
|
});
|
|
10427
|
+
function isRecord3(value) {
|
|
10428
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
10429
|
+
}
|
|
10275
10430
|
var observationInput = (input, context) => withUserId(
|
|
10276
10431
|
compactRecord4({
|
|
10277
10432
|
projectId: input.projectId,
|
|
@@ -10304,7 +10459,7 @@ var contextContracts = [
|
|
|
10304
10459
|
path: "/context/compile",
|
|
10305
10460
|
sdkNamespace: "context",
|
|
10306
10461
|
sdkMethod: "compileContext",
|
|
10307
|
-
summary: "Compile a focused reasoning context
|
|
10462
|
+
summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
|
|
10308
10463
|
convex: {
|
|
10309
10464
|
module: "contextCompiler",
|
|
10310
10465
|
functionName: "compile",
|
|
@@ -10326,8 +10481,8 @@ var contextContracts = [
|
|
|
10326
10481
|
kind: "mutation",
|
|
10327
10482
|
inputProjection: observationInput,
|
|
10328
10483
|
outputProjection: (output, input) => ({
|
|
10329
|
-
...output
|
|
10330
|
-
observationId: output
|
|
10484
|
+
...isRecord3(output) ? output : {},
|
|
10485
|
+
observationId: isRecord3(output) ? output.nodeId : void 0,
|
|
10331
10486
|
observationType: input.observationType
|
|
10332
10487
|
})
|
|
10333
10488
|
},
|
|
@@ -11808,10 +11963,11 @@ var worktreeDecisionGateInputSchema = z.object({
|
|
|
11808
11963
|
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
11809
11964
|
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
11810
11965
|
var addWorktreeArgs = z.object({
|
|
11811
|
-
title: z.string().
|
|
11966
|
+
title: z.string().describe("Human-readable worktree name or objective."),
|
|
11812
11967
|
name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
|
|
11813
|
-
topicId: z.string().describe("
|
|
11814
|
-
projectId: z.string().optional().describe("Legacy topicId alias."),
|
|
11968
|
+
topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
|
|
11969
|
+
projectId: z.string().optional().describe("Legacy topicId alias/hint."),
|
|
11970
|
+
topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
|
|
11815
11971
|
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
11816
11972
|
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
11817
11973
|
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
@@ -11836,6 +11992,10 @@ var addWorktreeArgs = z.object({
|
|
|
11836
11992
|
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
11837
11993
|
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
11838
11994
|
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
11995
|
+
tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
|
|
11996
|
+
touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
|
|
11997
|
+
sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
|
|
11998
|
+
sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
|
|
11839
11999
|
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
11840
12000
|
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
11841
12001
|
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
@@ -12165,8 +12325,46 @@ var worktreesContracts = [
|
|
|
12165
12325
|
args: openPullRequestArgs
|
|
12166
12326
|
})
|
|
12167
12327
|
];
|
|
12168
|
-
|
|
12169
|
-
|
|
12328
|
+
var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
12329
|
+
var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
|
|
12330
|
+
var taskTypeSchema = z.enum([
|
|
12331
|
+
"general",
|
|
12332
|
+
"find_evidence",
|
|
12333
|
+
"verify_claim",
|
|
12334
|
+
"research",
|
|
12335
|
+
"review",
|
|
12336
|
+
"interview",
|
|
12337
|
+
"analysis",
|
|
12338
|
+
"track_metrics"
|
|
12339
|
+
]);
|
|
12340
|
+
var createTaskArgs = z.object({
|
|
12341
|
+
title: z.string().describe("Task title."),
|
|
12342
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12343
|
+
description: z.string().optional().describe("Long-form task description."),
|
|
12344
|
+
taskType: taskTypeSchema.optional().describe("Task taxonomy."),
|
|
12345
|
+
priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
|
|
12346
|
+
status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
|
|
12347
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
|
|
12348
|
+
linkedBeliefId: z.string().optional().describe("Belief this task supports."),
|
|
12349
|
+
linkedQuestionId: z.string().optional().describe("Question this task addresses."),
|
|
12350
|
+
assigneeId: z.string().optional().describe("Principal assigned to the task."),
|
|
12351
|
+
dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
|
|
12352
|
+
tags: z.array(z.string()).optional().describe("Free-form tags.")
|
|
12353
|
+
});
|
|
12354
|
+
var createTaskInput = (input) => compactRecord4({
|
|
12355
|
+
title: input.title,
|
|
12356
|
+
topicId: input.topicId,
|
|
12357
|
+
description: input.description,
|
|
12358
|
+
taskType: input.taskType,
|
|
12359
|
+
priority: input.priority ?? "medium",
|
|
12360
|
+
status: input.status ?? "todo",
|
|
12361
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
12362
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
12363
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
12364
|
+
assigneeId: input.assigneeId,
|
|
12365
|
+
dueDate: input.dueDate,
|
|
12366
|
+
tags: input.tags
|
|
12367
|
+
});
|
|
12170
12368
|
var taskInput = (input) => compactRecord4({
|
|
12171
12369
|
...input,
|
|
12172
12370
|
taskId: input.taskId ?? input.id
|
|
@@ -12198,8 +12396,10 @@ var tasksContracts = [
|
|
|
12198
12396
|
convex: {
|
|
12199
12397
|
module: "tasks",
|
|
12200
12398
|
functionName: "create",
|
|
12201
|
-
kind: "mutation"
|
|
12202
|
-
|
|
12399
|
+
kind: "mutation",
|
|
12400
|
+
inputProjection: createTaskInput
|
|
12401
|
+
},
|
|
12402
|
+
args: createTaskArgs
|
|
12203
12403
|
}),
|
|
12204
12404
|
surfaceContract({
|
|
12205
12405
|
name: "list_tasks",
|
|
@@ -13318,9 +13518,12 @@ var ALL_FUNCTION_CONTRACTS = [
|
|
|
13318
13518
|
];
|
|
13319
13519
|
assertSurfaceCoverage(ALL_FUNCTION_CONTRACTS);
|
|
13320
13520
|
var FUNCTION_SURFACE_CONTRACTS = ALL_FUNCTION_CONTRACTS;
|
|
13321
|
-
new Map(
|
|
13521
|
+
var FUNCTION_CONTRACTS_BY_NAME = new Map(
|
|
13322
13522
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
13323
13523
|
);
|
|
13524
|
+
FUNCTION_CONTRACTS_BY_NAME.get.bind(
|
|
13525
|
+
FUNCTION_CONTRACTS_BY_NAME
|
|
13526
|
+
);
|
|
13324
13527
|
|
|
13325
13528
|
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
13326
13529
|
function isCopyableSeedRequirement(entry) {
|
|
@@ -13966,10 +14169,18 @@ function isInfisicalRuntimeDisabled(env = {}) {
|
|
|
13966
14169
|
}
|
|
13967
14170
|
async function hydrateInfisicalRuntimeEnv(options) {
|
|
13968
14171
|
const env = options.env ?? {};
|
|
13969
|
-
const
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
14172
|
+
const baseBootstrap = readInfisicalRuntimeBootstrap(env, options.bootstrap);
|
|
14173
|
+
const bootstrap = baseBootstrap ? {
|
|
14174
|
+
...baseBootstrap,
|
|
14175
|
+
...Object.fromEntries(
|
|
14176
|
+
Object.entries(options.bootstrap ?? {}).filter(
|
|
14177
|
+
([, value]) => value !== void 0
|
|
14178
|
+
)
|
|
14179
|
+
),
|
|
14180
|
+
apiUrl: trimTrailingSlash(
|
|
14181
|
+
options.bootstrap?.apiUrl ?? baseBootstrap.apiUrl
|
|
14182
|
+
)
|
|
14183
|
+
} : null;
|
|
13973
14184
|
if (!bootstrap) {
|
|
13974
14185
|
return {
|
|
13975
14186
|
status: "disabled",
|
|
@@ -14065,16 +14276,6 @@ function normalizeInfisicalEnvironment(value) {
|
|
|
14065
14276
|
}
|
|
14066
14277
|
return "prod";
|
|
14067
14278
|
}
|
|
14068
|
-
function mergeBootstrap(base, overrides) {
|
|
14069
|
-
if (!base) {
|
|
14070
|
-
return null;
|
|
14071
|
-
}
|
|
14072
|
-
return {
|
|
14073
|
-
...base,
|
|
14074
|
-
...compact(overrides ?? {}),
|
|
14075
|
-
apiUrl: trimTrailingSlash(overrides?.apiUrl ?? base.apiUrl)
|
|
14076
|
-
};
|
|
14077
|
-
}
|
|
14078
14279
|
async function loginWithUniversalAuth(bootstrap, fetchImpl) {
|
|
14079
14280
|
const response = await fetchImpl(
|
|
14080
14281
|
`${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
|
|
@@ -14159,14 +14360,18 @@ async function readSecretValue(args) {
|
|
|
14159
14360
|
async function readJson(response) {
|
|
14160
14361
|
try {
|
|
14161
14362
|
return await response.json();
|
|
14162
|
-
} catch {
|
|
14363
|
+
} catch (error) {
|
|
14364
|
+
debugInfisicalRuntimeFallback("response.json", error);
|
|
14163
14365
|
return void 0;
|
|
14164
14366
|
}
|
|
14165
14367
|
}
|
|
14368
|
+
function isRecord4(value) {
|
|
14369
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14370
|
+
}
|
|
14166
14371
|
function readNestedString(value, path2) {
|
|
14167
14372
|
let current = value;
|
|
14168
14373
|
for (const key of path2) {
|
|
14169
|
-
if (!current ||
|
|
14374
|
+
if (!isRecord4(current) || !(key in current)) {
|
|
14170
14375
|
return null;
|
|
14171
14376
|
}
|
|
14172
14377
|
current = current[key];
|
|
@@ -14174,13 +14379,12 @@ function readNestedString(value, path2) {
|
|
|
14174
14379
|
return typeof current === "string" && current.length > 0 ? current : null;
|
|
14175
14380
|
}
|
|
14176
14381
|
function messageFromBody(body4) {
|
|
14177
|
-
if (!body4
|
|
14382
|
+
if (!isRecord4(body4)) {
|
|
14178
14383
|
return "no response body";
|
|
14179
14384
|
}
|
|
14180
|
-
const record = body4;
|
|
14181
14385
|
for (const key of ["message", "error", "errorMessage"]) {
|
|
14182
|
-
if (typeof
|
|
14183
|
-
return
|
|
14386
|
+
if (typeof body4[key] === "string") {
|
|
14387
|
+
return body4[key];
|
|
14184
14388
|
}
|
|
14185
14389
|
}
|
|
14186
14390
|
return JSON.stringify(body4);
|
|
@@ -14200,10 +14404,32 @@ function isTruthyEnv(value) {
|
|
|
14200
14404
|
function trimTrailingSlash(value) {
|
|
14201
14405
|
return value.replace(/\/+$/u, "");
|
|
14202
14406
|
}
|
|
14203
|
-
function
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14407
|
+
function debugInfisicalRuntimeFallback(message, error) {
|
|
14408
|
+
const env = globalThis.process?.env;
|
|
14409
|
+
if (env?.LUCERN_COMPAT_FALLBACK_DEBUG !== "1" && env?.LUCERN_INFISICAL_RUNTIME_DEBUG !== "1") {
|
|
14410
|
+
return;
|
|
14411
|
+
}
|
|
14412
|
+
console.debug(`[infisical-runtime] ${message}`, {
|
|
14413
|
+
error: formatInfisicalRuntimeError(error)
|
|
14414
|
+
});
|
|
14415
|
+
}
|
|
14416
|
+
function formatInfisicalRuntimeError(error) {
|
|
14417
|
+
if (error instanceof Error) {
|
|
14418
|
+
return `${error.name}: ${error.message}`;
|
|
14419
|
+
}
|
|
14420
|
+
if (typeof error === "string") {
|
|
14421
|
+
return error;
|
|
14422
|
+
}
|
|
14423
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
14424
|
+
return String(error);
|
|
14425
|
+
}
|
|
14426
|
+
if (error && typeof error === "object") {
|
|
14427
|
+
const keys = Object.keys(error).slice(0, 5);
|
|
14428
|
+
if (keys.length > 0) {
|
|
14429
|
+
return `Unknown Infisical runtime error object with keys: ${keys.join(", ")}`;
|
|
14430
|
+
}
|
|
14431
|
+
}
|
|
14432
|
+
return "Unknown Infisical runtime error shape";
|
|
14207
14433
|
}
|
|
14208
14434
|
|
|
14209
14435
|
// src/infisical-runtime.ts
|
|
@@ -14560,6 +14786,7 @@ __export(src_exports, {
|
|
|
14560
14786
|
WORKTREE_PHASES: () => WORKTREE_PHASES,
|
|
14561
14787
|
applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
|
|
14562
14788
|
asListItems: () => asListItems,
|
|
14789
|
+
asRecord: () => asRecord,
|
|
14563
14790
|
assertValidWebhookSecret: () => assertValidWebhookSecret,
|
|
14564
14791
|
assertValidWebhookUrl: () => assertValidWebhookUrl,
|
|
14565
14792
|
buildDeprecatedBranchMetadata: () => buildDeprecatedBranchMetadata,
|
|
@@ -14631,6 +14858,7 @@ __export(src_exports, {
|
|
|
14631
14858
|
isLensFilterCriteria: () => isLensFilterCriteria2,
|
|
14632
14859
|
isLucernPrompt: () => isLucernPrompt,
|
|
14633
14860
|
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
14861
|
+
isRecord: () => isRecord6,
|
|
14634
14862
|
isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV12,
|
|
14635
14863
|
lastDelegator: () => lastDelegator,
|
|
14636
14864
|
listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
|
|
@@ -14940,9 +15168,7 @@ function generatePortableRequestId() {
|
|
|
14940
15168
|
8
|
|
14941
15169
|
).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
14942
15170
|
}
|
|
14943
|
-
|
|
14944
|
-
return generatePortableRequestId();
|
|
14945
|
-
}
|
|
15171
|
+
var randomIdempotencyKey = generatePortableRequestId;
|
|
14946
15172
|
function isRetryableStatus(status) {
|
|
14947
15173
|
return status >= 500 || status === 408 || status === 429;
|
|
14948
15174
|
}
|
|
@@ -15007,8 +15233,11 @@ function timeoutError(timeoutMs) {
|
|
|
15007
15233
|
error.name = "AbortError";
|
|
15008
15234
|
return error;
|
|
15009
15235
|
}
|
|
15236
|
+
function isRecord5(value) {
|
|
15237
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15238
|
+
}
|
|
15010
15239
|
function readPolicySummaryFromDetails(details) {
|
|
15011
|
-
if (!
|
|
15240
|
+
if (!isRecord5(details)) {
|
|
15012
15241
|
return null;
|
|
15013
15242
|
}
|
|
15014
15243
|
const directSummary = details.summary;
|
|
@@ -15016,11 +15245,11 @@ function readPolicySummaryFromDetails(details) {
|
|
|
15016
15245
|
return directSummary.trim();
|
|
15017
15246
|
}
|
|
15018
15247
|
const policy = details.policy;
|
|
15019
|
-
if (!
|
|
15248
|
+
if (!isRecord5(policy)) {
|
|
15020
15249
|
return null;
|
|
15021
15250
|
}
|
|
15022
15251
|
const explanation = policy.explanation;
|
|
15023
|
-
if (!
|
|
15252
|
+
if (!isRecord5(explanation)) {
|
|
15024
15253
|
return null;
|
|
15025
15254
|
}
|
|
15026
15255
|
const nestedSummary = explanation.summary;
|
|
@@ -15084,11 +15313,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15084
15313
|
if (!text) {
|
|
15085
15314
|
return null;
|
|
15086
15315
|
}
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
} catch {
|
|
15316
|
+
const parsed = tryParseGatewayEnvelopeJson(text);
|
|
15317
|
+
if (!parsed.ok) {
|
|
15090
15318
|
return null;
|
|
15091
15319
|
}
|
|
15320
|
+
return isRecord5(parsed.value) ? parsed.value : null;
|
|
15092
15321
|
}
|
|
15093
15322
|
function resolveTimeoutMs(method, requestTimeoutMs) {
|
|
15094
15323
|
if (typeof requestTimeoutMs === "number") {
|
|
@@ -15100,16 +15329,31 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15100
15329
|
}
|
|
15101
15330
|
return config.timeoutMs ?? 15e3;
|
|
15102
15331
|
}
|
|
15332
|
+
function tryParseGatewayEnvelopeJson(text) {
|
|
15333
|
+
const trimmed = text.trim();
|
|
15334
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
15335
|
+
return { ok: false, reason: "non-json" };
|
|
15336
|
+
}
|
|
15337
|
+
try {
|
|
15338
|
+
return { ok: true, value: JSON.parse(trimmed) };
|
|
15339
|
+
} catch (error) {
|
|
15340
|
+
if (error instanceof SyntaxError) {
|
|
15341
|
+
return { ok: false, reason: "invalid-json", error };
|
|
15342
|
+
}
|
|
15343
|
+
throw error;
|
|
15344
|
+
}
|
|
15345
|
+
}
|
|
15103
15346
|
function buildApiError(args) {
|
|
15104
15347
|
const failure = args.failure;
|
|
15105
|
-
const legacyError = failure &&
|
|
15348
|
+
const legacyError = failure && isRecord5(failure.error) ? failure.error : failure?.legacyError;
|
|
15106
15349
|
const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
|
|
15107
15350
|
const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
|
|
15108
15351
|
const details = failure?.details ?? legacyError?.details;
|
|
15109
15352
|
const policySummary = readPolicySummaryFromDetails(details);
|
|
15353
|
+
const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
|
|
15110
15354
|
return new LucernApiError({
|
|
15111
15355
|
code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
|
|
15112
|
-
message: policySummary ??
|
|
15356
|
+
message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
|
|
15113
15357
|
status: args.response.status,
|
|
15114
15358
|
invariant: failure?.invariant,
|
|
15115
15359
|
suggestion: failure?.suggestion,
|
|
@@ -15235,8 +15479,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
15235
15479
|
}
|
|
15236
15480
|
|
|
15237
15481
|
// ../sdk/src/sdkSurface.ts
|
|
15482
|
+
function isRecord6(value) {
|
|
15483
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15484
|
+
}
|
|
15238
15485
|
function asRecord(value) {
|
|
15239
|
-
return value
|
|
15486
|
+
return isRecord6(value) ? value : {};
|
|
15240
15487
|
}
|
|
15241
15488
|
function cleanString2(value) {
|
|
15242
15489
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
@@ -15297,9 +15544,7 @@ function normalizeNodeWriteInput(value) {
|
|
|
15297
15544
|
}
|
|
15298
15545
|
return next;
|
|
15299
15546
|
}
|
|
15300
|
-
|
|
15301
|
-
return normalizeVerificationStatus(value);
|
|
15302
|
-
}
|
|
15547
|
+
var normalizeNodeVerificationStatus = normalizeVerificationStatus;
|
|
15303
15548
|
function normalizeTopicQuery(value) {
|
|
15304
15549
|
const topicId = cleanString2(value.topicId);
|
|
15305
15550
|
if (!topicId) {
|
|
@@ -15326,7 +15571,10 @@ function createListResult(items, legacyKey) {
|
|
|
15326
15571
|
total: items.length
|
|
15327
15572
|
};
|
|
15328
15573
|
if (legacyKey) {
|
|
15329
|
-
|
|
15574
|
+
return {
|
|
15575
|
+
...result,
|
|
15576
|
+
[legacyKey]: items
|
|
15577
|
+
};
|
|
15330
15578
|
}
|
|
15331
15579
|
return result;
|
|
15332
15580
|
}
|
|
@@ -15370,6 +15618,17 @@ function asTenantVaultSecretArray(data) {
|
|
|
15370
15618
|
}
|
|
15371
15619
|
function createAdminClient(config = {}) {
|
|
15372
15620
|
const gateway = createGatewayRequestClient(config);
|
|
15621
|
+
const getControlObjectOwnership = async () => gateway.request({
|
|
15622
|
+
path: "/api/platform/v1/admin/control-ownership"
|
|
15623
|
+
});
|
|
15624
|
+
const createMembership = async (input, idempotencyKey) => gateway.request({
|
|
15625
|
+
path: "/api/platform/v1/memberships",
|
|
15626
|
+
method: "POST",
|
|
15627
|
+
body: input,
|
|
15628
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15629
|
+
});
|
|
15630
|
+
const updateMembership = createMembership;
|
|
15631
|
+
const upsertMembership = createMembership;
|
|
15373
15632
|
return {
|
|
15374
15633
|
/**
|
|
15375
15634
|
* List tenants visible to the current principal.
|
|
@@ -15401,19 +15660,11 @@ function createAdminClient(config = {}) {
|
|
|
15401
15660
|
/**
|
|
15402
15661
|
* Get the control-object ownership contract.
|
|
15403
15662
|
*/
|
|
15404
|
-
|
|
15405
|
-
return gateway.request({
|
|
15406
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
15407
|
-
});
|
|
15408
|
-
},
|
|
15663
|
+
getControlObjectOwnership,
|
|
15409
15664
|
/**
|
|
15410
15665
|
* @deprecated Use getControlObjectOwnership.
|
|
15411
15666
|
*/
|
|
15412
|
-
|
|
15413
|
-
return gateway.request({
|
|
15414
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
15415
|
-
});
|
|
15416
|
-
},
|
|
15667
|
+
getControlObjectOwnershipContract: getControlObjectOwnership,
|
|
15417
15668
|
/**
|
|
15418
15669
|
* List workspaces for the current admin scope.
|
|
15419
15670
|
*/
|
|
@@ -15460,26 +15711,15 @@ function createAdminClient(config = {}) {
|
|
|
15460
15711
|
/**
|
|
15461
15712
|
* Create a membership.
|
|
15462
15713
|
*/
|
|
15463
|
-
|
|
15464
|
-
return gateway.request({
|
|
15465
|
-
path: "/api/platform/v1/memberships",
|
|
15466
|
-
method: "POST",
|
|
15467
|
-
body: input,
|
|
15468
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15469
|
-
});
|
|
15470
|
-
},
|
|
15714
|
+
createMembership,
|
|
15471
15715
|
/**
|
|
15472
15716
|
* Update a membership.
|
|
15473
15717
|
*/
|
|
15474
|
-
|
|
15475
|
-
return this.createMembership(input, idempotencyKey);
|
|
15476
|
-
},
|
|
15718
|
+
updateMembership,
|
|
15477
15719
|
/**
|
|
15478
15720
|
* @deprecated Use createMembership or updateMembership.
|
|
15479
15721
|
*/
|
|
15480
|
-
|
|
15481
|
-
return this.createMembership(input, idempotencyKey);
|
|
15482
|
-
},
|
|
15722
|
+
upsertMembership,
|
|
15483
15723
|
/**
|
|
15484
15724
|
* List tenant API keys in the current admin scope.
|
|
15485
15725
|
*/
|
|
@@ -15761,115 +16001,111 @@ function createAnswersClient(config = {}) {
|
|
|
15761
16001
|
// ../sdk/src/audiencesClient.ts
|
|
15762
16002
|
function createAudiencesClient(config = {}) {
|
|
15763
16003
|
const gateway = createGatewayRequestClient(config);
|
|
16004
|
+
const listRegistry = async (query5 = {}) => {
|
|
16005
|
+
return gateway.request({
|
|
16006
|
+
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
16007
|
+
...query5,
|
|
16008
|
+
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
16009
|
+
status: query5.status
|
|
16010
|
+
})}`
|
|
16011
|
+
}).then(
|
|
16012
|
+
(response) => mapGatewayData(
|
|
16013
|
+
response,
|
|
16014
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
|
|
16015
|
+
)
|
|
16016
|
+
);
|
|
16017
|
+
};
|
|
16018
|
+
const createRegistryEntry = async (input, idempotencyKey) => {
|
|
16019
|
+
return gateway.request({
|
|
16020
|
+
path: "/api/platform/v1/audiences/registry",
|
|
16021
|
+
method: "POST",
|
|
16022
|
+
body: input,
|
|
16023
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16024
|
+
});
|
|
16025
|
+
};
|
|
16026
|
+
const updateRegistryEntry = createRegistryEntry;
|
|
16027
|
+
const upsertRegistry = createRegistryEntry;
|
|
16028
|
+
const getRegistry = listRegistry;
|
|
16029
|
+
const listGrants = async (query5 = {}) => {
|
|
16030
|
+
return gateway.request({
|
|
16031
|
+
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
16032
|
+
...query5,
|
|
16033
|
+
audienceKey: query5.audienceKey,
|
|
16034
|
+
principalId: query5.principalId,
|
|
16035
|
+
groupId: query5.groupId,
|
|
16036
|
+
status: query5.status
|
|
16037
|
+
})}`
|
|
16038
|
+
}).then(
|
|
16039
|
+
(response) => mapGatewayData(
|
|
16040
|
+
response,
|
|
16041
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
16042
|
+
)
|
|
16043
|
+
);
|
|
16044
|
+
};
|
|
16045
|
+
const createGrant = async (input, idempotencyKey) => {
|
|
16046
|
+
return gateway.request({
|
|
16047
|
+
path: "/api/platform/v1/audiences/grants",
|
|
16048
|
+
method: "POST",
|
|
16049
|
+
body: input,
|
|
16050
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16051
|
+
});
|
|
16052
|
+
};
|
|
16053
|
+
const getGrants = listGrants;
|
|
16054
|
+
const grant = createGrant;
|
|
16055
|
+
const deleteGrant = async (input, idempotencyKey) => {
|
|
16056
|
+
return gateway.request({
|
|
16057
|
+
path: "/api/platform/v1/audiences/grants/revoke",
|
|
16058
|
+
method: "POST",
|
|
16059
|
+
body: input,
|
|
16060
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16061
|
+
});
|
|
16062
|
+
};
|
|
16063
|
+
const revokeGrant = deleteGrant;
|
|
15764
16064
|
return {
|
|
15765
16065
|
/**
|
|
15766
16066
|
* List audience registry entries.
|
|
15767
16067
|
*/
|
|
15768
|
-
|
|
15769
|
-
return gateway.request({
|
|
15770
|
-
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
15771
|
-
...query5,
|
|
15772
|
-
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
15773
|
-
status: query5.status
|
|
15774
|
-
})}`
|
|
15775
|
-
}).then(
|
|
15776
|
-
(response) => mapGatewayData(
|
|
15777
|
-
response,
|
|
15778
|
-
(data) => createListResult(
|
|
15779
|
-
Array.isArray(data) ? data : [],
|
|
15780
|
-
"registryEntries"
|
|
15781
|
-
)
|
|
15782
|
-
)
|
|
15783
|
-
);
|
|
15784
|
-
},
|
|
16068
|
+
listRegistry,
|
|
15785
16069
|
/**
|
|
15786
16070
|
* @deprecated Use listRegistry.
|
|
15787
16071
|
*/
|
|
15788
|
-
|
|
15789
|
-
return this.listRegistry(query5);
|
|
15790
|
-
},
|
|
16072
|
+
getRegistry,
|
|
15791
16073
|
/**
|
|
15792
16074
|
* Create an audience registry entry.
|
|
15793
16075
|
*/
|
|
15794
|
-
|
|
15795
|
-
return gateway.request({
|
|
15796
|
-
path: "/api/platform/v1/audiences/registry",
|
|
15797
|
-
method: "POST",
|
|
15798
|
-
body: input,
|
|
15799
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15800
|
-
});
|
|
15801
|
-
},
|
|
16076
|
+
createRegistryEntry,
|
|
15802
16077
|
/**
|
|
15803
16078
|
* Update an audience registry entry.
|
|
15804
16079
|
*/
|
|
15805
|
-
|
|
15806
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
15807
|
-
},
|
|
16080
|
+
updateRegistryEntry,
|
|
15808
16081
|
/**
|
|
15809
16082
|
* @deprecated Use createRegistryEntry or updateRegistryEntry.
|
|
15810
16083
|
*/
|
|
15811
|
-
|
|
15812
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
15813
|
-
},
|
|
16084
|
+
upsertRegistry,
|
|
15814
16085
|
/**
|
|
15815
16086
|
* List audience grants.
|
|
15816
16087
|
*/
|
|
15817
|
-
|
|
15818
|
-
return gateway.request({
|
|
15819
|
-
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
15820
|
-
...query5,
|
|
15821
|
-
audienceKey: query5.audienceKey,
|
|
15822
|
-
principalId: query5.principalId,
|
|
15823
|
-
groupId: query5.groupId,
|
|
15824
|
-
status: query5.status
|
|
15825
|
-
})}`
|
|
15826
|
-
}).then(
|
|
15827
|
-
(response) => mapGatewayData(
|
|
15828
|
-
response,
|
|
15829
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
15830
|
-
)
|
|
15831
|
-
);
|
|
15832
|
-
},
|
|
16088
|
+
listGrants,
|
|
15833
16089
|
/**
|
|
15834
16090
|
* @deprecated Use listGrants.
|
|
15835
16091
|
*/
|
|
15836
|
-
|
|
15837
|
-
return this.listGrants(query5);
|
|
15838
|
-
},
|
|
16092
|
+
getGrants,
|
|
15839
16093
|
/**
|
|
15840
16094
|
* Create an audience grant.
|
|
15841
16095
|
*/
|
|
15842
|
-
|
|
15843
|
-
return gateway.request({
|
|
15844
|
-
path: "/api/platform/v1/audiences/grants",
|
|
15845
|
-
method: "POST",
|
|
15846
|
-
body: input,
|
|
15847
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15848
|
-
});
|
|
15849
|
-
},
|
|
16096
|
+
createGrant,
|
|
15850
16097
|
/**
|
|
15851
16098
|
* @deprecated Use createGrant.
|
|
15852
16099
|
*/
|
|
15853
|
-
|
|
15854
|
-
return this.createGrant(input, idempotencyKey);
|
|
15855
|
-
},
|
|
16100
|
+
grant,
|
|
15856
16101
|
/**
|
|
15857
16102
|
* Delete an audience grant by revoking it.
|
|
15858
16103
|
*/
|
|
15859
|
-
|
|
15860
|
-
return gateway.request({
|
|
15861
|
-
path: "/api/platform/v1/audiences/grants/revoke",
|
|
15862
|
-
method: "POST",
|
|
15863
|
-
body: input,
|
|
15864
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
15865
|
-
});
|
|
15866
|
-
},
|
|
16104
|
+
deleteGrant,
|
|
15867
16105
|
/**
|
|
15868
16106
|
* @deprecated Use deleteGrant.
|
|
15869
16107
|
*/
|
|
15870
|
-
|
|
15871
|
-
return this.deleteGrant(input, idempotencyKey);
|
|
15872
|
-
}
|
|
16108
|
+
revokeGrant
|
|
15873
16109
|
};
|
|
15874
16110
|
}
|
|
15875
16111
|
|
|
@@ -15910,8 +16146,18 @@ function authBaseUrl(config) {
|
|
|
15910
16146
|
return config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
15911
16147
|
}
|
|
15912
16148
|
async function readJson2(response) {
|
|
15913
|
-
|
|
15914
|
-
|
|
16149
|
+
try {
|
|
16150
|
+
const payload = await response.json();
|
|
16151
|
+
return isRecord7(payload) ? payload : {};
|
|
16152
|
+
} catch (error) {
|
|
16153
|
+
return unreadableJsonBodyFallback();
|
|
16154
|
+
}
|
|
16155
|
+
}
|
|
16156
|
+
function unreadableJsonBodyFallback(_error) {
|
|
16157
|
+
return {};
|
|
16158
|
+
}
|
|
16159
|
+
function isRecord7(value) {
|
|
16160
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
15915
16161
|
}
|
|
15916
16162
|
function readString(value) {
|
|
15917
16163
|
const normalized = typeof value === "string" ? value.trim() : "";
|
|
@@ -15953,7 +16199,10 @@ function assertDeviceTokenResponse(payload) {
|
|
|
15953
16199
|
tenant_id: tenantId,
|
|
15954
16200
|
workspace_id: readString(payload.workspace_id),
|
|
15955
16201
|
principal_id: principalId,
|
|
15956
|
-
user: payload.user && typeof payload.user === "
|
|
16202
|
+
user: isRecord7(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
|
|
16203
|
+
id: payload.user.id,
|
|
16204
|
+
principalId: payload.user.principalId
|
|
16205
|
+
} : void 0
|
|
15957
16206
|
};
|
|
15958
16207
|
}
|
|
15959
16208
|
function maybeThrowDeviceError(payload) {
|
|
@@ -16101,12 +16350,12 @@ function createBeliefsClient(config = {}) {
|
|
|
16101
16350
|
body: normalizeModulateConfidenceInput(input),
|
|
16102
16351
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16103
16352
|
});
|
|
16104
|
-
async
|
|
16353
|
+
const getOpinionHistory = async (beliefId) => {
|
|
16105
16354
|
const response = await gateway.request({
|
|
16106
16355
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
|
|
16107
16356
|
});
|
|
16108
16357
|
return mapOpinionHistoryEntriesFromGatewayData(response.data);
|
|
16109
|
-
}
|
|
16358
|
+
};
|
|
16110
16359
|
return {
|
|
16111
16360
|
/**
|
|
16112
16361
|
* Create a belief within a topic scope.
|
|
@@ -16151,13 +16400,9 @@ function createBeliefsClient(config = {}) {
|
|
|
16151
16400
|
* trigger = cause of the score change
|
|
16152
16401
|
* triggeringRef = optional pointer to the evidence or worktree that drove the change
|
|
16153
16402
|
*/
|
|
16154
|
-
|
|
16155
|
-
return getOpinionHistory(beliefId);
|
|
16156
|
-
},
|
|
16403
|
+
getOpinionHistory,
|
|
16157
16404
|
/** @deprecated Use getOpinionHistory(). */
|
|
16158
|
-
|
|
16159
|
-
return getOpinionHistory(beliefId);
|
|
16160
|
-
},
|
|
16405
|
+
getConfidenceHistory: getOpinionHistory,
|
|
16161
16406
|
/**
|
|
16162
16407
|
* Fork a scored belief into a new formulation.
|
|
16163
16408
|
*/
|
|
@@ -16305,6 +16550,9 @@ function cleanOptionalString(value) {
|
|
|
16305
16550
|
const normalized = value?.trim();
|
|
16306
16551
|
return normalized ? normalized : void 0;
|
|
16307
16552
|
}
|
|
16553
|
+
function isRecord8(value) {
|
|
16554
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
16555
|
+
}
|
|
16308
16556
|
function cleanRequiredString(value, label) {
|
|
16309
16557
|
const normalized = cleanOptionalString(value);
|
|
16310
16558
|
if (!normalized) {
|
|
@@ -16344,9 +16592,10 @@ function topicPayload(input, allowed, operation) {
|
|
|
16344
16592
|
};
|
|
16345
16593
|
}
|
|
16346
16594
|
function listResultFromEnvelope(data, legacyKey) {
|
|
16347
|
-
const record = data
|
|
16595
|
+
const record = isRecord8(data) ? data : {};
|
|
16596
|
+
const legacyItems = record[legacyKey];
|
|
16348
16597
|
return createListResult(
|
|
16349
|
-
Array.isArray(
|
|
16598
|
+
Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
|
|
16350
16599
|
legacyKey
|
|
16351
16600
|
);
|
|
16352
16601
|
}
|
|
@@ -16718,7 +16967,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
|
|
|
16718
16967
|
// ../sdk/src/ontologyClient.ts
|
|
16719
16968
|
function createOntologyClient(config = {}) {
|
|
16720
16969
|
const gateway = createGatewayRequestClient(config);
|
|
16721
|
-
|
|
16970
|
+
const client = {
|
|
16722
16971
|
/**
|
|
16723
16972
|
* List ontology definitions matching optional filters.
|
|
16724
16973
|
*/
|
|
@@ -16727,13 +16976,14 @@ function createOntologyClient(config = {}) {
|
|
|
16727
16976
|
path: `/api/platform/v1/ontologies${toQueryString(filters)}`
|
|
16728
16977
|
}).then(
|
|
16729
16978
|
(response) => mapGatewayData(response, (data) => {
|
|
16730
|
-
const record =
|
|
16731
|
-
const ontologies =
|
|
16732
|
-
const
|
|
16979
|
+
const record = asRecord(data);
|
|
16980
|
+
const ontologies = asListItems(data, "ontologies");
|
|
16981
|
+
const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
|
|
16982
|
+
const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
|
|
16733
16983
|
return {
|
|
16734
16984
|
...record,
|
|
16735
|
-
...createListResult(
|
|
16736
|
-
ontologies,
|
|
16985
|
+
...createListResult(definitions, "definitions"),
|
|
16986
|
+
ontologies: definitions,
|
|
16737
16987
|
total
|
|
16738
16988
|
};
|
|
16739
16989
|
})
|
|
@@ -16760,18 +17010,6 @@ function createOntologyClient(config = {}) {
|
|
|
16760
17010
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
16761
17011
|
});
|
|
16762
17012
|
},
|
|
16763
|
-
/**
|
|
16764
|
-
* List ontology definitions.
|
|
16765
|
-
*/
|
|
16766
|
-
async listDefinitions(filters = {}) {
|
|
16767
|
-
return this.list(filters);
|
|
16768
|
-
},
|
|
16769
|
-
/**
|
|
16770
|
-
* Get an ontology definition.
|
|
16771
|
-
*/
|
|
16772
|
-
async getDefinition(id) {
|
|
16773
|
-
return this.get(id);
|
|
16774
|
-
},
|
|
16775
17013
|
/**
|
|
16776
17014
|
* Create an ontology definition.
|
|
16777
17015
|
*/
|
|
@@ -16813,7 +17051,7 @@ function createOntologyClient(config = {}) {
|
|
|
16813
17051
|
}).then(
|
|
16814
17052
|
(response) => mapGatewayData(
|
|
16815
17053
|
response,
|
|
16816
|
-
(data) => createListResult(
|
|
17054
|
+
(data) => createListResult(asListItems(data, "versions"), "versions")
|
|
16817
17055
|
)
|
|
16818
17056
|
);
|
|
16819
17057
|
},
|
|
@@ -16861,20 +17099,19 @@ function createOntologyClient(config = {}) {
|
|
|
16861
17099
|
(data) => createListResult(Array.isArray(data) ? data : [], "topics")
|
|
16862
17100
|
)
|
|
16863
17101
|
);
|
|
16864
|
-
},
|
|
16865
|
-
/**
|
|
16866
|
-
* @deprecated Use listTopics.
|
|
16867
|
-
*/
|
|
16868
|
-
async listTopicsByOntology(ontologyId) {
|
|
16869
|
-
return this.listTopics(ontologyId);
|
|
16870
17102
|
}
|
|
16871
17103
|
};
|
|
17104
|
+
return Object.assign(client, {
|
|
17105
|
+
listDefinitions: client.list,
|
|
17106
|
+
getDefinition: client.get,
|
|
17107
|
+
listTopicsByOntology: client.listTopics
|
|
17108
|
+
});
|
|
16872
17109
|
}
|
|
16873
17110
|
|
|
16874
17111
|
// ../sdk/src/graphClient.ts
|
|
16875
17112
|
function createGraphClient(config = {}) {
|
|
16876
17113
|
const gateway = createGatewayRequestClient(config);
|
|
16877
|
-
|
|
17114
|
+
const client = {
|
|
16878
17115
|
/**
|
|
16879
17116
|
* List graph nodes matching the provided filters.
|
|
16880
17117
|
*/
|
|
@@ -16887,12 +17124,6 @@ function createGraphClient(config = {}) {
|
|
|
16887
17124
|
(response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
|
|
16888
17125
|
);
|
|
16889
17126
|
},
|
|
16890
|
-
/**
|
|
16891
|
-
* @deprecated Use listNodes.
|
|
16892
|
-
*/
|
|
16893
|
-
async queryNodes(query5) {
|
|
16894
|
-
return this.listNodes(query5);
|
|
16895
|
-
},
|
|
16896
17127
|
/**
|
|
16897
17128
|
* Retrieve a single graph node by nodeId or globalId.
|
|
16898
17129
|
*/
|
|
@@ -17003,12 +17234,6 @@ function createGraphClient(config = {}) {
|
|
|
17003
17234
|
)
|
|
17004
17235
|
);
|
|
17005
17236
|
},
|
|
17006
|
-
/**
|
|
17007
|
-
* @deprecated Use listEdges.
|
|
17008
|
-
*/
|
|
17009
|
-
async queryEdges(query5) {
|
|
17010
|
-
return this.listEdges(query5);
|
|
17011
|
-
},
|
|
17012
17237
|
/**
|
|
17013
17238
|
* Create a graph edge.
|
|
17014
17239
|
*/
|
|
@@ -17097,13 +17322,7 @@ function createGraphClient(config = {}) {
|
|
|
17097
17322
|
});
|
|
17098
17323
|
},
|
|
17099
17324
|
/**
|
|
17100
|
-
* Retrieve
|
|
17101
|
-
*/
|
|
17102
|
-
async getNeighborhood(query5) {
|
|
17103
|
-
return this.neighborhood(query5);
|
|
17104
|
-
},
|
|
17105
|
-
/**
|
|
17106
|
-
* Retrieve the shortest known path between two graph nodes.
|
|
17325
|
+
* Retrieve the shortest known path between two graph nodes.
|
|
17107
17326
|
*/
|
|
17108
17327
|
async getPath(query5) {
|
|
17109
17328
|
return gateway.request({
|
|
@@ -17119,6 +17338,11 @@ function createGraphClient(config = {}) {
|
|
|
17119
17338
|
});
|
|
17120
17339
|
}
|
|
17121
17340
|
};
|
|
17341
|
+
return Object.assign(client, {
|
|
17342
|
+
queryNodes: client.listNodes,
|
|
17343
|
+
queryEdges: client.listEdges,
|
|
17344
|
+
getNeighborhood: client.neighborhood
|
|
17345
|
+
});
|
|
17122
17346
|
}
|
|
17123
17347
|
|
|
17124
17348
|
// ../sdk/src/identityClient.ts
|
|
@@ -17172,6 +17396,13 @@ function createIdentityClient(config = {}) {
|
|
|
17172
17396
|
body: input,
|
|
17173
17397
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17174
17398
|
});
|
|
17399
|
+
const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17400
|
+
const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
|
|
17401
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
17402
|
+
method: "POST",
|
|
17403
|
+
body: input,
|
|
17404
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17405
|
+
});
|
|
17175
17406
|
return {
|
|
17176
17407
|
/**
|
|
17177
17408
|
* Resolve the current authenticated identity summary.
|
|
@@ -17220,15 +17451,11 @@ function createIdentityClient(config = {}) {
|
|
|
17220
17451
|
/**
|
|
17221
17452
|
* Update a principal.
|
|
17222
17453
|
*/
|
|
17223
|
-
|
|
17224
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17225
|
-
},
|
|
17454
|
+
updatePrincipal,
|
|
17226
17455
|
/**
|
|
17227
17456
|
* @deprecated Use createPrincipal or updatePrincipal.
|
|
17228
17457
|
*/
|
|
17229
|
-
|
|
17230
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
17231
|
-
},
|
|
17458
|
+
upsertPrincipal: updatePrincipal,
|
|
17232
17459
|
/**
|
|
17233
17460
|
* List keys in the current identity scope.
|
|
17234
17461
|
*/
|
|
@@ -17267,20 +17494,11 @@ function createIdentityClient(config = {}) {
|
|
|
17267
17494
|
/**
|
|
17268
17495
|
* Delete an API key by revoking it.
|
|
17269
17496
|
*/
|
|
17270
|
-
|
|
17271
|
-
return gateway.request({
|
|
17272
|
-
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
17273
|
-
method: "POST",
|
|
17274
|
-
body: input,
|
|
17275
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
17276
|
-
});
|
|
17277
|
-
},
|
|
17497
|
+
deleteKey,
|
|
17278
17498
|
/**
|
|
17279
17499
|
* @deprecated Use deleteKey.
|
|
17280
17500
|
*/
|
|
17281
|
-
|
|
17282
|
-
return this.deleteKey(keyId, input, idempotencyKey);
|
|
17283
|
-
},
|
|
17501
|
+
revokeKey: deleteKey,
|
|
17284
17502
|
/**
|
|
17285
17503
|
* Search Clerk users by email or display attributes.
|
|
17286
17504
|
*/
|
|
@@ -17396,14 +17614,11 @@ function createIdentityClient(config = {}) {
|
|
|
17396
17614
|
}
|
|
17397
17615
|
|
|
17398
17616
|
// ../sdk/src/topicsClient.ts
|
|
17399
|
-
function asRecord3(value) {
|
|
17400
|
-
return value && typeof value === "object" ? value : {};
|
|
17401
|
-
}
|
|
17402
17617
|
function cleanString3(value) {
|
|
17403
17618
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
17404
17619
|
}
|
|
17405
17620
|
function normalizeTopicRecord(value) {
|
|
17406
|
-
const record =
|
|
17621
|
+
const record = asRecord(value);
|
|
17407
17622
|
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
17408
17623
|
return withTopicAlias({
|
|
17409
17624
|
...record,
|
|
@@ -17428,7 +17643,7 @@ function createTopicsClient(config = {}) {
|
|
|
17428
17643
|
})}`
|
|
17429
17644
|
}).then(
|
|
17430
17645
|
(response) => mapGatewayData(response, (data) => {
|
|
17431
|
-
const record =
|
|
17646
|
+
const record = asRecord(data);
|
|
17432
17647
|
const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
|
|
17433
17648
|
return {
|
|
17434
17649
|
...createListResult(items, "topics"),
|
|
@@ -17445,7 +17660,7 @@ function createTopicsClient(config = {}) {
|
|
|
17445
17660
|
}).then(
|
|
17446
17661
|
(response) => mapGatewayData(
|
|
17447
17662
|
response,
|
|
17448
|
-
(data) => normalizeTopicRecord(
|
|
17663
|
+
(data) => normalizeTopicRecord(asRecord(data).topic ?? data)
|
|
17449
17664
|
)
|
|
17450
17665
|
);
|
|
17451
17666
|
},
|
|
@@ -17481,7 +17696,7 @@ function createTopicsClient(config = {}) {
|
|
|
17481
17696
|
)}`
|
|
17482
17697
|
}).then(
|
|
17483
17698
|
(response) => mapGatewayData(response, (data) => {
|
|
17484
|
-
const record =
|
|
17699
|
+
const record = asRecord(data);
|
|
17485
17700
|
return {
|
|
17486
17701
|
tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
|
|
17487
17702
|
};
|
|
@@ -17900,7 +18115,7 @@ function createEventsFacade(config = {}) {
|
|
|
17900
18115
|
function createGraphFacade(config = {}) {
|
|
17901
18116
|
const graphClient = createGraphClient(config);
|
|
17902
18117
|
const gateway = createGatewayRequestClient(config);
|
|
17903
|
-
|
|
18118
|
+
const graphFacade = {
|
|
17904
18119
|
async neighborhood(input) {
|
|
17905
18120
|
return graphClient.neighborhood({
|
|
17906
18121
|
globalId: input.globalId,
|
|
@@ -17908,18 +18123,6 @@ function createGraphFacade(config = {}) {
|
|
|
17908
18123
|
maxDepth: input.maxDepth
|
|
17909
18124
|
});
|
|
17910
18125
|
},
|
|
17911
|
-
async traverse(input) {
|
|
17912
|
-
return graphClient.traverse(input);
|
|
17913
|
-
},
|
|
17914
|
-
async analyze(input = {}) {
|
|
17915
|
-
return graphClient.analyze(input);
|
|
17916
|
-
},
|
|
17917
|
-
async bias(input = {}) {
|
|
17918
|
-
return graphClient.bias(input);
|
|
17919
|
-
},
|
|
17920
|
-
async gaps(input) {
|
|
17921
|
-
return graphClient.gaps(input);
|
|
17922
|
-
},
|
|
17923
18126
|
async falsify(input, idempotencyKey = randomIdempotencyKey()) {
|
|
17924
18127
|
return gateway.request({
|
|
17925
18128
|
path: "/api/platform/v1/graph/falsify",
|
|
@@ -17929,6 +18132,12 @@ function createGraphFacade(config = {}) {
|
|
|
17929
18132
|
});
|
|
17930
18133
|
}
|
|
17931
18134
|
};
|
|
18135
|
+
return Object.assign(graphFacade, {
|
|
18136
|
+
traverse: graphClient.traverse,
|
|
18137
|
+
analyze: graphClient.analyze,
|
|
18138
|
+
bias: graphClient.bias,
|
|
18139
|
+
gaps: graphClient.gaps
|
|
18140
|
+
});
|
|
17932
18141
|
}
|
|
17933
18142
|
function createIdentityFacade(config = {}) {
|
|
17934
18143
|
const identityClient = createIdentityClient(config);
|
|
@@ -17942,15 +18151,12 @@ function createIdentityFacade(config = {}) {
|
|
|
17942
18151
|
function createOntologiesFacade(config = {}) {
|
|
17943
18152
|
const ontologyClient = createOntologyClient(config);
|
|
17944
18153
|
const gateway = createGatewayRequestClient(config);
|
|
17945
|
-
|
|
18154
|
+
const ontologyFacade = {
|
|
17946
18155
|
async get(id) {
|
|
17947
18156
|
return gateway.request({
|
|
17948
18157
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
17949
18158
|
});
|
|
17950
18159
|
},
|
|
17951
|
-
async list(query5 = {}) {
|
|
17952
|
-
return ontologyClient.list(query5);
|
|
17953
|
-
},
|
|
17954
18160
|
async bind(input, idempotencyKey) {
|
|
17955
18161
|
return gateway.request({
|
|
17956
18162
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
|
|
@@ -17970,6 +18176,9 @@ function createOntologiesFacade(config = {}) {
|
|
|
17970
18176
|
});
|
|
17971
18177
|
}
|
|
17972
18178
|
};
|
|
18179
|
+
return Object.assign(ontologyFacade, {
|
|
18180
|
+
list: ontologyClient.list
|
|
18181
|
+
});
|
|
17973
18182
|
}
|
|
17974
18183
|
function createQuestionsFacade(config = {}) {
|
|
17975
18184
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -18162,15 +18371,9 @@ function createTasksFacade(config = {}) {
|
|
|
18162
18371
|
function createTopicsFacade(config = {}) {
|
|
18163
18372
|
const topicsClient = createTopicsClient(config);
|
|
18164
18373
|
return {
|
|
18165
|
-
|
|
18166
|
-
|
|
18167
|
-
|
|
18168
|
-
async get(id) {
|
|
18169
|
-
return topicsClient.get(id);
|
|
18170
|
-
},
|
|
18171
|
-
async list(query5 = {}) {
|
|
18172
|
-
return topicsClient.list(query5);
|
|
18173
|
-
},
|
|
18374
|
+
create: topicsClient.create,
|
|
18375
|
+
get: topicsClient.get,
|
|
18376
|
+
list: topicsClient.list,
|
|
18174
18377
|
async update(input, idempotencyKey) {
|
|
18175
18378
|
const { id, ...rest } = input;
|
|
18176
18379
|
return topicsClient.update(id, rest, idempotencyKey);
|
|
@@ -18186,12 +18389,8 @@ function createTopicsFacade(config = {}) {
|
|
|
18186
18389
|
maxDepth: input.maxDepth
|
|
18187
18390
|
});
|
|
18188
18391
|
},
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
},
|
|
18192
|
-
async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
|
|
18193
|
-
return topicsClient.bulkCreate(input, idempotencyKey);
|
|
18194
|
-
}
|
|
18392
|
+
remove: topicsClient.remove,
|
|
18393
|
+
bulkCreate: topicsClient.bulkCreate
|
|
18195
18394
|
};
|
|
18196
18395
|
}
|
|
18197
18396
|
function createWebhooksFacade(config = {}) {
|
|
@@ -18391,7 +18590,7 @@ function createWorktreesFacade(config = {}) {
|
|
|
18391
18590
|
// ../sdk/src/decisionsClient.ts
|
|
18392
18591
|
function createDecisionsClient(config = {}) {
|
|
18393
18592
|
const gateway = createGatewayRequestClient(config);
|
|
18394
|
-
|
|
18593
|
+
const client = {
|
|
18395
18594
|
/**
|
|
18396
18595
|
* List judgments for a topic scope.
|
|
18397
18596
|
*/
|
|
@@ -18469,12 +18668,6 @@ function createDecisionsClient(config = {}) {
|
|
|
18469
18668
|
})
|
|
18470
18669
|
);
|
|
18471
18670
|
},
|
|
18472
|
-
/**
|
|
18473
|
-
* @deprecated Use listPendingOutcomeReviews.
|
|
18474
|
-
*/
|
|
18475
|
-
async listPendingJudgmentOutcomeReview(query5) {
|
|
18476
|
-
return this.listPendingOutcomeReviews(query5);
|
|
18477
|
-
},
|
|
18478
18671
|
/**
|
|
18479
18672
|
* Get audit integrity checks for judgment transitions.
|
|
18480
18673
|
*/
|
|
@@ -18507,12 +18700,6 @@ function createDecisionsClient(config = {}) {
|
|
|
18507
18700
|
)
|
|
18508
18701
|
);
|
|
18509
18702
|
},
|
|
18510
|
-
/**
|
|
18511
|
-
* @deprecated Use createJudgment.
|
|
18512
|
-
*/
|
|
18513
|
-
async recordJudgment(input, idempotencyKey) {
|
|
18514
|
-
return this.createJudgment(input, idempotencyKey);
|
|
18515
|
-
},
|
|
18516
18703
|
/**
|
|
18517
18704
|
* Update the outcome for an existing judgment.
|
|
18518
18705
|
*/
|
|
@@ -18523,14 +18710,13 @@ function createDecisionsClient(config = {}) {
|
|
|
18523
18710
|
body: input,
|
|
18524
18711
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
18525
18712
|
});
|
|
18526
|
-
},
|
|
18527
|
-
/**
|
|
18528
|
-
* @deprecated Use updateJudgmentOutcome.
|
|
18529
|
-
*/
|
|
18530
|
-
async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
|
|
18531
|
-
return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
|
|
18532
18713
|
}
|
|
18533
18714
|
};
|
|
18715
|
+
return Object.assign(client, {
|
|
18716
|
+
listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
|
|
18717
|
+
recordJudgment: client.createJudgment,
|
|
18718
|
+
recordJudgmentOutcome: client.updateJudgmentOutcome
|
|
18719
|
+
});
|
|
18534
18720
|
}
|
|
18535
18721
|
|
|
18536
18722
|
// ../sdk/src/embeddingsClient.ts
|
|
@@ -18655,50 +18841,55 @@ function cleanNumber(value) {
|
|
|
18655
18841
|
function cleanBoolean(value) {
|
|
18656
18842
|
return typeof value === "boolean" ? value : void 0;
|
|
18657
18843
|
}
|
|
18658
|
-
function buildCompileContextRequest(
|
|
18659
|
-
const
|
|
18660
|
-
const
|
|
18844
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
18845
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
18846
|
+
const payload = {};
|
|
18847
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
18848
|
+
if (topicId) {
|
|
18849
|
+
payload.topicId = topicId;
|
|
18850
|
+
}
|
|
18851
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
18661
18852
|
if (query5) {
|
|
18662
18853
|
payload.query = query5;
|
|
18663
18854
|
}
|
|
18664
|
-
const budget = cleanNumber(
|
|
18855
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
18665
18856
|
if (budget !== void 0) {
|
|
18666
18857
|
payload.budget = budget;
|
|
18667
18858
|
}
|
|
18668
|
-
const ranking = cleanString4(
|
|
18859
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
18669
18860
|
if (ranking) {
|
|
18670
18861
|
payload.ranking = ranking;
|
|
18671
18862
|
}
|
|
18672
|
-
const limit = cleanNumber(
|
|
18863
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
18673
18864
|
if (limit !== void 0) {
|
|
18674
18865
|
payload.limit = limit;
|
|
18675
18866
|
}
|
|
18676
|
-
const maxDepth = cleanNumber(
|
|
18867
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
18677
18868
|
if (maxDepth !== void 0) {
|
|
18678
18869
|
payload.maxDepth = maxDepth;
|
|
18679
18870
|
}
|
|
18680
|
-
const includeEntities = cleanBoolean(
|
|
18871
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
18681
18872
|
if (includeEntities !== void 0) {
|
|
18682
18873
|
payload.includeEntities = includeEntities;
|
|
18683
18874
|
}
|
|
18684
|
-
const mode = cleanString4(
|
|
18875
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
18685
18876
|
if (mode) {
|
|
18686
18877
|
payload.mode = mode;
|
|
18687
18878
|
}
|
|
18688
|
-
const includeFailures = cleanBoolean(
|
|
18879
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
18689
18880
|
if (includeFailures !== void 0) {
|
|
18690
18881
|
payload.includeFailures = includeFailures;
|
|
18691
18882
|
}
|
|
18692
|
-
const worktreeId = cleanString4(
|
|
18883
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
18693
18884
|
if (worktreeId) {
|
|
18694
18885
|
payload.worktreeId = worktreeId;
|
|
18695
18886
|
}
|
|
18696
|
-
const sessionId = cleanString4(
|
|
18887
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
18697
18888
|
if (sessionId) {
|
|
18698
18889
|
payload.sessionId = sessionId;
|
|
18699
18890
|
}
|
|
18700
|
-
if (Array.isArray(
|
|
18701
|
-
payload.packWeightOverrides =
|
|
18891
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
18892
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
18702
18893
|
}
|
|
18703
18894
|
return {
|
|
18704
18895
|
path: "/api/platform/v1/context/compile",
|
|
@@ -18710,13 +18901,20 @@ function createContextClient(config = {}) {
|
|
|
18710
18901
|
const gateway = createGatewayRequestClient(config);
|
|
18711
18902
|
return {
|
|
18712
18903
|
/**
|
|
18713
|
-
* Compile a focused reasoning context pack
|
|
18714
|
-
* @param
|
|
18904
|
+
* Compile a focused reasoning context pack.
|
|
18905
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
18715
18906
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
18716
18907
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
18717
18908
|
*/
|
|
18718
|
-
async compile(
|
|
18719
|
-
const request = buildCompileContextRequest(
|
|
18909
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
18910
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
18911
|
+
return gateway.request({
|
|
18912
|
+
...request,
|
|
18913
|
+
body: request.body
|
|
18914
|
+
});
|
|
18915
|
+
},
|
|
18916
|
+
async compileByQuery(input = {}) {
|
|
18917
|
+
const request = buildCompileContextRequest(input);
|
|
18720
18918
|
return gateway.request({
|
|
18721
18919
|
...request,
|
|
18722
18920
|
body: request.body
|
|
@@ -19154,7 +19352,7 @@ function createGraphStateClassifierClient(config = {}) {
|
|
|
19154
19352
|
// ../sdk/src/harnessClient.ts
|
|
19155
19353
|
function createHarnessClient(config = {}) {
|
|
19156
19354
|
const gateway = createGatewayRequestClient(config);
|
|
19157
|
-
|
|
19355
|
+
const client = {
|
|
19158
19356
|
/**
|
|
19159
19357
|
* List agent definitions.
|
|
19160
19358
|
*/
|
|
@@ -19187,12 +19385,6 @@ function createHarnessClient(config = {}) {
|
|
|
19187
19385
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
19188
19386
|
});
|
|
19189
19387
|
},
|
|
19190
|
-
/**
|
|
19191
|
-
* @deprecated Use createAgentDefinition.
|
|
19192
|
-
*/
|
|
19193
|
-
async registerAgentDefinition(input, idempotencyKey) {
|
|
19194
|
-
return this.createAgentDefinition(input, idempotencyKey);
|
|
19195
|
-
},
|
|
19196
19388
|
/**
|
|
19197
19389
|
* Update an agent definition.
|
|
19198
19390
|
*/
|
|
@@ -19231,12 +19423,6 @@ function createHarnessClient(config = {}) {
|
|
|
19231
19423
|
)
|
|
19232
19424
|
);
|
|
19233
19425
|
},
|
|
19234
|
-
/**
|
|
19235
|
-
* @deprecated Use listAgentRuns.
|
|
19236
|
-
*/
|
|
19237
|
-
async listRunsForAgent(agentId, scope = {}) {
|
|
19238
|
-
return this.listAgentRuns(agentId, scope);
|
|
19239
|
-
},
|
|
19240
19426
|
/**
|
|
19241
19427
|
* List tool definitions.
|
|
19242
19428
|
*/
|
|
@@ -19269,12 +19455,6 @@ function createHarnessClient(config = {}) {
|
|
|
19269
19455
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
19270
19456
|
});
|
|
19271
19457
|
},
|
|
19272
|
-
/**
|
|
19273
|
-
* @deprecated Use createToolDefinition.
|
|
19274
|
-
*/
|
|
19275
|
-
async registerToolDefinition(input, idempotencyKey) {
|
|
19276
|
-
return this.createToolDefinition(input, idempotencyKey);
|
|
19277
|
-
},
|
|
19278
19458
|
/**
|
|
19279
19459
|
* Update a tool definition.
|
|
19280
19460
|
*/
|
|
@@ -19309,12 +19489,6 @@ function createHarnessClient(config = {}) {
|
|
|
19309
19489
|
)
|
|
19310
19490
|
);
|
|
19311
19491
|
},
|
|
19312
|
-
/**
|
|
19313
|
-
* @deprecated Use listRunEntries.
|
|
19314
|
-
*/
|
|
19315
|
-
async listRunLedgerEntries(scope = {}) {
|
|
19316
|
-
return this.listRunEntries(scope);
|
|
19317
|
-
},
|
|
19318
19492
|
/**
|
|
19319
19493
|
* Create a harness run.
|
|
19320
19494
|
*/
|
|
@@ -19389,6 +19563,12 @@ function createHarnessClient(config = {}) {
|
|
|
19389
19563
|
});
|
|
19390
19564
|
}
|
|
19391
19565
|
};
|
|
19566
|
+
return Object.assign(client, {
|
|
19567
|
+
registerAgentDefinition: client.createAgentDefinition,
|
|
19568
|
+
listRunsForAgent: client.listAgentRuns,
|
|
19569
|
+
registerToolDefinition: client.createToolDefinition,
|
|
19570
|
+
listRunLedgerEntries: client.listRunEntries
|
|
19571
|
+
});
|
|
19392
19572
|
}
|
|
19393
19573
|
|
|
19394
19574
|
// ../sdk/src/jobsClient.ts
|
|
@@ -19516,45 +19696,41 @@ function createJobsClient(config = {}) {
|
|
|
19516
19696
|
// ../sdk/src/learningClient.ts
|
|
19517
19697
|
function createLearningClient(config = {}) {
|
|
19518
19698
|
const gateway = createGatewayRequestClient(config);
|
|
19699
|
+
const listRecentExecutions = async (args = {}) => gateway.request({
|
|
19700
|
+
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
19701
|
+
...normalizeTopicQuery(args),
|
|
19702
|
+
namespace: args.namespace,
|
|
19703
|
+
audienceMode: args.audienceMode,
|
|
19704
|
+
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
19705
|
+
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
19706
|
+
})}`
|
|
19707
|
+
}).then(
|
|
19708
|
+
(response) => mapGatewayData(
|
|
19709
|
+
response,
|
|
19710
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
19711
|
+
)
|
|
19712
|
+
);
|
|
19713
|
+
const getExecutionStats = async (args = {}) => gateway.request({
|
|
19714
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
19715
|
+
...normalizeTopicQuery(args),
|
|
19716
|
+
namespace: args.namespace,
|
|
19717
|
+
audienceMode: args.audienceMode,
|
|
19718
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
19719
|
+
})}`
|
|
19720
|
+
});
|
|
19519
19721
|
return {
|
|
19520
19722
|
/**
|
|
19521
19723
|
* List recent execution records.
|
|
19522
19724
|
*/
|
|
19523
|
-
|
|
19524
|
-
return gateway.request({
|
|
19525
|
-
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
19526
|
-
...normalizeTopicQuery(args),
|
|
19527
|
-
namespace: args.namespace,
|
|
19528
|
-
audienceMode: args.audienceMode,
|
|
19529
|
-
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
19530
|
-
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
19531
|
-
})}`
|
|
19532
|
-
}).then(
|
|
19533
|
-
(response) => mapGatewayData(
|
|
19534
|
-
response,
|
|
19535
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
19536
|
-
)
|
|
19537
|
-
);
|
|
19538
|
-
},
|
|
19725
|
+
listRecentExecutions,
|
|
19539
19726
|
/**
|
|
19540
19727
|
* @deprecated Use listRecentExecutions.
|
|
19541
19728
|
*/
|
|
19542
|
-
|
|
19543
|
-
return this.listRecentExecutions(args);
|
|
19544
|
-
},
|
|
19729
|
+
getRecentExecutions: listRecentExecutions,
|
|
19545
19730
|
/**
|
|
19546
19731
|
* Get aggregate execution statistics.
|
|
19547
19732
|
*/
|
|
19548
|
-
|
|
19549
|
-
return gateway.request({
|
|
19550
|
-
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
19551
|
-
...normalizeTopicQuery(args),
|
|
19552
|
-
namespace: args.namespace,
|
|
19553
|
-
audienceMode: args.audienceMode,
|
|
19554
|
-
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
19555
|
-
})}`
|
|
19556
|
-
});
|
|
19557
|
-
}
|
|
19733
|
+
getExecutionStats
|
|
19558
19734
|
};
|
|
19559
19735
|
}
|
|
19560
19736
|
|
|
@@ -20591,7 +20767,7 @@ function createOrgGraphSearchClient(config = {}) {
|
|
|
20591
20767
|
// ../sdk/src/packsClient.ts
|
|
20592
20768
|
function createPacksClient(config = {}) {
|
|
20593
20769
|
const gateway = createGatewayRequestClient(config);
|
|
20594
|
-
|
|
20770
|
+
const client = {
|
|
20595
20771
|
/**
|
|
20596
20772
|
* List catalog entries for available packs.
|
|
20597
20773
|
*/
|
|
@@ -20605,12 +20781,6 @@ function createPacksClient(config = {}) {
|
|
|
20605
20781
|
)
|
|
20606
20782
|
);
|
|
20607
20783
|
},
|
|
20608
|
-
/**
|
|
20609
|
-
* @deprecated Use listCatalog.
|
|
20610
|
-
*/
|
|
20611
|
-
async getCatalog() {
|
|
20612
|
-
return this.listCatalog();
|
|
20613
|
-
},
|
|
20614
20784
|
/**
|
|
20615
20785
|
* Get the discovery catalog for packs.
|
|
20616
20786
|
*/
|
|
@@ -20640,12 +20810,6 @@ function createPacksClient(config = {}) {
|
|
|
20640
20810
|
)
|
|
20641
20811
|
);
|
|
20642
20812
|
},
|
|
20643
|
-
/**
|
|
20644
|
-
* @deprecated Use listStates.
|
|
20645
|
-
*/
|
|
20646
|
-
async getStates(query5 = {}) {
|
|
20647
|
-
return this.listStates(query5);
|
|
20648
|
-
},
|
|
20649
20813
|
/**
|
|
20650
20814
|
* Get health details for a pack.
|
|
20651
20815
|
*/
|
|
@@ -20669,12 +20833,6 @@ function createPacksClient(config = {}) {
|
|
|
20669
20833
|
)
|
|
20670
20834
|
);
|
|
20671
20835
|
},
|
|
20672
|
-
/**
|
|
20673
|
-
* @deprecated Use listTelemetry.
|
|
20674
|
-
*/
|
|
20675
|
-
async getTelemetry(query5 = {}) {
|
|
20676
|
-
return this.listTelemetry(query5);
|
|
20677
|
-
},
|
|
20678
20836
|
/**
|
|
20679
20837
|
* Create a pack entitlement.
|
|
20680
20838
|
*/
|
|
@@ -20686,18 +20844,6 @@ function createPacksClient(config = {}) {
|
|
|
20686
20844
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
20687
20845
|
});
|
|
20688
20846
|
},
|
|
20689
|
-
/**
|
|
20690
|
-
* Update a pack entitlement.
|
|
20691
|
-
*/
|
|
20692
|
-
async updateEntitlement(input, idempotencyKey) {
|
|
20693
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
20694
|
-
},
|
|
20695
|
-
/**
|
|
20696
|
-
* @deprecated Use createEntitlement or updateEntitlement.
|
|
20697
|
-
*/
|
|
20698
|
-
async upsertEntitlement(input, idempotencyKey) {
|
|
20699
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
20700
|
-
},
|
|
20701
20847
|
/**
|
|
20702
20848
|
* Install a pack.
|
|
20703
20849
|
*/
|
|
@@ -20754,6 +20900,13 @@ function createPacksClient(config = {}) {
|
|
|
20754
20900
|
});
|
|
20755
20901
|
}
|
|
20756
20902
|
};
|
|
20903
|
+
return Object.assign(client, {
|
|
20904
|
+
getCatalog: client.listCatalog,
|
|
20905
|
+
getStates: client.listStates,
|
|
20906
|
+
getTelemetry: client.listTelemetry,
|
|
20907
|
+
updateEntitlement: client.createEntitlement,
|
|
20908
|
+
upsertEntitlement: client.createEntitlement
|
|
20909
|
+
});
|
|
20757
20910
|
}
|
|
20758
20911
|
|
|
20759
20912
|
// ../sdk/src/policyClient.ts
|
|
@@ -20789,6 +20942,14 @@ function asRolePolicyArray(data) {
|
|
|
20789
20942
|
}
|
|
20790
20943
|
return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
|
|
20791
20944
|
}
|
|
20945
|
+
function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
|
|
20946
|
+
const result = {};
|
|
20947
|
+
result.permission = permission;
|
|
20948
|
+
result.allowedTopicIds = allowedTopicIds;
|
|
20949
|
+
result.deniedTopics = deniedTopics;
|
|
20950
|
+
result.count = count;
|
|
20951
|
+
return result;
|
|
20952
|
+
}
|
|
20792
20953
|
function createPolicyClient(config = {}) {
|
|
20793
20954
|
const gateway = createGatewayRequestClient(config);
|
|
20794
20955
|
return {
|
|
@@ -21011,15 +21172,15 @@ function createPolicyClient(config = {}) {
|
|
|
21011
21172
|
});
|
|
21012
21173
|
const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
|
|
21013
21174
|
const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21175
|
+
const result = {};
|
|
21176
|
+
result.success = true;
|
|
21177
|
+
result.data = buildFilterByPermissionResponse(
|
|
21178
|
+
permission,
|
|
21179
|
+
allowedTopicIds,
|
|
21180
|
+
deniedTopics,
|
|
21181
|
+
typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
|
|
21182
|
+
);
|
|
21183
|
+
return result;
|
|
21023
21184
|
}
|
|
21024
21185
|
};
|
|
21025
21186
|
}
|
|
@@ -21027,64 +21188,66 @@ function createPolicyClient(config = {}) {
|
|
|
21027
21188
|
// ../sdk/src/reportsClient.ts
|
|
21028
21189
|
function createReportsClient(config = {}) {
|
|
21029
21190
|
const gateway = createGatewayRequestClient(config);
|
|
21191
|
+
const listTemplates = async (args = {}) => gateway.request({
|
|
21192
|
+
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
21193
|
+
slug: args.slug
|
|
21194
|
+
})}`
|
|
21195
|
+
}).then(
|
|
21196
|
+
(response) => mapGatewayData(response, (data) => {
|
|
21197
|
+
const rows = asListItems(data, "templates");
|
|
21198
|
+
return createListResult(rows, "templates");
|
|
21199
|
+
})
|
|
21200
|
+
);
|
|
21201
|
+
const listReports = async (input, args = {}) => {
|
|
21202
|
+
const topicId = resolveTopicId(input);
|
|
21203
|
+
if (!topicId) {
|
|
21204
|
+
throw new Error("topicId is required");
|
|
21205
|
+
}
|
|
21206
|
+
return gateway.request({
|
|
21207
|
+
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
21208
|
+
{
|
|
21209
|
+
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
21210
|
+
}
|
|
21211
|
+
)}`
|
|
21212
|
+
}).then(
|
|
21213
|
+
(response) => mapGatewayData(
|
|
21214
|
+
response,
|
|
21215
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
21216
|
+
)
|
|
21217
|
+
);
|
|
21218
|
+
};
|
|
21219
|
+
const getReport = async (reportId) => gateway.request({
|
|
21220
|
+
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
21221
|
+
});
|
|
21030
21222
|
return {
|
|
21031
21223
|
/**
|
|
21032
21224
|
* List report templates.
|
|
21033
21225
|
*/
|
|
21034
|
-
|
|
21035
|
-
return gateway.request({
|
|
21036
|
-
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
21037
|
-
slug: args.slug
|
|
21038
|
-
})}`
|
|
21039
|
-
}).then(
|
|
21040
|
-
(response) => mapGatewayData(response, (data) => {
|
|
21041
|
-
const record = data && typeof data === "object" ? data : {};
|
|
21042
|
-
const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
|
|
21043
|
-
return createListResult(rows, "templates");
|
|
21044
|
-
})
|
|
21045
|
-
);
|
|
21046
|
-
},
|
|
21226
|
+
listTemplates,
|
|
21047
21227
|
/**
|
|
21048
21228
|
* @deprecated Use listTemplates.
|
|
21049
21229
|
*/
|
|
21050
|
-
|
|
21051
|
-
return this.listTemplates(args);
|
|
21052
|
-
},
|
|
21230
|
+
getTemplates: listTemplates,
|
|
21053
21231
|
/**
|
|
21054
21232
|
* List reports for a topic scope.
|
|
21055
21233
|
*/
|
|
21056
|
-
|
|
21057
|
-
const topicId = resolveTopicId(input);
|
|
21058
|
-
if (!topicId) {
|
|
21059
|
-
throw new Error("topicId is required");
|
|
21060
|
-
}
|
|
21061
|
-
return gateway.request({
|
|
21062
|
-
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
21063
|
-
{
|
|
21064
|
-
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
21065
|
-
}
|
|
21066
|
-
)}`
|
|
21067
|
-
}).then(
|
|
21068
|
-
(response) => mapGatewayData(
|
|
21069
|
-
response,
|
|
21070
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
21071
|
-
)
|
|
21072
|
-
);
|
|
21073
|
-
},
|
|
21234
|
+
listReports,
|
|
21074
21235
|
/**
|
|
21075
21236
|
* Get a generated report.
|
|
21076
21237
|
*/
|
|
21077
|
-
|
|
21078
|
-
return gateway.request({
|
|
21079
|
-
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
21080
|
-
});
|
|
21081
|
-
}
|
|
21238
|
+
getReport
|
|
21082
21239
|
};
|
|
21083
21240
|
}
|
|
21084
21241
|
|
|
21085
21242
|
// ../sdk/src/schemaClient.ts
|
|
21086
21243
|
function createSchemaClient(config = {}) {
|
|
21087
21244
|
const gateway = createGatewayRequestClient(config);
|
|
21245
|
+
const createEntitlement = (input, idempotencyKey) => gateway.request({
|
|
21246
|
+
path: "/api/platform/v1/schema/entitlements",
|
|
21247
|
+
method: "POST",
|
|
21248
|
+
body: input,
|
|
21249
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21250
|
+
});
|
|
21088
21251
|
return {
|
|
21089
21252
|
/**
|
|
21090
21253
|
* List schema packs.
|
|
@@ -21136,29 +21299,95 @@ function createSchemaClient(config = {}) {
|
|
|
21136
21299
|
/**
|
|
21137
21300
|
* Create a schema entitlement.
|
|
21138
21301
|
*/
|
|
21139
|
-
|
|
21140
|
-
return gateway.request({
|
|
21141
|
-
path: "/api/platform/v1/schema/entitlements",
|
|
21142
|
-
method: "POST",
|
|
21143
|
-
body: input,
|
|
21144
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21145
|
-
});
|
|
21146
|
-
},
|
|
21302
|
+
createEntitlement,
|
|
21147
21303
|
/**
|
|
21148
21304
|
* Update a schema entitlement.
|
|
21149
21305
|
*/
|
|
21150
|
-
|
|
21151
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
21152
|
-
},
|
|
21306
|
+
updateEntitlement: createEntitlement,
|
|
21153
21307
|
/**
|
|
21154
21308
|
* @deprecated Use createEntitlement or updateEntitlement.
|
|
21155
21309
|
*/
|
|
21156
|
-
|
|
21157
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
21158
|
-
}
|
|
21310
|
+
upsertEntitlement: createEntitlement
|
|
21159
21311
|
};
|
|
21160
21312
|
}
|
|
21161
21313
|
|
|
21314
|
+
// ../sdk/src/clientHelpers.ts
|
|
21315
|
+
function asNodeArray(data) {
|
|
21316
|
+
const rows = asListItems(data, "nodes");
|
|
21317
|
+
if (rows.length > 0) {
|
|
21318
|
+
return rows.filter(
|
|
21319
|
+
(value) => Boolean(value) && typeof value === "object"
|
|
21320
|
+
);
|
|
21321
|
+
}
|
|
21322
|
+
if (data && typeof data === "object") {
|
|
21323
|
+
return [data];
|
|
21324
|
+
}
|
|
21325
|
+
return [];
|
|
21326
|
+
}
|
|
21327
|
+
function requireTopicId4(args) {
|
|
21328
|
+
const topicId = resolveTopicId(args);
|
|
21329
|
+
if (!topicId) {
|
|
21330
|
+
throw new Error("topicId is required");
|
|
21331
|
+
}
|
|
21332
|
+
return topicId;
|
|
21333
|
+
}
|
|
21334
|
+
function requireTopicOrProjectId(args) {
|
|
21335
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
21336
|
+
if (!topicId) {
|
|
21337
|
+
throw new Error("topicId is required");
|
|
21338
|
+
}
|
|
21339
|
+
return topicId;
|
|
21340
|
+
}
|
|
21341
|
+
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
21342
|
+
function matchesAuditNodeReference(value, nodeId) {
|
|
21343
|
+
if (Array.isArray(value)) {
|
|
21344
|
+
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
21345
|
+
}
|
|
21346
|
+
if (!value || typeof value !== "object") {
|
|
21347
|
+
return false;
|
|
21348
|
+
}
|
|
21349
|
+
return Object.entries(value).some(([key, entry]) => {
|
|
21350
|
+
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
21351
|
+
return true;
|
|
21352
|
+
}
|
|
21353
|
+
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
21354
|
+
return true;
|
|
21355
|
+
}
|
|
21356
|
+
return matchesAuditNodeReference(entry, nodeId);
|
|
21357
|
+
});
|
|
21358
|
+
}
|
|
21359
|
+
function requireText(args) {
|
|
21360
|
+
const text = resolveText(args);
|
|
21361
|
+
if (!text) {
|
|
21362
|
+
throw new Error("text is required");
|
|
21363
|
+
}
|
|
21364
|
+
return text;
|
|
21365
|
+
}
|
|
21366
|
+
function requireBaseRate(args) {
|
|
21367
|
+
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
21368
|
+
if (baseRate < 0 || baseRate > 1) {
|
|
21369
|
+
throw new Error("baseRate must be within [0, 1].");
|
|
21370
|
+
}
|
|
21371
|
+
return baseRate;
|
|
21372
|
+
}
|
|
21373
|
+
function sdkQueryString(input) {
|
|
21374
|
+
const params = new URLSearchParams();
|
|
21375
|
+
for (const [key, value] of Object.entries(input)) {
|
|
21376
|
+
if (value === void 0 || value === null) {
|
|
21377
|
+
continue;
|
|
21378
|
+
}
|
|
21379
|
+
if (Array.isArray(value)) {
|
|
21380
|
+
if (value.length > 0) {
|
|
21381
|
+
params.set(key, value.join(","));
|
|
21382
|
+
}
|
|
21383
|
+
continue;
|
|
21384
|
+
}
|
|
21385
|
+
params.set(key, String(value));
|
|
21386
|
+
}
|
|
21387
|
+
const serialized = params.toString();
|
|
21388
|
+
return serialized ? `?${serialized}` : "";
|
|
21389
|
+
}
|
|
21390
|
+
|
|
21162
21391
|
// ../sdk/src/telemetryClient.ts
|
|
21163
21392
|
var TELEMETRY_FIELDS = [
|
|
21164
21393
|
"tenantId",
|
|
@@ -21329,6 +21558,16 @@ function query4(input) {
|
|
|
21329
21558
|
cursor: input.cursor
|
|
21330
21559
|
};
|
|
21331
21560
|
}
|
|
21561
|
+
function effectiveToolsQuery(input) {
|
|
21562
|
+
return {
|
|
21563
|
+
...query4(input),
|
|
21564
|
+
callerRole: input.callerRole,
|
|
21565
|
+
surface: input.surface,
|
|
21566
|
+
sessionType: input.sessionType,
|
|
21567
|
+
permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
|
|
21568
|
+
executableOnly: input.executableOnly
|
|
21569
|
+
};
|
|
21570
|
+
}
|
|
21332
21571
|
function writeBody(input, operation) {
|
|
21333
21572
|
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
21334
21573
|
}
|
|
@@ -21357,7 +21596,9 @@ function createToolRegistryClient(config = {}) {
|
|
|
21357
21596
|
},
|
|
21358
21597
|
listEffectiveTools(input) {
|
|
21359
21598
|
return gateway.request({
|
|
21360
|
-
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
21599
|
+
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
21600
|
+
effectiveToolsQuery(input)
|
|
21601
|
+
)}`
|
|
21361
21602
|
}).then(
|
|
21362
21603
|
(response) => mapGatewayData(
|
|
21363
21604
|
response,
|
|
@@ -21448,7 +21689,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
21448
21689
|
}
|
|
21449
21690
|
|
|
21450
21691
|
// ../sdk/src/version.ts
|
|
21451
|
-
var LUCERN_SDK_VERSION = "0.
|
|
21692
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
|
|
21452
21693
|
|
|
21453
21694
|
// ../sdk/src/workflowClient.ts
|
|
21454
21695
|
function normalizeLensQuery(value) {
|
|
@@ -21642,12 +21883,6 @@ function createWorkflowClient(config = {}) {
|
|
|
21642
21883
|
)
|
|
21643
21884
|
);
|
|
21644
21885
|
},
|
|
21645
|
-
/**
|
|
21646
|
-
* @deprecated Use createWorktree.
|
|
21647
|
-
*/
|
|
21648
|
-
async addWorktree(input, idempotencyKey) {
|
|
21649
|
-
return client.createWorktree(input, idempotencyKey);
|
|
21650
|
-
},
|
|
21651
21886
|
/**
|
|
21652
21887
|
* Merge a worktree into the main belief line.
|
|
21653
21888
|
*/
|
|
@@ -21838,61 +22073,26 @@ function createWorkflowClient(config = {}) {
|
|
|
21838
22073
|
/**
|
|
21839
22074
|
* Update a workflow task.
|
|
21840
22075
|
*/
|
|
21841
|
-
async updateTask(taskId, input, idempotencyKey) {
|
|
21842
|
-
return gateway.request({
|
|
21843
|
-
path: `/api/platform/v1/workflow/tasks/${encodeURIComponent(taskId)}`,
|
|
21844
|
-
method: "PATCH",
|
|
21845
|
-
body: input,
|
|
21846
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
21847
|
-
});
|
|
21848
|
-
},
|
|
21849
|
-
/**
|
|
21850
|
-
* @deprecated Use createBranch.
|
|
21851
|
-
*/
|
|
21852
|
-
async createPillar(input, idempotencyKey) {
|
|
21853
|
-
return client.createBranch(input, idempotencyKey);
|
|
21854
|
-
},
|
|
21855
|
-
/**
|
|
21856
|
-
* @deprecated Use addWorktree.
|
|
21857
|
-
*/
|
|
21858
|
-
async createSprint(input, idempotencyKey) {
|
|
21859
|
-
return client.createWorktree(input, idempotencyKey);
|
|
21860
|
-
},
|
|
21861
|
-
/**
|
|
21862
|
-
* @deprecated Use merge.
|
|
21863
|
-
*/
|
|
21864
|
-
async completeSprint(worktreeId, input, idempotencyKey) {
|
|
21865
|
-
return client.merge(worktreeId, input, idempotencyKey);
|
|
21866
|
-
},
|
|
21867
|
-
/**
|
|
21868
|
-
* @deprecated Use openPullRequest.
|
|
21869
|
-
*/
|
|
21870
|
-
async requestReview(worktreeId, input, idempotencyKey) {
|
|
21871
|
-
return client.openPullRequest(worktreeId, input, idempotencyKey);
|
|
21872
|
-
},
|
|
21873
|
-
/**
|
|
21874
|
-
* @deprecated Use push.
|
|
21875
|
-
*/
|
|
21876
|
-
async publishFindings(worktreeId, input, idempotencyKey) {
|
|
21877
|
-
return client.push(worktreeId, input, idempotencyKey);
|
|
22076
|
+
async updateTask(taskId, input, idempotencyKey) {
|
|
22077
|
+
return gateway.request({
|
|
22078
|
+
path: `/api/platform/v1/workflow/tasks/${encodeURIComponent(taskId)}`,
|
|
22079
|
+
method: "PATCH",
|
|
22080
|
+
body: input,
|
|
22081
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
22082
|
+
});
|
|
21878
22083
|
}
|
|
21879
22084
|
};
|
|
21880
|
-
return client
|
|
22085
|
+
return Object.assign(client, {
|
|
22086
|
+
addWorktree: client.createWorktree,
|
|
22087
|
+
createPillar: client.createBranch,
|
|
22088
|
+
createSprint: client.createWorktree,
|
|
22089
|
+
completeSprint: client.merge,
|
|
22090
|
+
requestReview: client.openPullRequest,
|
|
22091
|
+
publishFindings: client.push
|
|
22092
|
+
});
|
|
21881
22093
|
}
|
|
21882
22094
|
|
|
21883
22095
|
// ../sdk/src/client.ts
|
|
21884
|
-
function asNodeArray(data) {
|
|
21885
|
-
const rows = asListItems(data, "nodes");
|
|
21886
|
-
if (rows.length > 0) {
|
|
21887
|
-
return rows.filter(
|
|
21888
|
-
(value) => Boolean(value) && typeof value === "object"
|
|
21889
|
-
);
|
|
21890
|
-
}
|
|
21891
|
-
if (data && typeof data === "object") {
|
|
21892
|
-
return [data];
|
|
21893
|
-
}
|
|
21894
|
-
return [];
|
|
21895
|
-
}
|
|
21896
22096
|
function toGatewayConfig(config) {
|
|
21897
22097
|
return {
|
|
21898
22098
|
baseUrl: config.baseUrl,
|
|
@@ -21920,72 +22120,9 @@ function toGatewayConfig(config) {
|
|
|
21920
22120
|
}
|
|
21921
22121
|
};
|
|
21922
22122
|
}
|
|
21923
|
-
function requireTopicId4(args) {
|
|
21924
|
-
const topicId = resolveTopicId(args);
|
|
21925
|
-
if (!topicId) {
|
|
21926
|
-
throw new Error("topicId is required");
|
|
21927
|
-
}
|
|
21928
|
-
return topicId;
|
|
21929
|
-
}
|
|
21930
|
-
function requireTopicOrProjectId(args) {
|
|
21931
|
-
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
21932
|
-
if (!topicId) {
|
|
21933
|
-
throw new Error("topicId is required");
|
|
21934
|
-
}
|
|
21935
|
-
return topicId;
|
|
21936
|
-
}
|
|
21937
|
-
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
21938
|
-
function matchesAuditNodeReference(value, nodeId) {
|
|
21939
|
-
if (Array.isArray(value)) {
|
|
21940
|
-
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
21941
|
-
}
|
|
21942
|
-
if (!value || typeof value !== "object") {
|
|
21943
|
-
return false;
|
|
21944
|
-
}
|
|
21945
|
-
return Object.entries(value).some(([key, entry]) => {
|
|
21946
|
-
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
21947
|
-
return true;
|
|
21948
|
-
}
|
|
21949
|
-
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
21950
|
-
return true;
|
|
21951
|
-
}
|
|
21952
|
-
return matchesAuditNodeReference(entry, nodeId);
|
|
21953
|
-
});
|
|
21954
|
-
}
|
|
21955
|
-
function requireText(args) {
|
|
21956
|
-
const text = resolveText(args);
|
|
21957
|
-
if (!text) {
|
|
21958
|
-
throw new Error("text is required");
|
|
21959
|
-
}
|
|
21960
|
-
return text;
|
|
21961
|
-
}
|
|
21962
|
-
function requireBaseRate(args) {
|
|
21963
|
-
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
21964
|
-
if (baseRate < 0 || baseRate > 1) {
|
|
21965
|
-
throw new Error("baseRate must be within [0, 1].");
|
|
21966
|
-
}
|
|
21967
|
-
return baseRate;
|
|
21968
|
-
}
|
|
21969
22123
|
function exposeGatewayData(response) {
|
|
21970
22124
|
return Object.assign({}, response, response.data);
|
|
21971
22125
|
}
|
|
21972
|
-
function sdkQueryString(input) {
|
|
21973
|
-
const params = new URLSearchParams();
|
|
21974
|
-
for (const [key, value] of Object.entries(input)) {
|
|
21975
|
-
if (value === void 0 || value === null) {
|
|
21976
|
-
continue;
|
|
21977
|
-
}
|
|
21978
|
-
if (Array.isArray(value)) {
|
|
21979
|
-
if (value.length > 0) {
|
|
21980
|
-
params.set(key, value.join(","));
|
|
21981
|
-
}
|
|
21982
|
-
continue;
|
|
21983
|
-
}
|
|
21984
|
-
params.set(key, String(value));
|
|
21985
|
-
}
|
|
21986
|
-
const serialized = params.toString();
|
|
21987
|
-
return serialized ? `?${serialized}` : "";
|
|
21988
|
-
}
|
|
21989
22126
|
function createLucernClient(config = {}) {
|
|
21990
22127
|
const gatewayConfig = toGatewayConfig(config);
|
|
21991
22128
|
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
@@ -22209,7 +22346,7 @@ function createLucernClient(config = {}) {
|
|
|
22209
22346
|
topicId,
|
|
22210
22347
|
nodeType: "contradiction",
|
|
22211
22348
|
limit: 500
|
|
22212
|
-
}) : args.nodeId ? await graphClient.
|
|
22349
|
+
}) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
|
|
22213
22350
|
const contradictions2 = asNodeArray(response.data).filter((node) => {
|
|
22214
22351
|
const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
|
|
22215
22352
|
if (args.status && status !== args.status) {
|
|
@@ -22389,23 +22526,15 @@ function createLucernClient(config = {}) {
|
|
|
22389
22526
|
}).then(exposeGatewayData);
|
|
22390
22527
|
}
|
|
22391
22528
|
const nodesNamespace = {
|
|
22392
|
-
list
|
|
22393
|
-
return graphClient.listNodes(query5);
|
|
22394
|
-
},
|
|
22529
|
+
list: graphClient.listNodes,
|
|
22395
22530
|
get(input) {
|
|
22396
22531
|
return graphClient.getNode(
|
|
22397
22532
|
typeof input === "string" ? { nodeId: input } : input
|
|
22398
22533
|
);
|
|
22399
22534
|
},
|
|
22400
|
-
create
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
update(input, idempotencyKey) {
|
|
22404
|
-
return graphClient.updateNode(input, idempotencyKey);
|
|
22405
|
-
},
|
|
22406
|
-
batchCreate(input, idempotencyKey) {
|
|
22407
|
-
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
22408
|
-
},
|
|
22535
|
+
create: graphClient.createNode,
|
|
22536
|
+
update: graphClient.updateNode,
|
|
22537
|
+
batchCreate: graphClient.batchCreateNodes,
|
|
22409
22538
|
listByTopicAndType(input) {
|
|
22410
22539
|
return gateway.request({
|
|
22411
22540
|
path: `/api/platform/v1/nodes${sdkQueryString({
|
|
@@ -22430,15 +22559,9 @@ function createLucernClient(config = {}) {
|
|
|
22430
22559
|
})}`
|
|
22431
22560
|
}).then(exposeGatewayData);
|
|
22432
22561
|
},
|
|
22433
|
-
supersede
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
verify(input, idempotencyKey) {
|
|
22437
|
-
return graphClient.verifyNode(input, idempotencyKey);
|
|
22438
|
-
},
|
|
22439
|
-
hardDelete(input, idempotencyKey) {
|
|
22440
|
-
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
22441
|
-
}
|
|
22562
|
+
supersede: graphClient.supersedeNode,
|
|
22563
|
+
verify: graphClient.verifyNode,
|
|
22564
|
+
hardDelete: graphClient.hardDeleteNode
|
|
22442
22565
|
};
|
|
22443
22566
|
const publicationNamespace = {
|
|
22444
22567
|
create(input, idempotencyKey) {
|
|
@@ -22515,9 +22638,7 @@ function createLucernClient(config = {}) {
|
|
|
22515
22638
|
return {
|
|
22516
22639
|
config,
|
|
22517
22640
|
version: LUCERN_SDK_VERSION,
|
|
22518
|
-
search
|
|
22519
|
-
return searchResources(query5, options);
|
|
22520
|
-
},
|
|
22641
|
+
search: searchResources,
|
|
22521
22642
|
events: {
|
|
22522
22643
|
list(query5 = {}) {
|
|
22523
22644
|
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
@@ -22614,9 +22735,7 @@ function createLucernClient(config = {}) {
|
|
|
22614
22735
|
confidenceHistory(nodeId) {
|
|
22615
22736
|
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
22616
22737
|
},
|
|
22617
|
-
opinionHistory
|
|
22618
|
-
return getOpinionHistory(nodeId);
|
|
22619
|
-
},
|
|
22738
|
+
opinionHistory: getOpinionHistory,
|
|
22620
22739
|
createContract(nodeId, input) {
|
|
22621
22740
|
return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
|
|
22622
22741
|
},
|
|
@@ -22870,10 +22989,10 @@ function createLucernClient(config = {}) {
|
|
|
22870
22989
|
}));
|
|
22871
22990
|
},
|
|
22872
22991
|
getHighPriority(args) {
|
|
22873
|
-
return
|
|
22992
|
+
return questionsFacade.list({
|
|
22874
22993
|
topicId: requireTopicId4(args),
|
|
22875
22994
|
status: args.includeAnswered ? void 0 : "open"
|
|
22876
|
-
}).then((data) => {
|
|
22995
|
+
}).then(exposeGatewayData).then((data) => {
|
|
22877
22996
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
22878
22997
|
const rank = (priority) => {
|
|
22879
22998
|
switch (priority) {
|
|
@@ -22903,9 +23022,7 @@ function createLucernClient(config = {}) {
|
|
|
22903
23022
|
},
|
|
22904
23023
|
graph: {
|
|
22905
23024
|
nodes: nodesNamespace,
|
|
22906
|
-
createEdge
|
|
22907
|
-
return graphClient.createEdge(input);
|
|
22908
|
-
},
|
|
23025
|
+
createEdge: graphClient.createEdge,
|
|
22909
23026
|
neighborhood(args) {
|
|
22910
23027
|
return graphFacade.neighborhood({
|
|
22911
23028
|
globalId: args.globalId,
|
|
@@ -22964,7 +23081,7 @@ function createLucernClient(config = {}) {
|
|
|
22964
23081
|
bisectConfidence,
|
|
22965
23082
|
listBeliefs,
|
|
22966
23083
|
detectConfirmationBias(topicId, threshold) {
|
|
22967
|
-
return
|
|
23084
|
+
return graphFacade.bias({
|
|
22968
23085
|
topicId,
|
|
22969
23086
|
threshold,
|
|
22970
23087
|
limit: 200
|
|
@@ -22975,7 +23092,7 @@ function createLucernClient(config = {}) {
|
|
|
22975
23092
|
}));
|
|
22976
23093
|
},
|
|
22977
23094
|
getStructureAnalysis(topicId) {
|
|
22978
|
-
return
|
|
23095
|
+
return graphFacade.analyze({
|
|
22979
23096
|
topicId,
|
|
22980
23097
|
limit: 200
|
|
22981
23098
|
}).then((response) => ({
|
|
@@ -23042,38 +23159,20 @@ function createLucernClient(config = {}) {
|
|
|
23042
23159
|
}
|
|
23043
23160
|
},
|
|
23044
23161
|
judgments: {
|
|
23045
|
-
create
|
|
23046
|
-
|
|
23047
|
-
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
list(query5) {
|
|
23052
|
-
return decisionsClient.listJudgments(query5);
|
|
23053
|
-
},
|
|
23054
|
-
get(judgmentId) {
|
|
23055
|
-
return decisionsClient.getJudgment(judgmentId);
|
|
23056
|
-
},
|
|
23057
|
-
recordOutcome(judgmentId, input) {
|
|
23058
|
-
return decisionsClient.recordJudgmentOutcome(judgmentId, input);
|
|
23059
|
-
},
|
|
23060
|
-
updateOutcome(judgmentId, input) {
|
|
23061
|
-
return decisionsClient.updateJudgmentOutcome(judgmentId, input);
|
|
23062
|
-
},
|
|
23162
|
+
create: decisionsClient.createJudgment,
|
|
23163
|
+
record: decisionsClient.recordJudgment,
|
|
23164
|
+
list: decisionsClient.listJudgments,
|
|
23165
|
+
get: decisionsClient.getJudgment,
|
|
23166
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
23167
|
+
updateOutcome: decisionsClient.updateJudgmentOutcome,
|
|
23063
23168
|
readiness(topicId) {
|
|
23064
|
-
return decisionsClient.getJudgmentReadiness({
|
|
23065
|
-
topicId
|
|
23066
|
-
});
|
|
23169
|
+
return decisionsClient.getJudgmentReadiness({ topicId });
|
|
23067
23170
|
},
|
|
23068
23171
|
calibration(topicId) {
|
|
23069
|
-
return decisionsClient.getJudgmentCalibration({
|
|
23070
|
-
topicId
|
|
23071
|
-
});
|
|
23172
|
+
return decisionsClient.getJudgmentCalibration({ topicId });
|
|
23072
23173
|
},
|
|
23073
23174
|
pendingOutcomeReview(topicId) {
|
|
23074
|
-
return decisionsClient.listPendingJudgmentOutcomeReview({
|
|
23075
|
-
topicId
|
|
23076
|
-
});
|
|
23175
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
|
|
23077
23176
|
},
|
|
23078
23177
|
transitionAuditIntegrity(args) {
|
|
23079
23178
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
@@ -23083,21 +23182,11 @@ function createLucernClient(config = {}) {
|
|
|
23083
23182
|
}
|
|
23084
23183
|
},
|
|
23085
23184
|
decisions: {
|
|
23086
|
-
create
|
|
23087
|
-
|
|
23088
|
-
|
|
23089
|
-
|
|
23090
|
-
|
|
23091
|
-
},
|
|
23092
|
-
list(query5) {
|
|
23093
|
-
return decisionsClient.listJudgments(query5);
|
|
23094
|
-
},
|
|
23095
|
-
get(decisionId) {
|
|
23096
|
-
return decisionsClient.getJudgment(decisionId);
|
|
23097
|
-
},
|
|
23098
|
-
recordOutcome(decisionId, input) {
|
|
23099
|
-
return decisionsClient.recordJudgmentOutcome(decisionId, input);
|
|
23100
|
-
},
|
|
23185
|
+
create: decisionsClient.createJudgment,
|
|
23186
|
+
record: decisionsClient.recordJudgment,
|
|
23187
|
+
list: decisionsClient.listJudgments,
|
|
23188
|
+
get: decisionsClient.getJudgment,
|
|
23189
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
23101
23190
|
lessons(decisionId, input, idempotencyKey) {
|
|
23102
23191
|
return gateway.request({
|
|
23103
23192
|
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
@@ -23129,21 +23218,11 @@ function createLucernClient(config = {}) {
|
|
|
23129
23218
|
}
|
|
23130
23219
|
},
|
|
23131
23220
|
worktrees: {
|
|
23132
|
-
createBranch
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
},
|
|
23138
|
-
listLenses(query5) {
|
|
23139
|
-
return workflowClient.listLenses(query5);
|
|
23140
|
-
},
|
|
23141
|
-
applyLensToTopic(input) {
|
|
23142
|
-
return workflowClient.applyLensToTopic(input);
|
|
23143
|
-
},
|
|
23144
|
-
removeLensFromTopic(input) {
|
|
23145
|
-
return workflowClient.removeLensFromTopic(input);
|
|
23146
|
-
},
|
|
23221
|
+
createBranch: workflowClient.createBranch,
|
|
23222
|
+
createLens: workflowClient.createLens,
|
|
23223
|
+
listLenses: workflowClient.listLenses,
|
|
23224
|
+
applyLensToTopic: workflowClient.applyLensToTopic,
|
|
23225
|
+
removeLensFromTopic: workflowClient.removeLensFromTopic,
|
|
23147
23226
|
create(input) {
|
|
23148
23227
|
return worktreesFacade.create({
|
|
23149
23228
|
title: input.title,
|
|
@@ -23248,7 +23327,9 @@ function createLucernClient(config = {}) {
|
|
|
23248
23327
|
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
23249
23328
|
(value) => typeof value === "string"
|
|
23250
23329
|
) : void 0;
|
|
23251
|
-
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23330
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23331
|
+
(value) => typeof value === "string"
|
|
23332
|
+
) : void 0;
|
|
23252
23333
|
return worktreesFacade.update({
|
|
23253
23334
|
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
23254
23335
|
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
@@ -23262,7 +23343,23 @@ function createLucernClient(config = {}) {
|
|
|
23262
23343
|
});
|
|
23263
23344
|
},
|
|
23264
23345
|
update(input) {
|
|
23265
|
-
|
|
23346
|
+
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
23347
|
+
(value) => typeof value === "string"
|
|
23348
|
+
) : void 0;
|
|
23349
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
23350
|
+
(value) => typeof value === "string"
|
|
23351
|
+
) : void 0;
|
|
23352
|
+
return worktreesFacade.update({
|
|
23353
|
+
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
23354
|
+
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
23355
|
+
campaign: typeof input.campaign === "number" ? input.campaign : void 0,
|
|
23356
|
+
lane: typeof input.lane === "string" ? input.lane : void 0,
|
|
23357
|
+
laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
|
|
23358
|
+
orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
|
|
23359
|
+
dependsOn,
|
|
23360
|
+
blocks,
|
|
23361
|
+
gate: typeof input.gate === "string" ? input.gate : void 0
|
|
23362
|
+
});
|
|
23266
23363
|
},
|
|
23267
23364
|
updateTargets(input) {
|
|
23268
23365
|
return worktreesFacade.updateTargets({
|
|
@@ -23273,9 +23370,7 @@ function createLucernClient(config = {}) {
|
|
|
23273
23370
|
removeQuestionIds: input.removeQuestionIds
|
|
23274
23371
|
});
|
|
23275
23372
|
},
|
|
23276
|
-
listAll
|
|
23277
|
-
return workflowClient.listAllWorktrees(query5);
|
|
23278
|
-
},
|
|
23373
|
+
listAll: workflowClient.listAllWorktrees,
|
|
23279
23374
|
merge(worktreeId, input) {
|
|
23280
23375
|
return worktreesFacade.merge({
|
|
23281
23376
|
id: worktreeId,
|
|
@@ -23283,18 +23378,12 @@ function createLucernClient(config = {}) {
|
|
|
23283
23378
|
summary: input.summary
|
|
23284
23379
|
});
|
|
23285
23380
|
},
|
|
23286
|
-
push
|
|
23287
|
-
|
|
23288
|
-
},
|
|
23289
|
-
openPullRequest(worktreeId, input) {
|
|
23290
|
-
return workflowClient.openPullRequest(worktreeId, input);
|
|
23291
|
-
},
|
|
23381
|
+
push: workflowClient.push,
|
|
23382
|
+
openPullRequest: workflowClient.openPullRequest,
|
|
23292
23383
|
pipelineSnapshot(topicId) {
|
|
23293
23384
|
return functionSurfaceClient.pipelineSnapshot({ topicId });
|
|
23294
23385
|
},
|
|
23295
|
-
complete
|
|
23296
|
-
return worktreesFacade.complete(input, idempotencyKey);
|
|
23297
|
-
},
|
|
23386
|
+
complete: worktreesFacade.complete,
|
|
23298
23387
|
advancePhase(worktreeId, idempotencyKey) {
|
|
23299
23388
|
return worktreesFacade.advancePhase(
|
|
23300
23389
|
{ worktreeId },
|
|
@@ -23307,12 +23396,8 @@ function createLucernClient(config = {}) {
|
|
|
23307
23396
|
idempotencyKey
|
|
23308
23397
|
);
|
|
23309
23398
|
},
|
|
23310
|
-
patchState
|
|
23311
|
-
|
|
23312
|
-
},
|
|
23313
|
-
bulkCreate(input, idempotencyKey) {
|
|
23314
|
-
return worktreesFacade.bulkCreate(input, idempotencyKey);
|
|
23315
|
-
}
|
|
23399
|
+
patchState: worktreesFacade.patchState,
|
|
23400
|
+
bulkCreate: worktreesFacade.bulkCreate
|
|
23316
23401
|
},
|
|
23317
23402
|
context: {
|
|
23318
23403
|
listTopics(query5 = {}) {
|
|
@@ -23323,27 +23408,15 @@ function createLucernClient(config = {}) {
|
|
|
23323
23408
|
type: query5.type
|
|
23324
23409
|
});
|
|
23325
23410
|
},
|
|
23326
|
-
compile
|
|
23327
|
-
|
|
23328
|
-
},
|
|
23329
|
-
recordScopeLearning(input, idempotencyKey) {
|
|
23330
|
-
return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
|
|
23331
|
-
},
|
|
23411
|
+
compile: contextClient.compile,
|
|
23412
|
+
recordScopeLearning: functionSurfaceClient.recordScopeLearning,
|
|
23332
23413
|
discover(input) {
|
|
23333
23414
|
return discoverTopics(input);
|
|
23334
23415
|
},
|
|
23335
|
-
analyzeTopicDensity
|
|
23336
|
-
|
|
23337
|
-
|
|
23338
|
-
|
|
23339
|
-
return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
|
|
23340
|
-
},
|
|
23341
|
-
seedBeliefLattice(input = {}, idempotencyKey) {
|
|
23342
|
-
return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
|
|
23343
|
-
},
|
|
23344
|
-
getLatticeCoverage(input = {}) {
|
|
23345
|
-
return functionSurfaceClient.getLatticeCoverage(input);
|
|
23346
|
-
},
|
|
23416
|
+
analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
|
|
23417
|
+
applyAutoBranching: functionSurfaceClient.applyAutoBranching,
|
|
23418
|
+
seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
|
|
23419
|
+
getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
|
|
23347
23420
|
matchEntityType(input) {
|
|
23348
23421
|
return ontologiesFacade.match(input).then(exposeGatewayData);
|
|
23349
23422
|
},
|
|
@@ -23428,9 +23501,7 @@ function createLucernClient(config = {}) {
|
|
|
23428
23501
|
type: input.type
|
|
23429
23502
|
});
|
|
23430
23503
|
},
|
|
23431
|
-
get
|
|
23432
|
-
return topicsFacade.get(topicId);
|
|
23433
|
-
},
|
|
23504
|
+
get: topicsFacade.get,
|
|
23434
23505
|
create(input) {
|
|
23435
23506
|
return topicsFacade.create({
|
|
23436
23507
|
name: input.name,
|
|
@@ -23475,12 +23546,8 @@ function createLucernClient(config = {}) {
|
|
|
23475
23546
|
maxDepth: query5.maxDepth
|
|
23476
23547
|
});
|
|
23477
23548
|
},
|
|
23478
|
-
remove
|
|
23479
|
-
|
|
23480
|
-
},
|
|
23481
|
-
bulkCreate(input, idempotencyKey) {
|
|
23482
|
-
return topicsFacade.bulkCreate(input, idempotencyKey);
|
|
23483
|
-
}
|
|
23549
|
+
remove: topicsFacade.remove,
|
|
23550
|
+
bulkCreate: topicsFacade.bulkCreate
|
|
23484
23551
|
},
|
|
23485
23552
|
answers: {
|
|
23486
23553
|
create(input) {
|
|
@@ -23579,33 +23646,15 @@ function createLucernClient(config = {}) {
|
|
|
23579
23646
|
raw: ontologyClient
|
|
23580
23647
|
},
|
|
23581
23648
|
coordination: {
|
|
23582
|
-
registerSession
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
|
|
23590
|
-
|
|
23591
|
-
listActiveSessions(input = {}) {
|
|
23592
|
-
return functionSurfaceClient.listActiveSessions(input);
|
|
23593
|
-
},
|
|
23594
|
-
sendAgentMessage(input, idempotencyKey) {
|
|
23595
|
-
return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
|
|
23596
|
-
},
|
|
23597
|
-
broadcastMessage(input, idempotencyKey) {
|
|
23598
|
-
return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
|
|
23599
|
-
},
|
|
23600
|
-
getInbox(input = {}) {
|
|
23601
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
23602
|
-
},
|
|
23603
|
-
getAgentInbox(input = {}) {
|
|
23604
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
23605
|
-
},
|
|
23606
|
-
claimFiles(input, idempotencyKey) {
|
|
23607
|
-
return functionSurfaceClient.claimFiles(input, idempotencyKey);
|
|
23608
|
-
}
|
|
23649
|
+
registerSession: functionSurfaceClient.registerSession,
|
|
23650
|
+
heartbeatSession: functionSurfaceClient.heartbeatSession,
|
|
23651
|
+
endSession: functionSurfaceClient.endSession,
|
|
23652
|
+
listActiveSessions: functionSurfaceClient.listActiveSessions,
|
|
23653
|
+
sendAgentMessage: functionSurfaceClient.sendAgentMessage,
|
|
23654
|
+
broadcastMessage: functionSurfaceClient.broadcastMessage,
|
|
23655
|
+
getInbox: functionSurfaceClient.getAgentInbox,
|
|
23656
|
+
getAgentInbox: functionSurfaceClient.getAgentInbox,
|
|
23657
|
+
claimFiles: functionSurfaceClient.claimFiles
|
|
23609
23658
|
},
|
|
23610
23659
|
policy: {
|
|
23611
23660
|
checkPermission(input) {
|
|
@@ -23636,38 +23685,24 @@ function createLucernClient(config = {}) {
|
|
|
23636
23685
|
principalId: typeof input.principalId === "string" ? input.principalId : void 0
|
|
23637
23686
|
});
|
|
23638
23687
|
},
|
|
23688
|
+
// Backward compatibility shim: keep the policy namespace exposing the
|
|
23689
|
+
// historical manageWritePolicy entry point.
|
|
23639
23690
|
manageWritePolicy(input, idempotencyKey) {
|
|
23640
23691
|
return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
|
|
23641
23692
|
},
|
|
23642
23693
|
raw: policyClient
|
|
23643
23694
|
},
|
|
23644
23695
|
observations: {
|
|
23645
|
-
ingest
|
|
23646
|
-
|
|
23647
|
-
|
|
23648
|
-
|
|
23649
|
-
return functionSurfaceClient.ingestObservation(input, idempotencyKey);
|
|
23650
|
-
},
|
|
23651
|
-
getContext(input) {
|
|
23652
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
23653
|
-
},
|
|
23654
|
-
getObservationContext(input) {
|
|
23655
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
23656
|
-
}
|
|
23696
|
+
ingest: functionSurfaceClient.ingestObservation,
|
|
23697
|
+
ingestObservation: functionSurfaceClient.ingestObservation,
|
|
23698
|
+
getContext: functionSurfaceClient.getObservationContext,
|
|
23699
|
+
getObservationContext: functionSurfaceClient.getObservationContext
|
|
23657
23700
|
},
|
|
23658
23701
|
coding: {
|
|
23659
|
-
getCodeContext
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
return functionSurfaceClient.getChangeHistory(input);
|
|
23664
|
-
},
|
|
23665
|
-
recordAttempt(input, idempotencyKey) {
|
|
23666
|
-
return functionSurfaceClient.recordAttempt(input, idempotencyKey);
|
|
23667
|
-
},
|
|
23668
|
-
getFailureLog(input) {
|
|
23669
|
-
return functionSurfaceClient.getFailureLog(input);
|
|
23670
|
-
}
|
|
23702
|
+
getCodeContext: functionSurfaceClient.getCodeContext,
|
|
23703
|
+
getChangeHistory: functionSurfaceClient.getChangeHistory,
|
|
23704
|
+
recordAttempt: functionSurfaceClient.recordAttempt,
|
|
23705
|
+
getFailureLog: functionSurfaceClient.getFailureLog
|
|
23671
23706
|
},
|
|
23672
23707
|
contracts: {
|
|
23673
23708
|
create(input) {
|
|
@@ -23693,9 +23728,7 @@ function createLucernClient(config = {}) {
|
|
|
23693
23728
|
}
|
|
23694
23729
|
},
|
|
23695
23730
|
bootstrap: {
|
|
23696
|
-
generateSessionHandoff
|
|
23697
|
-
return functionSurfaceClient.generateSessionHandoff(input);
|
|
23698
|
-
}
|
|
23731
|
+
generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
|
|
23699
23732
|
},
|
|
23700
23733
|
embeddings: embeddingsClient,
|
|
23701
23734
|
graphAnalysis: graphAnalysisClient,
|
|
@@ -23717,25 +23750,15 @@ function createLucernClient(config = {}) {
|
|
|
23717
23750
|
createAcl: toolRegistryClient.createAcl,
|
|
23718
23751
|
deleteAcl: toolRegistryClient.deleteAcl,
|
|
23719
23752
|
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
23720
|
-
register
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
return unregisterCustomTool(fullName);
|
|
23725
|
-
},
|
|
23726
|
-
list() {
|
|
23727
|
-
return listRegisteredCustomTools();
|
|
23728
|
-
},
|
|
23729
|
-
clear() {
|
|
23730
|
-
clearRegisteredCustomTools();
|
|
23731
|
-
},
|
|
23753
|
+
register: registerCustomTool,
|
|
23754
|
+
unregister: unregisterCustomTool,
|
|
23755
|
+
list: listRegisteredCustomTools,
|
|
23756
|
+
clear: clearRegisteredCustomTools,
|
|
23732
23757
|
invoke(name, input = {}) {
|
|
23733
23758
|
const fullName = name.includes(".") ? name : `custom.${name}`;
|
|
23734
23759
|
return invokeCustomTool(fullName, input);
|
|
23735
23760
|
},
|
|
23736
|
-
namespace
|
|
23737
|
-
return getCustomNamespace(namespace);
|
|
23738
|
-
}
|
|
23761
|
+
namespace: getCustomNamespace
|
|
23739
23762
|
},
|
|
23740
23763
|
packs: {
|
|
23741
23764
|
/**
|
|
@@ -23750,27 +23773,13 @@ function createLucernClient(config = {}) {
|
|
|
23750
23773
|
get isInstalled() {
|
|
23751
23774
|
return _packInstalled;
|
|
23752
23775
|
},
|
|
23753
|
-
listCatalog
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
return packsClient.listStates(scope);
|
|
23761
|
-
},
|
|
23762
|
-
states(scope) {
|
|
23763
|
-
return packsClient.getStates(scope);
|
|
23764
|
-
},
|
|
23765
|
-
install(input) {
|
|
23766
|
-
return packsClient.install(input);
|
|
23767
|
-
},
|
|
23768
|
-
enable(input) {
|
|
23769
|
-
return packsClient.enable(input);
|
|
23770
|
-
},
|
|
23771
|
-
disable(input) {
|
|
23772
|
-
return packsClient.disable(input);
|
|
23773
|
-
}
|
|
23776
|
+
listCatalog: packsClient.listCatalog,
|
|
23777
|
+
catalog: packsClient.listCatalog,
|
|
23778
|
+
listStates: packsClient.listStates,
|
|
23779
|
+
states: packsClient.getStates,
|
|
23780
|
+
install: packsClient.install,
|
|
23781
|
+
enable: packsClient.enable,
|
|
23782
|
+
disable: packsClient.disable
|
|
23774
23783
|
},
|
|
23775
23784
|
nodes: nodesNamespace,
|
|
23776
23785
|
identity: {
|
|
@@ -23783,30 +23792,16 @@ function createLucernClient(config = {}) {
|
|
|
23783
23792
|
raw: identityClient
|
|
23784
23793
|
},
|
|
23785
23794
|
mcp: {
|
|
23786
|
-
bootstrapSession
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
},
|
|
23792
|
-
beginBuildSession(input) {
|
|
23793
|
-
return mcpClient.beginBuildSession(input);
|
|
23794
|
-
},
|
|
23795
|
-
evaluateEngineeringContract(input) {
|
|
23796
|
-
return mcpClient.evaluateEngineeringContract(input);
|
|
23797
|
-
},
|
|
23798
|
-
evaluateResearchContract(input) {
|
|
23799
|
-
return mcpClient.evaluateResearchContract(input);
|
|
23800
|
-
}
|
|
23795
|
+
bootstrapSession: mcpClient.bootstrapSession,
|
|
23796
|
+
checkWritePolicy: mcpClient.checkWritePolicy,
|
|
23797
|
+
beginBuildSession: mcpClient.beginBuildSession,
|
|
23798
|
+
evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
|
|
23799
|
+
evaluateResearchContract: mcpClient.evaluateResearchContract
|
|
23801
23800
|
},
|
|
23802
23801
|
auth: {
|
|
23803
23802
|
device: {
|
|
23804
|
-
createCode
|
|
23805
|
-
|
|
23806
|
-
},
|
|
23807
|
-
pollToken(deviceCode) {
|
|
23808
|
-
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
23809
|
-
}
|
|
23803
|
+
createCode: authDeviceClient.createDeviceCode,
|
|
23804
|
+
pollToken: authDeviceClient.pollDeviceToken
|
|
23810
23805
|
}
|
|
23811
23806
|
},
|
|
23812
23807
|
custom: getCustomNamespace("custom"),
|
|
@@ -23859,50 +23854,55 @@ function cleanNumber2(value) {
|
|
|
23859
23854
|
function cleanBoolean2(value) {
|
|
23860
23855
|
return typeof value === "boolean" ? value : void 0;
|
|
23861
23856
|
}
|
|
23862
|
-
function buildCompileContextRequest2(
|
|
23863
|
-
const
|
|
23864
|
-
const
|
|
23857
|
+
function buildCompileContextRequest2(topicIdOrInput = {}, input = {}) {
|
|
23858
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
23859
|
+
const payload = {};
|
|
23860
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString6(topicIdOrInput) : cleanString6(effectiveInput.topicId);
|
|
23861
|
+
if (topicId) {
|
|
23862
|
+
payload.topicId = topicId;
|
|
23863
|
+
}
|
|
23864
|
+
const query5 = cleanString6(effectiveInput.query);
|
|
23865
23865
|
if (query5) {
|
|
23866
23866
|
payload.query = query5;
|
|
23867
23867
|
}
|
|
23868
|
-
const budget = cleanNumber2(
|
|
23868
|
+
const budget = cleanNumber2(effectiveInput.budget) ?? cleanNumber2(effectiveInput.tokenBudget);
|
|
23869
23869
|
if (budget !== void 0) {
|
|
23870
23870
|
payload.budget = budget;
|
|
23871
23871
|
}
|
|
23872
|
-
const ranking = cleanString6(
|
|
23872
|
+
const ranking = cleanString6(effectiveInput.ranking) ?? cleanString6(effectiveInput.rankingProfile);
|
|
23873
23873
|
if (ranking) {
|
|
23874
23874
|
payload.ranking = ranking;
|
|
23875
23875
|
}
|
|
23876
|
-
const limit = cleanNumber2(
|
|
23876
|
+
const limit = cleanNumber2(effectiveInput.limit);
|
|
23877
23877
|
if (limit !== void 0) {
|
|
23878
23878
|
payload.limit = limit;
|
|
23879
23879
|
}
|
|
23880
|
-
const maxDepth = cleanNumber2(
|
|
23880
|
+
const maxDepth = cleanNumber2(effectiveInput.maxDepth);
|
|
23881
23881
|
if (maxDepth !== void 0) {
|
|
23882
23882
|
payload.maxDepth = maxDepth;
|
|
23883
23883
|
}
|
|
23884
|
-
const includeEntities = cleanBoolean2(
|
|
23884
|
+
const includeEntities = cleanBoolean2(effectiveInput.includeEntities);
|
|
23885
23885
|
if (includeEntities !== void 0) {
|
|
23886
23886
|
payload.includeEntities = includeEntities;
|
|
23887
23887
|
}
|
|
23888
|
-
const mode = cleanString6(
|
|
23888
|
+
const mode = cleanString6(effectiveInput.mode);
|
|
23889
23889
|
if (mode) {
|
|
23890
23890
|
payload.mode = mode;
|
|
23891
23891
|
}
|
|
23892
|
-
const includeFailures = cleanBoolean2(
|
|
23892
|
+
const includeFailures = cleanBoolean2(effectiveInput.includeFailures);
|
|
23893
23893
|
if (includeFailures !== void 0) {
|
|
23894
23894
|
payload.includeFailures = includeFailures;
|
|
23895
23895
|
}
|
|
23896
|
-
const worktreeId = cleanString6(
|
|
23896
|
+
const worktreeId = cleanString6(effectiveInput.worktreeId);
|
|
23897
23897
|
if (worktreeId) {
|
|
23898
23898
|
payload.worktreeId = worktreeId;
|
|
23899
23899
|
}
|
|
23900
|
-
const sessionId = cleanString6(
|
|
23900
|
+
const sessionId = cleanString6(effectiveInput.sessionId);
|
|
23901
23901
|
if (sessionId) {
|
|
23902
23902
|
payload.sessionId = sessionId;
|
|
23903
23903
|
}
|
|
23904
|
-
if (Array.isArray(
|
|
23905
|
-
payload.packWeightOverrides =
|
|
23904
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
23905
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
23906
23906
|
}
|
|
23907
23907
|
return {
|
|
23908
23908
|
path: "/api/platform/v1/context/compile",
|
|
@@ -23912,8 +23912,12 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
23912
23912
|
}
|
|
23913
23913
|
function createContextFacade(config) {
|
|
23914
23914
|
return {
|
|
23915
|
-
compile(
|
|
23916
|
-
const request = buildCompileContextRequest2(
|
|
23915
|
+
compile(topicIdOrInput = {}, input = {}) {
|
|
23916
|
+
const request = buildCompileContextRequest2(topicIdOrInput, input);
|
|
23917
|
+
return config.transport.request(request);
|
|
23918
|
+
},
|
|
23919
|
+
compileByQuery(input = {}) {
|
|
23920
|
+
const request = buildCompileContextRequest2(input);
|
|
23917
23921
|
return config.transport.request(request);
|
|
23918
23922
|
}
|
|
23919
23923
|
};
|
|
@@ -23992,17 +23996,11 @@ var TOKENS_PER_WORD = 1.35;
|
|
|
23992
23996
|
var MIN_TOKEN_ESTIMATE = 8;
|
|
23993
23997
|
|
|
23994
23998
|
// ../sdk/src/contextPackPolicy.ts
|
|
23995
|
-
function nowMs() {
|
|
23996
|
-
return Date.now();
|
|
23997
|
-
}
|
|
23998
|
-
function normalizeText(text) {
|
|
23999
|
-
return text.trim().toLowerCase();
|
|
24000
|
-
}
|
|
24001
23999
|
function tokenHits(text, tokens) {
|
|
24002
24000
|
if (tokens.length === 0) {
|
|
24003
24001
|
return 1;
|
|
24004
24002
|
}
|
|
24005
|
-
const haystack =
|
|
24003
|
+
const haystack = text.trim().toLowerCase();
|
|
24006
24004
|
let hits = 0;
|
|
24007
24005
|
for (const token of tokens) {
|
|
24008
24006
|
if (haystack.includes(token)) {
|
|
@@ -24017,7 +24015,7 @@ function clamp013(value) {
|
|
|
24017
24015
|
}
|
|
24018
24016
|
return Math.max(0, Math.min(1, value));
|
|
24019
24017
|
}
|
|
24020
|
-
function recencyScore(updatedAt, referenceTimeMs =
|
|
24018
|
+
function recencyScore(updatedAt, referenceTimeMs = Date.now()) {
|
|
24021
24019
|
if (!updatedAt || !Number.isFinite(updatedAt)) {
|
|
24022
24020
|
return 0.25;
|
|
24023
24021
|
}
|
|
@@ -24033,15 +24031,15 @@ function confidenceScore(confidence) {
|
|
|
24033
24031
|
return clamp013(confidence);
|
|
24034
24032
|
}
|
|
24035
24033
|
function priorityScore(priority) {
|
|
24036
|
-
const value =
|
|
24034
|
+
const value = (priority || "").trim().toLowerCase();
|
|
24037
24035
|
return PRIORITY_SCORES[value] ?? DEFAULT_PRIORITY_SCORE;
|
|
24038
24036
|
}
|
|
24039
24037
|
function severityScore(severity) {
|
|
24040
|
-
const value =
|
|
24038
|
+
const value = (severity || "").trim().toLowerCase();
|
|
24041
24039
|
return SEVERITY_SCORES[value] ?? DEFAULT_SEVERITY_SCORE;
|
|
24042
24040
|
}
|
|
24043
24041
|
function beliefTypeBonus(beliefType) {
|
|
24044
|
-
const value =
|
|
24042
|
+
const value = (beliefType || "").trim().toLowerCase();
|
|
24045
24043
|
return BELIEF_TYPE_BONUS[value] ?? DEFAULT_BELIEF_TYPE_BONUS;
|
|
24046
24044
|
}
|
|
24047
24045
|
function resolveEffectiveWeights(overrides) {
|
|
@@ -24067,7 +24065,7 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
24067
24065
|
}
|
|
24068
24066
|
const ts = candidate.updatedAt || candidate.createdAt || null;
|
|
24069
24067
|
if (ts && Number.isFinite(ts)) {
|
|
24070
|
-
const ageDays = Math.max(0,
|
|
24068
|
+
const ageDays = Math.max(0, Date.now() - ts) / (1e3 * 60 * 60 * 24);
|
|
24071
24069
|
if (ageDays < 1) {
|
|
24072
24070
|
parts.push("updated today");
|
|
24073
24071
|
} else if (ageDays < 7) {
|
|
@@ -24092,10 +24090,6 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
24092
24090
|
}
|
|
24093
24091
|
return parts.join(", ");
|
|
24094
24092
|
}
|
|
24095
|
-
function computeBaselineScore(candidate, queryTokens) {
|
|
24096
|
-
const hits = tokenHits(candidate.text, queryTokens);
|
|
24097
|
-
return queryTokens.length === 0 ? 1 : hits;
|
|
24098
|
-
}
|
|
24099
24093
|
function computeWeightedScore(section, candidate, queryTokens, effectiveWeights, referenceTimeMs) {
|
|
24100
24094
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
24101
24095
|
const queryComponent = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(candidate.text, queryTokens) / queryTokens.length);
|
|
@@ -24129,7 +24123,7 @@ function rankContextSection(section, rows, queryTokens, limit, profile, options)
|
|
|
24129
24123
|
queryTokens,
|
|
24130
24124
|
effectiveWeights,
|
|
24131
24125
|
referenceTimeMs
|
|
24132
|
-
) :
|
|
24126
|
+
) : queryTokens.length === 0 ? 1 : tokenHits(row.text, queryTokens);
|
|
24133
24127
|
const result = { ...row, score };
|
|
24134
24128
|
if (includeJustifications && profile === "weighted_v1") {
|
|
24135
24129
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
@@ -24496,18 +24490,21 @@ function normalizeQueryTokens(query5) {
|
|
|
24496
24490
|
function parseRankingProfile(value) {
|
|
24497
24491
|
return value === "baseline_v1" ? "baseline_v1" : "weighted_v1";
|
|
24498
24492
|
}
|
|
24493
|
+
function isRecord9(value) {
|
|
24494
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24495
|
+
}
|
|
24499
24496
|
function beliefTypeOf(node) {
|
|
24500
24497
|
if (typeof node.beliefType === "string") {
|
|
24501
24498
|
return node.beliefType;
|
|
24502
24499
|
}
|
|
24503
|
-
const metadata = node.metadata
|
|
24500
|
+
const metadata = isRecord9(node.metadata) ? node.metadata : {};
|
|
24504
24501
|
if (typeof metadata.beliefType === "string") {
|
|
24505
24502
|
return metadata.beliefType;
|
|
24506
24503
|
}
|
|
24507
24504
|
return "";
|
|
24508
24505
|
}
|
|
24509
24506
|
function questionStatusOf(node) {
|
|
24510
|
-
const metadata = node.metadata
|
|
24507
|
+
const metadata = isRecord9(node.metadata) ? node.metadata : {};
|
|
24511
24508
|
const direct = typeof node.status === "string" ? node.status : "";
|
|
24512
24509
|
const questionStatus = typeof metadata.questionStatus === "string" ? metadata.questionStatus : "";
|
|
24513
24510
|
return (questionStatus || direct || "open").toLowerCase();
|
|
@@ -24523,9 +24520,6 @@ function isOpenQuestion(status) {
|
|
|
24523
24520
|
"belief_forked"
|
|
24524
24521
|
].includes(status);
|
|
24525
24522
|
}
|
|
24526
|
-
function metadataText(payload) {
|
|
24527
|
-
return JSON.stringify(payload).toLowerCase();
|
|
24528
|
-
}
|
|
24529
24523
|
function collectTopicNeighborhood(topics2, rootTopicId, maxDescendantDepth = 2) {
|
|
24530
24524
|
const byId = /* @__PURE__ */ new Map();
|
|
24531
24525
|
const children = /* @__PURE__ */ new Map();
|
|
@@ -24587,11 +24581,10 @@ function dedupeById(rows) {
|
|
|
24587
24581
|
return output;
|
|
24588
24582
|
}
|
|
24589
24583
|
function candidateTimestamp(candidate) {
|
|
24590
|
-
if (!candidate
|
|
24584
|
+
if (!isRecord9(candidate)) {
|
|
24591
24585
|
return 0;
|
|
24592
24586
|
}
|
|
24593
|
-
const
|
|
24594
|
-
const timestamps = [record.updatedAt, record.createdAt, record.generatedAt].filter(
|
|
24587
|
+
const timestamps = [candidate.updatedAt, candidate.createdAt, candidate.generatedAt].filter(
|
|
24595
24588
|
(value) => typeof value === "number" && Number.isFinite(value)
|
|
24596
24589
|
);
|
|
24597
24590
|
return timestamps.length > 0 ? Math.max(...timestamps) : 0;
|
|
@@ -24713,7 +24706,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24713
24706
|
beliefType: beliefTypeOf(belief) || null,
|
|
24714
24707
|
status: belief.status || "active",
|
|
24715
24708
|
updatedAt: belief.updatedAt || belief.createdAt || null,
|
|
24716
|
-
metadataText: belief.metadata && typeof belief.metadata === "object" ?
|
|
24709
|
+
metadataText: belief.metadata && typeof belief.metadata === "object" ? JSON.stringify(belief.metadata).toLowerCase() : ""
|
|
24717
24710
|
}));
|
|
24718
24711
|
const activeBeliefs = rankContextSection(
|
|
24719
24712
|
"activeBeliefs",
|
|
@@ -24745,7 +24738,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24745
24738
|
status,
|
|
24746
24739
|
priority: typeof metadata.priority === "string" ? metadata.priority : "medium",
|
|
24747
24740
|
updatedAt: question.updatedAt || question.createdAt || null,
|
|
24748
|
-
metadataText:
|
|
24741
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
24749
24742
|
};
|
|
24750
24743
|
}).filter((row) => isOpenQuestion(row.status));
|
|
24751
24744
|
const openQuestions = rankContextSection(
|
|
@@ -24777,7 +24770,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24777
24770
|
kind: typeof metadata.kind === "string" && metadata.kind || "observation",
|
|
24778
24771
|
createdAt: item.createdAt || null,
|
|
24779
24772
|
updatedAt: item.updatedAt || item.createdAt || null,
|
|
24780
|
-
metadataText:
|
|
24773
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
24781
24774
|
};
|
|
24782
24775
|
});
|
|
24783
24776
|
const recentEvidence = rankContextSection(
|
|
@@ -24859,7 +24852,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24859
24852
|
let failureContext;
|
|
24860
24853
|
if (snapshot.plan.includeFailures && snapshot.failures) {
|
|
24861
24854
|
const allFailures = snapshot.failures.filter((node) => {
|
|
24862
|
-
const metadata = node.metadata
|
|
24855
|
+
const metadata = isRecord9(node.metadata) ? node.metadata : {};
|
|
24863
24856
|
return metadata.failedApproach === true || metadata.isFailedAttempt === true;
|
|
24864
24857
|
});
|
|
24865
24858
|
const rankedFailures = rankContextSection(
|
|
@@ -24877,7 +24870,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
24877
24870
|
);
|
|
24878
24871
|
const failures = rankedFailures.map((row) => {
|
|
24879
24872
|
const original = allFailures.find((node) => String(node._id) === row.id);
|
|
24880
|
-
const metadata = original?.metadata
|
|
24873
|
+
const metadata = isRecord9(original?.metadata) ? original?.metadata : {};
|
|
24881
24874
|
return {
|
|
24882
24875
|
attemptId: row.id,
|
|
24883
24876
|
approach: String(row.text || ""),
|
|
@@ -25361,9 +25354,7 @@ function lastDelegator(delegationChain) {
|
|
|
25361
25354
|
|
|
25362
25355
|
// ../sdk/src/contracts/lens-filter.contract.ts
|
|
25363
25356
|
function isLensFilterCriteria2(value) {
|
|
25364
|
-
|
|
25365
|
-
const obj = value;
|
|
25366
|
-
return typeof obj.version === "number" && typeof obj.kind === "string";
|
|
25357
|
+
return isRecord10(value) && typeof value.version === "number" && typeof value.kind === "string";
|
|
25367
25358
|
}
|
|
25368
25359
|
function isTaxonomyFilterCriteriaV12(value) {
|
|
25369
25360
|
if (!isLensFilterCriteria2(value)) return false;
|
|
@@ -25392,6 +25383,9 @@ function validateFilterCriteria2(value) {
|
|
|
25392
25383
|
]
|
|
25393
25384
|
};
|
|
25394
25385
|
}
|
|
25386
|
+
function isRecord10(value) {
|
|
25387
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25388
|
+
}
|
|
25395
25389
|
function validateTaxonomyFilterV1(criteria) {
|
|
25396
25390
|
const errors = [];
|
|
25397
25391
|
if (!Array.isArray(criteria.entityTypeFilters)) {
|
|
@@ -25898,6 +25892,9 @@ function fromBase64(value) {
|
|
|
25898
25892
|
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
25899
25893
|
return decodeURIComponent(escape(atob(normalized)));
|
|
25900
25894
|
}
|
|
25895
|
+
function isRecord11(value) {
|
|
25896
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
25897
|
+
}
|
|
25901
25898
|
function createEventId() {
|
|
25902
25899
|
const random = typeof globalThis.crypto?.randomUUID === "function" ? globalThis.crypto.randomUUID().replace(/-/g, "") : Array.from(
|
|
25903
25900
|
typeof globalThis.crypto?.getRandomValues === "function" ? globalThis.crypto.getRandomValues(new Uint8Array(16)) : Array.from({ length: 16 }, () => Math.floor(Math.random() * 256)),
|
|
@@ -25946,14 +25943,14 @@ function decodeEventCursor(cursor) {
|
|
|
25946
25943
|
}
|
|
25947
25944
|
try {
|
|
25948
25945
|
const parsed = JSON.parse(fromBase64(cursor.trim()));
|
|
25949
|
-
if (typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
25946
|
+
if (!isRecord11(parsed) || typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
25950
25947
|
return null;
|
|
25951
25948
|
}
|
|
25952
25949
|
return {
|
|
25953
25950
|
timestamp: parsed.timestamp,
|
|
25954
25951
|
eventId: parsed.eventId.trim()
|
|
25955
25952
|
};
|
|
25956
|
-
} catch {
|
|
25953
|
+
} catch (error) {
|
|
25957
25954
|
return null;
|
|
25958
25955
|
}
|
|
25959
25956
|
}
|
|
@@ -25982,7 +25979,7 @@ var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"])
|
|
|
25982
25979
|
function normalizeUrl(url) {
|
|
25983
25980
|
try {
|
|
25984
25981
|
return new URL(url.trim());
|
|
25985
|
-
} catch {
|
|
25982
|
+
} catch (error) {
|
|
25986
25983
|
throw new Error("Webhook URL must be a valid absolute URL.");
|
|
25987
25984
|
}
|
|
25988
25985
|
}
|
|
@@ -26228,6 +26225,9 @@ function hasValue(value) {
|
|
|
26228
26225
|
}
|
|
26229
26226
|
return true;
|
|
26230
26227
|
}
|
|
26228
|
+
function isRecord12(value) {
|
|
26229
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
26230
|
+
}
|
|
26231
26231
|
function normalizeToolExecutionParams(params) {
|
|
26232
26232
|
const normalized = { ...params };
|
|
26233
26233
|
for (const aliases of SCOPE_ALIAS_GROUPS) {
|
|
@@ -26250,16 +26250,19 @@ function parseToolExecutionMetadata(result) {
|
|
|
26250
26250
|
}
|
|
26251
26251
|
try {
|
|
26252
26252
|
const payload = JSON.parse(raw);
|
|
26253
|
+
if (!isRecord12(payload)) {
|
|
26254
|
+
return { isError: Boolean(result.isError) };
|
|
26255
|
+
}
|
|
26253
26256
|
return {
|
|
26254
26257
|
isError: Boolean(result.isError),
|
|
26255
26258
|
code: typeof payload.code === "string" ? payload.code : void 0,
|
|
26256
26259
|
status: typeof payload.status === "number" ? payload.status : void 0,
|
|
26257
|
-
correlationId:
|
|
26258
|
-
policyTraceId:
|
|
26259
|
-
invariant:
|
|
26260
|
+
correlationId: optionalStringOrNull(payload.correlationId),
|
|
26261
|
+
policyTraceId: optionalStringOrNull(payload.policyTraceId),
|
|
26262
|
+
invariant: optionalStringOrNull(payload.invariant)
|
|
26260
26263
|
};
|
|
26261
|
-
} catch {
|
|
26262
|
-
return
|
|
26264
|
+
} catch (error) {
|
|
26265
|
+
return ignoreMalformedToolMetadata(error, result);
|
|
26263
26266
|
}
|
|
26264
26267
|
}
|
|
26265
26268
|
async function executeToolWithEnvelope(args) {
|
|
@@ -26277,6 +26280,15 @@ async function executeToolWithEnvelope(args) {
|
|
|
26277
26280
|
});
|
|
26278
26281
|
return result;
|
|
26279
26282
|
}
|
|
26283
|
+
function ignoreMalformedToolMetadata(_error, result) {
|
|
26284
|
+
return { isError: Boolean(result.isError) };
|
|
26285
|
+
}
|
|
26286
|
+
function optionalStringOrNull(value) {
|
|
26287
|
+
if (typeof value === "string" || value === null) {
|
|
26288
|
+
return value;
|
|
26289
|
+
}
|
|
26290
|
+
return void 0;
|
|
26291
|
+
}
|
|
26280
26292
|
|
|
26281
26293
|
// src/types.ts
|
|
26282
26294
|
var McpHandlerError = class extends Error {
|
|
@@ -26663,24 +26675,27 @@ function readResultString(value, key) {
|
|
|
26663
26675
|
}
|
|
26664
26676
|
function createContextHandlers(context) {
|
|
26665
26677
|
const compiler = createContextClient(context.sdkConfig);
|
|
26678
|
+
const functionSurface = createFunctionSurfaceClient(context.sdkConfig);
|
|
26666
26679
|
return {
|
|
26667
26680
|
compile_context: contractToHandler(
|
|
26668
26681
|
MCP_TOOL_CONTRACTS.compile_context,
|
|
26669
26682
|
async (params) => {
|
|
26670
|
-
const topicId = readTopicId4(params
|
|
26671
|
-
const
|
|
26672
|
-
|
|
26673
|
-
{
|
|
26674
|
-
|
|
26675
|
-
|
|
26676
|
-
|
|
26677
|
-
|
|
26678
|
-
|
|
26679
|
-
|
|
26680
|
-
|
|
26681
|
-
|
|
26682
|
-
|
|
26683
|
-
|
|
26683
|
+
const topicId = readTopicId4(params);
|
|
26684
|
+
const query5 = readString3(params, "query");
|
|
26685
|
+
const input = {
|
|
26686
|
+
...query5 ? { query: query5 } : {},
|
|
26687
|
+
...readNumber2(params, "budget") !== void 0 ? { budget: readNumber2(params, "budget") } : {},
|
|
26688
|
+
...readString3(params, "ranking") ? {
|
|
26689
|
+
ranking: readString3(params, "ranking")
|
|
26690
|
+
} : {},
|
|
26691
|
+
...readNumber2(params, "limit") !== void 0 ? { limit: readNumber2(params, "limit") } : {},
|
|
26692
|
+
...readNumber2(params, "maxDepth") !== void 0 ? { maxDepth: readNumber2(params, "maxDepth") } : {},
|
|
26693
|
+
...readBoolean(params, "includeEntities") !== void 0 ? { includeEntities: readBoolean(params, "includeEntities") } : {}
|
|
26694
|
+
};
|
|
26695
|
+
if (!topicId && !query5) {
|
|
26696
|
+
throw new Error("[compile_context] query is required when topicId is omitted.");
|
|
26697
|
+
}
|
|
26698
|
+
const response = topicId ? await compiler.compile(topicId, input) : await functionSurface.compileContext(input);
|
|
26684
26699
|
writeLocalLucernContext({
|
|
26685
26700
|
topicId: readResultString(response.data, "topicId") ?? topicId,
|
|
26686
26701
|
topicName: readResultString(response.data, "topicName"),
|
|
@@ -27786,18 +27801,22 @@ function createWorktreeHandlers(context) {
|
|
|
27786
27801
|
MCP_TOOL_CONTRACTS.add_worktree,
|
|
27787
27802
|
async (params) => {
|
|
27788
27803
|
const topicId = readTopicId4(params);
|
|
27789
|
-
if (!topicId) {
|
|
27790
|
-
throw new Error("add_worktree requires topicId");
|
|
27791
|
-
}
|
|
27792
27804
|
const result = await workflow.addWorktree({
|
|
27793
27805
|
title: readString3(params, "title", { required: true }),
|
|
27794
27806
|
topicId,
|
|
27807
|
+
topicHint: readString3(params, "topicHint"),
|
|
27795
27808
|
branchId: readString3(params, "branchId"),
|
|
27796
27809
|
objective: readString3(params, "objective"),
|
|
27797
27810
|
hypothesis: readString3(params, "hypothesis"),
|
|
27811
|
+
rationale: readString3(params, "rationale"),
|
|
27812
|
+
worktreeType: readString3(params, "worktreeType"),
|
|
27798
27813
|
beliefIds: readStringArray(params, "beliefIds"),
|
|
27799
27814
|
autoShape: readBoolean(params, "autoShape"),
|
|
27800
27815
|
domainPackId: readString3(params, "domainPackId"),
|
|
27816
|
+
tags: readStringArray(params, "tags"),
|
|
27817
|
+
touchedPaths: readStringArray(params, "touchedPaths"),
|
|
27818
|
+
sourceRef: readString3(params, "sourceRef"),
|
|
27819
|
+
sourceKind: readString3(params, "sourceKind"),
|
|
27801
27820
|
campaign: typeof params.campaign === "number" ? params.campaign : void 0,
|
|
27802
27821
|
lane: readString3(params, "lane"),
|
|
27803
27822
|
laneOrderInCampaign: typeof params.laneOrderInCampaign === "number" ? params.laneOrderInCampaign : void 0,
|
|
@@ -27917,8 +27936,8 @@ function loadMcpSdk() {
|
|
|
27917
27936
|
try {
|
|
27918
27937
|
const dynamicRequire = eval("require");
|
|
27919
27938
|
return dynamicRequire("@modelcontextprotocol/sdk") ?? {};
|
|
27920
|
-
} catch {
|
|
27921
|
-
return
|
|
27939
|
+
} catch (error) {
|
|
27940
|
+
return ignoreMcpSdkLoadError();
|
|
27922
27941
|
}
|
|
27923
27942
|
}
|
|
27924
27943
|
var MCP_AUTH_ERROR_CODES = [
|
|
@@ -27997,11 +28016,11 @@ function deriveCustomToolScopes(customTool) {
|
|
|
27997
28016
|
return uniqueScopes(customTool.metadata.requiredScopes ?? ["custom:execute"]);
|
|
27998
28017
|
}
|
|
27999
28018
|
function createFallbackRuntime() {
|
|
28019
|
+
function noop() {
|
|
28020
|
+
}
|
|
28000
28021
|
return {
|
|
28001
|
-
registerResource:
|
|
28002
|
-
|
|
28003
|
-
registerTool: () => {
|
|
28004
|
-
}
|
|
28022
|
+
registerResource: noop,
|
|
28023
|
+
registerTool: noop
|
|
28005
28024
|
};
|
|
28006
28025
|
}
|
|
28007
28026
|
function createMcpRuntime() {
|
|
@@ -28015,7 +28034,7 @@ function createMcpRuntime() {
|
|
|
28015
28034
|
{ name: "lucern-platform-mcp", version: "1.2.0" },
|
|
28016
28035
|
{ capabilities: { resources: {}, tools: {} } }
|
|
28017
28036
|
);
|
|
28018
|
-
} catch {
|
|
28037
|
+
} catch (error) {
|
|
28019
28038
|
return createFallbackRuntime();
|
|
28020
28039
|
}
|
|
28021
28040
|
}
|
|
@@ -28039,15 +28058,14 @@ function executeWithHandler(_name, handler, contract, params) {
|
|
|
28039
28058
|
}
|
|
28040
28059
|
}
|
|
28041
28060
|
function isMcpToolResult(value) {
|
|
28042
|
-
if (!value
|
|
28061
|
+
if (!isRecord13(value)) {
|
|
28043
28062
|
return false;
|
|
28044
28063
|
}
|
|
28045
|
-
|
|
28046
|
-
if (!Array.isArray(candidate.content)) {
|
|
28064
|
+
if (!Array.isArray(value.content)) {
|
|
28047
28065
|
return false;
|
|
28048
28066
|
}
|
|
28049
|
-
return
|
|
28050
|
-
if (!entry
|
|
28067
|
+
return value.content.every((entry) => {
|
|
28068
|
+
if (!isRecord13(entry)) {
|
|
28051
28069
|
return false;
|
|
28052
28070
|
}
|
|
28053
28071
|
return typeof entry.text === "string";
|
|
@@ -28218,6 +28236,12 @@ function createLucernMcpServer(options) {
|
|
|
28218
28236
|
unimplementedToolNames
|
|
28219
28237
|
};
|
|
28220
28238
|
}
|
|
28239
|
+
function isRecord13(value) {
|
|
28240
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28241
|
+
}
|
|
28242
|
+
function ignoreMcpSdkLoadError(_error) {
|
|
28243
|
+
return {};
|
|
28244
|
+
}
|
|
28221
28245
|
|
|
28222
28246
|
// src/standalone.ts
|
|
28223
28247
|
var OBSERVATION_RESOURCE_TEMPLATE = "lucern://observations/topic/{topicId}";
|
|
@@ -28259,6 +28283,9 @@ function resourceName(uri) {
|
|
|
28259
28283
|
return uri.replace("lucern://", "lucern-").replace(/[{}]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
28260
28284
|
}
|
|
28261
28285
|
function readTemplateVar(variables, key) {
|
|
28286
|
+
if (!isRecord14(variables)) {
|
|
28287
|
+
return;
|
|
28288
|
+
}
|
|
28262
28289
|
const value = variables[key];
|
|
28263
28290
|
if (typeof value === "string") {
|
|
28264
28291
|
return value;
|
|
@@ -28271,7 +28298,7 @@ function readTemplateVar(variables, key) {
|
|
|
28271
28298
|
async function notifyResourceUpdated(server, uri) {
|
|
28272
28299
|
try {
|
|
28273
28300
|
await server.server.sendResourceUpdated({ uri });
|
|
28274
|
-
} catch {
|
|
28301
|
+
} catch (error) {
|
|
28275
28302
|
}
|
|
28276
28303
|
}
|
|
28277
28304
|
function registerResources(server, runtime, observationStore) {
|
|
@@ -28332,10 +28359,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28332
28359
|
mimeType: "application/json"
|
|
28333
28360
|
},
|
|
28334
28361
|
async (_uri, variables) => {
|
|
28335
|
-
const topicId = readTemplateVar(
|
|
28336
|
-
variables,
|
|
28337
|
-
"topicId"
|
|
28338
|
-
);
|
|
28362
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28339
28363
|
const records = topicId ? observationStore.list(topicId, 25) : [];
|
|
28340
28364
|
return {
|
|
28341
28365
|
contents: [
|
|
@@ -28368,9 +28392,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28368
28392
|
mimeType: "application/json"
|
|
28369
28393
|
},
|
|
28370
28394
|
async (_uri, variables) => {
|
|
28371
|
-
const
|
|
28372
|
-
const
|
|
28373
|
-
const query5 = readTemplateVar(values, "query");
|
|
28395
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28396
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28374
28397
|
const matches = topicId && query5 ? observationStore.search(topicId, query5, 25) : [];
|
|
28375
28398
|
return {
|
|
28376
28399
|
contents: [
|
|
@@ -28403,10 +28426,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28403
28426
|
mimeType: "application/json"
|
|
28404
28427
|
},
|
|
28405
28428
|
async (_uri, variables) => {
|
|
28406
|
-
const topicId = readTemplateVar(
|
|
28407
|
-
variables,
|
|
28408
|
-
"topicId"
|
|
28409
|
-
);
|
|
28429
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28410
28430
|
const context = topicId ? observationStore.getContext({ topicId, limit: 12 }) : observationStore.getContext({ topicId: "unknown", limit: 12 });
|
|
28411
28431
|
return {
|
|
28412
28432
|
contents: [
|
|
@@ -28430,9 +28450,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28430
28450
|
mimeType: "application/json"
|
|
28431
28451
|
},
|
|
28432
28452
|
async (_uri, variables) => {
|
|
28433
|
-
const
|
|
28434
|
-
const
|
|
28435
|
-
const query5 = readTemplateVar(values, "query");
|
|
28453
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28454
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28436
28455
|
const context = observationStore.getContext({
|
|
28437
28456
|
topicId: topicId ?? "unknown",
|
|
28438
28457
|
query: query5,
|
|
@@ -28458,7 +28477,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28458
28477
|
await notifyResourceUpdated(server, `lucern://context/topic/${encoded}`);
|
|
28459
28478
|
try {
|
|
28460
28479
|
await server.server.sendResourceListChanged();
|
|
28461
|
-
} catch {
|
|
28480
|
+
} catch (error) {
|
|
28462
28481
|
}
|
|
28463
28482
|
};
|
|
28464
28483
|
return { resourceUris, notifyObservationChanged };
|
|
@@ -28498,15 +28517,14 @@ function registerTools(server, runtime) {
|
|
|
28498
28517
|
inputSchema: shape
|
|
28499
28518
|
},
|
|
28500
28519
|
async (args) => {
|
|
28501
|
-
return handler(args, tool.contract);
|
|
28520
|
+
return handler(isRecord14(args) ? args : {}, tool.contract);
|
|
28502
28521
|
}
|
|
28503
28522
|
);
|
|
28504
28523
|
}
|
|
28505
28524
|
}
|
|
28506
28525
|
function createLucernStandaloneMcpServer(options) {
|
|
28507
28526
|
const observationStore = new McpObservationStore();
|
|
28508
|
-
let notifyObservationChanged =
|
|
28509
|
-
};
|
|
28527
|
+
let notifyObservationChanged = noopAsync;
|
|
28510
28528
|
const runtime = createLucernMcpServer({
|
|
28511
28529
|
...options,
|
|
28512
28530
|
observationStore,
|
|
@@ -28516,7 +28534,7 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28516
28534
|
});
|
|
28517
28535
|
const server = new McpServer({
|
|
28518
28536
|
name: "lucern-mcp",
|
|
28519
|
-
version: "0.
|
|
28537
|
+
version: "0.3.0-alpha.8"
|
|
28520
28538
|
});
|
|
28521
28539
|
registerTools(server, runtime);
|
|
28522
28540
|
const resources = registerResources(server, runtime, observationStore);
|
|
@@ -28539,6 +28557,11 @@ async function startLucernMcpStdioServer(options) {
|
|
|
28539
28557
|
await packageServer.server.connect(transport);
|
|
28540
28558
|
return packageServer;
|
|
28541
28559
|
}
|
|
28560
|
+
function isRecord14(value) {
|
|
28561
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28562
|
+
}
|
|
28563
|
+
async function noopAsync() {
|
|
28564
|
+
}
|
|
28542
28565
|
|
|
28543
28566
|
// src/remote.ts
|
|
28544
28567
|
function resolveAuthMode(auth) {
|