@daogee/mdgraph 1.0.0 → 1.2.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 (106) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README-ZH.md +66 -4
  3. package/README.md +84 -22
  4. package/agent-pack/README.md +2 -0
  5. package/agent-pack/mdgraph-agent-instructions.md +3 -1
  6. package/agent-pack/prompts/wiki-authoring.md +12 -0
  7. package/agent-pack/skills/wiki-authoring/SKILL.md +38 -0
  8. package/agent-pack/skills/wiki-authoring/agents/openai.yaml +4 -0
  9. package/dist/analysis/status-freshness.d.ts +8 -1
  10. package/dist/analysis/status-freshness.js +19 -6
  11. package/dist/bin/mdgraph.js +260 -25
  12. package/dist/config/limits.d.ts +2 -0
  13. package/dist/config/limits.js +3 -1
  14. package/dist/config/load-config.js +8 -2
  15. package/dist/db/connection.js +17 -1
  16. package/dist/db/repositories.d.ts +55 -4
  17. package/dist/db/repositories.js +458 -11
  18. package/dist/db/sqlite-adapter.js +8 -2
  19. package/dist/evaluation/context-packing-evaluation.d.ts +29 -0
  20. package/dist/evaluation/context-packing-evaluation.js +134 -0
  21. package/dist/evaluation/entity-extraction-evaluation.d.ts +38 -0
  22. package/dist/evaluation/entity-extraction-evaluation.js +118 -0
  23. package/dist/evaluation/historical-baseline.d.ts +70 -0
  24. package/dist/evaluation/historical-baseline.js +278 -0
  25. package/dist/evaluation/related-documents-evaluation.d.ts +26 -0
  26. package/dist/evaluation/related-documents-evaluation.js +163 -0
  27. package/dist/evaluation/retrieval-eval.d.ts +25 -5
  28. package/dist/evaluation/retrieval-eval.js +79 -7
  29. package/dist/evaluation/structured-query-evaluation.d.ts +27 -0
  30. package/dist/evaluation/structured-query-evaluation.js +156 -0
  31. package/dist/extraction/entity-extractor.js +42 -22
  32. package/dist/extraction/graph-builder.js +2 -18
  33. package/dist/index.d.ts +24 -4
  34. package/dist/index.js +12 -4
  35. package/dist/indexer.js +80 -4
  36. package/dist/mcp/server.d.ts +4 -0
  37. package/dist/mcp/server.js +21 -11
  38. package/dist/mcp/tools.d.ts +5 -1
  39. package/dist/mcp/tools.js +116 -18
  40. package/dist/parser/markdown-parser.js +2 -0
  41. package/dist/query/context-builder.d.ts +32 -2
  42. package/dist/query/context-builder.js +191 -12
  43. package/dist/query/knowledge-card.d.ts +90 -0
  44. package/dist/query/knowledge-card.js +676 -0
  45. package/dist/query/search.d.ts +5 -1
  46. package/dist/query/search.js +85 -16
  47. package/dist/query/structured-query-executor.d.ts +28 -0
  48. package/dist/query/structured-query-executor.js +138 -0
  49. package/dist/query/structured-query.d.ts +50 -0
  50. package/dist/query/structured-query.js +390 -0
  51. package/dist/relationships/derive-related.d.ts +86 -0
  52. package/dist/relationships/derive-related.js +322 -0
  53. package/dist/reporting/report.js +2 -2
  54. package/dist/semantic/embed-chunks.d.ts +2 -0
  55. package/dist/semantic/embed-chunks.js +31 -0
  56. package/dist/semantic/ollama-provider.d.ts +6 -0
  57. package/dist/semantic/ollama-provider.js +136 -0
  58. package/dist/semantic/provider-registry.d.ts +8 -0
  59. package/dist/semantic/provider-registry.js +66 -0
  60. package/dist/semantic/provider.d.ts +35 -0
  61. package/dist/semantic/provider.js +29 -0
  62. package/dist/semantic/status.d.ts +6 -1
  63. package/dist/semantic/status.js +49 -3
  64. package/dist/types.d.ts +7 -2
  65. package/dist/types.js +2 -1
  66. package/dist/utils/path-safety.d.ts +3 -0
  67. package/dist/utils/path-safety.js +27 -0
  68. package/dist/watcher/file-watcher.d.ts +4 -0
  69. package/dist/watcher/file-watcher.js +151 -17
  70. package/dist/watcher/watch-health.d.ts +34 -0
  71. package/dist/watcher/watch-health.js +75 -0
  72. package/dist/wiki/wiki-dependencies.d.ts +20 -0
  73. package/dist/wiki/wiki-dependencies.js +45 -0
  74. package/dist/wiki/wiki-domains.d.ts +13 -0
  75. package/dist/wiki/wiki-domains.js +55 -0
  76. package/dist/wiki/wiki-evidence.d.ts +27 -0
  77. package/dist/wiki/wiki-evidence.js +112 -0
  78. package/dist/wiki/wiki-plan.d.ts +121 -0
  79. package/dist/wiki/wiki-plan.js +616 -0
  80. package/dist/wiki/wiki-status.d.ts +67 -0
  81. package/dist/wiki/wiki-status.js +451 -0
  82. package/docs/EN/Agent_Integration.md +15 -5
  83. package/docs/EN/Architecture.md +52 -16
  84. package/docs/EN/Evaluation_Questions.md +35 -5
  85. package/docs/EN/Knowledge_Cards_and_Wiki_Workflow.md +97 -0
  86. package/docs/EN/Operations.md +111 -0
  87. package/docs/EN/Output_Contracts.md +83 -10
  88. package/docs/EN/Public_Contracts.md +25 -16
  89. package/docs/EN/Public_Contracts_1.0.md +32 -18
  90. package/docs/EN/README.md +24 -0
  91. package/docs/EN/Release_Checklist.md +27 -13
  92. package/docs/EN/Retrieval_and_Context.md +118 -0
  93. package/docs/EN/Structured_Query_and_Relationships.md +111 -0
  94. package/docs/ZH/Agent_Integration.md +15 -5
  95. package/docs/ZH/Architecture.md +52 -21
  96. package/docs/ZH/Evaluation_Questions.md +36 -6
  97. package/docs/ZH/Knowledge_Cards_and_Wiki_Workflow.md +99 -0
  98. package/docs/ZH/Operations.md +111 -0
  99. package/docs/ZH/Output_Contracts.md +83 -10
  100. package/docs/ZH/Public_Contracts.md +24 -15
  101. package/docs/ZH/Public_Contracts_1.0.md +31 -17
  102. package/docs/ZH/README.md +24 -0
  103. package/docs/ZH/Release_Checklist.md +27 -13
  104. package/docs/ZH/Retrieval_and_Context.md +118 -0
  105. package/docs/ZH/Structured_Query_and_Relationships.md +111 -0
  106. package/package.json +50 -19
