kernl 0.8.1 → 0.8.3
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 +1 -1
- package/CHANGELOG.md +13 -0
- 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/handle.d.ts.map +1 -1
- package/dist/memory/handle.js +3 -1
- package/dist/tool/sys/memory.d.ts.map +1 -1
- package/dist/tool/sys/memory.js +3 -0
- package/package.json +1 -2
- package/src/lib/logger.ts +10 -31
- package/src/memory/handle.ts +2 -1
- package/src/tool/sys/memory.ts +3 -0
- 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/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @kernl/core
|
|
2
2
|
|
|
3
|
+
## 0.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae11e54: Replace pino logger with console-based implementation to reduce dependencies
|
|
8
|
+
|
|
9
|
+
## 0.8.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: handle postgres duplicate key error when index already exists
|
|
14
|
+
- fix: include object content and collection in memory search/list results
|
|
15
|
+
|
|
3
16
|
## 0.8.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/lib/logger.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type Logger = {
|
|
|
25
25
|
* Get a logger for a given namespace.
|
|
26
26
|
*
|
|
27
27
|
* @param namespace - the namespace to use for the logger (e.g., 'kernl:core', 'kernl:agent').
|
|
28
|
-
* @returns A logger object with
|
|
28
|
+
* @returns A logger object with console-based logging and sensitive data flags.
|
|
29
29
|
*/
|
|
30
30
|
export declare function getLogger(namespace?: string): Logger;
|
|
31
31
|
/**
|
package/dist/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9C,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9C,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9C,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,GAAE,MAAgB,GAAG,MAAM,CAc7D;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAqB,CAAC;AAEzC,eAAe,MAAM,CAAC"}
|
package/dist/lib/logger.js
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
import pino from "pino";
|
|
2
1
|
import { env } from "./env.js";
|
|
3
|
-
/**
|
|
4
|
-
* By default we don't log LLM inputs/outputs, to prevent exposing sensitive data.
|
|
5
|
-
* Set KERNL_LOG_MODEL_DATA=true to enable.
|
|
6
|
-
*/
|
|
7
|
-
const dontLogModelData = !env.KERNL_LOG_MODEL_DATA;
|
|
8
|
-
/**
|
|
9
|
-
* By default we don't log tool inputs/outputs, to prevent exposing sensitive data.
|
|
10
|
-
* Set KERNL_LOG_TOOL_DATA=true to enable.
|
|
11
|
-
*/
|
|
12
|
-
const dontLogToolData = !env.KERNL_LOG_TOOL_DATA;
|
|
13
|
-
/**
|
|
14
|
-
* Base pino logger instance
|
|
15
|
-
*/
|
|
16
|
-
const base = pino({
|
|
17
|
-
level: env.LOG_LEVEL,
|
|
18
|
-
});
|
|
19
2
|
/**
|
|
20
3
|
* Get a logger for a given namespace.
|
|
21
4
|
*
|
|
22
5
|
* @param namespace - the namespace to use for the logger (e.g., 'kernl:core', 'kernl:agent').
|
|
23
|
-
* @returns A logger object with
|
|
6
|
+
* @returns A logger object with console-based logging and sensitive data flags.
|
|
24
7
|
*/
|
|
25
8
|
export function getLogger(namespace = "kernl") {
|
|
26
|
-
const
|
|
9
|
+
const prefix = `[${namespace}]`;
|
|
27
10
|
return {
|
|
28
11
|
namespace,
|
|
29
|
-
trace:
|
|
30
|
-
debug:
|
|
31
|
-
info:
|
|
32
|
-
warn:
|
|
33
|
-
error:
|
|
34
|
-
fatal:
|
|
35
|
-
dontLogModelData,
|
|
36
|
-
dontLogToolData,
|
|
12
|
+
trace: (msg, ...args) => console.debug(prefix, msg, ...args),
|
|
13
|
+
debug: (msg, ...args) => console.debug(prefix, msg, ...args),
|
|
14
|
+
info: (msg, ...args) => console.info(prefix, msg, ...args),
|
|
15
|
+
warn: (msg, ...args) => console.warn(prefix, msg, ...args),
|
|
16
|
+
error: (msg, ...args) => console.error(prefix, msg, ...args),
|
|
17
|
+
fatal: (msg, ...args) => console.error(prefix, "[FATAL]", msg, ...args),
|
|
18
|
+
dontLogModelData: !env.KERNL_LOG_MODEL_DATA,
|
|
19
|
+
dontLogToolData: !env.KERNL_LOG_TOOL_DATA,
|
|
37
20
|
};
|
|
38
21
|
}
|
|
39
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../src/memory/handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAGjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEpC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW,CAAC,iBAAiB,CAAC;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAA0B;IAE3D,OAAO,CAAC,WAAW,CAA8B;gBAErC,MAAM,EAAE,uBAAuB;IAS3C;;;;OAIG;YACW,UAAU;IAUxB;;OAEG;YACW,WAAW;
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../src/memory/handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAGjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEpC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,qBAAa,iBAAkB,YAAW,WAAW,CAAC,iBAAiB,CAAC;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAA0B;IAE3D,OAAO,CAAC,WAAW,CAA8B;gBAErC,MAAM,EAAE,uBAAuB;IAS3C;;;;OAIG;YACW,UAAU;IAUxB;;OAEG;YACW,WAAW;IAsBzB;;;;;OAKG;IACG,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAevE;;OAEG;IACG,MAAM,CACV,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,GAC5C,OAAO,CAAC,YAAY,CAAC;IAOxB;;;;;OAKG;IACG,KAAK,CACT,OAAO,EACH,aAAa,CAAC,iBAAiB,CAAC,GAChC,aAAa,CAAC,iBAAiB,CAAC,EAAE,GACrC,OAAO,CAAC,WAAW,CAAC;IAKvB;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAK3D;;;;OAIG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE;;;;;OAKG;YACW,MAAM;CAIrB"}
|
package/dist/memory/handle.js
CHANGED
|
@@ -56,7 +56,9 @@ export class MemoryIndexHandle {
|
|
|
56
56
|
//
|
|
57
57
|
// Ignore "already exists" errors
|
|
58
58
|
if (err.message?.includes("already exists") ||
|
|
59
|
-
err.message?.includes("AlreadyExists")
|
|
59
|
+
err.message?.includes("AlreadyExists") ||
|
|
60
|
+
err.code === "23505" // postgres unique constraint violation
|
|
61
|
+
) {
|
|
60
62
|
return;
|
|
61
63
|
}
|
|
62
64
|
throw err;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/tool/sys/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/tool/sys/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA8HrC;;;;GAIG;AACH,eAAO,MAAM,MAAM,kBAIjB,CAAC"}
|
package/dist/tool/sys/memory.js
CHANGED
|
@@ -32,7 +32,9 @@ const search = tool({
|
|
|
32
32
|
});
|
|
33
33
|
return mems.map((h) => ({
|
|
34
34
|
id: h.document?.id,
|
|
35
|
+
collection: h.document?.collection,
|
|
35
36
|
text: h.document?.text,
|
|
37
|
+
object: h.document?.objtext,
|
|
36
38
|
score: h.score,
|
|
37
39
|
}));
|
|
38
40
|
},
|
|
@@ -108,6 +110,7 @@ const list = tool({
|
|
|
108
110
|
id: r.id,
|
|
109
111
|
collection: r.collection,
|
|
110
112
|
text: r.content.text,
|
|
113
|
+
object: r.content.object,
|
|
111
114
|
}));
|
|
112
115
|
},
|
|
113
116
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kernl",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "A modern AI agent framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kernl",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@modelcontextprotocol/sdk": "^1.20.2",
|
|
36
|
-
"pino": "^9.6.0",
|
|
37
36
|
"yaml": "^2.8.2",
|
|
38
37
|
"zod": "^4.1.12",
|
|
39
38
|
"@kernl-sdk/protocol": "0.2.8",
|
package/src/lib/logger.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
import pino from "pino";
|
|
2
|
-
|
|
3
1
|
import { env } from "./env";
|
|
4
2
|
|
|
5
|
-
/**
|
|
6
|
-
* By default we don't log LLM inputs/outputs, to prevent exposing sensitive data.
|
|
7
|
-
* Set KERNL_LOG_MODEL_DATA=true to enable.
|
|
8
|
-
*/
|
|
9
|
-
const dontLogModelData = !env.KERNL_LOG_MODEL_DATA;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* By default we don't log tool inputs/outputs, to prevent exposing sensitive data.
|
|
13
|
-
* Set KERNL_LOG_TOOL_DATA=true to enable.
|
|
14
|
-
*/
|
|
15
|
-
const dontLogToolData = !env.KERNL_LOG_TOOL_DATA;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Base pino logger instance
|
|
19
|
-
*/
|
|
20
|
-
const base = pino({
|
|
21
|
-
level: env.LOG_LEVEL,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
3
|
/**
|
|
25
4
|
* A logger instance with namespace support and sensitive data flags.
|
|
26
5
|
*/
|
|
@@ -52,21 +31,21 @@ export type Logger = {
|
|
|
52
31
|
* Get a logger for a given namespace.
|
|
53
32
|
*
|
|
54
33
|
* @param namespace - the namespace to use for the logger (e.g., 'kernl:core', 'kernl:agent').
|
|
55
|
-
* @returns A logger object with
|
|
34
|
+
* @returns A logger object with console-based logging and sensitive data flags.
|
|
56
35
|
*/
|
|
57
36
|
export function getLogger(namespace: string = "kernl"): Logger {
|
|
58
|
-
const
|
|
37
|
+
const prefix = `[${namespace}]`;
|
|
59
38
|
|
|
60
39
|
return {
|
|
61
40
|
namespace,
|
|
62
|
-
trace:
|
|
63
|
-
debug:
|
|
64
|
-
info:
|
|
65
|
-
warn:
|
|
66
|
-
error:
|
|
67
|
-
fatal:
|
|
68
|
-
dontLogModelData,
|
|
69
|
-
dontLogToolData,
|
|
41
|
+
trace: (msg, ...args) => console.debug(prefix, msg, ...args),
|
|
42
|
+
debug: (msg, ...args) => console.debug(prefix, msg, ...args),
|
|
43
|
+
info: (msg, ...args) => console.info(prefix, msg, ...args),
|
|
44
|
+
warn: (msg, ...args) => console.warn(prefix, msg, ...args),
|
|
45
|
+
error: (msg, ...args) => console.error(prefix, msg, ...args),
|
|
46
|
+
fatal: (msg, ...args) => console.error(prefix, "[FATAL]", msg, ...args),
|
|
47
|
+
dontLogModelData: !env.KERNL_LOG_MODEL_DATA,
|
|
48
|
+
dontLogToolData: !env.KERNL_LOG_TOOL_DATA,
|
|
70
49
|
};
|
|
71
50
|
}
|
|
72
51
|
|
package/src/memory/handle.ts
CHANGED
|
@@ -103,7 +103,8 @@ export class MemoryIndexHandle implements IndexHandle<IndexMemoryRecord> {
|
|
|
103
103
|
// Ignore "already exists" errors
|
|
104
104
|
if (
|
|
105
105
|
err.message?.includes("already exists") ||
|
|
106
|
-
err.message?.includes("AlreadyExists")
|
|
106
|
+
err.message?.includes("AlreadyExists") ||
|
|
107
|
+
err.code === "23505" // postgres unique constraint violation
|
|
107
108
|
) {
|
|
108
109
|
return;
|
|
109
110
|
}
|
package/src/tool/sys/memory.ts
CHANGED
|
@@ -38,7 +38,9 @@ const search = tool({
|
|
|
38
38
|
|
|
39
39
|
return mems.map((h) => ({
|
|
40
40
|
id: h.document?.id,
|
|
41
|
+
collection: h.document?.collection,
|
|
41
42
|
text: h.document?.text,
|
|
43
|
+
object: h.document?.objtext,
|
|
42
44
|
score: h.score,
|
|
43
45
|
}));
|
|
44
46
|
},
|
|
@@ -126,6 +128,7 @@ const list = tool({
|
|
|
126
128
|
id: r.id,
|
|
127
129
|
collection: r.collection,
|
|
128
130
|
text: r.content.text,
|
|
131
|
+
object: r.content.object,
|
|
129
132
|
}));
|
|
130
133
|
},
|
|
131
134
|
});
|
package/dist/memory/codec.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory codecs.
|
|
3
|
-
*/
|
|
4
|
-
import type { Codec, AsyncCodec } from "@kernl-sdk/shared/lib";
|
|
5
|
-
import type { Filter as SearchFilter } from "@kernl-sdk/retrieval";
|
|
6
|
-
import type { MemoryFilter, MemoryRecord, MemoryRecordUpdate, IndexMemoryRecord, IndexMemoryRecordPatch, MemoryByteCodec } from "./types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Codec for converting MemoryFilter to retrieval Filter.
|
|
9
|
-
*
|
|
10
|
-
* - scope.namespace → namespace
|
|
11
|
-
* - scope.entityId → entityId
|
|
12
|
-
* - scope.agentId → agentId
|
|
13
|
-
* - collections → collection: { $in: [...] }
|
|
14
|
-
* - after/before → timestamp: { $gt/$lt }
|
|
15
|
-
*
|
|
16
|
-
* Content field filtering (text, metadata, kind) is not currently supported.
|
|
17
|
-
* Text relevance is handled via vector similarity in the query, not filters.
|
|
18
|
-
*/
|
|
19
|
-
export declare const MEMORY_FILTER: Codec<MemoryFilter, SearchFilter>;
|
|
20
|
-
/**
|
|
21
|
-
* Create a codec for MemoryRecord -> IndexMemoryRecord.
|
|
22
|
-
*/
|
|
23
|
-
export declare function recordCodec(bytecodec: MemoryByteCodec): AsyncCodec<MemoryRecord, IndexMemoryRecord>;
|
|
24
|
-
/**
|
|
25
|
-
* Codec for converting MemoryRecordUpdate to IndexMemoryRecordPatch.
|
|
26
|
-
*
|
|
27
|
-
* Maps patchable fields from domain update to index patch format.
|
|
28
|
-
* wmem/smem are store-only fields and are not included.
|
|
29
|
-
* content changes require full re-index, not a patch.
|
|
30
|
-
*/
|
|
31
|
-
export declare const PATCH_CODEC: Codec<MemoryRecordUpdate, IndexMemoryRecordPatch>;
|
|
32
|
-
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/memory/codec.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,YAAY,EAAE,YAAY,CA0B3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,eAAe,GACzB,UAAU,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAqB7C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,kBAAkB,EAAE,sBAAsB,CAqBzE,CAAC"}
|
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"}
|