@lucern/sdk 0.2.0-alpha.6 → 0.2.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +13 -0
- package/examples/README.md +69 -0
- package/examples/contradiction.ts +94 -0
- package/examples/investigation-context.ts +118 -0
- package/examples/questions-and-tasks.ts +55 -0
- package/examples/quickstart.ts +97 -0
- package/examples/shared.ts +318 -0
- package/examples/strict-public-types.ts +143 -0
- package/examples/worktree-lifecycle.ts +79 -0
- package/package.json +16 -58
- package/src/README.md +6 -0
- package/src/adminClient.ts +789 -0
- package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
- package/src/audiencesClient.ts +209 -0
- package/src/auditClient.ts +50 -0
- package/src/beliefsClient.ts +319 -0
- package/src/client.ts +2647 -0
- package/src/contextClient.ts +130 -0
- package/{dist/lib/platform/sdk/contextFacade.d.ts → src/contextFacade.ts} +6 -1
- package/src/contextPackCompiler.ts +828 -0
- package/src/contextPackSchema.ts +251 -0
- package/src/contextTypes.ts +153 -0
- package/src/contracts/api-enums.contract.ts +202 -0
- package/src/contracts/auth-session.contract.ts +109 -0
- package/src/contracts/context-pack.contract.ts +700 -0
- package/src/contracts/contextPack.ts +1 -0
- package/src/contracts/index.ts +10 -0
- package/src/contracts/lens-filter.contract.ts +183 -0
- package/src/contracts/lens-workflow.contract.ts +162 -0
- package/src/contracts/lensFilter.ts +1 -0
- package/src/contracts/lensWorkflow.ts +1 -0
- package/src/contracts/mcp-tools.contract.ts +3636 -0
- package/src/contracts/mcpTools.ts +1 -0
- package/src/contracts/prompt.contract.ts +50 -0
- package/src/contracts/prompt.ts +1 -0
- package/src/contracts/sdk-tools.contract.ts +1457 -0
- package/src/contracts/sdkTools.ts +1 -0
- package/src/contracts/workflow-runtime.contract.ts +440 -0
- package/src/contracts/workflowRuntime.ts +1 -0
- package/src/controlObjectOwnership.ts +286 -0
- package/src/coreClient.ts +570 -0
- package/src/customTools.ts +398 -0
- package/src/decisionsClient.ts +286 -0
- package/src/domainContext.ts +15 -0
- package/src/events.ts +531 -0
- package/src/eventsCore.ts +168 -0
- package/src/facade/beliefs.ts +83 -0
- package/src/facade/context.ts +110 -0
- package/src/facade/contradictions.ts +29 -0
- package/src/facade/edges.ts +30 -0
- package/src/facade/events.ts +23 -0
- package/src/facade/evidence.ts +41 -0
- package/src/facade/graph.ts +38 -0
- package/src/facade/identity.ts +16 -0
- package/src/facade/ontologies.ts +34 -0
- package/src/facade/questions.ts +59 -0
- package/src/facade/search.ts +16 -0
- package/src/facade/tasks.ts +37 -0
- package/src/facade/topics.ts +42 -0
- package/src/facade/webhooks.ts +58 -0
- package/src/facade/worktrees.ts +51 -0
- package/src/gatewayFacades.ts +1666 -0
- package/src/graphClient.ts +529 -0
- package/src/harnessClient.ts +585 -0
- package/src/identityClient.ts +278 -0
- package/src/learningClient.ts +95 -0
- package/src/mcpParityClient.ts +240 -0
- package/src/mcpParitySurface.ts +70 -0
- package/src/ontologyClient.ts +275 -0
- package/src/packRuntime.ts +3 -0
- package/src/packsClient.ts +260 -0
- package/src/policyClient.ts +572 -0
- package/src/realtime/index.ts +51 -0
- package/src/realtime/refs.ts +17 -0
- package/src/reportsClient.ts +99 -0
- package/src/schemaClient.ts +129 -0
- package/src/sdkSurface.ts +190 -0
- package/src/topicsClient.ts +243 -0
- package/src/types.ts +807 -0
- package/src/workflowClient.ts +826 -0
- package/tsconfig.json +9 -0
- package/dist/.generated +0 -2
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/lib/platform/auth/credentials.d.ts +0 -5
- package/dist/lib/platform/auth/credentials.js +0 -40
- package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
- package/dist/lib/platform/sdk/adminClient.js +0 -384
- package/dist/lib/platform/sdk/answersClient.js +0 -21
- package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
- package/dist/lib/platform/sdk/audiencesClient.js +0 -111
- package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
- package/dist/lib/platform/sdk/auditClient.js +0 -21
- package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
- package/dist/lib/platform/sdk/beliefsClient.js +0 -124
- package/dist/lib/platform/sdk/client.d.ts +0 -2369
- package/dist/lib/platform/sdk/client.js +0 -1831
- package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
- package/dist/lib/platform/sdk/contextClient.js +0 -86
- package/dist/lib/platform/sdk/contextFacade.js +0 -10
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
- package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
- package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
- package/dist/lib/platform/sdk/contextTypes.js +0 -1
- package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
- package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
- package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
- package/dist/lib/platform/sdk/coreClient.js +0 -366
- package/dist/lib/platform/sdk/customTools.d.ts +0 -83
- package/dist/lib/platform/sdk/customTools.js +0 -247
- package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
- package/dist/lib/platform/sdk/decisionsClient.js +0 -129
- package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
- package/dist/lib/platform/sdk/domainContext.js +0 -1
- package/dist/lib/platform/sdk/events.d.ts +0 -176
- package/dist/lib/platform/sdk/events.js +0 -261
- package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
- package/dist/lib/platform/sdk/eventsCore.js +0 -13
- package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
- package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
- package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
- package/dist/lib/platform/sdk/graphClient.js +0 -235
- package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
- package/dist/lib/platform/sdk/harnessClient.js +0 -219
- package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
- package/dist/lib/platform/sdk/identityClient.js +0 -131
- package/dist/lib/platform/sdk/index.js +0 -49
- package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
- package/dist/lib/platform/sdk/learningClient.js +0 -53
- package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
- package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
- package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
- package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
- package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
- package/dist/lib/platform/sdk/ontologyClient.js +0 -161
- package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
- package/dist/lib/platform/sdk/packRuntime.js +0 -1
- package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
- package/dist/lib/platform/sdk/packsClient.js +0 -157
- package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
- package/dist/lib/platform/sdk/policyClient.js +0 -277
- package/dist/lib/platform/sdk/promptCatalog.js +0 -1
- package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
- package/dist/lib/platform/sdk/reportsClient.js +0 -64
- package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
- package/dist/lib/platform/sdk/schemaClient.js +0 -71
- package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
- package/dist/lib/platform/sdk/sdkSurface.js +0 -140
- package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
- package/dist/lib/platform/sdk/topicsClient.js +0 -118
- package/dist/lib/platform/sdk/types.d.ts +0 -692
- package/dist/lib/platform/sdk/types.js +0 -1
- package/dist/lib/platform/sdk/version.d.ts +0 -2
- package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
- package/dist/lib/platform/sdk/workflowClient.js +0 -366
- package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
- package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
- package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
- package/dist/lucern/contracts/src/auth.contract.js +0 -57
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
- package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
- package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
- package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/events-types.contract.js +0 -8
- package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
- package/dist/lucern/contracts/src/events.contract.js +0 -159
- package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
- package/dist/lucern/contracts/src/gateway.contract.js +0 -19
- package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
- package/dist/lucern/contracts/src/ids.contract.js +0 -24
- package/dist/lucern/contracts/src/index.d.ts +0 -29
- package/dist/lucern/contracts/src/index.js +0 -29
- package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
- package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
- package/dist/lucern/contracts/src/prompt.contract.d.ts +0 -24
- package/dist/lucern/contracts/src/prompt.contract.js +0 -24
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
- package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
- package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
- package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
- package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
- package/dist/realtime-refs.d.ts +0 -1
- package/dist/realtime-refs.js +0 -1
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +0 -1
- /package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +0 -0
- /package/{dist/lib/platform/sdk/promptCatalog.d.ts → src/promptCatalog.ts} +0 -0
- /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,2647 @@
|
|
|
1
|
+
import { type AdminClientConfig, createAdminClient } from "./adminClient";
|
|
2
|
+
import {
|
|
3
|
+
type AnswersClientConfig,
|
|
4
|
+
createAnswersClient,
|
|
5
|
+
} from "./answersClient";
|
|
6
|
+
import {
|
|
7
|
+
type AudiencesClientConfig,
|
|
8
|
+
createAudiencesClient,
|
|
9
|
+
} from "./audiencesClient";
|
|
10
|
+
import { type AuditClientConfig, createAuditClient } from "./auditClient";
|
|
11
|
+
import {
|
|
12
|
+
type BeliefsClientConfig,
|
|
13
|
+
createBeliefsClient,
|
|
14
|
+
} from "./beliefsClient";
|
|
15
|
+
import {
|
|
16
|
+
createGatewayRequestClient,
|
|
17
|
+
type GatewayClientConfig,
|
|
18
|
+
LucernApiError,
|
|
19
|
+
type PlatformGatewaySuccess,
|
|
20
|
+
randomIdempotencyKey,
|
|
21
|
+
toQueryString,
|
|
22
|
+
} from "./coreClient";
|
|
23
|
+
import {
|
|
24
|
+
type CustomToolRegistration,
|
|
25
|
+
clearRegisteredCustomTools,
|
|
26
|
+
invokeRegisteredCustomTool,
|
|
27
|
+
listRegisteredCustomTools,
|
|
28
|
+
registerCustomTool,
|
|
29
|
+
unregisterCustomTool,
|
|
30
|
+
} from "./customTools";
|
|
31
|
+
import {
|
|
32
|
+
createBeliefsFacade,
|
|
33
|
+
createContradictionsFacade,
|
|
34
|
+
createEdgesFacade,
|
|
35
|
+
createEvidenceFacade,
|
|
36
|
+
createEventsFacade,
|
|
37
|
+
createGraphFacade,
|
|
38
|
+
createIdentityFacade,
|
|
39
|
+
createOntologiesFacade,
|
|
40
|
+
createQuestionsFacade,
|
|
41
|
+
createSearchFacade,
|
|
42
|
+
createTasksFacade,
|
|
43
|
+
createTopicsFacade,
|
|
44
|
+
createWebhooksFacade,
|
|
45
|
+
createWorktreesFacade,
|
|
46
|
+
} from "./gatewayFacades";
|
|
47
|
+
import {
|
|
48
|
+
createDecisionsClient,
|
|
49
|
+
type DecisionsClientConfig,
|
|
50
|
+
type RecordJudgmentInput,
|
|
51
|
+
} from "./decisionsClient";
|
|
52
|
+
import {
|
|
53
|
+
createContextClient,
|
|
54
|
+
type ContextClientConfig,
|
|
55
|
+
} from "./contextClient";
|
|
56
|
+
import { createGraphClient, type GraphClientConfig } from "./graphClient";
|
|
57
|
+
import { createHarnessClient, type HarnessClientConfig } from "./harnessClient";
|
|
58
|
+
import {
|
|
59
|
+
createIdentityClient,
|
|
60
|
+
type IdentityClientConfig,
|
|
61
|
+
} from "./identityClient";
|
|
62
|
+
import {
|
|
63
|
+
createLearningClient,
|
|
64
|
+
type LearningClientConfig,
|
|
65
|
+
} from "./learningClient";
|
|
66
|
+
import {
|
|
67
|
+
createMcpParityClient,
|
|
68
|
+
type McpParityClientConfig,
|
|
69
|
+
} from "./mcpParityClient";
|
|
70
|
+
import {
|
|
71
|
+
createOntologyClient,
|
|
72
|
+
type OntologyClientConfig,
|
|
73
|
+
} from "./ontologyClient";
|
|
74
|
+
import { createPacksClient, type PacksClientConfig } from "./packsClient";
|
|
75
|
+
import { createPolicyClient, type PolicyClientConfig } from "./policyClient";
|
|
76
|
+
import { createReportsClient, type ReportsClientConfig } from "./reportsClient";
|
|
77
|
+
import { createSchemaClient, type SchemaClientConfig } from "./schemaClient";
|
|
78
|
+
import { asListItems, resolveText, resolveTopicId } from "./sdkSurface";
|
|
79
|
+
import { createTopicsClient, type TopicsClientConfig } from "./topicsClient";
|
|
80
|
+
import type {
|
|
81
|
+
JsonObject,
|
|
82
|
+
PlatformGraphEdge,
|
|
83
|
+
PlatformGraphNode,
|
|
84
|
+
} from "./types";
|
|
85
|
+
import { LUCERN_SDK_VERSION } from "./version";
|
|
86
|
+
import {
|
|
87
|
+
type AddWorktreeInput,
|
|
88
|
+
type CompleteTaskInput,
|
|
89
|
+
type CreateTaskInput,
|
|
90
|
+
createWorkflowClient,
|
|
91
|
+
type MergeInput,
|
|
92
|
+
type UpdateTaskInput,
|
|
93
|
+
type WorkflowClientConfig,
|
|
94
|
+
} from "./workflowClient";
|
|
95
|
+
|
|
96
|
+
type ClientConfig =
|
|
97
|
+
| BeliefsClientConfig
|
|
98
|
+
| GraphClientConfig
|
|
99
|
+
| DecisionsClientConfig
|
|
100
|
+
| AnswersClientConfig
|
|
101
|
+
| ContextClientConfig
|
|
102
|
+
| WorkflowClientConfig
|
|
103
|
+
| AuditClientConfig
|
|
104
|
+
| AdminClientConfig
|
|
105
|
+
| IdentityClientConfig
|
|
106
|
+
| PolicyClientConfig
|
|
107
|
+
| PacksClientConfig
|
|
108
|
+
| ReportsClientConfig
|
|
109
|
+
| LearningClientConfig
|
|
110
|
+
| McpParityClientConfig
|
|
111
|
+
| OntologyClientConfig
|
|
112
|
+
| HarnessClientConfig
|
|
113
|
+
| SchemaClientConfig
|
|
114
|
+
| AudiencesClientConfig
|
|
115
|
+
| TopicsClientConfig;
|
|
116
|
+
|
|
117
|
+
type NodeLike = PlatformGraphNode;
|
|
118
|
+
type EdgeLike = PlatformGraphEdge;
|
|
119
|
+
type CustomToolInput = JsonObject;
|
|
120
|
+
type CustomToolInvoker = (input?: CustomToolInput) => Promise<unknown>;
|
|
121
|
+
type CustomToolNamespace = Record<string, CustomToolInvoker>;
|
|
122
|
+
type GatewayDataEnvelope<T extends Record<string, unknown>> =
|
|
123
|
+
PlatformGatewaySuccess<T> & T;
|
|
124
|
+
|
|
125
|
+
type BeliefsCompatCreateInput = {
|
|
126
|
+
topicId?: string;
|
|
127
|
+
text?: string;
|
|
128
|
+
canonicalText?: string;
|
|
129
|
+
formulation?: string;
|
|
130
|
+
rationale?: string;
|
|
131
|
+
worktreeId?: string;
|
|
132
|
+
pillar?: string;
|
|
133
|
+
sourceBeliefIds?: string[];
|
|
134
|
+
sourceType?: string;
|
|
135
|
+
beliefType?: string;
|
|
136
|
+
reversibility?: string;
|
|
137
|
+
predictionMeta?: JsonObject;
|
|
138
|
+
metadata?: JsonObject;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
type BeliefsCompatForkInput = {
|
|
142
|
+
text?: string;
|
|
143
|
+
newFormulation?: string;
|
|
144
|
+
formulation?: string;
|
|
145
|
+
forkReason?:
|
|
146
|
+
| "refinement"
|
|
147
|
+
| "contradiction_response"
|
|
148
|
+
| "scope_change"
|
|
149
|
+
| "confidence_collapse"
|
|
150
|
+
| "manual";
|
|
151
|
+
rationale?: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type BeliefsCompatUpdateConfidenceInput = {
|
|
155
|
+
confidence: number;
|
|
156
|
+
trigger?:
|
|
157
|
+
| "evidence_added"
|
|
158
|
+
| "evidence_removed"
|
|
159
|
+
| "contradiction_detected"
|
|
160
|
+
| "contradiction_resolved"
|
|
161
|
+
| "manual"
|
|
162
|
+
| "decay"
|
|
163
|
+
| "agent_assessment"
|
|
164
|
+
| "merge_outcome"
|
|
165
|
+
| "worktree_outcome"
|
|
166
|
+
| "worktree_completed";
|
|
167
|
+
rationale: string;
|
|
168
|
+
certainty?: number;
|
|
169
|
+
maxInlinePropagationTargets?: number;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
function asNodeArray(data: unknown): NodeLike[] {
|
|
173
|
+
const rows = asListItems<NodeLike>(data, "nodes");
|
|
174
|
+
if (rows.length > 0) {
|
|
175
|
+
return rows.filter(
|
|
176
|
+
(value): value is NodeLike => Boolean(value) && typeof value === "object"
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
if (data && typeof data === "object") {
|
|
180
|
+
return [data as NodeLike];
|
|
181
|
+
}
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function asEdgeArray(data: unknown): EdgeLike[] {
|
|
186
|
+
const rows = asListItems<EdgeLike>(data, "edges");
|
|
187
|
+
if (rows.length > 0) {
|
|
188
|
+
return rows.filter(
|
|
189
|
+
(value): value is EdgeLike => Boolean(value) && typeof value === "object"
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
if (data && typeof data === "object") {
|
|
193
|
+
return [data as EdgeLike];
|
|
194
|
+
}
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function normalizeBeliefStatus(status: string | undefined): string {
|
|
199
|
+
if (!status) {
|
|
200
|
+
return "unscored";
|
|
201
|
+
}
|
|
202
|
+
if (status === "unscored" || status === "scored" || status === "archived") {
|
|
203
|
+
return status;
|
|
204
|
+
}
|
|
205
|
+
if (status === "active" || status === "in_evaluation") {
|
|
206
|
+
return "unscored";
|
|
207
|
+
}
|
|
208
|
+
if (status === "challenged" || status === "validated") {
|
|
209
|
+
return "scored";
|
|
210
|
+
}
|
|
211
|
+
return "unscored";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function confidenceFromNode(node: NodeLike): number {
|
|
215
|
+
if (typeof node.confidence === "number") {
|
|
216
|
+
return node.confidence;
|
|
217
|
+
}
|
|
218
|
+
if (typeof node.metadata?.confidence === "number") {
|
|
219
|
+
return node.metadata.confidence;
|
|
220
|
+
}
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function toGatewayConfig(config: LucernClientConfig): GatewayClientConfig {
|
|
225
|
+
return {
|
|
226
|
+
baseUrl: config.baseUrl,
|
|
227
|
+
fetchImpl: config.fetchImpl,
|
|
228
|
+
maxRetries: config.maxRetries,
|
|
229
|
+
timeoutMs: config.timeoutMs,
|
|
230
|
+
timeoutMsByMethod: config.timeoutMsByMethod,
|
|
231
|
+
requestIdFactory: config.requestIdFactory,
|
|
232
|
+
onRequest: config.onRequest,
|
|
233
|
+
onResponse: config.onResponse,
|
|
234
|
+
getAuthHeaders: async () => {
|
|
235
|
+
const base = (
|
|
236
|
+
config.getAuthHeaders ? await config.getAuthHeaders() : {}
|
|
237
|
+
) as Record<string, string>;
|
|
238
|
+
if (config.apiKey && !base["x-lucern-key"] && !base.Authorization) {
|
|
239
|
+
base["x-lucern-key"] = config.apiKey;
|
|
240
|
+
}
|
|
241
|
+
if (config.userToken && !base["x-lucern-user-token"]) {
|
|
242
|
+
base["x-lucern-user-token"] = config.userToken;
|
|
243
|
+
}
|
|
244
|
+
if (config.environment && !base["x-lucern-environment"]) {
|
|
245
|
+
base["x-lucern-environment"] = config.environment;
|
|
246
|
+
}
|
|
247
|
+
return base;
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function requireTopicId(args: { topicId?: string }): string {
|
|
253
|
+
const topicId = resolveTopicId(args);
|
|
254
|
+
if (!topicId) {
|
|
255
|
+
throw new Error("topicId is required");
|
|
256
|
+
}
|
|
257
|
+
return topicId;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const AUDIT_NODE_REFERENCE_KEY_PATTERN =
|
|
261
|
+
/(^|_)(id|nodeid|beliefid|resourceid|targetid|sourceid|subjectid|globalid|entityid|recordid|fromnodeid|tonodeid|linkednodeid|linkedbeliefid|nodeids|beliefids|resourceids)$/i;
|
|
262
|
+
|
|
263
|
+
function matchesAuditNodeReference(value: unknown, nodeId: string): boolean {
|
|
264
|
+
if (Array.isArray(value)) {
|
|
265
|
+
return value.some((entry) => matchesAuditNodeReference(entry, nodeId));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!value || typeof value !== "object") {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return Object.entries(value as Record<string, unknown>).some(([key, entry]) => {
|
|
273
|
+
if (
|
|
274
|
+
typeof entry === "string" &&
|
|
275
|
+
entry === nodeId &&
|
|
276
|
+
AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key)
|
|
277
|
+
) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (
|
|
282
|
+
Array.isArray(entry) &&
|
|
283
|
+
AUDIT_NODE_REFERENCE_KEY_PATTERN.test(key) &&
|
|
284
|
+
entry.some((item) => item === nodeId)
|
|
285
|
+
) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return matchesAuditNodeReference(entry, nodeId);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function requireText(args: {
|
|
294
|
+
text?: string;
|
|
295
|
+
canonicalText?: string;
|
|
296
|
+
formulation?: string;
|
|
297
|
+
newFormulation?: string;
|
|
298
|
+
}): string {
|
|
299
|
+
const text = resolveText(args);
|
|
300
|
+
if (!text) {
|
|
301
|
+
throw new Error("text is required");
|
|
302
|
+
}
|
|
303
|
+
return text;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function exposeGatewayData<T extends Record<string, unknown>>(
|
|
307
|
+
response: PlatformGatewaySuccess<T>
|
|
308
|
+
): GatewayDataEnvelope<T> {
|
|
309
|
+
return Object.assign({}, response, response.data);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Configuration for the high-level Lucern SDK client.
|
|
314
|
+
*
|
|
315
|
+
* At minimum, provide `apiKey` and `baseUrl`. The SDK handles
|
|
316
|
+
* authentication, retries, and idempotency automatically.
|
|
317
|
+
*/
|
|
318
|
+
export type LucernClientConfig = ClientConfig & {
|
|
319
|
+
/** API key for authenticating with the Lucern platform. */
|
|
320
|
+
apiKey?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Optional Clerk JWT for per-user identity and RBAC.
|
|
323
|
+
* When present, the SDK operates in user-scoped mode with
|
|
324
|
+
* pack-aware tool filtering. When absent, operates in agent mode.
|
|
325
|
+
*/
|
|
326
|
+
userToken?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Optional pack key for auto-install convenience.
|
|
329
|
+
* When set, the SDK will call `packs.install()` on first use
|
|
330
|
+
* to ensure the pack is available in the workspace.
|
|
331
|
+
*/
|
|
332
|
+
packKey?: string;
|
|
333
|
+
/** Target environment. Defaults to production if not specified. */
|
|
334
|
+
environment?: "sandbox" | "production";
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Create the high-level Lucern SDK client with all domain namespaces.
|
|
339
|
+
*
|
|
340
|
+
* @param config - Client configuration with API key, base URL, and optional settings.
|
|
341
|
+
* @returns The Lucern client with namespaced methods for beliefs, topics, evidence, decisions, and more.
|
|
342
|
+
*/
|
|
343
|
+
export function createLucernClient(config: LucernClientConfig = {}) {
|
|
344
|
+
const gatewayConfig = toGatewayConfig(config);
|
|
345
|
+
const beliefsClient = createBeliefsClient(gatewayConfig);
|
|
346
|
+
const beliefsFacade = createBeliefsFacade(gatewayConfig);
|
|
347
|
+
const graphClient = createGraphClient(gatewayConfig);
|
|
348
|
+
const graphFacade = createGraphFacade(gatewayConfig);
|
|
349
|
+
const decisionsClient = createDecisionsClient(gatewayConfig);
|
|
350
|
+
const contextClient = createContextClient(gatewayConfig);
|
|
351
|
+
const workflowClient = createWorkflowClient(gatewayConfig);
|
|
352
|
+
const auditClient = createAuditClient(gatewayConfig);
|
|
353
|
+
const adminClient = createAdminClient(gatewayConfig);
|
|
354
|
+
const answersClient = createAnswersClient(gatewayConfig);
|
|
355
|
+
const contradictionsFacade = createContradictionsFacade(gatewayConfig);
|
|
356
|
+
const edgesFacade = createEdgesFacade(gatewayConfig);
|
|
357
|
+
const evidenceFacade = createEvidenceFacade(gatewayConfig);
|
|
358
|
+
const eventsFacade = createEventsFacade(gatewayConfig);
|
|
359
|
+
const identityClient = createIdentityClient(gatewayConfig);
|
|
360
|
+
const identityFacade = createIdentityFacade(gatewayConfig);
|
|
361
|
+
const ontologiesFacade = createOntologiesFacade(gatewayConfig);
|
|
362
|
+
const questionsFacade = createQuestionsFacade(gatewayConfig);
|
|
363
|
+
const searchFacade = createSearchFacade(gatewayConfig);
|
|
364
|
+
const tasksFacade = createTasksFacade(gatewayConfig);
|
|
365
|
+
const topicsFacade = createTopicsFacade(gatewayConfig);
|
|
366
|
+
const webhooksFacade = createWebhooksFacade(gatewayConfig);
|
|
367
|
+
const worktreesFacade = createWorktreesFacade(gatewayConfig);
|
|
368
|
+
const policyClient = createPolicyClient(gatewayConfig);
|
|
369
|
+
const ontologyClient = createOntologyClient(gatewayConfig);
|
|
370
|
+
const mcpParityClient = createMcpParityClient(gatewayConfig);
|
|
371
|
+
const packsClient = createPacksClient(gatewayConfig);
|
|
372
|
+
const reportsClient = createReportsClient(gatewayConfig);
|
|
373
|
+
const learningClient = createLearningClient(gatewayConfig);
|
|
374
|
+
const harnessClient = createHarnessClient(gatewayConfig);
|
|
375
|
+
const schemaClient = createSchemaClient(gatewayConfig);
|
|
376
|
+
const audiencesClient = createAudiencesClient(gatewayConfig);
|
|
377
|
+
const topicsClient = createTopicsClient(gatewayConfig);
|
|
378
|
+
const gateway = createGatewayRequestClient(gatewayConfig);
|
|
379
|
+
const customNamespaceCache = new Map<string, CustomToolNamespace>();
|
|
380
|
+
|
|
381
|
+
// Pack auto-install: tracks whether the configured packKey has been installed.
|
|
382
|
+
// Install is lazy — triggered on first API call or explicit ensurePack().
|
|
383
|
+
let _packInstalled = !config.packKey; // true if no packKey configured
|
|
384
|
+
let _packInstallPromise: Promise<void> | null = null;
|
|
385
|
+
|
|
386
|
+
async function ensurePack(): Promise<void> {
|
|
387
|
+
if (_packInstalled) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (_packInstallPromise) {
|
|
391
|
+
return _packInstallPromise;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const installPromise = (async () => {
|
|
395
|
+
try {
|
|
396
|
+
await packsClient.install({
|
|
397
|
+
packKey: config.packKey!,
|
|
398
|
+
autoEnable: true,
|
|
399
|
+
});
|
|
400
|
+
_packInstalled = true;
|
|
401
|
+
} catch (err) {
|
|
402
|
+
// If the pack is already installed, treat as success
|
|
403
|
+
if (err instanceof LucernApiError && err.code === "ALREADY_EXISTS") {
|
|
404
|
+
_packInstalled = true;
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
// Re-throw — caller decides whether to proceed without the pack
|
|
408
|
+
throw err;
|
|
409
|
+
}
|
|
410
|
+
})();
|
|
411
|
+
|
|
412
|
+
_packInstallPromise = installPromise;
|
|
413
|
+
|
|
414
|
+
try {
|
|
415
|
+
await installPromise;
|
|
416
|
+
} catch (error) {
|
|
417
|
+
if (_packInstallPromise === installPromise) {
|
|
418
|
+
_packInstallPromise = null;
|
|
419
|
+
}
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const invokeCustomTool = async (
|
|
425
|
+
fullName: string,
|
|
426
|
+
input: CustomToolInput = {}
|
|
427
|
+
): Promise<unknown> => {
|
|
428
|
+
const payload =
|
|
429
|
+
input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
430
|
+
return invokeRegisteredCustomTool(fullName, payload, { source: "sdk" });
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const getCustomNamespace = (namespace: string): CustomToolNamespace => {
|
|
434
|
+
const normalized = namespace.trim() || "custom";
|
|
435
|
+
const cached = customNamespaceCache.get(normalized);
|
|
436
|
+
if (cached) {
|
|
437
|
+
return cached;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const proxy = new Proxy(
|
|
441
|
+
{},
|
|
442
|
+
{
|
|
443
|
+
get(_target, property): unknown {
|
|
444
|
+
if (typeof property !== "string" || property === "then") {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
return async (input: CustomToolInput = {}) =>
|
|
448
|
+
invokeCustomTool(`${normalized}.${property}`, input);
|
|
449
|
+
},
|
|
450
|
+
}
|
|
451
|
+
) as CustomToolNamespace;
|
|
452
|
+
|
|
453
|
+
customNamespaceCache.set(normalized, proxy);
|
|
454
|
+
return proxy;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
const extensionNamespaces = new Proxy(
|
|
458
|
+
{},
|
|
459
|
+
{
|
|
460
|
+
get(_target, namespace): unknown {
|
|
461
|
+
if (typeof namespace !== "string" || namespace === "then") {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
return getCustomNamespace(namespace);
|
|
465
|
+
},
|
|
466
|
+
}
|
|
467
|
+
) as Record<string, CustomToolNamespace>;
|
|
468
|
+
|
|
469
|
+
async function createEvidenceCompat(args: {
|
|
470
|
+
text?: string;
|
|
471
|
+
canonicalText?: string;
|
|
472
|
+
topicId?: string;
|
|
473
|
+
source?: string;
|
|
474
|
+
sourceUrl?: string;
|
|
475
|
+
targetId?: string;
|
|
476
|
+
weight?: number;
|
|
477
|
+
metadata?: JsonObject;
|
|
478
|
+
title?: string;
|
|
479
|
+
content?: string;
|
|
480
|
+
contentType?: string;
|
|
481
|
+
kind?: string;
|
|
482
|
+
supports?: {
|
|
483
|
+
nodeId: string;
|
|
484
|
+
weight: number;
|
|
485
|
+
reasoning?: string;
|
|
486
|
+
};
|
|
487
|
+
}) {
|
|
488
|
+
const topicId = requireTopicId(args);
|
|
489
|
+
const text = resolveText(args);
|
|
490
|
+
if (!text) {
|
|
491
|
+
throw new Error("text is required");
|
|
492
|
+
}
|
|
493
|
+
const metadata = {
|
|
494
|
+
...(args.metadata ?? {}),
|
|
495
|
+
...(args.supports?.reasoning
|
|
496
|
+
? { rationale: args.supports.reasoning }
|
|
497
|
+
: {}),
|
|
498
|
+
} as JsonObject;
|
|
499
|
+
|
|
500
|
+
return evidenceFacade.create({
|
|
501
|
+
topicId,
|
|
502
|
+
text,
|
|
503
|
+
source: args.source ?? args.sourceUrl,
|
|
504
|
+
targetId: args.targetId ?? args.supports?.nodeId,
|
|
505
|
+
weight: args.weight ?? args.supports?.weight,
|
|
506
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
507
|
+
title: args.title,
|
|
508
|
+
content: args.content,
|
|
509
|
+
contentType: args.contentType,
|
|
510
|
+
kind: args.kind,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
async function addEvidence(args: {
|
|
515
|
+
text?: string;
|
|
516
|
+
canonicalText?: string;
|
|
517
|
+
topicId?: string;
|
|
518
|
+
source?: string;
|
|
519
|
+
sourceUrl?: string;
|
|
520
|
+
targetId?: string;
|
|
521
|
+
weight?: number;
|
|
522
|
+
metadata?: JsonObject;
|
|
523
|
+
title?: string;
|
|
524
|
+
content?: string;
|
|
525
|
+
contentType?: string;
|
|
526
|
+
kind?: string;
|
|
527
|
+
supports?: {
|
|
528
|
+
nodeId: string;
|
|
529
|
+
weight: number;
|
|
530
|
+
reasoning?: string;
|
|
531
|
+
};
|
|
532
|
+
}) {
|
|
533
|
+
const created = await createEvidenceCompat({
|
|
534
|
+
...args,
|
|
535
|
+
targetId: args.supports ? undefined : args.targetId,
|
|
536
|
+
weight: args.supports ? undefined : args.weight,
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
if (!args.supports) {
|
|
540
|
+
return created.data;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const evidenceId = created.data.id;
|
|
544
|
+
if (typeof evidenceId !== "string" || evidenceId.length === 0) {
|
|
545
|
+
throw new Error("evidence create did not return an id");
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const linked = await evidenceFacade.link({
|
|
549
|
+
evidenceId,
|
|
550
|
+
targetId: args.supports.nodeId,
|
|
551
|
+
weight: args.supports.weight,
|
|
552
|
+
rationale: args.supports.reasoning,
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
return {
|
|
556
|
+
...created.data,
|
|
557
|
+
edgeId: linked.data.edgeId,
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
async function listBeliefs(args: {
|
|
562
|
+
topicId?: string;
|
|
563
|
+
worktreeId?: string;
|
|
564
|
+
status?: string;
|
|
565
|
+
minConfidence?: number;
|
|
566
|
+
limit?: number;
|
|
567
|
+
cursor?: string;
|
|
568
|
+
}) {
|
|
569
|
+
const response = await beliefsFacade.list({
|
|
570
|
+
topicId: requireTopicId(args),
|
|
571
|
+
status: args.status,
|
|
572
|
+
worktreeId: args.worktreeId,
|
|
573
|
+
minConfidence: args.minConfidence,
|
|
574
|
+
limit: args.limit,
|
|
575
|
+
cursor: args.cursor,
|
|
576
|
+
});
|
|
577
|
+
return Array.isArray(response.data.beliefs) ? response.data.beliefs : [];
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
async function searchBeliefs(args: {
|
|
581
|
+
query: string;
|
|
582
|
+
topicId?: string;
|
|
583
|
+
status?: string;
|
|
584
|
+
minConfidence?: number;
|
|
585
|
+
limit?: number;
|
|
586
|
+
}) {
|
|
587
|
+
const topicId = resolveTopicId(args);
|
|
588
|
+
if (!topicId) {
|
|
589
|
+
return { results: [] };
|
|
590
|
+
}
|
|
591
|
+
const response = await searchFacade.query({
|
|
592
|
+
q: args.query,
|
|
593
|
+
topicId,
|
|
594
|
+
types: ["belief"],
|
|
595
|
+
status: args.status,
|
|
596
|
+
minConfidence: args.minConfidence,
|
|
597
|
+
limit: args.limit,
|
|
598
|
+
});
|
|
599
|
+
const data = exposeGatewayData(response);
|
|
600
|
+
const groupedBeliefs = Array.isArray(data.beliefs)
|
|
601
|
+
? (data.beliefs as Record<string, unknown>[])
|
|
602
|
+
: [];
|
|
603
|
+
const mergedResults = Array.isArray(data.results)
|
|
604
|
+
? (data.results as Record<string, unknown>[])
|
|
605
|
+
: [];
|
|
606
|
+
const results =
|
|
607
|
+
groupedBeliefs.length > 0
|
|
608
|
+
? groupedBeliefs
|
|
609
|
+
: mergedResults.filter((result) => result.type === "belief");
|
|
610
|
+
return { results };
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
async function searchResources(
|
|
614
|
+
query: string,
|
|
615
|
+
options: {
|
|
616
|
+
topicId?: string;
|
|
617
|
+
types?: string[];
|
|
618
|
+
status?: string;
|
|
619
|
+
minConfidence?: number;
|
|
620
|
+
limit?: number;
|
|
621
|
+
cursor?: string;
|
|
622
|
+
} = {}
|
|
623
|
+
) {
|
|
624
|
+
const topicId = resolveTopicId(options);
|
|
625
|
+
if (!topicId) {
|
|
626
|
+
throw new Error("topicId is required");
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return searchFacade
|
|
630
|
+
.query({
|
|
631
|
+
q: query,
|
|
632
|
+
topicId,
|
|
633
|
+
types: options.types as Array<"belief" | "evidence" | "question"> | undefined,
|
|
634
|
+
status: options.status,
|
|
635
|
+
minConfidence: options.minConfidence,
|
|
636
|
+
limit: options.limit,
|
|
637
|
+
cursor: options.cursor,
|
|
638
|
+
})
|
|
639
|
+
.then(exposeGatewayData);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
async function findContradictions(args: {
|
|
643
|
+
topicId?: string;
|
|
644
|
+
nodeId?: string;
|
|
645
|
+
status?: string;
|
|
646
|
+
}) {
|
|
647
|
+
const topicId = resolveTopicId(args);
|
|
648
|
+
const response = topicId
|
|
649
|
+
? await graphClient.listNodes({
|
|
650
|
+
topicId,
|
|
651
|
+
nodeType: "contradiction",
|
|
652
|
+
limit: 500,
|
|
653
|
+
})
|
|
654
|
+
: args.nodeId
|
|
655
|
+
? await graphClient.queryNodes({ nodeId: args.nodeId })
|
|
656
|
+
: { data: [] };
|
|
657
|
+
const contradictions = asNodeArray(response.data)
|
|
658
|
+
.filter((node) => {
|
|
659
|
+
const status =
|
|
660
|
+
typeof node.metadata?.status === "string"
|
|
661
|
+
? node.metadata.status
|
|
662
|
+
: typeof node.status === "string"
|
|
663
|
+
? node.status
|
|
664
|
+
: "unresolved";
|
|
665
|
+
if (args.status && status !== args.status) {
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
return true;
|
|
669
|
+
})
|
|
670
|
+
.map((node) => ({
|
|
671
|
+
beliefA:
|
|
672
|
+
typeof node.metadata?.beliefA === "string"
|
|
673
|
+
? node.metadata.beliefA
|
|
674
|
+
: "",
|
|
675
|
+
beliefB:
|
|
676
|
+
typeof node.metadata?.beliefB === "string"
|
|
677
|
+
? node.metadata.beliefB
|
|
678
|
+
: "",
|
|
679
|
+
description: node.canonicalText ?? "",
|
|
680
|
+
severity:
|
|
681
|
+
typeof node.metadata?.severity === "string"
|
|
682
|
+
? node.metadata.severity
|
|
683
|
+
: "medium",
|
|
684
|
+
status:
|
|
685
|
+
typeof node.metadata?.status === "string"
|
|
686
|
+
? node.metadata.status
|
|
687
|
+
: "unresolved",
|
|
688
|
+
defeatType:
|
|
689
|
+
typeof node.metadata?.defeatType === "string"
|
|
690
|
+
? node.metadata.defeatType
|
|
691
|
+
: "rebuts",
|
|
692
|
+
}));
|
|
693
|
+
return { contradictions };
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
async function queryLineage(nodeId: string, depth = 5) {
|
|
697
|
+
const response = await beliefsFacade.lineage(nodeId);
|
|
698
|
+
const lineage = Array.isArray(response.data.lineage)
|
|
699
|
+
? response.data.lineage
|
|
700
|
+
: [];
|
|
701
|
+
const chain =
|
|
702
|
+
lineage.length > 0
|
|
703
|
+
? lineage
|
|
704
|
+
.slice(0, depth + 1)
|
|
705
|
+
.map((entry, index) => ({
|
|
706
|
+
nodeId: entry.nodeId ?? entry.beliefId ?? "",
|
|
707
|
+
relation: index === 0 ? "self" : "ancestor",
|
|
708
|
+
}))
|
|
709
|
+
: [{ nodeId, relation: "self" }];
|
|
710
|
+
return {
|
|
711
|
+
chain,
|
|
712
|
+
forkTree: {
|
|
713
|
+
nodeId,
|
|
714
|
+
parentCount: Math.max(0, lineage.length - 1),
|
|
715
|
+
childCount: 0,
|
|
716
|
+
children: [],
|
|
717
|
+
},
|
|
718
|
+
depth,
|
|
719
|
+
beliefId: response.data.beliefId,
|
|
720
|
+
lineage,
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
async function getConfidenceHistory(nodeId: string) {
|
|
725
|
+
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
async function getAuditTrail(nodeId: string, limit = 50) {
|
|
729
|
+
const events = await auditClient.listEvents({ limit });
|
|
730
|
+
const entries = asListItems<JsonObject>(events.data, "events")
|
|
731
|
+
.filter((event) => matchesAuditNodeReference(event, nodeId))
|
|
732
|
+
.slice(0, limit)
|
|
733
|
+
.map((event) => {
|
|
734
|
+
const row = event as JsonObject;
|
|
735
|
+
return {
|
|
736
|
+
action: typeof row.action === "string" ? row.action : "unknown",
|
|
737
|
+
actor: typeof row.actor === "string" ? row.actor : "unknown",
|
|
738
|
+
timestamp:
|
|
739
|
+
typeof row.timestamp === "number" ? row.timestamp : Date.now(),
|
|
740
|
+
rationale:
|
|
741
|
+
typeof row.rationale === "string"
|
|
742
|
+
? row.rationale
|
|
743
|
+
: "No rationale recorded.",
|
|
744
|
+
before: row.before ?? null,
|
|
745
|
+
after: row.after ?? null,
|
|
746
|
+
};
|
|
747
|
+
});
|
|
748
|
+
return { entries };
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
async function bisectConfidence(
|
|
752
|
+
nodeId: string,
|
|
753
|
+
args: { expectedDirection: "overconfident" | "underconfident" }
|
|
754
|
+
) {
|
|
755
|
+
return beliefsFacade.bisect(nodeId, args).then(exposeGatewayData);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
async function discoverTopics(input: JsonObject = {}) {
|
|
759
|
+
return gateway
|
|
760
|
+
.request<Record<string, unknown>>({
|
|
761
|
+
path: "/api/platform/v1/context/discover",
|
|
762
|
+
method: "POST",
|
|
763
|
+
body: input,
|
|
764
|
+
})
|
|
765
|
+
.then(exposeGatewayData);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
async function discoverEntityConnections(input: JsonObject = {}) {
|
|
769
|
+
return gateway
|
|
770
|
+
.request<Record<string, unknown>>({
|
|
771
|
+
path: "/api/platform/v1/context/entity-connections",
|
|
772
|
+
method: "POST",
|
|
773
|
+
body: input,
|
|
774
|
+
})
|
|
775
|
+
.then(exposeGatewayData);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
async function triggerBeliefReview(input: JsonObject = {}) {
|
|
779
|
+
return gateway
|
|
780
|
+
.request<Record<string, unknown>>({
|
|
781
|
+
path: "/api/platform/v1/context/belief-review",
|
|
782
|
+
method: "POST",
|
|
783
|
+
body: input,
|
|
784
|
+
idempotencyKey: randomIdempotencyKey(),
|
|
785
|
+
})
|
|
786
|
+
.then(exposeGatewayData);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
async function createContractCompat(input: JsonObject = {}) {
|
|
790
|
+
return gateway
|
|
791
|
+
.request<Record<string, unknown>>({
|
|
792
|
+
path: "/api/platform/v1/contracts",
|
|
793
|
+
method: "POST",
|
|
794
|
+
body: input,
|
|
795
|
+
idempotencyKey: randomIdempotencyKey(),
|
|
796
|
+
})
|
|
797
|
+
.then(exposeGatewayData);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
async function evaluateContractCompat(input: JsonObject = {}) {
|
|
801
|
+
return gateway
|
|
802
|
+
.request<Record<string, unknown>>({
|
|
803
|
+
path: "/api/platform/v1/contracts/evaluate",
|
|
804
|
+
method: "POST",
|
|
805
|
+
body: input,
|
|
806
|
+
idempotencyKey: randomIdempotencyKey(),
|
|
807
|
+
})
|
|
808
|
+
.then(exposeGatewayData);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
async function getContractStatusCompat(input: JsonObject = {}) {
|
|
812
|
+
return gateway
|
|
813
|
+
.request<Record<string, unknown>>({
|
|
814
|
+
path: "/api/platform/v1/contracts/status",
|
|
815
|
+
method: "POST",
|
|
816
|
+
body: input,
|
|
817
|
+
})
|
|
818
|
+
.then(exposeGatewayData);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
async function listContractsCompat(input: JsonObject = {}) {
|
|
822
|
+
return gateway
|
|
823
|
+
.request<Record<string, unknown>>({
|
|
824
|
+
path: `/api/platform/v1/contracts${toQueryString({
|
|
825
|
+
beliefNodeId:
|
|
826
|
+
typeof input.beliefNodeId === "string"
|
|
827
|
+
? input.beliefNodeId
|
|
828
|
+
: undefined,
|
|
829
|
+
contractId:
|
|
830
|
+
typeof input.contractId === "string" ? input.contractId : undefined,
|
|
831
|
+
status: typeof input.status === "string" ? input.status : undefined,
|
|
832
|
+
})}`,
|
|
833
|
+
})
|
|
834
|
+
.then(exposeGatewayData);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
async function createOntologyCompat(input: JsonObject = {}) {
|
|
838
|
+
const response = await ontologyClient.createDefinition(
|
|
839
|
+
input as Parameters<typeof ontologyClient.createDefinition>[0]
|
|
840
|
+
);
|
|
841
|
+
const envelope = response as PlatformGatewaySuccess<Record<string, unknown>>;
|
|
842
|
+
return Object.assign({}, envelope, envelope.data);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
async function updateOntologyCompat(input: JsonObject = {}) {
|
|
846
|
+
const id = typeof input.id === "string" ? input.id : "";
|
|
847
|
+
const { id: _id, ...rest } = input;
|
|
848
|
+
const response = await ontologyClient.updateDefinition(
|
|
849
|
+
id,
|
|
850
|
+
rest as Parameters<typeof ontologyClient.updateDefinition>[1]
|
|
851
|
+
);
|
|
852
|
+
const envelope = response as PlatformGatewaySuccess<Record<string, unknown>>;
|
|
853
|
+
return Object.assign({}, envelope, envelope.data);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
async function archiveOntologyCompat(input: JsonObject = {}) {
|
|
857
|
+
const id = typeof input.id === "string" ? input.id : "";
|
|
858
|
+
const response = await ontologyClient.archiveDefinition(id);
|
|
859
|
+
const envelope = response as PlatformGatewaySuccess<Record<string, unknown>>;
|
|
860
|
+
return Object.assign({}, envelope, envelope.data);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
async function createOntologyVersionCompat(input: JsonObject = {}) {
|
|
864
|
+
const ontologyId =
|
|
865
|
+
typeof input.ontologyId === "string" ? input.ontologyId : "";
|
|
866
|
+
const { ontologyId: _ontologyId, ...rest } = input;
|
|
867
|
+
const response = await ontologyClient.createVersion(
|
|
868
|
+
ontologyId,
|
|
869
|
+
rest as Parameters<typeof ontologyClient.createVersion>[1]
|
|
870
|
+
);
|
|
871
|
+
const envelope = response as PlatformGatewaySuccess<Record<string, unknown>>;
|
|
872
|
+
return Object.assign({}, envelope, envelope.data);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
async function publishOntologyVersionCompat(input: JsonObject = {}) {
|
|
876
|
+
return gateway
|
|
877
|
+
.request<Record<string, unknown>>({
|
|
878
|
+
path: "/api/platform/v1/ontologies/versions/publish",
|
|
879
|
+
method: "POST",
|
|
880
|
+
body: input,
|
|
881
|
+
idempotencyKey: randomIdempotencyKey(),
|
|
882
|
+
})
|
|
883
|
+
.then(exposeGatewayData);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
async function deprecateOntologyVersionCompat(input: JsonObject = {}) {
|
|
887
|
+
return gateway
|
|
888
|
+
.request<Record<string, unknown>>({
|
|
889
|
+
path: "/api/platform/v1/ontologies/versions/deprecate",
|
|
890
|
+
method: "POST",
|
|
891
|
+
body: input,
|
|
892
|
+
idempotencyKey: randomIdempotencyKey(),
|
|
893
|
+
})
|
|
894
|
+
.then(exposeGatewayData);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
async function resolveEffectiveOntologyCompat(input: JsonObject = {}) {
|
|
898
|
+
return gateway
|
|
899
|
+
.request<Record<string, unknown>>({
|
|
900
|
+
path: "/api/platform/v1/ontologies/effective",
|
|
901
|
+
method: "POST",
|
|
902
|
+
body: input,
|
|
903
|
+
})
|
|
904
|
+
.then(exposeGatewayData);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
async function traceEntityImpactCompat(input: JsonObject = {}) {
|
|
908
|
+
return gateway
|
|
909
|
+
.request<Record<string, unknown>>({
|
|
910
|
+
path: "/api/platform/v1/graph/trace-entity-impact",
|
|
911
|
+
method: "POST",
|
|
912
|
+
body: input,
|
|
913
|
+
})
|
|
914
|
+
.then(exposeGatewayData);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
const nodesNamespace = {
|
|
918
|
+
list(query: Parameters<typeof graphClient.listNodes>[0]) {
|
|
919
|
+
return graphClient.listNodes(query);
|
|
920
|
+
},
|
|
921
|
+
get(input: string | Parameters<typeof graphClient.getNode>[0]) {
|
|
922
|
+
return graphClient.getNode(
|
|
923
|
+
typeof input === "string" ? { nodeId: input } : input
|
|
924
|
+
);
|
|
925
|
+
},
|
|
926
|
+
create(
|
|
927
|
+
input: Parameters<typeof graphClient.createNode>[0],
|
|
928
|
+
idempotencyKey?: string
|
|
929
|
+
) {
|
|
930
|
+
return graphClient.createNode(input, idempotencyKey);
|
|
931
|
+
},
|
|
932
|
+
update(
|
|
933
|
+
input: Parameters<typeof graphClient.updateNode>[0],
|
|
934
|
+
idempotencyKey?: string
|
|
935
|
+
) {
|
|
936
|
+
return graphClient.updateNode(input, idempotencyKey);
|
|
937
|
+
},
|
|
938
|
+
batchCreate(
|
|
939
|
+
input: Parameters<typeof graphClient.batchCreateNodes>[0],
|
|
940
|
+
idempotencyKey?: string
|
|
941
|
+
) {
|
|
942
|
+
return graphClient.batchCreateNodes(input, idempotencyKey);
|
|
943
|
+
},
|
|
944
|
+
supersede(
|
|
945
|
+
input: Parameters<typeof graphClient.supersedeNode>[0],
|
|
946
|
+
idempotencyKey?: string
|
|
947
|
+
) {
|
|
948
|
+
return graphClient.supersedeNode(input, idempotencyKey);
|
|
949
|
+
},
|
|
950
|
+
verify(
|
|
951
|
+
input: Parameters<typeof graphClient.verifyNode>[0],
|
|
952
|
+
idempotencyKey?: string
|
|
953
|
+
) {
|
|
954
|
+
return graphClient.verifyNode(input, idempotencyKey);
|
|
955
|
+
},
|
|
956
|
+
hardDelete(
|
|
957
|
+
input: Parameters<typeof graphClient.hardDeleteNode>[0],
|
|
958
|
+
idempotencyKey?: string
|
|
959
|
+
) {
|
|
960
|
+
return graphClient.hardDeleteNode(input, idempotencyKey);
|
|
961
|
+
},
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
return {
|
|
965
|
+
config,
|
|
966
|
+
version: LUCERN_SDK_VERSION,
|
|
967
|
+
search(
|
|
968
|
+
query: string,
|
|
969
|
+
options?: {
|
|
970
|
+
topicId?: string;
|
|
971
|
+
types?: string[];
|
|
972
|
+
status?: string;
|
|
973
|
+
minConfidence?: number;
|
|
974
|
+
limit?: number;
|
|
975
|
+
cursor?: string;
|
|
976
|
+
}
|
|
977
|
+
) {
|
|
978
|
+
return searchResources(query, options);
|
|
979
|
+
},
|
|
980
|
+
events: {
|
|
981
|
+
list(query: Parameters<typeof eventsFacade.list>[0] = {}) {
|
|
982
|
+
return eventsFacade.list(query).then(exposeGatewayData);
|
|
983
|
+
},
|
|
984
|
+
replay(
|
|
985
|
+
input: Parameters<typeof eventsFacade.replay>[0]
|
|
986
|
+
) {
|
|
987
|
+
return eventsFacade.replay(input).then(exposeGatewayData);
|
|
988
|
+
},
|
|
989
|
+
},
|
|
990
|
+
beliefs: {
|
|
991
|
+
create(input: BeliefsCompatCreateInput) {
|
|
992
|
+
return beliefsFacade
|
|
993
|
+
.create({
|
|
994
|
+
topicId: requireTopicId(input),
|
|
995
|
+
text: requireText(input),
|
|
996
|
+
rationale: input.rationale,
|
|
997
|
+
worktreeId: input.worktreeId,
|
|
998
|
+
pillar: input.pillar,
|
|
999
|
+
sourceBeliefIds: input.sourceBeliefIds,
|
|
1000
|
+
sourceType: input.sourceType,
|
|
1001
|
+
beliefType: input.beliefType,
|
|
1002
|
+
reversibility: input.reversibility,
|
|
1003
|
+
predictionMeta: input.predictionMeta,
|
|
1004
|
+
metadata: input.metadata,
|
|
1005
|
+
})
|
|
1006
|
+
.then(exposeGatewayData);
|
|
1007
|
+
},
|
|
1008
|
+
get(nodeId: string) {
|
|
1009
|
+
return beliefsFacade.get(nodeId).then(exposeGatewayData);
|
|
1010
|
+
},
|
|
1011
|
+
refine(
|
|
1012
|
+
nodeId: string,
|
|
1013
|
+
textOrInput: string | { text: string; rationale?: string },
|
|
1014
|
+
rationale?: string
|
|
1015
|
+
) {
|
|
1016
|
+
const payload =
|
|
1017
|
+
typeof textOrInput === "string"
|
|
1018
|
+
? { text: textOrInput, rationale }
|
|
1019
|
+
: {
|
|
1020
|
+
text: textOrInput.text,
|
|
1021
|
+
rationale: textOrInput.rationale,
|
|
1022
|
+
};
|
|
1023
|
+
return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
|
|
1024
|
+
},
|
|
1025
|
+
updateConfidence(
|
|
1026
|
+
nodeId: string,
|
|
1027
|
+
input: BeliefsCompatUpdateConfidenceInput
|
|
1028
|
+
) {
|
|
1029
|
+
return beliefsFacade.updateConfidence(nodeId, input).then(exposeGatewayData);
|
|
1030
|
+
},
|
|
1031
|
+
modulateConfidence(
|
|
1032
|
+
nodeId: string,
|
|
1033
|
+
input: BeliefsCompatUpdateConfidenceInput
|
|
1034
|
+
) {
|
|
1035
|
+
return beliefsFacade.updateConfidence(nodeId, input).then(exposeGatewayData);
|
|
1036
|
+
},
|
|
1037
|
+
updateStatus(
|
|
1038
|
+
input: Parameters<typeof beliefsFacade.updateStatus>[0],
|
|
1039
|
+
idempotencyKey?: string
|
|
1040
|
+
) {
|
|
1041
|
+
return beliefsFacade
|
|
1042
|
+
.updateStatus(input, idempotencyKey)
|
|
1043
|
+
.then(exposeGatewayData);
|
|
1044
|
+
},
|
|
1045
|
+
updateRationale(
|
|
1046
|
+
input: Parameters<typeof beliefsFacade.updateRationale>[0],
|
|
1047
|
+
idempotencyKey?: string
|
|
1048
|
+
) {
|
|
1049
|
+
return beliefsFacade
|
|
1050
|
+
.updateRationale(input, idempotencyKey)
|
|
1051
|
+
.then(exposeGatewayData);
|
|
1052
|
+
},
|
|
1053
|
+
linkBeliefs(
|
|
1054
|
+
input: Parameters<typeof beliefsFacade.linkBeliefs>[0],
|
|
1055
|
+
idempotencyKey?: string
|
|
1056
|
+
) {
|
|
1057
|
+
return beliefsFacade
|
|
1058
|
+
.linkBeliefs(input, idempotencyKey)
|
|
1059
|
+
.then(exposeGatewayData);
|
|
1060
|
+
},
|
|
1061
|
+
unlinkEvidence(
|
|
1062
|
+
input: Parameters<typeof beliefsFacade.unlinkEvidence>[0],
|
|
1063
|
+
idempotencyKey?: string
|
|
1064
|
+
) {
|
|
1065
|
+
return beliefsFacade
|
|
1066
|
+
.unlinkEvidence(input, idempotencyKey)
|
|
1067
|
+
.then(exposeGatewayData);
|
|
1068
|
+
},
|
|
1069
|
+
updateCriticality(
|
|
1070
|
+
input: Parameters<typeof beliefsFacade.updateCriticality>[0],
|
|
1071
|
+
idempotencyKey?: string
|
|
1072
|
+
) {
|
|
1073
|
+
return beliefsFacade
|
|
1074
|
+
.updateCriticality(input, idempotencyKey)
|
|
1075
|
+
.then(exposeGatewayData);
|
|
1076
|
+
},
|
|
1077
|
+
batchUpdateCriticality(
|
|
1078
|
+
input: Parameters<typeof beliefsFacade.batchUpdateCriticality>[0],
|
|
1079
|
+
idempotencyKey?: string
|
|
1080
|
+
) {
|
|
1081
|
+
return beliefsFacade
|
|
1082
|
+
.batchUpdateCriticality(input, idempotencyKey)
|
|
1083
|
+
.then(exposeGatewayData);
|
|
1084
|
+
},
|
|
1085
|
+
reassignTopic(
|
|
1086
|
+
input: Parameters<typeof beliefsFacade.reassignTopic>[0],
|
|
1087
|
+
idempotencyKey?: string
|
|
1088
|
+
) {
|
|
1089
|
+
return beliefsFacade
|
|
1090
|
+
.reassignTopic(input, idempotencyKey)
|
|
1091
|
+
.then(exposeGatewayData);
|
|
1092
|
+
},
|
|
1093
|
+
fork(nodeId: string, input: BeliefsCompatForkInput) {
|
|
1094
|
+
return beliefsFacade
|
|
1095
|
+
.fork(nodeId, {
|
|
1096
|
+
text: requireText(input),
|
|
1097
|
+
forkReason: input.forkReason,
|
|
1098
|
+
rationale: input.rationale,
|
|
1099
|
+
})
|
|
1100
|
+
.then(exposeGatewayData);
|
|
1101
|
+
},
|
|
1102
|
+
archive(
|
|
1103
|
+
nodeId: string,
|
|
1104
|
+
input?: string | { reason?: string; rationale?: string }
|
|
1105
|
+
) {
|
|
1106
|
+
const payload =
|
|
1107
|
+
typeof input === "string"
|
|
1108
|
+
? { reason: input }
|
|
1109
|
+
: input
|
|
1110
|
+
? { reason: input.reason ?? input.rationale }
|
|
1111
|
+
: undefined;
|
|
1112
|
+
return beliefsFacade.archive(nodeId, payload).then(exposeGatewayData);
|
|
1113
|
+
},
|
|
1114
|
+
list(args: {
|
|
1115
|
+
topicId?: string;
|
|
1116
|
+
worktreeId?: string;
|
|
1117
|
+
status?: string;
|
|
1118
|
+
minConfidence?: number;
|
|
1119
|
+
limit?: number;
|
|
1120
|
+
cursor?: string;
|
|
1121
|
+
}) {
|
|
1122
|
+
return beliefsFacade
|
|
1123
|
+
.list({
|
|
1124
|
+
topicId: requireTopicId(args),
|
|
1125
|
+
worktreeId: args.worktreeId,
|
|
1126
|
+
status: args.status,
|
|
1127
|
+
minConfidence: args.minConfidence,
|
|
1128
|
+
limit: args.limit,
|
|
1129
|
+
cursor: args.cursor,
|
|
1130
|
+
})
|
|
1131
|
+
.then(exposeGatewayData);
|
|
1132
|
+
},
|
|
1133
|
+
search: searchBeliefs,
|
|
1134
|
+
lineage(nodeId: string) {
|
|
1135
|
+
return beliefsFacade.lineage(nodeId).then(exposeGatewayData);
|
|
1136
|
+
},
|
|
1137
|
+
confidenceHistory(nodeId: string) {
|
|
1138
|
+
return beliefsFacade.confidenceHistory(nodeId).then(exposeGatewayData);
|
|
1139
|
+
},
|
|
1140
|
+
createContract(
|
|
1141
|
+
nodeId: string,
|
|
1142
|
+
input: Parameters<typeof beliefsFacade.createContract>[1]
|
|
1143
|
+
) {
|
|
1144
|
+
return beliefsFacade
|
|
1145
|
+
.createContract(nodeId, input)
|
|
1146
|
+
.then(exposeGatewayData);
|
|
1147
|
+
},
|
|
1148
|
+
bisect(
|
|
1149
|
+
nodeId: string,
|
|
1150
|
+
input: Parameters<typeof beliefsFacade.bisect>[1]
|
|
1151
|
+
) {
|
|
1152
|
+
return beliefsFacade.bisect(nodeId, input).then(exposeGatewayData);
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
webhooks: {
|
|
1156
|
+
create(input: Parameters<typeof webhooksFacade.create>[0]) {
|
|
1157
|
+
return webhooksFacade.create(input).then(exposeGatewayData);
|
|
1158
|
+
},
|
|
1159
|
+
list(query?: Parameters<typeof webhooksFacade.list>[0]) {
|
|
1160
|
+
return webhooksFacade.list(query).then(exposeGatewayData);
|
|
1161
|
+
},
|
|
1162
|
+
get(id: string) {
|
|
1163
|
+
return webhooksFacade.get(id).then(exposeGatewayData);
|
|
1164
|
+
},
|
|
1165
|
+
update(
|
|
1166
|
+
id: string,
|
|
1167
|
+
input: Parameters<typeof webhooksFacade.update>[1]
|
|
1168
|
+
) {
|
|
1169
|
+
return webhooksFacade.update(id, input).then(exposeGatewayData);
|
|
1170
|
+
},
|
|
1171
|
+
delete(id: string) {
|
|
1172
|
+
return webhooksFacade.delete(id).then(exposeGatewayData);
|
|
1173
|
+
},
|
|
1174
|
+
test(id: string, input?: Parameters<typeof webhooksFacade.test>[1]) {
|
|
1175
|
+
return webhooksFacade.test(id, input).then(exposeGatewayData);
|
|
1176
|
+
},
|
|
1177
|
+
deliveries(
|
|
1178
|
+
id: string,
|
|
1179
|
+
query?: Parameters<typeof webhooksFacade.deliveries>[1]
|
|
1180
|
+
) {
|
|
1181
|
+
return webhooksFacade.deliveries(id, query).then(exposeGatewayData);
|
|
1182
|
+
},
|
|
1183
|
+
health(id: string) {
|
|
1184
|
+
return webhooksFacade.health(id).then(exposeGatewayData);
|
|
1185
|
+
},
|
|
1186
|
+
},
|
|
1187
|
+
edges: {
|
|
1188
|
+
create(args: {
|
|
1189
|
+
sourceId: string;
|
|
1190
|
+
targetId: string;
|
|
1191
|
+
edgeType: string;
|
|
1192
|
+
topicId?: string;
|
|
1193
|
+
confidence?: number;
|
|
1194
|
+
weight?: number;
|
|
1195
|
+
context?: string;
|
|
1196
|
+
reasoning?: string;
|
|
1197
|
+
}) {
|
|
1198
|
+
return edgesFacade
|
|
1199
|
+
.create({
|
|
1200
|
+
sourceId: args.sourceId,
|
|
1201
|
+
targetId: args.targetId,
|
|
1202
|
+
edgeType: args.edgeType,
|
|
1203
|
+
topicId: args.topicId,
|
|
1204
|
+
confidence: args.confidence,
|
|
1205
|
+
weight: args.weight,
|
|
1206
|
+
context: args.context ?? args.reasoning,
|
|
1207
|
+
})
|
|
1208
|
+
.then(exposeGatewayData);
|
|
1209
|
+
},
|
|
1210
|
+
update(
|
|
1211
|
+
input: Parameters<typeof edgesFacade.update>[0],
|
|
1212
|
+
idempotencyKey?: string
|
|
1213
|
+
) {
|
|
1214
|
+
return edgesFacade.update(input, idempotencyKey).then(exposeGatewayData);
|
|
1215
|
+
},
|
|
1216
|
+
remove(
|
|
1217
|
+
input: Parameters<typeof edgesFacade.remove>[0],
|
|
1218
|
+
idempotencyKey?: string
|
|
1219
|
+
) {
|
|
1220
|
+
return edgesFacade.remove(input, idempotencyKey).then(exposeGatewayData);
|
|
1221
|
+
},
|
|
1222
|
+
removeBetween(
|
|
1223
|
+
input: Parameters<typeof edgesFacade.removeBetween>[0],
|
|
1224
|
+
idempotencyKey?: string
|
|
1225
|
+
) {
|
|
1226
|
+
return edgesFacade
|
|
1227
|
+
.removeBetween(input, idempotencyKey)
|
|
1228
|
+
.then(exposeGatewayData);
|
|
1229
|
+
},
|
|
1230
|
+
batchCreate(
|
|
1231
|
+
input: Parameters<typeof edgesFacade.batchCreate>[0],
|
|
1232
|
+
idempotencyKey?: string
|
|
1233
|
+
) {
|
|
1234
|
+
return edgesFacade
|
|
1235
|
+
.batchCreate(input, idempotencyKey)
|
|
1236
|
+
.then(exposeGatewayData);
|
|
1237
|
+
},
|
|
1238
|
+
delete(
|
|
1239
|
+
input: Parameters<typeof edgesFacade.delete>[0],
|
|
1240
|
+
idempotencyKey?: string
|
|
1241
|
+
) {
|
|
1242
|
+
return edgesFacade.delete(input, idempotencyKey).then(exposeGatewayData);
|
|
1243
|
+
},
|
|
1244
|
+
list(args: {
|
|
1245
|
+
sourceId: string;
|
|
1246
|
+
edgeType?: string;
|
|
1247
|
+
limit?: number;
|
|
1248
|
+
cursor?: string;
|
|
1249
|
+
}) {
|
|
1250
|
+
return edgesFacade
|
|
1251
|
+
.list({
|
|
1252
|
+
sourceId: args.sourceId,
|
|
1253
|
+
edgeType: args.edgeType,
|
|
1254
|
+
limit: args.limit,
|
|
1255
|
+
cursor: args.cursor,
|
|
1256
|
+
})
|
|
1257
|
+
.then(exposeGatewayData);
|
|
1258
|
+
},
|
|
1259
|
+
traverse(args: {
|
|
1260
|
+
startNode: string;
|
|
1261
|
+
direction?: string;
|
|
1262
|
+
maxDepth?: number;
|
|
1263
|
+
topicId?: string;
|
|
1264
|
+
}) {
|
|
1265
|
+
return edgesFacade
|
|
1266
|
+
.traverse({
|
|
1267
|
+
startNode: args.startNode,
|
|
1268
|
+
direction: args.direction,
|
|
1269
|
+
maxDepth: args.maxDepth,
|
|
1270
|
+
topicId: args.topicId,
|
|
1271
|
+
})
|
|
1272
|
+
.then(exposeGatewayData);
|
|
1273
|
+
},
|
|
1274
|
+
},
|
|
1275
|
+
evidence: {
|
|
1276
|
+
create(args: {
|
|
1277
|
+
text?: string;
|
|
1278
|
+
canonicalText?: string;
|
|
1279
|
+
topicId?: string;
|
|
1280
|
+
source?: string;
|
|
1281
|
+
sourceUrl?: string;
|
|
1282
|
+
targetId?: string;
|
|
1283
|
+
weight?: number;
|
|
1284
|
+
metadata?: JsonObject;
|
|
1285
|
+
title?: string;
|
|
1286
|
+
content?: string;
|
|
1287
|
+
contentType?: string;
|
|
1288
|
+
kind?: string;
|
|
1289
|
+
supports?: {
|
|
1290
|
+
nodeId: string;
|
|
1291
|
+
weight: number;
|
|
1292
|
+
reasoning?: string;
|
|
1293
|
+
};
|
|
1294
|
+
}) {
|
|
1295
|
+
return createEvidenceCompat(args).then(exposeGatewayData);
|
|
1296
|
+
},
|
|
1297
|
+
add: addEvidence,
|
|
1298
|
+
get(evidenceId: string) {
|
|
1299
|
+
return evidenceFacade.get(evidenceId).then(exposeGatewayData);
|
|
1300
|
+
},
|
|
1301
|
+
list(args: {
|
|
1302
|
+
topicId?: string;
|
|
1303
|
+
targetId?: string;
|
|
1304
|
+
limit?: number;
|
|
1305
|
+
cursor?: string;
|
|
1306
|
+
}) {
|
|
1307
|
+
return evidenceFacade
|
|
1308
|
+
.list({
|
|
1309
|
+
topicId: args.topicId,
|
|
1310
|
+
targetId: args.targetId,
|
|
1311
|
+
limit: args.limit,
|
|
1312
|
+
cursor: args.cursor,
|
|
1313
|
+
})
|
|
1314
|
+
.then(exposeGatewayData);
|
|
1315
|
+
},
|
|
1316
|
+
search(args: {
|
|
1317
|
+
q?: string;
|
|
1318
|
+
query?: string;
|
|
1319
|
+
topicId?: string;
|
|
1320
|
+
targetId?: string;
|
|
1321
|
+
methodology?: string;
|
|
1322
|
+
limit?: number;
|
|
1323
|
+
cursor?: string;
|
|
1324
|
+
}) {
|
|
1325
|
+
const q = args.q ?? args.query;
|
|
1326
|
+
if (!q) {
|
|
1327
|
+
throw new Error("q is required");
|
|
1328
|
+
}
|
|
1329
|
+
return evidenceFacade
|
|
1330
|
+
.search({
|
|
1331
|
+
q,
|
|
1332
|
+
topicId: args.topicId,
|
|
1333
|
+
targetId: args.targetId,
|
|
1334
|
+
limit: args.limit,
|
|
1335
|
+
cursor: args.cursor,
|
|
1336
|
+
})
|
|
1337
|
+
.then(exposeGatewayData);
|
|
1338
|
+
},
|
|
1339
|
+
link(args: {
|
|
1340
|
+
evidenceId: string;
|
|
1341
|
+
targetId?: string;
|
|
1342
|
+
beliefId?: string;
|
|
1343
|
+
questionId?: string;
|
|
1344
|
+
targetType?: "belief" | "question" | string;
|
|
1345
|
+
weight?: number;
|
|
1346
|
+
rationale?: string;
|
|
1347
|
+
}) {
|
|
1348
|
+
const targetId = args.targetId ?? args.questionId ?? args.beliefId;
|
|
1349
|
+
if (!targetId) {
|
|
1350
|
+
throw new Error("targetId is required");
|
|
1351
|
+
}
|
|
1352
|
+
const targetType =
|
|
1353
|
+
typeof args.targetType === "string"
|
|
1354
|
+
? args.targetType
|
|
1355
|
+
: args.questionId
|
|
1356
|
+
? "question"
|
|
1357
|
+
: args.beliefId
|
|
1358
|
+
? "belief"
|
|
1359
|
+
: undefined;
|
|
1360
|
+
return evidenceFacade
|
|
1361
|
+
.link({
|
|
1362
|
+
evidenceId: args.evidenceId,
|
|
1363
|
+
targetId,
|
|
1364
|
+
targetType: targetType as "belief" | "question" | undefined,
|
|
1365
|
+
weight: args.weight,
|
|
1366
|
+
rationale: args.rationale,
|
|
1367
|
+
})
|
|
1368
|
+
.then(exposeGatewayData);
|
|
1369
|
+
},
|
|
1370
|
+
linkToBelief(args: {
|
|
1371
|
+
evidenceId: string;
|
|
1372
|
+
beliefId: string;
|
|
1373
|
+
weight: number;
|
|
1374
|
+
rationale?: string;
|
|
1375
|
+
}) {
|
|
1376
|
+
return evidenceFacade
|
|
1377
|
+
.link({
|
|
1378
|
+
evidenceId: args.evidenceId,
|
|
1379
|
+
targetId: args.beliefId,
|
|
1380
|
+
weight: args.weight,
|
|
1381
|
+
rationale: args.rationale,
|
|
1382
|
+
})
|
|
1383
|
+
.then((response) => ({
|
|
1384
|
+
...response.data,
|
|
1385
|
+
beliefId: args.beliefId,
|
|
1386
|
+
}));
|
|
1387
|
+
},
|
|
1388
|
+
updateStatus(
|
|
1389
|
+
input: Parameters<typeof evidenceFacade.updateStatus>[0],
|
|
1390
|
+
idempotencyKey?: string
|
|
1391
|
+
) {
|
|
1392
|
+
return evidenceFacade
|
|
1393
|
+
.updateStatus(input, idempotencyKey)
|
|
1394
|
+
.then(exposeGatewayData);
|
|
1395
|
+
},
|
|
1396
|
+
update(
|
|
1397
|
+
input: Parameters<typeof evidenceFacade.update>[0],
|
|
1398
|
+
idempotencyKey?: string
|
|
1399
|
+
) {
|
|
1400
|
+
return evidenceFacade.update(input, idempotencyKey).then(exposeGatewayData);
|
|
1401
|
+
},
|
|
1402
|
+
flagIncorrect(
|
|
1403
|
+
input: Parameters<typeof evidenceFacade.flagIncorrect>[0],
|
|
1404
|
+
idempotencyKey?: string
|
|
1405
|
+
) {
|
|
1406
|
+
return evidenceFacade
|
|
1407
|
+
.flagIncorrect(input, idempotencyKey)
|
|
1408
|
+
.then(exposeGatewayData);
|
|
1409
|
+
},
|
|
1410
|
+
remove(
|
|
1411
|
+
input: Parameters<typeof evidenceFacade.remove>[0],
|
|
1412
|
+
idempotencyKey?: string
|
|
1413
|
+
) {
|
|
1414
|
+
return evidenceFacade.remove(input, idempotencyKey).then(exposeGatewayData);
|
|
1415
|
+
},
|
|
1416
|
+
updateVerificationStatus(
|
|
1417
|
+
input: Parameters<typeof evidenceFacade.updateVerificationStatus>[0],
|
|
1418
|
+
idempotencyKey?: string
|
|
1419
|
+
) {
|
|
1420
|
+
return evidenceFacade
|
|
1421
|
+
.updateVerificationStatus(input, idempotencyKey)
|
|
1422
|
+
.then(exposeGatewayData);
|
|
1423
|
+
},
|
|
1424
|
+
},
|
|
1425
|
+
questions: {
|
|
1426
|
+
create(args: {
|
|
1427
|
+
text: string;
|
|
1428
|
+
topicId?: string;
|
|
1429
|
+
priority?: string;
|
|
1430
|
+
linkedBeliefId?: string;
|
|
1431
|
+
metadata?: JsonObject;
|
|
1432
|
+
}) {
|
|
1433
|
+
return questionsFacade
|
|
1434
|
+
.create({
|
|
1435
|
+
topicId: requireTopicId(args),
|
|
1436
|
+
text: args.text,
|
|
1437
|
+
priority: args.priority,
|
|
1438
|
+
linkedBeliefId: args.linkedBeliefId,
|
|
1439
|
+
metadata: args.metadata,
|
|
1440
|
+
})
|
|
1441
|
+
.then(exposeGatewayData);
|
|
1442
|
+
},
|
|
1443
|
+
get(questionId: string) {
|
|
1444
|
+
return questionsFacade.get(questionId).then(exposeGatewayData);
|
|
1445
|
+
},
|
|
1446
|
+
refine(
|
|
1447
|
+
questionId: string,
|
|
1448
|
+
text: string,
|
|
1449
|
+
refinementReason?: string
|
|
1450
|
+
) {
|
|
1451
|
+
return questionsFacade
|
|
1452
|
+
.refine(questionId, {
|
|
1453
|
+
text,
|
|
1454
|
+
rationale: refinementReason,
|
|
1455
|
+
})
|
|
1456
|
+
.then(exposeGatewayData);
|
|
1457
|
+
},
|
|
1458
|
+
list(args: {
|
|
1459
|
+
topicId?: string;
|
|
1460
|
+
status?: string;
|
|
1461
|
+
priority?: string;
|
|
1462
|
+
worktreeId?: string;
|
|
1463
|
+
limit?: number;
|
|
1464
|
+
cursor?: string;
|
|
1465
|
+
}) {
|
|
1466
|
+
return questionsFacade
|
|
1467
|
+
.list({
|
|
1468
|
+
topicId: requireTopicId(args),
|
|
1469
|
+
status: args.status,
|
|
1470
|
+
priority: args.priority,
|
|
1471
|
+
worktreeId: args.worktreeId,
|
|
1472
|
+
limit: args.limit,
|
|
1473
|
+
cursor: args.cursor,
|
|
1474
|
+
})
|
|
1475
|
+
.then(exposeGatewayData);
|
|
1476
|
+
},
|
|
1477
|
+
updateStatus(questionId: string, status: string, rationale?: string) {
|
|
1478
|
+
return questionsFacade
|
|
1479
|
+
.updateStatus(questionId, {
|
|
1480
|
+
status,
|
|
1481
|
+
rationale,
|
|
1482
|
+
})
|
|
1483
|
+
.then(exposeGatewayData);
|
|
1484
|
+
},
|
|
1485
|
+
batchCreate(
|
|
1486
|
+
input: Parameters<typeof questionsFacade.batchCreate>[0],
|
|
1487
|
+
idempotencyKey?: string
|
|
1488
|
+
) {
|
|
1489
|
+
return questionsFacade
|
|
1490
|
+
.batchCreate(input, idempotencyKey)
|
|
1491
|
+
.then(exposeGatewayData);
|
|
1492
|
+
},
|
|
1493
|
+
add(
|
|
1494
|
+
input: Parameters<typeof questionsFacade.add>[0],
|
|
1495
|
+
idempotencyKey?: string
|
|
1496
|
+
) {
|
|
1497
|
+
return questionsFacade.add(input, idempotencyKey).then(exposeGatewayData);
|
|
1498
|
+
},
|
|
1499
|
+
updatePriority(
|
|
1500
|
+
input: Parameters<typeof questionsFacade.updatePriority>[0],
|
|
1501
|
+
idempotencyKey?: string
|
|
1502
|
+
) {
|
|
1503
|
+
return questionsFacade
|
|
1504
|
+
.updatePriority(input, idempotencyKey)
|
|
1505
|
+
.then(exposeGatewayData);
|
|
1506
|
+
},
|
|
1507
|
+
advanceToConviction(
|
|
1508
|
+
input: Parameters<typeof questionsFacade.advanceToConviction>[0],
|
|
1509
|
+
idempotencyKey?: string
|
|
1510
|
+
) {
|
|
1511
|
+
return questionsFacade
|
|
1512
|
+
.advanceToConviction(input, idempotencyKey)
|
|
1513
|
+
.then(exposeGatewayData);
|
|
1514
|
+
},
|
|
1515
|
+
updateConviction(
|
|
1516
|
+
input: Parameters<typeof questionsFacade.updateConviction>[0],
|
|
1517
|
+
idempotencyKey?: string
|
|
1518
|
+
) {
|
|
1519
|
+
return questionsFacade
|
|
1520
|
+
.updateConviction(input, idempotencyKey)
|
|
1521
|
+
.then(exposeGatewayData);
|
|
1522
|
+
},
|
|
1523
|
+
finalizeConviction(
|
|
1524
|
+
input: Parameters<typeof questionsFacade.finalizeConviction>[0],
|
|
1525
|
+
idempotencyKey?: string
|
|
1526
|
+
) {
|
|
1527
|
+
return questionsFacade
|
|
1528
|
+
.finalizeConviction(input, idempotencyKey)
|
|
1529
|
+
.then(exposeGatewayData);
|
|
1530
|
+
},
|
|
1531
|
+
update(
|
|
1532
|
+
input: Parameters<typeof questionsFacade.update>[0],
|
|
1533
|
+
idempotencyKey?: string
|
|
1534
|
+
) {
|
|
1535
|
+
return questionsFacade.update(input, idempotencyKey).then(exposeGatewayData);
|
|
1536
|
+
},
|
|
1537
|
+
delete(
|
|
1538
|
+
input: Parameters<typeof questionsFacade.delete>[0],
|
|
1539
|
+
idempotencyKey?: string
|
|
1540
|
+
) {
|
|
1541
|
+
return questionsFacade.delete(input, idempotencyKey).then(exposeGatewayData);
|
|
1542
|
+
},
|
|
1543
|
+
answer(
|
|
1544
|
+
questionId: string,
|
|
1545
|
+
input: {
|
|
1546
|
+
text: string;
|
|
1547
|
+
confidence?: string;
|
|
1548
|
+
evidenceIds?: string[];
|
|
1549
|
+
rationale?: string;
|
|
1550
|
+
}
|
|
1551
|
+
) {
|
|
1552
|
+
return questionsFacade
|
|
1553
|
+
.answer(questionId, input)
|
|
1554
|
+
.then(exposeGatewayData);
|
|
1555
|
+
},
|
|
1556
|
+
archive(questionId: string, reason?: string) {
|
|
1557
|
+
return questionsFacade
|
|
1558
|
+
.archive(questionId, { reason })
|
|
1559
|
+
.then(exposeGatewayData);
|
|
1560
|
+
},
|
|
1561
|
+
linkEvidence(args: {
|
|
1562
|
+
evidenceId: string;
|
|
1563
|
+
questionId: string;
|
|
1564
|
+
relevance?: number;
|
|
1565
|
+
weight?: number;
|
|
1566
|
+
rationale?: string;
|
|
1567
|
+
}) {
|
|
1568
|
+
const weight = args.weight ?? args.relevance;
|
|
1569
|
+
return evidenceFacade
|
|
1570
|
+
.link({
|
|
1571
|
+
evidenceId: args.evidenceId,
|
|
1572
|
+
targetId: args.questionId,
|
|
1573
|
+
targetType: "question",
|
|
1574
|
+
weight,
|
|
1575
|
+
rationale: args.rationale,
|
|
1576
|
+
})
|
|
1577
|
+
.then((response) => ({
|
|
1578
|
+
...response.data,
|
|
1579
|
+
questionId: args.questionId,
|
|
1580
|
+
relevance: weight,
|
|
1581
|
+
}));
|
|
1582
|
+
},
|
|
1583
|
+
getHighPriority(args: {
|
|
1584
|
+
topicId?: string;
|
|
1585
|
+
limit?: number;
|
|
1586
|
+
includeAnswered?: boolean;
|
|
1587
|
+
}) {
|
|
1588
|
+
return this.list({
|
|
1589
|
+
topicId: requireTopicId(args),
|
|
1590
|
+
status: args.includeAnswered ? undefined : "open",
|
|
1591
|
+
}).then((data) => {
|
|
1592
|
+
const questions = (
|
|
1593
|
+
Array.isArray(data.questions) ? data.questions : []
|
|
1594
|
+
) as Array<{ priority?: string } & Record<string, unknown>>;
|
|
1595
|
+
const rank = (priority: string | undefined): number => {
|
|
1596
|
+
switch (priority) {
|
|
1597
|
+
case "urgent":
|
|
1598
|
+
return 4;
|
|
1599
|
+
case "high":
|
|
1600
|
+
return 3;
|
|
1601
|
+
case "medium":
|
|
1602
|
+
return 2;
|
|
1603
|
+
case "low":
|
|
1604
|
+
return 1;
|
|
1605
|
+
default:
|
|
1606
|
+
return 0;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
return {
|
|
1611
|
+
questions: [...questions]
|
|
1612
|
+
.sort((a, b) => rank(b.priority) - rank(a.priority))
|
|
1613
|
+
.slice(0, args.limit ?? 20),
|
|
1614
|
+
};
|
|
1615
|
+
});
|
|
1616
|
+
},
|
|
1617
|
+
async findMissing(args: {
|
|
1618
|
+
topicId?: string;
|
|
1619
|
+
minConfidence?: number;
|
|
1620
|
+
}) {
|
|
1621
|
+
return graphFacade
|
|
1622
|
+
.gaps({
|
|
1623
|
+
topicId: requireTopicId(args),
|
|
1624
|
+
minConfidence: args.minConfidence,
|
|
1625
|
+
})
|
|
1626
|
+
.then(exposeGatewayData);
|
|
1627
|
+
},
|
|
1628
|
+
},
|
|
1629
|
+
graph: {
|
|
1630
|
+
nodes: nodesNamespace,
|
|
1631
|
+
createEdge(input: Parameters<typeof graphClient.createEdge>[0]) {
|
|
1632
|
+
return graphClient.createEdge(input);
|
|
1633
|
+
},
|
|
1634
|
+
neighborhood(args: Parameters<typeof graphClient.neighborhood>[0]) {
|
|
1635
|
+
return graphFacade
|
|
1636
|
+
.neighborhood({
|
|
1637
|
+
globalId: args.globalId,
|
|
1638
|
+
globalIds:
|
|
1639
|
+
typeof args.globalIds === "string"
|
|
1640
|
+
? args.globalIds
|
|
1641
|
+
.split(",")
|
|
1642
|
+
.map((value) => value.trim())
|
|
1643
|
+
.filter((value) => value.length > 0)
|
|
1644
|
+
: undefined,
|
|
1645
|
+
maxDepth: args.maxDepth,
|
|
1646
|
+
})
|
|
1647
|
+
.then(exposeGatewayData);
|
|
1648
|
+
},
|
|
1649
|
+
queryLineage,
|
|
1650
|
+
getConfidenceHistory,
|
|
1651
|
+
getAuditTrail,
|
|
1652
|
+
traverse(args: {
|
|
1653
|
+
startNode: string;
|
|
1654
|
+
direction?: string;
|
|
1655
|
+
maxDepth?: number;
|
|
1656
|
+
topicId?: string;
|
|
1657
|
+
}) {
|
|
1658
|
+
return graphFacade
|
|
1659
|
+
.traverse({
|
|
1660
|
+
startNode: args.startNode,
|
|
1661
|
+
direction: args.direction,
|
|
1662
|
+
maxDepth: args.maxDepth ?? 3,
|
|
1663
|
+
topicId: args.topicId,
|
|
1664
|
+
})
|
|
1665
|
+
.then(exposeGatewayData);
|
|
1666
|
+
},
|
|
1667
|
+
analyze(args: {
|
|
1668
|
+
topicId?: string;
|
|
1669
|
+
limit?: number;
|
|
1670
|
+
metric?: string;
|
|
1671
|
+
}) {
|
|
1672
|
+
return graphFacade
|
|
1673
|
+
.analyze({
|
|
1674
|
+
topicId: requireTopicId(args),
|
|
1675
|
+
limit: args.limit,
|
|
1676
|
+
metric: args.metric as never,
|
|
1677
|
+
})
|
|
1678
|
+
.then(exposeGatewayData);
|
|
1679
|
+
},
|
|
1680
|
+
bias(args: {
|
|
1681
|
+
topicId?: string;
|
|
1682
|
+
threshold?: number;
|
|
1683
|
+
limit?: number;
|
|
1684
|
+
}) {
|
|
1685
|
+
return graphFacade
|
|
1686
|
+
.bias({
|
|
1687
|
+
topicId: requireTopicId(args),
|
|
1688
|
+
threshold: args.threshold,
|
|
1689
|
+
limit: args.limit,
|
|
1690
|
+
})
|
|
1691
|
+
.then(exposeGatewayData);
|
|
1692
|
+
},
|
|
1693
|
+
gaps(args: {
|
|
1694
|
+
topicId?: string;
|
|
1695
|
+
minConfidence?: number;
|
|
1696
|
+
}) {
|
|
1697
|
+
return graphFacade
|
|
1698
|
+
.gaps({
|
|
1699
|
+
topicId: requireTopicId(args),
|
|
1700
|
+
minConfidence: args.minConfidence,
|
|
1701
|
+
})
|
|
1702
|
+
.then(exposeGatewayData);
|
|
1703
|
+
},
|
|
1704
|
+
falsify(args: {
|
|
1705
|
+
topicId?: string;
|
|
1706
|
+
beliefId?: string;
|
|
1707
|
+
beliefIds?: string[];
|
|
1708
|
+
minConfidence?: number;
|
|
1709
|
+
}) {
|
|
1710
|
+
return graphFacade
|
|
1711
|
+
.falsify({
|
|
1712
|
+
topicId: args.topicId,
|
|
1713
|
+
beliefId: args.beliefId,
|
|
1714
|
+
beliefIds: args.beliefIds,
|
|
1715
|
+
minConfidence: args.minConfidence,
|
|
1716
|
+
})
|
|
1717
|
+
.then(exposeGatewayData);
|
|
1718
|
+
},
|
|
1719
|
+
traceEntityImpact(args: { nodeId: string; topicId?: string }) {
|
|
1720
|
+
return traceEntityImpactCompat({
|
|
1721
|
+
nodeId: args.nodeId,
|
|
1722
|
+
topicId: args.topicId,
|
|
1723
|
+
});
|
|
1724
|
+
},
|
|
1725
|
+
searchBeliefs,
|
|
1726
|
+
findContradictions,
|
|
1727
|
+
bisectConfidence,
|
|
1728
|
+
listBeliefs,
|
|
1729
|
+
detectConfirmationBias(
|
|
1730
|
+
topicId: string,
|
|
1731
|
+
threshold?: number
|
|
1732
|
+
) {
|
|
1733
|
+
return this.bias({
|
|
1734
|
+
topicId,
|
|
1735
|
+
threshold,
|
|
1736
|
+
limit: 200,
|
|
1737
|
+
}).then((response) => ({
|
|
1738
|
+
...response,
|
|
1739
|
+
topicId,
|
|
1740
|
+
threshold: threshold ?? 0.7,
|
|
1741
|
+
}));
|
|
1742
|
+
},
|
|
1743
|
+
getStructureAnalysis(topicId: string) {
|
|
1744
|
+
return this.analyze({
|
|
1745
|
+
topicId,
|
|
1746
|
+
limit: 200,
|
|
1747
|
+
}).then((response) => ({
|
|
1748
|
+
...response,
|
|
1749
|
+
topicId,
|
|
1750
|
+
}));
|
|
1751
|
+
},
|
|
1752
|
+
getFalsificationQuestions(
|
|
1753
|
+
topicId: string,
|
|
1754
|
+
beliefIds?: string[]
|
|
1755
|
+
) {
|
|
1756
|
+
return graphFacade
|
|
1757
|
+
.falsify({
|
|
1758
|
+
topicId,
|
|
1759
|
+
beliefIds,
|
|
1760
|
+
})
|
|
1761
|
+
.then(exposeGatewayData)
|
|
1762
|
+
.then((response) => ({
|
|
1763
|
+
topicId,
|
|
1764
|
+
questions: response.questions,
|
|
1765
|
+
}));
|
|
1766
|
+
},
|
|
1767
|
+
},
|
|
1768
|
+
judgments: {
|
|
1769
|
+
create(input: RecordJudgmentInput) {
|
|
1770
|
+
return decisionsClient.createJudgment(input);
|
|
1771
|
+
},
|
|
1772
|
+
record(input: RecordJudgmentInput) {
|
|
1773
|
+
return decisionsClient.recordJudgment(input);
|
|
1774
|
+
},
|
|
1775
|
+
list(query: Parameters<typeof decisionsClient.listJudgments>[0]) {
|
|
1776
|
+
return decisionsClient.listJudgments(query);
|
|
1777
|
+
},
|
|
1778
|
+
get(judgmentId: string) {
|
|
1779
|
+
return decisionsClient.getJudgment(judgmentId);
|
|
1780
|
+
},
|
|
1781
|
+
recordOutcome(
|
|
1782
|
+
judgmentId: string,
|
|
1783
|
+
input: Parameters<typeof decisionsClient.recordJudgmentOutcome>[1]
|
|
1784
|
+
) {
|
|
1785
|
+
return decisionsClient.recordJudgmentOutcome(judgmentId, input);
|
|
1786
|
+
},
|
|
1787
|
+
updateOutcome(
|
|
1788
|
+
judgmentId: string,
|
|
1789
|
+
input: Parameters<typeof decisionsClient.updateJudgmentOutcome>[1]
|
|
1790
|
+
) {
|
|
1791
|
+
return decisionsClient.updateJudgmentOutcome(judgmentId, input);
|
|
1792
|
+
},
|
|
1793
|
+
readiness(topicId: string) {
|
|
1794
|
+
return decisionsClient.getJudgmentReadiness({
|
|
1795
|
+
topicId,
|
|
1796
|
+
});
|
|
1797
|
+
},
|
|
1798
|
+
calibration(topicId: string) {
|
|
1799
|
+
return decisionsClient.getJudgmentCalibration({
|
|
1800
|
+
topicId,
|
|
1801
|
+
});
|
|
1802
|
+
},
|
|
1803
|
+
pendingOutcomeReview(topicId: string) {
|
|
1804
|
+
return decisionsClient.listPendingJudgmentOutcomeReview({
|
|
1805
|
+
topicId,
|
|
1806
|
+
});
|
|
1807
|
+
},
|
|
1808
|
+
transitionAuditIntegrity(args: {
|
|
1809
|
+
topicId?: string;
|
|
1810
|
+
judgmentId?: string;
|
|
1811
|
+
includePassing?: boolean;
|
|
1812
|
+
}) {
|
|
1813
|
+
return decisionsClient.getJudgmentTransitionAuditIntegrity({
|
|
1814
|
+
...args,
|
|
1815
|
+
topicId: requireTopicId(args),
|
|
1816
|
+
});
|
|
1817
|
+
},
|
|
1818
|
+
},
|
|
1819
|
+
worktrees: {
|
|
1820
|
+
createBranch(input: Parameters<typeof workflowClient.createBranch>[0]) {
|
|
1821
|
+
return workflowClient.createBranch(input);
|
|
1822
|
+
},
|
|
1823
|
+
createLens(input: Parameters<typeof workflowClient.createLens>[0]) {
|
|
1824
|
+
return workflowClient.createLens(input);
|
|
1825
|
+
},
|
|
1826
|
+
listLenses(query: Parameters<typeof workflowClient.listLenses>[0]) {
|
|
1827
|
+
return workflowClient.listLenses(query);
|
|
1828
|
+
},
|
|
1829
|
+
applyLensToTopic(
|
|
1830
|
+
input: Parameters<typeof workflowClient.applyLensToTopic>[0]
|
|
1831
|
+
) {
|
|
1832
|
+
return workflowClient.applyLensToTopic(input);
|
|
1833
|
+
},
|
|
1834
|
+
removeLensFromTopic(
|
|
1835
|
+
input: Parameters<typeof workflowClient.removeLensFromTopic>[0]
|
|
1836
|
+
) {
|
|
1837
|
+
return workflowClient.removeLensFromTopic(input);
|
|
1838
|
+
},
|
|
1839
|
+
create(input: AddWorktreeInput) {
|
|
1840
|
+
return worktreesFacade.create({
|
|
1841
|
+
title: input.title,
|
|
1842
|
+
topicId: requireTopicId(input),
|
|
1843
|
+
objective: input.objective,
|
|
1844
|
+
hypothesis: input.hypothesis,
|
|
1845
|
+
beliefIds: input.beliefIds,
|
|
1846
|
+
autoShape: input.autoShape,
|
|
1847
|
+
domainPackId: input.domainPackId,
|
|
1848
|
+
executionOrder: input.executionOrder,
|
|
1849
|
+
dependsOn: input.dependsOn,
|
|
1850
|
+
blocks: input.blocks,
|
|
1851
|
+
gate: input.gate,
|
|
1852
|
+
proofArtifacts: input.proofArtifacts,
|
|
1853
|
+
staffingHint:
|
|
1854
|
+
typeof input.staffingHint === "string"
|
|
1855
|
+
? input.staffingHint
|
|
1856
|
+
: undefined,
|
|
1857
|
+
lastReconciledAt: input.lastReconciledAt,
|
|
1858
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
1859
|
+
});
|
|
1860
|
+
},
|
|
1861
|
+
add(input: AddWorktreeInput) {
|
|
1862
|
+
return worktreesFacade.create({
|
|
1863
|
+
title: input.title,
|
|
1864
|
+
topicId: requireTopicId(input),
|
|
1865
|
+
objective: input.objective,
|
|
1866
|
+
hypothesis: input.hypothesis,
|
|
1867
|
+
beliefIds: input.beliefIds,
|
|
1868
|
+
autoShape: input.autoShape,
|
|
1869
|
+
domainPackId: input.domainPackId,
|
|
1870
|
+
executionOrder: input.executionOrder,
|
|
1871
|
+
dependsOn: input.dependsOn,
|
|
1872
|
+
blocks: input.blocks,
|
|
1873
|
+
gate: input.gate,
|
|
1874
|
+
proofArtifacts: input.proofArtifacts,
|
|
1875
|
+
staffingHint:
|
|
1876
|
+
typeof input.staffingHint === "string"
|
|
1877
|
+
? input.staffingHint
|
|
1878
|
+
: undefined,
|
|
1879
|
+
lastReconciledAt: input.lastReconciledAt,
|
|
1880
|
+
autoFixPolicy: input.autoFixPolicy,
|
|
1881
|
+
});
|
|
1882
|
+
},
|
|
1883
|
+
list(query: Parameters<typeof workflowClient.listWorktrees>[0]) {
|
|
1884
|
+
return worktreesFacade.list({
|
|
1885
|
+
topicId: requireTopicId(query),
|
|
1886
|
+
status: query.status,
|
|
1887
|
+
limit: query.limit,
|
|
1888
|
+
});
|
|
1889
|
+
},
|
|
1890
|
+
activate(worktreeId: string) {
|
|
1891
|
+
return worktreesFacade.activate({ id: worktreeId });
|
|
1892
|
+
},
|
|
1893
|
+
updateMetadata(
|
|
1894
|
+
input: Parameters<typeof mcpParityClient.updateWorktreeMetadata>[0]
|
|
1895
|
+
) {
|
|
1896
|
+
const dependsOn = Array.isArray(input.dependsOn)
|
|
1897
|
+
? input.dependsOn.filter(
|
|
1898
|
+
(value): value is string => typeof value === "string"
|
|
1899
|
+
)
|
|
1900
|
+
: undefined;
|
|
1901
|
+
const blocks = Array.isArray(input.blocks)
|
|
1902
|
+
? input.blocks.filter((value): value is string => typeof value === "string")
|
|
1903
|
+
: undefined;
|
|
1904
|
+
return worktreesFacade.update({
|
|
1905
|
+
id: typeof input.worktreeId === "string" ? input.worktreeId : "",
|
|
1906
|
+
hypothesis: typeof input.hypothesis === "string" ? input.hypothesis : undefined,
|
|
1907
|
+
track: typeof input.track === "string" ? input.track : undefined,
|
|
1908
|
+
trackPosition:
|
|
1909
|
+
typeof input.trackPosition === "number" ? input.trackPosition : undefined,
|
|
1910
|
+
executionBand:
|
|
1911
|
+
typeof input.executionBand === "number" ? input.executionBand : undefined,
|
|
1912
|
+
executionOrder:
|
|
1913
|
+
typeof input.executionOrder === "number" ? input.executionOrder : undefined,
|
|
1914
|
+
dependsOn,
|
|
1915
|
+
blocks,
|
|
1916
|
+
gate: typeof input.gate === "string" ? input.gate : undefined,
|
|
1917
|
+
});
|
|
1918
|
+
},
|
|
1919
|
+
update(
|
|
1920
|
+
input: Parameters<typeof mcpParityClient.updateWorktreeMetadata>[0]
|
|
1921
|
+
) {
|
|
1922
|
+
return this.updateMetadata(input);
|
|
1923
|
+
},
|
|
1924
|
+
updateTargets(
|
|
1925
|
+
input: Parameters<typeof workflowClient.updateWorktreeTargets>[0]
|
|
1926
|
+
) {
|
|
1927
|
+
return worktreesFacade.updateTargets({
|
|
1928
|
+
id: input.worktreeId,
|
|
1929
|
+
addBeliefIds: input.addBeliefIds,
|
|
1930
|
+
addQuestionIds: input.addQuestionIds,
|
|
1931
|
+
removeBeliefIds: input.removeBeliefIds,
|
|
1932
|
+
removeQuestionIds: input.removeQuestionIds,
|
|
1933
|
+
});
|
|
1934
|
+
},
|
|
1935
|
+
listAll(
|
|
1936
|
+
query: Parameters<typeof workflowClient.listAllWorktrees>[0] = {}
|
|
1937
|
+
) {
|
|
1938
|
+
return workflowClient.listAllWorktrees(query);
|
|
1939
|
+
},
|
|
1940
|
+
merge(worktreeId: string, input: MergeInput) {
|
|
1941
|
+
return worktreesFacade.merge({
|
|
1942
|
+
id: worktreeId,
|
|
1943
|
+
outcomes: input.outcomes,
|
|
1944
|
+
summary: input.summary,
|
|
1945
|
+
});
|
|
1946
|
+
},
|
|
1947
|
+
push(
|
|
1948
|
+
worktreeId: string,
|
|
1949
|
+
input: Parameters<typeof workflowClient.push>[1]
|
|
1950
|
+
) {
|
|
1951
|
+
return workflowClient.push(worktreeId, input);
|
|
1952
|
+
},
|
|
1953
|
+
openPullRequest(
|
|
1954
|
+
worktreeId: string,
|
|
1955
|
+
input: Parameters<typeof workflowClient.openPullRequest>[1]
|
|
1956
|
+
) {
|
|
1957
|
+
return workflowClient.openPullRequest(worktreeId, input);
|
|
1958
|
+
},
|
|
1959
|
+
pipelineSnapshot(topicId: string) {
|
|
1960
|
+
return mcpParityClient.pipelineSnapshot({ topicId });
|
|
1961
|
+
},
|
|
1962
|
+
complete(
|
|
1963
|
+
input: Parameters<typeof worktreesFacade.complete>[0],
|
|
1964
|
+
idempotencyKey?: string
|
|
1965
|
+
) {
|
|
1966
|
+
return worktreesFacade.complete(input, idempotencyKey);
|
|
1967
|
+
},
|
|
1968
|
+
advancePhase(
|
|
1969
|
+
worktreeId: string,
|
|
1970
|
+
idempotencyKey?: string
|
|
1971
|
+
) {
|
|
1972
|
+
return worktreesFacade.advancePhase(
|
|
1973
|
+
{ worktreeId },
|
|
1974
|
+
idempotencyKey
|
|
1975
|
+
);
|
|
1976
|
+
},
|
|
1977
|
+
setPhase(
|
|
1978
|
+
worktreeId: string,
|
|
1979
|
+
phase: string,
|
|
1980
|
+
idempotencyKey?: string
|
|
1981
|
+
) {
|
|
1982
|
+
return worktreesFacade.setPhase(
|
|
1983
|
+
{ worktreeId, phase },
|
|
1984
|
+
idempotencyKey
|
|
1985
|
+
);
|
|
1986
|
+
},
|
|
1987
|
+
patchState(
|
|
1988
|
+
input: Parameters<typeof worktreesFacade.patchState>[0],
|
|
1989
|
+
idempotencyKey?: string
|
|
1990
|
+
) {
|
|
1991
|
+
return worktreesFacade.patchState(input, idempotencyKey);
|
|
1992
|
+
},
|
|
1993
|
+
bulkCreate(
|
|
1994
|
+
input: Parameters<typeof worktreesFacade.bulkCreate>[0],
|
|
1995
|
+
idempotencyKey?: string
|
|
1996
|
+
) {
|
|
1997
|
+
return worktreesFacade.bulkCreate(input, idempotencyKey);
|
|
1998
|
+
},
|
|
1999
|
+
},
|
|
2000
|
+
context: {
|
|
2001
|
+
listTopics(query: Parameters<typeof topicsClient.list>[0] = {}) {
|
|
2002
|
+
return topicsFacade.list({
|
|
2003
|
+
ontologyId: query.ontologyId,
|
|
2004
|
+
parentTopicId: query.parentTopicId,
|
|
2005
|
+
status: query.status as
|
|
2006
|
+
| "active"
|
|
2007
|
+
| "archived"
|
|
2008
|
+
| "watching"
|
|
2009
|
+
| undefined,
|
|
2010
|
+
type: query.type,
|
|
2011
|
+
});
|
|
2012
|
+
},
|
|
2013
|
+
compile(
|
|
2014
|
+
topicId: string,
|
|
2015
|
+
input: Parameters<typeof contextClient.compile>[1] = {}
|
|
2016
|
+
) {
|
|
2017
|
+
return contextClient.compile(topicId, input);
|
|
2018
|
+
},
|
|
2019
|
+
recordScopeLearning(
|
|
2020
|
+
input: Parameters<typeof mcpParityClient.recordScopeLearning>[0]
|
|
2021
|
+
) {
|
|
2022
|
+
return mcpParityClient.recordScopeLearning(input);
|
|
2023
|
+
},
|
|
2024
|
+
discover(input: Parameters<typeof mcpParityClient.discover>[0]) {
|
|
2025
|
+
return discoverTopics(input as JsonObject);
|
|
2026
|
+
},
|
|
2027
|
+
analyzeTopicDensity(
|
|
2028
|
+
input: Parameters<typeof mcpParityClient.analyzeTopicDensity>[0]
|
|
2029
|
+
) {
|
|
2030
|
+
return mcpParityClient.analyzeTopicDensity(input);
|
|
2031
|
+
},
|
|
2032
|
+
applyAutoBranching(
|
|
2033
|
+
input: Parameters<typeof mcpParityClient.applyAutoBranching>[0]
|
|
2034
|
+
) {
|
|
2035
|
+
return mcpParityClient.applyAutoBranching(input);
|
|
2036
|
+
},
|
|
2037
|
+
seedBeliefLattice(
|
|
2038
|
+
input: Parameters<typeof mcpParityClient.seedBeliefLattice>[0] = {}
|
|
2039
|
+
) {
|
|
2040
|
+
return mcpParityClient.seedBeliefLattice(input);
|
|
2041
|
+
},
|
|
2042
|
+
getLatticeCoverage(
|
|
2043
|
+
input: Parameters<typeof mcpParityClient.getLatticeCoverage>[0] = {}
|
|
2044
|
+
) {
|
|
2045
|
+
return mcpParityClient.getLatticeCoverage(input);
|
|
2046
|
+
},
|
|
2047
|
+
matchEntityType(
|
|
2048
|
+
input: Parameters<typeof mcpParityClient.matchEntityType>[0]
|
|
2049
|
+
) {
|
|
2050
|
+
return ontologiesFacade
|
|
2051
|
+
.match(input as Parameters<typeof ontologiesFacade.match>[0])
|
|
2052
|
+
.then(exposeGatewayData);
|
|
2053
|
+
},
|
|
2054
|
+
discoverEntityConnections(
|
|
2055
|
+
input: Parameters<typeof mcpParityClient.discoverEntityConnections>[0]
|
|
2056
|
+
) {
|
|
2057
|
+
return discoverEntityConnections(input as JsonObject);
|
|
2058
|
+
},
|
|
2059
|
+
triggerBeliefReview(
|
|
2060
|
+
input: Parameters<typeof mcpParityClient.triggerBeliefReview>[0]
|
|
2061
|
+
) {
|
|
2062
|
+
return triggerBeliefReview(input as JsonObject);
|
|
2063
|
+
},
|
|
2064
|
+
},
|
|
2065
|
+
tasks: {
|
|
2066
|
+
create(input: CreateTaskInput) {
|
|
2067
|
+
return tasksFacade.create({
|
|
2068
|
+
topicId: requireTopicId(input),
|
|
2069
|
+
title: input.title,
|
|
2070
|
+
description: input.description,
|
|
2071
|
+
taskType: input.taskType,
|
|
2072
|
+
priority: input.priority,
|
|
2073
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
2074
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
2075
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
2076
|
+
});
|
|
2077
|
+
},
|
|
2078
|
+
complete(taskId: string, input: CompleteTaskInput) {
|
|
2079
|
+
return tasksFacade.complete({
|
|
2080
|
+
id: taskId,
|
|
2081
|
+
outputSummary: input.outputSummary,
|
|
2082
|
+
});
|
|
2083
|
+
},
|
|
2084
|
+
update(taskId: string, input: UpdateTaskInput) {
|
|
2085
|
+
return tasksFacade.update({
|
|
2086
|
+
id: taskId,
|
|
2087
|
+
title: input.title,
|
|
2088
|
+
description: input.description,
|
|
2089
|
+
priority: input.priority,
|
|
2090
|
+
status: input.status,
|
|
2091
|
+
linkedBeliefId: input.linkedBeliefId,
|
|
2092
|
+
linkedQuestionId: input.linkedQuestionId,
|
|
2093
|
+
linkedWorktreeId: input.linkedWorktreeId,
|
|
2094
|
+
});
|
|
2095
|
+
},
|
|
2096
|
+
list(input: Parameters<typeof mcpParityClient.listTasks>[0]) {
|
|
2097
|
+
return tasksFacade.list({
|
|
2098
|
+
topicId: resolveTopicId(input),
|
|
2099
|
+
worktreeId:
|
|
2100
|
+
typeof input.worktreeId === "string"
|
|
2101
|
+
? input.worktreeId
|
|
2102
|
+
: typeof input.linkedWorktreeId === "string"
|
|
2103
|
+
? input.linkedWorktreeId
|
|
2104
|
+
: undefined,
|
|
2105
|
+
status: typeof input.status === "string" ? input.status : undefined,
|
|
2106
|
+
limit: typeof input.limit === "number" ? input.limit : undefined,
|
|
2107
|
+
});
|
|
2108
|
+
},
|
|
2109
|
+
},
|
|
2110
|
+
topics: {
|
|
2111
|
+
list(input: Parameters<typeof topicsClient.list>[0] = {}) {
|
|
2112
|
+
return topicsFacade.list({
|
|
2113
|
+
ontologyId: input.ontologyId,
|
|
2114
|
+
parentTopicId: input.parentTopicId,
|
|
2115
|
+
status: input.status as "active" | "archived" | "watching" | undefined,
|
|
2116
|
+
type: input.type,
|
|
2117
|
+
});
|
|
2118
|
+
},
|
|
2119
|
+
get(topicId: string) {
|
|
2120
|
+
return topicsFacade.get(topicId);
|
|
2121
|
+
},
|
|
2122
|
+
create(input: Parameters<typeof topicsClient.create>[0]) {
|
|
2123
|
+
return topicsFacade.create({
|
|
2124
|
+
name: input.name,
|
|
2125
|
+
description: input.description,
|
|
2126
|
+
type: input.type,
|
|
2127
|
+
parentTopicId: input.parentTopicId,
|
|
2128
|
+
ontologyId: input.ontologyId,
|
|
2129
|
+
tenantId: input.tenantId,
|
|
2130
|
+
workspaceId: input.workspaceId,
|
|
2131
|
+
visibility: input.visibility,
|
|
2132
|
+
createdBy: input.createdBy,
|
|
2133
|
+
});
|
|
2134
|
+
},
|
|
2135
|
+
update(
|
|
2136
|
+
topicId: string,
|
|
2137
|
+
input: Parameters<typeof topicsClient.update>[1]
|
|
2138
|
+
) {
|
|
2139
|
+
return topicsFacade.update({
|
|
2140
|
+
id: topicId,
|
|
2141
|
+
name: input.name,
|
|
2142
|
+
description: input.description,
|
|
2143
|
+
type: input.type,
|
|
2144
|
+
ontologyId: input.ontologyId,
|
|
2145
|
+
clearOntologyId: input.clearOntologyId,
|
|
2146
|
+
status: input.status,
|
|
2147
|
+
visibility: input.visibility,
|
|
2148
|
+
});
|
|
2149
|
+
},
|
|
2150
|
+
tree(
|
|
2151
|
+
topicId: string,
|
|
2152
|
+
query: Parameters<typeof topicsClient.getTree>[1] = {}
|
|
2153
|
+
) {
|
|
2154
|
+
return topicsFacade.tree({
|
|
2155
|
+
id: topicId,
|
|
2156
|
+
maxDepth: query.maxDepth,
|
|
2157
|
+
});
|
|
2158
|
+
},
|
|
2159
|
+
getTree(input: { rootId: string; maxDepth?: number }) {
|
|
2160
|
+
return topicsFacade.tree({
|
|
2161
|
+
id: input.rootId,
|
|
2162
|
+
maxDepth: input.maxDepth,
|
|
2163
|
+
});
|
|
2164
|
+
},
|
|
2165
|
+
coverage(
|
|
2166
|
+
topicId: string,
|
|
2167
|
+
query: Parameters<typeof topicsClient.getCoverage>[1] = {}
|
|
2168
|
+
) {
|
|
2169
|
+
return topicsFacade.coverage({
|
|
2170
|
+
id: topicId,
|
|
2171
|
+
includeDescendants: query.includeDescendants,
|
|
2172
|
+
maxDepth: query.maxDepth,
|
|
2173
|
+
});
|
|
2174
|
+
},
|
|
2175
|
+
remove(topicId: string, idempotencyKey?: string) {
|
|
2176
|
+
return topicsFacade.remove(topicId, idempotencyKey);
|
|
2177
|
+
},
|
|
2178
|
+
bulkCreate(
|
|
2179
|
+
input: Parameters<typeof topicsFacade.bulkCreate>[0],
|
|
2180
|
+
idempotencyKey?: string
|
|
2181
|
+
) {
|
|
2182
|
+
return topicsFacade.bulkCreate(input, idempotencyKey);
|
|
2183
|
+
},
|
|
2184
|
+
},
|
|
2185
|
+
answers: {
|
|
2186
|
+
create(input: Parameters<typeof mcpParityClient.createAnswer>[0]) {
|
|
2187
|
+
const questionId =
|
|
2188
|
+
typeof input.questionNodeId === "string" ? input.questionNodeId : "";
|
|
2189
|
+
if (!questionId) {
|
|
2190
|
+
throw new Error("questionNodeId is required");
|
|
2191
|
+
}
|
|
2192
|
+
const text =
|
|
2193
|
+
typeof input.answerText === "string" ? input.answerText : "";
|
|
2194
|
+
if (!text) {
|
|
2195
|
+
throw new Error("answerText is required");
|
|
2196
|
+
}
|
|
2197
|
+
const confidence =
|
|
2198
|
+
input.confidence === "moderate" ? "medium" : input.confidence;
|
|
2199
|
+
|
|
2200
|
+
return questionsFacade.answer(questionId, {
|
|
2201
|
+
text,
|
|
2202
|
+
confidence:
|
|
2203
|
+
typeof confidence === "string" ? confidence : undefined,
|
|
2204
|
+
evidenceIds: Array.isArray(input.evidenceNodeIds)
|
|
2205
|
+
? input.evidenceNodeIds.filter(
|
|
2206
|
+
(value): value is string => typeof value === "string"
|
|
2207
|
+
)
|
|
2208
|
+
: undefined,
|
|
2209
|
+
});
|
|
2210
|
+
},
|
|
2211
|
+
get(input: Parameters<typeof mcpParityClient.getAnswer>[0]) {
|
|
2212
|
+
const questionId =
|
|
2213
|
+
typeof input.questionNodeId === "string" ? input.questionNodeId : "";
|
|
2214
|
+
if (!questionId) {
|
|
2215
|
+
throw new Error("questionNodeId is required");
|
|
2216
|
+
}
|
|
2217
|
+
return answersClient.get(questionId);
|
|
2218
|
+
},
|
|
2219
|
+
},
|
|
2220
|
+
contradictions: {
|
|
2221
|
+
flag(args: {
|
|
2222
|
+
beliefA: string;
|
|
2223
|
+
beliefB: string;
|
|
2224
|
+
description: string;
|
|
2225
|
+
topicId?: string;
|
|
2226
|
+
severity?: string;
|
|
2227
|
+
defeatType?: string;
|
|
2228
|
+
}) {
|
|
2229
|
+
return contradictionsFacade
|
|
2230
|
+
.flag({
|
|
2231
|
+
beliefA: args.beliefA,
|
|
2232
|
+
beliefB: args.beliefB,
|
|
2233
|
+
description: args.description,
|
|
2234
|
+
topicId: requireTopicId(args),
|
|
2235
|
+
severity: args.severity,
|
|
2236
|
+
defeatType: args.defeatType,
|
|
2237
|
+
})
|
|
2238
|
+
.then(exposeGatewayData);
|
|
2239
|
+
},
|
|
2240
|
+
list(args: {
|
|
2241
|
+
topicId?: string;
|
|
2242
|
+
status?: string;
|
|
2243
|
+
limit?: number;
|
|
2244
|
+
cursor?: string;
|
|
2245
|
+
}) {
|
|
2246
|
+
return contradictionsFacade
|
|
2247
|
+
.list({
|
|
2248
|
+
topicId: requireTopicId(args),
|
|
2249
|
+
status: args.status,
|
|
2250
|
+
limit: args.limit,
|
|
2251
|
+
cursor: args.cursor,
|
|
2252
|
+
})
|
|
2253
|
+
.then(exposeGatewayData);
|
|
2254
|
+
},
|
|
2255
|
+
get(contradictionId: string) {
|
|
2256
|
+
return contradictionsFacade.get(contradictionId).then(exposeGatewayData);
|
|
2257
|
+
},
|
|
2258
|
+
find: findContradictions,
|
|
2259
|
+
},
|
|
2260
|
+
ontologies: {
|
|
2261
|
+
list(
|
|
2262
|
+
input: {
|
|
2263
|
+
tenantId?: string;
|
|
2264
|
+
tier?: string;
|
|
2265
|
+
status?: string;
|
|
2266
|
+
} = {}
|
|
2267
|
+
) {
|
|
2268
|
+
return ontologiesFacade.list(input).then(exposeGatewayData);
|
|
2269
|
+
},
|
|
2270
|
+
get(ontologyId: string) {
|
|
2271
|
+
return ontologiesFacade
|
|
2272
|
+
.get(ontologyId)
|
|
2273
|
+
.then((response) => exposeGatewayData(response));
|
|
2274
|
+
},
|
|
2275
|
+
bind(
|
|
2276
|
+
input: Parameters<typeof ontologiesFacade.bind>[0],
|
|
2277
|
+
idempotencyKey?: Parameters<typeof ontologiesFacade.bind>[1]
|
|
2278
|
+
) {
|
|
2279
|
+
return ontologiesFacade
|
|
2280
|
+
.bind(input, idempotencyKey)
|
|
2281
|
+
.then((response) => exposeGatewayData(response));
|
|
2282
|
+
},
|
|
2283
|
+
match(
|
|
2284
|
+
input: Parameters<typeof ontologiesFacade.match>[0],
|
|
2285
|
+
idempotencyKey?: Parameters<typeof ontologiesFacade.match>[1]
|
|
2286
|
+
) {
|
|
2287
|
+
return ontologiesFacade.match(input, idempotencyKey).then(exposeGatewayData);
|
|
2288
|
+
},
|
|
2289
|
+
create(input: Parameters<typeof mcpParityClient.createOntology>[0]) {
|
|
2290
|
+
return createOntologyCompat(input as JsonObject);
|
|
2291
|
+
},
|
|
2292
|
+
update(input: Parameters<typeof mcpParityClient.updateOntology>[0]) {
|
|
2293
|
+
return updateOntologyCompat(input as JsonObject);
|
|
2294
|
+
},
|
|
2295
|
+
archive(input: Parameters<typeof mcpParityClient.archiveOntology>[0]) {
|
|
2296
|
+
return archiveOntologyCompat(input as JsonObject);
|
|
2297
|
+
},
|
|
2298
|
+
createVersion(
|
|
2299
|
+
input: Parameters<typeof mcpParityClient.createOntologyVersion>[0]
|
|
2300
|
+
) {
|
|
2301
|
+
return createOntologyVersionCompat(input as JsonObject);
|
|
2302
|
+
},
|
|
2303
|
+
publishVersion(
|
|
2304
|
+
input: Parameters<typeof mcpParityClient.publishOntologyVersion>[0]
|
|
2305
|
+
) {
|
|
2306
|
+
return publishOntologyVersionCompat(input as JsonObject);
|
|
2307
|
+
},
|
|
2308
|
+
deprecateVersion(
|
|
2309
|
+
input: Parameters<typeof mcpParityClient.deprecateOntologyVersion>[0]
|
|
2310
|
+
) {
|
|
2311
|
+
return deprecateOntologyVersionCompat(input as JsonObject);
|
|
2312
|
+
},
|
|
2313
|
+
resolveEffective(
|
|
2314
|
+
input: Parameters<typeof mcpParityClient.resolveEffectiveOntology>[0]
|
|
2315
|
+
) {
|
|
2316
|
+
return resolveEffectiveOntologyCompat(input as JsonObject);
|
|
2317
|
+
},
|
|
2318
|
+
raw: ontologyClient,
|
|
2319
|
+
},
|
|
2320
|
+
coordination: {
|
|
2321
|
+
registerSession(
|
|
2322
|
+
input: Parameters<typeof mcpParityClient.registerSession>[0] = {}
|
|
2323
|
+
) {
|
|
2324
|
+
return mcpParityClient.registerSession(input);
|
|
2325
|
+
},
|
|
2326
|
+
heartbeatSession(
|
|
2327
|
+
input: Parameters<typeof mcpParityClient.heartbeatSession>[0] = {}
|
|
2328
|
+
) {
|
|
2329
|
+
return mcpParityClient.heartbeatSession(input);
|
|
2330
|
+
},
|
|
2331
|
+
endSession(
|
|
2332
|
+
input: Parameters<typeof mcpParityClient.endSession>[0] = {}
|
|
2333
|
+
) {
|
|
2334
|
+
return mcpParityClient.endSession(input);
|
|
2335
|
+
},
|
|
2336
|
+
listActiveSessions(
|
|
2337
|
+
input: Parameters<typeof mcpParityClient.listActiveSessions>[0] = {}
|
|
2338
|
+
) {
|
|
2339
|
+
return mcpParityClient.listActiveSessions(input);
|
|
2340
|
+
},
|
|
2341
|
+
sendAgentMessage(
|
|
2342
|
+
input: Parameters<typeof mcpParityClient.sendAgentMessage>[0]
|
|
2343
|
+
) {
|
|
2344
|
+
return mcpParityClient.sendAgentMessage(input);
|
|
2345
|
+
},
|
|
2346
|
+
broadcastMessage(
|
|
2347
|
+
input: Parameters<typeof mcpParityClient.broadcastMessage>[0]
|
|
2348
|
+
) {
|
|
2349
|
+
return mcpParityClient.broadcastMessage(input);
|
|
2350
|
+
},
|
|
2351
|
+
getInbox(
|
|
2352
|
+
input: Parameters<typeof mcpParityClient.getAgentInbox>[0] = {}
|
|
2353
|
+
) {
|
|
2354
|
+
return mcpParityClient.getAgentInbox(input);
|
|
2355
|
+
},
|
|
2356
|
+
claimFiles(input: Parameters<typeof mcpParityClient.claimFiles>[0]) {
|
|
2357
|
+
return mcpParityClient.claimFiles(input);
|
|
2358
|
+
},
|
|
2359
|
+
},
|
|
2360
|
+
policy: {
|
|
2361
|
+
checkPermission(
|
|
2362
|
+
input: Parameters<typeof mcpParityClient.checkPermission>[0]
|
|
2363
|
+
) {
|
|
2364
|
+
return policyClient.checkPermission({
|
|
2365
|
+
topicId: typeof input.topicId === "string" ? input.topicId : undefined,
|
|
2366
|
+
permission:
|
|
2367
|
+
typeof input.permission === "string"
|
|
2368
|
+
? (input.permission as "read" | "write")
|
|
2369
|
+
: undefined,
|
|
2370
|
+
principal:
|
|
2371
|
+
typeof input.principal === "string" ? input.principal : undefined,
|
|
2372
|
+
principalId:
|
|
2373
|
+
typeof input.principalId === "string" ? input.principalId : undefined,
|
|
2374
|
+
beliefClusterId:
|
|
2375
|
+
typeof input.beliefClusterId === "string"
|
|
2376
|
+
? input.beliefClusterId
|
|
2377
|
+
: undefined,
|
|
2378
|
+
});
|
|
2379
|
+
},
|
|
2380
|
+
listAccessibleTopics(
|
|
2381
|
+
input: Parameters<typeof policyClient.listAccessibleTopics>[0] = {}
|
|
2382
|
+
) {
|
|
2383
|
+
return policyClient.listAccessibleTopics({
|
|
2384
|
+
permission:
|
|
2385
|
+
typeof input.permission === "string"
|
|
2386
|
+
? (input.permission as "read" | "write")
|
|
2387
|
+
: undefined,
|
|
2388
|
+
includeShared:
|
|
2389
|
+
typeof input.includeShared === "boolean"
|
|
2390
|
+
? input.includeShared
|
|
2391
|
+
: undefined,
|
|
2392
|
+
principal:
|
|
2393
|
+
typeof input.principal === "string" ? input.principal : undefined,
|
|
2394
|
+
principalId:
|
|
2395
|
+
typeof input.principalId === "string" ? input.principalId : undefined,
|
|
2396
|
+
limit: typeof input.limit === "number" ? input.limit : undefined,
|
|
2397
|
+
});
|
|
2398
|
+
},
|
|
2399
|
+
filterByPermission(
|
|
2400
|
+
input: Parameters<typeof mcpParityClient.filterByPermission>[0]
|
|
2401
|
+
) {
|
|
2402
|
+
return policyClient.filterByPermission({
|
|
2403
|
+
topicIds: Array.isArray(input.topicIds)
|
|
2404
|
+
? input.topicIds.filter(
|
|
2405
|
+
(value): value is string => typeof value === "string"
|
|
2406
|
+
)
|
|
2407
|
+
: undefined,
|
|
2408
|
+
permission:
|
|
2409
|
+
typeof input.permission === "string"
|
|
2410
|
+
? (input.permission as "read" | "write")
|
|
2411
|
+
: undefined,
|
|
2412
|
+
principal:
|
|
2413
|
+
typeof input.principal === "string" ? input.principal : undefined,
|
|
2414
|
+
principalId:
|
|
2415
|
+
typeof input.principalId === "string" ? input.principalId : undefined,
|
|
2416
|
+
});
|
|
2417
|
+
},
|
|
2418
|
+
manageWritePolicy(
|
|
2419
|
+
input: Parameters<typeof mcpParityClient.manageWritePolicy>[0]
|
|
2420
|
+
) {
|
|
2421
|
+
return mcpParityClient.manageWritePolicy(input);
|
|
2422
|
+
},
|
|
2423
|
+
raw: policyClient,
|
|
2424
|
+
},
|
|
2425
|
+
observations: {
|
|
2426
|
+
ingest(input: Parameters<typeof mcpParityClient.ingestObservation>[0]) {
|
|
2427
|
+
return mcpParityClient.ingestObservation(input);
|
|
2428
|
+
},
|
|
2429
|
+
getContext(
|
|
2430
|
+
input: Parameters<typeof mcpParityClient.getObservationContext>[0]
|
|
2431
|
+
) {
|
|
2432
|
+
return mcpParityClient.getObservationContext(input);
|
|
2433
|
+
},
|
|
2434
|
+
},
|
|
2435
|
+
coding: {
|
|
2436
|
+
getCodeContext(input: Parameters<typeof mcpParityClient.getCodeContext>[0]) {
|
|
2437
|
+
return mcpParityClient.getCodeContext(input);
|
|
2438
|
+
},
|
|
2439
|
+
getChangeHistory(
|
|
2440
|
+
input: Parameters<typeof mcpParityClient.getChangeHistory>[0]
|
|
2441
|
+
) {
|
|
2442
|
+
return mcpParityClient.getChangeHistory(input);
|
|
2443
|
+
},
|
|
2444
|
+
recordAttempt(input: Parameters<typeof mcpParityClient.recordAttempt>[0]) {
|
|
2445
|
+
return mcpParityClient.recordAttempt(input);
|
|
2446
|
+
},
|
|
2447
|
+
getFailureLog(input: Parameters<typeof mcpParityClient.getFailureLog>[0]) {
|
|
2448
|
+
return mcpParityClient.getFailureLog(input);
|
|
2449
|
+
},
|
|
2450
|
+
},
|
|
2451
|
+
contracts: {
|
|
2452
|
+
create(
|
|
2453
|
+
input: Parameters<typeof mcpParityClient.createEpistemicContract>[0]
|
|
2454
|
+
) {
|
|
2455
|
+
return createContractCompat(input as JsonObject);
|
|
2456
|
+
},
|
|
2457
|
+
list(
|
|
2458
|
+
input: {
|
|
2459
|
+
beliefNodeId?: string;
|
|
2460
|
+
contractId?: string;
|
|
2461
|
+
status?: string;
|
|
2462
|
+
} = {}
|
|
2463
|
+
) {
|
|
2464
|
+
return listContractsCompat(input as JsonObject);
|
|
2465
|
+
},
|
|
2466
|
+
evaluate(input: Parameters<typeof mcpParityClient.evaluateContract>[0]) {
|
|
2467
|
+
return evaluateContractCompat(input as JsonObject);
|
|
2468
|
+
},
|
|
2469
|
+
getStatus(input: Parameters<typeof mcpParityClient.getContractStatus>[0]) {
|
|
2470
|
+
return getContractStatusCompat(input as JsonObject);
|
|
2471
|
+
},
|
|
2472
|
+
},
|
|
2473
|
+
bootstrap: {
|
|
2474
|
+
generateSessionHandoff(
|
|
2475
|
+
input: Parameters<typeof mcpParityClient.generateSessionHandoff>[0]
|
|
2476
|
+
) {
|
|
2477
|
+
return mcpParityClient.generateSessionHandoff(input);
|
|
2478
|
+
},
|
|
2479
|
+
},
|
|
2480
|
+
research: {
|
|
2481
|
+
searchSources(args: {
|
|
2482
|
+
query: string;
|
|
2483
|
+
topicId?: string;
|
|
2484
|
+
sources?: string[];
|
|
2485
|
+
}) {
|
|
2486
|
+
const topicId = requireTopicId(args);
|
|
2487
|
+
return graphClient
|
|
2488
|
+
.listNodes({
|
|
2489
|
+
topicId,
|
|
2490
|
+
nodeType: "source",
|
|
2491
|
+
limit: 100,
|
|
2492
|
+
})
|
|
2493
|
+
.then((response) => {
|
|
2494
|
+
const query = args.query.toLowerCase();
|
|
2495
|
+
const results = asNodeArray(response.data)
|
|
2496
|
+
.filter((node) => {
|
|
2497
|
+
const text = `${node.canonicalText ?? ""} ${
|
|
2498
|
+
typeof node.metadata?.title === "string"
|
|
2499
|
+
? node.metadata.title
|
|
2500
|
+
: ""
|
|
2501
|
+
}`.toLowerCase();
|
|
2502
|
+
if (!text.includes(query)) {
|
|
2503
|
+
return false;
|
|
2504
|
+
}
|
|
2505
|
+
if (!args.sources || args.sources.length === 0) {
|
|
2506
|
+
return true;
|
|
2507
|
+
}
|
|
2508
|
+
const sourceType =
|
|
2509
|
+
typeof node.metadata?.sourceType === "string"
|
|
2510
|
+
? node.metadata.sourceType.toLowerCase()
|
|
2511
|
+
: "";
|
|
2512
|
+
return args.sources.some((source) =>
|
|
2513
|
+
sourceType.includes(source.toLowerCase())
|
|
2514
|
+
);
|
|
2515
|
+
})
|
|
2516
|
+
.map((node) => ({
|
|
2517
|
+
title:
|
|
2518
|
+
typeof node.metadata?.title === "string"
|
|
2519
|
+
? node.metadata.title
|
|
2520
|
+
: (node.canonicalText ?? "Untitled source"),
|
|
2521
|
+
url:
|
|
2522
|
+
typeof node.metadata?.sourceUrl === "string"
|
|
2523
|
+
? node.metadata.sourceUrl
|
|
2524
|
+
: "",
|
|
2525
|
+
snippet: node.canonicalText ?? "",
|
|
2526
|
+
relevanceScore: 1,
|
|
2527
|
+
suggestedEvidence: node.canonicalText ?? "",
|
|
2528
|
+
}));
|
|
2529
|
+
return { results };
|
|
2530
|
+
});
|
|
2531
|
+
},
|
|
2532
|
+
async executeDeepResearch(args: {
|
|
2533
|
+
query: string;
|
|
2534
|
+
topicId?: string;
|
|
2535
|
+
depth?: "quick" | "standard" | "deep";
|
|
2536
|
+
}) {
|
|
2537
|
+
const sources = await this.searchSources({
|
|
2538
|
+
query: args.query,
|
|
2539
|
+
topicId: requireTopicId(args),
|
|
2540
|
+
sources: ["web"],
|
|
2541
|
+
});
|
|
2542
|
+
const sampleSize =
|
|
2543
|
+
args.depth === "deep" ? 10 : args.depth === "quick" ? 3 : 5;
|
|
2544
|
+
const selected = sources.results.slice(0, sampleSize);
|
|
2545
|
+
return {
|
|
2546
|
+
report: {
|
|
2547
|
+
summary:
|
|
2548
|
+
selected.length > 0
|
|
2549
|
+
? `Research completed for "${args.query}" with ${selected.length} relevant sources.`
|
|
2550
|
+
: `No relevant sources found for "${args.query}".`,
|
|
2551
|
+
findings: selected.map((source) => ({
|
|
2552
|
+
title: source.title,
|
|
2553
|
+
summary: source.snippet,
|
|
2554
|
+
sourceUrl: source.url,
|
|
2555
|
+
})),
|
|
2556
|
+
sources: selected.map((source) => ({
|
|
2557
|
+
title: source.title,
|
|
2558
|
+
url: source.url,
|
|
2559
|
+
})),
|
|
2560
|
+
linkedEvidence: [],
|
|
2561
|
+
linkedQuestions: [],
|
|
2562
|
+
},
|
|
2563
|
+
};
|
|
2564
|
+
},
|
|
2565
|
+
},
|
|
2566
|
+
tools: {
|
|
2567
|
+
register(registration: CustomToolRegistration) {
|
|
2568
|
+
return registerCustomTool(registration);
|
|
2569
|
+
},
|
|
2570
|
+
unregister(fullName: string) {
|
|
2571
|
+
return unregisterCustomTool(fullName);
|
|
2572
|
+
},
|
|
2573
|
+
list() {
|
|
2574
|
+
return listRegisteredCustomTools();
|
|
2575
|
+
},
|
|
2576
|
+
clear() {
|
|
2577
|
+
clearRegisteredCustomTools();
|
|
2578
|
+
},
|
|
2579
|
+
invoke(name: string, input: CustomToolInput = {}) {
|
|
2580
|
+
const fullName = name.includes(".") ? name : `custom.${name}`;
|
|
2581
|
+
return invokeCustomTool(fullName, input);
|
|
2582
|
+
},
|
|
2583
|
+
namespace(namespace: string) {
|
|
2584
|
+
return getCustomNamespace(namespace);
|
|
2585
|
+
},
|
|
2586
|
+
},
|
|
2587
|
+
packs: {
|
|
2588
|
+
/**
|
|
2589
|
+
* Ensure the configured packKey is installed.
|
|
2590
|
+
* No-op if no packKey was provided or if the pack is already installed.
|
|
2591
|
+
* Called automatically on first API use when packKey is set.
|
|
2592
|
+
*/
|
|
2593
|
+
ensurePack,
|
|
2594
|
+
/**
|
|
2595
|
+
* Check if the configured pack has been installed in this session.
|
|
2596
|
+
*/
|
|
2597
|
+
get isInstalled() {
|
|
2598
|
+
return _packInstalled;
|
|
2599
|
+
},
|
|
2600
|
+
listCatalog() {
|
|
2601
|
+
return packsClient.listCatalog();
|
|
2602
|
+
},
|
|
2603
|
+
catalog() {
|
|
2604
|
+
return packsClient.getCatalog();
|
|
2605
|
+
},
|
|
2606
|
+
listStates(scope?: Parameters<typeof packsClient.listStates>[0]) {
|
|
2607
|
+
return packsClient.listStates(scope);
|
|
2608
|
+
},
|
|
2609
|
+
states(scope?: Parameters<typeof packsClient.getStates>[0]) {
|
|
2610
|
+
return packsClient.getStates(scope);
|
|
2611
|
+
},
|
|
2612
|
+
install(input: Parameters<typeof packsClient.install>[0]) {
|
|
2613
|
+
return packsClient.install(input);
|
|
2614
|
+
},
|
|
2615
|
+
enable(input: Parameters<typeof packsClient.enable>[0]) {
|
|
2616
|
+
return packsClient.enable(input);
|
|
2617
|
+
},
|
|
2618
|
+
disable(input: Parameters<typeof packsClient.disable>[0]) {
|
|
2619
|
+
return packsClient.disable(input);
|
|
2620
|
+
},
|
|
2621
|
+
},
|
|
2622
|
+
nodes: nodesNamespace,
|
|
2623
|
+
identity: identityFacade,
|
|
2624
|
+
custom: getCustomNamespace("custom"),
|
|
2625
|
+
extensions: extensionNamespaces,
|
|
2626
|
+
raw: {
|
|
2627
|
+
beliefs: beliefsClient,
|
|
2628
|
+
graph: graphClient,
|
|
2629
|
+
decisions: decisionsClient,
|
|
2630
|
+
workflow: workflowClient,
|
|
2631
|
+
audit: auditClient,
|
|
2632
|
+
admin: adminClient,
|
|
2633
|
+
identity: identityClient,
|
|
2634
|
+
policy: policyClient,
|
|
2635
|
+
answers: answersClient,
|
|
2636
|
+
ontology: ontologyClient,
|
|
2637
|
+
mcpParity: mcpParityClient,
|
|
2638
|
+
packs: packsClient,
|
|
2639
|
+
reports: reportsClient,
|
|
2640
|
+
learning: learningClient,
|
|
2641
|
+
harness: harnessClient,
|
|
2642
|
+
schema: schemaClient,
|
|
2643
|
+
audiences: audiencesClient,
|
|
2644
|
+
topics: topicsClient,
|
|
2645
|
+
},
|
|
2646
|
+
};
|
|
2647
|
+
}
|