@@ -1,20 +1,35 @@
1
- import { searchGraph } from "./search.js";
1
+ import { explainSearchGraphAsync, searchGraph } from "./search.js";
2
2
  import { scanContentRiskLines } from "../utils/content-risk.js";
3
3
  import { normalizePath, uniqueStrings } from "../utils/text.js";
4
+ import { createKnowledgeCardBuilder } from "./knowledge-card.js";
4
5
  const DEFAULT_MAX_CONTEXT_NODES = 16;
6
+ const DEFAULT_MAX_CONTEXT_CARD_SUMMARIES = 4;
5
7
  export const CONTEXT_PACKING_STRATEGY = "mmr-style-document-round-robin";
8
+ export const CONTEXT_PACKING_STRATEGIES = [CONTEXT_PACKING_STRATEGY, "mmr"];
9
+ export const DEFAULT_MMR_LAMBDA = 0.65;
10
+ const MMR_SAME_DOCUMENT_REDUNDANCY_THRESHOLD = 0.8;
6
11
  export function buildContext(repository, config, query, options = {}) {
12
+ const searchLimit = positiveIntegerOr(options.searchLimit, config.search.defaultLimit * 2);
13
+ const results = searchGraph(repository, config, query, searchLimit, options.searchOptions);
14
+ return buildContextFromSearchResults(repository, config, query, results, options);
15
+ }
16
+ export async function buildContextAsync(repository, config, query, options = {}) {
17
+ const searchLimit = positiveIntegerOr(options.searchLimit, config.search.defaultLimit * 2);
18
+ const explanation = await explainSearchGraphAsync(repository, config, query, searchLimit, options.searchOptions);
19
+ return buildContextFromSearchResults(repository, config, query, explanation.results, options, explanation.semanticDiagnostic);
20
+ }
21
+ export function buildContextFromSearchResults(repository, config, query, results, options, semanticDiagnostic) {
7
22
  const knownFiles = normalizeKnownFiles(options.knownFiles ?? []);
8
23
  const maxChars = positiveIntegerOr(options.maxChars, config.search.maxContextChars);
9
- const searchLimit = positiveIntegerOr(options.searchLimit, config.search.defaultLimit * 2);
10
24
  const maxDepth = positiveIntegerOr(options.maxDepth, config.search.maxDepth);
11
- const results = searchGraph(repository, config, query, searchLimit, options.searchOptions);
12
25
  const collection = collectContextCandidates(repository, config, results, maxDepth);
13
26
  const candidates = knownFiles.length
14
27
  ? mergeKnownFileCandidates(repository, collection.candidates, knownFiles)
15
28
  : collection.candidates;
16
- const packed = packContext(query, enrichContextCandidates(repository, candidates), maxChars, options.mode);
17
- const result = addAgentHints(packed.result, knownFiles);
29
+ const packingStrategy = options.packingStrategy ?? CONTEXT_PACKING_STRATEGY;
30
+ const packed = packContext(repository, config, query, enrichContextCandidates(repository, candidates), maxChars, options.mode, packingStrategy, mmrLambdaOrDefault(options.mmrLambda));
31
+ const hinted = addAgentHints(packed.result, knownFiles);
32
+ const result = semanticDiagnostic ? { ...hinted, semanticDiagnostic } : hinted;
18
33
  if (!options.debug) {
19
34
  return result;
20
35
  }
@@ -25,14 +40,18 @@ export function buildContext(repository, config, query, options = {}) {
25
40
  candidateCount: candidates.length,
26
41
  directCandidates: candidates.filter((candidate) => candidate.direct).length,
27
42
  expandedCandidates: candidates.filter((candidate) => !candidate.direct).length,
28
- packingStrategy: CONTEXT_PACKING_STRATEGY,
43
+ packingStrategy: packed.packingStrategy,
44
+ packingSimilarity: packed.packingSimilarity,
45
+ mmrLambda: packed.mmrLambda,
46
+ packingSelections: packed.packingSelections,
29
47
  packedItems: result.items.length,
30
48
  packedUniqueDocuments: uniqueStrings(result.items.map((item) => item.path)).length,
31
49
  packingDiversityRatio: result.items.length
32
50
  ? Number((uniqueStrings(result.items.map((item) => item.path)).length / result.items.length).toFixed(4))
33
51
  : 0,
34
52
  budgetTruncatedItems: packed.budgetTruncatedItems,
35
- budgetSkippedItems: packed.budgetSkippedItems
53
+ budgetSkippedItems: packed.budgetSkippedItems,
54
+ redundancySkippedItems: packed.redundancySkippedItems || undefined
36
55
  }
37
56
  };
