@lucern/sdk 0.3.0-alpha.2 → 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.d.ts +2 -0
- package/dist/adminClient.js +195 -3
- package/dist/adminClient.js.map +1 -1
- package/dist/answersClient.d.ts +2 -0
- package/dist/answersClient.js +195 -3
- package/dist/answersClient.js.map +1 -1
- package/dist/audiencesClient.d.ts +2 -0
- package/dist/audiencesClient.js +195 -3
- package/dist/audiencesClient.js.map +1 -1
- package/dist/auditClient.d.ts +2 -0
- package/dist/auditClient.js +197 -5
- package/dist/auditClient.js.map +1 -1
- package/dist/authContext.d.ts +56 -0
- package/dist/authContext.js +170 -0
- package/dist/authContext.js.map +1 -0
- package/dist/authDeviceClient.d.ts +49 -0
- package/dist/authDeviceClient.js +108 -0
- package/dist/authDeviceClient.js.map +1 -0
- package/dist/beliefs/index.d.ts +19 -2
- package/dist/beliefs/index.js +2648 -327
- package/dist/beliefs/index.js.map +1 -1
- package/dist/beliefsClient.d.ts +2 -0
- package/dist/beliefsClient.js +199 -7
- package/dist/beliefsClient.js.map +1 -1
- package/dist/boundaryClientSurface.d.ts +20 -0
- package/dist/boundaryClientSurface.js +66 -0
- package/dist/boundaryClientSurface.js.map +1 -0
- package/dist/{client-B6aWUUwp.d.ts → client-DOLqClbU.d.ts} +548 -9
- package/dist/client.d.ts +20 -3
- package/dist/client.js +2648 -327
- package/dist/client.js.map +1 -1
- package/dist/contextClient.d.ts +2 -0
- package/dist/contextClient.js +201 -9
- 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.d.ts +1 -0
- package/dist/contracts/index.js +104 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/mcpTools.d.ts +46 -1
- package/dist/contracts/mcpTools.js +102 -0
- package/dist/contracts/mcpTools.js.map +1 -1
- package/dist/contradictions/index.d.ts +19 -2
- package/dist/contradictions/index.js +2648 -327
- package/dist/contradictions/index.js.map +1 -1
- package/dist/coreClient.d.ts +9 -0
- package/dist/coreClient.js +195 -3
- package/dist/coreClient.js.map +1 -1
- package/dist/decisions/index.d.ts +19 -2
- package/dist/decisions/index.js +2648 -327
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisionsClient.d.ts +2 -0
- package/dist/decisionsClient.js +198 -6
- package/dist/decisionsClient.js.map +1 -1
- package/dist/edges/index.d.ts +19 -2
- package/dist/edges/index.js +2648 -327
- package/dist/edges/index.js.map +1 -1
- package/dist/embeddingsClient.d.ts +106 -0
- package/dist/embeddingsClient.js +708 -0
- package/dist/embeddingsClient.js.map +1 -0
- package/dist/eventingClient.d.ts +96 -0
- package/dist/eventingClient.js +705 -0
- package/dist/eventingClient.js.map +1 -0
- package/dist/eventsCore.d.ts +2 -0
- package/dist/eventsCore.js +195 -3
- package/dist/eventsCore.js.map +1 -1
- package/dist/evidence/index.d.ts +19 -2
- package/dist/evidence/index.js +2648 -327
- package/dist/evidence/index.js.map +1 -1
- package/dist/evidenceClient.d.ts +2 -0
- package/dist/evidenceClient.js +195 -3
- package/dist/evidenceClient.js.map +1 -1
- package/dist/gatewayFacades.d.ts +38 -3
- package/dist/gatewayFacades.js +371 -12
- package/dist/gatewayFacades.js.map +1 -1
- package/dist/graphAnalysisClient.d.ts +147 -0
- package/dist/graphAnalysisClient.js +756 -0
- package/dist/graphAnalysisClient.js.map +1 -0
- package/dist/graphClient.d.ts +2 -0
- package/dist/graphClient.js +202 -10
- package/dist/graphClient.js.map +1 -1
- package/dist/graphRecommendationsClient.d.ts +56 -0
- package/dist/graphRecommendationsClient.js +646 -0
- package/dist/graphRecommendationsClient.js.map +1 -0
- package/dist/graphStateClassifierClient.d.ts +73 -0
- package/dist/graphStateClassifierClient.js +694 -0
- package/dist/graphStateClassifierClient.js.map +1 -0
- package/dist/harnessClient.d.ts +2 -0
- package/dist/harnessClient.js +197 -5
- package/dist/harnessClient.js.map +1 -1
- package/dist/identityClient.d.ts +89 -3
- package/dist/identityClient.js +363 -4
- package/dist/identityClient.js.map +1 -1
- package/dist/index.d.ts +23 -4
- package/dist/index.js +3098 -353
- 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.d.ts +98 -0
- package/dist/jobsClient.js +704 -0
- package/dist/jobsClient.js.map +1 -0
- package/dist/learningClient.d.ts +2 -0
- package/dist/learningClient.js +197 -5
- package/dist/learningClient.js.map +1 -1
- package/dist/lenses/index.d.ts +43 -2
- package/dist/lenses/index.js +2648 -327
- package/dist/lenses/index.js.map +1 -1
- package/dist/mcpClient.d.ts +28 -0
- package/dist/mcpClient.js +650 -0
- package/dist/mcpClient.js.map +1 -0
- package/dist/modelRuntimeClient.d.ts +72 -0
- package/dist/modelRuntimeClient.js +681 -0
- package/dist/modelRuntimeClient.js.map +1 -0
- package/dist/nodes/index.d.ts +37 -2
- package/dist/nodes/index.js +2648 -327
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +19 -2
- package/dist/ontologies/index.js +2648 -327
- package/dist/ontologies/index.js.map +1 -1
- package/dist/ontologyClient.d.ts +2 -0
- package/dist/ontologyClient.js +195 -3
- package/dist/ontologyClient.js.map +1 -1
- package/dist/ontologyLinksClient.d.ts +71 -0
- package/dist/ontologyLinksClient.js +675 -0
- package/dist/ontologyLinksClient.js.map +1 -0
- package/dist/orgGraphSearchClient.d.ts +85 -0
- package/dist/orgGraphSearchClient.js +652 -0
- package/dist/orgGraphSearchClient.js.map +1 -0
- package/dist/packRuntime.d.ts +1 -2
- package/dist/packsClient.d.ts +2 -0
- package/dist/packsClient.js +195 -3
- package/dist/packsClient.js.map +1 -1
- package/dist/policyClient.d.ts +2 -0
- package/dist/policyClient.js +195 -3
- package/dist/policyClient.js.map +1 -1
- package/dist/questions/index.d.ts +19 -2
- package/dist/questions/index.js +2648 -327
- package/dist/questions/index.js.map +1 -1
- package/dist/reportsClient.d.ts +2 -0
- package/dist/reportsClient.js +197 -5
- package/dist/reportsClient.js.map +1 -1
- package/dist/schemaClient.d.ts +2 -0
- package/dist/schemaClient.js +195 -3
- package/dist/schemaClient.js.map +1 -1
- package/dist/sdkSurface.d.ts +2 -0
- package/dist/sourcesClient.d.ts +2 -0
- package/dist/sourcesClient.js +195 -3
- package/dist/sourcesClient.js.map +1 -1
- package/dist/telemetryClient.d.ts +94 -0
- package/dist/telemetryClient.js +719 -0
- package/dist/telemetryClient.js.map +1 -0
- package/dist/toolRegistryClient.d.ts +107 -0
- package/dist/toolRegistryClient.js +733 -0
- package/dist/toolRegistryClient.js.map +1 -0
- package/dist/topics/index.d.ts +19 -2
- package/dist/topics/index.js +2648 -327
- package/dist/topics/index.js.map +1 -1
- package/dist/topicsClient.d.ts +2 -0
- package/dist/topicsClient.js +200 -8
- package/dist/topicsClient.js.map +1 -1
- package/dist/workflowClient.d.ts +43 -7
- package/dist/workflowClient.js +200 -8
- package/dist/workflowClient.js.map +1 -1
- package/dist/worktrees/index.d.ts +43 -2
- package/dist/worktrees/index.js +2648 -327
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
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';
|
|
2
3
|
import * as tool_contracts_star from '@lucern/contracts/tool-contracts';
|
|
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';
|
|
3
6
|
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
5
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -42,27 +45,45 @@ __export(src_exports, {
|
|
|
42
45
|
DEFEAT_TYPES: () => DEFEAT_TYPES,
|
|
43
46
|
DOMAIN_EVENT_TYPES: () => DOMAIN_EVENT_TYPES,
|
|
44
47
|
DOMAIN_EVENT_VERSION: () => DOMAIN_EVENT_VERSION,
|
|
48
|
+
DeviceAuthorizationError: () => DeviceAuthorizationError,
|
|
45
49
|
EDGE_TYPES: () => EDGE_TYPES,
|
|
50
|
+
EMBEDDINGS_FIELDS: () => EMBEDDINGS_FIELDS,
|
|
46
51
|
EPISTEMIC_EDGE_TYPES: () => EPISTEMIC_EDGE_TYPES,
|
|
47
52
|
EPISTEMIC_LAYERS: () => EPISTEMIC_LAYERS,
|
|
53
|
+
EVENTING_FIELDS: () => EVENTING_FIELDS,
|
|
48
54
|
EVENT_RETENTION_DEFAULT_DAYS: () => EVENT_RETENTION_DEFAULT_DAYS,
|
|
49
55
|
FORK_REASONS: () => FORK_REASONS,
|
|
50
56
|
FUNCTION_SURFACE_METHOD_PATHS: () => FUNCTION_SURFACE_METHOD_PATHS,
|
|
57
|
+
GRAPH_ANALYSIS_ANALYSIS_FIELDS: () => GRAPH_ANALYSIS_ANALYSIS_FIELDS,
|
|
58
|
+
GRAPH_ANALYSIS_COMPUTE_FIELDS: () => GRAPH_ANALYSIS_COMPUTE_FIELDS,
|
|
59
|
+
GRAPH_ANALYSIS_SUGGESTION_FIELDS: () => GRAPH_ANALYSIS_SUGGESTION_FIELDS,
|
|
60
|
+
GRAPH_RECOMMENDATION_FIELDS: () => GRAPH_RECOMMENDATION_FIELDS,
|
|
61
|
+
GRAPH_STATE_CLASSIFIER_FIELDS: () => GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
62
|
+
InfisicalRuntimeError: () => InfisicalRuntimeError,
|
|
63
|
+
JOBS_FIELDS: () => JOBS_FIELDS,
|
|
51
64
|
JUDGMENT_TYPES: () => JUDGMENT_TYPES,
|
|
52
65
|
LENS_PERSPECTIVE_TYPES: () => LENS_PERSPECTIVE_TYPES,
|
|
53
66
|
LENS_STATUSES: () => LENS_STATUSES,
|
|
54
67
|
LENS_TASK_TEMPLATE_PRIORITIES: () => LENS_TASK_TEMPLATE_PRIORITIES,
|
|
55
68
|
LUCERN_SDK_VERSION: () => LUCERN_SDK_VERSION,
|
|
56
69
|
LucernApiError: () => LucernApiError,
|
|
70
|
+
LucernSdkAuthContextError: () => LucernSdkAuthContextError,
|
|
57
71
|
MAX_ENTITY_LIMIT: () => MAX_ENTITY_LIMIT,
|
|
72
|
+
MCP_ALWAYS_ALLOWED_TOOL_NAMES: () => MCP_ALWAYS_ALLOWED_TOOL_NAMES,
|
|
58
73
|
MERGE_OUTCOMES: () => MERGE_OUTCOMES,
|
|
74
|
+
MODEL_RUNTIME_FIELDS: () => MODEL_RUNTIME_FIELDS,
|
|
59
75
|
MORNING_BRIEF_WORKFLOW_ID: () => MORNING_BRIEF_WORKFLOW_ID,
|
|
60
76
|
NIGHTLY_RECONCILIATION_WORKFLOW_ID: () => NIGHTLY_RECONCILIATION_WORKFLOW_ID,
|
|
77
|
+
ONTOLOGY_LINK_FIELDS: () => ONTOLOGY_LINK_FIELDS,
|
|
78
|
+
ORG_GRAPH_SEARCH_FIELDS: () => ORG_GRAPH_SEARCH_FIELDS,
|
|
61
79
|
REASONING_METHODS: () => REASONING_METHODS,
|
|
62
80
|
SESSION_AUTH_MODES: () => SESSION_AUTH_MODES,
|
|
63
81
|
SESSION_LIFECYCLE_STATUSES: () => SESSION_LIFECYCLE_STATUSES,
|
|
64
82
|
SESSION_PRINCIPAL_TYPES: () => SESSION_PRINCIPAL_TYPES,
|
|
65
83
|
STRUCTURAL_EDGE_TYPES: () => STRUCTURAL_EDGE_TYPES,
|
|
84
|
+
TELEMETRY_FIELDS: () => TELEMETRY_FIELDS,
|
|
85
|
+
TENANT_IDENTITY_FIELDS: () => TENANT_IDENTITY_FIELDS,
|
|
86
|
+
TOOL_REGISTRY_FIELDS: () => TOOL_REGISTRY_FIELDS,
|
|
66
87
|
WEBHOOK_MAX_ATTEMPTS: () => WEBHOOK_MAX_ATTEMPTS,
|
|
67
88
|
WEBHOOK_RETRY_DELAYS_MS: () => WEBHOOK_RETRY_DELAYS_MS,
|
|
68
89
|
WORKFLOW_ACTION_KINDS: () => WORKFLOW_ACTION_KINDS,
|
|
@@ -78,11 +99,14 @@ __export(src_exports, {
|
|
|
78
99
|
WORKFLOW_STAFFING_HINTS: () => WORKFLOW_STAFFING_HINTS,
|
|
79
100
|
WORKFLOW_TRIGGER_KINDS: () => WORKFLOW_TRIGGER_KINDS,
|
|
80
101
|
WORKTREE_PHASES: () => WORKTREE_PHASES,
|
|
102
|
+
applyInfisicalRuntimeEnv: () => applyInfisicalRuntimeEnv,
|
|
81
103
|
asListItems: () => asListItems,
|
|
82
104
|
assertValidWebhookSecret: () => assertValidWebhookSecret,
|
|
83
105
|
assertValidWebhookUrl: () => assertValidWebhookUrl,
|
|
84
106
|
buildDeprecatedBranchMetadata: () => buildDeprecatedBranchMetadata,
|
|
85
107
|
buildDomainEvent: () => buildDomainEvent,
|
|
108
|
+
buildMcpToolContracts: () => buildMcpToolContracts,
|
|
109
|
+
buildMcpToolManifest: () => buildMcpToolManifest,
|
|
86
110
|
clearRegisteredCustomTools: () => clearRegisteredCustomTools,
|
|
87
111
|
compareEventCursor: () => compareEventCursor,
|
|
88
112
|
compileContextPackFromSnapshot: () => compileContextPackFromSnapshot,
|
|
@@ -91,27 +115,40 @@ __export(src_exports, {
|
|
|
91
115
|
createAnswersClient: () => createAnswersClient,
|
|
92
116
|
createAudiencesClient: () => createAudiencesClient,
|
|
93
117
|
createAuditClient: () => createAuditClient,
|
|
118
|
+
createAuthDeviceClient: () => createAuthDeviceClient,
|
|
94
119
|
createBeliefsClient: () => createBeliefsClient,
|
|
120
|
+
createCanonicalAuthHeaders: () => createCanonicalAuthHeaders,
|
|
95
121
|
createContextClient: () => createContextClient,
|
|
96
122
|
createContextFacade: () => createContextFacade,
|
|
97
123
|
createDecisionsClient: () => createDecisionsClient,
|
|
124
|
+
createEmbeddingsClient: () => createEmbeddingsClient,
|
|
98
125
|
createEventId: () => createEventId,
|
|
126
|
+
createEventingClient: () => createEventingClient,
|
|
99
127
|
createEventsClientCore: () => createEventsClientCore,
|
|
100
128
|
createEvidenceClient: () => createEvidenceClient,
|
|
101
129
|
createFunctionSurfaceClient: () => createFunctionSurfaceClient,
|
|
102
130
|
createGatewayRequestClient: () => createGatewayRequestClient,
|
|
131
|
+
createGraphAnalysisClient: () => createGraphAnalysisClient,
|
|
103
132
|
createGraphClient: () => createGraphClient,
|
|
133
|
+
createGraphRecommendationsClient: () => createGraphRecommendationsClient,
|
|
134
|
+
createGraphStateClassifierClient: () => createGraphStateClassifierClient,
|
|
104
135
|
createHarnessClient: () => createHarnessClient,
|
|
105
136
|
createIdentityClient: () => createIdentityClient,
|
|
137
|
+
createJobsClient: () => createJobsClient,
|
|
106
138
|
createLearningClient: () => createLearningClient,
|
|
107
139
|
createListResult: () => createListResult,
|
|
108
140
|
createLucernClient: () => createLucernClient,
|
|
141
|
+
createModelRuntimeClient: () => createModelRuntimeClient,
|
|
109
142
|
createOntologyClient: () => createOntologyClient,
|
|
143
|
+
createOntologyLinksClient: () => createOntologyLinksClient,
|
|
144
|
+
createOrgGraphSearchClient: () => createOrgGraphSearchClient,
|
|
110
145
|
createPacksClient: () => createPacksClient,
|
|
111
146
|
createPolicyClient: () => createPolicyClient,
|
|
112
147
|
createReportsClient: () => createReportsClient,
|
|
113
148
|
createSchemaClient: () => createSchemaClient,
|
|
114
149
|
createSourcesClient: () => createSourcesClient,
|
|
150
|
+
createTelemetryClient: () => createTelemetryClient,
|
|
151
|
+
createToolRegistryClient: () => createToolRegistryClient,
|
|
115
152
|
createTopicsClient: () => createTopicsClient,
|
|
116
153
|
createWebhooksClientCore: () => createWebhooksClientCore,
|
|
117
154
|
createWorkflowClient: () => createWorkflowClient,
|
|
@@ -120,14 +157,18 @@ __export(src_exports, {
|
|
|
120
157
|
encodeEventCursor: () => encodeEventCursor,
|
|
121
158
|
eventPatternToRegExp: () => eventPatternToRegExp,
|
|
122
159
|
getControlObjectOwnershipCase: () => getControlObjectOwnershipCase,
|
|
160
|
+
getMcpToolExposure: () => getMcpToolExposure,
|
|
123
161
|
getRegisteredCustomTool: () => getRegisteredCustomTool,
|
|
162
|
+
hydrateInfisicalRuntimeEnv: () => hydrateInfisicalRuntimeEnv,
|
|
124
163
|
inferActorType: () => inferActorType,
|
|
125
164
|
inferLensPerspectiveTypeFromBranchSchema: () => inferLensPerspectiveTypeFromBranchSchema,
|
|
126
165
|
inferSessionPrincipalType: () => inferSessionPrincipalType,
|
|
127
166
|
invokeRegisteredCustomTool: () => invokeRegisteredCustomTool,
|
|
128
167
|
isAfterCursor: () => isAfterCursor,
|
|
168
|
+
isInfisicalRuntimeDisabled: () => isInfisicalRuntimeDisabled,
|
|
129
169
|
isLensFilterCriteria: () => isLensFilterCriteria,
|
|
130
170
|
isLucernPrompt: () => isLucernPrompt,
|
|
171
|
+
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
131
172
|
isTaxonomyFilterCriteriaV1: () => isTaxonomyFilterCriteriaV1,
|
|
132
173
|
lastDelegator: () => lastDelegator,
|
|
133
174
|
listControlObjectOwnershipCases: () => listControlObjectOwnershipCases,
|
|
@@ -137,8 +178,11 @@ __export(src_exports, {
|
|
|
137
178
|
mapOpinionHistoryEntriesFromGatewayData: () => mapOpinionHistoryEntriesFromGatewayData,
|
|
138
179
|
matchesAnyEventPattern: () => matchesAnyEventPattern,
|
|
139
180
|
matchesEventPattern: () => matchesEventPattern,
|
|
181
|
+
mcpContractToInputSchema: () => mcpContractToInputSchema,
|
|
182
|
+
mcpContractToManifestEntry: () => mcpContractToManifestEntry,
|
|
140
183
|
migrateBranchToLens: () => migrateBranchToLens,
|
|
141
184
|
nextDeliveryAttemptAt: () => nextDeliveryAttemptAt,
|
|
185
|
+
normalizeCanonicalLucernAuthContext: () => normalizeCanonicalLucernAuthContext,
|
|
142
186
|
normalizeDelegationChain: () => normalizeDelegationChain,
|
|
143
187
|
normalizeNodeVerificationStatus: () => normalizeNodeVerificationStatus,
|
|
144
188
|
normalizeNodeWriteInput: () => normalizeNodeWriteInput,
|
|
@@ -150,6 +194,7 @@ __export(src_exports, {
|
|
|
150
194
|
opinionFromProjected: () => opinionFromProjected,
|
|
151
195
|
planContextPackCompilation: () => planContextPackCompilation,
|
|
152
196
|
randomIdempotencyKey: () => randomIdempotencyKey,
|
|
197
|
+
readInfisicalRuntimeBootstrap: () => readInfisicalRuntimeBootstrap,
|
|
153
198
|
registerCustomTool: () => registerCustomTool,
|
|
154
199
|
resolveDeliveryFailureStatus: () => resolveDeliveryFailureStatus,
|
|
155
200
|
resolveText: () => resolveText,
|
|
@@ -197,6 +242,173 @@ function opinionFromProjected(probability, uncertainty, baseRate) {
|
|
|
197
242
|
};
|
|
198
243
|
}
|
|
199
244
|
|
|
245
|
+
// src/authContext.ts
|
|
246
|
+
var LucernSdkAuthContextError = class extends Error {
|
|
247
|
+
reason;
|
|
248
|
+
constructor(reason, message) {
|
|
249
|
+
super(message);
|
|
250
|
+
this.name = "LucernSdkAuthContextError";
|
|
251
|
+
this.reason = reason;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
function cleanString(value) {
|
|
255
|
+
const normalized = value?.trim();
|
|
256
|
+
return normalized ? normalized : void 0;
|
|
257
|
+
}
|
|
258
|
+
function cleanStringList(values) {
|
|
259
|
+
if (!values) {
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
return values.map((value) => value.trim()).filter(
|
|
263
|
+
(value, index, list) => value.length > 0 && list.indexOf(value) === index
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function requireString(value, reason, label) {
|
|
267
|
+
const normalized = cleanString(value);
|
|
268
|
+
if (!normalized) {
|
|
269
|
+
throw new LucernSdkAuthContextError(
|
|
270
|
+
reason,
|
|
271
|
+
`Canonical Lucern SDK auth context is missing ${label}.`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
return normalized;
|
|
275
|
+
}
|
|
276
|
+
function requirePrincipalType(principalType) {
|
|
277
|
+
if (!principalType) {
|
|
278
|
+
throw new LucernSdkAuthContextError(
|
|
279
|
+
"principal_missing",
|
|
280
|
+
"Canonical Lucern SDK auth context is missing principalType."
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
return principalType;
|
|
284
|
+
}
|
|
285
|
+
function requireAuthMode(authMode) {
|
|
286
|
+
if (!authMode) {
|
|
287
|
+
throw new LucernSdkAuthContextError(
|
|
288
|
+
"principal_missing",
|
|
289
|
+
"Canonical Lucern SDK auth context is missing authMode."
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return authMode;
|
|
293
|
+
}
|
|
294
|
+
function ensurePermitMatch(args) {
|
|
295
|
+
const actual = cleanString(args.actual);
|
|
296
|
+
if (actual && actual !== args.expected) {
|
|
297
|
+
throw new LucernSdkAuthContextError(
|
|
298
|
+
"policy_denied",
|
|
299
|
+
`Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function normalizeCanonicalLucernAuthContext(input) {
|
|
304
|
+
if (!input) {
|
|
305
|
+
throw new LucernSdkAuthContextError(
|
|
306
|
+
"principal_missing",
|
|
307
|
+
"Canonical Lucern SDK auth context is required."
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
if (input.policyDecision === "deny") {
|
|
311
|
+
throw new LucernSdkAuthContextError(
|
|
312
|
+
"policy_denied",
|
|
313
|
+
"Canonical Lucern SDK auth context carries a denied policy decision."
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
const principalId = requireString(
|
|
317
|
+
input.principalId,
|
|
318
|
+
"principal_missing",
|
|
319
|
+
"principalId"
|
|
320
|
+
);
|
|
321
|
+
const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
|
|
322
|
+
const workspaceId = requireString(
|
|
323
|
+
input.workspaceId,
|
|
324
|
+
"workspace_missing",
|
|
325
|
+
"workspaceId"
|
|
326
|
+
);
|
|
327
|
+
const roles = cleanStringList(input.roles);
|
|
328
|
+
const scopes = cleanStringList(input.scopes);
|
|
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) {
|
|
333
|
+
throw new LucernSdkAuthContextError(
|
|
334
|
+
"membership_missing",
|
|
335
|
+
"Canonical Lucern SDK auth context requires non-empty roles and scopes."
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
const subject = cleanString(input.permit?.subject) ?? principalId;
|
|
339
|
+
const tenant = cleanString(input.permit?.tenant) ?? tenantId;
|
|
340
|
+
const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
|
|
341
|
+
ensurePermitMatch({
|
|
342
|
+
field: "subject",
|
|
343
|
+
expected: principalId,
|
|
344
|
+
actual: subject
|
|
345
|
+
});
|
|
346
|
+
ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
|
|
347
|
+
ensurePermitMatch({
|
|
348
|
+
field: "workspace",
|
|
349
|
+
expected: workspaceId,
|
|
350
|
+
actual: workspace
|
|
351
|
+
});
|
|
352
|
+
const context = input.permit?.context ? { ...input.permit.context } : void 0;
|
|
353
|
+
return {
|
|
354
|
+
clerkId: cleanString(input.clerkId),
|
|
355
|
+
principalId,
|
|
356
|
+
tenantId,
|
|
357
|
+
workspaceId,
|
|
358
|
+
principalType,
|
|
359
|
+
authMode,
|
|
360
|
+
roles,
|
|
361
|
+
scopes,
|
|
362
|
+
delegationChain: input.delegationChain ? [...input.delegationChain] : [],
|
|
363
|
+
policyTraceId: cleanString(input.policyTraceId),
|
|
364
|
+
correlationId: cleanString(input.correlationId),
|
|
365
|
+
membershipId: cleanString(input.membershipId),
|
|
366
|
+
permit: {
|
|
367
|
+
subject,
|
|
368
|
+
tenant,
|
|
369
|
+
workspace,
|
|
370
|
+
resource: cleanString(input.permit?.resource),
|
|
371
|
+
action: cleanString(input.permit?.action),
|
|
372
|
+
relation: cleanString(input.permit?.relation),
|
|
373
|
+
context
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
function createCanonicalAuthHeaders(authContext) {
|
|
378
|
+
const headers = {
|
|
379
|
+
"x-lucern-principal-id": authContext.principalId,
|
|
380
|
+
"x-lucern-principal-type": authContext.principalType,
|
|
381
|
+
"x-lucern-tenant": authContext.tenantId,
|
|
382
|
+
"x-lucern-tenant-id": authContext.tenantId,
|
|
383
|
+
"x-lucern-workspace": authContext.workspaceId,
|
|
384
|
+
"x-lucern-workspace-id": authContext.workspaceId,
|
|
385
|
+
"x-lucern-auth-mode": authContext.authMode,
|
|
386
|
+
"x-lucern-roles": authContext.roles.join(","),
|
|
387
|
+
"x-lucern-scopes": authContext.scopes.join(","),
|
|
388
|
+
"x-lucern-permit-context": JSON.stringify(authContext.permit)
|
|
389
|
+
};
|
|
390
|
+
if (authContext.clerkId) {
|
|
391
|
+
headers["x-lucern-clerk-id"] = authContext.clerkId;
|
|
392
|
+
headers["x-lucern-user-id"] = authContext.clerkId;
|
|
393
|
+
}
|
|
394
|
+
if (authContext.delegationChain.length > 0) {
|
|
395
|
+
headers["x-lucern-delegation-chain"] = JSON.stringify(
|
|
396
|
+
authContext.delegationChain
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
if (authContext.policyTraceId) {
|
|
400
|
+
headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
|
|
401
|
+
}
|
|
402
|
+
if (authContext.correlationId) {
|
|
403
|
+
headers["x-correlation-id"] = authContext.correlationId;
|
|
404
|
+
headers["x-lucern-correlation-id"] = authContext.correlationId;
|
|
405
|
+
}
|
|
406
|
+
if (authContext.membershipId) {
|
|
407
|
+
headers["x-lucern-membership-id"] = authContext.membershipId;
|
|
408
|
+
}
|
|
409
|
+
return headers;
|
|
410
|
+
}
|
|
411
|
+
|
|
200
412
|
// src/coreClient.ts
|
|
201
413
|
var LucernApiError = class extends Error {
|
|
202
414
|
code;
|
|
@@ -353,16 +565,41 @@ function readPolicySummaryFromDetails(details) {
|
|
|
353
565
|
}
|
|
354
566
|
return null;
|
|
355
567
|
}
|
|
568
|
+
async function resolveConfiguredAuthContext(authContext) {
|
|
569
|
+
if (typeof authContext === "function") {
|
|
570
|
+
return await authContext();
|
|
571
|
+
}
|
|
572
|
+
return authContext;
|
|
573
|
+
}
|
|
574
|
+
function mergeHeaderRecord(base, addition) {
|
|
575
|
+
const headers = new Headers(base);
|
|
576
|
+
for (const [key, value] of Object.entries(addition)) {
|
|
577
|
+
const existing = headers.get(key);
|
|
578
|
+
if (existing !== null && existing !== value) {
|
|
579
|
+
throw new LucernSdkAuthContextError(
|
|
580
|
+
"policy_denied",
|
|
581
|
+
`Canonical Lucern SDK auth context conflicts with existing ${key} header.`
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
headers.set(key, value);
|
|
585
|
+
}
|
|
586
|
+
return Object.fromEntries(headers.entries());
|
|
587
|
+
}
|
|
356
588
|
function createGatewayRequestClient(config = {}) {
|
|
357
589
|
const fetchImpl = config.fetchImpl ?? fetch;
|
|
358
590
|
const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
359
591
|
const maxRetries = config.maxRetries ?? 2;
|
|
360
592
|
const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
|
|
361
593
|
async function resolveAuthHeaders() {
|
|
362
|
-
|
|
363
|
-
|
|
594
|
+
const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
|
|
595
|
+
const authContextInput = await resolveConfiguredAuthContext(
|
|
596
|
+
config.authContext
|
|
597
|
+
);
|
|
598
|
+
if (!authContextInput && !config.requireCanonicalAuthContext) {
|
|
599
|
+
return base;
|
|
364
600
|
}
|
|
365
|
-
|
|
601
|
+
const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
|
|
602
|
+
return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
|
|
366
603
|
}
|
|
367
604
|
async function fetchWithTimeout(url, init, timeoutMs) {
|
|
368
605
|
const controller = new AbortController();
|
|
@@ -537,11 +774,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
537
774
|
function asRecord(value) {
|
|
538
775
|
return value && typeof value === "object" ? value : {};
|
|
539
776
|
}
|
|
540
|
-
function
|
|
777
|
+
function cleanString2(value) {
|
|
541
778
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
542
779
|
}
|
|
543
780
|
function normalizeVerificationStatus(value) {
|
|
544
|
-
const status =
|
|
781
|
+
const status = cleanString2(value);
|
|
545
782
|
if (!status) {
|
|
546
783
|
return void 0;
|
|
547
784
|
}
|
|
@@ -557,20 +794,20 @@ function cloneWith(value, patch) {
|
|
|
557
794
|
return { ...value, ...patch };
|
|
558
795
|
}
|
|
559
796
|
function resolveTopicId(value) {
|
|
560
|
-
return
|
|
797
|
+
return cleanString2(value.topicId);
|
|
561
798
|
}
|
|
562
799
|
function resolveText(value) {
|
|
563
|
-
return
|
|
800
|
+
return cleanString2(value.text) ?? cleanString2(value.canonicalText);
|
|
564
801
|
}
|
|
565
802
|
function withTopicAlias(value) {
|
|
566
|
-
const topicId =
|
|
803
|
+
const topicId = cleanString2(value.topicId) ?? void 0;
|
|
567
804
|
if (!topicId) {
|
|
568
805
|
return value;
|
|
569
806
|
}
|
|
570
807
|
return cloneWith(value, { topicId });
|
|
571
808
|
}
|
|
572
809
|
function withTextAlias(value) {
|
|
573
|
-
const text =
|
|
810
|
+
const text = cleanString2(value.text) ?? cleanString2(value.canonicalText) ?? void 0;
|
|
574
811
|
if (!text) {
|
|
575
812
|
return value;
|
|
576
813
|
}
|
|
@@ -600,7 +837,7 @@ function normalizeNodeVerificationStatus(value) {
|
|
|
600
837
|
return normalizeVerificationStatus(value);
|
|
601
838
|
}
|
|
602
839
|
function normalizeTopicQuery(value) {
|
|
603
|
-
const topicId =
|
|
840
|
+
const topicId = cleanString2(value.topicId);
|
|
604
841
|
if (!topicId) {
|
|
605
842
|
return value;
|
|
606
843
|
}
|
|
@@ -673,9 +910,9 @@ function createAdminClient(config = {}) {
|
|
|
673
910
|
/**
|
|
674
911
|
* List tenants visible to the current principal.
|
|
675
912
|
*/
|
|
676
|
-
async listTenants(
|
|
913
|
+
async listTenants(query5 = {}) {
|
|
677
914
|
return gateway.request({
|
|
678
|
-
path: `/api/platform/v1/tenants${toQueryString(
|
|
915
|
+
path: `/api/platform/v1/tenants${toQueryString(query5)}`
|
|
679
916
|
}).then(
|
|
680
917
|
(response) => mapGatewayData(
|
|
681
918
|
response,
|
|
@@ -716,9 +953,9 @@ function createAdminClient(config = {}) {
|
|
|
716
953
|
/**
|
|
717
954
|
* List workspaces for the current admin scope.
|
|
718
955
|
*/
|
|
719
|
-
async listWorkspaces(
|
|
956
|
+
async listWorkspaces(query5 = {}) {
|
|
720
957
|
return gateway.request({
|
|
721
|
-
path: `/api/platform/v1/workspaces${toQueryString(
|
|
958
|
+
path: `/api/platform/v1/workspaces${toQueryString(query5)}`
|
|
722
959
|
}).then(
|
|
723
960
|
(response) => mapGatewayData(
|
|
724
961
|
response,
|
|
@@ -743,9 +980,9 @@ function createAdminClient(config = {}) {
|
|
|
743
980
|
/**
|
|
744
981
|
* List memberships for the current admin scope.
|
|
745
982
|
*/
|
|
746
|
-
async listMemberships(
|
|
983
|
+
async listMemberships(query5 = {}) {
|
|
747
984
|
return gateway.request({
|
|
748
|
-
path: `/api/platform/v1/memberships${toQueryString(
|
|
985
|
+
path: `/api/platform/v1/memberships${toQueryString(query5)}`
|
|
749
986
|
}).then(
|
|
750
987
|
(response) => mapGatewayData(
|
|
751
988
|
response,
|
|
@@ -982,9 +1219,9 @@ function createAdminClient(config = {}) {
|
|
|
982
1219
|
/**
|
|
983
1220
|
* List group members.
|
|
984
1221
|
*/
|
|
985
|
-
async listGroupMembers(
|
|
1222
|
+
async listGroupMembers(query5) {
|
|
986
1223
|
return gateway.request({
|
|
987
|
-
path: `/api/platform/v1/groups/members${toQueryString(
|
|
1224
|
+
path: `/api/platform/v1/groups/members${toQueryString(query5)}`
|
|
988
1225
|
});
|
|
989
1226
|
},
|
|
990
1227
|
/**
|
|
@@ -1011,9 +1248,9 @@ function createAdminClient(config = {}) {
|
|
|
1011
1248
|
/**
|
|
1012
1249
|
* List pack-to-group assignments.
|
|
1013
1250
|
*/
|
|
1014
|
-
async listPackGroupAssignments(
|
|
1251
|
+
async listPackGroupAssignments(query5 = {}) {
|
|
1015
1252
|
return gateway.request({
|
|
1016
|
-
path: `/api/platform/v1/groups/packs${toQueryString(
|
|
1253
|
+
path: `/api/platform/v1/groups/packs${toQueryString(query5)}`
|
|
1017
1254
|
});
|
|
1018
1255
|
},
|
|
1019
1256
|
/**
|
|
@@ -1064,12 +1301,12 @@ function createAudiencesClient(config = {}) {
|
|
|
1064
1301
|
/**
|
|
1065
1302
|
* List audience registry entries.
|
|
1066
1303
|
*/
|
|
1067
|
-
async listRegistry(
|
|
1304
|
+
async listRegistry(query5 = {}) {
|
|
1068
1305
|
return gateway.request({
|
|
1069
1306
|
path: `/api/platform/v1/audiences/registry${toQueryString({
|
|
1070
|
-
...
|
|
1071
|
-
effective: typeof
|
|
1072
|
-
status:
|
|
1307
|
+
...query5,
|
|
1308
|
+
effective: typeof query5.effective === "boolean" ? query5.effective ? "true" : "false" : void 0,
|
|
1309
|
+
status: query5.status
|
|
1073
1310
|
})}`
|
|
1074
1311
|
}).then(
|
|
1075
1312
|
(response) => mapGatewayData(
|
|
@@ -1084,8 +1321,8 @@ function createAudiencesClient(config = {}) {
|
|
|
1084
1321
|
/**
|
|
1085
1322
|
* @deprecated Use listRegistry.
|
|
1086
1323
|
*/
|
|
1087
|
-
async getRegistry(
|
|
1088
|
-
return this.listRegistry(
|
|
1324
|
+
async getRegistry(query5 = {}) {
|
|
1325
|
+
return this.listRegistry(query5);
|
|
1089
1326
|
},
|
|
1090
1327
|
/**
|
|
1091
1328
|
* Create an audience registry entry.
|
|
@@ -1113,14 +1350,14 @@ function createAudiencesClient(config = {}) {
|
|
|
1113
1350
|
/**
|
|
1114
1351
|
* List audience grants.
|
|
1115
1352
|
*/
|
|
1116
|
-
async listGrants(
|
|
1353
|
+
async listGrants(query5 = {}) {
|
|
1117
1354
|
return gateway.request({
|
|
1118
1355
|
path: `/api/platform/v1/audiences/grants${toQueryString({
|
|
1119
|
-
...
|
|
1120
|
-
audienceKey:
|
|
1121
|
-
principalId:
|
|
1122
|
-
groupId:
|
|
1123
|
-
status:
|
|
1356
|
+
...query5,
|
|
1357
|
+
audienceKey: query5.audienceKey,
|
|
1358
|
+
principalId: query5.principalId,
|
|
1359
|
+
groupId: query5.groupId,
|
|
1360
|
+
status: query5.status
|
|
1124
1361
|
})}`
|
|
1125
1362
|
}).then(
|
|
1126
1363
|
(response) => mapGatewayData(
|
|
@@ -1132,8 +1369,8 @@ function createAudiencesClient(config = {}) {
|
|
|
1132
1369
|
/**
|
|
1133
1370
|
* @deprecated Use listGrants.
|
|
1134
1371
|
*/
|
|
1135
|
-
async getGrants(
|
|
1136
|
-
return this.listGrants(
|
|
1372
|
+
async getGrants(query5 = {}) {
|
|
1373
|
+
return this.listGrants(query5);
|
|
1137
1374
|
},
|
|
1138
1375
|
/**
|
|
1139
1376
|
* Create an audience grant.
|
|
@@ -1179,10 +1416,10 @@ function createAuditClient(config = {}) {
|
|
|
1179
1416
|
/**
|
|
1180
1417
|
* List audit events for the current scope.
|
|
1181
1418
|
*/
|
|
1182
|
-
async listEvents(
|
|
1419
|
+
async listEvents(query5 = {}) {
|
|
1183
1420
|
return gateway.request({
|
|
1184
1421
|
path: `/api/platform/v1/audit/events${toQueryString(
|
|
1185
|
-
normalizeTopicQuery(
|
|
1422
|
+
normalizeTopicQuery(query5)
|
|
1186
1423
|
)}`
|
|
1187
1424
|
}).then(
|
|
1188
1425
|
(response) => mapGatewayData(
|
|
@@ -1194,11 +1431,116 @@ function createAuditClient(config = {}) {
|
|
|
1194
1431
|
};
|
|
1195
1432
|
}
|
|
1196
1433
|
|
|
1434
|
+
// src/authDeviceClient.ts
|
|
1435
|
+
var DeviceAuthorizationError = class extends Error {
|
|
1436
|
+
error;
|
|
1437
|
+
interval;
|
|
1438
|
+
constructor(args) {
|
|
1439
|
+
super(args.description ?? args.error);
|
|
1440
|
+
this.name = "DeviceAuthorizationError";
|
|
1441
|
+
this.error = args.error;
|
|
1442
|
+
this.interval = args.interval;
|
|
1443
|
+
}
|
|
1444
|
+
};
|
|
1445
|
+
function authBaseUrl(config) {
|
|
1446
|
+
return config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
1447
|
+
}
|
|
1448
|
+
async function readJson(response) {
|
|
1449
|
+
const payload = await response.json().catch(() => ({}));
|
|
1450
|
+
return payload && typeof payload === "object" && !Array.isArray(payload) ? payload : {};
|
|
1451
|
+
}
|
|
1452
|
+
function readString(value) {
|
|
1453
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
1454
|
+
return normalized || void 0;
|
|
1455
|
+
}
|
|
1456
|
+
function assertDeviceCodeResponse(payload) {
|
|
1457
|
+
const deviceCode = readString(payload.device_code);
|
|
1458
|
+
const userCode = readString(payload.user_code);
|
|
1459
|
+
const verificationUri = readString(payload.verification_uri);
|
|
1460
|
+
const verificationUriComplete = readString(payload.verification_uri_complete);
|
|
1461
|
+
const expiresIn = payload.expires_in;
|
|
1462
|
+
const interval = payload.interval;
|
|
1463
|
+
if (!deviceCode || !userCode || !verificationUri || !verificationUriComplete || typeof expiresIn !== "number" || typeof interval !== "number") {
|
|
1464
|
+
throw new Error("Gateway returned an invalid device-code response.");
|
|
1465
|
+
}
|
|
1466
|
+
return {
|
|
1467
|
+
device_code: deviceCode,
|
|
1468
|
+
user_code: userCode,
|
|
1469
|
+
verification_uri: verificationUri,
|
|
1470
|
+
verification_uri_complete: verificationUriComplete,
|
|
1471
|
+
expires_in: expiresIn,
|
|
1472
|
+
interval
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
function assertDeviceTokenResponse(payload) {
|
|
1476
|
+
const accessToken = readString(payload.access_token);
|
|
1477
|
+
const tokenType = readString(payload.token_type);
|
|
1478
|
+
const scope = readString(payload.scope);
|
|
1479
|
+
const tenantId = readString(payload.tenant_id);
|
|
1480
|
+
const principalId = readString(payload.principal_id);
|
|
1481
|
+
if (!accessToken || tokenType !== "Bearer" || typeof payload.expires_in !== "number" || !scope || !tenantId || !principalId) {
|
|
1482
|
+
throw new Error("Gateway returned an invalid device token response.");
|
|
1483
|
+
}
|
|
1484
|
+
return {
|
|
1485
|
+
access_token: accessToken,
|
|
1486
|
+
token_type: "Bearer",
|
|
1487
|
+
expires_in: payload.expires_in,
|
|
1488
|
+
scope,
|
|
1489
|
+
tenant_id: tenantId,
|
|
1490
|
+
workspace_id: readString(payload.workspace_id),
|
|
1491
|
+
principal_id: principalId,
|
|
1492
|
+
user: payload.user && typeof payload.user === "object" && !Array.isArray(payload.user) ? payload.user : void 0
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function maybeThrowDeviceError(payload) {
|
|
1496
|
+
const error = readString(payload.error);
|
|
1497
|
+
throw new DeviceAuthorizationError({
|
|
1498
|
+
error: error ?? "invalid_request",
|
|
1499
|
+
description: readString(payload.error_description),
|
|
1500
|
+
interval: typeof payload.interval === "number" ? payload.interval : void 0
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
function createAuthDeviceClient(config = {}) {
|
|
1504
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
1505
|
+
const baseUrl = authBaseUrl(config);
|
|
1506
|
+
async function post(path, body4) {
|
|
1507
|
+
return fetchImpl(`${baseUrl}${path}`, {
|
|
1508
|
+
method: "POST",
|
|
1509
|
+
headers: { "content-type": "application/json" },
|
|
1510
|
+
body: JSON.stringify(body4)
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
return {
|
|
1514
|
+
async createDeviceCode(input = {}) {
|
|
1515
|
+
const response = await post("/api/platform/v1/auth/device/code", {
|
|
1516
|
+
client_id: input.clientId ?? "lucern-cli",
|
|
1517
|
+
scope: input.scope ?? "graph.read graph.write"
|
|
1518
|
+
});
|
|
1519
|
+
const payload = await readJson(response);
|
|
1520
|
+
if (!response.ok) {
|
|
1521
|
+
maybeThrowDeviceError(payload);
|
|
1522
|
+
}
|
|
1523
|
+
return assertDeviceCodeResponse(payload);
|
|
1524
|
+
},
|
|
1525
|
+
async pollDeviceToken(deviceCode) {
|
|
1526
|
+
const response = await post("/api/platform/v1/auth/device/token", {
|
|
1527
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
1528
|
+
device_code: deviceCode
|
|
1529
|
+
});
|
|
1530
|
+
const payload = await readJson(response);
|
|
1531
|
+
if (!response.ok) {
|
|
1532
|
+
maybeThrowDeviceError(payload);
|
|
1533
|
+
}
|
|
1534
|
+
return assertDeviceTokenResponse(payload);
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1197
1539
|
// src/beliefsClient.ts
|
|
1198
1540
|
function asRecord2(value) {
|
|
1199
1541
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1200
1542
|
}
|
|
1201
|
-
function
|
|
1543
|
+
function readString2(value) {
|
|
1202
1544
|
if (typeof value !== "string") {
|
|
1203
1545
|
return void 0;
|
|
1204
1546
|
}
|
|
@@ -1235,15 +1577,15 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1235
1577
|
const record = asRecord2(value);
|
|
1236
1578
|
const tuple = normalizeOpinionTuple(record);
|
|
1237
1579
|
const projected = readNumber(record.confidence) ?? clamp012(tuple.b + tuple.a * tuple.u);
|
|
1238
|
-
const triggeringEvidenceId =
|
|
1239
|
-
const triggeringQuestionId =
|
|
1240
|
-
const triggeringAnswerId =
|
|
1241
|
-
const triggeringContradictionId =
|
|
1580
|
+
const triggeringEvidenceId = readString2(record.triggeringEvidenceId);
|
|
1581
|
+
const triggeringQuestionId = readString2(record.triggeringQuestionId);
|
|
1582
|
+
const triggeringAnswerId = readString2(record.triggeringAnswerId);
|
|
1583
|
+
const triggeringContradictionId = readString2(
|
|
1242
1584
|
record.triggeringContradictionId
|
|
1243
1585
|
);
|
|
1244
|
-
const triggeringWorktreeId =
|
|
1586
|
+
const triggeringWorktreeId = readString2(record.triggeringWorktreeId);
|
|
1245
1587
|
const triggeringRef = triggeringEvidenceId ? { kind: "evidence", id: triggeringEvidenceId } : triggeringQuestionId ? { kind: "question", id: triggeringQuestionId } : triggeringAnswerId ? { kind: "answer", id: triggeringAnswerId } : triggeringContradictionId ? { kind: "contradiction", id: triggeringContradictionId } : triggeringWorktreeId ? { kind: "worktree", id: triggeringWorktreeId } : void 0;
|
|
1246
|
-
const trigger =
|
|
1588
|
+
const trigger = readString2(record.trigger);
|
|
1247
1589
|
if (!trigger) {
|
|
1248
1590
|
throw new Error("Gateway opinion history entries must include trigger.");
|
|
1249
1591
|
}
|
|
@@ -1256,9 +1598,9 @@ function mapOpinionHistoryEntriesFromGatewayData(payload) {
|
|
|
1256
1598
|
P: clamp012(projected),
|
|
1257
1599
|
trigger,
|
|
1258
1600
|
...triggeringRef ? { triggeringRef } : {},
|
|
1259
|
-
...
|
|
1260
|
-
...
|
|
1261
|
-
...
|
|
1601
|
+
...readString2(record.rationale) ? { rationale: readString2(record.rationale) } : {},
|
|
1602
|
+
...readString2(record.userId) ? { userId: readString2(record.userId) } : {},
|
|
1603
|
+
...readString2(record.slOperator) ? { slOperator: readString2(record.slOperator) } : {}
|
|
1262
1604
|
};
|
|
1263
1605
|
}).sort((left, right) => left.t - right.t);
|
|
1264
1606
|
}
|
|
@@ -1493,6 +1835,180 @@ function createEvidenceClient(config = {}) {
|
|
|
1493
1835
|
}
|
|
1494
1836
|
};
|
|
1495
1837
|
}
|
|
1838
|
+
|
|
1839
|
+
// src/boundaryClientSurface.ts
|
|
1840
|
+
function cleanOptionalString(value) {
|
|
1841
|
+
const normalized = value?.trim();
|
|
1842
|
+
return normalized ? normalized : void 0;
|
|
1843
|
+
}
|
|
1844
|
+
function cleanRequiredString(value, label) {
|
|
1845
|
+
const normalized = cleanOptionalString(value);
|
|
1846
|
+
if (!normalized) {
|
|
1847
|
+
throw new Error(`${label} is required`);
|
|
1848
|
+
}
|
|
1849
|
+
return normalized;
|
|
1850
|
+
}
|
|
1851
|
+
function readTopicId(input) {
|
|
1852
|
+
return cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId);
|
|
1853
|
+
}
|
|
1854
|
+
function requireTopicId(input) {
|
|
1855
|
+
const topicId = readTopicId(input);
|
|
1856
|
+
if (!topicId) {
|
|
1857
|
+
throw new Error("topicId is required");
|
|
1858
|
+
}
|
|
1859
|
+
return topicId;
|
|
1860
|
+
}
|
|
1861
|
+
function assertKnownKeys(input, allowed, operation) {
|
|
1862
|
+
const allowedSet = new Set(allowed);
|
|
1863
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
|
|
1864
|
+
if (unknownKeys.length > 0) {
|
|
1865
|
+
throw new Error(
|
|
1866
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
1867
|
+
);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
function knownPayload(input, allowed, operation) {
|
|
1871
|
+
assertKnownKeys(input, allowed, operation);
|
|
1872
|
+
return { ...input };
|
|
1873
|
+
}
|
|
1874
|
+
function topicPayload(input, allowed, operation) {
|
|
1875
|
+
assertKnownKeys(input, allowed, operation);
|
|
1876
|
+
return {
|
|
1877
|
+
...input,
|
|
1878
|
+
topicId: requireTopicId(input),
|
|
1879
|
+
projectId: void 0
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
function listResultFromEnvelope(data, legacyKey) {
|
|
1883
|
+
const record = data && typeof data === "object" ? data : {};
|
|
1884
|
+
return createListResult(
|
|
1885
|
+
Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
|
|
1886
|
+
legacyKey
|
|
1887
|
+
);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
// src/eventingClient.ts
|
|
1891
|
+
var EVENTING_FIELDS = [
|
|
1892
|
+
"tenantId",
|
|
1893
|
+
"workspaceId",
|
|
1894
|
+
"principalId",
|
|
1895
|
+
"topicId",
|
|
1896
|
+
"eventId",
|
|
1897
|
+
"eventType",
|
|
1898
|
+
"eventPayload",
|
|
1899
|
+
"webhookId",
|
|
1900
|
+
"deliveryId",
|
|
1901
|
+
"status",
|
|
1902
|
+
"attempt",
|
|
1903
|
+
"statusCode",
|
|
1904
|
+
"error",
|
|
1905
|
+
"responseBody",
|
|
1906
|
+
"durationMs",
|
|
1907
|
+
"metadata",
|
|
1908
|
+
"limit",
|
|
1909
|
+
"cursor"
|
|
1910
|
+
];
|
|
1911
|
+
function query(input) {
|
|
1912
|
+
return {
|
|
1913
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
1914
|
+
workspaceId: input.workspaceId,
|
|
1915
|
+
principalId: input.principalId,
|
|
1916
|
+
topicId: input.topicId,
|
|
1917
|
+
eventType: input.eventType,
|
|
1918
|
+
webhookId: input.webhookId,
|
|
1919
|
+
status: input.status,
|
|
1920
|
+
limit: input.limit,
|
|
1921
|
+
cursor: input.cursor
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
function body(input, operation) {
|
|
1925
|
+
return knownPayload(input, EVENTING_FIELDS, operation);
|
|
1926
|
+
}
|
|
1927
|
+
function createEventingClient(config = {}) {
|
|
1928
|
+
const gateway = createGatewayRequestClient(config);
|
|
1929
|
+
return {
|
|
1930
|
+
recordEvent(input, idempotencyKey) {
|
|
1931
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1932
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
1933
|
+
return gateway.request({
|
|
1934
|
+
path: "/api/platform/v1/events",
|
|
1935
|
+
method: "POST",
|
|
1936
|
+
body: body(
|
|
1937
|
+
input,
|
|
1938
|
+
"events.recordEvent"
|
|
1939
|
+
),
|
|
1940
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1941
|
+
});
|
|
1942
|
+
},
|
|
1943
|
+
listEvents(input) {
|
|
1944
|
+
return gateway.request({
|
|
1945
|
+
path: `/api/platform/v1/events${toQueryString(query(input))}`
|
|
1946
|
+
}).then(
|
|
1947
|
+
(response) => mapGatewayData(
|
|
1948
|
+
response,
|
|
1949
|
+
(data) => listResultFromEnvelope(data, "events")
|
|
1950
|
+
)
|
|
1951
|
+
);
|
|
1952
|
+
},
|
|
1953
|
+
listWebhooks(input) {
|
|
1954
|
+
return gateway.request({
|
|
1955
|
+
path: `/api/platform/v1/webhooks${toQueryString(query(input))}`
|
|
1956
|
+
}).then(
|
|
1957
|
+
(response) => mapGatewayData(
|
|
1958
|
+
response,
|
|
1959
|
+
(data) => listResultFromEnvelope(
|
|
1960
|
+
data,
|
|
1961
|
+
"webhooks"
|
|
1962
|
+
)
|
|
1963
|
+
)
|
|
1964
|
+
);
|
|
1965
|
+
},
|
|
1966
|
+
enqueueDelivery(input, idempotencyKey) {
|
|
1967
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1968
|
+
cleanRequiredString(input.eventId, "eventId");
|
|
1969
|
+
cleanRequiredString(input.webhookId, "webhookId");
|
|
1970
|
+
return gateway.request({
|
|
1971
|
+
path: "/api/platform/v1/events/deliveries",
|
|
1972
|
+
method: "POST",
|
|
1973
|
+
body: body(
|
|
1974
|
+
input,
|
|
1975
|
+
"events.enqueueDelivery"
|
|
1976
|
+
),
|
|
1977
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1978
|
+
});
|
|
1979
|
+
},
|
|
1980
|
+
recordDeliveryAttempt(input, idempotencyKey) {
|
|
1981
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1982
|
+
cleanRequiredString(input.deliveryId, "deliveryId");
|
|
1983
|
+
return gateway.request({
|
|
1984
|
+
path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
|
|
1985
|
+
input.deliveryId
|
|
1986
|
+
)}/attempts`,
|
|
1987
|
+
method: "POST",
|
|
1988
|
+
body: body(
|
|
1989
|
+
input,
|
|
1990
|
+
"events.recordDeliveryAttempt"
|
|
1991
|
+
),
|
|
1992
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1993
|
+
});
|
|
1994
|
+
},
|
|
1995
|
+
updateDeliveryStatus(input, idempotencyKey) {
|
|
1996
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
1997
|
+
cleanRequiredString(input.deliveryId, "deliveryId");
|
|
1998
|
+
return gateway.request({
|
|
1999
|
+
path: `/api/platform/v1/events/deliveries/${encodeURIComponent(
|
|
2000
|
+
input.deliveryId
|
|
2001
|
+
)}/status`,
|
|
2002
|
+
method: "PATCH",
|
|
2003
|
+
body: body(
|
|
2004
|
+
input,
|
|
2005
|
+
"events.updateDeliveryStatus"
|
|
2006
|
+
),
|
|
2007
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
1496
2012
|
var DEFAULT_CUSTOM_NAMESPACE = "custom";
|
|
1497
2013
|
var RESERVED_NAMESPACES = /* @__PURE__ */ new Set(["lucern"]);
|
|
1498
2014
|
var CustomToolRegistryError = class extends Error {
|
|
@@ -1898,10 +2414,10 @@ function createGraphClient(config = {}) {
|
|
|
1898
2414
|
/**
|
|
1899
2415
|
* List graph nodes matching the provided filters.
|
|
1900
2416
|
*/
|
|
1901
|
-
async listNodes(
|
|
2417
|
+
async listNodes(query5) {
|
|
1902
2418
|
return gateway.request({
|
|
1903
2419
|
path: `/api/platform/v1/graph/nodes${toQueryString(
|
|
1904
|
-
normalizeTopicQuery(
|
|
2420
|
+
normalizeTopicQuery(query5)
|
|
1905
2421
|
)}`
|
|
1906
2422
|
}).then(
|
|
1907
2423
|
(response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
|
|
@@ -1910,15 +2426,15 @@ function createGraphClient(config = {}) {
|
|
|
1910
2426
|
/**
|
|
1911
2427
|
* @deprecated Use listNodes.
|
|
1912
2428
|
*/
|
|
1913
|
-
async queryNodes(
|
|
1914
|
-
return this.listNodes(
|
|
2429
|
+
async queryNodes(query5) {
|
|
2430
|
+
return this.listNodes(query5);
|
|
1915
2431
|
},
|
|
1916
2432
|
/**
|
|
1917
2433
|
* Retrieve a single graph node by nodeId or globalId.
|
|
1918
2434
|
*/
|
|
1919
|
-
async getNode(
|
|
2435
|
+
async getNode(query5) {
|
|
1920
2436
|
return gateway.request({
|
|
1921
|
-
path: `/api/platform/v1/graph/nodes${toQueryString(
|
|
2437
|
+
path: `/api/platform/v1/graph/nodes${toQueryString(query5)}`
|
|
1922
2438
|
}).then(
|
|
1923
2439
|
(response) => mapGatewayData(
|
|
1924
2440
|
response,
|
|
@@ -2011,10 +2527,10 @@ function createGraphClient(config = {}) {
|
|
|
2011
2527
|
/**
|
|
2012
2528
|
* List graph edges matching the provided filters.
|
|
2013
2529
|
*/
|
|
2014
|
-
async listEdges(
|
|
2530
|
+
async listEdges(query5) {
|
|
2015
2531
|
return gateway.request({
|
|
2016
2532
|
path: `/api/platform/v1/graph/edges${toQueryString(
|
|
2017
|
-
normalizeTopicQuery(
|
|
2533
|
+
normalizeTopicQuery(query5)
|
|
2018
2534
|
)}`
|
|
2019
2535
|
}).then(
|
|
2020
2536
|
(response) => mapGatewayData(
|
|
@@ -2026,8 +2542,8 @@ function createGraphClient(config = {}) {
|
|
|
2026
2542
|
/**
|
|
2027
2543
|
* @deprecated Use listEdges.
|
|
2028
2544
|
*/
|
|
2029
|
-
async queryEdges(
|
|
2030
|
-
return this.listEdges(
|
|
2545
|
+
async queryEdges(query5) {
|
|
2546
|
+
return this.listEdges(query5);
|
|
2031
2547
|
},
|
|
2032
2548
|
/**
|
|
2033
2549
|
* Create a graph edge.
|
|
@@ -2043,9 +2559,9 @@ function createGraphClient(config = {}) {
|
|
|
2043
2559
|
/**
|
|
2044
2560
|
* Delete one or more edges matching the provided filter.
|
|
2045
2561
|
*/
|
|
2046
|
-
async deleteEdge(
|
|
2562
|
+
async deleteEdge(query5, idempotencyKey) {
|
|
2047
2563
|
return gateway.request({
|
|
2048
|
-
path: `/api/platform/v1/graph/edges${toQueryString(
|
|
2564
|
+
path: `/api/platform/v1/graph/edges${toQueryString(query5)}`,
|
|
2049
2565
|
method: "DELETE",
|
|
2050
2566
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2051
2567
|
});
|
|
@@ -2053,26 +2569,26 @@ function createGraphClient(config = {}) {
|
|
|
2053
2569
|
/**
|
|
2054
2570
|
* Retrieve a graph neighborhood around a root node.
|
|
2055
2571
|
*/
|
|
2056
|
-
async neighborhood(
|
|
2572
|
+
async neighborhood(query5) {
|
|
2057
2573
|
return gateway.request({
|
|
2058
|
-
path: `/api/platform/v1/graph/neighborhood${toQueryString(
|
|
2574
|
+
path: `/api/platform/v1/graph/neighborhood${toQueryString(query5)}`
|
|
2059
2575
|
});
|
|
2060
2576
|
},
|
|
2061
2577
|
/**
|
|
2062
2578
|
* Traverse the graph from a starting node.
|
|
2063
2579
|
*/
|
|
2064
|
-
async traverse(
|
|
2580
|
+
async traverse(query5) {
|
|
2065
2581
|
return gateway.request({
|
|
2066
2582
|
path: "/api/platform/v1/graph/traverse",
|
|
2067
2583
|
method: "POST",
|
|
2068
|
-
body: normalizeTopicQuery(
|
|
2584
|
+
body: normalizeTopicQuery(query5)
|
|
2069
2585
|
});
|
|
2070
2586
|
},
|
|
2071
2587
|
/**
|
|
2072
2588
|
* Analyze graph structure for a topic.
|
|
2073
2589
|
*/
|
|
2074
|
-
async analyze(
|
|
2075
|
-
const normalized = normalizeTopicQuery(
|
|
2590
|
+
async analyze(query5 = {}) {
|
|
2591
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2076
2592
|
return gateway.request({
|
|
2077
2593
|
path: `/api/platform/v1/graph/analyze${toQueryString({
|
|
2078
2594
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2084,8 +2600,8 @@ function createGraphClient(config = {}) {
|
|
|
2084
2600
|
/**
|
|
2085
2601
|
* Detect confirmation-bias patterns for a topic graph.
|
|
2086
2602
|
*/
|
|
2087
|
-
async bias(
|
|
2088
|
-
const normalized = normalizeTopicQuery(
|
|
2603
|
+
async bias(query5 = {}) {
|
|
2604
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2089
2605
|
return gateway.request({
|
|
2090
2606
|
path: `/api/platform/v1/graph/bias${toQueryString({
|
|
2091
2607
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2097,8 +2613,8 @@ function createGraphClient(config = {}) {
|
|
|
2097
2613
|
/**
|
|
2098
2614
|
* Find graph gaps for beliefs that still need testing.
|
|
2099
2615
|
*/
|
|
2100
|
-
async gaps(
|
|
2101
|
-
const normalized = normalizeTopicQuery(
|
|
2616
|
+
async gaps(query5) {
|
|
2617
|
+
const normalized = normalizeTopicQuery(query5);
|
|
2102
2618
|
return gateway.request({
|
|
2103
2619
|
path: `/api/platform/v1/graph/gaps${toQueryString({
|
|
2104
2620
|
topicId: typeof normalized.topicId === "string" ? normalized.topicId : void 0,
|
|
@@ -2109,33 +2625,33 @@ function createGraphClient(config = {}) {
|
|
|
2109
2625
|
/**
|
|
2110
2626
|
* Search across graph resources within a topic.
|
|
2111
2627
|
*/
|
|
2112
|
-
async search(
|
|
2628
|
+
async search(query5) {
|
|
2113
2629
|
return gateway.request({
|
|
2114
2630
|
path: "/api/platform/v1/search",
|
|
2115
2631
|
method: "POST",
|
|
2116
|
-
body: normalizeTopicQuery(
|
|
2632
|
+
body: normalizeTopicQuery(query5)
|
|
2117
2633
|
});
|
|
2118
2634
|
},
|
|
2119
2635
|
/**
|
|
2120
2636
|
* Retrieve a graph neighborhood around a root node.
|
|
2121
2637
|
*/
|
|
2122
|
-
async getNeighborhood(
|
|
2123
|
-
return this.neighborhood(
|
|
2638
|
+
async getNeighborhood(query5) {
|
|
2639
|
+
return this.neighborhood(query5);
|
|
2124
2640
|
},
|
|
2125
2641
|
/**
|
|
2126
2642
|
* Retrieve the shortest known path between two graph nodes.
|
|
2127
2643
|
*/
|
|
2128
|
-
async getPath(
|
|
2644
|
+
async getPath(query5) {
|
|
2129
2645
|
return gateway.request({
|
|
2130
|
-
path: `/api/platform/v1/graph/path${toQueryString(
|
|
2646
|
+
path: `/api/platform/v1/graph/path${toQueryString(query5)}`
|
|
2131
2647
|
});
|
|
2132
2648
|
},
|
|
2133
2649
|
/**
|
|
2134
2650
|
* Retrieve graph analytics for the requested metric.
|
|
2135
2651
|
*/
|
|
2136
|
-
async getAnalytics(
|
|
2652
|
+
async getAnalytics(query5 = {}) {
|
|
2137
2653
|
return gateway.request({
|
|
2138
|
-
path: `/api/platform/v1/graph/analytics${toQueryString(
|
|
2654
|
+
path: `/api/platform/v1/graph/analytics${toQueryString(query5)}`
|
|
2139
2655
|
});
|
|
2140
2656
|
}
|
|
2141
2657
|
};
|
|
@@ -2152,6 +2668,37 @@ function createIdentityWhoamiClient(config = {}) {
|
|
|
2152
2668
|
}
|
|
2153
2669
|
};
|
|
2154
2670
|
}
|
|
2671
|
+
var TENANT_IDENTITY_FIELDS = [
|
|
2672
|
+
"tenantId",
|
|
2673
|
+
"workspaceId",
|
|
2674
|
+
"principalId",
|
|
2675
|
+
"integrationKey",
|
|
2676
|
+
"secretRef",
|
|
2677
|
+
"policySubject",
|
|
2678
|
+
"policyAction",
|
|
2679
|
+
"policyResource",
|
|
2680
|
+
"decision",
|
|
2681
|
+
"config",
|
|
2682
|
+
"configKey",
|
|
2683
|
+
"configValue",
|
|
2684
|
+
"provider",
|
|
2685
|
+
"status",
|
|
2686
|
+
"metadata",
|
|
2687
|
+
"limit",
|
|
2688
|
+
"cursor"
|
|
2689
|
+
];
|
|
2690
|
+
function tenantIdentityQuery(input) {
|
|
2691
|
+
return {
|
|
2692
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
2693
|
+
workspaceId: input.workspaceId,
|
|
2694
|
+
principalId: input.principalId,
|
|
2695
|
+
limit: input.limit,
|
|
2696
|
+
cursor: input.cursor
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
function tenantIdentityBody(input, operation) {
|
|
2700
|
+
return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
|
|
2701
|
+
}
|
|
2155
2702
|
function createIdentityClient(config = {}) {
|
|
2156
2703
|
const gateway = createGatewayRequestClient(config);
|
|
2157
2704
|
const whoamiClient = createIdentityWhoamiClient(config);
|
|
@@ -2187,9 +2734,9 @@ function createIdentityClient(config = {}) {
|
|
|
2187
2734
|
/**
|
|
2188
2735
|
* List principals in the current identity scope.
|
|
2189
2736
|
*/
|
|
2190
|
-
async listPrincipals(
|
|
2737
|
+
async listPrincipals(query5 = {}) {
|
|
2191
2738
|
return gateway.request({
|
|
2192
|
-
path: `/api/platform/v1/identity/principals${toQueryString(
|
|
2739
|
+
path: `/api/platform/v1/identity/principals${toQueryString(query5)}`
|
|
2193
2740
|
}).then(
|
|
2194
2741
|
(response) => mapGatewayData(
|
|
2195
2742
|
response,
|
|
@@ -2221,9 +2768,9 @@ function createIdentityClient(config = {}) {
|
|
|
2221
2768
|
/**
|
|
2222
2769
|
* List keys in the current identity scope.
|
|
2223
2770
|
*/
|
|
2224
|
-
async listKeys(
|
|
2771
|
+
async listKeys(query5 = {}) {
|
|
2225
2772
|
return gateway.request({
|
|
2226
|
-
path: `/api/platform/v1/identity/keys${toQueryString(
|
|
2773
|
+
path: `/api/platform/v1/identity/keys${toQueryString(query5)}`
|
|
2227
2774
|
}).then(
|
|
2228
2775
|
(response) => mapGatewayData(
|
|
2229
2776
|
response,
|
|
@@ -2277,6 +2824,109 @@ function createIdentityClient(config = {}) {
|
|
|
2277
2824
|
return gateway.request({
|
|
2278
2825
|
path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
|
|
2279
2826
|
});
|
|
2827
|
+
},
|
|
2828
|
+
async getTenantConfig(input) {
|
|
2829
|
+
return gateway.request({
|
|
2830
|
+
path: `/api/platform/v1/identity/tenant-config${toQueryString(
|
|
2831
|
+
tenantIdentityQuery(input)
|
|
2832
|
+
)}`
|
|
2833
|
+
});
|
|
2834
|
+
},
|
|
2835
|
+
async updateTenantConfig(input, idempotencyKey) {
|
|
2836
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2837
|
+
return gateway.request({
|
|
2838
|
+
path: "/api/platform/v1/identity/tenant-config",
|
|
2839
|
+
method: "PATCH",
|
|
2840
|
+
body: tenantIdentityBody(
|
|
2841
|
+
input,
|
|
2842
|
+
"identity.updateTenantConfig"
|
|
2843
|
+
),
|
|
2844
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2845
|
+
});
|
|
2846
|
+
},
|
|
2847
|
+
async listIntegrations(input) {
|
|
2848
|
+
return gateway.request({
|
|
2849
|
+
path: `/api/platform/v1/identity/integrations${toQueryString(
|
|
2850
|
+
tenantIdentityQuery(input)
|
|
2851
|
+
)}`
|
|
2852
|
+
}).then(
|
|
2853
|
+
(response) => mapGatewayData(
|
|
2854
|
+
response,
|
|
2855
|
+
(data) => listResultFromEnvelope(
|
|
2856
|
+
data,
|
|
2857
|
+
"integrations"
|
|
2858
|
+
)
|
|
2859
|
+
)
|
|
2860
|
+
);
|
|
2861
|
+
},
|
|
2862
|
+
async upsertIntegration(input, idempotencyKey) {
|
|
2863
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2864
|
+
cleanRequiredString(input.integrationKey, "integrationKey");
|
|
2865
|
+
return gateway.request({
|
|
2866
|
+
path: "/api/platform/v1/identity/integrations",
|
|
2867
|
+
method: "PUT",
|
|
2868
|
+
body: tenantIdentityBody(
|
|
2869
|
+
input,
|
|
2870
|
+
"identity.upsertIntegration"
|
|
2871
|
+
),
|
|
2872
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2873
|
+
});
|
|
2874
|
+
},
|
|
2875
|
+
async listSecrets(input) {
|
|
2876
|
+
return gateway.request({
|
|
2877
|
+
path: `/api/platform/v1/identity/secrets${toQueryString(
|
|
2878
|
+
tenantIdentityQuery(input)
|
|
2879
|
+
)}`
|
|
2880
|
+
}).then(
|
|
2881
|
+
(response) => mapGatewayData(
|
|
2882
|
+
response,
|
|
2883
|
+
(data) => listResultFromEnvelope(
|
|
2884
|
+
data,
|
|
2885
|
+
"secrets"
|
|
2886
|
+
)
|
|
2887
|
+
)
|
|
2888
|
+
);
|
|
2889
|
+
},
|
|
2890
|
+
async putSecretReference(input, idempotencyKey) {
|
|
2891
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2892
|
+
cleanRequiredString(input.secretRef, "secretRef");
|
|
2893
|
+
return gateway.request({
|
|
2894
|
+
path: "/api/platform/v1/identity/secrets",
|
|
2895
|
+
method: "PUT",
|
|
2896
|
+
body: tenantIdentityBody(
|
|
2897
|
+
input,
|
|
2898
|
+
"identity.putSecretReference"
|
|
2899
|
+
),
|
|
2900
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2901
|
+
});
|
|
2902
|
+
},
|
|
2903
|
+
async evaluatePolicy(input, idempotencyKey) {
|
|
2904
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2905
|
+
cleanRequiredString(input.policySubject, "policySubject");
|
|
2906
|
+
cleanRequiredString(input.policyAction, "policyAction");
|
|
2907
|
+
cleanRequiredString(input.policyResource, "policyResource");
|
|
2908
|
+
return gateway.request({
|
|
2909
|
+
path: "/api/platform/v1/identity/policy/evaluate",
|
|
2910
|
+
method: "POST",
|
|
2911
|
+
body: tenantIdentityBody(
|
|
2912
|
+
input,
|
|
2913
|
+
"identity.evaluatePolicy"
|
|
2914
|
+
),
|
|
2915
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2916
|
+
});
|
|
2917
|
+
},
|
|
2918
|
+
async recordPolicyDecision(input, idempotencyKey) {
|
|
2919
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
2920
|
+
cleanRequiredString(input.decision, "decision");
|
|
2921
|
+
return gateway.request({
|
|
2922
|
+
path: "/api/platform/v1/identity/policy/decisions",
|
|
2923
|
+
method: "POST",
|
|
2924
|
+
body: tenantIdentityBody(
|
|
2925
|
+
input,
|
|
2926
|
+
"identity.recordPolicyDecision"
|
|
2927
|
+
),
|
|
2928
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
2929
|
+
});
|
|
2280
2930
|
}
|
|
2281
2931
|
};
|
|
2282
2932
|
}
|
|
@@ -2285,12 +2935,12 @@ function createIdentityClient(config = {}) {
|
|
|
2285
2935
|
function asRecord3(value) {
|
|
2286
2936
|
return value && typeof value === "object" ? value : {};
|
|
2287
2937
|
}
|
|
2288
|
-
function
|
|
2938
|
+
function cleanString3(value) {
|
|
2289
2939
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
2290
2940
|
}
|
|
2291
2941
|
function normalizeTopicRecord(value) {
|
|
2292
2942
|
const record = asRecord3(value);
|
|
2293
|
-
const topicId =
|
|
2943
|
+
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
2294
2944
|
return withTopicAlias({
|
|
2295
2945
|
...record,
|
|
2296
2946
|
...topicId ? { topicId } : {}
|
|
@@ -2302,15 +2952,15 @@ function normalizeTopicTreeNode(value) {
|
|
|
2302
2952
|
function createTopicsClient(config = {}) {
|
|
2303
2953
|
const gateway = createGatewayRequestClient(config);
|
|
2304
2954
|
return {
|
|
2305
|
-
async list(
|
|
2306
|
-
const topicId = resolveTopicId(
|
|
2955
|
+
async list(query5 = {}) {
|
|
2956
|
+
const topicId = resolveTopicId(query5);
|
|
2307
2957
|
return gateway.request({
|
|
2308
2958
|
path: `/api/platform/v1/topics${toQueryString({
|
|
2309
2959
|
...topicId ? { topicId } : {},
|
|
2310
|
-
ontologyId:
|
|
2311
|
-
parentTopicId:
|
|
2312
|
-
status:
|
|
2313
|
-
type:
|
|
2960
|
+
ontologyId: query5.ontologyId,
|
|
2961
|
+
parentTopicId: query5.parentTopicId,
|
|
2962
|
+
status: query5.status,
|
|
2963
|
+
type: query5.type
|
|
2314
2964
|
})}`
|
|
2315
2965
|
}).then(
|
|
2316
2966
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -2360,10 +3010,10 @@ function createTopicsClient(config = {}) {
|
|
|
2360
3010
|
(response) => mapGatewayData(response, (data) => normalizeTopicRecord(data))
|
|
2361
3011
|
);
|
|
2362
3012
|
},
|
|
2363
|
-
async getTree(topicId,
|
|
3013
|
+
async getTree(topicId, query5 = {}) {
|
|
2364
3014
|
return gateway.request({
|
|
2365
3015
|
path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/tree${toQueryString(
|
|
2366
|
-
|
|
3016
|
+
query5
|
|
2367
3017
|
)}`
|
|
2368
3018
|
}).then(
|
|
2369
3019
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -2374,10 +3024,10 @@ function createTopicsClient(config = {}) {
|
|
|
2374
3024
|
})
|
|
2375
3025
|
);
|
|
2376
3026
|
},
|
|
2377
|
-
async getCoverage(topicId,
|
|
3027
|
+
async getCoverage(topicId, query5 = {}) {
|
|
2378
3028
|
return gateway.request({
|
|
2379
3029
|
path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/coverage${toQueryString(
|
|
2380
|
-
|
|
3030
|
+
query5
|
|
2381
3031
|
)}`
|
|
2382
3032
|
});
|
|
2383
3033
|
},
|
|
@@ -2437,15 +3087,15 @@ function createBeliefsFacade(config = {}) {
|
|
|
2437
3087
|
path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`
|
|
2438
3088
|
});
|
|
2439
3089
|
},
|
|
2440
|
-
async list(
|
|
3090
|
+
async list(query5) {
|
|
2441
3091
|
return gateway.request({
|
|
2442
3092
|
path: `/api/platform/v1/beliefs${toQueryString({
|
|
2443
|
-
topicId:
|
|
2444
|
-
status:
|
|
2445
|
-
worktreeId:
|
|
2446
|
-
minConfidence:
|
|
2447
|
-
limit:
|
|
2448
|
-
cursor:
|
|
3093
|
+
topicId: query5.topicId,
|
|
3094
|
+
status: query5.status,
|
|
3095
|
+
worktreeId: query5.worktreeId,
|
|
3096
|
+
minConfidence: query5.minConfidence,
|
|
3097
|
+
limit: query5.limit,
|
|
3098
|
+
cursor: query5.cursor
|
|
2449
3099
|
})}`
|
|
2450
3100
|
});
|
|
2451
3101
|
},
|
|
@@ -2581,13 +3231,13 @@ function createContradictionsFacade(config = {}) {
|
|
|
2581
3231
|
idempotencyKey
|
|
2582
3232
|
});
|
|
2583
3233
|
},
|
|
2584
|
-
async list(
|
|
3234
|
+
async list(query5) {
|
|
2585
3235
|
return gateway.request({
|
|
2586
3236
|
path: `/api/platform/v1/contradictions${toQueryString({
|
|
2587
|
-
topicId:
|
|
2588
|
-
status:
|
|
2589
|
-
limit:
|
|
2590
|
-
cursor:
|
|
3237
|
+
topicId: query5.topicId,
|
|
3238
|
+
status: query5.status,
|
|
3239
|
+
limit: query5.limit,
|
|
3240
|
+
cursor: query5.cursor
|
|
2591
3241
|
})}`
|
|
2592
3242
|
});
|
|
2593
3243
|
},
|
|
@@ -2609,13 +3259,13 @@ function createEdgesFacade(config = {}) {
|
|
|
2609
3259
|
idempotencyKey
|
|
2610
3260
|
});
|
|
2611
3261
|
},
|
|
2612
|
-
async list(
|
|
3262
|
+
async list(query5) {
|
|
2613
3263
|
return gateway.request({
|
|
2614
3264
|
path: `/api/platform/v1/edges${toQueryString({
|
|
2615
|
-
sourceId:
|
|
2616
|
-
edgeType:
|
|
2617
|
-
limit:
|
|
2618
|
-
cursor:
|
|
3265
|
+
sourceId: query5.sourceId,
|
|
3266
|
+
edgeType: query5.edgeType,
|
|
3267
|
+
limit: query5.limit,
|
|
3268
|
+
cursor: query5.cursor
|
|
2619
3269
|
})}`
|
|
2620
3270
|
});
|
|
2621
3271
|
},
|
|
@@ -2685,13 +3335,13 @@ function createEvidenceFacade(config = {}) {
|
|
|
2685
3335
|
path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`
|
|
2686
3336
|
});
|
|
2687
3337
|
},
|
|
2688
|
-
async list(
|
|
3338
|
+
async list(query5) {
|
|
2689
3339
|
return gateway.request({
|
|
2690
3340
|
path: `/api/platform/v1/evidence${toQueryString({
|
|
2691
|
-
topicId:
|
|
2692
|
-
targetId:
|
|
2693
|
-
limit:
|
|
2694
|
-
cursor:
|
|
3341
|
+
topicId: query5.topicId,
|
|
3342
|
+
targetId: query5.targetId,
|
|
3343
|
+
limit: query5.limit,
|
|
3344
|
+
cursor: query5.cursor
|
|
2695
3345
|
})}`
|
|
2696
3346
|
});
|
|
2697
3347
|
},
|
|
@@ -2708,11 +3358,11 @@ function createEvidenceFacade(config = {}) {
|
|
|
2708
3358
|
idempotencyKey
|
|
2709
3359
|
});
|
|
2710
3360
|
},
|
|
2711
|
-
async search(
|
|
3361
|
+
async search(query5, idempotencyKey = randomIdempotencyKey()) {
|
|
2712
3362
|
return gateway.request({
|
|
2713
3363
|
path: "/api/platform/v1/evidence/search",
|
|
2714
3364
|
method: "POST",
|
|
2715
|
-
body:
|
|
3365
|
+
body: query5,
|
|
2716
3366
|
idempotencyKey
|
|
2717
3367
|
});
|
|
2718
3368
|
},
|
|
@@ -2761,15 +3411,15 @@ function createEvidenceFacade(config = {}) {
|
|
|
2761
3411
|
function createEventsFacade(config = {}) {
|
|
2762
3412
|
const gateway = createGatewayRequestClient(config);
|
|
2763
3413
|
return {
|
|
2764
|
-
async list(
|
|
3414
|
+
async list(query5 = {}) {
|
|
2765
3415
|
return gateway.request({
|
|
2766
3416
|
path: `/api/platform/v1/events${toQueryString({
|
|
2767
|
-
topicId:
|
|
2768
|
-
after:
|
|
2769
|
-
types: serializeTypes(
|
|
2770
|
-
startTime:
|
|
2771
|
-
endTime:
|
|
2772
|
-
limit:
|
|
3417
|
+
topicId: query5.topicId,
|
|
3418
|
+
after: query5.after,
|
|
3419
|
+
types: serializeTypes(query5.types),
|
|
3420
|
+
startTime: query5.startTime,
|
|
3421
|
+
endTime: query5.endTime,
|
|
3422
|
+
limit: query5.limit
|
|
2773
3423
|
})}`
|
|
2774
3424
|
});
|
|
2775
3425
|
},
|
|
@@ -2834,8 +3484,8 @@ function createOntologiesFacade(config = {}) {
|
|
|
2834
3484
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
2835
3485
|
});
|
|
2836
3486
|
},
|
|
2837
|
-
async list(
|
|
2838
|
-
return ontologyClient.list(
|
|
3487
|
+
async list(query5 = {}) {
|
|
3488
|
+
return ontologyClient.list(query5);
|
|
2839
3489
|
},
|
|
2840
3490
|
async bind(input, idempotencyKey) {
|
|
2841
3491
|
return gateway.request({
|
|
@@ -2873,15 +3523,15 @@ function createQuestionsFacade(config = {}) {
|
|
|
2873
3523
|
path: `/api/platform/v1/questions/${encodeURIComponent(id)}`
|
|
2874
3524
|
});
|
|
2875
3525
|
},
|
|
2876
|
-
async list(
|
|
3526
|
+
async list(query5) {
|
|
2877
3527
|
return gateway.request({
|
|
2878
3528
|
path: `/api/platform/v1/questions${toQueryString({
|
|
2879
|
-
topicId:
|
|
2880
|
-
status:
|
|
2881
|
-
priority:
|
|
2882
|
-
worktreeId:
|
|
2883
|
-
limit:
|
|
2884
|
-
cursor:
|
|
3529
|
+
topicId: query5.topicId,
|
|
3530
|
+
status: query5.status,
|
|
3531
|
+
priority: query5.priority,
|
|
3532
|
+
worktreeId: query5.worktreeId,
|
|
3533
|
+
limit: query5.limit,
|
|
3534
|
+
cursor: query5.cursor
|
|
2885
3535
|
})}`
|
|
2886
3536
|
});
|
|
2887
3537
|
},
|
|
@@ -3033,13 +3683,13 @@ function createTasksFacade(config = {}) {
|
|
|
3033
3683
|
idempotencyKey
|
|
3034
3684
|
});
|
|
3035
3685
|
},
|
|
3036
|
-
async list(
|
|
3686
|
+
async list(query5) {
|
|
3037
3687
|
return gateway.request({
|
|
3038
3688
|
path: `/api/platform/v1/tasks${toQueryString({
|
|
3039
|
-
topicId:
|
|
3040
|
-
worktreeId:
|
|
3041
|
-
status:
|
|
3042
|
-
limit:
|
|
3689
|
+
topicId: query5.topicId,
|
|
3690
|
+
worktreeId: query5.worktreeId,
|
|
3691
|
+
status: query5.status,
|
|
3692
|
+
limit: query5.limit
|
|
3043
3693
|
})}`
|
|
3044
3694
|
});
|
|
3045
3695
|
}
|
|
@@ -3054,8 +3704,8 @@ function createTopicsFacade(config = {}) {
|
|
|
3054
3704
|
async get(id) {
|
|
3055
3705
|
return topicsClient.get(id);
|
|
3056
3706
|
},
|
|
3057
|
-
async list(
|
|
3058
|
-
return topicsClient.list(
|
|
3707
|
+
async list(query5 = {}) {
|
|
3708
|
+
return topicsClient.list(query5);
|
|
3059
3709
|
},
|
|
3060
3710
|
async update(input, idempotencyKey) {
|
|
3061
3711
|
const { id, ...rest } = input;
|
|
@@ -3091,10 +3741,10 @@ function createWebhooksFacade(config = {}) {
|
|
|
3091
3741
|
idempotencyKey
|
|
3092
3742
|
});
|
|
3093
3743
|
},
|
|
3094
|
-
async list(
|
|
3744
|
+
async list(query5 = {}) {
|
|
3095
3745
|
return gateway.request({
|
|
3096
3746
|
path: `/api/platform/v1/webhooks${toQueryString({
|
|
3097
|
-
topicId:
|
|
3747
|
+
topicId: query5.topicId
|
|
3098
3748
|
})}`
|
|
3099
3749
|
});
|
|
3100
3750
|
},
|
|
@@ -3126,10 +3776,10 @@ function createWebhooksFacade(config = {}) {
|
|
|
3126
3776
|
idempotencyKey
|
|
3127
3777
|
});
|
|
3128
3778
|
},
|
|
3129
|
-
async deliveries(id,
|
|
3779
|
+
async deliveries(id, query5 = {}) {
|
|
3130
3780
|
return gateway.request({
|
|
3131
3781
|
path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
|
|
3132
|
-
limit:
|
|
3782
|
+
limit: query5.limit
|
|
3133
3783
|
})}`
|
|
3134
3784
|
});
|
|
3135
3785
|
},
|
|
@@ -3151,24 +3801,24 @@ function createWorktreesFacade(config = {}) {
|
|
|
3151
3801
|
idempotencyKey
|
|
3152
3802
|
});
|
|
3153
3803
|
},
|
|
3154
|
-
async list(
|
|
3804
|
+
async list(query5) {
|
|
3155
3805
|
return gateway.request({
|
|
3156
3806
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
3157
|
-
topicId:
|
|
3158
|
-
status:
|
|
3159
|
-
groupBy:
|
|
3160
|
-
lane:
|
|
3161
|
-
campaign:
|
|
3162
|
-
limit:
|
|
3807
|
+
topicId: query5.topicId,
|
|
3808
|
+
status: query5.status,
|
|
3809
|
+
groupBy: query5.groupBy,
|
|
3810
|
+
lane: query5.lane,
|
|
3811
|
+
campaign: query5.campaign,
|
|
3812
|
+
limit: query5.limit
|
|
3163
3813
|
})}`
|
|
3164
3814
|
});
|
|
3165
3815
|
},
|
|
3166
|
-
async listCampaigns(
|
|
3816
|
+
async listCampaigns(query5 = {}) {
|
|
3167
3817
|
return gateway.request({
|
|
3168
3818
|
path: `/api/platform/v1/worktrees/campaigns${toQueryString({
|
|
3169
|
-
topicId:
|
|
3170
|
-
status:
|
|
3171
|
-
limit:
|
|
3819
|
+
topicId: query5.topicId,
|
|
3820
|
+
status: query5.status,
|
|
3821
|
+
limit: query5.limit
|
|
3172
3822
|
})}`
|
|
3173
3823
|
});
|
|
3174
3824
|
},
|
|
@@ -3281,12 +3931,12 @@ function createDecisionsClient(config = {}) {
|
|
|
3281
3931
|
/**
|
|
3282
3932
|
* List judgments for a topic scope.
|
|
3283
3933
|
*/
|
|
3284
|
-
async listJudgments(
|
|
3934
|
+
async listJudgments(query5) {
|
|
3285
3935
|
return gateway.request({
|
|
3286
3936
|
path: `/api/platform/v1/graph/judgments${toQueryString({
|
|
3287
|
-
...normalizeTopicQuery(
|
|
3288
|
-
includeArchived: typeof
|
|
3289
|
-
limit:
|
|
3937
|
+
...normalizeTopicQuery(query5),
|
|
3938
|
+
includeArchived: typeof query5.includeArchived === "boolean" ? query5.includeArchived ? "true" : "false" : void 0,
|
|
3939
|
+
limit: query5.limit
|
|
3290
3940
|
})}`
|
|
3291
3941
|
}).then(
|
|
3292
3942
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -3318,30 +3968,30 @@ function createDecisionsClient(config = {}) {
|
|
|
3318
3968
|
/**
|
|
3319
3969
|
* Get readiness signals for creating a judgment.
|
|
3320
3970
|
*/
|
|
3321
|
-
async getJudgmentReadiness(
|
|
3971
|
+
async getJudgmentReadiness(query5) {
|
|
3322
3972
|
return gateway.request({
|
|
3323
3973
|
path: `/api/platform/v1/graph/judgments/readiness${toQueryString(
|
|
3324
|
-
normalizeTopicQuery(
|
|
3974
|
+
normalizeTopicQuery(query5)
|
|
3325
3975
|
)}`
|
|
3326
3976
|
});
|
|
3327
3977
|
},
|
|
3328
3978
|
/**
|
|
3329
3979
|
* Get calibration analytics for judgment outcomes.
|
|
3330
3980
|
*/
|
|
3331
|
-
async getJudgmentCalibration(
|
|
3981
|
+
async getJudgmentCalibration(query5) {
|
|
3332
3982
|
return gateway.request({
|
|
3333
3983
|
path: `/api/platform/v1/graph/judgments/calibration${toQueryString(
|
|
3334
|
-
normalizeTopicQuery(
|
|
3984
|
+
normalizeTopicQuery(query5)
|
|
3335
3985
|
)}`
|
|
3336
3986
|
});
|
|
3337
3987
|
},
|
|
3338
3988
|
/**
|
|
3339
3989
|
* List judgments still awaiting outcome review.
|
|
3340
3990
|
*/
|
|
3341
|
-
async listPendingOutcomeReviews(
|
|
3991
|
+
async listPendingOutcomeReviews(query5) {
|
|
3342
3992
|
return gateway.request({
|
|
3343
3993
|
path: `/api/platform/v1/graph/judgments/pending-outcome-review${toQueryString(
|
|
3344
|
-
normalizeTopicQuery(
|
|
3994
|
+
normalizeTopicQuery(query5)
|
|
3345
3995
|
)}`
|
|
3346
3996
|
}).then(
|
|
3347
3997
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -3358,19 +4008,19 @@ function createDecisionsClient(config = {}) {
|
|
|
3358
4008
|
/**
|
|
3359
4009
|
* @deprecated Use listPendingOutcomeReviews.
|
|
3360
4010
|
*/
|
|
3361
|
-
async listPendingJudgmentOutcomeReview(
|
|
3362
|
-
return this.listPendingOutcomeReviews(
|
|
4011
|
+
async listPendingJudgmentOutcomeReview(query5) {
|
|
4012
|
+
return this.listPendingOutcomeReviews(query5);
|
|
3363
4013
|
},
|
|
3364
4014
|
/**
|
|
3365
4015
|
* Get audit integrity checks for judgment transitions.
|
|
3366
4016
|
*/
|
|
3367
|
-
async getJudgmentTransitionAuditIntegrity(
|
|
4017
|
+
async getJudgmentTransitionAuditIntegrity(query5) {
|
|
3368
4018
|
return gateway.request({
|
|
3369
4019
|
path: `/api/platform/v1/graph/judgments/transition-audit-integrity${toQueryString(
|
|
3370
4020
|
{
|
|
3371
|
-
...normalizeTopicQuery(
|
|
3372
|
-
judgmentId:
|
|
3373
|
-
includePassing: typeof
|
|
4021
|
+
...normalizeTopicQuery(query5),
|
|
4022
|
+
judgmentId: query5.judgmentId,
|
|
4023
|
+
includePassing: typeof query5.includePassing === "boolean" ? query5.includePassing ? "true" : "false" : void 0
|
|
3374
4024
|
}
|
|
3375
4025
|
)}`
|
|
3376
4026
|
});
|
|
@@ -3419,56 +4069,168 @@ function createDecisionsClient(config = {}) {
|
|
|
3419
4069
|
};
|
|
3420
4070
|
}
|
|
3421
4071
|
|
|
3422
|
-
// src/
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
4072
|
+
// src/embeddingsClient.ts
|
|
4073
|
+
var EMBEDDINGS_FIELDS = [
|
|
4074
|
+
"topicId",
|
|
4075
|
+
"projectId",
|
|
4076
|
+
"workspaceId",
|
|
4077
|
+
"nodeIds",
|
|
4078
|
+
"nodeType",
|
|
4079
|
+
"embeddingModel",
|
|
4080
|
+
"queryText",
|
|
4081
|
+
"queryVector",
|
|
4082
|
+
"minScore",
|
|
4083
|
+
"limit",
|
|
4084
|
+
"cursor",
|
|
4085
|
+
"metadata"
|
|
4086
|
+
];
|
|
4087
|
+
function assertNodeIds(nodeIds) {
|
|
4088
|
+
if (!Array.isArray(nodeIds) || nodeIds.length === 0) {
|
|
4089
|
+
throw new Error("nodeIds is required");
|
|
4090
|
+
}
|
|
3428
4091
|
}
|
|
3429
|
-
function
|
|
3430
|
-
return
|
|
4092
|
+
function missingQuery(input) {
|
|
4093
|
+
return {
|
|
4094
|
+
topicId: requireTopicId(input),
|
|
4095
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId"),
|
|
4096
|
+
nodeType: input.nodeType,
|
|
4097
|
+
embeddingModel: input.embeddingModel,
|
|
4098
|
+
limit: input.limit,
|
|
4099
|
+
cursor: input.cursor
|
|
4100
|
+
};
|
|
3431
4101
|
}
|
|
3432
|
-
function
|
|
3433
|
-
const
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
4102
|
+
function createEmbeddingsClient(config = {}) {
|
|
4103
|
+
const gateway = createGatewayRequestClient(config);
|
|
4104
|
+
return {
|
|
4105
|
+
getByNodeIds(input) {
|
|
4106
|
+
assertNodeIds(input.nodeIds);
|
|
4107
|
+
return gateway.request({
|
|
4108
|
+
path: "/api/platform/v1/embeddings/by-node-ids",
|
|
4109
|
+
method: "POST",
|
|
4110
|
+
body: topicPayload(
|
|
4111
|
+
{
|
|
4112
|
+
...input,
|
|
4113
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4114
|
+
},
|
|
4115
|
+
EMBEDDINGS_FIELDS,
|
|
4116
|
+
"embeddings.getByNodeIds"
|
|
4117
|
+
)
|
|
4118
|
+
}).then(
|
|
4119
|
+
(response) => mapGatewayData(
|
|
4120
|
+
response,
|
|
4121
|
+
(data) => listResultFromEnvelope(
|
|
4122
|
+
data,
|
|
4123
|
+
"embeddings"
|
|
4124
|
+
)
|
|
4125
|
+
)
|
|
4126
|
+
);
|
|
4127
|
+
},
|
|
4128
|
+
listMissingForTopic(input) {
|
|
4129
|
+
return gateway.request({
|
|
4130
|
+
path: `/api/platform/v1/embeddings/missing${toQueryString(
|
|
4131
|
+
missingQuery(input)
|
|
4132
|
+
)}`
|
|
4133
|
+
}).then(
|
|
4134
|
+
(response) => mapGatewayData(
|
|
4135
|
+
response,
|
|
4136
|
+
(data) => listResultFromEnvelope(
|
|
4137
|
+
data,
|
|
4138
|
+
"nodes"
|
|
4139
|
+
)
|
|
4140
|
+
)
|
|
4141
|
+
);
|
|
4142
|
+
},
|
|
4143
|
+
vectorSearchByTopic(input) {
|
|
4144
|
+
if (!input.queryText && !input.queryVector) {
|
|
4145
|
+
throw new Error("queryText or queryVector is required");
|
|
4146
|
+
}
|
|
4147
|
+
return gateway.request({
|
|
4148
|
+
path: "/api/platform/v1/embeddings/vector-search",
|
|
4149
|
+
method: "POST",
|
|
4150
|
+
body: topicPayload(
|
|
4151
|
+
{
|
|
4152
|
+
...input,
|
|
4153
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4154
|
+
},
|
|
4155
|
+
EMBEDDINGS_FIELDS,
|
|
4156
|
+
"embeddings.vectorSearchByTopic"
|
|
4157
|
+
)
|
|
4158
|
+
}).then(
|
|
4159
|
+
(response) => mapGatewayData(
|
|
4160
|
+
response,
|
|
4161
|
+
(data) => listResultFromEnvelope(data, "results")
|
|
4162
|
+
)
|
|
4163
|
+
);
|
|
4164
|
+
},
|
|
4165
|
+
markEmbeddingBackfillQueued(input, idempotencyKey) {
|
|
4166
|
+
assertNodeIds(input.nodeIds);
|
|
4167
|
+
return gateway.request({
|
|
4168
|
+
path: "/api/platform/v1/embeddings/backfill-queued",
|
|
4169
|
+
method: "POST",
|
|
4170
|
+
body: topicPayload(
|
|
4171
|
+
{
|
|
4172
|
+
...input,
|
|
4173
|
+
workspaceId: cleanRequiredString(input.workspaceId, "workspaceId")
|
|
4174
|
+
},
|
|
4175
|
+
EMBEDDINGS_FIELDS,
|
|
4176
|
+
"embeddings.markEmbeddingBackfillQueued"
|
|
4177
|
+
),
|
|
4178
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4179
|
+
});
|
|
4180
|
+
}
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
// src/contextClient.ts
|
|
4185
|
+
function cleanString4(value) {
|
|
4186
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
4187
|
+
}
|
|
4188
|
+
function cleanNumber(value) {
|
|
4189
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4190
|
+
}
|
|
4191
|
+
function cleanBoolean(value) {
|
|
4192
|
+
return typeof value === "boolean" ? value : void 0;
|
|
4193
|
+
}
|
|
4194
|
+
function buildCompileContextRequest(topicId, input = {}) {
|
|
4195
|
+
const payload = { topicId };
|
|
4196
|
+
const query5 = cleanString4(input.query);
|
|
4197
|
+
if (query5) {
|
|
4198
|
+
payload.query = query5;
|
|
4199
|
+
}
|
|
4200
|
+
const budget = cleanNumber(input.budget) ?? cleanNumber(input.tokenBudget);
|
|
4201
|
+
if (budget !== void 0) {
|
|
4202
|
+
payload.budget = budget;
|
|
4203
|
+
}
|
|
4204
|
+
const ranking = cleanString4(input.ranking) ?? cleanString4(input.rankingProfile);
|
|
4205
|
+
if (ranking) {
|
|
4206
|
+
payload.ranking = ranking;
|
|
4207
|
+
}
|
|
4208
|
+
const limit = cleanNumber(input.limit);
|
|
4209
|
+
if (limit !== void 0) {
|
|
4210
|
+
payload.limit = limit;
|
|
4211
|
+
}
|
|
4212
|
+
const maxDepth = cleanNumber(input.maxDepth);
|
|
4213
|
+
if (maxDepth !== void 0) {
|
|
4214
|
+
payload.maxDepth = maxDepth;
|
|
4215
|
+
}
|
|
4216
|
+
const includeEntities = cleanBoolean(input.includeEntities);
|
|
4217
|
+
if (includeEntities !== void 0) {
|
|
4218
|
+
payload.includeEntities = includeEntities;
|
|
4219
|
+
}
|
|
4220
|
+
const mode = cleanString4(input.mode);
|
|
4221
|
+
if (mode) {
|
|
4222
|
+
payload.mode = mode;
|
|
4223
|
+
}
|
|
4224
|
+
const includeFailures = cleanBoolean(input.includeFailures);
|
|
4225
|
+
if (includeFailures !== void 0) {
|
|
4226
|
+
payload.includeFailures = includeFailures;
|
|
4227
|
+
}
|
|
4228
|
+
const worktreeId = cleanString4(input.worktreeId);
|
|
4229
|
+
if (worktreeId) {
|
|
4230
|
+
payload.worktreeId = worktreeId;
|
|
4231
|
+
}
|
|
4232
|
+
const sessionId = cleanString4(input.sessionId);
|
|
4233
|
+
if (sessionId) {
|
|
3472
4234
|
payload.sessionId = sessionId;
|
|
3473
4235
|
}
|
|
3474
4236
|
if (Array.isArray(input.packWeightOverrides) && input.packWeightOverrides.length > 0) {
|
|
@@ -3499,6 +4261,408 @@ function createContextClient(config = {}) {
|
|
|
3499
4261
|
};
|
|
3500
4262
|
}
|
|
3501
4263
|
|
|
4264
|
+
// src/graphAnalysisClient.ts
|
|
4265
|
+
var GRAPH_ANALYSIS_ANALYSIS_FIELDS = [
|
|
4266
|
+
"topicId",
|
|
4267
|
+
"projectId",
|
|
4268
|
+
"workspaceId",
|
|
4269
|
+
"analysisType",
|
|
4270
|
+
"healthScore",
|
|
4271
|
+
"findings",
|
|
4272
|
+
"suggestions",
|
|
4273
|
+
"sourceNodeIds",
|
|
4274
|
+
"sourceEdgeIds",
|
|
4275
|
+
"detectorVersions",
|
|
4276
|
+
"metadata"
|
|
4277
|
+
];
|
|
4278
|
+
var GRAPH_ANALYSIS_SUGGESTION_FIELDS = [
|
|
4279
|
+
"topicId",
|
|
4280
|
+
"projectId",
|
|
4281
|
+
"workspaceId",
|
|
4282
|
+
"analysisId",
|
|
4283
|
+
"suggestions",
|
|
4284
|
+
"metadata"
|
|
4285
|
+
];
|
|
4286
|
+
var GRAPH_ANALYSIS_COMPUTE_FIELDS = [
|
|
4287
|
+
"topicId",
|
|
4288
|
+
"projectId",
|
|
4289
|
+
"workspaceId",
|
|
4290
|
+
"analysisType",
|
|
4291
|
+
"sourceNodeIds",
|
|
4292
|
+
"sourceEdgeIds",
|
|
4293
|
+
"detectorVersions",
|
|
4294
|
+
"metadata"
|
|
4295
|
+
];
|
|
4296
|
+
function readTopicId2(input) {
|
|
4297
|
+
return input.topicId?.trim() || input.projectId?.trim() || void 0;
|
|
4298
|
+
}
|
|
4299
|
+
function requireTopicId2(input) {
|
|
4300
|
+
const topicId = readTopicId2(input);
|
|
4301
|
+
if (!topicId) {
|
|
4302
|
+
throw new Error("topicId is required");
|
|
4303
|
+
}
|
|
4304
|
+
return topicId;
|
|
4305
|
+
}
|
|
4306
|
+
function assertKnownKeys2(input, allowed, operation) {
|
|
4307
|
+
const allowedSet = new Set(allowed);
|
|
4308
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
|
|
4309
|
+
if (unknownKeys.length > 0) {
|
|
4310
|
+
throw new Error(
|
|
4311
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
4312
|
+
);
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
function normalizeAnalysisPayload(input) {
|
|
4316
|
+
assertKnownKeys2(
|
|
4317
|
+
input,
|
|
4318
|
+
GRAPH_ANALYSIS_ANALYSIS_FIELDS,
|
|
4319
|
+
"graphAnalysis.saveAnalysis"
|
|
4320
|
+
);
|
|
4321
|
+
return {
|
|
4322
|
+
...input,
|
|
4323
|
+
topicId: requireTopicId2(input),
|
|
4324
|
+
projectId: void 0
|
|
4325
|
+
};
|
|
4326
|
+
}
|
|
4327
|
+
function normalizeSuggestionPayload(input) {
|
|
4328
|
+
assertKnownKeys2(
|
|
4329
|
+
input,
|
|
4330
|
+
GRAPH_ANALYSIS_SUGGESTION_FIELDS,
|
|
4331
|
+
"graphAnalysis.saveSuggestions"
|
|
4332
|
+
);
|
|
4333
|
+
return {
|
|
4334
|
+
...input,
|
|
4335
|
+
topicId: requireTopicId2(input),
|
|
4336
|
+
projectId: void 0
|
|
4337
|
+
};
|
|
4338
|
+
}
|
|
4339
|
+
function normalizeComputePayload(input) {
|
|
4340
|
+
assertKnownKeys2(
|
|
4341
|
+
input,
|
|
4342
|
+
GRAPH_ANALYSIS_COMPUTE_FIELDS,
|
|
4343
|
+
"graphAnalysis.computeOrRequestAnalysis"
|
|
4344
|
+
);
|
|
4345
|
+
return {
|
|
4346
|
+
...input,
|
|
4347
|
+
topicId: requireTopicId2(input),
|
|
4348
|
+
projectId: void 0
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
function graphAnalysisQuery(input) {
|
|
4352
|
+
return {
|
|
4353
|
+
topicId: requireTopicId2(input),
|
|
4354
|
+
workspaceId: input.workspaceId,
|
|
4355
|
+
analysisType: input.analysisType,
|
|
4356
|
+
limit: input.limit,
|
|
4357
|
+
cursor: input.cursor
|
|
4358
|
+
};
|
|
4359
|
+
}
|
|
4360
|
+
function createGraphAnalysisClient(config = {}) {
|
|
4361
|
+
const gateway = createGatewayRequestClient(config);
|
|
4362
|
+
return {
|
|
4363
|
+
saveAnalysis(input, idempotencyKey) {
|
|
4364
|
+
return gateway.request({
|
|
4365
|
+
path: "/api/platform/v1/graph-analysis/analyses",
|
|
4366
|
+
method: "POST",
|
|
4367
|
+
body: normalizeAnalysisPayload(input),
|
|
4368
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4369
|
+
});
|
|
4370
|
+
},
|
|
4371
|
+
listAnalyses(input) {
|
|
4372
|
+
return gateway.request({
|
|
4373
|
+
path: `/api/platform/v1/graph-analysis/analyses${toQueryString(
|
|
4374
|
+
graphAnalysisQuery(input)
|
|
4375
|
+
)}`
|
|
4376
|
+
}).then(
|
|
4377
|
+
(response) => mapGatewayData(
|
|
4378
|
+
response,
|
|
4379
|
+
(data) => createListResult(
|
|
4380
|
+
Array.isArray(data.analyses) ? data.analyses : Array.isArray(data) ? data : [],
|
|
4381
|
+
"analyses"
|
|
4382
|
+
)
|
|
4383
|
+
)
|
|
4384
|
+
);
|
|
4385
|
+
},
|
|
4386
|
+
getLatestAnalysis(input) {
|
|
4387
|
+
return gateway.request({
|
|
4388
|
+
path: `/api/platform/v1/graph-analysis/analyses/latest${toQueryString({
|
|
4389
|
+
topicId: requireTopicId2(input),
|
|
4390
|
+
workspaceId: input.workspaceId,
|
|
4391
|
+
analysisType: input.analysisType
|
|
4392
|
+
})}`
|
|
4393
|
+
});
|
|
4394
|
+
},
|
|
4395
|
+
saveSuggestions(input, idempotencyKey) {
|
|
4396
|
+
return gateway.request({
|
|
4397
|
+
path: "/api/platform/v1/graph-analysis/suggestions",
|
|
4398
|
+
method: "POST",
|
|
4399
|
+
body: normalizeSuggestionPayload(input),
|
|
4400
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4401
|
+
});
|
|
4402
|
+
},
|
|
4403
|
+
updateSuggestionStatus(input, idempotencyKey) {
|
|
4404
|
+
return gateway.request({
|
|
4405
|
+
path: `/api/platform/v1/graph-analysis/suggestions/${encodeURIComponent(
|
|
4406
|
+
input.suggestionId
|
|
4407
|
+
)}`,
|
|
4408
|
+
method: "PATCH",
|
|
4409
|
+
body: {
|
|
4410
|
+
status: input.status,
|
|
4411
|
+
rationale: input.rationale,
|
|
4412
|
+
metadata: input.metadata
|
|
4413
|
+
},
|
|
4414
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4415
|
+
});
|
|
4416
|
+
},
|
|
4417
|
+
listSuggestions(input) {
|
|
4418
|
+
return gateway.request({
|
|
4419
|
+
path: `/api/platform/v1/graph-analysis/suggestions${toQueryString({
|
|
4420
|
+
topicId: requireTopicId2(input),
|
|
4421
|
+
workspaceId: input.workspaceId,
|
|
4422
|
+
analysisId: input.analysisId,
|
|
4423
|
+
findingId: input.findingId,
|
|
4424
|
+
status: input.status,
|
|
4425
|
+
limit: input.limit,
|
|
4426
|
+
cursor: input.cursor
|
|
4427
|
+
})}`
|
|
4428
|
+
}).then(
|
|
4429
|
+
(response) => mapGatewayData(
|
|
4430
|
+
response,
|
|
4431
|
+
(data) => createListResult(
|
|
4432
|
+
Array.isArray(data.suggestions) ? data.suggestions : Array.isArray(data) ? data : [],
|
|
4433
|
+
"suggestions"
|
|
4434
|
+
)
|
|
4435
|
+
)
|
|
4436
|
+
);
|
|
4437
|
+
},
|
|
4438
|
+
listGraphChanges(input) {
|
|
4439
|
+
return gateway.request({
|
|
4440
|
+
path: `/api/platform/v1/graph-analysis/changes${toQueryString({
|
|
4441
|
+
topicId: requireTopicId2(input),
|
|
4442
|
+
workspaceId: input.workspaceId,
|
|
4443
|
+
analysisId: input.analysisId,
|
|
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),
|
|
4447
|
+
limit: input.limit,
|
|
4448
|
+
cursor: input.cursor
|
|
4449
|
+
})}`
|
|
4450
|
+
}).then(
|
|
4451
|
+
(response) => mapGatewayData(
|
|
4452
|
+
response,
|
|
4453
|
+
(data) => createListResult(
|
|
4454
|
+
Array.isArray(data.changes) ? data.changes : Array.isArray(data) ? data : [],
|
|
4455
|
+
"changes"
|
|
4456
|
+
)
|
|
4457
|
+
)
|
|
4458
|
+
);
|
|
4459
|
+
},
|
|
4460
|
+
computeOrRequestAnalysis(input, idempotencyKey) {
|
|
4461
|
+
return gateway.request({
|
|
4462
|
+
path: "/api/platform/v1/graph-analysis/compute",
|
|
4463
|
+
method: "POST",
|
|
4464
|
+
body: normalizeComputePayload(input),
|
|
4465
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4466
|
+
});
|
|
4467
|
+
}
|
|
4468
|
+
};
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
// src/graphRecommendationsClient.ts
|
|
4472
|
+
var GRAPH_RECOMMENDATION_FIELDS = [
|
|
4473
|
+
"topicId",
|
|
4474
|
+
"projectId",
|
|
4475
|
+
"workspaceId",
|
|
4476
|
+
"limit",
|
|
4477
|
+
"cursor",
|
|
4478
|
+
"status",
|
|
4479
|
+
"findingId",
|
|
4480
|
+
"actionType",
|
|
4481
|
+
"targetNodeIds",
|
|
4482
|
+
"priority",
|
|
4483
|
+
"rationale",
|
|
4484
|
+
"healthScore",
|
|
4485
|
+
"metadata"
|
|
4486
|
+
];
|
|
4487
|
+
function readTopicId3(input) {
|
|
4488
|
+
return input.topicId?.trim() || input.projectId?.trim() || void 0;
|
|
4489
|
+
}
|
|
4490
|
+
function requireTopicId3(input) {
|
|
4491
|
+
const topicId = readTopicId3(input);
|
|
4492
|
+
if (!topicId) {
|
|
4493
|
+
throw new Error("topicId is required");
|
|
4494
|
+
}
|
|
4495
|
+
return topicId;
|
|
4496
|
+
}
|
|
4497
|
+
function assertKnownKeys3(input, operation) {
|
|
4498
|
+
const allowed = new Set(GRAPH_RECOMMENDATION_FIELDS);
|
|
4499
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
|
|
4500
|
+
if (unknownKeys.length > 0) {
|
|
4501
|
+
throw new Error(
|
|
4502
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
4503
|
+
);
|
|
4504
|
+
}
|
|
4505
|
+
}
|
|
4506
|
+
function listQuery(input) {
|
|
4507
|
+
assertKnownKeys3(
|
|
4508
|
+
input,
|
|
4509
|
+
"graphRecommendations.listForTopic"
|
|
4510
|
+
);
|
|
4511
|
+
return {
|
|
4512
|
+
workspaceId: input.workspaceId,
|
|
4513
|
+
topicId: requireTopicId3(input),
|
|
4514
|
+
limit: input.limit,
|
|
4515
|
+
cursor: input.cursor,
|
|
4516
|
+
status: input.status,
|
|
4517
|
+
findingId: input.findingId,
|
|
4518
|
+
actionType: input.actionType,
|
|
4519
|
+
priority: input.priority,
|
|
4520
|
+
targetNodeIds: input.targetNodeIds?.join(","),
|
|
4521
|
+
healthScore: input.healthScore
|
|
4522
|
+
};
|
|
4523
|
+
}
|
|
4524
|
+
function createGraphRecommendationsClient(config = {}) {
|
|
4525
|
+
const gateway = createGatewayRequestClient(config);
|
|
4526
|
+
return {
|
|
4527
|
+
listForTopic(input) {
|
|
4528
|
+
return gateway.request({
|
|
4529
|
+
path: `/api/platform/v1/graph-recommendations${toQueryString(
|
|
4530
|
+
listQuery(input)
|
|
4531
|
+
)}`
|
|
4532
|
+
}).then(
|
|
4533
|
+
(response) => mapGatewayData(
|
|
4534
|
+
response,
|
|
4535
|
+
(data) => createListResult(
|
|
4536
|
+
Array.isArray(
|
|
4537
|
+
data.recommendations
|
|
4538
|
+
) ? data.recommendations : Array.isArray(data) ? data : [],
|
|
4539
|
+
"recommendations"
|
|
4540
|
+
)
|
|
4541
|
+
)
|
|
4542
|
+
);
|
|
4543
|
+
},
|
|
4544
|
+
getRecommendation(recommendationId) {
|
|
4545
|
+
return gateway.request({
|
|
4546
|
+
path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
|
|
4547
|
+
recommendationId
|
|
4548
|
+
)}`
|
|
4549
|
+
});
|
|
4550
|
+
},
|
|
4551
|
+
markRecommendationStatus(input, idempotencyKey) {
|
|
4552
|
+
return gateway.request({
|
|
4553
|
+
path: `/api/platform/v1/graph-recommendations/${encodeURIComponent(
|
|
4554
|
+
input.recommendationId
|
|
4555
|
+
)}/status`,
|
|
4556
|
+
method: "PATCH",
|
|
4557
|
+
body: {
|
|
4558
|
+
status: input.status,
|
|
4559
|
+
rationale: input.rationale,
|
|
4560
|
+
metadata: input.metadata
|
|
4561
|
+
},
|
|
4562
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4563
|
+
});
|
|
4564
|
+
}
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4567
|
+
|
|
4568
|
+
// src/graphStateClassifierClient.ts
|
|
4569
|
+
var GRAPH_STATE_CLASSIFIER_FIELDS = [
|
|
4570
|
+
"topicId",
|
|
4571
|
+
"projectId",
|
|
4572
|
+
"workspaceId",
|
|
4573
|
+
"nodeId",
|
|
4574
|
+
"epistemicStatus",
|
|
4575
|
+
"beliefMaturity",
|
|
4576
|
+
"answerQuality",
|
|
4577
|
+
"evidenceNetwork",
|
|
4578
|
+
"logicalRole",
|
|
4579
|
+
"questionPriority",
|
|
4580
|
+
"layer",
|
|
4581
|
+
"modelVersion",
|
|
4582
|
+
"limit",
|
|
4583
|
+
"cursor",
|
|
4584
|
+
"metadata"
|
|
4585
|
+
];
|
|
4586
|
+
function normalizeRecordPayload(input) {
|
|
4587
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4588
|
+
cleanRequiredString(input.nodeId, "nodeId");
|
|
4589
|
+
return topicPayload(
|
|
4590
|
+
input,
|
|
4591
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4592
|
+
"graphStateClassifier.recordClassification"
|
|
4593
|
+
);
|
|
4594
|
+
}
|
|
4595
|
+
function createGraphStateClassifierClient(config = {}) {
|
|
4596
|
+
const gateway = createGatewayRequestClient(config);
|
|
4597
|
+
return {
|
|
4598
|
+
classifyNode(input, idempotencyKey) {
|
|
4599
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4600
|
+
cleanRequiredString(input.nodeId, "nodeId");
|
|
4601
|
+
return gateway.request({
|
|
4602
|
+
path: "/api/platform/v1/graph-state-classifier/classify-node",
|
|
4603
|
+
method: "POST",
|
|
4604
|
+
body: topicPayload(
|
|
4605
|
+
input,
|
|
4606
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4607
|
+
"graphStateClassifier.classifyNode"
|
|
4608
|
+
),
|
|
4609
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4610
|
+
});
|
|
4611
|
+
},
|
|
4612
|
+
classifyTopic(input, idempotencyKey) {
|
|
4613
|
+
cleanRequiredString(input.workspaceId, "workspaceId");
|
|
4614
|
+
return gateway.request({
|
|
4615
|
+
path: "/api/platform/v1/graph-state-classifier/classify-topic",
|
|
4616
|
+
method: "POST",
|
|
4617
|
+
body: topicPayload(
|
|
4618
|
+
input,
|
|
4619
|
+
GRAPH_STATE_CLASSIFIER_FIELDS,
|
|
4620
|
+
"graphStateClassifier.classifyTopic"
|
|
4621
|
+
),
|
|
4622
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4623
|
+
}).then(
|
|
4624
|
+
(response) => mapGatewayData(
|
|
4625
|
+
response,
|
|
4626
|
+
(data) => listResultFromEnvelope(
|
|
4627
|
+
data,
|
|
4628
|
+
"classifications"
|
|
4629
|
+
)
|
|
4630
|
+
)
|
|
4631
|
+
);
|
|
4632
|
+
},
|
|
4633
|
+
listClassifications(input) {
|
|
4634
|
+
return gateway.request({
|
|
4635
|
+
path: `/api/platform/v1/graph-state-classifier/classifications${toQueryString({
|
|
4636
|
+
topicId: requireTopicId(input),
|
|
4637
|
+
workspaceId: input.workspaceId,
|
|
4638
|
+
nodeId: input.nodeId,
|
|
4639
|
+
modelVersion: input.modelVersion,
|
|
4640
|
+
layer: input.layer,
|
|
4641
|
+
epistemicStatus: input.epistemicStatus,
|
|
4642
|
+
limit: input.limit,
|
|
4643
|
+
cursor: input.cursor
|
|
4644
|
+
})}`
|
|
4645
|
+
}).then(
|
|
4646
|
+
(response) => mapGatewayData(
|
|
4647
|
+
response,
|
|
4648
|
+
(data) => listResultFromEnvelope(
|
|
4649
|
+
data,
|
|
4650
|
+
"classifications"
|
|
4651
|
+
)
|
|
4652
|
+
)
|
|
4653
|
+
);
|
|
4654
|
+
},
|
|
4655
|
+
recordClassification(input, idempotencyKey) {
|
|
4656
|
+
return gateway.request({
|
|
4657
|
+
path: "/api/platform/v1/graph-state-classifier/classifications",
|
|
4658
|
+
method: "POST",
|
|
4659
|
+
body: normalizeRecordPayload(input),
|
|
4660
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4661
|
+
});
|
|
4662
|
+
}
|
|
4663
|
+
};
|
|
4664
|
+
}
|
|
4665
|
+
|
|
3502
4666
|
// src/harnessClient.ts
|
|
3503
4667
|
function createHarnessClient(config = {}) {
|
|
3504
4668
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -3718,9 +4882,9 @@ function createHarnessClient(config = {}) {
|
|
|
3718
4882
|
/**
|
|
3719
4883
|
* List prompt resolutions.
|
|
3720
4884
|
*/
|
|
3721
|
-
async listPromptResolutions(
|
|
4885
|
+
async listPromptResolutions(query5 = {}) {
|
|
3722
4886
|
return gateway.request({
|
|
3723
|
-
path: `/api/platform/v1/harness/prompts${toQueryString(
|
|
4887
|
+
path: `/api/platform/v1/harness/prompts${toQueryString(query5)}`
|
|
3724
4888
|
}).then(
|
|
3725
4889
|
(response) => mapGatewayData(
|
|
3726
4890
|
response,
|
|
@@ -3739,6 +4903,128 @@ function createHarnessClient(config = {}) {
|
|
|
3739
4903
|
};
|
|
3740
4904
|
}
|
|
3741
4905
|
|
|
4906
|
+
// src/jobsClient.ts
|
|
4907
|
+
var JOBS_FIELDS = [
|
|
4908
|
+
"tenantId",
|
|
4909
|
+
"workspaceId",
|
|
4910
|
+
"principalId",
|
|
4911
|
+
"topicId",
|
|
4912
|
+
"worktreeId",
|
|
4913
|
+
"jobId",
|
|
4914
|
+
"jobType",
|
|
4915
|
+
"payload",
|
|
4916
|
+
"status",
|
|
4917
|
+
"attempt",
|
|
4918
|
+
"runId",
|
|
4919
|
+
"queue",
|
|
4920
|
+
"priority",
|
|
4921
|
+
"error",
|
|
4922
|
+
"metadata",
|
|
4923
|
+
"limit",
|
|
4924
|
+
"cursor"
|
|
4925
|
+
];
|
|
4926
|
+
function query2(input) {
|
|
4927
|
+
return {
|
|
4928
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
4929
|
+
workspaceId: input.workspaceId,
|
|
4930
|
+
principalId: input.principalId,
|
|
4931
|
+
topicId: input.topicId,
|
|
4932
|
+
worktreeId: input.worktreeId,
|
|
4933
|
+
jobType: input.jobType,
|
|
4934
|
+
status: input.status,
|
|
4935
|
+
queue: input.queue,
|
|
4936
|
+
limit: input.limit,
|
|
4937
|
+
cursor: input.cursor
|
|
4938
|
+
};
|
|
4939
|
+
}
|
|
4940
|
+
function body2(input, operation) {
|
|
4941
|
+
return knownPayload(input, JOBS_FIELDS, operation);
|
|
4942
|
+
}
|
|
4943
|
+
function createJobsClient(config = {}) {
|
|
4944
|
+
const gateway = createGatewayRequestClient(config);
|
|
4945
|
+
return {
|
|
4946
|
+
enqueue(input, idempotencyKey) {
|
|
4947
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4948
|
+
cleanRequiredString(input.jobType, "jobType");
|
|
4949
|
+
return gateway.request({
|
|
4950
|
+
path: "/api/platform/v1/jobs",
|
|
4951
|
+
method: "POST",
|
|
4952
|
+
body: body2(input, "jobs.enqueue"),
|
|
4953
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4954
|
+
});
|
|
4955
|
+
},
|
|
4956
|
+
list(input) {
|
|
4957
|
+
return gateway.request({
|
|
4958
|
+
path: `/api/platform/v1/jobs${toQueryString(query2(input))}`
|
|
4959
|
+
}).then(
|
|
4960
|
+
(response) => mapGatewayData(
|
|
4961
|
+
response,
|
|
4962
|
+
(data) => listResultFromEnvelope(data, "jobs")
|
|
4963
|
+
)
|
|
4964
|
+
);
|
|
4965
|
+
},
|
|
4966
|
+
claim(input, idempotencyKey) {
|
|
4967
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4968
|
+
return gateway.request({
|
|
4969
|
+
path: "/api/platform/v1/jobs/claim",
|
|
4970
|
+
method: "POST",
|
|
4971
|
+
body: body2(input, "jobs.claim"),
|
|
4972
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4973
|
+
});
|
|
4974
|
+
},
|
|
4975
|
+
updateStatus(input, idempotencyKey) {
|
|
4976
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4977
|
+
cleanRequiredString(input.jobId, "jobId");
|
|
4978
|
+
return gateway.request({
|
|
4979
|
+
path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/status`,
|
|
4980
|
+
method: "PATCH",
|
|
4981
|
+
body: body2(
|
|
4982
|
+
input,
|
|
4983
|
+
"jobs.updateStatus"
|
|
4984
|
+
),
|
|
4985
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4986
|
+
});
|
|
4987
|
+
},
|
|
4988
|
+
retry(input, idempotencyKey) {
|
|
4989
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
4990
|
+
cleanRequiredString(input.jobId, "jobId");
|
|
4991
|
+
return gateway.request({
|
|
4992
|
+
path: `/api/platform/v1/jobs/${encodeURIComponent(input.jobId)}/retry`,
|
|
4993
|
+
method: "POST",
|
|
4994
|
+
body: body2(input, "jobs.retry"),
|
|
4995
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
4996
|
+
});
|
|
4997
|
+
},
|
|
4998
|
+
recordRunStart(input, idempotencyKey) {
|
|
4999
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5000
|
+
return gateway.request({
|
|
5001
|
+
path: "/api/platform/v1/jobs/runs/start",
|
|
5002
|
+
method: "POST",
|
|
5003
|
+
body: body2(
|
|
5004
|
+
input,
|
|
5005
|
+
"jobs.recordRunStart"
|
|
5006
|
+
),
|
|
5007
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5008
|
+
});
|
|
5009
|
+
},
|
|
5010
|
+
recordRunFinish(input, idempotencyKey) {
|
|
5011
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5012
|
+
cleanRequiredString(input.runId, "runId");
|
|
5013
|
+
return gateway.request({
|
|
5014
|
+
path: `/api/platform/v1/jobs/runs/${encodeURIComponent(
|
|
5015
|
+
input.runId
|
|
5016
|
+
)}/finish`,
|
|
5017
|
+
method: "POST",
|
|
5018
|
+
body: body2(
|
|
5019
|
+
input,
|
|
5020
|
+
"jobs.recordRunFinish"
|
|
5021
|
+
),
|
|
5022
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5023
|
+
});
|
|
5024
|
+
}
|
|
5025
|
+
};
|
|
5026
|
+
}
|
|
5027
|
+
|
|
3742
5028
|
// src/learningClient.ts
|
|
3743
5029
|
function createLearningClient(config = {}) {
|
|
3744
5030
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -3768,17 +5054,133 @@ function createLearningClient(config = {}) {
|
|
|
3768
5054
|
async getRecentExecutions(args = {}) {
|
|
3769
5055
|
return this.listRecentExecutions(args);
|
|
3770
5056
|
},
|
|
3771
|
-
/**
|
|
3772
|
-
* Get aggregate execution statistics.
|
|
3773
|
-
*/
|
|
3774
|
-
async getExecutionStats(args = {}) {
|
|
5057
|
+
/**
|
|
5058
|
+
* Get aggregate execution statistics.
|
|
5059
|
+
*/
|
|
5060
|
+
async getExecutionStats(args = {}) {
|
|
5061
|
+
return gateway.request({
|
|
5062
|
+
path: `/api/platform/v1/learning/executions/stats${toQueryString({
|
|
5063
|
+
...normalizeTopicQuery(args),
|
|
5064
|
+
namespace: args.namespace,
|
|
5065
|
+
audienceMode: args.audienceMode,
|
|
5066
|
+
hours: typeof args.hours === "number" && Number.isFinite(args.hours) ? String(args.hours) : void 0
|
|
5067
|
+
})}`
|
|
5068
|
+
});
|
|
5069
|
+
}
|
|
5070
|
+
};
|
|
5071
|
+
}
|
|
5072
|
+
function toJsonValue(value) {
|
|
5073
|
+
if (value === void 0) {
|
|
5074
|
+
return void 0;
|
|
5075
|
+
}
|
|
5076
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
5077
|
+
const json = JSON.stringify(value, (_key, candidate) => {
|
|
5078
|
+
if (typeof candidate === "bigint") {
|
|
5079
|
+
return candidate.toString();
|
|
5080
|
+
}
|
|
5081
|
+
if (typeof candidate === "function" || typeof candidate === "symbol" || typeof candidate === "undefined") {
|
|
5082
|
+
return void 0;
|
|
5083
|
+
}
|
|
5084
|
+
if (candidate && typeof candidate === "object") {
|
|
5085
|
+
if (seen.has(candidate)) {
|
|
5086
|
+
return "[Circular]";
|
|
5087
|
+
}
|
|
5088
|
+
seen.add(candidate);
|
|
5089
|
+
}
|
|
5090
|
+
return candidate;
|
|
5091
|
+
});
|
|
5092
|
+
if (json === void 0) {
|
|
5093
|
+
return void 0;
|
|
5094
|
+
}
|
|
5095
|
+
return JSON.parse(json);
|
|
5096
|
+
}
|
|
5097
|
+
function createMcpClient(config = {}) {
|
|
5098
|
+
const gateway = createGatewayRequestClient(config);
|
|
5099
|
+
return {
|
|
5100
|
+
bootstrapSession(input = {}) {
|
|
5101
|
+
const scope = {
|
|
5102
|
+
tenantId: input.tenantId,
|
|
5103
|
+
workspaceId: input.workspaceId
|
|
5104
|
+
};
|
|
5105
|
+
const body4 = {
|
|
5106
|
+
transportKind: input.transportKind,
|
|
5107
|
+
sessionId: input.sessionId,
|
|
5108
|
+
agentIdentity: input.agentIdentity,
|
|
5109
|
+
workspaceId: input.workspaceId
|
|
5110
|
+
};
|
|
5111
|
+
return gateway.request({
|
|
5112
|
+
path: `${MCP_GATEWAY_BOOTSTRAP_ENDPOINT}${toQueryString(scope)}`,
|
|
5113
|
+
method: "POST",
|
|
5114
|
+
body: body4
|
|
5115
|
+
});
|
|
5116
|
+
},
|
|
5117
|
+
checkWritePolicy(input) {
|
|
5118
|
+
const scope = {
|
|
5119
|
+
tenantId: input.tenantId,
|
|
5120
|
+
workspaceId: input.workspaceId
|
|
5121
|
+
};
|
|
5122
|
+
return gateway.request({
|
|
5123
|
+
path: `${MCP_GATEWAY_WRITE_POLICY_CHECK_ENDPOINT}${toQueryString(scope)}`,
|
|
5124
|
+
method: "POST",
|
|
5125
|
+
body: {
|
|
5126
|
+
topicId: input.topicId,
|
|
5127
|
+
role: input.role,
|
|
5128
|
+
toolName: input.toolName
|
|
5129
|
+
}
|
|
5130
|
+
});
|
|
5131
|
+
},
|
|
5132
|
+
beginBuildSession(input) {
|
|
5133
|
+
const scope = {
|
|
5134
|
+
tenantId: input.tenantId,
|
|
5135
|
+
workspaceId: input.workspaceId
|
|
5136
|
+
};
|
|
5137
|
+
return gateway.request({
|
|
5138
|
+
path: `${MCP_GATEWAY_BEGIN_BUILD_SESSION_ENDPOINT}${toQueryString(scope)}`,
|
|
5139
|
+
method: "POST",
|
|
5140
|
+
body: {
|
|
5141
|
+
worktreeId: input.worktreeId,
|
|
5142
|
+
branch: input.branch,
|
|
5143
|
+
branchBase: input.branchBase,
|
|
5144
|
+
prBase: input.prBase,
|
|
5145
|
+
sessionMode: input.sessionMode,
|
|
5146
|
+
activateIfPlanning: input.activateIfPlanning
|
|
5147
|
+
}
|
|
5148
|
+
});
|
|
5149
|
+
},
|
|
5150
|
+
evaluateEngineeringContract(input) {
|
|
5151
|
+
const scope = {
|
|
5152
|
+
tenantId: input.tenantId,
|
|
5153
|
+
workspaceId: input.workspaceId
|
|
5154
|
+
};
|
|
5155
|
+
return gateway.request({
|
|
5156
|
+
path: `${MCP_GATEWAY_EVALUATE_ENGINEERING_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
|
|
5157
|
+
method: "POST",
|
|
5158
|
+
body: {
|
|
5159
|
+
beliefNodeId: toJsonValue(input.beliefNodeId),
|
|
5160
|
+
trigger: toJsonValue(input.trigger),
|
|
5161
|
+
testOutput: toJsonValue(input.testOutput),
|
|
5162
|
+
tscOutput: toJsonValue(input.tscOutput),
|
|
5163
|
+
lintOutput: toJsonValue(input.lintOutput),
|
|
5164
|
+
sentryData: toJsonValue(input.sentryData)
|
|
5165
|
+
}
|
|
5166
|
+
});
|
|
5167
|
+
},
|
|
5168
|
+
evaluateResearchContract(input) {
|
|
5169
|
+
const scope = {
|
|
5170
|
+
tenantId: input.tenantId,
|
|
5171
|
+
workspaceId: input.workspaceId
|
|
5172
|
+
};
|
|
3775
5173
|
return gateway.request({
|
|
3776
|
-
path:
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
5174
|
+
path: `${MCP_GATEWAY_EVALUATE_RESEARCH_CONTRACT_ENDPOINT}${toQueryString(scope)}`,
|
|
5175
|
+
method: "POST",
|
|
5176
|
+
body: {
|
|
5177
|
+
beliefNodeId: toJsonValue(input.beliefNodeId),
|
|
5178
|
+
trigger: toJsonValue(input.trigger),
|
|
5179
|
+
metricData: toJsonValue(input.metricData),
|
|
5180
|
+
referenceCheckData: toJsonValue(input.referenceCheckData),
|
|
5181
|
+
marketIndexData: toJsonValue(input.marketIndexData),
|
|
5182
|
+
temporalData: toJsonValue(input.temporalData)
|
|
5183
|
+
}
|
|
3782
5184
|
});
|
|
3783
5185
|
}
|
|
3784
5186
|
};
|
|
@@ -3886,6 +5288,7 @@ var FUNCTION_SURFACE_METHOD_PATHS = [
|
|
|
3886
5288
|
"topics.updateTopic",
|
|
3887
5289
|
"worktrees.activateWorktree",
|
|
3888
5290
|
"worktrees.addWorktree",
|
|
5291
|
+
"worktrees.beginBuildSession",
|
|
3889
5292
|
"worktrees.listAllWorktrees",
|
|
3890
5293
|
"worktrees.listCampaigns",
|
|
3891
5294
|
"worktrees.listWorktrees",
|
|
@@ -3908,6 +5311,7 @@ var CONTRACTS = {
|
|
|
3908
5311
|
"archive_belief": { method: "DELETE", path: "/beliefs", kind: "mutation", idempotent: true, surfaceIntent: "mcp_core" },
|
|
3909
5312
|
"archive_ontology": { method: "DELETE", path: "/ontologies", kind: "mutation", idempotent: true, surfaceIntent: "mcp_governance" },
|
|
3910
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" },
|
|
3911
5315
|
"bisect_confidence": { method: "POST", path: "/beliefs/confidence/bisect", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
3912
5316
|
"broadcast_message": { method: "POST", path: "/coordination/messages/broadcast", kind: "mutation", idempotent: true, surfaceIntent: "system" },
|
|
3913
5317
|
"check_permission": { method: "POST", path: "/identity/check-permission", kind: "query", idempotent: false, surfaceIntent: "mcp_core" },
|
|
@@ -4079,6 +5483,9 @@ function createFunctionSurfaceClient(config = {}) {
|
|
|
4079
5483
|
archiveQuestion(input = {}, idempotencyKey) {
|
|
4080
5484
|
return execute("archive_question", input, idempotencyKey);
|
|
4081
5485
|
},
|
|
5486
|
+
beginBuildSession(input = {}, idempotencyKey) {
|
|
5487
|
+
return execute("begin_build_session", input, idempotencyKey);
|
|
5488
|
+
},
|
|
4082
5489
|
bisectConfidence(input = {}, idempotencyKey) {
|
|
4083
5490
|
return execute("bisect_confidence", input, idempotencyKey);
|
|
4084
5491
|
},
|
|
@@ -4376,6 +5783,304 @@ function createFunctionSurfaceClient(config = {}) {
|
|
|
4376
5783
|
};
|
|
4377
5784
|
}
|
|
4378
5785
|
|
|
5786
|
+
// src/modelRuntimeClient.ts
|
|
5787
|
+
var MODEL_RUNTIME_FIELDS = [
|
|
5788
|
+
"tenantId",
|
|
5789
|
+
"workspaceId",
|
|
5790
|
+
"principalId",
|
|
5791
|
+
"functionName",
|
|
5792
|
+
"slotKey",
|
|
5793
|
+
"modelId",
|
|
5794
|
+
"provider",
|
|
5795
|
+
"routingPolicy",
|
|
5796
|
+
"metadata",
|
|
5797
|
+
"limit",
|
|
5798
|
+
"cursor"
|
|
5799
|
+
];
|
|
5800
|
+
function scopeQuery(input) {
|
|
5801
|
+
return {
|
|
5802
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
5803
|
+
workspaceId: input.workspaceId,
|
|
5804
|
+
principalId: input.principalId,
|
|
5805
|
+
provider: input.provider,
|
|
5806
|
+
limit: input.limit,
|
|
5807
|
+
cursor: input.cursor
|
|
5808
|
+
};
|
|
5809
|
+
}
|
|
5810
|
+
function modelRuntimeBody(input, operation) {
|
|
5811
|
+
return knownPayload(input, MODEL_RUNTIME_FIELDS, operation);
|
|
5812
|
+
}
|
|
5813
|
+
function createModelRuntimeClient(config = {}) {
|
|
5814
|
+
const gateway = createGatewayRequestClient(config);
|
|
5815
|
+
return {
|
|
5816
|
+
listModels(input) {
|
|
5817
|
+
return gateway.request({
|
|
5818
|
+
path: `/api/platform/v1/model-runtime/models${toQueryString(
|
|
5819
|
+
scopeQuery(input)
|
|
5820
|
+
)}`
|
|
5821
|
+
}).then(
|
|
5822
|
+
(response) => mapGatewayData(
|
|
5823
|
+
response,
|
|
5824
|
+
(data) => listResultFromEnvelope(data, "models")
|
|
5825
|
+
)
|
|
5826
|
+
);
|
|
5827
|
+
},
|
|
5828
|
+
getModel(input) {
|
|
5829
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5830
|
+
cleanRequiredString(input.modelId, "modelId");
|
|
5831
|
+
return gateway.request({
|
|
5832
|
+
path: `/api/platform/v1/model-runtime/models/${encodeURIComponent(
|
|
5833
|
+
input.modelId
|
|
5834
|
+
)}${toQueryString({
|
|
5835
|
+
tenantId: input.tenantId,
|
|
5836
|
+
workspaceId: input.workspaceId,
|
|
5837
|
+
principalId: input.principalId
|
|
5838
|
+
})}`
|
|
5839
|
+
});
|
|
5840
|
+
},
|
|
5841
|
+
listFunctionSlots(input) {
|
|
5842
|
+
return gateway.request({
|
|
5843
|
+
path: `/api/platform/v1/model-runtime/function-slots${toQueryString({
|
|
5844
|
+
...scopeQuery(input),
|
|
5845
|
+
functionName: input.functionName
|
|
5846
|
+
})}`
|
|
5847
|
+
}).then(
|
|
5848
|
+
(response) => mapGatewayData(
|
|
5849
|
+
response,
|
|
5850
|
+
(data) => listResultFromEnvelope(data, "slots")
|
|
5851
|
+
)
|
|
5852
|
+
);
|
|
5853
|
+
},
|
|
5854
|
+
resolveSlot(input, idempotencyKey) {
|
|
5855
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5856
|
+
cleanRequiredString(input.functionName, "functionName");
|
|
5857
|
+
return gateway.request({
|
|
5858
|
+
path: "/api/platform/v1/model-runtime/function-slots/resolve",
|
|
5859
|
+
method: "POST",
|
|
5860
|
+
body: modelRuntimeBody(
|
|
5861
|
+
input,
|
|
5862
|
+
"modelRuntime.resolveSlot"
|
|
5863
|
+
),
|
|
5864
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5865
|
+
});
|
|
5866
|
+
},
|
|
5867
|
+
updateSlotConfig(input, idempotencyKey) {
|
|
5868
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
5869
|
+
cleanRequiredString(input.functionName, "functionName");
|
|
5870
|
+
cleanRequiredString(input.slotKey, "slotKey");
|
|
5871
|
+
cleanRequiredString(input.modelId, "modelId");
|
|
5872
|
+
return gateway.request({
|
|
5873
|
+
path: "/api/platform/v1/model-runtime/slot-configs",
|
|
5874
|
+
method: "PUT",
|
|
5875
|
+
body: modelRuntimeBody(
|
|
5876
|
+
input,
|
|
5877
|
+
"modelRuntime.updateSlotConfig"
|
|
5878
|
+
),
|
|
5879
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5880
|
+
});
|
|
5881
|
+
}
|
|
5882
|
+
};
|
|
5883
|
+
}
|
|
5884
|
+
|
|
5885
|
+
// src/ontologyLinksClient.ts
|
|
5886
|
+
var ONTOLOGY_LINK_FIELDS = [
|
|
5887
|
+
"topicId",
|
|
5888
|
+
"workspaceId",
|
|
5889
|
+
"linkId",
|
|
5890
|
+
"sourceNodeId",
|
|
5891
|
+
"sourceGlobalId",
|
|
5892
|
+
"targetNodeId",
|
|
5893
|
+
"targetGlobalId",
|
|
5894
|
+
"ontologyId",
|
|
5895
|
+
"ontologyType",
|
|
5896
|
+
"edgeType",
|
|
5897
|
+
"weight",
|
|
5898
|
+
"confidence",
|
|
5899
|
+
"status",
|
|
5900
|
+
"metadata"
|
|
5901
|
+
];
|
|
5902
|
+
function assertEndpoints(input) {
|
|
5903
|
+
if (!input.sourceNodeId && !input.sourceGlobalId) {
|
|
5904
|
+
throw new Error("sourceNodeId or sourceGlobalId is required");
|
|
5905
|
+
}
|
|
5906
|
+
if (!input.targetNodeId && !input.targetGlobalId) {
|
|
5907
|
+
throw new Error("targetNodeId or targetGlobalId is required");
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
function normalizeLinkPayload(input, operation) {
|
|
5911
|
+
assertEndpoints(input);
|
|
5912
|
+
cleanRequiredString(input.ontologyId, "ontologyId");
|
|
5913
|
+
cleanRequiredString(input.edgeType, "edgeType");
|
|
5914
|
+
return knownPayload(input, ONTOLOGY_LINK_FIELDS, operation);
|
|
5915
|
+
}
|
|
5916
|
+
function createOntologyLinksClient(config = {}) {
|
|
5917
|
+
const gateway = createGatewayRequestClient(config);
|
|
5918
|
+
return {
|
|
5919
|
+
createLink(input, idempotencyKey) {
|
|
5920
|
+
return gateway.request({
|
|
5921
|
+
path: "/api/platform/v1/ontology-links",
|
|
5922
|
+
method: "POST",
|
|
5923
|
+
body: normalizeLinkPayload(input, "ontologyLinks.createLink"),
|
|
5924
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5925
|
+
});
|
|
5926
|
+
},
|
|
5927
|
+
upsertLink(input, idempotencyKey) {
|
|
5928
|
+
return gateway.request({
|
|
5929
|
+
path: "/api/platform/v1/ontology-links",
|
|
5930
|
+
method: "PUT",
|
|
5931
|
+
body: normalizeLinkPayload(input, "ontologyLinks.upsertLink"),
|
|
5932
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5933
|
+
});
|
|
5934
|
+
},
|
|
5935
|
+
listLinksForNode(input) {
|
|
5936
|
+
const nodeId = cleanOptionalString(input.nodeId);
|
|
5937
|
+
const globalId = cleanOptionalString(input.globalId);
|
|
5938
|
+
if (!nodeId && !globalId) {
|
|
5939
|
+
throw new Error("nodeId or globalId is required");
|
|
5940
|
+
}
|
|
5941
|
+
const pathId = encodeURIComponent(nodeId ?? globalId ?? "");
|
|
5942
|
+
return gateway.request({
|
|
5943
|
+
path: `/api/platform/v1/ontology-links/nodes/${pathId}${toQueryString({
|
|
5944
|
+
topicId: input.topicId,
|
|
5945
|
+
workspaceId: input.workspaceId,
|
|
5946
|
+
globalId: nodeId ? void 0 : globalId,
|
|
5947
|
+
ontologyId: input.ontologyId,
|
|
5948
|
+
ontologyType: input.ontologyType,
|
|
5949
|
+
edgeType: input.edgeType,
|
|
5950
|
+
status: input.status,
|
|
5951
|
+
limit: input.limit,
|
|
5952
|
+
cursor: input.cursor
|
|
5953
|
+
})}`
|
|
5954
|
+
}).then(
|
|
5955
|
+
(response) => mapGatewayData(
|
|
5956
|
+
response,
|
|
5957
|
+
(data) => listResultFromEnvelope(data, "links")
|
|
5958
|
+
)
|
|
5959
|
+
);
|
|
5960
|
+
},
|
|
5961
|
+
updateLinkStatus(input, idempotencyKey) {
|
|
5962
|
+
return gateway.request({
|
|
5963
|
+
path: `/api/platform/v1/ontology-links/${encodeURIComponent(
|
|
5964
|
+
input.linkId
|
|
5965
|
+
)}/status`,
|
|
5966
|
+
method: "PATCH",
|
|
5967
|
+
body: knownPayload(
|
|
5968
|
+
input,
|
|
5969
|
+
ONTOLOGY_LINK_FIELDS,
|
|
5970
|
+
"ontologyLinks.updateLinkStatus"
|
|
5971
|
+
),
|
|
5972
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5973
|
+
});
|
|
5974
|
+
}
|
|
5975
|
+
};
|
|
5976
|
+
}
|
|
5977
|
+
|
|
5978
|
+
// src/orgGraphSearchClient.ts
|
|
5979
|
+
var ORG_GRAPH_SEARCH_FIELDS = [
|
|
5980
|
+
"tenantId",
|
|
5981
|
+
"workspaceId",
|
|
5982
|
+
"query",
|
|
5983
|
+
"nodeTypes",
|
|
5984
|
+
"minConfidence",
|
|
5985
|
+
"limit",
|
|
5986
|
+
"cursor",
|
|
5987
|
+
"provenanceScope"
|
|
5988
|
+
];
|
|
5989
|
+
function cleanString5(value, label) {
|
|
5990
|
+
const normalized = value?.trim();
|
|
5991
|
+
if (!normalized) {
|
|
5992
|
+
throw new Error(`${label} is required`);
|
|
5993
|
+
}
|
|
5994
|
+
return normalized;
|
|
5995
|
+
}
|
|
5996
|
+
function assertKnownSearchKeys(input, operation) {
|
|
5997
|
+
const allowed = new Set(ORG_GRAPH_SEARCH_FIELDS);
|
|
5998
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
|
|
5999
|
+
if (unknownKeys.length > 0) {
|
|
6000
|
+
throw new Error(
|
|
6001
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
6002
|
+
);
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
function searchBody(input) {
|
|
6006
|
+
assertKnownSearchKeys(
|
|
6007
|
+
input,
|
|
6008
|
+
"orgGraphSearch.search"
|
|
6009
|
+
);
|
|
6010
|
+
return {
|
|
6011
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
6012
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
6013
|
+
query: cleanString5(input.query, "query"),
|
|
6014
|
+
nodeTypes: input.nodeTypes,
|
|
6015
|
+
minConfidence: input.minConfidence,
|
|
6016
|
+
limit: input.limit,
|
|
6017
|
+
cursor: input.cursor,
|
|
6018
|
+
provenanceScope: input.provenanceScope
|
|
6019
|
+
};
|
|
6020
|
+
}
|
|
6021
|
+
function listQuery2(input) {
|
|
6022
|
+
return {
|
|
6023
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
6024
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
6025
|
+
nodeTypes: input.nodeTypes?.join(","),
|
|
6026
|
+
minConfidence: input.minConfidence,
|
|
6027
|
+
limit: input.limit,
|
|
6028
|
+
cursor: input.cursor
|
|
6029
|
+
};
|
|
6030
|
+
}
|
|
6031
|
+
function mapResults(data) {
|
|
6032
|
+
const record = data && typeof data === "object" ? data : {};
|
|
6033
|
+
return createListResult(
|
|
6034
|
+
Array.isArray(record.results) ? record.results : Array.isArray(data) ? data : [],
|
|
6035
|
+
"results"
|
|
6036
|
+
);
|
|
6037
|
+
}
|
|
6038
|
+
function createOrgGraphSearchClient(config = {}) {
|
|
6039
|
+
const gateway = createGatewayRequestClient(config);
|
|
6040
|
+
return {
|
|
6041
|
+
search(input) {
|
|
6042
|
+
return gateway.request({
|
|
6043
|
+
path: "/api/platform/v1/org-graph-search/search",
|
|
6044
|
+
method: "POST",
|
|
6045
|
+
body: searchBody(input)
|
|
6046
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
6047
|
+
},
|
|
6048
|
+
getNode(input) {
|
|
6049
|
+
const nodeId = input.nodeId?.trim();
|
|
6050
|
+
const globalId = input.globalId?.trim();
|
|
6051
|
+
if (!nodeId && !globalId) {
|
|
6052
|
+
throw new Error("nodeId or globalId is required");
|
|
6053
|
+
}
|
|
6054
|
+
const nodePath = encodeURIComponent(nodeId ?? globalId ?? "");
|
|
6055
|
+
return gateway.request({
|
|
6056
|
+
path: `/api/platform/v1/org-graph-search/nodes/${nodePath}${toQueryString(
|
|
6057
|
+
{
|
|
6058
|
+
tenantId: cleanString5(input.tenantId, "tenantId"),
|
|
6059
|
+
workspaceId: cleanString5(input.workspaceId, "workspaceId"),
|
|
6060
|
+
globalId: nodeId ? void 0 : globalId
|
|
6061
|
+
}
|
|
6062
|
+
)}`
|
|
6063
|
+
});
|
|
6064
|
+
},
|
|
6065
|
+
listByProvenance(input) {
|
|
6066
|
+
return gateway.request({
|
|
6067
|
+
path: `/api/platform/v1/org-graph-search/provenance${toQueryString({
|
|
6068
|
+
...listQuery2(input),
|
|
6069
|
+
provenanceScope: input.provenanceScope
|
|
6070
|
+
})}`
|
|
6071
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
6072
|
+
},
|
|
6073
|
+
listPublishedFromWorkspace(input) {
|
|
6074
|
+
return gateway.request({
|
|
6075
|
+
path: `/api/platform/v1/org-graph-search/published${toQueryString({
|
|
6076
|
+
...listQuery2(input),
|
|
6077
|
+
sourceWorkspaceId: input.sourceWorkspaceId
|
|
6078
|
+
})}`
|
|
6079
|
+
}).then((response) => mapGatewayData(response, mapResults));
|
|
6080
|
+
}
|
|
6081
|
+
};
|
|
6082
|
+
}
|
|
6083
|
+
|
|
4379
6084
|
// src/packsClient.ts
|
|
4380
6085
|
function createPacksClient(config = {}) {
|
|
4381
6086
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -4418,9 +6123,9 @@ function createPacksClient(config = {}) {
|
|
|
4418
6123
|
/**
|
|
4419
6124
|
* List pack states for the current scope.
|
|
4420
6125
|
*/
|
|
4421
|
-
async listStates(
|
|
6126
|
+
async listStates(query5 = {}) {
|
|
4422
6127
|
return gateway.request({
|
|
4423
|
-
path: `/api/platform/v1/packs/states${toQueryString(
|
|
6128
|
+
path: `/api/platform/v1/packs/states${toQueryString(query5)}`
|
|
4424
6129
|
}).then(
|
|
4425
6130
|
(response) => mapGatewayData(
|
|
4426
6131
|
response,
|
|
@@ -4431,25 +6136,25 @@ function createPacksClient(config = {}) {
|
|
|
4431
6136
|
/**
|
|
4432
6137
|
* @deprecated Use listStates.
|
|
4433
6138
|
*/
|
|
4434
|
-
async getStates(
|
|
4435
|
-
return this.listStates(
|
|
6139
|
+
async getStates(query5 = {}) {
|
|
6140
|
+
return this.listStates(query5);
|
|
4436
6141
|
},
|
|
4437
6142
|
/**
|
|
4438
6143
|
* Get health details for a pack.
|
|
4439
6144
|
*/
|
|
4440
|
-
async getHealth(packKey,
|
|
6145
|
+
async getHealth(packKey, query5 = {}) {
|
|
4441
6146
|
return gateway.request({
|
|
4442
6147
|
path: `/api/platform/v1/packs/${encodeURIComponent(packKey)}/health${toQueryString(
|
|
4443
|
-
|
|
6148
|
+
query5
|
|
4444
6149
|
)}`
|
|
4445
6150
|
});
|
|
4446
6151
|
},
|
|
4447
6152
|
/**
|
|
4448
6153
|
* List pack telemetry entries.
|
|
4449
6154
|
*/
|
|
4450
|
-
async listTelemetry(
|
|
6155
|
+
async listTelemetry(query5 = {}) {
|
|
4451
6156
|
return gateway.request({
|
|
4452
|
-
path: `/api/platform/v1/packs/telemetry${toQueryString(
|
|
6157
|
+
path: `/api/platform/v1/packs/telemetry${toQueryString(query5)}`
|
|
4453
6158
|
}).then(
|
|
4454
6159
|
(response) => mapGatewayData(
|
|
4455
6160
|
response,
|
|
@@ -4460,8 +6165,8 @@ function createPacksClient(config = {}) {
|
|
|
4460
6165
|
/**
|
|
4461
6166
|
* @deprecated Use listTelemetry.
|
|
4462
6167
|
*/
|
|
4463
|
-
async getTelemetry(
|
|
4464
|
-
return this.listTelemetry(
|
|
6168
|
+
async getTelemetry(query5 = {}) {
|
|
6169
|
+
return this.listTelemetry(query5);
|
|
4465
6170
|
},
|
|
4466
6171
|
/**
|
|
4467
6172
|
* Create a pack entitlement.
|
|
@@ -4583,9 +6288,9 @@ function createPolicyClient(config = {}) {
|
|
|
4583
6288
|
/**
|
|
4584
6289
|
* List policy decisions in the current scope.
|
|
4585
6290
|
*/
|
|
4586
|
-
async listDecisions(
|
|
6291
|
+
async listDecisions(query5 = {}) {
|
|
4587
6292
|
return gateway.request({
|
|
4588
|
-
path: `/api/platform/v1/policy/decisions${toQueryString(
|
|
6293
|
+
path: `/api/platform/v1/policy/decisions${toQueryString(query5)}`
|
|
4589
6294
|
}).then(
|
|
4590
6295
|
(response) => mapGatewayData(
|
|
4591
6296
|
response,
|
|
@@ -4618,9 +6323,9 @@ function createPolicyClient(config = {}) {
|
|
|
4618
6323
|
/**
|
|
4619
6324
|
* List write policy rules for the current scope.
|
|
4620
6325
|
*/
|
|
4621
|
-
async listWritePolicies(
|
|
6326
|
+
async listWritePolicies(query5 = {}) {
|
|
4622
6327
|
const response = await gateway.request({
|
|
4623
|
-
path: `/api/platform/v1/policy/write-policies${toQueryString(
|
|
6328
|
+
path: `/api/platform/v1/policy/write-policies${toQueryString(query5)}`
|
|
4624
6329
|
});
|
|
4625
6330
|
const rawPolicies = response.data && typeof response.data === "object" ? response.data.policies : response.data;
|
|
4626
6331
|
return {
|
|
@@ -4683,9 +6388,9 @@ function createPolicyClient(config = {}) {
|
|
|
4683
6388
|
/**
|
|
4684
6389
|
* List tenant role policies for the current scope.
|
|
4685
6390
|
*/
|
|
4686
|
-
async listRolePolicies(
|
|
6391
|
+
async listRolePolicies(query5 = {}) {
|
|
4687
6392
|
const response = await gateway.request({
|
|
4688
|
-
path: `/api/platform/v1/policy/roles${toQueryString(
|
|
6393
|
+
path: `/api/platform/v1/policy/roles${toQueryString(query5)}`
|
|
4689
6394
|
});
|
|
4690
6395
|
return {
|
|
4691
6396
|
...response,
|
|
@@ -4743,28 +6448,28 @@ function createPolicyClient(config = {}) {
|
|
|
4743
6448
|
/**
|
|
4744
6449
|
* Check a permission decision for a topic or project scope.
|
|
4745
6450
|
*/
|
|
4746
|
-
async checkPermission(
|
|
4747
|
-
if (!
|
|
6451
|
+
async checkPermission(query5) {
|
|
6452
|
+
if (!query5.topicId) {
|
|
4748
6453
|
throw new Error("topicId is required");
|
|
4749
6454
|
}
|
|
4750
6455
|
return gateway.request({
|
|
4751
|
-
path: `/api/platform/v1/policy/check${toQueryString(
|
|
6456
|
+
path: `/api/platform/v1/policy/check${toQueryString(query5)}`
|
|
4752
6457
|
});
|
|
4753
6458
|
},
|
|
4754
6459
|
/**
|
|
4755
6460
|
* List accessible topics for a principal.
|
|
4756
6461
|
*/
|
|
4757
|
-
async listAccessibleTopics(
|
|
4758
|
-
const permission =
|
|
4759
|
-
const principal =
|
|
6462
|
+
async listAccessibleTopics(query5 = {}) {
|
|
6463
|
+
const permission = query5.permission ?? "read";
|
|
6464
|
+
const principal = query5.principal ?? query5.principalId;
|
|
4760
6465
|
const response = await gateway.request({
|
|
4761
6466
|
path: `/api/platform/v1/policy/topics${toQueryString({
|
|
4762
|
-
tenantId:
|
|
4763
|
-
workspaceId:
|
|
6467
|
+
tenantId: query5.tenantId,
|
|
6468
|
+
workspaceId: query5.workspaceId,
|
|
4764
6469
|
permission,
|
|
4765
|
-
includeShared:
|
|
6470
|
+
includeShared: query5.includeShared,
|
|
4766
6471
|
principal,
|
|
4767
|
-
limit:
|
|
6472
|
+
limit: query5.limit
|
|
4768
6473
|
})}`
|
|
4769
6474
|
});
|
|
4770
6475
|
return {
|
|
@@ -4947,6 +6652,294 @@ function createSchemaClient(config = {}) {
|
|
|
4947
6652
|
};
|
|
4948
6653
|
}
|
|
4949
6654
|
|
|
6655
|
+
// src/telemetryClient.ts
|
|
6656
|
+
var TELEMETRY_FIELDS = [
|
|
6657
|
+
"tenantId",
|
|
6658
|
+
"workspaceId",
|
|
6659
|
+
"principalId",
|
|
6660
|
+
"topicId",
|
|
6661
|
+
"worktreeId",
|
|
6662
|
+
"eventLevel",
|
|
6663
|
+
"eventType",
|
|
6664
|
+
"message",
|
|
6665
|
+
"toolName",
|
|
6666
|
+
"toolCalls",
|
|
6667
|
+
"decision",
|
|
6668
|
+
"policySubject",
|
|
6669
|
+
"policyAction",
|
|
6670
|
+
"policyResource",
|
|
6671
|
+
"runId",
|
|
6672
|
+
"runType",
|
|
6673
|
+
"status",
|
|
6674
|
+
"durationMs",
|
|
6675
|
+
"error",
|
|
6676
|
+
"metadata",
|
|
6677
|
+
"limit",
|
|
6678
|
+
"cursor"
|
|
6679
|
+
];
|
|
6680
|
+
function query3(input) {
|
|
6681
|
+
return {
|
|
6682
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
6683
|
+
workspaceId: input.workspaceId,
|
|
6684
|
+
principalId: input.principalId,
|
|
6685
|
+
topicId: input.topicId,
|
|
6686
|
+
worktreeId: input.worktreeId,
|
|
6687
|
+
runType: input.runType,
|
|
6688
|
+
status: input.status,
|
|
6689
|
+
limit: input.limit,
|
|
6690
|
+
cursor: input.cursor
|
|
6691
|
+
};
|
|
6692
|
+
}
|
|
6693
|
+
function body3(input, operation) {
|
|
6694
|
+
return knownPayload(input, TELEMETRY_FIELDS, operation);
|
|
6695
|
+
}
|
|
6696
|
+
function createTelemetryClient(config = {}) {
|
|
6697
|
+
const gateway = createGatewayRequestClient(config);
|
|
6698
|
+
return {
|
|
6699
|
+
logSystemEvent(input, idempotencyKey) {
|
|
6700
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6701
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
6702
|
+
cleanRequiredString(input.message, "message");
|
|
6703
|
+
return gateway.request({
|
|
6704
|
+
path: "/api/platform/v1/telemetry/system-events",
|
|
6705
|
+
method: "POST",
|
|
6706
|
+
body: body3(
|
|
6707
|
+
input,
|
|
6708
|
+
"telemetry.logSystemEvent"
|
|
6709
|
+
),
|
|
6710
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6711
|
+
});
|
|
6712
|
+
},
|
|
6713
|
+
logToolCallsBatch(input, idempotencyKey) {
|
|
6714
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6715
|
+
return gateway.request({
|
|
6716
|
+
path: "/api/platform/v1/telemetry/tool-calls/batch",
|
|
6717
|
+
method: "POST",
|
|
6718
|
+
body: body3(
|
|
6719
|
+
input,
|
|
6720
|
+
"telemetry.logToolCallsBatch"
|
|
6721
|
+
),
|
|
6722
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6723
|
+
});
|
|
6724
|
+
},
|
|
6725
|
+
recordEpistemicAudit(input, idempotencyKey) {
|
|
6726
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6727
|
+
cleanRequiredString(input.eventType, "eventType");
|
|
6728
|
+
return gateway.request({
|
|
6729
|
+
path: "/api/platform/v1/telemetry/epistemic-audits",
|
|
6730
|
+
method: "POST",
|
|
6731
|
+
body: body3(
|
|
6732
|
+
input,
|
|
6733
|
+
"telemetry.recordEpistemicAudit"
|
|
6734
|
+
),
|
|
6735
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6736
|
+
});
|
|
6737
|
+
},
|
|
6738
|
+
recordPolicyDecision(input, idempotencyKey) {
|
|
6739
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6740
|
+
cleanRequiredString(input.decision, "decision");
|
|
6741
|
+
return gateway.request({
|
|
6742
|
+
path: "/api/platform/v1/telemetry/policy-decisions",
|
|
6743
|
+
method: "POST",
|
|
6744
|
+
body: body3(
|
|
6745
|
+
input,
|
|
6746
|
+
"telemetry.recordPolicyDecision"
|
|
6747
|
+
),
|
|
6748
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6749
|
+
});
|
|
6750
|
+
},
|
|
6751
|
+
startRun(input, idempotencyKey) {
|
|
6752
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6753
|
+
cleanRequiredString(input.runType, "runType");
|
|
6754
|
+
return gateway.request({
|
|
6755
|
+
path: "/api/platform/v1/telemetry/runs/start",
|
|
6756
|
+
method: "POST",
|
|
6757
|
+
body: body3(
|
|
6758
|
+
input,
|
|
6759
|
+
"telemetry.startRun"
|
|
6760
|
+
),
|
|
6761
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6762
|
+
});
|
|
6763
|
+
},
|
|
6764
|
+
finishRun(input, idempotencyKey) {
|
|
6765
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6766
|
+
cleanRequiredString(input.runId, "runId");
|
|
6767
|
+
return gateway.request({
|
|
6768
|
+
path: `/api/platform/v1/telemetry/runs/${encodeURIComponent(
|
|
6769
|
+
input.runId
|
|
6770
|
+
)}/finish`,
|
|
6771
|
+
method: "POST",
|
|
6772
|
+
body: body3(
|
|
6773
|
+
input,
|
|
6774
|
+
"telemetry.finishRun"
|
|
6775
|
+
),
|
|
6776
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6777
|
+
});
|
|
6778
|
+
},
|
|
6779
|
+
listRuns(input) {
|
|
6780
|
+
return gateway.request({
|
|
6781
|
+
path: `/api/platform/v1/telemetry/runs${toQueryString(query3(input))}`
|
|
6782
|
+
}).then(
|
|
6783
|
+
(response) => mapGatewayData(
|
|
6784
|
+
response,
|
|
6785
|
+
(data) => listResultFromEnvelope(data, "runs")
|
|
6786
|
+
)
|
|
6787
|
+
);
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
}
|
|
6791
|
+
|
|
6792
|
+
// src/toolRegistryClient.ts
|
|
6793
|
+
var TOOL_REGISTRY_FIELDS = [
|
|
6794
|
+
"tenantId",
|
|
6795
|
+
"workspaceId",
|
|
6796
|
+
"principalId",
|
|
6797
|
+
"toolName",
|
|
6798
|
+
"packKey",
|
|
6799
|
+
"packVersion",
|
|
6800
|
+
"status",
|
|
6801
|
+
"permissions",
|
|
6802
|
+
"role",
|
|
6803
|
+
"surface",
|
|
6804
|
+
"parameterSchema",
|
|
6805
|
+
"returnSchema",
|
|
6806
|
+
"handlerRef",
|
|
6807
|
+
"executionAdapter",
|
|
6808
|
+
"safetyMetadata",
|
|
6809
|
+
"aclId",
|
|
6810
|
+
"metadata",
|
|
6811
|
+
"limit",
|
|
6812
|
+
"cursor"
|
|
6813
|
+
];
|
|
6814
|
+
function query4(input) {
|
|
6815
|
+
return {
|
|
6816
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
6817
|
+
workspaceId: input.workspaceId,
|
|
6818
|
+
principalId: input.principalId,
|
|
6819
|
+
packKey: input.packKey,
|
|
6820
|
+
status: input.status,
|
|
6821
|
+
limit: input.limit,
|
|
6822
|
+
cursor: input.cursor
|
|
6823
|
+
};
|
|
6824
|
+
}
|
|
6825
|
+
function writeBody(input, operation) {
|
|
6826
|
+
return knownPayload(input, TOOL_REGISTRY_FIELDS, operation);
|
|
6827
|
+
}
|
|
6828
|
+
function createToolRegistryClient(config = {}) {
|
|
6829
|
+
const gateway = createGatewayRequestClient(config);
|
|
6830
|
+
return {
|
|
6831
|
+
listCatalog(input) {
|
|
6832
|
+
return gateway.request({
|
|
6833
|
+
path: `/api/platform/v1/tools/catalog${toQueryString(query4(input))}`
|
|
6834
|
+
}).then(
|
|
6835
|
+
(response) => mapGatewayData(
|
|
6836
|
+
response,
|
|
6837
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6838
|
+
)
|
|
6839
|
+
);
|
|
6840
|
+
},
|
|
6841
|
+
listExecutable(input) {
|
|
6842
|
+
return gateway.request({
|
|
6843
|
+
path: `/api/platform/v1/tools/executable${toQueryString(query4(input))}`
|
|
6844
|
+
}).then(
|
|
6845
|
+
(response) => mapGatewayData(
|
|
6846
|
+
response,
|
|
6847
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6848
|
+
)
|
|
6849
|
+
);
|
|
6850
|
+
},
|
|
6851
|
+
listEffectiveTools(input) {
|
|
6852
|
+
return gateway.request({
|
|
6853
|
+
path: `/api/platform/v1/tools/effective${toQueryString(query4(input))}`
|
|
6854
|
+
}).then(
|
|
6855
|
+
(response) => mapGatewayData(
|
|
6856
|
+
response,
|
|
6857
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6858
|
+
)
|
|
6859
|
+
);
|
|
6860
|
+
},
|
|
6861
|
+
upsertCoreTools(input, idempotencyKey) {
|
|
6862
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6863
|
+
return gateway.request({
|
|
6864
|
+
path: "/api/platform/v1/tools/core",
|
|
6865
|
+
method: "PUT",
|
|
6866
|
+
body: {
|
|
6867
|
+
tenantId: input.tenantId,
|
|
6868
|
+
workspaceId: input.workspaceId,
|
|
6869
|
+
metadata: input.metadata,
|
|
6870
|
+
tools: input.tools
|
|
6871
|
+
},
|
|
6872
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6873
|
+
}).then(
|
|
6874
|
+
(response) => mapGatewayData(
|
|
6875
|
+
response,
|
|
6876
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6877
|
+
)
|
|
6878
|
+
);
|
|
6879
|
+
},
|
|
6880
|
+
setPackToolsStatus(input, idempotencyKey) {
|
|
6881
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6882
|
+
cleanRequiredString(input.packKey, "packKey");
|
|
6883
|
+
return gateway.request({
|
|
6884
|
+
path: `/api/platform/v1/tools/packs/${encodeURIComponent(
|
|
6885
|
+
input.packKey
|
|
6886
|
+
)}/status`,
|
|
6887
|
+
method: "PATCH",
|
|
6888
|
+
body: writeBody(
|
|
6889
|
+
input,
|
|
6890
|
+
"tools.setPackToolsStatus"
|
|
6891
|
+
),
|
|
6892
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6893
|
+
}).then(
|
|
6894
|
+
(response) => mapGatewayData(
|
|
6895
|
+
response,
|
|
6896
|
+
(data) => listResultFromEnvelope(data, "tools")
|
|
6897
|
+
)
|
|
6898
|
+
);
|
|
6899
|
+
},
|
|
6900
|
+
createAcl(input, idempotencyKey) {
|
|
6901
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6902
|
+
cleanRequiredString(input.principalId, "principalId");
|
|
6903
|
+
cleanRequiredString(input.toolName, "toolName");
|
|
6904
|
+
return gateway.request({
|
|
6905
|
+
path: "/api/platform/v1/tools/acls",
|
|
6906
|
+
method: "POST",
|
|
6907
|
+
body: writeBody(
|
|
6908
|
+
input,
|
|
6909
|
+
"tools.createAcl"
|
|
6910
|
+
),
|
|
6911
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6912
|
+
});
|
|
6913
|
+
},
|
|
6914
|
+
deleteAcl(input, idempotencyKey) {
|
|
6915
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6916
|
+
cleanRequiredString(input.aclId, "aclId");
|
|
6917
|
+
return gateway.request({
|
|
6918
|
+
path: `/api/platform/v1/tools/acls/${encodeURIComponent(input.aclId)}`,
|
|
6919
|
+
method: "DELETE",
|
|
6920
|
+
body: writeBody(
|
|
6921
|
+
input,
|
|
6922
|
+
"tools.deleteAcl"
|
|
6923
|
+
),
|
|
6924
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6925
|
+
});
|
|
6926
|
+
},
|
|
6927
|
+
registerCustomTool(input, idempotencyKey) {
|
|
6928
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
6929
|
+
cleanRequiredString(input.toolName, "toolName");
|
|
6930
|
+
return gateway.request({
|
|
6931
|
+
path: "/api/platform/v1/tools/custom",
|
|
6932
|
+
method: "POST",
|
|
6933
|
+
body: writeBody(
|
|
6934
|
+
input,
|
|
6935
|
+
"tools.registerCustomTool"
|
|
6936
|
+
),
|
|
6937
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
6938
|
+
});
|
|
6939
|
+
}
|
|
6940
|
+
};
|
|
6941
|
+
}
|
|
6942
|
+
|
|
4950
6943
|
// src/version.ts
|
|
4951
6944
|
var LUCERN_SDK_VERSION = "0.2.0-alpha.1";
|
|
4952
6945
|
|
|
@@ -4964,10 +6957,10 @@ function createWorkflowClient(config = {}) {
|
|
|
4964
6957
|
/**
|
|
4965
6958
|
* List workflow branches for a topic scope.
|
|
4966
6959
|
*/
|
|
4967
|
-
async listBranches(
|
|
6960
|
+
async listBranches(query5) {
|
|
4968
6961
|
return gateway.request({
|
|
4969
6962
|
path: `/api/platform/v1/workflow/branches${toQueryString(
|
|
4970
|
-
normalizeTopicQuery(
|
|
6963
|
+
normalizeTopicQuery(query5)
|
|
4971
6964
|
)}`
|
|
4972
6965
|
}).then(
|
|
4973
6966
|
(response) => mapGatewayData(
|
|
@@ -4995,10 +6988,10 @@ function createWorkflowClient(config = {}) {
|
|
|
4995
6988
|
/**
|
|
4996
6989
|
* List reusable lenses for a workspace or topic scope.
|
|
4997
6990
|
*/
|
|
4998
|
-
async listLenses(
|
|
6991
|
+
async listLenses(query5) {
|
|
4999
6992
|
return gateway.request({
|
|
5000
6993
|
path: `/api/platform/v1/workflow/lenses${toQueryString(
|
|
5001
|
-
normalizeLensQuery(
|
|
6994
|
+
normalizeLensQuery(query5)
|
|
5002
6995
|
)}`
|
|
5003
6996
|
}).then(
|
|
5004
6997
|
(response) => mapGatewayData(
|
|
@@ -5070,14 +7063,14 @@ function createWorkflowClient(config = {}) {
|
|
|
5070
7063
|
/**
|
|
5071
7064
|
* List worktrees for a topic scope.
|
|
5072
7065
|
*/
|
|
5073
|
-
async listWorktrees(
|
|
5074
|
-
const normalized = normalizeTopicQuery(
|
|
7066
|
+
async listWorktrees(query5) {
|
|
7067
|
+
const normalized = normalizeTopicQuery(query5);
|
|
5075
7068
|
return gateway.request({
|
|
5076
7069
|
path: `/api/platform/v1/worktrees/all${toQueryString({
|
|
5077
7070
|
...normalized,
|
|
5078
|
-
groupBy:
|
|
5079
|
-
lane:
|
|
5080
|
-
campaign:
|
|
7071
|
+
groupBy: query5.groupBy,
|
|
7072
|
+
lane: query5.lane,
|
|
7073
|
+
campaign: query5.campaign
|
|
5081
7074
|
})}`
|
|
5082
7075
|
}).then(
|
|
5083
7076
|
(response) => mapGatewayData(
|
|
@@ -5092,14 +7085,14 @@ function createWorkflowClient(config = {}) {
|
|
|
5092
7085
|
/**
|
|
5093
7086
|
* List all worktrees across accessible topics.
|
|
5094
7087
|
*/
|
|
5095
|
-
async listAllWorktrees(
|
|
7088
|
+
async listAllWorktrees(query5 = {}) {
|
|
5096
7089
|
return gateway.request({
|
|
5097
7090
|
path: `/api/platform/v1/worktrees${toQueryString({
|
|
5098
|
-
status:
|
|
5099
|
-
groupBy:
|
|
5100
|
-
lane:
|
|
5101
|
-
campaign:
|
|
5102
|
-
limit:
|
|
7091
|
+
status: query5.status,
|
|
7092
|
+
groupBy: query5.groupBy,
|
|
7093
|
+
lane: query5.lane,
|
|
7094
|
+
campaign: query5.campaign,
|
|
7095
|
+
limit: query5.limit
|
|
5103
7096
|
})}`
|
|
5104
7097
|
}).then(
|
|
5105
7098
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -5119,10 +7112,10 @@ function createWorkflowClient(config = {}) {
|
|
|
5119
7112
|
/**
|
|
5120
7113
|
* List compact pipeline campaigns with nested lanes.
|
|
5121
7114
|
*/
|
|
5122
|
-
async listCampaigns(
|
|
7115
|
+
async listCampaigns(query5 = {}) {
|
|
5123
7116
|
return gateway.request({
|
|
5124
7117
|
path: `/api/platform/v1/worktrees/campaigns${toQueryString(
|
|
5125
|
-
normalizeTopicQuery(
|
|
7118
|
+
normalizeTopicQuery(query5)
|
|
5126
7119
|
)}`
|
|
5127
7120
|
});
|
|
5128
7121
|
},
|
|
@@ -5178,11 +7171,11 @@ function createWorkflowClient(config = {}) {
|
|
|
5178
7171
|
* Update targeted beliefs/questions for a worktree.
|
|
5179
7172
|
*/
|
|
5180
7173
|
async updateWorktreeTargets(input, idempotencyKey) {
|
|
5181
|
-
const { worktreeId, ...
|
|
7174
|
+
const { worktreeId, ...body4 } = input;
|
|
5182
7175
|
return gateway.request({
|
|
5183
7176
|
path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/targets`,
|
|
5184
7177
|
method: "POST",
|
|
5185
|
-
body,
|
|
7178
|
+
body: body4,
|
|
5186
7179
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
5187
7180
|
}).then(
|
|
5188
7181
|
(response) => mapGatewayData(
|
|
@@ -5271,11 +7264,11 @@ function createWorkflowClient(config = {}) {
|
|
|
5271
7264
|
/**
|
|
5272
7265
|
* List accessible topic contexts.
|
|
5273
7266
|
*/
|
|
5274
|
-
async listTopics(
|
|
7267
|
+
async listTopics(query5 = {}) {
|
|
5275
7268
|
return gateway.request({
|
|
5276
7269
|
path: `/api/platform/v1/workflow/topics${toQueryString({
|
|
5277
|
-
includeShared: typeof
|
|
5278
|
-
limit:
|
|
7270
|
+
includeShared: typeof query5.includeShared === "boolean" ? query5.includeShared ? "true" : "false" : void 0,
|
|
7271
|
+
limit: query5.limit
|
|
5279
7272
|
})}`
|
|
5280
7273
|
}).then(
|
|
5281
7274
|
(response) => mapGatewayData(response, (data) => {
|
|
@@ -5403,13 +7396,15 @@ function toGatewayConfig(config) {
|
|
|
5403
7396
|
requestIdFactory: config.requestIdFactory,
|
|
5404
7397
|
onRequest: config.onRequest,
|
|
5405
7398
|
onResponse: config.onResponse,
|
|
7399
|
+
authContext: config.authContext,
|
|
7400
|
+
requireCanonicalAuthContext: config.requireCanonicalAuthContext,
|
|
5406
7401
|
getAuthHeaders: async () => {
|
|
5407
7402
|
const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
|
|
5408
7403
|
if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
|
|
5409
7404
|
base["x-lucern-key"] = config.apiKey;
|
|
5410
7405
|
}
|
|
5411
|
-
if (config.userToken && !base["x-lucern-
|
|
5412
|
-
base["x-lucern-
|
|
7406
|
+
if (config.userToken && !base["x-lucern-session-token"]) {
|
|
7407
|
+
base["x-lucern-session-token"] = config.userToken;
|
|
5413
7408
|
}
|
|
5414
7409
|
if (config.environment && !base["x-lucern-environment"]) {
|
|
5415
7410
|
base["x-lucern-environment"] = config.environment;
|
|
@@ -5418,8 +7413,15 @@ function toGatewayConfig(config) {
|
|
|
5418
7413
|
}
|
|
5419
7414
|
};
|
|
5420
7415
|
}
|
|
5421
|
-
function
|
|
5422
|
-
const topicId = resolveTopicId(args);
|
|
7416
|
+
function requireTopicId4(args) {
|
|
7417
|
+
const topicId = resolveTopicId(args);
|
|
7418
|
+
if (!topicId) {
|
|
7419
|
+
throw new Error("topicId is required");
|
|
7420
|
+
}
|
|
7421
|
+
return topicId;
|
|
7422
|
+
}
|
|
7423
|
+
function requireTopicOrProjectId(args) {
|
|
7424
|
+
const topicId = args.topicId?.trim() || args.projectId?.trim() || void 0;
|
|
5423
7425
|
if (!topicId) {
|
|
5424
7426
|
throw new Error("topicId is required");
|
|
5425
7427
|
}
|
|
@@ -5460,18 +7462,41 @@ function requireBaseRate(args) {
|
|
|
5460
7462
|
function exposeGatewayData(response) {
|
|
5461
7463
|
return Object.assign({}, response, response.data);
|
|
5462
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
|
+
}
|
|
5463
7482
|
function createLucernClient(config = {}) {
|
|
5464
7483
|
const gatewayConfig = toGatewayConfig(config);
|
|
5465
7484
|
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
5466
7485
|
const sourcesClient = createSourcesClient(gatewayConfig);
|
|
5467
7486
|
const beliefsFacade = createBeliefsFacade(gatewayConfig);
|
|
5468
7487
|
const evidenceClient = createEvidenceClient(gatewayConfig);
|
|
7488
|
+
const embeddingsClient = createEmbeddingsClient(gatewayConfig);
|
|
7489
|
+
const eventingClient = createEventingClient(gatewayConfig);
|
|
5469
7490
|
const graphClient = createGraphClient(gatewayConfig);
|
|
7491
|
+
const graphAnalysisClient = createGraphAnalysisClient(gatewayConfig);
|
|
7492
|
+
const graphRecommendationsClient = createGraphRecommendationsClient(gatewayConfig);
|
|
7493
|
+
const graphStateClassifierClient = createGraphStateClassifierClient(gatewayConfig);
|
|
5470
7494
|
const graphFacade = createGraphFacade(gatewayConfig);
|
|
5471
7495
|
const decisionsClient = createDecisionsClient(gatewayConfig);
|
|
5472
7496
|
const contextClient = createContextClient(gatewayConfig);
|
|
5473
7497
|
const workflowClient = createWorkflowClient(gatewayConfig);
|
|
5474
7498
|
const auditClient = createAuditClient(gatewayConfig);
|
|
7499
|
+
const authDeviceClient = createAuthDeviceClient(gatewayConfig);
|
|
5475
7500
|
const adminClient = createAdminClient(gatewayConfig);
|
|
5476
7501
|
const answersClient = createAnswersClient(gatewayConfig);
|
|
5477
7502
|
const contradictionsFacade = createContradictionsFacade(gatewayConfig);
|
|
@@ -5489,10 +7514,17 @@ function createLucernClient(config = {}) {
|
|
|
5489
7514
|
const worktreesFacade = createWorktreesFacade(gatewayConfig);
|
|
5490
7515
|
const policyClient = createPolicyClient(gatewayConfig);
|
|
5491
7516
|
const ontologyClient = createOntologyClient(gatewayConfig);
|
|
7517
|
+
const ontologyLinksClient = createOntologyLinksClient(gatewayConfig);
|
|
7518
|
+
const orgGraphSearchClient = createOrgGraphSearchClient(gatewayConfig);
|
|
5492
7519
|
const functionSurfaceClient = createFunctionSurfaceClient(gatewayConfig);
|
|
7520
|
+
const toolRegistryClient = createToolRegistryClient(gatewayConfig);
|
|
7521
|
+
const modelRuntimeClient = createModelRuntimeClient(gatewayConfig);
|
|
5493
7522
|
const packsClient = createPacksClient(gatewayConfig);
|
|
5494
7523
|
const reportsClient = createReportsClient(gatewayConfig);
|
|
5495
7524
|
const learningClient = createLearningClient(gatewayConfig);
|
|
7525
|
+
const mcpClient = createMcpClient(gatewayConfig);
|
|
7526
|
+
const jobsClient = createJobsClient(gatewayConfig);
|
|
7527
|
+
const telemetryClient = createTelemetryClient(gatewayConfig);
|
|
5496
7528
|
const harnessClient = createHarnessClient(gatewayConfig);
|
|
5497
7529
|
const schemaClient = createSchemaClient(gatewayConfig);
|
|
5498
7530
|
const audiencesClient = createAudiencesClient(gatewayConfig);
|
|
@@ -5621,7 +7653,7 @@ function createLucernClient(config = {}) {
|
|
|
5621
7653
|
}
|
|
5622
7654
|
async function listBeliefs(args) {
|
|
5623
7655
|
const response = await beliefsFacade.list({
|
|
5624
|
-
topicId:
|
|
7656
|
+
topicId: requireTopicId4(args),
|
|
5625
7657
|
status: args.status,
|
|
5626
7658
|
worktreeId: args.worktreeId,
|
|
5627
7659
|
minConfidence: args.minConfidence,
|
|
@@ -5649,13 +7681,13 @@ function createLucernClient(config = {}) {
|
|
|
5649
7681
|
const results = groupedBeliefs.length > 0 ? groupedBeliefs : mergedResults.filter((result) => result.type === "belief");
|
|
5650
7682
|
return { results };
|
|
5651
7683
|
}
|
|
5652
|
-
async function searchResources(
|
|
7684
|
+
async function searchResources(query5, options = {}) {
|
|
5653
7685
|
const topicId = resolveTopicId(options);
|
|
5654
7686
|
if (!topicId) {
|
|
5655
7687
|
throw new Error("topicId is required");
|
|
5656
7688
|
}
|
|
5657
7689
|
return searchFacade.query({
|
|
5658
|
-
q:
|
|
7690
|
+
q: query5,
|
|
5659
7691
|
topicId,
|
|
5660
7692
|
types: options.types,
|
|
5661
7693
|
status: options.status,
|
|
@@ -5850,8 +7882,8 @@ function createLucernClient(config = {}) {
|
|
|
5850
7882
|
}).then(exposeGatewayData);
|
|
5851
7883
|
}
|
|
5852
7884
|
const nodesNamespace = {
|
|
5853
|
-
list(
|
|
5854
|
-
return graphClient.listNodes(
|
|
7885
|
+
list(query5) {
|
|
7886
|
+
return graphClient.listNodes(query5);
|
|
5855
7887
|
},
|
|
5856
7888
|
get(input) {
|
|
5857
7889
|
return graphClient.getNode(
|
|
@@ -5867,6 +7899,30 @@ function createLucernClient(config = {}) {
|
|
|
5867
7899
|
batchCreate(input, idempotencyKey) {
|
|
5868
7900
|
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
5869
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
|
+
},
|
|
5870
7926
|
supersede(input, idempotencyKey) {
|
|
5871
7927
|
return graphClient.supersedeNode(input, idempotencyKey);
|
|
5872
7928
|
},
|
|
@@ -5877,19 +7933,97 @@ function createLucernClient(config = {}) {
|
|
|
5877
7933
|
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
5878
7934
|
}
|
|
5879
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
|
+
};
|
|
5880
8008
|
return {
|
|
5881
8009
|
config,
|
|
5882
8010
|
version: LUCERN_SDK_VERSION,
|
|
5883
|
-
search(
|
|
5884
|
-
return searchResources(
|
|
8011
|
+
search(query5, options) {
|
|
8012
|
+
return searchResources(query5, options);
|
|
5885
8013
|
},
|
|
5886
8014
|
events: {
|
|
5887
|
-
list(
|
|
5888
|
-
return eventsFacade.list(
|
|
8015
|
+
list(query5 = {}) {
|
|
8016
|
+
return eventsFacade.list(query5).then(exposeGatewayData);
|
|
5889
8017
|
},
|
|
5890
8018
|
replay(input) {
|
|
5891
8019
|
return eventsFacade.replay(input).then(exposeGatewayData);
|
|
5892
|
-
}
|
|
8020
|
+
},
|
|
8021
|
+
recordEvent: eventingClient.recordEvent,
|
|
8022
|
+
listEvents: eventingClient.listEvents,
|
|
8023
|
+
listWebhooks: eventingClient.listWebhooks,
|
|
8024
|
+
enqueueDelivery: eventingClient.enqueueDelivery,
|
|
8025
|
+
recordDeliveryAttempt: eventingClient.recordDeliveryAttempt,
|
|
8026
|
+
updateDeliveryStatus: eventingClient.updateDeliveryStatus
|
|
5893
8027
|
},
|
|
5894
8028
|
beliefs: {
|
|
5895
8029
|
create(input) {
|
|
@@ -5958,7 +8092,7 @@ function createLucernClient(config = {}) {
|
|
|
5958
8092
|
},
|
|
5959
8093
|
list(args) {
|
|
5960
8094
|
return beliefsFacade.list({
|
|
5961
|
-
topicId:
|
|
8095
|
+
topicId: requireTopicId4(args),
|
|
5962
8096
|
worktreeId: args.worktreeId,
|
|
5963
8097
|
status: args.status,
|
|
5964
8098
|
minConfidence: args.minConfidence,
|
|
@@ -5987,8 +8121,8 @@ function createLucernClient(config = {}) {
|
|
|
5987
8121
|
create(input) {
|
|
5988
8122
|
return webhooksFacade.create(input).then(exposeGatewayData);
|
|
5989
8123
|
},
|
|
5990
|
-
list(
|
|
5991
|
-
return webhooksFacade.list(
|
|
8124
|
+
list(query5) {
|
|
8125
|
+
return webhooksFacade.list(query5).then(exposeGatewayData);
|
|
5992
8126
|
},
|
|
5993
8127
|
get(id) {
|
|
5994
8128
|
return webhooksFacade.get(id).then(exposeGatewayData);
|
|
@@ -6002,8 +8136,8 @@ function createLucernClient(config = {}) {
|
|
|
6002
8136
|
test(id, input) {
|
|
6003
8137
|
return webhooksFacade.test(id, input).then(exposeGatewayData);
|
|
6004
8138
|
},
|
|
6005
|
-
deliveries(id,
|
|
6006
|
-
return webhooksFacade.deliveries(id,
|
|
8139
|
+
deliveries(id, query5) {
|
|
8140
|
+
return webhooksFacade.deliveries(id, query5).then(exposeGatewayData);
|
|
6007
8141
|
},
|
|
6008
8142
|
health(id) {
|
|
6009
8143
|
return webhooksFacade.health(id).then(exposeGatewayData);
|
|
@@ -6158,7 +8292,7 @@ function createLucernClient(config = {}) {
|
|
|
6158
8292
|
},
|
|
6159
8293
|
list(args) {
|
|
6160
8294
|
return questionsFacade.list({
|
|
6161
|
-
topicId:
|
|
8295
|
+
topicId: requireTopicId4(args),
|
|
6162
8296
|
status: args.status,
|
|
6163
8297
|
priority: args.priority,
|
|
6164
8298
|
worktreeId: args.worktreeId,
|
|
@@ -6230,7 +8364,7 @@ function createLucernClient(config = {}) {
|
|
|
6230
8364
|
},
|
|
6231
8365
|
getHighPriority(args) {
|
|
6232
8366
|
return this.list({
|
|
6233
|
-
topicId:
|
|
8367
|
+
topicId: requireTopicId4(args),
|
|
6234
8368
|
status: args.includeAnswered ? void 0 : "open"
|
|
6235
8369
|
}).then((data) => {
|
|
6236
8370
|
const questions = Array.isArray(data.questions) ? data.questions : [];
|
|
@@ -6255,7 +8389,7 @@ function createLucernClient(config = {}) {
|
|
|
6255
8389
|
},
|
|
6256
8390
|
async findMissing(args) {
|
|
6257
8391
|
return graphFacade.gaps({
|
|
6258
|
-
topicId:
|
|
8392
|
+
topicId: requireTopicId4(args),
|
|
6259
8393
|
minConfidence: args.minConfidence
|
|
6260
8394
|
}).then(exposeGatewayData);
|
|
6261
8395
|
}
|
|
@@ -6286,21 +8420,21 @@ function createLucernClient(config = {}) {
|
|
|
6286
8420
|
},
|
|
6287
8421
|
analyze(args) {
|
|
6288
8422
|
return graphFacade.analyze({
|
|
6289
|
-
topicId:
|
|
8423
|
+
topicId: requireTopicId4(args),
|
|
6290
8424
|
limit: args.limit,
|
|
6291
8425
|
metric: args.metric
|
|
6292
8426
|
}).then(exposeGatewayData);
|
|
6293
8427
|
},
|
|
6294
8428
|
bias(args) {
|
|
6295
8429
|
return graphFacade.bias({
|
|
6296
|
-
topicId:
|
|
8430
|
+
topicId: requireTopicId4(args),
|
|
6297
8431
|
threshold: args.threshold,
|
|
6298
8432
|
limit: args.limit
|
|
6299
8433
|
}).then(exposeGatewayData);
|
|
6300
8434
|
},
|
|
6301
8435
|
gaps(args) {
|
|
6302
8436
|
return graphFacade.gaps({
|
|
6303
|
-
topicId:
|
|
8437
|
+
topicId: requireTopicId4(args),
|
|
6304
8438
|
minConfidence: args.minConfidence
|
|
6305
8439
|
}).then(exposeGatewayData);
|
|
6306
8440
|
},
|
|
@@ -6352,6 +8486,54 @@ function createLucernClient(config = {}) {
|
|
|
6352
8486
|
}));
|
|
6353
8487
|
}
|
|
6354
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
|
+
},
|
|
6355
8537
|
judgments: {
|
|
6356
8538
|
create(input) {
|
|
6357
8539
|
return decisionsClient.createJudgment(input);
|
|
@@ -6359,8 +8541,8 @@ function createLucernClient(config = {}) {
|
|
|
6359
8541
|
record(input) {
|
|
6360
8542
|
return decisionsClient.recordJudgment(input);
|
|
6361
8543
|
},
|
|
6362
|
-
list(
|
|
6363
|
-
return decisionsClient.listJudgments(
|
|
8544
|
+
list(query5) {
|
|
8545
|
+
return decisionsClient.listJudgments(query5);
|
|
6364
8546
|
},
|
|
6365
8547
|
get(judgmentId) {
|
|
6366
8548
|
return decisionsClient.getJudgment(judgmentId);
|
|
@@ -6389,10 +8571,56 @@ function createLucernClient(config = {}) {
|
|
|
6389
8571
|
transitionAuditIntegrity(args) {
|
|
6390
8572
|
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
6391
8573
|
...args,
|
|
6392
|
-
topicId:
|
|
8574
|
+
topicId: requireTopicId4(args)
|
|
6393
8575
|
});
|
|
6394
8576
|
}
|
|
6395
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
|
+
},
|
|
6396
8624
|
worktrees: {
|
|
6397
8625
|
createBranch(input) {
|
|
6398
8626
|
return workflowClient.createBranch(input);
|
|
@@ -6400,8 +8628,8 @@ function createLucernClient(config = {}) {
|
|
|
6400
8628
|
createLens(input) {
|
|
6401
8629
|
return workflowClient.createLens(input);
|
|
6402
8630
|
},
|
|
6403
|
-
listLenses(
|
|
6404
|
-
return workflowClient.listLenses(
|
|
8631
|
+
listLenses(query5) {
|
|
8632
|
+
return workflowClient.listLenses(query5);
|
|
6405
8633
|
},
|
|
6406
8634
|
applyLensToTopic(input) {
|
|
6407
8635
|
return workflowClient.applyLensToTopic(input);
|
|
@@ -6412,10 +8640,24 @@ function createLucernClient(config = {}) {
|
|
|
6412
8640
|
create(input) {
|
|
6413
8641
|
return worktreesFacade.create({
|
|
6414
8642
|
title: input.title,
|
|
6415
|
-
topicId:
|
|
8643
|
+
topicId: requireTopicId4(input),
|
|
6416
8644
|
objective: input.objective,
|
|
6417
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,
|
|
6418
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,
|
|
6419
8661
|
autoShape: input.autoShape,
|
|
6420
8662
|
domainPackId: input.domainPackId,
|
|
6421
8663
|
campaign: input.campaign,
|
|
@@ -6428,16 +8670,31 @@ function createLucernClient(config = {}) {
|
|
|
6428
8670
|
proofArtifacts: input.proofArtifacts,
|
|
6429
8671
|
staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
|
|
6430
8672
|
lastReconciledAt: input.lastReconciledAt,
|
|
6431
|
-
autoFixPolicy: input.autoFixPolicy
|
|
8673
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
8674
|
+
lensId: input.lensId
|
|
6432
8675
|
});
|
|
6433
8676
|
},
|
|
6434
8677
|
add(input) {
|
|
6435
8678
|
return worktreesFacade.create({
|
|
6436
8679
|
title: input.title,
|
|
6437
|
-
topicId:
|
|
8680
|
+
topicId: requireTopicId4(input),
|
|
6438
8681
|
objective: input.objective,
|
|
6439
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,
|
|
6440
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,
|
|
6441
8698
|
autoShape: input.autoShape,
|
|
6442
8699
|
domainPackId: input.domainPackId,
|
|
6443
8700
|
campaign: input.campaign,
|
|
@@ -6450,16 +8707,33 @@ function createLucernClient(config = {}) {
|
|
|
6450
8707
|
proofArtifacts: input.proofArtifacts,
|
|
6451
8708
|
staffingHint: typeof input.staffingHint === "string" ? input.staffingHint : void 0,
|
|
6452
8709
|
lastReconciledAt: input.lastReconciledAt,
|
|
6453
|
-
autoFixPolicy: input.autoFixPolicy
|
|
8710
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
8711
|
+
lensId: input.lensId
|
|
6454
8712
|
});
|
|
6455
8713
|
},
|
|
6456
|
-
list(
|
|
8714
|
+
list(query5) {
|
|
6457
8715
|
return worktreesFacade.list({
|
|
6458
|
-
topicId:
|
|
6459
|
-
status:
|
|
6460
|
-
limit:
|
|
8716
|
+
topicId: requireTopicId4(query5),
|
|
8717
|
+
status: query5.status,
|
|
8718
|
+
limit: query5.limit
|
|
6461
8719
|
});
|
|
6462
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
|
+
},
|
|
6463
8737
|
activate(worktreeId) {
|
|
6464
8738
|
return worktreesFacade.activate({ id: worktreeId });
|
|
6465
8739
|
},
|
|
@@ -6492,8 +8766,8 @@ function createLucernClient(config = {}) {
|
|
|
6492
8766
|
removeQuestionIds: input.removeQuestionIds
|
|
6493
8767
|
});
|
|
6494
8768
|
},
|
|
6495
|
-
listAll(
|
|
6496
|
-
return workflowClient.listAllWorktrees(
|
|
8769
|
+
listAll(query5 = {}) {
|
|
8770
|
+
return workflowClient.listAllWorktrees(query5);
|
|
6497
8771
|
},
|
|
6498
8772
|
merge(worktreeId, input) {
|
|
6499
8773
|
return worktreesFacade.merge({
|
|
@@ -6534,12 +8808,12 @@ function createLucernClient(config = {}) {
|
|
|
6534
8808
|
}
|
|
6535
8809
|
},
|
|
6536
8810
|
context: {
|
|
6537
|
-
listTopics(
|
|
8811
|
+
listTopics(query5 = {}) {
|
|
6538
8812
|
return topicsFacade.list({
|
|
6539
|
-
ontologyId:
|
|
6540
|
-
parentTopicId:
|
|
6541
|
-
status:
|
|
6542
|
-
type:
|
|
8813
|
+
ontologyId: query5.ontologyId,
|
|
8814
|
+
parentTopicId: query5.parentTopicId,
|
|
8815
|
+
status: query5.status,
|
|
8816
|
+
type: query5.type
|
|
6543
8817
|
});
|
|
6544
8818
|
},
|
|
6545
8819
|
compile(topicId, input = {}) {
|
|
@@ -6611,6 +8885,31 @@ function createLucernClient(config = {}) {
|
|
|
6611
8885
|
status: typeof input.status === "string" ? input.status : void 0,
|
|
6612
8886
|
limit: typeof input.limit === "number" ? input.limit : void 0
|
|
6613
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);
|
|
6614
8913
|
}
|
|
6615
8914
|
},
|
|
6616
8915
|
topics: {
|
|
@@ -6650,10 +8949,10 @@ function createLucernClient(config = {}) {
|
|
|
6650
8949
|
visibility: input.visibility
|
|
6651
8950
|
});
|
|
6652
8951
|
},
|
|
6653
|
-
tree(topicId,
|
|
8952
|
+
tree(topicId, query5 = {}) {
|
|
6654
8953
|
return topicsFacade.tree({
|
|
6655
8954
|
id: topicId,
|
|
6656
|
-
maxDepth:
|
|
8955
|
+
maxDepth: query5.maxDepth
|
|
6657
8956
|
});
|
|
6658
8957
|
},
|
|
6659
8958
|
getTree(input) {
|
|
@@ -6662,11 +8961,11 @@ function createLucernClient(config = {}) {
|
|
|
6662
8961
|
maxDepth: input.maxDepth
|
|
6663
8962
|
});
|
|
6664
8963
|
},
|
|
6665
|
-
coverage(topicId,
|
|
8964
|
+
coverage(topicId, query5 = {}) {
|
|
6666
8965
|
return topicsFacade.coverage({
|
|
6667
8966
|
id: topicId,
|
|
6668
|
-
includeDescendants:
|
|
6669
|
-
maxDepth:
|
|
8967
|
+
includeDescendants: query5.includeDescendants,
|
|
8968
|
+
maxDepth: query5.maxDepth
|
|
6670
8969
|
});
|
|
6671
8970
|
},
|
|
6672
8971
|
remove(topicId, idempotencyKey) {
|
|
@@ -6716,7 +9015,7 @@ function createLucernClient(config = {}) {
|
|
|
6716
9015
|
},
|
|
6717
9016
|
list(args) {
|
|
6718
9017
|
return contradictionsFacade.list({
|
|
6719
|
-
topicId:
|
|
9018
|
+
topicId: requireTopicId4(args),
|
|
6720
9019
|
status: args.status,
|
|
6721
9020
|
limit: args.limit,
|
|
6722
9021
|
cursor: args.cursor
|
|
@@ -6891,7 +9190,26 @@ function createLucernClient(config = {}) {
|
|
|
6891
9190
|
return functionSurfaceClient.generateSessionHandoff(input);
|
|
6892
9191
|
}
|
|
6893
9192
|
},
|
|
9193
|
+
embeddings: embeddingsClient,
|
|
9194
|
+
graphAnalysis: graphAnalysisClient,
|
|
9195
|
+
graphRecommendations: graphRecommendationsClient,
|
|
9196
|
+
orgGraphSearch: orgGraphSearchClient,
|
|
9197
|
+
ontologyLinks: ontologyLinksNamespace,
|
|
9198
|
+
graphStateClassifier: graphStateClassifierClient,
|
|
9199
|
+
modelRuntime: modelRuntimeClient,
|
|
9200
|
+
jobs: jobsClient,
|
|
9201
|
+
telemetry: telemetryClient,
|
|
9202
|
+
publication: publicationNamespace,
|
|
9203
|
+
contentPublication: publicationNamespace,
|
|
6894
9204
|
tools: {
|
|
9205
|
+
listCatalog: toolRegistryClient.listCatalog,
|
|
9206
|
+
listExecutable: toolRegistryClient.listExecutable,
|
|
9207
|
+
listEffectiveTools: toolRegistryClient.listEffectiveTools,
|
|
9208
|
+
upsertCoreTools: toolRegistryClient.upsertCoreTools,
|
|
9209
|
+
setPackToolsStatus: toolRegistryClient.setPackToolsStatus,
|
|
9210
|
+
createAcl: toolRegistryClient.createAcl,
|
|
9211
|
+
deleteAcl: toolRegistryClient.deleteAcl,
|
|
9212
|
+
registerCustomTool: toolRegistryClient.registerCustomTool,
|
|
6895
9213
|
register(registration) {
|
|
6896
9214
|
return registerCustomTool(registration);
|
|
6897
9215
|
},
|
|
@@ -6948,26 +9266,74 @@ function createLucernClient(config = {}) {
|
|
|
6948
9266
|
}
|
|
6949
9267
|
},
|
|
6950
9268
|
nodes: nodesNamespace,
|
|
6951
|
-
identity:
|
|
9269
|
+
identity: {
|
|
9270
|
+
...identityFacade,
|
|
9271
|
+
evaluatePolicy: identityClient.evaluatePolicy,
|
|
9272
|
+
recordPolicyDecision: identityClient.recordPolicyDecision,
|
|
9273
|
+
putSecretReference: identityClient.putSecretReference,
|
|
9274
|
+
createPrincipal: identityClient.createPrincipal,
|
|
9275
|
+
updatePrincipal: identityClient.updatePrincipal,
|
|
9276
|
+
raw: identityClient
|
|
9277
|
+
},
|
|
9278
|
+
mcp: {
|
|
9279
|
+
bootstrapSession(input) {
|
|
9280
|
+
return mcpClient.bootstrapSession(input);
|
|
9281
|
+
},
|
|
9282
|
+
checkWritePolicy(input) {
|
|
9283
|
+
return mcpClient.checkWritePolicy(input);
|
|
9284
|
+
},
|
|
9285
|
+
beginBuildSession(input) {
|
|
9286
|
+
return mcpClient.beginBuildSession(input);
|
|
9287
|
+
},
|
|
9288
|
+
evaluateEngineeringContract(input) {
|
|
9289
|
+
return mcpClient.evaluateEngineeringContract(input);
|
|
9290
|
+
},
|
|
9291
|
+
evaluateResearchContract(input) {
|
|
9292
|
+
return mcpClient.evaluateResearchContract(input);
|
|
9293
|
+
}
|
|
9294
|
+
},
|
|
9295
|
+
auth: {
|
|
9296
|
+
device: {
|
|
9297
|
+
createCode(input) {
|
|
9298
|
+
return authDeviceClient.createDeviceCode(input);
|
|
9299
|
+
},
|
|
9300
|
+
pollToken(deviceCode) {
|
|
9301
|
+
return authDeviceClient.pollDeviceToken(deviceCode);
|
|
9302
|
+
}
|
|
9303
|
+
}
|
|
9304
|
+
},
|
|
6952
9305
|
custom: getCustomNamespace("custom"),
|
|
6953
9306
|
extensions: extensionNamespaces,
|
|
6954
9307
|
raw: {
|
|
6955
9308
|
beliefs: beliefsClient,
|
|
6956
9309
|
sources: sourcesClient,
|
|
6957
9310
|
evidence: evidenceClient,
|
|
9311
|
+
embeddings: embeddingsClient,
|
|
9312
|
+
eventing: eventingClient,
|
|
6958
9313
|
graph: graphClient,
|
|
9314
|
+
graphAnalysis: graphAnalysisClient,
|
|
9315
|
+
graphRecommendations: graphRecommendationsClient,
|
|
9316
|
+
graphStateClassifier: graphStateClassifierClient,
|
|
6959
9317
|
decisions: decisionsClient,
|
|
6960
9318
|
workflow: workflowClient,
|
|
6961
9319
|
audit: auditClient,
|
|
9320
|
+
authDevice: authDeviceClient,
|
|
6962
9321
|
admin: adminClient,
|
|
6963
9322
|
identity: identityClient,
|
|
6964
9323
|
policy: policyClient,
|
|
6965
9324
|
answers: answersClient,
|
|
6966
9325
|
ontology: ontologyClient,
|
|
9326
|
+
ontologyLinks: ontologyLinksClient,
|
|
9327
|
+
orgGraphSearch: orgGraphSearchClient,
|
|
6967
9328
|
functionSurface: functionSurfaceClient,
|
|
9329
|
+
toolRegistry: toolRegistryClient,
|
|
9330
|
+
modelRuntime: modelRuntimeClient,
|
|
6968
9331
|
packs: packsClient,
|
|
6969
9332
|
reports: reportsClient,
|
|
6970
9333
|
learning: learningClient,
|
|
9334
|
+
mcp: mcpClient,
|
|
9335
|
+
jobs: jobsClient,
|
|
9336
|
+
telemetry: telemetryClient,
|
|
6971
9337
|
harness: harnessClient,
|
|
6972
9338
|
schema: schemaClient,
|
|
6973
9339
|
audiences: audiencesClient,
|
|
@@ -6977,7 +9343,7 @@ function createLucernClient(config = {}) {
|
|
|
6977
9343
|
}
|
|
6978
9344
|
|
|
6979
9345
|
// src/facade/context.ts
|
|
6980
|
-
function
|
|
9346
|
+
function cleanString6(value) {
|
|
6981
9347
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
6982
9348
|
}
|
|
6983
9349
|
function cleanNumber2(value) {
|
|
@@ -6988,15 +9354,15 @@ function cleanBoolean2(value) {
|
|
|
6988
9354
|
}
|
|
6989
9355
|
function buildCompileContextRequest2(topicId, input = {}) {
|
|
6990
9356
|
const payload = { topicId };
|
|
6991
|
-
const
|
|
6992
|
-
if (
|
|
6993
|
-
payload.query =
|
|
9357
|
+
const query5 = cleanString6(input.query);
|
|
9358
|
+
if (query5) {
|
|
9359
|
+
payload.query = query5;
|
|
6994
9360
|
}
|
|
6995
9361
|
const budget = cleanNumber2(input.budget) ?? cleanNumber2(input.tokenBudget);
|
|
6996
9362
|
if (budget !== void 0) {
|
|
6997
9363
|
payload.budget = budget;
|
|
6998
9364
|
}
|
|
6999
|
-
const ranking =
|
|
9365
|
+
const ranking = cleanString6(input.ranking) ?? cleanString6(input.rankingProfile);
|
|
7000
9366
|
if (ranking) {
|
|
7001
9367
|
payload.ranking = ranking;
|
|
7002
9368
|
}
|
|
@@ -7012,7 +9378,7 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
7012
9378
|
if (includeEntities !== void 0) {
|
|
7013
9379
|
payload.includeEntities = includeEntities;
|
|
7014
9380
|
}
|
|
7015
|
-
const mode =
|
|
9381
|
+
const mode = cleanString6(input.mode);
|
|
7016
9382
|
if (mode) {
|
|
7017
9383
|
payload.mode = mode;
|
|
7018
9384
|
}
|
|
@@ -7020,11 +9386,11 @@ function buildCompileContextRequest2(topicId, input = {}) {
|
|
|
7020
9386
|
if (includeFailures !== void 0) {
|
|
7021
9387
|
payload.includeFailures = includeFailures;
|
|
7022
9388
|
}
|
|
7023
|
-
const worktreeId =
|
|
9389
|
+
const worktreeId = cleanString6(input.worktreeId);
|
|
7024
9390
|
if (worktreeId) {
|
|
7025
9391
|
payload.worktreeId = worktreeId;
|
|
7026
9392
|
}
|
|
7027
|
-
const sessionId =
|
|
9393
|
+
const sessionId = cleanString6(input.sessionId);
|
|
7028
9394
|
if (sessionId) {
|
|
7029
9395
|
payload.sessionId = sessionId;
|
|
7030
9396
|
}
|
|
@@ -7614,11 +9980,11 @@ function toPositiveInt(value, fallback, max) {
|
|
|
7614
9980
|
const floored = Math.floor(value);
|
|
7615
9981
|
return Math.max(1, Math.min(floored, max));
|
|
7616
9982
|
}
|
|
7617
|
-
function normalizeQueryTokens(
|
|
7618
|
-
if (!
|
|
9983
|
+
function normalizeQueryTokens(query5) {
|
|
9984
|
+
if (!query5) {
|
|
7619
9985
|
return [];
|
|
7620
9986
|
}
|
|
7621
|
-
return
|
|
9987
|
+
return query5.toLowerCase().split(/[^a-z0-9]+/).map((token) => token.trim()).filter((token) => token.length >= 2);
|
|
7622
9988
|
}
|
|
7623
9989
|
function parseRankingProfile(value) {
|
|
7624
9990
|
return value === "baseline_v1" ? "baseline_v1" : "weighted_v1";
|
|
@@ -8608,6 +10974,15 @@ function buildDeprecatedBranchMetadata(args) {
|
|
|
8608
10974
|
|
|
8609
10975
|
// src/contracts/mcpTools.ts
|
|
8610
10976
|
var mcpTools_exports = {};
|
|
10977
|
+
__export(mcpTools_exports, {
|
|
10978
|
+
MCP_ALWAYS_ALLOWED_TOOL_NAMES: () => MCP_ALWAYS_ALLOWED_TOOL_NAMES,
|
|
10979
|
+
buildMcpToolContracts: () => buildMcpToolContracts,
|
|
10980
|
+
buildMcpToolManifest: () => buildMcpToolManifest,
|
|
10981
|
+
getMcpToolExposure: () => getMcpToolExposure,
|
|
10982
|
+
isMcpToolAllowed: () => isMcpToolAllowed,
|
|
10983
|
+
mcpContractToInputSchema: () => mcpContractToInputSchema,
|
|
10984
|
+
mcpContractToManifestEntry: () => mcpContractToManifestEntry
|
|
10985
|
+
});
|
|
8611
10986
|
|
|
8612
10987
|
// src/contracts/tool-contracts.ts
|
|
8613
10988
|
var tool_contracts_exports = {};
|
|
@@ -8615,6 +10990,92 @@ __reExport(tool_contracts_exports, tool_contracts_star);
|
|
|
8615
10990
|
|
|
8616
10991
|
// src/contracts/mcpTools.ts
|
|
8617
10992
|
__reExport(mcpTools_exports, tool_contracts_exports);
|
|
10993
|
+
var OPERATION_MANIFEST = LUCERN_OPERATION_MANIFEST;
|
|
10994
|
+
var MCP_ALWAYS_ALLOWED_TOOL_NAMES = ["identity_whoami"];
|
|
10995
|
+
function getMcpToolExposure(toolName) {
|
|
10996
|
+
return OPERATION_MANIFEST[toolName]?.surfaces.mcp ?? "none";
|
|
10997
|
+
}
|
|
10998
|
+
function decorateMcpToolContract(toolName, contract) {
|
|
10999
|
+
const exposure = getMcpToolExposure(toolName);
|
|
11000
|
+
if (exposure === "none") {
|
|
11001
|
+
return null;
|
|
11002
|
+
}
|
|
11003
|
+
return exposure === "internal" || contract.internal ? { ...contract, internal: true } : contract;
|
|
11004
|
+
}
|
|
11005
|
+
function buildMcpToolContracts(options = {}) {
|
|
11006
|
+
const merged = {
|
|
11007
|
+
...tool_contracts_exports.MCP_TOOL_CONTRACTS,
|
|
11008
|
+
...options.extensions ?? {}
|
|
11009
|
+
};
|
|
11010
|
+
return Object.fromEntries(
|
|
11011
|
+
Object.entries(merged).flatMap(([toolName, contract]) => {
|
|
11012
|
+
const decorated = decorateMcpToolContract(toolName, contract);
|
|
11013
|
+
return decorated ? [[toolName, decorated]] : [];
|
|
11014
|
+
})
|
|
11015
|
+
);
|
|
11016
|
+
}
|
|
11017
|
+
function mcpContractToInputSchema(contract) {
|
|
11018
|
+
const properties = {};
|
|
11019
|
+
for (const [paramName, paramDef] of Object.entries(contract.parameters)) {
|
|
11020
|
+
const prop = {
|
|
11021
|
+
type: paramDef.type,
|
|
11022
|
+
description: paramDef.description
|
|
11023
|
+
};
|
|
11024
|
+
if (paramDef.enum) {
|
|
11025
|
+
prop.enum = paramDef.enum;
|
|
11026
|
+
}
|
|
11027
|
+
properties[paramName] = prop;
|
|
11028
|
+
}
|
|
11029
|
+
return {
|
|
11030
|
+
type: "object",
|
|
11031
|
+
properties,
|
|
11032
|
+
required: contract.required
|
|
11033
|
+
};
|
|
11034
|
+
}
|
|
11035
|
+
function mcpContractToManifestEntry(name, contract) {
|
|
11036
|
+
return {
|
|
11037
|
+
name,
|
|
11038
|
+
description: contract.description,
|
|
11039
|
+
inputSchema: mcpContractToInputSchema(contract),
|
|
11040
|
+
internal: Boolean(contract.internal),
|
|
11041
|
+
ownerModule: contract.ownerModule,
|
|
11042
|
+
ontologyPrimitive: contract.ontologyPrimitive,
|
|
11043
|
+
tier: contract.tier
|
|
11044
|
+
};
|
|
11045
|
+
}
|
|
11046
|
+
function isMcpToolAllowed(toolName, options = {}) {
|
|
11047
|
+
const contracts = options.contracts ?? buildMcpToolContracts();
|
|
11048
|
+
const contract = contracts[toolName];
|
|
11049
|
+
const alwaysAllowed = /* @__PURE__ */ new Set([
|
|
11050
|
+
...MCP_ALWAYS_ALLOWED_TOOL_NAMES,
|
|
11051
|
+
...options.alwaysAllowedTools ?? []
|
|
11052
|
+
]);
|
|
11053
|
+
if (alwaysAllowed.has(toolName)) {
|
|
11054
|
+
return true;
|
|
11055
|
+
}
|
|
11056
|
+
if (options.sessionType === "user" && contract?.internal) {
|
|
11057
|
+
return false;
|
|
11058
|
+
}
|
|
11059
|
+
if (options.permittedTools !== void 0 && options.permittedTools !== null) {
|
|
11060
|
+
return options.permittedTools.some((tool) => tool.toolName === toolName);
|
|
11061
|
+
}
|
|
11062
|
+
if (options.allowedTools === null || options.allowedTools === void 0) {
|
|
11063
|
+
return true;
|
|
11064
|
+
}
|
|
11065
|
+
return options.allowedTools.includes(toolName);
|
|
11066
|
+
}
|
|
11067
|
+
function buildMcpToolManifest(args = {}) {
|
|
11068
|
+
const contracts = args.contracts ?? buildMcpToolContracts();
|
|
11069
|
+
return Object.entries(contracts).filter(([name, contract]) => {
|
|
11070
|
+
if (args.visibility?.sessionType === "user" && contract.internal) {
|
|
11071
|
+
return false;
|
|
11072
|
+
}
|
|
11073
|
+
return isMcpToolAllowed(name, {
|
|
11074
|
+
...args.visibility,
|
|
11075
|
+
contracts
|
|
11076
|
+
});
|
|
11077
|
+
}).map(([name, contract]) => mcpContractToManifestEntry(name, contract));
|
|
11078
|
+
}
|
|
8618
11079
|
|
|
8619
11080
|
// src/index.ts
|
|
8620
11081
|
__reExport(src_exports, mcpTools_exports);
|
|
@@ -9125,15 +11586,15 @@ function serializeTypes2(types) {
|
|
|
9125
11586
|
function createEventsClientCore(config = {}) {
|
|
9126
11587
|
const gateway = createGatewayRequestClient(config);
|
|
9127
11588
|
return {
|
|
9128
|
-
async list(
|
|
11589
|
+
async list(query5 = {}) {
|
|
9129
11590
|
return gateway.request({
|
|
9130
11591
|
path: `/v1/events${toQueryString({
|
|
9131
|
-
topicId:
|
|
9132
|
-
after:
|
|
9133
|
-
types: serializeTypes2(
|
|
9134
|
-
startTime:
|
|
9135
|
-
endTime:
|
|
9136
|
-
limit:
|
|
11592
|
+
topicId: query5.topicId,
|
|
11593
|
+
after: query5.after,
|
|
11594
|
+
types: serializeTypes2(query5.types),
|
|
11595
|
+
startTime: query5.startTime,
|
|
11596
|
+
endTime: query5.endTime,
|
|
11597
|
+
limit: query5.limit
|
|
9137
11598
|
})}`
|
|
9138
11599
|
});
|
|
9139
11600
|
},
|
|
@@ -9158,10 +11619,10 @@ function createWebhooksClientCore(config = {}) {
|
|
|
9158
11619
|
idempotencyKey
|
|
9159
11620
|
});
|
|
9160
11621
|
},
|
|
9161
|
-
async list(
|
|
11622
|
+
async list(query5 = {}) {
|
|
9162
11623
|
return gateway.request({
|
|
9163
11624
|
path: `/v1/webhooks${toQueryString({
|
|
9164
|
-
topicId:
|
|
11625
|
+
topicId: query5.topicId
|
|
9165
11626
|
})}`
|
|
9166
11627
|
});
|
|
9167
11628
|
},
|
|
@@ -9193,10 +11654,10 @@ function createWebhooksClientCore(config = {}) {
|
|
|
9193
11654
|
idempotencyKey
|
|
9194
11655
|
});
|
|
9195
11656
|
},
|
|
9196
|
-
async deliveries(id,
|
|
11657
|
+
async deliveries(id, query5 = {}) {
|
|
9197
11658
|
return gateway.request({
|
|
9198
11659
|
path: `/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
|
|
9199
|
-
limit:
|
|
11660
|
+
limit: query5.limit
|
|
9200
11661
|
})}`
|
|
9201
11662
|
});
|
|
9202
11663
|
},
|
|
@@ -9207,7 +11668,291 @@ function createWebhooksClientCore(config = {}) {
|
|
|
9207
11668
|
}
|
|
9208
11669
|
};
|
|
9209
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
|
+
}
|
|
9210
11955
|
|
|
9211
|
-
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, EDGE_TYPES, EPISTEMIC_EDGE_TYPES, EPISTEMIC_LAYERS, EVENT_RETENTION_DEFAULT_DAYS, FORK_REASONS, FUNCTION_SURFACE_METHOD_PATHS, JUDGMENT_TYPES, LENS_PERSPECTIVE_TYPES, LENS_STATUSES, LENS_TASK_TEMPLATE_PRIORITIES, LUCERN_SDK_VERSION, LucernApiError, MAX_ENTITY_LIMIT, MERGE_OUTCOMES, MORNING_BRIEF_WORKFLOW_ID, NIGHTLY_RECONCILIATION_WORKFLOW_ID, REASONING_METHODS, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, STRUCTURAL_EDGE_TYPES, 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, clearRegisteredCustomTools, compareEventCursor, compileContextPackFromSnapshot, computeWebhookSignature, createAdminClient, createAnswersClient, createAudiencesClient, createAuditClient, createBeliefsClient, createContextClient, createContextFacade, createDecisionsClient, createEventId, createEventsClientCore, createEvidenceClient, createFunctionSurfaceClient, createGatewayRequestClient, createGraphClient, createHarnessClient, createIdentityClient, createLearningClient, createListResult, createLucernClient, createOntologyClient, createPacksClient, createPolicyClient, createReportsClient, createSchemaClient, createSourcesClient, createTopicsClient, createWebhooksClientCore, createWorkflowClient, decodeEventCursor, emitDomainEvent, encodeEventCursor, eventPatternToRegExp, getControlObjectOwnershipCase, getRegisteredCustomTool, inferActorType, inferLensPerspectiveTypeFromBranchSchema, inferSessionPrincipalType, invokeRegisteredCustomTool, isAfterCursor, isLensFilterCriteria, isLucernPrompt, isTaxonomyFilterCriteriaV1, lastDelegator, listControlObjectOwnershipCases, listRegisteredCustomTools, mapAliasedList, mapGatewayData, mapOpinionHistoryEntriesFromGatewayData, matchesAnyEventPattern, matchesEventPattern, migrateBranchToLens, nextDeliveryAttemptAt, 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 };
|
|
9212
11957
|
//# sourceMappingURL=index.js.map
|
|
9213
11958
|
//# sourceMappingURL=index.js.map
|