@manta-eu/client 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/graphql.d.ts +136 -35
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +70 -14
- package/dist/generated/graphql.js.map +1 -1
- package/dist/shared/datastore-id.js +1 -1
- package/dist/shared/datastore-id.js.map +1 -1
- package/dist/shared/memory-citation-sampling.d.ts +2 -1
- package/dist/shared/memory-citation-sampling.d.ts.map +1 -1
- package/dist/shared/memory-citation-sampling.js +5 -4
- package/dist/shared/memory-citation-sampling.js.map +1 -1
- package/dist/shared/memory-diversity.js +1 -1
- package/dist/shared/memory-diversity.js.map +1 -1
- package/dist/shared/memory-keyword-recall.d.ts +1 -0
- package/dist/shared/memory-keyword-recall.d.ts.map +1 -1
- package/dist/shared/memory-keyword-recall.js +2 -1
- package/dist/shared/memory-keyword-recall.js.map +1 -1
- package/dist/shared/rdf-namespaces.d.ts +1 -3
- package/dist/shared/rdf-namespaces.d.ts.map +1 -1
- package/dist/shared/rdf-namespaces.js +2 -4
- package/dist/shared/rdf-namespaces.js.map +1 -1
- package/dist/shared/tools/coercers.d.ts.map +1 -1
- package/dist/shared/tools/coercers.js +6 -3
- package/dist/shared/tools/coercers.js.map +1 -1
- package/dist/shared/tools/index.d.ts +1 -1
- package/dist/shared/tools/index.d.ts.map +1 -1
- package/dist/shared/tools/metadata.js +23 -23
- package/dist/shared/tools/metadata.js.map +1 -1
- package/dist/shared/tools/types.d.ts +24 -24
- package/dist/shared/tools/types.d.ts.map +1 -1
- package/dist/shared/writable-shape-query.js +2 -2
- package/dist/shared/writable-shape-query.js.map +1 -1
- package/package.json +5 -5
- package/src/generated/graphql.ts +225 -48
- package/src/shared/datastore-id.ts +1 -1
- package/src/shared/memory-citation-sampling.ts +5 -5
- package/src/shared/memory-diversity.ts +1 -1
- package/src/shared/memory-keyword-recall.ts +3 -1
- package/src/shared/rdf-namespaces.ts +2 -9
- package/src/shared/tools/coercers.ts +7 -4
- package/src/shared/tools/index.ts +8 -8
- package/src/shared/tools/metadata.ts +23 -23
- package/src/shared/tools/types.ts +30 -30
- package/src/shared/writable-shape-query.ts +2 -2
|
@@ -13,22 +13,22 @@ export type {
|
|
|
13
13
|
ActionPlanShowcaseInput,
|
|
14
14
|
ActionPlanShowcaseOutput,
|
|
15
15
|
ActionPlanStatus,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
AddFactsInput,
|
|
17
|
+
AddFactsOutput,
|
|
18
18
|
CancelScheduleInput,
|
|
19
19
|
CancelScheduleOutput,
|
|
20
20
|
ExecuteActionPlanInput,
|
|
21
21
|
ExecuteActionPlanOutput,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
ExplainFactToolInput,
|
|
23
|
+
ExplainFactToolOutput,
|
|
24
24
|
GenerateChartInput,
|
|
25
25
|
GenerateChartOutput,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
GetRulesInput,
|
|
27
|
+
GetRulesOutput,
|
|
28
28
|
ListScheduledTasksInput,
|
|
29
29
|
ListScheduledTasksOutput,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
QueryKnowledgeGraphInput,
|
|
31
|
+
QueryKnowledgeGraphOutput,
|
|
32
32
|
ScheduleTaskInput,
|
|
33
33
|
ScheduleTaskOutput,
|
|
34
34
|
ShowEntitiesInput,
|
|
@@ -6,30 +6,30 @@ import { iriLocalName } from "../rdf-namespaces";
|
|
|
6
6
|
import type { ToolMetadata, ToolName } from "./types";
|
|
7
7
|
|
|
8
8
|
export const toolMetadata: ToolMetadata = {
|
|
9
|
-
|
|
10
|
-
name: "
|
|
11
|
-
category: "
|
|
9
|
+
queryKnowledgeGraph: {
|
|
10
|
+
name: "queryKnowledgeGraph",
|
|
11
|
+
category: "knowledge-graph",
|
|
12
12
|
humanName: "Query knowledge base",
|
|
13
|
-
description: "Retrieve facts from
|
|
13
|
+
description: "Retrieve facts from the knowledge graph using SPARQL",
|
|
14
14
|
getHumanName: (input) => {
|
|
15
15
|
return input?.humanIntent || "Querying...";
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
name: "
|
|
20
|
-
category: "
|
|
18
|
+
addFacts: {
|
|
19
|
+
name: "addFacts",
|
|
20
|
+
category: "knowledge-graph",
|
|
21
21
|
humanName: "Add facts",
|
|
22
|
-
description: "Add facts to
|
|
22
|
+
description: "Add facts to the knowledge graph as Turtle",
|
|
23
23
|
getHumanName: (input) => {
|
|
24
24
|
return input?.humanIntent || "Adding facts...";
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
name: "
|
|
29
|
-
category: "
|
|
27
|
+
getRules: {
|
|
28
|
+
name: "getRules",
|
|
29
|
+
category: "knowledge-graph",
|
|
30
30
|
humanName: "Check rules",
|
|
31
31
|
description:
|
|
32
|
-
"Retrieve Datalog rules from
|
|
32
|
+
"Retrieve Datalog rules from the knowledge graph with optional filters (named graph, rdf:type, limit) to avoid context overflow",
|
|
33
33
|
getHumanName: (input) => {
|
|
34
34
|
const parts: string[] = [];
|
|
35
35
|
if (input?.namedGraphIri) parts.push(`plan: ${input.namedGraphIri}`);
|
|
@@ -38,9 +38,9 @@ export const toolMetadata: ToolMetadata = {
|
|
|
38
38
|
return `Checking rules ${parts.join(" + ")}`;
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
-
|
|
42
|
-
name: "
|
|
43
|
-
category: "
|
|
41
|
+
explainFact: {
|
|
42
|
+
name: "explainFact",
|
|
43
|
+
category: "knowledge-graph",
|
|
44
44
|
humanName: "Explain reasoning",
|
|
45
45
|
description: "Explain how facts are derived using rules",
|
|
46
46
|
getHumanName: () => "Explaining reasoning...",
|
|
@@ -88,20 +88,20 @@ export const toolMetadata: ToolMetadata = {
|
|
|
88
88
|
return input?.namedGraphIri ? `Execute plan: ${input.namedGraphIri}` : "Executing action plan...";
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
|
-
|
|
92
|
-
name: "
|
|
93
|
-
category: "
|
|
91
|
+
manageRules: {
|
|
92
|
+
name: "manageRules",
|
|
93
|
+
category: "knowledge-graph",
|
|
94
94
|
humanName: "Manage rules",
|
|
95
|
-
description: "Add, change, or remove Datalog rules in
|
|
95
|
+
description: "Add, change, or remove Datalog rules in the knowledge graph",
|
|
96
96
|
getHumanName: (input) => {
|
|
97
97
|
return input?.humanIntent || "Managing rules...";
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
|
-
|
|
101
|
-
name: "
|
|
102
|
-
category: "
|
|
100
|
+
manageFacts: {
|
|
101
|
+
name: "manageFacts",
|
|
102
|
+
category: "knowledge-graph",
|
|
103
103
|
humanName: "Manage facts",
|
|
104
|
-
description: "Add
|
|
104
|
+
description: "Add or change facts in the knowledge graph",
|
|
105
105
|
getHumanName: (input) => {
|
|
106
106
|
return input?.humanIntent || "Managing facts...";
|
|
107
107
|
},
|
|
@@ -10,17 +10,17 @@ export type { TestTripleInput };
|
|
|
10
10
|
export type SparqlJsonBinding = SparqlBinding;
|
|
11
11
|
|
|
12
12
|
export type ToolName =
|
|
13
|
-
| "
|
|
14
|
-
| "
|
|
15
|
-
| "
|
|
16
|
-
| "
|
|
13
|
+
| "queryKnowledgeGraph"
|
|
14
|
+
| "addFacts"
|
|
15
|
+
| "getRules"
|
|
16
|
+
| "explainFact"
|
|
17
17
|
| "scheduleTask"
|
|
18
18
|
| "listScheduledTasks"
|
|
19
19
|
| "cancelSchedule"
|
|
20
20
|
| "generateChart"
|
|
21
21
|
| "executeActionPlan"
|
|
22
|
-
| "
|
|
23
|
-
| "
|
|
22
|
+
| "manageRules"
|
|
23
|
+
| "manageFacts"
|
|
24
24
|
| "actionPlanShowcase"
|
|
25
25
|
| "showEntities"
|
|
26
26
|
| "checkAutoPilotStatus"
|
|
@@ -28,7 +28,7 @@ export type ToolName =
|
|
|
28
28
|
| "markAsLowRisk"
|
|
29
29
|
| "readUploadedFile";
|
|
30
30
|
|
|
31
|
-
export type ToolCategory = "
|
|
31
|
+
export type ToolCategory = "knowledge-graph" | "scheduler" | "charts" | "action" | "auto-pilot";
|
|
32
32
|
|
|
33
33
|
export type ToolInputSchema<T = unknown> = z.ZodSchema<T>;
|
|
34
34
|
|
|
@@ -39,36 +39,36 @@ export type ToolErrorResult = {
|
|
|
39
39
|
content: string;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export type
|
|
42
|
+
export type QueryKnowledgeGraphInput = {
|
|
43
43
|
humanIntent: string;
|
|
44
44
|
sparql: string;
|
|
45
45
|
keepPrefixes?: boolean;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export type
|
|
48
|
+
export type QueryKnowledgeGraphOutput = JsonLdGraphDocument | SparqlJsonResults | ToolErrorResult;
|
|
49
49
|
|
|
50
|
-
export type
|
|
50
|
+
export type AddFactsInput = {
|
|
51
51
|
facts: string;
|
|
52
52
|
humanIntent: string;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export type
|
|
55
|
+
export type AddFactsOutput = string | ToolErrorResult;
|
|
56
56
|
|
|
57
|
-
export type
|
|
57
|
+
export type GetRulesInput = {
|
|
58
58
|
namedGraphIri?: string;
|
|
59
59
|
rdfTypes?: string[];
|
|
60
60
|
limit?: number;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type GetRulesOutputSuccess = {
|
|
64
64
|
rules: string[] | string | Record<string, unknown>[]; // TODO: standardize on RuleInfo type
|
|
65
65
|
totalCount: number;
|
|
66
66
|
truncated?: boolean;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
export type
|
|
69
|
+
export type GetRulesOutput = GetRulesOutputSuccess | ToolErrorResult;
|
|
70
70
|
|
|
71
|
-
export type
|
|
71
|
+
export type ExplainFactToolInput = {
|
|
72
72
|
subject: string;
|
|
73
73
|
predicate?: string;
|
|
74
74
|
object: string;
|
|
@@ -76,7 +76,7 @@ export type ExplainRDFoxRulesInput = {
|
|
|
76
76
|
|
|
77
77
|
export type ToolObjectOutput = object | ToolErrorResult;
|
|
78
78
|
|
|
79
|
-
export type
|
|
79
|
+
export type ExplainFactToolOutput = ToolObjectOutput;
|
|
80
80
|
|
|
81
81
|
export type ScheduleTaskInput = {
|
|
82
82
|
when: "scheduled" | "delayed" | "cron";
|
|
@@ -151,7 +151,7 @@ export type ExecuteActionPlanOutput =
|
|
|
151
151
|
}
|
|
152
152
|
| ToolErrorResult;
|
|
153
153
|
|
|
154
|
-
export type
|
|
154
|
+
export type ManageRulesInput = {
|
|
155
155
|
humanIntent: string;
|
|
156
156
|
operation: "add" | "change" | "remove";
|
|
157
157
|
ruleIri?: string;
|
|
@@ -161,17 +161,17 @@ export type ManageRDFoxRulesInput = {
|
|
|
161
161
|
dryRun?: boolean;
|
|
162
162
|
stageOnly?: boolean;
|
|
163
163
|
};
|
|
164
|
-
export type
|
|
164
|
+
export type ManageRulesSuccess = {
|
|
165
165
|
success: true;
|
|
166
166
|
ruleIri: string;
|
|
167
167
|
parsedRule: DatalogRule | null;
|
|
168
168
|
content: string;
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
export type
|
|
172
|
-
| (
|
|
173
|
-
| (
|
|
174
|
-
| (
|
|
171
|
+
export type ManageRulesOutput =
|
|
172
|
+
| (ManageRulesSuccess & { dryRun: true })
|
|
173
|
+
| (ManageRulesSuccess & { staged: true })
|
|
174
|
+
| (ManageRulesSuccess & {
|
|
175
175
|
ruleText: string;
|
|
176
176
|
inferenceVerified: boolean;
|
|
177
177
|
inferenceVerification: InferenceVerificationResult | null;
|
|
@@ -183,7 +183,7 @@ export type ManageRDFoxRulesOutput =
|
|
|
183
183
|
})
|
|
184
184
|
| ToolErrorResult;
|
|
185
185
|
|
|
186
|
-
export type
|
|
186
|
+
export type ManageFactsInput = {
|
|
187
187
|
humanIntent: string;
|
|
188
188
|
facts: string;
|
|
189
189
|
namedGraphIri?: string;
|
|
@@ -191,7 +191,7 @@ export type ManageRDFoxFactsInput = {
|
|
|
191
191
|
etag?: string;
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
export type
|
|
194
|
+
export type ManageFactsOutput =
|
|
195
195
|
| {
|
|
196
196
|
content: string;
|
|
197
197
|
is_error: boolean;
|
|
@@ -265,17 +265,17 @@ export type AutoPilotOutput = ({ success: true } & AutoPilotActionPlan) | ToolEr
|
|
|
265
265
|
export type CheckAutoPilotStatusOutput = AutoPilotActionPlan | ToolErrorResult;
|
|
266
266
|
|
|
267
267
|
export type ToolDefinitions = {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
queryKnowledgeGraph: ToolDefinition<QueryKnowledgeGraphInput, QueryKnowledgeGraphOutput>;
|
|
269
|
+
addFacts: ToolDefinition<AddFactsInput, AddFactsOutput>;
|
|
270
|
+
getRules: ToolDefinition<GetRulesInput, GetRulesOutput>;
|
|
271
|
+
explainFact: ToolDefinition<ExplainFactToolInput, ExplainFactToolOutput>;
|
|
272
272
|
scheduleTask: ToolDefinition<ScheduleTaskInput, ScheduleTaskOutput>;
|
|
273
273
|
listScheduledTasks: ToolDefinition<ListScheduledTasksInput, ListScheduledTasksOutput>;
|
|
274
274
|
cancelSchedule: ToolDefinition<CancelScheduleInput, CancelScheduleOutput>;
|
|
275
275
|
generateChart: ToolDefinition<GenerateChartInput, GenerateChartOutput>;
|
|
276
276
|
executeActionPlan: ToolDefinition<ExecuteActionPlanInput, ExecuteActionPlanOutput>;
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
manageRules: ToolDefinition<ManageRulesInput, ManageRulesOutput>;
|
|
278
|
+
manageFacts: ToolDefinition<ManageFactsInput, ManageFactsOutput>;
|
|
279
279
|
actionPlanShowcase: ToolDefinition<ActionPlanShowcaseInput, ActionPlanShowcaseOutput>;
|
|
280
280
|
showEntities: ToolDefinition<ShowEntitiesInput, ShowEntitiesOutput>;
|
|
281
281
|
checkAutoPilotStatus: ToolDefinition<AutoPilotInput, CheckAutoPilotStatusOutput>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataFactory } from "ldkit/rdf";
|
|
2
2
|
import { SELECT } from "ldkit/sparql";
|
|
3
|
-
import { sh,
|
|
3
|
+
import { sh, shaclGraph, writeLifecycle } from "./rdf-namespaces";
|
|
4
4
|
|
|
5
5
|
const dataFactory = new DataFactory();
|
|
6
6
|
const property = dataFactory.namedNode(sh.property);
|
|
@@ -12,7 +12,7 @@ export function buildActionShapePropertyQuery(actionShapeIris: string[]): string
|
|
|
12
12
|
const actionShapes = actionShapeIris.map((iri) => dataFactory.namedNode(iri));
|
|
13
13
|
|
|
14
14
|
return SELECT`DISTINCT ?actionShape ?parent ?path ?node ?flag`.WHERE`
|
|
15
|
-
GRAPH ${dataFactory.namedNode(
|
|
15
|
+
GRAPH ${dataFactory.namedNode(shaclGraph)} {
|
|
16
16
|
VALUES ?actionShape { ${actionShapes} }
|
|
17
17
|
?actionShape (${property}/${node})* ?parent .
|
|
18
18
|
?parent ${property} ?propertyShape .
|