@lucern/mcp 0.3.0-alpha.5 → 0.3.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +877 -883
- package/dist/cli.js.map +1 -1
- package/dist/gateway.js +751 -317
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +808 -890
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.js +914 -888
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +505 -161
- package/dist/runtime.js.map +1 -1
- package/package.json +7 -7
package/dist/hosted-route.js
CHANGED
|
@@ -370,6 +370,7 @@ __export(src_exports, {
|
|
|
370
370
|
WORKTREE_PHASES: () => WORKTREE_PHASES,
|
|
371
371
|
applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
|
|
372
372
|
asListItems: () => asListItems,
|
|
373
|
+
asRecord: () => asRecord,
|
|
373
374
|
assertValidWebhookSecret: () => assertValidWebhookSecret,
|
|
374
375
|
assertValidWebhookUrl: () => assertValidWebhookUrl,
|
|
375
376
|
buildDeprecatedBranchMetadata: () => buildDeprecatedBranchMetadata,
|
|
@@ -441,6 +442,7 @@ __export(src_exports, {
|
|
|
441
442
|
isLensFilterCriteria: () => isLensFilterCriteria,
|
|
442
443
|
isLucernPrompt: () => isLucernPrompt,
|
|
443
444
|
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
445
|
+
isRecord: () => isRecord2,
|
|
444
446
|
isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV1,
|
|
445
447
|
lastDelegator: () => lastDelegator,
|
|
446
448
|
listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
|
|
@@ -750,9 +752,7 @@ function generatePortableRequestId() {
|
|
|
750
752
|
8
|
|
751
753
|
).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
752
754
|
}
|
|
753
|
-
|
|
754
|
-
return generatePortableRequestId();
|
|
755
|
-
}
|
|
755
|
+
var randomIdempotencyKey = generatePortableRequestId;
|
|
756
756
|
function isRetryableStatus(status) {
|
|
757
757
|
return status >= 500 || status === 408 || status === 429;
|
|
758
758
|
}
|
|
@@ -817,8 +817,11 @@ function timeoutError(timeoutMs) {
|
|
|
817
817
|
error.name = "AbortError";
|
|
818
818
|
return error;
|
|
819
819
|
}
|
|
820
|
+
function isRecord(value) {
|
|
821
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
822
|
+
}
|
|
820
823
|
function readPolicySummaryFromDetails(details) {
|
|
821
|
-
if (!
|
|
824
|
+
if (!isRecord(details)) {
|
|
822
825
|
return null;
|
|
823
826
|
}
|
|
824
827
|
const directSummary = details.summary;
|
|
@@ -826,11 +829,11 @@ function readPolicySummaryFromDetails(details) {
|
|
|
826
829
|
return directSummary.trim();
|
|
827
830
|
}
|
|
828
831
|
const policy = details.policy;
|
|
829
|
-
if (!
|
|
832
|
+
if (!isRecord(policy)) {
|
|
830
833
|
return null;
|
|
831
834
|
}
|
|
832
835
|
const explanation = policy.explanation;
|
|
833
|
-
if (!
|
|
836
|
+
if (!isRecord(explanation)) {
|
|
834
837
|
return null;
|
|
835
838
|
}
|
|
836
839
|
const nestedSummary = explanation.summary;
|
|
@@ -894,11 +897,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
894
897
|
if (!text) {
|
|
895
898
|
return null;
|
|
896
899
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
} catch {
|
|
900
|
+
const parsed = tryParseGatewayEnvelopeJson(text);
|
|
901
|
+
if (!parsed.ok) {
|
|
900
902
|
return null;
|
|
901
903
|
}
|
|
904
|
+
return isRecord(parsed.value) ? parsed.value : null;
|
|
902
905
|
}
|
|
903
906
|
function resolveTimeoutMs(method, requestTimeoutMs) {
|
|
904
907
|
if (typeof requestTimeoutMs === "number") {
|
|
@@ -910,16 +913,31 @@ function createGatewayRequestClient(config = {}) {
|
|
|
910
913
|
}
|
|
911
914
|
return config.timeoutMs ?? 15e3;
|
|
912
915
|
}
|
|
916
|
+
function tryParseGatewayEnvelopeJson(text) {
|
|
917
|
+
const trimmed = text.trim();
|
|
918
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
919
|
+
return { ok: false, reason: "non-json" };
|
|
920
|
+
}
|
|
921
|
+
try {
|
|
922
|
+
return { ok: true, value: JSON.parse(trimmed) };
|
|
923
|
+
} catch (error) {
|
|
924
|
+
if (error instanceof SyntaxError) {
|
|
925
|
+
return { ok: false, reason: "invalid-json", error };
|
|
926
|
+
}
|
|
927
|
+
throw error;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
913
930
|
function buildApiError(args) {
|
|
914
931
|
const failure = args.failure;
|
|
915
|
-
const legacyError = failure &&
|
|
932
|
+
const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
|
|
916
933
|
const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
|
|
917
934
|
const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
|
|
918
935
|
const details = failure?.details ?? legacyError?.details;
|
|
919
936
|
const policySummary = readPolicySummaryFromDetails(details);
|
|
937
|
+
const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
|
|
920
938
|
return new LucernApiError({
|
|
921
939
|
code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
|
|
922
|
-
message: policySummary ??
|
|
940
|
+
message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
|
|
923
941
|
status: args.response.status,
|
|
924
942
|
invariant: failure?.invariant,
|
|
925
943
|
suggestion: failure?.suggestion,
|
|
@@ -1045,8 +1063,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
1045
1063
|
}
|
|
1046
1064
|
|
|
1047
1065
|
// ../sdk/src/sdkSurface.ts
|
|
1066
|
+
function isRecord2(value) {
|
|
1067
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1068
|
+
}
|
|
1048
1069
|
function asRecord(value) {
|
|
1049
|
-
return value
|
|
1070
|
+
return isRecord2(value) ? value : {};
|
|
1050
1071
|
}
|
|
1051
1072
|
function cleanString2(value) {
|
|
1052
1073
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
@@ -1107,9 +1128,7 @@ function normalizeNodeWriteInput(value) {
|
|
|
1107
1128
|
}
|
|
1108
1129
|
return next;
|
|
1109
1130
|
}
|
|
1110
|
-
|
|
1111
|
-
return normalizeVerificationStatus(value);
|
|
1112
|
-
}
|
|
1131
|
+
var normalizeNodeVerificationStatus = normalizeVerificationStatus;
|
|
1113
1132
|
function normalizeTopicQuery(value) {
|
|
1114
1133
|
const topicId = cleanString2(value.topicId);
|
|
1115
1134
|
if (!topicId) {
|
|
@@ -1136,7 +1155,10 @@ function createListResult(items, legacyKey) {
|
|
|
1136
1155
|
total: items.length
|
|
1137
1156
|
};
|
|
1138
1157
|
if (legacyKey) {
|
|
1139
|
-
|
|
1158
|
+
return {
|
|
1159
|
+
...result,
|
|
1160
|
+
[legacyKey]: items
|
|
1161
|
+
};
|
|
1140
1162
|
}
|
|
1141
1163
|
return result;
|
|
1142
1164
|
}
|
|
@@ -1180,6 +1202,17 @@ function asTenantVaultSecretArray(data) {
|
|
|
1180
1202
|
}
|
|
1181
1203
|
function createAdminClient(config = {}) {
|
|
1182
1204
|
const gateway = createGatewayRequestClient(config);
|
|
1205
|
+
const getControlObjectOwnership = async () => gateway.request({
|
|
1206
|
+
path: "/api/platform/v1/admin/control-ownership"
|
|
1207
|
+
});
|
|
1208
|
+
const createMembership = async (input, idempotencyKey) => gateway.request({
|
|
1209
|
+
path: "/api/platform/v1/memberships",
|
|
1210
|
+
method: "POST",
|
|
1211
|
+
body: input,
|
|
1212
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1213
|
+
});
|
|
1214
|
+
const updateMembership = createMembership;
|
|
1215
|
+
const upsertMembership = createMembership;
|
|
1183
1216
|
return {
|
|
1184
1217
|
/**
|
|
1185
1218
|
* List tenants visible to the current principal.
|
|
@@ -1211,19 +1244,11 @@ function createAdminClient(config = {}) {
|
|
|
1211
1244
|
/**
|
|
1212
1245
|
* Get the control-object ownership contract.
|
|
1213
1246
|
*/
|
|
1214
|
-
|
|
1215
|
-
return gateway.request({
|
|
1216
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
1217
|
-
});
|
|
1218
|
-
},
|
|
1247
|
+
getControlObjectOwnership,
|
|
1219
1248
|
/**
|
|
1220
1249
|
* @deprecated Use getControlObjectOwnership.
|
|
1221
1250
|
*/
|
|
1222
|
-
|
|
1223
|
-
return gateway.request({
|
|
1224
|
-
path: "/api/platform/v1/admin/control-ownership"
|
|
1225
|
-
});
|
|
1226
|
-
},
|
|
1251
|
+
getControlObjectOwnershipContract: getControlObjectOwnership,
|
|
1227
1252
|
/**
|
|
1228
1253
|
* List workspaces for the current admin scope.
|
|
1229
1254
|
*/
|
|
@@ -1270,26 +1295,15 @@ function createAdminClient(config = {}) {
|
|
|
1270
1295
|
/**
|
|
1271
1296
|
* Create a membership.
|
|
1272
1297
|
*/
|
|
1273
|
-
|
|
1274
|
-
return gateway.request({
|
|
1275
|
-
path: "/api/platform/v1/memberships",
|
|
1276
|
-
method: "POST",
|
|
1277
|
-
body: input,
|
|
1278
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1279
|
-
});
|
|
1280
|
-
},
|
|
1298
|
+
createMembership,
|
|
1281
1299
|
/**
|
|
1282
1300
|
* Update a membership.
|
|
1283
1301
|
*/
|
|
1284
|
-
|
|
1285
|
-
return this.createMembership(input, idempotencyKey);
|
|
1286
|
-
},
|
|
1302
|
+
updateMembership,
|
|
1287
1303
|
/**
|
|
1288
1304
|
* @deprecated Use createMembership or updateMembership.
|
|
1289
1305
|
*/
|
|
1290
|
-
|
|
1291
|
-
return this.createMembership(input, idempotencyKey);
|
|
1292
|
-
},
|
|
1306
|
+
upsertMembership,
|
|
1293
1307
|
/**
|
|
1294
1308
|
* List tenant API keys in the current admin scope.
|
|
1295
1309
|
*/
|
|
@@ -1571,115 +1585,111 @@ function createAnswersClient(config = {}) {
|
|
|
1571
1585
|
// ../sdk/src/audiencesClient.ts
|
|
1572
1586
|
function createAudiencesClient(config = {}) {
|
|
1573
1587
|
const gateway = createGatewayRequestClient(config);
|
|
1588
|
+
const listRegistry = async (query5 = {}) => {
|
|
1589
|
+
return gateway.request({
|
|
1590
|
+
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
1591
|
+
...query5,
|
|
1592
|
+
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
1593
|
+
status: query5.status
|
|
1594
|
+
})}`
|
|
1595
|
+
}).then(
|
|
1596
|
+
(response) => mapGatewayData(
|
|
1597
|
+
response,
|
|
1598
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "registryEntries")
|
|
1599
|
+
)
|
|
1600
|
+
);
|
|
1601
|
+
};
|
|
1602
|
+
const createRegistryEntry = async (input, idempotencyKey) => {
|
|
1603
|
+
return gateway.request({
|
|
1604
|
+
path: "/api/platform/v1/audiences/registry",
|
|
1605
|
+
method: "POST",
|
|
1606
|
+
body: input,
|
|
1607
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1608
|
+
});
|
|
1609
|
+
};
|
|
1610
|
+
const updateRegistryEntry = createRegistryEntry;
|
|
1611
|
+
const upsertRegistry = createRegistryEntry;
|
|
1612
|
+
const getRegistry = listRegistry;
|
|
1613
|
+
const listGrants = async (query5 = {}) => {
|
|
1614
|
+
return gateway.request({
|
|
1615
|
+
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
1616
|
+
...query5,
|
|
1617
|
+
audienceKey: query5.audienceKey,
|
|
1618
|
+
principalId: query5.principalId,
|
|
1619
|
+
groupId: query5.groupId,
|
|
1620
|
+
status: query5.status
|
|
1621
|
+
})}`
|
|
1622
|
+
}).then(
|
|
1623
|
+
(response) => mapGatewayData(
|
|
1624
|
+
response,
|
|
1625
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
1626
|
+
)
|
|
1627
|
+
);
|
|
1628
|
+
};
|
|
1629
|
+
const createGrant = async (input, idempotencyKey) => {
|
|
1630
|
+
return gateway.request({
|
|
1631
|
+
path: "/api/platform/v1/audiences/grants",
|
|
1632
|
+
method: "POST",
|
|
1633
|
+
body: input,
|
|
1634
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1635
|
+
});
|
|
1636
|
+
};
|
|
1637
|
+
const getGrants = listGrants;
|
|
1638
|
+
const grant = createGrant;
|
|
1639
|
+
const deleteGrant = async (input, idempotencyKey) => {
|
|
1640
|
+
return gateway.request({
|
|
1641
|
+
path: "/api/platform/v1/audiences/grants/revoke",
|
|
1642
|
+
method: "POST",
|
|
1643
|
+
body: input,
|
|
1644
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1645
|
+
});
|
|
1646
|
+
};
|
|
1647
|
+
const revokeGrant = deleteGrant;
|
|
1574
1648
|
return {
|
|
1575
1649
|
/**
|
|
1576
1650
|
* List audience registry entries.
|
|
1577
1651
|
*/
|
|
1578
|
-
|
|
1579
|
-
return gateway.request({
|
|
1580
|
-
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
1581
|
-
...query5,
|
|
1582
|
-
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
1583
|
-
status: query5.status
|
|
1584
|
-
})}`
|
|
1585
|
-
}).then(
|
|
1586
|
-
(response) => mapGatewayData(
|
|
1587
|
-
response,
|
|
1588
|
-
(data) => createListResult(
|
|
1589
|
-
Array.isArray(data) ? data : [],
|
|
1590
|
-
"registryEntries"
|
|
1591
|
-
)
|
|
1592
|
-
)
|
|
1593
|
-
);
|
|
1594
|
-
},
|
|
1652
|
+
listRegistry,
|
|
1595
1653
|
/**
|
|
1596
1654
|
* @deprecated Use listRegistry.
|
|
1597
1655
|
*/
|
|
1598
|
-
|
|
1599
|
-
return this.listRegistry(query5);
|
|
1600
|
-
},
|
|
1656
|
+
getRegistry,
|
|
1601
1657
|
/**
|
|
1602
1658
|
* Create an audience registry entry.
|
|
1603
1659
|
*/
|
|
1604
|
-
|
|
1605
|
-
return gateway.request({
|
|
1606
|
-
path: "/api/platform/v1/audiences/registry",
|
|
1607
|
-
method: "POST",
|
|
1608
|
-
body: input,
|
|
1609
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1610
|
-
});
|
|
1611
|
-
},
|
|
1660
|
+
createRegistryEntry,
|
|
1612
1661
|
/**
|
|
1613
1662
|
* Update an audience registry entry.
|
|
1614
1663
|
*/
|
|
1615
|
-
|
|
1616
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
1617
|
-
},
|
|
1664
|
+
updateRegistryEntry,
|
|
1618
1665
|
/**
|
|
1619
1666
|
* @deprecated Use createRegistryEntry or updateRegistryEntry.
|
|
1620
1667
|
*/
|
|
1621
|
-
|
|
1622
|
-
return this.createRegistryEntry(input, idempotencyKey);
|
|
1623
|
-
},
|
|
1668
|
+
upsertRegistry,
|
|
1624
1669
|
/**
|
|
1625
1670
|
* List audience grants.
|
|
1626
1671
|
*/
|
|
1627
|
-
|
|
1628
|
-
return gateway.request({
|
|
1629
|
-
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
1630
|
-
...query5,
|
|
1631
|
-
audienceKey: query5.audienceKey,
|
|
1632
|
-
principalId: query5.principalId,
|
|
1633
|
-
groupId: query5.groupId,
|
|
1634
|
-
status: query5.status
|
|
1635
|
-
})}`
|
|
1636
|
-
}).then(
|
|
1637
|
-
(response) => mapGatewayData(
|
|
1638
|
-
response,
|
|
1639
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "grants")
|
|
1640
|
-
)
|
|
1641
|
-
);
|
|
1642
|
-
},
|
|
1672
|
+
listGrants,
|
|
1643
1673
|
/**
|
|
1644
1674
|
* @deprecated Use listGrants.
|
|
1645
1675
|
*/
|
|
1646
|
-
|
|
1647
|
-
return this.listGrants(query5);
|
|
1648
|
-
},
|
|
1676
|
+
getGrants,
|
|
1649
1677
|
/**
|
|
1650
1678
|
* Create an audience grant.
|
|
1651
1679
|
*/
|
|
1652
|
-
|
|
1653
|
-
return gateway.request({
|
|
1654
|
-
path: "/api/platform/v1/audiences/grants",
|
|
1655
|
-
method: "POST",
|
|
1656
|
-
body: input,
|
|
1657
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1658
|
-
});
|
|
1659
|
-
},
|
|
1680
|
+
createGrant,
|
|
1660
1681
|
/**
|
|
1661
1682
|
* @deprecated Use createGrant.
|
|
1662
1683
|
*/
|
|
1663
|
-
|
|
1664
|
-
return this.createGrant(input, idempotencyKey);
|
|
1665
|
-
},
|
|
1684
|
+
grant,
|
|
1666
1685
|
/**
|
|
1667
1686
|
* Delete an audience grant by revoking it.
|
|
1668
1687
|
*/
|
|
1669
|
-
|
|
1670
|
-
return gateway.request({
|
|
1671
|
-
path: "/api/platform/v1/audiences/grants/revoke",
|
|
1672
|
-
method: "POST",
|
|
1673
|
-
body: input,
|
|
1674
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1675
|
-
});
|
|
1676
|
-
},
|
|
1688
|
+
deleteGrant,
|
|
1677
1689
|
/**
|
|
1678
1690
|
* @deprecated Use deleteGrant.
|
|
1679
1691
|
*/
|
|
1680
|
-
|
|
1681
|
-
return this.deleteGrant(input, idempotencyKey);
|
|
1682
|
-
}
|
|
1692
|
+
revokeGrant
|
|
1683
1693
|
};
|
|
1684
1694
|
}
|
|
1685
1695
|
|
|
@@ -1720,8 +1730,18 @@ function authBaseUrl(config) {
|
|
|
1720
1730
|
return config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
1721
1731
|
}
|
|
1722
1732
|
async function readJson(response) {
|
|
1723
|
-
|
|
1724
|
-
|
|
1733
|
+
try {
|
|
1734
|
+
const payload = await response.json();
|
|
1735
|
+
return isRecord3(payload) ? payload : {};
|
|
1736
|
+
} catch (error) {
|
|
1737
|
+
return unreadableJsonBodyFallback();
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function unreadableJsonBodyFallback(_error) {
|
|
1741
|
+
return {};
|
|
1742
|
+
}
|
|
1743
|
+
function isRecord3(value) {
|
|
1744
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1725
1745
|
}
|
|
1726
1746
|
function readString(value) {
|
|
1727
1747
|
const normalized = typeof value === "string" ? value.trim() : "";
|
|
@@ -1763,7 +1783,10 @@ function assertDeviceTokenResponse(payload) {
|
|
|
1763
1783
|
tenant_id: tenantId,
|
|
1764
1784
|
workspace_id: readString(payload.workspace_id),
|
|
1765
1785
|
principal_id: principalId,
|
|
1766
|
-
user: payload.user && typeof payload.user === "
|
|
1786
|
+
user: isRecord3(payload.user) && typeof payload.user.id === "string" && typeof payload.user.principalId === "string" ? {
|
|
1787
|
+
id: payload.user.id,
|
|
1788
|
+
principalId: payload.user.principalId
|
|
1789
|
+
} : void 0
|
|
1767
1790
|
};
|
|
1768
1791
|
}
|
|
1769
1792
|
function maybeThrowDeviceError(payload) {
|
|
@@ -1911,12 +1934,12 @@ function createBeliefsClient(config = {}) {
|
|
|
1911
1934
|
body: normalizeModulateConfidenceInput(input),
|
|
1912
1935
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1913
1936
|
});
|
|
1914
|
-
async
|
|
1937
|
+
const getOpinionHistory = async (beliefId) => {
|
|
1915
1938
|
const response = await gateway.request({
|
|
1916
1939
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/confidence-history`
|
|
1917
1940
|
});
|
|
1918
1941
|
return mapOpinionHistoryEntriesFromGatewayData(response.data);
|
|
1919
|
-
}
|
|
1942
|
+
};
|
|
1920
1943
|
return {
|
|
1921
1944
|
/**
|
|
1922
1945
|
* Create a belief within a topic scope.
|
|
@@ -1961,13 +1984,9 @@ function createBeliefsClient(config = {}) {
|
|
|
1961
1984
|
* trigger = cause of the score change
|
|
1962
1985
|
* triggeringRef = optional pointer to the evidence or worktree that drove the change
|
|
1963
1986
|
*/
|
|
1964
|
-
|
|
1965
|
-
return getOpinionHistory(beliefId);
|
|
1966
|
-
},
|
|
1987
|
+
getOpinionHistory,
|
|
1967
1988
|
/** @deprecated Use getOpinionHistory(). */
|
|
1968
|
-
|
|
1969
|
-
return getOpinionHistory(beliefId);
|
|
1970
|
-
},
|
|
1989
|
+
getConfidenceHistory: getOpinionHistory,
|
|
1971
1990
|
/**
|
|
1972
1991
|
* Fork a scored belief into a new formulation.
|
|
1973
1992
|
*/
|
|
@@ -2115,6 +2134,9 @@ function cleanOptionalString(value) {
|
|
|
2115
2134
|
const normalized = value?.trim();
|
|
2116
2135
|
return normalized ? normalized : void 0;
|
|
2117
2136
|
}
|
|
2137
|
+
function isRecord4(value) {
|
|
2138
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2139
|
+
}
|
|
2118
2140
|
function cleanRequiredString(value, label) {
|
|
2119
2141
|
const normalized = cleanOptionalString(value);
|
|
2120
2142
|
if (!normalized) {
|
|
@@ -2154,9 +2176,10 @@ function topicPayload(input, allowed, operation) {
|
|
|
2154
2176
|
};
|
|
2155
2177
|
}
|
|
2156
2178
|
function listResultFromEnvelope(data, legacyKey) {
|
|
2157
|
-
const record = data
|
|
2179
|
+
const record = isRecord4(data) ? data : {};
|
|
2180
|
+
const legacyItems = record[legacyKey];
|
|
2158
2181
|
return createListResult(
|
|
2159
|
-
Array.isArray(
|
|
2182
|
+
Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
|
|
2160
2183
|
legacyKey
|
|
2161
2184
|
);
|
|
2162
2185
|
}
|
|
@@ -2528,7 +2551,7 @@ async function invokeRegisteredCustomTool(fullName, params, context) {
|
|
|
2528
2551
|
// ../sdk/src/ontologyClient.ts
|
|
2529
2552
|
function createOntologyClient(config = {}) {
|
|
2530
2553
|
const gateway = createGatewayRequestClient(config);
|
|
2531
|
-
|
|
2554
|
+
const client = {
|
|
2532
2555
|
/**
|
|
2533
2556
|
* List ontology definitions matching optional filters.
|
|
2534
2557
|
*/
|
|
@@ -2537,13 +2560,14 @@ function createOntologyClient(config = {}) {
|
|
|
2537
2560
|
path: `/api/platform/v1/ontologies${toQueryString(filters)}`
|
|
2538
2561
|
}).then(
|
|
2539
2562
|
(response) => mapGatewayData(response, (data) => {
|
|
2540
|
-
const record =
|
|
2541
|
-
const ontologies =
|
|
2542
|
-
const
|
|
2563
|
+
const record = asRecord(data);
|
|
2564
|
+
const ontologies = asListItems(data, "ontologies");
|
|
2565
|
+
const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
|
|
2566
|
+
const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
|
|
2543
2567
|
return {
|
|
2544
2568
|
...record,
|
|
2545
|
-
...createListResult(
|
|
2546
|
-
ontologies,
|
|
2569
|
+
...createListResult(definitions, "definitions"),
|
|
2570
|
+
ontologies: definitions,
|
|
2547
2571
|
total
|
|
2548
2572
|
};
|
|
2549
2573
|
})
|
|
@@ -2570,18 +2594,6 @@ function createOntologyClient(config = {}) {
|
|
|
2570
2594
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2571
2595
|
});
|
|
2572
2596
|
},
|
|
2573
|
-
/**
|
|
2574
|
-
* List ontology definitions.
|
|
2575
|
-
*/
|
|
2576
|
-
async listDefinitions(filters = {}) {
|
|
2577
|
-
return this.list(filters);
|
|
2578
|
-
},
|
|
2579
|
-
/**
|
|
2580
|
-
* Get an ontology definition.
|
|
2581
|
-
*/
|
|
2582
|
-
async getDefinition(id) {
|
|
2583
|
-
return this.get(id);
|
|
2584
|
-
},
|
|
2585
2597
|
/**
|
|
2586
2598
|
* Create an ontology definition.
|
|
2587
2599
|
*/
|
|
@@ -2623,7 +2635,7 @@ function createOntologyClient(config = {}) {
|
|
|
2623
2635
|
}).then(
|
|
2624
2636
|
(response) => mapGatewayData(
|
|
2625
2637
|
response,
|
|
2626
|
-
(data) => createListResult(
|
|
2638
|
+
(data) => createListResult(asListItems(data, "versions"), "versions")
|
|
2627
2639
|
)
|
|
2628
2640
|
);
|
|
2629
2641
|
},
|
|
@@ -2671,20 +2683,19 @@ function createOntologyClient(config = {}) {
|
|
|
2671
2683
|
(data) => createListResult(Array.isArray(data) ? data : [], "topics")
|
|
2672
2684
|
)
|
|
2673
2685
|
);
|
|
2674
|
-
},
|
|
2675
|
-
/**
|
|
2676
|
-
* @deprecated Use listTopics.
|
|
2677
|
-
*/
|
|
2678
|
-
async listTopicsByOntology(ontologyId) {
|
|
2679
|
-
return this.listTopics(ontologyId);
|
|
2680
2686
|
}
|
|
2681
2687
|
};
|
|
2688
|
+
return Object.assign(client, {
|
|
2689
|
+
listDefinitions: client.list,
|
|
2690
|
+
getDefinition: client.get,
|
|
2691
|
+
listTopicsByOntology: client.listTopics
|
|
2692
|
+
});
|
|
2682
2693
|
}
|
|
2683
2694
|
|
|
2684
2695
|
// ../sdk/src/graphClient.ts
|
|
2685
2696
|
function createGraphClient(config = {}) {
|
|
2686
2697
|
const gateway = createGatewayRequestClient(config);
|
|
2687
|
-
|
|
2698
|
+
const client = {
|
|
2688
2699
|
/**
|
|
2689
2700
|
* List graph nodes matching the provided filters.
|
|
2690
2701
|
*/
|
|
@@ -2697,12 +2708,6 @@ function createGraphClient(config = {}) {
|
|
|
2697
2708
|
(response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
|
|
2698
2709
|
);
|
|
2699
2710
|
},
|
|
2700
|
-
/**
|
|
2701
|
-
* @deprecated Use listNodes.
|
|
2702
|
-
*/
|
|
2703
|
-
async queryNodes(query5) {
|
|
2704
|
-
return this.listNodes(query5);
|
|
2705
|
-
},
|
|
2706
2711
|
/**
|
|
2707
2712
|
* Retrieve a single graph node by nodeId or globalId.
|
|
2708
2713
|
*/
|
|
@@ -2813,12 +2818,6 @@ function createGraphClient(config = {}) {
|
|
|
2813
2818
|
)
|
|
2814
2819
|
);
|
|
2815
2820
|
},
|
|
2816
|
-
/**
|
|
2817
|
-
* @deprecated Use listEdges.
|
|
2818
|
-
*/
|
|
2819
|
-
async queryEdges(query5) {
|
|
2820
|
-
return this.listEdges(query5);
|
|
2821
|
-
},
|
|
2822
2821
|
/**
|
|
2823
2822
|
* Create a graph edge.
|
|
2824
2823
|
*/
|
|
@@ -2906,12 +2905,6 @@ function createGraphClient(config = {}) {
|
|
|
2906
2905
|
body: normalizeTopicQuery(query5)
|
|
2907
2906
|
});
|
|
2908
2907
|
},
|
|
2909
|
-
/**
|
|
2910
|
-
* Retrieve a graph neighborhood around a root node.
|
|
2911
|
-
*/
|
|
2912
|
-
async getNeighborhood(query5) {
|
|
2913
|
-
return this.neighborhood(query5);
|
|
2914
|
-
},
|
|
2915
2908
|
/**
|
|
2916
2909
|
* Retrieve the shortest known path between two graph nodes.
|
|
2917
2910
|
*/
|
|
@@ -2929,6 +2922,11 @@ function createGraphClient(config = {}) {
|
|
|
2929
2922
|
});
|
|
2930
2923
|
}
|
|
2931
2924
|
};
|
|
2925
|
+
return Object.assign(client, {
|
|
2926
|
+
queryNodes: client.listNodes,
|
|
2927
|
+
queryEdges: client.listEdges,
|
|
2928
|
+
getNeighborhood: client.neighborhood
|
|
2929
|
+
});
|
|
2932
2930
|
}
|
|
2933
2931
|
|
|
2934
2932
|
// ../sdk/src/identityClient.ts
|
|
@@ -2982,6 +2980,13 @@ function createIdentityClient(config = {}) {
|
|
|
2982
2980
|
body: input,
|
|
2983
2981
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2984
2982
|
});
|
|
2983
|
+
const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
2984
|
+
const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
|
|
2985
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
2986
|
+
method: "POST",
|
|
2987
|
+
body: input,
|
|
2988
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2989
|
+
});
|
|
2985
2990
|
return {
|
|
2986
2991
|
/**
|
|
2987
2992
|
* Resolve the current authenticated identity summary.
|
|
@@ -3030,15 +3035,11 @@ function createIdentityClient(config = {}) {
|
|
|
3030
3035
|
/**
|
|
3031
3036
|
* Update a principal.
|
|
3032
3037
|
*/
|
|
3033
|
-
|
|
3034
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
3035
|
-
},
|
|
3038
|
+
updatePrincipal,
|
|
3036
3039
|
/**
|
|
3037
3040
|
* @deprecated Use createPrincipal or updatePrincipal.
|
|
3038
3041
|
*/
|
|
3039
|
-
|
|
3040
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
3041
|
-
},
|
|
3042
|
+
upsertPrincipal: updatePrincipal,
|
|
3042
3043
|
/**
|
|
3043
3044
|
* List keys in the current identity scope.
|
|
3044
3045
|
*/
|
|
@@ -3077,20 +3078,11 @@ function createIdentityClient(config = {}) {
|
|
|
3077
3078
|
/**
|
|
3078
3079
|
* Delete an API key by revoking it.
|
|
3079
3080
|
*/
|
|
3080
|
-
|
|
3081
|
-
return gateway.request({
|
|
3082
|
-
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
3083
|
-
method: "POST",
|
|
3084
|
-
body: input,
|
|
3085
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
3086
|
-
});
|
|
3087
|
-
},
|
|
3081
|
+
deleteKey,
|
|
3088
3082
|
/**
|
|
3089
3083
|
* @deprecated Use deleteKey.
|
|
3090
3084
|
*/
|
|
3091
|
-
|
|
3092
|
-
return this.deleteKey(keyId, input, idempotencyKey);
|
|
3093
|
-
},
|
|
3085
|
+
revokeKey: deleteKey,
|
|
3094
3086
|
/**
|
|
3095
3087
|
* Search Clerk users by email or display attributes.
|
|
3096
3088
|
*/
|
|
@@ -3206,14 +3198,11 @@ function createIdentityClient(config = {}) {
|
|
|
3206
3198
|
}
|
|
3207
3199
|
|
|
3208
3200
|
// ../sdk/src/topicsClient.ts
|
|
3209
|
-
function asRecord3(value) {
|
|
3210
|
-
return value && typeof value === "object" ? value : {};
|
|
3211
|
-
}
|
|
3212
3201
|
function cleanString3(value) {
|
|
3213
3202
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
3214
3203
|
}
|
|
3215
3204
|
function normalizeTopicRecord(value) {
|
|
3216
|
-
const record =
|
|
3205
|
+
const record = asRecord(value);
|
|
3217
3206
|
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
3218
3207
|
return withTopicAlias({
|
|
3219
3208
|
...record,
|
|
@@ -3238,7 +3227,7 @@ function createTopicsClient(config = {}) {
|
|
|
3238
3227
|
})}`
|
|
3239
3228
|
}).then(
|
|
3240
3229
|
(response) => mapGatewayData(response, (data) => {
|
|
3241
|
-
const record =
|
|
3230
|
+
const record = asRecord(data);
|
|
3242
3231
|
const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
|
|
3243
3232
|
return {
|
|
3244
3233
|
...createListResult(items, "topics"),
|
|
@@ -3255,7 +3244,7 @@ function createTopicsClient(config = {}) {
|
|
|
3255
3244
|
}).then(
|
|
3256
3245
|
(response) => mapGatewayData(
|
|
3257
3246
|
response,
|
|
3258
|
-
(data) => normalizeTopicRecord(
|
|
3247
|
+
(data) => normalizeTopicRecord(asRecord(data).topic ?? data)
|
|
3259
3248
|
)
|
|
3260
3249
|
);
|
|
3261
3250
|
},
|
|
@@ -3291,7 +3280,7 @@ function createTopicsClient(config = {}) {
|
|
|
3291
3280
|
)}`
|
|
3292
3281
|
}).then(
|
|
3293
3282
|
(response) => mapGatewayData(response, (data) => {
|
|
3294
|
-
const record =
|
|
3283
|
+
const record = asRecord(data);
|
|
3295
3284
|
return {
|
|
3296
3285
|
tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
|
|
3297
3286
|
};
|
|
@@ -3710,7 +3699,7 @@ function createEventsFacade(config = {}) {
|
|
|
3710
3699
|
function createGraphFacade(config = {}) {
|
|
3711
3700
|
const graphClient = createGraphClient(config);
|
|
3712
3701
|
const gateway = createGatewayRequestClient(config);
|
|
3713
|
-
|
|
3702
|
+
const graphFacade = {
|
|
3714
3703
|
async neighborhood(input) {
|
|
3715
3704
|
return graphClient.neighborhood({
|
|
3716
3705
|
globalId: input.globalId,
|
|
@@ -3718,18 +3707,6 @@ function createGraphFacade(config = {}) {
|
|
|
3718
3707
|
maxDepth: input.maxDepth
|
|
3719
3708
|
});
|
|
3720
3709
|
},
|
|
3721
|
-
async traverse(input) {
|
|
3722
|
-
return graphClient.traverse(input);
|
|
3723
|
-
},
|
|
3724
|
-
async analyze(input = {}) {
|
|
3725
|
-
return graphClient.analyze(input);
|
|
3726
|
-
},
|
|
3727
|
-
async bias(input = {}) {
|
|
3728
|
-
return graphClient.bias(input);
|
|
3729
|
-
},
|
|
3730
|
-
async gaps(input) {
|
|
3731
|
-
return graphClient.gaps(input);
|
|
3732
|
-
},
|
|
3733
3710
|
async falsify(input, idempotencyKey = randomIdempotencyKey()) {
|
|
3734
3711
|
return gateway.request({
|
|
3735
3712
|
path: "/api/platform/v1/graph/falsify",
|
|
@@ -3739,6 +3716,12 @@ function createGraphFacade(config = {}) {
|
|
|
3739
3716
|
});
|
|
3740
3717
|
}
|
|
3741
3718
|
};
|
|
3719
|
+
return Object.assign(graphFacade, {
|
|
3720
|
+
traverse: graphClient.traverse,
|
|
3721
|
+
analyze: graphClient.analyze,
|
|
3722
|
+
bias: graphClient.bias,
|
|
3723
|
+
gaps: graphClient.gaps
|
|
3724
|
+
});
|
|
3742
3725
|
}
|
|
3743
3726
|
function createIdentityFacade(config = {}) {
|
|
3744
3727
|
const identityClient = createIdentityClient(config);
|
|
@@ -3752,15 +3735,12 @@ function createIdentityFacade(config = {}) {
|
|
|
3752
3735
|
function createOntologiesFacade(config = {}) {
|
|
3753
3736
|
const ontologyClient = createOntologyClient(config);
|
|
3754
3737
|
const gateway = createGatewayRequestClient(config);
|
|
3755
|
-
|
|
3738
|
+
const ontologyFacade = {
|
|
3756
3739
|
async get(id) {
|
|
3757
3740
|
return gateway.request({
|
|
3758
3741
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
3759
3742
|
});
|
|
3760
3743
|
},
|
|
3761
|
-
async list(query5 = {}) {
|
|
3762
|
-
return ontologyClient.list(query5);
|
|
3763
|
-
},
|
|
3764
3744
|
async bind(input, idempotencyKey) {
|
|
3765
3745
|
return gateway.request({
|
|
3766
3746
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
|
|
@@ -3780,6 +3760,9 @@ function createOntologiesFacade(config = {}) {
|
|
|
3780
3760
|
});
|
|
3781
3761
|
}
|
|
3782
3762
|
};
|
|
3763
|
+
return Object.assign(ontologyFacade, {
|
|
3764
|
+
list: ontologyClient.list
|
|
3765
|
+
});
|
|
3783
3766
|
}
|
|
3784
3767
|
function createQuestionsFacade(config = {}) {
|
|
3785
3768
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -3972,15 +3955,9 @@ function createTasksFacade(config = {}) {
|
|
|
3972
3955
|
function createTopicsFacade(config = {}) {
|
|
3973
3956
|
const topicsClient = createTopicsClient(config);
|
|
3974
3957
|
return {
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
async get(id) {
|
|
3979
|
-
return topicsClient.get(id);
|
|
3980
|
-
},
|
|
3981
|
-
async list(query5 = {}) {
|
|
3982
|
-
return topicsClient.list(query5);
|
|
3983
|
-
},
|
|
3958
|
+
create: topicsClient.create,
|
|
3959
|
+
get: topicsClient.get,
|
|
3960
|
+
list: topicsClient.list,
|
|
3984
3961
|
async update(input, idempotencyKey) {
|
|
3985
3962
|
const { id, ...rest } = input;
|
|
3986
3963
|
return topicsClient.update(id, rest, idempotencyKey);
|
|
@@ -3996,12 +3973,8 @@ function createTopicsFacade(config = {}) {
|
|
|
3996
3973
|
maxDepth: input.maxDepth
|
|
3997
3974
|
});
|
|
3998
3975
|
},
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
},
|
|
4002
|
-
async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
|
|
4003
|
-
return topicsClient.bulkCreate(input, idempotencyKey);
|
|
4004
|
-
}
|
|
3976
|
+
remove: topicsClient.remove,
|
|
3977
|
+
bulkCreate: topicsClient.bulkCreate
|
|
4005
3978
|
};
|
|
4006
3979
|
}
|
|
4007
3980
|
function createWebhooksFacade(config = {}) {
|
|
@@ -4201,7 +4174,7 @@ function createWorktreesFacade(config = {}) {
|
|
|
4201
4174
|
// ../sdk/src/decisionsClient.ts
|
|
4202
4175
|
function createDecisionsClient(config = {}) {
|
|
4203
4176
|
const gateway = createGatewayRequestClient(config);
|
|
4204
|
-
|
|
4177
|
+
const client = {
|
|
4205
4178
|
/**
|
|
4206
4179
|
* List judgments for a topic scope.
|
|
4207
4180
|
*/
|
|
@@ -4279,12 +4252,6 @@ function createDecisionsClient(config = {}) {
|
|
|
4279
4252
|
})
|
|
4280
4253
|
);
|
|
4281
4254
|
},
|
|
4282
|
-
/**
|
|
4283
|
-
* @deprecated Use listPendingOutcomeReviews.
|
|
4284
|
-
*/
|
|
4285
|
-
async listPendingJudgmentOutcomeReview(query5) {
|
|
4286
|
-
return this.listPendingOutcomeReviews(query5);
|
|
4287
|
-
},
|
|
4288
4255
|
/**
|
|
4289
4256
|
* Get audit integrity checks for judgment transitions.
|
|
4290
4257
|
*/
|
|
@@ -4317,12 +4284,6 @@ function createDecisionsClient(config = {}) {
|
|
|
4317
4284
|
)
|
|
4318
4285
|
);
|
|
4319
4286
|
},
|
|
4320
|
-
/**
|
|
4321
|
-
* @deprecated Use createJudgment.
|
|
4322
|
-
*/
|
|
4323
|
-
async recordJudgment(input, idempotencyKey) {
|
|
4324
|
-
return this.createJudgment(input, idempotencyKey);
|
|
4325
|
-
},
|
|
4326
4287
|
/**
|
|
4327
4288
|
* Update the outcome for an existing judgment.
|
|
4328
4289
|
*/
|
|
@@ -4333,14 +4294,13 @@ function createDecisionsClient(config = {}) {
|
|
|
4333
4294
|
body: input,
|
|
4334
4295
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4335
4296
|
});
|
|
4336
|
-
},
|
|
4337
|
-
/**
|
|
4338
|
-
* @deprecated Use updateJudgmentOutcome.
|
|
4339
|
-
*/
|
|
4340
|
-
async recordJudgmentOutcome(judgmentId, input, idempotencyKey) {
|
|
4341
|
-
return this.updateJudgmentOutcome(judgmentId, input, idempotencyKey);
|
|
4342
4297
|
}
|
|
4343
4298
|
};
|
|
4299
|
+
return Object.assign(client, {
|
|
4300
|
+
listPendingJudgmentOutcomeReview: client.listPendingOutcomeReviews,
|
|
4301
|
+
recordJudgment: client.createJudgment,
|
|
4302
|
+
recordJudgmentOutcome: client.updateJudgmentOutcome
|
|
4303
|
+
});
|
|
4344
4304
|
}
|
|
4345
4305
|
|
|
4346
4306
|
// ../sdk/src/embeddingsClient.ts
|
|
@@ -4964,7 +4924,7 @@ function createGraphStateClassifierClient(config = {}) {
|
|
|
4964
4924
|
// ../sdk/src/harnessClient.ts
|
|
4965
4925
|
function createHarnessClient(config = {}) {
|
|
4966
4926
|
const gateway = createGatewayRequestClient(config);
|
|
4967
|
-
|
|
4927
|
+
const client = {
|
|
4968
4928
|
/**
|
|
4969
4929
|
* List agent definitions.
|
|
4970
4930
|
*/
|
|
@@ -4997,12 +4957,6 @@ function createHarnessClient(config = {}) {
|
|
|
4997
4957
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4998
4958
|
});
|
|
4999
4959
|
},
|
|
5000
|
-
/**
|
|
5001
|
-
* @deprecated Use createAgentDefinition.
|
|
5002
|
-
*/
|
|
5003
|
-
async registerAgentDefinition(input, idempotencyKey) {
|
|
5004
|
-
return this.createAgentDefinition(input, idempotencyKey);
|
|
5005
|
-
},
|
|
5006
4960
|
/**
|
|
5007
4961
|
* Update an agent definition.
|
|
5008
4962
|
*/
|
|
@@ -5041,12 +4995,6 @@ function createHarnessClient(config = {}) {
|
|
|
5041
4995
|
)
|
|
5042
4996
|
);
|
|
5043
4997
|
},
|
|
5044
|
-
/**
|
|
5045
|
-
* @deprecated Use listAgentRuns.
|
|
5046
|
-
*/
|
|
5047
|
-
async listRunsForAgent(agentId, scope = {}) {
|
|
5048
|
-
return this.listAgentRuns(agentId, scope);
|
|
5049
|
-
},
|
|
5050
4998
|
/**
|
|
5051
4999
|
* List tool definitions.
|
|
5052
5000
|
*/
|
|
@@ -5079,12 +5027,6 @@ function createHarnessClient(config = {}) {
|
|
|
5079
5027
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5080
5028
|
});
|
|
5081
5029
|
},
|
|
5082
|
-
/**
|
|
5083
|
-
* @deprecated Use createToolDefinition.
|
|
5084
|
-
*/
|
|
5085
|
-
async registerToolDefinition(input, idempotencyKey) {
|
|
5086
|
-
return this.createToolDefinition(input, idempotencyKey);
|
|
5087
|
-
},
|
|
5088
5030
|
/**
|
|
5089
5031
|
* Update a tool definition.
|
|
5090
5032
|
*/
|
|
@@ -5119,12 +5061,6 @@ function createHarnessClient(config = {}) {
|
|
|
5119
5061
|
)
|
|
5120
5062
|
);
|
|
5121
5063
|
},
|
|
5122
|
-
/**
|
|
5123
|
-
* @deprecated Use listRunEntries.
|
|
5124
|
-
*/
|
|
5125
|
-
async listRunLedgerEntries(scope = {}) {
|
|
5126
|
-
return this.listRunEntries(scope);
|
|
5127
|
-
},
|
|
5128
5064
|
/**
|
|
5129
5065
|
* Create a harness run.
|
|
5130
5066
|
*/
|
|
@@ -5199,6 +5135,12 @@ function createHarnessClient(config = {}) {
|
|
|
5199
5135
|
});
|
|
5200
5136
|
}
|
|
5201
5137
|
};
|
|
5138
|
+
return Object.assign(client, {
|
|
5139
|
+
registerAgentDefinition: client.createAgentDefinition,
|
|
5140
|
+
listRunsForAgent: client.listAgentRuns,
|
|
5141
|
+
registerToolDefinition: client.createToolDefinition,
|
|
5142
|
+
listRunLedgerEntries: client.listRunEntries
|
|
5143
|
+
});
|
|
5202
5144
|
}
|
|
5203
5145
|
|
|
5204
5146
|
// ../sdk/src/jobsClient.ts
|
|
@@ -5326,45 +5268,41 @@ function createJobsClient(config = {}) {
|
|
|
5326
5268
|
// ../sdk/src/learningClient.ts
|
|
5327
5269
|
function createLearningClient(config = {}) {
|
|
5328
5270
|
const gateway = createGatewayRequestClient(config);
|
|
5271
|
+
const listRecentExecutions = async (args = {}) => gateway.request({
|
|
5272
|
+
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
5273
|
+
...normalizeTopicQuery(args),
|
|
5274
|
+
namespace: args.namespace,
|
|
5275
|
+
audienceMode: args.audienceMode,
|
|
5276
|
+
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
5277
|
+
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
5278
|
+
})}`
|
|
5279
|
+
}).then(
|
|
5280
|
+
(response) => mapGatewayData(
|
|
5281
|
+
response,
|
|
5282
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
5283
|
+
)
|
|
5284
|
+
);
|
|
5285
|
+
const getExecutionStats = async (args = {}) => gateway.request({
|
|
5286
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
5287
|
+
...normalizeTopicQuery(args),
|
|
5288
|
+
namespace: args.namespace,
|
|
5289
|
+
audienceMode: args.audienceMode,
|
|
5290
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
5291
|
+
})}`
|
|
5292
|
+
});
|
|
5329
5293
|
return {
|
|
5330
5294
|
/**
|
|
5331
5295
|
* List recent execution records.
|
|
5332
5296
|
*/
|
|
5333
|
-
|
|
5334
|
-
return gateway.request({
|
|
5335
|
-
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
5336
|
-
...normalizeTopicQuery(args),
|
|
5337
|
-
namespace: args.namespace,
|
|
5338
|
-
audienceMode: args.audienceMode,
|
|
5339
|
-
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
5340
|
-
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
5341
|
-
})}`
|
|
5342
|
-
}).then(
|
|
5343
|
-
(response) => mapGatewayData(
|
|
5344
|
-
response,
|
|
5345
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
5346
|
-
)
|
|
5347
|
-
);
|
|
5348
|
-
},
|
|
5297
|
+
listRecentExecutions,
|
|
5349
5298
|
/**
|
|
5350
5299
|
* @deprecated Use listRecentExecutions.
|
|
5351
5300
|
*/
|
|
5352
|
-
|
|
5353
|
-
return this.listRecentExecutions(args);
|
|
5354
|
-
},
|
|
5301
|
+
getRecentExecutions: listRecentExecutions,
|
|
5355
5302
|
/**
|
|
5356
5303
|
* Get aggregate execution statistics.
|
|
5357
5304
|
*/
|
|
5358
|
-
|
|
5359
|
-
return gateway.request({
|
|
5360
|
-
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
5361
|
-
...normalizeTopicQuery(args),
|
|
5362
|
-
namespace: args.namespace,
|
|
5363
|
-
audienceMode: args.audienceMode,
|
|
5364
|
-
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
5365
|
-
})}`
|
|
5366
|
-
});
|
|
5367
|
-
}
|
|
5305
|
+
getExecutionStats
|
|
5368
5306
|
};
|
|
5369
5307
|
}
|
|
5370
5308
|
|
|
@@ -6401,7 +6339,7 @@ function createOrgGraphSearchClient(config = {}) {
|
|
|
6401
6339
|
// ../sdk/src/packsClient.ts
|
|
6402
6340
|
function createPacksClient(config = {}) {
|
|
6403
6341
|
const gateway = createGatewayRequestClient(config);
|
|
6404
|
-
|
|
6342
|
+
const client = {
|
|
6405
6343
|
/**
|
|
6406
6344
|
* List catalog entries for available packs.
|
|
6407
6345
|
*/
|
|
@@ -6415,12 +6353,6 @@ function createPacksClient(config = {}) {
|
|
|
6415
6353
|
)
|
|
6416
6354
|
);
|
|
6417
6355
|
},
|
|
6418
|
-
/**
|
|
6419
|
-
* @deprecated Use listCatalog.
|
|
6420
|
-
*/
|
|
6421
|
-
async getCatalog() {
|
|
6422
|
-
return this.listCatalog();
|
|
6423
|
-
},
|
|
6424
6356
|
/**
|
|
6425
6357
|
* Get the discovery catalog for packs.
|
|
6426
6358
|
*/
|
|
@@ -6450,12 +6382,6 @@ function createPacksClient(config = {}) {
|
|
|
6450
6382
|
)
|
|
6451
6383
|
);
|
|
6452
6384
|
},
|
|
6453
|
-
/**
|
|
6454
|
-
* @deprecated Use listStates.
|
|
6455
|
-
*/
|
|
6456
|
-
async getStates(query5 = {}) {
|
|
6457
|
-
return this.listStates(query5);
|
|
6458
|
-
},
|
|
6459
6385
|
/**
|
|
6460
6386
|
* Get health details for a pack.
|
|
6461
6387
|
*/
|
|
@@ -6479,12 +6405,6 @@ function createPacksClient(config = {}) {
|
|
|
6479
6405
|
)
|
|
6480
6406
|
);
|
|
6481
6407
|
},
|
|
6482
|
-
/**
|
|
6483
|
-
* @deprecated Use listTelemetry.
|
|
6484
|
-
*/
|
|
6485
|
-
async getTelemetry(query5 = {}) {
|
|
6486
|
-
return this.listTelemetry(query5);
|
|
6487
|
-
},
|
|
6488
6408
|
/**
|
|
6489
6409
|
* Create a pack entitlement.
|
|
6490
6410
|
*/
|
|
@@ -6496,18 +6416,6 @@ function createPacksClient(config = {}) {
|
|
|
6496
6416
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6497
6417
|
});
|
|
6498
6418
|
},
|
|
6499
|
-
/**
|
|
6500
|
-
* Update a pack entitlement.
|
|
6501
|
-
*/
|
|
6502
|
-
async updateEntitlement(input, idempotencyKey) {
|
|
6503
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6504
|
-
},
|
|
6505
|
-
/**
|
|
6506
|
-
* @deprecated Use createEntitlement or updateEntitlement.
|
|
6507
|
-
*/
|
|
6508
|
-
async upsertEntitlement(input, idempotencyKey) {
|
|
6509
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6510
|
-
},
|
|
6511
6419
|
/**
|
|
6512
6420
|
* Install a pack.
|
|
6513
6421
|
*/
|
|
@@ -6564,6 +6472,13 @@ function createPacksClient(config = {}) {
|
|
|
6564
6472
|
});
|
|
6565
6473
|
}
|
|
6566
6474
|
};
|
|
6475
|
+
return Object.assign(client, {
|
|
6476
|
+
getCatalog: client.listCatalog,
|
|
6477
|
+
getStates: client.listStates,
|
|
6478
|
+
getTelemetry: client.listTelemetry,
|
|
6479
|
+
updateEntitlement: client.createEntitlement,
|
|
6480
|
+
upsertEntitlement: client.createEntitlement
|
|
6481
|
+
});
|
|
6567
6482
|
}
|
|
6568
6483
|
|
|
6569
6484
|
// ../sdk/src/policyClient.ts
|
|
@@ -6599,6 +6514,14 @@ function asRolePolicyArray(data) {
|
|
|
6599
6514
|
}
|
|
6600
6515
|
return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
|
|
6601
6516
|
}
|
|
6517
|
+
function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
|
|
6518
|
+
const result = {};
|
|
6519
|
+
result.permission = permission;
|
|
6520
|
+
result.allowedTopicIds = allowedTopicIds;
|
|
6521
|
+
result.deniedTopics = deniedTopics;
|
|
6522
|
+
result.count = count;
|
|
6523
|
+
return result;
|
|
6524
|
+
}
|
|
6602
6525
|
function createPolicyClient(config = {}) {
|
|
6603
6526
|
const gateway = createGatewayRequestClient(config);
|
|
6604
6527
|
return {
|
|
@@ -6821,15 +6744,15 @@ function createPolicyClient(config = {}) {
|
|
|
6821
6744
|
});
|
|
6822
6745
|
const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
|
|
6823
6746
|
const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6747
|
+
const result = {};
|
|
6748
|
+
result.success = true;
|
|
6749
|
+
result.data = buildFilterByPermissionResponse(
|
|
6750
|
+
permission,
|
|
6751
|
+
allowedTopicIds,
|
|
6752
|
+
deniedTopics,
|
|
6753
|
+
typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
|
|
6754
|
+
);
|
|
6755
|
+
return result;
|
|
6833
6756
|
}
|
|
6834
6757
|
};
|
|
6835
6758
|
}
|
|
@@ -6837,64 +6760,66 @@ function createPolicyClient(config = {}) {
|
|
|
6837
6760
|
// ../sdk/src/reportsClient.ts
|
|
6838
6761
|
function createReportsClient(config = {}) {
|
|
6839
6762
|
const gateway = createGatewayRequestClient(config);
|
|
6763
|
+
const listTemplates = async (args = {}) => gateway.request({
|
|
6764
|
+
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
6765
|
+
slug: args.slug
|
|
6766
|
+
})}`
|
|
6767
|
+
}).then(
|
|
6768
|
+
(response) => mapGatewayData(response, (data) => {
|
|
6769
|
+
const rows = asListItems(data, "templates");
|
|
6770
|
+
return createListResult(rows, "templates");
|
|
6771
|
+
})
|
|
6772
|
+
);
|
|
6773
|
+
const listReports = async (input, args = {}) => {
|
|
6774
|
+
const topicId = resolveTopicId(input);
|
|
6775
|
+
if (!topicId) {
|
|
6776
|
+
throw new Error("topicId is required");
|
|
6777
|
+
}
|
|
6778
|
+
return gateway.request({
|
|
6779
|
+
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
6780
|
+
{
|
|
6781
|
+
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
6782
|
+
}
|
|
6783
|
+
)}`
|
|
6784
|
+
}).then(
|
|
6785
|
+
(response) => mapGatewayData(
|
|
6786
|
+
response,
|
|
6787
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
6788
|
+
)
|
|
6789
|
+
);
|
|
6790
|
+
};
|
|
6791
|
+
const getReport = async (reportId) => gateway.request({
|
|
6792
|
+
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
6793
|
+
});
|
|
6840
6794
|
return {
|
|
6841
6795
|
/**
|
|
6842
6796
|
* List report templates.
|
|
6843
6797
|
*/
|
|
6844
|
-
|
|
6845
|
-
return gateway.request({
|
|
6846
|
-
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
6847
|
-
slug: args.slug
|
|
6848
|
-
})}`
|
|
6849
|
-
}).then(
|
|
6850
|
-
(response) => mapGatewayData(response, (data) => {
|
|
6851
|
-
const record = data && typeof data === "object" ? data : {};
|
|
6852
|
-
const rows = Array.isArray(data) ? data : Array.isArray(record.templates) ? record.templates : [];
|
|
6853
|
-
return createListResult(rows, "templates");
|
|
6854
|
-
})
|
|
6855
|
-
);
|
|
6856
|
-
},
|
|
6798
|
+
listTemplates,
|
|
6857
6799
|
/**
|
|
6858
6800
|
* @deprecated Use listTemplates.
|
|
6859
6801
|
*/
|
|
6860
|
-
|
|
6861
|
-
return this.listTemplates(args);
|
|
6862
|
-
},
|
|
6802
|
+
getTemplates: listTemplates,
|
|
6863
6803
|
/**
|
|
6864
6804
|
* List reports for a topic scope.
|
|
6865
6805
|
*/
|
|
6866
|
-
|
|
6867
|
-
const topicId = resolveTopicId(input);
|
|
6868
|
-
if (!topicId) {
|
|
6869
|
-
throw new Error("topicId is required");
|
|
6870
|
-
}
|
|
6871
|
-
return gateway.request({
|
|
6872
|
-
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
6873
|
-
{
|
|
6874
|
-
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
6875
|
-
}
|
|
6876
|
-
)}`
|
|
6877
|
-
}).then(
|
|
6878
|
-
(response) => mapGatewayData(
|
|
6879
|
-
response,
|
|
6880
|
-
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
6881
|
-
)
|
|
6882
|
-
);
|
|
6883
|
-
},
|
|
6806
|
+
listReports,
|
|
6884
6807
|
/**
|
|
6885
6808
|
* Get a generated report.
|
|
6886
6809
|
*/
|
|
6887
|
-
|
|
6888
|
-
return gateway.request({
|
|
6889
|
-
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
6890
|
-
});
|
|
6891
|
-
}
|
|
6810
|
+
getReport
|
|
6892
6811
|
};
|
|
6893
6812
|
}
|
|
6894
6813
|
|
|
6895
6814
|
// ../sdk/src/schemaClient.ts
|
|
6896
6815
|
function createSchemaClient(config = {}) {
|
|
6897
6816
|
const gateway = createGatewayRequestClient(config);
|
|
6817
|
+
const createEntitlement = (input, idempotencyKey) => gateway.request({
|
|
6818
|
+
path: "/api/platform/v1/schema/entitlements",
|
|
6819
|
+
method: "POST",
|
|
6820
|
+
body: input,
|
|
6821
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6822
|
+
});
|
|
6898
6823
|
return {
|
|
6899
6824
|
/**
|
|
6900
6825
|
* List schema packs.
|
|
@@ -6946,29 +6871,95 @@ function createSchemaClient(config = {}) {
|
|
|
6946
6871
|
/**
|
|
6947
6872
|
* Create a schema entitlement.
|
|
6948
6873
|
*/
|
|
6949
|
-
|
|
6950
|
-
return gateway.request({
|
|
6951
|
-
path: "/api/platform/v1/schema/entitlements",
|
|
6952
|
-
method: "POST",
|
|
6953
|
-
body: input,
|
|
6954
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6955
|
-
});
|
|
6956
|
-
},
|
|
6874
|
+
createEntitlement,
|
|
6957
6875
|
/**
|
|
6958
6876
|
* Update a schema entitlement.
|
|
6959
6877
|
*/
|
|
6960
|
-
|
|
6961
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6962
|
-
},
|
|
6878
|
+
updateEntitlement: createEntitlement,
|
|
6963
6879
|
/**
|
|
6964
6880
|
* @deprecated Use createEntitlement or updateEntitlement.
|
|
6965
6881
|
*/
|
|
6966
|
-
|
|
6967
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6968
|
-
}
|
|
6882
|
+
upsertEntitlement: createEntitlement
|
|
6969
6883
|
};
|
|
6970
6884
|
}
|
|
6971
6885
|
|
|
6886
|
+
// ../sdk/src/clientHelpers.ts
|
|
6887
|
+
function asNodeArray(data) {
|
|
6888
|
+
const rows = asListItems(data, "nodes");
|
|
6889
|
+
if (rows.length > 0) {
|
|
6890
|
+
return rows.filter(
|
|
6891
|
+
(value) => Boolean(value) && typeof value === "object"
|
|
6892
|
+
);
|
|
6893
|
+
}
|
|
6894
|
+
if (data && typeof data === "object") {
|
|
6895
|
+
return [data];
|
|
6896
|
+
}
|
|
6897
|
+
return [];
|
|
6898
|
+
}
|
|
6899
|
+
function requireTopicId4(args) {
|
|
6900
|
+
const topicId = resolveTopicId(args);
|
|
6901
|
+
if (!topicId) {
|
|
6902
|
+
throw new Error("topicId is required");
|
|
6903
|
+
}
|
|
6904
|
+
return topicId;
|
|
6905
|
+
}
|
|
6906
|
+
function requireTopicOrProjectId(args) {
|
|
6907
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
6908
|
+
if (!topicId) {
|
|
6909
|
+
throw new Error("topicId is required");
|
|
6910
|
+
}
|
|
6911
|
+
return topicId;
|
|
6912
|
+
}
|
|
6913
|
+
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
6914
|
+
function matchesAuditNodeReference(value, nodeId) {
|
|
6915
|
+
if (Array.isArray(value)) {
|
|
6916
|
+
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
6917
|
+
}
|
|
6918
|
+
if (!value || typeof value !== "object") {
|
|
6919
|
+
return false;
|
|
6920
|
+
}
|
|
6921
|
+
return Object.entries(value).some(([key, entry]) => {
|
|
6922
|
+
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
6923
|
+
return true;
|
|
6924
|
+
}
|
|
6925
|
+
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
6926
|
+
return true;
|
|
6927
|
+
}
|
|
6928
|
+
return matchesAuditNodeReference(entry, nodeId);
|
|
6929
|
+
});
|
|
6930
|
+
}
|
|
6931
|
+
function requireText(args) {
|
|
6932
|
+
const text = resolveText(args);
|
|
6933
|
+
if (!text) {
|
|
6934
|
+
throw new Error("text is required");
|
|
6935
|
+
}
|
|
6936
|
+
return text;
|
|
6937
|
+
}
|
|
6938
|
+
function requireBaseRate(args) {
|
|
6939
|
+
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
6940
|
+
if (baseRate < 0 || baseRate > 1) {
|
|
6941
|
+
throw new Error("baseRate must be within [0, 1].");
|
|
6942
|
+
}
|
|
6943
|
+
return baseRate;
|
|
6944
|
+
}
|
|
6945
|
+
function sdkQueryString(input) {
|
|
6946
|
+
const params = new URLSearchParams();
|
|
6947
|
+
for (const [key, value] of Object.entries(input)) {
|
|
6948
|
+
if (value === void 0 || value === null) {
|
|
6949
|
+
continue;
|
|
6950
|
+
}
|
|
6951
|
+
if (Array.isArray(value)) {
|
|
6952
|
+
if (value.length > 0) {
|
|
6953
|
+
params.set(key, value.join(","));
|
|
6954
|
+
}
|
|
6955
|
+
continue;
|
|
6956
|
+
}
|
|
6957
|
+
params.set(key, String(value));
|
|
6958
|
+
}
|
|
6959
|
+
const serialized = params.toString();
|
|
6960
|
+
return serialized ? `?${serialized}` : "";
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6972
6963
|
// ../sdk/src/telemetryClient.ts
|
|
6973
6964
|
var TELEMETRY_FIELDS = [
|
|
6974
6965
|
"tenantId",
|
|
@@ -7139,6 +7130,16 @@ function query4(input) {
|
|
|
7139
7130
|
cursor: input.cursor
|
|
7140
7131
|
};
|
|
7141
7132
|
}
|
|
7133
|
+
function effectiveToolsQuery(input) {
|
|
7134
|
+
return {
|
|
7135
|
+
...query4(input),
|
|
7136
|
+
callerRole: input.callerRole,
|
|
7137
|
+
surface: input.surface,
|
|
7138
|
+
sessionType: input.sessionType,
|
|
7139
|
+
permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
|
|
7140
|
+
executableOnly: input.executableOnly
|
|
7141
|
+
};
|
|
7142
|
+
}
|
|
7142
7143
|
function writeBody(input, operation) {
|
|
7143
7144
|
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
7144
7145
|
}
|
|
@@ -7167,7 +7168,9 @@ function createToolRegistryClient(config = {}) {
|
|
|
7167
7168
|
},
|
|
7168
7169
|
listEffectiveTools(input) {
|
|
7169
7170
|
return gateway.request({
|
|
7170
|
-
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
7171
|
+
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
7172
|
+
effectiveToolsQuery(input)
|
|
7173
|
+
)}`
|
|
7171
7174
|
}).then(
|
|
7172
7175
|
(response) => mapGatewayData(
|
|
7173
7176
|
response,
|
|
@@ -7258,7 +7261,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
7258
7261
|
}
|
|
7259
7262
|
|
|
7260
7263
|
// ../sdk/src/version.ts
|
|
7261
|
-
var LUCERN_SDK_VERSION = "0.
|
|
7264
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.7";
|
|
7262
7265
|
|
|
7263
7266
|
// ../sdk/src/workflowClient.ts
|
|
7264
7267
|
function normalizeLensQuery(value) {
|
|
@@ -7452,12 +7455,6 @@ function createWorkflowClient(config = {}) {
|
|
|
7452
7455
|
)
|
|
7453
7456
|
);
|
|
7454
7457
|
},
|
|
7455
|
-
/**
|
|
7456
|
-
* @deprecated Use createWorktree.
|
|
7457
|
-
*/
|
|
7458
|
-
async addWorktree(input, idempotencyKey) {
|
|
7459
|
-
return client.createWorktree(input, idempotencyKey);
|
|
7460
|
-
},
|
|
7461
7458
|
/**
|
|
7462
7459
|
* Merge a worktree into the main belief line.
|
|
7463
7460
|
*/
|
|
@@ -7655,54 +7652,19 @@ function createWorkflowClient(config = {}) {
|
|
|
7655
7652
|
body: input,
|
|
7656
7653
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7657
7654
|
});
|
|
7658
|
-
},
|
|
7659
|
-
/**
|
|
7660
|
-
* @deprecated Use createBranch.
|
|
7661
|
-
*/
|
|
7662
|
-
async createPillar(input, idempotencyKey) {
|
|
7663
|
-
return client.createBranch(input, idempotencyKey);
|
|
7664
|
-
},
|
|
7665
|
-
/**
|
|
7666
|
-
* @deprecated Use addWorktree.
|
|
7667
|
-
*/
|
|
7668
|
-
async createSprint(input, idempotencyKey) {
|
|
7669
|
-
return client.createWorktree(input, idempotencyKey);
|
|
7670
|
-
},
|
|
7671
|
-
/**
|
|
7672
|
-
* @deprecated Use merge.
|
|
7673
|
-
*/
|
|
7674
|
-
async completeSprint(worktreeId, input, idempotencyKey) {
|
|
7675
|
-
return client.merge(worktreeId, input, idempotencyKey);
|
|
7676
|
-
},
|
|
7677
|
-
/**
|
|
7678
|
-
* @deprecated Use openPullRequest.
|
|
7679
|
-
*/
|
|
7680
|
-
async requestReview(worktreeId, input, idempotencyKey) {
|
|
7681
|
-
return client.openPullRequest(worktreeId, input, idempotencyKey);
|
|
7682
|
-
},
|
|
7683
|
-
/**
|
|
7684
|
-
* @deprecated Use push.
|
|
7685
|
-
*/
|
|
7686
|
-
async publishFindings(worktreeId, input, idempotencyKey) {
|
|
7687
|
-
return client.push(worktreeId, input, idempotencyKey);
|
|
7688
7655
|
}
|
|
7689
7656
|
};
|
|
7690
|
-
return client
|
|
7657
|
+
return Object.assign(client, {
|
|
7658
|
+
addWorktree: client.createWorktree,
|
|
7659
|
+
createPillar: client.createBranch,
|
|
7660
|
+
createSprint: client.createWorktree,
|
|
7661
|
+
completeSprint: client.merge,
|
|
7662
|
+
requestReview: client.openPullRequest,
|
|
7663
|
+
publishFindings: client.push
|
|
7664
|
+
});
|
|
7691
7665
|
}
|
|
7692
7666
|
|
|
7693
7667
|
// ../sdk/src/client.ts
|
|
7694
|
-
function asNodeArray(data) {
|
|
7695
|
-
const rows = asListItems(data, "nodes");
|
|
7696
|
-
if (rows.length > 0) {
|
|
7697
|
-
return rows.filter(
|
|
7698
|
-
(value) => Boolean(value) && typeof value === "object"
|
|
7699
|
-
);
|
|
7700
|
-
}
|
|
7701
|
-
if (data && typeof data === "object") {
|
|
7702
|
-
return [data];
|
|
7703
|
-
}
|
|
7704
|
-
return [];
|
|
7705
|
-
}
|
|
7706
7668
|
function toGatewayConfig(config) {
|
|
7707
7669
|
return {
|
|
7708
7670
|
baseUrl: config.baseUrl,
|
|
@@ -7725,76 +7687,13 @@ function toGatewayConfig(config) {
|
|
|
7725
7687
|
}
|
|
7726
7688
|
if (config.environment && !base["x-lucern-environment"]) {
|
|
7727
7689
|
base["x-lucern-environment"] = config.environment;
|
|
7728
|
-
}
|
|
7729
|
-
return base;
|
|
7730
|
-
}
|
|
7731
|
-
};
|
|
7732
|
-
}
|
|
7733
|
-
function
|
|
7734
|
-
|
|
7735
|
-
if (!topicId) {
|
|
7736
|
-
throw new Error("topicId is required");
|
|
7737
|
-
}
|
|
7738
|
-
return topicId;
|
|
7739
|
-
}
|
|
7740
|
-
function requireTopicOrProjectId(args) {
|
|
7741
|
-
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
7742
|
-
if (!topicId) {
|
|
7743
|
-
throw new Error("topicId is required");
|
|
7744
|
-
}
|
|
7745
|
-
return topicId;
|
|
7746
|
-
}
|
|
7747
|
-
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
7748
|
-
function matchesAuditNodeReference(value, nodeId) {
|
|
7749
|
-
if (Array.isArray(value)) {
|
|
7750
|
-
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
7751
|
-
}
|
|
7752
|
-
if (!value || typeof value !== "object") {
|
|
7753
|
-
return false;
|
|
7754
|
-
}
|
|
7755
|
-
return Object.entries(value).some(([key, entry]) => {
|
|
7756
|
-
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
7757
|
-
return true;
|
|
7758
|
-
}
|
|
7759
|
-
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
7760
|
-
return true;
|
|
7761
|
-
}
|
|
7762
|
-
return matchesAuditNodeReference(entry, nodeId);
|
|
7763
|
-
});
|
|
7764
|
-
}
|
|
7765
|
-
function requireText(args) {
|
|
7766
|
-
const text = resolveText(args);
|
|
7767
|
-
if (!text) {
|
|
7768
|
-
throw new Error("text is required");
|
|
7769
|
-
}
|
|
7770
|
-
return text;
|
|
7771
|
-
}
|
|
7772
|
-
function requireBaseRate(args) {
|
|
7773
|
-
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
7774
|
-
if (baseRate < 0 || baseRate > 1) {
|
|
7775
|
-
throw new Error("baseRate must be within [0, 1].");
|
|
7776
|
-
}
|
|
7777
|
-
return baseRate;
|
|
7778
|
-
}
|
|
7779
|
-
function exposeGatewayData(response) {
|
|
7780
|
-
return Object.assign({}, response, response.data);
|
|
7781
|
-
}
|
|
7782
|
-
function sdkQueryString(input) {
|
|
7783
|
-
const params = new URLSearchParams();
|
|
7784
|
-
for (const [key, value] of Object.entries(input)) {
|
|
7785
|
-
if (value === void 0 || value === null) {
|
|
7786
|
-
continue;
|
|
7787
|
-
}
|
|
7788
|
-
if (Array.isArray(value)) {
|
|
7789
|
-
if (value.length > 0) {
|
|
7790
|
-
params.set(key, value.join(","));
|
|
7791
|
-
}
|
|
7792
|
-
continue;
|
|
7793
|
-
}
|
|
7794
|
-
params.set(key, String(value));
|
|
7795
|
-
}
|
|
7796
|
-
const serialized = params.toString();
|
|
7797
|
-
return serialized ? `?${serialized}` : "";
|
|
7690
|
+
}
|
|
7691
|
+
return base;
|
|
7692
|
+
}
|
|
7693
|
+
};
|
|
7694
|
+
}
|
|
7695
|
+
function exposeGatewayData(response) {
|
|
7696
|
+
return Object.assign({}, response, response.data);
|
|
7798
7697
|
}
|
|
7799
7698
|
function createLucernClient(config = {}) {
|
|
7800
7699
|
const gatewayConfig = toGatewayConfig(config);
|
|
@@ -8019,7 +7918,7 @@ function createLucernClient(config = {}) {
|
|
|
8019
7918
|
topicId,
|
|
8020
7919
|
nodeType: "contradiction",
|
|
8021
7920
|
limit: 500
|
|
8022
|
-
}) : args.nodeId ? await graphClient.
|
|
7921
|
+
}) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
|
|
8023
7922
|
const contradictions2 = asNodeArray(response.data).filter((node) => {
|
|
8024
7923
|
const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
|
|
8025
7924
|
if (args.status && status !== args.status) {
|
|
@@ -8199,23 +8098,15 @@ function createLucernClient(config = {}) {
|
|
|
8199
8098
|
}).then(exposeGatewayData);
|
|
8200
8099
|
}
|
|
8201
8100
|
const nodesNamespace = {
|
|
8202
|
-
list
|
|
8203
|
-
return graphClient.listNodes(query5);
|
|
8204
|
-
},
|
|
8101
|
+
list: graphClient.listNodes,
|
|
8205
8102
|
get(input) {
|
|
8206
8103
|
return graphClient.getNode(
|
|
8207
8104
|
typeof input === "string" ? { nodeId: input } : input
|
|
8208
8105
|
);
|
|
8209
8106
|
},
|
|
8210
|
-
create
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
update(input, idempotencyKey) {
|
|
8214
|
-
return graphClient.updateNode(input, idempotencyKey);
|
|
8215
|
-
},
|
|
8216
|
-
batchCreate(input, idempotencyKey) {
|
|
8217
|
-
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
8218
|
-
},
|
|
8107
|
+
create: graphClient.createNode,
|
|
8108
|
+
update: graphClient.updateNode,
|
|
8109
|
+
batchCreate: graphClient.batchCreateNodes,
|
|
8219
8110
|
listByTopicAndType(input) {
|
|
8220
8111
|
return gateway.request({
|
|
8221
8112
|
path: `/api/platform/v1/nodes${sdkQueryString({
|
|
@@ -8240,15 +8131,9 @@ function createLucernClient(config = {}) {
|
|
|
8240
8131
|
})}`
|
|
8241
8132
|
}).then(exposeGatewayData);
|
|
8242
8133
|
},
|
|
8243
|
-
supersede
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
verify(input, idempotencyKey) {
|
|
8247
|
-
return graphClient.verifyNode(input, idempotencyKey);
|
|
8248
|
-
},
|
|
8249
|
-
hardDelete(input, idempotencyKey) {
|
|
8250
|
-
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
8251
|
-
}
|
|
8134
|
+
supersede: graphClient.supersedeNode,
|
|
8135
|
+
verify: graphClient.verifyNode,
|
|
8136
|
+
hardDelete: graphClient.hardDeleteNode
|
|
8252
8137
|
};
|
|
8253
8138
|
const publicationNamespace = {
|
|
8254
8139
|
create(input, idempotencyKey) {
|
|
@@ -8325,9 +8210,7 @@ function createLucernClient(config = {}) {
|
|
|
8325
8210
|
return {
|
|
8326
8211
|
config,
|
|
8327
8212
|
version: LUCERN_SDK_VERSION,
|
|
8328
|
-
search
|
|
8329
|
-
return searchResources(query5, options);
|
|
8330
|
-
},
|
|
8213
|
+
search: searchResources,
|
|
8331
8214
|
events: {
|
|
8332
8215
|
list(query5 = {}) {
|
|
8333
8216
|
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
@@ -8424,9 +8307,7 @@ function createLucernClient(config = {}) {
|
|
|
8424
8307
|
confidenceHistory(nodeId) {
|
|
8425
8308
|
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
8426
8309
|
},
|
|
8427
|
-
opinionHistory
|
|
8428
|
-
return getOpinionHistory(nodeId);
|
|
8429
|
-
},
|
|
8310
|
+
opinionHistory: getOpinionHistory,
|
|
8430
8311
|
createContract(nodeId, input) {
|
|
8431
8312
|
return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
|
|
8432
8313
|
},
|
|
@@ -8680,10 +8561,10 @@ function createLucernClient(config = {}) {
|
|
|
8680
8561
|
}));
|
|
8681
8562
|
},
|
|
8682
8563
|
getHighPriority(args) {
|
|
8683
|
-
return
|
|
8564
|
+
return questionsFacade.list({
|
|
8684
8565
|
topicId: requireTopicId4(args),
|
|
8685
8566
|
status: args.includeAnswered ? void 0 : "open"
|
|
8686
|
-
}).then((data) => {
|
|
8567
|
+
}).then(exposeGatewayData).then((data) => {
|
|
8687
8568
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
8688
8569
|
const rank = (priority) => {
|
|
8689
8570
|
switch (priority) {
|
|
@@ -8713,9 +8594,7 @@ function createLucernClient(config = {}) {
|
|
|
8713
8594
|
},
|
|
8714
8595
|
graph: {
|
|
8715
8596
|
nodes: nodesNamespace,
|
|
8716
|
-
createEdge
|
|
8717
|
-
return graphClient.createEdge(input);
|
|
8718
|
-
},
|
|
8597
|
+
createEdge: graphClient.createEdge,
|
|
8719
8598
|
neighborhood(args) {
|
|
8720
8599
|
return graphFacade.neighborhood({
|
|
8721
8600
|
globalId: args.globalId,
|
|
@@ -8774,7 +8653,7 @@ function createLucernClient(config = {}) {
|
|
|
8774
8653
|
bisectConfidence,
|
|
8775
8654
|
listBeliefs,
|
|
8776
8655
|
detectConfirmationBias(topicId, threshold) {
|
|
8777
|
-
return
|
|
8656
|
+
return graphFacade.bias({
|
|
8778
8657
|
topicId,
|
|
8779
8658
|
threshold,
|
|
8780
8659
|
limit: 200
|
|
@@ -8785,7 +8664,7 @@ function createLucernClient(config = {}) {
|
|
|
8785
8664
|
}));
|
|
8786
8665
|
},
|
|
8787
8666
|
getStructureAnalysis(topicId) {
|
|
8788
|
-
return
|
|
8667
|
+
return graphFacade.analyze({
|
|
8789
8668
|
topicId,
|
|
8790
8669
|
limit: 200
|
|
8791
8670
|
}).then((response) => ({
|
|
@@ -8852,38 +8731,20 @@ function createLucernClient(config = {}) {
|
|
|
8852
8731
|
}
|
|
8853
8732
|
},
|
|
8854
8733
|
judgments: {
|
|
8855
|
-
create
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
list(query5) {
|
|
8862
|
-
return decisionsClient.listJudgments(query5);
|
|
8863
|
-
},
|
|
8864
|
-
get(judgmentId) {
|
|
8865
|
-
return decisionsClient.getJudgment(judgmentId);
|
|
8866
|
-
},
|
|
8867
|
-
recordOutcome(judgmentId, input) {
|
|
8868
|
-
return decisionsClient.recordJudgmentOutcome(judgmentId, input);
|
|
8869
|
-
},
|
|
8870
|
-
updateOutcome(judgmentId, input) {
|
|
8871
|
-
return decisionsClient.updateJudgmentOutcome(judgmentId, input);
|
|
8872
|
-
},
|
|
8734
|
+
create: decisionsClient.createJudgment,
|
|
8735
|
+
record: decisionsClient.recordJudgment,
|
|
8736
|
+
list: decisionsClient.listJudgments,
|
|
8737
|
+
get: decisionsClient.getJudgment,
|
|
8738
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
8739
|
+
updateOutcome: decisionsClient.updateJudgmentOutcome,
|
|
8873
8740
|
readiness(topicId) {
|
|
8874
|
-
return decisionsClient.getJudgmentReadiness({
|
|
8875
|
-
topicId
|
|
8876
|
-
});
|
|
8741
|
+
return decisionsClient.getJudgmentReadiness({ topicId });
|
|
8877
8742
|
},
|
|
8878
8743
|
calibration(topicId) {
|
|
8879
|
-
return decisionsClient.getJudgmentCalibration({
|
|
8880
|
-
topicId
|
|
8881
|
-
});
|
|
8744
|
+
return decisionsClient.getJudgmentCalibration({ topicId });
|
|
8882
8745
|
},
|
|
8883
8746
|
pendingOutcomeReview(topicId) {
|
|
8884
|
-
return decisionsClient.listPendingJudgmentOutcomeReview({
|
|
8885
|
-
topicId
|
|
8886
|
-
});
|
|
8747
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
|
|
8887
8748
|
},
|
|
8888
8749
|
transitionAuditIntegrity(args) {
|
|
8889
8750
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
@@ -8893,21 +8754,11 @@ function createLucernClient(config = {}) {
|
|
|
8893
8754
|
}
|
|
8894
8755
|
},
|
|
8895
8756
|
decisions: {
|
|
8896
|
-
create
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
},
|
|
8902
|
-
list(query5) {
|
|
8903
|
-
return decisionsClient.listJudgments(query5);
|
|
8904
|
-
},
|
|
8905
|
-
get(decisionId) {
|
|
8906
|
-
return decisionsClient.getJudgment(decisionId);
|
|
8907
|
-
},
|
|
8908
|
-
recordOutcome(decisionId, input) {
|
|
8909
|
-
return decisionsClient.recordJudgmentOutcome(decisionId, input);
|
|
8910
|
-
},
|
|
8757
|
+
create: decisionsClient.createJudgment,
|
|
8758
|
+
record: decisionsClient.recordJudgment,
|
|
8759
|
+
list: decisionsClient.listJudgments,
|
|
8760
|
+
get: decisionsClient.getJudgment,
|
|
8761
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
8911
8762
|
lessons(decisionId, input, idempotencyKey) {
|
|
8912
8763
|
return gateway.request({
|
|
8913
8764
|
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
@@ -8939,21 +8790,11 @@ function createLucernClient(config = {}) {
|
|
|
8939
8790
|
}
|
|
8940
8791
|
},
|
|
8941
8792
|
worktrees: {
|
|
8942
|
-
createBranch
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
},
|
|
8948
|
-
listLenses(query5) {
|
|
8949
|
-
return workflowClient.listLenses(query5);
|
|
8950
|
-
},
|
|
8951
|
-
applyLensToTopic(input) {
|
|
8952
|
-
return workflowClient.applyLensToTopic(input);
|
|
8953
|
-
},
|
|
8954
|
-
removeLensFromTopic(input) {
|
|
8955
|
-
return workflowClient.removeLensFromTopic(input);
|
|
8956
|
-
},
|
|
8793
|
+
createBranch: workflowClient.createBranch,
|
|
8794
|
+
createLens: workflowClient.createLens,
|
|
8795
|
+
listLenses: workflowClient.listLenses,
|
|
8796
|
+
applyLensToTopic: workflowClient.applyLensToTopic,
|
|
8797
|
+
removeLensFromTopic: workflowClient.removeLensFromTopic,
|
|
8957
8798
|
create(input) {
|
|
8958
8799
|
return worktreesFacade.create({
|
|
8959
8800
|
title: input.title,
|
|
@@ -9058,7 +8899,9 @@ function createLucernClient(config = {}) {
|
|
|
9058
8899
|
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
9059
8900
|
(value) => typeof value === "string"
|
|
9060
8901
|
) : void 0;
|
|
9061
|
-
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8902
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8903
|
+
(value) => typeof value === "string"
|
|
8904
|
+
) : void 0;
|
|
9062
8905
|
return worktreesFacade.update({
|
|
9063
8906
|
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
9064
8907
|
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
@@ -9072,7 +8915,23 @@ function createLucernClient(config = {}) {
|
|
|
9072
8915
|
});
|
|
9073
8916
|
},
|
|
9074
8917
|
update(input) {
|
|
9075
|
-
|
|
8918
|
+
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
8919
|
+
(value) => typeof value === "string"
|
|
8920
|
+
) : void 0;
|
|
8921
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8922
|
+
(value) => typeof value === "string"
|
|
8923
|
+
) : void 0;
|
|
8924
|
+
return worktreesFacade.update({
|
|
8925
|
+
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
8926
|
+
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
8927
|
+
campaign: typeof input.campaign === "number" ? input.campaign : void 0,
|
|
8928
|
+
lane: typeof input.lane === "string" ? input.lane : void 0,
|
|
8929
|
+
laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
|
|
8930
|
+
orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
|
|
8931
|
+
dependsOn,
|
|
8932
|
+
blocks,
|
|
8933
|
+
gate: typeof input.gate === "string" ? input.gate : void 0
|
|
8934
|
+
});
|
|
9076
8935
|
},
|
|
9077
8936
|
updateTargets(input) {
|
|
9078
8937
|
return worktreesFacade.updateTargets({
|
|
@@ -9083,9 +8942,7 @@ function createLucernClient(config = {}) {
|
|
|
9083
8942
|
removeQuestionIds: input.removeQuestionIds
|
|
9084
8943
|
});
|
|
9085
8944
|
},
|
|
9086
|
-
listAll
|
|
9087
|
-
return workflowClient.listAllWorktrees(query5);
|
|
9088
|
-
},
|
|
8945
|
+
listAll: workflowClient.listAllWorktrees,
|
|
9089
8946
|
merge(worktreeId, input) {
|
|
9090
8947
|
return worktreesFacade.merge({
|
|
9091
8948
|
id: worktreeId,
|
|
@@ -9093,18 +8950,12 @@ function createLucernClient(config = {}) {
|
|
|
9093
8950
|
summary: input.summary
|
|
9094
8951
|
});
|
|
9095
8952
|
},
|
|
9096
|
-
push
|
|
9097
|
-
|
|
9098
|
-
},
|
|
9099
|
-
openPullRequest(worktreeId, input) {
|
|
9100
|
-
return workflowClient.openPullRequest(worktreeId, input);
|
|
9101
|
-
},
|
|
8953
|
+
push: workflowClient.push,
|
|
8954
|
+
openPullRequest: workflowClient.openPullRequest,
|
|
9102
8955
|
pipelineSnapshot(topicId) {
|
|
9103
8956
|
return functionSurfaceClient.pipelineSnapshot({ topicId });
|
|
9104
8957
|
},
|
|
9105
|
-
complete
|
|
9106
|
-
return worktreesFacade.complete(input, idempotencyKey);
|
|
9107
|
-
},
|
|
8958
|
+
complete: worktreesFacade.complete,
|
|
9108
8959
|
advancePhase(worktreeId, idempotencyKey) {
|
|
9109
8960
|
return worktreesFacade.advancePhase(
|
|
9110
8961
|
{ worktreeId },
|
|
@@ -9117,12 +8968,8 @@ function createLucernClient(config = {}) {
|
|
|
9117
8968
|
idempotencyKey
|
|
9118
8969
|
);
|
|
9119
8970
|
},
|
|
9120
|
-
patchState
|
|
9121
|
-
|
|
9122
|
-
},
|
|
9123
|
-
bulkCreate(input, idempotencyKey) {
|
|
9124
|
-
return worktreesFacade.bulkCreate(input, idempotencyKey);
|
|
9125
|
-
}
|
|
8971
|
+
patchState: worktreesFacade.patchState,
|
|
8972
|
+
bulkCreate: worktreesFacade.bulkCreate
|
|
9126
8973
|
},
|
|
9127
8974
|
context: {
|
|
9128
8975
|
listTopics(query5 = {}) {
|
|
@@ -9133,27 +8980,15 @@ function createLucernClient(config = {}) {
|
|
|
9133
8980
|
type: query5.type
|
|
9134
8981
|
});
|
|
9135
8982
|
},
|
|
9136
|
-
compile
|
|
9137
|
-
|
|
9138
|
-
},
|
|
9139
|
-
recordScopeLearning(input, idempotencyKey) {
|
|
9140
|
-
return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
|
|
9141
|
-
},
|
|
8983
|
+
compile: contextClient.compile,
|
|
8984
|
+
recordScopeLearning: functionSurfaceClient.recordScopeLearning,
|
|
9142
8985
|
discover(input) {
|
|
9143
8986
|
return discoverTopics(input);
|
|
9144
8987
|
},
|
|
9145
|
-
analyzeTopicDensity
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
return functionSurfaceClient.applyAutoBranching(input, idempotencyKey);
|
|
9150
|
-
},
|
|
9151
|
-
seedBeliefLattice(input = {}, idempotencyKey) {
|
|
9152
|
-
return functionSurfaceClient.seedBeliefLattice(input, idempotencyKey);
|
|
9153
|
-
},
|
|
9154
|
-
getLatticeCoverage(input = {}) {
|
|
9155
|
-
return functionSurfaceClient.getLatticeCoverage(input);
|
|
9156
|
-
},
|
|
8988
|
+
analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
|
|
8989
|
+
applyAutoBranching: functionSurfaceClient.applyAutoBranching,
|
|
8990
|
+
seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
|
|
8991
|
+
getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
|
|
9157
8992
|
matchEntityType(input) {
|
|
9158
8993
|
return ontologiesFacade.match(input).then(exposeGatewayData);
|
|
9159
8994
|
},
|
|
@@ -9238,9 +9073,7 @@ function createLucernClient(config = {}) {
|
|
|
9238
9073
|
type: input.type
|
|
9239
9074
|
});
|
|
9240
9075
|
},
|
|
9241
|
-
get
|
|
9242
|
-
return topicsFacade.get(topicId);
|
|
9243
|
-
},
|
|
9076
|
+
get: topicsFacade.get,
|
|
9244
9077
|
create(input) {
|
|
9245
9078
|
return topicsFacade.create({
|
|
9246
9079
|
name: input.name,
|
|
@@ -9285,12 +9118,8 @@ function createLucernClient(config = {}) {
|
|
|
9285
9118
|
maxDepth: query5.maxDepth
|
|
9286
9119
|
});
|
|
9287
9120
|
},
|
|
9288
|
-
remove
|
|
9289
|
-
|
|
9290
|
-
},
|
|
9291
|
-
bulkCreate(input, idempotencyKey) {
|
|
9292
|
-
return topicsFacade.bulkCreate(input, idempotencyKey);
|
|
9293
|
-
}
|
|
9121
|
+
remove: topicsFacade.remove,
|
|
9122
|
+
bulkCreate: topicsFacade.bulkCreate
|
|
9294
9123
|
},
|
|
9295
9124
|
answers: {
|
|
9296
9125
|
create(input) {
|
|
@@ -9389,33 +9218,15 @@ function createLucernClient(config = {}) {
|
|
|
9389
9218
|
raw: ontologyClient
|
|
9390
9219
|
},
|
|
9391
9220
|
coordination: {
|
|
9392
|
-
registerSession
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
listActiveSessions(input = {}) {
|
|
9402
|
-
return functionSurfaceClient.listActiveSessions(input);
|
|
9403
|
-
},
|
|
9404
|
-
sendAgentMessage(input, idempotencyKey) {
|
|
9405
|
-
return functionSurfaceClient.sendAgentMessage(input, idempotencyKey);
|
|
9406
|
-
},
|
|
9407
|
-
broadcastMessage(input, idempotencyKey) {
|
|
9408
|
-
return functionSurfaceClient.broadcastMessage(input, idempotencyKey);
|
|
9409
|
-
},
|
|
9410
|
-
getInbox(input = {}) {
|
|
9411
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
9412
|
-
},
|
|
9413
|
-
getAgentInbox(input = {}) {
|
|
9414
|
-
return functionSurfaceClient.getAgentInbox(input);
|
|
9415
|
-
},
|
|
9416
|
-
claimFiles(input, idempotencyKey) {
|
|
9417
|
-
return functionSurfaceClient.claimFiles(input, idempotencyKey);
|
|
9418
|
-
}
|
|
9221
|
+
registerSession: functionSurfaceClient.registerSession,
|
|
9222
|
+
heartbeatSession: functionSurfaceClient.heartbeatSession,
|
|
9223
|
+
endSession: functionSurfaceClient.endSession,
|
|
9224
|
+
listActiveSessions: functionSurfaceClient.listActiveSessions,
|
|
9225
|
+
sendAgentMessage: functionSurfaceClient.sendAgentMessage,
|
|
9226
|
+
broadcastMessage: functionSurfaceClient.broadcastMessage,
|
|
9227
|
+
getInbox: functionSurfaceClient.getAgentInbox,
|
|
9228
|
+
getAgentInbox: functionSurfaceClient.getAgentInbox,
|
|
9229
|
+
claimFiles: functionSurfaceClient.claimFiles
|
|
9419
9230
|
},
|
|
9420
9231
|
policy: {
|
|
9421
9232
|
checkPermission(input) {
|
|
@@ -9446,38 +9257,24 @@ function createLucernClient(config = {}) {
|
|
|
9446
9257
|
principalId: typeof input.principalId === "string" ? input.principalId : void 0
|
|
9447
9258
|
});
|
|
9448
9259
|
},
|
|
9260
|
+
// Backward compatibility shim: keep the policy namespace exposing the
|
|
9261
|
+
// historical manageWritePolicy entry point.
|
|
9449
9262
|
manageWritePolicy(input, idempotencyKey) {
|
|
9450
9263
|
return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
|
|
9451
9264
|
},
|
|
9452
9265
|
raw: policyClient
|
|
9453
9266
|
},
|
|
9454
9267
|
observations: {
|
|
9455
|
-
ingest
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
return functionSurfaceClient.ingestObservation(input, idempotencyKey);
|
|
9460
|
-
},
|
|
9461
|
-
getContext(input) {
|
|
9462
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
9463
|
-
},
|
|
9464
|
-
getObservationContext(input) {
|
|
9465
|
-
return functionSurfaceClient.getObservationContext(input);
|
|
9466
|
-
}
|
|
9268
|
+
ingest: functionSurfaceClient.ingestObservation,
|
|
9269
|
+
ingestObservation: functionSurfaceClient.ingestObservation,
|
|
9270
|
+
getContext: functionSurfaceClient.getObservationContext,
|
|
9271
|
+
getObservationContext: functionSurfaceClient.getObservationContext
|
|
9467
9272
|
},
|
|
9468
9273
|
coding: {
|
|
9469
|
-
getCodeContext
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
return functionSurfaceClient.getChangeHistory(input);
|
|
9474
|
-
},
|
|
9475
|
-
recordAttempt(input, idempotencyKey) {
|
|
9476
|
-
return functionSurfaceClient.recordAttempt(input, idempotencyKey);
|
|
9477
|
-
},
|
|
9478
|
-
getFailureLog(input) {
|
|
9479
|
-
return functionSurfaceClient.getFailureLog(input);
|
|
9480
|
-
}
|
|
9274
|
+
getCodeContext: functionSurfaceClient.getCodeContext,
|
|
9275
|
+
getChangeHistory: functionSurfaceClient.getChangeHistory,
|
|
9276
|
+
recordAttempt: functionSurfaceClient.recordAttempt,
|
|
9277
|
+
getFailureLog: functionSurfaceClient.getFailureLog
|
|
9481
9278
|
},
|
|
9482
9279
|
contracts: {
|
|
9483
9280
|
create(input) {
|
|
@@ -9503,9 +9300,7 @@ function createLucernClient(config = {}) {
|
|
|
9503
9300
|
}
|
|
9504
9301
|
},
|
|
9505
9302
|
bootstrap: {
|
|
9506
|
-
generateSessionHandoff
|
|
9507
|
-
return functionSurfaceClient.generateSessionHandoff(input);
|
|
9508
|
-
}
|
|
9303
|
+
generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
|
|
9509
9304
|
},
|
|
9510
9305
|
embeddings: embeddingsClient,
|
|
9511
9306
|
graphAnalysis: graphAnalysisClient,
|
|
@@ -9527,25 +9322,15 @@ function createLucernClient(config = {}) {
|
|
|
9527
9322
|
createAcl: toolRegistryClient.createAcl,
|
|
9528
9323
|
deleteAcl: toolRegistryClient.deleteAcl,
|
|
9529
9324
|
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
9530
|
-
register
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
return unregisterCustomTool(fullName);
|
|
9535
|
-
},
|
|
9536
|
-
list() {
|
|
9537
|
-
return listRegisteredCustomTools();
|
|
9538
|
-
},
|
|
9539
|
-
clear() {
|
|
9540
|
-
clearRegisteredCustomTools();
|
|
9541
|
-
},
|
|
9325
|
+
register: registerCustomTool,
|
|
9326
|
+
unregister: unregisterCustomTool,
|
|
9327
|
+
list: listRegisteredCustomTools,
|
|
9328
|
+
clear: clearRegisteredCustomTools,
|
|
9542
9329
|
invoke(name, input = {}) {
|
|
9543
9330
|
const fullName = name.includes(".") ? name : `custom.${name}`;
|
|
9544
9331
|
return invokeCustomTool(fullName, input);
|
|
9545
9332
|
},
|
|
9546
|
-
namespace
|
|
9547
|
-
return getCustomNamespace(namespace);
|
|
9548
|
-
}
|
|
9333
|
+
namespace: getCustomNamespace
|
|
9549
9334
|
},
|
|
9550
9335
|
packs: {
|
|
9551
9336
|
/**
|
|
@@ -9560,27 +9345,13 @@ function createLucernClient(config = {}) {
|
|
|
9560
9345
|
get isInstalled() {
|
|
9561
9346
|
return _packInstalled;
|
|
9562
9347
|
},
|
|
9563
|
-
listCatalog
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
return packsClient.listStates(scope);
|
|
9571
|
-
},
|
|
9572
|
-
states(scope) {
|
|
9573
|
-
return packsClient.getStates(scope);
|
|
9574
|
-
},
|
|
9575
|
-
install(input) {
|
|
9576
|
-
return packsClient.install(input);
|
|
9577
|
-
},
|
|
9578
|
-
enable(input) {
|
|
9579
|
-
return packsClient.enable(input);
|
|
9580
|
-
},
|
|
9581
|
-
disable(input) {
|
|
9582
|
-
return packsClient.disable(input);
|
|
9583
|
-
}
|
|
9348
|
+
listCatalog: packsClient.listCatalog,
|
|
9349
|
+
catalog: packsClient.listCatalog,
|
|
9350
|
+
listStates: packsClient.listStates,
|
|
9351
|
+
states: packsClient.getStates,
|
|
9352
|
+
install: packsClient.install,
|
|
9353
|
+
enable: packsClient.enable,
|
|
9354
|
+
disable: packsClient.disable
|
|
9584
9355
|
},
|
|
9585
9356
|
nodes: nodesNamespace,
|
|
9586
9357
|
identity: {
|
|
@@ -9593,30 +9364,16 @@ function createLucernClient(config = {}) {
|
|
|
9593
9364
|
raw: identityClient
|
|
9594
9365
|
},
|
|
9595
9366
|
mcp: {
|
|
9596
|
-
bootstrapSession
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
},
|
|
9602
|
-
beginBuildSession(input) {
|
|
9603
|
-
return mcpClient.beginBuildSession(input);
|
|
9604
|
-
},
|
|
9605
|
-
evaluateEngineeringContract(input) {
|
|
9606
|
-
return mcpClient.evaluateEngineeringContract(input);
|
|
9607
|
-
},
|
|
9608
|
-
evaluateResearchContract(input) {
|
|
9609
|
-
return mcpClient.evaluateResearchContract(input);
|
|
9610
|
-
}
|
|
9367
|
+
bootstrapSession: mcpClient.bootstrapSession,
|
|
9368
|
+
checkWritePolicy: mcpClient.checkWritePolicy,
|
|
9369
|
+
beginBuildSession: mcpClient.beginBuildSession,
|
|
9370
|
+
evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
|
|
9371
|
+
evaluateResearchContract: mcpClient.evaluateResearchContract
|
|
9611
9372
|
},
|
|
9612
9373
|
auth: {
|
|
9613
9374
|
device: {
|
|
9614
|
-
createCode
|
|
9615
|
-
|
|
9616
|
-
},
|
|
9617
|
-
pollToken(deviceCode) {
|
|
9618
|
-
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
9619
|
-
}
|
|
9375
|
+
createCode: authDeviceClient.createDeviceCode,
|
|
9376
|
+
pollToken: authDeviceClient.pollDeviceToken
|
|
9620
9377
|
}
|
|
9621
9378
|
},
|
|
9622
9379
|
custom: getCustomNamespace("custom"),
|
|
@@ -9802,17 +9559,11 @@ var TOKENS_PER_WORD = 1.35;
|
|
|
9802
9559
|
var MIN_TOKEN_ESTIMATE = 8;
|
|
9803
9560
|
|
|
9804
9561
|
// ../sdk/src/contextPackPolicy.ts
|
|
9805
|
-
function nowMs() {
|
|
9806
|
-
return Date.now();
|
|
9807
|
-
}
|
|
9808
|
-
function normalizeText(text) {
|
|
9809
|
-
return text.trim().toLowerCase();
|
|
9810
|
-
}
|
|
9811
9562
|
function tokenHits(text, tokens) {
|
|
9812
9563
|
if (tokens.length === 0) {
|
|
9813
9564
|
return 1;
|
|
9814
9565
|
}
|
|
9815
|
-
const haystack =
|
|
9566
|
+
const haystack = text.trim().toLowerCase();
|
|
9816
9567
|
let hits = 0;
|
|
9817
9568
|
for (const token of tokens) {
|
|
9818
9569
|
if (haystack.includes(token)) {
|
|
@@ -9827,7 +9578,7 @@ function clamp013(value) {
|
|
|
9827
9578
|
}
|
|
9828
9579
|
return Math.max(0, Math.min(1, value));
|
|
9829
9580
|
}
|
|
9830
|
-
function recencyScore(updatedAt, referenceTimeMs =
|
|
9581
|
+
function recencyScore(updatedAt, referenceTimeMs = Date.now()) {
|
|
9831
9582
|
if (!updatedAt || !Number.isFinite(updatedAt)) {
|
|
9832
9583
|
return 0.25;
|
|
9833
9584
|
}
|
|
@@ -9843,15 +9594,15 @@ function confidenceScore(confidence) {
|
|
|
9843
9594
|
return clamp013(confidence);
|
|
9844
9595
|
}
|
|
9845
9596
|
function priorityScore(priority) {
|
|
9846
|
-
const value =
|
|
9597
|
+
const value = (priority || "").trim().toLowerCase();
|
|
9847
9598
|
return PRIORITY_SCORES[value] ?? DEFAULT_PRIORITY_SCORE;
|
|
9848
9599
|
}
|
|
9849
9600
|
function severityScore(severity) {
|
|
9850
|
-
const value =
|
|
9601
|
+
const value = (severity || "").trim().toLowerCase();
|
|
9851
9602
|
return SEVERITY_SCORES[value] ?? DEFAULT_SEVERITY_SCORE;
|
|
9852
9603
|
}
|
|
9853
9604
|
function beliefTypeBonus(beliefType) {
|
|
9854
|
-
const value =
|
|
9605
|
+
const value = (beliefType || "").trim().toLowerCase();
|
|
9855
9606
|
return BELIEF_TYPE_BONUS[value] ?? DEFAULT_BELIEF_TYPE_BONUS;
|
|
9856
9607
|
}
|
|
9857
9608
|
function resolveEffectiveWeights(overrides) {
|
|
@@ -9877,7 +9628,7 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
9877
9628
|
}
|
|
9878
9629
|
const ts = candidate.updatedAt || candidate.createdAt || null;
|
|
9879
9630
|
if (ts && Number.isFinite(ts)) {
|
|
9880
|
-
const ageDays = Math.max(0,
|
|
9631
|
+
const ageDays = Math.max(0, Date.now() - ts) / (1e3 * 60 * 60 * 24);
|
|
9881
9632
|
if (ageDays < 1) {
|
|
9882
9633
|
parts.push("updated today");
|
|
9883
9634
|
} else if (ageDays < 7) {
|
|
@@ -9902,10 +9653,6 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
9902
9653
|
}
|
|
9903
9654
|
return parts.join(", ");
|
|
9904
9655
|
}
|
|
9905
|
-
function computeBaselineScore(candidate, queryTokens) {
|
|
9906
|
-
const hits = tokenHits(candidate.text, queryTokens);
|
|
9907
|
-
return queryTokens.length === 0 ? 1 : hits;
|
|
9908
|
-
}
|
|
9909
9656
|
function computeWeightedScore(section, candidate, queryTokens, effectiveWeights, referenceTimeMs) {
|
|
9910
9657
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
9911
9658
|
const queryComponent = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(candidate.text, queryTokens) / queryTokens.length);
|
|
@@ -9939,7 +9686,7 @@ function rankContextSection(section, rows, queryTokens, limit, profile, options)
|
|
|
9939
9686
|
queryTokens,
|
|
9940
9687
|
effectiveWeights,
|
|
9941
9688
|
referenceTimeMs
|
|
9942
|
-
) :
|
|
9689
|
+
) : queryTokens.length === 0 ? 1 : tokenHits(row.text, queryTokens);
|
|
9943
9690
|
const result = { ...row, score };
|
|
9944
9691
|
if (includeJustifications && profile === "weighted_v1") {
|
|
9945
9692
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
@@ -10306,18 +10053,21 @@ function normalizeQueryTokens(query5) {
|
|
|
10306
10053
|
function parseRankingProfile(value) {
|
|
10307
10054
|
return value === "baseline_v1" ? "baseline_v1" : "weighted_v1";
|
|
10308
10055
|
}
|
|
10056
|
+
function isRecord5(value) {
|
|
10057
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10058
|
+
}
|
|
10309
10059
|
function beliefTypeOf(node) {
|
|
10310
10060
|
if (typeof node.beliefType === "string") {
|
|
10311
10061
|
return node.beliefType;
|
|
10312
10062
|
}
|
|
10313
|
-
const metadata = node.metadata
|
|
10063
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10314
10064
|
if (typeof metadata.beliefType === "string") {
|
|
10315
10065
|
return metadata.beliefType;
|
|
10316
10066
|
}
|
|
10317
10067
|
return "";
|
|
10318
10068
|
}
|
|
10319
10069
|
function questionStatusOf(node) {
|
|
10320
|
-
const metadata = node.metadata
|
|
10070
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10321
10071
|
const direct = typeof node.status === "string" ? node.status : "";
|
|
10322
10072
|
const questionStatus = typeof metadata.questionStatus === "string" ? metadata.questionStatus : "";
|
|
10323
10073
|
return (questionStatus || direct || "open").toLowerCase();
|
|
@@ -10333,9 +10083,6 @@ function isOpenQuestion(status) {
|
|
|
10333
10083
|
"belief_forked"
|
|
10334
10084
|
].includes(status);
|
|
10335
10085
|
}
|
|
10336
|
-
function metadataText(payload) {
|
|
10337
|
-
return JSON.stringify(payload).toLowerCase();
|
|
10338
|
-
}
|
|
10339
10086
|
function collectTopicNeighborhood(topics2, rootTopicId, maxDescendantDepth = 2) {
|
|
10340
10087
|
const byId = /* @__PURE__ */ new Map();
|
|
10341
10088
|
const children = /* @__PURE__ */ new Map();
|
|
@@ -10397,11 +10144,10 @@ function dedupeById(rows) {
|
|
|
10397
10144
|
return output;
|
|
10398
10145
|
}
|
|
10399
10146
|
function candidateTimestamp(candidate) {
|
|
10400
|
-
if (!candidate
|
|
10147
|
+
if (!isRecord5(candidate)) {
|
|
10401
10148
|
return 0;
|
|
10402
10149
|
}
|
|
10403
|
-
const
|
|
10404
|
-
const timestamps = [record.updatedAt, record.createdAt, record.generatedAt].filter(
|
|
10150
|
+
const timestamps = [candidate.updatedAt, candidate.createdAt, candidate.generatedAt].filter(
|
|
10405
10151
|
(value) => typeof value === "number" && Number.isFinite(value)
|
|
10406
10152
|
);
|
|
10407
10153
|
return timestamps.length > 0 ? Math.max(...timestamps) : 0;
|
|
@@ -10523,7 +10269,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10523
10269
|
beliefType: beliefTypeOf(belief) || null,
|
|
10524
10270
|
status: belief.status || "active",
|
|
10525
10271
|
updatedAt: belief.updatedAt || belief.createdAt || null,
|
|
10526
|
-
metadataText: belief.metadata && typeof belief.metadata === "object" ?
|
|
10272
|
+
metadataText: belief.metadata && typeof belief.metadata === "object" ? JSON.stringify(belief.metadata).toLowerCase() : ""
|
|
10527
10273
|
}));
|
|
10528
10274
|
const activeBeliefs = rankContextSection(
|
|
10529
10275
|
"activeBeliefs",
|
|
@@ -10555,7 +10301,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10555
10301
|
status,
|
|
10556
10302
|
priority: typeof metadata.priority === "string" ? metadata.priority : "medium",
|
|
10557
10303
|
updatedAt: question.updatedAt || question.createdAt || null,
|
|
10558
|
-
metadataText:
|
|
10304
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
10559
10305
|
};
|
|
10560
10306
|
}).filter((row) => isOpenQuestion(row.status));
|
|
10561
10307
|
const openQuestions = rankContextSection(
|
|
@@ -10587,7 +10333,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10587
10333
|
kind: typeof metadata.kind === "string" && metadata.kind || "observation",
|
|
10588
10334
|
createdAt: item.createdAt || null,
|
|
10589
10335
|
updatedAt: item.updatedAt || item.createdAt || null,
|
|
10590
|
-
metadataText:
|
|
10336
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
10591
10337
|
};
|
|
10592
10338
|
});
|
|
10593
10339
|
const recentEvidence = rankContextSection(
|
|
@@ -10669,7 +10415,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10669
10415
|
let failureContext;
|
|
10670
10416
|
if (snapshot.plan.includeFailures && snapshot.failures) {
|
|
10671
10417
|
const allFailures = snapshot.failures.filter((node) => {
|
|
10672
|
-
const metadata = node.metadata
|
|
10418
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10673
10419
|
return metadata.failedApproach === true || metadata.isFailedAttempt === true;
|
|
10674
10420
|
});
|
|
10675
10421
|
const rankedFailures = rankContextSection(
|
|
@@ -10687,7 +10433,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10687
10433
|
);
|
|
10688
10434
|
const failures = rankedFailures.map((row) => {
|
|
10689
10435
|
const original = allFailures.find((node) => String(node._id) === row.id);
|
|
10690
|
-
const metadata = original?.metadata
|
|
10436
|
+
const metadata = isRecord5(original?.metadata) ? original?.metadata : {};
|
|
10691
10437
|
return {
|
|
10692
10438
|
attemptId: row.id,
|
|
10693
10439
|
approach: String(row.text || ""),
|
|
@@ -11171,9 +10917,7 @@ function lastDelegator(delegationChain) {
|
|
|
11171
10917
|
|
|
11172
10918
|
// ../sdk/src/contracts/lens-filter.contract.ts
|
|
11173
10919
|
function isLensFilterCriteria(value) {
|
|
11174
|
-
|
|
11175
|
-
const obj = value;
|
|
11176
|
-
return typeof obj.version === "number" && typeof obj.kind === "string";
|
|
10920
|
+
return isRecord6(value) && typeof value.version === "number" && typeof value.kind === "string";
|
|
11177
10921
|
}
|
|
11178
10922
|
function isTaxonomyFilterCriteriaV1(value) {
|
|
11179
10923
|
if (!isLensFilterCriteria(value)) return false;
|
|
@@ -11202,6 +10946,9 @@ function validateFilterCriteria(value) {
|
|
|
11202
10946
|
]
|
|
11203
10947
|
};
|
|
11204
10948
|
}
|
|
10949
|
+
function isRecord6(value) {
|
|
10950
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10951
|
+
}
|
|
11205
10952
|
function validateTaxonomyFilterV1(criteria) {
|
|
11206
10953
|
const errors = [];
|
|
11207
10954
|
if (!Array.isArray(criteria.entityTypeFilters)) {
|
|
@@ -11715,9 +11462,16 @@ var ADD_WORKTREE = {
|
|
|
11715
11462
|
},
|
|
11716
11463
|
projectId: {
|
|
11717
11464
|
type: "string",
|
|
11718
|
-
description: "Legacy topicId alias"
|
|
11465
|
+
description: "Legacy topicId alias or resolver hint"
|
|
11466
|
+
},
|
|
11467
|
+
topicId: {
|
|
11468
|
+
type: "string",
|
|
11469
|
+
description: "Optional topic scope hint for resolver validation"
|
|
11470
|
+
},
|
|
11471
|
+
topicHint: {
|
|
11472
|
+
type: "string",
|
|
11473
|
+
description: "Natural-language topic hint for automatic topic resolution"
|
|
11719
11474
|
},
|
|
11720
|
-
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
11721
11475
|
branchId: {
|
|
11722
11476
|
type: "string",
|
|
11723
11477
|
description: "The branch this worktree investigates"
|
|
@@ -11815,6 +11569,22 @@ var ADD_WORKTREE = {
|
|
|
11815
11569
|
type: "string",
|
|
11816
11570
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
11817
11571
|
},
|
|
11572
|
+
tags: {
|
|
11573
|
+
type: "array",
|
|
11574
|
+
description: "Additional topic-resolution tags for the worktree"
|
|
11575
|
+
},
|
|
11576
|
+
touchedPaths: {
|
|
11577
|
+
type: "array",
|
|
11578
|
+
description: "File paths used as topic-resolution signals"
|
|
11579
|
+
},
|
|
11580
|
+
sourceRef: {
|
|
11581
|
+
type: "string",
|
|
11582
|
+
description: "Source reference used as a topic-resolution signal"
|
|
11583
|
+
},
|
|
11584
|
+
sourceKind: {
|
|
11585
|
+
type: "string",
|
|
11586
|
+
description: "Source kind used as a topic-resolution signal"
|
|
11587
|
+
},
|
|
11818
11588
|
campaign: {
|
|
11819
11589
|
type: "number",
|
|
11820
11590
|
description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
|
|
@@ -11852,7 +11622,7 @@ var ADD_WORKTREE = {
|
|
|
11852
11622
|
description: "Timestamp when worktree metadata was last reconciled"
|
|
11853
11623
|
}
|
|
11854
11624
|
},
|
|
11855
|
-
required: ["title"
|
|
11625
|
+
required: ["title"],
|
|
11856
11626
|
response: {
|
|
11857
11627
|
description: "The created worktree",
|
|
11858
11628
|
fields: {
|
|
@@ -13555,18 +13325,60 @@ var CREATE_TASK = {
|
|
|
13555
13325
|
name: "create_task",
|
|
13556
13326
|
description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
|
|
13557
13327
|
parameters: {
|
|
13558
|
-
title: { type: "string", description: "Task
|
|
13328
|
+
title: { type: "string", description: "Task title" },
|
|
13559
13329
|
topicId: { type: "string", description: "Topic scope" },
|
|
13330
|
+
description: {
|
|
13331
|
+
type: "string",
|
|
13332
|
+
description: "Long-form task description"
|
|
13333
|
+
},
|
|
13560
13334
|
taskType: {
|
|
13561
13335
|
type: "string",
|
|
13562
|
-
description: "
|
|
13563
|
-
enum: [
|
|
13336
|
+
description: "Task taxonomy",
|
|
13337
|
+
enum: [
|
|
13338
|
+
"general",
|
|
13339
|
+
"find_evidence",
|
|
13340
|
+
"verify_claim",
|
|
13341
|
+
"research",
|
|
13342
|
+
"review",
|
|
13343
|
+
"interview",
|
|
13344
|
+
"analysis",
|
|
13345
|
+
"track_metrics"
|
|
13346
|
+
]
|
|
13347
|
+
},
|
|
13348
|
+
priority: {
|
|
13349
|
+
type: "string",
|
|
13350
|
+
description: "Priority",
|
|
13351
|
+
enum: ["urgent", "high", "medium", "low"]
|
|
13352
|
+
},
|
|
13353
|
+
status: {
|
|
13354
|
+
type: "string",
|
|
13355
|
+
description: "Initial status (defaults to todo)",
|
|
13356
|
+
enum: ["todo", "in_progress", "blocked", "done"]
|
|
13357
|
+
},
|
|
13358
|
+
linkedWorktreeId: {
|
|
13359
|
+
type: "string",
|
|
13360
|
+
description: "Worktree this task belongs to"
|
|
13361
|
+
},
|
|
13362
|
+
linkedBeliefId: {
|
|
13363
|
+
type: "string",
|
|
13364
|
+
description: "Belief this task supports"
|
|
13564
13365
|
},
|
|
13565
13366
|
linkedQuestionId: {
|
|
13566
13367
|
type: "string",
|
|
13567
13368
|
description: "Question this task addresses"
|
|
13568
13369
|
},
|
|
13569
|
-
|
|
13370
|
+
assigneeId: {
|
|
13371
|
+
type: "string",
|
|
13372
|
+
description: "Principal assigned to the task"
|
|
13373
|
+
},
|
|
13374
|
+
dueDate: {
|
|
13375
|
+
type: "number",
|
|
13376
|
+
description: "Due date as epoch milliseconds"
|
|
13377
|
+
},
|
|
13378
|
+
tags: {
|
|
13379
|
+
type: "array",
|
|
13380
|
+
description: "Free-form string tags"
|
|
13381
|
+
}
|
|
13570
13382
|
},
|
|
13571
13383
|
required: ["title"],
|
|
13572
13384
|
response: {
|
|
@@ -15923,6 +15735,9 @@ function fromBase64(value) {
|
|
|
15923
15735
|
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
15924
15736
|
return decodeURIComponent(escape(atob(normalized)));
|
|
15925
15737
|
}
|
|
15738
|
+
function isRecord7(value) {
|
|
15739
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15740
|
+
}
|
|
15926
15741
|
function createEventId() {
|
|
15927
15742
|
const random = typeof globalThis.crypto?.randomUUID === "function" ? globalThis.crypto.randomUUID().replace(/-/g, "") : Array.from(
|
|
15928
15743
|
typeof globalThis.crypto?.getRandomValues === "function" ? globalThis.crypto.getRandomValues(new Uint8Array(16)) : Array.from({ length: 16 }, () => Math.floor(Math.random() * 256)),
|
|
@@ -15971,14 +15786,14 @@ function decodeEventCursor(cursor) {
|
|
|
15971
15786
|
}
|
|
15972
15787
|
try {
|
|
15973
15788
|
const parsed = JSON.parse(fromBase64(cursor.trim()));
|
|
15974
|
-
if (typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
15789
|
+
if (!isRecord7(parsed) || typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
15975
15790
|
return null;
|
|
15976
15791
|
}
|
|
15977
15792
|
return {
|
|
15978
15793
|
timestamp: parsed.timestamp,
|
|
15979
15794
|
eventId: parsed.eventId.trim()
|
|
15980
15795
|
};
|
|
15981
|
-
} catch {
|
|
15796
|
+
} catch (error) {
|
|
15982
15797
|
return null;
|
|
15983
15798
|
}
|
|
15984
15799
|
}
|
|
@@ -16007,7 +15822,7 @@ var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"])
|
|
|
16007
15822
|
function normalizeUrl(url) {
|
|
16008
15823
|
try {
|
|
16009
15824
|
return new URL(url.trim());
|
|
16010
|
-
} catch {
|
|
15825
|
+
} catch (error) {
|
|
16011
15826
|
throw new Error("Webhook URL must be a valid absolute URL.");
|
|
16012
15827
|
}
|
|
16013
15828
|
}
|
|
@@ -21140,6 +20955,11 @@ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
|
21140
20955
|
role: "sdk_dependency",
|
|
21141
20956
|
directTenantImport: false
|
|
21142
20957
|
},
|
|
20958
|
+
{
|
|
20959
|
+
packageName: "@lucern/graph-sync",
|
|
20960
|
+
role: "host_addon_runtime",
|
|
20961
|
+
directTenantImport: true
|
|
20962
|
+
},
|
|
21143
20963
|
{
|
|
21144
20964
|
packageName: "@lucern/identity",
|
|
21145
20965
|
role: "component_runtime",
|
|
@@ -21428,8 +21248,11 @@ function compactRecord(input) {
|
|
|
21428
21248
|
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
21429
21249
|
);
|
|
21430
21250
|
}
|
|
21251
|
+
function isRecord8(value) {
|
|
21252
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
21253
|
+
}
|
|
21431
21254
|
function recordValue(value) {
|
|
21432
|
-
return
|
|
21255
|
+
return isRecord8(value) ? value : {};
|
|
21433
21256
|
}
|
|
21434
21257
|
var createEvidenceProjection = defineProjection({
|
|
21435
21258
|
contractName: "create_evidence",
|
|
@@ -21864,9 +21687,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
|
|
|
21864
21687
|
required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
|
|
21865
21688
|
};
|
|
21866
21689
|
}
|
|
21867
|
-
|
|
21868
|
-
return contract;
|
|
21869
|
-
}
|
|
21690
|
+
var defineFunctionContract = (contract) => contract;
|
|
21870
21691
|
function authUserId(context) {
|
|
21871
21692
|
return context.userId ?? context.principalId ?? "lucern-agent";
|
|
21872
21693
|
}
|
|
@@ -22020,6 +21841,9 @@ var observationContextArgs = z.object({
|
|
|
22020
21841
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
22021
21842
|
status: z.string().optional().describe("Observation status filter.")
|
|
22022
21843
|
});
|
|
21844
|
+
function isRecord9(value) {
|
|
21845
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
21846
|
+
}
|
|
22023
21847
|
var observationInput = (input, context) => withUserId(
|
|
22024
21848
|
compactRecord4({
|
|
22025
21849
|
projectId: input.projectId,
|
|
@@ -22074,8 +21898,8 @@ var contextContracts = [
|
|
|
22074
21898
|
kind: "mutation",
|
|
22075
21899
|
inputProjection: observationInput,
|
|
22076
21900
|
outputProjection: (output, input) => ({
|
|
22077
|
-
...output
|
|
22078
|
-
observationId: output
|
|
21901
|
+
...isRecord9(output) ? output : {},
|
|
21902
|
+
observationId: isRecord9(output) ? output.nodeId : void 0,
|
|
22079
21903
|
observationType: input.observationType
|
|
22080
21904
|
})
|
|
22081
21905
|
},
|
|
@@ -23556,10 +23380,11 @@ var worktreeDecisionGateInputSchema = z.object({
|
|
|
23556
23380
|
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
23557
23381
|
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
23558
23382
|
var addWorktreeArgs = z.object({
|
|
23559
|
-
title: z.string().
|
|
23383
|
+
title: z.string().describe("Human-readable worktree name or objective."),
|
|
23560
23384
|
name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
|
|
23561
|
-
topicId: z.string().describe("
|
|
23562
|
-
projectId: z.string().optional().describe("Legacy topicId alias."),
|
|
23385
|
+
topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
|
|
23386
|
+
projectId: z.string().optional().describe("Legacy topicId alias/hint."),
|
|
23387
|
+
topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
|
|
23563
23388
|
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
23564
23389
|
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
23565
23390
|
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
@@ -23584,6 +23409,10 @@ var addWorktreeArgs = z.object({
|
|
|
23584
23409
|
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
23585
23410
|
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
23586
23411
|
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
23412
|
+
tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
|
|
23413
|
+
touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
|
|
23414
|
+
sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
|
|
23415
|
+
sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
|
|
23587
23416
|
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
23588
23417
|
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
23589
23418
|
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
@@ -23913,8 +23742,46 @@ var worktreesContracts = [
|
|
|
23913
23742
|
args: openPullRequestArgs
|
|
23914
23743
|
})
|
|
23915
23744
|
];
|
|
23916
|
-
|
|
23917
|
-
|
|
23745
|
+
var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
23746
|
+
var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
|
|
23747
|
+
var taskTypeSchema = z.enum([
|
|
23748
|
+
"general",
|
|
23749
|
+
"find_evidence",
|
|
23750
|
+
"verify_claim",
|
|
23751
|
+
"research",
|
|
23752
|
+
"review",
|
|
23753
|
+
"interview",
|
|
23754
|
+
"analysis",
|
|
23755
|
+
"track_metrics"
|
|
23756
|
+
]);
|
|
23757
|
+
var createTaskArgs = z.object({
|
|
23758
|
+
title: z.string().describe("Task title."),
|
|
23759
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
23760
|
+
description: z.string().optional().describe("Long-form task description."),
|
|
23761
|
+
taskType: taskTypeSchema.optional().describe("Task taxonomy."),
|
|
23762
|
+
priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
|
|
23763
|
+
status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
|
|
23764
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
|
|
23765
|
+
linkedBeliefId: z.string().optional().describe("Belief this task supports."),
|
|
23766
|
+
linkedQuestionId: z.string().optional().describe("Question this task addresses."),
|
|
23767
|
+
assigneeId: z.string().optional().describe("Principal assigned to the task."),
|
|
23768
|
+
dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
|
|
23769
|
+
tags: z.array(z.string()).optional().describe("Free-form tags.")
|
|
23770
|
+
});
|
|
23771
|
+
var createTaskInput = (input) => compactRecord4({
|
|
23772
|
+
title: input.title,
|
|
23773
|
+
topicId: input.topicId,
|
|
23774
|
+
description: input.description,
|
|
23775
|
+
taskType: input.taskType,
|
|
23776
|
+
priority: input.priority ?? "medium",
|
|
23777
|
+
status: input.status ?? "todo",
|
|
23778
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
23779
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
23780
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
23781
|
+
assigneeId: input.assigneeId,
|
|
23782
|
+
dueDate: input.dueDate,
|
|
23783
|
+
tags: input.tags
|
|
23784
|
+
});
|
|
23918
23785
|
var taskInput = (input) => compactRecord4({
|
|
23919
23786
|
...input,
|
|
23920
23787
|
taskId: input.taskId ?? input.id
|
|
@@ -23946,8 +23813,10 @@ var tasksContracts = [
|
|
|
23946
23813
|
convex: {
|
|
23947
23814
|
module: "tasks",
|
|
23948
23815
|
functionName: "create",
|
|
23949
|
-
kind: "mutation"
|
|
23950
|
-
|
|
23816
|
+
kind: "mutation",
|
|
23817
|
+
inputProjection: createTaskInput
|
|
23818
|
+
},
|
|
23819
|
+
args: createTaskArgs
|
|
23951
23820
|
}),
|
|
23952
23821
|
surfaceContract({
|
|
23953
23822
|
name: "list_tasks",
|
|
@@ -25066,9 +24935,12 @@ var ALL_FUNCTION_CONTRACTS = [
|
|
|
25066
24935
|
];
|
|
25067
24936
|
assertSurfaceCoverage(ALL_FUNCTION_CONTRACTS);
|
|
25068
24937
|
var FUNCTION_SURFACE_CONTRACTS = ALL_FUNCTION_CONTRACTS;
|
|
25069
|
-
new Map(
|
|
24938
|
+
var FUNCTION_CONTRACTS_BY_NAME = new Map(
|
|
25070
24939
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
25071
24940
|
);
|
|
24941
|
+
FUNCTION_CONTRACTS_BY_NAME.get.bind(
|
|
24942
|
+
FUNCTION_CONTRACTS_BY_NAME
|
|
24943
|
+
);
|
|
25072
24944
|
|
|
25073
24945
|
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
25074
24946
|
function isCopyableSeedRequirement(entry) {
|
|
@@ -25714,10 +25586,18 @@ function isInfisicalRuntimeDisabled(env = {}) {
|
|
|
25714
25586
|
}
|
|
25715
25587
|
async function hydrateInfisicalRuntimeEnv(options) {
|
|
25716
25588
|
const env = options.env ?? {};
|
|
25717
|
-
const
|
|
25718
|
-
|
|
25719
|
-
|
|
25720
|
-
|
|
25589
|
+
const baseBootstrap = readInfisicalRuntimeBootstrap(env, options.bootstrap);
|
|
25590
|
+
const bootstrap = baseBootstrap ? {
|
|
25591
|
+
...baseBootstrap,
|
|
25592
|
+
...Object.fromEntries(
|
|
25593
|
+
Object.entries(options.bootstrap ?? {}).filter(
|
|
25594
|
+
([, value]) => value !== void 0
|
|
25595
|
+
)
|
|
25596
|
+
),
|
|
25597
|
+
apiUrl: trimTrailingSlash(
|
|
25598
|
+
options.bootstrap?.apiUrl ?? baseBootstrap.apiUrl
|
|
25599
|
+
)
|
|
25600
|
+
} : null;
|
|
25721
25601
|
if (!bootstrap) {
|
|
25722
25602
|
return {
|
|
25723
25603
|
status: "disabled",
|
|
@@ -25813,16 +25693,6 @@ function normalizeInfisicalEnvironment(value) {
|
|
|
25813
25693
|
}
|
|
25814
25694
|
return "prod";
|
|
25815
25695
|
}
|
|
25816
|
-
function mergeBootstrap(base, overrides) {
|
|
25817
|
-
if (!base) {
|
|
25818
|
-
return null;
|
|
25819
|
-
}
|
|
25820
|
-
return {
|
|
25821
|
-
...base,
|
|
25822
|
-
...compact(overrides ?? {}),
|
|
25823
|
-
apiUrl: trimTrailingSlash(overrides?.apiUrl ?? base.apiUrl)
|
|
25824
|
-
};
|
|
25825
|
-
}
|
|
25826
25696
|
async function loginWithUniversalAuth(bootstrap, fetchImpl) {
|
|
25827
25697
|
const response = await fetchImpl(
|
|
25828
25698
|
`${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
|
|
@@ -25907,14 +25777,18 @@ async function readSecretValue(args) {
|
|
|
25907
25777
|
async function readJson2(response) {
|
|
25908
25778
|
try {
|
|
25909
25779
|
return await response.json();
|
|
25910
|
-
} catch {
|
|
25780
|
+
} catch (error) {
|
|
25781
|
+
debugInfisicalRuntimeFallback("response.json", error);
|
|
25911
25782
|
return void 0;
|
|
25912
25783
|
}
|
|
25913
25784
|
}
|
|
25785
|
+
function isRecord10(value) {
|
|
25786
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25787
|
+
}
|
|
25914
25788
|
function readNestedString(value, path2) {
|
|
25915
25789
|
let current = value;
|
|
25916
25790
|
for (const key of path2) {
|
|
25917
|
-
if (!current ||
|
|
25791
|
+
if (!isRecord10(current) || !(key in current)) {
|
|
25918
25792
|
return null;
|
|
25919
25793
|
}
|
|
25920
25794
|
current = current[key];
|
|
@@ -25922,13 +25796,12 @@ function readNestedString(value, path2) {
|
|
|
25922
25796
|
return typeof current === "string" && current.length > 0 ? current : null;
|
|
25923
25797
|
}
|
|
25924
25798
|
function messageFromBody(body4) {
|
|
25925
|
-
if (!body4
|
|
25799
|
+
if (!isRecord10(body4)) {
|
|
25926
25800
|
return "no response body";
|
|
25927
25801
|
}
|
|
25928
|
-
const record = body4;
|
|
25929
25802
|
for (const key of ["message", "error", "errorMessage"]) {
|
|
25930
|
-
if (typeof
|
|
25931
|
-
return
|
|
25803
|
+
if (typeof body4[key] === "string") {
|
|
25804
|
+
return body4[key];
|
|
25932
25805
|
}
|
|
25933
25806
|
}
|
|
25934
25807
|
return JSON.stringify(body4);
|
|
@@ -25948,10 +25821,32 @@ function isTruthyEnv(value) {
|
|
|
25948
25821
|
function trimTrailingSlash(value) {
|
|
25949
25822
|
return value.replace(/\/+$/u, "");
|
|
25950
25823
|
}
|
|
25951
|
-
function
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
|
|
25824
|
+
function debugInfisicalRuntimeFallback(message, error) {
|
|
25825
|
+
const env = globalThis.process?.env;
|
|
25826
|
+
if (env?.LUCERN_COMPAT_FALLBACK_DEBUG !== "1" && env?.LUCERN_INFISICAL_RUNTIME_DEBUG !== "1") {
|
|
25827
|
+
return;
|
|
25828
|
+
}
|
|
25829
|
+
console.debug(`[infisical-runtime] ${message}`, {
|
|
25830
|
+
error: formatInfisicalRuntimeError(error)
|
|
25831
|
+
});
|
|
25832
|
+
}
|
|
25833
|
+
function formatInfisicalRuntimeError(error) {
|
|
25834
|
+
if (error instanceof Error) {
|
|
25835
|
+
return `${error.name}: ${error.message}`;
|
|
25836
|
+
}
|
|
25837
|
+
if (typeof error === "string") {
|
|
25838
|
+
return error;
|
|
25839
|
+
}
|
|
25840
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
25841
|
+
return String(error);
|
|
25842
|
+
}
|
|
25843
|
+
if (error && typeof error === "object") {
|
|
25844
|
+
const keys = Object.keys(error).slice(0, 5);
|
|
25845
|
+
if (keys.length > 0) {
|
|
25846
|
+
return `Unknown Infisical runtime error object with keys: ${keys.join(", ")}`;
|
|
25847
|
+
}
|
|
25848
|
+
}
|
|
25849
|
+
return "Unknown Infisical runtime error shape";
|
|
25955
25850
|
}
|
|
25956
25851
|
|
|
25957
25852
|
// src/execution.ts
|
|
@@ -25998,6 +25893,9 @@ function hasValue(value) {
|
|
|
25998
25893
|
}
|
|
25999
25894
|
return true;
|
|
26000
25895
|
}
|
|
25896
|
+
function isRecord11(value) {
|
|
25897
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
25898
|
+
}
|
|
26001
25899
|
function normalizeToolExecutionParams(params) {
|
|
26002
25900
|
const normalized = { ...params };
|
|
26003
25901
|
for (const aliases of SCOPE_ALIAS_GROUPS) {
|
|
@@ -26020,16 +25918,19 @@ function parseToolExecutionMetadata(result) {
|
|
|
26020
25918
|
}
|
|
26021
25919
|
try {
|
|
26022
25920
|
const payload = JSON.parse(raw);
|
|
25921
|
+
if (!isRecord11(payload)) {
|
|
25922
|
+
return { isError: Boolean(result.isError) };
|
|
25923
|
+
}
|
|
26023
25924
|
return {
|
|
26024
25925
|
isError: Boolean(result.isError),
|
|
26025
25926
|
code: typeof payload.code === "string" ? payload.code : void 0,
|
|
26026
25927
|
status: typeof payload.status === "number" ? payload.status : void 0,
|
|
26027
|
-
correlationId:
|
|
26028
|
-
policyTraceId:
|
|
26029
|
-
invariant:
|
|
25928
|
+
correlationId: optionalStringOrNull(payload.correlationId),
|
|
25929
|
+
policyTraceId: optionalStringOrNull(payload.policyTraceId),
|
|
25930
|
+
invariant: optionalStringOrNull(payload.invariant)
|
|
26030
25931
|
};
|
|
26031
|
-
} catch {
|
|
26032
|
-
return
|
|
25932
|
+
} catch (error) {
|
|
25933
|
+
return ignoreMalformedToolMetadata(error, result);
|
|
26033
25934
|
}
|
|
26034
25935
|
}
|
|
26035
25936
|
async function executeToolWithEnvelope(args) {
|
|
@@ -26047,6 +25948,15 @@ async function executeToolWithEnvelope(args) {
|
|
|
26047
25948
|
});
|
|
26048
25949
|
return result;
|
|
26049
25950
|
}
|
|
25951
|
+
function ignoreMalformedToolMetadata(_error, result) {
|
|
25952
|
+
return { isError: Boolean(result.isError) };
|
|
25953
|
+
}
|
|
25954
|
+
function optionalStringOrNull(value) {
|
|
25955
|
+
if (typeof value === "string" || value === null) {
|
|
25956
|
+
return value;
|
|
25957
|
+
}
|
|
25958
|
+
return void 0;
|
|
25959
|
+
}
|
|
26050
25960
|
|
|
26051
25961
|
// src/types.ts
|
|
26052
25962
|
var McpHandlerError = class extends Error {
|
|
@@ -27556,18 +27466,22 @@ function createWorktreeHandlers(context) {
|
|
|
27556
27466
|
MCP_TOOL_CONTRACTS.add_worktree,
|
|
27557
27467
|
async (params) => {
|
|
27558
27468
|
const topicId = readTopicId4(params);
|
|
27559
|
-
if (!topicId) {
|
|
27560
|
-
throw new Error("add_worktree requires topicId");
|
|
27561
|
-
}
|
|
27562
27469
|
const result = await workflow.addWorktree({
|
|
27563
27470
|
title: readString3(params, "title", { required: true }),
|
|
27564
27471
|
topicId,
|
|
27472
|
+
topicHint: readString3(params, "topicHint"),
|
|
27565
27473
|
branchId: readString3(params, "branchId"),
|
|
27566
27474
|
objective: readString3(params, "objective"),
|
|
27567
27475
|
hypothesis: readString3(params, "hypothesis"),
|
|
27476
|
+
rationale: readString3(params, "rationale"),
|
|
27477
|
+
worktreeType: readString3(params, "worktreeType"),
|
|
27568
27478
|
beliefIds: readStringArray(params, "beliefIds"),
|
|
27569
27479
|
autoShape: readBoolean(params, "autoShape"),
|
|
27570
27480
|
domainPackId: readString3(params, "domainPackId"),
|
|
27481
|
+
tags: readStringArray(params, "tags"),
|
|
27482
|
+
touchedPaths: readStringArray(params, "touchedPaths"),
|
|
27483
|
+
sourceRef: readString3(params, "sourceRef"),
|
|
27484
|
+
sourceKind: readString3(params, "sourceKind"),
|
|
27571
27485
|
campaign: typeof params.campaign === "number" ? params.campaign : void 0,
|
|
27572
27486
|
lane: readString3(params, "lane"),
|
|
27573
27487
|
laneOrderInCampaign: typeof params.laneOrderInCampaign === "number" ? params.laneOrderInCampaign : void 0,
|
|
@@ -27687,8 +27601,8 @@ function loadMcpSdk() {
|
|
|
27687
27601
|
try {
|
|
27688
27602
|
const dynamicRequire = eval("require");
|
|
27689
27603
|
return dynamicRequire("@modelcontextprotocol/sdk") ?? {};
|
|
27690
|
-
} catch {
|
|
27691
|
-
return
|
|
27604
|
+
} catch (error) {
|
|
27605
|
+
return ignoreMcpSdkLoadError();
|
|
27692
27606
|
}
|
|
27693
27607
|
}
|
|
27694
27608
|
var MCP_AUTH_ERROR_CODES = [
|
|
@@ -27767,11 +27681,11 @@ function deriveCustomToolScopes(customTool) {
|
|
|
27767
27681
|
return uniqueScopes(customTool.metadata.requiredScopes ?? ["custom:execute"]);
|
|
27768
27682
|
}
|
|
27769
27683
|
function createFallbackRuntime() {
|
|
27684
|
+
function noop() {
|
|
27685
|
+
}
|
|
27770
27686
|
return {
|
|
27771
|
-
registerResource:
|
|
27772
|
-
|
|
27773
|
-
registerTool: () => {
|
|
27774
|
-
}
|
|
27687
|
+
registerResource: noop,
|
|
27688
|
+
registerTool: noop
|
|
27775
27689
|
};
|
|
27776
27690
|
}
|
|
27777
27691
|
function createMcpRuntime() {
|
|
@@ -27785,7 +27699,7 @@ function createMcpRuntime() {
|
|
|
27785
27699
|
{ name: "lucern-platform-mcp", version: "1.2.0" },
|
|
27786
27700
|
{ capabilities: { resources: {}, tools: {} } }
|
|
27787
27701
|
);
|
|
27788
|
-
} catch {
|
|
27702
|
+
} catch (error) {
|
|
27789
27703
|
return createFallbackRuntime();
|
|
27790
27704
|
}
|
|
27791
27705
|
}
|
|
@@ -27809,15 +27723,14 @@ function executeWithHandler(_name, handler, contract, params) {
|
|
|
27809
27723
|
}
|
|
27810
27724
|
}
|
|
27811
27725
|
function isMcpToolResult(value) {
|
|
27812
|
-
if (!value
|
|
27726
|
+
if (!isRecord12(value)) {
|
|
27813
27727
|
return false;
|
|
27814
27728
|
}
|
|
27815
|
-
|
|
27816
|
-
if (!Array.isArray(candidate.content)) {
|
|
27729
|
+
if (!Array.isArray(value.content)) {
|
|
27817
27730
|
return false;
|
|
27818
27731
|
}
|
|
27819
|
-
return
|
|
27820
|
-
if (!entry
|
|
27732
|
+
return value.content.every((entry) => {
|
|
27733
|
+
if (!isRecord12(entry)) {
|
|
27821
27734
|
return false;
|
|
27822
27735
|
}
|
|
27823
27736
|
return typeof entry.text === "string";
|
|
@@ -27988,6 +27901,12 @@ function createLucernMcpServer(options) {
|
|
|
27988
27901
|
unimplementedToolNames
|
|
27989
27902
|
};
|
|
27990
27903
|
}
|
|
27904
|
+
function isRecord12(value) {
|
|
27905
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
27906
|
+
}
|
|
27907
|
+
function ignoreMcpSdkLoadError(_error) {
|
|
27908
|
+
return {};
|
|
27909
|
+
}
|
|
27991
27910
|
|
|
27992
27911
|
// src/standalone.ts
|
|
27993
27912
|
var OBSERVATION_RESOURCE_TEMPLATE = "lucern://observations/topic/{topicId}";
|
|
@@ -28029,6 +27948,9 @@ function resourceName(uri) {
|
|
|
28029
27948
|
return uri.replace("lucern://", "lucern-").replace(/[{}]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
28030
27949
|
}
|
|
28031
27950
|
function readTemplateVar(variables, key) {
|
|
27951
|
+
if (!isRecord13(variables)) {
|
|
27952
|
+
return;
|
|
27953
|
+
}
|
|
28032
27954
|
const value = variables[key];
|
|
28033
27955
|
if (typeof value === "string") {
|
|
28034
27956
|
return value;
|
|
@@ -28041,7 +27963,7 @@ function readTemplateVar(variables, key) {
|
|
|
28041
27963
|
async function notifyResourceUpdated(server, uri) {
|
|
28042
27964
|
try {
|
|
28043
27965
|
await server.server.sendResourceUpdated({ uri });
|
|
28044
|
-
} catch {
|
|
27966
|
+
} catch (error) {
|
|
28045
27967
|
}
|
|
28046
27968
|
}
|
|
28047
27969
|
function registerResources(server, runtime, observationStore) {
|
|
@@ -28102,10 +28024,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28102
28024
|
mimeType: "application/json"
|
|
28103
28025
|
},
|
|
28104
28026
|
async (_uri, variables) => {
|
|
28105
|
-
const topicId = readTemplateVar(
|
|
28106
|
-
variables,
|
|
28107
|
-
"topicId"
|
|
28108
|
-
);
|
|
28027
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28109
28028
|
const records = topicId ? observationStore.list(topicId, 25) : [];
|
|
28110
28029
|
return {
|
|
28111
28030
|
contents: [
|
|
@@ -28138,9 +28057,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28138
28057
|
mimeType: "application/json"
|
|
28139
28058
|
},
|
|
28140
28059
|
async (_uri, variables) => {
|
|
28141
|
-
const
|
|
28142
|
-
const
|
|
28143
|
-
const query5 = readTemplateVar(values, "query");
|
|
28060
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28061
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28144
28062
|
const matches = topicId && query5 ? observationStore.search(topicId, query5, 25) : [];
|
|
28145
28063
|
return {
|
|
28146
28064
|
contents: [
|
|
@@ -28173,10 +28091,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28173
28091
|
mimeType: "application/json"
|
|
28174
28092
|
},
|
|
28175
28093
|
async (_uri, variables) => {
|
|
28176
|
-
const topicId = readTemplateVar(
|
|
28177
|
-
variables,
|
|
28178
|
-
"topicId"
|
|
28179
|
-
);
|
|
28094
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28180
28095
|
const context = topicId ? observationStore.getContext({ topicId, limit: 12 }) : observationStore.getContext({ topicId: "unknown", limit: 12 });
|
|
28181
28096
|
return {
|
|
28182
28097
|
contents: [
|
|
@@ -28200,9 +28115,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28200
28115
|
mimeType: "application/json"
|
|
28201
28116
|
},
|
|
28202
28117
|
async (_uri, variables) => {
|
|
28203
|
-
const
|
|
28204
|
-
const
|
|
28205
|
-
const query5 = readTemplateVar(values, "query");
|
|
28118
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28119
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28206
28120
|
const context = observationStore.getContext({
|
|
28207
28121
|
topicId: topicId ?? "unknown",
|
|
28208
28122
|
query: query5,
|
|
@@ -28228,7 +28142,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28228
28142
|
await notifyResourceUpdated(server, `lucern://context/topic/${encoded}`);
|
|
28229
28143
|
try {
|
|
28230
28144
|
await server.server.sendResourceListChanged();
|
|
28231
|
-
} catch {
|
|
28145
|
+
} catch (error) {
|
|
28232
28146
|
}
|
|
28233
28147
|
};
|
|
28234
28148
|
return { resourceUris, notifyObservationChanged };
|
|
@@ -28268,15 +28182,14 @@ function registerTools(server, runtime) {
|
|
|
28268
28182
|
inputSchema: shape
|
|
28269
28183
|
},
|
|
28270
28184
|
async (args) => {
|
|
28271
|
-
return handler(args, tool.contract);
|
|
28185
|
+
return handler(isRecord13(args) ? args : {}, tool.contract);
|
|
28272
28186
|
}
|
|
28273
28187
|
);
|
|
28274
28188
|
}
|
|
28275
28189
|
}
|
|
28276
28190
|
function createLucernStandaloneMcpServer(options) {
|
|
28277
28191
|
const observationStore = new McpObservationStore();
|
|
28278
|
-
let notifyObservationChanged =
|
|
28279
|
-
};
|
|
28192
|
+
let notifyObservationChanged = noopAsync;
|
|
28280
28193
|
const runtime = createLucernMcpServer({
|
|
28281
28194
|
...options,
|
|
28282
28195
|
observationStore,
|
|
@@ -28286,7 +28199,7 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28286
28199
|
});
|
|
28287
28200
|
const server = new McpServer({
|
|
28288
28201
|
name: "lucern-mcp",
|
|
28289
|
-
version: "0.
|
|
28202
|
+
version: "0.3.0-alpha.7"
|
|
28290
28203
|
});
|
|
28291
28204
|
registerTools(server, runtime);
|
|
28292
28205
|
const resources = registerResources(server, runtime, observationStore);
|
|
@@ -28300,6 +28213,11 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28300
28213
|
promptNames
|
|
28301
28214
|
};
|
|
28302
28215
|
}
|
|
28216
|
+
function isRecord13(value) {
|
|
28217
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28218
|
+
}
|
|
28219
|
+
async function noopAsync() {
|
|
28220
|
+
}
|
|
28303
28221
|
|
|
28304
28222
|
// src/hosted-route.ts
|
|
28305
28223
|
var ALLOW_METHODS = "GET, POST, DELETE, OPTIONS";
|
|
@@ -28425,12 +28343,12 @@ async function handleHostedMcpRequest(request) {
|
|
|
28425
28343
|
message: error instanceof Error ? error.message : "Internal server error."
|
|
28426
28344
|
});
|
|
28427
28345
|
} finally {
|
|
28428
|
-
await transport.close().catch(
|
|
28429
|
-
|
|
28430
|
-
await server.server.close().catch(() => {
|
|
28431
|
-
});
|
|
28346
|
+
await transport.close().catch(ignoreHostedCloseError);
|
|
28347
|
+
await server.server.close().catch(ignoreHostedCloseError);
|
|
28432
28348
|
}
|
|
28433
28349
|
}
|
|
28350
|
+
function ignoreHostedCloseError(_error) {
|
|
28351
|
+
}
|
|
28434
28352
|
|
|
28435
28353
|
export { handleHostedMcpRequest };
|
|
28436
28354
|
//# sourceMappingURL=hosted-route.js.map
|