@mzhub/cortex 0.1.0 → 0.1.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/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/index.mjs +1 -1
- package/dist/adapters/index.mjs.map +1 -1
- package/dist/{index-DnOyj7gs.d.ts → index-DYNiiClR.d.ts} +6 -6
- package/dist/{index-C_w3EJQT.d.mts → index-fTN1gEXd.d.mts} +6 -6
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -21,12 +21,12 @@ interface MemoryOSConfig {
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
|
-
* import { MemoryOS } from '
|
|
25
|
-
* import { JSONFileAdapter } from '
|
|
24
|
+
* import { MemoryOS } from 'cortex';
|
|
25
|
+
* import { JSONFileAdapter } from 'cortex/adapters';
|
|
26
26
|
*
|
|
27
27
|
* const memory = new MemoryOS({
|
|
28
28
|
* llm: { provider: 'openai', apiKey: 'sk-...', model: 'gpt-4o-mini' },
|
|
29
|
-
* adapter: new JSONFileAdapter({ path: './.
|
|
29
|
+
* adapter: new JSONFileAdapter({ path: './.cortex' })
|
|
30
30
|
* });
|
|
31
31
|
*
|
|
32
32
|
* // Before LLM call - get context
|
|
@@ -223,8 +223,8 @@ declare global {
|
|
|
223
223
|
* @example
|
|
224
224
|
* ```typescript
|
|
225
225
|
* import express from 'express';
|
|
226
|
-
* import { MemoryOS } from '
|
|
227
|
-
* import { createMemoryMiddleware } from '
|
|
226
|
+
* import { MemoryOS } from 'cortex';
|
|
227
|
+
* import { createMemoryMiddleware } from 'cortex/middleware';
|
|
228
228
|
*
|
|
229
229
|
* const app = express();
|
|
230
230
|
* const memory = new MemoryOS({ ... });
|
|
@@ -263,7 +263,7 @@ declare function digestAfterResponse(memory: MemoryOS, userId: string, userMessa
|
|
|
263
263
|
* @example
|
|
264
264
|
* ```typescript
|
|
265
265
|
* // pages/api/chat.ts or app/api/chat/route.ts
|
|
266
|
-
* import { withMemory } from '
|
|
266
|
+
* import { withMemory } from 'cortex/middleware';
|
|
267
267
|
*
|
|
268
268
|
* export const POST = withMemory(memory, async (req, context) => {
|
|
269
269
|
* const { message } = await req.json();
|
|
@@ -21,12 +21,12 @@ interface MemoryOSConfig {
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
|
-
* import { MemoryOS } from '
|
|
25
|
-
* import { JSONFileAdapter } from '
|
|
24
|
+
* import { MemoryOS } from 'cortex';
|
|
25
|
+
* import { JSONFileAdapter } from 'cortex/adapters';
|
|
26
26
|
*
|
|
27
27
|
* const memory = new MemoryOS({
|
|
28
28
|
* llm: { provider: 'openai', apiKey: 'sk-...', model: 'gpt-4o-mini' },
|
|
29
|
-
* adapter: new JSONFileAdapter({ path: './.
|
|
29
|
+
* adapter: new JSONFileAdapter({ path: './.cortex' })
|
|
30
30
|
* });
|
|
31
31
|
*
|
|
32
32
|
* // Before LLM call - get context
|
|
@@ -223,8 +223,8 @@ declare global {
|
|
|
223
223
|
* @example
|
|
224
224
|
* ```typescript
|
|
225
225
|
* import express from 'express';
|
|
226
|
-
* import { MemoryOS } from '
|
|
227
|
-
* import { createMemoryMiddleware } from '
|
|
226
|
+
* import { MemoryOS } from 'cortex';
|
|
227
|
+
* import { createMemoryMiddleware } from 'cortex/middleware';
|
|
228
228
|
*
|
|
229
229
|
* const app = express();
|
|
230
230
|
* const memory = new MemoryOS({ ... });
|
|
@@ -263,7 +263,7 @@ declare function digestAfterResponse(memory: MemoryOS, userId: string, userMessa
|
|
|
263
263
|
* @example
|
|
264
264
|
* ```typescript
|
|
265
265
|
* // pages/api/chat.ts or app/api/chat/route.ts
|
|
266
|
-
* import { withMemory } from '
|
|
266
|
+
* import { withMemory } from 'cortex/middleware';
|
|
267
267
|
*
|
|
268
268
|
* export const POST = withMemory(memory, async (req, context) => {
|
|
269
269
|
* const { message } = await req.json();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as MemoryMiddlewareOptions, M as MemoryOS, a as MemoryOSConfig, c as createMemoryMiddleware, d as digestAfterResponse, w as withMemory } from './index-
|
|
1
|
+
export { b as MemoryMiddlewareOptions, M as MemoryOS, a as MemoryOSConfig, c as createMemoryMiddleware, d as digestAfterResponse, w as withMemory } from './index-fTN1gEXd.mjs';
|
|
2
2
|
import { f as MemoryOperation, M as MemoryFact, E as ExtractionResult, H as HydrateOptions, d as HydratedContext, S as Session, F as FactFilter, C as ConversationExchange } from './types-DybcUhEZ.mjs';
|
|
3
3
|
export { a as CompletionOptions, b as CompletionResult, h as MemoryOSEvents, c as MemoryOSOptions, g as Message, P as ProviderConfig, e as ProviderName } from './types-DybcUhEZ.mjs';
|
|
4
4
|
import { B as BaseAdapter } from './BaseAdapter-Bjj4JG_S.mjs';
|
|
@@ -210,7 +210,7 @@ declare class SemanticCache {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* Token economics utilities for
|
|
213
|
+
* Token economics utilities for cortex.
|
|
214
214
|
* Provides token estimation, compression, and analytics.
|
|
215
215
|
*/
|
|
216
216
|
/**
|
|
@@ -396,7 +396,7 @@ declare class MemoryEventEmitter {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/**
|
|
399
|
-
* Security utilities for
|
|
399
|
+
* Security utilities for cortex.
|
|
400
400
|
* Protects against prompt injection and data poisoning.
|
|
401
401
|
*/
|
|
402
402
|
interface SecurityConfig {
|
|
@@ -450,7 +450,7 @@ declare function wrapContextSafely(context: string): string;
|
|
|
450
450
|
declare function sanitizeForStorage(text: string): string;
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
|
-
* Budget management for
|
|
453
|
+
* Budget management for cortex.
|
|
454
454
|
* Prevents runaway costs from infinite loops or abuse.
|
|
455
455
|
*/
|
|
456
456
|
interface BudgetConfig {
|
|
@@ -527,7 +527,7 @@ declare class BudgetManager {
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/**
|
|
530
|
-
* Memory decay utilities for
|
|
530
|
+
* Memory decay utilities for cortex.
|
|
531
531
|
* Prevents the "stalker effect" by forgetting irrelevant facts over time.
|
|
532
532
|
*/
|
|
533
533
|
|
|
@@ -602,7 +602,7 @@ declare class DecayManager {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
/**
|
|
605
|
-
* Auto-summarization manager for
|
|
605
|
+
* Auto-summarization manager for cortex.
|
|
606
606
|
* Triggers conversation summarization after a threshold of messages.
|
|
607
607
|
*/
|
|
608
608
|
|
|
@@ -714,7 +714,7 @@ declare class TieredAdapter extends BaseAdapter {
|
|
|
714
714
|
}
|
|
715
715
|
|
|
716
716
|
/**
|
|
717
|
-
* Embeddings support for
|
|
717
|
+
* Embeddings support for cortex.
|
|
718
718
|
* Provides vector embeddings for semantic search.
|
|
719
719
|
*/
|
|
720
720
|
interface EmbeddingConfig {
|
|
@@ -1125,7 +1125,7 @@ declare class PredictiveEngine {
|
|
|
1125
1125
|
* - Ephemeral conversation buffer
|
|
1126
1126
|
* - Auto-flushed after extraction
|
|
1127
1127
|
*
|
|
1128
|
-
* This is an OPTIONAL wrapper - you can use
|
|
1128
|
+
* This is an OPTIONAL wrapper - you can use cortex without HMM.
|
|
1129
1129
|
*/
|
|
1130
1130
|
|
|
1131
1131
|
type MemoryLevel = "raw_log" | "fact" | "pattern" | "core_belief";
|
|
@@ -1142,7 +1142,7 @@ interface HierarchicalConfig {
|
|
|
1142
1142
|
debug?: boolean;
|
|
1143
1143
|
}
|
|
1144
1144
|
/**
|
|
1145
|
-
* Hierarchical Memory Manager - Optional HMM mode for
|
|
1145
|
+
* Hierarchical Memory Manager - Optional HMM mode for cortex
|
|
1146
1146
|
*/
|
|
1147
1147
|
declare class HierarchicalMemory {
|
|
1148
1148
|
private adapter;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as MemoryMiddlewareOptions, M as MemoryOS, a as MemoryOSConfig, c as createMemoryMiddleware, d as digestAfterResponse, w as withMemory } from './index-
|
|
1
|
+
export { b as MemoryMiddlewareOptions, M as MemoryOS, a as MemoryOSConfig, c as createMemoryMiddleware, d as digestAfterResponse, w as withMemory } from './index-DYNiiClR.js';
|
|
2
2
|
import { f as MemoryOperation, M as MemoryFact, E as ExtractionResult, H as HydrateOptions, d as HydratedContext, S as Session, F as FactFilter, C as ConversationExchange } from './types-DybcUhEZ.js';
|
|
3
3
|
export { a as CompletionOptions, b as CompletionResult, h as MemoryOSEvents, c as MemoryOSOptions, g as Message, P as ProviderConfig, e as ProviderName } from './types-DybcUhEZ.js';
|
|
4
4
|
import { B as BaseAdapter } from './BaseAdapter-WunbfD_n.js';
|
|
@@ -210,7 +210,7 @@ declare class SemanticCache {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* Token economics utilities for
|
|
213
|
+
* Token economics utilities for cortex.
|
|
214
214
|
* Provides token estimation, compression, and analytics.
|
|
215
215
|
*/
|
|
216
216
|
/**
|
|
@@ -396,7 +396,7 @@ declare class MemoryEventEmitter {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/**
|
|
399
|
-
* Security utilities for
|
|
399
|
+
* Security utilities for cortex.
|
|
400
400
|
* Protects against prompt injection and data poisoning.
|
|
401
401
|
*/
|
|
402
402
|
interface SecurityConfig {
|
|
@@ -450,7 +450,7 @@ declare function wrapContextSafely(context: string): string;
|
|
|
450
450
|
declare function sanitizeForStorage(text: string): string;
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
|
-
* Budget management for
|
|
453
|
+
* Budget management for cortex.
|
|
454
454
|
* Prevents runaway costs from infinite loops or abuse.
|
|
455
455
|
*/
|
|
456
456
|
interface BudgetConfig {
|
|
@@ -527,7 +527,7 @@ declare class BudgetManager {
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/**
|
|
530
|
-
* Memory decay utilities for
|
|
530
|
+
* Memory decay utilities for cortex.
|
|
531
531
|
* Prevents the "stalker effect" by forgetting irrelevant facts over time.
|
|
532
532
|
*/
|
|
533
533
|
|
|
@@ -602,7 +602,7 @@ declare class DecayManager {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
/**
|
|
605
|
-
* Auto-summarization manager for
|
|
605
|
+
* Auto-summarization manager for cortex.
|
|
606
606
|
* Triggers conversation summarization after a threshold of messages.
|
|
607
607
|
*/
|
|
608
608
|
|
|
@@ -714,7 +714,7 @@ declare class TieredAdapter extends BaseAdapter {
|
|
|
714
714
|
}
|
|
715
715
|
|
|
716
716
|
/**
|
|
717
|
-
* Embeddings support for
|
|
717
|
+
* Embeddings support for cortex.
|
|
718
718
|
* Provides vector embeddings for semantic search.
|
|
719
719
|
*/
|
|
720
720
|
interface EmbeddingConfig {
|
|
@@ -1125,7 +1125,7 @@ declare class PredictiveEngine {
|
|
|
1125
1125
|
* - Ephemeral conversation buffer
|
|
1126
1126
|
* - Auto-flushed after extraction
|
|
1127
1127
|
*
|
|
1128
|
-
* This is an OPTIONAL wrapper - you can use
|
|
1128
|
+
* This is an OPTIONAL wrapper - you can use cortex without HMM.
|
|
1129
1129
|
*/
|
|
1130
1130
|
|
|
1131
1131
|
type MemoryLevel = "raw_log" | "fact" | "pattern" | "core_belief";
|
|
@@ -1142,7 +1142,7 @@ interface HierarchicalConfig {
|
|
|
1142
1142
|
debug?: boolean;
|
|
1143
1143
|
}
|
|
1144
1144
|
/**
|
|
1145
|
-
* Hierarchical Memory Manager - Optional HMM mode for
|
|
1145
|
+
* Hierarchical Memory Manager - Optional HMM mode for cortex
|
|
1146
1146
|
*/
|
|
1147
1147
|
declare class HierarchicalMemory {
|
|
1148
1148
|
private adapter;
|
package/dist/index.js
CHANGED
|
@@ -667,7 +667,7 @@ Analyze the conversation and extract facts that should be remembered long-term.
|
|
|
667
667
|
- Job: "I work at Google as an engineer" \u2192 (User, WORKS_AT, Google), (User, JOB_TITLE, Engineer)
|
|
668
668
|
- Relationships: "My wife Sarah" \u2192 (User, SPOUSE, Sarah)
|
|
669
669
|
- Tech preferences: "I use React and TypeScript" \u2192 (User, USES_TECH, React), (User, USES_TECH, TypeScript)
|
|
670
|
-
- Projects: "Working on a memory system called
|
|
670
|
+
- Projects: "Working on a memory system called cortex" \u2192 (User, WORKING_ON, cortex)
|
|
671
671
|
- Important dates: "My birthday is March 15" \u2192 (User, BIRTHDAY, March 15)
|
|
672
672
|
|
|
673
673
|
## What to IGNORE:
|
|
@@ -1683,7 +1683,7 @@ var JSONFileAdapter = class extends BaseAdapter {
|
|
|
1683
1683
|
prettyPrint;
|
|
1684
1684
|
constructor(config = {}) {
|
|
1685
1685
|
super();
|
|
1686
|
-
this.basePath = config.path || "./.
|
|
1686
|
+
this.basePath = config.path || "./.cortex";
|
|
1687
1687
|
this.prettyPrint = config.prettyPrint ?? process.env.NODE_ENV !== "production";
|
|
1688
1688
|
}
|
|
1689
1689
|
async initialize() {
|