@tangle-network/agent-knowledge 6.2.0 → 7.0.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 +13 -0
- package/README.md +1 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-CmW6iORW.js → benchmarks-C8L7HJb4.js} +2 -2
- package/dist/{benchmarks-CmW6iORW.js.map → benchmarks-C8L7HJb4.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{ids-DRqPZ42_.js → ids-Bevz_pXV.js} +6 -2
- package/dist/ids-Bevz_pXV.js.map +1 -0
- package/dist/{index-3z3lFJnE.d.ts → index-D0wc4GYg.d.ts} +2 -2
- package/dist/{index-3z3lFJnE.d.ts.map → index-D0wc4GYg.d.ts.map} +1 -1
- package/dist/{index-DHebFLgU.d.ts → index-Dwp3Mx-w.d.ts} +3 -3
- package/dist/{index-DHebFLgU.d.ts.map → index-Dwp3Mx-w.d.ts.map} +1 -1
- package/dist/index.d.ts +42 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -35
- package/dist/index.js.map +1 -1
- package/dist/{inspect-LUMkas6A.js → inspect-CJQGYuKa.js} +156 -33
- package/dist/inspect-CJQGYuKa.js.map +1 -0
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{memory-C6KPRhoU.js → memory-CIYRB_Q8.js} +3 -3
- package/dist/{memory-C6KPRhoU.js.map → memory-CIYRB_Q8.js.map} +1 -1
- package/dist/sources/index.js +1 -1
- package/dist/{types-Cd57BPRt.d.ts → types-BOfmvDe-.d.ts} +21 -6
- package/dist/{types-Cd57BPRt.d.ts.map → types-BOfmvDe-.d.ts.map} +1 -1
- package/dist/viz/index.d.ts +1 -1
- package/docs/architecture.md +4 -2
- package/package.json +1 -1
- package/dist/ids-DRqPZ42_.js.map +0 -1
- package/dist/inspect-LUMkas6A.js.map +0 -1
package/dist/sources/index.js
CHANGED
|
@@ -227,21 +227,34 @@ interface ResearchClaimRecord {
|
|
|
227
227
|
contested: boolean;
|
|
228
228
|
firstSeenRound: number;
|
|
229
229
|
}
|
|
230
|
+
/** Immutable identity of one exact version of an original source URI. */
|
|
231
|
+
interface ResearchSourceVersion {
|
|
232
|
+
/** Canonical source-registry id for this URI and content hash. */
|
|
233
|
+
sourceId: KnowledgeId;
|
|
234
|
+
/** The URI supplied before the source was copied into the raw-source store. */
|
|
235
|
+
uri: string;
|
|
236
|
+
/** SHA-256 of the exact submitted source text. */
|
|
237
|
+
contentHash: string;
|
|
238
|
+
}
|
|
230
239
|
/**
|
|
231
240
|
* One immutable claim extraction observed while a source is being verified.
|
|
232
241
|
*
|
|
233
242
|
* An observation is deliberately separate from `ResearchClaimRecord`: source
|
|
234
243
|
* verification happens before source registration, and a process can die in
|
|
235
244
|
* between. The observation is durable immediately, but it contributes support
|
|
236
|
-
* to a claim only after
|
|
237
|
-
* confirmed `
|
|
245
|
+
* to a claim only after its expected registry id, original URI, and content hash
|
|
246
|
+
* appear together in the ledger's independently confirmed `registeredSources` set.
|
|
238
247
|
*/
|
|
239
248
|
interface ResearchClaimEvidence {
|
|
240
249
|
/** Stable identity of this claim/source/contradiction observation. */
|
|
241
250
|
id: string;
|
|
242
251
|
claimId: string;
|
|
243
252
|
text: string;
|
|
253
|
+
/** Canonical source-registry id expected for this source version. */
|
|
254
|
+
sourceId: KnowledgeId;
|
|
244
255
|
sourceUri: string;
|
|
256
|
+
/** SHA-256 of the exact source text from which this observation was extracted. */
|
|
257
|
+
sourceContentHash: string;
|
|
245
258
|
/** Existing claim this observation directly contradicts, when reported. */
|
|
246
259
|
contradictsClaimId?: string;
|
|
247
260
|
firstSeenRound: number;
|
|
@@ -255,6 +268,8 @@ interface ResearchClaimEvidence {
|
|
|
255
268
|
* overwrite each other, so the store addresses ledgers by this id.
|
|
256
269
|
*/
|
|
257
270
|
interface ResearchClaimLedger {
|
|
271
|
+
/** Persistent contract version; version 2 binds evidence to source content. */
|
|
272
|
+
schemaVersion: 2;
|
|
258
273
|
id: string;
|
|
259
274
|
/** The research goal this ledger accumulated evidence for. */
|
|
260
275
|
goal?: string;
|
|
@@ -272,8 +287,8 @@ interface ResearchClaimLedger {
|
|
|
272
287
|
* not yet been confirmed. Pending observations never count toward claims.
|
|
273
288
|
*/
|
|
274
289
|
claimEvidence: ResearchClaimEvidence[];
|
|
275
|
-
/** Exact
|
|
276
|
-
|
|
290
|
+
/** Exact source-registry identities confirmed after their raw bytes were stored. */
|
|
291
|
+
registeredSources: ResearchSourceVersion[];
|
|
277
292
|
claims: ResearchClaimRecord[];
|
|
278
293
|
questions: DeepQuestion[];
|
|
279
294
|
}
|
|
@@ -287,5 +302,5 @@ interface KnowledgeRelease {
|
|
|
287
302
|
metadata?: Record<string, unknown>;
|
|
288
303
|
}
|
|
289
304
|
//#endregion
|
|
290
|
-
export { ResearchClaimEvidence as C,
|
|
291
|
-
//# sourceMappingURL=types-
|
|
305
|
+
export { TrackedClaim as A, ResearchClaimEvidence as C, SourceAnchor as D, ResearchSourceVersion as E, SourceRecord as O, KnowledgeWriteParseResult as S, ResearchClaimRecord as T, KnowledgeRelation as _, KnowledgeBaseCandidate as a, KnowledgeUnit as b, KnowledgeEventType as c, KnowledgeGraphNode as d, KnowledgeId as f, KnowledgePolicy as g, KnowledgePage as h, KNOWLEDGE_EVENT_TYPES as i, SourceRegistry as k, KnowledgeGraph as l, KnowledgeLintFinding as m, DeepQuestion as n, KnowledgeClaim as o, KnowledgeIndex as p, DeepQuestionKind as r, KnowledgeEvent as s, ClaimRef as t, KnowledgeGraphEdge as u, KnowledgeRelease as v, ResearchClaimLedger as w, KnowledgeWriteBlock as x, KnowledgeSearchResult as y };
|
|
306
|
+
//# sourceMappingURL=types-BOfmvDe-.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BOfmvDe-.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;;UAGI;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA,UAAU;;EAEV;;EAEA;EACA,WAAW;EACX;;UAGe;EACf;EACA,SAAS;;UAGM;EACf;EACA;EACA;;UAGe;EACf,IAAI;EACJ;EACA,MAAM;EACN;EACA;EACA,WAAW;;UAGI;EACf,UAAU;EACV,UAAU;EACV;EACA;EACA,WAAW;;UAGI;EACf,IAAI;EACJ;EACA;EACA,SAAS;EACT,YAAY;EACZ;EACA;EACA,WAAW;EACX;;UAGe;EACf,IAAI;EACJ;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;;UAGe;EACf,IAAI;EACJ;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR,QAAQ;EACR;EACA;;UAGe;EACf,OAAO;EACP,OAAO;;UAGQ;EACf;EACA;EACA,SAAS;EACT,OAAO;EACP,OAAO;;UAGQ;EACf,MAAM;;;;;;;EAON;;EAEA;;;;;;;;EAQA;EACA;EACA;EACA;;UAGe;EACf;EAUA;EACA;EACA;EACA,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA,WAAW;;UAGI;EACf,IAAI;EACJ,OAAO;EACP;EACA;EACA;EACA;EACA,WAAW;;UAGI;EACf;EACA;;UAGe;EACf,QAAQ;EACR;;;;;;;;;;cAWW;KAWD,6BAA6B;UAExB;EACf;EACA,MAAM;EACN;EACA;EACA;EACA,WAAW;;;KAID;;;;;;;;;UAUK;EACf,MAAM;EACN;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf;;EAEA;;EAEA,iBAAiB;;EAEjB;;EAEA,aAAa;;;;;;EAMb;EACA;;;;;;;;;UAUe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;;EAEf,UAAU;;EAEV;;EAEA;;;;;;;;;;;UAYe;;EAEf;EACA;EACA;;EAEA,UAAU;EACV;;EAEA;;EAEA;EACA;;;;;;;;;;UAWe;;EAEf;EACA;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;;;EAKA,eAAe;;EAEf,mBAAmB;EACnB,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA,WAAW"}
|
package/dist/viz/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as KnowledgeGraphNode, l as KnowledgeGraph, u as KnowledgeGraphEdge } from "../types-
|
|
1
|
+
import { d as KnowledgeGraphNode, l as KnowledgeGraph, u as KnowledgeGraphEdge } from "../types-BOfmvDe-.js";
|
|
2
2
|
//#region src/viz/index.d.ts
|
|
3
3
|
interface KnowledgeVizNode extends KnowledgeGraphNode {
|
|
4
4
|
degree: number;
|
package/docs/architecture.md
CHANGED
|
@@ -51,8 +51,10 @@ They reach it through `mergeClaimLedger(id, merge)`, which holds the mutation lo
|
|
|
51
51
|
The combining rule is `mergeClaimLedgers`: support and contradiction edges union, `contested` and `addressed` latch on, `firstSeenRound` moves earlier, and every collection is sorted — so the merge is commutative, associative, and idempotent, and the bytes on disk depend on the evidence rather than on scheduling.
|
|
52
52
|
Ledgers for two different goals refuse to merge (`ClaimLedgerGoalConflictError`) rather than pooling unrelated evidence into one corroboration count.
|
|
53
53
|
The live driver exposes the published Set-based `TrackedClaim`; the ledger stores a separate `ResearchClaimRecord` with sorted arrays so JSON serialization cannot erase those sets.
|
|
54
|
-
Source verification
|
|
55
|
-
|
|
54
|
+
Source verification snapshots the proposal and persists a `ResearchClaimEvidence` observation containing the expected registry id, original URI, and full content hash; that observation cannot affect claim support or completion by itself.
|
|
55
|
+
After the exact submitted bytes are durable, `runVerifiedResearchLoop` passes the resulting `SourceRecord` to `commitSources`.
|
|
56
|
+
The ledger materializes only observations whose complete source identity matches a confirmed record, so reusing one URI for different bytes cannot activate the wrong claims and a crash on either side resumes safely.
|
|
57
|
+
Unversioned URI-only ledgers cannot prove which bytes produced their observations; reads and writes fail with `ClaimLedgerMigrationRequiredError` and preserve the original file for an explicit archive-and-reverify migration.
|
|
56
58
|
Before synchronous question generation, the persistent driver records `preparedRounds`; a resume reconstructs and checkpoints any prepared round whose questions were interrupted, and the loop publishes its `research.iteration` event only after that checkpoint succeeds.
|
|
57
59
|
|
|
58
60
|
Every write in this layer goes through `durable-fs` (`writeFileDurable`, `writeJsonDurableWithinRoot`) — temp file, fsync, atomic rename, fsync parent, through `O_NOFOLLOW` descriptors anchored via `/proc/self/fd` so a directory swapped for a symlink mid-write cannot redirect it outside the root.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-knowledge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Build, search, evaluate, and improve source-backed knowledge bases.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-knowledge#readme",
|
|
6
6
|
"repository": {
|
package/dist/ids-DRqPZ42_.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids-DRqPZ42_.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\n\nexport function sha256(text: string): string {\n return createHash('sha256').update(text).digest('hex')\n}\n\nexport function slugify(input: string): string {\n const out = input\n .trim()\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9\\u4e00-\\u9fff]+/g, '-')\n .replace(/^-+|-+$/g, '')\n return out || 'untitled'\n}\n\nexport function stableId(prefix: string, content: string): string {\n return `${prefix}_${sha256(content).slice(0, 16)}`\n}\n"],"mappings":";;AAEA,SAAgB,OAAO,MAAsB;CAC3C,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK;AACvD;AAEA,SAAgB,QAAQ,OAAuB;CAQ7C,OAPY,MACT,KAAK,CAAC,CACN,YAAY,CAAC,CACb,UAAU,MAAM,CAAC,CACjB,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,4BAA4B,GAAG,CAAC,CACxC,QAAQ,YAAY,EACd,KAAK;AAChB;AAEA,SAAgB,SAAS,QAAgB,SAAyB;CAChE,OAAO,GAAG,OAAO,GAAG,OAAO,OAAO,CAAC,CAAC,MAAM,GAAG,EAAE;AACjD"}
|