@fortemi/core 2026.7.0 → 2026.7.1

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/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, AiwgFortemiChunkDetailRef, AiwgFortemiChunkManifest, AiwgFortemiChunkPart, AiwgFortemiChunkPartRef, AiwgFortemiIndexExport, AiwgFortemiKnownRecordType, AiwgFortemiProjectedRecord, AiwgFortemiProvenance, AiwgFortemiProvenanceEvent, AiwgFortemiRecord, AiwgFortemiRecordSource, AiwgFortemiRecordType, AiwgFortemiRelationship, 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, 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';
4
4
 
5
5
  /**
6
6
  * Generate a RFC 9562 UUIDv7 identifier.
@@ -2365,19 +2365,19 @@ declare const CaptureKnowledgeInputSchema: z.ZodObject<{
2365
2365
  }, {
2366
2366
  content: string;
2367
2367
  title?: string | undefined;
2368
- tags?: string[] | undefined;
2369
2368
  format?: "markdown" | "plain" | "html" | undefined;
2369
+ tags?: string[] | undefined;
2370
2370
  }>, "many">>;
2371
2371
  template: z.ZodOptional<z.ZodString>;
2372
2372
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2373
2373
  }, "strip", z.ZodTypeAny, {
2374
2374
  source: string;
2375
2375
  format: "markdown" | "plain" | "html";
2376
- visibility: "private" | "public" | "shared";
2376
+ visibility: "private" | "shared" | "public";
2377
2377
  action: "create" | "bulk_create" | "from_template";
2378
2378
  title?: string | undefined;
2379
- tags?: string[] | undefined;
2380
2379
  archive_id?: string | undefined;
2380
+ tags?: string[] | undefined;
2381
2381
  content?: string | undefined;
2382
2382
  notes?: {
2383
2383
  format: "markdown" | "plain" | "html";
@@ -2391,16 +2391,16 @@ declare const CaptureKnowledgeInputSchema: z.ZodObject<{
2391
2391
  action: "create" | "bulk_create" | "from_template";
2392
2392
  source?: string | undefined;
2393
2393
  title?: string | undefined;
2394
- tags?: string[] | undefined;
2395
2394
  archive_id?: string | undefined;
2396
2395
  format?: "markdown" | "plain" | "html" | undefined;
2397
- visibility?: "private" | "public" | "shared" | undefined;
2396
+ visibility?: "private" | "shared" | "public" | undefined;
2397
+ tags?: string[] | undefined;
2398
2398
  content?: string | undefined;
2399
2399
  notes?: {
2400
2400
  content: string;
2401
2401
  title?: string | undefined;
2402
- tags?: string[] | undefined;
2403
2402
  format?: "markdown" | "plain" | "html" | undefined;
2403
+ tags?: string[] | undefined;
2404
2404
  }[] | undefined;
2405
2405
  template?: string | undefined;
2406
2406
  variables?: Record<string, string> | undefined;
@@ -2447,17 +2447,17 @@ declare const SearchInputSchema: z.ZodObject<{
2447
2447
  visibility: z.ZodOptional<z.ZodEnum<["private", "shared", "public"]>>;
2448
2448
  include_facets: z.ZodDefault<z.ZodBoolean>;
2449
2449
  }, "strip", z.ZodTypeAny, {
2450
- query: string;
2451
- offset: number;
2452
2450
  limit: number;
2451
+ offset: number;
2453
2452
  include_facets: boolean;
2454
- mode: "text" | "auto" | "semantic" | "hybrid";
2453
+ mode: "auto" | "text" | "semantic" | "hybrid";
2454
+ query: string;
2455
2455
  source?: string | undefined;
2456
- tags?: string[] | undefined;
2457
2456
  format?: "markdown" | "plain" | "html" | undefined;
2458
- visibility?: "private" | "public" | "shared" | undefined;
2457
+ visibility?: "private" | "shared" | "public" | undefined;
2459
2458
  is_starred?: boolean | undefined;
2460
2459
  is_archived?: boolean | undefined;
2460
+ tags?: string[] | undefined;
2461
2461
  collection_id?: string | undefined;
2462
2462
  date_from?: Date | undefined;
2463
2463
  date_to?: Date | undefined;
@@ -2466,18 +2466,18 @@ declare const SearchInputSchema: z.ZodObject<{
2466
2466
  }, {
2467
2467
  query: string;
2468
2468
  source?: string | undefined;
2469
- tags?: string[] | undefined;
2470
- offset?: number | undefined;
2471
- limit?: number | undefined;
2472
2469
  format?: "markdown" | "plain" | "html" | undefined;
2473
- visibility?: "private" | "public" | "shared" | undefined;
2470
+ visibility?: "private" | "shared" | "public" | undefined;
2474
2471
  is_starred?: boolean | undefined;
2475
2472
  is_archived?: boolean | undefined;
2473
+ tags?: string[] | undefined;
2474
+ limit?: number | undefined;
2475
+ offset?: number | undefined;
2476
2476
  collection_id?: string | undefined;
2477
2477
  date_from?: Date | undefined;
2478
2478
  date_to?: Date | undefined;
2479
2479
  include_facets?: boolean | undefined;
2480
- mode?: "text" | "auto" | "semantic" | "hybrid" | undefined;
2480
+ mode?: "auto" | "text" | "semantic" | "hybrid" | undefined;
2481
2481
  embeddingSetId?: string | undefined;
2482
2482
  query_embedding?: number[] | undefined;
2483
2483
  }>;
@@ -2557,22 +2557,22 @@ declare const ListNotesInputSchema: z.ZodObject<{
2557
2557
  collection_id: z.ZodOptional<z.ZodString>;
2558
2558
  include_deleted: z.ZodOptional<z.ZodBoolean>;
2559
2559
  }, "strip", z.ZodTypeAny, {
2560
- sort: "title" | "updated_at" | "created_at";
2561
- offset: number;
2560
+ sort: "created_at" | "updated_at" | "title";
2562
2561
  limit: number;
2562
+ offset: number;
2563
2563
  order: "asc" | "desc";
2564
- tags?: string[] | undefined;
2565
2564
  is_starred?: boolean | undefined;
2566
2565
  is_archived?: boolean | undefined;
2566
+ tags?: string[] | undefined;
2567
2567
  include_deleted?: boolean | undefined;
2568
2568
  collection_id?: string | undefined;
2569
2569
  }, {
2570
- tags?: string[] | undefined;
2571
- sort?: "title" | "updated_at" | "created_at" | undefined;
2572
- offset?: number | undefined;
2573
- limit?: number | undefined;
2570
+ sort?: "created_at" | "updated_at" | "title" | undefined;
2574
2571
  is_starred?: boolean | undefined;
2575
2572
  is_archived?: boolean | undefined;
2573
+ tags?: string[] | undefined;
2574
+ limit?: number | undefined;
2575
+ offset?: number | undefined;
2576
2576
  order?: "asc" | "desc" | undefined;
2577
2577
  include_deleted?: boolean | undefined;
2578
2578
  collection_id?: string | undefined;
@@ -2586,12 +2586,12 @@ declare const ManageTagsInputSchema: z.ZodObject<{
2586
2586
  tag: z.ZodOptional<z.ZodString>;
2587
2587
  }, "strip", z.ZodTypeAny, {
2588
2588
  action: "add" | "remove" | "list_for_note" | "list_all";
2589
- tag?: string | undefined;
2590
2589
  note_id?: string | undefined;
2590
+ tag?: string | undefined;
2591
2591
  }, {
2592
2592
  action: "add" | "remove" | "list_for_note" | "list_all";
2593
- tag?: string | undefined;
2594
2593
  note_id?: string | undefined;
2594
+ tag?: string | undefined;
2595
2595
  }>;
2596
2596
  type ManageTagsInput = z.infer<typeof ManageTagsInputSchema>;
2597
2597
  interface ManageTagsResult {
@@ -2613,17 +2613,17 @@ declare const ManageCollectionsInputSchema: z.ZodObject<{
2613
2613
  note_id: z.ZodOptional<z.ZodString>;
2614
2614
  }, "strip", z.ZodTypeAny, {
2615
2615
  action: "create" | "delete" | "list" | "assign" | "unassign" | "list_tree";
2616
- name?: string | undefined;
2617
- description?: string | undefined;
2618
2616
  collection_id?: string | undefined;
2619
2617
  note_id?: string | undefined;
2618
+ name?: string | undefined;
2619
+ description?: string | undefined;
2620
2620
  parent_id?: string | undefined;
2621
2621
  }, {
2622
2622
  action: "create" | "delete" | "list" | "assign" | "unassign" | "list_tree";
2623
- name?: string | undefined;
2624
- description?: string | undefined;
2625
2623
  collection_id?: string | undefined;
2626
2624
  note_id?: string | undefined;
2625
+ name?: string | undefined;
2626
+ description?: string | undefined;
2627
2627
  parent_id?: string | undefined;
2628
2628
  }>;
2629
2629
  type ManageCollectionsInput = z.infer<typeof ManageCollectionsInputSchema>;
@@ -3784,6 +3784,6 @@ declare function getPrefetchedSha256(url: string): string | undefined;
3784
3784
  */
