@semiont/make-meaning 0.5.8 → 0.5.10
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/index.d.ts +34 -29
- package/dist/index.js +472 -455
- package/dist/index.js.map +1 -1
- package/dist/smelter-main.js +26 -12
- package/dist/smelter-main.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { JobQueue } from '@semiont/jobs';
|
|
2
2
|
import { SemiontProject } from '@semiont/core/node';
|
|
3
|
-
import { GraphServiceConfig, VectorsServiceConfig, EmbeddingServiceConfig, EventBus, Logger, StoredEvent, ResourceId, ResourceDescriptor, AnnotationId, components, ITransport, BaseUrl, ConnectionState, SemiontError, UserDID, EventMap, IContentTransport, PutBinaryRequest, PutBinaryOptions, AccessToken, Annotation, UserId, ResourceAnnotations, AnnotationCategory, GraphPath, GraphConnection } from '@semiont/core';
|
|
3
|
+
import { GraphServiceConfig, VectorsServiceConfig, EmbeddingServiceConfig, EventBus, Logger, StoredEvent, ResourceId, ResourceDescriptor, AnnotationId, components, ITransport, BaseUrl, ConnectionState, SemiontError, UserDID, EventMap, IContentTransport, PutBinaryRequest, PutBinaryOptions, AccessToken, StateUnit, BusRequestPrimitive, Annotation, UserId, GatheredContext, ResourceAnnotations, AnnotationCategory, GraphPath, GraphConnection } from '@semiont/core';
|
|
4
4
|
import { EventStore, ViewStorage } from '@semiont/event-sourcing';
|
|
5
5
|
import { WorkingTreeStore } from '@semiont/content';
|
|
6
6
|
import { GraphDatabase } from '@semiont/graph';
|
|
7
7
|
import { VectorStore, EmbeddingProvider, ChunkingConfig } from '@semiont/vectors';
|
|
8
8
|
import { InferenceClient } from '@semiont/inference';
|
|
9
9
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
10
|
-
import {
|
|
10
|
+
import { WorkerBus } from '@semiont/sdk';
|
|
11
11
|
import { Writable, Readable } from 'node:stream';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -847,6 +847,16 @@ declare class Smelter {
|
|
|
847
847
|
* or is empty — callers skip it.
|
|
848
848
|
*/
|
|
849
849
|
private fetchEmbeddableText;
|
|
850
|
+
/**
|
|
851
|
+
* Read a resource's current entity types from the materialized view — the
|
|
852
|
+
* authoritative source, updated before the EventBus fires to consumers — so
|
|
853
|
+
* its vectors carry the discriminator `searchResources` filters on (e.g.
|
|
854
|
+
* exclude `['Question']`). One read on every embed path, mirroring how the
|
|
855
|
+
* smelter already reads current content and annotations; a failed read
|
|
856
|
+
* propagates to the pipeline's per-resource error handler (reconcile heals),
|
|
857
|
+
* rather than silently stamping `[]` and letting the resource leak into recall.
|
|
858
|
+
*/
|
|
859
|
+
private resolveEntityTypes;
|
|
850
860
|
private embedResource;
|
|
851
861
|
private handleResourceArchived;
|
|
852
862
|
private handleAnnotationAdded;
|
|
@@ -1237,8 +1247,6 @@ declare class ResourceContext {
|
|
|
1237
1247
|
* - Generating AI summaries
|
|
1238
1248
|
*/
|
|
1239
1249
|
|
|
1240
|
-
type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
|
|
1241
|
-
|
|
1242
1250
|
type AnnotationContextResponse = components['schemas']['AnnotationContextResponse'];
|
|
1243
1251
|
type ContextualSummaryResponse = components['schemas']['ContextualSummaryResponse'];
|
|
1244
1252
|
interface BuildContextOptions {
|
|
@@ -1258,7 +1266,7 @@ declare class AnnotationContext {
|
|
|
1258
1266
|
* @returns Rich context for LLM processing
|
|
1259
1267
|
* @throws Error if annotation or resource not found
|
|
1260
1268
|
*/
|
|
1261
|
-
static buildLLMContext(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, options?: BuildContextOptions, inferenceClient?: InferenceClient, logger?: Logger, embeddingProvider?: EmbeddingProvider): Promise<
|
|
1269
|
+
static buildLLMContext(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, options?: BuildContextOptions, inferenceClient?: InferenceClient, logger?: Logger, embeddingProvider?: EmbeddingProvider): Promise<GatheredContext>;
|
|
1262
1270
|
/**
|
|
1263
1271
|
* Get resource annotations from view storage (fast path)
|
|
1264
1272
|
* Throws if view missing
|
|
@@ -1332,24 +1340,7 @@ declare class AnnotationContext {
|
|
|
1332
1340
|
* All methods require graph traversal - must use graph database.
|
|
1333
1341
|
*/
|
|
1334
1342
|
|
|
1335
|
-
|
|
1336
|
-
id: string;
|
|
1337
|
-
type: string;
|
|
1338
|
-
label: string;
|
|
1339
|
-
metadata: {
|
|
1340
|
-
entityTypes: string[];
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
interface GraphEdge {
|
|
1344
|
-
source: string;
|
|
1345
|
-
target: string;
|
|
1346
|
-
type: string;
|
|
1347
|
-
metadata: Record<string, unknown>;
|
|
1348
|
-
}
|
|
1349
|
-
interface GraphRepresentation {
|
|
1350
|
-
nodes: GraphNode[];
|
|
1351
|
-
edges: GraphEdge[];
|
|
1352
|
-
}
|
|
1343
|
+
type KnowledgeGraph = components['schemas']['KnowledgeGraph'];
|
|
1353
1344
|
declare class GraphContext {
|
|
1354
1345
|
/**
|
|
1355
1346
|
* Get all resources referencing this resource (backlinks)
|
|
@@ -1372,10 +1363,20 @@ declare class GraphContext {
|
|
|
1372
1363
|
*/
|
|
1373
1364
|
static searchResources(query: string, kb: KnowledgeBase, limit?: number): Promise<ResourceDescriptor[]>;
|
|
1374
1365
|
/**
|
|
1375
|
-
* Build
|
|
1376
|
-
*
|
|
1366
|
+
* Build the unified knowledge graph for a resource's neighborhood:
|
|
1367
|
+
* resources AND annotations as typed nodes, typed/directional edges.
|
|
1368
|
+
*
|
|
1369
|
+
* This is the single graph builder (CONTEXT-UNIFICATION D3) — both the
|
|
1370
|
+
* matcher (ranking) and the resource/viz path consume it. The flattened
|
|
1371
|
+
* signals the matcher reads today (`connections`, `citedBy`/count,
|
|
1372
|
+
* `siblingEntityTypes`, `bidirectional`) are all derivable from this:
|
|
1373
|
+
* - peer connections → resource nodes + main→peer edges carrying `bidirectional`
|
|
1374
|
+
* - inbound citations → citing-resource nodes + `citation` edges (citing→main),
|
|
1375
|
+
* so citedByCount = inbound citation-edge count
|
|
1376
|
+
* - annotations on the resource → `annotation` nodes + `annotation-of` edges,
|
|
1377
|
+
* so siblingEntityTypes = union of those nodes' entityTypes
|
|
1377
1378
|
*/
|
|
1378
|
-
static
|
|
1379
|
+
static buildKnowledgeGraph(resourceId: ResourceId, kb: KnowledgeBase): Promise<KnowledgeGraph>;
|
|
1379
1380
|
}
|
|
1380
1381
|
|
|
1381
1382
|
/**
|
|
@@ -1385,19 +1386,23 @@ declare class GraphContext {
|
|
|
1385
1386
|
* Orchestrates: ResourceContext, GraphContext, AnnotationContext, and generation functions
|
|
1386
1387
|
*/
|
|
1387
1388
|
|
|
1388
|
-
type ResourceLLMContextResponse = components['schemas']['ResourceLLMContextResponse'];
|
|
1389
1389
|
interface LLMContextOptions {
|
|
1390
1390
|
depth: number;
|
|
1391
1391
|
maxResources: number;
|
|
1392
1392
|
includeContent: boolean;
|
|
1393
1393
|
includeSummary: boolean;
|
|
1394
|
+
/**
|
|
1395
|
+
* Entity types to exclude from the resource-gather semantic recall
|
|
1396
|
+
* (caller-supplied; e.g. ['Question']). Optional; default none.
|
|
1397
|
+
*/
|
|
1398
|
+
excludeEntityTypes?: string[];
|
|
1394
1399
|
}
|
|
1395
1400
|
declare class LLMContext {
|
|
1396
1401
|
/**
|
|
1397
1402
|
* Get comprehensive LLM context for a resource
|
|
1398
1403
|
* Includes: main resource, related resources, annotations, graph, content, summary, references
|
|
1399
1404
|
*/
|
|
1400
|
-
static getResourceContext(resourceId: ResourceId, options: LLMContextOptions, kb: KnowledgeBase, inferenceClient: InferenceClient): Promise<
|
|
1405
|
+
static getResourceContext(resourceId: ResourceId, options: LLMContextOptions, kb: KnowledgeBase, inferenceClient: InferenceClient): Promise<GatheredContext>;
|
|
1401
1406
|
}
|
|
1402
1407
|
|
|
1403
1408
|
/**
|
|
@@ -1421,4 +1426,4 @@ declare function generateResourceSummary(resourceName: string, content: string,
|
|
|
1421
1426
|
declare function generateReferenceSuggestions(referenceTitle: string, client: InferenceClient, entityType?: string, currentContent?: string): Promise<string[] | null>;
|
|
1422
1427
|
|
|
1423
1428
|
export { AnnotationContext, AnnotationOperations, BACKUP_FORMAT, Browser, CloneTokenManager, FORMAT_VERSION, Gatherer$1 as Gatherer, GraphContext, LLMContext, LocalContentTransport, LocalTransport, Matcher, ResourceContext, ResourceOperations, Smelter, Stower, bootstrapEntityTypes, createKnowledgeBase, createSmelterActorStateUnit, exportBackup, exportLinkedData, generateReferenceSuggestions, generateResourceSummary, importBackup, importLinkedData, isBackupManifest, readEntityTypesProjection, registerAnnotationAssemblyHandler, registerAnnotationLookupHandlers, registerBindUpdateBodyHandler, registerBusHandlers, registerJobCommandHandlers, startMakeMeaning, stopKnowledgeSystem, validateManifestVersion };
|
|
1424
|
-
export type { BackupContentReader, BackupEventStoreReader, BackupExporterOptions, BackupImportResult, BackupImporterOptions, BackupManifestHeader, BackupStreamSummary, BuildContextOptions, ContentBlobResolver, CreateAnnotationResult, CreateResourceInput, CreateResourceResult,
|
|
1429
|
+
export type { BackupContentReader, BackupEventStoreReader, BackupExporterOptions, BackupImportResult, BackupImporterOptions, BackupManifestHeader, BackupStreamSummary, BuildContextOptions, ContentBlobResolver, CreateAnnotationResult, CreateResourceInput, CreateResourceResult, KnowledgeBase, KnowledgeSystem, LLMContextOptions, LinkedDataContentReader, LinkedDataExporterOptions, LinkedDataImportResult, LinkedDataImporterOptions, LinkedDataViewReader, ListResourcesFilters, LocalTransportConfig, MakeMeaningConfig, MakeMeaningService, ReconcileState, ReconcileSummary, ReplayStats, SmelterActorStateUnit, SmelterActorStateUnitOptions, SmelterEvent, SmelterInput, SmelterTiming, SmelterWorkItem, UpdateAnnotationBodyResult };
|