@semiont/make-meaning 0.2.45 → 0.3.0
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 +141 -262
- package/dist/index.d.ts +512 -548
- package/dist/index.js +13046 -5104
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,217 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EventStore } from '@semiont/event-sourcing';
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { JobQueue, ReferenceAnnotationWorker, GenerationWorker, HighlightAnnotationWorker, AssessmentAnnotationWorker, CommentAnnotationWorker, TagAnnotationWorker } from '@semiont/jobs';
|
|
2
|
+
import { EventStore, ViewStorage } from '@semiont/event-sourcing';
|
|
3
|
+
import { FilesystemServiceConfig, GraphServiceConfig, InferenceServiceConfig, Logger, StoredEvent, ResourceId, EventBus, components, UserId, CreationMethod, AnnotationId, ResourceAnnotations, AnnotationCategory, GraphPath, GraphConnection } from '@semiont/core';
|
|
4
|
+
export { AssembledAnnotation, applyBodyOperations, assembleAnnotation } from '@semiont/core';
|
|
5
5
|
import { InferenceClient } from '@semiont/inference';
|
|
6
6
|
import { GraphDatabase } from '@semiont/graph';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
annotation: {
|
|
20
|
-
selector: {
|
|
21
|
-
start: number;
|
|
22
|
-
end: number;
|
|
23
|
-
exact: string;
|
|
24
|
-
prefix?: string;
|
|
25
|
-
suffix?: string;
|
|
26
|
-
};
|
|
27
|
-
entityTypes: string[];
|
|
7
|
+
import { RepresentationStore } from '@semiont/content';
|
|
8
|
+
import { Writable, Readable } from 'node:stream';
|
|
9
|
+
|
|
10
|
+
/** Narrow config type — only the fields make-meaning actually reads */
|
|
11
|
+
interface MakeMeaningConfig {
|
|
12
|
+
services: {
|
|
13
|
+
filesystem?: FilesystemServiceConfig;
|
|
14
|
+
graph?: GraphServiceConfig;
|
|
15
|
+
inference?: InferenceServiceConfig;
|
|
16
|
+
};
|
|
17
|
+
_metadata?: {
|
|
18
|
+
projectRoot: string;
|
|
28
19
|
};
|
|
29
|
-
}
|
|
30
|
-
declare class ReferenceAnnotationWorker extends JobWorker {
|
|
31
|
-
private config;
|
|
32
|
-
private eventStore;
|
|
33
|
-
private inferenceClient;
|
|
34
|
-
private eventBus;
|
|
35
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
36
|
-
protected getWorkerName(): string;
|
|
37
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
38
|
-
protected executeJob(job: AnyJob): Promise<DetectionResult>;
|
|
39
|
-
/**
|
|
40
|
-
* Detect entity references in resource using AI
|
|
41
|
-
* Self-contained implementation for reference detection
|
|
42
|
-
*
|
|
43
|
-
* Public for testing charset handling - see entity-detection-charset.test.ts
|
|
44
|
-
*/
|
|
45
|
-
detectReferences(resource: ResourceDescriptor$2, entityTypes: string[], includeDescriptiveReferences?: boolean): Promise<DetectedAnnotation[]>;
|
|
46
|
-
private processDetectionJob;
|
|
47
|
-
/**
|
|
48
|
-
* Emit completion event with result data
|
|
49
|
-
* Override base class to emit job.completed event (domain + progress)
|
|
50
|
-
*/
|
|
51
|
-
protected emitCompletionEvent(job: RunningJob<DetectionParams, DetectionProgress>, result: DetectionResult): Promise<void>;
|
|
52
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Update job progress and emit events to Event Store and EventBus
|
|
55
|
-
* Overrides base class to emit both domain events and progress events
|
|
56
|
-
*/
|
|
57
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Generation Worker
|
|
62
|
-
*
|
|
63
|
-
* Processes generation jobs: runs AI inference to generate new resources
|
|
64
|
-
* and emits resource.created and annotation.body.updated events.
|
|
65
|
-
*
|
|
66
|
-
* This worker is INDEPENDENT of HTTP clients - it just processes jobs and emits events.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
declare class GenerationWorker extends JobWorker {
|
|
70
|
-
private config;
|
|
71
|
-
private eventStore;
|
|
72
|
-
private inferenceClient;
|
|
73
|
-
private eventBus;
|
|
74
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
75
|
-
protected getWorkerName(): string;
|
|
76
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
77
|
-
protected executeJob(job: AnyJob): Promise<GenerationResult>;
|
|
78
|
-
private processGenerationJob;
|
|
79
|
-
/**
|
|
80
|
-
* Emit completion event with result data
|
|
81
|
-
* Override base class to emit job.completed event with resultResourceId
|
|
82
|
-
*/
|
|
83
|
-
protected emitCompletionEvent(job: RunningJob<GenerationParams, YieldProgress>, result: GenerationResult): Promise<void>;
|
|
84
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Update job progress and emit events to Event Store
|
|
87
|
-
* Overrides base class to also emit job progress events
|
|
88
|
-
*/
|
|
89
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Highlight Detection Worker
|
|
94
|
-
*
|
|
95
|
-
* Processes highlight-detection jobs: runs AI inference to find passages
|
|
96
|
-
* that should be highlighted and creates highlight annotations.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
declare class HighlightAnnotationWorker extends JobWorker {
|
|
100
|
-
private config;
|
|
101
|
-
private eventStore;
|
|
102
|
-
private inferenceClient;
|
|
103
|
-
private eventBus;
|
|
104
|
-
private isFirstProgress;
|
|
105
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
106
|
-
protected getWorkerName(): string;
|
|
107
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
108
|
-
protected executeJob(job: AnyJob): Promise<HighlightDetectionResult>;
|
|
109
|
-
/**
|
|
110
|
-
* Emit completion event with result data
|
|
111
|
-
* Override base class to emit job.completed event
|
|
112
|
-
*/
|
|
113
|
-
protected emitCompletionEvent(job: RunningJob<HighlightDetectionParams, HighlightDetectionProgress>, result: HighlightDetectionResult): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Override updateJobProgress to emit events to Event Store
|
|
116
|
-
*/
|
|
117
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
118
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
119
|
-
private processHighlightDetectionJob;
|
|
120
|
-
private createHighlightAnnotation;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Assessment Detection Worker
|
|
125
|
-
*
|
|
126
|
-
* Processes assessment-detection jobs: runs AI inference to assess/evaluate
|
|
127
|
-
* passages in the text and creates assessment annotations.
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
declare class AssessmentAnnotationWorker extends JobWorker {
|
|
131
|
-
private config;
|
|
132
|
-
private eventStore;
|
|
133
|
-
private inferenceClient;
|
|
134
|
-
private eventBus;
|
|
135
|
-
private isFirstProgress;
|
|
136
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
137
|
-
protected getWorkerName(): string;
|
|
138
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
139
|
-
protected executeJob(job: AnyJob): Promise<AssessmentDetectionResult>;
|
|
140
|
-
/**
|
|
141
|
-
* Emit completion event with result data
|
|
142
|
-
* Override base class to emit job.completed event
|
|
143
|
-
*/
|
|
144
|
-
protected emitCompletionEvent(job: RunningJob<AssessmentDetectionParams, AssessmentDetectionProgress>, result: AssessmentDetectionResult): Promise<void>;
|
|
145
|
-
/**
|
|
146
|
-
* Override updateJobProgress to emit events to Event Store
|
|
147
|
-
*/
|
|
148
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
149
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
150
|
-
private processAssessmentDetectionJob;
|
|
151
|
-
private createAssessmentAnnotation;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Comment Detection Worker
|
|
156
|
-
*
|
|
157
|
-
* Processes comment-detection jobs: runs AI inference to identify passages
|
|
158
|
-
* that would benefit from explanatory comments and creates comment annotations.
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
declare class CommentAnnotationWorker extends JobWorker {
|
|
162
|
-
private config;
|
|
163
|
-
private eventStore;
|
|
164
|
-
private inferenceClient;
|
|
165
|
-
private eventBus;
|
|
166
|
-
private isFirstProgress;
|
|
167
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
168
|
-
protected getWorkerName(): string;
|
|
169
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
170
|
-
protected executeJob(job: AnyJob): Promise<CommentDetectionResult>;
|
|
171
|
-
/**
|
|
172
|
-
* Emit completion event with result data
|
|
173
|
-
* Override base class to emit job.completed event
|
|
174
|
-
*/
|
|
175
|
-
protected emitCompletionEvent(job: RunningJob<CommentDetectionParams, CommentDetectionProgress>, result: CommentDetectionResult): Promise<void>;
|
|
176
|
-
/**
|
|
177
|
-
* Override updateJobProgress to emit events to Event Store
|
|
178
|
-
*/
|
|
179
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
180
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
181
|
-
private processCommentDetectionJob;
|
|
182
|
-
private createCommentAnnotation;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Tag Detection Worker
|
|
187
|
-
*
|
|
188
|
-
* Processes tag-detection jobs: runs AI inference to identify passages
|
|
189
|
-
* serving specific structural roles (IRAC, IMRAD, Toulmin, etc.) and
|
|
190
|
-
* creates tag annotations with dual-body structure.
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
declare class TagAnnotationWorker extends JobWorker {
|
|
194
|
-
private config;
|
|
195
|
-
private eventStore;
|
|
196
|
-
private inferenceClient;
|
|
197
|
-
private eventBus;
|
|
198
|
-
private isFirstProgress;
|
|
199
|
-
constructor(jobQueue: JobQueue, config: EnvironmentConfig, eventStore: EventStore, inferenceClient: InferenceClient, eventBus: EventBus, logger: Logger);
|
|
200
|
-
protected getWorkerName(): string;
|
|
201
|
-
protected canProcessJob(job: AnyJob): boolean;
|
|
202
|
-
protected executeJob(job: AnyJob): Promise<TagDetectionResult>;
|
|
203
|
-
/**
|
|
204
|
-
* Emit completion event with result data
|
|
205
|
-
* Override base class to emit job.completed event
|
|
206
|
-
*/
|
|
207
|
-
protected emitCompletionEvent(job: RunningJob<TagDetectionParams, TagDetectionProgress>, result: TagDetectionResult): Promise<void>;
|
|
208
|
-
/**
|
|
209
|
-
* Override updateJobProgress to emit events to Event Store
|
|
210
|
-
*/
|
|
211
|
-
protected updateJobProgress(job: AnyJob): Promise<void>;
|
|
212
|
-
protected handleJobFailure(job: AnyJob, error: any): Promise<void>;
|
|
213
|
-
private processTagDetectionJob;
|
|
214
|
-
private createTagAnnotation;
|
|
215
20
|
}
|
|
216
21
|
|
|
217
22
|
/**
|
|
@@ -235,7 +40,6 @@ declare class TagAnnotationWorker extends JobWorker {
|
|
|
235
40
|
*/
|
|
236
41
|
|
|
237
42
|
declare class GraphDBConsumer {
|
|
238
|
-
private config;
|
|
239
43
|
private eventStore;
|
|
240
44
|
private graphDb;
|
|
241
45
|
private static readonly GRAPH_RELEVANT_EVENTS;
|
|
@@ -247,7 +51,7 @@ declare class GraphDBConsumer {
|
|
|
247
51
|
private pipelineSubscription;
|
|
248
52
|
private lastProcessed;
|
|
249
53
|
private readonly logger;
|
|
250
|
-
constructor(
|
|
54
|
+
constructor(eventStore: EventStore, graphDb: GraphDatabase, logger: Logger);
|
|
251
55
|
initialize(): Promise<void>;
|
|
252
56
|
/**
|
|
253
57
|
* Subscribe globally to ALL events, pre-filter to graph-relevant types,
|
|
@@ -307,6 +111,221 @@ declare class GraphDBConsumer {
|
|
|
307
111
|
shutdown(): Promise<void>;
|
|
308
112
|
}
|
|
309
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Knowledge Base
|
|
116
|
+
*
|
|
117
|
+
* The inert store that records what intelligent actors decide.
|
|
118
|
+
* Groups the four KB subsystems from ARCHITECTURE.md:
|
|
119
|
+
*
|
|
120
|
+
* - Event Log (immutable append-only) — via EventStore
|
|
121
|
+
* - Materialized Views (fast single-doc queries) — via ViewStorage
|
|
122
|
+
* - Content Store (SHA-256 addressed, deduplicated) — via RepresentationStore
|
|
123
|
+
* - Graph (eventually consistent relationship projection) — via GraphDatabase
|
|
124
|
+
*
|
|
125
|
+
* The Gatherer and Binder are the only actors that read from these stores directly.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
interface KnowledgeBase {
|
|
129
|
+
eventStore: EventStore;
|
|
130
|
+
views: ViewStorage;
|
|
131
|
+
content: RepresentationStore;
|
|
132
|
+
graph: GraphDatabase;
|
|
133
|
+
}
|
|
134
|
+
declare function createKnowledgeBase(eventStore: EventStore, basePath: string, projectRoot: string | undefined, graphDb: GraphDatabase, logger: Logger): KnowledgeBase;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Gatherer Actor
|
|
138
|
+
*
|
|
139
|
+
* The read actor for the knowledge base. Subscribes to gather and browse events,
|
|
140
|
+
* queries KB stores via context modules, and emits results back to the bus.
|
|
141
|
+
*
|
|
142
|
+
* From ARCHITECTURE.md:
|
|
143
|
+
* "When a Generator Agent or Linker Agent emits a gather event, the Gatherer
|
|
144
|
+
* receives it from the bus, queries the relevant KB stores, and assembles
|
|
145
|
+
* the context needed for downstream work."
|
|
146
|
+
*
|
|
147
|
+
* Handles:
|
|
148
|
+
* - gather:requested / gather:resource-requested — LLM context assembly
|
|
149
|
+
* - browse:resource-requested — single resource metadata (materialized from events)
|
|
150
|
+
* - browse:resources-requested — list resources
|
|
151
|
+
* - browse:annotations-requested — all annotations for a resource
|
|
152
|
+
* - browse:annotation-requested — single annotation with resolved resource
|
|
153
|
+
* - browse:events-requested — resource event history
|
|
154
|
+
* - browse:annotation-history-requested — annotation event history
|
|
155
|
+
* - mark:entity-types-requested — list entity types
|
|
156
|
+
*
|
|
157
|
+
* RxJS pipeline follows the GraphDBConsumer pattern:
|
|
158
|
+
* - groupBy(resourceUri) for per-resource isolation (gather events)
|
|
159
|
+
* - mergeMap for independent request-response (browse events)
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
declare class Gatherer {
|
|
163
|
+
private kb;
|
|
164
|
+
private eventBus;
|
|
165
|
+
private inferenceClient;
|
|
166
|
+
private config?;
|
|
167
|
+
private subscriptions;
|
|
168
|
+
private readonly logger;
|
|
169
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, inferenceClient: InferenceClient, logger: Logger, config?: MakeMeaningConfig | undefined);
|
|
170
|
+
initialize(): Promise<void>;
|
|
171
|
+
private handleAnnotationGather;
|
|
172
|
+
private handleResourceGather;
|
|
173
|
+
private handleBrowseResource;
|
|
174
|
+
private handleBrowseResources;
|
|
175
|
+
private handleBrowseAnnotations;
|
|
176
|
+
private handleBrowseAnnotation;
|
|
177
|
+
private handleBrowseEvents;
|
|
178
|
+
private handleBrowseAnnotationHistory;
|
|
179
|
+
private handleEntityTypes;
|
|
180
|
+
stop(): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Binder Actor
|
|
185
|
+
*
|
|
186
|
+
* Bridge between the event bus and the knowledge base for entity resolution.
|
|
187
|
+
* Subscribes to bind search events and referenced-by queries, queries KB stores
|
|
188
|
+
* (graph, views), and emits results back to the bus.
|
|
189
|
+
*
|
|
190
|
+
* From ARCHITECTURE.md:
|
|
191
|
+
* "When an Analyst or Linker Agent emits a bind event, the Binder receives it
|
|
192
|
+
* from the bus, searches the KB stores for matching resources, and resolves
|
|
193
|
+
* references — linking a mention to its referent."
|
|
194
|
+
*
|
|
195
|
+
* Handles:
|
|
196
|
+
* - bind:search-requested — search for binding candidates
|
|
197
|
+
* - bind:referenced-by-requested — find annotations that reference a resource
|
|
198
|
+
*
|
|
199
|
+
* The Binder handles only the read side (searching for candidates).
|
|
200
|
+
* The write side (annotation.body.updated) stays in the route where
|
|
201
|
+
* userId is available from auth context. That domain event still flows
|
|
202
|
+
* through the bus via EventStore auto-publish.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
declare class Binder {
|
|
206
|
+
private kb;
|
|
207
|
+
private eventBus;
|
|
208
|
+
private inferenceClient?;
|
|
209
|
+
private subscriptions;
|
|
210
|
+
private readonly logger;
|
|
211
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger, inferenceClient?: InferenceClient | undefined);
|
|
212
|
+
initialize(): Promise<void>;
|
|
213
|
+
private handleSearch;
|
|
214
|
+
/**
|
|
215
|
+
* Context-driven search: multi-source retrieval + composite scoring
|
|
216
|
+
*
|
|
217
|
+
* Retrieval sources:
|
|
218
|
+
* 1. Name match — graph.searchResources(searchTerm)
|
|
219
|
+
* 2. Entity type match — graph.listResources({ entityTypes })
|
|
220
|
+
* 3. Graph neighborhood — connections from GatheredContext
|
|
221
|
+
*
|
|
222
|
+
* Ranking signals:
|
|
223
|
+
* - Entity type overlap (Jaccard similarity)
|
|
224
|
+
* - Bidirectionality (already connected both ways)
|
|
225
|
+
* - Citation weight (well-connected = important)
|
|
226
|
+
* - Name match quality (exact > prefix > contains)
|
|
227
|
+
* - Recency (newer resources scored higher)
|
|
228
|
+
*/
|
|
229
|
+
private contextDrivenSearch;
|
|
230
|
+
/**
|
|
231
|
+
* LLM-based semantic relevance scoring (GraphRAG-style)
|
|
232
|
+
*
|
|
233
|
+
* Batches candidates into a single prompt asking the LLM to score
|
|
234
|
+
* each candidate's semantic relevance given the passage and graph context.
|
|
235
|
+
*
|
|
236
|
+
* @returns Map of resourceId → score (0-1)
|
|
237
|
+
*/
|
|
238
|
+
private inferenceSemanticScore;
|
|
239
|
+
private handleReferencedBy;
|
|
240
|
+
stop(): Promise<void>;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Stower Actor
|
|
245
|
+
*
|
|
246
|
+
* The single write gateway to the Knowledge Base. Subscribes to command
|
|
247
|
+
* events on the EventBus and translates them into domain events on the
|
|
248
|
+
* EventStore + content writes to the RepresentationStore.
|
|
249
|
+
*
|
|
250
|
+
* From ARCHITECTURE.md:
|
|
251
|
+
* The Knowledge Base has exactly three actor interfaces:
|
|
252
|
+
* - Stower (write) — this actor
|
|
253
|
+
* - Gatherer (read context)
|
|
254
|
+
* - Binder (read search)
|
|
255
|
+
*
|
|
256
|
+
* No other code should call eventStore.appendEvent() or repStore.store().
|
|
257
|
+
*
|
|
258
|
+
* Subscriptions:
|
|
259
|
+
* - yield:create → resource.created (+ content store) → yield:created / yield:create-failed
|
|
260
|
+
* - mark:create → annotation.added → mark:created / mark:create-failed
|
|
261
|
+
* - mark:delete → annotation.removed → mark:deleted / mark:delete-failed
|
|
262
|
+
* - mark:update-body → annotation.body.updated → (no result event yet)
|
|
263
|
+
* - mark:archive → resource.archived (resource-scoped, no result event)
|
|
264
|
+
* - mark:unarchive → resource.unarchived (resource-scoped, no result event)
|
|
265
|
+
* - mark:add-entity-type → entitytype.added → mark:entity-type-added / mark:entity-type-add-failed
|
|
266
|
+
* - mark:update-entity-types → entitytag.added / entitytag.removed
|
|
267
|
+
* - job:start → job.started
|
|
268
|
+
* - job:report-progress → job.progress
|
|
269
|
+
* - job:complete → job.completed
|
|
270
|
+
* - job:fail → job.failed
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
type ResourceDescriptor$3 = components['schemas']['ResourceDescriptor'];
|
|
274
|
+
interface CreateResourceResult {
|
|
275
|
+
resourceId: ResourceId;
|
|
276
|
+
resource: ResourceDescriptor$3;
|
|
277
|
+
}
|
|
278
|
+
declare class Stower {
|
|
279
|
+
private kb;
|
|
280
|
+
private eventBus;
|
|
281
|
+
private subscription;
|
|
282
|
+
private readonly logger;
|
|
283
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger);
|
|
284
|
+
initialize(): Promise<void>;
|
|
285
|
+
private handleYieldCreate;
|
|
286
|
+
private handleMarkCreate;
|
|
287
|
+
private handleMarkDelete;
|
|
288
|
+
private handleMarkUpdateBody;
|
|
289
|
+
private handleMarkArchive;
|
|
290
|
+
private handleMarkUnarchive;
|
|
291
|
+
private handleAddEntityType;
|
|
292
|
+
private handleUpdateEntityTypes;
|
|
293
|
+
private handleJobStart;
|
|
294
|
+
private handleJobReportProgress;
|
|
295
|
+
private handleJobComplete;
|
|
296
|
+
private handleJobFail;
|
|
297
|
+
stop(): Promise<void>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Clone Token Manager
|
|
302
|
+
*
|
|
303
|
+
* Reactive actor that handles clone token operations via the EventBus.
|
|
304
|
+
* Manages an in-memory token store for resource cloning workflows.
|
|
305
|
+
*
|
|
306
|
+
* Handles:
|
|
307
|
+
* - yield:clone-token-requested — generate a clone token for a resource
|
|
308
|
+
* - yield:clone-resource-requested — look up a resource by clone token
|
|
309
|
+
* - yield:clone-create — create a new resource from a clone token
|
|
310
|
+
*
|
|
311
|
+
* From COMPLETE-EVENT-PROTOCOL.md:
|
|
312
|
+
* "Clone tokens produce new resources — that's yield."
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
declare class CloneTokenManager {
|
|
316
|
+
private kb;
|
|
317
|
+
private eventBus;
|
|
318
|
+
private subscriptions;
|
|
319
|
+
private readonly logger;
|
|
320
|
+
private readonly tokens;
|
|
321
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger);
|
|
322
|
+
initialize(): Promise<void>;
|
|
323
|
+
private handleGenerateToken;
|
|
324
|
+
private handleGetResource;
|
|
325
|
+
private handleCreateResource;
|
|
326
|
+
stop(): Promise<void>;
|
|
327
|
+
}
|
|
328
|
+
|
|
310
329
|
/**
|
|
311
330
|
* Make-Meaning Service
|
|
312
331
|
*
|
|
@@ -320,10 +339,9 @@ declare class GraphDBConsumer {
|
|
|
320
339
|
*/
|
|
321
340
|
|
|
322
341
|
interface MakeMeaningService {
|
|
342
|
+
kb: KnowledgeBase;
|
|
323
343
|
jobQueue: JobQueue;
|
|
324
344
|
eventStore: EventStore;
|
|
325
|
-
eventBus: EventBus;
|
|
326
|
-
repStore: RepresentationStore;
|
|
327
345
|
inferenceClient: InferenceClient;
|
|
328
346
|
graphDb: GraphDatabase;
|
|
329
347
|
workers: {
|
|
@@ -335,15 +353,19 @@ interface MakeMeaningService {
|
|
|
335
353
|
tag: TagAnnotationWorker;
|
|
336
354
|
};
|
|
337
355
|
graphConsumer: GraphDBConsumer;
|
|
356
|
+
stower: Stower;
|
|
357
|
+
gatherer: Gatherer;
|
|
358
|
+
binder: Binder;
|
|
359
|
+
cloneTokenManager: CloneTokenManager;
|
|
338
360
|
stop: () => Promise<void>;
|
|
339
361
|
}
|
|
340
|
-
declare function startMakeMeaning(config:
|
|
362
|
+
declare function startMakeMeaning(config: MakeMeaningConfig, eventBus: EventBus, logger: Logger): Promise<MakeMeaningService>;
|
|
341
363
|
|
|
342
364
|
/**
|
|
343
365
|
* Entity Types Bootstrap Service
|
|
344
366
|
*
|
|
345
367
|
* On startup, checks if the entity types projection exists.
|
|
346
|
-
* If not, emits
|
|
368
|
+
* If not, emits mark:add-entity-type for each DEFAULT_ENTITY_TYPES entry.
|
|
347
369
|
* This ensures the system has entity types available immediately after first deployment.
|
|
348
370
|
*/
|
|
349
371
|
|
|
@@ -351,7 +373,7 @@ declare function startMakeMeaning(config: EnvironmentConfig, eventBus: EventBus,
|
|
|
351
373
|
* Bootstrap entity types projection if it doesn't exist.
|
|
352
374
|
* Uses a system user ID (00000000-0000-0000-0000-000000000000) for bootstrap events.
|
|
353
375
|
*/
|
|
354
|
-
declare function bootstrapEntityTypes(
|
|
376
|
+
declare function bootstrapEntityTypes(eventBus: EventBus, config: MakeMeaningConfig, logger?: Logger): Promise<void>;
|
|
355
377
|
/**
|
|
356
378
|
* Reset the bootstrap flag (used for testing)
|
|
357
379
|
*/
|
|
@@ -367,19 +389,242 @@ declare function resetBootstrap(): void;
|
|
|
367
389
|
/**
|
|
368
390
|
* Read entity types from view storage projection
|
|
369
391
|
*/
|
|
370
|
-
declare function readEntityTypesProjection(config:
|
|
392
|
+
declare function readEntityTypesProjection(config: MakeMeaningConfig): Promise<string[]>;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Exchange Format Manifest Types
|
|
396
|
+
*
|
|
397
|
+
* Defines the metadata structures for backup archives.
|
|
398
|
+
* The manifest is the first entry in an archive and describes its contents.
|
|
399
|
+
*/
|
|
400
|
+
declare const BACKUP_FORMAT: "semiont-backup";
|
|
401
|
+
declare const FORMAT_VERSION = 1;
|
|
402
|
+
interface BackupManifestHeader {
|
|
403
|
+
format: typeof BACKUP_FORMAT;
|
|
404
|
+
version: number;
|
|
405
|
+
exportedAt: string;
|
|
406
|
+
sourceUrl: string;
|
|
407
|
+
stats: {
|
|
408
|
+
streams: number;
|
|
409
|
+
events: number;
|
|
410
|
+
blobs: number;
|
|
411
|
+
contentBytes: number;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
interface BackupStreamSummary {
|
|
415
|
+
stream: string;
|
|
416
|
+
eventCount: number;
|
|
417
|
+
firstChecksum: string;
|
|
418
|
+
lastChecksum: string;
|
|
419
|
+
}
|
|
420
|
+
declare const LINKED_DATA_FORMAT: "semiont-linked-data";
|
|
421
|
+
interface LinkedDataManifest {
|
|
422
|
+
'@context': Record<string, string>;
|
|
423
|
+
'@type': string;
|
|
424
|
+
'semiont:format': typeof LINKED_DATA_FORMAT;
|
|
425
|
+
'semiont:version': number;
|
|
426
|
+
'dct:created': string;
|
|
427
|
+
'prov:wasGeneratedBy': {
|
|
428
|
+
'@type': string;
|
|
429
|
+
'prov:used': string;
|
|
430
|
+
};
|
|
431
|
+
'semiont:entityTypes': string[];
|
|
432
|
+
'void:entities': number;
|
|
433
|
+
}
|
|
434
|
+
declare function isBackupManifest(obj: unknown): obj is BackupManifestHeader;
|
|
435
|
+
declare function validateManifestVersion(version: number): void;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Backup Exporter
|
|
439
|
+
*
|
|
440
|
+
* Produces a lossless tar.gz archive of the system of record:
|
|
441
|
+
* - Event log (all streams, JSONL format)
|
|
442
|
+
* - Content store (content-addressed blobs)
|
|
443
|
+
*
|
|
444
|
+
* Reads events via EventStore and content via RepresentationStore.
|
|
445
|
+
* The archive can restore a complete knowledge base.
|
|
446
|
+
*/
|
|
447
|
+
|
|
448
|
+
/** Subset of EventStore used by the backup exporter. */
|
|
449
|
+
interface BackupEventStoreReader {
|
|
450
|
+
log: {
|
|
451
|
+
storage: {
|
|
452
|
+
getAllResourceIds(): Promise<ResourceId[]>;
|
|
453
|
+
};
|
|
454
|
+
getEvents(resourceId: ResourceId): Promise<StoredEvent[]>;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
/** Subset of RepresentationStore used by the backup exporter. */
|
|
458
|
+
interface BackupContentReader {
|
|
459
|
+
retrieve(checksum: string, mediaType: string): Promise<Buffer>;
|
|
460
|
+
}
|
|
461
|
+
interface BackupExporterOptions {
|
|
462
|
+
eventStore: BackupEventStoreReader;
|
|
463
|
+
content: BackupContentReader;
|
|
464
|
+
sourceUrl: string;
|
|
465
|
+
logger?: Logger;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Export a full backup of the knowledge base to a tar.gz stream.
|
|
469
|
+
*
|
|
470
|
+
* Archive structure:
|
|
471
|
+
* .semiont/manifest.jsonl - Format metadata + per-stream checksums
|
|
472
|
+
* .semiont/events/__system__.jsonl - System events
|
|
473
|
+
* .semiont/events/{resourceId}.jsonl - Per-resource events
|
|
474
|
+
* {checksum}.{ext} - Content blobs (root level)
|
|
475
|
+
*/
|
|
476
|
+
declare function exportBackup(options: BackupExporterOptions, output: Writable): Promise<BackupManifestHeader>;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Event Replay
|
|
480
|
+
*
|
|
481
|
+
* Replays parsed JSONL event streams through the EventBus.
|
|
482
|
+
* Each domain event is translated to the corresponding command event
|
|
483
|
+
* (e.g. resource.created → yield:create), emitted, and the result
|
|
484
|
+
* event is awaited before proceeding (backpressure).
|
|
485
|
+
*
|
|
486
|
+
* Content blobs are resolved lazily via a lookup function so that
|
|
487
|
+
* the caller controls memory strategy (streaming, on-disk, etc.).
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Resolves a content blob by its checksum.
|
|
492
|
+
* Returned by the caller so replay doesn't dictate memory strategy.
|
|
493
|
+
*/
|
|
494
|
+
type ContentBlobResolver = (checksum: string) => Buffer | undefined;
|
|
495
|
+
interface ReplayStats {
|
|
496
|
+
eventsReplayed: number;
|
|
497
|
+
resourcesCreated: number;
|
|
498
|
+
annotationsCreated: number;
|
|
499
|
+
entityTypesAdded: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Backup Importer
|
|
504
|
+
*
|
|
505
|
+
* Restores a knowledge base from a backup tar.gz archive.
|
|
506
|
+
* Replays events through the EventBus → Stower pipeline so all
|
|
507
|
+
* derived state (materialized views, graph) rebuilds naturally.
|
|
508
|
+
*
|
|
509
|
+
* Accepts a Readable stream so callers can pipe directly from disk
|
|
510
|
+
* or network without buffering the entire archive first.
|
|
511
|
+
* Content blobs are resolved lazily via a closure over the parsed
|
|
512
|
+
* tar entries, avoiding a separate copy of all blob data in memory.
|
|
513
|
+
*/
|
|
514
|
+
|
|
515
|
+
interface BackupImporterOptions {
|
|
516
|
+
eventBus: EventBus;
|
|
517
|
+
logger?: Logger;
|
|
518
|
+
}
|
|
519
|
+
interface BackupImportResult {
|
|
520
|
+
manifest: BackupManifestHeader;
|
|
521
|
+
stats: ReplayStats;
|
|
522
|
+
hashChainValid: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Import a backup archive by replaying events through the EventBus.
|
|
526
|
+
*
|
|
527
|
+
* Flow:
|
|
528
|
+
* 1. Stream and decompress tar.gz entries
|
|
529
|
+
* 2. Parse .semiont/manifest.jsonl → validate format
|
|
530
|
+
* 3. Build blob resolver over root-level content entries
|
|
531
|
+
* 4. Replay .semiont/events/__system__.jsonl (entity types)
|
|
532
|
+
* 5. Replay each .semiont/events/{resourceId}.jsonl (resources, annotations)
|
|
533
|
+
*
|
|
534
|
+
* Events flow: importer → EventBus → Stower → EventStore + Views
|
|
535
|
+
*/
|
|
536
|
+
declare function importBackup(archive: Readable, options: BackupImporterOptions): Promise<BackupImportResult>;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Linked Data Exporter
|
|
540
|
+
*
|
|
541
|
+
* Produces a JSON-LD tar.gz archive from the current state of the knowledge base.
|
|
542
|
+
* Reads materialized views (not the event log) for a fast, current-state export.
|
|
543
|
+
*
|
|
544
|
+
* Archive structure:
|
|
545
|
+
* .semiont/manifest.jsonld - JSON-LD manifest with format metadata
|
|
546
|
+
* .semiont/resources/{resourceId}.jsonld - One JSON-LD document per resource
|
|
547
|
+
* {checksum}.{ext} - Content blobs (root level)
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
type ResourceDescriptor$2 = components['schemas']['ResourceDescriptor'];
|
|
551
|
+
type Annotation$3 = components['schemas']['Annotation'];
|
|
552
|
+
/** Subset of ViewStorage used by the linked-data exporter. */
|
|
553
|
+
interface LinkedDataViewReader {
|
|
554
|
+
getAll(): Promise<Array<{
|
|
555
|
+
resource: ResourceDescriptor$2;
|
|
556
|
+
annotations: {
|
|
557
|
+
annotations: Annotation$3[];
|
|
558
|
+
};
|
|
559
|
+
}>>;
|
|
560
|
+
}
|
|
561
|
+
/** Subset of RepresentationStore used by the linked-data exporter. */
|
|
562
|
+
interface LinkedDataContentReader {
|
|
563
|
+
retrieve(checksum: string, mediaType: string): Promise<Buffer>;
|
|
564
|
+
}
|
|
565
|
+
interface LinkedDataExporterOptions {
|
|
566
|
+
views: LinkedDataViewReader;
|
|
567
|
+
content: LinkedDataContentReader;
|
|
568
|
+
sourceUrl: string;
|
|
569
|
+
entityTypes: string[];
|
|
570
|
+
includeArchived?: boolean;
|
|
571
|
+
logger?: Logger;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Export the knowledge base as a JSON-LD tar.gz archive.
|
|
575
|
+
*/
|
|
576
|
+
declare function exportLinkedData(options: LinkedDataExporterOptions, output: Writable): Promise<LinkedDataManifest>;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Linked Data Importer
|
|
580
|
+
*
|
|
581
|
+
* Creates resources from a JSON-LD tar.gz archive exported by the linked-data exporter.
|
|
582
|
+
* Unlike the backup importer, this is lossy — new resources are created (new IDs),
|
|
583
|
+
* no event history is preserved. Entity types are restored from the manifest.
|
|
584
|
+
*
|
|
585
|
+
* Parses .semiont/manifest.jsonld for format validation and entity types,
|
|
586
|
+
* then processes each .semiont/resources/{resourceId}.jsonld to create
|
|
587
|
+
* resources and annotations via the EventBus → Stower pipeline.
|
|
588
|
+
*/
|
|
589
|
+
|
|
590
|
+
interface LinkedDataImporterOptions {
|
|
591
|
+
eventBus: EventBus;
|
|
592
|
+
userId: UserId;
|
|
593
|
+
logger?: Logger;
|
|
594
|
+
}
|
|
595
|
+
interface LinkedDataImportResult {
|
|
596
|
+
manifest: LinkedDataManifest;
|
|
597
|
+
resourcesCreated: number;
|
|
598
|
+
annotationsCreated: number;
|
|
599
|
+
entityTypesAdded: number;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Import a JSON-LD archive by creating resources through the EventBus.
|
|
603
|
+
*
|
|
604
|
+
* Flow:
|
|
605
|
+
* 1. Stream and decompress tar.gz entries
|
|
606
|
+
* 2. Parse .semiont/manifest.jsonld → validate format
|
|
607
|
+
* 3. Build blob resolver over root-level content entries
|
|
608
|
+
* 4. Add entity types from manifest via mark:add-entity-type
|
|
609
|
+
* 5. For each .semiont/resources/{id}.jsonld:
|
|
610
|
+
* a. Parse JSON-LD document
|
|
611
|
+
* b. Resolve content blob by checksum from representations
|
|
612
|
+
* c. Emit yield:create → await yield:created
|
|
613
|
+
* d. For each annotation: emit mark:create → await mark:created
|
|
614
|
+
*/
|
|
615
|
+
declare function importLinkedData(archive: Readable, options: LinkedDataImporterOptions): Promise<LinkedDataImportResult>;
|
|
371
616
|
|
|
372
617
|
/**
|
|
373
618
|
* Resource Operations
|
|
374
619
|
*
|
|
375
|
-
* Business logic for resource operations
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
620
|
+
* Business logic for resource operations. All writes go through the EventBus
|
|
621
|
+
* — the Stower actor subscribes and handles persistence.
|
|
622
|
+
*
|
|
623
|
+
* For create: emits yield:create, awaits yield:created / yield:create-failed.
|
|
624
|
+
* For archive/unarchive: emits mark:archive / mark:unarchive on scoped bus.
|
|
625
|
+
* For entity type updates: emits mark:update-entity-types.
|
|
380
626
|
*/
|
|
381
627
|
|
|
382
|
-
type CreateResourceResponse = components['schemas']['CreateResourceResponse'];
|
|
383
628
|
type ContentFormat = components['schemas']['ContentFormat'];
|
|
384
629
|
interface UpdateResourceInput {
|
|
385
630
|
resourceId: ResourceId;
|
|
@@ -399,40 +644,27 @@ interface CreateResourceInput {
|
|
|
399
644
|
}
|
|
400
645
|
declare class ResourceOperations {
|
|
401
646
|
/**
|
|
402
|
-
* Create a new resource
|
|
403
|
-
* Orchestrates: content storage → event emission → response building
|
|
404
|
-
*/
|
|
405
|
-
static createResource(input: CreateResourceInput, userId: UserId, eventStore: EventStore, repStore: RepresentationStore, config: EnvironmentConfig): Promise<CreateResourceResponse>;
|
|
406
|
-
/**
|
|
407
|
-
* Update resource metadata by computing diffs and emitting events
|
|
408
|
-
* Handles: archived status changes, entity type additions/removals
|
|
409
|
-
*/
|
|
410
|
-
static updateResource(input: UpdateResourceInput, eventStore: EventStore): Promise<void>;
|
|
411
|
-
/**
|
|
412
|
-
* Update archived status by emitting resource.archived or resource.unarchived event
|
|
647
|
+
* Create a new resource via EventBus → Stower
|
|
413
648
|
*/
|
|
414
|
-
|
|
649
|
+
static createResource(input: CreateResourceInput, userId: UserId, eventBus: EventBus): Promise<ResourceId>;
|
|
415
650
|
/**
|
|
416
|
-
* Update
|
|
651
|
+
* Update resource metadata via EventBus → Stower
|
|
417
652
|
*/
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* Compute diff between current and updated entity types
|
|
421
|
-
* Returns arrays of added and removed entity types
|
|
422
|
-
*/
|
|
423
|
-
private static computeEntityTypeDiff;
|
|
653
|
+
static updateResource(input: UpdateResourceInput, eventBus: EventBus): Promise<void>;
|
|
424
654
|
}
|
|
425
655
|
|
|
426
656
|
/**
|
|
427
657
|
* Annotation Operations
|
|
428
658
|
*
|
|
429
|
-
* Business logic for annotation CRUD operations
|
|
430
|
-
*
|
|
431
|
-
* - Update annotation body (operations: add/remove/replace)
|
|
432
|
-
* - Delete annotations (validation, event emission)
|
|
659
|
+
* Business logic for annotation CRUD operations. All writes go through the
|
|
660
|
+
* EventBus — the Stower actor subscribes and handles persistence.
|
|
433
661
|
*
|
|
662
|
+
* - Create: emits mark:create with full annotation + userId + resourceId
|
|
663
|
+
* - Update body: emits mark:update-body
|
|
664
|
+
* - Delete: emits mark:delete with annotationId + userId + resourceId
|
|
434
665
|
*/
|
|
435
666
|
|
|
667
|
+
type Agent = components['schemas']['Agent'];
|
|
436
668
|
type Annotation$2 = components['schemas']['Annotation'];
|
|
437
669
|
type CreateAnnotationRequest = components['schemas']['CreateAnnotationRequest'];
|
|
438
670
|
type UpdateAnnotationBodyRequest = components['schemas']['UpdateAnnotationBodyRequest'];
|
|
@@ -444,21 +676,17 @@ interface UpdateAnnotationBodyResult {
|
|
|
444
676
|
}
|
|
445
677
|
declare class AnnotationOperations {
|
|
446
678
|
/**
|
|
447
|
-
* Create a new annotation
|
|
679
|
+
* Create a new annotation via EventBus → Stower
|
|
448
680
|
*/
|
|
449
|
-
static createAnnotation(request: CreateAnnotationRequest, userId: UserId,
|
|
681
|
+
static createAnnotation(request: CreateAnnotationRequest, userId: UserId, creator: Agent, eventBus: EventBus): Promise<CreateAnnotationResult>;
|
|
450
682
|
/**
|
|
451
|
-
* Update annotation body
|
|
683
|
+
* Update annotation body via EventBus → Stower
|
|
452
684
|
*/
|
|
453
|
-
static updateAnnotationBody(id: string, request: UpdateAnnotationBodyRequest, userId: UserId,
|
|
685
|
+
static updateAnnotationBody(id: string, request: UpdateAnnotationBodyRequest, userId: UserId, eventBus: EventBus, kb: KnowledgeBase): Promise<UpdateAnnotationBodyResult>;
|
|
454
686
|
/**
|
|
455
|
-
* Delete an annotation
|
|
687
|
+
* Delete an annotation via EventBus → Stower
|
|
456
688
|
*/
|
|
457
|
-
static deleteAnnotation(id: string,
|
|
458
|
-
/**
|
|
459
|
-
* Apply body operations (add/remove/replace) to annotation body
|
|
460
|
-
*/
|
|
461
|
-
private static applyBodyOperations;
|
|
689
|
+
static deleteAnnotation(id: string, resourceIdStr: string, userId: UserId, eventBus: EventBus, kb: KnowledgeBase, logger?: Logger): Promise<void>;
|
|
462
690
|
}
|
|
463
691
|
|
|
464
692
|
/**
|
|
@@ -477,23 +705,23 @@ declare class ResourceContext {
|
|
|
477
705
|
/**
|
|
478
706
|
* Get resource metadata from view storage
|
|
479
707
|
*/
|
|
480
|
-
static getResourceMetadata(resourceId: ResourceId,
|
|
708
|
+
static getResourceMetadata(resourceId: ResourceId, kb: KnowledgeBase): Promise<ResourceDescriptor$1 | null>;
|
|
481
709
|
/**
|
|
482
710
|
* List all resources by scanning view storage
|
|
483
711
|
*/
|
|
484
|
-
static listResources(filters: ListResourcesFilters | undefined,
|
|
712
|
+
static listResources(filters: ListResourcesFilters | undefined, kb: KnowledgeBase): Promise<ResourceDescriptor$1[]>;
|
|
485
713
|
/**
|
|
486
714
|
* Add content previews to resources (for search results)
|
|
487
715
|
* Retrieves and decodes the first 200 characters of each resource's primary representation
|
|
488
716
|
*/
|
|
489
|
-
static addContentPreviews(resources: ResourceDescriptor$1[],
|
|
717
|
+
static addContentPreviews(resources: ResourceDescriptor$1[], kb: KnowledgeBase): Promise<Array<ResourceDescriptor$1 & {
|
|
490
718
|
content: string;
|
|
491
719
|
}>>;
|
|
492
720
|
/**
|
|
493
721
|
* Get full content for a resource
|
|
494
722
|
* Retrieves and decodes the primary representation
|
|
495
723
|
*/
|
|
496
|
-
static getResourceContent(resource: ResourceDescriptor$1,
|
|
724
|
+
static getResourceContent(resource: ResourceDescriptor$1, kb: KnowledgeBase): Promise<string | undefined>;
|
|
497
725
|
}
|
|
498
726
|
|
|
499
727
|
/**
|
|
@@ -505,9 +733,6 @@ declare class ResourceContext {
|
|
|
505
733
|
* - Building LLM context for annotations
|
|
506
734
|
* - Extracting annotation text context
|
|
507
735
|
* - Generating AI summaries
|
|
508
|
-
*
|
|
509
|
-
* NOTE: This class contains static utility methods without logger access.
|
|
510
|
-
* Console statements kept for debugging - consider adding logger parameter in future.
|
|
511
736
|
*/
|
|
512
737
|
|
|
513
738
|
type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
|
|
@@ -523,24 +748,25 @@ declare class AnnotationContext {
|
|
|
523
748
|
/**
|
|
524
749
|
* Build LLM context for an annotation
|
|
525
750
|
*
|
|
526
|
-
* @param
|
|
751
|
+
* @param annotationId - Bare annotation ID
|
|
527
752
|
* @param resourceId - Source resource ID
|
|
528
|
-
* @param
|
|
753
|
+
* @param kb - Knowledge base stores
|
|
529
754
|
* @param options - Context building options
|
|
755
|
+
* @param inferenceClient - Optional inference client for target context summary
|
|
530
756
|
* @returns Rich context for LLM processing
|
|
531
757
|
* @throws Error if annotation or resource not found
|
|
532
758
|
*/
|
|
533
|
-
static buildLLMContext(
|
|
759
|
+
static buildLLMContext(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, options?: BuildContextOptions, inferenceClient?: InferenceClient, logger?: Logger): Promise<AnnotationLLMContextResponse>;
|
|
534
760
|
/**
|
|
535
761
|
* Get resource annotations from view storage (fast path)
|
|
536
762
|
* Throws if view missing
|
|
537
763
|
*/
|
|
538
|
-
static getResourceAnnotations(resourceId: ResourceId,
|
|
764
|
+
static getResourceAnnotations(resourceId: ResourceId, kb: KnowledgeBase): Promise<ResourceAnnotations>;
|
|
539
765
|
/**
|
|
540
766
|
* Get all annotations
|
|
541
767
|
* @returns Array of all annotation objects
|
|
542
768
|
*/
|
|
543
|
-
static getAllAnnotations(resourceId: ResourceId,
|
|
769
|
+
static getAllAnnotations(resourceId: ResourceId, kb: KnowledgeBase): Promise<Annotation$1[]>;
|
|
544
770
|
/**
|
|
545
771
|
* Enrich reference annotations with resolved document names
|
|
546
772
|
* Adds _resolvedDocumentName property to annotations that link to documents
|
|
@@ -551,7 +777,7 @@ declare class AnnotationContext {
|
|
|
551
777
|
* Get resource stats (version info)
|
|
552
778
|
* @returns Version and timestamp info for the annotations
|
|
553
779
|
*/
|
|
554
|
-
static getResourceStats(resourceId: ResourceId,
|
|
780
|
+
static getResourceStats(resourceId: ResourceId, kb: KnowledgeBase): Promise<{
|
|
555
781
|
resourceId: ResourceId;
|
|
556
782
|
version: number;
|
|
557
783
|
updatedAt: string;
|
|
@@ -559,12 +785,12 @@ declare class AnnotationContext {
|
|
|
559
785
|
/**
|
|
560
786
|
* Check if resource exists in view storage
|
|
561
787
|
*/
|
|
562
|
-
static resourceExists(resourceId: ResourceId,
|
|
788
|
+
static resourceExists(resourceId: ResourceId, kb: KnowledgeBase): Promise<boolean>;
|
|
563
789
|
/**
|
|
564
790
|
* Get a single annotation by ID
|
|
565
791
|
* O(1) lookup using resource ID to access view storage
|
|
566
792
|
*/
|
|
567
|
-
static getAnnotation(annotationId: AnnotationId, resourceId: ResourceId,
|
|
793
|
+
static getAnnotation(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase): Promise<Annotation$1 | null>;
|
|
568
794
|
/**
|
|
569
795
|
* List annotations with optional filtering
|
|
570
796
|
* @param filters - Optional filters like resourceId and type
|
|
@@ -573,15 +799,15 @@ declare class AnnotationContext {
|
|
|
573
799
|
static listAnnotations(filters: {
|
|
574
800
|
resourceId?: ResourceId;
|
|
575
801
|
type?: AnnotationCategory;
|
|
576
|
-
} | undefined,
|
|
802
|
+
} | undefined, kb: KnowledgeBase): Promise<Annotation$1[]>;
|
|
577
803
|
/**
|
|
578
804
|
* Get annotation context (selected text with surrounding context)
|
|
579
805
|
*/
|
|
580
|
-
static getAnnotationContext(annotationId: AnnotationId, resourceId: ResourceId, contextBefore: number, contextAfter: number,
|
|
806
|
+
static getAnnotationContext(annotationId: AnnotationId, resourceId: ResourceId, contextBefore: number, contextAfter: number, kb: KnowledgeBase): Promise<AnnotationContextResponse>;
|
|
581
807
|
/**
|
|
582
808
|
* Generate AI summary of annotation in context
|
|
583
809
|
*/
|
|
584
|
-
static generateAnnotationSummary(annotationId: AnnotationId, resourceId: ResourceId,
|
|
810
|
+
static generateAnnotationSummary(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, inferenceClient: InferenceClient): Promise<ContextualSummaryResponse>;
|
|
585
811
|
/**
|
|
586
812
|
* Get resource content as string
|
|
587
813
|
*/
|
|
@@ -629,27 +855,27 @@ declare class GraphContext {
|
|
|
629
855
|
* Get all resources referencing this resource (backlinks)
|
|
630
856
|
* Requires graph traversal - must use graph database
|
|
631
857
|
*/
|
|
632
|
-
static getBacklinks(resourceId: ResourceId,
|
|
858
|
+
static getBacklinks(resourceId: ResourceId, kb: KnowledgeBase): Promise<Annotation[]>;
|
|
633
859
|
/**
|
|
634
860
|
* Find shortest path between two resources
|
|
635
861
|
* Requires graph traversal - must use graph database
|
|
636
862
|
*/
|
|
637
|
-
static findPath(fromResourceId: ResourceId, toResourceId: ResourceId,
|
|
863
|
+
static findPath(fromResourceId: ResourceId, toResourceId: ResourceId, kb: KnowledgeBase, maxDepth?: number): Promise<GraphPath[]>;
|
|
638
864
|
/**
|
|
639
865
|
* Get resource connections (graph edges)
|
|
640
866
|
* Requires graph traversal - must use graph database
|
|
641
867
|
*/
|
|
642
|
-
static getResourceConnections(resourceId: ResourceId,
|
|
868
|
+
static getResourceConnections(resourceId: ResourceId, kb: KnowledgeBase): Promise<GraphConnection[]>;
|
|
643
869
|
/**
|
|
644
870
|
* Search resources by name (cross-resource query)
|
|
645
871
|
* Requires full-text search - must use graph database
|
|
646
872
|
*/
|
|
647
|
-
static searchResources(query: string,
|
|
873
|
+
static searchResources(query: string, kb: KnowledgeBase, limit?: number): Promise<ResourceDescriptor[]>;
|
|
648
874
|
/**
|
|
649
875
|
* Build graph representation with nodes and edges for a resource and its connections
|
|
650
876
|
* Retrieves connections from graph and builds visualization-ready structure
|
|
651
877
|
*/
|
|
652
|
-
static buildGraphRepresentation(resourceId: ResourceId, maxRelated: number,
|
|
878
|
+
static buildGraphRepresentation(resourceId: ResourceId, maxRelated: number, kb: KnowledgeBase): Promise<GraphRepresentation>;
|
|
653
879
|
}
|
|
654
880
|
|
|
655
881
|
/**
|
|
@@ -671,274 +897,20 @@ declare class LLMContext {
|
|
|
671
897
|
* Get comprehensive LLM context for a resource
|
|
672
898
|
* Includes: main resource, related resources, annotations, graph, content, summary, references
|
|
673
899
|
*/
|
|
674
|
-
static getResourceContext(resourceId: ResourceId, options: LLMContextOptions,
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* Response parsers for annotation detection motivations
|
|
679
|
-
*
|
|
680
|
-
* Provides static methods to parse and validate AI responses for each motivation type.
|
|
681
|
-
* Includes offset validation and correction logic.
|
|
682
|
-
* Extracted from worker implementations to centralize parsing logic.
|
|
683
|
-
*
|
|
684
|
-
* NOTE: These are static utility methods without logger access.
|
|
685
|
-
* Console statements kept for debugging - consider adding logger parameter in future.
|
|
686
|
-
*/
|
|
687
|
-
/**
|
|
688
|
-
* Represents a detected comment with validated position
|
|
689
|
-
*/
|
|
690
|
-
interface CommentMatch {
|
|
691
|
-
exact: string;
|
|
692
|
-
start: number;
|
|
693
|
-
end: number;
|
|
694
|
-
prefix?: string;
|
|
695
|
-
suffix?: string;
|
|
696
|
-
comment: string;
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Represents a detected highlight with validated position
|
|
700
|
-
*/
|
|
701
|
-
interface HighlightMatch {
|
|
702
|
-
exact: string;
|
|
703
|
-
start: number;
|
|
704
|
-
end: number;
|
|
705
|
-
prefix?: string;
|
|
706
|
-
suffix?: string;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Represents a detected assessment with validated position
|
|
710
|
-
*/
|
|
711
|
-
interface AssessmentMatch {
|
|
712
|
-
exact: string;
|
|
713
|
-
start: number;
|
|
714
|
-
end: number;
|
|
715
|
-
prefix?: string;
|
|
716
|
-
suffix?: string;
|
|
717
|
-
assessment: string;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Represents a detected tag with validated position
|
|
721
|
-
*/
|
|
722
|
-
interface TagMatch {
|
|
723
|
-
exact: string;
|
|
724
|
-
start: number;
|
|
725
|
-
end: number;
|
|
726
|
-
prefix?: string;
|
|
727
|
-
suffix?: string;
|
|
728
|
-
category: string;
|
|
729
|
-
}
|
|
730
|
-
declare class MotivationParsers {
|
|
731
|
-
/**
|
|
732
|
-
* Parse and validate AI response for comment detection
|
|
733
|
-
*
|
|
734
|
-
* @param response - Raw AI response string (may include markdown code fences)
|
|
735
|
-
* @param content - Original content to validate offsets against
|
|
736
|
-
* @returns Array of validated comment matches
|
|
737
|
-
*/
|
|
738
|
-
static parseComments(response: string, content: string): CommentMatch[];
|
|
739
|
-
/**
|
|
740
|
-
* Parse and validate AI response for highlight detection
|
|
741
|
-
*
|
|
742
|
-
* @param response - Raw AI response string (may include markdown code fences)
|
|
743
|
-
* @param content - Original content to validate offsets against
|
|
744
|
-
* @returns Array of validated highlight matches
|
|
745
|
-
*/
|
|
746
|
-
static parseHighlights(response: string, content: string): HighlightMatch[];
|
|
747
|
-
/**
|
|
748
|
-
* Parse and validate AI response for assessment detection
|
|
749
|
-
*
|
|
750
|
-
* @param response - Raw AI response string (may include markdown code fences)
|
|
751
|
-
* @param content - Original content to validate offsets against
|
|
752
|
-
* @returns Array of validated assessment matches
|
|
753
|
-
*/
|
|
754
|
-
static parseAssessments(response: string, content: string): AssessmentMatch[];
|
|
755
|
-
/**
|
|
756
|
-
* Parse and validate AI response for tag detection
|
|
757
|
-
* Note: Does NOT validate offsets - caller must do that with content
|
|
758
|
-
*
|
|
759
|
-
* @param response - Raw AI response string (may include markdown code fences)
|
|
760
|
-
* @returns Array of tag matches (offsets not yet validated)
|
|
761
|
-
*/
|
|
762
|
-
static parseTags(response: string): Omit<TagMatch, 'category'>[];
|
|
763
|
-
/**
|
|
764
|
-
* Validate tag offsets against content and add category
|
|
765
|
-
* Helper for tag detection after initial parsing
|
|
766
|
-
*
|
|
767
|
-
* @param tags - Parsed tags without validated offsets
|
|
768
|
-
* @param content - Original content to validate against
|
|
769
|
-
* @param category - Category to assign to validated tags
|
|
770
|
-
* @returns Array of validated tag matches
|
|
771
|
-
*/
|
|
772
|
-
static validateTagOffsets(tags: Omit<TagMatch, 'category'>[], content: string, category: string): TagMatch[];
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
/**
|
|
776
|
-
* Annotation Detection
|
|
777
|
-
*
|
|
778
|
-
* Orchestrates the full annotation detection pipeline:
|
|
779
|
-
* 1. Fetch resource metadata and content
|
|
780
|
-
* 2. Build AI prompts using MotivationPrompts
|
|
781
|
-
* 3. Call AI inference
|
|
782
|
-
* 4. Parse and validate results using MotivationParsers
|
|
783
|
-
*
|
|
784
|
-
* This is the high-level API for AI-powered annotation detection.
|
|
785
|
-
* Workers and other consumers should use these methods instead of
|
|
786
|
-
* implementing detection logic directly.
|
|
787
|
-
*/
|
|
788
|
-
|
|
789
|
-
declare class AnnotationDetection {
|
|
790
|
-
/**
|
|
791
|
-
* Detect comments in a resource
|
|
792
|
-
*
|
|
793
|
-
* @param resourceId - The resource to analyze
|
|
794
|
-
* @param config - Environment configuration
|
|
795
|
-
* @param client - Inference client for AI operations
|
|
796
|
-
* @param instructions - Optional user instructions for comment generation
|
|
797
|
-
* @param tone - Optional tone guidance (e.g., "academic", "conversational")
|
|
798
|
-
* @param density - Optional target number of comments per 2000 words
|
|
799
|
-
* @returns Array of validated comment matches
|
|
800
|
-
*/
|
|
801
|
-
static detectComments(resourceId: ResourceId, config: EnvironmentConfig, client: InferenceClient, instructions?: string, tone?: string, density?: number): Promise<CommentMatch[]>;
|
|
802
|
-
/**
|
|
803
|
-
* Detect highlights in a resource
|
|
804
|
-
*
|
|
805
|
-
* @param resourceId - The resource to analyze
|
|
806
|
-
* @param config - Environment configuration
|
|
807
|
-
* @param client - Inference client for AI operations
|
|
808
|
-
* @param instructions - Optional user instructions for highlight selection
|
|
809
|
-
* @param density - Optional target number of highlights per 2000 words
|
|
810
|
-
* @returns Array of validated highlight matches
|
|
811
|
-
*/
|
|
812
|
-
static detectHighlights(resourceId: ResourceId, config: EnvironmentConfig, client: InferenceClient, instructions?: string, density?: number): Promise<HighlightMatch[]>;
|
|
813
|
-
/**
|
|
814
|
-
* Detect assessments in a resource
|
|
815
|
-
*
|
|
816
|
-
* @param resourceId - The resource to analyze
|
|
817
|
-
* @param config - Environment configuration
|
|
818
|
-
* @param client - Inference client for AI operations
|
|
819
|
-
* @param instructions - Optional user instructions for assessment generation
|
|
820
|
-
* @param tone - Optional tone guidance (e.g., "critical", "supportive")
|
|
821
|
-
* @param density - Optional target number of assessments per 2000 words
|
|
822
|
-
* @returns Array of validated assessment matches
|
|
823
|
-
*/
|
|
824
|
-
static detectAssessments(resourceId: ResourceId, config: EnvironmentConfig, client: InferenceClient, instructions?: string, tone?: string, density?: number): Promise<AssessmentMatch[]>;
|
|
825
|
-
/**
|
|
826
|
-
* Detect tags in a resource for a specific category
|
|
827
|
-
*
|
|
828
|
-
* @param resourceId - The resource to analyze
|
|
829
|
-
* @param config - Environment configuration
|
|
830
|
-
* @param client - Inference client for AI operations
|
|
831
|
-
* @param schemaId - The tag schema identifier (e.g., "irac", "imrad")
|
|
832
|
-
* @param category - The specific category to detect
|
|
833
|
-
* @returns Array of validated tag matches
|
|
834
|
-
*/
|
|
835
|
-
static detectTags(resourceId: ResourceId, config: EnvironmentConfig, client: InferenceClient, schemaId: string, category: string): Promise<TagMatch[]>;
|
|
836
|
-
/**
|
|
837
|
-
* Load resource content from representation store
|
|
838
|
-
* Helper method used by all detection methods
|
|
839
|
-
*
|
|
840
|
-
* @param resourceId - The resource ID to load
|
|
841
|
-
* @param config - Environment configuration
|
|
842
|
-
* @returns Resource content as string, or null if not available
|
|
843
|
-
*/
|
|
844
|
-
private static loadResourceContent;
|
|
900
|
+
static getResourceContext(resourceId: ResourceId, options: LLMContextOptions, kb: KnowledgeBase, inferenceClient: InferenceClient): Promise<ResourceLLMContextResponse>;
|
|
845
901
|
}
|
|
846
902
|
|
|
847
|
-
/**
|
|
848
|
-
* Prompt builders for annotation detection motivations
|
|
849
|
-
*
|
|
850
|
-
* Provides static methods to build AI prompts for each Web Annotation motivation type.
|
|
851
|
-
* Extracted from worker implementations to centralize prompt logic.
|
|
852
|
-
*/
|
|
853
|
-
declare class MotivationPrompts {
|
|
854
|
-
/**
|
|
855
|
-
* Build a prompt for detecting comment-worthy passages
|
|
856
|
-
*
|
|
857
|
-
* @param content - The text content to analyze (will be truncated to 8000 chars)
|
|
858
|
-
* @param instructions - Optional user-provided instructions
|
|
859
|
-
* @param tone - Optional tone guidance (e.g., "academic", "conversational")
|
|
860
|
-
* @param density - Optional target number of comments per 2000 words
|
|
861
|
-
* @returns Formatted prompt string
|
|
862
|
-
*/
|
|
863
|
-
static buildCommentPrompt(content: string, instructions?: string, tone?: string, density?: number): string;
|
|
864
|
-
/**
|
|
865
|
-
* Build a prompt for detecting highlight-worthy passages
|
|
866
|
-
*
|
|
867
|
-
* @param content - The text content to analyze (will be truncated to 8000 chars)
|
|
868
|
-
* @param instructions - Optional user-provided instructions
|
|
869
|
-
* @param density - Optional target number of highlights per 2000 words
|
|
870
|
-
* @returns Formatted prompt string
|
|
871
|
-
*/
|
|
872
|
-
static buildHighlightPrompt(content: string, instructions?: string, density?: number): string;
|
|
873
|
-
/**
|
|
874
|
-
* Build a prompt for detecting assessment-worthy passages
|
|
875
|
-
*
|
|
876
|
-
* @param content - The text content to analyze (will be truncated to 8000 chars)
|
|
877
|
-
* @param instructions - Optional user-provided instructions
|
|
878
|
-
* @param tone - Optional tone guidance (e.g., "critical", "supportive")
|
|
879
|
-
* @param density - Optional target number of assessments per 2000 words
|
|
880
|
-
* @returns Formatted prompt string
|
|
881
|
-
*/
|
|
882
|
-
static buildAssessmentPrompt(content: string, instructions?: string, tone?: string, density?: number): string;
|
|
883
|
-
/**
|
|
884
|
-
* Build a prompt for detecting structural tags
|
|
885
|
-
*
|
|
886
|
-
* @param content - The full text content to analyze (NOT truncated for structural analysis)
|
|
887
|
-
* @param category - The specific category to detect
|
|
888
|
-
* @param schemaName - Human-readable schema name
|
|
889
|
-
* @param schemaDescription - Schema description
|
|
890
|
-
* @param schemaDomain - Schema domain
|
|
891
|
-
* @param categoryDescription - Category description
|
|
892
|
-
* @param categoryExamples - Example questions/guidance for this category
|
|
893
|
-
* @returns Formatted prompt string
|
|
894
|
-
*/
|
|
895
|
-
static buildTagPrompt(content: string, category: string, schemaName: string, schemaDescription: string, schemaDomain: string, categoryDescription: string, categoryExamples: string[]): string;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Entity reference extracted from text
|
|
900
|
-
*/
|
|
901
|
-
interface ExtractedEntity {
|
|
902
|
-
exact: string;
|
|
903
|
-
entityType: string;
|
|
904
|
-
startOffset: number;
|
|
905
|
-
endOffset: number;
|
|
906
|
-
prefix?: string;
|
|
907
|
-
suffix?: string;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Extract entity references from text using AI
|
|
911
|
-
*
|
|
912
|
-
* @param text - The text to analyze
|
|
913
|
-
* @param entityTypes - Array of entity types to detect (optionally with examples)
|
|
914
|
-
* @param client - Inference client for AI operations
|
|
915
|
-
* @param includeDescriptiveReferences - Include anaphoric/cataphoric references (default: false)
|
|
916
|
-
* @param logger - Optional logger for debugging entity extraction
|
|
917
|
-
* @returns Array of extracted entities with their character offsets
|
|
918
|
-
*/
|
|
919
|
-
declare function extractEntities(exact: string, entityTypes: string[] | {
|
|
920
|
-
type: string;
|
|
921
|
-
examples?: string[];
|
|
922
|
-
}[], client: InferenceClient, includeDescriptiveReferences?: boolean, logger?: Logger): Promise<ExtractedEntity[]>;
|
|
923
|
-
|
|
924
903
|
/**
|
|
925
904
|
* Resource Generation Functions
|
|
926
905
|
*
|
|
927
|
-
* Application-specific resource generation logic
|
|
928
|
-
* - Markdown resource generation from topics
|
|
906
|
+
* Application-specific resource generation logic:
|
|
929
907
|
* - Resource summary generation
|
|
930
908
|
* - Reference suggestion generation
|
|
931
|
-
* - Language handling and template processing
|
|
932
909
|
*
|
|
910
|
+
* NOTE: generateResourceFromTopic lives in @semiont/jobs (canonical location)
|
|
911
|
+
* because make-meaning depends on jobs, not vice versa.
|
|
933
912
|
*/
|
|
934
913
|
|
|
935
|
-
/**
|
|
936
|
-
* Generate resource content using inference
|
|
937
|
-
*/
|
|
938
|
-
declare function generateResourceFromTopic(topic: string, entityTypes: string[], client: InferenceClient, userPrompt?: string, locale?: string, context?: YieldContext, temperature?: number, maxTokens?: number, logger?: Logger): Promise<{
|
|
939
|
-
title: string;
|
|
940
|
-
content: string;
|
|
941
|
-
}>;
|
|
942
914
|
/**
|
|
943
915
|
* Generate an intelligent summary for a resource
|
|
944
916
|
*/
|
|
@@ -948,15 +920,7 @@ declare function generateResourceSummary(resourceName: string, content: string,
|
|
|
948
920
|
*/
|
|
949
921
|
declare function generateReferenceSuggestions(referenceTitle: string, client: InferenceClient, entityType?: string, currentContent?: string): Promise<string[] | null>;
|
|
950
922
|
|
|
951
|
-
/**
|
|
952
|
-
* ID generation utilities
|
|
953
|
-
*/
|
|
954
|
-
/**
|
|
955
|
-
* Generate a UUID v4-like ID (without dashes)
|
|
956
|
-
*/
|
|
957
|
-
declare function generateUuid(): string;
|
|
958
|
-
|
|
959
923
|
declare const PACKAGE_NAME = "@semiont/make-meaning";
|
|
960
924
|
declare const VERSION = "0.1.0";
|
|
961
925
|
|
|
962
|
-
export { AnnotationContext,
|
|
926
|
+
export { AnnotationContext, AnnotationOperations, BACKUP_FORMAT, type BackupContentReader, type BackupEventStoreReader, type BackupExporterOptions, type BackupImportResult, type BackupImporterOptions, type BackupManifestHeader, type BackupStreamSummary, Binder, type BuildContextOptions, CloneTokenManager, type ContentBlobResolver, type CreateAnnotationResult, type CreateResourceInput, type CreateResourceResult, FORMAT_VERSION, Gatherer, GraphContext, GraphDBConsumer, type GraphEdge, type GraphNode, type GraphRepresentation, type KnowledgeBase, LLMContext, type LLMContextOptions, type LinkedDataContentReader, type LinkedDataExporterOptions, type LinkedDataImportResult, type LinkedDataImporterOptions, type LinkedDataViewReader, type ListResourcesFilters, type MakeMeaningConfig, type MakeMeaningService, PACKAGE_NAME, type ReplayStats, ResourceContext, ResourceOperations, Stower, type UpdateAnnotationBodyResult, type UpdateResourceInput, VERSION, bootstrapEntityTypes, createKnowledgeBase, exportBackup, exportLinkedData, generateReferenceSuggestions, generateResourceSummary, importBackup, importLinkedData, isBackupManifest, readEntityTypesProjection, resetBootstrap, startMakeMeaning, validateManifestVersion };
|