@fortemi/core 2026.7.1 → 2026.7.2
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 +16 -2
- package/dist/aiwg-index.d.ts +28 -1
- package/dist/aiwg-index.js +59 -2
- package/dist/aiwg-index.js.map +1 -1
- package/dist/index.d.ts +21 -2
- package/dist/index.js +186 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PGlite } from '@electric-sql/pglite';
|
|
2
2
|
import { z, ZodType } from 'zod';
|
|
3
|
-
export { AIWG_SCAN_REQUIRED_FIELDS, AiwgChunkedIndexBuildOptions, AiwgChunkedIndexBuildResult, AiwgChunkedIndexDetailLoader, AiwgChunkedIndexLoadOptions, AiwgChunkedIndexLoader, AiwgChunkedIndexProgress, AiwgChunkedIndexProgressPhase, AiwgChunkedIndexQueryOptions, AiwgChunkedIndexQueryResult, AiwgChunkedIndexValidationResult, AiwgFortemiChunk, AiwgFortemiChunkDetailRef, AiwgFortemiChunkManifest, AiwgFortemiChunkPart, AiwgFortemiChunkPartRef, AiwgFortemiIndexExport, AiwgFortemiIndexExportSchemaVersion, AiwgFortemiKnownRecordType, AiwgFortemiProjectedRecord, AiwgFortemiProvenance, AiwgFortemiProvenanceEvent, AiwgFortemiRecord, AiwgFortemiRecordEmbedding, AiwgFortemiRecordSchemaVersion, AiwgFortemiRecordSource, AiwgFortemiRecordType, AiwgFortemiRelationship, AiwgFortemiRelationshipDirection, AiwgFortemiSearchProjection, AiwgFortemiSkosConcept, AiwgFortemiSkosRelation, AiwgFortemiSkosRelationType, AiwgIndexController, AiwgIndexControllerListener, AiwgIndexControllerSnapshot, AiwgIndexGraphOptions, AiwgIndexQueryMatch, AiwgIndexQueryOptions, AiwgIndexQueryRankedItem, AiwgIndexQueryResult, AiwgIndexQueryWeights, AiwgIndexValidationResult, AiwgPrivacyClassification, AiwgProvenanceConfidence, AiwgRelationshipDirection, AiwgRelationshipEdgeSummary, AiwgRelationshipNodeSummary, AiwgRelationshipQueryOptions, AiwgRelationshipSetOperation, AiwgRelationshipSetOptions, AiwgRelationshipSetResult, AiwgRelationshipTraversalOptions, AiwgRelationshipTraversalResult, AiwgReviewAction, AiwgReviewDecision, AiwgReviewDecisionExport, AiwgReviewInput, AiwgStaticDuplicatePair, AiwgStaticEmbeddingRecord, AiwgStaticEmbeddingSet, AiwgStaticHybridQueryOptions, AiwgStaticSemanticQueryOptions, AiwgStaticSemanticResult, aiwgFortemiIndexToCommunityGraph, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, assertAiwgStaticEmbeddingSet, buildAiwgChunkedIndex, createAiwgFetchChunkLoader, createAiwgFetchDetailLoader, createAiwgIndexController, createAiwgReviewDecisionExport, findAiwgStaticDuplicatePairs, getAiwgFortemiFacets, queryAiwgFortemiIndex, queryAiwgHybridIndex, queryAiwgSemanticIndex, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport, validateAiwgStaticEmbeddingSet } from './aiwg-index.js';
|
|
3
|
+
export { AIWG_SCAN_REQUIRED_FIELDS, AiwgChunkedIndexBuildOptions, AiwgChunkedIndexBuildResult, AiwgChunkedIndexDetailLoader, AiwgChunkedIndexLoadOptions, AiwgChunkedIndexLoader, AiwgChunkedIndexProgress, AiwgChunkedIndexProgressPhase, AiwgChunkedIndexQueryOptions, AiwgChunkedIndexQueryResult, AiwgChunkedIndexValidationResult, AiwgFortemiAttachmentReference, AiwgFortemiBinarySource, AiwgFortemiChunk, AiwgFortemiChunkDetailRef, AiwgFortemiChunkManifest, AiwgFortemiChunkPart, AiwgFortemiChunkPartRef, AiwgFortemiIndexExport, AiwgFortemiIndexExportSchemaVersion, AiwgFortemiKnownRecordType, AiwgFortemiProjectedRecord, AiwgFortemiProvenance, AiwgFortemiProvenanceEvent, AiwgFortemiRecord, AiwgFortemiRecordEmbedding, AiwgFortemiRecordSchemaVersion, AiwgFortemiRecordSource, AiwgFortemiRecordType, AiwgFortemiRelationship, AiwgFortemiRelationshipDirection, AiwgFortemiSearchProjection, AiwgFortemiSkosConcept, AiwgFortemiSkosRelation, AiwgFortemiSkosRelationType, AiwgHeadlessEmbeddingBackend, AiwgIndexController, AiwgIndexControllerListener, AiwgIndexControllerSnapshot, AiwgIndexGraphOptions, AiwgIndexQueryMatch, AiwgIndexQueryOptions, AiwgIndexQueryRankedItem, AiwgIndexQueryResult, AiwgIndexQueryWeights, AiwgIndexValidationResult, AiwgPrivacyClassification, AiwgProvenanceConfidence, AiwgRelationshipDirection, AiwgRelationshipEdgeSummary, AiwgRelationshipNodeSummary, AiwgRelationshipQueryOptions, AiwgRelationshipSetOperation, AiwgRelationshipSetOptions, AiwgRelationshipSetResult, AiwgRelationshipTraversalOptions, AiwgRelationshipTraversalResult, AiwgReviewAction, AiwgReviewDecision, AiwgReviewDecisionExport, AiwgReviewInput, AiwgStaticDuplicatePair, AiwgStaticEmbeddingRecord, AiwgStaticEmbeddingSet, AiwgStaticHybridQueryOptions, AiwgStaticSemanticQueryOptions, AiwgStaticSemanticResult, BuildAiwgStaticEmbeddingSetOptions, aiwgFortemiIndexToCommunityGraph, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, assertAiwgStaticEmbeddingSet, buildAiwgChunkedIndex, buildAiwgStaticEmbeddingSet, createAiwgFetchChunkLoader, createAiwgFetchDetailLoader, createAiwgIndexController, createAiwgReviewDecisionExport, findAiwgStaticDuplicatePairs, getAiwgFortemiFacets, queryAiwgFortemiIndex, queryAiwgHybridIndex, queryAiwgSemanticIndex, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport, validateAiwgStaticEmbeddingSet } from './aiwg-index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generate a RFC 9562 UUIDv7 identifier.
|
|
@@ -386,6 +386,17 @@ declare const CURRENT_SHARD_VERSION = "1.0.0";
|
|
|
386
386
|
declare const SHARD_FORMAT = "matric-shard";
|
|
387
387
|
/** Components that can appear in a shard archive. */
|
|
388
388
|
type ShardComponent = 'notes' | 'collections' | 'tags' | 'links' | 'embedding_sets' | 'embedding_set_members' | 'embedding_configs' | 'embeddings' | 'skos_schemes' | 'skos_concepts' | 'skos_relations' | 'note_skos_tags' | 'provenance_edges' | 'community_assignments' | 'communities' | 'graph_edges' | 'graph_sources';
|
|
389
|
+
interface ShardAttachmentReference {
|
|
390
|
+
id: string;
|
|
391
|
+
path: string;
|
|
392
|
+
mime: string | null;
|
|
393
|
+
checksum: string;
|
|
394
|
+
bytes: number;
|
|
395
|
+
}
|
|
396
|
+
interface ShardBinarySource {
|
|
397
|
+
extracted_text: string;
|
|
398
|
+
attachment: ShardAttachmentReference;
|
|
399
|
+
}
|
|
389
400
|
/**
|
|
390
401
|
* Reference to one cluster file of a component split across addressable files
|
|
391
402
|
* (`notes/000.jsonl`, `notes/001.jsonl`, …). `offset`/`count` are the record
|
|
@@ -489,6 +500,7 @@ interface ShardNote {
|
|
|
489
500
|
title: string | null;
|
|
490
501
|
original_content: string;
|
|
491
502
|
revised_content: string | null;
|
|
503
|
+
binary_sources?: ShardBinarySource[];
|
|
492
504
|
format: string;
|
|
493
505
|
source: string;
|
|
494
506
|
starred: boolean;
|
|
@@ -705,6 +717,7 @@ interface BrowserNoteExport {
|
|
|
705
717
|
deleted_at: Date | string | null;
|
|
706
718
|
original_content: string;
|
|
707
719
|
revised_content: string | null;
|
|
720
|
+
binary_sources?: ShardBinarySource[];
|
|
708
721
|
tags: string[];
|
|
709
722
|
}
|
|
710
723
|
/** Convert a browser note to shard format. */
|
|
@@ -2733,6 +2746,8 @@ interface AttachmentRow {
|
|
|
2733
2746
|
note_id: string;
|
|
2734
2747
|
blob_id: string;
|
|
2735
2748
|
document_type_id: string | null;
|
|
2749
|
+
mime_type: string | null;
|
|
2750
|
+
extracted_text: string | null;
|
|
2736
2751
|
filename: string;
|
|
2737
2752
|
display_name: string | null;
|
|
2738
2753
|
position: number;
|
|
@@ -2751,6 +2766,7 @@ interface AttachInput {
|
|
|
2751
2766
|
data: Uint8Array;
|
|
2752
2767
|
filename: string;
|
|
2753
2768
|
mimeType?: string;
|
|
2769
|
+
extractedText?: string;
|
|
2754
2770
|
displayName?: string;
|
|
2755
2771
|
}
|
|
2756
2772
|
declare class AttachmentsRepository {
|
|
@@ -2797,11 +2813,13 @@ declare const ManageAttachmentsInputSchema: z.ZodObject<{
|
|
|
2797
2813
|
data_base64: z.ZodOptional<z.ZodString>;
|
|
2798
2814
|
filename: z.ZodOptional<z.ZodString>;
|
|
2799
2815
|
mime_type: z.ZodOptional<z.ZodString>;
|
|
2816
|
+
extracted_text: z.ZodOptional<z.ZodString>;
|
|
2800
2817
|
display_name: z.ZodOptional<z.ZodString>;
|
|
2801
2818
|
}, "strip", z.ZodTypeAny, {
|
|
2802
2819
|
action: "delete" | "list" | "attach" | "get" | "get_blob";
|
|
2803
2820
|
note_id?: string | undefined;
|
|
2804
2821
|
filename?: string | undefined;
|
|
2822
|
+
extracted_text?: string | undefined;
|
|
2805
2823
|
attachment_id?: string | undefined;
|
|
2806
2824
|
data_base64?: string | undefined;
|
|
2807
2825
|
mime_type?: string | undefined;
|
|
@@ -2810,6 +2828,7 @@ declare const ManageAttachmentsInputSchema: z.ZodObject<{
|
|
|
2810
2828
|
action: "delete" | "list" | "attach" | "get" | "get_blob";
|
|
2811
2829
|
note_id?: string | undefined;
|
|
2812
2830
|
filename?: string | undefined;
|
|
2831
|
+
extracted_text?: string | undefined;
|
|
2813
2832
|
attachment_id?: string | undefined;
|
|
2814
2833
|
data_base64?: string | undefined;
|
|
2815
2834
|
mime_type?: string | undefined;
|
|
@@ -3784,6 +3803,6 @@ declare function getPrefetchedSha256(url: string): string | undefined;
|
|
|
3784
3803
|
*/
|
|
3785
3804
|
declare function clearPrefetchedShard(url?: string): void;
|
|
3786
3805
|
|
|
3787
|
-
declare const VERSION = "2026.7.
|
|
3806
|
+
declare const VERSION = "2026.7.2";
|
|
3788
3807
|
|
|
3789
3808
|
export { type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRow, type AttachmentRow, AttachmentsRepository, type BackendCandidate, type BackendCapabilities, type BackendConcept, type BackendLink, type BackendListOptions, type BackendNote, type BackendNoteFull, type BackendProvenanceEdge, type BackendRequest, type BackendSearchHit, type BackendSearchQueryOptions, type BackendSearchResult, type BackendSelection, type BackendSemanticTier, type BackendStartupCost, type BlobStore, type BridgeCapability, type BridgeProviderInfo, type BrowserNoteExport, CURRENT_MIGRATION_HEAD, CURRENT_SHARD_VERSION, type CapabilityInfo, CapabilityManager, type CapabilityName, type CapabilityState, type CaptureKnowledgeInput, CaptureKnowledgeInputSchema, type CaptureKnowledgeResult, type CollectionCreateInput, type CollectionRow, CollectionsRepository, CommunitiesRepository, type CommunityAssignmentView, type CommunityCreateInput, type CommunityFilterDefinition, type CommunityGraph, type CommunityOptions, type CommunitySourceDescriptor, type CommunitySourceType, type CommunitySummary, type CompletionRequest, type CompletionResponse, type ConditionResult, type ConflictStrategy, type CooldownConfig, type CooldownEvent, type CosineSemanticProviderOptions, type CreatePGliteOptions, type CspDirectiveName, type CspDirectives, type CspViolationReport, DB_SNAPSHOT_SCHEMA_VERSION, type DataBackend, type DatabaseClient, type DbSnapshot, type DbSnapshotCompat, type DbSnapshotCompression, type DbSnapshotExpectations, type DbSnapshotMeta, type DbSnapshotSource, DbSnapshotVersionError, type DiscoveredProvider, type DiscoveryOptions, type DumpDbSnapshotOptions, type DumpableDb, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, type EmbedFunction, type EmbedRequest, type EmbedRequestMessage, type EmbedResponse, type EmbedResponseMessage, type EmbedTransportPort, type EmbedWorkerOptions, type EmbeddingCompatibilityPolicy, type EmbeddingSetCreateInput, type EmbeddingSetCriteria, type EmbeddingSetDescriptor, type EmbeddingSetEmbeddingInput, type EmbeddingSetFreshness, type EmbeddingSetKind, type EmbeddingSetMode, type EmbeddingSetRow, type EmbeddingSetSelector, EmbeddingSetsRepository, type EnqueueJobInput, type ErrorCategory, type EventMap, type ExportOptions, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FortemiBridge, type FortemiBridgeCapabilities, type FortemiBridgeHost, type FortemiConfig, type FortemiCore, type FortemiInferenceRouter, type FortemiSecretStore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type GraphCommunity, type GraphEdge, type GraphNode, GraphRepository, type IDisposable, type ImportCounts, type ImportOptions, type ImportProgress, type ImportProgressPhase, type ImportResult, type InferenceCapabilities, type InferenceProvider, JOB_CAPABILITIES, JOB_PRIORITIES, type JobQueueOptions, JobQueueWorker, type JobStatus, type JobType, LOCAL_ENDPOINTS, type LinkRow, LinksRepository, type ListNotesInput, ListNotesInputSchema, type LlmCapabilityOptions, type LlmCompleteFn, type LoadedPluginScript, type LocalEndpoint, type ManageArchiveInput, ManageArchiveInputSchema, type ManageArchiveResult, type ManageAttachmentsInput, ManageAttachmentsInputSchema, type ManageAttachmentsResult, type ManageCapabilitiesInput, ManageCapabilitiesInputSchema, type ManageCapabilitiesResult, type ManageCollectionsInput, ManageCollectionsInputSchema, type ManageCollectionsResult, type ManageLinksInput, ManageLinksInputSchema, type ManageLinksResult, type ManageNoteInput, ManageNoteInputSchema, type ManageNoteResult, type ManageTagsInput, ManageTagsInputSchema, type ManageTagsResult, MemoryBlobStore, type Migration, MigrationRunner, type ModelCategory, type ModelFitResult, type ModelInfo, type NoteCreateInput, type NoteFull, type NoteListOptions, type NoteRevision, type NoteSkosTag, type NoteSummary, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, type OpenShardOptions, type PGliteBackendOptions, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, type PGliteWorkerStorageBackendFactoryOptions, type PaginatedResult, type PersistenceMode, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type PrefetchOptions, type PrefetchResult, type ProbeResult, type ProbeStatus, type ProvenanceEdge, ProvenanceRepository, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, type RecommendedTier, type RecordProvenanceInput, type RemoteBackendConfig, type RemoteBackendPaths, type ResolvedEmbeddingRow, type ResolvedEmbeddingSet, type RestoreDbSnapshotOptions, type RouteHandler, SHARD_FORMAT, SUPPORTED_PGLITE_VERSION, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, type ShardBackendOptions, type ShardClusterRef, type ShardCollection, type ShardComponent, type ShardComponentStore, type ShardEmbedding, type ShardEmbeddingSet, type ShardEmbeddingSetMember, type ShardLayout, type ShardLink, type ShardListOptions, type ShardManifest, type ShardNote, type ShardNoteFull, type ShardNoteSkosTag, type ShardProvenanceEdge, type ShardReader, type ShardReaderNote, type ShardReaderSource, type ShardSearchOptions, type ShardSearchRankedNote, type ShardSearchResult, type ShardSearchWeights, type ShardSkosConcept, type ShardSkosRelation, type ShardSkosScheme, type ShardTag, type SimilarityGraphCacheKey, type SimilarityGraphOptions, type SimilarityGraphRequest, type SimilarityGraphResult, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StaticSemanticProvider, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, TypedEventBus, VERSION, type VectorEntry, type VirtualEmbeddingSetDefinition, type VirtualEmbeddingSetSource, type VirtualEmbeddingSetValidationError, type VirtualMaterializationPolicy, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, allMigrations, appendPluginScript, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createBlobStore, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRemoteBackend, createRoutes, createShardBackend, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dumpDbSnapshot, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, fortemiManifest, fromPrefetched, generateId, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, provenanceEdgeToShard, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateChecksums, verifyDbSnapshotMeta, verifySri };
|
package/dist/index.js
CHANGED
|
@@ -596,6 +596,19 @@ var migration0009 = {
|
|
|
596
596
|
`
|
|
597
597
|
};
|
|
598
598
|
|
|
599
|
+
// src/migrations/0010_attachment_text_metadata.ts
|
|
600
|
+
var migration0010 = {
|
|
601
|
+
version: 10,
|
|
602
|
+
name: "0010_attachment_text_metadata",
|
|
603
|
+
sql: `
|
|
604
|
+
ALTER TABLE attachment
|
|
605
|
+
ADD COLUMN IF NOT EXISTS mime_type TEXT;
|
|
606
|
+
|
|
607
|
+
ALTER TABLE attachment
|
|
608
|
+
ADD COLUMN IF NOT EXISTS extracted_text TEXT;
|
|
609
|
+
`
|
|
610
|
+
};
|
|
611
|
+
|
|
599
612
|
// src/migrations/index.ts
|
|
600
613
|
var allMigrations = [
|
|
601
614
|
migration0001,
|
|
@@ -606,7 +619,8 @@ var allMigrations = [
|
|
|
606
619
|
migration0006,
|
|
607
620
|
migration0007,
|
|
608
621
|
migration0008,
|
|
609
|
-
migration0009
|
|
622
|
+
migration0009,
|
|
623
|
+
migration0010
|
|
610
624
|
];
|
|
611
625
|
|
|
612
626
|
// src/data-archive.ts
|
|
@@ -1119,6 +1133,16 @@ function buildNoteConditions(options, startIdx, includeDeleted = false) {
|
|
|
1119
1133
|
}
|
|
1120
1134
|
|
|
1121
1135
|
// src/repositories/embedding-sets-repository.ts
|
|
1136
|
+
var ATTACHMENT_TEXT_JOIN = `
|
|
1137
|
+
LEFT JOIN (
|
|
1138
|
+
SELECT note_id,
|
|
1139
|
+
string_agg(extracted_text, ' ' ORDER BY position, created_at)
|
|
1140
|
+
FILTER (WHERE extracted_text IS NOT NULL AND extracted_text <> '') as extracted_text
|
|
1141
|
+
FROM attachment
|
|
1142
|
+
WHERE deleted_at IS NULL
|
|
1143
|
+
GROUP BY note_id
|
|
1144
|
+
) ax ON ax.note_id = n.id`;
|
|
1145
|
+
var COMBINED_TEXT_VECTOR_SQL = `to_tsvector('english', (coalesce(c.content, '') || ' ' || coalesce(ax.extracted_text, '')))`;
|
|
1122
1146
|
var DEFAULT_COMPATIBILITY = {
|
|
1123
1147
|
model: "require-same",
|
|
1124
1148
|
dimension: "require-same",
|
|
@@ -1498,7 +1522,7 @@ var EmbeddingSetsRepository = class {
|
|
|
1498
1522
|
params.push(criteria.updatedBefore);
|
|
1499
1523
|
}
|
|
1500
1524
|
if (criteria.query?.trim()) {
|
|
1501
|
-
conditions.push(`(n.tsv @@ plainto_tsquery('english', $${idx}) OR
|
|
1525
|
+
conditions.push(`(n.tsv @@ plainto_tsquery('english', $${idx}) OR ${COMBINED_TEXT_VECTOR_SQL} @@ plainto_tsquery('english', $${idx}))`);
|
|
1502
1526
|
params.push(criteria.query);
|
|
1503
1527
|
}
|
|
1504
1528
|
const result = await this.db.query(
|
|
@@ -1506,6 +1530,7 @@ var EmbeddingSetsRepository = class {
|
|
|
1506
1530
|
FROM embedding e
|
|
1507
1531
|
JOIN note n ON n.id = e.note_id
|
|
1508
1532
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1533
|
+
${ATTACHMENT_TEXT_JOIN}
|
|
1509
1534
|
WHERE ${conditions.join(" AND ")}
|
|
1510
1535
|
ORDER BY e.note_id, e.created_at DESC`,
|
|
1511
1536
|
params
|
|
@@ -1623,6 +1648,17 @@ var EmbeddingSetsRepository = class {
|
|
|
1623
1648
|
};
|
|
1624
1649
|
|
|
1625
1650
|
// src/repositories/search-repository.ts
|
|
1651
|
+
var ATTACHMENT_TEXT_JOIN2 = `
|
|
1652
|
+
LEFT JOIN (
|
|
1653
|
+
SELECT note_id,
|
|
1654
|
+
string_agg(extracted_text, ' ' ORDER BY position, created_at)
|
|
1655
|
+
FILTER (WHERE extracted_text IS NOT NULL AND extracted_text <> '') as extracted_text
|
|
1656
|
+
FROM attachment
|
|
1657
|
+
WHERE deleted_at IS NULL
|
|
1658
|
+
GROUP BY note_id
|
|
1659
|
+
) ax ON ax.note_id = n.id`;
|
|
1660
|
+
var COMBINED_TEXT_SQL = `(coalesce(c.content, '') || ' ' || coalesce(ax.extracted_text, ''))`;
|
|
1661
|
+
var COMBINED_TEXT_VECTOR_SQL2 = `to_tsvector('english', ${COMBINED_TEXT_SQL})`;
|
|
1626
1662
|
var SearchRepository = class {
|
|
1627
1663
|
constructor(db, semanticAvailable = false) {
|
|
1628
1664
|
this.db = db;
|
|
@@ -1707,7 +1743,7 @@ var SearchRepository = class {
|
|
|
1707
1743
|
const { conditions, params, nextIdx } = buildNoteConditions(options, 2);
|
|
1708
1744
|
conditions.unshift(
|
|
1709
1745
|
`(n.tsv @@ ${tsqFn}('english', $1) OR
|
|
1710
|
-
|
|
1746
|
+
${COMBINED_TEXT_VECTOR_SQL2} @@ ${tsqFn}('english', $1))`
|
|
1711
1747
|
);
|
|
1712
1748
|
let paramIdx = this.scopeToResolvedEmbeddingSet(conditions, params, nextIdx, resolvedEmbeddingSet);
|
|
1713
1749
|
const allParams = [query, ...params];
|
|
@@ -1716,6 +1752,7 @@ var SearchRepository = class {
|
|
|
1716
1752
|
`SELECT COUNT(*) as count
|
|
1717
1753
|
FROM note n
|
|
1718
1754
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1755
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1719
1756
|
WHERE ${where}`,
|
|
1720
1757
|
allParams
|
|
1721
1758
|
);
|
|
@@ -1724,17 +1761,18 @@ var SearchRepository = class {
|
|
|
1724
1761
|
const result = await this.db.query(
|
|
1725
1762
|
`SELECT n.id, n.title, n.created_at, n.updated_at,
|
|
1726
1763
|
ts_rank(
|
|
1727
|
-
setweight(n.tsv, 'A') || setweight(
|
|
1764
|
+
setweight(n.tsv, 'A') || setweight(${COMBINED_TEXT_VECTOR_SQL2}, 'B'),
|
|
1728
1765
|
${tsqFn}('english', $1)
|
|
1729
1766
|
) as rank,
|
|
1730
1767
|
ts_headline(
|
|
1731
1768
|
'english',
|
|
1732
|
-
|
|
1769
|
+
${COMBINED_TEXT_SQL},
|
|
1733
1770
|
${tsqFn}('english', $1),
|
|
1734
1771
|
'StartSel=<mark>, StopSel=</mark>, MaxWords=35, MinWords=15'
|
|
1735
1772
|
) as snippet
|
|
1736
1773
|
FROM note n
|
|
1737
1774
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1775
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1738
1776
|
WHERE ${where}
|
|
1739
1777
|
ORDER BY rank DESC, n.created_at DESC
|
|
1740
1778
|
LIMIT $${paramIdx++} OFFSET $${paramIdx++}`,
|
|
@@ -1750,6 +1788,7 @@ var SearchRepository = class {
|
|
|
1750
1788
|
const idsResult = await this.db.query(
|
|
1751
1789
|
`SELECT n.id FROM note n
|
|
1752
1790
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1791
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1753
1792
|
WHERE ${where}`,
|
|
1754
1793
|
allParams
|
|
1755
1794
|
);
|
|
@@ -1796,10 +1835,11 @@ var SearchRepository = class {
|
|
|
1796
1835
|
const result = await this.db.query(
|
|
1797
1836
|
`SELECT n.id, n.title, n.created_at, n.updated_at,
|
|
1798
1837
|
(e.vector <=> $${vecIdx}::vector) as distance,
|
|
1799
|
-
LEFT(
|
|
1838
|
+
LEFT(${COMBINED_TEXT_SQL}, 200) as snippet
|
|
1800
1839
|
FROM embedding e
|
|
1801
1840
|
JOIN note n ON n.id = e.note_id
|
|
1802
1841
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1842
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1803
1843
|
WHERE ${where}
|
|
1804
1844
|
ORDER BY e.vector <=> $${vecIdx}::vector ASC
|
|
1805
1845
|
LIMIT $${limIdx} OFFSET $${offIdx}`,
|
|
@@ -1840,7 +1880,7 @@ var SearchRepository = class {
|
|
|
1840
1880
|
const textConditions = [
|
|
1841
1881
|
...textCond.conditions,
|
|
1842
1882
|
`(n.tsv @@ ${tsqFn}('english', $1) OR
|
|
1843
|
-
|
|
1883
|
+
${COMBINED_TEXT_VECTOR_SQL2} @@ ${tsqFn}('english', $1))`
|
|
1844
1884
|
];
|
|
1845
1885
|
this.scopeToResolvedEmbeddingSet(textConditions, textCond.params, textCond.nextIdx, resolvedEmbeddingSet);
|
|
1846
1886
|
const textWhere = textConditions.join(" AND ");
|
|
@@ -1848,11 +1888,12 @@ var SearchRepository = class {
|
|
|
1848
1888
|
const textResult = await this.db.query(
|
|
1849
1889
|
`SELECT n.id,
|
|
1850
1890
|
ts_rank(
|
|
1851
|
-
setweight(n.tsv, 'A') || setweight(
|
|
1891
|
+
setweight(n.tsv, 'A') || setweight(${COMBINED_TEXT_VECTOR_SQL2}, 'B'),
|
|
1852
1892
|
${tsqFn}('english', $1)
|
|
1853
1893
|
) as rank
|
|
1854
1894
|
FROM note n
|
|
1855
1895
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1896
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1856
1897
|
WHERE ${textWhere}
|
|
1857
1898
|
ORDER BY rank DESC
|
|
1858
1899
|
LIMIT 100`,
|
|
@@ -1886,9 +1927,10 @@ var SearchRepository = class {
|
|
|
1886
1927
|
}
|
|
1887
1928
|
const noteResult = await this.db.query(
|
|
1888
1929
|
`SELECT n.id, n.title, n.created_at, n.updated_at,
|
|
1889
|
-
LEFT(
|
|
1930
|
+
LEFT(${COMBINED_TEXT_SQL}, 200) as snippet
|
|
1890
1931
|
FROM note n
|
|
1891
1932
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1933
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1892
1934
|
WHERE n.id = ANY($1)`,
|
|
1893
1935
|
[pageIds]
|
|
1894
1936
|
);
|
|
@@ -1936,9 +1978,10 @@ var SearchRepository = class {
|
|
|
1936
1978
|
const listParams = [...params, limit, offset];
|
|
1937
1979
|
const result = await this.db.query(
|
|
1938
1980
|
`SELECT n.id, n.title, n.created_at, n.updated_at,
|
|
1939
|
-
LEFT(
|
|
1981
|
+
LEFT(${COMBINED_TEXT_SQL}, 200) as snippet
|
|
1940
1982
|
FROM note n
|
|
1941
1983
|
LEFT JOIN note_revised_current c ON c.note_id = n.id
|
|
1984
|
+
${ATTACHMENT_TEXT_JOIN2}
|
|
1942
1985
|
WHERE ${where}
|
|
1943
1986
|
ORDER BY n.created_at DESC
|
|
1944
1987
|
LIMIT $${paramIdx++} OFFSET $${paramIdx++}`,
|
|
@@ -3811,6 +3854,29 @@ function getLlmFunction() {
|
|
|
3811
3854
|
return llmFn;
|
|
3812
3855
|
}
|
|
3813
3856
|
|
|
3857
|
+
// src/repositories/note-text.ts
|
|
3858
|
+
async function getNoteTextWithExtractedAttachments(db, noteId) {
|
|
3859
|
+
const result = await db.query(
|
|
3860
|
+
`SELECT c.content,
|
|
3861
|
+
COALESCE(string_agg(a.extracted_text, E'
|
|
3862
|
+
' ORDER BY a.position, a.created_at)
|
|
3863
|
+
FILTER (WHERE a.extracted_text IS NOT NULL AND a.extracted_text <> ''), '') as extracted_text
|
|
3864
|
+
FROM note_revised_current c
|
|
3865
|
+
LEFT JOIN attachment a ON a.note_id = c.note_id AND a.deleted_at IS NULL
|
|
3866
|
+
WHERE c.note_id = $1
|
|
3867
|
+
GROUP BY c.content`,
|
|
3868
|
+
[noteId]
|
|
3869
|
+
);
|
|
3870
|
+
if (result.rows.length === 0) return null;
|
|
3871
|
+
const content = result.rows[0].content;
|
|
3872
|
+
const extractedText = result.rows[0].extracted_text ?? "";
|
|
3873
|
+
return {
|
|
3874
|
+
content,
|
|
3875
|
+
extracted_text: extractedText,
|
|
3876
|
+
combined: [content, extractedText].filter(Boolean).join("\n")
|
|
3877
|
+
};
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3814
3880
|
// src/job-queue-worker.ts
|
|
3815
3881
|
var JOB_PRIORITIES = {
|
|
3816
3882
|
ai_revision: 1,
|
|
@@ -4092,12 +4158,9 @@ function conceptTaggingHandler(job, db) {
|
|
|
4092
4158
|
return (async () => {
|
|
4093
4159
|
const llmFn2 = getLlmFunction();
|
|
4094
4160
|
if (!llmFn2) return { skipped: true, reason: "no LLM function registered" };
|
|
4095
|
-
const
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
);
|
|
4099
|
-
if (result.rows.length === 0) throw new Error(`No content found for note ${job.note_id}`);
|
|
4100
|
-
const content = result.rows[0].content;
|
|
4161
|
+
const noteText = await getNoteTextWithExtractedAttachments(db, job.note_id);
|
|
4162
|
+
if (!noteText) throw new Error(`No content found for note ${job.note_id}`);
|
|
4163
|
+
const content = noteText.combined;
|
|
4101
4164
|
const prompt = `Task: Extract 3-5 topic tags from the text below.
|
|
4102
4165
|
Rules:
|
|
4103
4166
|
- Each tag is 1-3 words, lowercase
|
|
@@ -4990,9 +5053,17 @@ var AttachmentsRepository = class {
|
|
|
4990
5053
|
}
|
|
4991
5054
|
const attachmentId = generateId();
|
|
4992
5055
|
await this.db.query(
|
|
4993
|
-
`INSERT INTO attachment (id, note_id, blob_id, filename, display_name)
|
|
4994
|
-
VALUES ($1, $2, $3, $4, $5)`,
|
|
4995
|
-
[
|
|
5056
|
+
`INSERT INTO attachment (id, note_id, blob_id, filename, display_name, mime_type, extracted_text)
|
|
5057
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,
|
|
5058
|
+
[
|
|
5059
|
+
attachmentId,
|
|
5060
|
+
input.noteId,
|
|
5061
|
+
blobId,
|
|
5062
|
+
input.filename,
|
|
5063
|
+
input.displayName ?? null,
|
|
5064
|
+
input.mimeType ?? null,
|
|
5065
|
+
input.extractedText ?? null
|
|
5066
|
+
]
|
|
4996
5067
|
);
|
|
4997
5068
|
return this.get(attachmentId);
|
|
4998
5069
|
}
|
|
@@ -5055,6 +5126,7 @@ var ManageAttachmentsInputSchema = z.object({
|
|
|
5055
5126
|
data_base64: z.string().optional(),
|
|
5056
5127
|
filename: z.string().optional(),
|
|
5057
5128
|
mime_type: z.string().optional(),
|
|
5129
|
+
extracted_text: z.string().optional(),
|
|
5058
5130
|
display_name: z.string().optional()
|
|
5059
5131
|
});
|
|
5060
5132
|
async function manageAttachments(db, blobStore, rawInput) {
|
|
@@ -5073,6 +5145,7 @@ async function manageAttachments(db, blobStore, rawInput) {
|
|
|
5073
5145
|
data,
|
|
5074
5146
|
filename: input.filename,
|
|
5075
5147
|
mimeType: input.mime_type,
|
|
5148
|
+
extractedText: input.extracted_text,
|
|
5076
5149
|
displayName: input.display_name
|
|
5077
5150
|
});
|
|
5078
5151
|
return { action: "attach", attachment, size_bytes: data.length };
|
|
@@ -5324,12 +5397,9 @@ function averageEmbeddings(embeddings) {
|
|
|
5324
5397
|
async function embeddingGenerationHandler(job, db) {
|
|
5325
5398
|
const fn = embedFn;
|
|
5326
5399
|
if (!fn) return { skipped: true, reason: "no embed function registered" };
|
|
5327
|
-
const
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
);
|
|
5331
|
-
if (noteResult.rows.length === 0) throw new Error(`No content for note ${job.note_id}`);
|
|
5332
|
-
const content = noteResult.rows[0].content;
|
|
5400
|
+
const noteText = await getNoteTextWithExtractedAttachments(db, job.note_id);
|
|
5401
|
+
if (!noteText) throw new Error(`No content for note ${job.note_id}`);
|
|
5402
|
+
const content = noteText.combined;
|
|
5333
5403
|
const chunks = chunkText(content);
|
|
5334
5404
|
const embeddings = await fn(chunks);
|
|
5335
5405
|
const vector2 = averageEmbeddings(embeddings);
|
|
@@ -6512,6 +6582,7 @@ function noteToShard(note) {
|
|
|
6512
6582
|
title: note.title,
|
|
6513
6583
|
original_content: note.original_content,
|
|
6514
6584
|
revised_content: note.revised_content,
|
|
6585
|
+
...note.binary_sources?.length ? { binary_sources: note.binary_sources } : {},
|
|
6515
6586
|
format: note.format,
|
|
6516
6587
|
source: note.source,
|
|
6517
6588
|
starred: note.is_starred,
|
|
@@ -6532,6 +6603,7 @@ function noteFromShard(shard) {
|
|
|
6532
6603
|
is_archived: shard.archived,
|
|
6533
6604
|
original_content: shard.original_content,
|
|
6534
6605
|
revised_content: shard.revised_content,
|
|
6606
|
+
binary_sources: shard.binary_sources,
|
|
6535
6607
|
tags: shard.tags,
|
|
6536
6608
|
created_at: shard.created_at,
|
|
6537
6609
|
updated_at: shard.updated_at,
|
|
@@ -6789,9 +6861,40 @@ async function exportShard(db, options) {
|
|
|
6789
6861
|
tags.push(row.tag);
|
|
6790
6862
|
tagsByNote.set(row.note_id, tags);
|
|
6791
6863
|
}
|
|
6864
|
+
const attachmentRows = await db.query(
|
|
6865
|
+
`SELECT a.note_id,
|
|
6866
|
+
a.id,
|
|
6867
|
+
a.filename,
|
|
6868
|
+
a.mime_type,
|
|
6869
|
+
a.extracted_text,
|
|
6870
|
+
b.content_hash,
|
|
6871
|
+
b.size_bytes,
|
|
6872
|
+
b.storage_path
|
|
6873
|
+
FROM attachment a
|
|
6874
|
+
JOIN attachment_blob b ON b.id = a.blob_id
|
|
6875
|
+
WHERE a.deleted_at IS NULL
|
|
6876
|
+
ORDER BY a.note_id, a.position, a.created_at`
|
|
6877
|
+
);
|
|
6878
|
+
const binarySourcesByNote = /* @__PURE__ */ new Map();
|
|
6879
|
+
for (const row of attachmentRows.rows) {
|
|
6880
|
+
const source = {
|
|
6881
|
+
extracted_text: row.extracted_text ?? "",
|
|
6882
|
+
attachment: {
|
|
6883
|
+
id: row.id,
|
|
6884
|
+
path: row.storage_path ?? row.filename,
|
|
6885
|
+
mime: row.mime_type,
|
|
6886
|
+
checksum: row.content_hash,
|
|
6887
|
+
bytes: Number(row.size_bytes)
|
|
6888
|
+
}
|
|
6889
|
+
};
|
|
6890
|
+
const sources = binarySourcesByNote.get(row.note_id) ?? [];
|
|
6891
|
+
sources.push(source);
|
|
6892
|
+
binarySourcesByNote.set(row.note_id, sources);
|
|
6893
|
+
}
|
|
6792
6894
|
const notes = noteRows.rows.map((row) => ({
|
|
6793
6895
|
...row,
|
|
6794
|
-
tags: tagsByNote.get(row.id) ?? []
|
|
6896
|
+
tags: tagsByNote.get(row.id) ?? [],
|
|
6897
|
+
binary_sources: binarySourcesByNote.get(row.id)
|
|
6795
6898
|
}));
|
|
6796
6899
|
const exportedNoteIds = new Set(notes.map((n) => n.id));
|
|
6797
6900
|
const shardNotes = notes.map((n) => noteToShard(n));
|
|
@@ -7653,7 +7756,8 @@ function tokenize(query) {
|
|
|
7653
7756
|
return query.toLowerCase().split(/[^a-z0-9]+/i).filter((token) => token.length > 0);
|
|
7654
7757
|
}
|
|
7655
7758
|
function noteSearchText(note) {
|
|
7656
|
-
|
|
7759
|
+
const extractedText = note.binary_sources?.map((source) => source.extracted_text).filter(Boolean).join(" ") ?? "";
|
|
7760
|
+
return `${note.title ?? ""} ${note.original_content} ${note.revised_content ?? ""} ${extractedText}`.toLowerCase();
|
|
7657
7761
|
}
|
|
7658
7762
|
function countOccurrences(haystack, needle) {
|
|
7659
7763
|
if (!needle) return 0;
|
|
@@ -7674,7 +7778,8 @@ function noteMatchesTokens(note, tokens) {
|
|
|
7674
7778
|
function rankNote(note, tokens, weights) {
|
|
7675
7779
|
if (tokens.length === 0) return 0;
|
|
7676
7780
|
const title = (note.title ?? "").toLowerCase();
|
|
7677
|
-
const
|
|
7781
|
+
const extractedText = note.binary_sources?.map((source) => source.extracted_text).filter(Boolean).join(" ") ?? "";
|
|
7782
|
+
const content = `${note.original_content} ${note.revised_content ?? ""} ${extractedText}`.toLowerCase();
|
|
7678
7783
|
const tagText = note.tags.join(" ").toLowerCase();
|
|
7679
7784
|
let score = 0;
|
|
7680
7785
|
for (const token of tokens) {
|
|
@@ -7685,7 +7790,8 @@ function rankNote(note, tokens, weights) {
|
|
|
7685
7790
|
return score;
|
|
7686
7791
|
}
|
|
7687
7792
|
function makeSnippet(note, tokens, length) {
|
|
7688
|
-
const
|
|
7793
|
+
const extractedText = note.binary_sources?.map((source) => source.extracted_text).filter(Boolean).join(" ") ?? "";
|
|
7794
|
+
const content = `${note.original_content} ${note.revised_content ?? ""} ${extractedText}`.trim();
|
|
7689
7795
|
if (tokens.length === 0) return content.slice(0, length);
|
|
7690
7796
|
const lower = content.toLowerCase();
|
|
7691
7797
|
const firstAt = tokens.map((token) => lower.indexOf(token)).filter((index) => index !== -1).sort((a, b) => a - b)[0] ?? 0;
|
|
@@ -8470,7 +8576,55 @@ function recordTitle(item) {
|
|
|
8470
8576
|
return item.title ?? item.search?.title ?? item.search?.name ?? item.id;
|
|
8471
8577
|
}
|
|
8472
8578
|
function recordText(item) {
|
|
8473
|
-
|
|
8579
|
+
const base = item.text ?? item.search?.body ?? item.search?.summary ?? item.chunks?.map((chunk) => chunk.text ?? chunk.body ?? chunk.summary ?? "").filter(Boolean).join("\n") ?? "";
|
|
8580
|
+
const extractedText = "binary_sources" in item ? item.binary_sources?.map((source) => source.extracted_text).filter(Boolean).join("\n") ?? "" : "";
|
|
8581
|
+
return [base, extractedText].filter(Boolean).join("\n");
|
|
8582
|
+
}
|
|
8583
|
+
function defaultEmbeddingInput(record, granularity) {
|
|
8584
|
+
const title = recordTitle(record);
|
|
8585
|
+
const text = recordText(record);
|
|
8586
|
+
if (granularity === "title-summary") {
|
|
8587
|
+
const extractedText = record.binary_sources?.map((source) => source.extracted_text).filter(Boolean).join("\n") ?? "";
|
|
8588
|
+
return [title, record.search?.summary ?? "", extractedText].filter(Boolean).join("\n");
|
|
8589
|
+
}
|
|
8590
|
+
return [title, text].filter(Boolean).join("\n");
|
|
8591
|
+
}
|
|
8592
|
+
function generatedAtString(value) {
|
|
8593
|
+
if (value instanceof Date) return value.toISOString();
|
|
8594
|
+
return value ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
8595
|
+
}
|
|
8596
|
+
async function buildAiwgStaticEmbeddingSet(index, options) {
|
|
8597
|
+
assertAiwgFortemiIndexExport(index);
|
|
8598
|
+
const granularity = options.granularity ?? "body";
|
|
8599
|
+
const records = options.records ?? index.items;
|
|
8600
|
+
const embeddings = [];
|
|
8601
|
+
for (const record of records) {
|
|
8602
|
+
const input = options.textForRecord?.(record) ?? defaultEmbeddingInput(record, granularity);
|
|
8603
|
+
const embedding = await options.backend.embed(input, record);
|
|
8604
|
+
if (embedding.length !== options.backend.dimensions) {
|
|
8605
|
+
throw new Error(`Embedding for ${record.id} has ${embedding.length} dimensions; expected ${options.backend.dimensions}`);
|
|
8606
|
+
}
|
|
8607
|
+
embeddings.push({
|
|
8608
|
+
record_id: record.id,
|
|
8609
|
+
embedding,
|
|
8610
|
+
granularity,
|
|
8611
|
+
input_hash: computeHash(new TextEncoder().encode(input)),
|
|
8612
|
+
source_path: record.source.path
|
|
8613
|
+
});
|
|
8614
|
+
}
|
|
8615
|
+
const embeddingSet = {
|
|
8616
|
+
schema_version: "aiwg.fortemi.embedding.set.v1",
|
|
8617
|
+
id: options.id,
|
|
8618
|
+
model: options.backend.model,
|
|
8619
|
+
dimensions: options.backend.dimensions,
|
|
8620
|
+
generated_at: generatedAtString(options.generatedAt),
|
|
8621
|
+
granularity,
|
|
8622
|
+
...options.metric ? { metric: options.metric } : {},
|
|
8623
|
+
input_hash_algorithm: "sha256",
|
|
8624
|
+
embeddings
|
|
8625
|
+
};
|
|
8626
|
+
assertAiwgStaticEmbeddingSet(embeddingSet);
|
|
8627
|
+
return embeddingSet;
|
|
8474
8628
|
}
|
|
8475
8629
|
function recordSearchValues(item) {
|
|
8476
8630
|
const search = item.search;
|
|
@@ -9364,8 +9518,8 @@ function communityIdsFor(item, options) {
|
|
|
9364
9518
|
}
|
|
9365
9519
|
|
|
9366
9520
|
// src/index.ts
|
|
9367
|
-
var VERSION = "2026.7.
|
|
9521
|
+
var VERSION = "2026.7.2";
|
|
9368
9522
|
|
|
9369
|
-
export { AIWG_SCAN_REQUIRED_FIELDS, ArchiveManager, AttachmentsRepository, CURRENT_MIGRATION_HEAD, CURRENT_SHARD_VERSION, CapabilityManager, CaptureKnowledgeInputSchema, CollectionsRepository, CommunitiesRepository, DB_SNAPSHOT_SCHEMA_VERSION, DbSnapshotVersionError, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, EmbeddingSetsRepository, FallbackRouter, FortemiToolManifest, GetNoteInputSchema, GraphRepository, JOB_CAPABILITIES, JOB_PRIORITIES, JobQueueWorker, LOCAL_ENDPOINTS, LinksRepository, ListNotesInputSchema, ManageArchiveInputSchema, ManageAttachmentsInputSchema, ManageCapabilitiesInputSchema, ManageCollectionsInputSchema, ManageLinksInputSchema, ManageNoteInputSchema, ManageTagsInputSchema, MemoryBlobStore, MigrationRunner, NotesRepository, OpenAICompatibleProvider, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, ProvenanceRepository, ProviderRegistry, SHARD_FORMAT, SUPPORTED_PGLITE_VERSION, SearchInputSchema, SearchRepository, SkosRepository, TagsRepository, TransactionProxy, TypedEventBus, VERSION, aiRevisionHandler, aiwgFortemiIndexToCommunityGraph, allMigrations, appendPluginScript, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, assertAiwgStaticEmbeddingSet, buildAiwgChunkedIndex, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createAiwgFetchChunkLoader, createAiwgFetchDetailLoader, createAiwgIndexController, createAiwgReviewDecisionExport, createBlobStore, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRemoteBackend, createRoutes, createShardBackend, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dumpDbSnapshot, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, findAiwgStaticDuplicatePairs, fortemiManifest, fromPrefetched, generateId, getAiwgFortemiFacets, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, provenanceEdgeToShard, queryAiwgFortemiIndex, queryAiwgHybridIndex, queryAiwgSemanticIndex, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport, validateAiwgStaticEmbeddingSet, validateChecksums, verifyDbSnapshotMeta, verifySri };
|
|
9523
|
+
export { AIWG_SCAN_REQUIRED_FIELDS, ArchiveManager, AttachmentsRepository, CURRENT_MIGRATION_HEAD, CURRENT_SHARD_VERSION, CapabilityManager, CaptureKnowledgeInputSchema, CollectionsRepository, CommunitiesRepository, DB_SNAPSHOT_SCHEMA_VERSION, DbSnapshotVersionError, EMBED_REQUEST_KIND, EMBED_RESPONSE_KIND, EmbeddingSetsRepository, FallbackRouter, FortemiToolManifest, GetNoteInputSchema, GraphRepository, JOB_CAPABILITIES, JOB_PRIORITIES, JobQueueWorker, LOCAL_ENDPOINTS, LinksRepository, ListNotesInputSchema, ManageArchiveInputSchema, ManageAttachmentsInputSchema, ManageCapabilitiesInputSchema, ManageCollectionsInputSchema, ManageLinksInputSchema, ManageNoteInputSchema, ManageTagsInputSchema, MemoryBlobStore, MigrationRunner, NotesRepository, OpenAICompatibleProvider, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, PGliteWorkerStorageBackend, PGliteWorkerStorageBackendFactory, ProvenanceRepository, ProviderRegistry, SHARD_FORMAT, SUPPORTED_PGLITE_VERSION, SearchInputSchema, SearchRepository, SkosRepository, TagsRepository, TransactionProxy, TypedEventBus, VERSION, aiRevisionHandler, aiwgFortemiIndexToCommunityGraph, allMigrations, appendPluginScript, assertAiwgFortemiChunkManifest, assertAiwgFortemiChunkPart, assertAiwgFortemiIndexExport, assertAiwgStaticEmbeddingSet, buildAiwgChunkedIndex, buildAiwgStaticEmbeddingSet, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, clearPrefetchedShard, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createAiwgFetchChunkLoader, createAiwgFetchDetailLoader, createAiwgIndexController, createAiwgReviewDecisionExport, createBlobStore, createCosineSemanticProvider, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteBackend, createPGliteInstance, createRemoteBackend, createRoutes, createShardBackend, createWorkerEmbedFunction, defaultStorageBackendFactory, detectCommunities, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, dumpDbSnapshot, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, findAiwgStaticDuplicatePairs, fortemiManifest, fromPrefetched, generateId, getAiwgFortemiFacets, getEmbedFunction, getFortemiBridge, getFortemiSecretStore, getJobQueueStatus, getLlmFunction, getNote, getPrefetchedSha256, handleEmbedRequests, hasFortemiSecureSecrets, importShard, isPluginScriptAllowed, isShardPrefetched, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteSkosTagToShard, noteToShard, openShard, packTarGz, parseCspReport, prefetchShard, provenanceEdgeToShard, queryAiwgFortemiIndex, queryAiwgHybridIndex, queryAiwgSemanticIndex, registerLlmCapability, registerSemanticCapability, registerSemanticCapabilityWorker, registerServiceWorker, restoreDbSnapshot, searchTool, selectBackend, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, skosConceptToShard, skosRelationToShard, skosSchemeToShard, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateAiwgFortemiChunkManifest, validateAiwgFortemiChunkPart, validateAiwgFortemiIndexExport, validateAiwgStaticEmbeddingSet, validateChecksums, verifyDbSnapshotMeta, verifySri };
|
|
9370
9524
|
//# sourceMappingURL=index.js.map
|
|
9371
9525
|
//# sourceMappingURL=index.js.map
|