@lucern/mcp 0.3.0-alpha.6 → 0.3.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +969 -946
- package/dist/cli.js.map +1 -1
- package/dist/gateway.js +756 -322
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +878 -936
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.js +997 -942
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +524 -170
- package/dist/runtime.js.map +1 -1
- package/package.json +7 -7
package/dist/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
|
|
@@ -4465,50 +4425,55 @@ function cleanNumber(value) {
|
|
|
4465
4425
|
function cleanBoolean(value) {
|
|
4466
4426
|
return typeof value === "boolean" ? value : void 0;
|
|
4467
4427
|
}
|
|
4468
|
-
function buildCompileContextRequest(
|
|
4469
|
-
const
|
|
4470
|
-
const
|
|
4428
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
4429
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
4430
|
+
const payload = {};
|
|
4431
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
4432
|
+
if (topicId) {
|
|
4433
|
+
payload.topicId = topicId;
|
|
4434
|
+
}
|
|
4435
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
4471
4436
|
if (query5) {
|
|
4472
4437
|
payload.query = query5;
|
|
4473
4438
|
}
|
|
4474
|
-
const budget = cleanNumber(
|
|
4439
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
4475
4440
|
if (budget !== void 0) {
|
|
4476
4441
|
payload.budget = budget;
|
|
4477
4442
|
}
|
|
4478
|
-
const ranking = cleanString4(
|
|
4443
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
4479
4444
|
if (ranking) {
|
|
4480
4445
|
payload.ranking = ranking;
|
|
4481
4446
|
}
|
|
4482
|
-
const limit = cleanNumber(
|
|
4447
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
4483
4448
|
if (limit !== void 0) {
|
|
4484
4449
|
payload.limit = limit;
|
|
4485
4450
|
}
|
|
4486
|
-
const maxDepth = cleanNumber(
|
|
4451
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
4487
4452
|
if (maxDepth !== void 0) {
|
|
4488
4453
|
payload.maxDepth = maxDepth;
|
|
4489
4454
|
}
|
|
4490
|
-
const includeEntities = cleanBoolean(
|
|
4455
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
4491
4456
|
if (includeEntities !== void 0) {
|
|
4492
4457
|
payload.includeEntities = includeEntities;
|
|
4493
4458
|
}
|
|
4494
|
-
const mode = cleanString4(
|
|
4459
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
4495
4460
|
if (mode) {
|
|
4496
4461
|
payload.mode = mode;
|
|
4497
4462
|
}
|
|
4498
|
-
const includeFailures = cleanBoolean(
|
|
4463
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
4499
4464
|
if (includeFailures !== void 0) {
|
|
4500
4465
|
payload.includeFailures = includeFailures;
|
|
4501
4466
|
}
|
|
4502
|
-
const worktreeId = cleanString4(
|
|
4467
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
4503
4468
|
if (worktreeId) {
|
|
4504
4469
|
payload.worktreeId = worktreeId;
|
|
4505
4470
|
}
|
|
4506
|
-
const sessionId = cleanString4(
|
|
4471
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
4507
4472
|
if (sessionId) {
|
|
4508
4473
|
payload.sessionId = sessionId;
|
|
4509
4474
|
}
|
|
4510
|
-
if (Array.isArray(
|
|
4511
|
-
payload.packWeightOverrides =
|
|
4475
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
4476
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
4512
4477
|
}
|
|
4513
4478
|
return {
|
|
4514
4479
|
path: "/api/platform/v1/context/compile",
|
|
@@ -4520,13 +4485,20 @@ function createContextClient(config = {}) {
|
|
|
4520
4485
|
const gateway = createGatewayRequestClient(config);
|
|
4521
4486
|
return {
|
|
4522
4487
|
/**
|
|
4523
|
-
* Compile a focused reasoning context pack
|
|
4524
|
-
* @param
|
|
4488
|
+
* Compile a focused reasoning context pack.
|
|
4489
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
4525
4490
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
4526
4491
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
4527
4492
|
*/
|
|
4528
|
-
async compile(
|
|
4529
|
-
const request = buildCompileContextRequest(
|
|
4493
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
4494
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
4495
|
+
return gateway.request({
|
|
4496
|
+
...request,
|
|
4497
|
+
body: request.body
|
|
4498
|
+
});
|
|
4499
|
+
},
|
|
4500
|
+
async compileByQuery(input = {}) {
|
|
4501
|
+
const request = buildCompileContextRequest(input);
|
|
4530
4502
|
return gateway.request({
|
|
4531
4503
|
...request,
|
|
4532
4504
|
body: request.body
|
|
@@ -4964,7 +4936,7 @@ function createGraphStateClassifierClient(config = {}) {
|
|
|
4964
4936
|
// ../sdk/src/harnessClient.ts
|
|
4965
4937
|
function createHarnessClient(config = {}) {
|
|
4966
4938
|
const gateway = createGatewayRequestClient(config);
|
|
4967
|
-
|
|
4939
|
+
const client = {
|
|
4968
4940
|
/**
|
|
4969
4941
|
* List agent definitions.
|
|
4970
4942
|
*/
|
|
@@ -4997,12 +4969,6 @@ function createHarnessClient(config = {}) {
|
|
|
4997
4969
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4998
4970
|
});
|
|
4999
4971
|
},
|
|
5000
|
-
/**
|
|
5001
|
-
* @deprecated Use createAgentDefinition.
|
|
5002
|
-
*/
|
|
5003
|
-
async registerAgentDefinition(input, idempotencyKey) {
|
|
5004
|
-
return this.createAgentDefinition(input, idempotencyKey);
|
|
5005
|
-
},
|
|
5006
4972
|
/**
|
|
5007
4973
|
* Update an agent definition.
|
|
5008
4974
|
*/
|
|
@@ -5041,12 +5007,6 @@ function createHarnessClient(config = {}) {
|
|
|
5041
5007
|
)
|
|
5042
5008
|
);
|
|
5043
5009
|
},
|
|
5044
|
-
/**
|
|
5045
|
-
* @deprecated Use listAgentRuns.
|
|
5046
|
-
*/
|
|
5047
|
-
async listRunsForAgent(agentId, scope = {}) {
|
|
5048
|
-
return this.listAgentRuns(agentId, scope);
|
|
5049
|
-
},
|
|
5050
5010
|
/**
|
|
5051
5011
|
* List tool definitions.
|
|
5052
5012
|
*/
|
|
@@ -5079,12 +5039,6 @@ function createHarnessClient(config = {}) {
|
|
|
5079
5039
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5080
5040
|
});
|
|
5081
5041
|
},
|
|
5082
|
-
/**
|
|
5083
|
-
* @deprecated Use createToolDefinition.
|
|
5084
|
-
*/
|
|
5085
|
-
async registerToolDefinition(input, idempotencyKey) {
|
|
5086
|
-
return this.createToolDefinition(input, idempotencyKey);
|
|
5087
|
-
},
|
|
5088
5042
|
/**
|
|
5089
5043
|
* Update a tool definition.
|
|
5090
5044
|
*/
|
|
@@ -5119,12 +5073,6 @@ function createHarnessClient(config = {}) {
|
|
|
5119
5073
|
)
|
|
5120
5074
|
);
|
|
5121
5075
|
},
|
|
5122
|
-
/**
|
|
5123
|
-
* @deprecated Use listRunEntries.
|
|
5124
|
-
*/
|
|
5125
|
-
async listRunLedgerEntries(scope = {}) {
|
|
5126
|
-
return this.listRunEntries(scope);
|
|
5127
|
-
},
|
|
5128
5076
|
/**
|
|
5129
5077
|
* Create a harness run.
|
|
5130
5078
|
*/
|
|
@@ -5199,6 +5147,12 @@ function createHarnessClient(config = {}) {
|
|
|
5199
5147
|
});
|
|
5200
5148
|
}
|
|
5201
5149
|
};
|
|
5150
|
+
return Object.assign(client, {
|
|
5151
|
+
registerAgentDefinition: client.createAgentDefinition,
|
|
5152
|
+
listRunsForAgent: client.listAgentRuns,
|
|
5153
|
+
registerToolDefinition: client.createToolDefinition,
|
|
5154
|
+
listRunLedgerEntries: client.listRunEntries
|
|
5155
|
+
});
|
|
5202
5156
|
}
|
|
5203
5157
|
|
|
5204
5158
|
// ../sdk/src/jobsClient.ts
|
|
@@ -5326,45 +5280,41 @@ function createJobsClient(config = {}) {
|
|
|
5326
5280
|
// ../sdk/src/learningClient.ts
|
|
5327
5281
|
function createLearningClient(config = {}) {
|
|
5328
5282
|
const gateway = createGatewayRequestClient(config);
|
|
5283
|
+
const listRecentExecutions = async (args = {}) => gateway.request({
|
|
5284
|
+
path: `/api/platform/v1/learning/executions/recent${toQueryString({
|
|
5285
|
+
...normalizeTopicQuery(args),
|
|
5286
|
+
namespace: args.namespace,
|
|
5287
|
+
audienceMode: args.audienceMode,
|
|
5288
|
+
success: typeof args.success === "boolean" ? args.success ? "true" : "false" : void 0,
|
|
5289
|
+
limit: typeof args.limit === "number" && Number.isFinite(args.limit) ? String(args.limit) : void 0
|
|
5290
|
+
})}`
|
|
5291
|
+
}).then(
|
|
5292
|
+
(response) => mapGatewayData(
|
|
5293
|
+
response,
|
|
5294
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "executions")
|
|
5295
|
+
)
|
|
5296
|
+
);
|
|
5297
|
+
const getExecutionStats = async (args = {}) => gateway.request({
|
|
5298
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
5299
|
+
...normalizeTopicQuery(args),
|
|
5300
|
+
namespace: args.namespace,
|
|
5301
|
+
audienceMode: args.audienceMode,
|
|
5302
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
5303
|
+
})}`
|
|
5304
|
+
});
|
|
5329
5305
|
return {
|
|
5330
5306
|
/**
|
|
5331
5307
|
* List recent execution records.
|
|
5332
5308
|
*/
|
|
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
|
-
},
|
|
5309
|
+
listRecentExecutions,
|
|
5349
5310
|
/**
|
|
5350
5311
|
* @deprecated Use listRecentExecutions.
|
|
5351
5312
|
*/
|
|
5352
|
-
|
|
5353
|
-
return this.listRecentExecutions(args);
|
|
5354
|
-
},
|
|
5313
|
+
getRecentExecutions: listRecentExecutions,
|
|
5355
5314
|
/**
|
|
5356
5315
|
* Get aggregate execution statistics.
|
|
5357
5316
|
*/
|
|
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
|
-
}
|
|
5317
|
+
getExecutionStats
|
|
5368
5318
|
};
|
|
5369
5319
|
}
|
|
5370
5320
|
|
|
@@ -6401,7 +6351,7 @@ function createOrgGraphSearchClient(config = {}) {
|
|
|
6401
6351
|
// ../sdk/src/packsClient.ts
|
|
6402
6352
|
function createPacksClient(config = {}) {
|
|
6403
6353
|
const gateway = createGatewayRequestClient(config);
|
|
6404
|
-
|
|
6354
|
+
const client = {
|
|
6405
6355
|
/**
|
|
6406
6356
|
* List catalog entries for available packs.
|
|
6407
6357
|
*/
|
|
@@ -6415,12 +6365,6 @@ function createPacksClient(config = {}) {
|
|
|
6415
6365
|
)
|
|
6416
6366
|
);
|
|
6417
6367
|
},
|
|
6418
|
-
/**
|
|
6419
|
-
* @deprecated Use listCatalog.
|
|
6420
|
-
*/
|
|
6421
|
-
async getCatalog() {
|
|
6422
|
-
return this.listCatalog();
|
|
6423
|
-
},
|
|
6424
6368
|
/**
|
|
6425
6369
|
* Get the discovery catalog for packs.
|
|
6426
6370
|
*/
|
|
@@ -6450,12 +6394,6 @@ function createPacksClient(config = {}) {
|
|
|
6450
6394
|
)
|
|
6451
6395
|
);
|
|
6452
6396
|
},
|
|
6453
|
-
/**
|
|
6454
|
-
* @deprecated Use listStates.
|
|
6455
|
-
*/
|
|
6456
|
-
async getStates(query5 = {}) {
|
|
6457
|
-
return this.listStates(query5);
|
|
6458
|
-
},
|
|
6459
6397
|
/**
|
|
6460
6398
|
* Get health details for a pack.
|
|
6461
6399
|
*/
|
|
@@ -6479,12 +6417,6 @@ function createPacksClient(config = {}) {
|
|
|
6479
6417
|
)
|
|
6480
6418
|
);
|
|
6481
6419
|
},
|
|
6482
|
-
/**
|
|
6483
|
-
* @deprecated Use listTelemetry.
|
|
6484
|
-
*/
|
|
6485
|
-
async getTelemetry(query5 = {}) {
|
|
6486
|
-
return this.listTelemetry(query5);
|
|
6487
|
-
},
|
|
6488
6420
|
/**
|
|
6489
6421
|
* Create a pack entitlement.
|
|
6490
6422
|
*/
|
|
@@ -6496,18 +6428,6 @@ function createPacksClient(config = {}) {
|
|
|
6496
6428
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6497
6429
|
});
|
|
6498
6430
|
},
|
|
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
6431
|
/**
|
|
6512
6432
|
* Install a pack.
|
|
6513
6433
|
*/
|
|
@@ -6564,6 +6484,13 @@ function createPacksClient(config = {}) {
|
|
|
6564
6484
|
});
|
|
6565
6485
|
}
|
|
6566
6486
|
};
|
|
6487
|
+
return Object.assign(client, {
|
|
6488
|
+
getCatalog: client.listCatalog,
|
|
6489
|
+
getStates: client.listStates,
|
|
6490
|
+
getTelemetry: client.listTelemetry,
|
|
6491
|
+
updateEntitlement: client.createEntitlement,
|
|
6492
|
+
upsertEntitlement: client.createEntitlement
|
|
6493
|
+
});
|
|
6567
6494
|
}
|
|
6568
6495
|
|
|
6569
6496
|
// ../sdk/src/policyClient.ts
|
|
@@ -6599,6 +6526,14 @@ function asRolePolicyArray(data) {
|
|
|
6599
6526
|
}
|
|
6600
6527
|
return data.map(asRolePolicyRecord).filter((row) => Boolean(row));
|
|
6601
6528
|
}
|
|
6529
|
+
function buildFilterByPermissionResponse(permission, allowedTopicIds, deniedTopics, count) {
|
|
6530
|
+
const result = {};
|
|
6531
|
+
result.permission = permission;
|
|
6532
|
+
result.allowedTopicIds = allowedTopicIds;
|
|
6533
|
+
result.deniedTopics = deniedTopics;
|
|
6534
|
+
result.count = count;
|
|
6535
|
+
return result;
|
|
6536
|
+
}
|
|
6602
6537
|
function createPolicyClient(config = {}) {
|
|
6603
6538
|
const gateway = createGatewayRequestClient(config);
|
|
6604
6539
|
return {
|
|
@@ -6821,15 +6756,15 @@ function createPolicyClient(config = {}) {
|
|
|
6821
6756
|
});
|
|
6822
6757
|
const allowedTopicIds = Array.isArray(response.data?.allowedTopicIds) ? response.data.allowedTopicIds : [];
|
|
6823
6758
|
const deniedTopics = Array.isArray(response.data?.deniedTopics) ? response.data.deniedTopics : [];
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6759
|
+
const result = {};
|
|
6760
|
+
result.success = true;
|
|
6761
|
+
result.data = buildFilterByPermissionResponse(
|
|
6762
|
+
permission,
|
|
6763
|
+
allowedTopicIds,
|
|
6764
|
+
deniedTopics,
|
|
6765
|
+
typeof response.data?.count === "number" ? response.data.count : allowedTopicIds.length
|
|
6766
|
+
);
|
|
6767
|
+
return result;
|
|
6833
6768
|
}
|
|
6834
6769
|
};
|
|
6835
6770
|
}
|
|
@@ -6837,64 +6772,66 @@ function createPolicyClient(config = {}) {
|
|
|
6837
6772
|
// ../sdk/src/reportsClient.ts
|
|
6838
6773
|
function createReportsClient(config = {}) {
|
|
6839
6774
|
const gateway = createGatewayRequestClient(config);
|
|
6775
|
+
const listTemplates = async (args = {}) => gateway.request({
|
|
6776
|
+
path: `/api/platform/v1/reports/templates${toQueryString({
|
|
6777
|
+
slug: args.slug
|
|
6778
|
+
})}`
|
|
6779
|
+
}).then(
|
|
6780
|
+
(response) => mapGatewayData(response, (data) => {
|
|
6781
|
+
const rows = asListItems(data, "templates");
|
|
6782
|
+
return createListResult(rows, "templates");
|
|
6783
|
+
})
|
|
6784
|
+
);
|
|
6785
|
+
const listReports = async (input, args = {}) => {
|
|
6786
|
+
const topicId = resolveTopicId(input);
|
|
6787
|
+
if (!topicId) {
|
|
6788
|
+
throw new Error("topicId is required");
|
|
6789
|
+
}
|
|
6790
|
+
return gateway.request({
|
|
6791
|
+
path: `/api/platform/v1/reports/topics/${encodeURIComponent(topicId)}${toQueryString(
|
|
6792
|
+
{
|
|
6793
|
+
summary: typeof args.summary === "boolean" ? args.summary ? "true" : "false" : void 0
|
|
6794
|
+
}
|
|
6795
|
+
)}`
|
|
6796
|
+
}).then(
|
|
6797
|
+
(response) => mapGatewayData(
|
|
6798
|
+
response,
|
|
6799
|
+
(data) => createListResult(Array.isArray(data) ? data : [], "reports")
|
|
6800
|
+
)
|
|
6801
|
+
);
|
|
6802
|
+
};
|
|
6803
|
+
const getReport = async (reportId) => gateway.request({
|
|
6804
|
+
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
6805
|
+
});
|
|
6840
6806
|
return {
|
|
6841
6807
|
/**
|
|
6842
6808
|
* List report templates.
|
|
6843
6809
|
*/
|
|
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
|
-
},
|
|
6810
|
+
listTemplates,
|
|
6857
6811
|
/**
|
|
6858
6812
|
* @deprecated Use listTemplates.
|
|
6859
6813
|
*/
|
|
6860
|
-
|
|
6861
|
-
return this.listTemplates(args);
|
|
6862
|
-
},
|
|
6814
|
+
getTemplates: listTemplates,
|
|
6863
6815
|
/**
|
|
6864
6816
|
* List reports for a topic scope.
|
|
6865
6817
|
*/
|
|
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
|
-
},
|
|
6818
|
+
listReports,
|
|
6884
6819
|
/**
|
|
6885
6820
|
* Get a generated report.
|
|
6886
6821
|
*/
|
|
6887
|
-
|
|
6888
|
-
return gateway.request({
|
|
6889
|
-
path: `/api/platform/v1/reports/${encodeURIComponent(reportId)}`
|
|
6890
|
-
});
|
|
6891
|
-
}
|
|
6822
|
+
getReport
|
|
6892
6823
|
};
|
|
6893
6824
|
}
|
|
6894
6825
|
|
|
6895
6826
|
// ../sdk/src/schemaClient.ts
|
|
6896
6827
|
function createSchemaClient(config = {}) {
|
|
6897
6828
|
const gateway = createGatewayRequestClient(config);
|
|
6829
|
+
const createEntitlement = (input, idempotencyKey) => gateway.request({
|
|
6830
|
+
path: "/api/platform/v1/schema/entitlements",
|
|
6831
|
+
method: "POST",
|
|
6832
|
+
body: input,
|
|
6833
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6834
|
+
});
|
|
6898
6835
|
return {
|
|
6899
6836
|
/**
|
|
6900
6837
|
* List schema packs.
|
|
@@ -6946,29 +6883,95 @@ function createSchemaClient(config = {}) {
|
|
|
6946
6883
|
/**
|
|
6947
6884
|
* Create a schema entitlement.
|
|
6948
6885
|
*/
|
|
6949
|
-
|
|
6950
|
-
return gateway.request({
|
|
6951
|
-
path: "/api/platform/v1/schema/entitlements",
|
|
6952
|
-
method: "POST",
|
|
6953
|
-
body: input,
|
|
6954
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6955
|
-
});
|
|
6956
|
-
},
|
|
6886
|
+
createEntitlement,
|
|
6957
6887
|
/**
|
|
6958
6888
|
* Update a schema entitlement.
|
|
6959
6889
|
*/
|
|
6960
|
-
|
|
6961
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6962
|
-
},
|
|
6890
|
+
updateEntitlement: createEntitlement,
|
|
6963
6891
|
/**
|
|
6964
6892
|
* @deprecated Use createEntitlement or updateEntitlement.
|
|
6965
6893
|
*/
|
|
6966
|
-
|
|
6967
|
-
return this.createEntitlement(input, idempotencyKey);
|
|
6968
|
-
}
|
|
6894
|
+
upsertEntitlement: createEntitlement
|
|
6969
6895
|
};
|
|
6970
6896
|
}
|
|
6971
6897
|
|
|
6898
|
+
// ../sdk/src/clientHelpers.ts
|
|
6899
|
+
function asNodeArray(data) {
|
|
6900
|
+
const rows = asListItems(data, "nodes");
|
|
6901
|
+
if (rows.length > 0) {
|
|
6902
|
+
return rows.filter(
|
|
6903
|
+
(value) => Boolean(value) && typeof value === "object"
|
|
6904
|
+
);
|
|
6905
|
+
}
|
|
6906
|
+
if (data && typeof data === "object") {
|
|
6907
|
+
return [data];
|
|
6908
|
+
}
|
|
6909
|
+
return [];
|
|
6910
|
+
}
|
|
6911
|
+
function requireTopicId4(args) {
|
|
6912
|
+
const topicId = resolveTopicId(args);
|
|
6913
|
+
if (!topicId) {
|
|
6914
|
+
throw new Error("topicId is required");
|
|
6915
|
+
}
|
|
6916
|
+
return topicId;
|
|
6917
|
+
}
|
|
6918
|
+
function requireTopicOrProjectId(args) {
|
|
6919
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
6920
|
+
if (!topicId) {
|
|
6921
|
+
throw new Error("topicId is required");
|
|
6922
|
+
}
|
|
6923
|
+
return topicId;
|
|
6924
|
+
}
|
|
6925
|
+
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
6926
|
+
function matchesAuditNodeReference(value, nodeId) {
|
|
6927
|
+
if (Array.isArray(value)) {
|
|
6928
|
+
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
6929
|
+
}
|
|
6930
|
+
if (!value || typeof value !== "object") {
|
|
6931
|
+
return false;
|
|
6932
|
+
}
|
|
6933
|
+
return Object.entries(value).some(([key, entry]) => {
|
|
6934
|
+
if (typeof entry === "string" && entry === nodeId && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)) {
|
|
6935
|
+
return true;
|
|
6936
|
+
}
|
|
6937
|
+
if (Array.isArray(entry) && AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) && entry.some((item) => item === nodeId)) {
|
|
6938
|
+
return true;
|
|
6939
|
+
}
|
|
6940
|
+
return matchesAuditNodeReference(entry, nodeId);
|
|
6941
|
+
});
|
|
6942
|
+
}
|
|
6943
|
+
function requireText(args) {
|
|
6944
|
+
const text = resolveText(args);
|
|
6945
|
+
if (!text) {
|
|
6946
|
+
throw new Error("text is required");
|
|
6947
|
+
}
|
|
6948
|
+
return text;
|
|
6949
|
+
}
|
|
6950
|
+
function requireBaseRate(args) {
|
|
6951
|
+
const baseRate = typeof args.baseRate === "number" && Number.isFinite(args.baseRate) ? args.baseRate : 0.5;
|
|
6952
|
+
if (baseRate < 0 || baseRate > 1) {
|
|
6953
|
+
throw new Error("baseRate must be within [0, 1].");
|
|
6954
|
+
}
|
|
6955
|
+
return baseRate;
|
|
6956
|
+
}
|
|
6957
|
+
function sdkQueryString(input) {
|
|
6958
|
+
const params = new URLSearchParams();
|
|
6959
|
+
for (const [key, value] of Object.entries(input)) {
|
|
6960
|
+
if (value === void 0 || value === null) {
|
|
6961
|
+
continue;
|
|
6962
|
+
}
|
|
6963
|
+
if (Array.isArray(value)) {
|
|
6964
|
+
if (value.length > 0) {
|
|
6965
|
+
params.set(key, value.join(","));
|
|
6966
|
+
}
|
|
6967
|
+
continue;
|
|
6968
|
+
}
|
|
6969
|
+
params.set(key, String(value));
|
|
6970
|
+
}
|
|
6971
|
+
const serialized = params.toString();
|
|
6972
|
+
return serialized ? `?${serialized}` : "";
|
|
6973
|
+
}
|
|
6974
|
+
|
|
6972
6975
|
// ../sdk/src/telemetryClient.ts
|
|
6973
6976
|
var TELEMETRY_FIELDS = [
|
|
6974
6977
|
"tenantId",
|
|
@@ -7139,6 +7142,16 @@ function query4(input) {
|
|
|
7139
7142
|
cursor: input.cursor
|
|
7140
7143
|
};
|
|
7141
7144
|
}
|
|
7145
|
+
function effectiveToolsQuery(input) {
|
|
7146
|
+
return {
|
|
7147
|
+
...query4(input),
|
|
7148
|
+
callerRole: input.callerRole,
|
|
7149
|
+
surface: input.surface,
|
|
7150
|
+
sessionType: input.sessionType,
|
|
7151
|
+
permittedToolNames: input.permittedToolNames ? JSON.stringify(input.permittedToolNames) : void 0,
|
|
7152
|
+
executableOnly: input.executableOnly
|
|
7153
|
+
};
|
|
7154
|
+
}
|
|
7142
7155
|
function writeBody(input, operation) {
|
|
7143
7156
|
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
7144
7157
|
}
|
|
@@ -7167,7 +7180,9 @@ function createToolRegistryClient(config = {}) {
|
|
|
7167
7180
|
},
|
|
7168
7181
|
listEffectiveTools(input) {
|
|
7169
7182
|
return gateway.request({
|
|
7170
|
-
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
7183
|
+
path: `/api/platform/v1/tools/effective${toQueryString(
|
|
7184
|
+
effectiveToolsQuery(input)
|
|
7185
|
+
)}`
|
|
7171
7186
|
}).then(
|
|
7172
7187
|
(response) => mapGatewayData(
|
|
7173
7188
|
response,
|
|
@@ -7258,7 +7273,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
7258
7273
|
}
|
|
7259
7274
|
|
|
7260
7275
|
// ../sdk/src/version.ts
|
|
7261
|
-
var LUCERN_SDK_VERSION = "0.
|
|
7276
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
|
|
7262
7277
|
|
|
7263
7278
|
// ../sdk/src/workflowClient.ts
|
|
7264
7279
|
function normalizeLensQuery(value) {
|
|
@@ -7452,12 +7467,6 @@ function createWorkflowClient(config = {}) {
|
|
|
7452
7467
|
)
|
|
7453
7468
|
);
|
|
7454
7469
|
},
|
|
7455
|
-
/**
|
|
7456
|
-
* @deprecated Use createWorktree.
|
|
7457
|
-
*/
|
|
7458
|
-
async addWorktree(input, idempotencyKey) {
|
|
7459
|
-
return client.createWorktree(input, idempotencyKey);
|
|
7460
|
-
},
|
|
7461
7470
|
/**
|
|
7462
7471
|
* Merge a worktree into the main belief line.
|
|
7463
7472
|
*/
|
|
@@ -7655,54 +7664,19 @@ function createWorkflowClient(config = {}) {
|
|
|
7655
7664
|
body: input,
|
|
7656
7665
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7657
7666
|
});
|
|
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
7667
|
}
|
|
7689
7668
|
};
|
|
7690
|
-
return client
|
|
7669
|
+
return Object.assign(client, {
|
|
7670
|
+
addWorktree: client.createWorktree,
|
|
7671
|
+
createPillar: client.createBranch,
|
|
7672
|
+
createSprint: client.createWorktree,
|
|
7673
|
+
completeSprint: client.merge,
|
|
7674
|
+
requestReview: client.openPullRequest,
|
|
7675
|
+
publishFindings: client.push
|
|
7676
|
+
});
|
|
7691
7677
|
}
|
|
7692
7678
|
|
|
7693
7679
|
// ../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
7680
|
function toGatewayConfig(config) {
|
|
7707
7681
|
return {
|
|
7708
7682
|
baseUrl: config.baseUrl,
|
|
@@ -7730,72 +7704,9 @@ function toGatewayConfig(config) {
|
|
|
7730
7704
|
}
|
|
7731
7705
|
};
|
|
7732
7706
|
}
|
|
7733
|
-
function requireTopicId4(args) {
|
|
7734
|
-
const topicId = resolveTopicId(args);
|
|
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
7707
|
function exposeGatewayData(response) {
|
|
7780
7708
|
return Object.assign({}, response, response.data);
|
|
7781
7709
|
}
|
|
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}` : "";
|
|
7798
|
-
}
|
|
7799
7710
|
function createLucernClient(config = {}) {
|
|
7800
7711
|
const gatewayConfig = toGatewayConfig(config);
|
|
7801
7712
|
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
@@ -8019,7 +7930,7 @@ function createLucernClient(config = {}) {
|
|
|
8019
7930
|
topicId,
|
|
8020
7931
|
nodeType: "contradiction",
|
|
8021
7932
|
limit: 500
|
|
8022
|
-
}) : args.nodeId ? await graphClient.
|
|
7933
|
+
}) : args.nodeId ? await graphClient.listNodes({ nodeId: args.nodeId }) : { data: [] };
|
|
8023
7934
|
const contradictions2 = asNodeArray(response.data).filter((node) => {
|
|
8024
7935
|
const status = typeof node.metadata?.status === "string" ? node.metadata.status : typeof node.status === "string" ? node.status : "unresolved";
|
|
8025
7936
|
if (args.status && status !== args.status) {
|
|
@@ -8199,23 +8110,15 @@ function createLucernClient(config = {}) {
|
|
|
8199
8110
|
}).then(exposeGatewayData);
|
|
8200
8111
|
}
|
|
8201
8112
|
const nodesNamespace = {
|
|
8202
|
-
list
|
|
8203
|
-
return graphClient.listNodes(query5);
|
|
8204
|
-
},
|
|
8113
|
+
list: graphClient.listNodes,
|
|
8205
8114
|
get(input) {
|
|
8206
8115
|
return graphClient.getNode(
|
|
8207
8116
|
typeof input === "string" ? { nodeId: input } : input
|
|
8208
8117
|
);
|
|
8209
8118
|
},
|
|
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
|
-
},
|
|
8119
|
+
create: graphClient.createNode,
|
|
8120
|
+
update: graphClient.updateNode,
|
|
8121
|
+
batchCreate: graphClient.batchCreateNodes,
|
|
8219
8122
|
listByTopicAndType(input) {
|
|
8220
8123
|
return gateway.request({
|
|
8221
8124
|
path: `/api/platform/v1/nodes${sdkQueryString({
|
|
@@ -8240,15 +8143,9 @@ function createLucernClient(config = {}) {
|
|
|
8240
8143
|
})}`
|
|
8241
8144
|
}).then(exposeGatewayData);
|
|
8242
8145
|
},
|
|
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
|
-
}
|
|
8146
|
+
supersede: graphClient.supersedeNode,
|
|
8147
|
+
verify: graphClient.verifyNode,
|
|
8148
|
+
hardDelete: graphClient.hardDeleteNode
|
|
8252
8149
|
};
|
|
8253
8150
|
const publicationNamespace = {
|
|
8254
8151
|
create(input, idempotencyKey) {
|
|
@@ -8325,9 +8222,7 @@ function createLucernClient(config = {}) {
|
|
|
8325
8222
|
return {
|
|
8326
8223
|
config,
|
|
8327
8224
|
version: LUCERN_SDK_VERSION,
|
|
8328
|
-
search
|
|
8329
|
-
return searchResources(query5, options);
|
|
8330
|
-
},
|
|
8225
|
+
search: searchResources,
|
|
8331
8226
|
events: {
|
|
8332
8227
|
list(query5 = {}) {
|
|
8333
8228
|
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
@@ -8424,9 +8319,7 @@ function createLucernClient(config = {}) {
|
|
|
8424
8319
|
confidenceHistory(nodeId) {
|
|
8425
8320
|
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
8426
8321
|
},
|
|
8427
|
-
opinionHistory
|
|
8428
|
-
return getOpinionHistory(nodeId);
|
|
8429
|
-
},
|
|
8322
|
+
opinionHistory: getOpinionHistory,
|
|
8430
8323
|
createContract(nodeId, input) {
|
|
8431
8324
|
return beliefsFacade.createContract(nodeId, input).then(exposeGatewayData);
|
|
8432
8325
|
},
|
|
@@ -8680,10 +8573,10 @@ function createLucernClient(config = {}) {
|
|
|
8680
8573
|
}));
|
|
8681
8574
|
},
|
|
8682
8575
|
getHighPriority(args) {
|
|
8683
|
-
return
|
|
8576
|
+
return questionsFacade.list({
|
|
8684
8577
|
topicId: requireTopicId4(args),
|
|
8685
8578
|
status: args.includeAnswered ? void 0 : "open"
|
|
8686
|
-
}).then((data) => {
|
|
8579
|
+
}).then(exposeGatewayData).then((data) => {
|
|
8687
8580
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
8688
8581
|
const rank = (priority) => {
|
|
8689
8582
|
switch (priority) {
|
|
@@ -8713,9 +8606,7 @@ function createLucernClient(config = {}) {
|
|
|
8713
8606
|
},
|
|
8714
8607
|
graph: {
|
|
8715
8608
|
nodes: nodesNamespace,
|
|
8716
|
-
createEdge
|
|
8717
|
-
return graphClient.createEdge(input);
|
|
8718
|
-
},
|
|
8609
|
+
createEdge: graphClient.createEdge,
|
|
8719
8610
|
neighborhood(args) {
|
|
8720
8611
|
return graphFacade.neighborhood({
|
|
8721
8612
|
globalId: args.globalId,
|
|
@@ -8774,7 +8665,7 @@ function createLucernClient(config = {}) {
|
|
|
8774
8665
|
bisectConfidence,
|
|
8775
8666
|
listBeliefs,
|
|
8776
8667
|
detectConfirmationBias(topicId, threshold) {
|
|
8777
|
-
return
|
|
8668
|
+
return graphFacade.bias({
|
|
8778
8669
|
topicId,
|
|
8779
8670
|
threshold,
|
|
8780
8671
|
limit: 200
|
|
@@ -8785,7 +8676,7 @@ function createLucernClient(config = {}) {
|
|
|
8785
8676
|
}));
|
|
8786
8677
|
},
|
|
8787
8678
|
getStructureAnalysis(topicId) {
|
|
8788
|
-
return
|
|
8679
|
+
return graphFacade.analyze({
|
|
8789
8680
|
topicId,
|
|
8790
8681
|
limit: 200
|
|
8791
8682
|
}).then((response) => ({
|
|
@@ -8852,38 +8743,20 @@ function createLucernClient(config = {}) {
|
|
|
8852
8743
|
}
|
|
8853
8744
|
},
|
|
8854
8745
|
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
|
-
},
|
|
8746
|
+
create: decisionsClient.createJudgment,
|
|
8747
|
+
record: decisionsClient.recordJudgment,
|
|
8748
|
+
list: decisionsClient.listJudgments,
|
|
8749
|
+
get: decisionsClient.getJudgment,
|
|
8750
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
8751
|
+
updateOutcome: decisionsClient.updateJudgmentOutcome,
|
|
8873
8752
|
readiness(topicId) {
|
|
8874
|
-
return decisionsClient.getJudgmentReadiness({
|
|
8875
|
-
topicId
|
|
8876
|
-
});
|
|
8753
|
+
return decisionsClient.getJudgmentReadiness({ topicId });
|
|
8877
8754
|
},
|
|
8878
8755
|
calibration(topicId) {
|
|
8879
|
-
return decisionsClient.getJudgmentCalibration({
|
|
8880
|
-
topicId
|
|
8881
|
-
});
|
|
8756
|
+
return decisionsClient.getJudgmentCalibration({ topicId });
|
|
8882
8757
|
},
|
|
8883
8758
|
pendingOutcomeReview(topicId) {
|
|
8884
|
-
return decisionsClient.listPendingJudgmentOutcomeReview({
|
|
8885
|
-
topicId
|
|
8886
|
-
});
|
|
8759
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
|
|
8887
8760
|
},
|
|
8888
8761
|
transitionAuditIntegrity(args) {
|
|
8889
8762
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
@@ -8893,21 +8766,11 @@ function createLucernClient(config = {}) {
|
|
|
8893
8766
|
}
|
|
8894
8767
|
},
|
|
8895
8768
|
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
|
-
},
|
|
8769
|
+
create: decisionsClient.createJudgment,
|
|
8770
|
+
record: decisionsClient.recordJudgment,
|
|
8771
|
+
list: decisionsClient.listJudgments,
|
|
8772
|
+
get: decisionsClient.getJudgment,
|
|
8773
|
+
recordOutcome: decisionsClient.recordJudgmentOutcome,
|
|
8911
8774
|
lessons(decisionId, input, idempotencyKey) {
|
|
8912
8775
|
return gateway.request({
|
|
8913
8776
|
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
@@ -8939,21 +8802,11 @@ function createLucernClient(config = {}) {
|
|
|
8939
8802
|
}
|
|
8940
8803
|
},
|
|
8941
8804
|
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
|
-
},
|
|
8805
|
+
createBranch: workflowClient.createBranch,
|
|
8806
|
+
createLens: workflowClient.createLens,
|
|
8807
|
+
listLenses: workflowClient.listLenses,
|
|
8808
|
+
applyLensToTopic: workflowClient.applyLensToTopic,
|
|
8809
|
+
removeLensFromTopic: workflowClient.removeLensFromTopic,
|
|
8957
8810
|
create(input) {
|
|
8958
8811
|
return worktreesFacade.create({
|
|
8959
8812
|
title: input.title,
|
|
@@ -9058,7 +8911,9 @@ function createLucernClient(config = {}) {
|
|
|
9058
8911
|
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
9059
8912
|
(value) => typeof value === "string"
|
|
9060
8913
|
) : void 0;
|
|
9061
|
-
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8914
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8915
|
+
(value) => typeof value === "string"
|
|
8916
|
+
) : void 0;
|
|
9062
8917
|
return worktreesFacade.update({
|
|
9063
8918
|
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
9064
8919
|
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
@@ -9072,7 +8927,23 @@ function createLucernClient(config = {}) {
|
|
|
9072
8927
|
});
|
|
9073
8928
|
},
|
|
9074
8929
|
update(input) {
|
|
9075
|
-
|
|
8930
|
+
const dependsOn = Array.isArray(input.dependsOn) ? input.dependsOn.filter(
|
|
8931
|
+
(value) => typeof value === "string"
|
|
8932
|
+
) : void 0;
|
|
8933
|
+
const blocks = Array.isArray(input.blocks) ? input.blocks.filter(
|
|
8934
|
+
(value) => typeof value === "string"
|
|
8935
|
+
) : void 0;
|
|
8936
|
+
return worktreesFacade.update({
|
|
8937
|
+
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
8938
|
+
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : void 0,
|
|
8939
|
+
campaign: typeof input.campaign === "number" ? input.campaign : void 0,
|
|
8940
|
+
lane: typeof input.lane === "string" ? input.lane : void 0,
|
|
8941
|
+
laneOrderInCampaign: typeof input.laneOrderInCampaign === "number" ? input.laneOrderInCampaign : void 0,
|
|
8942
|
+
orderInLane: typeof input.orderInLane === "number" ? input.orderInLane : void 0,
|
|
8943
|
+
dependsOn,
|
|
8944
|
+
blocks,
|
|
8945
|
+
gate: typeof input.gate === "string" ? input.gate : void 0
|
|
8946
|
+
});
|
|
9076
8947
|
},
|
|
9077
8948
|
updateTargets(input) {
|
|
9078
8949
|
return worktreesFacade.updateTargets({
|
|
@@ -9083,9 +8954,7 @@ function createLucernClient(config = {}) {
|
|
|
9083
8954
|
removeQuestionIds: input.removeQuestionIds
|
|
9084
8955
|
});
|
|
9085
8956
|
},
|
|
9086
|
-
listAll
|
|
9087
|
-
return workflowClient.listAllWorktrees(query5);
|
|
9088
|
-
},
|
|
8957
|
+
listAll: workflowClient.listAllWorktrees,
|
|
9089
8958
|
merge(worktreeId, input) {
|
|
9090
8959
|
return worktreesFacade.merge({
|
|
9091
8960
|
id: worktreeId,
|
|
@@ -9093,18 +8962,12 @@ function createLucernClient(config = {}) {
|
|
|
9093
8962
|
summary: input.summary
|
|
9094
8963
|
});
|
|
9095
8964
|
},
|
|
9096
|
-
push
|
|
9097
|
-
|
|
9098
|
-
},
|
|
9099
|
-
openPullRequest(worktreeId, input) {
|
|
9100
|
-
return workflowClient.openPullRequest(worktreeId, input);
|
|
9101
|
-
},
|
|
8965
|
+
push: workflowClient.push,
|
|
8966
|
+
openPullRequest: workflowClient.openPullRequest,
|
|
9102
8967
|
pipelineSnapshot(topicId) {
|
|
9103
8968
|
return functionSurfaceClient.pipelineSnapshot({ topicId });
|
|
9104
8969
|
},
|
|
9105
|
-
complete
|
|
9106
|
-
return worktreesFacade.complete(input, idempotencyKey);
|
|
9107
|
-
},
|
|
8970
|
+
complete: worktreesFacade.complete,
|
|
9108
8971
|
advancePhase(worktreeId, idempotencyKey) {
|
|
9109
8972
|
return worktreesFacade.advancePhase(
|
|
9110
8973
|
{ worktreeId },
|
|
@@ -9117,12 +8980,8 @@ function createLucernClient(config = {}) {
|
|
|
9117
8980
|
idempotencyKey
|
|
9118
8981
|
);
|
|
9119
8982
|
},
|
|
9120
|
-
patchState
|
|
9121
|
-
|
|
9122
|
-
},
|
|
9123
|
-
bulkCreate(input, idempotencyKey) {
|
|
9124
|
-
return worktreesFacade.bulkCreate(input, idempotencyKey);
|
|
9125
|
-
}
|
|
8983
|
+
patchState: worktreesFacade.patchState,
|
|
8984
|
+
bulkCreate: worktreesFacade.bulkCreate
|
|
9126
8985
|
},
|
|
9127
8986
|
context: {
|
|
9128
8987
|
listTopics(query5 = {}) {
|
|
@@ -9133,27 +8992,15 @@ function createLucernClient(config = {}) {
|
|
|
9133
8992
|
type: query5.type
|
|
9134
8993
|
});
|
|
9135
8994
|
},
|
|
9136
|
-
compile
|
|
9137
|
-
|
|
9138
|
-
},
|
|
9139
|
-
recordScopeLearning(input, idempotencyKey) {
|
|
9140
|
-
return functionSurfaceClient.recordScopeLearning(input, idempotencyKey);
|
|
9141
|
-
},
|
|
8995
|
+
compile: contextClient.compile,
|
|
8996
|
+
recordScopeLearning: functionSurfaceClient.recordScopeLearning,
|
|
9142
8997
|
discover(input) {
|
|
9143
8998
|
return discoverTopics(input);
|
|
9144
8999
|
},
|
|
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
|
-
},
|
|
9000
|
+
analyzeTopicDensity: functionSurfaceClient.analyzeTopicDensity,
|
|
9001
|
+
applyAutoBranching: functionSurfaceClient.applyAutoBranching,
|
|
9002
|
+
seedBeliefLattice: functionSurfaceClient.seedBeliefLattice,
|
|
9003
|
+
getLatticeCoverage: functionSurfaceClient.getLatticeCoverage,
|
|
9157
9004
|
matchEntityType(input) {
|
|
9158
9005
|
return ontologiesFacade.match(input).then(exposeGatewayData);
|
|
9159
9006
|
},
|
|
@@ -9238,9 +9085,7 @@ function createLucernClient(config = {}) {
|
|
|
9238
9085
|
type: input.type
|
|
9239
9086
|
});
|
|
9240
9087
|
},
|
|
9241
|
-
get
|
|
9242
|
-
return topicsFacade.get(topicId);
|
|
9243
|
-
},
|
|
9088
|
+
get: topicsFacade.get,
|
|
9244
9089
|
create(input) {
|
|
9245
9090
|
return topicsFacade.create({
|
|
9246
9091
|
name: input.name,
|
|
@@ -9285,12 +9130,8 @@ function createLucernClient(config = {}) {
|
|
|
9285
9130
|
maxDepth: query5.maxDepth
|
|
9286
9131
|
});
|
|
9287
9132
|
},
|
|
9288
|
-
remove
|
|
9289
|
-
|
|
9290
|
-
},
|
|
9291
|
-
bulkCreate(input, idempotencyKey) {
|
|
9292
|
-
return topicsFacade.bulkCreate(input, idempotencyKey);
|
|
9293
|
-
}
|
|
9133
|
+
remove: topicsFacade.remove,
|
|
9134
|
+
bulkCreate: topicsFacade.bulkCreate
|
|
9294
9135
|
},
|
|
9295
9136
|
answers: {
|
|
9296
9137
|
create(input) {
|
|
@@ -9389,33 +9230,15 @@ function createLucernClient(config = {}) {
|
|
|
9389
9230
|
raw: ontologyClient
|
|
9390
9231
|
},
|
|
9391
9232
|
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
|
-
}
|
|
9233
|
+
registerSession: functionSurfaceClient.registerSession,
|
|
9234
|
+
heartbeatSession: functionSurfaceClient.heartbeatSession,
|
|
9235
|
+
endSession: functionSurfaceClient.endSession,
|
|
9236
|
+
listActiveSessions: functionSurfaceClient.listActiveSessions,
|
|
9237
|
+
sendAgentMessage: functionSurfaceClient.sendAgentMessage,
|
|
9238
|
+
broadcastMessage: functionSurfaceClient.broadcastMessage,
|
|
9239
|
+
getInbox: functionSurfaceClient.getAgentInbox,
|
|
9240
|
+
getAgentInbox: functionSurfaceClient.getAgentInbox,
|
|
9241
|
+
claimFiles: functionSurfaceClient.claimFiles
|
|
9419
9242
|
},
|
|
9420
9243
|
policy: {
|
|
9421
9244
|
checkPermission(input) {
|
|
@@ -9446,38 +9269,24 @@ function createLucernClient(config = {}) {
|
|
|
9446
9269
|
principalId: typeof input.principalId === "string" ? input.principalId : void 0
|
|
9447
9270
|
});
|
|
9448
9271
|
},
|
|
9272
|
+
// Backward compatibility shim: keep the policy namespace exposing the
|
|
9273
|
+
// historical manageWritePolicy entry point.
|
|
9449
9274
|
manageWritePolicy(input, idempotencyKey) {
|
|
9450
9275
|
return functionSurfaceClient.manageWritePolicy(input, idempotencyKey);
|
|
9451
9276
|
},
|
|
9452
9277
|
raw: policyClient
|
|
9453
9278
|
},
|
|
9454
9279
|
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
|
-
}
|
|
9280
|
+
ingest: functionSurfaceClient.ingestObservation,
|
|
9281
|
+
ingestObservation: functionSurfaceClient.ingestObservation,
|
|
9282
|
+
getContext: functionSurfaceClient.getObservationContext,
|
|
9283
|
+
getObservationContext: functionSurfaceClient.getObservationContext
|
|
9467
9284
|
},
|
|
9468
9285
|
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
|
-
}
|
|
9286
|
+
getCodeContext: functionSurfaceClient.getCodeContext,
|
|
9287
|
+
getChangeHistory: functionSurfaceClient.getChangeHistory,
|
|
9288
|
+
recordAttempt: functionSurfaceClient.recordAttempt,
|
|
9289
|
+
getFailureLog: functionSurfaceClient.getFailureLog
|
|
9481
9290
|
},
|
|
9482
9291
|
contracts: {
|
|
9483
9292
|
create(input) {
|
|
@@ -9503,9 +9312,7 @@ function createLucernClient(config = {}) {
|
|
|
9503
9312
|
}
|
|
9504
9313
|
},
|
|
9505
9314
|
bootstrap: {
|
|
9506
|
-
generateSessionHandoff
|
|
9507
|
-
return functionSurfaceClient.generateSessionHandoff(input);
|
|
9508
|
-
}
|
|
9315
|
+
generateSessionHandoff: functionSurfaceClient.generateSessionHandoff
|
|
9509
9316
|
},
|
|
9510
9317
|
embeddings: embeddingsClient,
|
|
9511
9318
|
graphAnalysis: graphAnalysisClient,
|
|
@@ -9527,25 +9334,15 @@ function createLucernClient(config = {}) {
|
|
|
9527
9334
|
createAcl: toolRegistryClient.createAcl,
|
|
9528
9335
|
deleteAcl: toolRegistryClient.deleteAcl,
|
|
9529
9336
|
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
9530
|
-
register
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
return unregisterCustomTool(fullName);
|
|
9535
|
-
},
|
|
9536
|
-
list() {
|
|
9537
|
-
return listRegisteredCustomTools();
|
|
9538
|
-
},
|
|
9539
|
-
clear() {
|
|
9540
|
-
clearRegisteredCustomTools();
|
|
9541
|
-
},
|
|
9337
|
+
register: registerCustomTool,
|
|
9338
|
+
unregister: unregisterCustomTool,
|
|
9339
|
+
list: listRegisteredCustomTools,
|
|
9340
|
+
clear: clearRegisteredCustomTools,
|
|
9542
9341
|
invoke(name, input = {}) {
|
|
9543
9342
|
const fullName = name.includes(".") ? name : `custom.${name}`;
|
|
9544
9343
|
return invokeCustomTool(fullName, input);
|
|
9545
9344
|
},
|
|
9546
|
-
namespace
|
|
9547
|
-
return getCustomNamespace(namespace);
|
|
9548
|
-
}
|
|
9345
|
+
namespace: getCustomNamespace
|
|
9549
9346
|
},
|
|
9550
9347
|
packs: {
|
|
9551
9348
|
/**
|
|
@@ -9560,27 +9357,13 @@ function createLucernClient(config = {}) {
|
|
|
9560
9357
|
get isInstalled() {
|
|
9561
9358
|
return _packInstalled;
|
|
9562
9359
|
},
|
|
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
|
-
}
|
|
9360
|
+
listCatalog: packsClient.listCatalog,
|
|
9361
|
+
catalog: packsClient.listCatalog,
|
|
9362
|
+
listStates: packsClient.listStates,
|
|
9363
|
+
states: packsClient.getStates,
|
|
9364
|
+
install: packsClient.install,
|
|
9365
|
+
enable: packsClient.enable,
|
|
9366
|
+
disable: packsClient.disable
|
|
9584
9367
|
},
|
|
9585
9368
|
nodes: nodesNamespace,
|
|
9586
9369
|
identity: {
|
|
@@ -9593,30 +9376,16 @@ function createLucernClient(config = {}) {
|
|
|
9593
9376
|
raw: identityClient
|
|
9594
9377
|
},
|
|
9595
9378
|
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
|
-
}
|
|
9379
|
+
bootstrapSession: mcpClient.bootstrapSession,
|
|
9380
|
+
checkWritePolicy: mcpClient.checkWritePolicy,
|
|
9381
|
+
beginBuildSession: mcpClient.beginBuildSession,
|
|
9382
|
+
evaluateEngineeringContract: mcpClient.evaluateEngineeringContract,
|
|
9383
|
+
evaluateResearchContract: mcpClient.evaluateResearchContract
|
|
9611
9384
|
},
|
|
9612
9385
|
auth: {
|
|
9613
9386
|
device: {
|
|
9614
|
-
createCode
|
|
9615
|
-
|
|
9616
|
-
},
|
|
9617
|
-
pollToken(deviceCode) {
|
|
9618
|
-
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
9619
|
-
}
|
|
9387
|
+
createCode: authDeviceClient.createDeviceCode,
|
|
9388
|
+
pollToken: authDeviceClient.pollDeviceToken
|
|
9620
9389
|
}
|
|
9621
9390
|
},
|
|
9622
9391
|
custom: getCustomNamespace("custom"),
|
|
@@ -9669,50 +9438,55 @@ function cleanNumber2(value) {
|
|
|
9669
9438
|
function cleanBoolean2(value) {
|
|
9670
9439
|
return typeof value === "boolean" ? value : void 0;
|
|
9671
9440
|
}
|
|
9672
|
-
function buildCompileContextRequest2(
|
|
9673
|
-
const
|
|
9674
|
-
const
|
|
9441
|
+
function buildCompileContextRequest2(topicIdOrInput = {}, input = {}) {
|
|
9442
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
9443
|
+
const payload = {};
|
|
9444
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString6(topicIdOrInput) : cleanString6(effectiveInput.topicId);
|
|
9445
|
+
if (topicId) {
|
|
9446
|
+
payload.topicId = topicId;
|
|
9447
|
+
}
|
|
9448
|
+
const query5 = cleanString6(effectiveInput.query);
|
|
9675
9449
|
if (query5) {
|
|
9676
9450
|
payload.query = query5;
|
|
9677
9451
|
}
|
|
9678
|
-
const budget = cleanNumber2(
|
|
9452
|
+
const budget = cleanNumber2(effectiveInput.budget) ?? cleanNumber2(effectiveInput.tokenBudget);
|
|
9679
9453
|
if (budget !== void 0) {
|
|
9680
9454
|
payload.budget = budget;
|
|
9681
9455
|
}
|
|
9682
|
-
const ranking = cleanString6(
|
|
9456
|
+
const ranking = cleanString6(effectiveInput.ranking) ?? cleanString6(effectiveInput.rankingProfile);
|
|
9683
9457
|
if (ranking) {
|
|
9684
9458
|
payload.ranking = ranking;
|
|
9685
9459
|
}
|
|
9686
|
-
const limit = cleanNumber2(
|
|
9460
|
+
const limit = cleanNumber2(effectiveInput.limit);
|
|
9687
9461
|
if (limit !== void 0) {
|
|
9688
9462
|
payload.limit = limit;
|
|
9689
9463
|
}
|
|
9690
|
-
const maxDepth = cleanNumber2(
|
|
9464
|
+
const maxDepth = cleanNumber2(effectiveInput.maxDepth);
|
|
9691
9465
|
if (maxDepth !== void 0) {
|
|
9692
9466
|
payload.maxDepth = maxDepth;
|
|
9693
9467
|
}
|
|
9694
|
-
const includeEntities = cleanBoolean2(
|
|
9468
|
+
const includeEntities = cleanBoolean2(effectiveInput.includeEntities);
|
|
9695
9469
|
if (includeEntities !== void 0) {
|
|
9696
9470
|
payload.includeEntities = includeEntities;
|
|
9697
9471
|
}
|
|
9698
|
-
const mode = cleanString6(
|
|
9472
|
+
const mode = cleanString6(effectiveInput.mode);
|
|
9699
9473
|
if (mode) {
|
|
9700
9474
|
payload.mode = mode;
|
|
9701
9475
|
}
|
|
9702
|
-
const includeFailures = cleanBoolean2(
|
|
9476
|
+
const includeFailures = cleanBoolean2(effectiveInput.includeFailures);
|
|
9703
9477
|
if (includeFailures !== void 0) {
|
|
9704
9478
|
payload.includeFailures = includeFailures;
|
|
9705
9479
|
}
|
|
9706
|
-
const worktreeId = cleanString6(
|
|
9480
|
+
const worktreeId = cleanString6(effectiveInput.worktreeId);
|
|
9707
9481
|
if (worktreeId) {
|
|
9708
9482
|
payload.worktreeId = worktreeId;
|
|
9709
9483
|
}
|
|
9710
|
-
const sessionId = cleanString6(
|
|
9484
|
+
const sessionId = cleanString6(effectiveInput.sessionId);
|
|
9711
9485
|
if (sessionId) {
|
|
9712
9486
|
payload.sessionId = sessionId;
|
|
9713
9487
|
}
|
|
9714
|
-
if (Array.isArray(
|
|
9715
|
-
payload.packWeightOverrides =
|
|
9488
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
9489
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
9716
9490
|
}
|
|
9717
9491
|
return {
|
|
9718
9492
|
path: "/api/platform/v1/context/compile",
|
|
@@ -9722,8 +9496,12 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
9722
9496
|
}
|
|
9723
9497
|
function createContextFacade(config) {
|
|
9724
9498
|
return {
|
|
9725
|
-
compile(
|
|
9726
|
-
const request = buildCompileContextRequest2(
|
|
9499
|
+
compile(topicIdOrInput = {}, input = {}) {
|
|
9500
|
+
const request = buildCompileContextRequest2(topicIdOrInput, input);
|
|
9501
|
+
return config.transport.request(request);
|
|
9502
|
+
},
|
|
9503
|
+
compileByQuery(input = {}) {
|
|
9504
|
+
const request = buildCompileContextRequest2(input);
|
|
9727
9505
|
return config.transport.request(request);
|
|
9728
9506
|
}
|
|
9729
9507
|
};
|
|
@@ -9802,17 +9580,11 @@ var TOKENS_PER_WORD = 1.35;
|
|
|
9802
9580
|
var MIN_TOKEN_ESTIMATE = 8;
|
|
9803
9581
|
|
|
9804
9582
|
// ../sdk/src/contextPackPolicy.ts
|
|
9805
|
-
function nowMs() {
|
|
9806
|
-
return Date.now();
|
|
9807
|
-
}
|
|
9808
|
-
function normalizeText(text) {
|
|
9809
|
-
return text.trim().toLowerCase();
|
|
9810
|
-
}
|
|
9811
9583
|
function tokenHits(text, tokens) {
|
|
9812
9584
|
if (tokens.length === 0) {
|
|
9813
9585
|
return 1;
|
|
9814
9586
|
}
|
|
9815
|
-
const haystack =
|
|
9587
|
+
const haystack = text.trim().toLowerCase();
|
|
9816
9588
|
let hits = 0;
|
|
9817
9589
|
for (const token of tokens) {
|
|
9818
9590
|
if (haystack.includes(token)) {
|
|
@@ -9827,7 +9599,7 @@ function clamp013(value) {
|
|
|
9827
9599
|
}
|
|
9828
9600
|
return Math.max(0, Math.min(1, value));
|
|
9829
9601
|
}
|
|
9830
|
-
function recencyScore(updatedAt, referenceTimeMs =
|
|
9602
|
+
function recencyScore(updatedAt, referenceTimeMs = Date.now()) {
|
|
9831
9603
|
if (!updatedAt || !Number.isFinite(updatedAt)) {
|
|
9832
9604
|
return 0.25;
|
|
9833
9605
|
}
|
|
@@ -9843,15 +9615,15 @@ function confidenceScore(confidence) {
|
|
|
9843
9615
|
return clamp013(confidence);
|
|
9844
9616
|
}
|
|
9845
9617
|
function priorityScore(priority) {
|
|
9846
|
-
const value =
|
|
9618
|
+
const value = (priority || "").trim().toLowerCase();
|
|
9847
9619
|
return PRIORITY_SCORES[value] ?? DEFAULT_PRIORITY_SCORE;
|
|
9848
9620
|
}
|
|
9849
9621
|
function severityScore(severity) {
|
|
9850
|
-
const value =
|
|
9622
|
+
const value = (severity || "").trim().toLowerCase();
|
|
9851
9623
|
return SEVERITY_SCORES[value] ?? DEFAULT_SEVERITY_SCORE;
|
|
9852
9624
|
}
|
|
9853
9625
|
function beliefTypeBonus(beliefType) {
|
|
9854
|
-
const value =
|
|
9626
|
+
const value = (beliefType || "").trim().toLowerCase();
|
|
9855
9627
|
return BELIEF_TYPE_BONUS[value] ?? DEFAULT_BELIEF_TYPE_BONUS;
|
|
9856
9628
|
}
|
|
9857
9629
|
function resolveEffectiveWeights(overrides) {
|
|
@@ -9877,7 +9649,7 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
9877
9649
|
}
|
|
9878
9650
|
const ts = candidate.updatedAt || candidate.createdAt || null;
|
|
9879
9651
|
if (ts && Number.isFinite(ts)) {
|
|
9880
|
-
const ageDays = Math.max(0,
|
|
9652
|
+
const ageDays = Math.max(0, Date.now() - ts) / (1e3 * 60 * 60 * 24);
|
|
9881
9653
|
if (ageDays < 1) {
|
|
9882
9654
|
parts.push("updated today");
|
|
9883
9655
|
} else if (ageDays < 7) {
|
|
@@ -9902,10 +9674,6 @@ function generateJustification(_section, candidate, queryTokens, weights) {
|
|
|
9902
9674
|
}
|
|
9903
9675
|
return parts.join(", ");
|
|
9904
9676
|
}
|
|
9905
|
-
function computeBaselineScore(candidate, queryTokens) {
|
|
9906
|
-
const hits = tokenHits(candidate.text, queryTokens);
|
|
9907
|
-
return queryTokens.length === 0 ? 1 : hits;
|
|
9908
|
-
}
|
|
9909
9677
|
function computeWeightedScore(section, candidate, queryTokens, effectiveWeights, referenceTimeMs) {
|
|
9910
9678
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
9911
9679
|
const queryComponent = queryTokens.length === 0 ? 0.4 : clamp013(tokenHits(candidate.text, queryTokens) / queryTokens.length);
|
|
@@ -9939,7 +9707,7 @@ function rankContextSection(section, rows, queryTokens, limit, profile, options)
|
|
|
9939
9707
|
queryTokens,
|
|
9940
9708
|
effectiveWeights,
|
|
9941
9709
|
referenceTimeMs
|
|
9942
|
-
) :
|
|
9710
|
+
) : queryTokens.length === 0 ? 1 : tokenHits(row.text, queryTokens);
|
|
9943
9711
|
const result = { ...row, score };
|
|
9944
9712
|
if (includeJustifications && profile === "weighted_v1") {
|
|
9945
9713
|
const weights = (effectiveWeights ?? RANKING_WEIGHTS)[section];
|
|
@@ -10306,18 +10074,21 @@ function normalizeQueryTokens(query5) {
|
|
|
10306
10074
|
function parseRankingProfile(value) {
|
|
10307
10075
|
return value === "baseline_v1" ? "baseline_v1" : "weighted_v1";
|
|
10308
10076
|
}
|
|
10077
|
+
function isRecord5(value) {
|
|
10078
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10079
|
+
}
|
|
10309
10080
|
function beliefTypeOf(node) {
|
|
10310
10081
|
if (typeof node.beliefType === "string") {
|
|
10311
10082
|
return node.beliefType;
|
|
10312
10083
|
}
|
|
10313
|
-
const metadata = node.metadata
|
|
10084
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10314
10085
|
if (typeof metadata.beliefType === "string") {
|
|
10315
10086
|
return metadata.beliefType;
|
|
10316
10087
|
}
|
|
10317
10088
|
return "";
|
|
10318
10089
|
}
|
|
10319
10090
|
function questionStatusOf(node) {
|
|
10320
|
-
const metadata = node.metadata
|
|
10091
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10321
10092
|
const direct = typeof node.status === "string" ? node.status : "";
|
|
10322
10093
|
const questionStatus = typeof metadata.questionStatus === "string" ? metadata.questionStatus : "";
|
|
10323
10094
|
return (questionStatus || direct || "open").toLowerCase();
|
|
@@ -10333,9 +10104,6 @@ function isOpenQuestion(status) {
|
|
|
10333
10104
|
"belief_forked"
|
|
10334
10105
|
].includes(status);
|
|
10335
10106
|
}
|
|
10336
|
-
function metadataText(payload) {
|
|
10337
|
-
return JSON.stringify(payload).toLowerCase();
|
|
10338
|
-
}
|
|
10339
10107
|
function collectTopicNeighborhood(topics2, rootTopicId, maxDescendantDepth = 2) {
|
|
10340
10108
|
const byId = /* @__PURE__ */ new Map();
|
|
10341
10109
|
const children = /* @__PURE__ */ new Map();
|
|
@@ -10397,11 +10165,10 @@ function dedupeById(rows) {
|
|
|
10397
10165
|
return output;
|
|
10398
10166
|
}
|
|
10399
10167
|
function candidateTimestamp(candidate) {
|
|
10400
|
-
if (!candidate
|
|
10168
|
+
if (!isRecord5(candidate)) {
|
|
10401
10169
|
return 0;
|
|
10402
10170
|
}
|
|
10403
|
-
const
|
|
10404
|
-
const timestamps = [record.updatedAt, record.createdAt, record.generatedAt].filter(
|
|
10171
|
+
const timestamps = [candidate.updatedAt, candidate.createdAt, candidate.generatedAt].filter(
|
|
10405
10172
|
(value) => typeof value === "number" && Number.isFinite(value)
|
|
10406
10173
|
);
|
|
10407
10174
|
return timestamps.length > 0 ? Math.max(...timestamps) : 0;
|
|
@@ -10523,7 +10290,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10523
10290
|
beliefType: beliefTypeOf(belief) || null,
|
|
10524
10291
|
status: belief.status || "active",
|
|
10525
10292
|
updatedAt: belief.updatedAt || belief.createdAt || null,
|
|
10526
|
-
metadataText: belief.metadata && typeof belief.metadata === "object" ?
|
|
10293
|
+
metadataText: belief.metadata && typeof belief.metadata === "object" ? JSON.stringify(belief.metadata).toLowerCase() : ""
|
|
10527
10294
|
}));
|
|
10528
10295
|
const activeBeliefs = rankContextSection(
|
|
10529
10296
|
"activeBeliefs",
|
|
@@ -10555,7 +10322,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10555
10322
|
status,
|
|
10556
10323
|
priority: typeof metadata.priority === "string" ? metadata.priority : "medium",
|
|
10557
10324
|
updatedAt: question.updatedAt || question.createdAt || null,
|
|
10558
|
-
metadataText:
|
|
10325
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
10559
10326
|
};
|
|
10560
10327
|
}).filter((row) => isOpenQuestion(row.status));
|
|
10561
10328
|
const openQuestions = rankContextSection(
|
|
@@ -10587,7 +10354,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10587
10354
|
kind: typeof metadata.kind === "string" && metadata.kind || "observation",
|
|
10588
10355
|
createdAt: item.createdAt || null,
|
|
10589
10356
|
updatedAt: item.updatedAt || item.createdAt || null,
|
|
10590
|
-
metadataText:
|
|
10357
|
+
metadataText: JSON.stringify(metadata).toLowerCase()
|
|
10591
10358
|
};
|
|
10592
10359
|
});
|
|
10593
10360
|
const recentEvidence = rankContextSection(
|
|
@@ -10669,7 +10436,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10669
10436
|
let failureContext;
|
|
10670
10437
|
if (snapshot.plan.includeFailures && snapshot.failures) {
|
|
10671
10438
|
const allFailures = snapshot.failures.filter((node) => {
|
|
10672
|
-
const metadata = node.metadata
|
|
10439
|
+
const metadata = isRecord5(node.metadata) ? node.metadata : {};
|
|
10673
10440
|
return metadata.failedApproach === true || metadata.isFailedAttempt === true;
|
|
10674
10441
|
});
|
|
10675
10442
|
const rankedFailures = rankContextSection(
|
|
@@ -10687,7 +10454,7 @@ function compileContextPackFromSnapshot(snapshot) {
|
|
|
10687
10454
|
);
|
|
10688
10455
|
const failures = rankedFailures.map((row) => {
|
|
10689
10456
|
const original = allFailures.find((node) => String(node._id) === row.id);
|
|
10690
|
-
const metadata = original?.metadata
|
|
10457
|
+
const metadata = isRecord5(original?.metadata) ? original?.metadata : {};
|
|
10691
10458
|
return {
|
|
10692
10459
|
attemptId: row.id,
|
|
10693
10460
|
approach: String(row.text || ""),
|
|
@@ -11171,9 +10938,7 @@ function lastDelegator(delegationChain) {
|
|
|
11171
10938
|
|
|
11172
10939
|
// ../sdk/src/contracts/lens-filter.contract.ts
|
|
11173
10940
|
function isLensFilterCriteria(value) {
|
|
11174
|
-
|
|
11175
|
-
const obj = value;
|
|
11176
|
-
return typeof obj.version === "number" && typeof obj.kind === "string";
|
|
10941
|
+
return isRecord6(value) && typeof value.version === "number" && typeof value.kind === "string";
|
|
11177
10942
|
}
|
|
11178
10943
|
function isTaxonomyFilterCriteriaV1(value) {
|
|
11179
10944
|
if (!isLensFilterCriteria(value)) return false;
|
|
@@ -11202,6 +10967,9 @@ function validateFilterCriteria(value) {
|
|
|
11202
10967
|
]
|
|
11203
10968
|
};
|
|
11204
10969
|
}
|
|
10970
|
+
function isRecord6(value) {
|
|
10971
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10972
|
+
}
|
|
11205
10973
|
function validateTaxonomyFilterV1(criteria) {
|
|
11206
10974
|
const errors = [];
|
|
11207
10975
|
if (!Array.isArray(criteria.entityTypeFilters)) {
|
|
@@ -11715,9 +11483,16 @@ var ADD_WORKTREE = {
|
|
|
11715
11483
|
},
|
|
11716
11484
|
projectId: {
|
|
11717
11485
|
type: "string",
|
|
11718
|
-
description: "Legacy topicId alias"
|
|
11486
|
+
description: "Legacy topicId alias or resolver hint"
|
|
11487
|
+
},
|
|
11488
|
+
topicId: {
|
|
11489
|
+
type: "string",
|
|
11490
|
+
description: "Optional topic scope hint for resolver validation"
|
|
11491
|
+
},
|
|
11492
|
+
topicHint: {
|
|
11493
|
+
type: "string",
|
|
11494
|
+
description: "Natural-language topic hint for automatic topic resolution"
|
|
11719
11495
|
},
|
|
11720
|
-
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
11721
11496
|
branchId: {
|
|
11722
11497
|
type: "string",
|
|
11723
11498
|
description: "The branch this worktree investigates"
|
|
@@ -11815,6 +11590,22 @@ var ADD_WORKTREE = {
|
|
|
11815
11590
|
type: "string",
|
|
11816
11591
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
11817
11592
|
},
|
|
11593
|
+
tags: {
|
|
11594
|
+
type: "array",
|
|
11595
|
+
description: "Additional topic-resolution tags for the worktree"
|
|
11596
|
+
},
|
|
11597
|
+
touchedPaths: {
|
|
11598
|
+
type: "array",
|
|
11599
|
+
description: "File paths used as topic-resolution signals"
|
|
11600
|
+
},
|
|
11601
|
+
sourceRef: {
|
|
11602
|
+
type: "string",
|
|
11603
|
+
description: "Source reference used as a topic-resolution signal"
|
|
11604
|
+
},
|
|
11605
|
+
sourceKind: {
|
|
11606
|
+
type: "string",
|
|
11607
|
+
description: "Source kind used as a topic-resolution signal"
|
|
11608
|
+
},
|
|
11818
11609
|
campaign: {
|
|
11819
11610
|
type: "number",
|
|
11820
11611
|
description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
|
|
@@ -11852,7 +11643,7 @@ var ADD_WORKTREE = {
|
|
|
11852
11643
|
description: "Timestamp when worktree metadata was last reconciled"
|
|
11853
11644
|
}
|
|
11854
11645
|
},
|
|
11855
|
-
required: ["title"
|
|
11646
|
+
required: ["title"],
|
|
11856
11647
|
response: {
|
|
11857
11648
|
description: "The created worktree",
|
|
11858
11649
|
fields: {
|
|
@@ -13349,15 +13140,15 @@ var IDENTITY_WHOAMI = {
|
|
|
13349
13140
|
};
|
|
13350
13141
|
var COMPILE_CONTEXT = {
|
|
13351
13142
|
name: "compile_context",
|
|
13352
|
-
description: "Compile a focused reasoning context
|
|
13143
|
+
description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
|
|
13353
13144
|
parameters: {
|
|
13354
13145
|
topicId: {
|
|
13355
13146
|
type: "string",
|
|
13356
|
-
description: "
|
|
13147
|
+
description: "Optional topic scope ID. Omit to resolve the topic from query."
|
|
13357
13148
|
},
|
|
13358
13149
|
query: {
|
|
13359
13150
|
type: "string",
|
|
13360
|
-
description: "
|
|
13151
|
+
description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
|
|
13361
13152
|
},
|
|
13362
13153
|
budget: {
|
|
13363
13154
|
type: "number",
|
|
@@ -13381,7 +13172,7 @@ var COMPILE_CONTEXT = {
|
|
|
13381
13172
|
description: "Include related ontological entities in the compiled result"
|
|
13382
13173
|
}
|
|
13383
13174
|
},
|
|
13384
|
-
required: [
|
|
13175
|
+
required: [],
|
|
13385
13176
|
response: {
|
|
13386
13177
|
description: "Compiled context pack for the requested topic",
|
|
13387
13178
|
fields: {
|
|
@@ -13555,18 +13346,60 @@ var CREATE_TASK = {
|
|
|
13555
13346
|
name: "create_task",
|
|
13556
13347
|
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
13348
|
parameters: {
|
|
13558
|
-
title: { type: "string", description: "Task
|
|
13349
|
+
title: { type: "string", description: "Task title" },
|
|
13559
13350
|
topicId: { type: "string", description: "Topic scope" },
|
|
13351
|
+
description: {
|
|
13352
|
+
type: "string",
|
|
13353
|
+
description: "Long-form task description"
|
|
13354
|
+
},
|
|
13560
13355
|
taskType: {
|
|
13561
13356
|
type: "string",
|
|
13562
|
-
description: "
|
|
13563
|
-
enum: [
|
|
13357
|
+
description: "Task taxonomy",
|
|
13358
|
+
enum: [
|
|
13359
|
+
"general",
|
|
13360
|
+
"find_evidence",
|
|
13361
|
+
"verify_claim",
|
|
13362
|
+
"research",
|
|
13363
|
+
"review",
|
|
13364
|
+
"interview",
|
|
13365
|
+
"analysis",
|
|
13366
|
+
"track_metrics"
|
|
13367
|
+
]
|
|
13368
|
+
},
|
|
13369
|
+
priority: {
|
|
13370
|
+
type: "string",
|
|
13371
|
+
description: "Priority",
|
|
13372
|
+
enum: ["urgent", "high", "medium", "low"]
|
|
13373
|
+
},
|
|
13374
|
+
status: {
|
|
13375
|
+
type: "string",
|
|
13376
|
+
description: "Initial status (defaults to todo)",
|
|
13377
|
+
enum: ["todo", "in_progress", "blocked", "done"]
|
|
13378
|
+
},
|
|
13379
|
+
linkedWorktreeId: {
|
|
13380
|
+
type: "string",
|
|
13381
|
+
description: "Worktree this task belongs to"
|
|
13382
|
+
},
|
|
13383
|
+
linkedBeliefId: {
|
|
13384
|
+
type: "string",
|
|
13385
|
+
description: "Belief this task supports"
|
|
13564
13386
|
},
|
|
13565
13387
|
linkedQuestionId: {
|
|
13566
13388
|
type: "string",
|
|
13567
13389
|
description: "Question this task addresses"
|
|
13568
13390
|
},
|
|
13569
|
-
|
|
13391
|
+
assigneeId: {
|
|
13392
|
+
type: "string",
|
|
13393
|
+
description: "Principal assigned to the task"
|
|
13394
|
+
},
|
|
13395
|
+
dueDate: {
|
|
13396
|
+
type: "number",
|
|
13397
|
+
description: "Due date as epoch milliseconds"
|
|
13398
|
+
},
|
|
13399
|
+
tags: {
|
|
13400
|
+
type: "array",
|
|
13401
|
+
description: "Free-form string tags"
|
|
13402
|
+
}
|
|
13570
13403
|
},
|
|
13571
13404
|
required: ["title"],
|
|
13572
13405
|
response: {
|
|
@@ -15923,6 +15756,9 @@ function fromBase64(value) {
|
|
|
15923
15756
|
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
15924
15757
|
return decodeURIComponent(escape(atob(normalized)));
|
|
15925
15758
|
}
|
|
15759
|
+
function isRecord7(value) {
|
|
15760
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15761
|
+
}
|
|
15926
15762
|
function createEventId() {
|
|
15927
15763
|
const random = typeof globalThis.crypto?.randomUUID === "function" ? globalThis.crypto.randomUUID().replace(/-/g, "") : Array.from(
|
|
15928
15764
|
typeof globalThis.crypto?.getRandomValues === "function" ? globalThis.crypto.getRandomValues(new Uint8Array(16)) : Array.from({ length: 16 }, () => Math.floor(Math.random() * 256)),
|
|
@@ -15971,14 +15807,14 @@ function decodeEventCursor(cursor) {
|
|
|
15971
15807
|
}
|
|
15972
15808
|
try {
|
|
15973
15809
|
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) {
|
|
15810
|
+
if (!isRecord7(parsed) || typeof parsed.timestamp !== "number" || !Number.isFinite(parsed.timestamp) || typeof parsed.eventId !== "string" || parsed.eventId.trim().length === 0) {
|
|
15975
15811
|
return null;
|
|
15976
15812
|
}
|
|
15977
15813
|
return {
|
|
15978
15814
|
timestamp: parsed.timestamp,
|
|
15979
15815
|
eventId: parsed.eventId.trim()
|
|
15980
15816
|
};
|
|
15981
|
-
} catch {
|
|
15817
|
+
} catch (error) {
|
|
15982
15818
|
return null;
|
|
15983
15819
|
}
|
|
15984
15820
|
}
|
|
@@ -16007,7 +15843,7 @@ var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"])
|
|
|
16007
15843
|
function normalizeUrl(url) {
|
|
16008
15844
|
try {
|
|
16009
15845
|
return new URL(url.trim());
|
|
16010
|
-
} catch {
|
|
15846
|
+
} catch (error) {
|
|
16011
15847
|
throw new Error("Webhook URL must be a valid absolute URL.");
|
|
16012
15848
|
}
|
|
16013
15849
|
}
|
|
@@ -21140,6 +20976,11 @@ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
|
|
|
21140
20976
|
role: "sdk_dependency",
|
|
21141
20977
|
directTenantImport: false
|
|
21142
20978
|
},
|
|
20979
|
+
{
|
|
20980
|
+
packageName: "@lucern/graph-sync",
|
|
20981
|
+
role: "host_addon_runtime",
|
|
20982
|
+
directTenantImport: true
|
|
20983
|
+
},
|
|
21143
20984
|
{
|
|
21144
20985
|
packageName: "@lucern/identity",
|
|
21145
20986
|
role: "component_runtime",
|
|
@@ -21428,8 +21269,11 @@ function compactRecord(input) {
|
|
|
21428
21269
|
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
21429
21270
|
);
|
|
21430
21271
|
}
|
|
21272
|
+
function isRecord8(value) {
|
|
21273
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
21274
|
+
}
|
|
21431
21275
|
function recordValue(value) {
|
|
21432
|
-
return
|
|
21276
|
+
return isRecord8(value) ? value : {};
|
|
21433
21277
|
}
|
|
21434
21278
|
var createEvidenceProjection = defineProjection({
|
|
21435
21279
|
contractName: "create_evidence",
|
|
@@ -21864,9 +21708,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
|
|
|
21864
21708
|
required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
|
|
21865
21709
|
};
|
|
21866
21710
|
}
|
|
21867
|
-
|
|
21868
|
-
return contract;
|
|
21869
|
-
}
|
|
21711
|
+
var defineFunctionContract = (contract) => contract;
|
|
21870
21712
|
function authUserId(context) {
|
|
21871
21713
|
return context.userId ?? context.principalId ?? "lucern-agent";
|
|
21872
21714
|
}
|
|
@@ -22020,6 +21862,9 @@ var observationContextArgs = z.object({
|
|
|
22020
21862
|
limit: z.number().optional().describe("Maximum observations to return."),
|
|
22021
21863
|
status: z.string().optional().describe("Observation status filter.")
|
|
22022
21864
|
});
|
|
21865
|
+
function isRecord9(value) {
|
|
21866
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
21867
|
+
}
|
|
22023
21868
|
var observationInput = (input, context) => withUserId(
|
|
22024
21869
|
compactRecord4({
|
|
22025
21870
|
projectId: input.projectId,
|
|
@@ -22052,7 +21897,7 @@ var contextContracts = [
|
|
|
22052
21897
|
path: "/context/compile",
|
|
22053
21898
|
sdkNamespace: "context",
|
|
22054
21899
|
sdkMethod: "compileContext",
|
|
22055
|
-
summary: "Compile a focused reasoning context
|
|
21900
|
+
summary: "Compile a focused reasoning context, resolving topic from query when omitted.",
|
|
22056
21901
|
convex: {
|
|
22057
21902
|
module: "contextCompiler",
|
|
22058
21903
|
functionName: "compile",
|
|
@@ -22074,8 +21919,8 @@ var contextContracts = [
|
|
|
22074
21919
|
kind: "mutation",
|
|
22075
21920
|
inputProjection: observationInput,
|
|
22076
21921
|
outputProjection: (output, input) => ({
|
|
22077
|
-
...output
|
|
22078
|
-
observationId: output
|
|
21922
|
+
...isRecord9(output) ? output : {},
|
|
21923
|
+
observationId: isRecord9(output) ? output.nodeId : void 0,
|
|
22079
21924
|
observationType: input.observationType
|
|
22080
21925
|
})
|
|
22081
21926
|
},
|
|
@@ -23556,10 +23401,11 @@ var worktreeDecisionGateInputSchema = z.object({
|
|
|
23556
23401
|
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
23557
23402
|
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
23558
23403
|
var addWorktreeArgs = z.object({
|
|
23559
|
-
title: z.string().
|
|
23404
|
+
title: z.string().describe("Human-readable worktree name or objective."),
|
|
23560
23405
|
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."),
|
|
23406
|
+
topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
|
|
23407
|
+
projectId: z.string().optional().describe("Legacy topicId alias/hint."),
|
|
23408
|
+
topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
|
|
23563
23409
|
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
23564
23410
|
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
23565
23411
|
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
@@ -23584,6 +23430,10 @@ var addWorktreeArgs = z.object({
|
|
|
23584
23430
|
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
23585
23431
|
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
23586
23432
|
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
23433
|
+
tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
|
|
23434
|
+
touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
|
|
23435
|
+
sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
|
|
23436
|
+
sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
|
|
23587
23437
|
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
23588
23438
|
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
23589
23439
|
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
@@ -23913,8 +23763,46 @@ var worktreesContracts = [
|
|
|
23913
23763
|
args: openPullRequestArgs
|
|
23914
23764
|
})
|
|
23915
23765
|
];
|
|
23916
|
-
|
|
23917
|
-
|
|
23766
|
+
var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
23767
|
+
var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
|
|
23768
|
+
var taskTypeSchema = z.enum([
|
|
23769
|
+
"general",
|
|
23770
|
+
"find_evidence",
|
|
23771
|
+
"verify_claim",
|
|
23772
|
+
"research",
|
|
23773
|
+
"review",
|
|
23774
|
+
"interview",
|
|
23775
|
+
"analysis",
|
|
23776
|
+
"track_metrics"
|
|
23777
|
+
]);
|
|
23778
|
+
var createTaskArgs = z.object({
|
|
23779
|
+
title: z.string().describe("Task title."),
|
|
23780
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
23781
|
+
description: z.string().optional().describe("Long-form task description."),
|
|
23782
|
+
taskType: taskTypeSchema.optional().describe("Task taxonomy."),
|
|
23783
|
+
priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
|
|
23784
|
+
status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
|
|
23785
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
|
|
23786
|
+
linkedBeliefId: z.string().optional().describe("Belief this task supports."),
|
|
23787
|
+
linkedQuestionId: z.string().optional().describe("Question this task addresses."),
|
|
23788
|
+
assigneeId: z.string().optional().describe("Principal assigned to the task."),
|
|
23789
|
+
dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
|
|
23790
|
+
tags: z.array(z.string()).optional().describe("Free-form tags.")
|
|
23791
|
+
});
|
|
23792
|
+
var createTaskInput = (input) => compactRecord4({
|
|
23793
|
+
title: input.title,
|
|
23794
|
+
topicId: input.topicId,
|
|
23795
|
+
description: input.description,
|
|
23796
|
+
taskType: input.taskType,
|
|
23797
|
+
priority: input.priority ?? "medium",
|
|
23798
|
+
status: input.status ?? "todo",
|
|
23799
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
23800
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
23801
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
23802
|
+
assigneeId: input.assigneeId,
|
|
23803
|
+
dueDate: input.dueDate,
|
|
23804
|
+
tags: input.tags
|
|
23805
|
+
});
|
|
23918
23806
|
var taskInput = (input) => compactRecord4({
|
|
23919
23807
|
...input,
|
|
23920
23808
|
taskId: input.taskId ?? input.id
|
|
@@ -23946,8 +23834,10 @@ var tasksContracts = [
|
|
|
23946
23834
|
convex: {
|
|
23947
23835
|
module: "tasks",
|
|
23948
23836
|
functionName: "create",
|
|
23949
|
-
kind: "mutation"
|
|
23950
|
-
|
|
23837
|
+
kind: "mutation",
|
|
23838
|
+
inputProjection: createTaskInput
|
|
23839
|
+
},
|
|
23840
|
+
args: createTaskArgs
|
|
23951
23841
|
}),
|
|
23952
23842
|
surfaceContract({
|
|
23953
23843
|
name: "list_tasks",
|
|
@@ -25066,9 +24956,12 @@ var ALL_FUNCTION_CONTRACTS = [
|
|
|
25066
24956
|
];
|
|
25067
24957
|
assertSurfaceCoverage(ALL_FUNCTION_CONTRACTS);
|
|
25068
24958
|
var FUNCTION_SURFACE_CONTRACTS = ALL_FUNCTION_CONTRACTS;
|
|
25069
|
-
new Map(
|
|
24959
|
+
var FUNCTION_CONTRACTS_BY_NAME = new Map(
|
|
25070
24960
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
25071
24961
|
);
|
|
24962
|
+
FUNCTION_CONTRACTS_BY_NAME.get.bind(
|
|
24963
|
+
FUNCTION_CONTRACTS_BY_NAME
|
|
24964
|
+
);
|
|
25072
24965
|
|
|
25073
24966
|
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
25074
24967
|
function isCopyableSeedRequirement(entry) {
|
|
@@ -25714,10 +25607,18 @@ function isInfisicalRuntimeDisabled(env = {}) {
|
|
|
25714
25607
|
}
|
|
25715
25608
|
async function hydrateInfisicalRuntimeEnv(options) {
|
|
25716
25609
|
const env = options.env ?? {};
|
|
25717
|
-
const
|
|
25718
|
-
|
|
25719
|
-
|
|
25720
|
-
|
|
25610
|
+
const baseBootstrap = readInfisicalRuntimeBootstrap(env, options.bootstrap);
|
|
25611
|
+
const bootstrap = baseBootstrap ? {
|
|
25612
|
+
...baseBootstrap,
|
|
25613
|
+
...Object.fromEntries(
|
|
25614
|
+
Object.entries(options.bootstrap ?? {}).filter(
|
|
25615
|
+
([, value]) => value !== void 0
|
|
25616
|
+
)
|
|
25617
|
+
),
|
|
25618
|
+
apiUrl: trimTrailingSlash(
|
|
25619
|
+
options.bootstrap?.apiUrl ?? baseBootstrap.apiUrl
|
|
25620
|
+
)
|
|
25621
|
+
} : null;
|
|
25721
25622
|
if (!bootstrap) {
|
|
25722
25623
|
return {
|
|
25723
25624
|
status: "disabled",
|
|
@@ -25813,16 +25714,6 @@ function normalizeInfisicalEnvironment(value) {
|
|
|
25813
25714
|
}
|
|
25814
25715
|
return "prod";
|
|
25815
25716
|
}
|
|
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
25717
|
async function loginWithUniversalAuth(bootstrap, fetchImpl) {
|
|
25827
25718
|
const response = await fetchImpl(
|
|
25828
25719
|
`${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
|
|
@@ -25907,14 +25798,18 @@ async function readSecretValue(args) {
|
|
|
25907
25798
|
async function readJson2(response) {
|
|
25908
25799
|
try {
|
|
25909
25800
|
return await response.json();
|
|
25910
|
-
} catch {
|
|
25801
|
+
} catch (error) {
|
|
25802
|
+
debugInfisicalRuntimeFallback("response.json", error);
|
|
25911
25803
|
return void 0;
|
|
25912
25804
|
}
|
|
25913
25805
|
}
|
|
25806
|
+
function isRecord10(value) {
|
|
25807
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
25808
|
+
}
|
|
25914
25809
|
function readNestedString(value, path2) {
|
|
25915
25810
|
let current = value;
|
|
25916
25811
|
for (const key of path2) {
|
|
25917
|
-
if (!current ||
|
|
25812
|
+
if (!isRecord10(current) || !(key in current)) {
|
|
25918
25813
|
return null;
|
|
25919
25814
|
}
|
|
25920
25815
|
current = current[key];
|
|
@@ -25922,13 +25817,12 @@ function readNestedString(value, path2) {
|
|
|
25922
25817
|
return typeof current === "string" && current.length > 0 ? current : null;
|
|
25923
25818
|
}
|
|
25924
25819
|
function messageFromBody(body4) {
|
|
25925
|
-
if (!body4
|
|
25820
|
+
if (!isRecord10(body4)) {
|
|
25926
25821
|
return "no response body";
|
|
25927
25822
|
}
|
|
25928
|
-
const record = body4;
|
|
25929
25823
|
for (const key of ["message", "error", "errorMessage"]) {
|
|
25930
|
-
if (typeof
|
|
25931
|
-
return
|
|
25824
|
+
if (typeof body4[key] === "string") {
|
|
25825
|
+
return body4[key];
|
|
25932
25826
|
}
|
|
25933
25827
|
}
|
|
25934
25828
|
return JSON.stringify(body4);
|
|
@@ -25948,10 +25842,32 @@ function isTruthyEnv(value) {
|
|
|
25948
25842
|
function trimTrailingSlash(value) {
|
|
25949
25843
|
return value.replace(/\/+$/u, "");
|
|
25950
25844
|
}
|
|
25951
|
-
function
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
|
|
25845
|
+
function debugInfisicalRuntimeFallback(message, error) {
|
|
25846
|
+
const env = globalThis.process?.env;
|
|
25847
|
+
if (env?.LUCERN_COMPAT_FALLBACK_DEBUG !== "1" && env?.LUCERN_INFISICAL_RUNTIME_DEBUG !== "1") {
|
|
25848
|
+
return;
|
|
25849
|
+
}
|
|
25850
|
+
console.debug(`[infisical-runtime] ${message}`, {
|
|
25851
|
+
error: formatInfisicalRuntimeError(error)
|
|
25852
|
+
});
|
|
25853
|
+
}
|
|
25854
|
+
function formatInfisicalRuntimeError(error) {
|
|
25855
|
+
if (error instanceof Error) {
|
|
25856
|
+
return `${error.name}: ${error.message}`;
|
|
25857
|
+
}
|
|
25858
|
+
if (typeof error === "string") {
|
|
25859
|
+
return error;
|
|
25860
|
+
}
|
|
25861
|
+
if (typeof error === "number" || typeof error === "boolean") {
|
|
25862
|
+
return String(error);
|
|
25863
|
+
}
|
|
25864
|
+
if (error && typeof error === "object") {
|
|
25865
|
+
const keys = Object.keys(error).slice(0, 5);
|
|
25866
|
+
if (keys.length > 0) {
|
|
25867
|
+
return `Unknown Infisical runtime error object with keys: ${keys.join(", ")}`;
|
|
25868
|
+
}
|
|
25869
|
+
}
|
|
25870
|
+
return "Unknown Infisical runtime error shape";
|
|
25955
25871
|
}
|
|
25956
25872
|
|
|
25957
25873
|
// src/execution.ts
|
|
@@ -25998,6 +25914,9 @@ function hasValue(value) {
|
|
|
25998
25914
|
}
|
|
25999
25915
|
return true;
|
|
26000
25916
|
}
|
|
25917
|
+
function isRecord11(value) {
|
|
25918
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
25919
|
+
}
|
|
26001
25920
|
function normalizeToolExecutionParams(params) {
|
|
26002
25921
|
const normalized = { ...params };
|
|
26003
25922
|
for (const aliases of SCOPE_ALIAS_GROUPS) {
|
|
@@ -26020,16 +25939,19 @@ function parseToolExecutionMetadata(result) {
|
|
|
26020
25939
|
}
|
|
26021
25940
|
try {
|
|
26022
25941
|
const payload = JSON.parse(raw);
|
|
25942
|
+
if (!isRecord11(payload)) {
|
|
25943
|
+
return { isError: Boolean(result.isError) };
|
|
25944
|
+
}
|
|
26023
25945
|
return {
|
|
26024
25946
|
isError: Boolean(result.isError),
|
|
26025
25947
|
code: typeof payload.code === "string" ? payload.code : void 0,
|
|
26026
25948
|
status: typeof payload.status === "number" ? payload.status : void 0,
|
|
26027
|
-
correlationId:
|
|
26028
|
-
policyTraceId:
|
|
26029
|
-
invariant:
|
|
25949
|
+
correlationId: optionalStringOrNull(payload.correlationId),
|
|
25950
|
+
policyTraceId: optionalStringOrNull(payload.policyTraceId),
|
|
25951
|
+
invariant: optionalStringOrNull(payload.invariant)
|
|
26030
25952
|
};
|
|
26031
|
-
} catch {
|
|
26032
|
-
return
|
|
25953
|
+
} catch (error) {
|
|
25954
|
+
return ignoreMalformedToolMetadata(error, result);
|
|
26033
25955
|
}
|
|
26034
25956
|
}
|
|
26035
25957
|
async function executeToolWithEnvelope(args) {
|
|
@@ -26047,6 +25969,15 @@ async function executeToolWithEnvelope(args) {
|
|
|
26047
25969
|
});
|
|
26048
25970
|
return result;
|
|
26049
25971
|
}
|
|
25972
|
+
function ignoreMalformedToolMetadata(_error, result) {
|
|
25973
|
+
return { isError: Boolean(result.isError) };
|
|
25974
|
+
}
|
|
25975
|
+
function optionalStringOrNull(value) {
|
|
25976
|
+
if (typeof value === "string" || value === null) {
|
|
25977
|
+
return value;
|
|
25978
|
+
}
|
|
25979
|
+
return void 0;
|
|
25980
|
+
}
|
|
26050
25981
|
|
|
26051
25982
|
// src/types.ts
|
|
26052
25983
|
var McpHandlerError = class extends Error {
|
|
@@ -26433,24 +26364,27 @@ function readResultString(value, key) {
|
|
|
26433
26364
|
}
|
|
26434
26365
|
function createContextHandlers(context) {
|
|
26435
26366
|
const compiler = createContextClient(context.sdkConfig);
|
|
26367
|
+
const functionSurface = createFunctionSurfaceClient(context.sdkConfig);
|
|
26436
26368
|
return {
|
|
26437
26369
|
compile_context: contractToHandler(
|
|
26438
26370
|
MCP_TOOL_CONTRACTS.compile_context,
|
|
26439
26371
|
async (params) => {
|
|
26440
|
-
const topicId = readTopicId4(params
|
|
26441
|
-
const
|
|
26442
|
-
|
|
26443
|
-
{
|
|
26444
|
-
|
|
26445
|
-
|
|
26446
|
-
|
|
26447
|
-
|
|
26448
|
-
|
|
26449
|
-
|
|
26450
|
-
|
|
26451
|
-
|
|
26452
|
-
|
|
26453
|
-
|
|
26372
|
+
const topicId = readTopicId4(params);
|
|
26373
|
+
const query5 = readString3(params, "query");
|
|
26374
|
+
const input = {
|
|
26375
|
+
...query5 ? { query: query5 } : {},
|
|
26376
|
+
...readNumber2(params, "budget") !== void 0 ? { budget: readNumber2(params, "budget") } : {},
|
|
26377
|
+
...readString3(params, "ranking") ? {
|
|
26378
|
+
ranking: readString3(params, "ranking")
|
|
26379
|
+
} : {},
|
|
26380
|
+
...readNumber2(params, "limit") !== void 0 ? { limit: readNumber2(params, "limit") } : {},
|
|
26381
|
+
...readNumber2(params, "maxDepth") !== void 0 ? { maxDepth: readNumber2(params, "maxDepth") } : {},
|
|
26382
|
+
...readBoolean(params, "includeEntities") !== void 0 ? { includeEntities: readBoolean(params, "includeEntities") } : {}
|
|
26383
|
+
};
|
|
26384
|
+
if (!topicId && !query5) {
|
|
26385
|
+
throw new Error("[compile_context] query is required when topicId is omitted.");
|
|
26386
|
+
}
|
|
26387
|
+
const response = topicId ? await compiler.compile(topicId, input) : await functionSurface.compileContext(input);
|
|
26454
26388
|
writeLocalLucernContext({
|
|
26455
26389
|
topicId: readResultString(response.data, "topicId") ?? topicId,
|
|
26456
26390
|
topicName: readResultString(response.data, "topicName"),
|
|
@@ -27556,18 +27490,22 @@ function createWorktreeHandlers(context) {
|
|
|
27556
27490
|
MCP_TOOL_CONTRACTS.add_worktree,
|
|
27557
27491
|
async (params) => {
|
|
27558
27492
|
const topicId = readTopicId4(params);
|
|
27559
|
-
if (!topicId) {
|
|
27560
|
-
throw new Error("add_worktree requires topicId");
|
|
27561
|
-
}
|
|
27562
27493
|
const result = await workflow.addWorktree({
|
|
27563
27494
|
title: readString3(params, "title", { required: true }),
|
|
27564
27495
|
topicId,
|
|
27496
|
+
topicHint: readString3(params, "topicHint"),
|
|
27565
27497
|
branchId: readString3(params, "branchId"),
|
|
27566
27498
|
objective: readString3(params, "objective"),
|
|
27567
27499
|
hypothesis: readString3(params, "hypothesis"),
|
|
27500
|
+
rationale: readString3(params, "rationale"),
|
|
27501
|
+
worktreeType: readString3(params, "worktreeType"),
|
|
27568
27502
|
beliefIds: readStringArray(params, "beliefIds"),
|
|
27569
27503
|
autoShape: readBoolean(params, "autoShape"),
|
|
27570
27504
|
domainPackId: readString3(params, "domainPackId"),
|
|
27505
|
+
tags: readStringArray(params, "tags"),
|
|
27506
|
+
touchedPaths: readStringArray(params, "touchedPaths"),
|
|
27507
|
+
sourceRef: readString3(params, "sourceRef"),
|
|
27508
|
+
sourceKind: readString3(params, "sourceKind"),
|
|
27571
27509
|
campaign: typeof params.campaign === "number" ? params.campaign : void 0,
|
|
27572
27510
|
lane: readString3(params, "lane"),
|
|
27573
27511
|
laneOrderInCampaign: typeof params.laneOrderInCampaign === "number" ? params.laneOrderInCampaign : void 0,
|
|
@@ -27687,8 +27625,8 @@ function loadMcpSdk() {
|
|
|
27687
27625
|
try {
|
|
27688
27626
|
const dynamicRequire = eval("require");
|
|
27689
27627
|
return dynamicRequire("@modelcontextprotocol/sdk") ?? {};
|
|
27690
|
-
} catch {
|
|
27691
|
-
return
|
|
27628
|
+
} catch (error) {
|
|
27629
|
+
return ignoreMcpSdkLoadError();
|
|
27692
27630
|
}
|
|
27693
27631
|
}
|
|
27694
27632
|
var MCP_AUTH_ERROR_CODES = [
|
|
@@ -27767,11 +27705,11 @@ function deriveCustomToolScopes(customTool) {
|
|
|
27767
27705
|
return uniqueScopes(customTool.metadata.requiredScopes ?? ["custom:execute"]);
|
|
27768
27706
|
}
|
|
27769
27707
|
function createFallbackRuntime() {
|
|
27708
|
+
function noop() {
|
|
27709
|
+
}
|
|
27770
27710
|
return {
|
|
27771
|
-
registerResource:
|
|
27772
|
-
|
|
27773
|
-
registerTool: () => {
|
|
27774
|
-
}
|
|
27711
|
+
registerResource: noop,
|
|
27712
|
+
registerTool: noop
|
|
27775
27713
|
};
|
|
27776
27714
|
}
|
|
27777
27715
|
function createMcpRuntime() {
|
|
@@ -27785,7 +27723,7 @@ function createMcpRuntime() {
|
|
|
27785
27723
|
{ name: "lucern-platform-mcp", version: "1.2.0" },
|
|
27786
27724
|
{ capabilities: { resources: {}, tools: {} } }
|
|
27787
27725
|
);
|
|
27788
|
-
} catch {
|
|
27726
|
+
} catch (error) {
|
|
27789
27727
|
return createFallbackRuntime();
|
|
27790
27728
|
}
|
|
27791
27729
|
}
|
|
@@ -27809,15 +27747,14 @@ function executeWithHandler(_name, handler, contract, params) {
|
|
|
27809
27747
|
}
|
|
27810
27748
|
}
|
|
27811
27749
|
function isMcpToolResult(value) {
|
|
27812
|
-
if (!value
|
|
27750
|
+
if (!isRecord12(value)) {
|
|
27813
27751
|
return false;
|
|
27814
27752
|
}
|
|
27815
|
-
|
|
27816
|
-
if (!Array.isArray(candidate.content)) {
|
|
27753
|
+
if (!Array.isArray(value.content)) {
|
|
27817
27754
|
return false;
|
|
27818
27755
|
}
|
|
27819
|
-
return
|
|
27820
|
-
if (!entry
|
|
27756
|
+
return value.content.every((entry) => {
|
|
27757
|
+
if (!isRecord12(entry)) {
|
|
27821
27758
|
return false;
|
|
27822
27759
|
}
|
|
27823
27760
|
return typeof entry.text === "string";
|
|
@@ -27988,6 +27925,12 @@ function createLucernMcpServer(options) {
|
|
|
27988
27925
|
unimplementedToolNames
|
|
27989
27926
|
};
|
|
27990
27927
|
}
|
|
27928
|
+
function isRecord12(value) {
|
|
27929
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
27930
|
+
}
|
|
27931
|
+
function ignoreMcpSdkLoadError(_error) {
|
|
27932
|
+
return {};
|
|
27933
|
+
}
|
|
27991
27934
|
|
|
27992
27935
|
// src/standalone.ts
|
|
27993
27936
|
var OBSERVATION_RESOURCE_TEMPLATE = "lucern://observations/topic/{topicId}";
|
|
@@ -28029,6 +27972,9 @@ function resourceName(uri) {
|
|
|
28029
27972
|
return uri.replace("lucern://", "lucern-").replace(/[{}]/g, "").replace(/[^a-zA-Z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
28030
27973
|
}
|
|
28031
27974
|
function readTemplateVar(variables, key) {
|
|
27975
|
+
if (!isRecord13(variables)) {
|
|
27976
|
+
return;
|
|
27977
|
+
}
|
|
28032
27978
|
const value = variables[key];
|
|
28033
27979
|
if (typeof value === "string") {
|
|
28034
27980
|
return value;
|
|
@@ -28041,7 +27987,7 @@ function readTemplateVar(variables, key) {
|
|
|
28041
27987
|
async function notifyResourceUpdated(server, uri) {
|
|
28042
27988
|
try {
|
|
28043
27989
|
await server.server.sendResourceUpdated({ uri });
|
|
28044
|
-
} catch {
|
|
27990
|
+
} catch (error) {
|
|
28045
27991
|
}
|
|
28046
27992
|
}
|
|
28047
27993
|
function registerResources(server, runtime, observationStore) {
|
|
@@ -28102,10 +28048,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28102
28048
|
mimeType: "application/json"
|
|
28103
28049
|
},
|
|
28104
28050
|
async (_uri, variables) => {
|
|
28105
|
-
const topicId = readTemplateVar(
|
|
28106
|
-
variables,
|
|
28107
|
-
"topicId"
|
|
28108
|
-
);
|
|
28051
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28109
28052
|
const records = topicId ? observationStore.list(topicId, 25) : [];
|
|
28110
28053
|
return {
|
|
28111
28054
|
contents: [
|
|
@@ -28138,9 +28081,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28138
28081
|
mimeType: "application/json"
|
|
28139
28082
|
},
|
|
28140
28083
|
async (_uri, variables) => {
|
|
28141
|
-
const
|
|
28142
|
-
const
|
|
28143
|
-
const query5 = readTemplateVar(values, "query");
|
|
28084
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28085
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28144
28086
|
const matches = topicId && query5 ? observationStore.search(topicId, query5, 25) : [];
|
|
28145
28087
|
return {
|
|
28146
28088
|
contents: [
|
|
@@ -28173,10 +28115,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28173
28115
|
mimeType: "application/json"
|
|
28174
28116
|
},
|
|
28175
28117
|
async (_uri, variables) => {
|
|
28176
|
-
const topicId = readTemplateVar(
|
|
28177
|
-
variables,
|
|
28178
|
-
"topicId"
|
|
28179
|
-
);
|
|
28118
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28180
28119
|
const context = topicId ? observationStore.getContext({ topicId, limit: 12 }) : observationStore.getContext({ topicId: "unknown", limit: 12 });
|
|
28181
28120
|
return {
|
|
28182
28121
|
contents: [
|
|
@@ -28200,9 +28139,8 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28200
28139
|
mimeType: "application/json"
|
|
28201
28140
|
},
|
|
28202
28141
|
async (_uri, variables) => {
|
|
28203
|
-
const
|
|
28204
|
-
const
|
|
28205
|
-
const query5 = readTemplateVar(values, "query");
|
|
28142
|
+
const topicId = readTemplateVar(variables, "topicId");
|
|
28143
|
+
const query5 = readTemplateVar(variables, "query");
|
|
28206
28144
|
const context = observationStore.getContext({
|
|
28207
28145
|
topicId: topicId ?? "unknown",
|
|
28208
28146
|
query: query5,
|
|
@@ -28228,7 +28166,7 @@ function registerResources(server, runtime, observationStore) {
|
|
|
28228
28166
|
await notifyResourceUpdated(server, `lucern://context/topic/${encoded}`);
|
|
28229
28167
|
try {
|
|
28230
28168
|
await server.server.sendResourceListChanged();
|
|
28231
|
-
} catch {
|
|
28169
|
+
} catch (error) {
|
|
28232
28170
|
}
|
|
28233
28171
|
};
|
|
28234
28172
|
return { resourceUris, notifyObservationChanged };
|
|
@@ -28268,15 +28206,14 @@ function registerTools(server, runtime) {
|
|
|
28268
28206
|
inputSchema: shape
|
|
28269
28207
|
},
|
|
28270
28208
|
async (args) => {
|
|
28271
|
-
return handler(args, tool.contract);
|
|
28209
|
+
return handler(isRecord13(args) ? args : {}, tool.contract);
|
|
28272
28210
|
}
|
|
28273
28211
|
);
|
|
28274
28212
|
}
|
|
28275
28213
|
}
|
|
28276
28214
|
function createLucernStandaloneMcpServer(options) {
|
|
28277
28215
|
const observationStore = new McpObservationStore();
|
|
28278
|
-
let notifyObservationChanged =
|
|
28279
|
-
};
|
|
28216
|
+
let notifyObservationChanged = noopAsync;
|
|
28280
28217
|
const runtime = createLucernMcpServer({
|
|
28281
28218
|
...options,
|
|
28282
28219
|
observationStore,
|
|
@@ -28286,7 +28223,7 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28286
28223
|
});
|
|
28287
28224
|
const server = new McpServer({
|
|
28288
28225
|
name: "lucern-mcp",
|
|
28289
|
-
version: "0.
|
|
28226
|
+
version: "0.3.0-alpha.8"
|
|
28290
28227
|
});
|
|
28291
28228
|
registerTools(server, runtime);
|
|
28292
28229
|
const resources = registerResources(server, runtime, observationStore);
|
|
@@ -28300,6 +28237,11 @@ function createLucernStandaloneMcpServer(options) {
|
|
|
28300
28237
|
promptNames
|
|
28301
28238
|
};
|
|
28302
28239
|
}
|
|
28240
|
+
function isRecord13(value) {
|
|
28241
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
28242
|
+
}
|
|
28243
|
+
async function noopAsync() {
|
|
28244
|
+
}
|
|
28303
28245
|
|
|
28304
28246
|
// src/hosted-route.ts
|
|
28305
28247
|
var ALLOW_METHODS = "GET, POST, DELETE, OPTIONS";
|
|
@@ -28425,12 +28367,12 @@ async function handleHostedMcpRequest(request) {
|
|
|
28425
28367
|
message: error instanceof Error ? error.message : "Internal server error."
|
|
28426
28368
|
});
|
|
28427
28369
|
} finally {
|
|
28428
|
-
await transport.close().catch(
|
|
28429
|
-
|
|
28430
|
-
await server.server.close().catch(() => {
|
|
28431
|
-
});
|
|
28370
|
+
await transport.close().catch(ignoreHostedCloseError);
|
|
28371
|
+
await server.server.close().catch(ignoreHostedCloseError);
|
|
28432
28372
|
}
|
|
28433
28373
|
}
|
|
28374
|
+
function ignoreHostedCloseError(_error) {
|
|
28375
|
+
}
|
|
28434
28376
|
|
|
28435
28377
|
export { handleHostedMcpRequest };
|
|
28436
28378
|
//# sourceMappingURL=hosted-route.js.map
|