@equationalapplications/core-llm-wiki 9.5.2 → 9.5.3

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.
@@ -6066,15 +6066,29 @@ function mergeOutcomes(a, b) {
6066
6066
  taskItems: a.taskItems + b.taskItems
6067
6067
  };
6068
6068
  }
6069
- async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch) {
6069
+ async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch, probe) {
6070
6070
  try {
6071
6071
  return await extractOnce(deps, ctx, ontologyContext, batch);
6072
6072
  } catch (err) {
6073
6073
  if (!isContextOverflowError(err)) throw err;
6074
+ if (!probe.checked) {
6075
+ probe.checked = true;
6076
+ const probePrompt = deps.promptService.buildOpsExtractPrompt(
6077
+ [{ ...batch[0], event: { ...batch[0].event, summary: "x" } }],
6078
+ ontologyContext,
6079
+ ctx.guidance
6080
+ );
6081
+ try {
6082
+ await callLlm(deps.options, { operation: "librarian", entityId: ctx.entityId, trigger: ctx.trigger, meter: ctx.meter }, probePrompt);
6083
+ } catch (e) {
6084
+ if (!isContextOverflowError(e)) throw e;
6085
+ throw new Error("ops extract: minimal-prompt probe also overflowed (fixed prompt part exceeds the model window?)");
6086
+ }
6087
+ }
6074
6088
  if (batch.length > 1) {
6075
6089
  const mid = Math.ceil(batch.length / 2);
6076
- const a = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(0, mid));
6077
- const b = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(mid));
6090
+ const a = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(0, mid), probe);
6091
+ const b = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch.slice(mid), probe);
6078
6092
  return mergeOutcomes(a, b);
6079
6093
  }
6080
6094
  const lone = batch[0];
@@ -6126,21 +6140,7 @@ async function extractWithOverflowRetry(deps, ctx, ontologyContext, batch) {
6126
6140
  }
6127
6141
  async function runExtract(deps, ctx, batch) {
6128
6142
  const ontologyContext = await deps.ontologyService?.buildPromptContext(ctx.entityId) ?? null;
6129
- const out = await extractWithOverflowRetry(deps, ctx, ontologyContext, batch);
6130
- if (out.skippedEvents > 0 && out.skippedEvents === out.batch.length) {
6131
- const probe = deps.promptService.buildOpsExtractPrompt(
6132
- [{ ...batch[0], event: { ...batch[0].event, summary: "x" } }],
6133
- ontologyContext,
6134
- ctx.guidance
6135
- );
6136
- try {
6137
- await callLlm(deps.options, { operation: "librarian", entityId: ctx.entityId, trigger: ctx.trigger, meter: void 0 }, probe);
6138
- } catch (e) {
6139
- if (!isContextOverflowError(e)) throw e;
6140
- throw new Error(`ops extract: all ${out.skippedEvents} selected events were skipped for context overflow and a minimal probe also overflowed (fixed prompt part exceeds the model window?)`);
6141
- }
6142
- }
6143
- return out;
6143
+ return extractWithOverflowRetry(deps, ctx, ontologyContext, batch, { checked: false });
6144
6144
  }
6145
6145
  async function extractOnce(deps, ctx, ontologyContext, batch) {
6146
6146
  const { entityId, trigger } = ctx;
@@ -11029,5 +11029,5 @@ var WriteService = class {
11029
11029
  };
11030
11030
 
11031
11031
  export { BaseRepository, CURRENT_SCHEMA_VERSION, CheckpointIncompleteError, DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, DEFAULT_MAX_EMBED_CHARS, 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_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, chunkText, configureRandomSource, createLegacySourceTypeIndex, createdAtValue, detectSchemaVersion, drainChunkSql, drainHiSql, edgeTripleAllowed, emitDiagnostic, emptyManifest, entityDrainChunkSql, entityDrainHiSql, entitySummaryMetaKey, extractSqliteCode, factTokenCost, fts5LedgerDropSql, fts5PendingIndexesDdl, fts5TablesDdl, fts5TriggerNames, fts5TriggersDdl, generateId, idDrainChunkSql, idReindexChunkSql, isLiveAt, isRetiredTableName, isUsableDate, isWikiSearchUnavailableError, liveAtSql, normalizeSourceHash, normalizeSourceRef, normalizeTitleKey, packFactsByBudget, parseEmbedding, parseJsonArray, parseJsonObject, parseStoredSourcePointer, passageFtsTablesDdl, passageFtsTriggerNames, passageFtsTriggersDdl, probePendingWork, readRebuildProgress, reanchorRebuildFingerprint, resolveEdgeDefinitions, resolveGrounding, resolveLibrarianStrategy, resolveNodeType, retiredTableName, runSourceRefNormalize, safeSlice, serializeSourcePointer, setupDatabase, sweepChunkSql, sweepHiSql, typeSatisfies, validUsage, validateInlineEdges, validateManifest, validateSourcePointerValue, warnChangedDefaultsOnce, windowChunkSql, windowHiSql, writeNormalizeStamp, writeRebuildStart };
11032
- //# sourceMappingURL=chunk-7HJXGKQO.mjs.map
11033
- //# sourceMappingURL=chunk-7HJXGKQO.mjs.map
11032
+ //# sourceMappingURL=chunk-QIS2SGUM.mjs.map
11033
+ //# sourceMappingURL=chunk-QIS2SGUM.mjs.map