kernl 0.8.2 → 0.8.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/.turbo/turbo-build.log +4 -5
- package/CHANGELOG.md +12 -0
- package/dist/kernl/__tests__/memory-config.test.d.ts +2 -0
- package/dist/kernl/__tests__/memory-config.test.d.ts.map +1 -0
- package/dist/kernl/__tests__/memory-config.test.js +157 -0
- package/dist/kernl/kernl.d.ts +9 -0
- package/dist/kernl/kernl.d.ts.map +1 -1
- package/dist/kernl/kernl.js +56 -22
- package/dist/kernl/types.d.ts +3 -2
- package/dist/kernl/types.d.ts.map +1 -1
- package/dist/lib/logger.d.ts +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +10 -27
- package/dist/memory/__tests__/encoder.test.js +46 -0
- package/dist/memory/codecs/domain.js +1 -2
- package/dist/memory/encoder.d.ts +7 -7
- package/dist/memory/encoder.d.ts.map +1 -1
- package/dist/memory/encoder.js +15 -7
- package/dist/memory/memory.js +1 -1
- package/dist/memory/types.d.ts +6 -2
- package/dist/memory/types.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/kernl/__tests__/memory-config.test.ts +203 -0
- package/src/kernl/kernl.ts +72 -30
- package/src/kernl/types.ts +3 -2
- package/src/lib/logger.ts +10 -31
- package/src/memory/__tests__/encoder.test.ts +63 -0
- package/src/memory/codecs/domain.ts +1 -1
- package/src/memory/encoder.ts +18 -10
- package/src/memory/memory.ts +1 -1
- package/src/memory/types.ts +6 -2
- package/.turbo/turbo-check-types.log +0 -4
- package/dist/memory/codec.d.ts +0 -32
- package/dist/memory/codec.d.ts.map +0 -1
- package/dist/memory/codec.js +0 -97
- package/tsconfig.tsbuildinfo +0 -1
package/dist/memory/codec.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory codecs.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Codec for converting MemoryFilter to retrieval Filter.
|
|
6
|
-
*
|
|
7
|
-
* - scope.namespace → namespace
|
|
8
|
-
* - scope.entityId → entityId
|
|
9
|
-
* - scope.agentId → agentId
|
|
10
|
-
* - collections → collection: { $in: [...] }
|
|
11
|
-
* - after/before → timestamp: { $gt/$lt }
|
|
12
|
-
*
|
|
13
|
-
* Content field filtering (text, metadata, kind) is not currently supported.
|
|
14
|
-
* Text relevance is handled via vector similarity in the query, not filters.
|
|
15
|
-
*/
|
|
16
|
-
export const MEMORY_FILTER = {
|
|
17
|
-
encode(mf) {
|
|
18
|
-
const sf = {};
|
|
19
|
-
// scope
|
|
20
|
-
if (mf.scope?.namespace !== undefined)
|
|
21
|
-
sf.namespace = mf.scope.namespace;
|
|
22
|
-
if (mf.scope?.entityId !== undefined)
|
|
23
|
-
sf.entityId = mf.scope.entityId;
|
|
24
|
-
if (mf.scope?.agentId !== undefined)
|
|
25
|
-
sf.agentId = mf.scope.agentId;
|
|
26
|
-
if (mf.collections && mf.collections.length > 0) {
|
|
27
|
-
sf.collection = { $in: mf.collections };
|
|
28
|
-
}
|
|
29
|
-
if (mf.after !== undefined || mf.before !== undefined) {
|
|
30
|
-
const ts = {};
|
|
31
|
-
if (mf.after !== undefined)
|
|
32
|
-
ts.$gt = mf.after;
|
|
33
|
-
if (mf.before !== undefined)
|
|
34
|
-
ts.$lt = mf.before;
|
|
35
|
-
sf.timestamp = ts;
|
|
36
|
-
}
|
|
37
|
-
return sf;
|
|
38
|
-
},
|
|
39
|
-
decode(_filter) {
|
|
40
|
-
throw new Error("MEMORY_FILTER.decode not implemented");
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Create a codec for MemoryRecord -> IndexMemoryRecord.
|
|
45
|
-
*/
|
|
46
|
-
export function recordCodec(bytecodec) {
|
|
47
|
-
return {
|
|
48
|
-
async encode(record) {
|
|
49
|
-
const indexable = await bytecodec.encode(record.content);
|
|
50
|
-
return {
|
|
51
|
-
id: record.id,
|
|
52
|
-
namespace: record.scope.namespace ?? null,
|
|
53
|
-
entityId: record.scope.entityId ?? null,
|
|
54
|
-
agentId: record.scope.agentId ?? null,
|
|
55
|
-
kind: record.kind,
|
|
56
|
-
collection: record.collection,
|
|
57
|
-
timestamp: record.timestamp,
|
|
58
|
-
createdAt: record.createdAt,
|
|
59
|
-
updatedAt: record.updatedAt,
|
|
60
|
-
...indexable,
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
async decode() {
|
|
64
|
-
throw new Error("createRecordCodec.decode not implemented");
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Codec for converting MemoryRecordUpdate to IndexMemoryRecordPatch.
|
|
70
|
-
*
|
|
71
|
-
* Maps patchable fields from domain update to index patch format.
|
|
72
|
-
* wmem/smem are store-only fields and are not included.
|
|
73
|
-
* content changes require full re-index, not a patch.
|
|
74
|
-
*/
|
|
75
|
-
export const PATCH_CODEC = {
|
|
76
|
-
encode(update) {
|
|
77
|
-
const patch = { id: update.id };
|
|
78
|
-
if (update.scope?.namespace !== undefined)
|
|
79
|
-
patch.namespace = update.scope.namespace;
|
|
80
|
-
if (update.scope?.entityId !== undefined)
|
|
81
|
-
patch.entityId = update.scope.entityId;
|
|
82
|
-
if (update.scope?.agentId !== undefined)
|
|
83
|
-
patch.agentId = update.scope.agentId;
|
|
84
|
-
if (update.collection !== undefined)
|
|
85
|
-
patch.collection = update.collection;
|
|
86
|
-
if (update.timestamp !== undefined)
|
|
87
|
-
patch.timestamp = update.timestamp;
|
|
88
|
-
if (update.updatedAt !== undefined)
|
|
89
|
-
patch.updatedAt = update.updatedAt;
|
|
90
|
-
if (update.metadata !== undefined)
|
|
91
|
-
patch.metadata = update.metadata;
|
|
92
|
-
return patch;
|
|
93
|
-
},
|
|
94
|
-
decode(_patch) {
|
|
95
|
-
throw new Error("PATCH_CODEC.decode not implemented");
|
|
96
|
-
},
|
|
97
|
-
};
|
package/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["./src/agent.ts","./src/context.ts","./src/guardrail.ts","./src/index.ts","./src/internal.ts","./src/kernl.ts","./src/lifecycle.ts","./src/task.ts","./src/agent/index.ts","./src/agent/__tests__/concurrency.test.ts","./src/agent/__tests__/run.test.ts","./src/api/__tests__/threads.test.ts","./src/api/models/index.ts","./src/api/models/thread.ts","./src/api/resources/threads/events.ts","./src/api/resources/threads/index.ts","./src/api/resources/threads/threads.ts","./src/api/resources/threads/types.ts","./src/api/resources/threads/utils.ts","./src/lib/env.ts","./src/lib/error.ts","./src/lib/logger.ts","./src/lib/serde/json.ts","./src/mcp/base.ts","./src/mcp/http.ts","./src/mcp/sse.ts","./src/mcp/stdio.ts","./src/mcp/types.ts","./src/mcp/utils.ts","./src/mcp/__tests__/base.test.ts","./src/mcp/__tests__/integration.test.ts","./src/mcp/__tests__/stdio.test.ts","./src/mcp/__tests__/utils.test.ts","./src/mcp/__tests__/fixtures/server.ts","./src/mcp/__tests__/fixtures/utils.ts","./src/memory/byte.ts","./src/memory/index.ts","./src/memory/indexes.ts","./src/memory/memory.ts","./src/memory/store.ts","./src/memory/types.ts","./src/storage/base.ts","./src/storage/in-memory.ts","./src/storage/index.ts","./src/storage/thread.ts","./src/storage/__tests__/in-memory.test.ts","./src/thread/index.ts","./src/thread/thread.ts","./src/thread/utils.ts","./src/thread/__tests__/integration.test.ts","./src/thread/__tests__/mock.ts","./src/thread/__tests__/namespace.test.ts","./src/thread/__tests__/thread-persistence.test.ts","./src/thread/__tests__/thread.test.ts","./src/thread/__tests__/fixtures/mock-model.ts","./src/tool/index.ts","./src/tool/tool.ts","./src/tool/toolkit.ts","./src/tool/types.ts","./src/tool/__tests__/fixtures.ts","./src/tool/__tests__/tool.test.ts","./src/tool/__tests__/toolkit.test.ts","./src/trace/processor.ts","./src/trace/traces.ts","./src/trace/utils.ts","./src/types/agent.ts","./src/types/kernl.ts","./src/types/thread.ts"],"version":"5.9.2"}
|