@tangle-network/agent-knowledge 17.0.2 → 17.1.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/CHANGELOG.md +14 -0
- package/README.md +4 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-BbPJdmHe.js → benchmarks-B3kU-Yxz.js} +2 -2
- package/dist/{benchmarks-BbPJdmHe.js.map → benchmarks-B3kU-Yxz.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -19
- package/dist/index.js.map +1 -1
- package/dist/{inspect-DvPbG-kF.js → inspect-DrJnvx5Z.js} +24 -3
- package/dist/inspect-DrJnvx5Z.js.map +1 -0
- package/dist/memory/index.js +2 -2
- package/dist/{memory-ce9n5O24.js → memory-Bn1Xs1hY.js} +2 -2
- package/dist/{memory-ce9n5O24.js.map → memory-Bn1Xs1hY.js.map} +1 -1
- package/dist/{search-Cw6eYfSd.js → search-Cbyj2shJ.js} +16 -11
- package/dist/search-Cbyj2shJ.js.map +1 -0
- package/docs/run-scoped-citations.md +30 -0
- package/package.json +2 -2
- package/dist/inspect-DvPbG-kF.js.map +0 -1
- package/dist/search-Cw6eYfSd.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as textSourceId, n as slugify, r as stableId, t as sha256 } from "./ids-Bevz_pXV.js";
|
|
2
|
-
import { r as searchKnowledge } from "./search-
|
|
2
|
+
import { r as searchKnowledge } from "./search-Cbyj2shJ.js";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -2027,15 +2027,29 @@ var KnowledgeCitationAuditError = class extends Error {
|
|
|
2027
2027
|
this.report = report;
|
|
2028
2028
|
}
|
|
2029
2029
|
};
|
|
2030
|
+
const ENCODED_REFERENCE_PREFIX = "knowledge-ref:v1:";
|
|
2030
2031
|
/**
|
|
2031
2032
|
* Parse the persisted citation form.
|
|
2032
2033
|
*
|
|
2033
2034
|
* `page-id` is unqualified. `here::page-id`, `shared::page-id`, and
|
|
2034
2035
|
* `inherited:<runId>::page-id` bind an intentional duplicate to one origin.
|
|
2036
|
+
* Ambiguous names use `knowledge-ref:v1:` plus a URI-encoded JSON [origin, pageId]
|
|
2037
|
+
* tuple (null origin means unqualified). Always use the formatter to mint handles.
|
|
2038
|
+
* Legacy percent sequences are literal; old records are not silently reinterpreted.
|
|
2035
2039
|
*/
|
|
2036
2040
|
function parseKnowledgeCitationReference(value) {
|
|
2037
2041
|
if (typeof value !== "string" || value.trim().length === 0) throw new TypeError("persisted knowledge citation must be a non-empty string");
|
|
2038
2042
|
const normalized = value.trim();
|
|
2043
|
+
if (normalized.startsWith(ENCODED_REFERENCE_PREFIX)) try {
|
|
2044
|
+
const tuple = JSON.parse(decodeURIComponent(normalized.slice(17)));
|
|
2045
|
+
if (!Array.isArray(tuple) || tuple.length !== 2) throw new TypeError("encoded citation must contain an origin/page tuple");
|
|
2046
|
+
return normalizeReference({
|
|
2047
|
+
pageId: tuple[1],
|
|
2048
|
+
...tuple[0] === null ? {} : { origin: tuple[0] }
|
|
2049
|
+
});
|
|
2050
|
+
} catch (cause) {
|
|
2051
|
+
throw new TypeError("invalid encoded knowledge citation", { cause });
|
|
2052
|
+
}
|
|
2039
2053
|
const separator = normalized.indexOf("::");
|
|
2040
2054
|
if (separator < 0) return Object.freeze({ pageId: normalized });
|
|
2041
2055
|
const possibleOrigin = normalized.slice(0, separator);
|
|
@@ -2049,7 +2063,14 @@ function parseKnowledgeCitationReference(value) {
|
|
|
2049
2063
|
/** Serialize one reference into the canonical frontmatter representation. */
|
|
2050
2064
|
function formatKnowledgeCitationReference(reference) {
|
|
2051
2065
|
const normalized = normalizeReference(reference);
|
|
2052
|
-
|
|
2066
|
+
const legacy = normalized.origin === void 0 ? normalized.pageId : `${normalized.origin}::${normalized.pageId}`;
|
|
2067
|
+
try {
|
|
2068
|
+
const parsed = parseKnowledgeCitationReference(legacy);
|
|
2069
|
+
if (parsed.pageId === normalized.pageId && parsed.origin === normalized.origin) return legacy;
|
|
2070
|
+
} catch (error) {
|
|
2071
|
+
if (!(error instanceof TypeError)) throw error;
|
|
2072
|
+
}
|
|
2073
|
+
return `${ENCODED_REFERENCE_PREFIX}${encodeURIComponent(JSON.stringify([normalized.origin ?? null, normalized.pageId]))}`;
|
|
2053
2074
|
}
|
|
2054
2075
|
/** Resolve one reference against an already materialized visibility chain. */
|
|
2055
2076
|
function resolveKnowledgeCitation(visiblePages, reference) {
|
|
@@ -4053,4 +4074,4 @@ function explainKnowledgeTarget(index, target) {
|
|
|
4053
4074
|
//#endregion
|
|
4054
4075
|
export { formatKnowledgeCitationReference as $, inspectPendingKnowledgeMutation as $t, addSourceText as A, writeJsonDurableWithinRoot as An, ResearchSourceVersionSchema as At, KB_STORE_DIR as B, claimId as Bt, gradeClaims as C, renameDurable as Cn, KnowledgePageSchema as Ct, buildKnowledgeIndex as D, writeFileDurable as Dn, ResearchClaimEvidenceSchema as Dt, verifyGradeableEvidence as E, withSafeDirectory as En, KnowledgeRelationSchema as Et, ClaimLedgerMigrationRequiredError as F, assertDeepQuestionIntegrity as Ft, KnowledgeCitationAuditError as G, materializeRegisteredClaimEvidence as Gt, assertClaimLedgerId as H, deepQuestionId as Ht, FileSystemKbStore as I, assertResearchClaimEvidenceIntegrity as It, assertKnowledgeCitationAudit as J, normalizeClaimText as Jt, KnowledgeCitationResolutionError as K, mergeClaimLedgers as Kt, KB_CLAIM_LEDGER_DIR as L, assertResearchClaimLedgerIntegrity as Lt, snapshotSourceTextInput as M, textSourceAdapter as Mn, SourceRecordSchema as Mt, sourceRegistryPath as N, KNOWLEDGE_EVENT_TYPES as Nt, writeKnowledgeIndex as O, writeFileDurableWithinRoot as On, ResearchClaimLedgerSchema as Ot, writeSourceRegistry as P, ClaimLedgerGoalConflictError as Pt, auditKnowledgeCitations as Q, acquireDurableFileLock as Qt, KB_EVENTS_PATH as R, assertTrackedClaimIntegrity as Rt, claimCheckKey as S, removeDurable as Sn, KnowledgePageInvalidationSchema as St, verdictFor as T, withSafeDescendant as Tn, KnowledgeRelationNodeSchema as Tt, buildKnowledgeGraph as U, emptyClaimLedger as Ut, MemoryKbStore as V, claimSourceHost as Vt, knowledgePageRelations as W, linkClaimContradictions as Wt, assertRunScopedCitationsResolved as X, formatFrontmatter as Xt, assertKnowledgeCitationsResolved as Y, researchSourceVersionKey as Yt, auditCurrentRunCitations as Z, parseFrontmatter as Zt, lintKnowledgeIndex as _, isMissingFile as _n, KnowledgeBaseCandidateSchema as _t, applyKnowledgeWriteBlocksFile as a, applyKnowledgeFileTransaction as an, SCAFFOLD_PAGE_BASENAMES as at, UncheckableClaimError as b, readRegularFileWithinRoot as bn, KnowledgeGraphNodeSchema as bt, KnowledgeDuplicateIntakeError as c, finishKnowledgeFileTransaction as cn, isScaffoldPath as ct, createFileRunLineageAuthority as d, rollbackKnowledgeFileTransaction as dn, loadKnowledgePages as dt, isKnowledgeMutationHeld as en, parseKnowledgeCitationReference as et, createRunScopedStores as f, DEFAULT_PAGES_DIRECTORY as fn, writeJson as ft, validateKnowledgeIndex as g, isKernelAnchoredPath as gn, DeepQuestionSchema as gt, normalizePageText as h, canonicalRelativeWithinRoot as hn, normalizeLinkTarget as ht, applyKnowledgeWriteBlocks as i, withKnowledgeRead as in, resolveRunScopedCitations as it, loadSourceRegistry as j, mediaTypeFor$1 as jn, SourceAnchorSchema as jt, addSourcePath as k, writeJsonDurable as kn, ResearchClaimRecordSchema as kt, assertKnowledgeWriteIntake as l, knowledgeFileTransactionPlanHash as ln, knowledgePageFromMarkdown as lt, detectNearDuplicatePages as m, canonicalPathsEqual as mn, extractWikilinks as mt, inspectKnowledgeIndex as n, runInKnowledgeMutationScope as nn, resolveKnowledgeCitations as nt, isSafeKnowledgePath as o, assertKnowledgeMutationPath as on, initKnowledgeBase as ot, originatedPages as p, normalizePagesDirectory as pn, WIKILINK_REGEX as pt, assertCurrentRunCitationsResolved as q, mergeTrackedClaims as qt, stringMetadata as r, withKnowledgeMutation as rn, resolveRunScopedCitation as rt, parseKnowledgeWriteBlocks as s, commitKnowledgeFileMutations as sn, isKnowledgePagePath as st, explainKnowledgeTarget as t, recoverPendingKnowledgeMutation as tn, resolveKnowledgeCitation as tt, RUN_LINEAGE_BASENAME as u, prepareKnowledgeFileTransaction as un, layoutFor as ut, CHECKABLE_RUNG_THRESHOLD as v, listRegularFilesWithinRoot as vn, KnowledgeEventSchema as vt, gradeFor as w, syncDirectory as wn, KnowledgeRelationGraphSchema as wt, assertGradeableEvidence as x, relativeWithinRoot as xn, KnowledgeIndexSchema as xt, DEADLINE_EXIT_CODE as y, readRegularFileNoFollow as yn, KnowledgeGraphEdgeSchema as yt, KB_INDEX_PATH as z, claimEvidenceId as zt };
|
|
4055
4076
|
|
|
4056
|
-
//# sourceMappingURL=inspect-
|
|
4077
|
+
//# sourceMappingURL=inspect-DrJnvx5Z.js.map
|