@hraness/kb 0.18.0 → 0.19.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 (39) hide show
  1. package/README.md +197 -113
  2. package/dist/authoring.js +2 -2
  3. package/dist/benchmark.js +3 -3
  4. package/dist/cli.js +16 -12
  5. package/dist/evaluation-builder.js +5 -5
  6. package/dist/evaluation-kb.js +5 -5
  7. package/dist/graph.js +3 -1
  8. package/dist/{index-zxdy5pby.js → index-5m2ydj5q.js} +2 -2
  9. package/dist/{index-cxfrakt7.js → index-ekpwvbra.js} +5 -2
  10. package/dist/{index-jsmvyyvf.js → index-ey46z1zf.js} +4 -4
  11. package/dist/{index-cv6fh7z5.js → index-gm9t95d9.js} +1 -1
  12. package/dist/{index-01jj6rbv.js → index-gxr0fctd.js} +3 -3
  13. package/dist/index-nd6nynv2.js +1162 -0
  14. package/dist/{index-s2gw5aw9.js → index-qwgsmtsz.js} +1 -1
  15. package/dist/{index-zzhgcwyt.js → index-vxmf14m1.js} +3 -3
  16. package/dist/{index-n5dd7r0v.js → index-xw9ac71d.js} +2 -2
  17. package/dist/{index-1vrd1rmn.js → index-ykvvkd77.js} +1 -1
  18. package/dist/index.js +30 -8
  19. package/dist/percolate.js +22 -2
  20. package/dist/portfolio.js +5 -5
  21. package/dist/sdk.js +4 -4
  22. package/dist/search.js +2 -2
  23. package/dist/semantic.js +3 -3
  24. package/dist/workflows/decision-context.js +5 -5
  25. package/dist/workflows/index.js +5 -5
  26. package/package.json +1 -1
  27. package/skills/kb/AGENTS.md +3 -0
  28. package/skills/kb/SKILL.md +38 -29
  29. package/skills/kb/agents/openai.yaml +2 -2
  30. package/skills/kb/references/companion-skills.md +96 -0
  31. package/skills/kb/references/customize.md +123 -0
  32. package/skills/kb/references/percolate.md +39 -7
  33. package/skills/kb/references/query.md +21 -0
  34. package/skills/kb/templates/companion-skill.template.md +57 -0
  35. package/src/authoring.ts +5 -3
  36. package/src/cli.ts +12 -7
  37. package/src/graph.ts +8 -1
  38. package/src/percolate.ts +1088 -17
  39. package/dist/index-dyqwejk5.js +0 -531
@@ -207,6 +207,9 @@ function emptyMetadata() {
207
207
  }
208
208
  var relationPredicatePattern = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
209
209
  var maxNoteIdLength = 2048;
