@equationalapplications/core-llm-wiki 9.19.0 → 9.20.1
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-JTKJXNB6.mjs → chunk-PLZNFRMM.mjs} +50 -8
- package/dist/chunk-PLZNFRMM.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-hg6O6N-X.d.mts → testing-DS_d9qmP.d.mts} +16 -6
- package/dist/{testing-hg6O6N-X.d.ts → testing-DS_d9qmP.d.ts} +16 -6
- 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-JTKJXNB6.mjs.map +0 -1
|
@@ -10304,14 +10304,17 @@ var DEFAULT_MAX_TOTAL_CHARS = 5e6;
|
|
|
10304
10304
|
function limitOr(value, fallback) {
|
|
10305
10305
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
|
|
10306
10306
|
}
|
|
10307
|
-
function listStoredSourcesSql(prefix) {
|
|
10307
|
+
function listStoredSourcesSql(prefix, paging) {
|
|
10308
|
+
const cursorPredicate = paging?.hasCursor ? "\n AND d.source_ref > ?" : "";
|
|
10309
|
+
const limitClause = paging ? "\n LIMIT ?" : "";
|
|
10308
10310
|
return `SELECT d.source_ref, d.source_hash, d.char_count, d.created_at,
|
|
10309
10311
|
(SELECT COUNT(*) FROM ${prefix}source_passages p
|
|
10310
10312
|
WHERE p.document_id = d.id AND +p.entity_id = d.entity_id) AS passage_count
|
|
10311
10313
|
FROM ${prefix}source_documents d
|
|
10312
|
-
WHERE d.entity_id =
|
|
10313
|
-
ORDER BY d.source_ref COLLATE BINARY`;
|
|
10314
|
+
WHERE d.entity_id = ?${cursorPredicate}
|
|
10315
|
+
ORDER BY d.source_ref COLLATE BINARY${limitClause}`;
|
|
10314
10316
|
}
|
|
10317
|
+
var DEFAULT_LIST_PAGE_LIMIT = 200;
|
|
10315
10318
|
var SourceStoreService = class {
|
|
10316
10319
|
constructor(db, prefix, options, jobManager) {
|
|
10317
10320
|
this.db = db;
|
|
@@ -10388,9 +10391,48 @@ var SourceStoreService = class {
|
|
|
10388
10391
|
storedAt: Number(row.created_at)
|
|
10389
10392
|
};
|
|
10390
10393
|
}
|
|
10391
|
-
/** Spec §
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
+
/** Spec source-store-paging §2: point probe — true iff the document row exists for the
|
|
10395
|
+
* normalized ref. Plain read, no write lock, hash-blind: the UNIQUE index on
|
|
10396
|
+
* (entity_id, source_ref) makes one row per pair the only possible state, so a
|
|
10397
|
+
* re-stored changed copy is still stored. Blank/non-string refs return false (no throw). */
|
|
10398
|
+
async hasStoredSource(entityId, sourceRef) {
|
|
10399
|
+
const ref = normalizeSourceRef(sourceRef);
|
|
10400
|
+
if (!ref) return false;
|
|
10401
|
+
const row = await this.db.getFirstAsync(
|
|
10402
|
+
`SELECT id FROM ${this.prefix}source_documents WHERE entity_id = ? AND source_ref = ?`,
|
|
10403
|
+
[entityId, ref]
|
|
10404
|
+
);
|
|
10405
|
+
return row !== void 0 && row !== null;
|
|
10406
|
+
}
|
|
10407
|
+
/** Spec §4/§7: full store listing, including sources stored with no ingest.
|
|
10408
|
+
* With `opts` (spec source-store §7): keyset paging in source_ref
|
|
10409
|
+
* COLLATE BINARY order; validation order opts shape → afterSourceRef →
|
|
10410
|
+
* limit, each a named throw before any query. `Number.isSafeInteger`
|
|
10411
|
+
* subsumes 0/negative/NaN/Infinity/non-number limits. */
|
|
10412
|
+
async listStoredSources(entityId, opts) {
|
|
10413
|
+
let cursor;
|
|
10414
|
+
let limit;
|
|
10415
|
+
if (opts !== void 0) {
|
|
10416
|
+
if (opts === null || typeof opts !== "object" || Array.isArray(opts)) {
|
|
10417
|
+
throw new Error("Invalid opts");
|
|
10418
|
+
}
|
|
10419
|
+
if (opts.afterSourceRef !== void 0) {
|
|
10420
|
+
const normalized = normalizeSourceRef(opts.afterSourceRef);
|
|
10421
|
+
if (!normalized) throw new Error("Invalid afterSourceRef");
|
|
10422
|
+
cursor = normalized;
|
|
10423
|
+
}
|
|
10424
|
+
if (opts.limit !== void 0) {
|
|
10425
|
+
const raw = opts.limit;
|
|
10426
|
+
if (typeof raw !== "number" || !Number.isSafeInteger(raw) || raw < 1) {
|
|
10427
|
+
throw new Error("Invalid limit");
|
|
10428
|
+
}
|
|
10429
|
+
limit = raw;
|
|
10430
|
+
}
|
|
10431
|
+
}
|
|
10432
|
+
const paging = cursor !== void 0 || limit !== void 0;
|
|
10433
|
+
const sql = listStoredSourcesSql(this.prefix, paging ? { hasCursor: cursor !== void 0 } : void 0);
|
|
10434
|
+
const bindings = paging ? cursor !== void 0 ? [entityId, cursor, limit ?? DEFAULT_LIST_PAGE_LIMIT] : [entityId, limit ?? DEFAULT_LIST_PAGE_LIMIT] : [entityId];
|
|
10435
|
+
const rows = await this.db.getAllAsync(sql, bindings);
|
|
10394
10436
|
return rows.map((r) => ({
|
|
10395
10437
|
sourceRef: r.source_ref,
|
|
10396
10438
|
sourceHash: r.source_hash,
|
|
@@ -12646,5 +12688,5 @@ var WriteService = class {
|
|
|
12646
12688
|
};
|
|
12647
12689
|
|
|
12648
12690
|
export { BaseRepository, CLASSIFIER_MAX_CHOICES, CURRENT_SCHEMA_VERSION, CheckpointIncompleteError, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DEFAULT_TYPING_MIN_CONFIDENCE, DiagnosticBuffer, EMBED_CHARS_CEILING, EdgeRepository, EmbeddingService, EraseStepError, FTS5_DRAIN_CHUNK, FTS5_REBUILD_SNAPSHOT_KEY, FTS5_REBUILD_WM_KEY, FTS5_RECLAIM_MERGE_PAGES, FTS5_RETIRED_COUNTER_KEY, FTS5_RETIRED_TABLES_KEY, FTS5_STATE_KEY, FTS5_SWEEP_CURSOR_KEY, HEAL_ANCHORS_PER_CANDIDATE, HEAL_BATCH_SIZE, HEAL_MAX_FACT_BODY_CHARS_L3, HEAL_MAX_TASKS, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MAX_EMBED_ATTEMPTS, MIGRATIONS, MaintenanceService, MetadataRepository, ONTOLOGY_ABSTAIN_SENTINEL, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, SourceStoreService, TemporalService, UnavailableIndexStrategy, UsageMeter, VectorRemovalRepository, VectorRemovalService, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiExternalDeletionError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, assertEntityId, assertEpochMs, canEngageIngestTyping, canEngageWriteTyping, chunkText, configureRandomSource, createEntriesDeletedIndex, createEventsForgottenIndex, createLegacySourceTypeIndex, createdAtValue, detectSchemaVersion, drainChunkSql, drainHiSql, edgeTripleAllowed, emitDiagnostic, emptyManifest, entityDrainChunkSql, entityDrainHiSql, entitySummaryMetaKey, extractSqliteCode, factTokenCost, fts5LedgerDropSql, fts5PendingIndexesDdl, fts5TablesDdl, fts5TriggerNames, fts5TriggersDdl, generateId, idDrainChunkSql, idReindexChunkSql, isLiveAt, isReservedAbstainSlug, isRetiredTableName, isUsableDate, isWikiSearchUnavailableError, liveAtSql, nodeTypeReceipts, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, parseJsonArray, parseJsonObject, parseStoredDerivedEvents, parseStoredSourcePointer, passageFtsTablesDdl, passageFtsTriggerNames, passageFtsTriggersDdl, probePendingWork, readRebuildProgress, reanchorRebuildFingerprint, resolveContextBudget, resolveContextBudgetOrThrow, resolveDefaultChunkLength, resolveEdgeDefinitions, resolveEdgesMinConfidence, resolveGrounding, resolveHealScreenMinConfidence, resolveLibrarianStrategy, resolveMaxPromptChars, resolveNodeType, resolveNodeTypeMatch, resolveResolveMinConfidence, resolveSystemOneEdges, resolveSystemOneHealScreen, resolveSystemOneResolve, resolveSystemOneTypeOnIngest, resolveSystemOneTypeOnWrite, resolveSystemOneTyping, resolveTypingMinConfidence, retiredTableName, runSourceRefNormalize, safeSlice, serializeDerivedEvents, serializeSourcePointer, setupDatabase, shouldEmitOntologyReceipt, sweepChunkSql, sweepHiSql, typeSatisfies, validUsage, validateDerivedEventsValue, validateInlineEdges, validateManifest, validateSourcePointerValue, warnChangedDefaultsOnce, warnOnce, windowChunkSql, windowHiSql, writeNormalizeStamp, writeRebuildStart };
|
|
12649
|
-
//# sourceMappingURL=chunk-
|
|
12650
|
-
//# sourceMappingURL=chunk-
|
|
12691
|
+
//# sourceMappingURL=chunk-PLZNFRMM.mjs.map
|
|
12692
|
+
//# sourceMappingURL=chunk-PLZNFRMM.mjs.map
|