@equationalapplications/core-llm-wiki 7.11.0 → 7.11.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.
@@ -2612,6 +2612,8 @@ declare class PromptService {
2612
2612
  private appendGrounding;
2613
2613
  private hydrate;
2614
2614
  private hasOntologyPlaceholders;
2615
+ /** Removes ontology placeholders until none remain, so a nested form cannot reassemble one (closes CodeQL #11). */
2616
+ private stripOntologyPlaceholders;
2615
2617
  private buildSystemPrompt;
2616
2618
  private appendOntology;
2617
2619
  buildIngestPrompt(documentChunk: string, runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
@@ -2612,6 +2612,8 @@ declare class PromptService {
2612
2612
  private appendGrounding;
2613
2613
  private hydrate;
2614
2614
  private hasOntologyPlaceholders;
2615
+ /** Removes ontology placeholders until none remain, so a nested form cannot reassemble one (closes CodeQL #11). */
2616
+ private stripOntologyPlaceholders;
2615
2617
  private buildSystemPrompt;
2616
2618
  private appendOntology;
2617
2619
  buildIngestPrompt(documentChunk: string, runtimeOverride?: string, ontologyContext?: OntologyPromptContext | null): {
@@ -1,2 +1,2 @@
1
- export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-C-WsBxLh.mjs';
1
+ export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-B0UtFCq1.mjs';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-C-WsBxLh.js';
1
+ export { aB as EmbeddingService, aC as ImportExportService, aD as IngestionService, aE as JobManager, aE as JobManagerType, aF as MaintenanceService, aG as RetrievalService, aH as SearchService, aH as SearchServiceType, ar as WikiMemoryTestAccess, aI as WriteService } from './testing-B0UtFCq1.js';
2
2
  import '@equationalapplications/core-okf';
package/dist/testing.js CHANGED
@@ -1709,12 +1709,24 @@ ${groundingEvidenceBlock(writer, cfg)}` : systemPrompt;
1709
1709
  hasOntologyPlaceholders(template) {
1710
1710
  return /\{\{\s*ontology(?:Manifest|ModeInstructions)\s*\}\}/.test(template);
1711
1711
  }
1712
+ /** Removes ontology placeholders until none remain, so a nested form cannot reassemble one (closes CodeQL #11). */
1713
+ stripOntologyPlaceholders(template) {
1714
+ let out = template;
1715
+ let prev;
1716
+ do {
1717
+ prev = out;
1718
+ out = out.replace(/\{\{\s*ontology(?:Manifest|ModeInstructions)\s*\}\}/g, "");
1719
+ } while (out !== prev);
1720
+ return out;
1721
+ }
1712
1722
  buildSystemPrompt(template, variables, ontologyContext) {
1723
+ const hasOntologyPlaceholders = this.hasOntologyPlaceholders(template);
1724
+ const effective = hasOntologyPlaceholders && ontologyContext == null ? this.stripOntologyPlaceholders(template) : template;
1713
1725
  const shouldHydrate = Object.keys(variables).some(
1714
- (key) => new RegExp(`\\{\\{\\s*${key}\\s*\\}\\}`).test(template)
1715
- ) || ontologyContext != null && this.hasOntologyPlaceholders(template);
1716
- const hydrated = shouldHydrate ? this.hydrate(template, { ...variables, ...ontologyContext ?? {} }) : template;
1717
- return this.hasOntologyPlaceholders(template) ? ontologyContext != null ? hydrated : hydrated.replace(/\{\{\s*ontology(?:Manifest|ModeInstructions)\s*\}\}/g, "") : this.appendOntology(hydrated, ontologyContext);
1726
+ (key) => new RegExp(`\\{\\{\\s*${key}\\s*\\}\\}`).test(effective)
1727
+ ) || ontologyContext != null && hasOntologyPlaceholders;
1728
+ const hydrated = shouldHydrate ? this.hydrate(effective, { ...variables, ...ontologyContext ?? {} }) : effective;
1729
+ return hasOntologyPlaceholders ? hydrated : this.appendOntology(hydrated, ontologyContext);
1718
1730
  }
1719
1731
  appendOntology(systemPrompt, ctx) {
1720
1732
  if (!ctx) return systemPrompt;