@lucern/mcp 0.3.0-alpha.2 → 0.3.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/bin/lucern-mcp.js +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +23370 -0
- package/dist/cli.js.map +1 -0
- package/dist/gateway.d.ts +117 -1
- package/dist/gateway.js +658 -53
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +2586 -517
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +2854 -618
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +2 -34
- package/dist/runtime.js +145 -686
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -6
package/dist/hosted-route.js
CHANGED
|
@@ -89,9 +89,9 @@ var McpObservationStore = class {
|
|
|
89
89
|
const records = this.byTopic.get(topicId) ?? [];
|
|
90
90
|
return [...records].sort((left, right) => right.createdAt - left.createdAt).slice(0, Math.max(1, limit));
|
|
91
91
|
}
|
|
92
|
-
search(topicId,
|
|
92
|
+
search(topicId, query5, limit = 10) {
|
|
93
93
|
const records = this.byTopic.get(topicId) ?? [];
|
|
94
|
-
const terms = tokenize(
|
|
94
|
+
const terms = tokenize(query5);
|
|
95
95
|
if (terms.length === 0) {
|
|
96
96
|
return this.list(topicId, limit);
|
|
97
97
|
}
|
|
@@ -127,8 +127,8 @@ var McpObservationStore = class {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
function tokenize(
|
|
131
|
-
return
|
|
130
|
+
function tokenize(query5) {
|
|
131
|
+
return query5.toLowerCase().split(/[^a-z0-9]+/).map((term) => term.trim()).filter((term) => term.length >= 2);
|
|
132
132
|
}
|
|
133
133
|
function scoreObservation(record, terms) {
|
|
134
134
|
const source = [
|
|
@@ -150,6 +150,172 @@ function scoreObservation(record, terms) {
|
|
|
150
150
|
return score;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
// ../sdk/src/authContext.ts
|
|
154
|
+
var LucernSdkAuthContextError = class extends Error {
|
|
155
|
+
reason;
|
|
156
|
+
constructor(reason, message) {
|
|
157
|
+
super(message);
|
|
158
|
+
this.name = "LucernSdkAuthContextError";
|
|
159
|
+
this.reason = reason;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
function cleanString(value) {
|
|
163
|
+
const normalized = value?.trim();
|
|
164
|
+
return normalized ? normalized : void 0;
|
|
165
|
+
}
|
|
166
|
+
function cleanStringList(values) {
|
|
167
|
+
if (!values) {
|
|
168
|
+
return [];
|
|
169
|
+
}
|
|
170
|
+
return values.map((value) => value.trim()).filter(
|
|
171
|
+
(value, index, list) => value.length > 0 && list.indexOf(value) === index
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function requireString(value, reason, label) {
|
|
175
|
+
const normalized = cleanString(value);
|
|
176
|
+
if (!normalized) {
|
|
177
|
+
throw new LucernSdkAuthContextError(
|
|
178
|
+
reason,
|
|
179
|
+
`Canonical Lucern SDK auth context is missing ${label}.`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return normalized;
|
|
183
|
+
}
|
|
184
|
+
function requirePrincipalType(principalType) {
|
|
185
|
+
if (!principalType) {
|
|
186
|
+
throw new LucernSdkAuthContextError(
|
|
187
|
+
"principal_missing",
|
|
188
|
+
"Canonical Lucern SDK auth context is missing principalType."
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
return principalType;
|
|
192
|
+
}
|
|
193
|
+
function requireAuthMode(authMode) {
|
|
194
|
+
if (!authMode) {
|
|
195
|
+
throw new LucernSdkAuthContextError(
|
|
196
|
+
"principal_missing",
|
|
197
|
+
"Canonical Lucern SDK auth context is missing authMode."
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
return authMode;
|
|
201
|
+
}
|
|
202
|
+
function ensurePermitMatch(args) {
|
|
203
|
+
const actual = cleanString(args.actual);
|
|
204
|
+
if (actual && actual !== args.expected) {
|
|
205
|
+
throw new LucernSdkAuthContextError(
|
|
206
|
+
"policy_denied",
|
|
207
|
+
`Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function normalizeCanonicalLucernAuthContext(input) {
|
|
212
|
+
if (!input) {
|
|
213
|
+
throw new LucernSdkAuthContextError(
|
|
214
|
+
"principal_missing",
|
|
215
|
+
"Canonical Lucern SDK auth context is required."
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
if (input.policyDecision === "deny") {
|
|
219
|
+
throw new LucernSdkAuthContextError(
|
|
220
|
+
"policy_denied",
|
|
221
|
+
"Canonical Lucern SDK auth context carries a denied policy decision."
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
const principalId = requireString(
|
|
225
|
+
input.principalId,
|
|
226
|
+
"principal_missing",
|
|
227
|
+
"principalId"
|
|
228
|
+
);
|
|
229
|
+
const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
|
|
230
|
+
const workspaceId = requireString(
|
|
231
|
+
input.workspaceId,
|
|
232
|
+
"workspace_missing",
|
|
233
|
+
"workspaceId"
|
|
234
|
+
);
|
|
235
|
+
const roles = cleanStringList(input.roles);
|
|
236
|
+
const scopes = cleanStringList(input.scopes);
|
|
237
|
+
if (roles.length === 0 || scopes.length === 0) {
|
|
238
|
+
throw new LucernSdkAuthContextError(
|
|
239
|
+
"membership_missing",
|
|
240
|
+
"Canonical Lucern SDK auth context requires non-empty roles and scopes."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
const principalType = requirePrincipalType(input.principalType);
|
|
244
|
+
const authMode = requireAuthMode(input.authMode);
|
|
245
|
+
const subject = cleanString(input.permit?.subject) ?? principalId;
|
|
246
|
+
const tenant = cleanString(input.permit?.tenant) ?? tenantId;
|
|
247
|
+
const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
|
|
248
|
+
ensurePermitMatch({
|
|
249
|
+
field: "subject",
|
|
250
|
+
expected: principalId,
|
|
251
|
+
actual: subject
|
|
252
|
+
});
|
|
253
|
+
ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
|
|
254
|
+
ensurePermitMatch({
|
|
255
|
+
field: "workspace",
|
|
256
|
+
expected: workspaceId,
|
|
257
|
+
actual: workspace
|
|
258
|
+
});
|
|
259
|
+
const context = input.permit?.context ? { ...input.permit.context } : void 0;
|
|
260
|
+
return {
|
|
261
|
+
clerkId: cleanString(input.clerkId),
|
|
262
|
+
principalId,
|
|
263
|
+
tenantId,
|
|
264
|
+
workspaceId,
|
|
265
|
+
principalType,
|
|
266
|
+
authMode,
|
|
267
|
+
roles,
|
|
268
|
+
scopes,
|
|
269
|
+
delegationChain: input.delegationChain ? [...input.delegationChain] : [],
|
|
270
|
+
policyTraceId: cleanString(input.policyTraceId),
|
|
271
|
+
correlationId: cleanString(input.correlationId),
|
|
272
|
+
membershipId: cleanString(input.membershipId),
|
|
273
|
+
permit: {
|
|
274
|
+
subject,
|
|
275
|
+
tenant,
|
|
276
|
+
workspace,
|
|
277
|
+
resource: cleanString(input.permit?.resource),
|
|
278
|
+
action: cleanString(input.permit?.action),
|
|
279
|
+
relation: cleanString(input.permit?.relation),
|
|
280
|
+
context
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function createCanonicalAuthHeaders(authContext) {
|
|
285
|
+
const headers = {
|
|
286
|
+
"x-lucern-principal-id": authContext.principalId,
|
|
287
|
+
"x-lucern-principal-type": authContext.principalType,
|
|
288
|
+
"x-lucern-tenant": authContext.tenantId,
|
|
289
|
+
"x-lucern-tenant-id": authContext.tenantId,
|
|
290
|
+
"x-lucern-workspace": authContext.workspaceId,
|
|
291
|
+
"x-lucern-workspace-id": authContext.workspaceId,
|
|
292
|
+
"x-lucern-auth-mode": authContext.authMode,
|
|
293
|
+
"x-lucern-roles": authContext.roles.join(","),
|
|
294
|
+
"x-lucern-scopes": authContext.scopes.join(","),
|
|
295
|
+
"x-lucern-permit-context": JSON.stringify(authContext.permit)
|
|
296
|
+
};
|
|
297
|
+
if (authContext.clerkId) {
|
|
298
|
+
headers["x-lucern-clerk-id"] = authContext.clerkId;
|
|
299
|
+
headers["x-lucern-user-id"] = authContext.clerkId;
|
|
300
|
+
}
|
|
301
|
+
if (authContext.delegationChain.length > 0) {
|
|
302
|
+
headers["x-lucern-delegation-chain"] = JSON.stringify(
|
|
303
|
+
authContext.delegationChain
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
if (authContext.policyTraceId) {
|
|
307
|
+
headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
|
|
308
|
+
}
|
|
309
|
+
if (authContext.correlationId) {
|
|
310
|
+
headers["x-correlation-id"] = authContext.correlationId;
|
|
311
|
+
headers["x-lucern-correlation-id"] = authContext.correlationId;
|
|
312
|
+
}
|
|
313
|
+
if (authContext.membershipId) {
|
|
314
|
+
headers["x-lucern-membership-id"] = authContext.membershipId;
|
|
315
|
+
}
|
|
316
|
+
return headers;
|
|
317
|
+
}
|
|
318
|
+
|
|
153
319
|
// ../sdk/src/coreClient.ts
|
|
154
320
|
var LucernApiError = class extends Error {
|
|
155
321
|
code;
|
|
@@ -306,16 +472,41 @@ function readPolicySummaryFromDetails(details) {
|
|
|
306
472
|
}
|
|
307
473
|
return null;
|
|
308
474
|
}
|
|
475
|
+
async function resolveConfiguredAuthContext(authContext) {
|
|
476
|
+
if (typeof authContext === "function") {
|
|
477
|
+
return await authContext();
|
|
478
|
+
}
|
|
479
|
+
return authContext;
|
|
480
|
+
}
|
|
481
|
+
function mergeHeaderRecord(base, addition) {
|
|
482
|
+
const headers = new Headers(base);
|
|
483
|
+
for (const [key, value] of Object.entries(addition)) {
|
|
484
|
+
const existing = headers.get(key);
|
|
485
|
+
if (existing !== null && existing !== value) {
|
|
486
|
+
throw new LucernSdkAuthContextError(
|
|
487
|
+
"policy_denied",
|
|
488
|
+
`Canonical Lucern SDK auth context conflicts with existing ${key} header.`
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
headers.set(key, value);
|
|
492
|
+
}
|
|
493
|
+
return Object.fromEntries(headers.entries());
|
|
494
|
+
}
|
|
309
495
|
function createGatewayRequestClient(config = {}) {
|
|
310
496
|
const fetchImpl = config.fetchImpl ?? fetch;
|
|
311
497
|
const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
312
498
|
const maxRetries = config.maxRetries ?? 2;
|
|
313
499
|
const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
|
|
314
500
|
async function resolveAuthHeaders() {
|
|
315
|
-
|
|
316
|
-
|
|
501
|
+
const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
|
|
502
|
+
const authContextInput = await resolveConfiguredAuthContext(
|
|
503
|
+
config.authContext
|
|
504
|
+
);
|
|
505
|
+
if (!authContextInput && !config.requireCanonicalAuthContext) {
|
|
506
|
+
return base;
|
|
317
507
|
}
|
|
318
|
-
|
|
508
|
+
const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
|
|
509
|
+
return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
|
|
319
510
|
}
|
|
320
511
|
async function fetchWithTimeout(url, init, timeoutMs) {
|
|
321
512
|
const controller = new AbortController();
|
|
@@ -490,11 +681,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
490
681
|
function asRecord(value) {
|
|
491
682
|
return value && typeof value === "object" ? value : {};
|
|
492
683
|
}
|
|
493
|
-
function
|
|
684
|
+
function cleanString2(value) {
|
|
494
685
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
495
686
|
}
|
|
496
687
|
function normalizeVerificationStatus(value) {
|
|
497
|
-
const status =
|
|
688
|
+
const status = cleanString2(value);
|
|
498
689
|
if (!status) {
|
|
499
690
|
return void 0;
|
|
500
691
|
}
|
|
@@ -510,20 +701,20 @@ function cloneWith(value, patch) {
|
|
|
510
701
|
return { ...value, ...patch };
|
|
511
702
|
}
|
|
512
703
|
function resolveTopicId(value) {
|
|
513
|
-
return
|
|
704
|
+
return cleanString2(value.topicId);
|
|
514
705
|
}
|
|
515
706
|
function resolveText(value) {
|
|
516
|
-
return
|
|
707
|
+
return cleanString2(value.text) ?? cleanString2(value.canonicalText);
|
|
517
708
|
}
|
|
518
709
|
function withTopicAlias(value) {
|
|
519
|
-
const topicId =
|
|
710
|
+
const topicId = cleanString2(value.topicId) ?? void 0;
|
|
520
711
|
if (!topicId) {
|
|
521
712
|
return value;
|
|
522
713
|
}
|
|
523
714
|
return cloneWith(value, { topicId });
|
|
524
715
|
}
|
|
525
716
|
function withTextAlias(value) {
|
|
526
|
-
const text =
|
|
717
|
+
const text = cleanString2(value.text) ?? cleanString2(value.canonicalText) ?? void 0;
|
|
527
718
|
if (!text) {
|
|
528
719
|
return value;
|
|
529
720
|
}
|
|
@@ -553,7 +744,7 @@ function normalizeNodeVerificationStatus(value) {
|
|
|
553
744
|
return normalizeVerificationStatus(value);
|
|
554
745
|
}
|
|
555
746
|
function normalizeTopicQuery(value) {
|
|
556
|
-
const topicId =
|
|
747
|
+
const topicId = cleanString2(value.topicId);
|
|
557
748
|
if (!topicId) {
|
|
558
749
|
return value;
|
|
559
750
|
}
|
|
@@ -626,9 +817,9 @@ function createAdminClient(config = {}) {
|
|
|
626
817
|
/**
|
|
627
818
|
* List tenants visible to the current principal.
|
|
628
819
|
*/
|
|
629
|
-
async listTenants(
|
|
820
|
+
async listTenants(query5 = {}) {
|
|
630
821
|
return gateway.request({
|
|
631
|
-
path: `/api/platform/v1/tenants${toQueryString(
|
|
822
|
+
path: `/api/platform/v1/tenants${toQueryString(query5)}`
|
|
632
823
|
}).then(
|
|
633
824
|
(response) => mapGatewayData(
|
|
634
825
|
response,
|
|
@@ -669,9 +860,9 @@ function createAdminClient(config = {}) {
|
|
|
669
860
|
/**
|
|
670
861
|
* List workspaces for the current admin scope.
|
|
671
862
|
*/
|
|
672
|
-
async listWorkspaces(
|
|
863
|
+
async listWorkspaces(query5 = {}) {
|
|
673
864
|
return gateway.request({
|
|
674
|
-
path: `/api/platform/v1/workspaces${toQueryString(
|
|
865
|
+
path: `/api/platform/v1/workspaces${toQueryString(query5)}`
|
|
675
866
|
}).then(
|
|
676
867
|
(response) => mapGatewayData(
|
|
677
868
|
response,
|
|
@@ -696,9 +887,9 @@ function createAdminClient(config = {}) {
|
|
|
696
887
|
/**
|
|
697
888
|
* List memberships for the current admin scope.
|
|
698
889
|
*/
|
|
699
|
-
async listMemberships(
|
|
890
|
+
async listMemberships(query5 = {}) {
|
|
700
891
|
return gateway.request({
|
|
701
|
-
path: `/api/platform/v1/memberships${toQueryString(
|
|
892
|
+
path: `/api/platform/v1/memberships${toQueryString(query5)}`
|
|
702
893
|
}).then(
|
|
703
894
|
(response) => mapGatewayData(
|
|
704
895
|
response,
|
|
@@ -935,9 +1126,9 @@ function createAdminClient(config = {}) {
|
|
|
935
1126
|
/**
|
|
936
1127
|
* List group members.
|
|
937
1128
|
*/
|
|
938
|
-
async listGroupMembers(
|
|
1129
|
+
async listGroupMembers(query5) {
|
|
939
1130
|
return gateway.request({
|
|
940
|
-
path: `/api/platform/v1/groups/members${toQueryString(
|
|
1131
|
+
path: `/api/platform/v1/groups/members${toQueryString(query5)}`
|
|
941
1132
|
});
|
|
942
1133
|
},
|
|
943
1134
|
/**
|
|
@@ -964,9 +1155,9 @@ function createAdminClient(config = {}) {
|
|
|
964
1155
|
/**
|
|
965
1156
|
* List pack-to-group assignments.
|
|
966
1157
|
*/
|
|
967
|
-
async listPackGroupAssignments(
|
|
1158
|
+
async listPackGroupAssignments(query5 = {}) {
|
|
968
1159
|
return gateway.request({
|
|
969
|
-
path: `/api/platform/v1/groups/packs${toQueryString(
|
|
1160
|
+
path: `/api/platform/v1/groups/packs${toQueryString(query5)}`
|
|
970
1161
|
});
|
|
971
1162
|
},
|
|
972
1163
|
/**
|
|
@@ -1017,12 +1208,12 @@ function createAudiencesClient(config = {}) {
|
|
|
1017
1208
|
/**
|
|
1018
1209
|
* List audience registry entries.
|
|
1019
1210
|
*/
|
|
1020
|
-
async listRegistry(
|
|
1211
|
+
async listRegistry(query5 = {}) {
|
|
1021
1212
|
return gateway.request({
|
|
1022
1213
|
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
1023
|
-
...
|
|
1024
|
-
effective: typeof
|
|
1025
|
-
status:
|
|
1214
|
+
...query5,
|
|
1215
|
+
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
1216
|
+
status: query5.status
|
|
1026
1217
|
})}`
|
|
1027
1218
|
}).then(
|
|
1028
1219
|
(response) => mapGatewayData(
|
|
@@ -1037,8 +1228,8 @@ function createAudiencesClient(config = {}) {
|
|
|
1037
1228
|
/**
|
|
1038
1229
|
* @deprecated Use listRegistry.
|
|
1039
1230
|
*/
|
|
1040
|
-
async getRegistry(
|
|
1041
|
-
return this.listRegistry(
|
|
1231
|
+
async getRegistry(query5 = {}) {
|
|
1232
|
+
return this.listRegistry(query5);
|
|
1042
1233
|
},
|
|
1043
1234
|
/**
|
|
1044
1235
|
* Create an audience registry entry.
|
|
@@ -1066,14 +1257,14 @@ function createAudiencesClient(config = {}) {
|
|
|
1066
1257
|
/**
|
|
1067
1258
|
* List audience grants.
|
|
1068
1259
|
*/
|
|
1069
|
-
async listGrants(
|
|
1260
|
+
async listGrants(query5 = {}) {
|
|
1070
1261
|
return gateway.request({
|
|
1071
1262
|
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
1072
|
-
...
|
|
1073
|
-
audienceKey:
|
|
1074
|
-
principalId:
|
|
1075
|
-
groupId:
|
|
1076
|
-
status:
|
|
1263
|
+
...query5,
|
|
1264
|
+
audienceKey: query5.audienceKey,
|
|
1265
|
+
principalId: query5.principalId,
|
|
1266
|
+
groupId: query5.groupId,
|
|
1267
|
+
status: query5.status
|
|
1077
1268
|
})}`
|
|
1078
1269
|
}).then(
|
|
1079
1270
|
(response) => mapGatewayData(
|
|
@@ -1085,8 +1276,8 @@ function createAudiencesClient(config = {}) {
|
|
|
1085
1276
|
/**
|
|
1086
1277
|
* @deprecated Use listGrants.
|
|
1087
1278
|
*/
|
|
1088
|
-
async getGrants(
|
|
1089
|
-
return this.listGrants(
|
|
1279
|
+
async getGrants(query5 = {}) {
|
|
1280
|
+
return this.listGrants(query5);
|
|
1090
1281
|
},
|
|
1091
1282
|
/**
|
|
1092
1283
|
* Create an audience grant.
|
|
@@ -1132,10 +1323,10 @@ function createAuditClient(config = {}) {
|
|
|
1132
1323
|
/**
|
|
1133
1324
|
* List audit events for the current scope.
|
|
1134
1325
|
*/
|
|
1135
|
-
async listEvents(
|
|
1326
|
+
async listEvents(query5 = {}) {
|
|
1136
1327
|
return gateway.request({
|
|
1137
1328
|
path: `/api/platform/v1/audit/events${toQueryString(
|
|
1138
|
-
normalizeTopicQuery(
|
|
1329
|
+
normalizeTopicQuery(query5)
|
|
1139
1330
|
)}`
|
|
1140
1331
|
}).then(
|
|
1141
1332
|
(response) => mapGatewayData(
|
|
@@ -1147,11 +1338,116 @@ function createAuditClient(config = {}) {
|
|
|
1147
1338
|
};
|
|
1148
1339
|
}
|
|
1149
1340
|
|
|
1341
|
+
// ../sdk/src/authDeviceClient.ts
|
|
1342
|
+
var DeviceAuthorizationError = class extends Error {
|
|
1343
|
+
error;
|
|
1344
|
+
interval;
|
|
1345
|
+
constructor(args) {
|
|
1346
|
+
super(args.description ?? args.error);
|
|
1347
|
+
this.name = "DeviceAuthorizationError";
|
|
1348
|
+
this.error = args.error;
|
|
1349
|
+
this.interval = args.interval;
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
function authBaseUrl(config) {
|
|
1353
|
+
return config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
1354
|
+
}
|
|
1355
|
+
async function readJson(response) {
|
|
1356
|
+
const payload = await response.json().catch(() => ({}));
|
|
1357
|
+
return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
|
|
1358
|
+
}
|
|
1359
|
+
function readString(value) {
|
|
1360
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
1361
|
+
return normalized || void 0;
|
|
1362
|
+
}
|
|
1363
|
+
function assertDeviceCodeResponse(payload) {
|
|
1364
|
+
const deviceCode = readString(payload.device_code);
|
|
1365
|
+
const userCode = readString(payload.user_code);
|
|
1366
|
+
const verificationUri = readString(payload.verification_uri);
|
|
1367
|
+
const verificationUriComplete = readString(payload.verification_uri_complete);
|
|
1368
|
+
const expiresIn = payload.expires_in;
|
|
1369
|
+
const interval = payload.interval;
|
|
1370
|
+
if (!deviceCode || !userCode || !verificationUri || !verificationUriComplete || typeof expiresIn !== "number" || typeof interval !== "number") {
|
|
1371
|
+
throw new Error("Gateway returned an invalid device-code response.");
|
|
1372
|
+
}
|
|
1373
|
+
return {
|
|
1374
|
+
device_code: deviceCode,
|
|
1375
|
+
user_code: userCode,
|
|
1376
|
+
verification_uri: verificationUri,
|
|
1377
|
+
verification_uri_complete: verificationUriComplete,
|
|
1378
|
+
expires_in: expiresIn,
|
|
1379
|
+
interval
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
function assertDeviceTokenResponse(payload) {
|
|
1383
|
+
const accessToken = readString(payload.access_token);
|
|
1384
|
+
const tokenType = readString(payload.token_type);
|
|
1385
|
+
const scope = readString(payload.scope);
|
|
1386
|
+
const tenantId = readString(payload.tenant_id);
|
|
1387
|
+
const principalId = readString(payload.principal_id);
|
|
1388
|
+
if (!accessToken || tokenType !== "Bearer" || typeof payload.expires_in !== "number" || !scope || !tenantId || !principalId) {
|
|
1389
|
+
throw new Error("Gateway returned an invalid device token response.");
|
|
1390
|
+
}
|
|
1391
|
+
return {
|
|
1392
|
+
access_token: accessToken,
|
|
1393
|
+
token_type: "Bearer",
|
|
1394
|
+
expires_in: payload.expires_in,
|
|
1395
|
+
scope,
|
|
1396
|
+
tenant_id: tenantId,
|
|
1397
|
+
workspace_id: readString(payload.workspace_id),
|
|
1398
|
+
principal_id: principalId,
|
|
1399
|
+
user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
function maybeThrowDeviceError(payload) {
|
|
1403
|
+
const error = readString(payload.error);
|
|
1404
|
+
throw new DeviceAuthorizationError({
|
|
1405
|
+
error: error ?? "invalid_request",
|
|
1406
|
+
description: readString(payload.error_description),
|
|
1407
|
+
interval: typeof payload.interval === "number" ? payload.interval : void 0
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
function createAuthDeviceClient(config = {}) {
|
|
1411
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
1412
|
+
const baseUrl = authBaseUrl(config);
|
|
1413
|
+
async function post(path, body4) {
|
|
1414
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1415
|
+
method: "POST",
|
|
1416
|
+
headers: { "content-type": "application/json" },
|
|
1417
|
+
body: JSON.stringify(body4)
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
return {
|
|
1421
|
+
async createDeviceCode(input = {}) {
|
|
1422
|
+
const response = await post("/api/platform/v1/auth/device/code", {
|
|
1423
|
+
client_id: input.clientId ?? "lucern-cli",
|
|
1424
|
+
scope: input.scope ?? "graph.read graph.write"
|
|
1425
|
+
});
|
|
1426
|
+
const payload = await readJson(response);
|
|
1427
|
+
if (!response.ok) {
|
|
1428
|
+
maybeThrowDeviceError(payload);
|
|
1429
|
+
}
|
|
1430
|
+
return assertDeviceCodeResponse(payload);
|
|
1431
|
+
},
|
|
1432
|
+
async pollDeviceToken(deviceCode) {
|
|
1433
|
+
const response = await post("/api/platform/v1/auth/device/token", {
|
|
1434
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
1435
|
+
device_code: deviceCode
|
|
1436
|
+
});
|
|
1437
|
+
const payload = await readJson(response);
|
|
1438
|
+
if (!response.ok) {
|
|
1439
|
+
maybeThrowDeviceError(payload);
|
|
1440
|
+
}
|
|
1441
|
+
return assertDeviceTokenResponse(payload);
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1150
1446
|
// ../sdk/src/beliefsClient.ts
|
|
1151
1447
|
function asRecord2(value) {
|
|
1152
1448
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1153
1449
|
}
|
|
1154
|
-
function
|
|
1450
|
+
function readString2(value) {
|
|
1155
1451
|
if (typeof value !== "string") {
|
|
1156
1452
|
return void 0;
|
|
1157
1453
|
}
|
|
@@ -1188,15 +1484,15 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1188
1484
|
const record = asRecord2(value);
|
|
1189
1485
|
const tuple = normalizeOpinionTuple(record);
|
|
1190
1486
|
const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
|
|
1191
|
-
const triggeringEvidenceId =
|
|
1192
|
-
const triggeringQuestionId =
|
|
1193
|
-
const triggeringAnswerId =
|
|
1194
|
-
const triggeringContradictionId =
|
|
1487
|
+
const triggeringEvidenceId = readString2(record.triggeringEvidenceId);
|
|
1488
|
+
const triggeringQuestionId = readString2(record.triggeringQuestionId);
|
|
1489
|
+
const triggeringAnswerId = readString2(record.triggeringAnswerId);
|
|
1490
|
+
const triggeringContradictionId = readString2(
|
|
1195
1491
|
record.triggeringContradictionId
|
|
1196
1492
|
);
|
|
1197
|
-
const triggeringWorktreeId =
|
|
1493
|
+
const triggeringWorktreeId = readString2(record.triggeringWorktreeId);
|
|
1198
1494
|
const triggeringRef = triggeringEvidenceId ? { kind: "evidence", id: triggeringEvidenceId } : triggeringQuestionId ? { kind: "question", id: triggeringQuestionId } : triggeringAnswerId ? { kind: "answer", id: triggeringAnswerId } : triggeringContradictionId ? { kind: "contradiction", id: triggeringContradictionId } : triggeringWorktreeId ? { kind: "worktree", id: triggeringWorktreeId } : void 0;
|
|
1199
|
-
const trigger =
|
|
1495
|
+
const trigger = readString2(record.trigger);
|
|
1200
1496
|
if (!trigger) {
|
|
1201
1497
|
throw new Error("Gateway opinion history entries must include trigger.");
|
|
1202
1498
|
}
|
|
@@ -1209,9 +1505,9 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1209
1505
|
P: clamp01(projected),
|
|
1210
1506
|
trigger,
|
|
1211
1507
|
...triggeringRef ? { triggeringRef } : {},
|
|
1212
|
-
...
|
|
1213
|
-
...
|
|
1214
|
-
...
|
|
1508
|
+
...readString2(record.rationale) ? { rationale: readString2(record.rationale) } : {},
|
|
1509
|
+
...readString2(record.userId) ? { userId: readString2(record.userId) } : {},
|
|
1510
|
+
...readString2(record.slOperator) ? { slOperator: readString2(record.slOperator) } : {}
|
|
1215
1511
|
};
|
|
1216
1512
|
}).sort((left, right) => left.t - right.t);
|
|
1217
1513
|
}
|
|
@@ -1446,6 +1742,180 @@ function createEvidenceClient(config = {}) {
|
|
|
1446
1742
|
}
|
|
1447
1743
|
};
|
|
1448
1744
|
}
|
|
1745
|
+
|
|
1746
|
+
// ../sdk/src/boundaryClientSurface.ts
|
|
1747
|
+
function cleanOptionalString(value) {
|
|
1748
|
+
const normalized = value?.trim();
|
|
1749
|
+
return normalized ? normalized : void 0;
|
|
1750
|
+
}
|
|
1751
|
+
function cleanRequiredString(value, label) {
|
|
1752
|
+
const normalized = cleanOptionalString(value);
|
|
1753
|
+
if (!normalized) {
|
|
1754
|
+
throw new Error(`${label} is required`);
|
|
1755
|
+
}
|
|
1756
|
+
return normalized;
|
|
1757
|
+
}
|
|
1758
|
+
function readTopicId(input) {
|
|
1759
|
+
return cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId);
|
|
1760
|
+
}
|
|
1761
|
+
function requireTopicId(input) {
|
|
1762
|
+
const topicId = readTopicId(input);
|
|
1763
|
+
if (!topicId) {
|
|
1764
|
+
throw new Error("topicId is required");
|
|
1765
|
+
}
|
|
1766
|
+
return topicId;
|
|
1767
|
+
}
|
|
1768
|
+
function assertKnownKeys(input, allowed, operation) {
|
|
1769
|
+
const allowedSet = new Set(allowed);
|
|
1770
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
|
|
1771
|
+
if (unknownKeys.length > 0) {
|
|
1772
|
+
throw new Error(
|
|
1773
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
function knownPayload(input, allowed, operation) {
|
|
1778
|
+
assertKnownKeys(input, allowed, operation);
|
|
1779
|
+
return { ...input };
|
|
1780
|
+
}
|
|
1781
|
+
function topicPayload(input, allowed, operation) {
|
|
1782
|
+
assertKnownKeys(input, allowed, operation);
|
|
1783
|
+
return {
|
|
1784
|
+
...input,
|
|
1785
|
+
topicId: requireTopicId(input),
|
|
1786
|
+
projectId: void 0
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
function listResultFromEnvelope(data, legacyKey) {
|
|
1790
|
+
const record = data && typeof data === "object" ? data : {};
|
|
1791
|
+
return createListResult(
|
|
1792
|
+
Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
|
|
1793
|
+
legacyKey
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// ../sdk/src/eventingClient.ts
|
|
1798
|
+
var EVENTING_FIELDS = [
|
|
1799
|
+
"tenantId",
|
|
1800
|
+
"workspaceId",
|
|
1801
|
+
"principalId",
|
|
1802
|
+
"topicId",
|
|
1803
|
+
"eventId",
|
|
1804
|
+
"eventType",
|
|
1805
|
+
"eventPayload",
|
|
1806
|
+
"webhookId",
|
|
1807
|
+
"deliveryId",
|
|
1808
|
+
"status",
|
|
1809
|
+
"attempt",
|
|
1810
|
+
"statusCode",
|
|
1811
|
+
"error",
|
|
1812
|
+
"responseBody",
|
|
1813
|
+
"durationMs",
|
|
1814
|
+
"metadata",
|
|
1815
|
+
"limit",
|
|
1816
|
+
"cursor"
|
|
1817
|
+
];
|
|
1818
|
+
function query(input) {
|
|
1819
|
+
return {
|
|
1820
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
1821
|
+
workspaceId: input.workspaceId,
|
|
1822
|
+
principalId: input.principalId,
|
|
1823
|
+
topicId: input.topicId,
|
|
1824
|
+
eventType: input.eventType,
|
|
1825
|
+
webhookId: input.webhookId,
|
|
1826
|
+
status: input.status,
|
|
1827
|
+
limit: input.limit,
|
|
1828
|
+
cursor: input.cursor
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
function body(input, operation) {
|
|
1832
|
+
return knownPayload(input, EVENTING_FIELDS, operation);
|
|
1833
|
+
}
|
|
1834
|
+
function createEventingClient(config = {}) {
|
|
1835
|
+
const gateway = createGatewayRequestClient(config);
|
|
1836
|
+
return {
|
|
1837
|
+
recordEvent(input, idempotencyKey) {
|
|
1838
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1839
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
1840
|
+
return gateway.request({
|
|
1841
|
+
path: "/api/platform/v1/events",
|
|
1842
|
+
method: "POST",
|
|
1843
|
+
body: body(
|
|
1844
|
+
input,
|
|
1845
|
+
"events.recordEvent"
|
|
1846
|
+
),
|
|
1847
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1848
|
+
});
|
|
1849
|
+
},
|
|
1850
|
+
listEvents(input) {
|
|
1851
|
+
return gateway.request({
|
|
1852
|
+
path: `/api/platform/v1/events${toQueryString(query(input))}`
|
|
1853
|
+
}).then(
|
|
1854
|
+
(response) => mapGatewayData(
|
|
1855
|
+
response,
|
|
1856
|
+
(data) => listResultFromEnvelope(data, "events")
|
|
1857
|
+
)
|
|
1858
|
+
);
|
|
1859
|
+
},
|
|
1860
|
+
listWebhooks(input) {
|
|
1861
|
+
return gateway.request({
|
|
1862
|
+
path: `/api/platform/v1/webhooks${toQueryString(query(input))}`
|
|
1863
|
+
}).then(
|
|
1864
|
+
(response) => mapGatewayData(
|
|
1865
|
+
response,
|
|
1866
|
+
(data) => listResultFromEnvelope(
|
|
1867
|
+
data,
|
|
1868
|
+
"webhooks"
|
|
1869
|
+
)
|
|
1870
|
+
)
|
|
1871
|
+
);
|
|
1872
|
+
},
|
|
1873
|
+
enqueueDelivery(input, idempotencyKey) {
|
|
1874
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1875
|
+
cleanRequiredString(input.eventId, "eventId");
|
|
1876
|
+
cleanRequiredString(input.webhookId, "webhookId");
|
|
1877
|
+
return gateway.request({
|
|
1878
|
+
path: "/api/platform/v1/events/deliveries",
|
|
1879
|
+
method: "POST",
|
|
1880
|
+
body: body(
|
|
1881
|
+
input,
|
|
1882
|
+
"events.enqueueDelivery"
|
|
1883
|
+
),
|
|
1884
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1885
|
+
});
|
|
1886
|
+
},
|
|
1887
|
+
recordDeliveryAttempt(input, idempotencyKey) {
|
|
1888
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1889
|
+
cleanRequiredString(input.deliveryId, "deliveryId");
|
|
1890
|
+
return gateway.request({
|
|
1891
|
+
path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
|
|
1892
|
+
input.deliveryId
|
|
1893
|
+
)}/attempts`,
|
|
1894
|
+
method: "POST",
|
|
1895
|
+
body: body(
|
|
1896
|
+
input,
|
|
1897
|
+
"events.recordDeliveryAttempt"
|
|
1898
|
+
),
|
|
1899
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1900
|
+
});
|
|
1901
|
+
},
|
|
1902
|
+
updateDeliveryStatus(input, idempotencyKey) {
|
|
1903
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1904
|
+
cleanRequiredString(input.deliveryId, "deliveryId");
|
|
1905
|
+
return gateway.request({
|
|
1906
|
+
path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
|
|
1907
|
+
input.deliveryId
|
|
1908
|
+
)}/status`,
|
|
1909
|
+
method: "PATCH",
|
|
1910
|
+
body: body(
|
|
1911
|
+
input,
|
|
1912
|
+
"events.updateDeliveryStatus"
|
|
1913
|
+
),
|
|
1914
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1449
1919
|
var DEFAULT_CUSTOM_NAMESPACE = "custom";
|
|
1450
1920
|
var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
|
|
1451
1921
|
var CustomToolRegistryError = class extends Error {
|
|
@@ -1851,10 +2321,10 @@ function createGraphClient(config = {}) {
|
|
|
1851
2321
|
/**
|
|
1852
2322
|
* List graph nodes matching the provided filters.
|
|
1853
2323
|
*/
|
|
1854
|
-
async listNodes(
|
|
2324
|
+
async listNodes(query5) {
|
|
1855
2325
|
return gateway.request({
|
|
1856
2326
|
path: `/api/platform/v1/graph/nodes${toQueryString(
|
|
1857
|
-
normalizeTopicQuery(
|
|
2327
|
+
normalizeTopicQuery(query5)
|
|
1858
2328
|
)}`
|
|
1859
2329
|
}).then(
|
|
1860
2330
|
(response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
|
|
@@ -1863,15 +2333,15 @@ function createGraphClient(config = {}) {
|
|
|
1863
2333
|
/**
|
|
1864
2334
|
* @deprecated Use listNodes.
|
|
1865
2335
|
*/
|
|
1866
|
-
async queryNodes(
|
|
1867
|
-
return this.listNodes(
|
|
2336
|
+
async queryNodes(query5) {
|
|
2337
|
+
return this.listNodes(query5);
|
|
1868
2338
|
},
|
|
1869
2339
|
/**
|
|
1870
2340
|
* Retrieve a single graph node by nodeId or globalId.
|
|
1871
2341
|
*/
|
|
1872
|
-
async getNode(
|
|
2342
|
+
async getNode(query5) {
|
|
1873
2343
|
return gateway.request({
|
|
1874
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(
|
|
2344
|
+
path: `/api/platform/v1/graph/nodes${toQueryString(query5)}`
|
|
1875
2345
|
}).then(
|
|
1876
2346
|
(response) => mapGatewayData(
|
|
1877
2347
|
response,
|
|
@@ -1964,10 +2434,10 @@ function createGraphClient(config = {}) {
|
|
|
1964
2434
|
/**
|
|
1965
2435
|
* List graph edges matching the provided filters.
|
|
1966
2436
|
*/
|
|
1967
|
-
async listEdges(
|
|
2437
|
+
async listEdges(query5) {
|
|
1968
2438
|
return gateway.request({
|
|
1969
2439
|
path: `/api/platform/v1/graph/edges${toQueryString(
|
|
1970
|
-
normalizeTopicQuery(
|
|
2440
|
+
normalizeTopicQuery(query5)
|
|
1971
2441
|
)}`
|
|
1972
2442
|
}).then(
|
|
1973
2443
|
(response) => mapGatewayData(
|
|
@@ -1979,8 +2449,8 @@ function createGraphClient(config = {}) {
|
|
|
1979
2449
|
/**
|
|
1980
2450
|
* @deprecated Use listEdges.
|
|
1981
2451
|
*/
|
|
1982
|
-
async queryEdges(
|
|
1983
|
-
return this.listEdges(
|
|
2452
|
+
async queryEdges(query5) {
|
|
2453
|
+
return this.listEdges(query5);
|
|
1984
2454
|
},
|
|
1985
2455
|
/**
|
|
1986
2456
|
* Create a graph edge.
|
|
@@ -1996,9 +2466,9 @@ function createGraphClient(config = {}) {
|
|
|
1996
2466
|
/**
|
|
1997
2467
|
* Delete one or more edges matching the provided filter.
|
|
1998
2468
|
*/
|
|
1999
|
-
async deleteEdge(
|
|
2469
|
+
async deleteEdge(query5, idempotencyKey) {
|
|
2000
2470
|
return gateway.request({
|
|
2001
|
-
path: `/api/platform/v1/graph/edges${toQueryString(
|
|
2471
|
+
path: `/api/platform/v1/graph/edges${toQueryString(query5)}`,
|
|
2002
2472
|
method: "DELETE",
|
|
2003
2473
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2004
2474
|
});
|
|
@@ -2006,26 +2476,26 @@ function createGraphClient(config = {}) {
|
|
|
2006
2476
|
/**
|
|
2007
2477
|
* Retrieve a graph neighborhood around a root node.
|
|
2008
2478
|
*/
|
|
2009
|
-
async neighborhood(
|
|
2479
|
+
async neighborhood(query5) {
|
|
2010
2480
|
return gateway.request({
|
|
2011
|
-
path: `/api/platform/v1/graph/neighborhood${toQueryString(
|
|
2481
|
+
path: `/api/platform/v1/graph/neighborhood${toQueryString(query5)}`
|
|
2012
2482
|
});
|
|
2013
2483
|
},
|
|
2014
2484
|
/**
|
|
2015
2485
|
* Traverse the graph from a starting node.
|
|
2016
2486
|
*/
|
|
2017
|
-
async traverse(
|
|
2487
|
+
async traverse(query5) {
|
|
2018
2488
|
return gateway.request({
|
|
2019
2489
|
path: "/api/platform/v1/graph/traverse",
|
|
2020
2490
|
method: "POST",
|
|
2021
|
-
body: normalizeTopicQuery(
|
|
2491
|
+
body: normalizeTopicQuery(query5)
|
|
2022
2492
|
});
|
|
2023
2493
|
},
|
|
2024
2494
|
/**
|
|
2025
2495
|
* Analyze graph structure for a topic.
|
|
2026
2496
|
*/
|
|
2027
|
-
async analyze(
|
|
2028
|
-
const normalized = normalizeTopicQuery(
|
|
2497
|
+
async analyze(query5 = {}) {
|
|
2498
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2029
2499
|
return gateway.request({
|
|
2030
2500
|
path: `/api/platform/v1/graph/analyze${toQueryString({
|
|
2031
2501
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2037,8 +2507,8 @@ function createGraphClient(config = {}) {
|
|
|
2037
2507
|
/**
|
|
2038
2508
|
* Detect confirmation-bias patterns for a topic graph.
|
|
2039
2509
|
*/
|
|
2040
|
-
async bias(
|
|
2041
|
-
const normalized = normalizeTopicQuery(
|
|
2510
|
+
async bias(query5 = {}) {
|
|
2511
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2042
2512
|
return gateway.request({
|
|
2043
2513
|
path: `/api/platform/v1/graph/bias${toQueryString({
|
|
2044
2514
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2050,8 +2520,8 @@ function createGraphClient(config = {}) {
|
|
|
2050
2520
|
/**
|
|
2051
2521
|
* Find graph gaps for beliefs that still need testing.
|
|
2052
2522
|
*/
|
|
2053
|
-
async gaps(
|
|
2054
|
-
const normalized = normalizeTopicQuery(
|
|
2523
|
+
async gaps(query5) {
|
|
2524
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2055
2525
|
return gateway.request({
|
|
2056
2526
|
path: `/api/platform/v1/graph/gaps${toQueryString({
|
|
2057
2527
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2062,33 +2532,33 @@ function createGraphClient(config = {}) {
|
|
|
2062
2532
|
/**
|
|
2063
2533
|
* Search across graph resources within a topic.
|
|
2064
2534
|
*/
|
|
2065
|
-
async search(
|
|
2535
|
+
async search(query5) {
|
|
2066
2536
|
return gateway.request({
|
|
2067
2537
|
path: "/api/platform/v1/search",
|
|
2068
2538
|
method: "POST",
|
|
2069
|
-
body: normalizeTopicQuery(
|
|
2539
|
+
body: normalizeTopicQuery(query5)
|
|
2070
2540
|
});
|
|
2071
2541
|
},
|
|
2072
2542
|
/**
|
|
2073
2543
|
* Retrieve a graph neighborhood around a root node.
|
|
2074
2544
|
*/
|
|
2075
|
-
async getNeighborhood(
|
|
2076
|
-
return this.neighborhood(
|
|
2545
|
+
async getNeighborhood(query5) {
|
|
2546
|
+
return this.neighborhood(query5);
|
|
2077
2547
|
},
|
|
2078
2548
|
/**
|
|
2079
2549
|
* Retrieve the shortest known path between two graph nodes.
|
|
2080
2550
|
*/
|
|
2081
|
-
async getPath(
|
|
2551
|
+
async getPath(query5) {
|
|
2082
2552
|
return gateway.request({
|
|
2083
|
-
path: `/api/platform/v1/graph/path${toQueryString(
|
|
2553
|
+
path: `/api/platform/v1/graph/path${toQueryString(query5)}`
|
|
2084
2554
|
});
|
|
2085
2555
|
},
|
|
2086
2556
|
/**
|
|
2087
2557
|
* Retrieve graph analytics for the requested metric.
|
|
2088
2558
|
*/
|
|
2089
|
-
async getAnalytics(
|
|
2559
|
+
async getAnalytics(query5 = {}) {
|
|
2090
2560
|
return gateway.request({
|
|
2091
|
-
path: `/api/platform/v1/graph/analytics${toQueryString(
|
|
2561
|
+
path: `/api/platform/v1/graph/analytics${toQueryString(query5)}`
|
|
2092
2562
|
});
|
|
2093
2563
|
}
|
|
2094
2564
|
};
|
|
@@ -2105,6 +2575,37 @@ function createIdentityWhoamiClient(config = {}) {
|
|
|
2105
2575
|
}
|
|
2106
2576
|
};
|
|
2107
2577
|
}
|
|
2578
|
+
var TENANT_IDENTITY_FIELDS = [
|
|
2579
|
+
"tenantId",
|
|
2580
|
+
"workspaceId",
|
|
2581
|
+
"principalId",
|
|
2582
|
+
"integrationKey",
|
|
2583
|
+
"secretRef",
|
|
2584
|
+
"policySubject",
|
|
2585
|
+
"policyAction",
|
|
2586
|
+
"policyResource",
|
|
2587
|
+
"decision",
|
|
2588
|
+
"config",
|
|
2589
|
+
"configKey",
|
|
2590
|
+
"configValue",
|
|
2591
|
+
"provider",
|
|
2592
|
+
"status",
|
|
2593
|
+
"metadata",
|
|
2594
|
+
"limit",
|
|
2595
|
+
"cursor"
|
|
2596
|
+
];
|
|
2597
|
+
function tenantIdentityQuery(input) {
|
|
2598
|
+
return {
|
|
2599
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
2600
|
+
workspaceId: input.workspaceId,
|
|
2601
|
+
principalId: input.principalId,
|
|
2602
|
+
limit: input.limit,
|
|
2603
|
+
cursor: input.cursor
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2606
|
+
function tenantIdentityBody(input, operation) {
|
|
2607
|
+
return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
|
|
2608
|
+
}
|
|
2108
2609
|
function createIdentityClient(config = {}) {
|
|
2109
2610
|
const gateway = createGatewayRequestClient(config);
|
|
2110
2611
|
const whoamiClient = createIdentityWhoamiClient(config);
|
|
@@ -2140,9 +2641,9 @@ function createIdentityClient(config = {}) {
|
|
|
2140
2641
|
/**
|
|
2141
2642
|
* List principals in the current identity scope.
|
|
2142
2643
|
*/
|
|
2143
|
-
async listPrincipals(
|
|
2644
|
+
async listPrincipals(query5 = {}) {
|
|
2144
2645
|
return gateway.request({
|
|
2145
|
-
path: `/api/platform/v1/identity/principals${toQueryString(
|
|
2646
|
+
path: `/api/platform/v1/identity/principals${toQueryString(query5)}`
|
|
2146
2647
|
}).then(
|
|
2147
2648
|
(response) => mapGatewayData(
|
|
2148
2649
|
response,
|
|
@@ -2174,9 +2675,9 @@ function createIdentityClient(config = {}) {
|
|
|
2174
2675
|
/**
|
|
2175
2676
|
* List keys in the current identity scope.
|
|
2176
2677
|
*/
|
|
2177
|
-
async listKeys(
|
|
2678
|
+
async listKeys(query5 = {}) {
|
|
2178
2679
|
return gateway.request({
|
|
2179
|
-
path: `/api/platform/v1/identity/keys${toQueryString(
|
|
2680
|
+
path: `/api/platform/v1/identity/keys${toQueryString(query5)}`
|
|
2180
2681
|
}).then(
|
|
2181
2682
|
(response) => mapGatewayData(
|
|
2182
2683
|
response,
|
|
@@ -2230,6 +2731,109 @@ function createIdentityClient(config = {}) {
|
|
|
2230
2731
|
return gateway.request({
|
|
2231
2732
|
path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
|
|
2232
2733
|
});
|
|
2734
|
+
},
|
|
2735
|
+
async getTenantConfig(input) {
|
|
2736
|
+
return gateway.request({
|
|
2737
|
+
path: `/api/platform/v1/identity/tenant-config${toQueryString(
|
|
2738
|
+
tenantIdentityQuery(input)
|
|
2739
|
+
)}`
|
|
2740
|
+
});
|
|
2741
|
+
},
|
|
2742
|
+
async updateTenantConfig(input, idempotencyKey) {
|
|
2743
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2744
|
+
return gateway.request({
|
|
2745
|
+
path: "/api/platform/v1/identity/tenant-config",
|
|
2746
|
+
method: "PATCH",
|
|
2747
|
+
body: tenantIdentityBody(
|
|
2748
|
+
input,
|
|
2749
|
+
"identity.updateTenantConfig"
|
|
2750
|
+
),
|
|
2751
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2752
|
+
});
|
|
2753
|
+
},
|
|
2754
|
+
async listIntegrations(input) {
|
|
2755
|
+
return gateway.request({
|
|
2756
|
+
path: `/api/platform/v1/identity/integrations${toQueryString(
|
|
2757
|
+
tenantIdentityQuery(input)
|
|
2758
|
+
)}`
|
|
2759
|
+
}).then(
|
|
2760
|
+
(response) => mapGatewayData(
|
|
2761
|
+
response,
|
|
2762
|
+
(data) => listResultFromEnvelope(
|
|
2763
|
+
data,
|
|
2764
|
+
"integrations"
|
|
2765
|
+
)
|
|
2766
|
+
)
|
|
2767
|
+
);
|
|
2768
|
+
},
|
|
2769
|
+
async upsertIntegration(input, idempotencyKey) {
|
|
2770
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2771
|
+
cleanRequiredString(input.integrationKey, "integrationKey");
|
|
2772
|
+
return gateway.request({
|
|
2773
|
+
path: "/api/platform/v1/identity/integrations",
|
|
2774
|
+
method: "PUT",
|
|
2775
|
+
body: tenantIdentityBody(
|
|
2776
|
+
input,
|
|
2777
|
+
"identity.upsertIntegration"
|
|
2778
|
+
),
|
|
2779
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2780
|
+
});
|
|
2781
|
+
},
|
|
2782
|
+
async listSecrets(input) {
|
|
2783
|
+
return gateway.request({
|
|
2784
|
+
path: `/api/platform/v1/identity/secrets${toQueryString(
|
|
2785
|
+
tenantIdentityQuery(input)
|
|
2786
|
+
)}`
|
|
2787
|
+
}).then(
|
|
2788
|
+
(response) => mapGatewayData(
|
|
2789
|
+
response,
|
|
2790
|
+
(data) => listResultFromEnvelope(
|
|
2791
|
+
data,
|
|
2792
|
+
"secrets"
|
|
2793
|
+
)
|
|
2794
|
+
)
|
|
2795
|
+
);
|
|
2796
|
+
},
|
|
2797
|
+
async putSecretReference(input, idempotencyKey) {
|
|
2798
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2799
|
+
cleanRequiredString(input.secretRef, "secretRef");
|
|
2800
|
+
return gateway.request({
|
|
2801
|
+
path: "/api/platform/v1/identity/secrets",
|
|
2802
|
+
method: "PUT",
|
|
2803
|
+
body: tenantIdentityBody(
|
|
2804
|
+
input,
|
|
2805
|
+
"identity.putSecretReference"
|
|
2806
|
+
),
|
|
2807
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2808
|
+
});
|
|
2809
|
+
},
|
|
2810
|
+
async evaluatePolicy(input, idempotencyKey) {
|
|
2811
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2812
|
+
cleanRequiredString(input.policySubject, "policySubject");
|
|
2813
|
+
cleanRequiredString(input.policyAction, "policyAction");
|
|
2814
|
+
cleanRequiredString(input.policyResource, "policyResource");
|
|
2815
|
+
return gateway.request({
|
|
2816
|
+
path: "/api/platform/v1/identity/policy/evaluate",
|
|
2817
|
+
method: "POST",
|
|
2818
|
+
body: tenantIdentityBody(
|
|
2819
|
+
input,
|
|
2820
|
+
"identity.evaluatePolicy"
|
|
2821
|
+
),
|
|
2822
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2823
|
+
});
|
|
2824
|
+
},
|
|
2825
|
+
async recordPolicyDecision(input, idempotencyKey) {
|
|
2826
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2827
|
+
cleanRequiredString(input.decision, "decision");
|
|
2828
|
+
return gateway.request({
|
|
2829
|
+
path: "/api/platform/v1/identity/policy/decisions",
|
|
2830
|
+
method: "POST",
|
|
2831
|
+
body: tenantIdentityBody(
|
|
2832
|
+
input,
|
|
2833
|
+
"identity.recordPolicyDecision"
|
|
2834
|
+
),
|
|
2835
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2836
|
+
});
|
|
2233
2837
|
}
|
|
2234
2838
|
};
|
|
2235
2839
|
}
|
|
@@ -2238,12 +2842,12 @@ function createIdentityClient(config = {}) {
|
|
|
2238
2842
|
function asRecord3(value) {
|
|
2239
2843
|
return value && typeof value === "object" ? value : {};
|
|
2240
2844
|
}
|
|
2241
|
-
function
|
|
2845
|
+
function cleanString3(value) {
|
|
2242
2846
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
2243
2847
|
}
|
|
2244
2848
|
function normalizeTopicRecord(value) {
|
|
2245
2849
|
const record = asRecord3(value);
|
|
2246
|
-
const topicId =
|
|
2850
|
+
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
2247
2851
|
return withTopicAlias({
|
|
2248
2852
|
...record,
|
|
2249
2853
|
...topicId ? { topicId } : {}
|
|
@@ -2255,15 +2859,15 @@ function normalizeTopicTreeNode(value) {
|
|
|
2255
2859
|
function createTopicsClient(config = {}) {
|
|
2256
2860
|
const gateway = createGatewayRequestClient(config);
|
|
2257
2861
|
return {
|
|
2258
|
-
async list(
|
|
2259
|
-
const topicId = resolveTopicId(
|
|
2862
|
+
async list(query5 = {}) {
|
|
2863
|
+
const topicId = resolveTopicId(query5);
|
|
2260
2864
|
return gateway.request({
|
|
2261
2865
|
path: `/api/platform/v1/topics${toQueryString({
|
|
2262
2866
|
...topicId ? { topicId } : {},
|
|
2263
|
-
ontologyId:
|
|
2264
|
-
parentTopicId:
|
|
2265
|
-
status:
|
|
2266
|
-
type:
|
|
2867
|
+
ontologyId: query5.ontologyId,
|
|
2868
|
+
parentTopicId: query5.parentTopicId,
|
|
2869
|
+
status: query5.status,
|
|
2870
|
+
type: query5.type
|
|
2267
2871
|
})}`
|
|
2268
2872
|
}).then(
|
|
2269
2873
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -2313,10 +2917,10 @@ function createTopicsClient(config = {}) {
|
|
|
2313
2917
|
(response) => mapGatewayData(response, (data) => normalizeTopicRecord(data))
|
|
2314
2918
|
);
|
|
2315
2919
|
},
|
|
2316
|
-
async getTree(topicId,
|
|
2920
|
+
async getTree(topicId, query5 = {}) {
|
|
2317
2921
|
return gateway.request({
|
|
2318
2922
|
path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/tree${toQueryString(
|
|
2319
|
-
|
|
2923
|
+
query5
|
|
2320
2924
|
)}`
|
|
2321
2925
|
}).then(
|
|
2322
2926
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -2327,10 +2931,10 @@ function createTopicsClient(config = {}) {
|
|
|
2327
2931
|
})
|
|
2328
2932
|
);
|
|
2329
2933
|
},
|
|
2330
|
-
async getCoverage(topicId,
|
|
2934
|
+
async getCoverage(topicId, query5 = {}) {
|
|
2331
2935
|
return gateway.request({
|
|
2332
2936
|
path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/coverage${toQueryString(
|
|
2333
|
-
|
|
2937
|
+
query5
|
|
2334
2938
|
)}`
|
|
2335
2939
|
});
|
|
2336
2940
|
},
|
|
@@ -2390,15 +2994,15 @@ function createBeliefsFacade(config = {}) {
|
|
|
2390
2994
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`
|
|
2391
2995
|
});
|
|
2392
2996
|
},
|
|
2393
|
-
async list(
|
|
2997
|
+
async list(query5) {
|
|
2394
2998
|
return gateway.request({
|
|
2395
2999
|
path: `/api/platform/v1/beliefs${toQueryString({
|
|
2396
|
-
topicId:
|
|
2397
|
-
status:
|
|
2398
|
-
worktreeId:
|
|
2399
|
-
minConfidence:
|
|
2400
|
-
limit:
|
|
2401
|
-
cursor:
|
|
3000
|
+
topicId: query5.topicId,
|
|
3001
|
+
status: query5.status,
|
|
3002
|
+
worktreeId: query5.worktreeId,
|
|
3003
|
+
minConfidence: query5.minConfidence,
|
|
3004
|
+
limit: query5.limit,
|
|
3005
|
+
cursor: query5.cursor
|
|
2402
3006
|
})}`
|
|
2403
3007
|
});
|
|
2404
3008
|
},
|
|
@@ -2534,13 +3138,13 @@ function createContradictionsFacade(config = {}) {
|
|
|
2534
3138
|
idempotencyKey
|
|
2535
3139
|
});
|
|
2536
3140
|
},
|
|
2537
|
-
async list(
|
|
3141
|
+
async list(query5) {
|
|
2538
3142
|
return gateway.request({
|
|
2539
3143
|
path: `/api/platform/v1/contradictions${toQueryString({
|
|
2540
|
-
topicId:
|
|
2541
|
-
status:
|
|
2542
|
-
limit:
|
|
2543
|
-
cursor:
|
|
3144
|
+
topicId: query5.topicId,
|
|
3145
|
+
status: query5.status,
|
|
3146
|
+
limit: query5.limit,
|
|
3147
|
+
cursor: query5.cursor
|
|
2544
3148
|
})}`
|
|
2545
3149
|
});
|
|
2546
3150
|
},
|
|
@@ -2562,13 +3166,13 @@ function createEdgesFacade(config = {}) {
|
|
|
2562
3166
|
idempotencyKey
|
|
2563
3167
|
});
|
|
2564
3168
|
},
|
|
2565
|
-
async list(
|
|
3169
|
+
async list(query5) {
|
|
2566
3170
|
return gateway.request({
|
|
2567
3171
|
path: `/api/platform/v1/edges${toQueryString({
|
|
2568
|
-
sourceId:
|
|
2569
|
-
edgeType:
|
|
2570
|
-
limit:
|
|
2571
|
-
cursor:
|
|
3172
|
+
sourceId: query5.sourceId,
|
|
3173
|
+
edgeType: query5.edgeType,
|
|
3174
|
+
limit: query5.limit,
|
|
3175
|
+
cursor: query5.cursor
|
|
2572
3176
|
})}`
|
|
2573
3177
|
});
|
|
2574
3178
|
},
|
|
@@ -2638,13 +3242,13 @@ function createEvidenceFacade(config = {}) {
|
|
|
2638
3242
|
path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`
|
|
2639
3243
|
});
|
|
2640
3244
|
},
|
|
2641
|
-
async list(
|
|
3245
|
+
async list(query5) {
|
|
2642
3246
|
return gateway.request({
|
|
2643
3247
|
path: `/api/platform/v1/evidence${toQueryString({
|
|
2644
|
-
topicId:
|
|
2645
|
-
targetId:
|
|
2646
|
-
limit:
|
|
2647
|
-
cursor:
|
|
3248
|
+
topicId: query5.topicId,
|
|
3249
|
+
targetId: query5.targetId,
|
|
3250
|
+
limit: query5.limit,
|
|
3251
|
+
cursor: query5.cursor
|
|
2648
3252
|
})}`
|
|
2649
3253
|
});
|
|
2650
3254
|
},
|
|
@@ -2661,11 +3265,11 @@ function createEvidenceFacade(config = {}) {
|
|
|
2661
3265
|
idempotencyKey
|
|
2662
3266
|
});
|
|
2663
3267
|
},
|
|
2664
|
-
async search(
|
|
3268
|
+
async search(query5, idempotencyKey = randomIdempotencyKey()) {
|
|
2665
3269
|
return gateway.request({
|
|
2666
3270
|
path: "/api/platform/v1/evidence/search",
|
|
2667
3271
|
method: "POST",
|
|
2668
|
-
body:
|
|
3272
|
+
body: query5,
|
|
2669
3273
|
idempotencyKey
|
|
2670
3274
|
});
|
|
2671
3275
|
},
|
|
@@ -2714,15 +3318,15 @@ function createEvidenceFacade(config = {}) {
|
|
|
2714
3318
|
function createEventsFacade(config = {}) {
|
|
2715
3319
|
const gateway = createGatewayRequestClient(config);
|
|
2716
3320
|
return {
|
|
2717
|
-
async list(
|
|
3321
|
+
async list(query5 = {}) {
|
|
2718
3322
|
return gateway.request({
|
|
2719
3323
|
path: `/api/platform/v1/events${toQueryString({
|
|
2720
|
-
topicId:
|
|
2721
|
-
after:
|
|
2722
|
-
types: serializeTypes(
|
|
2723
|
-
startTime:
|
|
2724
|
-
endTime:
|
|
2725
|
-
limit:
|
|
3324
|
+
topicId: query5.topicId,
|
|
3325
|
+
after: query5.after,
|
|
3326
|
+
types: serializeTypes(query5.types),
|
|
3327
|
+
startTime: query5.startTime,
|
|
3328
|
+
endTime: query5.endTime,
|
|
3329
|
+
limit: query5.limit
|
|
2726
3330
|
})}`
|
|
2727
3331
|
});
|
|
2728
3332
|
},
|
|
@@ -2787,8 +3391,8 @@ function createOntologiesFacade(config = {}) {
|
|
|
2787
3391
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
2788
3392
|
});
|
|
2789
3393
|
},
|
|
2790
|
-
async list(
|
|
2791
|
-
return ontologyClient.list(
|
|
3394
|
+
async list(query5 = {}) {
|
|
3395
|
+
return ontologyClient.list(query5);
|
|
2792
3396
|
},
|
|
2793
3397
|
async bind(input, idempotencyKey) {
|
|
2794
3398
|
return gateway.request({
|
|
@@ -2826,15 +3430,15 @@ function createQuestionsFacade(config = {}) {
|
|
|
2826
3430
|
path: `/api/platform/v1/questions/${encodeURIComponent(id)}`
|
|
2827
3431
|
});
|
|
2828
3432
|
},
|
|
2829
|
-
async list(
|
|
3433
|
+
async list(query5) {
|
|
2830
3434
|
return gateway.request({
|
|
2831
3435
|
path: `/api/platform/v1/questions${toQueryString({
|
|
2832
|
-
topicId:
|
|
2833
|
-
status:
|
|
2834
|
-
priority:
|
|
2835
|
-
worktreeId:
|
|
2836
|
-
limit:
|
|
2837
|
-
cursor:
|
|
3436
|
+
topicId: query5.topicId,
|
|
3437
|
+
status: query5.status,
|
|
3438
|
+
priority: query5.priority,
|
|
3439
|
+
worktreeId: query5.worktreeId,
|
|
3440
|
+
limit: query5.limit,
|
|
3441
|
+
cursor: query5.cursor
|
|
2838
3442
|
})}`
|
|
2839
3443
|
});
|
|
2840
3444
|
},
|
|
@@ -2986,13 +3590,13 @@ function createTasksFacade(config = {}) {
|
|
|
2986
3590
|
idempotencyKey
|
|
2987
3591
|
});
|
|
2988
3592
|
},
|
|
2989
|
-
async list(
|
|
3593
|
+
async list(query5) {
|
|
2990
3594
|
return gateway.request({
|
|
2991
3595
|
path: `/api/platform/v1/tasks${toQueryString({
|
|
2992
|
-
topicId:
|
|
2993
|
-
worktreeId:
|
|
2994
|
-
status:
|
|
2995
|
-
limit:
|
|
3596
|
+
topicId: query5.topicId,
|
|
3597
|
+
worktreeId: query5.worktreeId,
|
|
3598
|
+
status: query5.status,
|
|
3599
|
+
limit: query5.limit
|
|
2996
3600
|
})}`
|
|
2997
3601
|
});
|
|
2998
3602
|
}
|
|
@@ -3007,8 +3611,8 @@ function createTopicsFacade(config = {}) {
|
|
|
3007
3611
|
async get(id) {
|
|
3008
3612
|
return topicsClient.get(id);
|
|
3009
3613
|
},
|
|
3010
|
-
async list(
|
|
3011
|
-
return topicsClient.list(
|
|
3614
|
+
async list(query5 = {}) {
|
|
3615
|
+
return topicsClient.list(query5);
|
|
3012
3616
|
},
|
|
3013
3617
|
async update(input, idempotencyKey) {
|
|
3014
3618
|
const { id, ...rest } = input;
|
|
@@ -3044,10 +3648,10 @@ function createWebhooksFacade(config = {}) {
|
|
|
3044
3648
|
idempotencyKey
|
|
3045
3649
|
});
|
|
3046
3650
|
},
|
|
3047
|
-
async list(
|
|
3651
|
+
async list(query5 = {}) {
|
|
3048
3652
|
return gateway.request({
|
|
3049
3653
|
path: `/api/platform/v1/webhooks${toQueryString({
|
|
3050
|
-
topicId:
|
|
3654
|
+
topicId: query5.topicId
|
|
3051
3655
|
})}`
|
|
3052
3656
|
});
|
|
3053
3657
|
},
|
|
@@ -3079,10 +3683,10 @@ function createWebhooksFacade(config = {}) {
|
|
|
3079
3683
|
idempotencyKey
|
|
3080
3684
|
});
|
|
3081
3685
|
},
|
|
3082
|
-
async deliveries(id,
|
|
3686
|
+
async deliveries(id, query5 = {}) {
|
|
3083
3687
|
return gateway.request({
|
|
3084
3688
|
path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
|
|
3085
|
-
limit:
|
|
3689
|
+
limit: query5.limit
|
|
3086
3690
|
})}`
|
|
3087
3691
|
});
|
|
3088
3692
|
},
|
|
@@ -3104,24 +3708,24 @@ function createWorktreesFacade(config = {}) {
|
|
|
3104
3708
|
idempotencyKey
|
|
3105
3709
|
});
|
|
3106
3710
|
},
|
|
3107
|
-
async list(
|
|
3711
|
+
async list(query5) {
|
|
3108
3712
|
return gateway.request({
|
|
3109
3713
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
3110
|
-
topicId:
|
|
3111
|
-
status:
|
|
3112
|
-
groupBy:
|
|
3113
|
-
lane:
|
|
3114
|
-
campaign:
|
|
3115
|
-
limit:
|
|
3714
|
+
topicId: query5.topicId,
|
|
3715
|
+
status: query5.status,
|
|
3716
|
+
groupBy: query5.groupBy,
|
|
3717
|
+
lane: query5.lane,
|
|
3718
|
+
campaign: query5.campaign,
|
|
3719
|
+
limit: query5.limit
|
|
3116
3720
|
})}`
|
|
3117
3721
|
});
|
|
3118
3722
|
},
|
|
3119
|
-
async listCampaigns(
|
|
3723
|
+
async listCampaigns(query5 = {}) {
|
|
3120
3724
|
return gateway.request({
|
|
3121
3725
|
path: `/api/platform/v1/worktrees/campaigns${toQueryString({
|
|
3122
|
-
topicId:
|
|
3123
|
-
status:
|
|
3124
|
-
limit:
|
|
3726
|
+
topicId: query5.topicId,
|
|
3727
|
+
status: query5.status,
|
|
3728
|
+
limit: query5.limit
|
|
3125
3729
|
})}`
|
|
3126
3730
|
});
|
|
3127
3731
|
},
|
|
@@ -3234,12 +3838,12 @@ function createDecisionsClient(config = {}) {
|
|
|
3234
3838
|
/**
|
|
3235
3839
|
* List judgments for a topic scope.
|
|
3236
3840
|
*/
|
|
3237
|
-
async listJudgments(
|
|
3841
|
+
async listJudgments(query5) {
|
|
3238
3842
|
return gateway.request({
|
|
3239
3843
|
path: `/api/platform/v1/graph/judgments${toQueryString({
|
|
3240
|
-
...normalizeTopicQuery(
|
|
3241
|
-
includeArchived: typeof
|
|
3242
|
-
limit:
|
|
3844
|
+
...normalizeTopicQuery(query5),
|
|
3845
|
+
includeArchived: typeof query5.includeArchived === "boolean" ? query5.includeArchived ? "true" : "false" : void 0,
|
|
3846
|
+
limit: query5.limit
|
|
3243
3847
|
})}`
|
|
3244
3848
|
}).then(
|
|
3245
3849
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -3271,30 +3875,30 @@ function createDecisionsClient(config = {}) {
|
|
|
3271
3875
|
/**
|
|
3272
3876
|
* Get readiness signals for creating a judgment.
|
|
3273
3877
|
*/
|
|
3274
|
-
async getJudgmentReadiness(
|
|
3878
|
+
async getJudgmentReadiness(query5) {
|
|
3275
3879
|
return gateway.request({
|
|
3276
3880
|
path: `/api/platform/v1/graph/judgments/readiness${toQueryString(
|
|
3277
|
-
normalizeTopicQuery(
|
|
3881
|
+
normalizeTopicQuery(query5)
|
|
3278
3882
|
)}`
|
|
3279
3883
|
});
|
|
3280
3884
|
},
|
|
3281
3885
|
/**
|
|
3282
3886
|
* Get calibration analytics for judgment outcomes.
|
|
3283
3887
|
*/
|
|
3284
|
-
async getJudgmentCalibration(
|
|
3888
|
+
async getJudgmentCalibration(query5) {
|
|
3285
3889
|
return gateway.request({
|
|
3286
3890
|
path: `/api/platform/v1/graph/judgments/calibration${toQueryString(
|
|
3287
|
-
normalizeTopicQuery(
|
|
3891
|
+
normalizeTopicQuery(query5)
|
|
3288
3892
|
)}`
|
|
3289
3893
|
});
|
|
3290
3894
|
},
|
|
3291
3895
|
/**
|
|
3292
3896
|
* List judgments still awaiting outcome review.
|
|
3293
3897
|
*/
|
|
3294
|
-
async listPendingOutcomeReviews(
|
|
3898
|
+
async listPendingOutcomeReviews(query5) {
|
|
3295
3899
|
return gateway.request({
|
|
3296
3900
|
path: `/api/platform/v1/graph/judgments/pending-outcome-review${toQueryString(
|
|
3297
|
-
normalizeTopicQuery(
|
|
3901
|
+
normalizeTopicQuery(query5)
|
|
3298
3902
|
)}`
|
|
3299
3903
|
}).then(
|
|
3300
3904
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -3311,19 +3915,19 @@ function createDecisionsClient(config = {}) {
|
|
|
3311
3915
|
/**
|
|
3312
3916
|
* @deprecated Use listPendingOutcomeReviews.
|
|
3313
3917
|
*/
|
|
3314
|
-
async listPendingJudgmentOutcomeReview(
|
|
3315
|
-
return this.listPendingOutcomeReviews(
|
|
3918
|
+
async listPendingJudgmentOutcomeReview(query5) {
|
|
3919
|
+
return this.listPendingOutcomeReviews(query5);
|
|
3316
3920
|
},
|
|
3317
3921
|
/**
|
|
3318
3922
|
* Get audit integrity checks for judgment transitions.
|
|
3319
3923
|
*/
|
|
3320
|
-
async getJudgmentTransitionAuditIntegrity(
|
|
3924
|
+
async getJudgmentTransitionAuditIntegrity(query5) {
|
|
3321
3925
|
return gateway.request({
|
|
3322
3926
|
path: `/api/platform/v1/graph/judgments/transition-audit-integrity${toQueryString(
|
|
3323
3927
|
{
|
|
3324
|
-
...normalizeTopicQuery(
|
|
3325
|
-
judgmentId:
|
|
3326
|
-
includePassing: typeof
|
|
3928
|
+
...normalizeTopicQuery(query5),
|
|
3929
|
+
judgmentId: query5.judgmentId,
|
|
3930
|
+
includePassing: typeof query5.includePassing === "boolean" ? query5.includePassing ? "true" : "false" : void 0
|
|
3327
3931
|
}
|
|
3328
3932
|
)}`
|
|
3329
3933
|
});
|
|
@@ -3372,55 +3976,167 @@ function createDecisionsClient(config = {}) {
|
|
|
3372
3976
|
};
|
|
3373
3977
|
}
|
|
3374
3978
|
|
|
3375
|
-
// ../sdk/src/
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3979
|
+
// ../sdk/src/embeddingsClient.ts
|
|
3980
|
+
var EMBEDDINGS_FIELDS = [
|
|
3981
|
+
"topicId",
|
|
3982
|
+
"projectId",
|
|
3983
|
+
"workspaceId",
|
|
3984
|
+
"nodeIds",
|
|
3985
|
+
"nodeType",
|
|
3986
|
+
"embeddingModel",
|
|
3987
|
+
"queryText",
|
|
3988
|
+
"queryVector",
|
|
3989
|
+
"minScore",
|
|
3990
|
+
"limit",
|
|
3991
|
+
"cursor",
|
|
3992
|
+
"metadata"
|
|
3993
|
+
];
|
|
3994
|
+
function assertNodeIds(nodeIds) {
|
|
3995
|
+
if (!Array.isArray(nodeIds) || nodeIds.length === 0) {
|
|
3996
|
+
throw new Error("nodeIds is required");
|
|
3997
|
+
}
|
|
3381
3998
|
}
|
|
3382
|
-
function
|
|
3383
|
-
return
|
|
3999
|
+
function missingQuery(input) {
|
|
4000
|
+
return {
|
|
4001
|
+
topicId: requireTopicId(input),
|
|
4002
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId"),
|
|
4003
|
+
nodeType: input.nodeType,
|
|
4004
|
+
embeddingModel: input.embeddingModel,
|
|
4005
|
+
limit: input.limit,
|
|
4006
|
+
cursor: input.cursor
|
|
4007
|
+
};
|
|
3384
4008
|
}
|
|
3385
|
-
function
|
|
3386
|
-
const
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
4009
|
+
function createEmbeddingsClient(config = {}) {
|
|
4010
|
+
const gateway = createGatewayRequestClient(config);
|
|
4011
|
+
return {
|
|
4012
|
+
getByNodeIds(input) {
|
|
4013
|
+
assertNodeIds(input.nodeIds);
|
|
4014
|
+
return gateway.request({
|
|
4015
|
+
path: "/api/platform/v1/embeddings/by-node-ids",
|
|
4016
|
+
method: "POST",
|
|
4017
|
+
body: topicPayload(
|
|
4018
|
+
{
|
|
4019
|
+
...input,
|
|
4020
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4021
|
+
},
|
|
4022
|
+
EMBEDDINGS_FIELDS,
|
|
4023
|
+
"embeddings.getByNodeIds"
|
|
4024
|
+
)
|
|
4025
|
+
}).then(
|
|
4026
|
+
(response) => mapGatewayData(
|
|
4027
|
+
response,
|
|
4028
|
+
(data) => listResultFromEnvelope(
|
|
4029
|
+
data,
|
|
4030
|
+
"embeddings"
|
|
4031
|
+
)
|
|
4032
|
+
)
|
|
4033
|
+
);
|
|
4034
|
+
},
|
|
4035
|
+
listMissingForTopic(input) {
|
|
4036
|
+
return gateway.request({
|
|
4037
|
+
path: `/api/platform/v1/embeddings/missing${toQueryString(
|
|
4038
|
+
missingQuery(input)
|
|
4039
|
+
)}`
|
|
4040
|
+
}).then(
|
|
4041
|
+
(response) => mapGatewayData(
|
|
4042
|
+
response,
|
|
4043
|
+
(data) => listResultFromEnvelope(
|
|
4044
|
+
data,
|
|
4045
|
+
"nodes"
|
|
4046
|
+
)
|
|
4047
|
+
)
|
|
4048
|
+
);
|
|
4049
|
+
},
|
|
4050
|
+
vectorSearchByTopic(input) {
|
|
4051
|
+
if (!input.queryText && !input.queryVector) {
|
|
4052
|
+
throw new Error("queryText or queryVector is required");
|
|
4053
|
+
}
|
|
4054
|
+
return gateway.request({
|
|
4055
|
+
path: "/api/platform/v1/embeddings/vector-search",
|
|
4056
|
+
method: "POST",
|
|
4057
|
+
body: topicPayload(
|
|
4058
|
+
{
|
|
4059
|
+
...input,
|
|
4060
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4061
|
+
},
|
|
4062
|
+
EMBEDDINGS_FIELDS,
|
|
4063
|
+
"embeddings.vectorSearchByTopic"
|
|
4064
|
+
)
|
|
4065
|
+
}).then(
|
|
4066
|
+
(response) => mapGatewayData(
|
|
4067
|
+
response,
|
|
4068
|
+
(data) => listResultFromEnvelope(data, "results")
|
|
4069
|
+
)
|
|
4070
|
+
);
|
|
4071
|
+
},
|
|
4072
|
+
markEmbeddingBackfillQueued(input, idempotencyKey) {
|
|
4073
|
+
assertNodeIds(input.nodeIds);
|
|
4074
|
+
return gateway.request({
|
|
4075
|
+
path: "/api/platform/v1/embeddings/backfill-queued",
|
|
4076
|
+
method: "POST",
|
|
4077
|
+
body: topicPayload(
|
|
4078
|
+
{
|
|
4079
|
+
...input,
|
|
4080
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4081
|
+
},
|
|
4082
|
+
EMBEDDINGS_FIELDS,
|
|
4083
|
+
"embeddings.markEmbeddingBackfillQueued"
|
|
4084
|
+
),
|
|
4085
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4086
|
+
});
|
|
4087
|
+
}
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
|
|
4091
|
+
// ../sdk/src/contextClient.ts
|
|
4092
|
+
function cleanString4(value) {
|
|
4093
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
4094
|
+
}
|
|
4095
|
+
function cleanNumber(value) {
|
|
4096
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4097
|
+
}
|
|
4098
|
+
function cleanBoolean(value) {
|
|
4099
|
+
return typeof value === "boolean" ? value : void 0;
|
|
4100
|
+
}
|
|
4101
|
+
function buildCompileContextRequest(topicId, input = {}) {
|
|
4102
|
+
const payload = { topicId };
|
|
4103
|
+
const query5 = cleanString4(input.query);
|
|
4104
|
+
if (query5) {
|
|
4105
|
+
payload.query = query5;
|
|
4106
|
+
}
|
|
4107
|
+
const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
|
|
4108
|
+
if (budget !== void 0) {
|
|
4109
|
+
payload.budget = budget;
|
|
4110
|
+
}
|
|
4111
|
+
const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
|
|
4112
|
+
if (ranking) {
|
|
4113
|
+
payload.ranking = ranking;
|
|
4114
|
+
}
|
|
4115
|
+
const limit = cleanNumber(input.limit);
|
|
4116
|
+
if (limit !== void 0) {
|
|
4117
|
+
payload.limit = limit;
|
|
4118
|
+
}
|
|
4119
|
+
const maxDepth = cleanNumber(input.maxDepth);
|
|
4120
|
+
if (maxDepth !== void 0) {
|
|
4121
|
+
payload.maxDepth = maxDepth;
|
|
4122
|
+
}
|
|
4123
|
+
const includeEntities = cleanBoolean(input.includeEntities);
|
|
4124
|
+
if (includeEntities !== void 0) {
|
|
4125
|
+
payload.includeEntities = includeEntities;
|
|
4126
|
+
}
|
|
4127
|
+
const mode = cleanString4(input.mode);
|
|
4128
|
+
if (mode) {
|
|
4129
|
+
payload.mode = mode;
|
|
4130
|
+
}
|
|
4131
|
+
const includeFailures = cleanBoolean(input.includeFailures);
|
|
3416
4132
|
if (includeFailures !== void 0) {
|
|
3417
4133
|
payload.includeFailures = includeFailures;
|
|
3418
4134
|
}
|
|
3419
|
-
const worktreeId =
|
|
4135
|
+
const worktreeId = cleanString4(input.worktreeId);
|
|
3420
4136
|
if (worktreeId) {
|
|
3421
4137
|
payload.worktreeId = worktreeId;
|
|
3422
4138
|
}
|
|
3423
|
-
const sessionId =
|
|
4139
|
+
const sessionId = cleanString4(input.sessionId);
|
|
3424
4140
|
if (sessionId) {
|
|
3425
4141
|
payload.sessionId = sessionId;
|
|
3426
4142
|
}
|
|
@@ -3452,6 +4168,406 @@ function createContextClient(config = {}) {
|
|
|
3452
4168
|
};
|
|
3453
4169
|
}
|
|
3454
4170
|
|
|
4171
|
+
// ../sdk/src/graphAnalysisClient.ts
|
|
4172
|
+
var GRAPH_ANALYSIS_ANALYSIS_FIELDS = [
|
|
4173
|
+
"topicId",
|
|
4174
|
+
"projectId",
|
|
4175
|
+
"workspaceId",
|
|
4176
|
+
"analysisType",
|
|
4177
|
+
"healthScore",
|
|
4178
|
+
"findings",
|
|
4179
|
+
"suggestions",
|
|
4180
|
+
"sourceNodeIds",
|
|
4181
|
+
"sourceEdgeIds",
|
|
4182
|
+
"detectorVersions",
|
|
4183
|
+
"metadata"
|
|
4184
|
+
];
|
|
4185
|
+
var GRAPH_ANALYSIS_SUGGESTION_FIELDS = [
|
|
4186
|
+
"topicId",
|
|
4187
|
+
"projectId",
|
|
4188
|
+
"workspaceId",
|
|
4189
|
+
"analysisId",
|
|
4190
|
+
"suggestions",
|
|
4191
|
+
"metadata"
|
|
4192
|
+
];
|
|
4193
|
+
var GRAPH_ANALYSIS_COMPUTE_FIELDS = [
|
|
4194
|
+
"topicId",
|
|
4195
|
+
"projectId",
|
|
4196
|
+
"workspaceId",
|
|
4197
|
+
"analysisType",
|
|
4198
|
+
"sourceNodeIds",
|
|
4199
|
+
"sourceEdgeIds",
|
|
4200
|
+
"detectorVersions",
|
|
4201
|
+
"metadata"
|
|
4202
|
+
];
|
|
4203
|
+
function readTopicId2(input) {
|
|
4204
|
+
return input.topicId?.trim() || input.projectId?.trim() || void 0;
|
|
4205
|
+
}
|
|
4206
|
+
function requireTopicId2(input) {
|
|
4207
|
+
const topicId = readTopicId2(input);
|
|
4208
|
+
if (!topicId) {
|
|
4209
|
+
throw new Error("topicId is required");
|
|
4210
|
+
}
|
|
4211
|
+
return topicId;
|
|
4212
|
+
}
|
|
4213
|
+
function assertKnownKeys2(input, allowed, operation) {
|
|
4214
|
+
const allowedSet = new Set(allowed);
|
|
4215
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
|
|
4216
|
+
if (unknownKeys.length > 0) {
|
|
4217
|
+
throw new Error(
|
|
4218
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
4219
|
+
);
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
function normalizeAnalysisPayload(input) {
|
|
4223
|
+
assertKnownKeys2(
|
|
4224
|
+
input,
|
|
4225
|
+
GRAPH_ANALYSIS_ANALYSIS_FIELDS,
|
|
4226
|
+
"graphAnalysis.saveAnalysis"
|
|
4227
|
+
);
|
|
4228
|
+
return {
|
|
4229
|
+
...input,
|
|
4230
|
+
topicId: requireTopicId2(input),
|
|
4231
|
+
projectId: void 0
|
|
4232
|
+
};
|
|
4233
|
+
}
|
|
4234
|
+
function normalizeSuggestionPayload(input) {
|
|
4235
|
+
assertKnownKeys2(
|
|
4236
|
+
input,
|
|
4237
|
+
GRAPH_ANALYSIS_SUGGESTION_FIELDS,
|
|
4238
|
+
"graphAnalysis.saveSuggestions"
|
|
4239
|
+
);
|
|
4240
|
+
return {
|
|
4241
|
+
...input,
|
|
4242
|
+
topicId: requireTopicId2(input),
|
|
4243
|
+
projectId: void 0
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4246
|
+
function normalizeComputePayload(input) {
|
|
4247
|
+
assertKnownKeys2(
|
|
4248
|
+
input,
|
|
4249
|
+
GRAPH_ANALYSIS_COMPUTE_FIELDS,
|
|
4250
|
+
"graphAnalysis.computeOrRequestAnalysis"
|
|
4251
|
+
);
|
|
4252
|
+
return {
|
|
4253
|
+
...input,
|
|
4254
|
+
topicId: requireTopicId2(input),
|
|
4255
|
+
projectId: void 0
|
|
4256
|
+
};
|
|
4257
|
+
}
|
|
4258
|
+
function graphAnalysisQuery(input) {
|
|
4259
|
+
return {
|
|
4260
|
+
topicId: requireTopicId2(input),
|
|
4261
|
+
workspaceId: input.workspaceId,
|
|
4262
|
+
analysisType: input.analysisType,
|
|
4263
|
+
limit: input.limit,
|
|
4264
|
+
cursor: input.cursor
|
|
4265
|
+
};
|
|
4266
|
+
}
|
|
4267
|
+
function createGraphAnalysisClient(config = {}) {
|
|
4268
|
+
const gateway = createGatewayRequestClient(config);
|
|
4269
|
+
return {
|
|
4270
|
+
saveAnalysis(input, idempotencyKey) {
|
|
4271
|
+
return gateway.request({
|
|
4272
|
+
path: "/api/platform/v1/graph-analysis/analyses",
|
|
4273
|
+
method: "POST",
|
|
4274
|
+
body: normalizeAnalysisPayload(input),
|
|
4275
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4276
|
+
});
|
|
4277
|
+
},
|
|
4278
|
+
listAnalyses(input) {
|
|
4279
|
+
return gateway.request({
|
|
4280
|
+
path: `/api/platform/v1/graph-analysis/analyses${toQueryString(
|
|
4281
|
+
graphAnalysisQuery(input)
|
|
4282
|
+
)}`
|
|
4283
|
+
}).then(
|
|
4284
|
+
(response) => mapGatewayData(
|
|
4285
|
+
response,
|
|
4286
|
+
(data) => createListResult(
|
|
4287
|
+
Array.isArray(data.analyses) ? data.analyses : Array.isArray(data) ? data : [],
|
|
4288
|
+
"analyses"
|
|
4289
|
+
)
|
|
4290
|
+
)
|
|
4291
|
+
);
|
|
4292
|
+
},
|
|
4293
|
+
getLatestAnalysis(input) {
|
|
4294
|
+
return gateway.request({
|
|
4295
|
+
path: `/api/platform/v1/graph-analysis/analyses/latest${toQueryString({
|
|
4296
|
+
topicId: requireTopicId2(input),
|
|
4297
|
+
workspaceId: input.workspaceId,
|
|
4298
|
+
analysisType: input.analysisType
|
|
4299
|
+
})}`
|
|
4300
|
+
});
|
|
4301
|
+
},
|
|
4302
|
+
saveSuggestions(input, idempotencyKey) {
|
|
4303
|
+
return gateway.request({
|
|
4304
|
+
path: "/api/platform/v1/graph-analysis/suggestions",
|
|
4305
|
+
method: "POST",
|
|
4306
|
+
body: normalizeSuggestionPayload(input),
|
|
4307
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4308
|
+
});
|
|
4309
|
+
},
|
|
4310
|
+
updateSuggestionStatus(input, idempotencyKey) {
|
|
4311
|
+
return gateway.request({
|
|
4312
|
+
path: `/api/platform/v1/graph-analysis/suggestions/${encodeURIComponent(
|
|
4313
|
+
input.suggestionId
|
|
4314
|
+
)}`,
|
|
4315
|
+
method: "PATCH",
|
|
4316
|
+
body: {
|
|
4317
|
+
status: input.status,
|
|
4318
|
+
rationale: input.rationale,
|
|
4319
|
+
metadata: input.metadata
|
|
4320
|
+
},
|
|
4321
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4322
|
+
});
|
|
4323
|
+
},
|
|
4324
|
+
listSuggestions(input) {
|
|
4325
|
+
return gateway.request({
|
|
4326
|
+
path: `/api/platform/v1/graph-analysis/suggestions${toQueryString({
|
|
4327
|
+
topicId: requireTopicId2(input),
|
|
4328
|
+
workspaceId: input.workspaceId,
|
|
4329
|
+
analysisId: input.analysisId,
|
|
4330
|
+
findingId: input.findingId,
|
|
4331
|
+
status: input.status,
|
|
4332
|
+
limit: input.limit,
|
|
4333
|
+
cursor: input.cursor
|
|
4334
|
+
})}`
|
|
4335
|
+
}).then(
|
|
4336
|
+
(response) => mapGatewayData(
|
|
4337
|
+
response,
|
|
4338
|
+
(data) => createListResult(
|
|
4339
|
+
Array.isArray(data.suggestions) ? data.suggestions : Array.isArray(data) ? data : [],
|
|
4340
|
+
"suggestions"
|
|
4341
|
+
)
|
|
4342
|
+
)
|
|
4343
|
+
);
|
|
4344
|
+
},
|
|
4345
|
+
listGraphChanges(input) {
|
|
4346
|
+
return gateway.request({
|
|
4347
|
+
path: `/api/platform/v1/graph-analysis/changes${toQueryString({
|
|
4348
|
+
topicId: requireTopicId2(input),
|
|
4349
|
+
workspaceId: input.workspaceId,
|
|
4350
|
+
analysisId: input.analysisId,
|
|
4351
|
+
since: input.since,
|
|
4352
|
+
limit: input.limit,
|
|
4353
|
+
cursor: input.cursor
|
|
4354
|
+
})}`
|
|
4355
|
+
}).then(
|
|
4356
|
+
(response) => mapGatewayData(
|
|
4357
|
+
response,
|
|
4358
|
+
(data) => createListResult(
|
|
4359
|
+
Array.isArray(data.changes) ? data.changes : Array.isArray(data) ? data : [],
|
|
4360
|
+
"changes"
|
|
4361
|
+
)
|
|
4362
|
+
)
|
|
4363
|
+
);
|
|
4364
|
+
},
|
|
4365
|
+
computeOrRequestAnalysis(input, idempotencyKey) {
|
|
4366
|
+
return gateway.request({
|
|
4367
|
+
path: "/api/platform/v1/graph-analysis/compute",
|
|
4368
|
+
method: "POST",
|
|
4369
|
+
body: normalizeComputePayload(input),
|
|
4370
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4371
|
+
});
|
|
4372
|
+
}
|
|
4373
|
+
};
|
|
4374
|
+
}
|
|
4375
|
+
|
|
4376
|
+
// ../sdk/src/graphRecommendationsClient.ts
|
|
4377
|
+
var GRAPH_RECOMMENDATION_FIELDS = [
|
|
4378
|
+
"topicId",
|
|
4379
|
+
"projectId",
|
|
4380
|
+
"workspaceId",
|
|
4381
|
+
"limit",
|
|
4382
|
+
"cursor",
|
|
4383
|
+
"status",
|
|
4384
|
+
"findingId",
|
|
4385
|
+
"actionType",
|
|
4386
|
+
"targetNodeIds",
|
|
4387
|
+
"priority",
|
|
4388
|
+
"rationale",
|
|
4389
|
+
"healthScore",
|
|
4390
|
+
"metadata"
|
|
4391
|
+
];
|
|
4392
|
+
function readTopicId3(input) {
|
|
4393
|
+
return input.topicId?.trim() || input.projectId?.trim() || void 0;
|
|
4394
|
+
}
|
|
4395
|
+
function requireTopicId3(input) {
|
|
4396
|
+
const topicId = readTopicId3(input);
|
|
4397
|
+
if (!topicId) {
|
|
4398
|
+
throw new Error("topicId is required");
|
|
4399
|
+
}
|
|
4400
|
+
return topicId;
|
|
4401
|
+
}
|
|
4402
|
+
function assertKnownKeys3(input, operation) {
|
|
4403
|
+
const allowed = new Set(GRAPH_RECOMMENDATION_FIELDS);
|
|
4404
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
|
|
4405
|
+
if (unknownKeys.length > 0) {
|
|
4406
|
+
throw new Error(
|
|
4407
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
4408
|
+
);
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
function listQuery(input) {
|
|
4412
|
+
assertKnownKeys3(
|
|
4413
|
+
input,
|
|
4414
|
+
"graphRecommendations.listForTopic"
|
|
4415
|
+
);
|
|
4416
|
+
return {
|
|
4417
|
+
workspaceId: input.workspaceId,
|
|
4418
|
+
topicId: requireTopicId3(input),
|
|
4419
|
+
limit: input.limit,
|
|
4420
|
+
cursor: input.cursor,
|
|
4421
|
+
status: input.status,
|
|
4422
|
+
findingId: input.findingId,
|
|
4423
|
+
actionType: input.actionType,
|
|
4424
|
+
priority: input.priority,
|
|
4425
|
+
targetNodeIds: input.targetNodeIds?.join(","),
|
|
4426
|
+
healthScore: input.healthScore
|
|
4427
|
+
};
|
|
4428
|
+
}
|
|
4429
|
+
function createGraphRecommendationsClient(config = {}) {
|
|
4430
|
+
const gateway = createGatewayRequestClient(config);
|
|
4431
|
+
return {
|
|
4432
|
+
listForTopic(input) {
|
|
4433
|
+
return gateway.request({
|
|
4434
|
+
path: `/api/platform/v1/graph-recommendations${toQueryString(
|
|
4435
|
+
listQuery(input)
|
|
4436
|
+
)}`
|
|
4437
|
+
}).then(
|
|
4438
|
+
(response) => mapGatewayData(
|
|
4439
|
+
response,
|
|
4440
|
+
(data) => createListResult(
|
|
4441
|
+
Array.isArray(
|
|
4442
|
+
data.recommendations
|
|
4443
|
+
) ? data.recommendations : Array.isArray(data) ? data : [],
|
|
4444
|
+
"recommendations"
|
|
4445
|
+
)
|
|
4446
|
+
)
|
|
4447
|
+
);
|
|
4448
|
+
},
|
|
4449
|
+
getRecommendation(recommendationId) {
|
|
4450
|
+
return gateway.request({
|
|
4451
|
+
path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
|
|
4452
|
+
recommendationId
|
|
4453
|
+
)}`
|
|
4454
|
+
});
|
|
4455
|
+
},
|
|
4456
|
+
markRecommendationStatus(input, idempotencyKey) {
|
|
4457
|
+
return gateway.request({
|
|
4458
|
+
path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
|
|
4459
|
+
input.recommendationId
|
|
4460
|
+
)}/status`,
|
|
4461
|
+
method: "PATCH",
|
|
4462
|
+
body: {
|
|
4463
|
+
status: input.status,
|
|
4464
|
+
rationale: input.rationale,
|
|
4465
|
+
metadata: input.metadata
|
|
4466
|
+
},
|
|
4467
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4468
|
+
});
|
|
4469
|
+
}
|
|
4470
|
+
};
|
|
4471
|
+
}
|
|
4472
|
+
|
|
4473
|
+
// ../sdk/src/graphStateClassifierClient.ts
|
|
4474
|
+
var GRAPH_STATE_CLASSIFIER_FIELDS = [
|
|
4475
|
+
"topicId",
|
|
4476
|
+
"projectId",
|
|
4477
|
+
"workspaceId",
|
|
4478
|
+
"nodeId",
|
|
4479
|
+
"epistemicStatus",
|
|
4480
|
+
"beliefMaturity",
|
|
4481
|
+
"answerQuality",
|
|
4482
|
+
"evidenceNetwork",
|
|
4483
|
+
"logicalRole",
|
|
4484
|
+
"questionPriority",
|
|
4485
|
+
"layer",
|
|
4486
|
+
"modelVersion",
|
|
4487
|
+
"limit",
|
|
4488
|
+
"cursor",
|
|
4489
|
+
"metadata"
|
|
4490
|
+
];
|
|
4491
|
+
function normalizeRecordPayload(input) {
|
|
4492
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4493
|
+
cleanRequiredString(input.nodeId, "nodeId");
|
|
4494
|
+
return topicPayload(
|
|
4495
|
+
input,
|
|
4496
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4497
|
+
"graphStateClassifier.recordClassification"
|
|
4498
|
+
);
|
|
4499
|
+
}
|
|
4500
|
+
function createGraphStateClassifierClient(config = {}) {
|
|
4501
|
+
const gateway = createGatewayRequestClient(config);
|
|
4502
|
+
return {
|
|
4503
|
+
classifyNode(input, idempotencyKey) {
|
|
4504
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4505
|
+
cleanRequiredString(input.nodeId, "nodeId");
|
|
4506
|
+
return gateway.request({
|
|
4507
|
+
path: "/api/platform/v1/graph-state-classifier/classify-node",
|
|
4508
|
+
method: "POST",
|
|
4509
|
+
body: topicPayload(
|
|
4510
|
+
input,
|
|
4511
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4512
|
+
"graphStateClassifier.classifyNode"
|
|
4513
|
+
),
|
|
4514
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4515
|
+
});
|
|
4516
|
+
},
|
|
4517
|
+
classifyTopic(input, idempotencyKey) {
|
|
4518
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4519
|
+
return gateway.request({
|
|
4520
|
+
path: "/api/platform/v1/graph-state-classifier/classify-topic",
|
|
4521
|
+
method: "POST",
|
|
4522
|
+
body: topicPayload(
|
|
4523
|
+
input,
|
|
4524
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4525
|
+
"graphStateClassifier.classifyTopic"
|
|
4526
|
+
),
|
|
4527
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4528
|
+
}).then(
|
|
4529
|
+
(response) => mapGatewayData(
|
|
4530
|
+
response,
|
|
4531
|
+
(data) => listResultFromEnvelope(
|
|
4532
|
+
data,
|
|
4533
|
+
"classifications"
|
|
4534
|
+
)
|
|
4535
|
+
)
|
|
4536
|
+
);
|
|
4537
|
+
},
|
|
4538
|
+
listClassifications(input) {
|
|
4539
|
+
return gateway.request({
|
|
4540
|
+
path: `/api/platform/v1/graph-state-classifier/classifications${toQueryString({
|
|
4541
|
+
topicId: requireTopicId(input),
|
|
4542
|
+
workspaceId: input.workspaceId,
|
|
4543
|
+
nodeId: input.nodeId,
|
|
4544
|
+
modelVersion: input.modelVersion,
|
|
4545
|
+
layer: input.layer,
|
|
4546
|
+
epistemicStatus: input.epistemicStatus,
|
|
4547
|
+
limit: input.limit,
|
|
4548
|
+
cursor: input.cursor
|
|
4549
|
+
})}`
|
|
4550
|
+
}).then(
|
|
4551
|
+
(response) => mapGatewayData(
|
|
4552
|
+
response,
|
|
4553
|
+
(data) => listResultFromEnvelope(
|
|
4554
|
+
data,
|
|
4555
|
+
"classifications"
|
|
4556
|
+
)
|
|
4557
|
+
)
|
|
4558
|
+
);
|
|
4559
|
+
},
|
|
4560
|
+
recordClassification(input, idempotencyKey) {
|
|
4561
|
+
return gateway.request({
|
|
4562
|
+
path: "/api/platform/v1/graph-state-classifier/classifications",
|
|
4563
|
+
method: "POST",
|
|
4564
|
+
body: normalizeRecordPayload(input),
|
|
4565
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4566
|
+
});
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
}
|
|
4570
|
+
|
|
3455
4571
|
// ../sdk/src/harnessClient.ts
|
|
3456
4572
|
function createHarnessClient(config = {}) {
|
|
3457
4573
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -3671,9 +4787,9 @@ function createHarnessClient(config = {}) {
|
|
|
3671
4787
|
/**
|
|
3672
4788
|
* List prompt resolutions.
|
|
3673
4789
|
*/
|
|
3674
|
-
async listPromptResolutions(
|
|
4790
|
+
async listPromptResolutions(query5 = {}) {
|
|
3675
4791
|
return gateway.request({
|
|
3676
|
-
path: `/api/platform/v1/harness/prompts${toQueryString(
|
|
4792
|
+
path: `/api/platform/v1/harness/prompts${toQueryString(query5)}`
|
|
3677
4793
|
}).then(
|
|
3678
4794
|
(response) => mapGatewayData(
|
|
3679
4795
|
response,
|
|
@@ -3692,6 +4808,128 @@ function createHarnessClient(config = {}) {
|
|
|
3692
4808
|
};
|
|
3693
4809
|
}
|
|
3694
4810
|
|
|
4811
|
+
// ../sdk/src/jobsClient.ts
|
|
4812
|
+
var JOBS_FIELDS = [
|
|
4813
|
+
"tenantId",
|
|
4814
|
+
"workspaceId",
|
|
4815
|
+
"principalId",
|
|
4816
|
+
"topicId",
|
|
4817
|
+
"worktreeId",
|
|
4818
|
+
"jobId",
|
|
4819
|
+
"jobType",
|
|
4820
|
+
"payload",
|
|
4821
|
+
"status",
|
|
4822
|
+
"attempt",
|
|
4823
|
+
"runId",
|
|
4824
|
+
"queue",
|
|
4825
|
+
"priority",
|
|
4826
|
+
"error",
|
|
4827
|
+
"metadata",
|
|
4828
|
+
"limit",
|
|
4829
|
+
"cursor"
|
|
4830
|
+
];
|
|
4831
|
+
function query2(input) {
|
|
4832
|
+
return {
|
|
4833
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
4834
|
+
workspaceId: input.workspaceId,
|
|
4835
|
+
principalId: input.principalId,
|
|
4836
|
+
topicId: input.topicId,
|
|
4837
|
+
worktreeId: input.worktreeId,
|
|
4838
|
+
jobType: input.jobType,
|
|
4839
|
+
status: input.status,
|
|
4840
|
+
queue: input.queue,
|
|
4841
|
+
limit: input.limit,
|
|
4842
|
+
cursor: input.cursor
|
|
4843
|
+
};
|
|
4844
|
+
}
|
|
4845
|
+
function body2(input, operation) {
|
|
4846
|
+
return knownPayload(input, JOBS_FIELDS, operation);
|
|
4847
|
+
}
|
|
4848
|
+
function createJobsClient(config = {}) {
|
|
4849
|
+
const gateway = createGatewayRequestClient(config);
|
|
4850
|
+
return {
|
|
4851
|
+
enqueue(input, idempotencyKey) {
|
|
4852
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4853
|
+
cleanRequiredString(input.jobType, "jobType");
|
|
4854
|
+
return gateway.request({
|
|
4855
|
+
path: "/api/platform/v1/jobs",
|
|
4856
|
+
method: "POST",
|
|
4857
|
+
body: body2(input, "jobs.enqueue"),
|
|
4858
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4859
|
+
});
|
|
4860
|
+
},
|
|
4861
|
+
list(input) {
|
|
4862
|
+
return gateway.request({
|
|
4863
|
+
path: `/api/platform/v1/jobs${toQueryString(query2(input))}`
|
|
4864
|
+
}).then(
|
|
4865
|
+
(response) => mapGatewayData(
|
|
4866
|
+
response,
|
|
4867
|
+
(data) => listResultFromEnvelope(data, "jobs")
|
|
4868
|
+
)
|
|
4869
|
+
);
|
|
4870
|
+
},
|
|
4871
|
+
claim(input, idempotencyKey) {
|
|
4872
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4873
|
+
return gateway.request({
|
|
4874
|
+
path: "/api/platform/v1/jobs/claim",
|
|
4875
|
+
method: "POST",
|
|
4876
|
+
body: body2(input, "jobs.claim"),
|
|
4877
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4878
|
+
});
|
|
4879
|
+
},
|
|
4880
|
+
updateStatus(input, idempotencyKey) {
|
|
4881
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4882
|
+
cleanRequiredString(input.jobId, "jobId");
|
|
4883
|
+
return gateway.request({
|
|
4884
|
+
path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/status`,
|
|
4885
|
+
method: "PATCH",
|
|
4886
|
+
body: body2(
|
|
4887
|
+
input,
|
|
4888
|
+
"jobs.updateStatus"
|
|
4889
|
+
),
|
|
4890
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4891
|
+
});
|
|
4892
|
+
},
|
|
4893
|
+
retry(input, idempotencyKey) {
|
|
4894
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4895
|
+
cleanRequiredString(input.jobId, "jobId");
|
|
4896
|
+
return gateway.request({
|
|
4897
|
+
path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/retry`,
|
|
4898
|
+
method: "POST",
|
|
4899
|
+
body: body2(input, "jobs.retry"),
|
|
4900
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4901
|
+
});
|
|
4902
|
+
},
|
|
4903
|
+
recordRunStart(input, idempotencyKey) {
|
|
4904
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4905
|
+
return gateway.request({
|
|
4906
|
+
path: "/api/platform/v1/jobs/runs/start",
|
|
4907
|
+
method: "POST",
|
|
4908
|
+
body: body2(
|
|
4909
|
+
input,
|
|
4910
|
+
"jobs.recordRunStart"
|
|
4911
|
+
),
|
|
4912
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4913
|
+
});
|
|
4914
|
+
},
|
|
4915
|
+
recordRunFinish(input, idempotencyKey) {
|
|
4916
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4917
|
+
cleanRequiredString(input.runId, "runId");
|
|
4918
|
+
return gateway.request({
|
|
4919
|
+
path: `/api/platform/v1/jobs/runs/${encodeURIComponent(
|
|
4920
|
+
input.runId
|
|
4921
|
+
)}/finish`,
|
|
4922
|
+
method: "POST",
|
|
4923
|
+
body: body2(
|
|
4924
|
+
input,
|
|
4925
|
+
"jobs.recordRunFinish"
|
|
4926
|
+
),
|
|
4927
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4928
|
+
});
|
|
4929
|
+
}
|
|
4930
|
+
};
|
|
4931
|
+
}
|
|
4932
|
+
|
|
3695
4933
|
// ../sdk/src/learningClient.ts
|
|
3696
4934
|
function createLearningClient(config = {}) {
|
|
3697
4935
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -3737,6 +4975,131 @@ function createLearningClient(config = {}) {
|
|
|
3737
4975
|
};
|
|
3738
4976
|
}
|
|
3739
4977
|
|
|
4978
|
+
// ../contracts/src/mcp-gateway-boundary.contract.ts
|
|
4979
|
+
var MCP_GATEWAY_BOOTSTRAP_ENDPOINT = "/api/platform/v1/mcp/session";
|
|
4980
|
+
var MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT = "/api/platform/v1/mcp/write-policy/check";
|
|
4981
|
+
var MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT = "/api/platform/v1/mcp/build-session/begin";
|
|
4982
|
+
var MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT = "/api/platform/v1/mcp/contracts/evaluate-engineering";
|
|
4983
|
+
var MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT = "/api/platform/v1/mcp/contracts/evaluate-research";
|
|
4984
|
+
|
|
4985
|
+
// ../sdk/src/mcpClient.ts
|
|
4986
|
+
function toJsonValue(value) {
|
|
4987
|
+
if (value === void 0) {
|
|
4988
|
+
return void 0;
|
|
4989
|
+
}
|
|
4990
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
4991
|
+
const json = JSON.stringify(value, (_key, candidate) => {
|
|
4992
|
+
if (typeof candidate === "bigint") {
|
|
4993
|
+
return candidate.toString();
|
|
4994
|
+
}
|
|
4995
|
+
if (typeof candidate === "function" || typeof candidate === "symbol" || typeof candidate === "undefined") {
|
|
4996
|
+
return void 0;
|
|
4997
|
+
}
|
|
4998
|
+
if (candidate && typeof candidate === "object") {
|
|
4999
|
+
if (seen.has(candidate)) {
|
|
5000
|
+
return "[Circular]";
|
|
5001
|
+
}
|
|
5002
|
+
seen.add(candidate);
|
|
5003
|
+
}
|
|
5004
|
+
return candidate;
|
|
5005
|
+
});
|
|
5006
|
+
if (json === void 0) {
|
|
5007
|
+
return void 0;
|
|
5008
|
+
}
|
|
5009
|
+
return JSON.parse(json);
|
|
5010
|
+
}
|
|
5011
|
+
function createMcpClient(config = {}) {
|
|
5012
|
+
const gateway = createGatewayRequestClient(config);
|
|
5013
|
+
return {
|
|
5014
|
+
bootstrapSession(input = {}) {
|
|
5015
|
+
const scope = {
|
|
5016
|
+
tenantId: input.tenantId,
|
|
5017
|
+
workspaceId: input.workspaceId
|
|
5018
|
+
};
|
|
5019
|
+
const body4 = {
|
|
5020
|
+
transportKind: input.transportKind,
|
|
5021
|
+
sessionId: input.sessionId,
|
|
5022
|
+
agentIdentity: input.agentIdentity,
|
|
5023
|
+
workspaceId: input.workspaceId
|
|
5024
|
+
};
|
|
5025
|
+
return gateway.request({
|
|
5026
|
+
path: `${MCP_GATEWAY_BOOTSTRAP_ENDPOINT}${toQueryString(scope)}`,
|
|
5027
|
+
method: "POST",
|
|
5028
|
+
body: body4
|
|
5029
|
+
});
|
|
5030
|
+
},
|
|
5031
|
+
checkWritePolicy(input) {
|
|
5032
|
+
const scope = {
|
|
5033
|
+
tenantId: input.tenantId,
|
|
5034
|
+
workspaceId: input.workspaceId
|
|
5035
|
+
};
|
|
5036
|
+
return gateway.request({
|
|
5037
|
+
path: `${MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT}${toQueryString(scope)}`,
|
|
5038
|
+
method: "POST",
|
|
5039
|
+
body: {
|
|
5040
|
+
topicId: input.topicId,
|
|
5041
|
+
role: input.role,
|
|
5042
|
+
toolName: input.toolName
|
|
5043
|
+
}
|
|
5044
|
+
});
|
|
5045
|
+
},
|
|
5046
|
+
beginBuildSession(input) {
|
|
5047
|
+
const scope = {
|
|
5048
|
+
tenantId: input.tenantId,
|
|
5049
|
+
workspaceId: input.workspaceId
|
|
5050
|
+
};
|
|
5051
|
+
return gateway.request({
|
|
5052
|
+
path: `${MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT}${toQueryString(scope)}`,
|
|
5053
|
+
method: "POST",
|
|
5054
|
+
body: {
|
|
5055
|
+
worktreeId: input.worktreeId,
|
|
5056
|
+
branch: input.branch,
|
|
5057
|
+
branchBase: input.branchBase,
|
|
5058
|
+
prBase: input.prBase,
|
|
5059
|
+
sessionMode: input.sessionMode,
|
|
5060
|
+
activateIfPlanning: input.activateIfPlanning
|
|
5061
|
+
}
|
|
5062
|
+
});
|
|
5063
|
+
},
|
|
5064
|
+
evaluateEngineeringContract(input) {
|
|
5065
|
+
const scope = {
|
|
5066
|
+
tenantId: input.tenantId,
|
|
5067
|
+
workspaceId: input.workspaceId
|
|
5068
|
+
};
|
|
5069
|
+
return gateway.request({
|
|
5070
|
+
path: `${MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
|
|
5071
|
+
method: "POST",
|
|
5072
|
+
body: {
|
|
5073
|
+
beliefNodeId: toJsonValue(input.beliefNodeId),
|
|
5074
|
+
trigger: toJsonValue(input.trigger),
|
|
5075
|
+
testOutput: toJsonValue(input.testOutput),
|
|
5076
|
+
tscOutput: toJsonValue(input.tscOutput),
|
|
5077
|
+
lintOutput: toJsonValue(input.lintOutput),
|
|
5078
|
+
sentryData: toJsonValue(input.sentryData)
|
|
5079
|
+
}
|
|
5080
|
+
});
|
|
5081
|
+
},
|
|
5082
|
+
evaluateResearchContract(input) {
|
|
5083
|
+
const scope = {
|
|
5084
|
+
tenantId: input.tenantId,
|
|
5085
|
+
workspaceId: input.workspaceId
|
|
5086
|
+
};
|
|
5087
|
+
return gateway.request({
|
|
5088
|
+
path: `${MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
|
|
5089
|
+
method: "POST",
|
|
5090
|
+
body: {
|
|
5091
|
+
beliefNodeId: toJsonValue(input.beliefNodeId),
|
|
5092
|
+
trigger: toJsonValue(input.trigger),
|
|
5093
|
+
metricData: toJsonValue(input.metricData),
|
|
5094
|
+
referenceCheckData: toJsonValue(input.referenceCheckData),
|
|
5095
|
+
marketIndexData: toJsonValue(input.marketIndexData),
|
|
5096
|
+
temporalData: toJsonValue(input.temporalData)
|
|
5097
|
+
}
|
|
5098
|
+
});
|
|
5099
|
+
}
|
|
5100
|
+
};
|
|
5101
|
+
}
|
|
5102
|
+
|
|
3740
5103
|
// ../sdk/src/generated/functionSurface.ts
|
|
3741
5104
|
var CONTRACTS = {
|
|
3742
5105
|
"activate_worktree": { method: "POST", path: "/worktrees/activate", kind: "mutation", idempotent: true, surfaceIntent: "mcp_workflow" },
|
|
@@ -4194,26 +5557,324 @@ function createFunctionSurfaceClient(config = {}) {
|
|
|
4194
5557
|
traverseGraph(input = {}, idempotencyKey) {
|
|
4195
5558
|
return execute("traverse_graph", input, idempotencyKey);
|
|
4196
5559
|
},
|
|
4197
|
-
triggerBeliefReview(input = {}, idempotencyKey) {
|
|
4198
|
-
return execute("trigger_belief_review", input, idempotencyKey);
|
|
5560
|
+
triggerBeliefReview(input = {}, idempotencyKey) {
|
|
5561
|
+
return execute("trigger_belief_review", input, idempotencyKey);
|
|
5562
|
+
},
|
|
5563
|
+
updateOntology(input = {}, idempotencyKey) {
|
|
5564
|
+
return execute("update_ontology", input, idempotencyKey);
|
|
5565
|
+
},
|
|
5566
|
+
updateQuestionStatus(input = {}, idempotencyKey) {
|
|
5567
|
+
return execute("update_question_status", input, idempotencyKey);
|
|
5568
|
+
},
|
|
5569
|
+
updateTask(input = {}, idempotencyKey) {
|
|
5570
|
+
return execute("update_task", input, idempotencyKey);
|
|
5571
|
+
},
|
|
5572
|
+
updateTopic(input = {}, idempotencyKey) {
|
|
5573
|
+
return execute("update_topic", input, idempotencyKey);
|
|
5574
|
+
},
|
|
5575
|
+
updateWorktreeMetadata(input = {}, idempotencyKey) {
|
|
5576
|
+
return execute("update_worktree_metadata", input, idempotencyKey);
|
|
5577
|
+
},
|
|
5578
|
+
updateWorktreeTargets(input = {}, idempotencyKey) {
|
|
5579
|
+
return execute("update_worktree_targets", input, idempotencyKey);
|
|
5580
|
+
}
|
|
5581
|
+
};
|
|
5582
|
+
}
|
|
5583
|
+
|
|
5584
|
+
// ../sdk/src/modelRuntimeClient.ts
|
|
5585
|
+
var MODEL_RUNTIME_FIELDS = [
|
|
5586
|
+
"tenantId",
|
|
5587
|
+
"workspaceId",
|
|
5588
|
+
"principalId",
|
|
5589
|
+
"functionName",
|
|
5590
|
+
"slotKey",
|
|
5591
|
+
"modelId",
|
|
5592
|
+
"provider",
|
|
5593
|
+
"routingPolicy",
|
|
5594
|
+
"metadata",
|
|
5595
|
+
"limit",
|
|
5596
|
+
"cursor"
|
|
5597
|
+
];
|
|
5598
|
+
function scopeQuery(input) {
|
|
5599
|
+
return {
|
|
5600
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
5601
|
+
workspaceId: input.workspaceId,
|
|
5602
|
+
principalId: input.principalId,
|
|
5603
|
+
provider: input.provider,
|
|
5604
|
+
limit: input.limit,
|
|
5605
|
+
cursor: input.cursor
|
|
5606
|
+
};
|
|
5607
|
+
}
|
|
5608
|
+
function modelRuntimeBody(input, operation) {
|
|
5609
|
+
return knownPayload(input, MODEL_RUNTIME_FIELDS, operation);
|
|
5610
|
+
}
|
|
5611
|
+
function createModelRuntimeClient(config = {}) {
|
|
5612
|
+
const gateway = createGatewayRequestClient(config);
|
|
5613
|
+
return {
|
|
5614
|
+
listModels(input) {
|
|
5615
|
+
return gateway.request({
|
|
5616
|
+
path: `/api/platform/v1/model-runtime/models${toQueryString(
|
|
5617
|
+
scopeQuery(input)
|
|
5618
|
+
)}`
|
|
5619
|
+
}).then(
|
|
5620
|
+
(response) => mapGatewayData(
|
|
5621
|
+
response,
|
|
5622
|
+
(data) => listResultFromEnvelope(data, "models")
|
|
5623
|
+
)
|
|
5624
|
+
);
|
|
5625
|
+
},
|
|
5626
|
+
getModel(input) {
|
|
5627
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5628
|
+
cleanRequiredString(input.modelId, "modelId");
|
|
5629
|
+
return gateway.request({
|
|
5630
|
+
path: `/api/platform/v1/model-runtime/models/${encodeURIComponent(
|
|
5631
|
+
input.modelId
|
|
5632
|
+
)}${toQueryString({
|
|
5633
|
+
tenantId: input.tenantId,
|
|
5634
|
+
workspaceId: input.workspaceId,
|
|
5635
|
+
principalId: input.principalId
|
|
5636
|
+
})}`
|
|
5637
|
+
});
|
|
5638
|
+
},
|
|
5639
|
+
listFunctionSlots(input) {
|
|
5640
|
+
return gateway.request({
|
|
5641
|
+
path: `/api/platform/v1/model-runtime/function-slots${toQueryString({
|
|
5642
|
+
...scopeQuery(input),
|
|
5643
|
+
functionName: input.functionName
|
|
5644
|
+
})}`
|
|
5645
|
+
}).then(
|
|
5646
|
+
(response) => mapGatewayData(
|
|
5647
|
+
response,
|
|
5648
|
+
(data) => listResultFromEnvelope(data, "slots")
|
|
5649
|
+
)
|
|
5650
|
+
);
|
|
5651
|
+
},
|
|
5652
|
+
resolveSlot(input, idempotencyKey) {
|
|
5653
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5654
|
+
cleanRequiredString(input.functionName, "functionName");
|
|
5655
|
+
return gateway.request({
|
|
5656
|
+
path: "/api/platform/v1/model-runtime/function-slots/resolve",
|
|
5657
|
+
method: "POST",
|
|
5658
|
+
body: modelRuntimeBody(
|
|
5659
|
+
input,
|
|
5660
|
+
"modelRuntime.resolveSlot"
|
|
5661
|
+
),
|
|
5662
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5663
|
+
});
|
|
4199
5664
|
},
|
|
4200
|
-
|
|
4201
|
-
|
|
5665
|
+
updateSlotConfig(input, idempotencyKey) {
|
|
5666
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5667
|
+
cleanRequiredString(input.functionName, "functionName");
|
|
5668
|
+
cleanRequiredString(input.slotKey, "slotKey");
|
|
5669
|
+
cleanRequiredString(input.modelId, "modelId");
|
|
5670
|
+
return gateway.request({
|
|
5671
|
+
path: "/api/platform/v1/model-runtime/slot-configs",
|
|
5672
|
+
method: "PUT",
|
|
5673
|
+
body: modelRuntimeBody(
|
|
5674
|
+
input,
|
|
5675
|
+
"modelRuntime.updateSlotConfig"
|
|
5676
|
+
),
|
|
5677
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5678
|
+
});
|
|
5679
|
+
}
|
|
5680
|
+
};
|
|
5681
|
+
}
|
|
5682
|
+
|
|
5683
|
+
// ../sdk/src/ontologyLinksClient.ts
|
|
5684
|
+
var ONTOLOGY_LINK_FIELDS = [
|
|
5685
|
+
"topicId",
|
|
5686
|
+
"workspaceId",
|
|
5687
|
+
"linkId",
|
|
5688
|
+
"sourceNodeId",
|
|
5689
|
+
"sourceGlobalId",
|
|
5690
|
+
"targetNodeId",
|
|
5691
|
+
"targetGlobalId",
|
|
5692
|
+
"ontologyId",
|
|
5693
|
+
"ontologyType",
|
|
5694
|
+
"edgeType",
|
|
5695
|
+
"weight",
|
|
5696
|
+
"confidence",
|
|
5697
|
+
"status",
|
|
5698
|
+
"metadata"
|
|
5699
|
+
];
|
|
5700
|
+
function assertEndpoints(input) {
|
|
5701
|
+
if (!input.sourceNodeId && !input.sourceGlobalId) {
|
|
5702
|
+
throw new Error("sourceNodeId or sourceGlobalId is required");
|
|
5703
|
+
}
|
|
5704
|
+
if (!input.targetNodeId && !input.targetGlobalId) {
|
|
5705
|
+
throw new Error("targetNodeId or targetGlobalId is required");
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
function normalizeLinkPayload(input, operation) {
|
|
5709
|
+
assertEndpoints(input);
|
|
5710
|
+
cleanRequiredString(input.ontologyId, "ontologyId");
|
|
5711
|
+
cleanRequiredString(input.edgeType, "edgeType");
|
|
5712
|
+
return knownPayload(input, ONTOLOGY_LINK_FIELDS, operation);
|
|
5713
|
+
}
|
|
5714
|
+
function createOntologyLinksClient(config = {}) {
|
|
5715
|
+
const gateway = createGatewayRequestClient(config);
|
|
5716
|
+
return {
|
|
5717
|
+
createLink(input, idempotencyKey) {
|
|
5718
|
+
return gateway.request({
|
|
5719
|
+
path: "/api/platform/v1/ontology-links",
|
|
5720
|
+
method: "POST",
|
|
5721
|
+
body: normalizeLinkPayload(input, "ontologyLinks.createLink"),
|
|
5722
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5723
|
+
});
|
|
4202
5724
|
},
|
|
4203
|
-
|
|
4204
|
-
return
|
|
5725
|
+
upsertLink(input, idempotencyKey) {
|
|
5726
|
+
return gateway.request({
|
|
5727
|
+
path: "/api/platform/v1/ontology-links",
|
|
5728
|
+
method: "PUT",
|
|
5729
|
+
body: normalizeLinkPayload(input, "ontologyLinks.upsertLink"),
|
|
5730
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5731
|
+
});
|
|
4205
5732
|
},
|
|
4206
|
-
|
|
4207
|
-
|
|
5733
|
+
listLinksForNode(input) {
|
|
5734
|
+
const nodeId = cleanOptionalString(input.nodeId);
|
|
5735
|
+
const globalId = cleanOptionalString(input.globalId);
|
|
5736
|
+
if (!nodeId && !globalId) {
|
|
5737
|
+
throw new Error("nodeId or globalId is required");
|
|
5738
|
+
}
|
|
5739
|
+
const pathId = encodeURIComponent(nodeId ?? globalId ?? "");
|
|
5740
|
+
return gateway.request({
|
|
5741
|
+
path: `/api/platform/v1/ontology-links/nodes/${pathId}${toQueryString({
|
|
5742
|
+
topicId: input.topicId,
|
|
5743
|
+
workspaceId: input.workspaceId,
|
|
5744
|
+
globalId: nodeId ? void 0 : globalId,
|
|
5745
|
+
ontologyId: input.ontologyId,
|
|
5746
|
+
ontologyType: input.ontologyType,
|
|
5747
|
+
edgeType: input.edgeType,
|
|
5748
|
+
status: input.status,
|
|
5749
|
+
limit: input.limit,
|
|
5750
|
+
cursor: input.cursor
|
|
5751
|
+
})}`
|
|
5752
|
+
}).then(
|
|
5753
|
+
(response) => mapGatewayData(
|
|
5754
|
+
response,
|
|
5755
|
+
(data) => listResultFromEnvelope(data, "links")
|
|
5756
|
+
)
|
|
5757
|
+
);
|
|
4208
5758
|
},
|
|
4209
|
-
|
|
4210
|
-
return
|
|
5759
|
+
updateLinkStatus(input, idempotencyKey) {
|
|
5760
|
+
return gateway.request({
|
|
5761
|
+
path: `/api/platform/v1/ontology-links/${encodeURIComponent(
|
|
5762
|
+
input.linkId
|
|
5763
|
+
)}/status`,
|
|
5764
|
+
method: "PATCH",
|
|
5765
|
+
body: knownPayload(
|
|
5766
|
+
input,
|
|
5767
|
+
ONTOLOGY_LINK_FIELDS,
|
|
5768
|
+
"ontologyLinks.updateLinkStatus"
|
|
5769
|
+
),
|
|
5770
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5771
|
+
});
|
|
5772
|
+
}
|
|
5773
|
+
};
|
|
5774
|
+
}
|
|
5775
|
+
|
|
5776
|
+
// ../sdk/src/orgGraphSearchClient.ts
|
|
5777
|
+
var ORG_GRAPH_SEARCH_FIELDS = [
|
|
5778
|
+
"tenantId",
|
|
5779
|
+
"workspaceId",
|
|
5780
|
+
"query",
|
|
5781
|
+
"nodeTypes",
|
|
5782
|
+
"minConfidence",
|
|
5783
|
+
"limit",
|
|
5784
|
+
"cursor",
|
|
5785
|
+
"provenanceScope"
|
|
5786
|
+
];
|
|
5787
|
+
function cleanString5(value, label) {
|
|
5788
|
+
const normalized = value?.trim();
|
|
5789
|
+
if (!normalized) {
|
|
5790
|
+
throw new Error(`${label} is required`);
|
|
5791
|
+
}
|
|
5792
|
+
return normalized;
|
|
5793
|
+
}
|
|
5794
|
+
function assertKnownSearchKeys(input, operation) {
|
|
5795
|
+
const allowed = new Set(ORG_GRAPH_SEARCH_FIELDS);
|
|
5796
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
|
|
5797
|
+
if (unknownKeys.length > 0) {
|
|
5798
|
+
throw new Error(
|
|
5799
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
5800
|
+
);
|
|
5801
|
+
}
|
|
5802
|
+
}
|
|
5803
|
+
function searchBody(input) {
|
|
5804
|
+
assertKnownSearchKeys(
|
|
5805
|
+
input,
|
|
5806
|
+
"orgGraphSearch.search"
|
|
5807
|
+
);
|
|
5808
|
+
return {
|
|
5809
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
5810
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
5811
|
+
query: cleanString5(input.query, "query"),
|
|
5812
|
+
nodeTypes: input.nodeTypes,
|
|
5813
|
+
minConfidence: input.minConfidence,
|
|
5814
|
+
limit: input.limit,
|
|
5815
|
+
cursor: input.cursor,
|
|
5816
|
+
provenanceScope: input.provenanceScope
|
|
5817
|
+
};
|
|
5818
|
+
}
|
|
5819
|
+
function listQuery2(input) {
|
|
5820
|
+
return {
|
|
5821
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
5822
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
5823
|
+
nodeTypes: input.nodeTypes?.join(","),
|
|
5824
|
+
minConfidence: input.minConfidence,
|
|
5825
|
+
limit: input.limit,
|
|
5826
|
+
cursor: input.cursor
|
|
5827
|
+
};
|
|
5828
|
+
}
|
|
5829
|
+
function mapResults(data) {
|
|
5830
|
+
const record = data && typeof data === "object" ? data : {};
|
|
5831
|
+
return createListResult(
|
|
5832
|
+
Array.isArray(record.results) ? record.results : Array.isArray(data) ? data : [],
|
|
5833
|
+
"results"
|
|
5834
|
+
);
|
|
5835
|
+
}
|
|
5836
|
+
function createOrgGraphSearchClient(config = {}) {
|
|
5837
|
+
const gateway = createGatewayRequestClient(config);
|
|
5838
|
+
return {
|
|
5839
|
+
search(input) {
|
|
5840
|
+
return gateway.request({
|
|
5841
|
+
path: "/api/platform/v1/org-graph-search/search",
|
|
5842
|
+
method: "POST",
|
|
5843
|
+
body: searchBody(input)
|
|
5844
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
5845
|
+
},
|
|
5846
|
+
getNode(input) {
|
|
5847
|
+
const nodeId = input.nodeId?.trim();
|
|
5848
|
+
const globalId = input.globalId?.trim();
|
|
5849
|
+
if (!nodeId && !globalId) {
|
|
5850
|
+
throw new Error("nodeId or globalId is required");
|
|
5851
|
+
}
|
|
5852
|
+
const nodePath = encodeURIComponent(nodeId ?? globalId ?? "");
|
|
5853
|
+
return gateway.request({
|
|
5854
|
+
path: `/api/platform/v1/org-graph-search/nodes/${nodePath}${toQueryString(
|
|
5855
|
+
{
|
|
5856
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
5857
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
5858
|
+
globalId: nodeId ? void 0 : globalId
|
|
5859
|
+
}
|
|
5860
|
+
)}`
|
|
5861
|
+
});
|
|
4211
5862
|
},
|
|
4212
|
-
|
|
4213
|
-
return
|
|
5863
|
+
listByProvenance(input) {
|
|
5864
|
+
return gateway.request({
|
|
5865
|
+
path: `/api/platform/v1/org-graph-search/provenance${toQueryString({
|
|
5866
|
+
...listQuery2(input),
|
|
5867
|
+
provenanceScope: input.provenanceScope
|
|
5868
|
+
})}`
|
|
5869
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
4214
5870
|
},
|
|
4215
|
-
|
|
4216
|
-
return
|
|
5871
|
+
listPublishedFromWorkspace(input) {
|
|
5872
|
+
return gateway.request({
|
|
5873
|
+
path: `/api/platform/v1/org-graph-search/published${toQueryString({
|
|
5874
|
+
...listQuery2(input),
|
|
5875
|
+
sourceWorkspaceId: input.sourceWorkspaceId
|
|
5876
|
+
})}`
|
|
5877
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
4217
5878
|
}
|
|
4218
5879
|
};
|
|
4219
5880
|
}
|
|
@@ -4260,9 +5921,9 @@ function createPacksClient(config = {}) {
|
|
|
4260
5921
|
/**
|
|
4261
5922
|
* List pack states for the current scope.
|
|
4262
5923
|
*/
|
|
4263
|
-
async listStates(
|
|
5924
|
+
async listStates(query5 = {}) {
|
|
4264
5925
|
return gateway.request({
|
|
4265
|
-
path: `/api/platform/v1/packs/states${toQueryString(
|
|
5926
|
+
path: `/api/platform/v1/packs/states${toQueryString(query5)}`
|
|
4266
5927
|
}).then(
|
|
4267
5928
|
(response) => mapGatewayData(
|
|
4268
5929
|
response,
|
|
@@ -4273,25 +5934,25 @@ function createPacksClient(config = {}) {
|
|
|
4273
5934
|
/**
|
|
4274
5935
|
* @deprecated Use listStates.
|
|
4275
5936
|
*/
|
|
4276
|
-
async getStates(
|
|
4277
|
-
return this.listStates(
|
|
5937
|
+
async getStates(query5 = {}) {
|
|
5938
|
+
return this.listStates(query5);
|
|
4278
5939
|
},
|
|
4279
5940
|
/**
|
|
4280
5941
|
* Get health details for a pack.
|
|
4281
5942
|
*/
|
|
4282
|
-
async getHealth(packKey,
|
|
5943
|
+
async getHealth(packKey, query5 = {}) {
|
|
4283
5944
|
return gateway.request({
|
|
4284
5945
|
path: `/api/platform/v1/packs/${encodeURIComponent(packKey)}/health${toQueryString(
|
|
4285
|
-
|
|
5946
|
+
query5
|
|
4286
5947
|
)}`
|
|
4287
5948
|
});
|
|
4288
5949
|
},
|
|
4289
5950
|
/**
|
|
4290
5951
|
* List pack telemetry entries.
|
|
4291
5952
|
*/
|
|
4292
|
-
async listTelemetry(
|
|
5953
|
+
async listTelemetry(query5 = {}) {
|
|
4293
5954
|
return gateway.request({
|
|
4294
|
-
path: `/api/platform/v1/packs/telemetry${toQueryString(
|
|
5955
|
+
path: `/api/platform/v1/packs/telemetry${toQueryString(query5)}`
|
|
4295
5956
|
}).then(
|
|
4296
5957
|
(response) => mapGatewayData(
|
|
4297
5958
|
response,
|
|
@@ -4302,8 +5963,8 @@ function createPacksClient(config = {}) {
|
|
|
4302
5963
|
/**
|
|
4303
5964
|
* @deprecated Use listTelemetry.
|
|
4304
5965
|
*/
|
|
4305
|
-
async getTelemetry(
|
|
4306
|
-
return this.listTelemetry(
|
|
5966
|
+
async getTelemetry(query5 = {}) {
|
|
5967
|
+
return this.listTelemetry(query5);
|
|
4307
5968
|
},
|
|
4308
5969
|
/**
|
|
4309
5970
|
* Create a pack entitlement.
|
|
@@ -4425,9 +6086,9 @@ function createPolicyClient(config = {}) {
|
|
|
4425
6086
|
/**
|
|
4426
6087
|
* List policy decisions in the current scope.
|
|
4427
6088
|
*/
|
|
4428
|
-
async listDecisions(
|
|
6089
|
+
async listDecisions(query5 = {}) {
|
|
4429
6090
|
return gateway.request({
|
|
4430
|
-
path: `/api/platform/v1/policy/decisions${toQueryString(
|
|
6091
|
+
path: `/api/platform/v1/policy/decisions${toQueryString(query5)}`
|
|
4431
6092
|
}).then(
|
|
4432
6093
|
(response) => mapGatewayData(
|
|
4433
6094
|
response,
|
|
@@ -4460,9 +6121,9 @@ function createPolicyClient(config = {}) {
|
|
|
4460
6121
|
/**
|
|
4461
6122
|
* List write policy rules for the current scope.
|
|
4462
6123
|
*/
|
|
4463
|
-
async listWritePolicies(
|
|
6124
|
+
async listWritePolicies(query5 = {}) {
|
|
4464
6125
|
const response = await gateway.request({
|
|
4465
|
-
path: `/api/platform/v1/policy/write-policies${toQueryString(
|
|
6126
|
+
path: `/api/platform/v1/policy/write-policies${toQueryString(query5)}`
|
|
4466
6127
|
});
|
|
4467
6128
|
const rawPolicies = response.data && typeof response.data === "object" ? response.data.policies : response.data;
|
|
4468
6129
|
return {
|
|
@@ -4525,9 +6186,9 @@ function createPolicyClient(config = {}) {
|
|
|
4525
6186
|
/**
|
|
4526
6187
|
* List tenant role policies for the current scope.
|
|
4527
6188
|
*/
|
|
4528
|
-
async listRolePolicies(
|
|
6189
|
+
async listRolePolicies(query5 = {}) {
|
|
4529
6190
|
const response = await gateway.request({
|
|
4530
|
-
path: `/api/platform/v1/policy/roles${toQueryString(
|
|
6191
|
+
path: `/api/platform/v1/policy/roles${toQueryString(query5)}`
|
|
4531
6192
|
});
|
|
4532
6193
|
return {
|
|
4533
6194
|
...response,
|
|
@@ -4585,28 +6246,28 @@ function createPolicyClient(config = {}) {
|
|
|
4585
6246
|
/**
|
|
4586
6247
|
* Check a permission decision for a topic or project scope.
|
|
4587
6248
|
*/
|
|
4588
|
-
async checkPermission(
|
|
4589
|
-
if (!
|
|
6249
|
+
async checkPermission(query5) {
|
|
6250
|
+
if (!query5.topicId) {
|
|
4590
6251
|
throw new Error("topicId is required");
|
|
4591
6252
|
}
|
|
4592
6253
|
return gateway.request({
|
|
4593
|
-
path: `/api/platform/v1/policy/check${toQueryString(
|
|
6254
|
+
path: `/api/platform/v1/policy/check${toQueryString(query5)}`
|
|
4594
6255
|
});
|
|
4595
6256
|
},
|
|
4596
6257
|
/**
|
|
4597
6258
|
* List accessible topics for a principal.
|
|
4598
6259
|
*/
|
|
4599
|
-
async listAccessibleTopics(
|
|
4600
|
-
const permission =
|
|
4601
|
-
const principal =
|
|
6260
|
+
async listAccessibleTopics(query5 = {}) {
|
|
6261
|
+
const permission = query5.permission ?? "read";
|
|
6262
|
+
const principal = query5.principal ?? query5.principalId;
|
|
4602
6263
|
const response = await gateway.request({
|
|
4603
6264
|
path: `/api/platform/v1/policy/topics${toQueryString({
|
|
4604
|
-
tenantId:
|
|
4605
|
-
workspaceId:
|
|
6265
|
+
tenantId: query5.tenantId,
|
|
6266
|
+
workspaceId: query5.workspaceId,
|
|
4606
6267
|
permission,
|
|
4607
|
-
includeShared:
|
|
6268
|
+
includeShared: query5.includeShared,
|
|
4608
6269
|
principal,
|
|
4609
|
-
limit:
|
|
6270
|
+
limit: query5.limit
|
|
4610
6271
|
})}`
|
|
4611
6272
|
});
|
|
4612
6273
|
return {
|
|
@@ -4789,6 +6450,294 @@ function createSchemaClient(config = {}) {
|
|
|
4789
6450
|
};
|
|
4790
6451
|
}
|
|
4791
6452
|
|
|
6453
|
+
// ../sdk/src/telemetryClient.ts
|
|
6454
|
+
var TELEMETRY_FIELDS = [
|
|
6455
|
+
"tenantId",
|
|
6456
|
+
"workspaceId",
|
|
6457
|
+
"principalId",
|
|
6458
|
+
"topicId",
|
|
6459
|
+
"worktreeId",
|
|
6460
|
+
"eventLevel",
|
|
6461
|
+
"eventType",
|
|
6462
|
+
"message",
|
|
6463
|
+
"toolName",
|
|
6464
|
+
"toolCalls",
|
|
6465
|
+
"decision",
|
|
6466
|
+
"policySubject",
|
|
6467
|
+
"policyAction",
|
|
6468
|
+
"policyResource",
|
|
6469
|
+
"runId",
|
|
6470
|
+
"runType",
|
|
6471
|
+
"status",
|
|
6472
|
+
"durationMs",
|
|
6473
|
+
"error",
|
|
6474
|
+
"metadata",
|
|
6475
|
+
"limit",
|
|
6476
|
+
"cursor"
|
|
6477
|
+
];
|
|
6478
|
+
function query3(input) {
|
|
6479
|
+
return {
|
|
6480
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
6481
|
+
workspaceId: input.workspaceId,
|
|
6482
|
+
principalId: input.principalId,
|
|
6483
|
+
topicId: input.topicId,
|
|
6484
|
+
worktreeId: input.worktreeId,
|
|
6485
|
+
runType: input.runType,
|
|
6486
|
+
status: input.status,
|
|
6487
|
+
limit: input.limit,
|
|
6488
|
+
cursor: input.cursor
|
|
6489
|
+
};
|
|
6490
|
+
}
|
|
6491
|
+
function body3(input, operation) {
|
|
6492
|
+
return knownPayload(input, TELEMETRY_FIELDS, operation);
|
|
6493
|
+
}
|
|
6494
|
+
function createTelemetryClient(config = {}) {
|
|
6495
|
+
const gateway = createGatewayRequestClient(config);
|
|
6496
|
+
return {
|
|
6497
|
+
logSystemEvent(input, idempotencyKey) {
|
|
6498
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6499
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
6500
|
+
cleanRequiredString(input.message, "message");
|
|
6501
|
+
return gateway.request({
|
|
6502
|
+
path: "/api/platform/v1/telemetry/system-events",
|
|
6503
|
+
method: "POST",
|
|
6504
|
+
body: body3(
|
|
6505
|
+
input,
|
|
6506
|
+
"telemetry.logSystemEvent"
|
|
6507
|
+
),
|
|
6508
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6509
|
+
});
|
|
6510
|
+
},
|
|
6511
|
+
logToolCallsBatch(input, idempotencyKey) {
|
|
6512
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6513
|
+
return gateway.request({
|
|
6514
|
+
path: "/api/platform/v1/telemetry/tool-calls/batch",
|
|
6515
|
+
method: "POST",
|
|
6516
|
+
body: body3(
|
|
6517
|
+
input,
|
|
6518
|
+
"telemetry.logToolCallsBatch"
|
|
6519
|
+
),
|
|
6520
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6521
|
+
});
|
|
6522
|
+
},
|
|
6523
|
+
recordEpistemicAudit(input, idempotencyKey) {
|
|
6524
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6525
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
6526
|
+
return gateway.request({
|
|
6527
|
+
path: "/api/platform/v1/telemetry/epistemic-audits",
|
|
6528
|
+
method: "POST",
|
|
6529
|
+
body: body3(
|
|
6530
|
+
input,
|
|
6531
|
+
"telemetry.recordEpistemicAudit"
|
|
6532
|
+
),
|
|
6533
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6534
|
+
});
|
|
6535
|
+
},
|
|
6536
|
+
recordPolicyDecision(input, idempotencyKey) {
|
|
6537
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6538
|
+
cleanRequiredString(input.decision, "decision");
|
|
6539
|
+
return gateway.request({
|
|
6540
|
+
path: "/api/platform/v1/telemetry/policy-decisions",
|
|
6541
|
+
method: "POST",
|
|
6542
|
+
body: body3(
|
|
6543
|
+
input,
|
|
6544
|
+
"telemetry.recordPolicyDecision"
|
|
6545
|
+
),
|
|
6546
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6547
|
+
});
|
|
6548
|
+
},
|
|
6549
|
+
startRun(input, idempotencyKey) {
|
|
6550
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6551
|
+
cleanRequiredString(input.runType, "runType");
|
|
6552
|
+
return gateway.request({
|
|
6553
|
+
path: "/api/platform/v1/telemetry/runs/start",
|
|
6554
|
+
method: "POST",
|
|
6555
|
+
body: body3(
|
|
6556
|
+
input,
|
|
6557
|
+
"telemetry.startRun"
|
|
6558
|
+
),
|
|
6559
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6560
|
+
});
|
|
6561
|
+
},
|
|
6562
|
+
finishRun(input, idempotencyKey) {
|
|
6563
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6564
|
+
cleanRequiredString(input.runId, "runId");
|
|
6565
|
+
return gateway.request({
|
|
6566
|
+
path: `/api/platform/v1/telemetry/runs/${encodeURIComponent(
|
|
6567
|
+
input.runId
|
|
6568
|
+
)}/finish`,
|
|
6569
|
+
method: "POST",
|
|
6570
|
+
body: body3(
|
|
6571
|
+
input,
|
|
6572
|
+
"telemetry.finishRun"
|
|
6573
|
+
),
|
|
6574
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6575
|
+
});
|
|
6576
|
+
},
|
|
6577
|
+
listRuns(input) {
|
|
6578
|
+
return gateway.request({
|
|
6579
|
+
path: `/api/platform/v1/telemetry/runs${toQueryString(query3(input))}`
|
|
6580
|
+
}).then(
|
|
6581
|
+
(response) => mapGatewayData(
|
|
6582
|
+
response,
|
|
6583
|
+
(data) => listResultFromEnvelope(data, "runs")
|
|
6584
|
+
)
|
|
6585
|
+
);
|
|
6586
|
+
}
|
|
6587
|
+
};
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
// ../sdk/src/toolRegistryClient.ts
|
|
6591
|
+
var TOOL_REGISTRY_FIELDS = [
|
|
6592
|
+
"tenantId",
|
|
6593
|
+
"workspaceId",
|
|
6594
|
+
"principalId",
|
|
6595
|
+
"toolName",
|
|
6596
|
+
"packKey",
|
|
6597
|
+
"packVersion",
|
|
6598
|
+
"status",
|
|
6599
|
+
"permissions",
|
|
6600
|
+
"role",
|
|
6601
|
+
"surface",
|
|
6602
|
+
"parameterSchema",
|
|
6603
|
+
"returnSchema",
|
|
6604
|
+
"handlerRef",
|
|
6605
|
+
"executionAdapter",
|
|
6606
|
+
"safetyMetadata",
|
|
6607
|
+
"aclId",
|
|
6608
|
+
"metadata",
|
|
6609
|
+
"limit",
|
|
6610
|
+
"cursor"
|
|
6611
|
+
];
|
|
6612
|
+
function query4(input) {
|
|
6613
|
+
return {
|
|
6614
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
6615
|
+
workspaceId: input.workspaceId,
|
|
6616
|
+
principalId: input.principalId,
|
|
6617
|
+
packKey: input.packKey,
|
|
6618
|
+
status: input.status,
|
|
6619
|
+
limit: input.limit,
|
|
6620
|
+
cursor: input.cursor
|
|
6621
|
+
};
|
|
6622
|
+
}
|
|
6623
|
+
function writeBody(input, operation) {
|
|
6624
|
+
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
6625
|
+
}
|
|
6626
|
+
function createToolRegistryClient(config = {}) {
|
|
6627
|
+
const gateway = createGatewayRequestClient(config);
|
|
6628
|
+
return {
|
|
6629
|
+
listCatalog(input) {
|
|
6630
|
+
return gateway.request({
|
|
6631
|
+
path: `/api/platform/v1/tools/catalog${toQueryString(query4(input))}`
|
|
6632
|
+
}).then(
|
|
6633
|
+
(response) => mapGatewayData(
|
|
6634
|
+
response,
|
|
6635
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6636
|
+
)
|
|
6637
|
+
);
|
|
6638
|
+
},
|
|
6639
|
+
listExecutable(input) {
|
|
6640
|
+
return gateway.request({
|
|
6641
|
+
path: `/api/platform/v1/tools/executable${toQueryString(query4(input))}`
|
|
6642
|
+
}).then(
|
|
6643
|
+
(response) => mapGatewayData(
|
|
6644
|
+
response,
|
|
6645
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6646
|
+
)
|
|
6647
|
+
);
|
|
6648
|
+
},
|
|
6649
|
+
listEffectiveTools(input) {
|
|
6650
|
+
return gateway.request({
|
|
6651
|
+
path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
|
|
6652
|
+
}).then(
|
|
6653
|
+
(response) => mapGatewayData(
|
|
6654
|
+
response,
|
|
6655
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6656
|
+
)
|
|
6657
|
+
);
|
|
6658
|
+
},
|
|
6659
|
+
upsertCoreTools(input, idempotencyKey) {
|
|
6660
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6661
|
+
return gateway.request({
|
|
6662
|
+
path: "/api/platform/v1/tools/core",
|
|
6663
|
+
method: "PUT",
|
|
6664
|
+
body: {
|
|
6665
|
+
tenantId: input.tenantId,
|
|
6666
|
+
workspaceId: input.workspaceId,
|
|
6667
|
+
metadata: input.metadata,
|
|
6668
|
+
tools: input.tools
|
|
6669
|
+
},
|
|
6670
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6671
|
+
}).then(
|
|
6672
|
+
(response) => mapGatewayData(
|
|
6673
|
+
response,
|
|
6674
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6675
|
+
)
|
|
6676
|
+
);
|
|
6677
|
+
},
|
|
6678
|
+
setPackToolsStatus(input, idempotencyKey) {
|
|
6679
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6680
|
+
cleanRequiredString(input.packKey, "packKey");
|
|
6681
|
+
return gateway.request({
|
|
6682
|
+
path: `/api/platform/v1/tools/packs/${encodeURIComponent(
|
|
6683
|
+
input.packKey
|
|
6684
|
+
)}/status`,
|
|
6685
|
+
method: "PATCH",
|
|
6686
|
+
body: writeBody(
|
|
6687
|
+
input,
|
|
6688
|
+
"tools.setPackToolsStatus"
|
|
6689
|
+
),
|
|
6690
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6691
|
+
}).then(
|
|
6692
|
+
(response) => mapGatewayData(
|
|
6693
|
+
response,
|
|
6694
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6695
|
+
)
|
|
6696
|
+
);
|
|
6697
|
+
},
|
|
6698
|
+
createAcl(input, idempotencyKey) {
|
|
6699
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6700
|
+
cleanRequiredString(input.principalId, "principalId");
|
|
6701
|
+
cleanRequiredString(input.toolName, "toolName");
|
|
6702
|
+
return gateway.request({
|
|
6703
|
+
path: "/api/platform/v1/tools/acls",
|
|
6704
|
+
method: "POST",
|
|
6705
|
+
body: writeBody(
|
|
6706
|
+
input,
|
|
6707
|
+
"tools.createAcl"
|
|
6708
|
+
),
|
|
6709
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6710
|
+
});
|
|
6711
|
+
},
|
|
6712
|
+
deleteAcl(input, idempotencyKey) {
|
|
6713
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6714
|
+
cleanRequiredString(input.aclId, "aclId");
|
|
6715
|
+
return gateway.request({
|
|
6716
|
+
path: `/api/platform/v1/tools/acls/${encodeURIComponent(input.aclId)}`,
|
|
6717
|
+
method: "DELETE",
|
|
6718
|
+
body: writeBody(
|
|
6719
|
+
input,
|
|
6720
|
+
"tools.deleteAcl"
|
|
6721
|
+
),
|
|
6722
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6723
|
+
});
|
|
6724
|
+
},
|
|
6725
|
+
registerCustomTool(input, idempotencyKey) {
|
|
6726
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6727
|
+
cleanRequiredString(input.toolName, "toolName");
|
|
6728
|
+
return gateway.request({
|
|
6729
|
+
path: "/api/platform/v1/tools/custom",
|
|
6730
|
+
method: "POST",
|
|
6731
|
+
body: writeBody(
|
|
6732
|
+
input,
|
|
6733
|
+
"tools.registerCustomTool"
|
|
6734
|
+
),
|
|
6735
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6736
|
+
});
|
|
6737
|
+
}
|
|
6738
|
+
};
|
|
6739
|
+
}
|
|
6740
|
+
|
|
4792
6741
|
// ../sdk/src/version.ts
|
|
4793
6742
|
var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
|
|
4794
6743
|
|
|
@@ -4806,10 +6755,10 @@ function createWorkflowClient(config = {}) {
|
|
|
4806
6755
|
/**
|
|
4807
6756
|
* List workflow branches for a topic scope.
|
|
4808
6757
|
*/
|
|
4809
|
-
async listBranches(
|
|
6758
|
+
async listBranches(query5) {
|
|
4810
6759
|
return gateway.request({
|
|
4811
6760
|
path: `/api/platform/v1/workflow/branches${toQueryString(
|
|
4812
|
-
normalizeTopicQuery(
|
|
6761
|
+
normalizeTopicQuery(query5)
|
|
4813
6762
|
)}`
|
|
4814
6763
|
}).then(
|
|
4815
6764
|
(response) => mapGatewayData(
|
|
@@ -4837,10 +6786,10 @@ function createWorkflowClient(config = {}) {
|
|
|
4837
6786
|
/**
|
|
4838
6787
|
* List reusable lenses for a workspace or topic scope.
|
|
4839
6788
|
*/
|
|
4840
|
-
async listLenses(
|
|
6789
|
+
async listLenses(query5) {
|
|
4841
6790
|
return gateway.request({
|
|
4842
6791
|
path: `/api/platform/v1/workflow/lenses${toQueryString(
|
|
4843
|
-
normalizeLensQuery(
|
|
6792
|
+
normalizeLensQuery(query5)
|
|
4844
6793
|
)}`
|
|
4845
6794
|
}).then(
|
|
4846
6795
|
(response) => mapGatewayData(
|
|
@@ -4912,14 +6861,14 @@ function createWorkflowClient(config = {}) {
|
|
|
4912
6861
|
/**
|
|
4913
6862
|
* List worktrees for a topic scope.
|
|
4914
6863
|
*/
|
|
4915
|
-
async listWorktrees(
|
|
4916
|
-
const normalized = normalizeTopicQuery(
|
|
6864
|
+
async listWorktrees(query5) {
|
|
6865
|
+
const normalized = normalizeTopicQuery(query5);
|
|
4917
6866
|
return gateway.request({
|
|
4918
6867
|
path: `/api/platform/v1/worktrees/all${toQueryString({
|
|
4919
6868
|
...normalized,
|
|
4920
|
-
groupBy:
|
|
4921
|
-
lane:
|
|
4922
|
-
campaign:
|
|
6869
|
+
groupBy: query5.groupBy,
|
|
6870
|
+
lane: query5.lane,
|
|
6871
|
+
campaign: query5.campaign
|
|
4923
6872
|
})}`
|
|
4924
6873
|
}).then(
|
|
4925
6874
|
(response) => mapGatewayData(
|
|
@@ -4934,14 +6883,14 @@ function createWorkflowClient(config = {}) {
|
|
|
4934
6883
|
/**
|
|
4935
6884
|
* List all worktrees across accessible topics.
|
|
4936
6885
|
*/
|
|
4937
|
-
async listAllWorktrees(
|
|
6886
|
+
async listAllWorktrees(query5 = {}) {
|
|
4938
6887
|
return gateway.request({
|
|
4939
6888
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
4940
|
-
status:
|
|
4941
|
-
groupBy:
|
|
4942
|
-
lane:
|
|
4943
|
-
campaign:
|
|
4944
|
-
limit:
|
|
6889
|
+
status: query5.status,
|
|
6890
|
+
groupBy: query5.groupBy,
|
|
6891
|
+
lane: query5.lane,
|
|
6892
|
+
campaign: query5.campaign,
|
|
6893
|
+
limit: query5.limit
|
|
4945
6894
|
})}`
|
|
4946
6895
|
}).then(
|
|
4947
6896
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -4961,10 +6910,10 @@ function createWorkflowClient(config = {}) {
|
|
|
4961
6910
|
/**
|
|
4962
6911
|
* List compact pipeline campaigns with nested lanes.
|
|
4963
6912
|
*/
|
|
4964
|
-
async listCampaigns(
|
|
6913
|
+
async listCampaigns(query5 = {}) {
|
|
4965
6914
|
return gateway.request({
|
|
4966
6915
|
path: `/api/platform/v1/worktrees/campaigns${toQueryString(
|
|
4967
|
-
normalizeTopicQuery(
|
|
6916
|
+
normalizeTopicQuery(query5)
|
|
4968
6917
|
)}`
|
|
4969
6918
|
});
|
|
4970
6919
|
},
|
|
@@ -5020,11 +6969,11 @@ function createWorkflowClient(config = {}) {
|
|
|
5020
6969
|
* Update targeted beliefs/questions for a worktree.
|
|
5021
6970
|
*/
|
|
5022
6971
|
async updateWorktreeTargets(input, idempotencyKey) {
|
|
5023
|
-
const { worktreeId, ...
|
|
6972
|
+
const { worktreeId, ...body4 } = input;
|
|
5024
6973
|
return gateway.request({
|
|
5025
6974
|
path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/targets`,
|
|
5026
6975
|
method: "POST",
|
|
5027
|
-
body,
|
|
6976
|
+
body: body4,
|
|
5028
6977
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5029
6978
|
}).then(
|
|
5030
6979
|
(response) => mapGatewayData(
|
|
@@ -5113,11 +7062,11 @@ function createWorkflowClient(config = {}) {
|
|
|
5113
7062
|
/**
|
|
5114
7063
|
* List accessible topic contexts.
|
|
5115
7064
|
*/
|
|
5116
|
-
async listTopics(
|
|
7065
|
+
async listTopics(query5 = {}) {
|
|
5117
7066
|
return gateway.request({
|
|
5118
7067
|
path: `/api/platform/v1/workflow/topics${toQueryString({
|
|
5119
|
-
includeShared: typeof
|
|
5120
|
-
limit:
|
|
7068
|
+
includeShared: typeof query5.includeShared === "boolean" ? query5.includeShared ? "true" : "false" : void 0,
|
|
7069
|
+
limit: query5.limit
|
|
5121
7070
|
})}`
|
|
5122
7071
|
}).then(
|
|
5123
7072
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -5245,13 +7194,15 @@ function toGatewayConfig(config) {
|
|
|
5245
7194
|
requestIdFactory: config.requestIdFactory,
|
|
5246
7195
|
onRequest: config.onRequest,
|
|
5247
7196
|
onResponse: config.onResponse,
|
|
7197
|
+
authContext: config.authContext,
|
|
7198
|
+
requireCanonicalAuthContext: config.requireCanonicalAuthContext,
|
|
5248
7199
|
getAuthHeaders: async () => {
|
|
5249
7200
|
const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
|
|
5250
7201
|
if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
|
|
5251
7202
|
base["x-lucern-key"] = config.apiKey;
|
|
5252
7203
|
}
|
|
5253
|
-
if (config.userToken && !base["x-lucern-
|
|
5254
|
-
base["x-lucern-
|
|
7204
|
+
if (config.userToken && !base["x-lucern-session-token"]) {
|
|
7205
|
+
base["x-lucern-session-token"] = config.userToken;
|
|
5255
7206
|
}
|
|
5256
7207
|
if (config.environment && !base["x-lucern-environment"]) {
|
|
5257
7208
|
base["x-lucern-environment"] = config.environment;
|
|
@@ -5260,7 +7211,7 @@ function toGatewayConfig(config) {
|
|
|
5260
7211
|
}
|
|
5261
7212
|
};
|
|
5262
7213
|
}
|
|
5263
|
-
function
|
|
7214
|
+
function requireTopicId4(args) {
|
|
5264
7215
|
const topicId = resolveTopicId(args);
|
|
5265
7216
|
if (!topicId) {
|
|
5266
7217
|
throw new Error("topicId is required");
|
|
@@ -5308,12 +7259,18 @@ function createLucernClient(config = {}) {
|
|
|
5308
7259
|
const sourcesClient = createSourcesClient(gatewayConfig);
|
|
5309
7260
|
const beliefsFacade = createBeliefsFacade(gatewayConfig);
|
|
5310
7261
|
const evidenceClient = createEvidenceClient(gatewayConfig);
|
|
7262
|
+
const embeddingsClient = createEmbeddingsClient(gatewayConfig);
|
|
7263
|
+
const eventingClient = createEventingClient(gatewayConfig);
|
|
5311
7264
|
const graphClient = createGraphClient(gatewayConfig);
|
|
7265
|
+
const graphAnalysisClient = createGraphAnalysisClient(gatewayConfig);
|
|
7266
|
+
const graphRecommendationsClient = createGraphRecommendationsClient(gatewayConfig);
|
|
7267
|
+
const graphStateClassifierClient = createGraphStateClassifierClient(gatewayConfig);
|
|
5312
7268
|
const graphFacade = createGraphFacade(gatewayConfig);
|
|
5313
7269
|
const decisionsClient = createDecisionsClient(gatewayConfig);
|
|
5314
7270
|
const contextClient = createContextClient(gatewayConfig);
|
|
5315
7271
|
const workflowClient = createWorkflowClient(gatewayConfig);
|
|
5316
7272
|
const auditClient = createAuditClient(gatewayConfig);
|
|
7273
|
+
const authDeviceClient = createAuthDeviceClient(gatewayConfig);
|
|
5317
7274
|
const adminClient = createAdminClient(gatewayConfig);
|
|
5318
7275
|
const answersClient = createAnswersClient(gatewayConfig);
|
|
5319
7276
|
const contradictionsFacade = createContradictionsFacade(gatewayConfig);
|
|
@@ -5331,10 +7288,17 @@ function createLucernClient(config = {}) {
|
|
|
5331
7288
|
const worktreesFacade = createWorktreesFacade(gatewayConfig);
|
|
5332
7289
|
const policyClient = createPolicyClient(gatewayConfig);
|
|
5333
7290
|
const ontologyClient = createOntologyClient(gatewayConfig);
|
|
7291
|
+
const ontologyLinksClient = createOntologyLinksClient(gatewayConfig);
|
|
7292
|
+
const orgGraphSearchClient = createOrgGraphSearchClient(gatewayConfig);
|
|
5334
7293
|
const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
|
|
7294
|
+
const toolRegistryClient = createToolRegistryClient(gatewayConfig);
|
|
7295
|
+
const modelRuntimeClient = createModelRuntimeClient(gatewayConfig);
|
|
5335
7296
|
const packsClient = createPacksClient(gatewayConfig);
|
|
5336
7297
|
const reportsClient = createReportsClient(gatewayConfig);
|
|
5337
7298
|
const learningClient = createLearningClient(gatewayConfig);
|
|
7299
|
+
const mcpClient = createMcpClient(gatewayConfig);
|
|
7300
|
+
const jobsClient = createJobsClient(gatewayConfig);
|
|
7301
|
+
const telemetryClient = createTelemetryClient(gatewayConfig);
|
|
5338
7302
|
const harnessClient = createHarnessClient(gatewayConfig);
|
|
5339
7303
|
const schemaClient = createSchemaClient(gatewayConfig);
|
|
5340
7304
|
const audiencesClient = createAudiencesClient(gatewayConfig);
|
|
@@ -5463,7 +7427,7 @@ function createLucernClient(config = {}) {
|
|
|
5463
7427
|
}
|
|
5464
7428
|
async function listBeliefs(args) {
|
|
5465
7429
|
const response = await beliefsFacade.list({
|
|
5466
|
-
topicId:
|
|
7430
|
+
topicId: requireTopicId4(args),
|
|
5467
7431
|
status: args.status,
|
|
5468
7432
|
worktreeId: args.worktreeId,
|
|
5469
7433
|
minConfidence: args.minConfidence,
|
|
@@ -5491,13 +7455,13 @@ function createLucernClient(config = {}) {
|
|
|
5491
7455
|
const results = groupedBeliefs.length > 0 ? groupedBeliefs : mergedResults.filter((result) => result.type === "belief");
|
|
5492
7456
|
return { results };
|
|
5493
7457
|
}
|
|
5494
|
-
async function searchResources(
|
|
7458
|
+
async function searchResources(query5, options = {}) {
|
|
5495
7459
|
const topicId = resolveTopicId(options);
|
|
5496
7460
|
if (!topicId) {
|
|
5497
7461
|
throw new Error("topicId is required");
|
|
5498
7462
|
}
|
|
5499
7463
|
return searchFacade.query({
|
|
5500
|
-
q:
|
|
7464
|
+
q: query5,
|
|
5501
7465
|
topicId,
|
|
5502
7466
|
types: options.types,
|
|
5503
7467
|
status: options.status,
|
|
@@ -5692,8 +7656,8 @@ function createLucernClient(config = {}) {
|
|
|
5692
7656
|
}).then(exposeGatewayData);
|
|
5693
7657
|
}
|
|
5694
7658
|
const nodesNamespace = {
|
|
5695
|
-
list(
|
|
5696
|
-
return graphClient.listNodes(
|
|
7659
|
+
list(query5) {
|
|
7660
|
+
return graphClient.listNodes(query5);
|
|
5697
7661
|
},
|
|
5698
7662
|
get(input) {
|
|
5699
7663
|
return graphClient.getNode(
|
|
@@ -5722,16 +7686,22 @@ function createLucernClient(config = {}) {
|
|
|
5722
7686
|
return {
|
|
5723
7687
|
config,
|
|
5724
7688
|
version: LUCERN_SDK_VERSION,
|
|
5725
|
-
search(
|
|
5726
|
-
return searchResources(
|
|
7689
|
+
search(query5, options) {
|
|
7690
|
+
return searchResources(query5, options);
|
|
5727
7691
|
},
|
|
5728
7692
|
events: {
|
|
5729
|
-
list(
|
|
5730
|
-
return eventsFacade.list(
|
|
7693
|
+
list(query5 = {}) {
|
|
7694
|
+
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
5731
7695
|
},
|
|
5732
7696
|
replay(input) {
|
|
5733
7697
|
return eventsFacade.replay(input).then(exposeGatewayData);
|
|
5734
|
-
}
|
|
7698
|
+
},
|
|
7699
|
+
recordEvent: eventingClient.recordEvent,
|
|
7700
|
+
listEvents: eventingClient.listEvents,
|
|
7701
|
+
listWebhooks: eventingClient.listWebhooks,
|
|
7702
|
+
enqueueDelivery: eventingClient.enqueueDelivery,
|
|
7703
|
+
recordDeliveryAttempt: eventingClient.recordDeliveryAttempt,
|
|
7704
|
+
updateDeliveryStatus: eventingClient.updateDeliveryStatus
|
|
5735
7705
|
},
|
|
5736
7706
|
beliefs: {
|
|
5737
7707
|
create(input) {
|
|
@@ -5800,7 +7770,7 @@ function createLucernClient(config = {}) {
|
|
|
5800
7770
|
},
|
|
5801
7771
|
list(args) {
|
|
5802
7772
|
return beliefsFacade.list({
|
|
5803
|
-
topicId:
|
|
7773
|
+
topicId: requireTopicId4(args),
|
|
5804
7774
|
worktreeId: args.worktreeId,
|
|
5805
7775
|
status: args.status,
|
|
5806
7776
|
minConfidence: args.minConfidence,
|
|
@@ -5829,8 +7799,8 @@ function createLucernClient(config = {}) {
|
|
|
5829
7799
|
create(input) {
|
|
5830
7800
|
return webhooksFacade.create(input).then(exposeGatewayData);
|
|
5831
7801
|
},
|
|
5832
|
-
list(
|
|
5833
|
-
return webhooksFacade.list(
|
|
7802
|
+
list(query5) {
|
|
7803
|
+
return webhooksFacade.list(query5).then(exposeGatewayData);
|
|
5834
7804
|
},
|
|
5835
7805
|
get(id) {
|
|
5836
7806
|
return webhooksFacade.get(id).then(exposeGatewayData);
|
|
@@ -5844,8 +7814,8 @@ function createLucernClient(config = {}) {
|
|
|
5844
7814
|
test(id, input) {
|
|
5845
7815
|
return webhooksFacade.test(id, input).then(exposeGatewayData);
|
|
5846
7816
|
},
|
|
5847
|
-
deliveries(id,
|
|
5848
|
-
return webhooksFacade.deliveries(id,
|
|
7817
|
+
deliveries(id, query5) {
|
|
7818
|
+
return webhooksFacade.deliveries(id, query5).then(exposeGatewayData);
|
|
5849
7819
|
},
|
|
5850
7820
|
health(id) {
|
|
5851
7821
|
return webhooksFacade.health(id).then(exposeGatewayData);
|
|
@@ -6000,7 +7970,7 @@ function createLucernClient(config = {}) {
|
|
|
6000
7970
|
},
|
|
6001
7971
|
list(args) {
|
|
6002
7972
|
return questionsFacade.list({
|
|
6003
|
-
topicId:
|
|
7973
|
+
topicId: requireTopicId4(args),
|
|
6004
7974
|
status: args.status,
|
|
6005
7975
|
priority: args.priority,
|
|
6006
7976
|
worktreeId: args.worktreeId,
|
|
@@ -6072,7 +8042,7 @@ function createLucernClient(config = {}) {
|
|
|
6072
8042
|
},
|
|
6073
8043
|
getHighPriority(args) {
|
|
6074
8044
|
return this.list({
|
|
6075
|
-
topicId:
|
|
8045
|
+
topicId: requireTopicId4(args),
|
|
6076
8046
|
status: args.includeAnswered ? void 0 : "open"
|
|
6077
8047
|
}).then((data) => {
|
|
6078
8048
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
@@ -6097,7 +8067,7 @@ function createLucernClient(config = {}) {
|
|
|
6097
8067
|
},
|
|
6098
8068
|
async findMissing(args) {
|
|
6099
8069
|
return graphFacade.gaps({
|
|
6100
|
-
topicId:
|
|
8070
|
+
topicId: requireTopicId4(args),
|
|
6101
8071
|
minConfidence: args.minConfidence
|
|
6102
8072
|
}).then(exposeGatewayData);
|
|
6103
8073
|
}
|
|
@@ -6128,21 +8098,21 @@ function createLucernClient(config = {}) {
|
|
|
6128
8098
|
},
|
|
6129
8099
|
analyze(args) {
|
|
6130
8100
|
return graphFacade.analyze({
|
|
6131
|
-
topicId:
|
|
8101
|
+
topicId: requireTopicId4(args),
|
|
6132
8102
|
limit: args.limit,
|
|
6133
8103
|
metric: args.metric
|
|
6134
8104
|
}).then(exposeGatewayData);
|
|
6135
8105
|
},
|
|
6136
8106
|
bias(args) {
|
|
6137
8107
|
return graphFacade.bias({
|
|
6138
|
-
topicId:
|
|
8108
|
+
topicId: requireTopicId4(args),
|
|
6139
8109
|
threshold: args.threshold,
|
|
6140
8110
|
limit: args.limit
|
|
6141
8111
|
}).then(exposeGatewayData);
|
|
6142
8112
|
},
|
|
6143
8113
|
gaps(args) {
|
|
6144
8114
|
return graphFacade.gaps({
|
|
6145
|
-
topicId:
|
|
8115
|
+
topicId: requireTopicId4(args),
|
|
6146
8116
|
minConfidence: args.minConfidence
|
|
6147
8117
|
}).then(exposeGatewayData);
|
|
6148
8118
|
},
|
|
@@ -6201,8 +8171,8 @@ function createLucernClient(config = {}) {
|
|
|
6201
8171
|
record(input) {
|
|
6202
8172
|
return decisionsClient.recordJudgment(input);
|
|
6203
8173
|
},
|
|
6204
|
-
list(
|
|
6205
|
-
return decisionsClient.listJudgments(
|
|
8174
|
+
list(query5) {
|
|
8175
|
+
return decisionsClient.listJudgments(query5);
|
|
6206
8176
|
},
|
|
6207
8177
|
get(judgmentId) {
|
|
6208
8178
|
return decisionsClient.getJudgment(judgmentId);
|
|
@@ -6231,7 +8201,7 @@ function createLucernClient(config = {}) {
|
|
|
6231
8201
|
transitionAuditIntegrity(args) {
|
|
6232
8202
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
6233
8203
|
...args,
|
|
6234
|
-
topicId:
|
|
8204
|
+
topicId: requireTopicId4(args)
|
|
6235
8205
|
});
|
|
6236
8206
|
}
|
|
6237
8207
|
},
|
|
@@ -6242,8 +8212,8 @@ function createLucernClient(config = {}) {
|
|
|
6242
8212
|
createLens(input) {
|
|
6243
8213
|
return workflowClient.createLens(input);
|
|
6244
8214
|
},
|
|
6245
|
-
listLenses(
|
|
6246
|
-
return workflowClient.listLenses(
|
|
8215
|
+
listLenses(query5) {
|
|
8216
|
+
return workflowClient.listLenses(query5);
|
|
6247
8217
|
},
|
|
6248
8218
|
applyLensToTopic(input) {
|
|
6249
8219
|
return workflowClient.applyLensToTopic(input);
|
|
@@ -6254,7 +8224,7 @@ function createLucernClient(config = {}) {
|
|
|
6254
8224
|
create(input) {
|
|
6255
8225
|
return worktreesFacade.create({
|
|
6256
8226
|
title: input.title,
|
|
6257
|
-
topicId:
|
|
8227
|
+
topicId: requireTopicId4(input),
|
|
6258
8228
|
objective: input.objective,
|
|
6259
8229
|
hypothesis: input.hypothesis,
|
|
6260
8230
|
beliefIds: input.beliefIds,
|
|
@@ -6276,7 +8246,7 @@ function createLucernClient(config = {}) {
|
|
|
6276
8246
|
add(input) {
|
|
6277
8247
|
return worktreesFacade.create({
|
|
6278
8248
|
title: input.title,
|
|
6279
|
-
topicId:
|
|
8249
|
+
topicId: requireTopicId4(input),
|
|
6280
8250
|
objective: input.objective,
|
|
6281
8251
|
hypothesis: input.hypothesis,
|
|
6282
8252
|
beliefIds: input.beliefIds,
|
|
@@ -6295,11 +8265,11 @@ function createLucernClient(config = {}) {
|
|
|
6295
8265
|
autoFixPolicy: input.autoFixPolicy
|
|
6296
8266
|
});
|
|
6297
8267
|
},
|
|
6298
|
-
list(
|
|
8268
|
+
list(query5) {
|
|
6299
8269
|
return worktreesFacade.list({
|
|
6300
|
-
topicId:
|
|
6301
|
-
status:
|
|
6302
|
-
limit:
|
|
8270
|
+
topicId: requireTopicId4(query5),
|
|
8271
|
+
status: query5.status,
|
|
8272
|
+
limit: query5.limit
|
|
6303
8273
|
});
|
|
6304
8274
|
},
|
|
6305
8275
|
activate(worktreeId) {
|
|
@@ -6334,8 +8304,8 @@ function createLucernClient(config = {}) {
|
|
|
6334
8304
|
removeQuestionIds: input.removeQuestionIds
|
|
6335
8305
|
});
|
|
6336
8306
|
},
|
|
6337
|
-
listAll(
|
|
6338
|
-
return workflowClient.listAllWorktrees(
|
|
8307
|
+
listAll(query5 = {}) {
|
|
8308
|
+
return workflowClient.listAllWorktrees(query5);
|
|
6339
8309
|
},
|
|
6340
8310
|
merge(worktreeId, input) {
|
|
6341
8311
|
return worktreesFacade.merge({
|
|
@@ -6376,12 +8346,12 @@ function createLucernClient(config = {}) {
|
|
|
6376
8346
|
}
|
|
6377
8347
|
},
|
|
6378
8348
|
context: {
|
|
6379
|
-
listTopics(
|
|
8349
|
+
listTopics(query5 = {}) {
|
|
6380
8350
|
return topicsFacade.list({
|
|
6381
|
-
ontologyId:
|
|
6382
|
-
parentTopicId:
|
|
6383
|
-
status:
|
|
6384
|
-
type:
|
|
8351
|
+
ontologyId: query5.ontologyId,
|
|
8352
|
+
parentTopicId: query5.parentTopicId,
|
|
8353
|
+
status: query5.status,
|
|
8354
|
+
type: query5.type
|
|
6385
8355
|
});
|
|
6386
8356
|
},
|
|
6387
8357
|
compile(topicId, input = {}) {
|
|
@@ -6492,10 +8462,10 @@ function createLucernClient(config = {}) {
|
|
|
6492
8462
|
visibility: input.visibility
|
|
6493
8463
|
});
|
|
6494
8464
|
},
|
|
6495
|
-
tree(topicId,
|
|
8465
|
+
tree(topicId, query5 = {}) {
|
|
6496
8466
|
return topicsFacade.tree({
|
|
6497
8467
|
id: topicId,
|
|
6498
|
-
maxDepth:
|
|
8468
|
+
maxDepth: query5.maxDepth
|
|
6499
8469
|
});
|
|
6500
8470
|
},
|
|
6501
8471
|
getTree(input) {
|
|
@@ -6504,11 +8474,11 @@ function createLucernClient(config = {}) {
|
|
|
6504
8474
|
maxDepth: input.maxDepth
|
|
6505
8475
|
});
|
|
6506
8476
|
},
|
|
6507
|
-
coverage(topicId,
|
|
8477
|
+
coverage(topicId, query5 = {}) {
|
|
6508
8478
|
return topicsFacade.coverage({
|
|
6509
8479
|
id: topicId,
|
|
6510
|
-
includeDescendants:
|
|
6511
|
-
maxDepth:
|
|
8480
|
+
includeDescendants: query5.includeDescendants,
|
|
8481
|
+
maxDepth: query5.maxDepth
|
|
6512
8482
|
});
|
|
6513
8483
|
},
|
|
6514
8484
|
remove(topicId, idempotencyKey) {
|
|
@@ -6558,7 +8528,7 @@ function createLucernClient(config = {}) {
|
|
|
6558
8528
|
},
|
|
6559
8529
|
list(args) {
|
|
6560
8530
|
return contradictionsFacade.list({
|
|
6561
|
-
topicId:
|
|
8531
|
+
topicId: requireTopicId4(args),
|
|
6562
8532
|
status: args.status,
|
|
6563
8533
|
limit: args.limit,
|
|
6564
8534
|
cursor: args.cursor
|
|
@@ -6733,7 +8703,24 @@ function createLucernClient(config = {}) {
|
|
|
6733
8703
|
return functionSurfaceClient.generateSessionHandoff(input);
|
|
6734
8704
|
}
|
|
6735
8705
|
},
|
|
8706
|
+
embeddings: embeddingsClient,
|
|
8707
|
+
graphAnalysis: graphAnalysisClient,
|
|
8708
|
+
graphRecommendations: graphRecommendationsClient,
|
|
8709
|
+
orgGraphSearch: orgGraphSearchClient,
|
|
8710
|
+
ontologyLinks: ontologyLinksClient,
|
|
8711
|
+
graphStateClassifier: graphStateClassifierClient,
|
|
8712
|
+
modelRuntime: modelRuntimeClient,
|
|
8713
|
+
jobs: jobsClient,
|
|
8714
|
+
telemetry: telemetryClient,
|
|
6736
8715
|
tools: {
|
|
8716
|
+
listCatalog: toolRegistryClient.listCatalog,
|
|
8717
|
+
listExecutable: toolRegistryClient.listExecutable,
|
|
8718
|
+
listEffectiveTools: toolRegistryClient.listEffectiveTools,
|
|
8719
|
+
upsertCoreTools: toolRegistryClient.upsertCoreTools,
|
|
8720
|
+
setPackToolsStatus: toolRegistryClient.setPackToolsStatus,
|
|
8721
|
+
createAcl: toolRegistryClient.createAcl,
|
|
8722
|
+
deleteAcl: toolRegistryClient.deleteAcl,
|
|
8723
|
+
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
6737
8724
|
register(registration) {
|
|
6738
8725
|
return registerCustomTool(registration);
|
|
6739
8726
|
},
|
|
@@ -6790,26 +8777,74 @@ function createLucernClient(config = {}) {
|
|
|
6790
8777
|
}
|
|
6791
8778
|
},
|
|
6792
8779
|
nodes: nodesNamespace,
|
|
6793
|
-
identity:
|
|
8780
|
+
identity: {
|
|
8781
|
+
...identityFacade,
|
|
8782
|
+
evaluatePolicy: identityClient.evaluatePolicy,
|
|
8783
|
+
recordPolicyDecision: identityClient.recordPolicyDecision,
|
|
8784
|
+
putSecretReference: identityClient.putSecretReference,
|
|
8785
|
+
createPrincipal: identityClient.createPrincipal,
|
|
8786
|
+
updatePrincipal: identityClient.updatePrincipal,
|
|
8787
|
+
raw: identityClient
|
|
8788
|
+
},
|
|
8789
|
+
mcp: {
|
|
8790
|
+
bootstrapSession(input) {
|
|
8791
|
+
return mcpClient.bootstrapSession(input);
|
|
8792
|
+
},
|
|
8793
|
+
checkWritePolicy(input) {
|
|
8794
|
+
return mcpClient.checkWritePolicy(input);
|
|
8795
|
+
},
|
|
8796
|
+
beginBuildSession(input) {
|
|
8797
|
+
return mcpClient.beginBuildSession(input);
|
|
8798
|
+
},
|
|
8799
|
+
evaluateEngineeringContract(input) {
|
|
8800
|
+
return mcpClient.evaluateEngineeringContract(input);
|
|
8801
|
+
},
|
|
8802
|
+
evaluateResearchContract(input) {
|
|
8803
|
+
return mcpClient.evaluateResearchContract(input);
|
|
8804
|
+
}
|
|
8805
|
+
},
|
|
8806
|
+
auth: {
|
|
8807
|
+
device: {
|
|
8808
|
+
createCode(input) {
|
|
8809
|
+
return authDeviceClient.createDeviceCode(input);
|
|
8810
|
+
},
|
|
8811
|
+
pollToken(deviceCode) {
|
|
8812
|
+
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
},
|
|
6794
8816
|
custom: getCustomNamespace("custom"),
|
|
6795
8817
|
extensions: extensionNamespaces,
|
|
6796
8818
|
raw: {
|
|
6797
8819
|
beliefs: beliefsClient,
|
|
6798
8820
|
sources: sourcesClient,
|
|
6799
8821
|
evidence: evidenceClient,
|
|
8822
|
+
embeddings: embeddingsClient,
|
|
8823
|
+
eventing: eventingClient,
|
|
6800
8824
|
graph: graphClient,
|
|
8825
|
+
graphAnalysis: graphAnalysisClient,
|
|
8826
|
+
graphRecommendations: graphRecommendationsClient,
|
|
8827
|
+
graphStateClassifier: graphStateClassifierClient,
|
|
6801
8828
|
decisions: decisionsClient,
|
|
6802
8829
|
workflow: workflowClient,
|
|
6803
8830
|
audit: auditClient,
|
|
8831
|
+
authDevice: authDeviceClient,
|
|
6804
8832
|
admin: adminClient,
|
|
6805
8833
|
identity: identityClient,
|
|
6806
8834
|
policy: policyClient,
|
|
6807
8835
|
answers: answersClient,
|
|
6808
8836
|
ontology: ontologyClient,
|
|
8837
|
+
ontologyLinks: ontologyLinksClient,
|
|
8838
|
+
orgGraphSearch: orgGraphSearchClient,
|
|
6809
8839
|
functionSurface: functionSurfaceClient,
|
|
8840
|
+
toolRegistry: toolRegistryClient,
|
|
8841
|
+
modelRuntime: modelRuntimeClient,
|
|
6810
8842
|
packs: packsClient,
|
|
6811
8843
|
reports: reportsClient,
|
|
6812
8844
|
learning: learningClient,
|
|
8845
|
+
mcp: mcpClient,
|
|
8846
|
+
jobs: jobsClient,
|
|
8847
|
+
telemetry: telemetryClient,
|
|
6813
8848
|
harness: harnessClient,
|
|
6814
8849
|
schema: schemaClient,
|
|
6815
8850
|
audiences: audiencesClient,
|
|
@@ -10636,7 +12671,6 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
10636
12671
|
deprecate_ontology_version: DEPRECATE_ONTOLOGY_VERSION,
|
|
10637
12672
|
resolve_effective_ontology: RESOLVE_EFFECTIVE_ONTOLOGY
|
|
10638
12673
|
};
|
|
10639
|
-
globalThis.process?.env;
|
|
10640
12674
|
|
|
10641
12675
|
// ../contracts/src/function-registry/manifest.ts
|
|
10642
12676
|
var publicEverywhere = {
|
|
@@ -10961,6 +12995,7 @@ var LUCERN_OPERATION_MANIFEST = {
|
|
|
10961
12995
|
"Lucern MCP-only platform operation for local agent/bootstrap or verification workflows. Hidden from public discovery."
|
|
10962
12996
|
)
|
|
10963
12997
|
};
|
|
12998
|
+
globalThis.process?.env;
|
|
10964
12999
|
|
|
10965
13000
|
// src/execution.ts
|
|
10966
13001
|
var SCOPE_ALIAS_GROUPS = [];
|
|
@@ -11083,7 +13118,7 @@ function isMissing(value) {
|
|
|
11083
13118
|
}
|
|
11084
13119
|
return false;
|
|
11085
13120
|
}
|
|
11086
|
-
function
|
|
13121
|
+
function readString3(params, key, options = {}) {
|
|
11087
13122
|
const value = params[key];
|
|
11088
13123
|
if (value === void 0 || value === null) {
|
|
11089
13124
|
if (options.required) {
|
|
@@ -11137,7 +13172,7 @@ function readStringArray(params, key) {
|
|
|
11137
13172
|
const values = value.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
11138
13173
|
return values.length > 0 ? values : void 0;
|
|
11139
13174
|
}
|
|
11140
|
-
function
|
|
13175
|
+
function readTopicId4(params, options = {}) {
|
|
11141
13176
|
const value = params.topicId;
|
|
11142
13177
|
if (value === void 0 || value === null) {
|
|
11143
13178
|
if (options.required) {
|
|
@@ -11286,13 +13321,13 @@ function createBeliefHandlers(context) {
|
|
|
11286
13321
|
MCP_TOOL_CONTRACTS.create_belief,
|
|
11287
13322
|
async (params) => {
|
|
11288
13323
|
const result = await beliefs.createBelief({
|
|
11289
|
-
canonicalText:
|
|
13324
|
+
canonicalText: readString3(params, "canonicalText", {
|
|
11290
13325
|
required: true
|
|
11291
13326
|
}),
|
|
11292
|
-
topicId:
|
|
11293
|
-
layer:
|
|
11294
|
-
domain:
|
|
11295
|
-
subtype:
|
|
13327
|
+
topicId: readTopicId4(params, { required: true }),
|
|
13328
|
+
layer: readString3(params, "layer"),
|
|
13329
|
+
domain: readString3(params, "domain"),
|
|
13330
|
+
subtype: readString3(params, "nodeType"),
|
|
11296
13331
|
baseRate: readNumber2(params, "baseRate", { required: true })
|
|
11297
13332
|
});
|
|
11298
13333
|
return {
|
|
@@ -11305,11 +13340,11 @@ function createBeliefHandlers(context) {
|
|
|
11305
13340
|
refine_belief: contractToHandler(
|
|
11306
13341
|
MCP_TOOL_CONTRACTS.refine_belief,
|
|
11307
13342
|
async (params) => {
|
|
11308
|
-
const nodeId =
|
|
11309
|
-
const canonicalText =
|
|
13343
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
13344
|
+
const canonicalText = readString3(params, "canonicalText", {
|
|
11310
13345
|
required: true
|
|
11311
13346
|
});
|
|
11312
|
-
const rationale =
|
|
13347
|
+
const rationale = readString3(params, "rationale");
|
|
11313
13348
|
const result = await beliefs.refineBelief(nodeId, {
|
|
11314
13349
|
canonicalText,
|
|
11315
13350
|
rationale
|
|
@@ -11324,38 +13359,38 @@ function createBeliefHandlers(context) {
|
|
|
11324
13359
|
modulate_confidence: contractToHandler(
|
|
11325
13360
|
MCP_TOOL_CONTRACTS.modulate_confidence,
|
|
11326
13361
|
async (params) => {
|
|
11327
|
-
const nodeId =
|
|
13362
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
11328
13363
|
const opinion = readOpinionTuple(params);
|
|
11329
13364
|
const result = await beliefs.modulateConfidence(nodeId, {
|
|
11330
13365
|
opinion,
|
|
11331
|
-
trigger:
|
|
11332
|
-
rationale:
|
|
11333
|
-
triggeringEvidenceId:
|
|
11334
|
-
triggeringQuestionId:
|
|
11335
|
-
triggeringAnswerId:
|
|
11336
|
-
triggeringContradictionId:
|
|
13366
|
+
trigger: readString3(params, "trigger", { required: true }),
|
|
13367
|
+
rationale: readString3(params, "rationale", { required: true }),
|
|
13368
|
+
triggeringEvidenceId: readString3(params, "triggeringEvidenceId"),
|
|
13369
|
+
triggeringQuestionId: readString3(params, "triggeringQuestionId"),
|
|
13370
|
+
triggeringAnswerId: readString3(params, "triggeringAnswerId"),
|
|
13371
|
+
triggeringContradictionId: readString3(
|
|
11337
13372
|
params,
|
|
11338
13373
|
"triggeringContradictionId"
|
|
11339
13374
|
),
|
|
11340
|
-
triggeringWorktreeId:
|
|
13375
|
+
triggeringWorktreeId: readString3(params, "triggeringWorktreeId")
|
|
11341
13376
|
});
|
|
11342
13377
|
return {
|
|
11343
13378
|
nodeId,
|
|
11344
13379
|
newConfidence: result.data.newConfidence ?? result.data.confidence ?? opinion.b + opinion.a * opinion.u,
|
|
11345
13380
|
previousConfidence: result.data.previousConfidence ?? null,
|
|
11346
|
-
trigger:
|
|
13381
|
+
trigger: readString3(params, "trigger", { required: true })
|
|
11347
13382
|
};
|
|
11348
13383
|
}
|
|
11349
13384
|
),
|
|
11350
13385
|
fork_belief: contractToHandler(
|
|
11351
13386
|
MCP_TOOL_CONTRACTS.fork_belief,
|
|
11352
13387
|
async (params) => {
|
|
11353
|
-
const nodeId =
|
|
11354
|
-
const forkReason =
|
|
13388
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
13389
|
+
const forkReason = readString3(params, "forkReason", {
|
|
11355
13390
|
required: true
|
|
11356
13391
|
});
|
|
11357
13392
|
const result = await beliefs.forkBelief(nodeId, {
|
|
11358
|
-
newFormulation:
|
|
13393
|
+
newFormulation: readString3(params, "newFormulation", {
|
|
11359
13394
|
required: true
|
|
11360
13395
|
}),
|
|
11361
13396
|
forkReason
|
|
@@ -11370,8 +13405,8 @@ function createBeliefHandlers(context) {
|
|
|
11370
13405
|
archive_belief: contractToHandler(
|
|
11371
13406
|
MCP_TOOL_CONTRACTS.archive_belief,
|
|
11372
13407
|
async (params) => {
|
|
11373
|
-
const nodeId =
|
|
11374
|
-
const rationale =
|
|
13408
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
13409
|
+
const rationale = readString3(params, "rationale");
|
|
11375
13410
|
const result = await graph.updateNode({
|
|
11376
13411
|
nodeId,
|
|
11377
13412
|
status: "archived",
|
|
@@ -11396,12 +13431,12 @@ function createContextHandlers(context) {
|
|
|
11396
13431
|
MCP_TOOL_CONTRACTS.compile_context,
|
|
11397
13432
|
async (params) => {
|
|
11398
13433
|
const response = await compiler.compile(
|
|
11399
|
-
|
|
13434
|
+
readTopicId4(params, { required: true }),
|
|
11400
13435
|
{
|
|
11401
|
-
...
|
|
13436
|
+
...readString3(params, "query") ? { query: readString3(params, "query") } : {},
|
|
11402
13437
|
...readNumber2(params, "budget") !== void 0 ? { budget: readNumber2(params, "budget") } : {},
|
|
11403
|
-
...
|
|
11404
|
-
ranking:
|
|
13438
|
+
...readString3(params, "ranking") ? {
|
|
13439
|
+
ranking: readString3(params, "ranking")
|
|
11405
13440
|
} : {},
|
|
11406
13441
|
...readNumber2(params, "limit") !== void 0 ? { limit: readNumber2(params, "limit") } : {},
|
|
11407
13442
|
...readNumber2(params, "maxDepth") !== void 0 ? { maxDepth: readNumber2(params, "maxDepth") } : {},
|
|
@@ -11421,14 +13456,14 @@ function createContradictionHandlers(context) {
|
|
|
11421
13456
|
flag_contradiction: contractToHandler(
|
|
11422
13457
|
MCP_TOOL_CONTRACTS.flag_contradiction,
|
|
11423
13458
|
async (params) => {
|
|
11424
|
-
const beliefA =
|
|
11425
|
-
const beliefB =
|
|
11426
|
-
const description =
|
|
13459
|
+
const beliefA = readString3(params, "beliefA", { required: true });
|
|
13460
|
+
const beliefB = readString3(params, "beliefB", { required: true });
|
|
13461
|
+
const description = readString3(params, "description", {
|
|
11427
13462
|
required: true
|
|
11428
13463
|
});
|
|
11429
|
-
const topicId =
|
|
11430
|
-
const severity =
|
|
11431
|
-
const defeatType =
|
|
13464
|
+
const topicId = readTopicId4(params, { required: true });
|
|
13465
|
+
const severity = readString3(params, "severity") ?? "medium";
|
|
13466
|
+
const defeatType = readString3(params, "defeatType") ?? "rebuts";
|
|
11432
13467
|
const contradiction = await lucern.contradictions.flag({
|
|
11433
13468
|
beliefA,
|
|
11434
13469
|
beliefB,
|
|
@@ -11455,12 +13490,12 @@ function createEdgeHandlers(context) {
|
|
|
11455
13490
|
create_edge: contractToHandler(
|
|
11456
13491
|
MCP_TOOL_CONTRACTS.create_edge,
|
|
11457
13492
|
async (params) => {
|
|
11458
|
-
const sourceId =
|
|
11459
|
-
const targetId =
|
|
11460
|
-
const edgeType =
|
|
13493
|
+
const sourceId = readString3(params, "sourceId", { required: true });
|
|
13494
|
+
const targetId = readString3(params, "targetId", { required: true });
|
|
13495
|
+
const edgeType = readString3(params, "edgeType", { required: true });
|
|
11461
13496
|
const confidence = readNumber2(params, "confidence");
|
|
11462
13497
|
const weight = readNumber2(params, "weight");
|
|
11463
|
-
const contextText =
|
|
13498
|
+
const contextText = readString3(params, "context") ?? readString3(params, "reasoning");
|
|
11464
13499
|
const edge = await lucern.edges.create({
|
|
11465
13500
|
sourceId,
|
|
11466
13501
|
targetId,
|
|
@@ -11492,16 +13527,16 @@ function createEvidenceHandlers(context) {
|
|
|
11492
13527
|
MCP_TOOL_CONTRACTS.create_evidence,
|
|
11493
13528
|
async (params) => {
|
|
11494
13529
|
const response = await lucern.evidence.create({
|
|
11495
|
-
topicId:
|
|
11496
|
-
text:
|
|
11497
|
-
source:
|
|
11498
|
-
targetId:
|
|
13530
|
+
topicId: readTopicId4(params, { required: true }),
|
|
13531
|
+
text: readString3(params, "text", { required: true }),
|
|
13532
|
+
source: readString3(params, "source"),
|
|
13533
|
+
targetId: readString3(params, "targetId"),
|
|
11499
13534
|
weight: readNumber2(params, "weight"),
|
|
11500
13535
|
metadata: readMetadata(params),
|
|
11501
|
-
title:
|
|
11502
|
-
content:
|
|
11503
|
-
contentType:
|
|
11504
|
-
kind:
|
|
13536
|
+
title: readString3(params, "title"),
|
|
13537
|
+
content: readString3(params, "content"),
|
|
13538
|
+
contentType: readString3(params, "contentType"),
|
|
13539
|
+
kind: readString3(params, "kind")
|
|
11505
13540
|
});
|
|
11506
13541
|
return response.data;
|
|
11507
13542
|
}
|
|
@@ -11510,7 +13545,7 @@ function createEvidenceHandlers(context) {
|
|
|
11510
13545
|
MCP_TOOL_CONTRACTS.get_evidence,
|
|
11511
13546
|
async (params) => {
|
|
11512
13547
|
const response = await lucern.evidence.get(
|
|
11513
|
-
|
|
13548
|
+
readString3(params, "id", { required: true })
|
|
11514
13549
|
);
|
|
11515
13550
|
return response.data;
|
|
11516
13551
|
}
|
|
@@ -11519,10 +13554,10 @@ function createEvidenceHandlers(context) {
|
|
|
11519
13554
|
MCP_TOOL_CONTRACTS.list_evidence,
|
|
11520
13555
|
async (params) => {
|
|
11521
13556
|
const response = await lucern.evidence.list({
|
|
11522
|
-
topicId:
|
|
11523
|
-
targetId:
|
|
13557
|
+
topicId: readTopicId4(params),
|
|
13558
|
+
targetId: readString3(params, "targetId"),
|
|
11524
13559
|
limit: readNumber2(params, "limit"),
|
|
11525
|
-
cursor:
|
|
13560
|
+
cursor: readString3(params, "cursor")
|
|
11526
13561
|
});
|
|
11527
13562
|
return response.data;
|
|
11528
13563
|
}
|
|
@@ -11531,10 +13566,10 @@ function createEvidenceHandlers(context) {
|
|
|
11531
13566
|
MCP_TOOL_CONTRACTS.link_evidence,
|
|
11532
13567
|
async (params) => {
|
|
11533
13568
|
const response = await lucern.evidence.link({
|
|
11534
|
-
evidenceId:
|
|
11535
|
-
targetId:
|
|
13569
|
+
evidenceId: readString3(params, "evidenceId", { required: true }),
|
|
13570
|
+
targetId: readString3(params, "targetId", { required: true }),
|
|
11536
13571
|
weight: readNumber2(params, "weight"),
|
|
11537
|
-
rationale:
|
|
13572
|
+
rationale: readString3(params, "rationale")
|
|
11538
13573
|
});
|
|
11539
13574
|
return response.data;
|
|
11540
13575
|
}
|
|
@@ -11543,11 +13578,11 @@ function createEvidenceHandlers(context) {
|
|
|
11543
13578
|
MCP_TOOL_CONTRACTS.search_evidence,
|
|
11544
13579
|
async (params) => {
|
|
11545
13580
|
const response = await lucern.evidence.search({
|
|
11546
|
-
q:
|
|
11547
|
-
topicId:
|
|
11548
|
-
targetId:
|
|
13581
|
+
q: readString3(params, "q") ?? readString3(params, "query", { required: true }),
|
|
13582
|
+
topicId: readTopicId4(params),
|
|
13583
|
+
targetId: readString3(params, "targetId"),
|
|
11549
13584
|
limit: readNumber2(params, "limit"),
|
|
11550
|
-
cursor:
|
|
13585
|
+
cursor: readString3(params, "cursor")
|
|
11551
13586
|
});
|
|
11552
13587
|
return response.data;
|
|
11553
13588
|
}
|
|
@@ -11556,17 +13591,17 @@ function createEvidenceHandlers(context) {
|
|
|
11556
13591
|
MCP_TOOL_CONTRACTS.add_evidence,
|
|
11557
13592
|
async (params) => {
|
|
11558
13593
|
return lucern.evidence.add({
|
|
11559
|
-
canonicalText:
|
|
11560
|
-
topicId:
|
|
11561
|
-
sourceUrl:
|
|
13594
|
+
canonicalText: readString3(params, "canonicalText", { required: true }),
|
|
13595
|
+
topicId: readTopicId4(params, { required: true }),
|
|
13596
|
+
sourceUrl: readString3(params, "sourceUrl"),
|
|
11562
13597
|
supports: {
|
|
11563
|
-
nodeId:
|
|
13598
|
+
nodeId: readString3(params, "targetNodeId", { required: true }),
|
|
11564
13599
|
weight: readNumber2(params, "weight") ?? 1,
|
|
11565
|
-
reasoning:
|
|
13600
|
+
reasoning: readString3(params, "reasoning")
|
|
11566
13601
|
},
|
|
11567
|
-
title:
|
|
11568
|
-
content:
|
|
11569
|
-
contentType:
|
|
13602
|
+
title: readString3(params, "title"),
|
|
13603
|
+
content: readString3(params, "content"),
|
|
13604
|
+
contentType: readString3(params, "contentType"),
|
|
11570
13605
|
metadata: readMetadata(params)
|
|
11571
13606
|
});
|
|
11572
13607
|
}
|
|
@@ -11575,10 +13610,10 @@ function createEvidenceHandlers(context) {
|
|
|
11575
13610
|
MCP_TOOL_CONTRACTS.link_evidence_to_belief,
|
|
11576
13611
|
async (params) => {
|
|
11577
13612
|
return lucern.evidence.linkToBelief({
|
|
11578
|
-
evidenceId:
|
|
11579
|
-
beliefId:
|
|
13613
|
+
evidenceId: readString3(params, "evidenceId", { required: true }),
|
|
13614
|
+
beliefId: readString3(params, "beliefId", { required: true }),
|
|
11580
13615
|
weight: readNumber2(params, "weight", { required: true }),
|
|
11581
|
-
rationale:
|
|
13616
|
+
rationale: readString3(params, "rationale")
|
|
11582
13617
|
});
|
|
11583
13618
|
}
|
|
11584
13619
|
)
|
|
@@ -13429,6 +15464,40 @@ defineTable({
|
|
|
13429
15464
|
{ kind: "index", name: "by_tier_window_end", columns: ["tier", "windowEndMs"] }
|
|
13430
15465
|
]
|
|
13431
15466
|
});
|
|
15467
|
+
defineTable({
|
|
15468
|
+
name: "oauthDeviceCodes",
|
|
15469
|
+
component: "mc",
|
|
15470
|
+
category: "identity",
|
|
15471
|
+
shape: z.object({
|
|
15472
|
+
"deviceCodeHash": z.string(),
|
|
15473
|
+
"userCode": z.string(),
|
|
15474
|
+
"clientId": z.string(),
|
|
15475
|
+
"scope": z.string(),
|
|
15476
|
+
"status": z.enum(["pending", "approved", "denied", "expired", "consumed"]),
|
|
15477
|
+
"expiresAt": z.number(),
|
|
15478
|
+
"intervalSeconds": z.number(),
|
|
15479
|
+
"lastPolledAt": z.number().optional(),
|
|
15480
|
+
"slowDownCount": z.number().optional(),
|
|
15481
|
+
"clerkUserId": z.string().optional(),
|
|
15482
|
+
"tenantId": idOf("tenants").optional(),
|
|
15483
|
+
"workspaceId": z.string().optional(),
|
|
15484
|
+
"principalId": z.string().optional(),
|
|
15485
|
+
"role": z.string().optional(),
|
|
15486
|
+
"scopes": z.array(z.string()).optional(),
|
|
15487
|
+
"sessionId": z.string().optional(),
|
|
15488
|
+
"approvedAt": z.number().optional(),
|
|
15489
|
+
"deniedAt": z.number().optional(),
|
|
15490
|
+
"consumedAt": z.number().optional(),
|
|
15491
|
+
"createdAt": z.number(),
|
|
15492
|
+
"updatedAt": z.number()
|
|
15493
|
+
}),
|
|
15494
|
+
indices: [
|
|
15495
|
+
{ kind: "index", name: "by_deviceCodeHash", columns: ["deviceCodeHash"] },
|
|
15496
|
+
{ kind: "index", name: "by_userCode", columns: ["userCode"] },
|
|
15497
|
+
{ kind: "index", name: "by_status_expiresAt", columns: ["status", "expiresAt"] },
|
|
15498
|
+
{ kind: "index", name: "by_sessionId", columns: ["sessionId"] }
|
|
15499
|
+
]
|
|
15500
|
+
});
|
|
13432
15501
|
defineTable({
|
|
13433
15502
|
name: "servicePrincipalKeys",
|
|
13434
15503
|
component: "mc",
|
|
@@ -19137,7 +21206,7 @@ function createGraphHandlers(context) {
|
|
|
19137
21206
|
query_lineage: contractToHandler(
|
|
19138
21207
|
MCP_TOOL_CONTRACTS.query_lineage,
|
|
19139
21208
|
async (params) => {
|
|
19140
|
-
const nodeId =
|
|
21209
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
19141
21210
|
const depth = readNumber2(params, "depth") ?? 5;
|
|
19142
21211
|
const [parentEdgesResponse, childEdgesResponse] = await Promise.all([
|
|
19143
21212
|
graph.queryEdges({
|
|
@@ -19175,7 +21244,7 @@ function createGraphHandlers(context) {
|
|
|
19175
21244
|
get_confidence_history: contractToHandler(
|
|
19176
21245
|
MCP_TOOL_CONTRACTS.get_confidence_history,
|
|
19177
21246
|
async (params) => {
|
|
19178
|
-
const nodeId =
|
|
21247
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
19179
21248
|
const entries2 = await getConfidenceEntries(nodeId);
|
|
19180
21249
|
return { entries: entries2 };
|
|
19181
21250
|
}
|
|
@@ -19183,7 +21252,7 @@ function createGraphHandlers(context) {
|
|
|
19183
21252
|
get_audit_trail: contractToHandler(
|
|
19184
21253
|
MCP_TOOL_CONTRACTS.get_audit_trail,
|
|
19185
21254
|
async (params) => {
|
|
19186
|
-
const nodeId =
|
|
21255
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
19187
21256
|
const limit = readNumber2(params, "limit") ?? 50;
|
|
19188
21257
|
const events = await audit.listEvents({ limit: Math.max(1, limit) });
|
|
19189
21258
|
const entries2 = asAuditArray(events.data).filter((entry) => matchesAuditNodeReference2(entry, nodeId)).slice(0, limit).map((entry) => ({
|
|
@@ -19201,10 +21270,10 @@ function createGraphHandlers(context) {
|
|
|
19201
21270
|
MCP_TOOL_CONTRACTS.traverse_graph,
|
|
19202
21271
|
async (params) => {
|
|
19203
21272
|
const response = await graph.traverse({
|
|
19204
|
-
startNode:
|
|
19205
|
-
direction:
|
|
21273
|
+
startNode: readString3(params, "startNode", { required: true }),
|
|
21274
|
+
direction: readString3(params, "direction"),
|
|
19206
21275
|
maxDepth: readNumber2(params, "maxDepth"),
|
|
19207
|
-
topicId:
|
|
21276
|
+
topicId: readTopicId4(params)
|
|
19208
21277
|
});
|
|
19209
21278
|
return response.data;
|
|
19210
21279
|
}
|
|
@@ -19214,7 +21283,7 @@ function createGraphHandlers(context) {
|
|
|
19214
21283
|
async (params) => {
|
|
19215
21284
|
const globalIds = readStringArray(params, "globalIds");
|
|
19216
21285
|
const response = await graph.neighborhood({
|
|
19217
|
-
globalId:
|
|
21286
|
+
globalId: readString3(params, "globalId"),
|
|
19218
21287
|
globalIds: globalIds ? globalIds.join(",") : void 0,
|
|
19219
21288
|
maxDepth: readNumber2(params, "maxDepth")
|
|
19220
21289
|
});
|
|
@@ -19224,9 +21293,9 @@ function createGraphHandlers(context) {
|
|
|
19224
21293
|
search_beliefs: contractToHandler(
|
|
19225
21294
|
MCP_TOOL_CONTRACTS.search_beliefs,
|
|
19226
21295
|
async (params) => {
|
|
19227
|
-
const
|
|
19228
|
-
const topicId =
|
|
19229
|
-
const status =
|
|
21296
|
+
const query5 = readString3(params, "query", { required: true });
|
|
21297
|
+
const topicId = readTopicId4(params);
|
|
21298
|
+
const status = readString3(params, "status");
|
|
19230
21299
|
const minConfidence = readNumber2(params, "minConfidence");
|
|
19231
21300
|
const limit = readNumber2(params, "limit") ?? 10;
|
|
19232
21301
|
if (!topicId) {
|
|
@@ -19236,7 +21305,7 @@ function createGraphHandlers(context) {
|
|
|
19236
21305
|
return { results: [] };
|
|
19237
21306
|
}
|
|
19238
21307
|
const response = await graph.search({
|
|
19239
|
-
q:
|
|
21308
|
+
q: query5,
|
|
19240
21309
|
topicId,
|
|
19241
21310
|
types: ["belief"],
|
|
19242
21311
|
status,
|
|
@@ -19253,9 +21322,9 @@ function createGraphHandlers(context) {
|
|
|
19253
21322
|
find_contradictions: contractToHandler(
|
|
19254
21323
|
MCP_TOOL_CONTRACTS.find_contradictions,
|
|
19255
21324
|
async (params) => {
|
|
19256
|
-
const topicId =
|
|
19257
|
-
const nodeId =
|
|
19258
|
-
const status =
|
|
21325
|
+
const topicId = readTopicId4(params);
|
|
21326
|
+
const nodeId = readString3(params, "nodeId");
|
|
21327
|
+
const status = readString3(params, "status");
|
|
19259
21328
|
if (!topicId && !nodeId) {
|
|
19260
21329
|
return { contradictions: [] };
|
|
19261
21330
|
}
|
|
@@ -19287,8 +21356,8 @@ function createGraphHandlers(context) {
|
|
|
19287
21356
|
bisect_confidence: contractToHandler(
|
|
19288
21357
|
MCP_TOOL_CONTRACTS.bisect_confidence,
|
|
19289
21358
|
async (params) => {
|
|
19290
|
-
const nodeId =
|
|
19291
|
-
const expectedDirection =
|
|
21359
|
+
const nodeId = readString3(params, "nodeId", { required: true });
|
|
21360
|
+
const expectedDirection = readString3(params, "expectedDirection", {
|
|
19292
21361
|
required: true
|
|
19293
21362
|
});
|
|
19294
21363
|
const entries2 = await getConfidenceEntries(nodeId);
|
|
@@ -19307,7 +21376,7 @@ function createGraphHandlers(context) {
|
|
|
19307
21376
|
detect_confirmation_bias: contractToHandler(
|
|
19308
21377
|
MCP_TOOL_CONTRACTS.detect_confirmation_bias,
|
|
19309
21378
|
async (params) => {
|
|
19310
|
-
const topicId =
|
|
21379
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19311
21380
|
if (!await isTopicReadable(topicId)) {
|
|
19312
21381
|
return { topicId, beliefs: [] };
|
|
19313
21382
|
}
|
|
@@ -19332,7 +21401,7 @@ function createGraphHandlers(context) {
|
|
|
19332
21401
|
get_graph_structure_analysis: contractToHandler(
|
|
19333
21402
|
MCP_TOOL_CONTRACTS.get_graph_structure_analysis,
|
|
19334
21403
|
async (params) => {
|
|
19335
|
-
const topicId =
|
|
21404
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19336
21405
|
if (!await isTopicReadable(topicId)) {
|
|
19337
21406
|
return {
|
|
19338
21407
|
topicId,
|
|
@@ -19350,7 +21419,7 @@ function createGraphHandlers(context) {
|
|
|
19350
21419
|
get_falsification_questions: contractToHandler(
|
|
19351
21420
|
MCP_TOOL_CONTRACTS.get_falsification_questions,
|
|
19352
21421
|
async (params) => {
|
|
19353
|
-
const topicId =
|
|
21422
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19354
21423
|
if (!await isTopicReadable(topicId)) {
|
|
19355
21424
|
return { questions: [] };
|
|
19356
21425
|
}
|
|
@@ -19379,7 +21448,7 @@ function createGraphHandlers(context) {
|
|
|
19379
21448
|
get_graph_gaps: contractToHandler(
|
|
19380
21449
|
MCP_TOOL_CONTRACTS.get_graph_gaps,
|
|
19381
21450
|
async (params) => {
|
|
19382
|
-
const topicId =
|
|
21451
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19383
21452
|
if (!await isTopicReadable(topicId)) {
|
|
19384
21453
|
return { topicId, gaps: [], totalGaps: 0 };
|
|
19385
21454
|
}
|
|
@@ -19392,13 +21461,13 @@ function createGraphHandlers(context) {
|
|
|
19392
21461
|
list_beliefs: contractToHandler(
|
|
19393
21462
|
MCP_TOOL_CONTRACTS.list_beliefs,
|
|
19394
21463
|
async (params) => {
|
|
19395
|
-
const topicId =
|
|
21464
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19396
21465
|
if (!await isTopicReadable(topicId)) {
|
|
19397
21466
|
return { beliefs: [] };
|
|
19398
21467
|
}
|
|
19399
|
-
const status =
|
|
21468
|
+
const status = readString3(params, "status");
|
|
19400
21469
|
const minConfidence = readNumber2(params, "minConfidence");
|
|
19401
|
-
const worktreeId =
|
|
21470
|
+
const worktreeId = readString3(params, "worktreeId");
|
|
19402
21471
|
const response = await graph.queryNodes({
|
|
19403
21472
|
topicId,
|
|
19404
21473
|
nodeType: "belief",
|
|
@@ -19445,9 +21514,9 @@ function createJudgmentHandlers(context) {
|
|
|
19445
21514
|
record_judgment: contractToHandler(
|
|
19446
21515
|
MCP_TOOL_CONTRACTS.record_judgment,
|
|
19447
21516
|
async (params) => {
|
|
19448
|
-
const title =
|
|
19449
|
-
const rationale =
|
|
19450
|
-
const topicId =
|
|
21517
|
+
const title = readString3(params, "title", { required: true });
|
|
21518
|
+
const rationale = readString3(params, "rationale", { required: true });
|
|
21519
|
+
const topicId = readTopicId4(params, { required: true });
|
|
19451
21520
|
const confidence = readNumber2(params, "confidence");
|
|
19452
21521
|
const beliefIds = readStringArray(params, "beliefIds");
|
|
19453
21522
|
const result = await decisions.recordJudgment({
|
|
@@ -19492,16 +21561,16 @@ function createObservationHandlers(context) {
|
|
|
19492
21561
|
500
|
|
19493
21562
|
);
|
|
19494
21563
|
}
|
|
19495
|
-
const topicId =
|
|
21564
|
+
const topicId = readTopicId4(params, {
|
|
19496
21565
|
required: true
|
|
19497
21566
|
});
|
|
19498
|
-
const observationType =
|
|
21567
|
+
const observationType = readString3(params, "observationType", {
|
|
19499
21568
|
required: true
|
|
19500
21569
|
});
|
|
19501
|
-
const summary =
|
|
21570
|
+
const summary = readString3(params, "summary", {
|
|
19502
21571
|
required: true
|
|
19503
21572
|
});
|
|
19504
|
-
const source =
|
|
21573
|
+
const source = readString3(params, "source");
|
|
19505
21574
|
const confidence = readNumber2(params, "confidence");
|
|
19506
21575
|
const tags = readStringArray(params, "tags");
|
|
19507
21576
|
const metadata = readObject(params, "metadata");
|
|
@@ -19558,14 +21627,14 @@ function createObservationHandlers(context) {
|
|
|
19558
21627
|
500
|
|
19559
21628
|
);
|
|
19560
21629
|
}
|
|
19561
|
-
const topicId =
|
|
21630
|
+
const topicId = readTopicId4(params, {
|
|
19562
21631
|
required: true
|
|
19563
21632
|
});
|
|
19564
|
-
const
|
|
21633
|
+
const query5 = readString3(params, "query");
|
|
19565
21634
|
const limit = readNumber2(params, "limit");
|
|
19566
21635
|
return observationStore.getContext({
|
|
19567
21636
|
topicId,
|
|
19568
|
-
query,
|
|
21637
|
+
query: query5,
|
|
19569
21638
|
limit
|
|
19570
21639
|
});
|
|
19571
21640
|
}
|
|
@@ -19580,10 +21649,10 @@ function createPolicyHandlers(context) {
|
|
|
19580
21649
|
check_permission: contractToHandler(
|
|
19581
21650
|
MCP_TOOL_CONTRACTS.check_permission,
|
|
19582
21651
|
async (params) => {
|
|
19583
|
-
const topicId =
|
|
19584
|
-
const permission =
|
|
19585
|
-
const principal =
|
|
19586
|
-
const beliefClusterId =
|
|
21652
|
+
const topicId = readTopicId4(params, { required: true });
|
|
21653
|
+
const permission = readString3(params, "permission", { required: true }) ?? "read";
|
|
21654
|
+
const principal = readString3(params, "principal");
|
|
21655
|
+
const beliefClusterId = readString3(params, "beliefClusterId");
|
|
19587
21656
|
const result = await policy.checkPermission({
|
|
19588
21657
|
topicId,
|
|
19589
21658
|
permission,
|
|
@@ -19605,10 +21674,10 @@ function createPolicyHandlers(context) {
|
|
|
19605
21674
|
MCP_TOOL_CONTRACTS.filter_by_permission,
|
|
19606
21675
|
async (params) => {
|
|
19607
21676
|
const topicIds = readStringArray(params, "topicIds") ?? [];
|
|
19608
|
-
const permission =
|
|
21677
|
+
const permission = readString3(params, "permission", {
|
|
19609
21678
|
required: true
|
|
19610
21679
|
}) ?? "read";
|
|
19611
|
-
const principal =
|
|
21680
|
+
const principal = readString3(params, "principal");
|
|
19612
21681
|
const result = await policy.filterByPermission({
|
|
19613
21682
|
topicIds,
|
|
19614
21683
|
permission,
|
|
@@ -19639,10 +21708,10 @@ function createQuestionHandlers(context) {
|
|
|
19639
21708
|
MCP_TOOL_CONTRACTS.create_question,
|
|
19640
21709
|
async (params) => {
|
|
19641
21710
|
const response = await lucern.questions.create({
|
|
19642
|
-
text:
|
|
19643
|
-
topicId:
|
|
19644
|
-
priority:
|
|
19645
|
-
linkedBeliefId:
|
|
21711
|
+
text: readString3(params, "text", { required: true }),
|
|
21712
|
+
topicId: readTopicId4(params, { required: true }),
|
|
21713
|
+
priority: readString3(params, "priority"),
|
|
21714
|
+
linkedBeliefId: readString3(params, "linkedBeliefId"),
|
|
19646
21715
|
metadata: readMetadata2(params)
|
|
19647
21716
|
});
|
|
19648
21717
|
return response.data;
|
|
@@ -19652,7 +21721,7 @@ function createQuestionHandlers(context) {
|
|
|
19652
21721
|
MCP_TOOL_CONTRACTS.get_question,
|
|
19653
21722
|
async (params) => {
|
|
19654
21723
|
const response = await lucern.questions.get(
|
|
19655
|
-
|
|
21724
|
+
readString3(params, "id", { required: true })
|
|
19656
21725
|
);
|
|
19657
21726
|
return response.data;
|
|
19658
21727
|
}
|
|
@@ -19661,12 +21730,12 @@ function createQuestionHandlers(context) {
|
|
|
19661
21730
|
MCP_TOOL_CONTRACTS.list_questions,
|
|
19662
21731
|
async (params) => {
|
|
19663
21732
|
const response = await lucern.questions.list({
|
|
19664
|
-
topicId:
|
|
19665
|
-
status:
|
|
19666
|
-
priority:
|
|
19667
|
-
worktreeId:
|
|
21733
|
+
topicId: readTopicId4(params, { required: true }),
|
|
21734
|
+
status: readString3(params, "status"),
|
|
21735
|
+
priority: readString3(params, "priority"),
|
|
21736
|
+
worktreeId: readString3(params, "worktreeId"),
|
|
19668
21737
|
limit: readNumber2(params, "limit"),
|
|
19669
|
-
cursor:
|
|
21738
|
+
cursor: readString3(params, "cursor")
|
|
19670
21739
|
});
|
|
19671
21740
|
return response.data;
|
|
19672
21741
|
}
|
|
@@ -19675,12 +21744,12 @@ function createQuestionHandlers(context) {
|
|
|
19675
21744
|
MCP_TOOL_CONTRACTS.answer_question,
|
|
19676
21745
|
async (params) => {
|
|
19677
21746
|
const response = await lucern.questions.answer(
|
|
19678
|
-
|
|
21747
|
+
readString3(params, "id", { required: true }),
|
|
19679
21748
|
{
|
|
19680
|
-
text:
|
|
19681
|
-
confidence:
|
|
21749
|
+
text: readString3(params, "text", { required: true }),
|
|
21750
|
+
confidence: readString3(params, "confidence"),
|
|
19682
21751
|
evidenceIds: readStringArray(params, "evidenceIds"),
|
|
19683
|
-
rationale:
|
|
21752
|
+
rationale: readString3(params, "rationale")
|
|
19684
21753
|
}
|
|
19685
21754
|
);
|
|
19686
21755
|
return response.data;
|
|
@@ -19690,9 +21759,9 @@ function createQuestionHandlers(context) {
|
|
|
19690
21759
|
MCP_TOOL_CONTRACTS.refine_question,
|
|
19691
21760
|
async (params) => {
|
|
19692
21761
|
const response = await lucern.questions.refine(
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
21762
|
+
readString3(params, "id") ?? readString3(params, "questionId", { required: true }),
|
|
21763
|
+
readString3(params, "text", { required: true }),
|
|
21764
|
+
readString3(params, "rationale") ?? readString3(params, "refinementReason")
|
|
19696
21765
|
);
|
|
19697
21766
|
return response.data;
|
|
19698
21767
|
}
|
|
@@ -19701,9 +21770,9 @@ function createQuestionHandlers(context) {
|
|
|
19701
21770
|
MCP_TOOL_CONTRACTS.update_question_status,
|
|
19702
21771
|
async (params) => {
|
|
19703
21772
|
const response = await lucern.questions.updateStatus(
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
21773
|
+
readString3(params, "id") ?? readString3(params, "questionId", { required: true }),
|
|
21774
|
+
readString3(params, "status", { required: true }),
|
|
21775
|
+
readString3(params, "rationale")
|
|
19707
21776
|
);
|
|
19708
21777
|
return response.data;
|
|
19709
21778
|
}
|
|
@@ -19712,8 +21781,8 @@ function createQuestionHandlers(context) {
|
|
|
19712
21781
|
MCP_TOOL_CONTRACTS.archive_question,
|
|
19713
21782
|
async (params) => {
|
|
19714
21783
|
return lucern.questions.archive(
|
|
19715
|
-
|
|
19716
|
-
|
|
21784
|
+
readString3(params, "questionId", { required: true }),
|
|
21785
|
+
readString3(params, "reason")
|
|
19717
21786
|
);
|
|
19718
21787
|
}
|
|
19719
21788
|
),
|
|
@@ -19721,10 +21790,10 @@ function createQuestionHandlers(context) {
|
|
|
19721
21790
|
MCP_TOOL_CONTRACTS.link_evidence_to_question,
|
|
19722
21791
|
async (params) => {
|
|
19723
21792
|
return lucern.questions.linkEvidence({
|
|
19724
|
-
evidenceId:
|
|
19725
|
-
questionId:
|
|
21793
|
+
evidenceId: readString3(params, "evidenceId", { required: true }),
|
|
21794
|
+
questionId: readString3(params, "questionId", { required: true }),
|
|
19726
21795
|
relevance: readNumber2(params, "relevance") ?? 1,
|
|
19727
|
-
rationale:
|
|
21796
|
+
rationale: readString3(params, "rationale")
|
|
19728
21797
|
});
|
|
19729
21798
|
}
|
|
19730
21799
|
),
|
|
@@ -19732,7 +21801,7 @@ function createQuestionHandlers(context) {
|
|
|
19732
21801
|
MCP_TOOL_CONTRACTS.get_high_priority_questions,
|
|
19733
21802
|
async (params) => {
|
|
19734
21803
|
return lucern.questions.getHighPriority({
|
|
19735
|
-
topicId:
|
|
21804
|
+
topicId: readTopicId4(params, { required: true }),
|
|
19736
21805
|
limit: readNumber2(params, "limit"),
|
|
19737
21806
|
includeAnswered: readBoolean(params, "includeAnswered")
|
|
19738
21807
|
});
|
|
@@ -19742,7 +21811,7 @@ function createQuestionHandlers(context) {
|
|
|
19742
21811
|
MCP_TOOL_CONTRACTS.find_missing_questions,
|
|
19743
21812
|
async (params) => {
|
|
19744
21813
|
return lucern.questions.findMissing({
|
|
19745
|
-
topicId:
|
|
21814
|
+
topicId: readTopicId4(params, { required: true }),
|
|
19746
21815
|
minConfidence: readNumber2(params, "minConfidence")
|
|
19747
21816
|
});
|
|
19748
21817
|
}
|
|
@@ -19757,11 +21826,11 @@ function createTaskHandlers(context) {
|
|
|
19757
21826
|
create_task: contractToHandler(
|
|
19758
21827
|
MCP_TOOL_CONTRACTS.create_task,
|
|
19759
21828
|
async (params) => {
|
|
19760
|
-
const title =
|
|
19761
|
-
const topicId =
|
|
19762
|
-
const taskType =
|
|
19763
|
-
const linkedQuestionId =
|
|
19764
|
-
const linkedWorktreeId =
|
|
21829
|
+
const title = readString3(params, "title", { required: true });
|
|
21830
|
+
const topicId = readTopicId4(params, { required: true });
|
|
21831
|
+
const taskType = readString3(params, "taskType");
|
|
21832
|
+
const linkedQuestionId = readString3(params, "linkedQuestionId");
|
|
21833
|
+
const linkedWorktreeId = readString3(params, "linkedWorktreeId");
|
|
19765
21834
|
const result = await workflow.createTask({
|
|
19766
21835
|
title,
|
|
19767
21836
|
topicId,
|
|
@@ -19779,8 +21848,8 @@ function createTaskHandlers(context) {
|
|
|
19779
21848
|
complete_task: contractToHandler(
|
|
19780
21849
|
MCP_TOOL_CONTRACTS.complete_task,
|
|
19781
21850
|
async (params) => {
|
|
19782
|
-
const taskId =
|
|
19783
|
-
const outputSummary =
|
|
21851
|
+
const taskId = readString3(params, "taskId", { required: true });
|
|
21852
|
+
const outputSummary = readString3(params, "outputSummary", {
|
|
19784
21853
|
required: true
|
|
19785
21854
|
});
|
|
19786
21855
|
const evidenceCreated = readBoolean(params, "evidenceCreated");
|
|
@@ -19798,15 +21867,15 @@ function createTaskHandlers(context) {
|
|
|
19798
21867
|
update_task: contractToHandler(
|
|
19799
21868
|
MCP_TOOL_CONTRACTS.update_task,
|
|
19800
21869
|
async (params) => {
|
|
19801
|
-
const taskId =
|
|
19802
|
-
const title =
|
|
19803
|
-
const description =
|
|
19804
|
-
const linkedBeliefId =
|
|
19805
|
-
const linkedQuestionId =
|
|
19806
|
-
const linkedWorktreeId =
|
|
19807
|
-
const rawPriority =
|
|
21870
|
+
const taskId = readString3(params, "taskId", { required: true });
|
|
21871
|
+
const title = readString3(params, "title");
|
|
21872
|
+
const description = readString3(params, "description");
|
|
21873
|
+
const linkedBeliefId = readString3(params, "linkedBeliefId");
|
|
21874
|
+
const linkedQuestionId = readString3(params, "linkedQuestionId");
|
|
21875
|
+
const linkedWorktreeId = readString3(params, "linkedWorktreeId");
|
|
21876
|
+
const rawPriority = readString3(params, "priority");
|
|
19808
21877
|
const priority = rawPriority === "critical" || rawPriority === "high" || rawPriority === "medium" || rawPriority === "low" ? rawPriority : void 0;
|
|
19809
|
-
const rawStatus =
|
|
21878
|
+
const rawStatus = readString3(params, "status");
|
|
19810
21879
|
const status = rawStatus === "todo" || rawStatus === "in_progress" || rawStatus === "blocked" || rawStatus === "done" ? rawStatus : void 0;
|
|
19811
21880
|
const result = await workflow.updateTask(taskId, {
|
|
19812
21881
|
title,
|
|
@@ -19844,11 +21913,11 @@ function createWorktreeHandlers(context) {
|
|
|
19844
21913
|
return {
|
|
19845
21914
|
create_lens: contractToHandler(MCP_TOOL_CONTRACTS.create_lens, async (params) => {
|
|
19846
21915
|
const result = await workflow.createLens({
|
|
19847
|
-
name:
|
|
19848
|
-
workspaceId:
|
|
19849
|
-
topicId:
|
|
19850
|
-
description:
|
|
19851
|
-
perspectiveType:
|
|
21916
|
+
name: readString3(params, "name", { required: true }),
|
|
21917
|
+
workspaceId: readString3(params, "workspaceId"),
|
|
21918
|
+
topicId: readTopicId4(params),
|
|
21919
|
+
description: readString3(params, "description"),
|
|
21920
|
+
perspectiveType: readString3(params, "perspectiveType", {
|
|
19852
21921
|
required: true
|
|
19853
21922
|
}),
|
|
19854
21923
|
promptTemplates: Array.isArray(params.promptTemplates) ? params.promptTemplates : void 0,
|
|
@@ -19858,17 +21927,17 @@ function createWorktreeHandlers(context) {
|
|
|
19858
21927
|
});
|
|
19859
21928
|
return {
|
|
19860
21929
|
lensId: result.data.lensId ?? "",
|
|
19861
|
-
name: result.data.name ??
|
|
19862
|
-
workspaceId: result.data.workspaceId ??
|
|
21930
|
+
name: result.data.name ?? readString3(params, "name", { required: true }),
|
|
21931
|
+
workspaceId: result.data.workspaceId ?? readString3(params, "workspaceId") ?? null,
|
|
19863
21932
|
status: result.data.status ?? "active"
|
|
19864
21933
|
};
|
|
19865
21934
|
}),
|
|
19866
21935
|
list_lenses: contractToHandler(MCP_TOOL_CONTRACTS.list_lenses, async (params) => {
|
|
19867
21936
|
const result = await workflow.listLenses({
|
|
19868
|
-
workspaceId:
|
|
19869
|
-
topicId:
|
|
19870
|
-
status:
|
|
19871
|
-
perspectiveType:
|
|
21937
|
+
workspaceId: readString3(params, "workspaceId"),
|
|
21938
|
+
topicId: readTopicId4(params),
|
|
21939
|
+
status: readString3(params, "status"),
|
|
21940
|
+
perspectiveType: readString3(params, "perspectiveType")
|
|
19872
21941
|
});
|
|
19873
21942
|
return {
|
|
19874
21943
|
lenses: result.data.items ?? ("lenses" in result.data && Array.isArray(result.data.lenses) ? result.data.lenses : [])
|
|
@@ -19877,8 +21946,8 @@ function createWorktreeHandlers(context) {
|
|
|
19877
21946
|
apply_lens_to_topic: contractToHandler(
|
|
19878
21947
|
MCP_TOOL_CONTRACTS.apply_lens_to_topic,
|
|
19879
21948
|
async (params) => {
|
|
19880
|
-
const topicId =
|
|
19881
|
-
const lensId =
|
|
21949
|
+
const topicId = readTopicId4(params, { required: true });
|
|
21950
|
+
const lensId = readString3(params, "lensId", { required: true });
|
|
19882
21951
|
const result = await workflow.applyLensToTopic({
|
|
19883
21952
|
lensId,
|
|
19884
21953
|
topicId,
|
|
@@ -19895,8 +21964,8 @@ function createWorktreeHandlers(context) {
|
|
|
19895
21964
|
remove_lens_from_topic: contractToHandler(
|
|
19896
21965
|
MCP_TOOL_CONTRACTS.remove_lens_from_topic,
|
|
19897
21966
|
async (params) => {
|
|
19898
|
-
const topicId =
|
|
19899
|
-
const lensId =
|
|
21967
|
+
const topicId = readTopicId4(params, { required: true });
|
|
21968
|
+
const lensId = readString3(params, "lensId", { required: true });
|
|
19900
21969
|
const result = await workflow.removeLensFromTopic({
|
|
19901
21970
|
lensId,
|
|
19902
21971
|
topicId
|
|
@@ -19912,26 +21981,26 @@ function createWorktreeHandlers(context) {
|
|
|
19912
21981
|
add_worktree: contractToHandler(
|
|
19913
21982
|
MCP_TOOL_CONTRACTS.add_worktree,
|
|
19914
21983
|
async (params) => {
|
|
19915
|
-
const topicId =
|
|
21984
|
+
const topicId = readTopicId4(params);
|
|
19916
21985
|
if (!topicId) {
|
|
19917
21986
|
throw new Error("add_worktree requires topicId");
|
|
19918
21987
|
}
|
|
19919
21988
|
const result = await workflow.addWorktree({
|
|
19920
|
-
title:
|
|
21989
|
+
title: readString3(params, "title", { required: true }),
|
|
19921
21990
|
topicId,
|
|
19922
|
-
branchId:
|
|
19923
|
-
objective:
|
|
19924
|
-
hypothesis:
|
|
21991
|
+
branchId: readString3(params, "branchId"),
|
|
21992
|
+
objective: readString3(params, "objective"),
|
|
21993
|
+
hypothesis: readString3(params, "hypothesis"),
|
|
19925
21994
|
beliefIds: readStringArray(params, "beliefIds"),
|
|
19926
21995
|
autoShape: readBoolean(params, "autoShape"),
|
|
19927
|
-
domainPackId:
|
|
21996
|
+
domainPackId: readString3(params, "domainPackId"),
|
|
19928
21997
|
campaign: typeof params.campaign === "number" ? params.campaign : void 0,
|
|
19929
|
-
lane:
|
|
21998
|
+
lane: readString3(params, "lane"),
|
|
19930
21999
|
laneOrderInCampaign: typeof params.laneOrderInCampaign === "number" ? params.laneOrderInCampaign : void 0,
|
|
19931
22000
|
orderInLane: typeof params.orderInLane === "number" ? params.orderInLane : void 0,
|
|
19932
22001
|
dependsOn: readStringArray(params, "dependsOn"),
|
|
19933
22002
|
blocks: readStringArray(params, "blocks"),
|
|
19934
|
-
gate:
|
|
22003
|
+
gate: readString3(params, "gate")
|
|
19935
22004
|
});
|
|
19936
22005
|
return {
|
|
19937
22006
|
worktreeId: result.data.worktreeId,
|
|
@@ -19948,11 +22017,11 @@ function createWorktreeHandlers(context) {
|
|
|
19948
22017
|
}
|
|
19949
22018
|
),
|
|
19950
22019
|
merge: contractToHandler(MCP_TOOL_CONTRACTS.merge, async (params) => {
|
|
19951
|
-
const worktreeId =
|
|
22020
|
+
const worktreeId = readString3(params, "worktreeId", { required: true });
|
|
19952
22021
|
const outcomes = Array.isArray(params.outcomes) ? params.outcomes : [];
|
|
19953
22022
|
const result = await workflow.merge(worktreeId, {
|
|
19954
22023
|
outcomes,
|
|
19955
|
-
summary:
|
|
22024
|
+
summary: readString3(params, "summary")
|
|
19956
22025
|
});
|
|
19957
22026
|
return {
|
|
19958
22027
|
worktreeId: result.data.worktreeId ?? worktreeId,
|
|
@@ -19961,8 +22030,8 @@ function createWorktreeHandlers(context) {
|
|
|
19961
22030
|
};
|
|
19962
22031
|
}),
|
|
19963
22032
|
push: contractToHandler(MCP_TOOL_CONTRACTS.push, async (params) => {
|
|
19964
|
-
const worktreeId =
|
|
19965
|
-
const targetContext =
|
|
22033
|
+
const worktreeId = readString3(params, "worktreeId", { required: true });
|
|
22034
|
+
const targetContext = readString3(params, "targetContext", {
|
|
19966
22035
|
required: true
|
|
19967
22036
|
});
|
|
19968
22037
|
const result = await workflow.push(worktreeId, {
|
|
@@ -19978,10 +22047,10 @@ function createWorktreeHandlers(context) {
|
|
|
19978
22047
|
open_pull_request: contractToHandler(
|
|
19979
22048
|
MCP_TOOL_CONTRACTS.open_pull_request,
|
|
19980
22049
|
async (params) => {
|
|
19981
|
-
const worktreeId =
|
|
22050
|
+
const worktreeId = readString3(params, "worktreeId", {
|
|
19982
22051
|
required: true
|
|
19983
22052
|
});
|
|
19984
|
-
const summary =
|
|
22053
|
+
const summary = readString3(params, "summary", { required: true });
|
|
19985
22054
|
const reviewers = readStringArray(params, "reviewers");
|
|
19986
22055
|
const result = await workflow.openPullRequest(worktreeId, {
|
|
19987
22056
|
summary,
|
|
@@ -19997,8 +22066,8 @@ function createWorktreeHandlers(context) {
|
|
|
19997
22066
|
list_worktrees: contractToHandler(
|
|
19998
22067
|
MCP_TOOL_CONTRACTS.list_worktrees,
|
|
19999
22068
|
async (params) => {
|
|
20000
|
-
const topicId =
|
|
20001
|
-
const status = mapWorktreeStatus(
|
|
22069
|
+
const topicId = readTopicId4(params, { required: true });
|
|
22070
|
+
const status = mapWorktreeStatus(readString3(params, "status"));
|
|
20002
22071
|
const result = await workflow.listWorktrees({
|
|
20003
22072
|
topicId,
|
|
20004
22073
|
status
|
|
@@ -20148,7 +22217,7 @@ function createMcpRuntime() {
|
|
|
20148
22217
|
}
|
|
20149
22218
|
function createSdkConfig(options) {
|
|
20150
22219
|
const sessionHeaders = (token) => ({
|
|
20151
|
-
|
|
22220
|
+
"x-lucern-session-token": token
|
|
20152
22221
|
});
|
|
20153
22222
|
const apiKeyHeaders = (apiKey) => apiKey.startsWith("luc_") || apiKey.startsWith("stk_") ? { "x-lucern-key": apiKey } : { Authorization: `Bearer ${apiKey}` };
|
|
20154
22223
|
const getAuthHeaders = options?.sessionToken ? async () => sessionHeaders(options.sessionToken) : options?.apiKey ? async () => apiKeyHeaders(options.apiKey) : void 0;
|
|
@@ -20497,17 +22566,17 @@ function registerResources(server, runtime, observationStore) {
|
|
|
20497
22566
|
async (_uri, variables) => {
|
|
20498
22567
|
const values = variables;
|
|
20499
22568
|
const topicId = readTemplateVar(values, "topicId");
|
|
20500
|
-
const
|
|
20501
|
-
const matches = topicId &&
|
|
22569
|
+
const query5 = readTemplateVar(values, "query");
|
|
22570
|
+
const matches = topicId && query5 ? observationStore.search(topicId, query5, 25) : [];
|
|
20502
22571
|
return {
|
|
20503
22572
|
contents: [
|
|
20504
22573
|
{
|
|
20505
|
-
uri: `lucern://observations/search/${topicId ?? "unknown"}/${
|
|
22574
|
+
uri: `lucern://observations/search/${topicId ?? "unknown"}/${query5 ?? "none"}`,
|
|
20506
22575
|
mimeType: "application/json",
|
|
20507
22576
|
text: JSON.stringify(
|
|
20508
22577
|
{
|
|
20509
22578
|
topicId: topicId ?? null,
|
|
20510
|
-
query:
|
|
22579
|
+
query: query5 ?? null,
|
|
20511
22580
|
matches,
|
|
20512
22581
|
requiredScopes: ["graph:read"]
|
|
20513
22582
|
},
|
|
@@ -20559,16 +22628,16 @@ function registerResources(server, runtime, observationStore) {
|
|
|
20559
22628
|
async (_uri, variables) => {
|
|
20560
22629
|
const values = variables;
|
|
20561
22630
|
const topicId = readTemplateVar(values, "topicId");
|
|
20562
|
-
const
|
|
22631
|
+
const query5 = readTemplateVar(values, "query");
|
|
20563
22632
|
const context = observationStore.getContext({
|
|
20564
22633
|
topicId: topicId ?? "unknown",
|
|
20565
|
-
query,
|
|
22634
|
+
query: query5,
|
|
20566
22635
|
limit: 12
|
|
20567
22636
|
});
|
|
20568
22637
|
return {
|
|
20569
22638
|
contents: [
|
|
20570
22639
|
{
|
|
20571
|
-
uri: `lucern://context/search/${topicId ?? "unknown"}/${
|
|
22640
|
+
uri: `lucern://context/search/${topicId ?? "unknown"}/${query5 ?? "none"}`,
|
|
20572
22641
|
mimeType: "application/json",
|
|
20573
22642
|
text: JSON.stringify(context, null, 2)
|
|
20574
22643
|
}
|