@equationalapplications/core-llm-wiki 5.5.0 → 5.5.1
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/README.md +133 -0
- package/dist/{chunk-QVY5DFJV.mjs → chunk-JQRA6BYQ.mjs} +79 -12
- package/dist/chunk-JQRA6BYQ.mjs.map +1 -0
- package/dist/index.js +77 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/testing.js +77 -10
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-QVY5DFJV.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, generateId, BaseRepository, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, normalizeTitleKey, WikiTransactionError, extractSqliteCode } from './chunk-
|
|
2
|
-
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, HEAL_BATCH_SIZE, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDuplicateHashError, WikiIngestEmptyError, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-
|
|
1
|
+
import { __privateAdd, MetadataRepository, EmbeddingService, SearchService, JobManager, PromptService, IngestionService, MaintenanceService, ImportExportService, RetrievalService, WriteService, __privateGet, __privateSet, normalizeSourceRef, normalizeSourceHash, entitySummaryMetaKey, WikiSourceRefHashCollision, generateId, BaseRepository, emptyManifest, resolveNodeType, WikiStrictOntologyViolation, validateInlineEdges, resolveEdgeDefinitions, normalizeTitleKey, WikiTransactionError, extractSqliteCode } from './chunk-JQRA6BYQ.mjs';
|
|
2
|
+
export { DEFAULT_CHUNK_OVERLAP, DEFAULT_MAX_CHUNK_LENGTH, HEAL_BATCH_SIZE, HEAL_RECHECK_MS, HOOK_TIMEOUT_MARKER, ONTOLOGY_BACKFILL_BATCH_SIZE, ONTOLOGY_BACKFILL_MAX_PROMPT_CHARS, ONTOLOGY_BACKFILL_RECHECK_MS, ONTOLOGY_BACKFILL_SYSTEM_PROMPT, PromptService, PrunePartialFailureError, WikiBusyError, WikiDuplicateHashError, WikiIngestEmptyError, WikiParseError, WikiSourceRefHashCollision, WikiStrictOntologyViolation, WikiTransactionError, chunkText, configureRandomSource, parseEmbedding, safeSlice, validateManifest } from './chunk-JQRA6BYQ.mjs';
|
|
3
3
|
import { appendRelatedSection, buildConceptDocument, buildLogMd, buildEntityIndexMd, buildRootIndexMd, isAllowedOkfPath, parseRootIndexMd, parseEntityIndexMd, parseConcept, splitRelatedSection, extractMarkdownLinks, parseLogMd, parseEventIdComment, latestVerified, formatSourcesJson, appendEventIdComment, parseVerifiedFlexible, parseCitationsList, deriveTrustTier, isStaleAfter } from '@equationalapplications/core-okf';
|
|
4
4
|
|
|
5
5
|
// src/db/schema.ts
|
package/dist/testing.js
CHANGED
|
@@ -387,7 +387,12 @@ function extractParsePosition(err) {
|
|
|
387
387
|
return match ? Number(match[1]) : null;
|
|
388
388
|
}
|
|
389
389
|
function safeErrorToString(e) {
|
|
390
|
-
|
|
390
|
+
let isErrorLike = false;
|
|
391
|
+
try {
|
|
392
|
+
isErrorLike = e instanceof Error;
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
395
|
+
if (isErrorLike) {
|
|
391
396
|
const msg = readErrorField(e, "message");
|
|
392
397
|
if (typeof msg === "string" && msg.length > 0) return msg;
|
|
393
398
|
const name = readErrorField(e, "name");
|
|
@@ -412,16 +417,54 @@ function readErrorField(e, key) {
|
|
|
412
417
|
}
|
|
413
418
|
}
|
|
414
419
|
function sanitizeRankerError(err, sanitizeRankerErrors) {
|
|
420
|
+
let isErrorLike = false;
|
|
421
|
+
try {
|
|
422
|
+
isErrorLike = err instanceof Error;
|
|
423
|
+
} catch {
|
|
424
|
+
}
|
|
415
425
|
if (sanitizeRankerErrors === false) {
|
|
416
|
-
return
|
|
426
|
+
return isErrorLike ? err : new Error(safeErrorToString(err));
|
|
427
|
+
}
|
|
428
|
+
let errLike = null;
|
|
429
|
+
if (isErrorLike) errLike = err;
|
|
430
|
+
let typeName;
|
|
431
|
+
try {
|
|
432
|
+
if (errLike) {
|
|
433
|
+
const rawName = errLike.constructor?.name;
|
|
434
|
+
typeName = typeof rawName === "string" ? rawName : "Error";
|
|
435
|
+
} else {
|
|
436
|
+
typeName = typeof err;
|
|
437
|
+
}
|
|
438
|
+
} catch {
|
|
439
|
+
typeName = isErrorLike ? "Error" : typeof err;
|
|
440
|
+
}
|
|
441
|
+
let innerCause;
|
|
442
|
+
if (errLike) {
|
|
443
|
+
let cause;
|
|
444
|
+
try {
|
|
445
|
+
cause = errLike.cause;
|
|
446
|
+
} catch {
|
|
447
|
+
cause = void 0;
|
|
448
|
+
}
|
|
449
|
+
if (cause !== void 0) {
|
|
450
|
+
let causeName;
|
|
451
|
+
try {
|
|
452
|
+
const rawCauseName = cause?.constructor?.name;
|
|
453
|
+
causeName = typeof rawCauseName === "string" ? rawCauseName : typeof cause;
|
|
454
|
+
} catch {
|
|
455
|
+
causeName = typeof cause;
|
|
456
|
+
}
|
|
457
|
+
innerCause = new Error(`Caused by: ${causeName}`);
|
|
458
|
+
}
|
|
417
459
|
}
|
|
418
|
-
const typeName = err instanceof Error ? err.constructor?.name ?? "Error" : typeof err;
|
|
419
|
-
const innerCause = err instanceof Error && err.cause !== void 0 ? new Error(`Caused by: ${err.cause?.constructor?.name ?? typeof err.cause}`) : void 0;
|
|
420
460
|
const sanitized = new Error(
|
|
421
461
|
`VectorRanker ${typeName} (message scrubbed for security)`,
|
|
422
462
|
innerCause ? { cause: innerCause } : void 0
|
|
423
463
|
);
|
|
424
|
-
|
|
464
|
+
try {
|
|
465
|
+
sanitized.name = typeName;
|
|
466
|
+
} catch {
|
|
467
|
+
}
|
|
425
468
|
return sanitized;
|
|
426
469
|
}
|
|
427
470
|
function safeSlice(value, start, end) {
|
|
@@ -1843,7 +1886,12 @@ var TRUNCATION_PATTERNS = [
|
|
|
1843
1886
|
];
|
|
1844
1887
|
var EXCEEDS_LIMIT_PATTERN = /exceed[a-z]*[^.]{0,40}\b(model|context)?[ _-]?limit/i;
|
|
1845
1888
|
function isTruncationError(err) {
|
|
1846
|
-
|
|
1889
|
+
let message;
|
|
1890
|
+
try {
|
|
1891
|
+
message = err instanceof Error ? err.message : String(err ?? "");
|
|
1892
|
+
} catch {
|
|
1893
|
+
return false;
|
|
1894
|
+
}
|
|
1847
1895
|
if (EXCEEDS_LIMIT_PATTERN.test(message)) return false;
|
|
1848
1896
|
return TRUNCATION_PATTERNS.some((pattern) => pattern.test(message));
|
|
1849
1897
|
}
|
|
@@ -1950,7 +1998,12 @@ var HEAL_RECHECK_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
|
1950
1998
|
var SKIP_ERROR_LOG_CHARS = 4096;
|
|
1951
1999
|
var formatSkipError = (err) => {
|
|
1952
2000
|
let base;
|
|
1953
|
-
|
|
2001
|
+
let isErrorLike = false;
|
|
2002
|
+
try {
|
|
2003
|
+
isErrorLike = err instanceof Error;
|
|
2004
|
+
} catch {
|
|
2005
|
+
}
|
|
2006
|
+
if (isErrorLike || typeof err !== "object" && typeof err !== "function") {
|
|
1954
2007
|
base = safeErrorToString(err);
|
|
1955
2008
|
} else {
|
|
1956
2009
|
try {
|
|
@@ -3043,7 +3096,12 @@ var RetrievalService = class {
|
|
|
3043
3096
|
}
|
|
3044
3097
|
}
|
|
3045
3098
|
} catch (rankerErr) {
|
|
3046
|
-
|
|
3099
|
+
let isErrorLike = false;
|
|
3100
|
+
try {
|
|
3101
|
+
isErrorLike = rankerErr instanceof Error;
|
|
3102
|
+
} catch {
|
|
3103
|
+
}
|
|
3104
|
+
const rankerError = isErrorLike ? rankerErr : new Error(safeErrorToString(rankerErr));
|
|
3047
3105
|
const policy = this.options.vectorRankerFallback ?? "js-cosine";
|
|
3048
3106
|
this.options.onVectorRankerFallback?.({
|
|
3049
3107
|
error: this._sanitizeRankerError(rankerError),
|
|
@@ -3155,12 +3213,21 @@ var RetrievalService = class {
|
|
|
3155
3213
|
}
|
|
3156
3214
|
}
|
|
3157
3215
|
} catch (err) {
|
|
3158
|
-
|
|
3216
|
+
let isErrorLike = false;
|
|
3217
|
+
try {
|
|
3218
|
+
isErrorLike = err instanceof Error;
|
|
3219
|
+
} catch {
|
|
3220
|
+
}
|
|
3221
|
+
const error = isErrorLike ? err : new Error(safeErrorToString(err));
|
|
3159
3222
|
if (rankerShouldRethrow) {
|
|
3160
3223
|
throw error;
|
|
3161
3224
|
}
|
|
3162
3225
|
if (pendingRankerFallbackError) {
|
|
3163
|
-
|
|
3226
|
+
try {
|
|
3227
|
+
error.cause = pendingRankerFallbackError;
|
|
3228
|
+
} catch {
|
|
3229
|
+
this.options.onRetrievalFallback?.(pendingRankerFallbackError);
|
|
3230
|
+
}
|
|
3164
3231
|
pendingRankerFallbackError = void 0;
|
|
3165
3232
|
}
|
|
3166
3233
|
this.options.onRetrievalFallback?.(error);
|