@mikesaintsg/core 0.0.3 → 0.0.5
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 +37 -2
- package/dist/index.d.ts +534 -6
- package/dist/index.js +223 -199
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
- ✅ **Shared Types** — Contracts used across multiple packages
|
|
14
14
|
- ✅ **Result Pattern** — Functional error handling (`ok`, `err`, `map`, `chain`)
|
|
15
|
-
- ✅ **Bridge
|
|
15
|
+
- ✅ **Bridge Classes** — Ready-to-use implementations for cross-package communication
|
|
16
|
+
- ✅ **Factory Functions** — Simple API for creating bridge instances
|
|
16
17
|
- ✅ **Adapter Interfaces** — Embedding, tool format, persistence, and policy adapters
|
|
17
18
|
- ✅ **Base Error Class** — `EcosystemError` for all package-specific errors
|
|
18
19
|
- ✅ **Content Hashing** — SHA-256 based deduplication support
|
|
@@ -141,6 +142,17 @@ const results = await bridge.execute([call1, call2, call3])
|
|
|
141
142
|
| `createFormDirtyGuard(options)` | Navigation guard for dirty forms |
|
|
142
143
|
| `createSessionPersistence(options)` | Session storage adapter |
|
|
143
144
|
|
|
145
|
+
### Bridge Classes
|
|
146
|
+
|
|
147
|
+
Implementation classes for cross-package bridges (also available via factory functions):
|
|
148
|
+
|
|
149
|
+
| Class | Factory | Description |
|
|
150
|
+
|----------------------|------------------------------|----------------------------------|
|
|
151
|
+
| `ToolCallBridge` | `createToolCallBridge()` | Executes tool calls via registry |
|
|
152
|
+
| `RetrievalTool` | `createRetrievalTool()` | Vectorstore search tool |
|
|
153
|
+
| `FormDirtyGuard` | `createFormDirtyGuard()` | Navigation guard for dirty forms |
|
|
154
|
+
| `SessionPersistence` | `createSessionPersistence()` | Session storage adapter |
|
|
155
|
+
|
|
144
156
|
### Error Handling
|
|
145
157
|
|
|
146
158
|
| Export | Description |
|
|
@@ -155,7 +167,7 @@ const results = await bridge.execute([call1, call2, call3])
|
|
|
155
167
|
| `Result<T, E>` | Success or failure union |
|
|
156
168
|
| `Ok<T>`, `Err<E>` | Result discriminants |
|
|
157
169
|
| `Unsubscribe` | Cleanup function type |
|
|
158
|
-
| `
|
|
170
|
+
| `Destroyable` | Interface for resources with cleanup |
|
|
159
171
|
| `SubscriptionToHook<T>` | Convert subscriptions to hooks |
|
|
160
172
|
| `Embedding` | Float32Array embedding vector |
|
|
161
173
|
| `ToolCall`, `ToolResult`, `ToolSchema` | Tool-related types |
|
|
@@ -286,6 +298,29 @@ const guard = createFormDirtyGuard({
|
|
|
286
298
|
router.beforeNavigate(guard)
|
|
287
299
|
```
|
|
288
300
|
|
|
301
|
+
### Using Bridge Classes Directly
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
import { ToolCallBridge, RetrievalTool, SessionPersistence } from '@mikesaintsg/core'
|
|
305
|
+
|
|
306
|
+
// Direct class instantiation (alternative to factory functions)
|
|
307
|
+
const bridge = new ToolCallBridge({
|
|
308
|
+
registry,
|
|
309
|
+
timeout: 30000,
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
const tool = new RetrievalTool({
|
|
313
|
+
vectorStore,
|
|
314
|
+
name: 'search',
|
|
315
|
+
description: 'Search documents',
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
const persistence = new SessionPersistence({
|
|
319
|
+
database,
|
|
320
|
+
storeName: 'sessions',
|
|
321
|
+
})
|
|
322
|
+
```
|
|
323
|
+
|
|
289
324
|
---
|
|
290
325
|
|
|
291
326
|
## Constants
|