@kernl-sdk/pg 0.1.33 → 0.1.35
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 +18 -0
- package/dist/storage.d.ts +3 -3
- package/dist/storage.d.ts.map +1 -1
- package/dist/thread/store.d.ts +3 -3
- package/dist/thread/store.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/__tests__/integration.test.ts +23 -23
- package/src/storage.ts +3 -3
- package/src/thread/store.ts +4 -4
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @kernl/pg
|
|
2
2
|
|
|
3
|
+
## 0.1.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [884e513]
|
|
8
|
+
- Updated dependencies [0576a77]
|
|
9
|
+
- kernl@0.12.3
|
|
10
|
+
- @kernl-sdk/retrieval@0.1.10
|
|
11
|
+
- @kernl-sdk/storage@0.2.3
|
|
12
|
+
|
|
13
|
+
## 0.1.34
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [11cf6fd]
|
|
18
|
+
- kernl@0.12.2
|
|
19
|
+
- @kernl-sdk/storage@0.2.2
|
|
20
|
+
|
|
3
21
|
## 0.1.33
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Pool } from "pg";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IAgentRegistry, IModelRegistry, KernlStorage, Transaction } from "kernl";
|
|
3
3
|
import { PGThreadStore } from "./thread/store.js";
|
|
4
4
|
import { PGMemoryStore } from "./memory/store.js";
|
|
5
5
|
/**
|
|
@@ -83,8 +83,8 @@ export declare class PGStorage implements KernlStorage {
|
|
|
83
83
|
* Bind runtime registries to storage.
|
|
84
84
|
*/
|
|
85
85
|
bind(registries: {
|
|
86
|
-
agents:
|
|
87
|
-
models:
|
|
86
|
+
agents: IAgentRegistry;
|
|
87
|
+
models: IModelRegistry;
|
|
88
88
|
}): void;
|
|
89
89
|
/**
|
|
90
90
|
* Execute a function within a transaction.
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAG3C,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAG3C,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,oBAGnC,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,GAC3C,oBAAoB,GAAG,SAAS,CAOlC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,qBAAa,SAAU,YAAW,YAAY;IAC5C,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;gBAEZ,MAAM,EAAE,eAAe;IAMnC;;;;OAIG;YACW,UAAU;IAUxB;;OAEG;IACH,IAAI,CAAC,UAAU,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,GAAG,IAAI;IAI1E;;OAEG;IACG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrE;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC9B;;OAEG;YACW,WAAW;IAUzB;;OAEG;YACW,YAAY;IA6F1B;;OAEG;YACW,UAAU;IAMxB;;OAEG;YACW,UAAU;IAIxB;;OAEG;YACW,SAAS;IAIvB;;OAEG;YACW,WAAW;CAkB1B"}
|
package/dist/thread/store.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Pool, PoolClient } from "pg";
|
|
2
|
-
import { type
|
|
2
|
+
import { type IAgentRegistry, type IModelRegistry, type ThreadStore, type NewThread, type ThreadUpdate, type ThreadInclude, type ThreadListOptions, type ThreadHistoryOptions } from "kernl";
|
|
3
3
|
import { Thread, type ThreadEvent } from "kernl/internal";
|
|
4
4
|
import { type ThreadRecord } from "@kernl-sdk/storage";
|
|
5
5
|
/**
|
|
@@ -19,8 +19,8 @@ export declare class PGThreadStore implements ThreadStore {
|
|
|
19
19
|
* (TODO): move into abstract ThreadStore class
|
|
20
20
|
*/
|
|
21
21
|
bind(registries: {
|
|
22
|
-
agents:
|
|
23
|
-
models:
|
|
22
|
+
agents: IAgentRegistry;
|
|
23
|
+
models: IModelRegistry;
|
|
24
24
|
}): void;
|
|
25
25
|
/**
|
|
26
26
|
* Get a thread by id.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/thread/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,EAGL,KAAK,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/thread/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAC;AAI5B;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,UAAU,CAA4D;IAC9E,OAAO,CAAC,UAAU,CAAsB;gBAE5B,EAAE,EAAE,IAAI,GAAG,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAMlE;;;;OAIG;IACH,IAAI,CAAC,UAAU,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,cAAc,CAAA;KAAE,GAAG,IAAI;IAI1E;;OAEG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAuGvE;;OAEG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAuC1D;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IA4BhD;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAkB/D;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxC;;OAEG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAAC,WAAW,EAAE,CAAC;IAuCzB;;;;;;;;;OASG;IACG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmClD;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;KAAE,GAAG,MAAM;CA0C1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernl-sdk/pg",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"description": "PostgreSQL storage adapter for kernl",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kernl",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"tsc-alias": "^1.8.10",
|
|
36
36
|
"typescript": "5.9.2",
|
|
37
37
|
"vitest": "^4.0.8",
|
|
38
|
-
"@kernl-sdk/ai": "^0.4.
|
|
39
|
-
"@kernl-sdk/protocol": "^0.5.
|
|
38
|
+
"@kernl-sdk/ai": "^0.4.4",
|
|
39
|
+
"@kernl-sdk/protocol": "^0.5.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"pg": "^8.16.3",
|
|
43
|
-
"kernl": "^0.12.
|
|
44
|
-
"@kernl-sdk/retrieval": "^0.1.
|
|
43
|
+
"kernl": "^0.12.3",
|
|
44
|
+
"@kernl-sdk/retrieval": "^0.1.10",
|
|
45
45
|
"@kernl-sdk/shared": "^0.4.0",
|
|
46
|
-
"@kernl-sdk/storage": "0.2.
|
|
46
|
+
"@kernl-sdk/storage": "0.2.3"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "rm -rf dist",
|
|
@@ -6,8 +6,8 @@ import { PGThreadStore } from "../thread/store";
|
|
|
6
6
|
import {
|
|
7
7
|
Agent,
|
|
8
8
|
Context,
|
|
9
|
-
type
|
|
10
|
-
type
|
|
9
|
+
type IAgentRegistry,
|
|
10
|
+
type IModelRegistry,
|
|
11
11
|
} from "kernl";
|
|
12
12
|
import { Thread } from "kernl/internal";
|
|
13
13
|
import type { LanguageModel } from "@kernl-sdk/protocol";
|
|
@@ -49,10 +49,10 @@ describe.sequential("PGStorage auto-initialization", () => {
|
|
|
49
49
|
model,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const agents:
|
|
53
|
-
const models:
|
|
52
|
+
const agents: IAgentRegistry = new Map([["auto-init-agent", agent]]);
|
|
53
|
+
const models: IModelRegistry = new Map([
|
|
54
54
|
["test/auto-init-model", model],
|
|
55
|
-
]) as unknown as
|
|
55
|
+
]) as unknown as IModelRegistry;
|
|
56
56
|
|
|
57
57
|
storage.bind({ agents, models });
|
|
58
58
|
const store = storage.threads;
|
|
@@ -314,10 +314,10 @@ describe.sequential("PGStorage integration", () => {
|
|
|
314
314
|
model,
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
const agents:
|
|
318
|
-
const models:
|
|
317
|
+
const agents: IAgentRegistry = new Map<string, Agent>([["agent-1", agent]]);
|
|
318
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
319
319
|
["provider/model", model],
|
|
320
|
-
]) as unknown as
|
|
320
|
+
]) as unknown as IModelRegistry;
|
|
321
321
|
|
|
322
322
|
storage.bind({ agents, models });
|
|
323
323
|
const store = storage.threads;
|
|
@@ -510,10 +510,10 @@ describe.sequential("PGStorage integration", () => {
|
|
|
510
510
|
model,
|
|
511
511
|
});
|
|
512
512
|
|
|
513
|
-
const agents:
|
|
514
|
-
const models:
|
|
513
|
+
const agents: IAgentRegistry = new Map<string, Agent>([["agent-1", agent]]);
|
|
514
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
515
515
|
["provider/model", model],
|
|
516
|
-
]) as unknown as
|
|
516
|
+
]) as unknown as IModelRegistry;
|
|
517
517
|
|
|
518
518
|
storage.bind({ agents, models });
|
|
519
519
|
const store = storage.threads;
|
|
@@ -583,10 +583,10 @@ describe.sequential("PGStorage integration", () => {
|
|
|
583
583
|
model,
|
|
584
584
|
});
|
|
585
585
|
|
|
586
|
-
const agents:
|
|
587
|
-
const models:
|
|
586
|
+
const agents: IAgentRegistry = new Map<string, Agent>([["agent-1", agent]]);
|
|
587
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
588
588
|
["provider/model", model],
|
|
589
|
-
]) as unknown as
|
|
589
|
+
]) as unknown as IModelRegistry;
|
|
590
590
|
|
|
591
591
|
storage.bind({ agents, models });
|
|
592
592
|
const store = storage.threads;
|
|
@@ -641,10 +641,10 @@ describe.sequential("PGStorage integration", () => {
|
|
|
641
641
|
model,
|
|
642
642
|
});
|
|
643
643
|
|
|
644
|
-
const agents:
|
|
645
|
-
const models:
|
|
644
|
+
const agents: IAgentRegistry = new Map<string, Agent>([["agent-1", agent]]);
|
|
645
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
646
646
|
["provider/model", model],
|
|
647
|
-
]) as unknown as
|
|
647
|
+
]) as unknown as IModelRegistry;
|
|
648
648
|
|
|
649
649
|
storage.bind({ agents, models });
|
|
650
650
|
const store = storage.threads;
|
|
@@ -710,13 +710,13 @@ describe.sequential("PGStorage integration", () => {
|
|
|
710
710
|
model,
|
|
711
711
|
});
|
|
712
712
|
|
|
713
|
-
const agents:
|
|
713
|
+
const agents: IAgentRegistry = new Map<string, Agent>([
|
|
714
714
|
["agent-1", agent1],
|
|
715
715
|
["agent-2", agent2],
|
|
716
716
|
]);
|
|
717
|
-
const models:
|
|
717
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
718
718
|
["provider/model", model],
|
|
719
|
-
]) as unknown as
|
|
719
|
+
]) as unknown as IModelRegistry;
|
|
720
720
|
|
|
721
721
|
storage.bind({ agents, models });
|
|
722
722
|
const store = storage.threads;
|
|
@@ -827,10 +827,10 @@ describe.sequential("PGStorage integration", () => {
|
|
|
827
827
|
model,
|
|
828
828
|
});
|
|
829
829
|
|
|
830
|
-
const agents:
|
|
831
|
-
const models:
|
|
830
|
+
const agents: IAgentRegistry = new Map<string, Agent>([["agent-1", agent]]);
|
|
831
|
+
const models: IModelRegistry = new Map<string, LanguageModel>([
|
|
832
832
|
["provider/model", model],
|
|
833
|
-
]) as unknown as
|
|
833
|
+
]) as unknown as IModelRegistry;
|
|
834
834
|
|
|
835
835
|
storage.bind({ agents, models });
|
|
836
836
|
const store = storage.threads;
|
package/src/storage.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Pool, PoolClient } from "pg";
|
|
|
3
3
|
|
|
4
4
|
/* workspace */
|
|
5
5
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
IAgentRegistry,
|
|
7
|
+
IModelRegistry,
|
|
8
8
|
KernlStorage,
|
|
9
9
|
Transaction,
|
|
10
10
|
} from "kernl";
|
|
@@ -134,7 +134,7 @@ export class PGStorage implements KernlStorage {
|
|
|
134
134
|
/**
|
|
135
135
|
* Bind runtime registries to storage.
|
|
136
136
|
*/
|
|
137
|
-
bind(registries: { agents:
|
|
137
|
+
bind(registries: { agents: IAgentRegistry; models: IModelRegistry }): void {
|
|
138
138
|
this.threads.bind(registries);
|
|
139
139
|
}
|
|
140
140
|
|
package/src/thread/store.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { Pool, PoolClient } from "pg";
|
|
|
4
4
|
import {
|
|
5
5
|
Agent,
|
|
6
6
|
Context,
|
|
7
|
-
type
|
|
8
|
-
type
|
|
7
|
+
type IAgentRegistry,
|
|
8
|
+
type IModelRegistry,
|
|
9
9
|
type ThreadStore,
|
|
10
10
|
type NewThread,
|
|
11
11
|
type ThreadUpdate,
|
|
@@ -32,7 +32,7 @@ import { SQL_WHERE, SQL_ORDER, SQL_UPDATE } from "./sql";
|
|
|
32
32
|
*/
|
|
33
33
|
export class PGThreadStore implements ThreadStore {
|
|
34
34
|
private db: Pool | PoolClient;
|
|
35
|
-
private registries: { agents:
|
|
35
|
+
private registries: { agents: IAgentRegistry; models: IModelRegistry } | null;
|
|
36
36
|
private ensureInit: () => Promise<void>;
|
|
37
37
|
|
|
38
38
|
constructor(db: Pool | PoolClient, ensureInit: () => Promise<void>) {
|
|
@@ -46,7 +46,7 @@ export class PGThreadStore implements ThreadStore {
|
|
|
46
46
|
*
|
|
47
47
|
* (TODO): move into abstract ThreadStore class
|
|
48
48
|
*/
|
|
49
|
-
bind(registries: { agents:
|
|
49
|
+
bind(registries: { agents: IAgentRegistry; models: IModelRegistry }): void {
|
|
50
50
|
this.registries = registries;
|
|
51
51
|
}
|
|
52
52
|
|