@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.
Files changed (43) hide show
  1. package/dist/generated/graphql.d.ts +136 -35
  2. package/dist/generated/graphql.d.ts.map +1 -1
  3. package/dist/generated/graphql.js +70 -14
  4. package/dist/generated/graphql.js.map +1 -1
  5. package/dist/shared/datastore-id.js +1 -1
  6. package/dist/shared/datastore-id.js.map +1 -1
  7. package/dist/shared/memory-citation-sampling.d.ts +2 -1
  8. package/dist/shared/memory-citation-sampling.d.ts.map +1 -1
  9. package/dist/shared/memory-citation-sampling.js +5 -4
  10. package/dist/shared/memory-citation-sampling.js.map +1 -1
  11. package/dist/shared/memory-diversity.js +1 -1
  12. package/dist/shared/memory-diversity.js.map +1 -1
  13. package/dist/shared/memory-keyword-recall.d.ts +1 -0
  14. package/dist/shared/memory-keyword-recall.d.ts.map +1 -1
  15. package/dist/shared/memory-keyword-recall.js +2 -1
  16. package/dist/shared/memory-keyword-recall.js.map +1 -1
  17. package/dist/shared/rdf-namespaces.d.ts +1 -3
  18. package/dist/shared/rdf-namespaces.d.ts.map +1 -1
  19. package/dist/shared/rdf-namespaces.js +2 -4
  20. package/dist/shared/rdf-namespaces.js.map +1 -1
  21. package/dist/shared/tools/coercers.d.ts.map +1 -1
  22. package/dist/shared/tools/coercers.js +6 -3
  23. package/dist/shared/tools/coercers.js.map +1 -1
  24. package/dist/shared/tools/index.d.ts +1 -1
  25. package/dist/shared/tools/index.d.ts.map +1 -1
  26. package/dist/shared/tools/metadata.js +23 -23
  27. package/dist/shared/tools/metadata.js.map +1 -1
  28. package/dist/shared/tools/types.d.ts +24 -24
  29. package/dist/shared/tools/types.d.ts.map +1 -1
  30. package/dist/shared/writable-shape-query.js +2 -2
  31. package/dist/shared/writable-shape-query.js.map +1 -1
  32. package/package.json +5 -5
  33. package/src/generated/graphql.ts +225 -48
  34. package/src/shared/datastore-id.ts +1 -1
  35. package/src/shared/memory-citation-sampling.ts +5 -5
  36. package/src/shared/memory-diversity.ts +1 -1
  37. package/src/shared/memory-keyword-recall.ts +3 -1
  38. package/src/shared/rdf-namespaces.ts +2 -9
  39. package/src/shared/tools/coercers.ts +7 -4
  40. package/src/shared/tools/index.ts +8 -8
  41. package/src/shared/tools/metadata.ts +23 -23
  42. package/src/shared/tools/types.ts +30 -30
  43. 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
- AddRDFoxFactsInput,
17
- AddRDFoxFactsOutput,
16
+ AddFactsInput,
17
+ AddFactsOutput,
18
18
  CancelScheduleInput,
19
19
  CancelScheduleOutput,
20
20
  ExecuteActionPlanInput,
21
21
  ExecuteActionPlanOutput,
22
- ExplainRDFoxRulesInput,
23
- ExplainRDFoxRulesOutput,
22
+ ExplainFactToolInput,
23
+ ExplainFactToolOutput,
24
24
  GenerateChartInput,
25
25
  GenerateChartOutput,
26
- GetRDFoxRulesInput,
27
- GetRDFoxRulesOutput,
26
+ GetRulesInput,
27
+ GetRulesOutput,
28
28
  ListScheduledTasksInput,
29
29
  ListScheduledTasksOutput,
