@semiont/make-meaning 0.5.2 → 0.5.4
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 +13 -0
- package/dist/annotation-assembly.d.ts +8 -0
- package/dist/annotation-assembly.d.ts.map +1 -0
- package/dist/annotation-context.d.ts +104 -0
- package/dist/annotation-context.d.ts.map +1 -0
- package/dist/annotation-operations.d.ts +41 -0
- package/dist/annotation-operations.d.ts.map +1 -0
- package/dist/batch-utils.d.ts +14 -0
- package/dist/batch-utils.d.ts.map +1 -0
- package/dist/bootstrap/entity-types.d.ts +26 -0
- package/dist/bootstrap/entity-types.d.ts.map +1 -0
- package/dist/browser.d.ts +45 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/clone-token-manager.d.ts +31 -0
- package/dist/clone-token-manager.d.ts.map +1 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/embedding-store.d.ts +63 -0
- package/dist/embedding-store.d.ts.map +1 -0
- package/dist/event-enrichment.d.ts +5 -0
- package/dist/event-enrichment.d.ts.map +1 -0
- package/dist/exchange/backup-exporter.d.ts +43 -0
- package/dist/exchange/backup-exporter.d.ts.map +1 -0
- package/dist/exchange/backup-importer.d.ts +41 -0
- package/dist/exchange/backup-importer.d.ts.map +1 -0
- package/dist/exchange/index.d.ts +10 -0
- package/dist/exchange/index.d.ts.map +1 -0
- package/dist/exchange/linked-data-exporter.d.ts +42 -0
- package/dist/exchange/linked-data-exporter.d.ts.map +1 -0
- package/dist/exchange/linked-data-importer.d.ts +44 -0
- package/dist/exchange/linked-data-importer.d.ts.map +1 -0
- package/dist/exchange/manifest.d.ts +42 -0
- package/dist/exchange/manifest.d.ts.map +1 -0
- package/dist/exchange/replay.d.ts +37 -0
- package/dist/exchange/replay.d.ts.map +1 -0
- package/dist/exchange/tar.d.ts +34 -0
- package/dist/exchange/tar.d.ts.map +1 -0
- package/dist/gatherer.d.ts +45 -0
- package/dist/gatherer.d.ts.map +1 -0
- package/dist/generation/resource-generation.d.ts +20 -0
- package/dist/generation/resource-generation.d.ts.map +1 -0
- package/dist/graph/consumer.d.ts +104 -0
- package/dist/graph/consumer.d.ts.map +1 -0
- package/dist/graph-context.d.ts +56 -0
- package/dist/graph-context.d.ts.map +1 -0
- package/dist/handlers/annotation-assembly.d.ts +19 -0
- package/dist/handlers/annotation-assembly.d.ts.map +1 -0
- package/dist/handlers/annotation-lookups.d.ts +8 -0
- package/dist/handlers/annotation-lookups.d.ts.map +1 -0
- package/dist/handlers/bind-update-body.d.ts +19 -0
- package/dist/handlers/bind-update-body.d.ts.map +1 -0
- package/dist/handlers/index.d.ts +27 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/job-commands.d.ts +5 -0
- package/dist/handlers/job-commands.d.ts.map +1 -0
- package/dist/index.d.ts +37 -1240
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -27
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.d.ts +40 -0
- package/dist/knowledge-base.d.ts.map +1 -0
- package/dist/knowledge-system.d.ts +32 -0
- package/dist/knowledge-system.d.ts.map +1 -0
- package/dist/llm-context.d.ts +26 -0
- package/dist/llm-context.d.ts.map +1 -0
- package/dist/local-content-transport.d.ts +41 -0
- package/dist/local-content-transport.d.ts.map +1 -0
- package/dist/local-transport.d.ts +80 -0
- package/dist/local-transport.d.ts.map +1 -0
- package/dist/matcher.d.ts +60 -0
- package/dist/matcher.d.ts.map +1 -0
- package/dist/resource-context.d.ts +44 -0
- package/dist/resource-context.d.ts.map +1 -0
- package/dist/resource-operations.d.ts +38 -0
- package/dist/resource-operations.d.ts.map +1 -0
- package/dist/service.d.ts +21 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/smelter-actor-state-unit.d.ts +31 -0
- package/dist/smelter-actor-state-unit.d.ts.map +1 -0
- package/dist/smelter-main.d.ts +16 -2
- package/dist/smelter-main.d.ts.map +1 -0
- package/dist/smelter-main.js +6 -2
- package/dist/smelter-main.js.map +1 -1
- package/dist/smelter.d.ts +95 -0
- package/dist/smelter.d.ts.map +1 -0
- package/dist/stower.d.ts +69 -0
- package/dist/stower.d.ts.map +1 -0
- package/dist/views/entity-types-reader.d.ts +12 -0
- package/dist/views/entity-types-reader.d.ts.map +1 -0
- package/dist/views/projection-validators.d.ts +80 -0
- package/dist/views/projection-validators.d.ts.map +1 -0
- package/dist/views/tag-schemas-reader.d.ts +14 -0
- package/dist/views/tag-schemas-reader.d.ts.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smelter Actor
|
|
3
|
+
*
|
|
4
|
+
* Takes raw content, refines it into embedding vectors, persists them to the
|
|
5
|
+
* EmbeddingStore (.semiont/embeddings/), and indexes them into the VectorStore
|
|
6
|
+
* (Qdrant). Peer to the Graph Consumer.
|
|
7
|
+
*
|
|
8
|
+
* Pipeline:
|
|
9
|
+
* 1. Subscribe to resource and annotation events from the EventStore
|
|
10
|
+
* 2. Chunk resource text into overlapping passages
|
|
11
|
+
* 3. Embed each chunk via the configured EmbeddingProvider
|
|
12
|
+
* 4. Write vectors to EmbeddingStore (overwrite-in-place, git-durable)
|
|
13
|
+
* 5. Index vectors into the VectorStore (Qdrant) for fast similarity search
|
|
14
|
+
*
|
|
15
|
+
* Uses the same burst-buffer RxJS pipeline as GraphDBConsumer.
|
|
16
|
+
*
|
|
17
|
+
* ## Per-resource serialization
|
|
18
|
+
*
|
|
19
|
+
* Smelter processes events strictly in order per resourceId via
|
|
20
|
+
* `groupBy(resourceId) + concatMap(...)`. This is the stream-consumer
|
|
21
|
+
* flavor of per-resource serialization — the same invariant enforced by
|
|
22
|
+
* `GraphDBConsumer`, `Gatherer`, and (in a different shape) `ViewManager`.
|
|
23
|
+
* See `packages/core/src/serialize-per-key.ts` for the shared primitive
|
|
24
|
+
* used by RPC-style services.
|
|
25
|
+
*/
|
|
26
|
+
import { type EventStore, type ViewStorage } from '@semiont/event-sourcing';
|
|
27
|
+
import type { Logger } from '@semiont/core';
|
|
28
|
+
import type { EventBus } from '@semiont/core';
|
|
29
|
+
import type { VectorStore } from '@semiont/vectors';
|
|
30
|
+
import type { EmbeddingProvider } from '@semiont/vectors';
|
|
31
|
+
import type { ChunkingConfig } from '@semiont/vectors';
|
|
32
|
+
import type { WorkingTreeStore } from '@semiont/content';
|
|
33
|
+
import type { EmbeddingStore } from './embedding-store.js';
|
|
34
|
+
export declare class Smelter {
|
|
35
|
+
private eventBus;
|
|
36
|
+
private vectorStore;
|
|
37
|
+
private embeddingProvider;
|
|
38
|
+
private contentStore;
|
|
39
|
+
private embeddingStore;
|
|
40
|
+
private viewStorage;
|
|
41
|
+
private static readonly SMELTER_RELEVANT_EVENTS;
|
|
42
|
+
private static readonly BURST_WINDOW_MS;
|
|
43
|
+
private static readonly MAX_BATCH_SIZE;
|
|
44
|
+
private static readonly IDLE_TIMEOUT_MS;
|
|
45
|
+
private _globalSubscriptions;
|
|
46
|
+
private eventSubject;
|
|
47
|
+
private pipelineSubscription;
|
|
48
|
+
private readonly logger;
|
|
49
|
+
private readonly chunkingConfig;
|
|
50
|
+
constructor(_eventStore: EventStore, eventBus: EventBus, vectorStore: VectorStore, embeddingProvider: EmbeddingProvider, contentStore: WorkingTreeStore, embeddingStore: EmbeddingStore, viewStorage: ViewStorage, logger: Logger, chunkingConfig?: ChunkingConfig);
|
|
51
|
+
initialize(): Promise<void>;
|
|
52
|
+
stop(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Rebuild the vector store from the EmbeddingStore (.semiont/embeddings/).
|
|
55
|
+
*
|
|
56
|
+
* For each stored file, checks whether the model matches the configured
|
|
57
|
+
* provider. On mismatch, re-embeds from the stored text and overwrites the
|
|
58
|
+
* file before upserting into Qdrant. On match, loads the stored vectors
|
|
59
|
+
* directly — no embedding provider calls needed.
|
|
60
|
+
*/
|
|
61
|
+
rebuildAll(): Promise<void>;
|
|
62
|
+
private processBatch;
|
|
63
|
+
/**
|
|
64
|
+
* Batch-optimized processing for consecutive events of the same type.
|
|
65
|
+
*/
|
|
66
|
+
private applyBatchByType;
|
|
67
|
+
/**
|
|
68
|
+
* Batch-embed chunks from multiple yield:created events in a single
|
|
69
|
+
* embedBatch() call, then write to EmbeddingStore and index per resource.
|
|
70
|
+
*/
|
|
71
|
+
private batchResourceCreated;
|
|
72
|
+
/**
|
|
73
|
+
* Batch-embed exact texts from multiple mark:added events in a single
|
|
74
|
+
* embedBatch() call, then write to EmbeddingStore and index per annotation.
|
|
75
|
+
*/
|
|
76
|
+
private batchAnnotationAdded;
|
|
77
|
+
private safeProcessEvent;
|
|
78
|
+
private processEvent;
|
|
79
|
+
private handleResourceCreated;
|
|
80
|
+
/**
|
|
81
|
+
* Re-embed a resource whose content has changed in-place.
|
|
82
|
+
*
|
|
83
|
+
* Used by yield:updated and yield:representation-added handlers. Reads the
|
|
84
|
+
* current storageUri from the materialized view (which is updated before the
|
|
85
|
+
* EventBus fires), deletes stale Qdrant vectors, and overwrites the
|
|
86
|
+
* EmbeddingStore file with fresh chunks.
|
|
87
|
+
*/
|
|
88
|
+
private reembedResource;
|
|
89
|
+
private handleResourceUpdated;
|
|
90
|
+
private handleRepresentationAdded;
|
|
91
|
+
private handleResourceArchived;
|
|
92
|
+
private handleAnnotationAdded;
|
|
93
|
+
private handleAnnotationRemoved;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=smelter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smelter.d.ts","sourceRoot":"","sources":["../src/smelter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,KAAK,EAAE,MAAM,EAA4C,MAAM,eAAe,CAAC;AAEtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAqC,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D,qBAAa,OAAO;IAkBhB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,iBAAiB;IACzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,WAAW;IAtBrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAG5C;IAEH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAM;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAO;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAO;IAE9C,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAG9C,WAAW,EAAE,UAAU,EACf,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,gBAAgB,EAC9B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EAChC,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,cAAc;IAM3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAwInB,YAAY;IAoB1B;;OAEG;YACW,gBAAgB;IAiB9B;;;OAGG;YACW,oBAAoB;IA6ClC;;;OAGG;YACW,oBAAoB;YAqDpB,gBAAgB;YAahB,YAAY;YAuBZ,qBAAqB;IAqDnC;;;;;;;OAOG;YACW,eAAe;YAgCf,qBAAqB;YAIrB,yBAAyB;YAIzB,sBAAsB;YAOtB,qBAAqB;YAsCrB,uBAAuB;CAWtC"}
|
package/dist/stower.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stower Actor
|
|
3
|
+
*
|
|
4
|
+
* The single write gateway to the Knowledge Base. Subscribes to command
|
|
5
|
+
* events on the EventBus and translates them into domain events on the
|
|
6
|
+
* EventStore + content writes to the RepresentationStore.
|
|
7
|
+
*
|
|
8
|
+
* From ARCHITECTURE.md:
|
|
9
|
+
* The Knowledge Base has exactly three actor interfaces:
|
|
10
|
+
* - Stower (write) — this actor
|
|
11
|
+
* - Gatherer (read context)
|
|
12
|
+
* - Matcher (read search)
|
|
13
|
+
*
|
|
14
|
+
* No other code should call eventStore.appendEvent() or repStore.store().
|
|
15
|
+
*
|
|
16
|
+
* Subscriptions:
|
|
17
|
+
* - yield:create → resource.created (+ content store) → yield:created / yield:create-failed
|
|
18
|
+
* - yield:update → resource.updated (+ content store) → yield:updated / yield:update-failed
|
|
19
|
+
* - yield:mv → resource.moved (+ working tree move) → yield:moved / yield:move-failed
|
|
20
|
+
* - mark:create → annotation.added → mark:created / mark:create-failed
|
|
21
|
+
* - mark:delete → annotation.removed → mark:deleted / mark:delete-failed
|
|
22
|
+
* - mark:update-body → annotation.body.updated → (no result event yet)
|
|
23
|
+
* - mark:archive → resource.archived (+ file removal) (resource-scoped, no result event)
|
|
24
|
+
* - mark:unarchive → resource.unarchived (resource-scoped, no result event)
|
|
25
|
+
* - frame:add-entity-type → entitytype.added → frame:entity-type-added / frame:entity-type-add-failed
|
|
26
|
+
* - frame:add-tag-schema → tagschema.added → frame:tag-schema-added / frame:tag-schema-add-failed
|
|
27
|
+
* - mark:update-entity-types → entitytag.added / entitytag.removed
|
|
28
|
+
* - job:start → job.started
|
|
29
|
+
* - job:complete → job.completed
|
|
30
|
+
* - job:fail → job.failed
|
|
31
|
+
*
|
|
32
|
+
* Note: `job:report-progress` is intentionally NOT persisted. Progress
|
|
33
|
+
* events are ephemeral UI feedback and would clutter the event log
|
|
34
|
+
* (historical logs show ~3× as many progress entries as start+complete
|
|
35
|
+
* combined). UI consumers subscribe to the bus directly for live
|
|
36
|
+
* progress; the event log keeps only the durable lifecycle boundaries.
|
|
37
|
+
*/
|
|
38
|
+
import type { Logger, ResourceDescriptor } from '@semiont/core';
|
|
39
|
+
import { EventBus } from '@semiont/core';
|
|
40
|
+
import type { ResourceId } from '@semiont/core';
|
|
41
|
+
import type { KnowledgeBase } from './knowledge-base';
|
|
42
|
+
export interface CreateResourceResult {
|
|
43
|
+
resourceId: ResourceId;
|
|
44
|
+
resource: ResourceDescriptor;
|
|
45
|
+
}
|
|
46
|
+
export declare class Stower {
|
|
47
|
+
private kb;
|
|
48
|
+
private eventBus;
|
|
49
|
+
private subscription;
|
|
50
|
+
private readonly logger;
|
|
51
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger);
|
|
52
|
+
initialize(): Promise<void>;
|
|
53
|
+
private handleYieldCreate;
|
|
54
|
+
private handleYieldUpdate;
|
|
55
|
+
private handleYieldMv;
|
|
56
|
+
private handleMarkCreate;
|
|
57
|
+
private handleMarkDelete;
|
|
58
|
+
private handleMarkUpdateBody;
|
|
59
|
+
private handleMarkArchive;
|
|
60
|
+
private handleMarkUnarchive;
|
|
61
|
+
private handleAddEntityType;
|
|
62
|
+
private handleAddTagSchema;
|
|
63
|
+
private handleUpdateEntityTypes;
|
|
64
|
+
private handleJobStart;
|
|
65
|
+
private handleJobComplete;
|
|
66
|
+
private handleJobFail;
|
|
67
|
+
stop(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=stower.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stower.d.ts","sourceRoot":"","sources":["../src/stower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAKH,OAAO,KAAK,EAAwB,MAAM,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,QAAQ,EAA0E,MAAM,eAAe,CAAC;AACjH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,qBAAa,MAAM;IAKf,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ;IALlB,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAGtB,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,MAAM;IAKV,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAkCnB,iBAAiB;YAqGjB,iBAAiB;YA4BjB,aAAa;YAuCb,gBAAgB;YA2BhB,gBAAgB;YAwBhB,oBAAoB;YA2BpB,iBAAiB;YAgBjB,mBAAmB;YAuBnB,mBAAmB;YAoBnB,kBAAkB;YAoBlB,uBAAuB;YA6BvB,cAAc;YAiBd,iBAAiB;YAkBjB,aAAa;IAkBrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity Types Projection Reader
|
|
3
|
+
*
|
|
4
|
+
* Reads entity types from the view storage projection file.
|
|
5
|
+
* This file is maintained by ViewMaterializer in response to entitytype.added events.
|
|
6
|
+
*/
|
|
7
|
+
import type { SemiontProject } from '@semiont/core/node';
|
|
8
|
+
/**
|
|
9
|
+
* Read entity types from view storage projection
|
|
10
|
+
*/
|
|
11
|
+
export declare function readEntityTypesProjection(project: SemiontProject): Promise<string[]>;
|
|
12
|
+
//# sourceMappingURL=entity-types-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-types-reader.d.ts","sourceRoot":"","sources":["../../src/views/entity-types-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsB1F"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projection validators — pure functions that take a projection's
|
|
3
|
+
* current state plus a caller-supplied command input and decide
|
|
4
|
+
* whether the input is valid against the registered vocabulary.
|
|
5
|
+
*
|
|
6
|
+
* Used by the dispatcher in `handlers/job-commands.ts`. The dispatcher
|
|
7
|
+
* reads the projection (I/O), passes it here (pure), and either
|
|
8
|
+
* resolves the input or rejects with the error these functions return.
|
|
9
|
+
*
|
|
10
|
+
* Sibling to the projection-reducers in `@semiont/event-sourcing` —
|
|
11
|
+
* reducers handle the write side of projections; validators handle
|
|
12
|
+
* the read side. Both are I/O-free so the test for "unknown schemaId
|
|
13
|
+
* rejects" doesn't need a filesystem or a Stower.
|
|
14
|
+
*
|
|
15
|
+
* Load-bearing properties (mutual exclusion, soundness, completeness,
|
|
16
|
+
* order preservation, no-mutation) are pinned by axiom-style
|
|
17
|
+
* fast-check tests in `__tests__/views/projection-validators.test.ts`.
|
|
18
|
+
* See `docs/system/PROJECTION-PATTERN.md` for the full axiom catalog
|
|
19
|
+
* and the architectural narrative.
|
|
20
|
+
*/
|
|
21
|
+
import type { TagSchema } from '@semiont/core';
|
|
22
|
+
/**
|
|
23
|
+
* Result of {@link resolveTagSchema}.
|
|
24
|
+
*
|
|
25
|
+
* Discriminated union — callers narrow on the absence of `error` to
|
|
26
|
+
* get a typed `TagSchema`.
|
|
27
|
+
*/
|
|
28
|
+
export type ResolveTagSchemaResult = {
|
|
29
|
+
schema: TagSchema;
|
|
30
|
+
error?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
schema?: undefined;
|
|
33
|
+
error: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Look up a tag schema by id in the per-KB tag-schema projection.
|
|
37
|
+
*
|
|
38
|
+
* Pure read of `tagSchemas` (the unwrapped projection content; what
|
|
39
|
+
* `readTagSchemasProjection` returns). Returns either the resolved
|
|
40
|
+
* schema or a caller-facing error message.
|
|
41
|
+
*
|
|
42
|
+
* Two failure modes:
|
|
43
|
+
* - Empty/missing schemaId → "tag-annotation requires schemaId"
|
|
44
|
+
* - Non-empty but unregistered → "Tag schema not registered: <id>"
|
|
45
|
+
*
|
|
46
|
+
* Both messages are surfaced verbatim to the bus via `job:create-failed`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveTagSchema(tagSchemas: readonly TagSchema[], schemaId: unknown): ResolveTagSchemaResult;
|
|
49
|
+
/**
|
|
50
|
+
* Result of {@link validateEntityTypes}.
|
|
51
|
+
*
|
|
52
|
+
* Two cases — `ok: true` when all supplied tags are in the registered
|
|
53
|
+
* set (or none were supplied at all), `ok: false` plus the offending
|
|
54
|
+
* unknown tags otherwise.
|
|
55
|
+
*/
|
|
56
|
+
export type ValidateEntityTypesResult = {
|
|
57
|
+
ok: true;
|
|
58
|
+
} | {
|
|
59
|
+
ok: false;
|
|
60
|
+
unknown: string[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Validate that every caller-supplied entity type is in the per-KB
|
|
64
|
+
* entity-type projection.
|
|
65
|
+
*
|
|
66
|
+
* Pure read of `registered` (the unwrapped projection content; what
|
|
67
|
+
* `readEntityTypesProjection` returns). Empty/missing `requested`
|
|
68
|
+
* skips the check entirely — "no tags supplied" is not a validation
|
|
69
|
+
* failure, and the validator should never trigger an unnecessary
|
|
70
|
+
* projection read for it.
|
|
71
|
+
*/
|
|
72
|
+
export declare function validateEntityTypes(registered: readonly string[], requested: readonly string[] | undefined): ValidateEntityTypesResult;
|
|
73
|
+
/**
|
|
74
|
+
* Format the standard error message for an entity-type validation
|
|
75
|
+
* failure. Kept here so the dispatcher and any future caller agree on
|
|
76
|
+
* the wire format — same `Entity type not registered: <comma-list>`
|
|
77
|
+
* shape that `mark.assist` and `yield.fromAnnotation` callers handle.
|
|
78
|
+
*/
|
|
79
|
+
export declare function entityTypesNotRegisteredMessage(unknown: readonly string[]): string;
|
|
80
|
+
//# sourceMappingURL=projection-validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-validators.d.ts","sourceRoot":"","sources":["../../src/views/projection-validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAC9B;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACxC;IAAE,MAAM,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,QAAQ,EAAE,OAAO,GAChB,sBAAsB,CASxB;AAID;;;;;;GAMG;AACH,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAErC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACvC,yBAAyB,CAO3B;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAElF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag Schemas Projection Reader
|
|
3
|
+
*
|
|
4
|
+
* Reads tag schemas from the view storage projection file.
|
|
5
|
+
* This file is maintained by ViewMaterializer in response to
|
|
6
|
+
* `frame:tag-schema-added` events.
|
|
7
|
+
*/
|
|
8
|
+
import type { SemiontProject } from '@semiont/core/node';
|
|
9
|
+
import type { TagSchema } from '@semiont/core';
|
|
10
|
+
/**
|
|
11
|
+
* Read tag schemas from view storage projection
|
|
12
|
+
*/
|
|
13
|
+
export declare function readTagSchemasProjection(project: SemiontProject): Promise<TagSchema[]>;
|
|
14
|
+
//# sourceMappingURL=tag-schemas-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-schemas-reader.d.ts","sourceRoot":"","sources":["../../src/views/tag-schemas-reader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAqB5F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semiont/make-meaning",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Making meaning from resources through context assembly, pattern detection, and relationship reasoning",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "npm run typecheck && tsup",
|
|
23
|
+
"build": "npm run typecheck && tsup && tsc -p tsconfig.build.json",
|
|
24
24
|
"typecheck": "tsc --noEmit",
|
|
25
25
|
"clean": "rm -rf dist",
|
|
26
26
|
"test": "vitest run",
|
|
@@ -42,8 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@vitest/coverage-v8": "^4.1.0",
|
|
45
|
+
"fast-check": "^4.3.0",
|
|
45
46
|
"tsup": "^8.0.1",
|
|
46
|
-
"typescript": "^
|
|
47
|
+
"typescript": "^6.0.2"
|
|
47
48
|
},
|
|
48
49
|
"keywords": [
|
|
49
50
|
"semantic-annotation",
|