@fortemi/core 2026.5.0 → 2026.5.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/README.md CHANGED
@@ -1,8 +1,34 @@
1
+ <div align="center">
2
+
1
3
  # @fortemi/core
2
4
 
3
- Browser-only knowledge management core. PGlite (PostgreSQL WASM) data layer, single-writer worker, 11 MCP tools, job queue, capability system, SKOS taxonomy, hybrid search. 100% JSON format parity with the [`fortemi`](https://github.com/Fortemi/fortemi) Rust server.
5
+ **Headless browser knowledge-management core powered by PGlite, typed repositories, and agent tool helpers**
6
+
7
+ Local PostgreSQL-compatible storage, migrations, note/search repositories, capability orchestration, Knowledge Shards, and bridge-ready tool metadata for browser applications.
8
+
9
+ ```bash
10
+ pnpm add @fortemi/core
11
+ ```
12
+
13
+ [![npm version](https://img.shields.io/npm/v/@fortemi/core/latest?label=npm&color=CB3837&logo=npm&style=flat-square)](https://www.npmjs.com/package/@fortemi/core)
14
+ [![npm downloads](https://img.shields.io/npm/dm/@fortemi/core?color=CB3837&logo=npm&style=flat-square)](https://www.npmjs.com/package/@fortemi/core)
15
+ [![License: AGPL-3.0-only](https://img.shields.io/badge/License-AGPL--3.0--only-blue.svg?style=flat-square)](https://github.com/Fortemi/fortemi-react/blob/main/LICENSE)
16
+ [![Node Version](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen?style=flat-square&logo=node.js)](https://nodejs.org)
17
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org)
18
+
19
+ [**Install**](#installation) · [**Quick Start**](#quick-start) · [**Surface**](#what-you-get) · [**Tools**](#tool-surface) · [**Docs**](#documentation) · [**License**](#license)
4
20
 
5
- ## Install
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## What @fortemi/core Is
26
+
27
+ `@fortemi/core` is the headless Fortemi runtime for browser applications. It provides a PGlite-backed archive, repository classes, migrations, eventing, capability management, Knowledge Shard import/export, and tool helpers that can be called from UI code or bridge adapters.
28
+
29
+ Use `@fortemi/core` directly when you are building your own UI, integrating Fortemi into a non-React host, or wiring agent/tool calls against an existing browser database context.
30
+
31
+ ## Installation
6
32
 
7
33
  ```bash
8
34
  pnpm add @fortemi/core
@@ -10,57 +36,95 @@ pnpm add @fortemi/core
10
36
  npm install @fortemi/core
11
37
  ```
12
38
 
13
- Peer-installed dependencies these install automatically as regular dependencies:
39
+ Runtime dependencies installed with the package:
14
40
 
15
- - `@electric-sql/pglite` PostgreSQL compiled to WASM
16
- - `@noble/hashes` — cryptographic hashing
17
- - `fflate` gzip / tar for Knowledge Shards
18
- - `uuid` UUIDv7 generation
19
- - `zod` runtime validation
41
+ | Dependency | Purpose |
42
+ |---|---|
43
+ | `@electric-sql/pglite` | PostgreSQL compiled to WASM, plus pgvector |
44
+ | `@noble/hashes` | SHA hashing for content and integrity checks |
45
+ | `fflate` | Tar/gzip handling for Knowledge Shards |
46
+ | `uuid` | UUIDv7 identifiers |
47
+ | `zod` | Runtime input validation for tool helpers |
20
48
 
21
- ## Quick start
49
+ ## Quick Start
22
50
 
23
51
  ```ts
24
- import { createFortemi, registerServiceWorker } from '@fortemi/core';
25
-
26
- // Spin up the in-browser database and worker. OPFS on Chrome,
27
- // IndexedDB on Firefox, in-memory on Safari.
28
- const core = await createFortemi({
29
- persistence: 'auto',
30
- archive: 'default',
31
- });
32
-
33
- // Create a note (server-format parity).
34
- const note = await core.notes.create({
52
+ import {
53
+ ArchiveManager,
54
+ NotesRepository,
55
+ SearchRepository,
56
+ TypedEventBus,
57
+ registerServiceWorker,
58
+ } from '@fortemi/core'
59
+
60
+ const events = new TypedEventBus()
61
+ const archiveManager = new ArchiveManager('opfs', events)
62
+ const db = await archiveManager.open('default')
63
+
64
+ const notes = new NotesRepository(db, events)
65
+ const search = new SearchRepository(db)
66
+
67
+ const note = await notes.create({
35
68
  title: 'Hello',
36
- body: 'First note in the local archive.',
37
- });
69
+ content: 'First note in the local archive.',
70
+ })
38
71
 
39
- // Search (full-text by default; hybrid once semantic capability initializes).
40
- const results = await core.search.query({ text: 'hello' });
72
+ const results = await search.search('hello')
41
73
 
42
- // Optional: expose MCP REST endpoints on localhost:3000 via service worker.
43
- await registerServiceWorker();
74
+ // Optional: register standalone service-worker routes.
75
+ await registerServiceWorker()
44
76
  ```
45
77
 
46
- ## What it provides
78
+ ## What You Get
47
79
 
48
80
  | Surface | Description |
49
81
  |---|---|
50
- | **PGlite worker** | Single-writer Postgres WASM in a dedicated worker; all DB operations serialized via `postMessage` |
51
- | **Repositories** | Notes, search, tags, collections, links, SKOS concepts, attachments |
52
- | **MCP tools** | `capture_knowledge`, `manage_note`, `search`, `get_note`, `list_notes`, `manage_tags`, `manage_collections`, `manage_links`, `manage_archive`, `manage_capabilities`, `manage_attachments` |
53
- | **Service worker** | Optional MCP JSON-RPC over HTTP on `localhost:3000` (request interception) |
54
- | **Capability system** | Opt-in WASM modules: embeddings (transformers.js), local LLM (WebLLM), GPU detection |
55
- | **Inference providers** | OpenAI-compatible (remote + local), auto-discovery (Ollama, LM Studio, llama.cpp, vLLM, Jan), capability-aware fallback |
56
- | **Job queue** | Server-compatible pipeline: `ai_revision` (1), `title_generation` (2), `embedding` (3), `concept_tagging` (4), `linking` (5) |
57
- | **Knowledge Shards** | Tar.gz bundles with checksums for import/export; field-mapped JSON format parity |
58
- | **Migrations** | 5 numbered schema migrations matching the fortemi server |
82
+ | PGlite archive | `opfs`, `idb`, and `memory` persistence modes with migrations on open |
83
+ | Repositories | Notes, search, tags, collections, links, SKOS concepts, and attachments |
84
+ | Event bus | Typed subscriptions for note, job, archive, and capability events |
85
+ | Capability system | Embeddings, local LLM, GPU detection, local-provider discovery, fallback routing |
86
+ | Job queue | Server-compatible background workflow for revisions, titles, embeddings, concepts, and links |
87
+ | Knowledge Shards | Tar.gz import/export with checksums and JSON format parity |
88
+ | Service-worker helpers | Route registration primitives for standalone browser integration |
89
+
90
+ ## Tool Surface
91
+
92
+ `FortemiToolManifest` registers 10 bridge-visible Mnemos tools:
93
+
94
+ `capture_knowledge`, `manage_note`, `search`, `get_note`, `list_notes`, `manage_tags`, `manage_collections`, `manage_links`, `manage_archive`, `manage_capabilities`.
95
+
96
+ The package also exports 11 direct helper functions from `@fortemi/core`, including `manageAttachments` for attachment metadata and blob operations.
97
+
98
+ ```ts
99
+ import { fortemiManifest } from '@fortemi/core'
100
+
101
+ const capabilities = fortemiManifest.toPlinyCapabilities()
102
+ ```
103
+
104
+ ## Browser Storage
105
+
106
+ | Mode | Storage | Best for |
107
+ |---|---|---|
108
+ | `opfs` | Origin Private File System access-handle pool | Chrome and Edge production apps |
109
+ | `idb` | IndexedDB-backed PGlite data directory | Firefox and broad compatibility |
110
+ | `memory` | In-memory database | Tests, demos, restricted browser contexts |
111
+
112
+ ## React Bindings
113
+
114
+ For React applications, install `@fortemi/react`. It wraps `@fortemi/core` with `FortemiProvider`, context access, and 21 hooks.
115
+
116
+ ```bash
117
+ pnpm add @fortemi/react @fortemi/core react
118
+ ```
59
119
 
60
- ## React bindings
120
+ ## Documentation
61
121
 
62
- If you're building a React app, use [`@fortemi/react`](https://www.npmjs.com/package/@fortemi/react) instead — it wraps `@fortemi/core` with `FortemiProvider` and 21 hooks.
122
+ - [Repository API](https://github.com/Fortemi/fortemi-react/blob/main/docs/api-reference.md#repositories)
123
+ - [Integration guide](https://github.com/Fortemi/fortemi-react/blob/main/docs/integration.md)
124
+ - [Search guide](https://github.com/Fortemi/fortemi-react/blob/main/docs/search.md)
125
+ - [Extending Fortemi](https://github.com/Fortemi/fortemi-react/blob/main/docs/extending.md)
126
+ - [Supply-chain controls](https://github.com/Fortemi/fortemi-react/blob/main/docs/security/supply-chain.md)
63
127
 
64
128
  ## License
65
129
 
66
- [AGPL-3.0-only](https://github.com/Fortemi/fortemi-react/blob/main/LICENSE).
130
+ AGPL-3.0-only. See [LICENSE](https://github.com/Fortemi/fortemi-react/blob/main/LICENSE).
package/dist/index.d.ts CHANGED
@@ -2370,6 +2370,6 @@ declare function exportShard(db: DatabaseClient, options?: ExportOptions): Promi
2370
2370
  */
2371
2371
  declare function importShard(db: DatabaseClient, data: Uint8Array | ArrayBuffer, options?: ImportOptions): Promise<ImportResult>;
2372
2372
 
2373
- declare const VERSION = "2026.5.0";
2373
+ declare const VERSION = "2026.5.1";
2374
2374
 
2375
2375
  export { type ArchiveInfo, ArchiveManager, type AttachInput, type AttachmentBlobRow, type AttachmentRow, AttachmentsRepository, type BlobStore, type BrowserNoteExport, CURRENT_SHARD_VERSION, type CapabilityInfo, CapabilityManager, type CapabilityName, type CapabilityState, type CaptureKnowledgeInput, CaptureKnowledgeInputSchema, type CaptureKnowledgeResult, type CollectionCreateInput, type CollectionRow, CollectionsRepository, type CompletionRequest, type CompletionResponse, type ConditionResult, type ConflictStrategy, type CooldownConfig, type CooldownEvent, type CspDirectiveName, type CspDirectives, type CspViolationReport, type DatabaseClient, type DiscoveredProvider, type DiscoveryOptions, type EmbedFunction, type EmbedRequest, type EmbedResponse, type EnqueueJobInput, type ErrorCategory, type EventMap, type ExportOptions, type FallbackEvent, FallbackRouter, type FallbackRouterConfig, type FortemiConfig, type FortemiCore, type FortemiToolDefinition, FortemiToolManifest, type GetNoteInput, GetNoteInputSchema, type GpuCapabilities, type IDisposable, type ImportCounts, type ImportOptions, 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 NoteSummary, type NoteUpdateInput, NotesRepository, OpenAICompatibleProvider, type OpenAIProviderConfig, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, type PaginatedResult, type PersistenceMode, type PlinyCapability, type PluginCspOptions, type PluginScriptDescriptor, type PluginScriptPolicy, type ProbeResult, type ProbeStatus, type ProviderCapabilities, ProviderRegistry, type ProviderTier, type QueryExecutor, type QueryResult, type RecommendedTier, type RouteHandler, SHARD_FORMAT, type SWRegistrationResult, type SearchFacets, type SearchInput, SearchInputSchema, type SearchOptions, SearchRepository, type SearchResponse, type SearchResult, type ShardCollection, type ShardComponent, type ShardEmbedding, type ShardEmbeddingSet, type ShardEmbeddingSetMember, type ShardLink, type ShardManifest, type ShardNote, type ShardTag, type SkosConcept, type SkosRelation, SkosRepository, type SkosScheme, type StorageBackend, type StorageBackendFactory, type StorageOpenRequest, type StorageTopology, type StreamChunk, TagsRepository, TransactionProxy, TypedEventBus, VERSION, type VramTier, type WorkerRequest, type WorkerResponse, aiRevisionHandler, allMigrations, appendPluginScript, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createBlobStore, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteInstance, createRoutes, defaultStorageBackendFactory, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, fortemiManifest, generateId, getEmbedFunction, getJobQueueStatus, getLlmFunction, getNote, importShard, isPluginScriptAllowed, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteToShard, packTarGz, parseCspReport, registerLlmCapability, registerSemanticCapability, registerServiceWorker, searchTool, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateChecksums, verifySri };
package/dist/index.js CHANGED
@@ -5131,7 +5131,7 @@ function parseJsonArray(data) {
5131
5131
  }
5132
5132
 
5133
5133
  // src/index.ts
5134
- var VERSION = "2026.5.0";
5134
+ var VERSION = "2026.5.1";
5135
5135
 
5136
5136
  export { ArchiveManager, AttachmentsRepository, CURRENT_SHARD_VERSION, CapabilityManager, CaptureKnowledgeInputSchema, CollectionsRepository, FallbackRouter, FortemiToolManifest, GetNoteInputSchema, JOB_CAPABILITIES, JOB_PRIORITIES, JobQueueWorker, LOCAL_ENDPOINTS, LinksRepository, ListNotesInputSchema, ManageArchiveInputSchema, ManageAttachmentsInputSchema, ManageCapabilitiesInputSchema, ManageCollectionsInputSchema, ManageLinksInputSchema, ManageNoteInputSchema, ManageTagsInputSchema, MemoryBlobStore, MigrationRunner, NotesRepository, OpenAICompatibleProvider, PGliteStorageBackend, PGliteStorageBackendFactory, PGliteWorkerClient, ProviderRegistry, SHARD_FORMAT, SearchInputSchema, SearchRepository, SkosRepository, TagsRepository, TransactionProxy, TypedEventBus, VERSION, aiRevisionHandler, allMigrations, appendPluginScript, buildNoteConditions, buildPluginCsp, captureKnowledge, chunkText, classifyError, classifyModel, collectionFromShard, collectionToShard, computeHash, computeSri, conceptTaggingHandler, cosineSimilarity, createBlobStore, createCspReportHandler, createFortemi, createLegacyProvider, createPGliteInstance, createRoutes, defaultStorageBackendFactory, detectGpuCapabilities, detectInferenceCapabilities, discoverLocalProviders, embeddingFromShard, embeddingGenerationHandler, embeddingSetFromShard, embeddingSetMemberToShard, embeddingSetToShard, embeddingToShard, enqueueFullWorkflow, enqueueJob, enqueueNoteCreationJobs, estimateModelFit, estimateVramMB, estimateVramTier, exportShard, fetchPluginScript, fortemiManifest, generateId, getEmbedFunction, getJobQueueStatus, getLlmFunction, getNote, importShard, isPluginScriptAllowed, linkFromShard, linkToShard, linkingHandler, listNotes, manageArchive, manageAttachments, manageCapabilities, manageCollections, manageLinks, manageNote, manageTags, matchRoute, noteFromShard, noteToShard, packTarGz, parseCspReport, registerLlmCapability, registerSemanticCapability, registerServiceWorker, searchTool, selectLlmModel, setEmbedFunction, setLlmFunction, sha256Hex, suggestTags, tagsFromShard, tagsToShard, titleGenerationHandler, unpackTarGz, unregisterLlmCapability, unregisterSemanticCapability, validateChecksums, verifySri };
5137
5137
  //# sourceMappingURL=index.js.map