210
+ function isCanonicalRelationPredicate(value) {
211
+ return value !== "" && value === value.normalize("NFC") && relationPredicatePattern.test(value);
212
+ }
210
213
  function isCanonicalNoteId(value) {
211
214
  if (value === "" || value.length > maxNoteIdLength || value !== value.trim() || value !== value.normalize("NFC") || value.includes("\\") || value.includes("\x00") || value.includes(`
212
215
  `) || value.includes("\r") || value.startsWith("/") || value.endsWith("/") || value.toLocaleLowerCase("en-US").endsWith(".md")) {
@@ -275,7 +278,7 @@ function parsedRelations(contents, source, lineCounter) {
275
278
  continue;
276
279
  }
277
280
  const predicate = pair.key.value.normalize("NFC");
278
- if (!relationPredicatePattern.test(predicate)) {
281
+ if (!isCanonicalRelationPredicate(predicate)) {
279
282
  relationIssues.push(malformedRelation(source, predicateLine, `Invalid relation predicate "${predicate}"; use strict lower kebab-case.`, { predicate }));
280
283
  continue;
281
284
  }
@@ -1064,4 +1067,4 @@ function replaceCatalog(indexContent, catalog) {
1064
1067
  return indexContent.slice(0, start) + catalog + indexContent.slice(end + catalogEnd.length);
1065
1068
  }
1066
1069
 
1067
- export { MAX_PORTFOLIO_NAME_BYTES, MAX_DOCUMENT_ID_BYTES, portfolioVaultIdentity, parseVaultKey, parseDocumentId, documentIdState, formatQualifiedDocumentUri, parseQualifiedDocumentUri, portfolioDocumentIdentity, catalogStart, catalogEnd, MAX_ANALYZED_NOTES, MAX_CONNECTION_OBSERVATIONS, MAX_MENTION_PAIRS, MAX_MENTIONS, VaultAnalysisBudgetError, metadataValueFromUnknown, isCanonicalNoteId, normalizeVaultPath, searchableMarkdown, wikiLinks, parseNote, lookupNote, analyzeVault, renderCatalog, replaceCatalog };
1070
+ export { MAX_PORTFOLIO_NAME_BYTES, MAX_DOCUMENT_ID_BYTES, portfolioVaultIdentity, parseVaultKey, parseDocumentId, documentIdState, formatQualifiedDocumentUri, parseQualifiedDocumentUri, portfolioDocumentIdentity, catalogStart, catalogEnd, MAX_ANALYZED_NOTES, MAX_CONNECTION_OBSERVATIONS, MAX_MENTION_PAIRS, MAX_MENTIONS, VaultAnalysisBudgetError, metadataValueFromUnknown, isCanonicalRelationPredicate, isCanonicalNoteId, normalizeVaultPath, searchableMarkdown, wikiLinks, parseNote, lookupNote, analyzeVault, renderCatalog, replaceCatalog };
@@ -5,14 +5,14 @@ import {
5
5
  MAX_SEARCH_RESULTS,
6
6
  openKnowledgeBase,
7
7
  validateKnowledgeBaseSearchHistory
8
- } from "./index-zzhgcwyt.js";
8
+ } from "./index-vxmf14m1.js";
9
9
  import {
10
10
  expandSearchRequest,
11
11
  parseSearchRules
12
12
  } from "./index-adx6khj5.js";
13
13
  import {
14
14
  scanVault
15
- } from "./index-zxdy5pby.js";
15
+ } from "./index-5m2ydj5q.js";
16
16
  import {
17
17
  indexGitHistory
18
18
  } from "./index-1gwbassd.js";
@@ -22,7 +22,7 @@ import {
22
22
  } from "./index-x3fthpsc.js";
23
23
  import {
24
24
  validateSearchQuery
25
- } from "./index-cv6fh7z5.js";
25
+ } from "./index-gm9t95d9.js";
26
26
  import {
27
27
  validateQueryOptions
28
28
  } from "./index-48pz4jpc.js";
@@ -32,7 +32,7 @@ import {
32
32
  parseVaultKey,
33
33
  portfolioDocumentIdentity,
34
34
  portfolioVaultIdentity
35
- } from "./index-cxfrakt7.js";
35
+ } from "./index-ekpwvbra.js";
36
36
 
37
37
  // src/portfolio.ts
38
38
  import { createHash as createHash2 } from "crypto";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-48pz4jpc.js";
8
8
  import {
9
9
  lookupNote
10
- } from "./index-cxfrakt7.js";
10
+ } from "./index-ekpwvbra.js";
11
11
 
12
12
  // src/search.ts
13
13
  var MAX_EXACT_RESULTS = 500;
@@ -4,9 +4,10 @@ import {
4
4
  } from "./index-3rm7cz6h.js";
5
5
  import {
6
6
  isCanonicalNoteId,
7
+ isCanonicalRelationPredicate,
7
8
  parseDocumentId,
8
9
  parseQualifiedDocumentUri
9
- } from "./index-cxfrakt7.js";
10
+ } from "./index-ekpwvbra.js";
10
11
 
11
12
  // src/authoring.ts
12
13
  import { createHash, randomUUID } from "crypto";
@@ -40,7 +41,6 @@ import {
40
41
  } from "yaml";
41
42
  var MAX_NOTE_BYTES = 16 * 1024 * 1024;
42
43
  var NOTE_REVISION_PATTERN = /^sha256:[0-9a-f]{64}$/u;
43
- var PREDICATE_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
44
44
  var MAX_PARENT_DIRECTORY_ENTRIES = 1e5;
45
45
  var MAX_RECOVERY_LOCATIONS_PER_NOTE = 8;
46
46
 
@@ -113,7 +113,7 @@ function canonicalRelationTarget(value) {
113
113
  }
114
114
  function normalizeRelationPredicate(value) {
115
115
  const normalized = value.trim().normalize("NFC").toLocaleLowerCase("en-US").replaceAll("_", "-").replace(/\s+/gu, "-").replace(/-{2,}/gu, "-");
116
- if (!PREDICATE_PATTERN.test(normalized)) {
116
+ if (!isCanonicalRelationPredicate(normalized)) {
117
117
  throw new TypeError(`not a valid relation predicate: ${JSON.stringify(value)}`);
118
118
  }
119
119
  return normalized;