@equationalapplications/core-llm-wiki 9.5.0 → 9.5.2

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.
@@ -129,8 +129,15 @@ interface OntologyBackfillResult {
129
129
  /** Untyped facts inside the recheck cooldown. */
130
130
  deferred: number;
131
131
  /** Facts a batch could not process even alone, skipped so the pass could finish.
132
- * Stamped with the recheck cooldown, so they reappear as `deferred` next pass. */
132
+ * Counts both unstamped `threw` skips (no cooldown; retried next pass) and stamped
133
+ * `overflow_skip` skips (recheck cooldown, so they reappear as `deferred` next pass). */
133
134
  skipped: number;
135
+ /** Present when a token budget stopped the pass early (spec §10.5). Unattempted facts stay
136
+ * eligible (never cooldown-stamped). A host loop runs while `remaining > 0 && !budgetStop`,
137
+ * else a fixed budget never converges. */
138
+ budgetStop?: {
139
+ requiredEstimate: number;
140
+ };
134
141
  }
135
142
  /** Result of a single `runReembed` sweep. */
136
143
  interface ReembedResult {
@@ -789,6 +796,10 @@ type ClassifierAnswer = {
789
796
  };
790
797
  interface ClassifyResponse {
791
798
  answers: Record<string, ClassifierAnswer>;
799
+ usage?: {
800
+ inputTokens: number;
801
+ outputTokens: number;
802
+ };
792
803
  }
793
804
  /**
794
805
  * Result of semantic ranking for a single fact.
@@ -862,7 +873,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
862
873
  * Closed for this release series, but new codes are added in minor versions:
863
874
  * hosts must tolerate codes they do not recognize.
864
875
  */
865
- type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
876
+ type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
866
877
  /** The service run that emitted the diagnostic. */
867
878
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
868
879
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -1534,6 +1545,13 @@ interface WikiInstructions {
1534
1545
  ingest: string;
1535
1546
  librarian: string;
1536
1547
  heal: string;
1548
+ /**
1549
+ * Template only: the run-time prompt additionally carries a TITLE CATALOG
1550
+ * of the entity's typed node titles (appended after this text, before the
1551
+ * ontology block) whenever a catalog is built — see
1552
+ * `buildTitleCatalogBlock` and the data-scope note in the ontology-backfill
1553
+ * spec Errata (PR #425).
1554
+ */
1537
1555
  ontologyBackfill: string;
1538
1556
  }
1539
1557
  type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions';
@@ -3408,7 +3426,7 @@ declare class PromptService {
3408
3426
  degraded: DegradedRecord[];
3409
3427
  groundingCorpus?: string[];
3410
3428
  };
3411
- buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
3429
+ buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null, titleCatalog?: string): {
3412
3430
  systemPrompt: string;
3413
3431
  userPrompt: string;
3414
3432
  };
@@ -3974,6 +3992,7 @@ declare class MaintenanceService {
3974
3992
  promptOverride?: string;
3975
3993
  batchSize?: number;
3976
3994
  classifier?: 'auto' | 'llm';
3995
+ tokenBudget?: number;
3977
3996
  }): Promise<OntologyBackfillResult>;
3978
3997
  /**
3979
3998
  * Re-embed facts, honouring per-row failure markers and exponential backoff.
@@ -4116,6 +4135,8 @@ declare class MaintenanceService {
4116
4135
  promptOverride?: string;
4117
4136
  batchSize?: number;
4118
4137
  classifier?: 'auto' | 'llm';
4138
+ tokenBudget?: number;
4139
+ meter?: UsageMeter;
4119
4140
  }): Promise<OntologyBackfillResult>;
4120
4141
  /**
4121
4142
  * Classifier-mode backfill (spec §7.3): one `choice` question per untyped
@@ -4694,6 +4715,7 @@ declare class WikiMemory {
4694
4715
  promptOverride?: string;
4695
4716
  batchSize?: number;
4696
4717
  classifier?: 'auto' | 'llm';
4718
+ tokenBudget?: number;
4697
4719
  }): Promise<OntologyBackfillResult>;
4698
4720
  runReembed(entityId?: string, opts?: {
4699
4721
  force?: boolean;
@@ -129,8 +129,15 @@ interface OntologyBackfillResult {
129
129
  /** Untyped facts inside the recheck cooldown. */
130
130
  deferred: number;
131
131
  /** Facts a batch could not process even alone, skipped so the pass could finish.
132
- * Stamped with the recheck cooldown, so they reappear as `deferred` next pass. */
132
+ * Counts both unstamped `threw` skips (no cooldown; retried next pass) and stamped
133
+ * `overflow_skip` skips (recheck cooldown, so they reappear as `deferred` next pass). */
133
134
  skipped: number;
135
+ /** Present when a token budget stopped the pass early (spec §10.5). Unattempted facts stay
136
+ * eligible (never cooldown-stamped). A host loop runs while `remaining > 0 && !budgetStop`,
137
+ * else a fixed budget never converges. */
138
+ budgetStop?: {
139
+ requiredEstimate: number;
140
+ };
134
141
  }
135
142
  /** Result of a single `runReembed` sweep. */
