@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.
- package/README.md +197 -113
- package/dist/authoring.js +2 -2
- package/dist/benchmark.js +3 -3
- package/dist/cli.js +16 -12
- package/dist/evaluation-builder.js +5 -5
- package/dist/evaluation-kb.js +5 -5
- package/dist/graph.js +3 -1
- package/dist/{index-zxdy5pby.js → index-5m2ydj5q.js} +2 -2
- package/dist/{index-cxfrakt7.js → index-ekpwvbra.js} +5 -2
- package/dist/{index-jsmvyyvf.js → index-ey46z1zf.js} +4 -4
- package/dist/{index-cv6fh7z5.js → index-gm9t95d9.js} +1 -1
- package/dist/{index-01jj6rbv.js → index-gxr0fctd.js} +3 -3
- package/dist/index-nd6nynv2.js +1162 -0
- package/dist/{index-s2gw5aw9.js → index-qwgsmtsz.js} +1 -1
- package/dist/{index-zzhgcwyt.js → index-vxmf14m1.js} +3 -3
- package/dist/{index-n5dd7r0v.js → index-xw9ac71d.js} +2 -2
- package/dist/{index-1vrd1rmn.js → index-ykvvkd77.js} +1 -1
- package/dist/index.js +30 -8
- package/dist/percolate.js +22 -2
- package/dist/portfolio.js +5 -5
- package/dist/sdk.js +4 -4
- package/dist/search.js +2 -2
- package/dist/semantic.js +3 -3
- package/dist/workflows/decision-context.js +5 -5
- package/dist/workflows/index.js +5 -5
- package/package.json +1 -1
- package/skills/kb/AGENTS.md +3 -0
- package/skills/kb/SKILL.md +38 -29
- package/skills/kb/agents/openai.yaml +2 -2
- package/skills/kb/references/companion-skills.md +96 -0
- package/skills/kb/references/customize.md +123 -0
- package/skills/kb/references/percolate.md +39 -7
- package/skills/kb/references/query.md +21 -0
- package/skills/kb/templates/companion-skill.template.md +57 -0
- package/src/authoring.ts +5 -3
- package/src/cli.ts +12 -7
- package/src/graph.ts +8 -1
- package/src/percolate.ts +1088 -17
- 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 (!
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
35
|
+
} from "./index-ekpwvbra.js";
|
|
36
36
|
|
|
37
37
|
// src/portfolio.ts
|
|
38
38
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -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-
|
|
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 (!
|
|
116
|
+
if (!isCanonicalRelationPredicate(normalized)) {
|
|
117
117
|
throw new TypeError(`not a valid relation predicate: ${JSON.stringify(value)}`);
|
|
118
118
|
}
|
|
119
119
|
return normalized;
|