3785
3785
  declare function clearPrefetchedShard(url?: string): void;
3786
3786
 
3787
- declare const VERSION = "2026.7.0";
3787
+ declare const VERSION = "2026.7.1";
3788
3788
 
3789
3789
  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
@@ -8093,8 +8093,6 @@ var REQUIRED_RECORD_FIELDS = [
8093
8093
  "id",
8094
8094
  "type",
8095
8095
  "source",
8096
- "title",
8097
- "text",
8098
8096
  "facets",
8099
8097
  "tags",
8100
8098
  "concepts",
@@ -8135,6 +8133,12 @@ function isPlainRecord(value) {
8135
8133
  function isOptionalStringArray(value) {
8136
8134
  return value === void 0 || Array.isArray(value) && value.every((item) => typeof item === "string");
8137
8135
  }
8136
+ function isSupportedIndexSchemaVersion(value) {
8137
+ return value === "aiwg.fortemi.index.export.v1" || value === "aiwg.fortemi.index.export.v2";
8138
+ }
8139
+ function isSupportedRecordSchemaVersion(value) {
8140
+ return value === "aiwg.fortemi.index.record.v1" || value === "aiwg.fortemi.index.record.v2";
8141
+ }
8138
8142
  function validateOptionalRichMetadata(item, index, errors) {
8139
8143
  if (item.skos_concepts !== void 0) {
8140
8144
  if (!Array.isArray(item.skos_concepts)) {
@@ -8181,28 +8185,80 @@ function validateOptionalRichMetadata(item, index, errors) {
8181
8185
  if (relationship.metadata !== void 0 && !isPlainRecord(relationship.metadata)) {
8182
8186
  errors.push("items[" + index + "].relationships[" + relationshipIndex + "].metadata must be an object");
8183
8187
  }
8188
+ if (relationship.direction !== void 0 && relationship.direction !== "upstream" && relationship.direction !== "downstream" && relationship.direction !== "related") {
8189
+ errors.push("items[" + index + "].relationships[" + relationshipIndex + "].direction must be upstream, downstream, or related");
8190
+ }
8191
+ if (relationship.target_path !== void 0 && typeof relationship.target_path !== "string") {
8192
+ errors.push("items[" + index + "].relationships[" + relationshipIndex + "].target_path must be a string");
8193
+ }
8194
+ }
8195
+ }
8196
+ if (item.search !== void 0) {
8197
+ if (!isPlainRecord(item.search)) {
8198
+ errors.push("items[" + index + "].search must be an object");
8199
+ } else {
8200
+ if (!isOptionalStringArray(item.search.triggers)) errors.push("items[" + index + "].search.triggers must be a string array");
8201
+ if (!isOptionalStringArray(item.search.aliases)) errors.push("items[" + index + "].search.aliases must be a string array");
8202
+ if (!isOptionalStringArray(item.search.tags)) errors.push("items[" + index + "].search.tags must be a string array");
8203
+ if (item.search.frontmatter !== void 0 && !isPlainRecord(item.search.frontmatter)) {
8204
+ errors.push("items[" + index + "].search.frontmatter must be an object");
8205
+ }
8206
+ }
8207
+ }
8208
+ if (item.chunks !== void 0) {
8209
+ if (!Array.isArray(item.chunks)) {
8210
+ errors.push("items[" + index + "].chunks must be an array when present");
8211
+ } else {
8212
+ for (const [chunkIndex, chunk] of item.chunks.entries()) {
8213
+ if (!isPlainRecord(chunk)) errors.push("items[" + index + "].chunks[" + chunkIndex + "] must be an object");
8214
+ if (chunk.metadata !== void 0 && !isPlainRecord(chunk.metadata)) {
8215
+ errors.push("items[" + index + "].chunks[" + chunkIndex + "].metadata must be an object");
8216
+ }
8217
+ }
8218
+ }
8219
+ }
8220
+ if (item.embeddings !== void 0) {
8221
+ if (!Array.isArray(item.embeddings)) {
8222
+ errors.push("items[" + index + "].embeddings must be an array when present");
8223
+ } else {
8224
+ for (const [embeddingIndex, embedding] of item.embeddings.entries()) {
8225
+ if (!isPlainRecord(embedding)) errors.push("items[" + index + "].embeddings[" + embeddingIndex + "] must be an object");
8226
+ const vector2 = embedding.embedding ?? embedding.vector;
8227
+ if (vector2 !== void 0 && (!Array.isArray(vector2) || !vector2.every((entry) => typeof entry === "number"))) {
8228
+ errors.push("items[" + index + "].embeddings[" + embeddingIndex + "].embedding/vector must be a number array");
8229
+ }
8230
+ if (embedding.metadata !== void 0 && !isPlainRecord(embedding.metadata)) {
8231
+ errors.push("items[" + index + "].embeddings[" + embeddingIndex + "].metadata must be an object");
8232
+ }
8233
+ }
8184
8234
  }
8185
8235
  }
8236
+ if (item.compatibility !== void 0 && !isPlainRecord(item.compatibility)) {
8237
+ errors.push("items[" + index + "].compatibility must be an object");
8238
+ }
8186
8239
  }
8187
8240
  function validateAiwgFortemiIndexExport(value) {
8188
8241
  const errors = [];
8189
8242
  const counts = {};
8190
8243
  const data = value;
8191
- if (data?.schema_version !== "aiwg.fortemi.index.export.v1") {
8192
- errors.push("schema_version must be aiwg.fortemi.index.export.v1");
8244
+ if (!isSupportedIndexSchemaVersion(data?.schema_version)) {
8245
+ errors.push("schema_version must be aiwg.fortemi.index.export.v1 or aiwg.fortemi.index.export.v2");
8193
8246
  }
8194
8247
  if (!hasString(data?.generated_at)) errors.push("generated_at is required");
8195
8248
  if (!hasString(data?.source?.repo)) errors.push("source.repo is required");
8196
8249
  if (!hasString(data?.source?.privacy)) errors.push("source.privacy is required");
8197
8250
  if (!Array.isArray(data?.items)) errors.push("items must be an array");
8251
+ if (data.compatibility !== void 0 && !isPlainRecord(data.compatibility)) {
8252
+ errors.push("compatibility must be an object");
8253
+ }
8198
8254
  const ids = /* @__PURE__ */ new Set();
8199
8255
  let previousId = "";
8200
8256
  for (const [index, item] of (data.items ?? []).entries()) {
8201
8257
  for (const field of REQUIRED_RECORD_FIELDS) {
8202
8258
  if (!(field in item)) errors.push("items[" + index + "]." + field + " is required");
8203
8259
  }
8204
- if (item.schema_version !== "aiwg.fortemi.index.record.v1") {
8205
- errors.push("items[" + index + "].schema_version must be aiwg.fortemi.index.record.v1");
8260
+ if (!isSupportedRecordSchemaVersion(item.schema_version)) {
8261
+ errors.push("items[" + index + "].schema_version must be aiwg.fortemi.index.record.v1 or aiwg.fortemi.index.record.v2");
8206
8262
  }
8207
8263
  if (!hasString(item.id)) errors.push("items[" + index + "].id is required");
8208
8264
  if (hasString(item.id) && ids.has(item.id)) errors.push("duplicate id: " + item.id);
@@ -8216,6 +8272,12 @@ function validateAiwgFortemiIndexExport(value) {
8216
8272
  if (!hasString(item.source?.path)) errors.push("items[" + index + "].source.path is required");
8217
8273
  if (!hasString(item.source?.repo_relative_path)) errors.push("items[" + index + "].source.repo_relative_path is required");
8218
8274
  if (!hasString(item.source?.locator)) errors.push("items[" + index + "].source.locator is required");
8275
+ if (typeof item.title !== "string" && typeof item.search?.title !== "string" && typeof item.search?.name !== "string") {
8276
+ errors.push("items[" + index + "].title or search.title/search.name is required");
8277
+ }
8278
+ if (typeof item.text !== "string" && typeof item.search?.body !== "string" && typeof item.search?.summary !== "string") {
8279
+ errors.push("items[" + index + "].text or search.body/search.summary is required");
8280
+ }
8219
8281
  if (!Array.isArray(item.tags)) errors.push("items[" + index + "].tags must be an array");
8220
8282
  if (!Array.isArray(item.concepts)) errors.push("items[" + index + "].concepts must be an array");
8221
8283
  if (!Array.isArray(item.relationships)) errors.push("items[" + index + "].relationships must be an array");
@@ -8296,8 +8358,8 @@ function validateProjectedRecords(items) {
8296
8358
  const ids = /* @__PURE__ */ new Set();
8297
8359
  let previousId = "";
8298
8360
  for (const [index, item] of items.entries()) {
8299
- if (item.schema_version !== "aiwg.fortemi.index.record.v1") {
8300
- errors.push("items[" + index + "].schema_version must be aiwg.fortemi.index.record.v1");
8361
+ if (!isSupportedRecordSchemaVersion(item.schema_version)) {
8362
+ errors.push("items[" + index + "].schema_version must be aiwg.fortemi.index.record.v1 or aiwg.fortemi.index.record.v2");
8301
8363
  }
8302
8364
  if (!hasString(item.id)) errors.push("items[" + index + "].id is required");
8303
8365
  if (hasString(item.id) && ids.has(item.id)) errors.push("duplicate id: " + item.id);
@@ -8307,8 +8369,12 @@ function validateProjectedRecords(items) {
8307
8369
  }
8308
8370
  if (hasString(item.id)) previousId = item.id;
8309
8371
  if (!hasString(item.type)) errors.push("items[" + index + "].type must be a non-empty string");
8310
- if (!hasString(item.title)) errors.push("items[" + index + "].title is required");
8311
- if (typeof item.text !== "string") errors.push("items[" + index + "].text is required");
8372
+ if (typeof item.title !== "string" && typeof item.search?.title !== "string" && typeof item.search?.name !== "string") {
8373
+ errors.push("items[" + index + "].title or search.title/search.name is required");
8374
+ }
8375
+ if (typeof item.text !== "string" && typeof item.search?.body !== "string" && typeof item.search?.summary !== "string") {
8376
+ errors.push("items[" + index + "].text or search.body/search.summary is required");
8377
+ }
8312
8378
  if (!item.facets || typeof item.facets !== "object" || Array.isArray(item.facets)) {
8313
8379
  errors.push("items[" + index + "].facets must be an object");
8314
8380
  }
@@ -8400,6 +8466,38 @@ function getAiwgFortemiFacets(items) {
8400
8466
  }
8401
8467
  return result;
8402
8468
  }
8469
+ function recordTitle(item) {
8470
+ return item.title ?? item.search?.title ?? item.search?.name ?? item.id;
8471
+ }
8472
+ function recordText(item) {
8473
+ return item.text ?? item.search?.body ?? item.search?.summary ?? item.chunks?.map((chunk) => chunk.text ?? chunk.body ?? chunk.summary ?? "").filter(Boolean).join("\n") ?? "";
8474
+ }
8475
+ function recordSearchValues(item) {
8476
+ const search = item.search;
8477
+ const values = [
8478
+ item.id,
8479
+ recordTitle(item),
8480
+ recordText(item),
8481
+ search?.title,
8482
+ search?.name,
8483
+ search?.summary,
8484
+ search?.body,
8485
+ search?.capability,
8486
+ search?.phase,
8487
+ search?.type,
8488
+ ...search?.triggers ?? [],
8489
+ ...search?.aliases ?? [],
8490
+ ...search?.tags ?? [],
8491
+ ...(item.chunks ?? []).flatMap((chunk) => [chunk.text, chunk.body, chunk.summary, chunk.source_path])
8492
+ ];
8493
+ if (search?.frontmatter) {
8494
+ for (const value of Object.values(search.frontmatter)) {
8495
+ if (typeof value === "string") values.push(value);
8496
+ else if (Array.isArray(value)) values.push(...value.filter((entry) => typeof entry === "string"));
8497
+ }
8498
+ }
8499
+ return values.filter((value) => typeof value === "string" && value.length > 0);
8500
+ }
8403
8501
  function buildAiwgChunkedIndex(index, options = {}) {
8404
8502
  const partSize = hasPositiveInteger(options.partSize) ? options.partSize : 500;
8405
8503
  const projection = options.projection;
@@ -8461,14 +8559,21 @@ function matchesFacetFilters(item, filters) {
8461
8559
  function queryMatches(item, q) {
8462
8560
  if (!q) return [];
8463
8561
  const matches = [];
8464
- if (item.title.toLowerCase().includes(q)) matches.push({ field: "title", value: item.title });
8465
- if (item.text.toLowerCase().includes(q)) matches.push({ field: "text", value: item.text });
8562
+ const title = recordTitle(item);
8563
+ const text = recordText(item);
8564
+ if (title.toLowerCase().includes(q)) matches.push({ field: "title", value: title });
8565
+ if (text.toLowerCase().includes(q)) matches.push({ field: "text", value: text });
8466
8566
  for (const tag of item.tags) {
8467
8567
  if (tag.toLowerCase().includes(q)) matches.push({ field: "tag", value: tag });
8468
8568
  }
8469
8569
  for (const concept of item.concepts) {
8470
8570
  if (concept.toLowerCase().includes(q)) matches.push({ field: "concept", value: concept });
8471
8571
  }
8572
+ for (const value of recordSearchValues(item)) {
8573
+ if (value !== title && value !== text && value.toLowerCase().includes(q)) {
8574
+ matches.push({ field: "text", value, score: DEFAULT_QUERY_WEIGHTS.text });
8575
+ }
8576
+ }
8472
8577
  return matches;
8473
8578
  }
8474
8579
  var DISCOVERY_STOPWORDS = /* @__PURE__ */ new Set([
@@ -8524,17 +8629,28 @@ function discoveryMatches(item, query) {
8524
8629
  const idParts = item.id.split(/[:/]/);
8525
8630
  const names = [
8526
8631
  item.id,
8527
- item.title,
8632
+ recordTitle(item),
8633
+ item.search?.name,
8634
+ item.search?.title,
8635
+ ...item.search?.aliases ?? [],
8528
8636
  ...idParts,
8529
8637
  ...facetValues(item, ["name", "canonical_name", "command", "skill", "agent", "rule"])
8530
- ].filter(Boolean);
8531
- const triggers = facetValues(item, ["trigger", "triggers", "trigger_phrase", "trigger_phrases"]);
8638
+ ].filter((value) => hasString(value));
8639
+ const triggers = [
8640
+ ...facetValues(item, ["trigger", "triggers", "trigger_phrase", "trigger_phrases"]),
8641
+ ...item.search?.triggers ?? []
8642
+ ];
8532
8643
  const capabilities = [
8533
8644
  ...facetValues(item, ["capability", "capabilities", "summary", "description"]),
8645
+ item.search?.capability,
8646
+ item.search?.summary,
8647
+ item.search?.phase,
8648
+ item.search?.type,
8649
+ ...item.search?.tags ?? [],
8534
8650
  ...item.concepts,
8535
8651
  ...item.tags
8536
- ];
8537
- const sourceValues = [item.source?.path, item.source?.repo_relative_path, item.source?.locator].filter(Boolean);
8652
+ ].filter((value) => hasString(value));
8653
+ const sourceValues = [item.source?.path, item.source?.repo_relative_path, item.source?.locator].filter((value) => hasString(value));
8538
8654
  for (const name of names) {
8539
8655
  const canonicalName = canonicalDiscoveryName(name);
8540
8656
  if (!canonicalName) continue;
@@ -8544,8 +8660,9 @@ function discoveryMatches(item, query) {
8544
8660
  addDiscoveryMatch(matches, { field: "id", value: name, score: 48, reason: "near canonical name" });
8545
8661
  }
8546
8662
  }
8547
- const titleOverlap = tokenOverlapScore(tokens, item.title);
8548
- if (titleOverlap > 0) addDiscoveryMatch(matches, { field: "title", value: item.title, score: 18 * titleOverlap, reason: "title token overlap" });
8663
+ const title = recordTitle(item);
8664
+ const titleOverlap = tokenOverlapScore(tokens, title);
8665
+ if (titleOverlap > 0) addDiscoveryMatch(matches, { field: "title", value: title, score: 18 * titleOverlap, reason: "title token overlap" });
8549
8666
  for (const trigger of triggers) {
8550
8667
  const overlap = tokenOverlapScore(tokens, trigger);
8551
8668
  if (overlap > 0) addDiscoveryMatch(matches, { field: "facet", value: trigger, score: 34 * overlap, reason: "trigger phrase" });
@@ -8554,8 +8671,9 @@ function discoveryMatches(item, query) {
8554
8671
  const overlap = tokenOverlapScore(tokens, capability);
8555
8672
  if (overlap > 0) addDiscoveryMatch(matches, { field: "concept", value: capability, score: 22 * overlap, reason: "capability overlap" });
8556
8673
  }
8557
- const textOverlap = tokenOverlapScore(tokens, item.text);
8558
- if (textOverlap > 0) addDiscoveryMatch(matches, { field: "text", value: item.text, score: 8 * textOverlap, reason: "body token overlap" });
8674
+ const text = recordText(item);
8675
+ const textOverlap = tokenOverlapScore(tokens, text);
8676
+ if (textOverlap > 0) addDiscoveryMatch(matches, { field: "text", value: text, score: 8 * textOverlap, reason: "body token overlap" });
8559
8677
  for (const source of sourceValues) {
8560
8678
  const overlap = tokenOverlapScore(tokens, source);
8561
8679
  if (overlap > 0) addDiscoveryMatch(matches, { field: "source", value: source, score: 2 * overlap, reason: "path overlap" });
@@ -8583,7 +8701,7 @@ function createSnippet(item, matches, q, maxLength) {
8583
8701
  const textMatch = matches.find((match) => match.field === "text");
8584
8702
  const titleMatch = matches.find((match) => match.field === "title");
8585
8703
  const firstMatch = textMatch ?? titleMatch ?? matches[0];
8586
- return clipSnippet(firstMatch?.value ?? item.text, q, maxLength);
8704
+ return clipSnippet(firstMatch?.value ?? recordText(item), q, maxLength);
8587
8705
  }
8588
8706
  function createRankedEntries(items, q, options, ordinalBase = 0) {
8589
8707
  const weights = { ...DEFAULT_QUERY_WEIGHTS, ...options.weights };
@@ -8845,13 +8963,16 @@ function edgeFromRelationship(sourceId, relationship) {
8845
8963
  source_id: sourceId,
8846
8964
  target_id: relationship.target_id,
8847
8965
  type: relationship.type,
8848
- ...relationship.source_path ? { source_path: relationship.source_path } : {}
8966
+ ...relationship.source_path ? { source_path: relationship.source_path } : {},
8967
+ ...relationship.target_path ? { target_path: relationship.target_path } : {},
8968
+ ...relationship.direction ? { direction: relationship.direction } : {}
8849
8969
  };
8850
8970
  }
8851
8971
  function relationshipMatches(edge, options = {}) {
8852
8972
  const type = relationshipTypeFilter(options);
8853
8973
  const direction = options.direction ?? "both";
8854
8974
  if (type && edge.type !== type) return false;
8975
+ if (options.relationshipDirection && edge.direction !== options.relationshipDirection) return false;
8855
8976
  if (options.sourceId && edge.source_id !== options.sourceId) return false;
8856
8977
  if (options.targetId && edge.target_id !== options.targetId) return false;
8857
8978
  if (direction === "out" && options.targetId && edge.target_id !== options.targetId) return false;
@@ -8859,7 +8980,7 @@ function relationshipMatches(edge, options = {}) {
8859
8980
  return true;
8860
8981
  }
8861
8982
  function nodeSummary(item) {
8862
- return { id: item.id, type: item.type, title: item.title };
8983
+ return { id: item.id, type: item.type, title: recordTitle(item) };
8863
8984
  }
8864
8985
  function addNode(nodes, item) {
8865
8986
  if (item) nodes.set(item.id, nodeSummary(item));
@@ -9243,7 +9364,7 @@ function communityIdsFor(item, options) {
9243
9364
  }
9244
9365
 
9245
9366
  // src/index.ts
9246
- var VERSION = "2026.7.0";
9367
+ var VERSION = "2026.7.1";
9247
9368
 
9248
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 };
9249
9370
  //# sourceMappingURL=index.js.map