@equationalapplications/core-llm-wiki 6.1.0 → 6.3.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 +37 -1
- package/dist/{chunk-YEESP6J2.mjs → chunk-YDTJ2OO4.mjs} +19 -5
- package/dist/chunk-YDTJ2OO4.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +73 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-D0m2V9-E.d.mts → testing-BPwT0171.d.mts} +48 -1
- package/dist/{testing-D0m2V9-E.d.ts → testing-BPwT0171.d.ts} +48 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-YEESP6J2.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-
|
|
2
|
-
export { C as ChunkFailure, D as DegradedRecord, E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HEAL_BATCH_SIZE, i as HEAL_RECHECK_MS, j as HOOK_TIMEOUT_MARKER, k as HealResult, I as IngestDocumentResult, L as LLMProvider, l as ONTOLOGY_BACKFILL_BATCH_SIZE, m as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, n as ONTOLOGY_BACKFILL_RECHECK_MS, o as OntologyBackfillResult, p as OntologyConfig, q as OntologyEdgeType, r as OntologyMode, s as OntologyNodeType, t as OntologyPromptContext, u as OntologyUpdates, P as PromptOverrides, v as PromptService, w as PrunePartialFailureError, V as VectorRanker, x as VectorRankerFallback, y as VectorRankerRankArgs, z as VectorRankerSemanticResult, A as WikiBusyError, B as WikiBusyOperation, J as WikiCheckpoint, K as WikiConfig, N as WikiDuplicateHashError, Q as WikiEdge, T as WikiEvent, U as WikiFact, X as WikiIngestEmptyError, Y as WikiMemoryTestAccess, Z as WikiOutboxEvent, _ as WikiParseError, $ as WikiSourceRefHashCollision, a0 as WikiStrictOntologyViolation, a1 as WikiTask, a2 as WikiTransactionError } from './testing-
|
|
1
|
+
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BPwT0171.mjs';
|
|
2
|
+
export { C as ChunkFailure, D as DegradedRecord, E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HEAL_BATCH_SIZE, i as HEAL_RECHECK_MS, j as HOOK_TIMEOUT_MARKER, k as HealResult, I as IngestDocumentResult, L as LLMProvider, l as ONTOLOGY_BACKFILL_BATCH_SIZE, m as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, n as ONTOLOGY_BACKFILL_RECHECK_MS, o as OntologyBackfillResult, p as OntologyConfig, q as OntologyEdgeType, r as OntologyMode, s as OntologyNodeType, t as OntologyPromptContext, u as OntologyUpdates, P as PromptOverrides, v as PromptService, w as PrunePartialFailureError, V as VectorRanker, x as VectorRankerFallback, y as VectorRankerRankArgs, z as VectorRankerSemanticResult, A as WikiBusyError, B as WikiBusyOperation, J as WikiCheckpoint, K as WikiConfig, N as WikiDuplicateHashError, Q as WikiEdge, T as WikiEvent, U as WikiFact, X as WikiIngestEmptyError, Y as WikiMemoryTestAccess, Z as WikiOutboxEvent, _ as WikiParseError, $ as WikiSourceRefHashCollision, a0 as WikiStrictOntologyViolation, a1 as WikiTask, a2 as WikiTransactionError } from './testing-BPwT0171.mjs';
|
|
3
3
|
import { OkfFile } from '@equationalapplications/core-okf';
|
|
4
4
|
import 'minisearch';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-
|
|
2
|
-
export { C as ChunkFailure, D as DegradedRecord, E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HEAL_BATCH_SIZE, i as HEAL_RECHECK_MS, j as HOOK_TIMEOUT_MARKER, k as HealResult, I as IngestDocumentResult, L as LLMProvider, l as ONTOLOGY_BACKFILL_BATCH_SIZE, m as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, n as ONTOLOGY_BACKFILL_RECHECK_MS, o as OntologyBackfillResult, p as OntologyConfig, q as OntologyEdgeType, r as OntologyMode, s as OntologyNodeType, t as OntologyPromptContext, u as OntologyUpdates, P as PromptOverrides, v as PromptService, w as PrunePartialFailureError, V as VectorRanker, x as VectorRankerFallback, y as VectorRankerRankArgs, z as VectorRankerSemanticResult, A as WikiBusyError, B as WikiBusyOperation, J as WikiCheckpoint, K as WikiConfig, N as WikiDuplicateHashError, Q as WikiEdge, T as WikiEvent, U as WikiFact, X as WikiIngestEmptyError, Y as WikiMemoryTestAccess, Z as WikiOutboxEvent, _ as WikiParseError, $ as WikiSourceRefHashCollision, a0 as WikiStrictOntologyViolation, a1 as WikiTask, a2 as WikiTransactionError } from './testing-
|
|
1
|
+
import { M as MemoryBundle, F as FormatContextOptions, G as GraphNeighborhood, a as MemoryDump, b as FormattedMemoryDump, O as OntologyManifest, R as ReadOptions, S as SQLiteAdapter, W as WikiOptions, c as WikiMemory } from './testing-BPwT0171.js';
|
|
2
|
+
export { C as ChunkFailure, D as DegradedRecord, E as EntityStatus, d as ExtractedFact, e as ExtractedFactEdge, f as ExtractedFactWithOntology, g as ExtractedTask, h as GraphTraversalOptions, H as HEAL_BATCH_SIZE, i as HEAL_RECHECK_MS, j as HOOK_TIMEOUT_MARKER, k as HealResult, I as IngestDocumentResult, L as LLMProvider, l as ONTOLOGY_BACKFILL_BATCH_SIZE, m as ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, n as ONTOLOGY_BACKFILL_RECHECK_MS, o as OntologyBackfillResult, p as OntologyConfig, q as OntologyEdgeType, r as OntologyMode, s as OntologyNodeType, t as OntologyPromptContext, u as OntologyUpdates, P as PromptOverrides, v as PromptService, w as PrunePartialFailureError, V as VectorRanker, x as VectorRankerFallback, y as VectorRankerRankArgs, z as VectorRankerSemanticResult, A as WikiBusyError, B as WikiBusyOperation, J as WikiCheckpoint, K as WikiConfig, N as WikiDuplicateHashError, Q as WikiEdge, T as WikiEvent, U as WikiFact, X as WikiIngestEmptyError, Y as WikiMemoryTestAccess, Z as WikiOutboxEvent, _ as WikiParseError, $ as WikiSourceRefHashCollision, a0 as WikiStrictOntologyViolation, a1 as WikiTask, a2 as WikiTransactionError } from './testing-BPwT0171.js';
|
|
3
3
|
import { OkfFile } from '@equationalapplications/core-okf';
|
|
4
4
|
import 'minisearch';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -2784,15 +2784,29 @@ var MetadataRepository = class extends BaseRepository {
|
|
|
2784
2784
|
manifest
|
|
2785
2785
|
};
|
|
2786
2786
|
}
|
|
2787
|
-
|
|
2787
|
+
/**
|
|
2788
|
+
* Write an entity's manifest.
|
|
2789
|
+
*
|
|
2790
|
+
* `opts.ifAbsent` selects the conflict behaviour:
|
|
2791
|
+
* - omitted / `false` — upsert. An existing row is replaced.
|
|
2792
|
+
* - `true` — create-if-absent. An existing row is left exactly as it is.
|
|
2793
|
+
*
|
|
2794
|
+
* Returns whether this call actually wrote a row. Under `ifAbsent` a `false`
|
|
2795
|
+
* result means another writer got there first; the check and the write are one
|
|
2796
|
+
* statement, so there is no window between them.
|
|
2797
|
+
*/
|
|
2798
|
+
async setManifest(entityId, data, tx, opts) {
|
|
2788
2799
|
validateManifest(data.manifest);
|
|
2789
2800
|
const executor = this.getExecutor(tx);
|
|
2790
|
-
|
|
2801
|
+
const conflictClause = opts?.ifAbsent ? "ON CONFLICT(entity_id) DO NOTHING" : `ON CONFLICT(entity_id) DO UPDATE SET
|
|
2802
|
+
mode = excluded.mode, manifest_json = excluded.manifest_json, updated_at = excluded.updated_at`;
|
|
2803
|
+
const result = await executor.runAsync(
|
|
2791
2804
|
`INSERT INTO ${this.prefix}entity_manifests (entity_id, mode, manifest_json, updated_at)
|
|
2792
2805
|
VALUES (?, ?, ?, ?)
|
|
2793
|
-
|
|
2806
|
+
${conflictClause}`,
|
|
2794
2807
|
[entityId, data.mode, JSON.stringify(data.manifest), Date.now()]
|
|
2795
2808
|
);
|
|
2809
|
+
return result.changes > 0;
|
|
2796
2810
|
}
|
|
2797
2811
|
async mergeManifestUpdates(entityId, updates, tx) {
|
|
2798
2812
|
const current = await this.getManifest(entityId, tx) ?? {
|
|
@@ -7701,13 +7715,64 @@ var WikiMemory = class {
|
|
|
7701
7715
|
* Seeds or replaces an entity's ontology manifest and optional mode override.
|
|
7702
7716
|
* Validates manifest invariants (unique type slugs, edge endpoints reference node types).
|
|
7703
7717
|
* Invalidates the in-memory ontology cache for this entity.
|
|
7718
|
+
*
|
|
7719
|
+
* Delegates to `setOntologyManifests` so there is a single write path. The
|
|
7720
|
+
* observable contract is unchanged: same upsert semantics, same cache
|
|
7721
|
+
* invalidation, same `void` result.
|
|
7704
7722
|
*/
|
|
7705
7723
|
async setOntologyManifest(entityId, manifest, options) {
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7724
|
+
await this.setOntologyManifests([{ entityId, manifest, mode: options?.mode }]);
|
|
7725
|
+
}
|
|
7726
|
+
/**
|
|
7727
|
+
* Write several entities' ontology manifests in a single transaction.
|
|
7728
|
+
*
|
|
7729
|
+
* All succeed or none do. The transaction is opened on this instance's
|
|
7730
|
+
* serialized adapter — callers pass data, never a transaction handle, because
|
|
7731
|
+
* a consumer holds the unwrapped adapter and a transaction opened on it would
|
|
7732
|
+
* bypass the serialization mutex applied in the constructor.
|
|
7733
|
+
*
|
|
7734
|
+
* Returns which entities were written. `skipped` is only ever non-empty under
|
|
7735
|
+
* `opts.ifAbsent`.
|
|
7736
|
+
*
|
|
7737
|
+
* Sharp edge: `ifAbsent` checks for a PERSISTED row, not for an effective
|
|
7738
|
+
* manifest. An entity whose manifest currently comes from
|
|
7739
|
+
* `WikiConfig.ontology.seedManifests` has no row until the seed is
|
|
7740
|
+
* materialized on first access that supplies a transaction (in practice, an
|
|
7741
|
+
* ingest). Until then `ifAbsent` treats the entity as absent, writes the new
|
|
7742
|
+
* manifest over the configured seed, and reports it in `written`; the same
|
|
7743
|
+
* call after the seed has been materialized reports it in `skipped`. See the
|
|
7744
|
+
* `ifAbsent` notes in the package README.
|
|
7745
|
+
*/
|
|
7746
|
+
async setOntologyManifests(entries, opts) {
|
|
7747
|
+
if (entries.length === 0) return { written: [], skipped: [] };
|
|
7748
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7749
|
+
for (const entry of entries) {
|
|
7750
|
+
if (seen.has(entry.entityId)) {
|
|
7751
|
+
throw new Error(`Duplicate entityId in batch: ${entry.entityId}`);
|
|
7752
|
+
}
|
|
7753
|
+
seen.add(entry.entityId);
|
|
7754
|
+
}
|
|
7755
|
+
for (const entry of entries) {
|
|
7756
|
+
validateManifest(entry.manifest);
|
|
7757
|
+
}
|
|
7758
|
+
const written = [];
|
|
7759
|
+
const skipped = [];
|
|
7760
|
+
await this.db.withTransactionAsync(async (tx) => {
|
|
7761
|
+
for (const entry of entries) {
|
|
7762
|
+
const mode = entry.mode ?? this.ontologyService.resolveMode();
|
|
7763
|
+
const wrote = await this.metadataRepo.setManifest(
|
|
7764
|
+
entry.entityId,
|
|
7765
|
+
{ mode, manifest: entry.manifest },
|
|
7766
|
+
tx,
|
|
7767
|
+
{ ifAbsent: opts?.ifAbsent === true }
|
|
7768
|
+
);
|
|
7769
|
+
(wrote ? written : skipped).push(entry.entityId);
|
|
7770
|
+
}
|
|
7771
|
+
});
|
|
7772
|
+
for (const entry of entries) {
|
|
7773
|
+
this.ontologyService.invalidateCache(entry.entityId);
|
|
7774
|
+
}
|
|
7775
|
+
return { written, skipped };
|
|
7711
7776
|
}
|
|
7712
7777
|
/** Append a verification event to a fact. Does NOT touch `updated_at`. */
|
|
7713
7778
|
async writeOkfTrust(entryId, entityId, verified) {
|