@sixb/pg 0.1.2 → 0.1.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/dist/agents/agent-storage.d.ts +5 -3
- package/dist/agents/agent-storage.d.ts.map +1 -1
- package/dist/agents/checkpoints.d.ts +16 -0
- package/dist/agents/checkpoints.d.ts.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/messages.d.ts +2 -1
- package/dist/agents/messages.d.ts.map +1 -1
- package/dist/agents/rows.d.ts +18 -1
- package/dist/agents/rows.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1028 -35
- package/dist/index.js.map +15 -13
- package/dist/migrations.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-state.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-writer.d.ts.map +1 -1
- package/dist/pg-ai-cost-storage.d.ts +12 -0
- package/dist/pg-ai-cost-storage.d.ts.map +1 -0
- package/dist/pg-ai-usage-storage.d.ts +2 -1
- package/dist/pg-ai-usage-storage.d.ts.map +1 -1
- package/dist/pg-object-storage.d.ts +4 -3
- package/dist/pg-object-storage.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/agents/agent-storage.ts +6 -3
- package/src/agents/checkpoints.ts +204 -0
- package/src/agents/index.ts +1 -0
- package/src/agents/messages.ts +71 -13
- package/src/agents/rows.ts +45 -0
- package/src/index.ts +7 -1
- package/src/migrations/026-ai-cost-accounting.sql +53 -0
- package/src/migrations/027-agent-context-checkpoints.sql +34 -0
- package/src/migrations/028-object-override-edit-times.sql +3 -0
- package/src/migrations.ts +10 -0
- package/src/ontology-storage/materialization-state.ts +2 -0
- package/src/ontology-storage/materialization-writer.ts +5 -3
- package/src/pg-ai-cost-storage.ts +707 -0
- package/src/pg-ai-usage-storage.ts +15 -0
- package/src/pg-object-query-compiler.ts +81 -1
- package/src/pg-object-storage.ts +109 -13
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentStorage, ExecutionStorage } from "@sixb/core/storage";
|
|
2
2
|
import type { PgStoreClient } from "../transactions";
|
|
3
|
+
import { PgAgentContextCheckpointStore } from "./checkpoints";
|
|
3
4
|
import { PgAgentMessageStore } from "./messages";
|
|
4
5
|
import { PgAgentRunStore } from "./runs";
|
|
5
6
|
import { PgAgentThreadStore } from "./threads";
|
|
@@ -8,14 +9,15 @@ export interface PgAgentStorageOptions {
|
|
|
8
9
|
readonly executions: ExecutionStorage;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
|
-
* PostgreSQL-backed agent persistence: thread
|
|
12
|
-
* Cross-table writes
|
|
13
|
-
*
|
|
12
|
+
* PostgreSQL-backed agent persistence: thread, run, message, and context-checkpoint sub-stores
|
|
13
|
+
* sharing one connection. Cross-table writes run inside `runPgTransaction` with `SELECT ... FOR
|
|
14
|
+
* UPDATE` row locks for single-flight and checkpoint compare-and-swap safety.
|
|
14
15
|
*/
|
|
15
16
|
export declare class PgAgentStorage implements AgentStorage {
|
|
16
17
|
readonly threads: PgAgentThreadStore;
|
|
17
18
|
readonly runs: PgAgentRunStore;
|
|
18
19
|
readonly messages: PgAgentMessageStore;
|
|
20
|
+
readonly checkpoints: PgAgentContextCheckpointStore;
|
|
19
21
|
constructor(options: PgAgentStorageOptions);
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=agent-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-storage.d.ts","sourceRoot":"","sources":["../../src/agents/agent-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ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AgentContextCheckpointStore, type CreateAgentContextCheckpointInput } from "@sixb/core/storage";
|
|
2
|
+
import { type PgStoreClient } from "../transactions";
|
|
3
|
+
export declare class PgAgentContextCheckpointStore implements AgentContextCheckpointStore {
|
|
4
|
+
private readonly sql;
|
|
5
|
+
constructor(sql: PgStoreClient);
|
|
6
|
+
create(input: CreateAgentContextCheckpointInput): Promise<AgentContextCheckpointRecord>;
|
|
7
|
+
getLatest(input: {
|
|
8
|
+
readonly projectId: string;
|
|
9
|
+
readonly threadId: string;
|
|
10
|
+
}): Promise<AgentContextCheckpointRecord | null>;
|
|
11
|
+
getByRunIds(input: {
|
|
12
|
+
readonly projectId: string;
|
|
13
|
+
readonly runIds: readonly string[];
|
|
14
|
+
}): Promise<readonly AgentContextCheckpointRecord[]>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=checkpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../../src/agents/checkpoints.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAEhC,KAAK,iCAAiC,EACvC,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AActE,qBAAa,6BAA8B,YAAW,2BAA2B;IACnE,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAqIvF,SAAS,CAAC,KAAK,EAAE;QACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAC1B,GAAG,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;IAU1C,WAAW,CAAC,KAAK,EAAE;QACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;KACnC,GAAG,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC;CAuBrD"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { PgAgentStorageOptions } from "./agent-storage";
|
|
2
2
|
export { PgAgentStorage } from "./agent-storage";
|
|
3
|
+
export { PgAgentContextCheckpointStore } from "./checkpoints";
|
|
3
4
|
export { PgAgentMessageStore } from "./messages";
|
|
4
5
|
export { PgAgentRunStore } from "./runs";
|
|
5
6
|
export { PgAgentThreadStore } from "./threads";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type AgentMessageRecord, type AgentMessageStore, type AppendAgentMessageInput, type ListAgentMessagesInput, type ListAgentMessagesResult } from "@sixb/core/storage";
|
|
1
|
+
import { type AgentMessageRecord, type AgentMessageStore, type AppendAgentMessageInput, type DeleteAgentMessagesByRunInput, type ListAgentMessagesInput, type ListAgentMessagesResult } from "@sixb/core/storage";
|
|
2
2
|
import { type PgStoreClient } from "../transactions";
|
|
3
3
|
export declare class PgAgentMessageStore implements AgentMessageStore {
|
|
4
4
|
private readonly sql;
|
|
5
5
|
constructor(sql: PgStoreClient);
|
|
6
6
|
append(input: AppendAgentMessageInput): Promise<AgentMessageRecord>;
|
|
7
|
+
deleteByRunId(input: DeleteAgentMessagesByRunInput): Promise<number>;
|
|
7
8
|
getById(params: {
|
|
8
9
|
projectId: string;
|
|
9
10
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/agents/messages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AAGtE,qBAAa,mBAAoB,YAAW,iBAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/agents/messages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,iBAAiB,CAAA;AAGtE,qBAAa,mBAAoB,YAAW,iBAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAEzC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6FnE,aAAa,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC;IAgDpE,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAQtF,IAAI,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAkC5E"}
|
package/dist/agents/rows.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentMessagePart, JsonValue, Principal } from "@sixb/core";
|
|
2
|
-
import { type AgentMessageRecord, type AgentRunDiagnostic, type AgentRunRecord, type AgentThreadRecord } from "@sixb/core/storage";
|
|
2
|
+
import { type AgentContextCheckpointRecord, type AgentMessageRecord, type AgentRunDiagnostic, type AgentRunRecord, type AgentThreadRecord } from "@sixb/core/storage";
|
|
3
3
|
import type { SQLClient, SqlParameter } from "../pg-client";
|
|
4
4
|
export interface AgentThreadRow {
|
|
5
5
|
project_id: string;
|
|
@@ -50,9 +50,26 @@ export interface AgentMessageRow {
|
|
|
50
50
|
created_at: Date | string;
|
|
51
51
|
completed_at: Date | string | null;
|
|
52
52
|
}
|
|
53
|
+
export interface AgentContextCheckpointRow {
|
|
54
|
+
project_id: string;
|
|
55
|
+
id: string;
|
|
56
|
+
thread_id: string;
|
|
57
|
+
created_by_run_id: string;
|
|
58
|
+
previous_checkpoint_id: string | null;
|
|
59
|
+
reason: AgentContextCheckpointRecord["reason"];
|
|
60
|
+
summary: string;
|
|
61
|
+
summary_format_version: number | string;
|
|
62
|
+
summarized_through_seq: number | string;
|
|
63
|
+
observed_head_seq: number | string;
|
|
64
|
+
estimated_input_tokens_before: number | string;
|
|
65
|
+
estimated_input_tokens_after: number | string;
|
|
66
|
+
summary_model_id: string;
|
|
67
|
+
created_at: Date | string;
|
|
68
|
+
}
|
|
53
69
|
export declare function rowToThreadRecord(row: AgentThreadRow): AgentThreadRecord;
|
|
54
70
|
export declare function rowToRunRecord(row: AgentRunRow): AgentRunRecord;
|
|
55
71
|
export declare function rowToMessageRecord(row: AgentMessageRow): AgentMessageRecord;
|
|
72
|
+
export declare function rowToContextCheckpointRecord(row: AgentContextCheckpointRow): AgentContextCheckpointRecord;
|
|
56
73
|
export declare function queryAgentList<TRow>(input: {
|
|
57
74
|
readonly sql: SQLClient;
|
|
58
75
|
readonly table: "agent_threads" | "agent_messages";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/agents/rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAExE,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAK3D,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,oBAAoB,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;IACvC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAA;IACnC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,EAAE,IAAI,GAAG,MAAM,GAAG,IA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1,5 +1,5 @@
|
|
|
1
1
|
import type { MigrationCapableStorage, Storage, StorageMigrator, StorageTransactionOptions } from "@sixb/core";
|
|
2
|
-
import { type AiUsageStorage, type ObjectStorage } from "@sixb/core/storage";
|
|
2
|
+
import { type AiCostStorage, type AiUsageStorage, type ObjectStorage } from "@sixb/core/storage";
|
|
3
3
|
import { PgAgentStorage } from "./agents";
|
|
4
4
|
import { PgAuthStorage } from "./auth-storage";
|
|
5
5
|
import { PgConnectorConnectionStorage } from "./connector-connection-storage";
|
|
@@ -68,7 +68,7 @@ export interface PostgresStorageOptions {
|
|
|
68
68
|
/**
|
|
69
69
|
* PostgreSQL storage provider for Sixb.
|
|
70
70
|
*
|
|
71
|
-
* Bundles Sixb storage adapters, including the AI
|
|
71
|
+
* Bundles Sixb storage adapters, including the AI accounting ledger, behind a shared PostgreSQL
|
|
72
72
|
* connection pool (porsager `postgres`), which reliably reclaims connections under load.
|
|
73
73
|
*
|
|
74
74
|
* The storage exposes a core `StorageMigrator`. Sixb CLI startup and
|
|
@@ -93,6 +93,7 @@ export declare class PostgresStorage implements MigrationCapableStorage {
|
|
|
93
93
|
readonly executions: PgExecutionStorage;
|
|
94
94
|
readonly agents: PgAgentStorage;
|
|
95
95
|
readonly aiUsage: AiUsageStorage;
|
|
96
|
+
readonly aiCosts: AiCostStorage;
|
|
96
97
|
readonly actionRuns: PgActionRunStorage;
|
|
97
98
|
readonly pipelineRuns: PgPipelineRunStorage;
|
|
98
99
|
readonly workflowRuns: PgWorkflowRunStorage;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EACvB,OAAO,EACP,eAAe,EACf,yBAAyB,EAC1B,MAAM,YAAY,CAAA;AAUnB,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAA;AAC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