30
- RDFoxFactsInput,
31
- RDFoxFactsOutput,
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
- getRDFoxFacts: {
10
- name: "getRDFoxFacts",
11
- category: "rdfox",
9
+ queryKnowledgeGraph: {
10
+ name: "queryKnowledgeGraph",
11
+ category: "knowledge-graph",
12
12
  humanName: "Query knowledge base",
13
- description: "Retrieve facts from RDFox knowledge base using SPARQL",
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
- addRDFoxFacts: {
19
- name: "addRDFoxFacts",
20
- category: "rdfox",
18
+ addFacts: {
19
+ name: "addFacts",
20
+ category: "knowledge-graph",
21
21
  humanName: "Add facts",
22
- description: "Add facts to RDFox knowledge base as Turtle",
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
- getRDFoxRules: {
28
- name: "getRDFoxRules",
29
- category: "rdfox",
27
+ getRules: {
28
+ name: "getRules",
29
+ category: "knowledge-graph",
30
30
  humanName: "Check rules",
31
31
  description:
32
- "Retrieve Datalog rules from RDFox with optional filters (named graph, rdf:type, limit) to avoid context overflow",
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
- explainRDFoxRules: {
42
- name: "explainRDFoxRules",
43
- category: "rdfox",
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
- manageRDFoxRules: {
92
- name: "manageRDFoxRules",
93
- category: "rdfox",
91
+ manageRules: {
92
+ name: "manageRules",
93
+ category: "knowledge-graph",
94
94
  humanName: "Manage rules",
95
- description: "Add, change, or remove Datalog rules in RDFox knowledge base",
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
- manageRDFoxFacts: {
101
- name: "manageRDFoxFacts",
102
- category: "rdfox",
100
+ manageFacts: {
101
+ name: "manageFacts",
102
+ category: "knowledge-graph",
103
103
  humanName: "Manage facts",
104
- description: "Add, change facts in RDFox knowledge",
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
- | "getRDFoxFacts"
14
- | "addRDFoxFacts"
15
- | "getRDFoxRules"
16
- | "explainRDFoxRules"
13
+ | "queryKnowledgeGraph"
14
+ | "addFacts"
15
+ | "getRules"
16
+ | "explainFact"
17
17
  | "scheduleTask"
18
18
  | "listScheduledTasks"
19
19
  | "cancelSchedule"
20
20
  | "generateChart"
21
21
  | "executeActionPlan"
22
- | "manageRDFoxRules"
23
- | "manageRDFoxFacts"
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 = "rdfox" | "scheduler" | "charts" | "action" | "auto-pilot";
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 RDFoxFactsInput = {
42
+ export type QueryKnowledgeGraphInput = {
43
43
  humanIntent: string;
44
44
  sparql: string;
45
45
  keepPrefixes?: boolean;
46
46
  };
47
47
 
48
- export type RDFoxFactsOutput = JsonLdGraphDocument | SparqlJsonResults | ToolErrorResult;
48
+ export type QueryKnowledgeGraphOutput = JsonLdGraphDocument | SparqlJsonResults | ToolErrorResult;
49
49
 
50
- export type AddRDFoxFactsInput = {
50
+ export type AddFactsInput = {
51
51
  facts: string;
52
52
  humanIntent: string;
53
53
  };
54
54
 
55
- export type AddRDFoxFactsOutput = string | ToolErrorResult;
55
+ export type AddFactsOutput = string | ToolErrorResult;
56
56
 
57
- export type GetRDFoxRulesInput = {
57
+ export type GetRulesInput = {
58
58
  namedGraphIri?: string;
59
59
  rdfTypes?: string[];
60
60
  limit?: number;
61
61
  };
62
62
 
63
- export type GetRDFoxRulesOutputSuccess = {
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 GetRDFoxRulesOutput = GetRDFoxRulesOutputSuccess | ToolErrorResult;
69
+ export type GetRulesOutput = GetRulesOutputSuccess | ToolErrorResult;
70
70
 
71
- export type ExplainRDFoxRulesInput = {
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 ExplainRDFoxRulesOutput = ToolObjectOutput;
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 ManageRDFoxRulesInput = {
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 ManageRDFoxRulesSuccess = {
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 ManageRDFoxRulesOutput =
172
- | (ManageRDFoxRulesSuccess & { dryRun: true })
173
- | (ManageRDFoxRulesSuccess & { staged: true })
174
- | (ManageRDFoxRulesSuccess & {
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 ManageRDFoxFactsInput = {
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 ManageRDFoxFactsOutput =
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
- getRDFoxFacts: ToolDefinition<RDFoxFactsInput, RDFoxFactsOutput>;
269
- addRDFoxFacts: ToolDefinition<AddRDFoxFactsInput, AddRDFoxFactsOutput>;
270
- getRDFoxRules: ToolDefinition<GetRDFoxRulesInput, GetRDFoxRulesOutput>;
271
- explainRDFoxRules: ToolDefinition<ExplainRDFoxRulesInput, ExplainRDFoxRulesOutput>;
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
- manageRDFoxRules: ToolDefinition<ManageRDFoxRulesInput, ManageRDFoxRulesOutput>;
278
- manageRDFoxFacts: ToolDefinition<ManageRDFoxFactsInput, ManageRDFoxFactsOutput>;
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, shaclGraphIri, writeLifecycle } from "./rdf-namespaces";
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(shaclGraphIri)} {
15
+ GRAPH ${dataFactory.namedNode(shaclGraph)} {
16
16
  VALUES ?actionShape { ${actionShapes} }
17
17
  ?actionShape (${property}/${node})* ?parent .
18
18
  ?parent ${property} ?propertyShape .