@equationalapplications/core-llm-wiki 7.17.2 → 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 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- 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
|
@@ -253,7 +253,7 @@ interface LibrarianGateConfig {
|
|
|
253
253
|
/** Best-neighbour cosine below which a candidate is novel. Default 0.30 (calibrated against the 30 supersession scenarios). */
|
|
254
254
|
novelThreshold?: number;
|
|
255
255
|
}
|
|
256
|
-
/** `'legacy'` is the 7.x add-only librarian. `'ops'` is the spec §5.1 / §5.3 dispatcher. */
|
|
256
|
+
/** `'legacy'` is the 7.x add-only librarian. `'ops'` (default since 8.0.0) is the spec §5.1 / §5.3 dispatcher. */
|
|
257
257
|
interface LibrarianConfig {
|
|
258
258
|
strategy?: 'legacy' | 'ops';
|
|
259
259
|
gate?: LibrarianGateConfig;
|
|
@@ -358,15 +358,16 @@ interface WikiConfig {
|
|
|
358
358
|
grounding?: GroundingConfig;
|
|
359
359
|
/** Emit an `llm_usage` diagnostic after every LLM text call. Default false. */
|
|
360
360
|
reportLlmUsage?: boolean;
|
|
361
|
-
/** Librarian strategy selection (spec 2026-09-29 §5.1). Default `{ strategy: '
|
|
361
|
+
/** Librarian strategy selection (spec 2026-09-29 §5.1). Default `{ strategy: 'ops' }` since 8.0.0. */
|
|
362
362
|
librarian?: LibrarianConfig;
|
|
363
363
|
/**
|
|
364
|
-
* `'
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
364
|
+
* `'deferred'` (default since 8.0.0): write() only records the event, and
|
|
365
|
+
* nothing is extracted or healed until the host runs
|
|
366
|
+
* `runPendingMaintenance()` (spec 2026-09-29 §6). `'auto'`: write() starts
|
|
367
|
+
* librarian/heal in the background when thresholds are crossed. Don't pair
|
|
368
|
+
* `'deferred'` with `librarian: { strategy: 'legacy' }`: the legacy strategy
|
|
369
|
+
* reads only the newest 50 events per pass and advances the watermark past
|
|
370
|
+
* them, so a deferred backlog larger than that is never extracted.
|
|
370
371
|
*/
|
|
371
372
|
maintenance?: 'auto' | 'deferred';
|
|
372
373
|
/** `'auto'` mode only: also trigger the librarian when pending event text reaches ~this many tokens (chars/4). */
|
|
@@ -2815,7 +2816,7 @@ declare class PromptService {
|
|
|
2815
2816
|
* placeholders and leaves data placeholders verbatim; heal never receives
|
|
2816
2817
|
* ontology context, matching `buildHealPrompt`.
|
|
2817
2818
|
*/
|
|
2818
|
-
buildInstructionTemplates(ontologyContext: OntologyPromptContext | null): WikiInstructions;
|
|
2819
|
+
buildInstructionTemplates(ontologyContext: OntologyPromptContext | null, librarianStrategy: 'legacy' | 'ops'): WikiInstructions;
|
|
2819
2820
|
}
|
|
2820
2821
|
|
|
2821
2822
|
declare class IngestionService {
|
|
@@ -253,7 +253,7 @@ interface LibrarianGateConfig {
|
|
|
253
253
|
/** Best-neighbour cosine below which a candidate is novel. Default 0.30 (calibrated against the 30 supersession scenarios). */
|
|
254
254
|
novelThreshold?: number;
|
|
255
255
|
}
|
|
256
|
-
/** `'legacy'` is the 7.x add-only librarian. `'ops'` is the spec §5.1 / §5.3 dispatcher. */
|
|
256
|
+
/** `'legacy'` is the 7.x add-only librarian. `'ops'` (default since 8.0.0) is the spec §5.1 / §5.3 dispatcher. */
|
|
257
257
|
interface LibrarianConfig {
|
|
258
258
|
strategy?: 'legacy' | 'ops';
|
|
259
259
|
gate?: LibrarianGateConfig;
|
|
@@ -358,15 +358,16 @@ interface WikiConfig {
|
|
|
358
358
|
grounding?: GroundingConfig;
|
|
359
359
|
/** Emit an `llm_usage` diagnostic after every LLM text call. Default false. */
|
|
360
360
|
reportLlmUsage?: boolean;
|
|
361
|
-
/** Librarian strategy selection (spec 2026-09-29 §5.1). Default `{ strategy: '
|
|
361
|
+
/** Librarian strategy selection (spec 2026-09-29 §5.1). Default `{ strategy: 'ops' }` since 8.0.0. */
|
|
362
362
|
librarian?: LibrarianConfig;
|
|
363
363
|
/**
|
|
364
|
-
* `'
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
364
|
+
* `'deferred'` (default since 8.0.0): write() only records the event, and
|
|
365
|
+
* nothing is extracted or healed until the host runs
|
|
366
|
+
* `runPendingMaintenance()` (spec 2026-09-29 §6). `'auto'`: write() starts
|
|
367
|
+
* librarian/heal in the background when thresholds are crossed. Don't pair
|
|
368
|
+
* `'deferred'` with `librarian: { strategy: 'legacy' }`: the legacy strategy
|
|
369
|
+
* reads only the newest 50 events per pass and advances the watermark past
|
|
370
|
+
* them, so a deferred backlog larger than that is never extracted.
|
|
370
371
|
*/
|
|
371
372
|
maintenance?: 'auto' | 'deferred';
|
|
372
373
|
/** `'auto'` mode only: also trigger the librarian when pending event text reaches ~this many tokens (chars/4). */
|
|
@@ -2815,7 +2816,7 @@ declare class PromptService {
|
|
|
2815
2816
|
* placeholders and leaves data placeholders verbatim; heal never receives
|
|
2816
2817
|
* ontology context, matching `buildHealPrompt`.
|
|
2817
2818
|
*/
|
|
2818
|
-
buildInstructionTemplates(ontologyContext: OntologyPromptContext | null): WikiInstructions;
|
|
2819
|
+
buildInstructionTemplates(ontologyContext: OntologyPromptContext | null, librarianStrategy: 'legacy' | 'ops'): WikiInstructions;
|
|
2819
2820
|
}
|
|
2820
2821
|
|
|
2821
2822
|
declare class IngestionService {
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-
|
|
1
|
+
export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-De-WJ7xh.mjs';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-
|
|
1
|
+
export { aH as EmbeddingService, aI as ImportExportService, aJ as IngestionService, aK as JobManager, aK as JobManagerType, aL as MaintenanceService, aM as RetrievalService, aN as SearchService, aN as SearchServiceType, au as WikiMemoryTestAccess, aO as WriteService } from './testing-De-WJ7xh.js';
|
|
2
2
|
import '@equationalapplications/core-okf';
|
package/dist/testing.js
CHANGED
|
@@ -1907,11 +1907,11 @@ ${JSON.stringify({ items })}` };
|
|
|
1907
1907
|
* placeholders and leaves data placeholders verbatim; heal never receives
|
|
1908
1908
|
* ontology context, matching `buildHealPrompt`.
|
|
1909
1909
|
*/
|
|
1910
|
-
buildInstructionTemplates(ontologyContext) {
|
|
1910
|
+
buildInstructionTemplates(ontologyContext, librarianStrategy) {
|
|
1911
1911
|
const o = this.globalOverrides;
|
|
1912
1912
|
return {
|
|
1913
1913
|
ingest: this.appendGrounding(this.buildSystemPrompt(o?.ingestSystemPrompt ?? INGEST_SYSTEM_PROMPT, {}, ontologyContext), "ingest"),
|
|
1914
|
-
librarian: this.appendGrounding(this.buildSystemPrompt(o?.librarianSystemPrompt ?? LIBRARIAN_SYSTEM_PROMPT, {}, ontologyContext), "librarian"),
|
|
1914
|
+
librarian: librarianStrategy === "ops" ? this.appendGrounding(this.appendOntology(OPS_EXTRACT_SYSTEM_PROMPT, ontologyContext), "librarian") : this.appendGrounding(this.buildSystemPrompt(o?.librarianSystemPrompt ?? LIBRARIAN_SYSTEM_PROMPT, {}, ontologyContext), "librarian"),
|
|
1915
1915
|
heal: this.appendGrounding(o?.healSystemPrompt ?? HEAL_SYSTEM_PROMPT, "heal"),
|
|
1916
1916
|
ontologyBackfill: this.buildSystemPrompt(o?.ontologyBackfillSystemPrompt ?? ONTOLOGY_BACKFILL_SYSTEM_PROMPT, {}, ontologyContext)
|
|
1917
1917
|
};
|
|
@@ -2709,6 +2709,16 @@ function classifierStateForFact(fact) {
|
|
|
2709
2709
|
return parts.join("\n\n");
|
|
2710
2710
|
}
|
|
2711
2711
|
|
|
2712
|
+
// src/utils/engineDefaults.ts
|
|
2713
|
+
var DEFAULT_LIBRARIAN_STRATEGY = "ops";
|
|
2714
|
+
var DEFAULT_MAINTENANCE_MODE = "deferred";
|
|
2715
|
+
function resolveLibrarianStrategy(config) {
|
|
2716
|
+
return config?.librarian?.strategy ?? DEFAULT_LIBRARIAN_STRATEGY;
|
|
2717
|
+
}
|
|
2718
|
+
function resolveMaintenanceMode(config) {
|
|
2719
|
+
return config?.maintenance ?? DEFAULT_MAINTENANCE_MODE;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2712
2722
|
// src/utils/embedding.ts
|
|
2713
2723
|
function parseEmbedding(blob, text) {
|
|
2714
2724
|
if (blob && blob.byteLength > 0) {
|
|
@@ -3997,7 +4007,7 @@ var STRATEGIES = /* @__PURE__ */ new Map([
|
|
|
3997
4007
|
["ops", runOpsLibrarianPass]
|
|
3998
4008
|
]);
|
|
3999
4009
|
async function runLibrarianStrategy(deps, ctx) {
|
|
4000
|
-
const strategy = deps.options.config
|
|
4010
|
+
const strategy = resolveLibrarianStrategy(deps.options.config);
|
|
4001
4011
|
const fn = STRATEGIES.get(strategy);
|
|
4002
4012
|
if (!fn) {
|
|
4003
4013
|
throw new Error(`Unknown librarian strategy: ${strategy}`);
|
|
@@ -4146,7 +4156,7 @@ var MaintenanceService = class {
|
|
|
4146
4156
|
}
|
|
4147
4157
|
if (retainEventsFor !== null) {
|
|
4148
4158
|
const cutoff = now - retainEventsFor * 864e5;
|
|
4149
|
-
const guarded = this.options.config
|
|
4159
|
+
const guarded = resolveMaintenanceMode(this.options.config) === "deferred" || resolveLibrarianStrategy(this.options.config) === "ops";
|
|
4150
4160
|
if (guarded) {
|
|
4151
4161
|
const wm = await this.metadataRepo.getLibrarianWatermark(entityId, this.db);
|
|
4152
4162
|
deletedEvents = (await this.eventRepo.pruneThrough(entityId, cutoff, wm)).changes;
|
|
@@ -6724,7 +6734,7 @@ var WriteService = class {
|
|
|
6724
6734
|
created_at: now,
|
|
6725
6735
|
occurred_at: occurredAt
|
|
6726
6736
|
};
|
|
6727
|
-
const deferred = this.options.config
|
|
6737
|
+
const deferred = resolveMaintenanceMode(this.options.config) === "deferred";
|
|
6728
6738
|
if (deferred) {
|
|
6729
6739
|
await this.eventRepo.add(newEvent);
|
|
6730
6740
|
return;
|