@semiont/make-meaning 0.4.14 → 0.4.15
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 +4 -4
- package/dist/index.d.ts +34 -24
- package/dist/index.js +441 -482
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,12 +14,12 @@ This package implements the actor model from [ARCHITECTURE.md](../../docs/ARCHIT
|
|
|
14
14
|
- **Browser** (read) — handles all KB read queries: resources, annotations, events, annotation history, referenced-by lookups, entity type listing, and directory browse (merging filesystem listings with KB metadata)
|
|
15
15
|
- **Gatherer** (context assembly) — assembles gathered context for annotations (`gather:requested`) and resources (`gather:resource-requested`); searches vectors for semantically similar passages (adds `semanticContext` to `GatheredContext`)
|
|
16
16
|
- **Matcher** (search/link) — context-driven candidate search with multi-source retrieval, composite structural scoring, and optional LLM semantic scoring
|
|
17
|
-
- **Smelter** (embed) — subscribes to resource/annotation events, chunks text, embeds via `@semiont/vectors`,
|
|
17
|
+
- **Smelter** (embed) — subscribes to resource/annotation events, chunks text, embeds via `@semiont/vectors`, emits `embedding:compute` commands (persisted by Stower as `embedding:computed` events), and indexes into vector store (Qdrant)
|
|
18
18
|
- **CloneTokenManager** (yield) — manages clone token lifecycle for resource cloning
|
|
19
19
|
|
|
20
20
|
All actors subscribe to the EventBus via RxJS pipelines. They expose only `initialize()` and `stop()` — no public business methods. Callers communicate with actors by putting events on the bus.
|
|
21
21
|
|
|
22
|
-
The EventBus is a **complete interface** for all knowledge-domain operations. HTTP routes in the backend are thin wrappers that delegate to EventBus actors. The
|
|
22
|
+
The EventBus is a **complete interface** for all knowledge-domain operations. HTTP routes in the backend are thin wrappers that delegate to EventBus actors. The `@semiont/api-client` exposes the same operations via verb-oriented namespaces (`semiont.browse`, `semiont.mark`, `semiont.gather`, etc.).
|
|
23
23
|
|
|
24
24
|
## Quick Start
|
|
25
25
|
|
|
@@ -93,7 +93,7 @@ All meaningful actions flow through the EventBus. The KB actors are reactive —
|
|
|
93
93
|
graph TB
|
|
94
94
|
Routes["Backend Routes"] -->|commands| BUS["Event Bus"]
|
|
95
95
|
Workers["Job Workers"] -->|commands| BUS
|
|
96
|
-
EBC["
|
|
96
|
+
EBC["SemiontApiClient"] -->|commands| BUS
|
|
97
97
|
|
|
98
98
|
subgraph ks ["Knowledge System"]
|
|
99
99
|
STOWER["Stower<br/>(write)"]
|
|
@@ -126,7 +126,7 @@ graph TB
|
|
|
126
126
|
BROWSER -->|"browse:resource-result, browse:resources-result<br/>browse:annotations-result, browse:annotation-result<br/>browse:events-result, browse:annotation-history-result<br/>browse:referenced-by-result, browse:entity-types-result<br/>browse:directory-result"| BUS
|
|
127
127
|
GATHERER -->|"gather:complete, gather:failed<br/>gather:resource-complete, gather:resource-failed"| BUS
|
|
128
128
|
MATCHER -->|"match:search-results, match:search-failed"| BUS
|
|
129
|
-
SMELTER -->|"embedding:
|
|
129
|
+
SMELTER -->|"embedding:compute,<br/>embedding:delete"| BUS
|
|
130
130
|
CTM -->|"yield:clone-token-generated<br/>yield:clone-resource-result<br/>yield:clone-created"| BUS
|
|
131
131
|
|
|
132
132
|
classDef bus fill:#e8a838,stroke:#b07818,stroke-width:3px,color:#000,font-weight:bold
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JobQueue, ReferenceAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, AssessmentAnnotationWorker, CommentAnnotationWorker, TagAnnotationWorker } from '@semiont/jobs';
|
|
2
2
|
import { SemiontProject } from '@semiont/core/node';
|
|
3
|
-
import { GraphServiceConfig, VectorsServiceConfig, EmbeddingServiceConfig, Logger, StoredEvent, ResourceId,
|
|
3
|
+
import { GraphServiceConfig, VectorsServiceConfig, EmbeddingServiceConfig, EventBus, Logger, StoredEvent, ResourceId, components, AnnotationId, UserId, CreationMethod, ResourceAnnotations, AnnotationCategory, GraphPath, GraphConnection } from '@semiont/core';
|
|
4
4
|
export { AssembledAnnotation, applyBodyOperations, assembleAnnotation } from '@semiont/core';
|
|
5
5
|
import { EventStore, ViewStorage } from '@semiont/event-sourcing';
|
|
6
6
|
import { WorkingTreeStore } from '@semiont/content';
|
|
@@ -77,16 +77,17 @@ interface MakeMeaningConfig {
|
|
|
77
77
|
declare class GraphDBConsumer {
|
|
78
78
|
private eventStore;
|
|
79
79
|
private graphDb;
|
|
80
|
+
private coreEventBus;
|
|
80
81
|
private static readonly GRAPH_RELEVANT_EVENTS;
|
|
81
82
|
private static readonly BURST_WINDOW_MS;
|
|
82
83
|
private static readonly MAX_BATCH_SIZE;
|
|
83
84
|
private static readonly IDLE_TIMEOUT_MS;
|
|
84
|
-
private
|
|
85
|
+
private _globalSubscriptions;
|
|
85
86
|
private eventSubject;
|
|
86
87
|
private pipelineSubscription;
|
|
87
88
|
private lastProcessed;
|
|
88
89
|
private readonly logger;
|
|
89
|
-
constructor(eventStore: EventStore, graphDb: GraphDatabase, logger: Logger);
|
|
90
|
+
constructor(eventStore: EventStore, graphDb: GraphDatabase, coreEventBus: EventBus, logger: Logger);
|
|
90
91
|
initialize(): Promise<void>;
|
|
91
92
|
/**
|
|
92
93
|
* Subscribe globally to ALL events, pre-filter to graph-relevant types,
|
|
@@ -172,7 +173,7 @@ declare class Smelter {
|
|
|
172
173
|
private static readonly BURST_WINDOW_MS;
|
|
173
174
|
private static readonly MAX_BATCH_SIZE;
|
|
174
175
|
private static readonly IDLE_TIMEOUT_MS;
|
|
175
|
-
private
|
|
176
|
+
private _globalSubscriptions;
|
|
176
177
|
private eventSubject;
|
|
177
178
|
private pipelineSubscription;
|
|
178
179
|
private readonly logger;
|
|
@@ -182,7 +183,7 @@ declare class Smelter {
|
|
|
182
183
|
stop(): Promise<void>;
|
|
183
184
|
/**
|
|
184
185
|
* Rebuild the vector store from persisted embedding events in the event log.
|
|
185
|
-
* Reads all embedding
|
|
186
|
+
* Reads all embedding:computed / embedding:deleted events and replays them.
|
|
186
187
|
* Bypasses the live pipeline — reads directly from the event store.
|
|
187
188
|
*/
|
|
188
189
|
rebuildAll(): Promise<void>;
|
|
@@ -241,11 +242,10 @@ interface KnowledgeBase {
|
|
|
241
242
|
interface CreateKnowledgeBaseOptions {
|
|
242
243
|
vectorStore?: VectorStore;
|
|
243
244
|
embeddingProvider?: EmbeddingProvider;
|
|
244
|
-
eventBus?: EventBus;
|
|
245
245
|
chunkingConfig?: ChunkingConfig;
|
|
246
246
|
skipRebuild?: boolean;
|
|
247
247
|
}
|
|
248
|
-
declare function createKnowledgeBase(eventStore: EventStore, project: SemiontProject, graphDb: GraphDatabase, logger: Logger, options?: CreateKnowledgeBaseOptions): Promise<KnowledgeBase>;
|
|
248
|
+
declare function createKnowledgeBase(eventStore: EventStore, project: SemiontProject, graphDb: GraphDatabase, eventBus: EventBus, logger: Logger, options?: CreateKnowledgeBaseOptions): Promise<KnowledgeBase>;
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
251
|
* Stower Actor
|
|
@@ -277,8 +277,8 @@ declare function createKnowledgeBase(eventStore: EventStore, project: SemiontPro
|
|
|
277
277
|
* - job:report-progress → job.progress
|
|
278
278
|
* - job:complete → job.completed
|
|
279
279
|
* - job:fail → job.failed
|
|
280
|
-
* - embedding:
|
|
281
|
-
* - embedding:
|
|
280
|
+
* - embedding:compute → embedding.computed (from Smelter)
|
|
281
|
+
* - embedding:delete → embedding.deleted (from Smelter)
|
|
282
282
|
*/
|
|
283
283
|
|
|
284
284
|
type ResourceDescriptor$3 = components['schemas']['ResourceDescriptor'];
|
|
@@ -522,22 +522,29 @@ declare function startMakeMeaning(project: SemiontProject, config: MakeMeaningCo
|
|
|
522
522
|
}): Promise<MakeMeaningService>;
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
|
-
* Entity Types Bootstrap
|
|
525
|
+
* Entity Types Bootstrap
|
|
526
526
|
*
|
|
527
|
-
* On startup,
|
|
528
|
-
*
|
|
529
|
-
*
|
|
527
|
+
* On startup, seeds the KB with DEFAULT_ENTITY_TYPES by emitting
|
|
528
|
+
* mark:add-entity-type for each missing type. Reads the __system__ event
|
|
529
|
+
* stream (the durable source of truth in .semiont/events/) to determine
|
|
530
|
+
* which types already exist.
|
|
531
|
+
*
|
|
532
|
+
* Idempotent: safe to call on every startup. Only emits events for types
|
|
533
|
+
* not already in the log.
|
|
534
|
+
*
|
|
535
|
+
* Future: evolve toward a migration-based model where a `system:bootstrapped`
|
|
536
|
+
* sentinel event records that first-time init completed, and `system:migrated`
|
|
537
|
+
* events record schema version upgrades (e.g., adding new default entity types
|
|
538
|
+
* in a future release). For now, scanning the small __system__ stream is simple
|
|
539
|
+
* and correct.
|
|
530
540
|
*/
|
|
531
541
|
|
|
532
542
|
/**
|
|
533
|
-
* Bootstrap entity types
|
|
534
|
-
*
|
|
535
|
-
|
|
536
|
-
declare function bootstrapEntityTypes(eventBus: EventBus, project: SemiontProject, logger?: Logger): Promise<void>;
|
|
537
|
-
/**
|
|
538
|
-
* Reset the bootstrap flag (used for testing)
|
|
543
|
+
* Bootstrap entity types if any are missing from the event log.
|
|
544
|
+
* Reads the __system__ stream to find existing mark:entity-type-added events,
|
|
545
|
+
* then emits only the missing ones.
|
|
539
546
|
*/
|
|
540
|
-
declare function
|
|
547
|
+
declare function bootstrapEntityTypes(eventBus: EventBus, eventStore: EventStore, logger?: Logger): Promise<void>;
|
|
541
548
|
|
|
542
549
|
/**
|
|
543
550
|
* Entity Types Projection Reader
|
|
@@ -640,7 +647,7 @@ declare function exportBackup(options: BackupExporterOptions, output: Writable):
|
|
|
640
647
|
*
|
|
641
648
|
* Replays parsed JSONL event streams through the EventBus.
|
|
642
649
|
* Each domain event is translated to the corresponding command event
|
|
643
|
-
* (e.g.
|
|
650
|
+
* (e.g. yield:created → yield:create), emitted, and the result
|
|
644
651
|
* event is awaited before proceeding (backpressure).
|
|
645
652
|
*
|
|
646
653
|
* Content blobs are resolved lazily via a lookup function so that
|
|
@@ -674,6 +681,7 @@ interface ReplayStats {
|
|
|
674
681
|
|
|
675
682
|
interface BackupImporterOptions {
|
|
676
683
|
eventBus: EventBus;
|
|
684
|
+
contentStore: WorkingTreeStore;
|
|
677
685
|
logger?: Logger;
|
|
678
686
|
}
|
|
679
687
|
interface BackupImportResult {
|
|
@@ -749,6 +757,7 @@ declare function exportLinkedData(options: LinkedDataExporterOptions, output: Wr
|
|
|
749
757
|
|
|
750
758
|
interface LinkedDataImporterOptions {
|
|
751
759
|
eventBus: EventBus;
|
|
760
|
+
contentStore: WorkingTreeStore;
|
|
752
761
|
userId: UserId;
|
|
753
762
|
logger?: Logger;
|
|
754
763
|
}
|
|
@@ -796,12 +805,13 @@ interface UpdateResourceInput {
|
|
|
796
805
|
}
|
|
797
806
|
interface CreateResourceInput {
|
|
798
807
|
name: string;
|
|
799
|
-
|
|
808
|
+
storageUri: string;
|
|
809
|
+
contentChecksum: string;
|
|
810
|
+
byteSize: number;
|
|
800
811
|
format: ContentFormat;
|
|
801
812
|
language?: string;
|
|
802
813
|
entityTypes?: string[];
|
|
803
814
|
creationMethod?: CreationMethod;
|
|
804
|
-
storageUri?: string;
|
|
805
815
|
}
|
|
806
816
|
declare class ResourceOperations {
|
|
807
817
|
/**
|
|
@@ -1084,4 +1094,4 @@ declare function generateReferenceSuggestions(referenceTitle: string, client: In
|
|
|
1084
1094
|
declare const PACKAGE_NAME = "@semiont/make-meaning";
|
|
1085
1095
|
declare const VERSION = "0.1.0";
|
|
1086
1096
|
|
|
1087
|
-
export { AnnotationContext, AnnotationOperations, BACKUP_FORMAT, type BackupContentReader, type BackupEventStoreReader, type BackupExporterOptions, type BackupImportResult, type BackupImporterOptions, type BackupManifestHeader, type BackupStreamSummary, Browser, type BuildContextOptions, CloneTokenManager, type ContentBlobResolver, type CreateAnnotationResult, type CreateResourceInput, type CreateResourceResult, FORMAT_VERSION, Gatherer, GraphContext, type GraphEdge, type GraphNode, type GraphRepresentation, type KnowledgeBase, type KnowledgeSystem, LLMContext, type LLMContextOptions, type LinkedDataContentReader, type LinkedDataExporterOptions, type LinkedDataImportResult, type LinkedDataImporterOptions, type LinkedDataViewReader, type ListResourcesFilters, type MakeMeaningConfig, type MakeMeaningService, Matcher, PACKAGE_NAME, type ReplayStats, ResourceContext, ResourceOperations, Smelter, Stower, type UpdateAnnotationBodyResult, type UpdateResourceInput, VERSION, bootstrapEntityTypes, createKnowledgeBase, exportBackup, exportLinkedData, generateReferenceSuggestions, generateResourceSummary, importBackup, importLinkedData, isBackupManifest, readEntityTypesProjection,
|
|
1097
|
+
export { AnnotationContext, AnnotationOperations, BACKUP_FORMAT, type BackupContentReader, type BackupEventStoreReader, type BackupExporterOptions, type BackupImportResult, type BackupImporterOptions, type BackupManifestHeader, type BackupStreamSummary, Browser, type BuildContextOptions, CloneTokenManager, type ContentBlobResolver, type CreateAnnotationResult, type CreateResourceInput, type CreateResourceResult, FORMAT_VERSION, Gatherer, GraphContext, type GraphEdge, type GraphNode, type GraphRepresentation, type KnowledgeBase, type KnowledgeSystem, LLMContext, type LLMContextOptions, type LinkedDataContentReader, type LinkedDataExporterOptions, type LinkedDataImportResult, type LinkedDataImporterOptions, type LinkedDataViewReader, type ListResourcesFilters, type MakeMeaningConfig, type MakeMeaningService, Matcher, PACKAGE_NAME, type ReplayStats, ResourceContext, ResourceOperations, Smelter, Stower, type UpdateAnnotationBodyResult, type UpdateResourceInput, VERSION, bootstrapEntityTypes, createKnowledgeBase, exportBackup, exportLinkedData, generateReferenceSuggestions, generateResourceSummary, importBackup, importLinkedData, isBackupManifest, readEntityTypesProjection, startMakeMeaning, stopKnowledgeSystem, validateManifestVersion };
|