136
143
  interface ReembedResult {
@@ -789,6 +796,10 @@ type ClassifierAnswer = {
789
796
  };
790
797
  interface ClassifyResponse {
791
798
  answers: Record<string, ClassifierAnswer>;
799
+ usage?: {
800
+ inputTokens: number;
801
+ outputTokens: number;
802
+ };
792
803
  }
793
804
  /**
794
805
  * Result of semantic ranking for a single fact.
@@ -862,7 +873,7 @@ type WikiDiagnosticSeverity = 'info' | 'warn' | 'error';
862
873
  * Closed for this release series, but new codes are added in minor versions:
863
874
  * hosts must tolerate codes they do not recognize.
864
875
  */
865
- type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
876
+ type WikiDiagnosticCode = 'ingest_chunk_failed' | 'fact_rejected' | 'task_rejected' | 'fact_deduplicated' | 'edge_dropped' | 'embedding_failed' | 'hook_failed' | 'background_job_failed' | 'heal_skipped' | 'grounding_missing' | 'grounding_failed' | 'classification_low_confidence' | 'classification_invalid' | 'context_overflow_skipped' | 'llm_usage' | 'librarian_gate' | 'librarian_op_rejected' | 'contradicts_document' | 'resolve_failed' | 'read_budget' | 'event_retention_held' | 'prune_checkpoint_incomplete' | 'erase_secure_delete_off' | 'erase_entity_skipped' | 'erase_retired_vtab_undroppable' | 'erase_fts_orphan_cleared' | 'erase_retired_remaining' | 'erase_tombstones_remaining' | 'erase_retired_read_failed' | 'erase_registry_sweep_skipped' | 'import_tombstone_skipped' | 'event_created_at_clamped' | 'event_created_at_restamped' | 'external_deletion_pending' | 'external_deletion_discarded' | 'guidance_too_long' | 'guidance_resolver_failed' | 'source_pointer_unresolved' | 'source_pointer_invalid' | 'source_store_source_too_large' | 'source_store_budget_exceeded' | 'source_store_hash_mismatch' | 'source_store_duplicate_hash' | 'source_store_text_not_storable';
866
877
  /** The service run that emitted the diagnostic. */
867
878
  type WikiDiagnosticOperation = 'ingest' | 'upsertGraph' | 'librarian' | 'heal' | 'ontologyBackfill' | 'reembed' | 'importDump' | 'write' | 'supersede' | 'remember' | 'read' | 'prune' | 'externalDeletion' | 'sourceStore' | 'erase';
868
879
  /** `'auto'` when a write threshold started the run (auto-librarian / auto-heal); `'call'` when the host did. */
@@ -1534,6 +1545,13 @@ interface WikiInstructions {
1534
1545
  ingest: string;
1535
1546
  librarian: string;
1536
1547
  heal: string;
1548
+ /**
1549
+ * Template only: the run-time prompt additionally carries a TITLE CATALOG
1550
+ * of the entity's typed node titles (appended after this text, before the
1551
+ * ontology block) whenever a catalog is built — see
1552
+ * `buildTitleCatalogBlock` and the data-scope note in the ontology-backfill
1553
+ * spec Errata (PR #425).
1554
+ */
1537
1555
  ontologyBackfill: string;
1538
1556
  }
1539
1557
  type MaintenanceJob = 'librarian' | 'heal' | 'reembed' | 'externalDeletions';
@@ -3408,7 +3426,7 @@ declare class PromptService {
3408
3426
  degraded: DegradedRecord[];
3409
3427
  groundingCorpus?: string[];
3410
3428
  };
3411
- buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
3429
+ buildOntologyBackfillPrompt(facts: unknown[], runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null, titleCatalog?: string): {
3412
3430
  systemPrompt: string;
3413
3431
  userPrompt: string;
3414
3432
  };
@@ -3974,6 +3992,7 @@ declare class MaintenanceService {
3974
3992
  promptOverride?: string;
3975
3993
  batchSize?: number;
3976
3994
  classifier?: 'auto' | 'llm';
3995
+ tokenBudget?: number;
3977
3996
  }): Promise<OntologyBackfillResult>;
3978
3997
  /**
3979
3998
  * Re-embed facts, honouring per-row failure markers and exponential backoff.
@@ -4116,6 +4135,8 @@ declare class MaintenanceService {
4116
4135
  promptOverride?: string;
4117
4136
  batchSize?: number;
4118
4137
  classifier?: 'auto' | 'llm';
4138
+ tokenBudget?: number;
4139
+ meter?: UsageMeter;
4119
4140
  }): Promise<OntologyBackfillResult>;
4120
4141
  /**
4121
4142
  * Classifier-mode backfill (spec §7.3): one `choice` question per untyped
@@ -4694,6 +4715,7 @@ declare class WikiMemory {
4694
4715
  promptOverride?: string;
4695
4716
  batchSize?: number;
4696
4717
  classifier?: 'auto' | 'llm';
4718
+ tokenBudget?: number;
4697
4719
  }): Promise<OntologyBackfillResult>;
4698
4720
  runReembed(entityId?: string, opts?: {
4699
4721
  force?: boolean;
@@ -1,2 +1,2 @@
1
- export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-CTCRwhs0.mjs';
1
+ export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-BA6CedgZ.mjs';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-CTCRwhs0.js';
1
+ export { aW as EmbeddingService, aX as ImportExportService, aY as IngestionService, aZ as JobManager, aZ as JobManagerType, a_ as MaintenanceService, a$ as RetrievalService, b0 as SearchService, b0 as SearchServiceType, aI as WikiMemoryTestAccess, b1 as WriteService } from './testing-BA6CedgZ.js';
2
2
  import '@equationalapplications/core-okf';