@fortemi/core 2026.5.2 → 2026.5.4
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 +45 -8
- package/dist/index.d.ts +488 -50
- package/dist/index.js +1383 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# @fortemi/core
|
|
4
4
|
|
|
5
|
-
**Headless browser knowledge-management core powered by PGlite, typed repositories, and agent tool helpers**
|
|
5
|
+
**Headless browser knowledge-management core powered by PGlite, typed repositories, semantic retrieval, and agent tool helpers**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Build local-first knowledge apps with PostgreSQL-compatible storage in the browser, production-ready repositories, search primitives, Knowledge Shard portability, optional local AI wiring, and bridge-ready tool metadata.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
pnpm add @fortemi/core
|
|
@@ -16,7 +16,7 @@ pnpm add @fortemi/core
|
|
|
16
16
|
[](https://nodejs.org)
|
|
17
17
|
[](https://www.typescriptlang.org)
|
|
18
18
|
|
|
19
|
-
[**Install**](#installation) · [**Quick Start**](#quick-start) · [**Surface**](#what-you-get) · [**Tools**](#tool-surface) · [**Docs**](#documentation) · [**License**](#license)
|
|
19
|
+
[**Install**](#installation) · [**Why Fortemi**](#why-fortemi-core) · [**Quick Start**](#quick-start) · [**Surface**](#what-you-get) · [**Tools**](#tool-surface) · [**Docs**](#documentation) · [**License**](#license)
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -24,9 +24,36 @@ pnpm add @fortemi/core
|
|
|
24
24
|
|
|
25
25
|
## What @fortemi/core Is
|
|
26
26
|
|
|
27
|
-
`@fortemi/core` is the headless Fortemi runtime for browser applications. It
|
|
27
|
+
`@fortemi/core` is the headless Fortemi runtime for browser applications. It gives your app a durable local archive backed by PGlite, typed repository classes, migrations, eventing, capability management, Knowledge Shard import/export, and tool helpers that can be called from UI code or bridge adapters.
|
|
28
28
|
|
|
29
|
-
Use
|
|
29
|
+
Use it when you want the browser to own the user's working knowledge: notes, links, tags, collections, SKOS concepts, attachments, search history, revisions, generated metadata, and portable exports. No application server is required for the core archive path, and the same package can power React, non-React, extension, or embedded host integrations.
|
|
30
|
+
|
|
31
|
+
## Why Fortemi Core
|
|
32
|
+
|
|
33
|
+
Most browser note and knowledge apps choose between a thin IndexedDB wrapper, a hosted database, or a custom sync protocol. Fortemi starts from a different premise: the browser can run a real PostgreSQL-compatible archive locally, then expose that archive through stable typed APIs and agent-readable tools.
|
|
34
|
+
|
|
35
|
+
| Need | What Fortemi provides |
|
|
36
|
+
|---|---|
|
|
37
|
+
| Local-first persistence | PGlite storage through OPFS, IndexedDB, or memory modes |
|
|
38
|
+
| Queryable knowledge | SQL-backed repositories for notes, links, tags, collections, SKOS concepts, jobs, and search |
|
|
39
|
+
| Retrieval quality | Full-text search, pgvector-backed semantic search, hybrid ranking, snippets, facets, and filters |
|
|
40
|
+
| AI-ready workflows | Optional embeddings, local LLM capability discovery, job provenance, and fallback routing |
|
|
41
|
+
| Portable archives | Knowledge Shard tar.gz import/export with checksums and JSON format parity |
|
|
42
|
+
| Agent integration | Manifest-backed tools and direct helper functions for bridge adapters and automation |
|
|
43
|
+
| UI freedom | A headless package you can use from React, another framework, a browser extension, or a custom host |
|
|
44
|
+
|
|
45
|
+
### What You Can Build
|
|
46
|
+
|
|
47
|
+
- Local-first notebooks, research workspaces, and personal knowledge bases
|
|
48
|
+
- Browser-only semantic search over user-owned notes and imported knowledge
|
|
49
|
+
- AI memory layers for agents that need structured retrieval, provenance, and portable state
|
|
50
|
+
- Web apps that can run from static hosting while still offering durable local storage
|
|
51
|
+
- Import/export pipelines using Knowledge Shards instead of app-specific backup formats
|
|
52
|
+
- Custom React, Svelte, Vue, extension, or embedded UIs on top of the same archive model
|
|
53
|
+
|
|
54
|
+
### Architecture at a Glance
|
|
55
|
+
|
|
56
|
+
`ArchiveManager` opens a PGlite database, applies migrations, and scopes storage by archive name. Repository classes provide the canonical data-access layer. `TypedEventBus` keeps UI and background jobs in sync. Capability services track optional AI/runtime features. Tool helpers expose the same data model to bridges, local automations, and agent hosts.
|
|
30
57
|
|
|
31
58
|
## Installation
|
|
32
59
|
|
|
@@ -80,16 +107,22 @@ await registerServiceWorker()
|
|
|
80
107
|
| Surface | Description |
|
|
81
108
|
|---|---|
|
|
82
109
|
| PGlite archive | `opfs`, `idb`, and `memory` persistence modes with migrations on open |
|
|
83
|
-
| Repositories | Notes, search, tags, collections, links, SKOS concepts, and
|
|
110
|
+
| Repositories | Notes, search, tags, collections, links, SKOS concepts, attachments, embedding sets, graph helpers, jobs, and provenance |
|
|
84
111
|
| Event bus | Typed subscriptions for note, job, archive, and capability events |
|
|
85
112
|
| Capability system | Embeddings, local LLM, GPU detection, local-provider discovery, fallback routing |
|
|
86
113
|
| Job queue | Server-compatible background workflow for revisions, titles, embeddings, concepts, and links |
|
|
87
114
|
| Knowledge Shards | Tar.gz import/export with checksums and JSON format parity |
|
|
88
115
|
| Service-worker helpers | Route registration primitives for standalone browser integration |
|
|
89
116
|
|
|
117
|
+
## Search and Knowledge Model
|
|
118
|
+
|
|
119
|
+
Fortemi's archive is more than note CRUD. The schema includes note bodies, generated titles, revision history, tags, collections, inter-note links, SKOS concept schemes, attachments, job provenance, and query history. Search can combine PostgreSQL full-text ranking with pgvector embeddings, then fuse scores for hybrid results.
|
|
120
|
+
|
|
121
|
+
That gives product teams a foundation for features users already expect from serious knowledge software: fast recall, related-note discovery, semantic retrieval, explainable provenance, import/export, and structured taxonomy support.
|
|
122
|
+
|
|
90
123
|
## Tool Surface
|
|
91
124
|
|
|
92
|
-
`FortemiToolManifest` registers 10 bridge-visible
|
|
125
|
+
`FortemiToolManifest` registers 10 bridge-visible Fortemi tools:
|
|
93
126
|
|
|
94
127
|
`capture_knowledge`, `manage_note`, `search`, `get_note`, `list_notes`, `manage_tags`, `manage_collections`, `manage_links`, `manage_archive`, `manage_capabilities`.
|
|
95
128
|
|
|
@@ -98,9 +131,11 @@ The package also exports 11 direct helper functions from `@fortemi/core`, includ
|
|
|
98
131
|
```ts
|
|
99
132
|
import { fortemiManifest } from '@fortemi/core'
|
|
100
133
|
|
|
101
|
-
const capabilities = fortemiManifest.
|
|
134
|
+
const capabilities = fortemiManifest.toBridgeCapabilities()
|
|
102
135
|
```
|
|
103
136
|
|
|
137
|
+
Use the manifest when a host needs to advertise Fortemi operations to an agent runtime. Use the direct helper functions when your own code needs the same validated operations without going through a bridge layer.
|
|
138
|
+
|
|
104
139
|
## Browser Storage
|
|
105
140
|
|
|
106
141
|
| Mode | Storage | Best for |
|
|
@@ -109,6 +144,8 @@ const capabilities = fortemiManifest.toPlinyCapabilities()
|
|
|
109
144
|
| `idb` | IndexedDB-backed PGlite data directory | Firefox and broad compatibility |
|
|
110
145
|
| `memory` | In-memory database | Tests, demos, restricted browser contexts |
|
|
111
146
|
|
|
147
|
+
Data stays in the selected browser storage mode unless your application explicitly exports it, imports it, or wires external providers. Optional AI capabilities are opt-in and can be routed to local WASM, local provider servers, or host-provided integrations depending on your product requirements.
|
|
148
|
+
|
|
112
149
|
## React Bindings
|
|
113
150
|
|
|
114
151
|
For React applications, install `@fortemi/react`. It wraps `@fortemi/core` with `FortemiProvider`, context access, and 21 hooks.
|