kernl 0.8.2 → 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 +4 -5
- package/CHANGELOG.md +6 -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/package.json +1 -2
- package/src/lib/logger.ts +10 -31
- 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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
|
|
2
|
+
> kernl@0.8.3 build /home/runner/work/kernl/kernl/packages/kernl
|
|
3
|
+
> tsc && tsc-alias --resolve-full-paths
|
|
4
|
+
|
package/CHANGELOG.md
CHANGED
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
|
/**
|
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/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"}
|