38
57
  }
@@ -208,10 +227,12 @@ function collectContextCandidates(repository, config, results, maxDepth) {
208
227
  }
209
228
  function enrichContextCandidates(repository, candidates) {
210
229
  return candidates.map((candidate) => {
230
+ const row = repository.contextChunkForNode(candidate.nodeId);
211
231
  const sourceRefs = sourceRefsForCandidate(repository, candidate);
212
232
  const riskNotes = riskNotesForCandidate(candidate);
213
233
  return {
214
234
  ...candidate,
235
+ chunkId: row?.chunk.id,
215
236
  sourceRefs: sourceRefs.length ? sourceRefs : undefined,
216
237
  riskNotes: riskNotes.length ? riskNotes : undefined
217
238
  };
@@ -294,16 +315,19 @@ function compareContextCandidates(left, right) {
294
315
  }
295
316
  return right.score - left.score;
296
317
  }
297
- function packContext(query, candidates, maxChars, mode) {
318
+ function packContext(repository, config, query, candidates, maxChars, mode, packingStrategy, mmrLambda) {
319
+ const ranking = packingStrategy === "mmr"
320
+ ? rankCandidatesWithMmr(repository, config, candidates, mmrLambda)
321
+ : { candidates, redundancySkippedItems: 0 };
298
322
  const items = [];
299
323
  let usedChars = 0;
300
324
  let budgetTruncatedItems = 0;
301
325
  let budgetSkippedItems = 0;
302
- for (let index = 0; index < candidates.length; index += 1) {
303
- const candidate = candidates[index];
326
+ for (let index = 0; index < ranking.candidates.length; index += 1) {
327
+ const candidate = ranking.candidates[index];
304
328
  const remaining = maxChars - usedChars;
305
329
  if (remaining <= 0) {
306
- budgetSkippedItems += candidates.length - index;
330
+ budgetSkippedItems += ranking.candidates.length - index;
307
331
  break;
308
332
  }
309
333
  const content = trimToBudget(candidate.content, remaining);
@@ -332,7 +356,162 @@ function packContext(query, candidates, maxChars, mode) {
332
356
  content
333
357
  });
334
358
  }
335
- return { result: { query, maxChars, usedChars, mode, items }, budgetTruncatedItems, budgetSkippedItems };
359
+ const withCardSummaries = addContextCardSummaries(repository, items, maxChars - usedChars);
360
+ usedChars += withCardSummaries.usedChars;
361
+ return {
362
+ result: {
363
+ query,
364
+ maxChars,
365
+ usedChars,
366
+ mode,
367
+ items: withCardSummaries.items,
368
+ packing: {
369
+ strategy: packingStrategy,
370
+ similarity: ranking.packingSimilarity,
371
+ mmrLambda: packingStrategy === "mmr" ? mmrLambda : undefined,
372
+ redundancySkippedItems: ranking.redundancySkippedItems || undefined
373
+ }
374
+ },
375
+ packingStrategy,
376
+ packingSimilarity: ranking.packingSimilarity,
377
+ mmrLambda: packingStrategy === "mmr" ? mmrLambda : undefined,
378
+ packingSelections: ranking.packingSelections,
379
+ budgetTruncatedItems,
380
+ budgetSkippedItems,
381
+ redundancySkippedItems: ranking.redundancySkippedItems
382
+ };
383
+ }
384
+ function addContextCardSummaries(repository, items, availableChars) {
385
+ if (availableChars < 32 || !items.length) {
386
+ return { items, usedChars: 0 };
387
+ }
388
+ const builder = createKnowledgeCardBuilder(repository);
389
+ let remaining = availableChars;
390
+ let added = 0;
391
+ const enriched = items.map((item) => {
392
+ if (added >= DEFAULT_MAX_CONTEXT_CARD_SUMMARIES || remaining < 32) {
393
+ return item;
394
+ }
395
+ const card = builder.build(item.nodeId);
396
+ if (!card) {
397
+ return item;
398
+ }
399
+ const cardSummary = card.summary;
400
+ if (cardSummary.length < 32 || cardSummary.length > remaining || cardSummary.endsWith("…")) {
401
+ return item;
402
+ }
403
+ remaining -= cardSummary.length;
404
+ added += 1;
405
+ return { ...item, cardSummary };
406
+ });
407
+ return { items: enriched, usedChars: availableChars - remaining };
408
+ }
409
+ function rankCandidatesWithMmr(repository, config, candidates, lambda) {
410
+ if (!candidates.length) {
411
+ return {
412
+ candidates: [],
413
+ packingSimilarity: "lexical-jaccard",
414
+ packingSelections: [],
415
+ redundancySkippedItems: 0
416
+ };
417
+ }
418
+ const vectors = repository.chunkVectors(candidates.flatMap((candidate) => candidate.chunkId ? [candidate.chunkId] : []), config.embedding.provider, config.embedding.model, config.embedding.dimensions);
419
+ const tokenSets = new Map(candidates.map((candidate) => [candidate.nodeId, tokensForSimilarity(candidate.content)]));
420
+ const remaining = candidates.map((candidate, order) => ({ candidate, order }));
421
+ const selected = [];
422
+ const selections = [];
423
+ let redundancySkippedItems = 0;
424
+ const maximumScore = Math.max(...candidates.map((candidate) => Math.max(0, candidate.score)), 1);
425
+ while (remaining.length) {
426
+ const scored = remaining.map((entry) => {
427
+ const queryRelevance = clamp01(Math.max(0, entry.candidate.score) / maximumScore);
428
+ const similarities = selected.map((other) => candidateSimilarity(entry.candidate, other, vectors, tokenSets));
429
+ const mostRedundant = similarities.reduce((best, current) => current.value > best.value ? current : best, { value: 0, source: "none" });
430
+ return {
431
+ ...entry,
432
+ queryRelevance,
433
+ redundancyPenalty: mostRedundant.value,
434
+ similaritySource: mostRedundant.source,
435
+ mmrScore: lambda * queryRelevance - (1 - lambda) * mostRedundant.value
436
+ };
437
+ }).sort((left, right) => (right.mmrScore - left.mmrScore
438
+ || right.queryRelevance - left.queryRelevance
439
+ || left.order - right.order));
440
+ const best = scored[0];
441
+ const remainingIndex = remaining.findIndex((entry) => entry.order === best.order);
442
+ remaining.splice(remainingIndex, 1);
443
+ const repeatsSelectedDocument = selected.some((candidate) => candidate.path === best.candidate.path);
444
+ if (repeatsSelectedDocument && best.redundancyPenalty >= MMR_SAME_DOCUMENT_REDUNDANCY_THRESHOLD) {
445
+ redundancySkippedItems += 1;
446
+ continue;
447
+ }
448
+ selected.push(best.candidate);
449
+ selections.push({
450
+ nodeId: best.candidate.nodeId,
451
+ path: best.candidate.path,
452
+ queryRelevance: roundScore(best.queryRelevance),
453
+ redundancyPenalty: roundScore(best.redundancyPenalty),
454
+ mmrScore: roundScore(best.mmrScore),
455
+ similaritySource: best.similaritySource
456
+ });
457
+ }
458
+ const vectorCandidateCount = candidates.filter((candidate) => candidate.chunkId && vectors.has(candidate.chunkId)).length;
459
+ return {
460
+ candidates: selected,
461
+ packingSimilarity: vectorCandidateCount === candidates.length
462
+ ? "embedding-cosine"
463
+ : vectorCandidateCount > 1 ? "hybrid" : "lexical-jaccard",
464
+ packingSelections: selections,
465
+ redundancySkippedItems
466
+ };
467
+ }
468
+ function candidateSimilarity(left, right, vectors, tokenSets) {
469
+ const leftVector = left.chunkId ? vectors.get(left.chunkId) : undefined;
470
+ const rightVector = right.chunkId ? vectors.get(right.chunkId) : undefined;
471
+ if (leftVector && rightVector && leftVector.length === rightVector.length) {
472
+ return { value: clamp01(cosineSimilarity(leftVector, rightVector)), source: "embedding-cosine" };
473
+ }
474
+ return {
475
+ value: jaccardSimilarity(tokenSets.get(left.nodeId) ?? new Set(), tokenSets.get(right.nodeId) ?? new Set()),
476
+ source: "lexical-jaccard"
477
+ };
478
+ }
479
+ function cosineSimilarity(left, right) {
480
+ let dot = 0;
481
+ let leftMagnitude = 0;
482
+ let rightMagnitude = 0;
483
+ for (let index = 0; index < left.length; index += 1) {
484
+ dot += left[index] * right[index];
485
+ leftMagnitude += left[index] * left[index];
486
+ rightMagnitude += right[index] * right[index];
487
+ }
488
+ return leftMagnitude > 0 && rightMagnitude > 0 ? dot / Math.sqrt(leftMagnitude * rightMagnitude) : 0;
489
+ }
490
+ function tokensForSimilarity(content) {
491
+ return new Set(content.toLowerCase().match(/[\p{L}\p{N}_]+/gu) ?? []);
492
+ }
493
+ function jaccardSimilarity(left, right) {
494
+ if (!left.size && !right.size) {
495
+ return 0;
496
+ }
497
+ let intersection = 0;
498
+ for (const token of left) {
499
+ if (right.has(token)) {
500
+ intersection += 1;
501
+ }
502
+ }
503
+ return intersection / (left.size + right.size - intersection);
504
+ }
505
+ function mmrLambdaOrDefault(value) {
506
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1
507
+ ? value
508
+ : DEFAULT_MMR_LAMBDA;
509
+ }
510
+ function clamp01(value) {
511
+ return Math.min(1, Math.max(0, value));
512
+ }
513
+ function roundScore(value) {
514
+ return Number(value.toFixed(4));
336
515
  }
337
516
  function candidateFromSearchResult(result) {
338
517
  return {
@@ -0,0 +1,90 @@
1
+ import { GraphRepository, type NodeRecord } from "../db/repositories.js";
2
+ import type { EdgeKind, Provenance } from "../types.js";
3
+ export declare const DEFAULT_KNOWLEDGE_CARD_LIMITS: {
4
+ readonly definitions: 8;
5
+ readonly sourceRefs: 8;
6
+ readonly relatedDocuments: 8;
7
+ readonly evidence: 12;
8
+ readonly nextReads: 6;
9
+ readonly maxChars: 4000;
10
+ };
11
+ export type KnowledgeCardNodeKind = Exclude<NodeRecord["kind"], "chunk">;
12
+ export type CardAssociation = "direct" | "inherited" | "related";
13
+ export interface CardReference {
14
+ nodeId: string;
15
+ kind: KnowledgeCardNodeKind;
16
+ label: string;
17
+ path?: string;
18
+ anchor?: string;
19
+ lines?: {
20
+ start: number;
21
+ end: number;
22
+ };
23
+ edgeKind?: EdgeKind;
24
+ provenance?: Provenance;
25
+ confidence?: number;
26
+ /** Whether this card owns the edge, inherited it from containment, or reaches it through another graph node. */
27
+ association?: CardAssociation;
28
+ /** The graph node that owns the displayed fact when it is not this card's node. */
29
+ originNodeId?: string;
30
+ /** The graph node used to reach a related fact. */
31
+ viaNodeId?: string;
32
+ }
33
+ export interface CardSourceReference {
34
+ nodeId: string;
35
+ path: string;
36
+ edgeKind: Extract<EdgeKind, "IMPLEMENTS" | "REFERENCES_SOURCE">;
37
+ provenance: Provenance;
38
+ confidence: number;
39
+ association?: CardAssociation;
40
+ originNodeId?: string;
41
+ viaNodeId?: string;
42
+ }
43
+ export interface CardEvidence {
44
+ edgeId: string;
45
+ fromId: string;
46
+ fromLabel: string;
47
+ toId: string;
48
+ toLabel: string;
49
+ edgeKind: EdgeKind;
50
+ provenance: Provenance;
51
+ confidence: number;
52
+ association?: CardAssociation;
53
+ originNodeId?: string;
54
+ viaNodeId?: string;
55
+ }
56
+ export interface CardNextRead extends CardReference {
57
+ reason: string;
58
+ }
59
+ export interface KnowledgeCard {
60
+ nodeId: string;
61
+ kind: KnowledgeCardNodeKind;
62
+ label: string;
63
+ summary: string;
64
+ definitions: CardReference[];
65
+ sourceRefs: CardSourceReference[];
66
+ relatedDocuments: CardReference[];
67
+ evidence: CardEvidence[];
68
+ nextReads?: CardNextRead[];
69
+ truncated?: {
70
+ definitions?: number;
71
+ sourceRefs?: number;
72
+ relatedDocuments?: number;
73
+ evidence?: number;
74
+ nextReads?: number;
75
+ };
76
+ }
77
+ export interface KnowledgeCardOptions {
78
+ maxDefinitions?: number;
79
+ maxSourceRefs?: number;
80
+ maxRelatedDocuments?: number;
81
+ maxEvidence?: number;
82
+ maxNextReads?: number;
83
+ maxChars?: number;
84
+ }
85
+ export interface KnowledgeCardBuilder {
86
+ build(nodeOrId: NodeRecord | string): KnowledgeCard | undefined;
87
+ }
88
+ export declare function createKnowledgeCardBuilder(repository: GraphRepository, options?: KnowledgeCardOptions): KnowledgeCardBuilder;
89
+ export declare function buildKnowledgeCard(repository: GraphRepository, nodeOrId: NodeRecord | string, options?: KnowledgeCardOptions): KnowledgeCard | undefined;
90
+ export declare function formatKnowledgeCard(card: KnowledgeCard): string;