@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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Base
|
|
3
|
+
*
|
|
4
|
+
* The durable store that records what intelligent actors decide.
|
|
5
|
+
* Groups the KB subsystems from ARCHITECTURE.md:
|
|
6
|
+
*
|
|
7
|
+
* - Event Log (immutable append-only) — via EventStore
|
|
8
|
+
* - Materialized Views (fast single-doc queries) — via ViewStorage
|
|
9
|
+
* - Content Store (working-tree files, URI-addressed) — via WorkingTreeStore
|
|
10
|
+
* - Graph (eventually consistent relationship projection) — via GraphDatabase
|
|
11
|
+
* - Graph Consumer (event-to-graph projection) — via GraphDBConsumer
|
|
12
|
+
* - Vectors (semantic search) — via VectorStore (optional, read-only)
|
|
13
|
+
*
|
|
14
|
+
* The Smelter (event-to-vector projection) runs as an external actor
|
|
15
|
+
* via @semiont/make-meaning/smelter-main. It subscribes to domain events
|
|
16
|
+
* via the EventBus gateway, embeds content, and writes to Qdrant directly.
|
|
17
|
+
*/
|
|
18
|
+
import type { EventStore } from '@semiont/event-sourcing';
|
|
19
|
+
import { type ViewStorage } from '@semiont/event-sourcing';
|
|
20
|
+
import { WorkingTreeStore } from '@semiont/content';
|
|
21
|
+
import type { GraphDatabase } from '@semiont/graph';
|
|
22
|
+
import type { VectorStore } from '@semiont/vectors';
|
|
23
|
+
import type { SemiontProject } from '@semiont/core/node';
|
|
24
|
+
import type { EventBus, Logger } from '@semiont/core';
|
|
25
|
+
import { GraphDBConsumer } from './graph/consumer.js';
|
|
26
|
+
export interface KnowledgeBase {
|
|
27
|
+
eventStore: EventStore;
|
|
28
|
+
views: ViewStorage;
|
|
29
|
+
content: WorkingTreeStore;
|
|
30
|
+
graph: GraphDatabase;
|
|
31
|
+
graphConsumer: GraphDBConsumer;
|
|
32
|
+
vectors?: VectorStore;
|
|
33
|
+
projectionsDir: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CreateKnowledgeBaseOptions {
|
|
36
|
+
vectorStore?: VectorStore;
|
|
37
|
+
skipRebuild?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function createKnowledgeBase(eventStore: EventStore, project: SemiontProject, graphDb: GraphDatabase, eventBus: EventBus, logger: Logger, options?: CreateKnowledgeBaseOptions): Promise<KnowledgeBase>;
|
|
40
|
+
//# sourceMappingURL=knowledge-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-base.d.ts","sourceRoot":"","sources":["../src/knowledge-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAK,UAAU,CAAC;IAC1B,KAAK,EAAU,WAAW,CAAC;IAC3B,OAAO,EAAQ,gBAAgB,CAAC;IAChC,KAAK,EAAU,aAAa,CAAC;IAC7B,aAAa,EAAE,eAAe,CAAC;IAC/B,OAAO,CAAC,EAAO,WAAW,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,aAAa,CAAC,CAkCxB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge System
|
|
3
|
+
*
|
|
4
|
+
* Binds the KnowledgeBase to the actors that provide disciplined access to it.
|
|
5
|
+
* Nothing outside the KnowledgeSystem reads or writes the KnowledgeBase directly.
|
|
6
|
+
*
|
|
7
|
+
* - kb: the durable store (event log, views, content, graph)
|
|
8
|
+
* - stower: write actor — weaves new knowledge in
|
|
9
|
+
* - gatherer: read actor — traces threads to build context
|
|
10
|
+
* - matcher: search actor — finds related threads
|
|
11
|
+
* - browser: filesystem actor — lists project directories
|
|
12
|
+
* - cloneTokenManager: token actor — manages resource clone tokens
|
|
13
|
+
*
|
|
14
|
+
* EventBus, JobQueue, and workers are peers to KnowledgeSystem, not members.
|
|
15
|
+
*/
|
|
16
|
+
import type { KnowledgeBase } from './knowledge-base.js';
|
|
17
|
+
import type { Stower } from './stower.js';
|
|
18
|
+
import type { Gatherer } from './gatherer.js';
|
|
19
|
+
import type { Matcher } from './matcher.js';
|
|
20
|
+
import type { Browser } from './browser.js';
|
|
21
|
+
import type { CloneTokenManager } from './clone-token-manager.js';
|
|
22
|
+
export interface KnowledgeSystem {
|
|
23
|
+
kb: KnowledgeBase;
|
|
24
|
+
stower: Stower;
|
|
25
|
+
gatherer: Gatherer;
|
|
26
|
+
matcher: Matcher;
|
|
27
|
+
browser: Browser;
|
|
28
|
+
cloneTokenManager: CloneTokenManager;
|
|
29
|
+
stop: () => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function stopKnowledgeSystem(ks: KnowledgeSystem): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=knowledge-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-system.d.ts","sourceRoot":"","sources":["../src/knowledge-system.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAU,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAiB,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAe,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAgB,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAgB,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAiB,aAAa,CAAC;IACjC,MAAM,EAAa,MAAM,CAAC;IAC1B,QAAQ,EAAW,QAAQ,CAAC;IAC5B,OAAO,EAAY,OAAO,CAAC;IAC3B,OAAO,EAAY,OAAO,CAAC;IAC3B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,IAAI,EAAe,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ5E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Context
|
|
3
|
+
*
|
|
4
|
+
* Builds comprehensive context for LLM processing of resources
|
|
5
|
+
* Orchestrates: ResourceContext, GraphContext, AnnotationContext, and generation functions
|
|
6
|
+
*/
|
|
7
|
+
import type { InferenceClient } from '@semiont/inference';
|
|
8
|
+
import { type ResourceId } from '@semiont/core';
|
|
9
|
+
import type { components } from '@semiont/core';
|
|
10
|
+
import type { KnowledgeBase } from './knowledge-base';
|
|
11
|
+
type ResourceLLMContextResponse = components['schemas']['ResourceLLMContextResponse'];
|
|
12
|
+
export interface LLMContextOptions {
|
|
13
|
+
depth: number;
|
|
14
|
+
maxResources: number;
|
|
15
|
+
includeContent: boolean;
|
|
16
|
+
includeSummary: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class LLMContext {
|
|
19
|
+
/**
|
|
20
|
+
* Get comprehensive LLM context for a resource
|
|
21
|
+
* Includes: main resource, related resources, annotations, graph, content, summary, references
|
|
22
|
+
*/
|
|
23
|
+
static getResourceContext(resourceId: ResourceId, options: LLMContextOptions, kb: KnowledgeBase, inferenceClient: InferenceClient): Promise<ResourceLLMContextResponse>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=llm-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-context.d.ts","sourceRoot":"","sources":["../src/llm-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,KAAK,0BAA0B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AAEtF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,UAAU;IACrB;;;OAGG;WACU,kBAAkB,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,iBAAiB,EAC1B,EAAE,EAAE,aAAa,EACjB,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,0BAA0B,CAAC;CA4EvC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalContentTransport — `IContentTransport` for an in-process
|
|
3
|
+
* `KnowledgeSystem`.
|
|
4
|
+
*
|
|
5
|
+
* Reads go straight to `kb.views` (resource lookup) + `kb.content`
|
|
6
|
+
* (byte retrieval). No network, no auth — local mode runs as a single
|
|
7
|
+
* host-process identity.
|
|
8
|
+
*
|
|
9
|
+
* `putBinary` is intentionally not implemented in Phase 2: in-process
|
|
10
|
+
* resource creation is exercised through bus emits (mark/yield
|
|
11
|
+
* namespaces), not multipart upload. If a future caller needs raw
|
|
12
|
+
* binary upload from a local context, wire it through the same
|
|
13
|
+
* resource-creation pipeline the HTTP `/resources` handler uses.
|
|
14
|
+
*/
|
|
15
|
+
import type { AccessToken, ContentFormat, ResourceId } from '@semiont/core';
|
|
16
|
+
import type { IContentTransport, PutBinaryRequest, PutBinaryOptions } from '@semiont/core';
|
|
17
|
+
import type { KnowledgeSystem } from './knowledge-system.js';
|
|
18
|
+
export declare class LocalContentTransport implements IContentTransport {
|
|
19
|
+
private readonly ks;
|
|
20
|
+
constructor(ks: KnowledgeSystem);
|
|
21
|
+
putBinary(_request: PutBinaryRequest, _options?: PutBinaryOptions): Promise<{
|
|
22
|
+
resourceId: ResourceId;
|
|
23
|
+
}>;
|
|
24
|
+
getBinary(resourceId: ResourceId, options?: {
|
|
25
|
+
accept?: ContentFormat | string;
|
|
26
|
+
auth?: AccessToken;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
data: ArrayBuffer;
|
|
29
|
+
contentType: string;
|
|
30
|
+
}>;
|
|
31
|
+
getBinaryStream(resourceId: ResourceId, options?: {
|
|
32
|
+
accept?: ContentFormat | string;
|
|
33
|
+
auth?: AccessToken;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
stream: ReadableStream<Uint8Array>;
|
|
36
|
+
contentType: string;
|
|
37
|
+
}>;
|
|
38
|
+
private loadBinary;
|
|
39
|
+
dispose(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=local-content-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-content-transport.d.ts","sourceRoot":"","sources":["../src/local-content-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAW7D,qBAAa,qBAAsB,YAAW,iBAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,eAAe;IAE1C,SAAS,CACb,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC;QAAE,UAAU,EAAE,UAAU,CAAA;KAAE,CAAC;IAUhC,SAAS,CACb,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,WAAW,CAAA;KAAE,GAChE,OAAO,CAAC;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAShD,eAAe,CACnB,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,WAAW,CAAA;KAAE,GAChE,OAAO,CAAC;QAAE,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;YAyBzD,UAAU;IAcxB,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocalTransport — `ITransport` for an in-process `KnowledgeSystem`.
|
|
3
|
+
*
|
|
4
|
+
* Bus-ownership pattern (see `docs/protocol/TRANSPORT-CONTRACT.md`):
|
|
5
|
+
* - The caller owns a make-meaning `EventBus` and passes it to both
|
|
6
|
+
* `startMakeMeaning` and `LocalTransport` so the transport can publish
|
|
7
|
+
* directly onto the bus the `KnowledgeSystem` actors are listening on.
|
|
8
|
+
* - `SemiontClient` constructs its own `clientBus` and calls
|
|
9
|
+
* `bridgeInto(clientBus)` during construction. `LocalTransport`
|
|
10
|
+
* subscribes to every `BRIDGED_CHANNELS` entry on the make-meaning bus
|
|
11
|
+
* and forwards each onto `clientBus`.
|
|
12
|
+
* - The bus reference flows client → transport, never the other way.
|
|
13
|
+
*
|
|
14
|
+
* LocalTransport implements `ITransport` only. Auth, admin, and exchange
|
|
15
|
+
* (`IBackendOperations`) are HTTP-shaped concepts that don't apply
|
|
16
|
+
* in-process — local mode runs as a single host-process identity supplied
|
|
17
|
+
* at construction, with no token/credential lifecycle. A `SemiontClient`
|
|
18
|
+
* built over this transport has no `.auth` / `.admin` namespaces.
|
|
19
|
+
*/
|
|
20
|
+
import type { Observable } from 'rxjs';
|
|
21
|
+
import { BehaviorSubject } from 'rxjs';
|
|
22
|
+
import type { SemiontError } from '@semiont/core';
|
|
23
|
+
import type { BaseUrl, EventBus, EventMap, ResourceId, UserDID } from '@semiont/core';
|
|
24
|
+
import { type ConnectionState, type ITransport } from '@semiont/core';
|
|
25
|
+
import type { KnowledgeSystem } from './knowledge-system.js';
|
|
26
|
+
export interface LocalTransportConfig {
|
|
27
|
+
/**
|
|
28
|
+
* The in-process knowledge system. Lifetime is owned by the caller —
|
|
29
|
+
* `dispose()` on this transport does not stop the KnowledgeSystem.
|
|
30
|
+
*/
|
|
31
|
+
knowledgeSystem: KnowledgeSystem;
|
|
32
|
+
/**
|
|
33
|
+
* The make-meaning `EventBus`. Must be the same instance passed to
|
|
34
|
+
* `startMakeMeaning` so that emits land on the bus KnowledgeSystem
|
|
35
|
+
* actors are subscribed to.
|
|
36
|
+
*/
|
|
37
|
+
eventBus: EventBus;
|
|
38
|
+
/**
|
|
39
|
+
* Host-process identity. Stamped onto every emit as `_userId`, mirroring
|
|
40
|
+
* the gateway-injection convention used by `HttpTransport` (where the
|
|
41
|
+
* `/bus/emit` gateway reads the JWT subject and injects `_userId`).
|
|
42
|
+
* Handlers downstream trust nothing else.
|
|
43
|
+
*/
|
|
44
|
+
userId: UserDID;
|
|
45
|
+
/**
|
|
46
|
+
* Cosmetic base URL for diagnostics and URL composition. Defaults to
|
|
47
|
+
* `local://in-process`. Local code never makes outgoing HTTP requests
|
|
48
|
+
* with it.
|
|
49
|
+
*/
|
|
50
|
+
baseUrl?: BaseUrl;
|
|
51
|
+
}
|
|
52
|
+
export declare class LocalTransport implements ITransport {
|
|
53
|
+
readonly baseUrl: BaseUrl;
|
|
54
|
+
readonly state$: BehaviorSubject<ConnectionState>;
|
|
55
|
+
private readonly errorsSubject;
|
|
56
|
+
/**
|
|
57
|
+
* Stream of `SemiontError` instances surfaced from transport-mediated
|
|
58
|
+
* round-trips (typed-wire methods on this transport that fail). The
|
|
59
|
+
* in-process implementation does not currently surface errors through
|
|
60
|
+
* this stream — most failures here originate inside the make-meaning
|
|
61
|
+
* actors and surface through bus channels (correlation-ID failures via
|
|
62
|
+
* `busRequest`). The Subject exists to satisfy the `ITransport`
|
|
63
|
+
* contract; future expansion (e.g. transport-level guard failures)
|
|
64
|
+
* can publish into it.
|
|
65
|
+
*/
|
|
66
|
+
readonly errors$: Observable<SemiontError>;
|
|
67
|
+
private readonly bus;
|
|
68
|
+
private readonly userId;
|
|
69
|
+
private readonly bridges;
|
|
70
|
+
private readonly bridgeSubs;
|
|
71
|
+
private disposed;
|
|
72
|
+
constructor(cfg: LocalTransportConfig);
|
|
73
|
+
emit<K extends keyof EventMap>(channel: K, payload: EventMap[K], resourceScope?: ResourceId): Promise<void>;
|
|
74
|
+
on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void;
|
|
75
|
+
stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
|
|
76
|
+
subscribeToResource(_resourceId: ResourceId): () => void;
|
|
77
|
+
bridgeInto(bus: EventBus): void;
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=local-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-transport.d.ts","sourceRoot":"","sources":["../src/local-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,eAAe,EAAW,MAAM,MAAM,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAO,EACR,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,eAAe,EAAE,eAAe,CAAC;IACjC;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,cAAe,YAAW,UAAU;IAC/C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsD;IACpF;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAqC;IAE/E,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAS;gBAEb,GAAG,EAAE,oBAAoB;IAU/B,IAAI,CAAC,CAAC,SAAS,MAAM,QAAQ,EACjC,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EACpB,aAAa,CAAC,EAAE,UAAU,GACzB,OAAO,CAAC,IAAI,CAAC;IAyBhB,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAK7F,MAAM,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAIrE,mBAAmB,CAAC,WAAW,EAAE,UAAU,GAAG,MAAM,IAAI;IAOxD,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IA8B/B,OAAO,IAAI,IAAI;CAUhB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matcher Actor
|
|
3
|
+
*
|
|
4
|
+
* Candidate search for the bind flow. Subscribes to match:search-requested,
|
|
5
|
+
* queries the KB graph for matching resources, scores them, and emits results.
|
|
6
|
+
*
|
|
7
|
+
* Handles:
|
|
8
|
+
* - match:search-requested — multi-source retrieval + composite scoring
|
|
9
|
+
*
|
|
10
|
+
* The write side (annotation.body.updated) stays in the route where userId
|
|
11
|
+
* is available from auth context.
|
|
12
|
+
*/
|
|
13
|
+
import type { Logger } from '@semiont/core';
|
|
14
|
+
import { type EventBus } from '@semiont/core';
|
|
15
|
+
import type { InferenceClient } from '@semiont/inference';
|
|
16
|
+
import type { EmbeddingProvider } from '@semiont/vectors';
|
|
17
|
+
import type { KnowledgeBase } from './knowledge-base';
|
|
18
|
+
export declare class Matcher {
|
|
19
|
+
private kb;
|
|
20
|
+
private eventBus;
|
|
21
|
+
private inferenceClient;
|
|
22
|
+
private embeddingProvider?;
|
|
23
|
+
private subscriptions;
|
|
24
|
+
private readonly logger;
|
|
25
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger, inferenceClient: InferenceClient, embeddingProvider?: EmbeddingProvider | undefined);
|
|
26
|
+
initialize(): Promise<void>;
|
|
27
|
+
private handleSearch;
|
|
28
|
+
/**
|
|
29
|
+
* Context-driven search: multi-source retrieval + composite scoring
|
|
30
|
+
*
|
|
31
|
+
* Retrieval sources:
|
|
32
|
+
* 1. Name match — graph.searchResources(searchTerm)
|
|
33
|
+
* 2. Entity type match — graph.listResources({ entityTypes })
|
|
34
|
+
* 3. Graph neighborhood — connections from GatheredContext
|
|
35
|
+
*
|
|
36
|
+
* Ranking signals:
|
|
37
|
+
* - Entity type overlap (Jaccard similarity)
|
|
38
|
+
* - Bidirectionality (already connected both ways)
|
|
39
|
+
* - Citation weight (well-connected = important)
|
|
40
|
+
* - Name match quality (exact > prefix > contains)
|
|
41
|
+
* - Recency (newer resources scored higher)
|
|
42
|
+
*/
|
|
43
|
+
private contextDrivenSearch;
|
|
44
|
+
/**
|
|
45
|
+
* LLM-based semantic relevance scoring (GraphRAG-style)
|
|
46
|
+
*
|
|
47
|
+
* Batches candidates into a single prompt asking the LLM to score
|
|
48
|
+
* each candidate's semantic relevance given the passage and graph context.
|
|
49
|
+
*
|
|
50
|
+
* @returns Map of resourceId → score (0-1)
|
|
51
|
+
*/
|
|
52
|
+
private inferenceSemanticScore;
|
|
53
|
+
/**
|
|
54
|
+
* Search vectors for semantically similar resources.
|
|
55
|
+
* Returns empty array if vectors or embedding provider are not configured.
|
|
56
|
+
*/
|
|
57
|
+
private searchVectors;
|
|
58
|
+
stop(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../src/matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAA6B,MAAM,EAAsB,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,KAAK,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,OAAO;IAKhB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,iBAAiB,CAAC;IAR5B,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAGtB,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,QAAQ,EAC1B,MAAM,EAAE,MAAM,EACN,eAAe,EAAE,eAAe,EAChC,iBAAiB,CAAC,EAAE,iBAAiB,YAAA;IAKzC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAgBnB,YAAY;IAwC1B;;;;;;;;;;;;;;OAcG;YACW,mBAAmB;IAgMjC;;;;;;;OAOG;YACW,sBAAsB;IA6EpC;;;OAGG;YACW,aAAa;IAwBrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource Context
|
|
3
|
+
*
|
|
4
|
+
* Assembles resource context from view storage and content store
|
|
5
|
+
* Does NOT touch the graph - graph queries go through GraphContext
|
|
6
|
+
*/
|
|
7
|
+
import type { ResourceId } from '@semiont/core';
|
|
8
|
+
import type { KnowledgeBase } from './knowledge-base';
|
|
9
|
+
import type { ResourceDescriptor } from '@semiont/core';
|
|
10
|
+
export interface ListResourcesFilters {
|
|
11
|
+
search?: string;
|
|
12
|
+
archived?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class ResourceContext {
|
|
15
|
+
/**
|
|
16
|
+
* Get resource metadata from view storage
|
|
17
|
+
*/
|
|
18
|
+
static getResourceMetadata(resourceId: ResourceId, kb: KnowledgeBase): Promise<ResourceDescriptor | null>;
|
|
19
|
+
/**
|
|
20
|
+
* List resources, optionally filtered.
|
|
21
|
+
*
|
|
22
|
+
* When `search` is set, delegates to `kb.graph.searchResources`, which runs
|
|
23
|
+
* the name match in the graph engine instead of scanning every view in JS.
|
|
24
|
+
* The graph result is then narrowed by `archived` if requested.
|
|
25
|
+
*
|
|
26
|
+
* When `search` is unset, falls back to scanning all materialized views.
|
|
27
|
+
* (TODO: also push the listing path through the graph for large KBs.)
|
|
28
|
+
*/
|
|
29
|
+
static listResources(filters: ListResourcesFilters | undefined, kb: KnowledgeBase): Promise<ResourceDescriptor[]>;
|
|
30
|
+
private static sortByDateDesc;
|
|
31
|
+
/**
|
|
32
|
+
* Add content previews to resources (for search results)
|
|
33
|
+
* Retrieves and decodes the first 200 characters of each resource's primary representation
|
|
34
|
+
*/
|
|
35
|
+
static addContentPreviews(resources: ResourceDescriptor[], kb: KnowledgeBase): Promise<Array<ResourceDescriptor & {
|
|
36
|
+
content: string;
|
|
37
|
+
}>>;
|
|
38
|
+
/**
|
|
39
|
+
* Get full content for a resource
|
|
40
|
+
* Retrieves and decodes the primary representation
|
|
41
|
+
*/
|
|
42
|
+
static getResourceContent(resource: ResourceDescriptor, kb: KnowledgeBase): Promise<string | undefined>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=resource-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-context.d.ts","sourceRoot":"","sources":["../src/resource-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B;;OAEG;WACU,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAS/G;;;;;;;;;OASG;WACU,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,EAAE,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAuBvH,OAAO,CAAC,MAAM,CAAC,cAAc;IAQ7B;;;OAGG;WACU,kBAAkB,CAC7B,SAAS,EAAE,kBAAkB,EAAE,EAC/B,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAkB3D;;;OAGG;WACU,kBAAkB,CAC7B,QAAQ,EAAE,kBAAkB,EAC5B,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAQ/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource Operations
|
|
3
|
+
*
|
|
4
|
+
* Business logic for resource operations. All writes go through the EventBus
|
|
5
|
+
* — the Stower actor subscribes and handles persistence.
|
|
6
|
+
*
|
|
7
|
+
* For create: emits yield:create, awaits yield:created / yield:create-failed.
|
|
8
|
+
*/
|
|
9
|
+
import type { UserId, ResourceId } from '@semiont/core';
|
|
10
|
+
import type { components } from '@semiont/core';
|
|
11
|
+
import { EventBus } from '@semiont/core';
|
|
12
|
+
type ContentFormat = components['schemas']['ContentFormat'];
|
|
13
|
+
type Agent = components['schemas']['Agent'];
|
|
14
|
+
export interface CreateResourceInput {
|
|
15
|
+
name: string;
|
|
16
|
+
storageUri: string;
|
|
17
|
+
contentChecksum: string;
|
|
18
|
+
byteSize: number;
|
|
19
|
+
format: ContentFormat;
|
|
20
|
+
language?: string;
|
|
21
|
+
entityTypes?: string[];
|
|
22
|
+
/** Provenance for AI-generated resources: source resource + annotation. */
|
|
23
|
+
generatedFrom?: {
|
|
24
|
+
resourceId?: string;
|
|
25
|
+
annotationId?: string;
|
|
26
|
+
};
|
|
27
|
+
generationPrompt?: string;
|
|
28
|
+
generator?: Agent | Agent[];
|
|
29
|
+
isDraft?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class ResourceOperations {
|
|
32
|
+
/**
|
|
33
|
+
* Create a new resource via EventBus → Stower
|
|
34
|
+
*/
|
|
35
|
+
static createResource(input: CreateResourceInput, userId: UserId, eventBus: EventBus): Promise<ResourceId>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=resource-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-operations.d.ts","sourceRoot":"","sources":["../src/resource-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAgC,MAAM,eAAe,CAAC;AAEvE,KAAK,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;AAC5D,KAAK,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,2EAA2E;IAC3E,aAAa,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,kBAAkB;IAC7B;;OAEG;WACU,cAAc,CACzB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,UAAU,CAAC;CAwCvB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make-Meaning Service
|
|
3
|
+
*
|
|
4
|
+
* Provides a clean interface:
|
|
5
|
+
* const makeMeaning = await startMakeMeaning(project, config, eventBus, logger);
|
|
6
|
+
*/
|
|
7
|
+
import { type JobQueue } from '@semiont/jobs';
|
|
8
|
+
import type { SemiontProject } from '@semiont/core/node';
|
|
9
|
+
import { EventBus, type Logger } from '@semiont/core';
|
|
10
|
+
import { type MakeMeaningConfig } from './config';
|
|
11
|
+
import { type KnowledgeSystem } from './knowledge-system';
|
|
12
|
+
export type { MakeMeaningConfig } from './config';
|
|
13
|
+
export interface MakeMeaningService {
|
|
14
|
+
knowledgeSystem: KnowledgeSystem;
|
|
15
|
+
jobQueue: JobQueue;
|
|
16
|
+
stop: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function startMakeMeaning(project: SemiontProject, config: MakeMeaningConfig, eventBus: EventBus, logger: Logger, options?: {
|
|
19
|
+
skipRebuild?: boolean;
|
|
20
|
+
}): Promise<MakeMeaningService>;
|
|
21
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,KAAK,MAAM,EAAS,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAazE,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI/E,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAS,QAAQ,CAAC;IAC1B,IAAI,EAAa,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAoID,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC,OAAO,CAAC,kBAAkB,CAAC,CA2B7B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SmelterActorStateUnit — domain-event fan-in for the Smelter worker.
|
|
3
|
+
*
|
|
4
|
+
* Subscribes to the six smelter-relevant channels on a shared bus and
|
|
5
|
+
* exposes them as a single typed `events$` stream. Transport-neutral —
|
|
6
|
+
* the caller passes a `WorkerBus` (HTTP `ActorStateUnit` today, an in-process
|
|
7
|
+
* bus shim if/when one exists). The state unit does not own the bus and does
|
|
8
|
+
* not dispose it.
|
|
9
|
+
*
|
|
10
|
+
* `start()` widens the bus's channel-subscription set to include the
|
|
11
|
+
* smelter channels. On HTTP this extends the SSE subscription URL;
|
|
12
|
+
* on an in-process bus this is a no-op (the underlying `EventBus`
|
|
13
|
+
* already delivers every emit).
|
|
14
|
+
*/
|
|
15
|
+
import { Observable } from 'rxjs';
|
|
16
|
+
import type { StateUnit, WorkerBus } from '@semiont/sdk';
|
|
17
|
+
export interface SmelterEvent {
|
|
18
|
+
type: string;
|
|
19
|
+
resourceId?: string;
|
|
20
|
+
payload: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface SmelterActorStateUnitOptions {
|
|
23
|
+
bus: WorkerBus;
|
|
24
|
+
}
|
|
25
|
+
export interface SmelterActorStateUnit extends StateUnit {
|
|
26
|
+
events$: Observable<SmelterEvent>;
|
|
27
|
+
emit(channel: string, payload: Record<string, unknown>): Promise<void>;
|
|
28
|
+
start(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function createSmelterActorStateUnit(options: SmelterActorStateUnitOptions): SmelterActorStateUnit;
|
|
31
|
+
//# sourceMappingURL=smelter-actor-state-unit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smelter-actor-state-unit.d.ts","sourceRoot":"","sources":["../src/smelter-actor-state-unit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAS,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,SAAS,CAAC;CAChB;AAWD,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,4BAA4B,GAAG,qBAAqB,CA8BxG"}
|
package/dist/smelter-main.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Smelter Main — standalone entry point
|
|
3
|
+
*
|
|
4
|
+
* Continuous stream processor that subscribes to domain events via the
|
|
5
|
+
* EventBus gateway, fetches content via HTTP, chunks text, embeds via
|
|
6
|
+
* the configured provider, and writes vectors to Qdrant.
|
|
7
|
+
*
|
|
8
|
+
* Reads configuration from ~/.semiontconfig (TOML) via the canonical
|
|
9
|
+
* `createTomlConfigLoader` from @semiont/core. Authenticates with the
|
|
10
|
+
* KS via shared secret.
|
|
11
|
+
*
|
|
12
|
+
* Environment variables:
|
|
13
|
+
* SEMIONT_WORKER_SECRET — shared secret for JWT auth with the KS
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=smelter-main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smelter-main.d.ts","sourceRoot":"","sources":["../src/smelter-main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
package/dist/smelter-main.js
CHANGED
|
@@ -9805,10 +9805,14 @@ async function authenticate() {
|
|
|
9805
9805
|
logger.warn("No SEMIONT_WORKER_SECRET set \u2014 using empty token");
|
|
9806
9806
|
return "";
|
|
9807
9807
|
}
|
|
9808
|
-
const response = await fetch(`${baseUrl}/api/tokens/
|
|
9808
|
+
const response = await fetch(`${baseUrl}/api/tokens/agent`, {
|
|
9809
9809
|
method: "POST",
|
|
9810
9810
|
headers: { "Content-Type": "application/json" },
|
|
9811
|
-
body: JSON.stringify({
|
|
9811
|
+
body: JSON.stringify({
|
|
9812
|
+
secret: workerSecret,
|
|
9813
|
+
provider: embeddingType,
|
|
9814
|
+
model: embeddingModel
|
|
9815
|
+
})
|
|
9812
9816
|
});
|
|
9813
9817
|
if (!response.ok) {
|
|
9814
9818
|
throw new Error(`Authentication failed: ${response.status} ${response.statusText}`);
|