@equationalapplications/core-llm-wiki 8.0.4 → 8.0.5
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/dist/{chunk-2N5SNDS3.mjs → chunk-GYF5QLYK.mjs} +87 -16
- package/dist/chunk-GYF5QLYK.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +105 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-De-WJ7xh.d.mts → testing-BPddGTkl.d.mts} +29 -3
- package/dist/{testing-De-WJ7xh.d.ts → testing-BPddGTkl.d.ts} +29 -3
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +85 -14
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-2N5SNDS3.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseRepository, WikiGraphNodeOwnershipConflict, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, MetadataRepository, EmbeddingService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, normalizeSourceRef, normalizeSourceHash, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, assertEntityId, assertEpochMs, FTS5_STATE_KEY, fts5LedgerDropSql, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-
|
|
2
|
-
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isWikiSearchUnavailableError, parseEmbedding, safeSlice, validateManifest } from './chunk-
|
|
1
|
+
import { BaseRepository, WikiGraphNodeOwnershipConflict, parseJsonObject, parseJsonArray, liveAtSql, reanchorRebuildFingerprint, __privateAdd, warnChangedDefaultsOnce, MetadataRepository, EmbeddingService, SearchService, TemporalService, JobManager, PromptService, resolveGrounding, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, createLegacySourceTypeIndex, writeNormalizeStamp, CURRENT_SCHEMA_VERSION, detectSchemaVersion, MIGRATIONS, runSourceRefNormalize, normalizeSourceRef, normalizeSourceHash, resolveLibrarianStrategy, entitySummaryMetaKey, WikiSourceRefHashCollision, DiagnosticBuffer, validateManifest, WikiDraftNotFound, generateId, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, typeSatisfies, normalizeTitleKey, edgeTripleAllowed, MAX_EMBED_ATTEMPTS, UsageMeter, isWikiSearchUnavailableError, WikiBusyError, WikiInvalidReadOptions, isLiveAt, packFactsByBudget, factTokenCost, probePendingWork, WikiMigrationRequiredError, setupDatabase, UnavailableIndexStrategy, assertEntityId, assertEpochMs, FTS5_STATE_KEY, fts5LedgerDropSql, fts5TablesDdl, fts5PendingIndexesDdl, fts5TriggersDdl, writeRebuildStart, FTS5_RETIRED_COUNTER_KEY, retiredTableName, FTS5_RETIRED_TABLES_KEY, isRetiredTableName, idReindexChunkSql, readRebuildProgress, FTS5_DRAIN_CHUNK, FTS5_RECLAIM_MERGE_PAGES, windowHiSql, windowChunkSql, FTS5_REBUILD_WM_KEY, sweepHiSql, sweepChunkSql, FTS5_SWEEP_CURSOR_KEY, drainHiSql, drainChunkSql, FTS5_REBUILD_SNAPSHOT_KEY, idDrainChunkSql, entityDrainHiSql, entityDrainChunkSql, fts5TriggerNames, extractSqliteCode, WikiTransactionError } from './chunk-GYF5QLYK.mjs';
|
|
2
|
+
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, EMBED_CHARS_CEILING, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, chunkText, configureRandomSource, isWikiSearchUnavailableError, parseEmbedding, safeSlice, validateManifest } from './chunk-GYF5QLYK.mjs';
|
|
3
3
|
import { deriveTrustTier, isStaleAfter, appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList } from '@equationalapplications/core-okf';
|
|
4
4
|
import MiniSearch from 'minisearch';
|
|
5
5
|
|
|
@@ -2017,8 +2017,8 @@ var EventRepository = class extends BaseRepository {
|
|
|
2017
2017
|
* Delete events for an entity that were created at or before the given cutoff timestamp.
|
|
2018
2018
|
* Returns the number of deleted rows.
|
|
2019
2019
|
*/
|
|
2020
|
-
async prune(entityId, cutoff) {
|
|
2021
|
-
return this.db.runAsync(
|
|
2020
|
+
async prune(entityId, cutoff, tx) {
|
|
2021
|
+
return (tx ?? this.db).runAsync(
|
|
2022
2022
|
`DELETE FROM ${this.prefix}events WHERE entity_id = ? AND created_at <= ?`,
|
|
2023
2023
|
[entityId, cutoff]
|
|
2024
2024
|
);
|
|
@@ -2030,9 +2030,9 @@ var EventRepository = class extends BaseRepository {
|
|
|
2030
2030
|
* deleted. `wm = null` (no watermark yet) deletes nothing.
|
|
2031
2031
|
* Used by runPrune under the deferred/ops strategies.
|
|
2032
2032
|
*/
|
|
2033
|
-
async pruneThrough(entityId, cutoff, wm) {
|
|
2033
|
+
async pruneThrough(entityId, cutoff, wm, tx) {
|
|
2034
2034
|
if (!wm) return { changes: 0 };
|
|
2035
|
-
return this.db.runAsync(
|
|
2035
|
+
return (tx ?? this.db).runAsync(
|
|
2036
2036
|
`DELETE FROM ${this.prefix}events WHERE entity_id = ? AND created_at <= ? AND NOT ${AFTER_SQL}`,
|
|
2037
2037
|
[entityId, cutoff, ...afterArgs(wm)]
|
|
2038
2038
|
);
|
|
@@ -2050,6 +2050,18 @@ var EventRepository = class extends BaseRepository {
|
|
|
2050
2050
|
);
|
|
2051
2051
|
return Number(row?.n ?? 0);
|
|
2052
2052
|
}
|
|
2053
|
+
/**
|
|
2054
|
+
* The newest `created_at` stored for an entity, or null when it has no
|
|
2055
|
+
* events. `write()` reads it inside its transaction to keep `created_at`
|
|
2056
|
+
* strictly increasing per entity (spec ops-auto-first-batch §5).
|
|
2057
|
+
*/
|
|
2058
|
+
async latestCreatedAt(entityId, tx) {
|
|
2059
|
+
const row = await (tx ?? this.db).getFirstAsync(
|
|
2060
|
+
`SELECT MAX(created_at) AS at FROM ${this.prefix}events WHERE entity_id = ?`,
|
|
2061
|
+
[entityId]
|
|
2062
|
+
);
|
|
2063
|
+
return row?.at ?? null;
|
|
2064
|
+
}
|
|
2053
2065
|
/**
|
|
2054
2066
|
* Return the total number of events stored for an entity.
|
|
2055
2067
|
* `tx` is optional — pass an active transaction handle for atomic reads.
|
|
@@ -3248,6 +3260,9 @@ var MaintenanceScheduler = class {
|
|
|
3248
3260
|
let h;
|
|
3249
3261
|
try {
|
|
3250
3262
|
h = await this.maintenanceService.doRunHeal(entityId, { trigger: "call", meter });
|
|
3263
|
+
if (h.remaining === 0 && !(h.budgetStop && h.scanned === 0)) {
|
|
3264
|
+
await this.metadataRepo.updateCheckpoint(entityId, { heal: await this.eventRepo.count(entityId) }, this.db);
|
|
3265
|
+
}
|
|
3251
3266
|
} finally {
|
|
3252
3267
|
this.jobManager.releaseLock("heal", entityId);
|
|
3253
3268
|
}
|
|
@@ -3266,10 +3281,7 @@ var MaintenanceScheduler = class {
|
|
|
3266
3281
|
}
|
|
3267
3282
|
st.report.healPasses++;
|
|
3268
3283
|
progressed = true;
|
|
3269
|
-
if (h.remaining === 0)
|
|
3270
|
-
st.heal = false;
|
|
3271
|
-
await this.metadataRepo.updateCheckpoint(entityId, { heal: await this.eventRepo.count(entityId) }, this.db);
|
|
3272
|
-
}
|
|
3284
|
+
if (h.remaining === 0) st.heal = false;
|
|
3273
3285
|
if (h.budgetStop) {
|
|
3274
3286
|
stopped = exhaustedStop();
|
|
3275
3287
|
break rounds;
|