@semiont/make-meaning 0.5.25 → 0.5.27
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 +1 -1
- package/dist/index.d.ts +132 -29
- package/dist/index.js +301 -152
- package/dist/index.js.map +1 -1
- package/dist/smelter-main.js +2 -3
- package/dist/smelter-main.js.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -187,7 +187,7 @@ The EventBus is created by the backend (or script) and passed into `startMakeMea
|
|
|
187
187
|
|
|
188
188
|
### Pure projection validators
|
|
189
189
|
|
|
190
|
-
The dispatcher in [`src/handlers/job-commands.ts`](src/handlers/job-commands.ts) does projection-validated job creation: when a `mark.assist` (linking) or `yield.
|
|
190
|
+
The dispatcher in [`src/handlers/job-commands.ts`](src/handlers/job-commands.ts) does projection-validated job creation: when a `mark.assist` (linking) or `yield.fromContext` job arrives with `entityTypes`, the dispatcher validates that every tag is registered; when a tagging job arrives with a `schemaId`, the dispatcher resolves it against the registered tag-schema set.
|
|
191
191
|
|
|
192
192
|
Both rules are pure functions in [`src/views/projection-validators.ts`](src/views/projection-validators.ts):
|
|
193
193
|
|
package/dist/index.d.ts
CHANGED
|
@@ -54,10 +54,26 @@ interface MakeMeaningConfig {
|
|
|
54
54
|
gather: {
|
|
55
55
|
settleTimeoutMs: number;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Search policy. `semanticFloor` is the minimum cosine score a vector hit
|
|
59
|
+
* needs to appear in the semantic fallback (SEMANTIC-FALLBACK decision #1)
|
|
60
|
+
* — REQUIRED: the TOML loader owns the one default (0.6 at
|
|
61
|
+
* `[environments.<env>.make-meaning.search]`); hand-built configs
|
|
62
|
+
* (scripts, tests) state their policy explicitly.
|
|
63
|
+
*/
|
|
64
|
+
search: {
|
|
65
|
+
semanticFloor: number;
|
|
66
|
+
};
|
|
57
67
|
services: {
|
|
58
68
|
graph?: GraphServiceConfig;
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
/** REQUIRED (MANDATORY-EMBEDDING D0+D1, type-level per the 2026-08-12
|
|
70
|
+
* ruling): the config NAMES its store — `memory` is a first-class
|
|
71
|
+
* explicit choice, never a fallback. The TOML loader refuses configs
|
|
72
|
+
* without it; the type makes hand-built configs state their choice. */
|
|
73
|
+
vectors: VectorsServiceConfig;
|
|
74
|
+
/** REQUIRED (same ruling): the embedding provider is the KB's semantic
|
|
75
|
+
* identity — always named, never detected or defaulted. */
|
|
76
|
+
embedding: EmbeddingServiceConfig;
|
|
61
77
|
};
|
|
62
78
|
/**
|
|
63
79
|
* The KB's canonical identity domain — the SAME value `/api/tokens/agent`
|
|
@@ -181,14 +197,17 @@ interface KnowledgeBase {
|
|
|
181
197
|
graph: GraphDatabase;
|
|
182
198
|
weaveProgress: WeaveProgress;
|
|
183
199
|
smeltProgress: SmeltProgress;
|
|
184
|
-
vectors
|
|
200
|
+
vectors: VectorStore;
|
|
185
201
|
projectionsDir: string;
|
|
186
202
|
}
|
|
187
203
|
interface CreateKnowledgeBaseOptions {
|
|
188
|
-
|
|
204
|
+
/** Required (MANDATORY-EMBEDDING D0): a KB without vector search is not a
|
|
205
|
+
* configuration we support; `MemoryVectorStore` is the explicit named
|
|
206
|
+
* choice for stores that may rebuild on restart. */
|
|
207
|
+
vectorStore: VectorStore;
|
|
189
208
|
skipRebuild?: boolean;
|
|
190
209
|
}
|
|
191
|
-
declare function createKnowledgeBase(eventStore: EventStore, project: SemiontProject, graphDb: GraphDatabase, eventBus: EventBus, logger: Logger, options
|
|
210
|
+
declare function createKnowledgeBase(eventStore: EventStore, project: SemiontProject, graphDb: GraphDatabase, eventBus: EventBus, logger: Logger, options: CreateKnowledgeBaseOptions): Promise<KnowledgeBase>;
|
|
192
211
|
|
|
193
212
|
/**
|
|
194
213
|
* Stower Actor
|
|
@@ -290,12 +309,12 @@ declare class Gatherer$1 {
|
|
|
290
309
|
private inferenceClient;
|
|
291
310
|
/** Settle bound for the resource-gather barrier — operator-owned config (D5), threaded from `MakeMeaningConfig.gather`. */
|
|
292
311
|
private settleTimeoutMs;
|
|
293
|
-
private embeddingProvider
|
|
312
|
+
private embeddingProvider;
|
|
294
313
|
private subscriptions;
|
|
295
314
|
private readonly logger;
|
|
296
315
|
constructor(kb: KnowledgeBase, eventBus: EventBus, inferenceClient: InferenceClient,
|
|
297
316
|
/** Settle bound for the resource-gather barrier — operator-owned config (D5), threaded from `MakeMeaningConfig.gather`. */
|
|
298
|
-
settleTimeoutMs: number, logger: Logger, embeddingProvider
|
|
317
|
+
settleTimeoutMs: number, logger: Logger, embeddingProvider: EmbeddingProvider);
|
|
299
318
|
initialize(): Promise<void>;
|
|
300
319
|
private handleAnnotationGather;
|
|
301
320
|
private handleResourceGather;
|
|
@@ -320,17 +339,17 @@ declare class Matcher {
|
|
|
320
339
|
private kb;
|
|
321
340
|
private eventBus;
|
|
322
341
|
private inferenceClient;
|
|
323
|
-
private embeddingProvider
|
|
342
|
+
private embeddingProvider;
|
|
324
343
|
private subscriptions;
|
|
325
344
|
private readonly logger;
|
|
326
|
-
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger, inferenceClient: InferenceClient, embeddingProvider
|
|
345
|
+
constructor(kb: KnowledgeBase, eventBus: EventBus, logger: Logger, inferenceClient: InferenceClient, embeddingProvider: EmbeddingProvider);
|
|
327
346
|
initialize(): Promise<void>;
|
|
328
347
|
private handleSearch;
|
|
329
348
|
/**
|
|
330
349
|
* Context-driven search: multi-source retrieval + composite scoring
|
|
331
350
|
*
|
|
332
351
|
* Retrieval sources:
|
|
333
|
-
* 1. Name match — graph.
|
|
352
|
+
* 1. Name match — graph.listResources({ search: searchTerm })
|
|
334
353
|
* 2. Entity type match — graph.listResources({ entityTypes })
|
|
335
354
|
* 3. Graph neighborhood — connections from GatheredContext
|
|
336
355
|
*
|
|
@@ -364,6 +383,31 @@ declare class Matcher {
|
|
|
364
383
|
stop(): Promise<void>;
|
|
365
384
|
}
|
|
366
385
|
|
|
386
|
+
/**
|
|
387
|
+
* LimitsDiscovery — the Browser's discovery pool for per-`(provider, model)`
|
|
388
|
+
* inference ceilings (INFERENCE-LIMITS-EXPOSURE P2).
|
|
389
|
+
*
|
|
390
|
+
* D1: the ONLY storage is in-memory — the pool's client instances, whose
|
|
391
|
+
* `limits()` single-flights and caches success internally, and deliberately
|
|
392
|
+
* clears its promise on failure so a briefly-down provider recovers on a
|
|
393
|
+
* later request (absent → present, no restart needed).
|
|
394
|
+
*
|
|
395
|
+
* D3: enrichment must never fail or block the directory reply. Three guards
|
|
396
|
+
* carry that, each pinned in `limits-discovery.test.ts`:
|
|
397
|
+
* - construction is guarded per pair — a throwing factory (e.g. an
|
|
398
|
+
* Anthropic section whose apiKey is left to worker-process env
|
|
399
|
+
* expansion) is a discovery failure, never a Browser startup failure;
|
|
400
|
+
* - every consult is raced against `LIMITS_ENRICH_BUDGET_MS`;
|
|
401
|
+
* - every failure path yields the entry WITHOUT `limits` — the same
|
|
402
|
+
* absence semantics `servesJobTypes` already has.
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
type CollaboratorEntry = components['schemas']['CollaboratorEntry'];
|
|
406
|
+
interface LimitsDiscovery {
|
|
407
|
+
/** The entries, each with `limits` attached where discovery answered within budget. */
|
|
408
|
+
enrich(entries: CollaboratorEntry[]): Promise<CollaboratorEntry[]>;
|
|
409
|
+
}
|
|
410
|
+
|
|
367
411
|
/**
|
|
368
412
|
* Browser Actor
|
|
369
413
|
*
|
|
@@ -391,9 +435,17 @@ declare class Browser {
|
|
|
391
435
|
private eventBus;
|
|
392
436
|
private project;
|
|
393
437
|
private config;
|
|
438
|
+
/** Discovered per-(provider, model) ceilings for the roster (INFERENCE-LIMITS-EXPOSURE P2). */
|
|
439
|
+
private limitsDiscovery;
|
|
440
|
+
/** For the semantic search fallback — mandatory (MANDATORY-EMBEDDING D0). */
|
|
441
|
+
private embeddingProvider;
|
|
394
442
|
private subscriptions;
|
|
395
443
|
private readonly logger;
|
|
396
|
-
constructor(views: ViewStorage, kb: KnowledgeBase, eventBus: EventBus, project: SemiontProject, config: MakeMeaningConfig,
|
|
444
|
+
constructor(views: ViewStorage, kb: KnowledgeBase, eventBus: EventBus, project: SemiontProject, config: MakeMeaningConfig,
|
|
445
|
+
/** Discovered per-(provider, model) ceilings for the roster (INFERENCE-LIMITS-EXPOSURE P2). */
|
|
446
|
+
limitsDiscovery: LimitsDiscovery,
|
|
447
|
+
/** For the semantic search fallback — mandatory (MANDATORY-EMBEDDING D0). */
|
|
448
|
+
embeddingProvider: EmbeddingProvider, logger: Logger);
|
|
397
449
|
initialize(): Promise<void>;
|
|
398
450
|
/**
|
|
399
451
|
* Serve a resource's derived coordinate map (ANCHORED-TEXT-CACHE Lane 5).
|
|
@@ -580,7 +632,7 @@ declare class LocalTransport implements ITransport {
|
|
|
580
632
|
private readonly bridgeSubs;
|
|
581
633
|
private disposed;
|
|
582
634
|
constructor(cfg: LocalTransportConfig);
|
|
583
|
-
emit<K extends keyof EventMap>(channel: K, payload: EventMap[K], resourceScope?: ResourceId): Promise<
|
|
635
|
+
emit<K extends keyof EventMap>(channel: K, payload: EventMap[K], resourceScope?: ResourceId): Promise<number>;
|
|
584
636
|
on<K extends keyof EventMap>(channel: K, handler: (payload: EventMap[K]) => void): () => void;
|
|
585
637
|
stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
|
|
586
638
|
subscribeToResource(_resourceId: ResourceId): () => void;
|
|
@@ -1380,13 +1432,50 @@ declare class AnnotationOperations {
|
|
|
1380
1432
|
/**
|
|
1381
1433
|
* Resource Context
|
|
1382
1434
|
*
|
|
1383
|
-
* Assembles resource context from view storage and content store
|
|
1384
|
-
*
|
|
1435
|
+
* Assembles resource context from view storage and content store.
|
|
1436
|
+
* Graph queries go through GraphContext — with one deliberate exception:
|
|
1437
|
+
* `listResources`' search path runs inside the graph engine, and its
|
|
1438
|
+
* semantic fallback (SEMANTIC-FALLBACK) reads the vector index. Both are
|
|
1439
|
+
* single-index reads; anything that FUSES sources belongs to the Matcher.
|
|
1385
1440
|
*/
|
|
1386
1441
|
|
|
1387
1442
|
interface ListResourcesFilters {
|
|
1388
1443
|
search?: string;
|
|
1389
1444
|
archived?: boolean;
|
|
1445
|
+
entityType?: string;
|
|
1446
|
+
offset?: number;
|
|
1447
|
+
limit?: number;
|
|
1448
|
+
}
|
|
1449
|
+
interface ListResourcesResult {
|
|
1450
|
+
/** Semantic hits carry `content` — the passage that matched, not a preview. */
|
|
1451
|
+
resources: Array<ResourceDescriptor & {
|
|
1452
|
+
content?: string;
|
|
1453
|
+
}>;
|
|
1454
|
+
/** Size of the whole match set, not of the returned page. */
|
|
1455
|
+
total: number;
|
|
1456
|
+
/**
|
|
1457
|
+
* Which kind of answer this is (SEMANTIC-FALLBACK): 'lexical' for the
|
|
1458
|
+
* graph/view paths (including an honestly-empty page), 'semantic' when an
|
|
1459
|
+
* empty lexical search was answered from the vector index. REQUIRED — an
|
|
1460
|
+
* optional discriminator defaulting to lexical would let a missing value
|
|
1461
|
+
* silently read as lexical.
|
|
1462
|
+
*/
|
|
1463
|
+
matchKind: 'lexical' | 'semantic';
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* What the semantic fallback needs, passed as plain arguments (the
|
|
1467
|
+
* buildContext idiom — providers are parameters, not fields). Both the
|
|
1468
|
+
* provider and `kb.vectors` are mandatory (MANDATORY-EMBEDDING D0; the old
|
|
1469
|
+
* unconfigured branches — SEMANTIC-FALLBACK S3/S4 — were deliberately
|
|
1470
|
+
* retired with that change). What still degrades is FAILURE: a throwing
|
|
1471
|
+
* embed yields the empty lexical page (S5), because mandatory does not
|
|
1472
|
+
* mean always up.
|
|
1473
|
+
*/
|
|
1474
|
+
interface SemanticFallbackDeps {
|
|
1475
|
+
embeddingProvider: EmbeddingProvider;
|
|
1476
|
+
/** Minimum cosine score for a hit to appear — `search.semanticFloor`. */
|
|
1477
|
+
semanticFloor: number;
|
|
1478
|
+
logger: Logger;
|
|
1390
1479
|
}
|
|
1391
1480
|
declare class ResourceContext {
|
|
1392
1481
|
/**
|
|
@@ -1394,17 +1483,36 @@ declare class ResourceContext {
|
|
|
1394
1483
|
*/
|
|
1395
1484
|
static getResourceMetadata(resourceId: ResourceId, kb: KnowledgeBase): Promise<ResourceDescriptor | null>;
|
|
1396
1485
|
/**
|
|
1397
|
-
* List resources, optionally filtered
|
|
1486
|
+
* List resources, optionally filtered, as one page plus the size of the whole
|
|
1487
|
+
* match set. Every filter is applied before pagination on both paths — a
|
|
1488
|
+
* filter applied afterwards narrows the page rather than the match set, which
|
|
1489
|
+
* is how a search scoped to an entity type can come back empty while hundreds
|
|
1490
|
+
* of resources match.
|
|
1398
1491
|
*
|
|
1399
|
-
* When `search` is set,
|
|
1400
|
-
*
|
|
1401
|
-
* The graph result is then narrowed by `archived` if requested.
|
|
1492
|
+
* When `search` is set, the entire query — filtering, ordering and
|
|
1493
|
+
* pagination — runs inside the graph engine.
|
|
1402
1494
|
*
|
|
1403
|
-
* When `search` is unset,
|
|
1404
|
-
*
|
|
1495
|
+
* When `search` is unset, the materialized views answer instead. They are the
|
|
1496
|
+
* barrier-stamped projection, so an unsearched listing is read-your-writes
|
|
1497
|
+
* where the graph is only eventually consistent.
|
|
1405
1498
|
*/
|
|
1406
|
-
static listResources(filters: ListResourcesFilters | undefined, kb: KnowledgeBase): Promise<
|
|
1407
|
-
|
|
1499
|
+
static listResources(filters: ListResourcesFilters | undefined, kb: KnowledgeBase, semantic: SemanticFallbackDeps): Promise<ListResourcesResult>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Answer an empty lexical search from the vector index (SEMANTIC-FALLBACK):
|
|
1502
|
+
* embed the query once, fold chunk hits per resource, floor them, and label
|
|
1503
|
+
* the answer 'semantic' so the UI can say "no title matches, but these
|
|
1504
|
+
* documents discuss it".
|
|
1505
|
+
*
|
|
1506
|
+
* Degradation is the contract (axioms S3–S5): unconfigured vectors, an
|
|
1507
|
+
* absent provider, or ANY failure inside the fallback yields the same
|
|
1508
|
+
* empty page the caller already had, labelled 'lexical' — a broken
|
|
1509
|
+
* fallback must never turn a working empty search into an error.
|
|
1510
|
+
*
|
|
1511
|
+
* The floor is applied HERE rather than passed as `scoreThreshold`, so the
|
|
1512
|
+
* below-floor hits exist to be counted — the debug line is the evidence
|
|
1513
|
+
* decision #1's guessed 0.6 gets tuned from.
|
|
1514
|
+
*/
|
|
1515
|
+
private static semanticFallback;
|
|
1408
1516
|
/**
|
|
1409
1517
|
* Add content previews to resources (for search results)
|
|
1410
1518
|
* Retrieves and decodes the first 200 characters of each resource's primary representation
|
|
@@ -1449,7 +1557,7 @@ declare class AnnotationContext {
|
|
|
1449
1557
|
* @returns Rich context for LLM processing
|
|
1450
1558
|
* @throws Error if annotation or resource not found
|
|
1451
1559
|
*/
|
|
1452
|
-
static buildLLMContext(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, options?: BuildContextOptions, inferenceClient?: InferenceClient, logger?: Logger
|
|
1560
|
+
static buildLLMContext(annotationId: AnnotationId, resourceId: ResourceId, kb: KnowledgeBase, embeddingProvider: EmbeddingProvider, options?: BuildContextOptions, inferenceClient?: InferenceClient, logger?: Logger): Promise<GatheredContext>;
|
|
1453
1561
|
/**
|
|
1454
1562
|
* Get resource annotations from view storage (fast path)
|
|
1455
1563
|
* Throws if view missing
|
|
@@ -1540,11 +1648,6 @@ declare class GraphContext {
|
|
|
1540
1648
|
* Requires graph traversal - must use graph database
|
|
1541
1649
|
*/
|
|
1542
1650
|
static getResourceConnections(resourceId: ResourceId, kb: KnowledgeBase): Promise<GraphConnection[]>;
|
|
1543
|
-
/**
|
|
1544
|
-
* Search resources by name (cross-resource query)
|
|
1545
|
-
* Requires full-text search - must use graph database
|
|
1546
|
-
*/
|
|
1547
|
-
static searchResources(query: string, kb: KnowledgeBase, limit?: number): Promise<ResourceDescriptor[]>;
|
|
1548
1651
|
/**
|
|
1549
1652
|
* Build the unified knowledge graph for a resource's neighborhood:
|
|
1550
1653
|
* resources AND annotations as typed nodes, typed/directional edges.
|
|
@@ -1620,4 +1723,4 @@ declare function generateResourceSummary(resourceName: string, content: string,
|
|
|
1620
1723
|
declare function generateReferenceSuggestions(referenceTitle: string, client: InferenceClient, entityType?: string, currentContent?: string): Promise<string[] | null>;
|
|
1621
1724
|
|
|
1622
1725
|
export { AnnotationContext, AnnotationOperations, BACKUP_FORMAT, Browser, CloneTokenManager, FORMAT_VERSION, Gatherer$1 as Gatherer, GraphContext, LLMContext, LocalContentTransport, LocalTransport, Matcher, ResourceContext, ResourceOperations, Smelter, Stower, asBusRequestPrimitive, bootstrapEntityTypes, createKnowledgeBase, createSmelterActorStateUnit, exportBackup, exportLinkedData, generateReferenceSuggestions, generateResourceSummary, importBackup, importLinkedData, isBackupManifest, readEntityTypesProjection, registerAnnotationAssemblyHandler, registerAnnotationLookupHandlers, registerBindUpdateBodyHandler, registerBusHandlers, registerJobCommandHandlers, startMakeMeaning, stopKnowledgeSystem, validateManifestVersion };
|
|
1623
|
-
export type { BackupContentReader, BackupEventStoreReader, BackupExporterOptions, BackupImportResult, BackupImporterOptions, BackupManifestHeader, BackupStreamSummary, BuildContextOptions, ContentBlobResolver, CreateAnnotationResult, CreateResourceInput, CreateResourceResult, KnowledgeBase, KnowledgeSystem, LLMContextOptions, LinkedDataContentReader, LinkedDataExporterOptions, LinkedDataImportResult, LinkedDataImporterOptions, LinkedDataViewReader, ListResourcesFilters, LocalTransportConfig, MakeMeaningConfig, MakeMeaningService, ReconcileState, ReconcileSummary, ReplayStats, SmelterActorStateUnit, SmelterActorStateUnitOptions, SmelterEvent, SmelterInput, SmelterTiming, SmelterWorkItem, UpdateAnnotationBodyResult };
|
|
1726
|
+
export type { BackupContentReader, BackupEventStoreReader, BackupExporterOptions, BackupImportResult, BackupImporterOptions, BackupManifestHeader, BackupStreamSummary, BuildContextOptions, ContentBlobResolver, CreateAnnotationResult, CreateResourceInput, CreateResourceResult, KnowledgeBase, KnowledgeSystem, LLMContextOptions, LinkedDataContentReader, LinkedDataExporterOptions, LinkedDataImportResult, LinkedDataImporterOptions, LinkedDataViewReader, ListResourcesFilters, ListResourcesResult, LocalTransportConfig, MakeMeaningConfig, MakeMeaningService, ReconcileState, ReconcileSummary, ReplayStats, SmelterActorStateUnit, SmelterActorStateUnitOptions, SmelterEvent, SmelterInput, SmelterTiming, SmelterWorkItem, UpdateAnnotationBodyResult };
|