@lucern/sdk 0.2.0-alpha.1
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/README.md +97 -0
- package/dist/index.js +8980 -0
- package/dist/index.js.map +1 -0
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +53 -0
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +494 -0
- package/dist/lucern/contracts/src/lens-filter.contract.d.ts +70 -0
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +84 -0
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +151 -0
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +161 -0
- package/dist/lucern/mcp-server/src/context-pack-policy.d.ts +119 -0
- package/dist/lucern/mcp-server/src/context-pack-schema.d.ts +18 -0
- package/dist/lucern/modules/graph-primitives/src/ontology-matching.d.ts +78 -0
- package/dist/lucern/modules/graph-primitives/src/text-matching.d.ts +53 -0
- package/dist/lucern/packages/client-core/src/beliefs.d.ts +30 -0
- package/dist/lucern/packages/client-core/src/context.d.ts +29 -0
- package/dist/lucern/packages/client-core/src/contradictions.d.ts +11 -0
- package/dist/lucern/packages/client-core/src/edges.d.ts +11 -0
- package/dist/lucern/packages/client-core/src/events.d.ts +9 -0
- package/dist/lucern/packages/client-core/src/evidence.d.ts +21 -0
- package/dist/lucern/packages/client-core/src/graph.d.ts +17 -0
- package/dist/lucern/packages/client-core/src/identity.d.ts +7 -0
- package/dist/lucern/packages/client-core/src/ids.d.ts +7 -0
- package/dist/lucern/packages/client-core/src/ontologies.d.ts +13 -0
- package/dist/lucern/packages/client-core/src/questions.d.ts +39 -0
- package/dist/lucern/packages/client-core/src/search.d.ts +7 -0
- package/dist/lucern/packages/client-core/src/tasks.d.ts +13 -0
- package/dist/lucern/packages/client-core/src/topics.d.ts +17 -0
- package/dist/lucern/packages/client-core/src/webhooks.d.ts +35 -0
- package/dist/lucern/packages/client-core/src/worktrees.d.ts +17 -0
- package/dist/lucern/packages/domain-beliefs/src/beliefs.d.ts +283 -0
- package/dist/lucern/packages/domain-beliefs/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-context/src/compile.d.ts +11 -0
- package/dist/lucern/packages/domain-context/src/context-pack-compiler.d.ts +101 -0
- package/dist/lucern/packages/domain-context/src/index.d.ts +4 -0
- package/dist/lucern/packages/domain-context/src/ports.d.ts +58 -0
- package/dist/lucern/packages/domain-context/src/public-types.d.ts +1 -0
- package/dist/lucern/packages/domain-edges/src/contradictions.d.ts +59 -0
- package/dist/lucern/packages/domain-edges/src/edges.d.ts +91 -0
- package/dist/lucern/packages/domain-edges/src/index.d.ts +2 -0
- package/dist/lucern/packages/domain-evidence/src/evidence.d.ts +115 -0
- package/dist/lucern/packages/domain-evidence/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-graph/src/graph.d.ts +150 -0
- package/dist/lucern/packages/domain-identity/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-identity/src/whoami.d.ts +13 -0
- package/dist/lucern/packages/domain-ontologies/src/ontologies.d.ts +123 -0
- package/dist/lucern/packages/domain-questions/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-questions/src/questions.d.ts +147 -0
- package/dist/lucern/packages/domain-search/src/search.d.ts +97 -0
- package/dist/lucern/packages/domain-tasks/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-tasks/src/tasks.d.ts +102 -0
- package/dist/lucern/packages/domain-topics/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-topics/src/topics.d.ts +147 -0
- package/dist/lucern/packages/domain-worktrees/src/index.d.ts +1 -0
- package/dist/lucern/packages/domain-worktrees/src/worktrees.d.ts +185 -0
- package/dist/lucern/packages/events/src/index.d.ts +4 -0
- package/dist/lucern/packages/events/src/matching.d.ts +3 -0
- package/dist/lucern/packages/events/src/outbox.d.ts +15 -0
- package/dist/lucern/packages/events/src/types.d.ts +151 -0
- package/dist/lucern/packages/events/src/webhooks.d.ts +9 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/beliefs.d.ts +15 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/context.d.ts +12 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/contradictions.d.ts +7 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/edges.d.ts +7 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/events.d.ts +6 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/evidence.d.ts +21 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/graph.d.ts +10 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/identity.d.ts +5 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/ontologies.d.ts +8 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/questions.d.ts +39 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/search.d.ts +5 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/tasks.d.ts +8 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/topics.d.ts +10 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/webhooks.d.ts +16 -0
- package/dist/lucern/packages/sdk-typescript/src/facade/worktrees.d.ts +10 -0
- package/dist/lucern/packages/sdk-typescript/src/index.d.ts +28 -0
- package/dist/packages/sdk/src/adminClient.d.ts +89 -0
- package/dist/packages/sdk/src/answersClient.d.ts +5 -0
- package/dist/packages/sdk/src/audiencesClient.d.ts +87 -0
- package/dist/packages/sdk/src/auditClient.d.ts +23 -0
- package/dist/packages/sdk/src/beliefsClient.d.ts +54 -0
- package/dist/packages/sdk/src/client.d.ts +1610 -0
- package/dist/packages/sdk/src/contextClient.d.ts +9 -0
- package/dist/packages/sdk/src/contracts/api-enums.contract.d.ts +58 -0
- package/dist/packages/sdk/src/controlObjectOwnership.d.ts +293 -0
- package/dist/packages/sdk/src/coreClient.d.ts +120 -0
- package/dist/packages/sdk/src/customTools.d.ts +65 -0
- package/dist/packages/sdk/src/decisionsClient.d.ts +110 -0
- package/dist/packages/sdk/src/graphClient.d.ts +209 -0
- package/dist/packages/sdk/src/harnessClient.d.ts +222 -0
- package/dist/packages/sdk/src/identityClient.d.ts +104 -0
- package/dist/packages/sdk/src/index.d.ts +28 -0
- package/dist/packages/sdk/src/learningClient.d.ts +43 -0
- package/dist/packages/sdk/src/mcpParityClient.d.ts +68 -0
- package/dist/packages/sdk/src/mcpParitySurface.d.ts +8 -0
- package/dist/packages/sdk/src/ontologyClient.d.ts +115 -0
- package/dist/packages/sdk/src/packsClient.d.ts +101 -0
- package/dist/packages/sdk/src/policyClient.d.ts +204 -0
- package/dist/packages/sdk/src/reportsClient.d.ts +31 -0
- package/dist/packages/sdk/src/schemaClient.d.ts +54 -0
- package/dist/packages/sdk/src/sdkSurface.d.ts +56 -0
- package/dist/packages/sdk/src/topicsClient.d.ts +45 -0
- package/dist/packages/sdk/src/types.d.ts +489 -0
- package/dist/packages/sdk/src/version.d.ts +2 -0
- package/dist/packages/sdk/src/workflowClient.d.ts +274 -0
- package/package.json +56 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type ContextCompilationMode, type ContextPackV1, type PackWeightOverride } from "../../../contracts/src/context-pack.contract";
|
|
2
|
+
import { resolveEffectiveWeights } from "../../../mcp-server/src/context-pack-policy";
|
|
3
|
+
import { type ContextRankingProfile } from "../../../mcp-server/src/context-pack-schema";
|
|
4
|
+
export type ContextPackTopicRow = {
|
|
5
|
+
_id: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
parentTopicId?: string;
|
|
8
|
+
depth?: number;
|
|
9
|
+
status?: string;
|
|
10
|
+
updatedAt?: number;
|
|
11
|
+
createdAt?: number;
|
|
12
|
+
generatedAt?: number;
|
|
13
|
+
};
|
|
14
|
+
type ContextPackBeliefRow = {
|
|
15
|
+
_id: string;
|
|
16
|
+
canonicalText?: string;
|
|
17
|
+
confidence?: number;
|
|
18
|
+
beliefType?: string;
|
|
19
|
+
status?: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
updatedAt?: number;
|
|
22
|
+
createdAt?: number;
|
|
23
|
+
};
|
|
24
|
+
type ContextPackQuestionRow = {
|
|
25
|
+
_id: string;
|
|
26
|
+
canonicalText?: string;
|
|
27
|
+
status?: string;
|
|
28
|
+
metadata?: Record<string, unknown>;
|
|
29
|
+
updatedAt?: number;
|
|
30
|
+
createdAt?: number;
|
|
31
|
+
};
|
|
32
|
+
type ContextPackEvidenceRow = {
|
|
33
|
+
_id: string;
|
|
34
|
+
canonicalText?: string;
|
|
35
|
+
sourceUrl?: string;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
updatedAt?: number;
|
|
38
|
+
createdAt?: number;
|
|
39
|
+
};
|
|
40
|
+
type ContextPackContradictionRow = {
|
|
41
|
+
_id?: string;
|
|
42
|
+
globalId?: string;
|
|
43
|
+
weight?: number;
|
|
44
|
+
context?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
summary?: string;
|
|
47
|
+
updatedAt?: number;
|
|
48
|
+
createdAt?: number;
|
|
49
|
+
};
|
|
50
|
+
type ContextPackEntityRow = {
|
|
51
|
+
_id: string;
|
|
52
|
+
nodeType?: string;
|
|
53
|
+
title?: string;
|
|
54
|
+
canonicalText?: string;
|
|
55
|
+
connectedBeliefCount?: number;
|
|
56
|
+
connectedEvidenceCount?: number;
|
|
57
|
+
metadata?: Record<string, unknown>;
|
|
58
|
+
updatedAt?: number;
|
|
59
|
+
};
|
|
60
|
+
type ContextPackFailureRow = {
|
|
61
|
+
_id: string;
|
|
62
|
+
canonicalText?: string;
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
updatedAt?: number;
|
|
65
|
+
createdAt?: number;
|
|
66
|
+
};
|
|
67
|
+
export type CompileContextPackPlan = {
|
|
68
|
+
topicId: string;
|
|
69
|
+
queryText?: string;
|
|
70
|
+
tokens: string[];
|
|
71
|
+
limit: number;
|
|
72
|
+
rankingProfile: ContextRankingProfile;
|
|
73
|
+
tokenBudget: number;
|
|
74
|
+
descendantDepth: number;
|
|
75
|
+
includeEntities: boolean;
|
|
76
|
+
compilationMode: ContextCompilationMode;
|
|
77
|
+
includeFailures: boolean;
|
|
78
|
+
worktreeId?: string;
|
|
79
|
+
sessionId?: string;
|
|
80
|
+
packWeightOverrides?: PackWeightOverride[];
|
|
81
|
+
effectiveWeights: ReturnType<typeof resolveEffectiveWeights>;
|
|
82
|
+
scopedTopicIds: string[];
|
|
83
|
+
};
|
|
84
|
+
export type CompileContextPackPlanInput = {
|
|
85
|
+
args: Record<string, unknown> | undefined;
|
|
86
|
+
topic: ContextPackTopicRow;
|
|
87
|
+
allTopics: ContextPackTopicRow[];
|
|
88
|
+
};
|
|
89
|
+
export type CompileContextPackSnapshot = {
|
|
90
|
+
topic: ContextPackTopicRow;
|
|
91
|
+
plan: CompileContextPackPlan;
|
|
92
|
+
beliefs: ContextPackBeliefRow[];
|
|
93
|
+
questions: ContextPackQuestionRow[];
|
|
94
|
+
evidence: ContextPackEvidenceRow[];
|
|
95
|
+
contradictions: ContextPackContradictionRow[];
|
|
96
|
+
entities: ContextPackEntityRow[];
|
|
97
|
+
failures?: ContextPackFailureRow[];
|
|
98
|
+
};
|
|
99
|
+
export declare function planContextPackCompilation(input: CompileContextPackPlanInput): CompileContextPackPlan;
|
|
100
|
+
export declare function compileContextPackFromSnapshot(snapshot: CompileContextPackSnapshot): ContextPackV1;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ContextCompilationMode, ContextPackV1, ContextRankingProfile, PackWeightOverride } from "../../../contracts/src/context-pack.contract";
|
|
2
|
+
export type CompileContextCommand = {
|
|
3
|
+
topicId?: string;
|
|
4
|
+
projectId?: string;
|
|
5
|
+
query?: string;
|
|
6
|
+
budget?: number;
|
|
7
|
+
ranking?: ContextRankingProfile;
|
|
8
|
+
limit?: number;
|
|
9
|
+
maxDepth?: number;
|
|
10
|
+
includeEntities?: boolean;
|
|
11
|
+
mode?: ContextCompilationMode;
|
|
12
|
+
includeFailures?: boolean;
|
|
13
|
+
worktreeId?: string;
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
packWeightOverrides?: PackWeightOverride[];
|
|
16
|
+
/** @deprecated Use budget. */
|
|
17
|
+
tokenBudget?: number;
|
|
18
|
+
/** @deprecated Use ranking. */
|
|
19
|
+
rankingProfile?: ContextRankingProfile;
|
|
20
|
+
actorPrincipalId?: string;
|
|
21
|
+
policyTraceId?: string | null;
|
|
22
|
+
allowedTopicIds?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type CompileContextPortInput = {
|
|
25
|
+
topicId: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
query?: string;
|
|
28
|
+
budget?: number;
|
|
29
|
+
ranking?: ContextRankingProfile;
|
|
30
|
+
limit?: number;
|
|
31
|
+
maxDepth?: number;
|
|
32
|
+
includeEntities?: boolean;
|
|
33
|
+
mode?: ContextCompilationMode;
|
|
34
|
+
includeFailures?: boolean;
|
|
35
|
+
worktreeId?: string;
|
|
36
|
+
sessionId?: string;
|
|
37
|
+
packWeightOverrides?: PackWeightOverride[];
|
|
38
|
+
allowedTopicIds: string[];
|
|
39
|
+
};
|
|
40
|
+
export type ContextCompilerPort = {
|
|
41
|
+
compile(input: CompileContextPortInput): Promise<ContextPackV1>;
|
|
42
|
+
};
|
|
43
|
+
export type ContextPolicyPort = {
|
|
44
|
+
filterReadableTopicIds(input: {
|
|
45
|
+
topicIds: string[];
|
|
46
|
+
actorPrincipalId: string;
|
|
47
|
+
traceId?: string | null;
|
|
48
|
+
}): Promise<string[]>;
|
|
49
|
+
listReadableTopicIds(input: {
|
|
50
|
+
actorPrincipalId: string;
|
|
51
|
+
traceId?: string | null;
|
|
52
|
+
}): Promise<string[]>;
|
|
53
|
+
};
|
|
54
|
+
export type CompileContextPorts = {
|
|
55
|
+
compiler: ContextCompilerPort;
|
|
56
|
+
policy?: ContextPolicyPort;
|
|
57
|
+
requireAuth?: boolean;
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { PublicCompiledContext, PublicContextBelief, PublicContextContradiction, PublicContextEntity, PublicContextEvidence, PublicContextInjectionPolicy, PublicContextQuestion, } from "../../../contracts/src/context-pack.contract";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
type PublicSeverity = "low" | "medium" | "high" | "critical";
|
|
2
|
+
type DefeatType = "rebuts" | "undercuts" | "undermines";
|
|
3
|
+
export type ContradictionRecord = {
|
|
4
|
+
id: string;
|
|
5
|
+
contradictionId: string;
|
|
6
|
+
topicId?: string;
|
|
7
|
+
beliefA: string;
|
|
8
|
+
beliefB: string;
|
|
9
|
+
description: string;
|
|
10
|
+
severity: PublicSeverity;
|
|
11
|
+
status: string;
|
|
12
|
+
defeatType: DefeatType;
|
|
13
|
+
createdAt?: number;
|
|
14
|
+
updatedAt?: number;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export type ContradictionListResult = {
|
|
18
|
+
contradictions: ContradictionRecord[];
|
|
19
|
+
nextCursor: null;
|
|
20
|
+
};
|
|
21
|
+
export type FlagContradictionInput = {
|
|
22
|
+
beliefA: string;
|
|
23
|
+
beliefB: string;
|
|
24
|
+
description: string;
|
|
25
|
+
topicId: string;
|
|
26
|
+
severity?: string;
|
|
27
|
+
defeatType?: string;
|
|
28
|
+
};
|
|
29
|
+
export type ListContradictionsQuery = {
|
|
30
|
+
topicId: string;
|
|
31
|
+
status?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
cursor?: string;
|
|
34
|
+
};
|
|
35
|
+
type PortSeverity = "critical" | "significant" | "minor";
|
|
36
|
+
type FlagContradictionPortInput = {
|
|
37
|
+
beliefARawId: string;
|
|
38
|
+
beliefBRawId: string;
|
|
39
|
+
description: string;
|
|
40
|
+
topicId: string;
|
|
41
|
+
severity: PortSeverity;
|
|
42
|
+
publicSeverity: PublicSeverity;
|
|
43
|
+
defeatType: DefeatType;
|
|
44
|
+
};
|
|
45
|
+
export type ContradictionsPort = {
|
|
46
|
+
fetchBelief: (rawId: string) => Promise<unknown | null>;
|
|
47
|
+
flagContradiction: (input: FlagContradictionPortInput) => Promise<unknown>;
|
|
48
|
+
listByTopic: (args: {
|
|
49
|
+
topicId: string;
|
|
50
|
+
limit?: number;
|
|
51
|
+
}) => Promise<unknown[]>;
|
|
52
|
+
getById: (id: string) => Promise<unknown | null>;
|
|
53
|
+
};
|
|
54
|
+
export declare function flagContradiction(deps: ContradictionsPort, input: FlagContradictionInput): Promise<ContradictionRecord>;
|
|
55
|
+
export declare function listContradictions(deps: ContradictionsPort, query: ListContradictionsQuery): Promise<ContradictionListResult>;
|
|
56
|
+
export declare function getContradiction(deps: ContradictionsPort, input: {
|
|
57
|
+
id: string;
|
|
58
|
+
}): Promise<ContradictionRecord>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
type EdgeDirection = "up" | "down" | "both";
|
|
2
|
+
export type EdgeRecord = {
|
|
3
|
+
id: string;
|
|
4
|
+
edgeId: string;
|
|
5
|
+
globalId?: string;
|
|
6
|
+
sourceId: string;
|
|
7
|
+
targetId: string;
|
|
8
|
+
edgeType: string;
|
|
9
|
+
topicId?: string;
|
|
10
|
+
confidence?: number;
|
|
11
|
+
weight?: number;
|
|
12
|
+
context?: string;
|
|
13
|
+
fromLayer?: string;
|
|
14
|
+
toLayer?: string;
|
|
15
|
+
isDuplicate?: boolean;
|
|
16
|
+
createdAt?: number;
|
|
17
|
+
updatedAt?: number;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export type EdgeListResult = {
|
|
21
|
+
edges: EdgeRecord[];
|
|
22
|
+
nextCursor: null;
|
|
23
|
+
};
|
|
24
|
+
export type EdgeTraversalNode = {
|
|
25
|
+
id: string;
|
|
26
|
+
nodeId: string;
|
|
27
|
+
globalId?: string;
|
|
28
|
+
nodeType?: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
confidence?: number;
|
|
31
|
+
depth?: number;
|
|
32
|
+
topicId?: string;
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
export type EdgeTraversalResult = {
|
|
36
|
+
startNode: string;
|
|
37
|
+
direction: EdgeDirection;
|
|
38
|
+
maxDepth: number;
|
|
39
|
+
nodes: EdgeTraversalNode[];
|
|
40
|
+
edges: EdgeRecord[];
|
|
41
|
+
depth: number;
|
|
42
|
+
};
|
|
43
|
+
export type CreateEdgeInput = {
|
|
44
|
+
sourceId: string;
|
|
45
|
+
targetId: string;
|
|
46
|
+
edgeType: string;
|
|
47
|
+
topicId?: string;
|
|
48
|
+
confidence?: number;
|
|
49
|
+
weight?: number;
|
|
50
|
+
context?: string;
|
|
51
|
+
};
|
|
52
|
+
export type ListEdgesQuery = {
|
|
53
|
+
sourceId: string;
|
|
54
|
+
edgeType?: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
cursor?: string;
|
|
57
|
+
};
|
|
58
|
+
export type TraverseEdgesInput = {
|
|
59
|
+
startNode: string;
|
|
60
|
+
direction?: string;
|
|
61
|
+
maxDepth?: number;
|
|
62
|
+
topicId?: string;
|
|
63
|
+
};
|
|
64
|
+
type EdgeCreatePortInput = {
|
|
65
|
+
sourceRawId: string;
|
|
66
|
+
targetRawId: string;
|
|
67
|
+
edgeType: string;
|
|
68
|
+
topicId?: string;
|
|
69
|
+
confidence?: number;
|
|
70
|
+
weight?: number;
|
|
71
|
+
context?: string;
|
|
72
|
+
};
|
|
73
|
+
type EdgeTraversePortInput = {
|
|
74
|
+
startNode: string;
|
|
75
|
+
direction: EdgeDirection;
|
|
76
|
+
maxDepth: number;
|
|
77
|
+
topicId?: string;
|
|
78
|
+
};
|
|
79
|
+
export type EdgePort = {
|
|
80
|
+
createEdge: (input: EdgeCreatePortInput) => Promise<unknown>;
|
|
81
|
+
listEdgesBySource: (args: {
|
|
82
|
+
sourceRawId: string;
|
|
83
|
+
edgeType?: string;
|
|
84
|
+
limit?: number;
|
|
85
|
+
}) => Promise<unknown[]>;
|
|
86
|
+
traverseEdges: (input: EdgeTraversePortInput) => Promise<unknown>;
|
|
87
|
+
};
|
|
88
|
+
export declare function createEdge(deps: EdgePort, input: CreateEdgeInput): Promise<EdgeRecord>;
|
|
89
|
+
export declare function listEdges(deps: EdgePort, query: ListEdgesQuery): Promise<EdgeListResult>;
|
|
90
|
+
export declare function traverseEdges(deps: EdgePort, input: TraverseEdgesInput): Promise<EdgeTraversalResult>;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export type EvidenceTargetType = "belief" | "question";
|
|
2
|
+
type EvidenceRelation = "supports" | "contradicts" | "neutral";
|
|
3
|
+
export type EvidenceRecord = {
|
|
4
|
+
id: string;
|
|
5
|
+
nodeId: string;
|
|
6
|
+
evidenceId: string;
|
|
7
|
+
globalId?: string;
|
|
8
|
+
topicId?: string;
|
|
9
|
+
text: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
kind?: string;
|
|
12
|
+
source?: string;
|
|
13
|
+
sourceType?: string;
|
|
14
|
+
externalSourceType?: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
relation?: EvidenceRelation;
|
|
17
|
+
confidence?: number;
|
|
18
|
+
linkedBeliefId?: string;
|
|
19
|
+
linkedQuestionId?: string;
|
|
20
|
+
createdAt?: number;
|
|
21
|
+
updatedAt?: number;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
export type EvidenceListResult = {
|
|
25
|
+
evidence: EvidenceRecord[];
|
|
26
|
+
nextCursor: null;
|
|
27
|
+
};
|
|
28
|
+
export type EvidenceSearchResult = {
|
|
29
|
+
evidenceId: string;
|
|
30
|
+
nodeId: string;
|
|
31
|
+
globalId?: string;
|
|
32
|
+
text: string;
|
|
33
|
+
source?: string;
|
|
34
|
+
kind?: string;
|
|
35
|
+
relevanceScore: number;
|
|
36
|
+
};
|
|
37
|
+
export type EvidenceSearchPage = {
|
|
38
|
+
results: EvidenceSearchResult[];
|
|
39
|
+
nextCursor: null;
|
|
40
|
+
};
|
|
41
|
+
export type LinkEvidenceResult = {
|
|
42
|
+
edgeId: string;
|
|
43
|
+
evidenceId: string;
|
|
44
|
+
targetId: string;
|
|
45
|
+
targetType: EvidenceTargetType;
|
|
46
|
+
weight: number;
|
|
47
|
+
beliefId?: string;
|
|
48
|
+
questionId?: string;
|
|
49
|
+
};
|
|
50
|
+
export type CreateEvidenceInput = {
|
|
51
|
+
topicId: string;
|
|
52
|
+
text: string;
|
|
53
|
+
source?: string;
|
|
54
|
+
targetId?: string;
|
|
55
|
+
targetType?: EvidenceTargetType;
|
|
56
|
+
weight?: number;
|
|
57
|
+
metadata?: Record<string, unknown>;
|
|
58
|
+
title?: string;
|
|
59
|
+
content?: string;
|
|
60
|
+
contentType?: string;
|
|
61
|
+
kind?: string;
|
|
62
|
+
};
|
|
63
|
+
export type ListEvidenceQuery = {
|
|
64
|
+
topicId?: string;
|
|
65
|
+
targetId?: string;
|
|
66
|
+
limit?: number;
|
|
67
|
+
cursor?: string;
|
|
68
|
+
};
|
|
69
|
+
export type SearchEvidenceQuery = {
|
|
70
|
+
q: string;
|
|
71
|
+
topicId?: string;
|
|
72
|
+
targetId?: string;
|
|
73
|
+
limit?: number;
|
|
74
|
+
cursor?: string;
|
|
75
|
+
};
|
|
76
|
+
type TargetRef = {
|
|
77
|
+
type: EvidenceTargetType;
|
|
78
|
+
rawId: string;
|
|
79
|
+
};
|
|
80
|
+
type EvidenceCreatePortInput = Omit<CreateEvidenceInput, "targetId"> & {
|
|
81
|
+
target?: TargetRef;
|
|
82
|
+
weight: number;
|
|
83
|
+
};
|
|
84
|
+
type EvidenceLinkPortInput = {
|
|
85
|
+
evidenceRawId: string;
|
|
86
|
+
targetRawId: string;
|
|
87
|
+
weight: number;
|
|
88
|
+
rationale?: string;
|
|
89
|
+
};
|
|
90
|
+
export type EvidencePort = {
|
|
91
|
+
fetchEvidence: (rawId: string) => Promise<unknown | null>;
|
|
92
|
+
listEvidenceByTopic: (args: {
|
|
93
|
+
topicId: string;
|
|
94
|
+
limit?: number;
|
|
95
|
+
}) => Promise<unknown[]>;
|
|
96
|
+
listEvidenceForBelief: (rawBeliefId: string) => Promise<unknown[]>;
|
|
97
|
+
listEvidenceForQuestion: (rawQuestionId: string) => Promise<unknown[]>;
|
|
98
|
+
createEvidence: (input: EvidenceCreatePortInput) => Promise<unknown>;
|
|
99
|
+
linkEvidenceToBelief: (input: EvidenceLinkPortInput) => Promise<unknown>;
|
|
100
|
+
linkEvidenceToQuestion: (input: EvidenceLinkPortInput) => Promise<unknown>;
|
|
101
|
+
};
|
|
102
|
+
export declare function getEvidence(deps: EvidencePort, input: {
|
|
103
|
+
id: string;
|
|
104
|
+
}): Promise<EvidenceRecord>;
|
|
105
|
+
export declare function listEvidence(deps: EvidencePort, query: ListEvidenceQuery): Promise<EvidenceListResult>;
|
|
106
|
+
export declare function searchEvidence(deps: EvidencePort, query: SearchEvidenceQuery): Promise<EvidenceSearchPage>;
|
|
107
|
+
export declare function createEvidence(deps: EvidencePort, input: CreateEvidenceInput): Promise<EvidenceRecord>;
|
|
108
|
+
export declare function linkEvidence(deps: EvidencePort, input: {
|
|
109
|
+
evidenceId: string;
|
|
110
|
+
targetId: string;
|
|
111
|
+
targetType?: string;
|
|
112
|
+
weight?: number;
|
|
113
|
+
rationale?: string;
|
|
114
|
+
}): Promise<LinkEvidenceResult>;
|
|
115
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./evidence";
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
type GraphDirection = "up" | "down" | "both";
|
|
2
|
+
type GraphNodeRecord = Record<string, unknown>;
|
|
3
|
+
type GraphEdgeRecord = Record<string, unknown>;
|
|
4
|
+
type GraphBeliefGapRecord = {
|
|
5
|
+
beliefId: string;
|
|
6
|
+
text: string;
|
|
7
|
+
confidence: number | null;
|
|
8
|
+
suggestedQuestions: string[];
|
|
9
|
+
};
|
|
10
|
+
export type GraphNeighborhoodInput = {
|
|
11
|
+
globalId?: string;
|
|
12
|
+
globalIds?: string[];
|
|
13
|
+
maxDepth?: number;
|
|
14
|
+
};
|
|
15
|
+
export type GraphNeighborhoodResult = {
|
|
16
|
+
nodes: GraphNodeRecord[];
|
|
17
|
+
edges: GraphEdgeRecord[];
|
|
18
|
+
depth: number;
|
|
19
|
+
};
|
|
20
|
+
export type GraphTraverseInput = {
|
|
21
|
+
startNode: string;
|
|
22
|
+
direction?: string;
|
|
23
|
+
maxDepth?: number;
|
|
24
|
+
topicId?: string;
|
|
25
|
+
};
|
|
26
|
+
export type GraphTraverseResult = {
|
|
27
|
+
startNode: string;
|
|
28
|
+
direction: GraphDirection;
|
|
29
|
+
maxDepth: number;
|
|
30
|
+
nodes: GraphNodeRecord[];
|
|
31
|
+
edges: GraphEdgeRecord[];
|
|
32
|
+
depth: number;
|
|
33
|
+
topicId?: string;
|
|
34
|
+
};
|
|
35
|
+
export type GraphAnalyzeInput = {
|
|
36
|
+
topicId: string;
|
|
37
|
+
metric?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
};
|
|
40
|
+
export type GraphAnalyzeResult = {
|
|
41
|
+
topicId: string;
|
|
42
|
+
metric: string;
|
|
43
|
+
payload: Record<string, unknown>;
|
|
44
|
+
};
|
|
45
|
+
export type GraphBiasInput = {
|
|
46
|
+
topicId: string;
|
|
47
|
+
threshold?: number;
|
|
48
|
+
limit?: number;
|
|
49
|
+
};
|
|
50
|
+
export type GraphBiasBelief = {
|
|
51
|
+
nodeId: string;
|
|
52
|
+
biasScore: number;
|
|
53
|
+
riskLevel: string;
|
|
54
|
+
supportingCount: number;
|
|
55
|
+
challengingCount: number;
|
|
56
|
+
};
|
|
57
|
+
export type GraphBiasResult = {
|
|
58
|
+
topicId: string;
|
|
59
|
+
metric: "confirmation_bias";
|
|
60
|
+
threshold: number;
|
|
61
|
+
beliefs: GraphBiasBelief[];
|
|
62
|
+
payload: Record<string, unknown>;
|
|
63
|
+
};
|
|
64
|
+
export type GraphGapsInput = {
|
|
65
|
+
topicId: string;
|
|
66
|
+
minConfidence?: number;
|
|
67
|
+
};
|
|
68
|
+
export type GraphGapsResult = {
|
|
69
|
+
topicId: string;
|
|
70
|
+
gaps: GraphBeliefGapRecord[];
|
|
71
|
+
totalGaps: number;
|
|
72
|
+
};
|
|
73
|
+
type GraphBeliefRecord = {
|
|
74
|
+
beliefId?: string;
|
|
75
|
+
nodeId?: string;
|
|
76
|
+
topicId?: string;
|
|
77
|
+
text?: string;
|
|
78
|
+
canonicalText?: string;
|
|
79
|
+
confidence?: number | null;
|
|
80
|
+
};
|
|
81
|
+
type GraphQuestionRecord = {
|
|
82
|
+
questionId?: string;
|
|
83
|
+
nodeId?: string;
|
|
84
|
+
linkedBeliefId?: string;
|
|
85
|
+
};
|
|
86
|
+
type GraphTestingEdgeRecord = {
|
|
87
|
+
fromNodeId?: string;
|
|
88
|
+
toNodeId?: string;
|
|
89
|
+
edgeType?: string;
|
|
90
|
+
};
|
|
91
|
+
export type GraphFalsifyInput = {
|
|
92
|
+
topicId?: string;
|
|
93
|
+
beliefId?: string;
|
|
94
|
+
beliefIds?: string[];
|
|
95
|
+
minConfidence?: number;
|
|
96
|
+
};
|
|
97
|
+
export type GraphFalsificationQuestion = {
|
|
98
|
+
questionText: string;
|
|
99
|
+
falsificationPotential: number;
|
|
100
|
+
targetBeliefId: string;
|
|
101
|
+
targetBeliefText: string;
|
|
102
|
+
};
|
|
103
|
+
export type GraphFalsifyResult = {
|
|
104
|
+
topicId: string;
|
|
105
|
+
questions: GraphFalsificationQuestion[];
|
|
106
|
+
};
|
|
107
|
+
export type GraphPort = {
|
|
108
|
+
neighborhood: (input: {
|
|
109
|
+
globalIds: string[];
|
|
110
|
+
maxDepth: number;
|
|
111
|
+
}) => Promise<unknown>;
|
|
112
|
+
traverse: (input: {
|
|
113
|
+
startNode: string;
|
|
114
|
+
direction: GraphDirection;
|
|
115
|
+
maxDepth: number;
|
|
116
|
+
topicId?: string;
|
|
117
|
+
}) => Promise<unknown>;
|
|
118
|
+
analyze: (input: {
|
|
119
|
+
topicId: string;
|
|
120
|
+
metric: string;
|
|
121
|
+
limit?: number;
|
|
122
|
+
}) => Promise<unknown>;
|
|
123
|
+
bias: (input: {
|
|
124
|
+
topicId: string;
|
|
125
|
+
threshold: number;
|
|
126
|
+
limit?: number;
|
|
127
|
+
}) => Promise<unknown>;
|
|
128
|
+
listBeliefs: (input: {
|
|
129
|
+
topicId: string;
|
|
130
|
+
minConfidence?: number;
|
|
131
|
+
limit?: number;
|
|
132
|
+
}) => Promise<GraphBeliefRecord[]>;
|
|
133
|
+
fetchBelief: (input: {
|
|
134
|
+
beliefId: string;
|
|
135
|
+
}) => Promise<GraphBeliefRecord | null>;
|
|
136
|
+
listQuestions: (input: {
|
|
137
|
+
topicId: string;
|
|
138
|
+
limit?: number;
|
|
139
|
+
}) => Promise<GraphQuestionRecord[]>;
|
|
140
|
+
listTestingEdges: (input: {
|
|
141
|
+
topicId: string;
|
|
142
|
+
}) => Promise<GraphTestingEdgeRecord[]>;
|
|
143
|
+
};
|
|
144
|
+
export declare function graphNeighborhood(deps: GraphPort, input: GraphNeighborhoodInput): Promise<GraphNeighborhoodResult>;
|
|
145
|
+
export declare function graphTraverse(deps: GraphPort, input: GraphTraverseInput): Promise<GraphTraverseResult>;
|
|
146
|
+
export declare function graphAnalyze(deps: GraphPort, input: GraphAnalyzeInput): Promise<GraphAnalyzeResult>;
|
|
147
|
+
export declare function graphBias(deps: GraphPort, input: GraphBiasInput): Promise<GraphBiasResult>;
|
|
148
|
+
export declare function graphGaps(deps: GraphPort, input: GraphGapsInput): Promise<GraphGapsResult>;
|
|
149
|
+
export declare function graphFalsify(deps: GraphPort, input: GraphFalsifyInput): Promise<GraphFalsifyResult>;
|
|
150
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./whoami";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IdentitySummary = {
|
|
2
|
+
principalId: string;
|
|
3
|
+
principalType: string;
|
|
4
|
+
tenantId?: string;
|
|
5
|
+
workspaceId?: string;
|
|
6
|
+
scopes?: string[];
|
|
7
|
+
roles?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type WhoamiPort = {
|
|
10
|
+
resolveIdentitySummary: (() => IdentitySummary) | (() => Promise<IdentitySummary>);
|
|
11
|
+
};
|
|
12
|
+
export declare function normalizeIdentitySummary(value: IdentitySummary): IdentitySummary;
|
|
13
|
+
export declare function whoami(deps: WhoamiPort): Promise<IdentitySummary>;
|