@equationalapplications/core-llm-wiki 7.18.0 → 8.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/dist/{chunk-XA3VEFKQ.mjs → chunk-2N5SNDS3.mjs} +46 -8
- package/dist/chunk-2N5SNDS3.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +45 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -30
- package/dist/index.mjs.map +1 -1
- package/dist/{testing-DRB-65AM.d.mts → testing-De-WJ7xh.d.mts} +10 -9
- package/dist/{testing-DRB-65AM.d.ts → testing-De-WJ7xh.d.ts} +10 -9
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +15 -5
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-XA3VEFKQ.mjs.map +0 -1
|
@@ -2101,11 +2101,11 @@ ${JSON.stringify({ items })}` };
|
|
|
2101
2101
|
* placeholders and leaves data placeholders verbatim; heal never receives
|
|
2102
2102
|
* ontology context, matching `buildHealPrompt`.
|
|
2103
2103
|
*/
|
|
2104
|
-
buildInstructionTemplates(ontologyContext) {
|
|
2104
|
+
buildInstructionTemplates(ontologyContext, librarianStrategy) {
|
|
2105
2105
|
const o = this.globalOverrides;
|
|
2106
2106
|
return {
|
|
2107
2107
|
ingest: this.appendGrounding(this.buildSystemPrompt(o?.ingestSystemPrompt ?? INGEST_SYSTEM_PROMPT, {}, ontologyContext), "ingest"),
|
|
2108
|
-
librarian: this.appendGrounding(this.buildSystemPrompt(o?.librarianSystemPrompt ?? LIBRARIAN_SYSTEM_PROMPT, {}, ontologyContext), "librarian"),
|
|
2108
|
+
librarian: librarianStrategy === "ops" ? this.appendGrounding(this.appendOntology(OPS_EXTRACT_SYSTEM_PROMPT, ontologyContext), "librarian") : this.appendGrounding(this.buildSystemPrompt(o?.librarianSystemPrompt ?? LIBRARIAN_SYSTEM_PROMPT, {}, ontologyContext), "librarian"),
|
|
2109
2109
|
heal: this.appendGrounding(o?.healSystemPrompt ?? HEAL_SYSTEM_PROMPT, "heal"),
|
|
2110
2110
|
ontologyBackfill: this.buildSystemPrompt(o?.ontologyBackfillSystemPrompt ?? ONTOLOGY_BACKFILL_SYSTEM_PROMPT, {}, ontologyContext)
|
|
2111
2111
|
};
|
|
@@ -3052,6 +3052,44 @@ function classifierStateForFact(fact) {
|
|
|
3052
3052
|
return parts.join("\n\n");
|
|
3053
3053
|
}
|
|
3054
3054
|
|
|
3055
|
+
// src/utils/engineDefaults.ts
|
|
3056
|
+
var DEFAULT_LIBRARIAN_STRATEGY = "ops";
|
|
3057
|
+
var DEFAULT_MAINTENANCE_MODE = "deferred";
|
|
3058
|
+
function resolveLibrarianStrategy(config) {
|
|
3059
|
+
return config?.librarian?.strategy ?? DEFAULT_LIBRARIAN_STRATEGY;
|
|
3060
|
+
}
|
|
3061
|
+
function resolveMaintenanceMode(config) {
|
|
3062
|
+
return config?.maintenance ?? DEFAULT_MAINTENANCE_MODE;
|
|
3063
|
+
}
|
|
3064
|
+
function changedDefaultWarnings(config) {
|
|
3065
|
+
const warnings = [];
|
|
3066
|
+
const hasThreshold = config?.autoLibrarianThreshold !== void 0 || config?.autoHealThreshold !== void 0 || config?.autoLibrarianTokenThreshold !== void 0;
|
|
3067
|
+
if (hasThreshold && config?.maintenance === void 0) {
|
|
3068
|
+
warnings.push(
|
|
3069
|
+
"[core-llm-wiki] auto-run thresholds are set, but `maintenance` now defaults to 'deferred', so write() will not start the librarian or heal. Set `maintenance: 'auto'` or call runPendingMaintenance()."
|
|
3070
|
+
);
|
|
3071
|
+
}
|
|
3072
|
+
if (config?.prompts?.librarianSystemPrompt !== void 0 && config?.librarian?.strategy === void 0) {
|
|
3073
|
+
warnings.push(
|
|
3074
|
+
"[core-llm-wiki] `prompts.librarianSystemPrompt` is set, but `librarian.strategy` now defaults to 'ops', which does not use it. Set `librarian: { strategy: 'legacy' }` to keep the override."
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3077
|
+
if (config?.librarian?.strategy === "legacy" && config?.maintenance === void 0 && !hasThreshold) {
|
|
3078
|
+
warnings.push(
|
|
3079
|
+
"[core-llm-wiki] `librarian.strategy` is pinned to 'legacy', but `maintenance` now defaults to 'deferred', so write() will not start the librarian or heal, and a deferred backlog run keeps only the newest 50 events. Set `maintenance: 'auto'` to keep 7.x auto-run behavior."
|
|
3080
|
+
);
|
|
3081
|
+
}
|
|
3082
|
+
return warnings;
|
|
3083
|
+
}
|
|
3084
|
+
var warnedDefaults = /* @__PURE__ */ new Set();
|
|
3085
|
+
function warnChangedDefaultsOnce(config) {
|
|
3086
|
+
for (const message of changedDefaultWarnings(config)) {
|
|
3087
|
+
if (warnedDefaults.has(message)) continue;
|
|
3088
|
+
warnedDefaults.add(message);
|
|
3089
|
+
console.warn(message);
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3055
3093
|
// src/repositories/BaseRepository.ts
|
|
3056
3094
|
var BaseRepository = class {
|
|
3057
3095
|
constructor(db, prefix) {
|
|
@@ -4947,7 +4985,7 @@ var STRATEGIES = /* @__PURE__ */ new Map([
|
|
|
4947
4985
|
["ops", runOpsLibrarianPass]
|
|
4948
4986
|
]);
|
|
4949
4987
|
async function runLibrarianStrategy(deps, ctx) {
|
|
4950
|
-
const strategy = deps.options.config
|
|
4988
|
+
const strategy = resolveLibrarianStrategy(deps.options.config);
|
|
4951
4989
|
const fn = STRATEGIES.get(strategy);
|
|
4952
4990
|
if (!fn) {
|
|
4953
4991
|
throw new Error(`Unknown librarian strategy: ${strategy}`);
|
|
@@ -5096,7 +5134,7 @@ var MaintenanceService = class {
|
|
|
5096
5134
|
}
|
|
5097
5135
|
if (retainEventsFor !== null) {
|
|
5098
5136
|
const cutoff = now - retainEventsFor * 864e5;
|
|
5099
|
-
const guarded = this.options.config
|
|
5137
|
+
const guarded = resolveMaintenanceMode(this.options.config) === "deferred" || resolveLibrarianStrategy(this.options.config) === "ops";
|
|
5100
5138
|
if (guarded) {
|
|
5101
5139
|
const wm = await this.metadataRepo.getLibrarianWatermark(entityId, this.db);
|
|
5102
5140
|
deletedEvents = (await this.eventRepo.pruneThrough(entityId, cutoff, wm)).changes;
|
|
@@ -7595,7 +7633,7 @@ var WriteService = class {
|
|
|
7595
7633
|
created_at: now,
|
|
7596
7634
|
occurred_at: occurredAt
|
|
7597
7635
|
};
|
|
7598
|
-
const deferred = this.options.config
|
|
7636
|
+
const deferred = resolveMaintenanceMode(this.options.config) === "deferred";
|
|
7599
7637
|
if (deferred) {
|
|
7600
7638
|
await this.eventRepo.add(newEvent);
|
|
7601
7639
|
return;
|
|
@@ -7706,6 +7744,6 @@ var WriteService = class {
|
|
|
7706
7744
|
}
|
|
7707
7745
|
};
|
|
7708
7746
|
|
|
7709
|
-
export { BaseRepository, CURRENT_SCHEMA_VERSION, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DiagnosticBuffer, EMBED_CHARS_CEILING, EmbeddingService, 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_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, TemporalService, UnavailableIndexStrategy, UsageMeter, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, assertEntityId, assertEpochMs, chunkText, configureRandomSource, createLegacySourceTypeIndex, detectSchemaVersion, drainChunkSql, drainHiSql, edgeTripleAllowed, emptyManifest, entityDrainChunkSql, entityDrainHiSql, entitySummaryMetaKey, extractSqliteCode, factTokenCost, fts5LedgerDropSql, fts5PendingIndexesDdl, fts5TablesDdl, fts5TriggerNames, fts5TriggersDdl, generateId, idDrainChunkSql, idReindexChunkSql, isLiveAt, isRetiredTableName, isWikiSearchUnavailableError, liveAtSql, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, parseJsonArray, parseJsonObject, probePendingWork, readRebuildProgress, reanchorRebuildFingerprint, resolveEdgeDefinitions, resolveGrounding, resolveNodeType, retiredTableName, runSourceRefNormalize, safeSlice, setupDatabase, sweepChunkSql, sweepHiSql, typeSatisfies, validateInlineEdges, validateManifest, windowChunkSql, windowHiSql, writeNormalizeStamp, writeRebuildStart };
|
|
7710
|
-
//# sourceMappingURL=chunk-
|
|
7711
|
-
//# sourceMappingURL=chunk-
|
|
7747
|
+
export { BaseRepository, CURRENT_SCHEMA_VERSION, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, DiagnosticBuffer, EMBED_CHARS_CEILING, EmbeddingService, 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_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, RetrievalService, SearchService, TemporalService, UnavailableIndexStrategy, UsageMeter, WikiBusyError, WikiDraftNotFound, WikiDuplicateHashError, WikiGraphNodeOwnershipConflict, WikiIngestEmptyError, WikiInvalidReadOptions, WikiMigrationRequiredError, WikiParseError, WikiSearchUnavailableError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiSupersedeError, WikiTransactionError, WriteService, __privateAdd, __privateGet, __privateSet, assertEntityId, assertEpochMs, chunkText, configureRandomSource, createLegacySourceTypeIndex, detectSchemaVersion, drainChunkSql, drainHiSql, edgeTripleAllowed, emptyManifest, entityDrainChunkSql, entityDrainHiSql, entitySummaryMetaKey, extractSqliteCode, factTokenCost, fts5LedgerDropSql, fts5PendingIndexesDdl, fts5TablesDdl, fts5TriggerNames, fts5TriggersDdl, generateId, idDrainChunkSql, idReindexChunkSql, isLiveAt, isRetiredTableName, isWikiSearchUnavailableError, liveAtSql, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, parseJsonArray, parseJsonObject, probePendingWork, readRebuildProgress, reanchorRebuildFingerprint, resolveEdgeDefinitions, resolveGrounding, resolveLibrarianStrategy, resolveNodeType, retiredTableName, runSourceRefNormalize, safeSlice, setupDatabase, sweepChunkSql, sweepHiSql, typeSatisfies, validateInlineEdges, validateManifest, warnChangedDefaultsOnce, windowChunkSql, windowHiSql, writeNormalizeStamp, writeRebuildStart };
|
|
7748
|
+
//# sourceMappingURL=chunk-2N5SNDS3.mjs.map
|
|
7749
|
+
//# sourceMappingURL=chunk-2N5SNDS3.mjs.map
|