@tangle-network/agent-knowledge 19.0.1 → 19.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/dist/cli.js +1 -1
- package/dist/{index-eDsIXWyM.d.ts → index-Bh9wLd0_.d.ts} +64 -3
- package/dist/index-Bh9wLd0_.d.ts.map +1 -0
- package/dist/index.d.ts +96 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +268 -64
- package/dist/index.js.map +1 -1
- package/dist/{inspect-C6YK7af7.js → inspect-CwIvMcno.js} +126 -3
- package/dist/inspect-CwIvMcno.js.map +1 -0
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{memory-BYWNir2t.js → memory-PlYkyv8x.js} +430 -56
- package/dist/memory-PlYkyv8x.js.map +1 -0
- package/docs/hindsight-memory.md +126 -0
- package/docs/qmd-retrieval.md +60 -0
- package/docs/run-scoped-citations.md +14 -0
- package/package.json +1 -1
- package/dist/index-eDsIXWyM.d.ts.map +0 -1
- package/dist/inspect-C6YK7af7.js.map +0 -1
- package/dist/memory-BYWNir2t.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as writeSourceRegistry, $t as ClaimLedgerGoalConflictError, A as verifyKnowledgeVisibilitySnapshot, An as rollbackKnowledgeFileTransaction, At as loadKnowledgePages, B as assertGradeableEvidence, Bn as relativeWithinRoot, Bt as KnowledgeIndexSchema, C as knowledgePageDigest, Cn as withKnowledgeRead, Ct as resolveRunScopedCitations, D as normalizeVisibilityRef, Dn as finishKnowledgeFileTransaction, Dt as isScaffoldPath, E as normalizeVisibilityArtifact, En as commitKnowledgeFileMutations, Et as isKnowledgePagePath, F as validateKnowledgeIndex, Fn as isKernelAnchoredPath, Ft as DeepQuestionSchema, G as verifyGradeableEvidence, Gn as withSafeDirectory, Gt as KnowledgeRelationSchema, H as gradeClaims, Hn as renameDurable, Ht as KnowledgePageSchema, I as lintKnowledgeIndex, In as isMissingFile, It as KnowledgeBaseCandidateSchema, J as addSourcePath, Jn as writeJsonDurable, Jt as ResearchClaimRecordSchema, K as buildKnowledgeIndex, Kn as writeFileDurable, Kt as ResearchClaimEvidenceSchema, L as CHECKABLE_RUNG_THRESHOLD, Ln as listRegularFilesWithinRoot, Lt as KnowledgeEventSchema, M as visibilityIndexOf, Mn as normalizePagesDirectory, Mt as WIKILINK_REGEX, N as detectNearDuplicatePages, Nn as canonicalPathsEqual, Nt as extractWikilinks, O as validateKnowledgePage, On as knowledgeFileTransactionPlanHash, Ot as knowledgePageFromMarkdown, P as normalizePageText, Pn as canonicalRelativeWithinRoot, Pt as normalizeLinkTarget, Q as sourceRegistryPath, Qt as KNOWLEDGE_EVENT_TYPES, R as DEADLINE_EXIT_CODE, Rn as readRegularFileNoFollow, Rt as KnowledgeGraphEdgeSchema, S as encodeKnowledgeVisibilitySnapshot, Sn as withKnowledgeMutation, St as resolveRunScopedCitation, T as nonEmpty$1, Tn as assertKnowledgeMutationPath, Tt as initKnowledgeBase, U as gradeFor, Un as syncDirectory, Ut as KnowledgeRelationGraphSchema, V as claimCheckKey, Vn as removeDurable, Vt as KnowledgePageInvalidationSchema, W as verdictFor, Wn as withSafeDescendant, Wt as KnowledgeRelationNodeSchema, X as loadSourceRegistry, Xn as mediaTypeFor, Xt as SourceAnchorSchema, Y as addSourceText, Yn as writeJsonDurableWithinRoot, Yt as ResearchSourceVersionSchema, Z as snapshotSourceTextInput, Zn as textSourceAdapter, Zt as SourceRecordSchema, _ as KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION, _n as acquireDurableFileLock, _t as auditKnowledgeCitations, a as applyKnowledgeWriteBlocksFile, an as claimId, at as KB_STORE_DIR, b as decodeKnowledgeVisibilitySnapshot, bn as recoverPendingKnowledgeMutation, bt as resolveKnowledgeCitation, c as KnowledgeDuplicateIntakeError, cn as emptyClaimLedger, ct as buildKnowledgeGraph, d as createFileRunLineageAuthority, dn as mergeClaimLedgers, dt as KnowledgeCitationResolutionError, en as assertDeepQuestionIntegrity, et as ClaimLedgerMigrationRequiredError, f as createRunScopedStores, fn as mergeTrackedClaims, ft as assertCurrentRunCitationsResolved, g as KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM, gn as parseFrontmatter, gt as auditCurrentRunCitations, h as originatedPages, hn as formatFrontmatter, ht as assertRunScopedCitationsResolved, i as applyKnowledgeWriteBlocks, in as claimEvidenceId, it as KB_INDEX_PATH, j as visibilityIdentity, jn as DEFAULT_PAGES_DIRECTORY, jt as writeJson, k as validateOrigin, kn as prepareKnowledgeFileTransaction, kt as layoutFor, l as assertKnowledgeWriteIntake, ln as linkClaimContradictions, lt as knowledgePageRelations, m as loadKnowledgeToolChain, mn as researchSourceVersionKey, mt as assertKnowledgeCitationsResolved, n as inspectKnowledgeIndex, nn as assertResearchClaimLedgerIntegrity, nt as KB_CLAIM_LEDGER_DIR, o as isSafeKnowledgePath, on as claimSourceHost, ot as MemoryKbStore, p as isKnowledgeToolChain, pn as normalizeClaimText, pt as assertKnowledgeCitationAudit, q as writeKnowledgeIndex, qn as writeFileDurableWithinRoot, qt as ResearchClaimLedgerSchema, r as stringMetadata, rn as assertTrackedClaimIntegrity, rt as KB_EVENTS_PATH, s as parseKnowledgeWriteBlocks, sn as deepQuestionId, st as assertClaimLedgerId, t as explainKnowledgeTarget, tn as assertResearchClaimEvidenceIntegrity, tt as FileSystemKbStore, u as RUN_LINEAGE_BASENAME, un as materializeRegisteredClaimEvidence, ut as KnowledgeCitationAuditError, v as assertSchemaVersion, vn as inspectPendingKnowledgeMutation, vt as formatKnowledgeCitationReference, w as knowledgeVisibilityArtifactRef, wn as applyKnowledgeFileTransaction, wt as SCAFFOLD_PAGE_BASENAMES, x as digest, xn as runInKnowledgeMutationScope, xt as resolveKnowledgeCitations, y as createKnowledgeVisibilitySnapshot, yn as isKnowledgeMutationHeld, yt as parseKnowledgeCitationReference, z as UncheckableClaimError, zn as readRegularFileWithinRoot, zt as KnowledgeGraphNodeSchema } from "./inspect-CwIvMcno.js";
|
|
2
2
|
import { i as textSourceId, n as slugify, r as stableId, t as sha256 } from "./ids-Bevz_pXV.js";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as retrievalHoldoutConfigHash, C as defaultGetMemoryContext, D as deterministicRng, E as applySessionStickyRetrievalHoldout, F as scenarioContentFingerprint, I as assertImmutableRef, M as jsonCandidateCodec, N as jsonObjectCandidateCodec, O as emitRetrievalHoldoutBypass, P as runSerializedKnowledgeOptimization, S as forkAgentMemoryBranchSnapshot, T as applyRetrievalHoldout, _ as runAgentMemoryExperiment, a as runAgentMemoryImprovement, b as buildAgentMemorySequencesFromBenchmarkCases, c as hindsightMemoryBankId, d as AgentMemoryScopeSchema, f as AgentMemoryWriteInputSchema, g as runAgentMemoryLearningExperiment, h as compareAgentMemoryLearning, i as mem0MemoryAdapterIdentity, j as toOffPolicyTrajectory, k as resetRetrievalHoldoutRegistry, l as AgentMemoryHitSchema, m as graphitiMemoryAdapterIdentity, n as createNeo4jAgentMemoryAdapter, o as HindsightOperationUnknownError, p as createGraphitiMemoryAdapter, r as createMem0MemoryAdapter, s as createHindsightMemoryAdapter, t as createPlayMemoryTools, u as AgentMemoryKindSchema, v as agentMemorySequenceJudge, w as renderMemoryContext, x as createAgentMemoryBranch, y as buildAgentMemorySequenceScenarios } from "./memory-PlYkyv8x.js";
|
|
4
4
|
import { C as sleepForMemoryRecovery, F as buildIndustryRagBenchmarkSmokeCases, G as buildRetrievalEvalDispatch, H as createNoopMemoryBenchmarkAdapter, I as respondToIndustryMemoryBenchmarkSmokeCase, J as retrievalConfigSurface, K as partitionRetrievalScenarios, L as respondToIndustryRagBenchmarkSmokeCase, M as INDUSTRY_RAG_BENCHMARKS, N as buildFirstPartyMemoryLifecycleBenchmarkCases, P as buildIndustryMemoryBenchmarkSmokeCases, R as isKnowledgeMemoryBenchmarkCase, S as runBoundedMemoryLifecycle, U as memoryHitToSourceRecord, V as createInMemoryBenchmarkAdapter, W as memoryWriteResultToSourceRecord, X as scoreRetrievalArtifact, Y as retrievalRecallJudge, Z as mean, a as buildKnowledgeBenchmarkScenarios, b as memoryRecoveryDelayMs, c as runKnowledgeBenchmarkSuite, d as summarizeKnowledgeBenchmarkCampaign, f as acquireAgentMemoryRunLease, h as DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, i as runMemoryAdapterBenchmark, j as INDUSTRY_MEMORY_BENCHMARKS, l as scoreKnowledgeBenchmarkArtifact, m as AgentMemoryLifecycleUnsafeError, n as parseKnowledgeBenchmarkJsonl, o as knowledgeBenchmarkJudge, p as AgentMemoryLifecycleTimeoutError, q as retrievalConfigFromSurface, r as parseKnowledgeBenchmarkQrels, s as renderKnowledgeBenchmarkReportMarkdown, t as buildRetrievalBenchmarkCasesFromQrels, u as scoreMemoryBenchmarkArtifact, x as resolveMemoryCleanupTimeoutMs, y as createMemoryExecutionPool } from "./benchmarks-B3kU-Yxz.js";
|
|
5
5
|
import { a as buildKnowledgeLexicalIndex, c as tokenizeText, i as searchKnowledgePages, n as reciprocalRankFusion, o as scoreBm25, r as searchKnowledge, s as tokenizeQuery, t as KNOWLEDGE_SEARCH_RETRIEVER_ID } from "./search-Cbyj2shJ.js";
|
|
6
6
|
import { IRS_DIMENSION_HINTS, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, POLITE_USER_AGENT, __resetHttpThrottle, createCornellLiiSource, createIrsPublicationsSource, createStateSosSource, extractLinks, firstMatch, htmlToText, innerHtmlById, looksLikeBlockPage, politeFetch } from "./sources/index.js";
|
|
@@ -5969,12 +5969,11 @@ const DEFAULT_KNOWLEDGE_BRIEF_LIMIT = 5;
|
|
|
5969
5969
|
* and rendering are deterministic, and no field carries a timestamp.
|
|
5970
5970
|
*/
|
|
5971
5971
|
function buildKnowledgeBrief(visiblePages, question, options = {}) {
|
|
5972
|
+
return prepareKnowledgeBrief(visiblePages)(question, options);
|
|
5973
|
+
}
|
|
5974
|
+
/** Internal prepared view, shared by tools only while their immutable page view is current. */
|
|
5975
|
+
function prepareKnowledgeBrief(visiblePages) {
|
|
5972
5976
|
if (!Array.isArray(visiblePages)) throw new TypeError("knowledge brief requires the visible pages");
|
|
5973
|
-
if (typeof question !== "string" || question.trim().length === 0) throw new TypeError("knowledge brief question must be a non-empty string");
|
|
5974
|
-
const limit = options.limit ?? 5;
|
|
5975
|
-
const excludeInvalidated = options.excludeInvalidated ?? true;
|
|
5976
|
-
const maxChars = options.maxChars;
|
|
5977
|
-
if (maxChars !== void 0 && (!Number.isInteger(maxChars) || maxChars < 0)) throw new Error(`knowledge brief maxChars must be a non-negative integer, got ${maxChars}`);
|
|
5978
5977
|
const byId = /* @__PURE__ */ new Map();
|
|
5979
5978
|
for (const entry of visiblePages) {
|
|
5980
5979
|
const matches = byId.get(entry.page.id) ?? [];
|
|
@@ -6004,52 +6003,61 @@ function buildKnowledgeBrief(visiblePages, question, options = {}) {
|
|
|
6004
6003
|
originals.set(page, entry);
|
|
6005
6004
|
return page;
|
|
6006
6005
|
});
|
|
6007
|
-
const
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
const
|
|
6015
|
-
|
|
6016
|
-
pageId: entry.page.id,
|
|
6017
|
-
...candidates.length === 1 && formatKnowledgeCitationReference({ pageId: entry.page.id }) === entry.page.id ? {} : { origin: entry.origin }
|
|
6018
|
-
};
|
|
6019
|
-
assertKnowledgeCitationsResolved(candidates, [reference]);
|
|
6020
|
-
return {
|
|
6021
|
-
...hit,
|
|
6022
|
-
page: entry.page,
|
|
6023
|
-
origin: entry.origin,
|
|
6024
|
-
citationId: formatKnowledgeCitationReference(reference)
|
|
6025
|
-
};
|
|
6026
|
-
});
|
|
6027
|
-
const hits = [];
|
|
6028
|
-
const lines = [];
|
|
6029
|
-
let length = 0;
|
|
6030
|
-
for (const hit of ranked) {
|
|
6031
|
-
const line = briefLine(hit);
|
|
6032
|
-
const next = length === 0 ? line.length : length + 1 + line.length;
|
|
6033
|
-
if (maxChars !== void 0 && next > maxChars) break;
|
|
6034
|
-
hits.push(hit);
|
|
6035
|
-
lines.push(line);
|
|
6036
|
-
length = next;
|
|
6037
|
-
}
|
|
6038
|
-
return Object.freeze({
|
|
6039
|
-
question: question.trim(),
|
|
6040
|
-
retrieverId: KNOWLEDGE_SEARCH_RETRIEVER_ID,
|
|
6041
|
-
retrieverConfigDigest: canonicalCandidateDigest({
|
|
6006
|
+
const lexicalIndex = buildKnowledgeLexicalIndex(pages);
|
|
6007
|
+
return (question, options = {}) => {
|
|
6008
|
+
if (typeof question !== "string" || question.trim().length === 0) throw new TypeError("knowledge brief question must be a non-empty string");
|
|
6009
|
+
const limit = options.limit ?? 5;
|
|
6010
|
+
const excludeInvalidated = options.excludeInvalidated ?? true;
|
|
6011
|
+
const maxChars = options.maxChars;
|
|
6012
|
+
if (maxChars !== void 0 && (!Number.isInteger(maxChars) || maxChars < 0)) throw new Error(`knowledge brief maxChars must be a non-negative integer, got ${maxChars}`);
|
|
6013
|
+
const ranked = searchKnowledgePages(pages, question, {
|
|
6014
|
+
lexicalIndex,
|
|
6042
6015
|
limit,
|
|
6043
6016
|
excludeInvalidated,
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6017
|
+
...options.tags === void 0 ? {} : { tags: options.tags },
|
|
6018
|
+
...options.kinds === void 0 ? {} : { kinds: options.kinds }
|
|
6019
|
+
}).map((hit) => {
|
|
6020
|
+
const entry = originals.get(hit.page);
|
|
6021
|
+
const candidates = byId.get(entry.page.id);
|
|
6022
|
+
const reference = {
|
|
6023
|
+
pageId: entry.page.id,
|
|
6024
|
+
...candidates.length === 1 && formatKnowledgeCitationReference({ pageId: entry.page.id }) === entry.page.id ? {} : { origin: entry.origin }
|
|
6025
|
+
};
|
|
6026
|
+
assertKnowledgeCitationsResolved(candidates, [reference]);
|
|
6027
|
+
return {
|
|
6028
|
+
...hit,
|
|
6029
|
+
page: entry.page,
|
|
6030
|
+
origin: entry.origin,
|
|
6031
|
+
citationId: formatKnowledgeCitationReference(reference)
|
|
6032
|
+
};
|
|
6033
|
+
});
|
|
6034
|
+
const hits = [];
|
|
6035
|
+
const lines = [];
|
|
6036
|
+
let length = 0;
|
|
6037
|
+
for (const hit of ranked) {
|
|
6038
|
+
const line = briefLine(hit);
|
|
6039
|
+
const next = length === 0 ? line.length : length + 1 + line.length;
|
|
6040
|
+
if (maxChars !== void 0 && next > maxChars) break;
|
|
6041
|
+
hits.push(hit);
|
|
6042
|
+
lines.push(line);
|
|
6043
|
+
length = next;
|
|
6044
|
+
}
|
|
6045
|
+
return Object.freeze({
|
|
6046
|
+
question: question.trim(),
|
|
6047
|
+
retrieverId: KNOWLEDGE_SEARCH_RETRIEVER_ID,
|
|
6048
|
+
retrieverConfigDigest: canonicalCandidateDigest({
|
|
6049
|
+
limit,
|
|
6050
|
+
excludeInvalidated,
|
|
6051
|
+
tags: options.tags === void 0 ? null : [...options.tags],
|
|
6052
|
+
kinds: options.kinds === void 0 ? null : [...options.kinds],
|
|
6053
|
+
maxChars: maxChars ?? null
|
|
6054
|
+
}),
|
|
6055
|
+
hits: Object.freeze(hits),
|
|
6056
|
+
citationIds: Object.freeze(hits.map((hit) => hit.citationId)),
|
|
6057
|
+
results: Object.freeze(hits.map((hit) => Object.freeze(hit))),
|
|
6058
|
+
text: lines.join("\n")
|
|
6059
|
+
});
|
|
6060
|
+
};
|
|
6053
6061
|
}
|
|
6054
6062
|
function briefLine(hit) {
|
|
6055
6063
|
const snippet = hit.snippet.replace(/\s+/g, " ").trim();
|
|
@@ -6515,6 +6523,20 @@ function isoTimestamp(value, label) {
|
|
|
6515
6523
|
* Every search mints a retrieval receipt. Configured receipt capture also
|
|
6516
6524
|
* persists the exact visibility snapshot before delivering the receipt.
|
|
6517
6525
|
*/
|
|
6526
|
+
const preparedViews = /* @__PURE__ */ new WeakMap();
|
|
6527
|
+
function prepareView(chain) {
|
|
6528
|
+
const reusable = isKnowledgeToolChain(chain);
|
|
6529
|
+
const previous = reusable ? preparedViews.get(chain) : void 0;
|
|
6530
|
+
if (previous) return previous;
|
|
6531
|
+
const visibility = createKnowledgeVisibilitySnapshot(chain);
|
|
6532
|
+
const prepared = {
|
|
6533
|
+
brief: prepareKnowledgeBrief(chain),
|
|
6534
|
+
visibility,
|
|
6535
|
+
bytes: encodeKnowledgeVisibilitySnapshot(visibility)
|
|
6536
|
+
};
|
|
6537
|
+
if (reusable) preparedViews.set(chain, prepared);
|
|
6538
|
+
return prepared;
|
|
6539
|
+
}
|
|
6518
6540
|
const searchInput = z.object({
|
|
6519
6541
|
question: z.string().min(1),
|
|
6520
6542
|
limit: z.int().min(1).max(50).optional(),
|
|
@@ -6541,16 +6563,16 @@ function createKnowledgeTools(options) {
|
|
|
6541
6563
|
const pagesDirectory = normalizePagesDirectory(options.pagesDirectory);
|
|
6542
6564
|
return [
|
|
6543
6565
|
tool("knowledge_search", "Search visible knowledge with unambiguous citation handles. Optionally include refuted history or filter tags and kinds.", searchInput, async (input) => {
|
|
6544
|
-
const
|
|
6545
|
-
const brief =
|
|
6566
|
+
const prepared = prepareView(await loadKnowledgeToolChain(stores, runId));
|
|
6567
|
+
const brief = prepared.brief(input.question, {
|
|
6546
6568
|
...options.brief,
|
|
6547
6569
|
...input.limit === void 0 ? {} : { limit: input.limit },
|
|
6548
6570
|
...input.excludeInvalidated === void 0 ? {} : { excludeInvalidated: input.excludeInvalidated },
|
|
6549
6571
|
...input.tags === void 0 ? {} : { tags: input.tags },
|
|
6550
6572
|
...input.kinds === void 0 ? {} : { kinds: input.kinds }
|
|
6551
6573
|
});
|
|
6552
|
-
const visibility =
|
|
6553
|
-
const visibilityArtifact = options.recordRetrieval ? await persistVisibility(stores.storePath(runId), visibility) : void 0;
|
|
6574
|
+
const visibility = prepared.visibility;
|
|
6575
|
+
const visibilityArtifact = options.recordRetrieval ? await persistVisibility(stores.storePath(runId), visibility, prepared.bytes) : void 0;
|
|
6554
6576
|
const receipt = createKnowledgeRetrievalReceipt({
|
|
6555
6577
|
runId,
|
|
6556
6578
|
...options.actorId === void 0 ? {} : { actorId: options.actorId },
|
|
@@ -6574,7 +6596,7 @@ function createKnowledgeTools(options) {
|
|
|
6574
6596
|
};
|
|
6575
6597
|
}),
|
|
6576
6598
|
tool("knowledge_read", "Read one page by its id, optionally qualified with here::, shared:: or inherited:<runId>::.", readInput, async (input) => {
|
|
6577
|
-
const resolution = resolveKnowledgeCitation(await stores
|
|
6599
|
+
const resolution = resolveKnowledgeCitation(await loadKnowledgeToolChain(stores, runId), parseKnowledgeCitationReference(input.pageId));
|
|
6578
6600
|
return {
|
|
6579
6601
|
status: resolution.status,
|
|
6580
6602
|
page: resolution.resolved === void 0 ? null : {
|
|
@@ -6608,7 +6630,7 @@ function createKnowledgeTools(options) {
|
|
|
6608
6630
|
} }
|
|
6609
6631
|
});
|
|
6610
6632
|
}),
|
|
6611
|
-
tool("knowledge_resolve", "Resolve page ids against everything this run can see, without hiding an ambiguity.", resolveInput, async (input) => ({ resolutions: (await
|
|
6633
|
+
tool("knowledge_resolve", "Resolve page ids against everything this run can see, without hiding an ambiguity.", resolveInput, async (input) => ({ resolutions: resolveKnowledgeCitations(await loadKnowledgeToolChain(stores, runId), input.references.map((reference) => parseKnowledgeCitationReference(reference))).map((resolution) => ({
|
|
6612
6634
|
pageId: resolution.reference.pageId,
|
|
6613
6635
|
...resolution.reference.origin === void 0 ? {} : { origin: resolution.reference.origin },
|
|
6614
6636
|
status: resolution.status,
|
|
@@ -6634,17 +6656,19 @@ function tool(name, description, inputSchema, handler) {
|
|
|
6634
6656
|
};
|
|
6635
6657
|
}
|
|
6636
6658
|
/** Snapshot artifacts are immutable evidence, separate from authoritative KB state. */
|
|
6637
|
-
async function persistVisibility(root, snapshot) {
|
|
6638
|
-
const bytes = encodeKnowledgeVisibilitySnapshot(snapshot);
|
|
6659
|
+
async function persistVisibility(root, snapshot, bytes) {
|
|
6639
6660
|
const path = `.agent-knowledge/retrieval-visibility/${snapshot.snapshotDigest.replace("sha256:", "")}.json`;
|
|
6640
|
-
|
|
6661
|
+
const matches = async () => {
|
|
6641
6662
|
try {
|
|
6642
|
-
|
|
6643
|
-
|
|
6663
|
+
if (!(await readRegularFileWithinRoot(root, path)).bytes.equals(bytes)) throw new Error("stored knowledge visibility artifact does not match its content identity");
|
|
6664
|
+
return true;
|
|
6644
6665
|
} catch (error) {
|
|
6645
6666
|
if (!isMissingFile(error)) throw error;
|
|
6646
|
-
|
|
6667
|
+
return false;
|
|
6647
6668
|
}
|
|
6669
|
+
};
|
|
6670
|
+
if (!await matches()) await withKnowledgeMutation(root, async () => {
|
|
6671
|
+
if (!await matches()) await writeFileDurableWithinRoot(root, path, Buffer.from(bytes));
|
|
6648
6672
|
});
|
|
6649
6673
|
return knowledgeVisibilityArtifactRef({
|
|
6650
6674
|
uri: pathToFileURL(join(root, path)).href,
|
|
@@ -7074,6 +7098,186 @@ function humanize(slug) {
|
|
|
7074
7098
|
return slug.split("-").filter(Boolean).map((w) => w[0]?.toUpperCase() + w.slice(1)).join(" ") || slug;
|
|
7075
7099
|
}
|
|
7076
7100
|
//#endregion
|
|
7101
|
+
//#region src/qmd-search-provider.ts
|
|
7102
|
+
const indexedDocument = z.object({
|
|
7103
|
+
filepath: z.string(),
|
|
7104
|
+
collectionName: z.string(),
|
|
7105
|
+
body: z.string()
|
|
7106
|
+
});
|
|
7107
|
+
const searchResults = z.array(z.object({
|
|
7108
|
+
filepath: z.string(),
|
|
7109
|
+
score: z.number().finite()
|
|
7110
|
+
}));
|
|
7111
|
+
const querySchema = z.object({
|
|
7112
|
+
query: z.string().trim().min(1).max(16e3),
|
|
7113
|
+
limit: z.number().int().min(1).max(50).default(5)
|
|
7114
|
+
}).strict();
|
|
7115
|
+
const readSchema = z.object({
|
|
7116
|
+
sourceId: z.string().min(1),
|
|
7117
|
+
fromLine: z.number().int().min(1).default(1),
|
|
7118
|
+
maxLines: z.number().int().min(1).max(200).default(80)
|
|
7119
|
+
}).strict();
|
|
7120
|
+
/**
|
|
7121
|
+
* A fixed source snapshot, not an authorization decision. The trusted host supplies
|
|
7122
|
+
* one authorized corpus; agents cannot select a collection, bank, or arbitrary path.
|
|
7123
|
+
* QMD's index is derived: its bytes must agree with the authoritative source hash.
|
|
7124
|
+
*/
|
|
7125
|
+
function createQmdSearchProvider(options) {
|
|
7126
|
+
const { client } = options;
|
|
7127
|
+
const scopeId = z.string().trim().min(1).parse(options.scopeId);
|
|
7128
|
+
const revision = z.string().trim().min(1).parse(options.revision);
|
|
7129
|
+
const collection = z.string().regex(/^[a-zA-Z0-9_-]+$/).parse(options.collection);
|
|
7130
|
+
const mode = z.enum(["lexical", "vector"]).parse(options.mode ?? "lexical");
|
|
7131
|
+
const indexedAt = options.indexedAt === void 0 ? null : z.iso.datetime({ offset: true }).parse(options.indexedAt);
|
|
7132
|
+
if (mode === "vector" && !client.searchVector) throw new Error("QMD vector search is unavailable");
|
|
7133
|
+
const byId = /* @__PURE__ */ new Map();
|
|
7134
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
7135
|
+
for (const entry of options.documents) {
|
|
7136
|
+
const source = SourceRecordSchema.parse(structuredClone(entry.source));
|
|
7137
|
+
if (!/^[a-f0-9]{64}$/.test(source.contentHash)) throw new TypeError("QMD sources require an exact SHA-256 contentHash");
|
|
7138
|
+
if (source.text !== void 0 && sha256(source.text) !== source.contentHash) throw new Error("QMD source text does not match its contentHash");
|
|
7139
|
+
const prefix = `qmd://${collection}/`;
|
|
7140
|
+
const path = entry.qmdPath.slice(prefix.length);
|
|
7141
|
+
if (!entry.qmdPath.startsWith(prefix) || !path || path.split("/").some((part) => !part || part === "." || part === ".." || /[\\?#%]/.test(part) || [...part].some((char) => char.charCodeAt(0) < 32))) throw new TypeError("QMD document path must be within the bound collection");
|
|
7142
|
+
if (byId.has(source.id) || byPath.has(entry.qmdPath)) throw new Error("QMD snapshot contains duplicate source ids or paths");
|
|
7143
|
+
const document = {
|
|
7144
|
+
qmdPath: entry.qmdPath,
|
|
7145
|
+
source
|
|
7146
|
+
};
|
|
7147
|
+
byId.set(source.id, document);
|
|
7148
|
+
byPath.set(entry.qmdPath, document);
|
|
7149
|
+
}
|
|
7150
|
+
const snapshotDigest = canonicalCandidateDigest({
|
|
7151
|
+
scopeId,
|
|
7152
|
+
revision,
|
|
7153
|
+
collection,
|
|
7154
|
+
documents: [...byPath.values()].map(({ qmdPath, source }) => ({
|
|
7155
|
+
qmdPath,
|
|
7156
|
+
id: source.id,
|
|
7157
|
+
uri: source.uri,
|
|
7158
|
+
contentHash: source.contentHash
|
|
7159
|
+
})).sort((a, b) => a.qmdPath < b.qmdPath ? -1 : a.qmdPath > b.qmdPath ? 1 : 0)
|
|
7160
|
+
});
|
|
7161
|
+
const identity = Object.freeze({
|
|
7162
|
+
scopeId,
|
|
7163
|
+
revision,
|
|
7164
|
+
snapshotDigest,
|
|
7165
|
+
indexedAt,
|
|
7166
|
+
mode,
|
|
7167
|
+
documentCount: byId.size
|
|
7168
|
+
});
|
|
7169
|
+
const verifiedRead = async (document) => {
|
|
7170
|
+
const parsed = indexedDocument.safeParse(await client.get(document.qmdPath, { includeBody: true }));
|
|
7171
|
+
if (!parsed.success) throw new Error("QMD snapshot document is unavailable or malformed; rebuild the scoped index");
|
|
7172
|
+
const indexed = parsed.data;
|
|
7173
|
+
if (indexed.filepath !== document.qmdPath || indexed.collectionName !== collection) throw new Error("QMD returned a document outside the bound snapshot");
|
|
7174
|
+
if (sha256(indexed.body) !== document.source.contentHash) throw new Error("QMD index is stale for this source revision; rebuild the scoped index");
|
|
7175
|
+
return {
|
|
7176
|
+
qmdPath: document.qmdPath,
|
|
7177
|
+
source: {
|
|
7178
|
+
...structuredClone(document.source),
|
|
7179
|
+
text: indexed.body
|
|
7180
|
+
}
|
|
7181
|
+
};
|
|
7182
|
+
};
|
|
7183
|
+
return {
|
|
7184
|
+
...identity,
|
|
7185
|
+
/** Call once at admission; ordinary reads still verify their returned bytes. */
|
|
7186
|
+
async verifySnapshot() {
|
|
7187
|
+
for (const document of byPath.values()) await verifiedRead(document);
|
|
7188
|
+
return {
|
|
7189
|
+
...identity,
|
|
7190
|
+
verifiedDocumentCount: byPath.size,
|
|
7191
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7192
|
+
};
|
|
7193
|
+
},
|
|
7194
|
+
async search(query, searchOptions = {}) {
|
|
7195
|
+
const request = querySchema.parse({
|
|
7196
|
+
query,
|
|
7197
|
+
...searchOptions
|
|
7198
|
+
});
|
|
7199
|
+
const search = mode === "vector" ? client.searchVector : client.searchLex;
|
|
7200
|
+
const results = searchResults.parse(await search.call(client, request.query, {
|
|
7201
|
+
collection,
|
|
7202
|
+
limit: request.limit
|
|
7203
|
+
}));
|
|
7204
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7205
|
+
for (const hit of results) {
|
|
7206
|
+
if (!byPath.has(hit.filepath)) throw new Error("QMD returned a search result outside the bound snapshot");
|
|
7207
|
+
if (seen.has(hit.filepath)) throw new Error("QMD returned duplicate search results");
|
|
7208
|
+
seen.add(hit.filepath);
|
|
7209
|
+
}
|
|
7210
|
+
const hits = await Promise.all(results.slice(0, request.limit).map(async (hit) => ({
|
|
7211
|
+
...await verifiedRead(byPath.get(hit.filepath)),
|
|
7212
|
+
score: hit.score
|
|
7213
|
+
})));
|
|
7214
|
+
return {
|
|
7215
|
+
...identity,
|
|
7216
|
+
hits
|
|
7217
|
+
};
|
|
7218
|
+
},
|
|
7219
|
+
async read(sourceId) {
|
|
7220
|
+
const document = byId.get(sourceId);
|
|
7221
|
+
if (!document) throw new Error("Source is not in the bound QMD snapshot");
|
|
7222
|
+
return {
|
|
7223
|
+
...identity,
|
|
7224
|
+
document: await verifiedRead(document)
|
|
7225
|
+
};
|
|
7226
|
+
}
|
|
7227
|
+
};
|
|
7228
|
+
}
|
|
7229
|
+
/** Same source-checked functions used by a human reader and exact-profile tool grants. */
|
|
7230
|
+
function createQmdKnowledgeTools(options) {
|
|
7231
|
+
const prefix = options.namePrefix ?? "";
|
|
7232
|
+
if (!/^[a-zA-Z0-9_]*$/.test(prefix)) throw new TypeError("Invalid QMD tool name prefix");
|
|
7233
|
+
return [{
|
|
7234
|
+
name: `${prefix}qmd_search`,
|
|
7235
|
+
description: "Search this bound source snapshot. Results carry original source ids, URIs and hashes; use qmd_read for full source lines.",
|
|
7236
|
+
inputSchema: querySchema,
|
|
7237
|
+
inputSchemaJson: z.toJSONSchema(querySchema),
|
|
7238
|
+
async handler(input) {
|
|
7239
|
+
const request = querySchema.parse(input);
|
|
7240
|
+
const result = await options.provider.search(request.query, { limit: request.limit });
|
|
7241
|
+
return {
|
|
7242
|
+
...result,
|
|
7243
|
+
hits: result.hits.map(({ source, ...hit }) => {
|
|
7244
|
+
const { text, ...reference } = source;
|
|
7245
|
+
return {
|
|
7246
|
+
...hit,
|
|
7247
|
+
source: reference,
|
|
7248
|
+
excerpt: text?.slice(0, 2e3),
|
|
7249
|
+
excerptTruncated: (text?.length ?? 0) > 2e3
|
|
7250
|
+
};
|
|
7251
|
+
})
|
|
7252
|
+
};
|
|
7253
|
+
}
|
|
7254
|
+
}, {
|
|
7255
|
+
name: `${prefix}qmd_read`,
|
|
7256
|
+
description: "Read exact source lines by a source id returned from this snapshot. Other play sources are unavailable.",
|
|
7257
|
+
inputSchema: readSchema,
|
|
7258
|
+
inputSchemaJson: z.toJSONSchema(readSchema),
|
|
7259
|
+
async handler(input) {
|
|
7260
|
+
const request = readSchema.parse(input);
|
|
7261
|
+
const result = await options.provider.read(request.sourceId);
|
|
7262
|
+
const { text = "", ...source } = result.document.source;
|
|
7263
|
+
const lines = text.split("\n");
|
|
7264
|
+
const selected = lines.slice(request.fromLine - 1, request.fromLine - 1 + request.maxLines);
|
|
7265
|
+
const rendered = selected.map((line, index) => `${request.fromLine + index}: ${line}`).join("\n");
|
|
7266
|
+
return {
|
|
7267
|
+
...result,
|
|
7268
|
+
document: {
|
|
7269
|
+
...result.document,
|
|
7270
|
+
source,
|
|
7271
|
+
text: rendered.slice(0, 32e3),
|
|
7272
|
+
fromLine: request.fromLine,
|
|
7273
|
+
totalLines: lines.length,
|
|
7274
|
+
truncated: rendered.length > 32e3 || request.fromLine - 1 + selected.length < lines.length
|
|
7275
|
+
}
|
|
7276
|
+
};
|
|
7277
|
+
}
|
|
7278
|
+
}];
|
|
7279
|
+
}
|
|
7280
|
+
//#endregion
|
|
7077
7281
|
//#region src/readiness-check.ts
|
|
7078
7282
|
async function evaluateKnowledgeBaseReadiness(options) {
|
|
7079
7283
|
const index = await buildKnowledgeIndex(options.root);
|
|
@@ -8041,6 +8245,6 @@ function buildSteerText(gaps, deepQuestions, invalidationTargets, minIndependent
|
|
|
8041
8245
|
return lines.join("\n");
|
|
8042
8246
|
}
|
|
8043
8247
|
//#endregion
|
|
8044
|
-
export { AgentMemoryHitSchema, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScopeSchema, AgentMemoryWriteInputSchema, CHECKABLE_RUNG_THRESHOLD, CITES_INVALIDATED_FIELD, ClaimLedgerGoalConflictError, ClaimLedgerMigrationRequiredError, DEADLINE_EXIT_CODE, DEFAULT_KNOWLEDGE_BRIEF_LIMIT, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DEFAULT_PAGES_DIRECTORY, DeepQuestionSchema, FileSystemKbStore, FileSystemSearchProvider, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, KB_CLAIM_LEDGER_DIR, KB_EVENTS_PATH, KB_INDEX_PATH, KB_STORE_DIR, KNOWLEDGE_EVENT_TYPES, KNOWLEDGE_PROMOTIONS_DIRECTORY, KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM, KNOWLEDGE_PROMOTION_SCHEMA_VERSION, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM, KNOWLEDGE_SEARCH_RETRIEVER_ID, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION, KnowledgeBaseCandidateSchema, KnowledgeCitationAuditError, KnowledgeCitationResolutionError, KnowledgeDuplicateIntakeError, KnowledgeEventSchema, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, KnowledgeImprovementCandidateRefSchema, KnowledgeImprovementEvidenceSchema, KnowledgeImprovementRunStateSchema, KnowledgeIndexSchema, KnowledgePageInvalidationSchema, KnowledgePageSchema, KnowledgePromotionError, KnowledgeProposalParseError, KnowledgeRelationGraphError, KnowledgeRelationGraphSchema, KnowledgeRelationNodeSchema, KnowledgeRelationSchema, KnowledgeVisibilityUnavailableError, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, MemoryKbStore, POLITE_USER_AGENT, READINESS_SPEC_DEFAULTS, RUN_LINEAGE_BASENAME, ResearchClaimEvidenceSchema, ResearchClaimLedgerSchema, ResearchClaimRecordSchema, ResearchSourceVersionSchema, RouterError, SCAFFOLD_PAGE_BASENAMES, SourceAnchorSchema, SourceRecordSchema, UncheckableClaimError, WIKILINK_REGEX, __resetHttpThrottle, acquireAgentMemoryRunLease, addSourcePath, addSourceText, agentMemorySequenceJudge, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, assertClaimLedgerId, assertCurrentRunCitationsResolved, assertDeepQuestionIntegrity, assertGradeableEvidence, assertKnowledgeCitationAudit, assertKnowledgeCitationsResolved, assertKnowledgeRetrievalMatchesVisibility, assertKnowledgeRetrievalMatchesVisibilityArtifact, assertKnowledgeWriteIntake, assertResearchClaimEvidenceIntegrity, assertResearchClaimLedgerIntegrity, assertRunScopedCitationsResolved, assertTrackedClaimIntegrity, auditCurrentRunCitations, auditKnowledgeCitations, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildEvalKnowledgeBundle, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildKnowledgeBrief, buildKnowledgeGraph, buildKnowledgeIndex, buildKnowledgeLexicalIndex, buildKnowledgeRelationGraph, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, calibrateRagAnswerJudge, canonicalPathsEqual, canonicalRelativeWithinRoot, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, claimCheckKey, claimEvidenceId, claimId, claimSourceHost, compareAgentMemoryLearning, contentKey, createAdaptiveResearchDriver, createAgentMemoryBranch, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createCornellLiiSource, createD1FreshnessStoreStub, createFileRunLineageAuthority, createFileSystemFreshnessStore, createFileSystemSearchProvider, createGraphitiMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createKnowledgeRetrievalDisposition, createKnowledgeRetrievalReceipt, createKnowledgeTools, createKnowledgeUseReceipt, createKnowledgeVisibilitySnapshot, createLocalDiscoveryDispatcher, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPersistentResearchDrivingDriver, createRagAnswerQualityHook, createResearchDrivingDriver, createRunScopedStores, createStateSosSource, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, decodeKnowledgeVisibilitySnapshot, deepQuestionId, defaultGetMemoryContext, defineReadinessSpec, detectChanges, detectNearDuplicatePages, deterministicRng, diagnoseRagAnswerFailure, emitRetrievalHoldoutBypass, emptyClaimLedger, encodeKnowledgeVisibilitySnapshot, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractLinks, extractWikilinks, firstMatch, forkAgentMemoryBranchSnapshot, formatFrontmatter, formatKnowledgeCitationReference, formatKnowledgeInvalidationProposal, fromAgentCandidateKnowledgeRef, gradeClaims, gradeCompanyAgainstText, gradeFactAgainstText, gradeFor, graphitiMemoryAdapterIdentity, groundClaimInText, hashKnowledgeBase, htmlToText, improveKnowledgeBase, improveSelectedKnowledgeCandidate, initKnowledgeBase, innerHtmlById, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isKernelAnchoredPath, isKnowledgeMemoryBenchmarkCase, isKnowledgeMutationHeld, isKnowledgePagePath, isMissingFile, isReachable, isSafeKnowledgePath, isScaffoldPath, jsonCandidateCodec, jsonObjectCandidateCodec, kbIndexToText, knowledgeBenchmarkJudge, knowledgeCitationAuditFindings, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgePageDigest, knowledgePageFromMarkdown, knowledgePageRelations, knowledgeReleaseReport, knowledgeVisibilityArtifactRef, layoutFor, lensDistribution, linkClaimContradictions, lintCurrentRunCitations, lintKnowledgeIndex, listRegularFilesWithinRoot, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadKnowledgePromotionRecord, loadSourceRegistry, looksLikeBlockPage, materialFactsSurfaced, materialFactsSurfacedInText, materializeRegisteredClaimEvidence, mediaTypeFor, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, mergeClaimLedgers, mergeTrackedClaims, neighbors, normalizeClaimText, normalizeExternalRagScores, normalizeKnowledgeStateScope, normalizeLinkTarget, normalizePageText, normalizePagesDirectory, optimizeKnowledgeBasePolicy, originatedPages, parseFrontmatter, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, parseKnowledgeCitationReference, parseKnowledgeWriteBlocks, partitionRetrievalScenarios, planInvalidationPropagation, politeFetch, promoteKnowledgeCandidate, promoteRunScopedPages, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, readRegularFileNoFollow, readRegularFileWithinRoot, reciprocalRankFusion, recoverPendingKnowledgeMutation, relativeWithinRoot, removeDurable, renameDurable, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, researchSourceVersionKey, resetRetrievalHoldoutRegistry, resolveKnowledgeCitation, resolveKnowledgeCitations, resolveMemoryCleanupTimeoutMs, resolveRunScopedCitation, resolveRunScopedCitations, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, restoreKnowledgeCandidateBaseline, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runAgentMemoryLearningExperiment, runBoundedMemoryLifecycle, runDiscoveryLoop, runInKnowledgeMutationScope, runInvestmentThesisTask, runKnowledgeBenchmarkSuite, runKnowledgeResearchLoop, runMemoryAdapterBenchmark, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runSerializedKnowledgeOptimization, runVerifiedResearchLoop, scenarioContentFingerprint, scoreBm25, scoreKnowledgeBaseIndex, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRagAnswerArtifact, scoreRetrievalArtifact, searchKnowledge, searchKnowledgePages, sha256, sleepForMemoryRecovery, slugify, snapshotSourceTextInput, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, summarizeKnowledgeBenchmarkCampaign, syncDirectory, textSourceAdapter, textSourceId, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toOffPolicyTrajectory, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, tokenizeText, totalMaterialFacts, triageSource, validateKnowledgeIndex, verdictFor, verifyGradeableEvidence, verifyKnowledgeRetrievalDisposition, verifyKnowledgeRetrievalReceipt, verifyKnowledgeUseReceipt, verifyKnowledgeVisibilitySnapshot, walk, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, withKnowledgeMutation, withKnowledgeRead, withSafeDescendant, withSafeDirectory, writeFileDurable, writeFileDurableWithinRoot, writeJson, writeJsonDurable, writeJsonDurableWithinRoot, writeKnowledgeIndex, writeSourceRegistry };
|
|
8248
|
+
export { AgentMemoryHitSchema, AgentMemoryKindSchema, AgentMemoryLifecycleTimeoutError, AgentMemoryLifecycleUnsafeError, AgentMemoryScopeSchema, AgentMemoryWriteInputSchema, CHECKABLE_RUNG_THRESHOLD, CITES_INVALIDATED_FIELD, ClaimLedgerGoalConflictError, ClaimLedgerMigrationRequiredError, DEADLINE_EXIT_CODE, DEFAULT_KNOWLEDGE_BRIEF_LIMIT, DEFAULT_MEMORY_CLEANUP_TIMEOUT_MS, DEFAULT_PAGES_DIRECTORY, DeepQuestionSchema, FileSystemKbStore, FileSystemSearchProvider, HindsightOperationUnknownError, INDUSTRY_MEMORY_BENCHMARKS, INDUSTRY_RAG_BENCHMARKS, IRS_DIMENSION_HINTS, KB_CLAIM_LEDGER_DIR, KB_EVENTS_PATH, KB_INDEX_PATH, KB_STORE_DIR, KNOWLEDGE_EVENT_TYPES, KNOWLEDGE_PROMOTIONS_DIRECTORY, KNOWLEDGE_PROMOTION_DIGEST_ALGORITHM, KNOWLEDGE_PROMOTION_SCHEMA_VERSION, KNOWLEDGE_RECEIPT_DIGEST_ALGORITHM, KNOWLEDGE_SEARCH_RETRIEVER_ID, KNOWLEDGE_USE_RECEIPT_SCHEMA_VERSION, KnowledgeBaseCandidateSchema, KnowledgeCitationAuditError, KnowledgeCitationResolutionError, KnowledgeDuplicateIntakeError, KnowledgeEventSchema, KnowledgeGraphEdgeSchema, KnowledgeGraphNodeSchema, KnowledgeImprovementCandidateRefSchema, KnowledgeImprovementEvidenceSchema, KnowledgeImprovementRunStateSchema, KnowledgeIndexSchema, KnowledgePageInvalidationSchema, KnowledgePageSchema, KnowledgePromotionError, KnowledgeProposalParseError, KnowledgeRelationGraphError, KnowledgeRelationGraphSchema, KnowledgeRelationNodeSchema, KnowledgeRelationSchema, KnowledgeVisibilityUnavailableError, MAX_RESPONSE_BYTES, MIN_REQUEST_GAP_MS, MemoryKbStore, POLITE_USER_AGENT, READINESS_SPEC_DEFAULTS, RUN_LINEAGE_BASENAME, ResearchClaimEvidenceSchema, ResearchClaimLedgerSchema, ResearchClaimRecordSchema, ResearchSourceVersionSchema, RouterError, SCAFFOLD_PAGE_BASENAMES, SourceAnchorSchema, SourceRecordSchema, UncheckableClaimError, WIKILINK_REGEX, __resetHttpThrottle, acquireAgentMemoryRunLease, addSourcePath, addSourceText, agentMemorySequenceJudge, applyKnowledgeWriteBlocks, applyKnowledgeWriteBlocksFile, applyRetrievalHoldout, applySessionStickyRetrievalHoldout, assertClaimLedgerId, assertCurrentRunCitationsResolved, assertDeepQuestionIntegrity, assertGradeableEvidence, assertKnowledgeCitationAudit, assertKnowledgeCitationsResolved, assertKnowledgeRetrievalMatchesVisibility, assertKnowledgeRetrievalMatchesVisibilityArtifact, assertKnowledgeWriteIntake, assertResearchClaimEvidenceIntegrity, assertResearchClaimLedgerIntegrity, assertRunScopedCitationsResolved, assertTrackedClaimIntegrity, auditCurrentRunCitations, auditKnowledgeCitations, buildAgentMemorySequenceScenarios, buildAgentMemorySequencesFromBenchmarkCases, buildEvalKnowledgeBundle, buildFirstPartyMemoryLifecycleBenchmarkCases, buildIndustryMemoryBenchmarkSmokeCases, buildIndustryRagBenchmarkSmokeCases, buildKnowledgeBenchmarkScenarios, buildKnowledgeBrief, buildKnowledgeGraph, buildKnowledgeIndex, buildKnowledgeLexicalIndex, buildKnowledgeRelationGraph, buildRetrievalBenchmarkCasesFromQrels, buildRetrievalEvalDispatch, calibrateRagAnswerJudge, canonicalPathsEqual, canonicalRelativeWithinRoot, canonicalizeUrl, chunkMarkdown, citedClaimKey, citedClaimOf, claimCheckKey, claimEvidenceId, claimId, claimSourceHost, compareAgentMemoryLearning, contentKey, createAdaptiveResearchDriver, createAgentMemoryBranch, createClaimDecorator, createClaimGroundingVerifier, createCollectionResearchDriver, createCornellLiiSource, createD1FreshnessStoreStub, createFileRunLineageAuthority, createFileSystemFreshnessStore, createFileSystemSearchProvider, createGraphitiMemoryAdapter, createHindsightMemoryAdapter, createInMemoryBenchmarkAdapter, createIrsPublicationsSource, createKnowledgeControlLoopAdapter, createKnowledgeEvent, createKnowledgeRetrievalDisposition, createKnowledgeRetrievalReceipt, createKnowledgeTools, createKnowledgeUseReceipt, createKnowledgeVisibilitySnapshot, createLocalDiscoveryDispatcher, createMem0MemoryAdapter, createMemoryExecutionPool, createNeo4jAgentMemoryAdapter, createNoopMemoryBenchmarkAdapter, createPersistentResearchDrivingDriver, createPlayMemoryTools, createQmdKnowledgeTools, createQmdSearchProvider, createRagAnswerQualityHook, createResearchDrivingDriver, createRunScopedStores, createStateSosSource, createTangleRouterClient, createVerifyingResearchDriver, createWebResearchWorker, decodeKnowledgeVisibilitySnapshot, deepQuestionId, defaultGetMemoryContext, defineReadinessSpec, detectChanges, detectNearDuplicatePages, deterministicRng, diagnoseRagAnswerFailure, emitRetrievalHoldoutBypass, emptyClaimLedger, encodeKnowledgeVisibilitySnapshot, evaluateKnowledgeBaseReadiness, explainKnowledgeTarget, extractLinks, extractWikilinks, firstMatch, forkAgentMemoryBranchSnapshot, formatFrontmatter, formatKnowledgeCitationReference, formatKnowledgeInvalidationProposal, fromAgentCandidateKnowledgeRef, gradeClaims, gradeCompanyAgainstText, gradeFactAgainstText, gradeFor, graphitiMemoryAdapterIdentity, groundClaimInText, hashKnowledgeBase, hindsightMemoryBankId, htmlToText, improveKnowledgeBase, improveSelectedKnowledgeCandidate, initKnowledgeBase, innerHtmlById, inspectKnowledgeIndex, inspectPendingKnowledgeMutation, investmentThesisSet, isKernelAnchoredPath, isKnowledgeMemoryBenchmarkCase, isKnowledgeMutationHeld, isKnowledgePagePath, isMissingFile, isReachable, isSafeKnowledgePath, isScaffoldPath, jsonCandidateCodec, jsonObjectCandidateCodec, kbIndexToText, knowledgeBenchmarkJudge, knowledgeCitationAuditFindings, knowledgeImprovementCandidateRef, knowledgeImprovementRunDir, knowledgeImprovementRunId, knowledgePageDigest, knowledgePageFromMarkdown, knowledgePageRelations, knowledgeReleaseReport, knowledgeVisibilityArtifactRef, layoutFor, lensDistribution, linkClaimContradictions, lintCurrentRunCitations, lintKnowledgeIndex, listRegularFilesWithinRoot, loadKnowledgeImprovementActivationResult, loadKnowledgeImprovementEvents, loadKnowledgeImprovementState, loadKnowledgePages, loadKnowledgePromotionRecord, loadSourceRegistry, looksLikeBlockPage, materialFactsSurfaced, materialFactsSurfacedInText, materializeRegisteredClaimEvidence, mediaTypeFor, mem0MemoryAdapterIdentity, memoryHitToSourceRecord, memoryRecoveryDelayMs, memoryWriteResultToSourceRecord, mergeClaimLedgers, mergeTrackedClaims, neighbors, normalizeClaimText, normalizeExternalRagScores, normalizeKnowledgeStateScope, normalizeLinkTarget, normalizePageText, normalizePagesDirectory, optimizeKnowledgeBasePolicy, originatedPages, parseFrontmatter, parseKnowledgeBenchmarkJsonl, parseKnowledgeBenchmarkQrels, parseKnowledgeCitationReference, parseKnowledgeWriteBlocks, partitionRetrievalScenarios, planInvalidationPropagation, politeFetch, promoteKnowledgeCandidate, promoteRunScopedPages, proposeFromFinding, proposeFromFindings, ragAnswerQualityJudge, readRegularFileNoFollow, readRegularFileWithinRoot, reciprocalRankFusion, recoverPendingKnowledgeMutation, relativeWithinRoot, removeDurable, renameDurable, renderKnowledgeBenchmarkReportMarkdown, renderMemoryContext, researchSourceVersionKey, resetRetrievalHoldoutRegistry, resolveKnowledgeCitation, resolveKnowledgeCitations, resolveMemoryCleanupTimeoutMs, resolveRunScopedCitation, resolveRunScopedCitations, respondToIndustryMemoryBenchmarkSmokeCase, respondToIndustryRagBenchmarkSmokeCase, restoreKnowledgeCandidateBaseline, retrievalConfigFromSurface, retrievalConfigSurface, retrievalHoldoutConfigHash, retrievalRecallJudge, runAgentMemoryExperiment, runAgentMemoryImprovement, runAgentMemoryLearningExperiment, runBoundedMemoryLifecycle, runDiscoveryLoop, runInKnowledgeMutationScope, runInvestmentThesisTask, runKnowledgeBenchmarkSuite, runKnowledgeResearchLoop, runMemoryAdapterBenchmark, runRagKnowledgeImprovementLoop, runRagOptimization, runRetrievalImprovementLoop, runSerializedKnowledgeOptimization, runVerifiedResearchLoop, scenarioContentFingerprint, scoreBm25, scoreKnowledgeBaseIndex, scoreKnowledgeBenchmarkArtifact, scoreMemoryBenchmarkArtifact, scoreRagAnswerArtifact, scoreRetrievalArtifact, searchKnowledge, searchKnowledgePages, sha256, sleepForMemoryRecovery, slugify, snapshotSourceTextInput, sourceMatchesGaps, sourceRegistryPath, stableId, stripFrontmatter, summarizeKnowledgeBenchmarkCampaign, syncDirectory, textSourceAdapter, textSourceId, thesisReadinessSpecs, toAgentCandidateKnowledgeRef, toDeepEvalTestCases, toOffPolicyTrajectory, toRagCheckerRecords, toRagasEvaluationRows, toTruLensRecords, tokenizeQuery, tokenizeText, totalMaterialFacts, triageSource, validateKnowledgeIndex, verdictFor, verifyGradeableEvidence, verifyKnowledgeRetrievalDisposition, verifyKnowledgeRetrievalReceipt, verifyKnowledgeUseReceipt, verifyKnowledgeVisibilitySnapshot, walk, withCitedClaim, withKnowledgeImprovementCandidate, withKnowledgeImprovementComparison, withKnowledgeMutation, withKnowledgeRead, withSafeDescendant, withSafeDirectory, writeFileDurable, writeFileDurableWithinRoot, writeJson, writeJsonDurable, writeJsonDurableWithinRoot, writeKnowledgeIndex, writeSourceRegistry };
|
|
8045
8249
|
|
|
8046
8250
|
//# sourceMappingURL=index.js.map
|