@lucern/sdk 0.3.0-alpha.3 → 0.3.0-alpha.4
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/adminClient.js +4 -3
- package/dist/adminClient.js.map +1 -1
- package/dist/answersClient.js +4 -3
- package/dist/answersClient.js.map +1 -1
- package/dist/audiencesClient.js +4 -3
- package/dist/audiencesClient.js.map +1 -1
- package/dist/auditClient.js +4 -3
- package/dist/auditClient.js.map +1 -1
- package/dist/authContext.js +4 -3
- package/dist/authContext.js.map +1 -1
- package/dist/beliefs/index.d.ts +1 -1
- package/dist/beliefs/index.js +301 -7
- package/dist/beliefs/index.js.map +1 -1
- package/dist/beliefsClient.js +4 -3
- package/dist/beliefsClient.js.map +1 -1
- package/dist/{client-EiG9nJOY.d.ts → client-DOLqClbU.d.ts} +183 -3
- package/dist/client.d.ts +1 -1
- package/dist/client.js +301 -7
- package/dist/client.js.map +1 -1
- package/dist/contextClient.js +4 -3
- package/dist/contextClient.js.map +1 -1
- package/dist/contracts/api-enums.contract.d.ts +1 -1
- package/dist/contracts/api-enums.contract.js.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contradictions/index.d.ts +1 -1
- package/dist/contradictions/index.js +301 -7
- package/dist/contradictions/index.js.map +1 -1
- package/dist/coreClient.js +4 -3
- package/dist/coreClient.js.map +1 -1
- package/dist/decisions/index.d.ts +1 -1
- package/dist/decisions/index.js +301 -7
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisionsClient.js +4 -3
- package/dist/decisionsClient.js.map +1 -1
- package/dist/edges/index.d.ts +1 -1
- package/dist/edges/index.js +301 -7
- package/dist/edges/index.js.map +1 -1
- package/dist/embeddingsClient.js +4 -3
- package/dist/embeddingsClient.js.map +1 -1
- package/dist/eventingClient.js +4 -3
- package/dist/eventingClient.js.map +1 -1
- package/dist/eventsCore.js +4 -3
- package/dist/eventsCore.js.map +1 -1
- package/dist/evidence/index.d.ts +1 -1
- package/dist/evidence/index.js +301 -7
- package/dist/evidence/index.js.map +1 -1
- package/dist/evidenceClient.js +4 -3
- package/dist/evidenceClient.js.map +1 -1
- package/dist/gatewayFacades.d.ts +34 -1
- package/dist/gatewayFacades.js +4 -3
- package/dist/gatewayFacades.js.map +1 -1
- package/dist/graphAnalysisClient.d.ts +7 -0
- package/dist/graphAnalysisClient.js +7 -4
- package/dist/graphAnalysisClient.js.map +1 -1
- package/dist/graphClient.js +4 -3
- package/dist/graphClient.js.map +1 -1
- package/dist/graphRecommendationsClient.js +4 -3
- package/dist/graphRecommendationsClient.js.map +1 -1
- package/dist/graphStateClassifierClient.js +4 -3
- package/dist/graphStateClassifierClient.js.map +1 -1
- package/dist/harnessClient.js +4 -3
- package/dist/harnessClient.js.map +1 -1
- package/dist/identityClient.js +4 -3
- package/dist/identityClient.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +593 -8
- package/dist/index.js.map +1 -1
- package/dist/infisicalRuntime.d.ts +42 -0
- package/dist/infisicalRuntime.js +291 -0
- package/dist/infisicalRuntime.js.map +1 -0
- package/dist/jobsClient.js +4 -3
- package/dist/jobsClient.js.map +1 -1
- package/dist/learningClient.js +4 -3
- package/dist/learningClient.js.map +1 -1
- package/dist/lenses/index.d.ts +25 -1
- package/dist/lenses/index.js +301 -7
- package/dist/lenses/index.js.map +1 -1
- package/dist/mcpClient.js +4 -3
- package/dist/mcpClient.js.map +1 -1
- package/dist/modelRuntimeClient.js +4 -3
- package/dist/modelRuntimeClient.js.map +1 -1
- package/dist/nodes/index.d.ts +19 -1
- package/dist/nodes/index.js +301 -7
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +1 -1
- package/dist/ontologies/index.js +301 -7
- package/dist/ontologies/index.js.map +1 -1
- package/dist/ontologyClient.js +4 -3
- package/dist/ontologyClient.js.map +1 -1
- package/dist/ontologyLinksClient.js +4 -3
- package/dist/ontologyLinksClient.js.map +1 -1
- package/dist/orgGraphSearchClient.js +4 -3
- package/dist/orgGraphSearchClient.js.map +1 -1
- package/dist/packsClient.js +4 -3
- package/dist/packsClient.js.map +1 -1
- package/dist/policyClient.js +4 -3
- package/dist/policyClient.js.map +1 -1
- package/dist/questions/index.d.ts +1 -1
- package/dist/questions/index.js +301 -7
- package/dist/questions/index.js.map +1 -1
- package/dist/reportsClient.js +4 -3
- package/dist/reportsClient.js.map +1 -1
- package/dist/schemaClient.js +4 -3
- package/dist/schemaClient.js.map +1 -1
- package/dist/sourcesClient.js +4 -3
- package/dist/sourcesClient.js.map +1 -1
- package/dist/telemetryClient.js +4 -3
- package/dist/telemetryClient.js.map +1 -1
- package/dist/toolRegistryClient.js +4 -3
- package/dist/toolRegistryClient.js.map +1 -1
- package/dist/topics/index.d.ts +1 -1
- package/dist/topics/index.js +301 -7
- package/dist/topics/index.js.map +1 -1
- package/dist/topicsClient.js +4 -3
- package/dist/topicsClient.js.map +1 -1
- package/dist/workflowClient.d.ts +41 -7
- package/dist/workflowClient.js +4 -3
- package/dist/workflowClient.js.map +1 -1
- package/dist/worktrees/index.d.ts +25 -1
- package/dist/worktrees/index.js +301 -7
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT, MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT, MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT, MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT, MCP_GATEWAY_BOOTSTRAP_ENDPOINT } from '@lucern/contracts/mcp-gateway-boundary.contract';
|
|
3
3
|
import * as tool_contracts_star from '@lucern/contracts/tool-contracts';
|
|
4
4
|
import { LUCERN_OPERATION_MANIFEST } from '@lucern/contracts/function-registry/manifest';
|
|
5
|
+
import { INFISICAL_RUNTIME_MANIFEST, INFISICAL_RUNTIME_DEFAULT_PROJECT_ID, INFISICAL_RUNTIME_DEFAULT_API_URL, findInfisicalRuntimeSurface, findInfisicalRuntimePath } from '@lucern/contracts';
|
|
5
6
|
|
|
6
7
|
var __defProp = Object.defineProperty;
|
|
7
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -58,6 +59,7 @@ __export(src_exports, {
|
|
|
58
59
|
GRAPH_ANALYSIS_SUGGESTION_FIELDS: () => GRAPH_ANALYSIS_SUGGESTION_FIELDS,
|
|
59
60
|
GRAPH_RECOMMENDATION_FIELDS: () => GRAPH_RECOMMENDATION_FIELDS,
|
|
60
61
|
GRAPH_STATE_CLASSIFIER_FIELDS: () => GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
62
|
+
InfisicalRuntimeError: () => InfisicalRuntimeError,
|
|
61
63
|
JOBS_FIELDS: () => JOBS_FIELDS,
|
|
62
64
|
JUDGMENT_TYPES: () => JUDGMENT_TYPES,
|
|
63
65
|
LENS_PERSPECTIVE_TYPES: () => LENS_PERSPECTIVE_TYPES,
|
|
@@ -97,6 +99,7 @@ __export(src_exports, {
|
|
|
97
99
|
WORKFLOW_STAFFING_HINTS: () => WORKFLOW_STAFFING_HINTS,
|
|
98
100
|
WORKFLOW_TRIGGER_KINDS: () => WORKFLOW_TRIGGER_KINDS,
|
|
99
101
|
WORKTREE_PHASES: () => WORKTREE_PHASES,
|
|
102
|
+
applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
|
|
100
103
|
asListItems: () => asListItems,
|
|
101
104
|
assertValidWebhookSecret: () => assertValidWebhookSecret,
|
|
102
105
|
assertValidWebhookUrl: () => assertValidWebhookUrl,
|
|
@@ -156,11 +159,13 @@ __export(src_exports, {
|
|
|
156
159
|
getControlObjectOwnershipCase: () => getControlObjectOwnershipCase,
|
|
157
160
|
getMcpToolExposure: () => getMcpToolExposure,
|
|
158
161
|
getRegisteredCustomTool: () => getRegisteredCustomTool,
|
|
162
|
+
hydrateInfisicalRuntimeEnv: () => hydrateInfisicalRuntimeEnv,
|
|
159
163
|
inferActorType: () => inferActorType,
|
|
160
164
|
inferLensPerspectiveTypeFromBranchSchema: () => inferLensPerspectiveTypeFromBranchSchema,
|
|
161
165
|
inferSessionPrincipalType: () => inferSessionPrincipalType,
|
|
162
166
|
invokeRegisteredCustomTool: () => invokeRegisteredCustomTool,
|
|
163
167
|
isAfterCursor: () => isAfterCursor,
|
|
168
|
+
isInfisicalRuntimeDisabled: () => isInfisicalRuntimeDisabled,
|
|
164
169
|
isLensFilterCriteria: () => isLensFilterCriteria,
|
|
165
170
|
isLucernPrompt: () => isLucernPrompt,
|
|
166
171
|
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
@@ -189,6 +194,7 @@ __export(src_exports, {
|
|
|
189
194
|
opinionFromProjected: () => opinionFromProjected,
|
|
190
195
|
planContextPackCompilation: () => planContextPackCompilation,
|
|
191
196
|
randomIdempotencyKey: () => randomIdempotencyKey,
|
|
197
|
+
readInfisicalRuntimeBootstrap: () => readInfisicalRuntimeBootstrap,
|
|
192
198
|
registerCustomTool: () => registerCustomTool,
|
|
193
199
|
resolveDeliveryFailureStatus: () => resolveDeliveryFailureStatus,
|
|
194
200
|
resolveText: () => resolveText,
|
|
@@ -320,14 +326,15 @@ function normalizeCanonicalLucernAuthContext(input) {
|
|
|
320
326
|
);
|
|
321
327
|
const roles = cleanStringList(input.roles);
|
|
322
328
|
const scopes = cleanStringList(input.scopes);
|
|
323
|
-
|
|
329
|
+
const principalType = requirePrincipalType(input.principalType);
|
|
330
|
+
const authMode = requireAuthMode(input.authMode);
|
|
331
|
+
const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
|
|
332
|
+
if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
|
|
324
333
|
throw new LucernSdkAuthContextError(
|
|
325
334
|
"membership_missing",
|
|
326
335
|
"Canonical Lucern SDK auth context requires non-empty roles and scopes."
|
|
327
336
|
);
|
|
328
337
|
}
|
|
329
|
-
const principalType = requirePrincipalType(input.principalType);
|
|
330
|
-
const authMode = requireAuthMode(input.authMode);
|
|
331
338
|
const subject = cleanString(input.permit?.subject) ?? principalId;
|
|
332
339
|
const tenant = cleanString(input.permit?.tenant) ?? tenantId;
|
|
333
340
|
const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
|
|
@@ -4434,7 +4441,9 @@ function createGraphAnalysisClient(config = {}) {
|
|
|
4434
4441
|
topicId: requireTopicId2(input),
|
|
4435
4442
|
workspaceId: input.workspaceId,
|
|
4436
4443
|
analysisId: input.analysisId,
|
|
4437
|
-
|
|
4444
|
+
minimumCreatedAt: input.minimumCreatedAt ?? input.since ?? input.createdAt ?? input.analysisCreatedAt,
|
|
4445
|
+
sourceNodeIds: input.sourceNodeIds?.join(",") ?? (input.nodeId ? input.nodeId : void 0),
|
|
4446
|
+
sourceEdgeIds: input.sourceEdgeIds?.join(",") ?? (input.edgeId ? input.edgeId : void 0),
|
|
4438
4447
|
limit: input.limit,
|
|
4439
4448
|
cursor: input.cursor
|
|
4440
4449
|
})}`
|
|
@@ -5279,6 +5288,7 @@ var FUNCTION_SURFACE_METHOD_PATHS = [
|
|
|
5279
5288
|
"topics.updateTopic",
|
|
5280
5289
|
"worktrees.activateWorktree",
|
|
5281
5290
|
"worktrees.addWorktree",
|
|
5291
|
+
"worktrees.beginBuildSession",
|
|
5282
5292
|
"worktrees.listAllWorktrees",
|
|
5283
5293
|
"worktrees.listCampaigns",
|
|
5284
5294
|
"worktrees.listWorktrees",
|
|
@@ -5301,6 +5311,7 @@ var CONTRACTS = {
|
|
|
5301
5311
|
"archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
|
|
5302
5312
|
"archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
|
|
5303
5313
|
"archive_question": { method: "DELETE", path: "/questions", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
|
|
5314
|
+
"begin_build_session": { method: "POST", path: "/mcp/build-session/begin", kind: "mutation", idempotent: true, surfaceIntent: "system" },
|
|
5304
5315
|
"bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
5305
5316
|
"broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
|
|
5306
5317
|
"check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
@@ -5472,6 +5483,9 @@ function createFunctionSurfaceClient(config = {}) {
|
|
|
5472
5483
|
archiveQuestion(input = {}, idempotencyKey) {
|
|
5473
5484
|
return execute("archive_question", input, idempotencyKey);
|
|
5474
5485
|
},
|
|
5486
|
+
beginBuildSession(input = {}, idempotencyKey) {
|
|
5487
|
+
return execute("begin_build_session", input, idempotencyKey);
|
|
5488
|
+
},
|
|
5475
5489
|
bisectConfidence(input = {}, idempotencyKey) {
|
|
5476
5490
|
return execute("bisect_confidence", input, idempotencyKey);
|
|
5477
5491
|
},
|
|
@@ -7406,6 +7420,13 @@ function requireTopicId4(args) {
|
|
|
7406
7420
|
}
|
|
7407
7421
|
return topicId;
|
|
7408
7422
|
}
|
|
7423
|
+
function requireTopicOrProjectId(args) {
|
|
7424
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
7425
|
+
if (!topicId) {
|
|
7426
|
+
throw new Error("topicId is required");
|
|
7427
|
+
}
|
|
7428
|
+
return topicId;
|
|
7429
|
+
}
|
|
7409
7430
|
var AUDIT_NODE_REFERENCE_KEY_PATTERN = /(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
7410
7431
|
function matchesAuditNodeReference(value, nodeId) {
|
|
7411
7432
|
if (Array.isArray(value)) {
|
|
@@ -7441,6 +7462,23 @@ function requireBaseRate(args) {
|
|
|
7441
7462
|
function exposeGatewayData(response) {
|
|
7442
7463
|
return Object.assign({}, response, response.data);
|
|
7443
7464
|
}
|
|
7465
|
+
function sdkQueryString(input) {
|
|
7466
|
+
const params = new URLSearchParams();
|
|
7467
|
+
for (const [key, value] of Object.entries(input)) {
|
|
7468
|
+
if (value === void 0 || value === null) {
|
|
7469
|
+
continue;
|
|
7470
|
+
}
|
|
7471
|
+
if (Array.isArray(value)) {
|
|
7472
|
+
if (value.length > 0) {
|
|
7473
|
+
params.set(key, value.join(","));
|
|
7474
|
+
}
|
|
7475
|
+
continue;
|
|
7476
|
+
}
|
|
7477
|
+
params.set(key, String(value));
|
|
7478
|
+
}
|
|
7479
|
+
const serialized = params.toString();
|
|
7480
|
+
return serialized ? `?${serialized}` : "";
|
|
7481
|
+
}
|
|
7444
7482
|
function createLucernClient(config = {}) {
|
|
7445
7483
|
const gatewayConfig = toGatewayConfig(config);
|
|
7446
7484
|
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
@@ -7861,6 +7899,30 @@ function createLucernClient(config = {}) {
|
|
|
7861
7899
|
batchCreate(input, idempotencyKey) {
|
|
7862
7900
|
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
7863
7901
|
},
|
|
7902
|
+
listByTopicAndType(input) {
|
|
7903
|
+
return gateway.request({
|
|
7904
|
+
path: `/api/platform/v1/nodes${sdkQueryString({
|
|
7905
|
+
topicId: requireTopicOrProjectId(input),
|
|
7906
|
+
nodeType: input.nodeType,
|
|
7907
|
+
nodeTypes: input.nodeTypes,
|
|
7908
|
+
query: input.query,
|
|
7909
|
+
sourceText: input.sourceText,
|
|
7910
|
+
limit: input.limit,
|
|
7911
|
+
cursor: input.cursor
|
|
7912
|
+
})}`
|
|
7913
|
+
}).then(exposeGatewayData);
|
|
7914
|
+
},
|
|
7915
|
+
countByTopicAndType(input) {
|
|
7916
|
+
return gateway.request({
|
|
7917
|
+
path: `/api/platform/v1/nodes/count${sdkQueryString({
|
|
7918
|
+
topicId: requireTopicOrProjectId(input),
|
|
7919
|
+
nodeType: input.nodeType,
|
|
7920
|
+
nodeTypes: input.nodeTypes,
|
|
7921
|
+
query: input.query,
|
|
7922
|
+
limit: input.limit
|
|
7923
|
+
})}`
|
|
7924
|
+
}).then(exposeGatewayData);
|
|
7925
|
+
},
|
|
7864
7926
|
supersede(input, idempotencyKey) {
|
|
7865
7927
|
return graphClient.supersedeNode(input, idempotencyKey);
|
|
7866
7928
|
},
|
|
@@ -7871,6 +7933,78 @@ function createLucernClient(config = {}) {
|
|
|
7871
7933
|
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
7872
7934
|
}
|
|
7873
7935
|
};
|
|
7936
|
+
const publicationNamespace = {
|
|
7937
|
+
create(input, idempotencyKey) {
|
|
7938
|
+
return gateway.request({
|
|
7939
|
+
path: "/api/platform/v1/publication",
|
|
7940
|
+
method: "POST",
|
|
7941
|
+
body: input,
|
|
7942
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7943
|
+
}).then(exposeGatewayData);
|
|
7944
|
+
},
|
|
7945
|
+
update(publicationId, input, idempotencyKey) {
|
|
7946
|
+
return gateway.request({
|
|
7947
|
+
path: `/api/platform/v1/publication/${encodeURIComponent(
|
|
7948
|
+
publicationId
|
|
7949
|
+
)}`,
|
|
7950
|
+
method: "PATCH",
|
|
7951
|
+
body: input,
|
|
7952
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7953
|
+
}).then(exposeGatewayData);
|
|
7954
|
+
},
|
|
7955
|
+
list(input = {}) {
|
|
7956
|
+
return gateway.request({
|
|
7957
|
+
path: `/api/platform/v1/publication${sdkQueryString(input)}`
|
|
7958
|
+
}).then(exposeGatewayData);
|
|
7959
|
+
},
|
|
7960
|
+
getByTopic(input) {
|
|
7961
|
+
const topicId = typeof input === "string" ? input : input.topicId;
|
|
7962
|
+
const workspaceId = typeof input === "string" ? void 0 : input.workspaceId;
|
|
7963
|
+
return gateway.request({
|
|
7964
|
+
path: `/api/platform/v1/publication/by-topic/${encodeURIComponent(
|
|
7965
|
+
topicId
|
|
7966
|
+
)}${sdkQueryString({ workspaceId })}`
|
|
7967
|
+
}).then(exposeGatewayData);
|
|
7968
|
+
},
|
|
7969
|
+
publish(publicationId, input = {}, idempotencyKey) {
|
|
7970
|
+
return gateway.request({
|
|
7971
|
+
path: `/api/platform/v1/publication/${encodeURIComponent(
|
|
7972
|
+
publicationId
|
|
7973
|
+
)}/publish`,
|
|
7974
|
+
method: "POST",
|
|
7975
|
+
body: input,
|
|
7976
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7977
|
+
}).then(exposeGatewayData);
|
|
7978
|
+
},
|
|
7979
|
+
unpublish(publicationId, input = {}, idempotencyKey) {
|
|
7980
|
+
return gateway.request({
|
|
7981
|
+
path: `/api/platform/v1/publication/${encodeURIComponent(
|
|
7982
|
+
publicationId
|
|
7983
|
+
)}/unpublish`,
|
|
7984
|
+
method: "POST",
|
|
7985
|
+
body: input,
|
|
7986
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
7987
|
+
}).then(exposeGatewayData);
|
|
7988
|
+
},
|
|
7989
|
+
remove(publicationId, input = {}) {
|
|
7990
|
+
return gateway.request({
|
|
7991
|
+
path: `/api/platform/v1/publication/${encodeURIComponent(
|
|
7992
|
+
publicationId
|
|
7993
|
+
)}${sdkQueryString(input)}`,
|
|
7994
|
+
method: "DELETE"
|
|
7995
|
+
}).then(exposeGatewayData);
|
|
7996
|
+
}
|
|
7997
|
+
};
|
|
7998
|
+
const ontologyLinksNamespace = {
|
|
7999
|
+
...ontologyLinksClient,
|
|
8000
|
+
resolveThemeSource(input) {
|
|
8001
|
+
return gateway.request({
|
|
8002
|
+
path: "/api/platform/v1/ontology-links/theme-source",
|
|
8003
|
+
method: "POST",
|
|
8004
|
+
body: input
|
|
8005
|
+
}).then(exposeGatewayData);
|
|
8006
|
+
}
|
|
8007
|
+
};
|
|
7874
8008
|
return {
|
|
7875
8009
|
config,
|
|
7876
8010
|
version: LUCERN_SDK_VERSION,
|
|
@@ -8352,6 +8486,54 @@ function createLucernClient(config = {}) {
|
|
|
8352
8486
|
}));
|
|
8353
8487
|
}
|
|
8354
8488
|
},
|
|
8489
|
+
themes: {
|
|
8490
|
+
listByTopic(input) {
|
|
8491
|
+
return gateway.request({
|
|
8492
|
+
path: `/api/platform/v1/themes${sdkQueryString({
|
|
8493
|
+
topicId: requireTopicOrProjectId(input),
|
|
8494
|
+
query: input.query,
|
|
8495
|
+
limit: input.limit,
|
|
8496
|
+
cursor: input.cursor
|
|
8497
|
+
})}`
|
|
8498
|
+
}).then(exposeGatewayData);
|
|
8499
|
+
}
|
|
8500
|
+
},
|
|
8501
|
+
graphSearch: {
|
|
8502
|
+
keywordSearchNodes(input) {
|
|
8503
|
+
return gateway.request({
|
|
8504
|
+
path: "/api/platform/v1/graph-search/keyword-nodes",
|
|
8505
|
+
method: "POST",
|
|
8506
|
+
body: {
|
|
8507
|
+
...input,
|
|
8508
|
+
topicId: requireTopicOrProjectId(input),
|
|
8509
|
+
projectId: void 0
|
|
8510
|
+
}
|
|
8511
|
+
}).then(exposeGatewayData);
|
|
8512
|
+
}
|
|
8513
|
+
},
|
|
8514
|
+
classifiers: {
|
|
8515
|
+
listBeliefCandidates(input) {
|
|
8516
|
+
return gateway.request({
|
|
8517
|
+
path: `/api/platform/v1/classifiers/belief-candidates${sdkQueryString({
|
|
8518
|
+
topicId: requireTopicOrProjectId(input),
|
|
8519
|
+
classifierKey: input.classifierKey,
|
|
8520
|
+
query: input.query,
|
|
8521
|
+
limit: input.limit,
|
|
8522
|
+
cursor: input.cursor
|
|
8523
|
+
})}`
|
|
8524
|
+
}).then(exposeGatewayData);
|
|
8525
|
+
}
|
|
8526
|
+
},
|
|
8527
|
+
archetypes: {
|
|
8528
|
+
getJudgmentSignature(input) {
|
|
8529
|
+
return gateway.request({
|
|
8530
|
+
path: `/api/platform/v1/archetypes/judgment-signature${sdkQueryString({
|
|
8531
|
+
topicId: requireTopicOrProjectId(input),
|
|
8532
|
+
principalId: input.principalId
|
|
8533
|
+
})}`
|
|
8534
|
+
}).then(exposeGatewayData);
|
|
8535
|
+
}
|
|
8536
|
+
},
|
|
8355
8537
|
judgments: {
|
|
8356
8538
|
create(input) {
|
|
8357
8539
|
return decisionsClient.createJudgment(input);
|
|
@@ -8393,6 +8575,52 @@ function createLucernClient(config = {}) {
|
|
|
8393
8575
|
});
|
|
8394
8576
|
}
|
|
8395
8577
|
},
|
|
8578
|
+
decisions: {
|
|
8579
|
+
create(input) {
|
|
8580
|
+
return decisionsClient.createJudgment(input);
|
|
8581
|
+
},
|
|
8582
|
+
record(input) {
|
|
8583
|
+
return decisionsClient.recordJudgment(input);
|
|
8584
|
+
},
|
|
8585
|
+
list(query5) {
|
|
8586
|
+
return decisionsClient.listJudgments(query5);
|
|
8587
|
+
},
|
|
8588
|
+
get(decisionId) {
|
|
8589
|
+
return decisionsClient.getJudgment(decisionId);
|
|
8590
|
+
},
|
|
8591
|
+
recordOutcome(decisionId, input) {
|
|
8592
|
+
return decisionsClient.recordJudgmentOutcome(decisionId, input);
|
|
8593
|
+
},
|
|
8594
|
+
lessons(decisionId, input, idempotencyKey) {
|
|
8595
|
+
return gateway.request({
|
|
8596
|
+
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
8597
|
+
decisionId
|
|
8598
|
+
)}/lessons`,
|
|
8599
|
+
method: "POST",
|
|
8600
|
+
body: input,
|
|
8601
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
8602
|
+
}).then(exposeGatewayData);
|
|
8603
|
+
},
|
|
8604
|
+
archive(decisionId, input = {}, idempotencyKey) {
|
|
8605
|
+
return gateway.request({
|
|
8606
|
+
path: `/api/platform/v1/decisions/${encodeURIComponent(
|
|
8607
|
+
decisionId
|
|
8608
|
+
)}/archive`,
|
|
8609
|
+
method: "POST",
|
|
8610
|
+
body: input,
|
|
8611
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
8612
|
+
}).then(exposeGatewayData);
|
|
8613
|
+
},
|
|
8614
|
+
readiness(topicId) {
|
|
8615
|
+
return decisionsClient.getJudgmentReadiness({ topicId });
|
|
8616
|
+
},
|
|
8617
|
+
calibration(topicId) {
|
|
8618
|
+
return decisionsClient.getJudgmentCalibration({ topicId });
|
|
8619
|
+
},
|
|
8620
|
+
pendingOutcomeReview(topicId) {
|
|
8621
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({ topicId });
|
|
8622
|
+
}
|
|
8623
|
+
},
|
|
8396
8624
|
worktrees: {
|
|
8397
8625
|
createBranch(input) {
|
|
8398
8626
|
return workflowClient.createBranch(input);
|
|
@@ -8415,7 +8643,21 @@ function createLucernClient(config = {}) {
|
|
|
8415
8643
|
topicId: requireTopicId4(input),
|
|
8416
8644
|
objective: input.objective,
|
|
8417
8645
|
hypothesis: input.hypothesis,
|
|
8646
|
+
rationale: input.rationale,
|
|
8647
|
+
worktreeType: input.worktreeType,
|
|
8648
|
+
startDate: input.startDate,
|
|
8649
|
+
endDate: input.endDate,
|
|
8650
|
+
durationWeeks: input.durationWeeks,
|
|
8651
|
+
confidenceImpact: input.confidenceImpact,
|
|
8652
|
+
beliefFocus: input.beliefFocus,
|
|
8418
8653
|
beliefIds: input.beliefIds,
|
|
8654
|
+
targetBeliefIds: input.targetBeliefIds,
|
|
8655
|
+
targetQuestionIds: input.targetQuestionIds,
|
|
8656
|
+
keyQuestions: input.keyQuestions,
|
|
8657
|
+
evidenceSignals: input.evidenceSignals,
|
|
8658
|
+
decisionGate: input.decisionGate,
|
|
8659
|
+
goCriteria: input.goCriteria,
|
|
8660
|
+
noGoSignals: input.noGoSignals,
|
|
8419
8661
|
autoShape: input.autoShape,
|
|
8420
8662
|
domainPackId: input.domainPackId,
|
|
8421
8663
|
campaign: input.campaign,
|
|
@@ -8428,7 +8670,8 @@ function createLucernClient(config = {}) {
|
|
|
8428
8670
|
proofArtifacts: input.proofArtifacts,
|
|
8429
8671
|
staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
|
|
8430
8672
|
lastReconciledAt: input.lastReconciledAt,
|
|
8431
|
-
autoFixPolicy: input.autoFixPolicy
|
|
8673
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
8674
|
+
lensId: input.lensId
|
|
8432
8675
|
});
|
|
8433
8676
|
},
|
|
8434
8677
|
add(input) {
|
|
@@ -8437,7 +8680,21 @@ function createLucernClient(config = {}) {
|
|
|
8437
8680
|
topicId: requireTopicId4(input),
|
|
8438
8681
|
objective: input.objective,
|
|
8439
8682
|
hypothesis: input.hypothesis,
|
|
8683
|
+
rationale: input.rationale,
|
|
8684
|
+
worktreeType: input.worktreeType,
|
|
8685
|
+
startDate: input.startDate,
|
|
8686
|
+
endDate: input.endDate,
|
|
8687
|
+
durationWeeks: input.durationWeeks,
|
|
8688
|
+
confidenceImpact: input.confidenceImpact,
|
|
8689
|
+
beliefFocus: input.beliefFocus,
|
|
8440
8690
|
beliefIds: input.beliefIds,
|
|
8691
|
+
targetBeliefIds: input.targetBeliefIds,
|
|
8692
|
+
targetQuestionIds: input.targetQuestionIds,
|
|
8693
|
+
keyQuestions: input.keyQuestions,
|
|
8694
|
+
evidenceSignals: input.evidenceSignals,
|
|
8695
|
+
decisionGate: input.decisionGate,
|
|
8696
|
+
goCriteria: input.goCriteria,
|
|
8697
|
+
noGoSignals: input.noGoSignals,
|
|
8441
8698
|
autoShape: input.autoShape,
|
|
8442
8699
|
domainPackId: input.domainPackId,
|
|
8443
8700
|
campaign: input.campaign,
|
|
@@ -8450,7 +8707,8 @@ function createLucernClient(config = {}) {
|
|
|
8450
8707
|
proofArtifacts: input.proofArtifacts,
|
|
8451
8708
|
staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
|
|
8452
8709
|
lastReconciledAt: input.lastReconciledAt,
|
|
8453
|
-
autoFixPolicy: input.autoFixPolicy
|
|
8710
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
8711
|
+
lensId: input.lensId
|
|
8454
8712
|
});
|
|
8455
8713
|
},
|
|
8456
8714
|
list(query5) {
|
|
@@ -8460,6 +8718,22 @@ function createLucernClient(config = {}) {
|
|
|
8460
8718
|
limit: query5.limit
|
|
8461
8719
|
});
|
|
8462
8720
|
},
|
|
8721
|
+
listByTopic(query5) {
|
|
8722
|
+
return worktreesFacade.list({
|
|
8723
|
+
topicId: requireTopicId4(query5),
|
|
8724
|
+
status: query5.status,
|
|
8725
|
+
limit: query5.limit
|
|
8726
|
+
});
|
|
8727
|
+
},
|
|
8728
|
+
findByPairedSprint(input) {
|
|
8729
|
+
return gateway.request({
|
|
8730
|
+
path: `/api/platform/v1/worktrees/paired-sprint${sdkQueryString({
|
|
8731
|
+
sprintId: input.sprintId,
|
|
8732
|
+
topicId: input.topicId ?? input.projectId,
|
|
8733
|
+
limit: input.limit
|
|
8734
|
+
})}`
|
|
8735
|
+
}).then(exposeGatewayData);
|
|
8736
|
+
},
|
|
8463
8737
|
activate(worktreeId) {
|
|
8464
8738
|
return worktreesFacade.activate({ id: worktreeId });
|
|
8465
8739
|
},
|
|
@@ -8611,6 +8885,31 @@ function createLucernClient(config = {}) {
|
|
|
8611
8885
|
status: typeof input.status === "string" ? input.status : void 0,
|
|
8612
8886
|
limit: typeof input.limit === "number" ? input.limit : void 0
|
|
8613
8887
|
});
|
|
8888
|
+
},
|
|
8889
|
+
listByTopic(input) {
|
|
8890
|
+
return tasksFacade.list({
|
|
8891
|
+
topicId: requireTopicId4(input),
|
|
8892
|
+
status: typeof input.status === "string" ? input.status : void 0,
|
|
8893
|
+
limit: typeof input.limit === "number" ? input.limit : void 0
|
|
8894
|
+
});
|
|
8895
|
+
},
|
|
8896
|
+
listByWorktree(input) {
|
|
8897
|
+
return tasksFacade.list({
|
|
8898
|
+
topicId: typeof input.topicId === "string" ? input.topicId : void 0,
|
|
8899
|
+
worktreeId: input.worktreeId,
|
|
8900
|
+
status: typeof input.status === "string" ? input.status : void 0,
|
|
8901
|
+
limit: typeof input.limit === "number" ? input.limit : void 0
|
|
8902
|
+
});
|
|
8903
|
+
},
|
|
8904
|
+
linkChat(taskId, input, idempotencyKey) {
|
|
8905
|
+
return gateway.request({
|
|
8906
|
+
path: `/api/platform/v1/tasks/${encodeURIComponent(
|
|
8907
|
+
taskId
|
|
8908
|
+
)}/link-chat`,
|
|
8909
|
+
method: "POST",
|
|
8910
|
+
body: input,
|
|
8911
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
8912
|
+
}).then(exposeGatewayData);
|
|
8614
8913
|
}
|
|
8615
8914
|
},
|
|
8616
8915
|
topics: {
|
|
@@ -8895,11 +9194,13 @@ function createLucernClient(config = {}) {
|
|
|
8895
9194
|
graphAnalysis: graphAnalysisClient,
|
|
8896
9195
|
graphRecommendations: graphRecommendationsClient,
|
|
8897
9196
|
orgGraphSearch: orgGraphSearchClient,
|
|
8898
|
-
ontologyLinks:
|
|
9197
|
+
ontologyLinks: ontologyLinksNamespace,
|
|
8899
9198
|
graphStateClassifier: graphStateClassifierClient,
|
|
8900
9199
|
modelRuntime: modelRuntimeClient,
|
|
8901
9200
|
jobs: jobsClient,
|
|
8902
9201
|
telemetry: telemetryClient,
|
|
9202
|
+
publication: publicationNamespace,
|
|
9203
|
+
contentPublication: publicationNamespace,
|
|
8903
9204
|
tools: {
|
|
8904
9205
|
listCatalog: toolRegistryClient.listCatalog,
|
|
8905
9206
|
listExecutable: toolRegistryClient.listExecutable,
|
|
@@ -11367,7 +11668,291 @@ function createWebhooksClientCore(config = {}) {
|
|
|
11367
11668
|
}
|
|
11368
11669
|
};
|
|
11369
11670
|
}
|
|
11671
|
+
var InfisicalRuntimeError = class extends Error {
|
|
11672
|
+
code;
|
|
11673
|
+
status;
|
|
11674
|
+
constructor(args) {
|
|
11675
|
+
super(args.message);
|
|
11676
|
+
this.name = "InfisicalRuntimeError";
|
|
11677
|
+
this.code = args.code;
|
|
11678
|
+
this.status = args.status;
|
|
11679
|
+
}
|
|
11680
|
+
};
|
|
11681
|
+
function readInfisicalRuntimeBootstrap(env = {}, overrides = {}) {
|
|
11682
|
+
if (isInfisicalRuntimeDisabled(env)) {
|
|
11683
|
+
return null;
|
|
11684
|
+
}
|
|
11685
|
+
const bootstrapEnv = INFISICAL_RUNTIME_MANIFEST.bootstrapEnv;
|
|
11686
|
+
const clientId = overrides.clientId ?? readFirst(env, bootstrapEnv.clientId);
|
|
11687
|
+
const clientSecret = overrides.clientSecret ?? readFirst(env, bootstrapEnv.clientSecret);
|
|
11688
|
+
const hasAuthSignal = Boolean(clientId || clientSecret);
|
|
11689
|
+
if (!hasAuthSignal) {
|
|
11690
|
+
return null;
|
|
11691
|
+
}
|
|
11692
|
+
if (!clientId || !clientSecret) {
|
|
11693
|
+
throw new InfisicalRuntimeError({
|
|
11694
|
+
code: "INFISICAL_BOOTSTRAP_INCOMPLETE",
|
|
11695
|
+
message: "Infisical runtime bootstrap requires both INFISICAL_CLIENT_ID and INFISICAL_CLIENT_SECRET."
|
|
11696
|
+
});
|
|
11697
|
+
}
|
|
11698
|
+
return {
|
|
11699
|
+
apiUrl: overrides.apiUrl ?? readFirst(env, bootstrapEnv.apiUrl) ?? INFISICAL_RUNTIME_DEFAULT_API_URL,
|
|
11700
|
+
projectId: overrides.projectId ?? readFirst(env, bootstrapEnv.projectId) ?? INFISICAL_RUNTIME_DEFAULT_PROJECT_ID,
|
|
11701
|
+
clientId,
|
|
11702
|
+
clientSecret,
|
|
11703
|
+
environment: normalizeInfisicalEnvironment(
|
|
11704
|
+
overrides.environment ?? readFirst(env, bootstrapEnv.environment)
|
|
11705
|
+
),
|
|
11706
|
+
organizationSlug: overrides.organizationSlug ?? readFirst(env, bootstrapEnv.organizationSlug)
|
|
11707
|
+
};
|
|
11708
|
+
}
|
|
11709
|
+
function isInfisicalRuntimeDisabled(env = {}) {
|
|
11710
|
+
return INFISICAL_RUNTIME_MANIFEST.bootstrapEnv.disabled.some(
|
|
11711
|
+
(name) => isTruthyEnv(env[name])
|
|
11712
|
+
);
|
|
11713
|
+
}
|
|
11714
|
+
async function hydrateInfisicalRuntimeEnv(options) {
|
|
11715
|
+
const env = options.env ?? {};
|
|
11716
|
+
const bootstrap = mergeBootstrap(
|
|
11717
|
+
readInfisicalRuntimeBootstrap(env, options.bootstrap),
|
|
11718
|
+
options.bootstrap
|
|
11719
|
+
);
|
|
11720
|
+
if (!bootstrap) {
|
|
11721
|
+
return {
|
|
11722
|
+
status: "disabled",
|
|
11723
|
+
surfaceId: options.surfaceId,
|
|
11724
|
+
values: {},
|
|
11725
|
+
sourcePaths: []
|
|
11726
|
+
};
|
|
11727
|
+
}
|
|
11728
|
+
const surface = findInfisicalRuntimeSurface(options.surfaceId);
|
|
11729
|
+
if (!surface) {
|
|
11730
|
+
throw new InfisicalRuntimeError({
|
|
11731
|
+
code: "INFISICAL_UNKNOWN_SURFACE",
|
|
11732
|
+
message: `Unknown Lucern Infisical runtime surface: ${options.surfaceId}.`
|
|
11733
|
+
});
|
|
11734
|
+
}
|
|
11735
|
+
if (surface.delivery !== "runtime_fetch") {
|
|
11736
|
+
throw new InfisicalRuntimeError({
|
|
11737
|
+
code: "INFISICAL_UNSUPPORTED_SURFACE_DELIVERY",
|
|
11738
|
+
message: `${surface.id} uses ${surface.delivery}; runtime fetch is only valid for runtime_fetch surfaces.`
|
|
11739
|
+
});
|
|
11740
|
+
}
|
|
11741
|
+
const fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
11742
|
+
if (typeof fetchImpl !== "function") {
|
|
11743
|
+
throw new InfisicalRuntimeError({
|
|
11744
|
+
code: "INFISICAL_FETCH_UNAVAILABLE",
|
|
11745
|
+
message: "No fetch implementation is available for Infisical runtime hydration."
|
|
11746
|
+
});
|
|
11747
|
+
}
|
|
11748
|
+
const token = await loginWithUniversalAuth(bootstrap, fetchImpl);
|
|
11749
|
+
const values = {};
|
|
11750
|
+
const missingRequired = [];
|
|
11751
|
+
const sourcePaths = [];
|
|
11752
|
+
for (const pathId of surface.sourcePathIds) {
|
|
11753
|
+
const path = findInfisicalRuntimePath(pathId);
|
|
11754
|
+
if (!path) {
|
|
11755
|
+
throw new InfisicalRuntimeError({
|
|
11756
|
+
code: "INFISICAL_UNKNOWN_PATH",
|
|
11757
|
+
message: `Unknown Lucern Infisical runtime path: ${pathId}.`
|
|
11758
|
+
});
|
|
11759
|
+
}
|
|
11760
|
+
sourcePaths.push(path.secretPath);
|
|
11761
|
+
for (const variable of path.variables) {
|
|
11762
|
+
const runtimeVariable = variable;
|
|
11763
|
+
const secretValue = await readVariableSecret({
|
|
11764
|
+
bootstrap,
|
|
11765
|
+
fetchImpl,
|
|
11766
|
+
token,
|
|
11767
|
+
secretPath: path.secretPath,
|
|
11768
|
+
variable: runtimeVariable
|
|
11769
|
+
});
|
|
11770
|
+
if (!secretValue) {
|
|
11771
|
+
if (runtimeVariable.required) {
|
|
11772
|
+
missingRequired.push(runtimeVariable.name);
|
|
11773
|
+
}
|
|
11774
|
+
continue;
|
|
11775
|
+
}
|
|
11776
|
+
values[runtimeVariable.name] = secretValue.value;
|
|
11777
|
+
for (const alias of runtimeVariable.aliases ?? []) {
|
|
11778
|
+
values[alias] = secretValue.value;
|
|
11779
|
+
}
|
|
11780
|
+
}
|
|
11781
|
+
}
|
|
11782
|
+
if (missingRequired.length > 0) {
|
|
11783
|
+
throw new InfisicalRuntimeError({
|
|
11784
|
+
code: "INFISICAL_REQUIRED_SECRETS_MISSING",
|
|
11785
|
+
message: `Missing required Infisical runtime secrets: ${missingRequired.join(", ")}.`
|
|
11786
|
+
});
|
|
11787
|
+
}
|
|
11788
|
+
return {
|
|
11789
|
+
status: "hydrated",
|
|
11790
|
+
surfaceId: options.surfaceId,
|
|
11791
|
+
environment: bootstrap.environment,
|
|
11792
|
+
values,
|
|
11793
|
+
sourcePaths
|
|
11794
|
+
};
|
|
11795
|
+
}
|
|
11796
|
+
function applyInfisicalRuntimeEnv(result, targetEnv, options = {}) {
|
|
11797
|
+
for (const [key, value] of Object.entries(result.values)) {
|
|
11798
|
+
if (options.overrideExisting || !targetEnv[key]) {
|
|
11799
|
+
targetEnv[key] = value;
|
|
11800
|
+
}
|
|
11801
|
+
}
|
|
11802
|
+
}
|
|
11803
|
+
function normalizeInfisicalEnvironment(value) {
|
|
11804
|
+
if (value === "dev" || value === "staging" || value === "prod") {
|
|
11805
|
+
return value;
|
|
11806
|
+
}
|
|
11807
|
+
if (value === "development") {
|
|
11808
|
+
return "dev";
|
|
11809
|
+
}
|
|
11810
|
+
if (value === "production") {
|
|
11811
|
+
return "prod";
|
|
11812
|
+
}
|
|
11813
|
+
return "prod";
|
|
11814
|
+
}
|
|
11815
|
+
function mergeBootstrap(base, overrides) {
|
|
11816
|
+
if (!base) {
|
|
11817
|
+
return null;
|
|
11818
|
+
}
|
|
11819
|
+
return {
|
|
11820
|
+
...base,
|
|
11821
|
+
...compact(overrides ?? {}),
|
|
11822
|
+
apiUrl: trimTrailingSlash(overrides?.apiUrl ?? base.apiUrl)
|
|
11823
|
+
};
|
|
11824
|
+
}
|
|
11825
|
+
async function loginWithUniversalAuth(bootstrap, fetchImpl) {
|
|
11826
|
+
const response = await fetchImpl(
|
|
11827
|
+
`${trimTrailingSlash(bootstrap.apiUrl)}/api/v1/auth/universal-auth/login`,
|
|
11828
|
+
{
|
|
11829
|
+
method: "POST",
|
|
11830
|
+
headers: {
|
|
11831
|
+
"Content-Type": "application/json"
|
|
11832
|
+
},
|
|
11833
|
+
body: JSON.stringify({
|
|
11834
|
+
clientId: bootstrap.clientId,
|
|
11835
|
+
clientSecret: bootstrap.clientSecret,
|
|
11836
|
+
...bootstrap.organizationSlug ? { organizationSlug: bootstrap.organizationSlug } : {}
|
|
11837
|
+
})
|
|
11838
|
+
}
|
|
11839
|
+
);
|
|
11840
|
+
const body4 = await readJson2(response);
|
|
11841
|
+
if (!response.ok) {
|
|
11842
|
+
throw new InfisicalRuntimeError({
|
|
11843
|
+
code: "INFISICAL_UNIVERSAL_AUTH_FAILED",
|
|
11844
|
+
status: response.status,
|
|
11845
|
+
message: `Infisical Universal Auth failed with HTTP ${response.status}: ${messageFromBody(body4)}`
|
|
11846
|
+
});
|
|
11847
|
+
}
|
|
11848
|
+
const accessToken = readNestedString(body4, ["accessToken"]);
|
|
11849
|
+
if (!accessToken) {
|
|
11850
|
+
throw new InfisicalRuntimeError({
|
|
11851
|
+
code: "INFISICAL_UNIVERSAL_AUTH_INVALID_RESPONSE",
|
|
11852
|
+
message: "Infisical Universal Auth response did not include accessToken."
|
|
11853
|
+
});
|
|
11854
|
+
}
|
|
11855
|
+
return accessToken;
|
|
11856
|
+
}
|
|
11857
|
+
async function readVariableSecret(args) {
|
|
11858
|
+
const names = [args.variable.name, ...args.variable.aliases ?? []];
|
|
11859
|
+
for (const name of names) {
|
|
11860
|
+
const value = await readSecretValue({
|
|
11861
|
+
bootstrap: args.bootstrap,
|
|
11862
|
+
fetchImpl: args.fetchImpl,
|
|
11863
|
+
token: args.token,
|
|
11864
|
+
secretPath: args.secretPath,
|
|
11865
|
+
name,
|
|
11866
|
+
optional: true
|
|
11867
|
+
});
|
|
11868
|
+
if (value) {
|
|
11869
|
+
return { name, value };
|
|
11870
|
+
}
|
|
11871
|
+
}
|
|
11872
|
+
return null;
|
|
11873
|
+
}
|
|
11874
|
+
async function readSecretValue(args) {
|
|
11875
|
+
const params = new URLSearchParams({
|
|
11876
|
+
projectId: args.bootstrap.projectId,
|
|
11877
|
+
environment: args.bootstrap.environment,
|
|
11878
|
+
secretPath: args.secretPath,
|
|
11879
|
+
type: "shared",
|
|
11880
|
+
viewSecretValue: "true",
|
|
11881
|
+
expandSecretReferences: "true",
|
|
11882
|
+
includeImports: "true"
|
|
11883
|
+
});
|
|
11884
|
+
const response = await args.fetchImpl(
|
|
11885
|
+
`${trimTrailingSlash(args.bootstrap.apiUrl)}/api/v4/secrets/${encodeURIComponent(args.name)}?${params.toString()}`,
|
|
11886
|
+
{
|
|
11887
|
+
method: "GET",
|
|
11888
|
+
headers: {
|
|
11889
|
+
Authorization: `Bearer ${args.token}`
|
|
11890
|
+
}
|
|
11891
|
+
}
|
|
11892
|
+
);
|
|
11893
|
+
const body4 = await readJson2(response);
|
|
11894
|
+
if (response.status === 404 && args.optional) {
|
|
11895
|
+
return null;
|
|
11896
|
+
}
|
|
11897
|
+
if (!response.ok) {
|
|
11898
|
+
throw new InfisicalRuntimeError({
|
|
11899
|
+
code: "INFISICAL_SECRET_READ_FAILED",
|
|
11900
|
+
status: response.status,
|
|
11901
|
+
message: `Infisical secret ${args.name} read failed with HTTP ${response.status}: ${messageFromBody(body4)}`
|
|
11902
|
+
});
|
|
11903
|
+
}
|
|
11904
|
+
return readNestedString(body4, ["secret", "secretValue"]);
|
|
11905
|
+
}
|
|
11906
|
+
async function readJson2(response) {
|
|
11907
|
+
try {
|
|
11908
|
+
return await response.json();
|
|
11909
|
+
} catch {
|
|
11910
|
+
return void 0;
|
|
11911
|
+
}
|
|
11912
|
+
}
|
|
11913
|
+
function readNestedString(value, path) {
|
|
11914
|
+
let current = value;
|
|
11915
|
+
for (const key of path) {
|
|
11916
|
+
if (!current || typeof current !== "object" || !(key in current)) {
|
|
11917
|
+
return null;
|
|
11918
|
+
}
|
|
11919
|
+
current = current[key];
|
|
11920
|
+
}
|
|
11921
|
+
return typeof current === "string" && current.length > 0 ? current : null;
|
|
11922
|
+
}
|
|
11923
|
+
function messageFromBody(body4) {
|
|
11924
|
+
if (!body4 || typeof body4 !== "object") {
|
|
11925
|
+
return "no response body";
|
|
11926
|
+
}
|
|
11927
|
+
const record = body4;
|
|
11928
|
+
for (const key of ["message", "error", "errorMessage"]) {
|
|
11929
|
+
if (typeof record[key] === "string") {
|
|
11930
|
+
return record[key];
|
|
11931
|
+
}
|
|
11932
|
+
}
|
|
11933
|
+
return JSON.stringify(body4);
|
|
11934
|
+
}
|
|
11935
|
+
function readFirst(env, names) {
|
|
11936
|
+
for (const name of names) {
|
|
11937
|
+
const value = env[name]?.trim();
|
|
11938
|
+
if (value) {
|
|
11939
|
+
return value;
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11942
|
+
return void 0;
|
|
11943
|
+
}
|
|
11944
|
+
function isTruthyEnv(value) {
|
|
11945
|
+
return ["1", "true", "yes", "on"].includes(value?.toLowerCase() ?? "");
|
|
11946
|
+
}
|
|
11947
|
+
function trimTrailingSlash(value) {
|
|
11948
|
+
return value.replace(/\/+$/u, "");
|
|
11949
|
+
}
|
|
11950
|
+
function compact(value) {
|
|
11951
|
+
return Object.fromEntries(
|
|
11952
|
+
Object.entries(value).filter(([, entry]) => entry !== void 0)
|
|
11953
|
+
);
|
|
11954
|
+
}
|
|
11370
11955
|
|
|
11371
|
-
export { BELIEF_STATUSES, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, DeviceAuthorizationError, EDGE_TYPES, EMBEDDINGS_FIELDS, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENTING_FIELDS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, GRAPH_ANALYSIS_ANALYSIS_FIELDS, GRAPH_ANALYSIS_COMPUTE_FIELDS, GRAPH_ANALYSIS_SUGGESTION_FIELDS, GRAPH_RECOMMENDATION_FIELDS, GRAPH_STATE_CLASSIFIER_FIELDS, JOBS_FIELDS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, LucernSdkAuthContextError, MAX_ENTITY_LIMIT, MCP_ALWAYS_ALLOWED_TOOL_NAMES, MERGE_OUTCOMES, MODEL_RUNTIME_FIELDS, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, ONTOLOGY_LINK_FIELDS, ORG_GRAPH_SEARCH_FIELDS, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, TELEMETRY_FIELDS, TENANT_IDENTITY_FIELDS, TOOL_REGISTRY_FIELDS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, buildMcpToolContracts, buildMcpToolManifest, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createAuthDeviceClient, createBeliefsClient, createCanonicalAuthHeaders, createContextClient, createContextFacade, createDecisionsClient, createEmbeddingsClient, createEventId, createEventingClient, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphAnalysisClient, createGraphClient, createGraphRecommendationsClient, createGraphStateClassifierClient, createHarnessClient, createIdentityClient, createJobsClient, createLearningClient, createListResult, createLucernClient, createModelRuntimeClient, createOntologyClient, createOntologyLinksClient, createOrgGraphSearchClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTelemetryClient, createToolRegistryClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getMcpToolExposure, getRegisteredCustomTool, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isLensFilterCriteria, isLucernPrompt, isMcpToolAllowed, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, mcpContractToInputSchema, mcpContractToManifestEntry, migrateBranchToLens, nextDeliveryAttemptAt, normalizeCanonicalLucernAuthContext, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, planContextPackCompilation, randomIdempotencyKey, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, withSdkAliases, withTextAlias, withTopicAlias };
|
|
11956
|
+
export { BELIEF_STATUSES, BRANCH_DEPRECATION_MESSAGE, CANONICAL_WORKFLOW_DEFINITIONS, CONFIDENCE_TRIGGERS, CONTRADICTION_SEVERITIES, CONTRADICTION_STATUSES, CONTROL_OBJECT_BLAST_RADII, CONTROL_OBJECT_EDIT_SURFACES, CONTROL_OBJECT_INHERITANCE_RULES, CONTROL_OBJECT_KINDS, CONTROL_OBJECT_OWNERSHIP_CONTRACT, CONTROL_OBJECT_OWNERSHIP_MATRIX, CONTROL_OBJECT_OWNERSHIP_ROWS, CONTROL_OBJECT_OWNER_SCOPES, CustomToolRegistryError, DEFAULT_TIER_APPROVAL_MODE, DEFAULT_WORKFLOW_AUTO_FIX_POLICY, DEFEAT_TYPES, DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, DeviceAuthorizationError, EDGE_TYPES, EMBEDDINGS_FIELDS, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENTING_FIELDS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, GRAPH_ANALYSIS_ANALYSIS_FIELDS, GRAPH_ANALYSIS_COMPUTE_FIELDS, GRAPH_ANALYSIS_SUGGESTION_FIELDS, GRAPH_RECOMMENDATION_FIELDS, GRAPH_STATE_CLASSIFIER_FIELDS, InfisicalRuntimeError, JOBS_FIELDS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, LucernSdkAuthContextError, MAX_ENTITY_LIMIT, MCP_ALWAYS_ALLOWED_TOOL_NAMES, MERGE_OUTCOMES, MODEL_RUNTIME_FIELDS, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, ONTOLOGY_LINK_FIELDS, ORG_GRAPH_SEARCH_FIELDS, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, TELEMETRY_FIELDS, TENANT_IDENTITY_FIELDS, TOOL_REGISTRY_FIELDS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS, WORKFLOW_ACTION_KINDS, WORKFLOW_APPROVAL_MODES, WORKFLOW_AUTO_FIX_MODES, WORKFLOW_HOOK_EVENTS, WORKFLOW_INTEGRITY_CHECKS, WORKFLOW_MUTATION_TIERS, WORKFLOW_OUTPUT_KINDS, WORKFLOW_PROOF_ARTIFACT_KINDS, WORKFLOW_RUNTIME_SCHEMA_VERSION, WORKFLOW_RUN_STATUSES, WORKFLOW_STAFFING_HINTS, WORKFLOW_TRIGGER_KINDS, WORKTREE_PHASES, applyInfisicalRuntimeEnv, asListItems, assertValidWebhookSecret, assertValidWebhookUrl, buildDeprecatedBranchMetadata, buildDomainEvent, buildMcpToolContracts, buildMcpToolManifest, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createAuthDeviceClient, createBeliefsClient, createCanonicalAuthHeaders, createContextClient, createContextFacade, createDecisionsClient, createEmbeddingsClient, createEventId, createEventingClient, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphAnalysisClient, createGraphClient, createGraphRecommendationsClient, createGraphStateClassifierClient, createHarnessClient, createIdentityClient, createJobsClient, createLearningClient, createListResult, createLucernClient, createModelRuntimeClient, createOntologyClient, createOntologyLinksClient, createOrgGraphSearchClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTelemetryClient, createToolRegistryClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getMcpToolExposure, getRegisteredCustomTool, hydrateInfisicalRuntimeEnv, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isInfisicalRuntimeDisabled, isLensFilterCriteria, isLucernPrompt, isMcpToolAllowed, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, mcpContractToInputSchema, mcpContractToManifestEntry, migrateBranchToLens, nextDeliveryAttemptAt, normalizeCanonicalLucernAuthContext, normalizeDelegationChain, normalizeNodeVerificationStatus, normalizeNodeWriteInput, normalizeRetentionDays, normalizeTopicQuery, normalizeWebhookPatterns, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected, planContextPackCompilation, randomIdempotencyKey, readInfisicalRuntimeBootstrap, registerCustomTool, resolveDeliveryFailureStatus, resolveText, resolveTopicId, sanitizeWebhookRecord, sortEventsByCursor, toQueryString, truncateWebhookResponseBody, unregisterCustomTool, validateFilterCriteria, withSdkAliases, withTextAlias, withTopicAlias };
|
|
11372
11957
|
//# sourceMappingURL=index.js.map
|
|
11373
11958
|
//# sourceMappingURL=index.js.map
|