@sixb/sqlite 0.1.1 → 0.1.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/README.md +18 -13
- package/dist/action-run-storage.d.ts +5 -2
- package/dist/action-run-storage.d.ts.map +1 -1
- package/dist/agents/agent-storage.d.ts +9 -5
- package/dist/agents/agent-storage.d.ts.map +1 -1
- package/dist/agents/checkpoints.d.ts +14 -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 +21 -11
- package/dist/agents/rows.d.ts.map +1 -1
- package/dist/agents/runs.d.ts +3 -2
- package/dist/agents/runs.d.ts.map +1 -1
- package/dist/ai-cost-storage.d.ts +15 -0
- package/dist/ai-cost-storage.d.ts.map +1 -0
- package/dist/ai-usage-storage.d.ts +22 -0
- package/dist/ai-usage-storage.d.ts.map +1 -0
- package/dist/auth-storage/service-accounts.d.ts.map +1 -1
- package/dist/auth-storage/shared.d.ts +1 -10
- package/dist/auth-storage/shared.d.ts.map +1 -1
- package/dist/connector-connection-storage.d.ts +9 -0
- package/dist/connector-connection-storage.d.ts.map +1 -0
- package/dist/execution-storage.d.ts +14 -0
- package/dist/execution-storage.d.ts.map +1 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4633 -1066
- package/dist/index.js.map +33 -28
- package/dist/latest-run-query.d.ts.map +1 -1
- package/dist/migrations.d.ts +0 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-session.d.ts +50 -8
- package/dist/ontology-storage/materialization-session.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-state.d.ts +4 -5
- package/dist/ontology-storage/materialization-state.d.ts.map +1 -1
- package/dist/ontology-storage/materialization-writer.d.ts.map +1 -1
- package/dist/ontology-storage/materializations.d.ts +0 -2
- package/dist/ontology-storage/materializations.d.ts.map +1 -1
- package/dist/ontology-storage/outbox.d.ts.map +1 -1
- package/dist/ontology-storage/shared.d.ts +3 -3
- package/dist/ontology-storage/shared.d.ts.map +1 -1
- package/dist/ontology-storage/sources.d.ts.map +1 -1
- package/dist/pipeline-run-storage.d.ts +7 -2
- package/dist/pipeline-run-storage.d.ts.map +1 -1
- package/dist/projection-run-storage.d.ts +9 -2
- package/dist/projection-run-storage.d.ts.map +1 -1
- package/dist/run-list-query.d.ts +1 -1
- package/dist/run-list-query.d.ts.map +1 -1
- package/dist/sync-run-storage.d.ts +7 -2
- package/dist/sync-run-storage.d.ts.map +1 -1
- package/dist/testing.d.ts +6 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/transactions.d.ts +3 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/webhook-run-storage.d.ts +9 -2
- package/dist/webhook-run-storage.d.ts.map +1 -1
- package/dist/workflow-run-storage.d.ts +7 -3
- package/dist/workflow-run-storage.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/action-run-storage.ts +51 -74
- package/src/agents/agent-storage.ts +11 -6
- package/src/agents/checkpoints.ts +175 -0
- package/src/agents/index.ts +1 -0
- package/src/agents/messages.ts +59 -0
- package/src/agents/rows.ts +52 -40
- package/src/agents/runs.ts +27 -21
- package/src/ai-cost-storage.ts +744 -0
- package/src/ai-usage-storage.ts +324 -0
- package/src/auth-storage/service-accounts.ts +14 -21
- package/src/auth-storage/shared.ts +0 -22
- package/src/connector-connection-storage.ts +784 -0
- package/src/execution-storage.ts +158 -0
- package/src/index.ts +69 -22
- package/src/latest-run-query.ts +7 -1
- package/src/migrations/004-executions.sql +142 -0
- package/src/migrations/005-workflow-executions.sql +7 -0
- package/src/migrations/006-narrow-ontology-source-root-index.sql +4 -0
- package/src/migrations/007-split-overrides.sql +154 -0
- package/src/migrations/008-action-executions.sql +4 -0
- package/src/migrations/009-agent-executions.sql +115 -0
- package/src/migrations/010-ai-usage-accounting-foundation.sql +74 -0
- package/src/migrations/011-sync-failure-record.sql +22 -0
- package/src/migrations/012-pipeline-failure-record.sql +45 -0
- package/src/migrations/013-workflow-failure-record.sql +45 -0
- package/src/migrations/014-agent-failure-record.sql +59 -0
- package/src/migrations/015-projection-failure-record.sql +20 -0
- package/src/migrations/016-webhook-run-failure-record.sql +19 -0
- package/src/migrations/017-action-failure-record.sql +65 -0
- package/src/migrations/018-ontology-outbox-failure-record.sql +80 -0
- package/src/migrations/019-webhook-delivery-failure-record.sql +62 -0
- package/src/migrations/020-drop-run-usage-projections.sql +7 -0
- package/src/migrations/021-sync-pipeline-executions.sql +101 -0
- package/src/migrations/022-projection-executions.sql +244 -0
- package/src/migrations/023-webhook-executions.sql +51 -0
- package/src/migrations/024-ontology-commit-executions.sql +58 -0
- package/src/migrations/025-connector-connections.sql +257 -0
- package/src/migrations/026-ai-cost-accounting.sql +57 -0
- package/src/migrations/027-agent-context-checkpoints.sql +28 -0
- package/src/migrations/028-object-override-edit-times.sql +3 -0
- package/src/migrations.ts +129 -4
- package/src/ontology-storage/materialization-session.ts +317 -143
- package/src/ontology-storage/materialization-state.ts +323 -112
- package/src/ontology-storage/materialization-writer.ts +145 -67
- package/src/ontology-storage/materializations.ts +67 -141
- package/src/ontology-storage/outbox.ts +10 -3
- package/src/ontology-storage/shared.ts +10 -4
- package/src/ontology-storage/sources.ts +4 -1
- package/src/pipeline-run-storage.ts +128 -43
- package/src/projection-run-storage.ts +209 -97
- package/src/run-list-query.ts +9 -4
- package/src/sync-run-storage.ts +118 -32
- package/src/testing.ts +20 -0
- package/src/transactions.ts +10 -3
- package/src/webhook-run-storage.ts +118 -74
- package/src/workflow-run-storage.ts +117 -131
- package/dist/validation.d.ts +0 -5
- package/dist/validation.d.ts.map +0 -1
- package/dist/webhook-delivery-storage.d.ts +0 -27
- package/dist/webhook-delivery-storage.d.ts.map +0 -1
- package/src/validation.ts +0 -30
- package/src/webhook-delivery-storage.ts +0 -272
package/README.md
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
SQLite storage provider for Sixb, built on `bun:sqlite`.
|
|
4
4
|
|
|
5
|
-
Backs every Sixb store — objects, ontology commits, auth, agents,
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Backs every Sixb store — objects, ontology commits, auth, agents, the immutable execution and AI
|
|
6
|
+
usage ledgers, timeseries, and the run history for actions, syncs, pipelines, projections,
|
|
7
|
+
workflows, webhooks, and managed connector connections — from a single local database file. This
|
|
8
|
+
is the storage `bun create sixb` scaffolds, and part of what makes a fresh project run with no
|
|
8
9
|
service to install.
|
|
9
10
|
|
|
10
11
|
## Install
|
|
@@ -33,9 +34,10 @@ empty.
|
|
|
33
34
|
With a `path`, `SqliteStorage` exposes core's `StorageMigrator` contract and the CLI runs it at
|
|
34
35
|
startup. You do not write migrations — they ship inside this package.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Applied migrations are checksummed and schema changes ship as new ordered steps. Keep the database
|
|
38
|
+
file when upgrading normally; incompatible or dirty history fails startup instead of silently
|
|
39
|
+
rewriting an unknown schema. Before 1.0, an explicitly breaking migration may still require deleting
|
|
40
|
+
the database file and starting over.
|
|
39
41
|
|
|
40
42
|
## Transactions
|
|
41
43
|
|
|
@@ -45,13 +47,16 @@ await storage.transaction(async (tx) => {
|
|
|
45
47
|
})
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
Nested transactions are rejected. The `isolation` option is accepted and **ignored**: every
|
|
49
|
-
transaction runs through one
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
meaningful on a provider with true concurrent connections, such as [`@sixb/pg`](../pg).
|
|
50
|
+
Nested transactions are rejected. The `isolation` option is accepted and **ignored**: every write
|
|
51
|
+
transaction runs through one connection, serialized by an internal lock and a `BEGIN IMMEDIATE`, so
|
|
52
|
+
there is no concurrent writer to isolate against. `isolation: "serializable"` only becomes meaningful
|
|
53
|
+
on a provider with true concurrent connections, such as [`@sixb/pg`](../pg).
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
File-backed storage uses WAL mode and serves object and timeseries queries from a separate read-only
|
|
56
|
+
snapshot connection. Long materializations therefore do not block those reads behind the writer.
|
|
57
|
+
In-memory storage keeps one connection because SQLite in-memory databases are connection-local.
|
|
58
|
+
|
|
59
|
+
Reach for `@sixb/pg` before scaling out: SQLite still has one writer and is intended for one local
|
|
60
|
+
Sixb process, not shared replicas.
|
|
56
61
|
|
|
57
62
|
Call `close()` on shutdown.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { ActionRunRecord, ActionRunStorage, EnterActionRunPhaseInput, FinishActionRunInput, ListActionRunsInput, ListActionRunsResult, LockActionMaterializationRunInput, QueueActionRunInput, RecordActionEffectsInput, RecordActionWritebackInput, StartActionRunInput } from "@sixb/core/storage";
|
|
1
|
+
import type { ActionRunRecord, ActionRunStorage, EnterActionRunPhaseInput, ExecutionStorage, FinishActionRunInput, ListActionRunsInput, ListActionRunsResult, LockActionMaterializationRunInput, QueueActionRunInput, RecordActionEffectsInput, RecordActionWritebackInput, StartActionRunInput } from "@sixb/core/storage";
|
|
2
2
|
import { type SqliteStoreConnection } from "./transactions";
|
|
3
3
|
export interface SqliteActionRunStorageOptions {
|
|
4
|
+
/** Execution lookup sharing the same provider transaction. */
|
|
5
|
+
executions: ExecutionStorage;
|
|
4
6
|
/** Path to SQLite database file. Defaults to ':memory:' for in-memory database. */
|
|
5
7
|
path?: string;
|
|
6
8
|
/** Internal shared connection used by bundled SqliteStorage. */
|
|
@@ -9,7 +11,8 @@ export interface SqliteActionRunStorageOptions {
|
|
|
9
11
|
export declare class SqliteActionRunStorage implements ActionRunStorage {
|
|
10
12
|
private readonly connection;
|
|
11
13
|
private readonly db;
|
|
12
|
-
|
|
14
|
+
private readonly executions;
|
|
15
|
+
constructor(options: SqliteActionRunStorageOptions);
|
|
13
16
|
lockForMaterialization(input: LockActionMaterializationRunInput): Promise<ActionRunRecord>;
|
|
14
17
|
queue(input: QueueActionRunInput): Promise<ActionRunRecord>;
|
|
15
18
|
private requeueAfterEnqueueFailure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-run-storage.d.ts","sourceRoot":"","sources":["../src/action-run-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-run-storage.d.ts","sourceRoot":"","sources":["../src/action-run-storage.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAKV,eAAe,EACf,gBAAgB,EAEhB,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iCAAiC,EACjC,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAS3B,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,UAAU,EAAE,gBAAgB,CAAA;IAC5B,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,UAAU,CAAC,EAAE,qBAAqB,CAAA;CACnC;AAED,qBAAa,sBAAuB,YAAW,gBAAgB;IAC7D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAClD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAU;IAE7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;gBAEjC,OAAO,EAAE,6BAA6B;IAU5C,sBAAsB,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,eAAe,CAAC;IA+B1F,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;YA6EnD,0BAA0B;IAiDlC,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IA8C3D,UAAU,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsBrE,eAAe,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,eAAe,CAAC;IA+C5E,aAAa,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC;IA6CxE,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAiD7D,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAQnF,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA8GrE,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,iBAAiB;CAmB1B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AgentStorage } from "@sixb/core/storage";
|
|
1
|
+
import type { AgentStorage, ExecutionStorage } from "@sixb/core/storage";
|
|
2
2
|
import { type SqliteStoreConnection } from "../transactions";
|
|
3
|
+
import { SqliteAgentContextCheckpointStore } from "./checkpoints";
|
|
3
4
|
import { SqliteAgentMessageStore } from "./messages";
|
|
4
5
|
import { SqliteAgentRunStore } from "./runs";
|
|
5
6
|
import { SqliteAgentThreadStore } from "./threads";
|
|
@@ -8,18 +9,21 @@ export interface SqliteAgentStorageOptions {
|
|
|
8
9
|
path?: string;
|
|
9
10
|
/** Internal shared connection used by bundled SqliteStorage. */
|
|
10
11
|
connection?: SqliteStoreConnection;
|
|
12
|
+
/** Execution ledger used to validate immutable run ownership. */
|
|
13
|
+
executions: ExecutionStorage;
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
|
-
* SQLite-backed agent persistence: thread
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
+
* SQLite-backed agent persistence: thread, run, message, and context-checkpoint sub-stores sharing
|
|
17
|
+
* one connection. Cross-table writes run in SQLite transactions; the bundled {@link SqliteStorage}
|
|
18
|
+
* serializes them for single-flight and checkpoint compare-and-swap safety.
|
|
16
19
|
*/
|
|
17
20
|
export declare class SqliteAgentStorage implements AgentStorage {
|
|
18
21
|
readonly threads: SqliteAgentThreadStore;
|
|
19
22
|
readonly runs: SqliteAgentRunStore;
|
|
20
23
|
readonly messages: SqliteAgentMessageStore;
|
|
24
|
+
readonly checkpoints: SqliteAgentContextCheckpointStore;
|
|
21
25
|
private readonly connection;
|
|
22
|
-
constructor(options
|
|
26
|
+
constructor(options: SqliteAgentStorageOptions);
|
|
23
27
|
close(): void;
|
|
24
28
|
}
|
|
25
29
|
//# 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,MAAM,oBAAoB,CAAA;
|
|
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;AAExE,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAElD,MAAM,WAAW,yBAAyB;IACxC,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC,iEAAiE;IACjE,UAAU,EAAE,gBAAgB,CAAA;CAC7B;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAA;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;IAClC,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAA;IAC1C,QAAQ,CAAC,WAAW,EAAE,iCAAiC,CAAA;IAEvD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;gBAEtC,OAAO,EAAE,yBAAyB;IAa9C,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import { type AgentContextCheckpointRecord, type AgentContextCheckpointStore, type CreateAgentContextCheckpointInput } from "@sixb/core/storage";
|
|
3
|
+
export declare class SqliteAgentContextCheckpointStore implements AgentContextCheckpointStore {
|
|
4
|
+
private readonly db;
|
|
5
|
+
constructor(db: Database);
|
|
6
|
+
create(input: CreateAgentContextCheckpointInput): Promise<AgentContextCheckpointRecord>;
|
|
7
|
+
getLatest(input: {
|
|
8
|
+
readonly projectId: string;
|
|
9
|
+
readonly threadId: string;
|
|
10
|
+
}): Promise<AgentContextCheckpointRecord | null>;
|
|
11
|
+
private findLatest;
|
|
12
|
+
private requireById;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=checkpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoints.d.ts","sourceRoot":"","sources":["../../src/agents/checkpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAQ1C,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAEhC,KAAK,iCAAiC,EACvC,MAAM,oBAAoB,CAAA;AAY3B,qBAAa,iCAAkC,YAAW,2BAA2B;IACvE,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ;IAEnC,MAAM,CAAC,KAAK,EAAE,iCAAiC,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAiHvF,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;IAIhD,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,WAAW;CAYpB"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { SqliteAgentStorageOptions } from "./agent-storage";
|
|
2
2
|
export { SqliteAgentStorage } from "./agent-storage";
|
|
3
|
+
export { SqliteAgentContextCheckpointStore } from "./checkpoints";
|
|
3
4
|
export { SqliteAgentMessageStore } from "./messages";
|
|
4
5
|
export { SqliteAgentRunStore } from "./runs";
|
|
5
6
|
export { SqliteAgentThreadStore } from "./threads";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { type AgentMessageRecord, type AgentMessageStore, type AppendAgentMessageInput, type ListAgentMessagesInput, type ListAgentMessagesResult } from "@sixb/core/storage";
|
|
2
|
+
import { type AgentMessageRecord, type AgentMessageStore, type AppendAgentMessageInput, type DeleteAgentMessagesByRunInput, type ListAgentMessagesInput, type ListAgentMessagesResult } from "@sixb/core/storage";
|
|
3
3
|
export declare class SqliteAgentMessageStore implements AgentMessageStore {
|
|
4
4
|
private readonly db;
|
|
5
5
|
constructor(db: Database);
|
|
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":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,uBAAwB,YAAW,iBAAiB;IACnD,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ;IAEnC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+FnE,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;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/agents/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAEtB,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,uBAAwB,YAAW,iBAAiB;IACnD,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ;IAEnC,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+FnE,aAAa,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC;IAqDpE,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;IAgC3E,OAAO,CAAC,cAAc;CAcvB"}
|
package/dist/agents/rows.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import {
|
|
3
|
-
import { type AgentMessageRecord, type AgentRunRecord, type AgentThreadRecord } from "@sixb/core/storage";
|
|
2
|
+
import type { Principal } from "@sixb/core";
|
|
3
|
+
import { type AgentContextCheckpointRecord, type AgentMessageRecord, type AgentRunRecord, type AgentThreadRecord } from "@sixb/core/storage";
|
|
4
4
|
import type { SqliteValue } from "../run-list-query";
|
|
5
5
|
export interface AgentThreadRow {
|
|
6
6
|
project_id: string;
|
|
@@ -19,21 +19,14 @@ export interface AgentThreadRow {
|
|
|
19
19
|
export interface AgentRunRow {
|
|
20
20
|
project_id: string;
|
|
21
21
|
id: string;
|
|
22
|
+
execution_id: string;
|
|
22
23
|
thread_id: string;
|
|
23
24
|
agent_id: string;
|
|
24
25
|
trigger_message_id: string;
|
|
25
|
-
|
|
26
|
-
requested_by_principal_id: string | null;
|
|
27
|
-
execution_principal_type: "serviceAccount" | null;
|
|
28
|
-
execution_principal_id: string | null;
|
|
26
|
+
requester_group_ids: string;
|
|
29
27
|
status: AgentRunRecord["status"];
|
|
30
28
|
model_id: string | null;
|
|
31
29
|
finish_reason: string | null;
|
|
32
|
-
usage_input_tokens: number | null;
|
|
33
|
-
usage_output_tokens: number | null;
|
|
34
|
-
usage_total_tokens: number | null;
|
|
35
|
-
usage_reasoning_tokens: number | null;
|
|
36
|
-
usage_cached_input_tokens: number | null;
|
|
37
30
|
error: string | null;
|
|
38
31
|
diagnostics: string | null;
|
|
39
32
|
attempt: number;
|
|
@@ -58,9 +51,26 @@ export interface AgentMessageRow {
|
|
|
58
51
|
created_at: string;
|
|
59
52
|
completed_at: string | null;
|
|
60
53
|
}
|
|
54
|
+
export interface AgentContextCheckpointRow {
|
|
55
|
+
project_id: string;
|
|
56
|
+
id: string;
|
|
57
|
+
thread_id: string;
|
|
58
|
+
created_by_run_id: string;
|
|
59
|
+
previous_checkpoint_id: string | null;
|
|
60
|
+
reason: AgentContextCheckpointRecord["reason"];
|
|
61
|
+
summary: string;
|
|
62
|
+
summary_format_version: number;
|
|
63
|
+
summarized_through_seq: number;
|
|
64
|
+
observed_head_seq: number;
|
|
65
|
+
estimated_input_tokens_before: number;
|
|
66
|
+
estimated_input_tokens_after: number;
|
|
67
|
+
summary_model_id: string;
|
|
68
|
+
created_at: string;
|
|
69
|
+
}
|
|
61
70
|
export declare function rowToThreadRecord(row: AgentThreadRow): AgentThreadRecord;
|
|
62
71
|
export declare function rowToRunRecord(row: AgentRunRow): AgentRunRecord;
|
|
63
72
|
export declare function rowToMessageRecord(row: AgentMessageRow): AgentMessageRecord;
|
|
73
|
+
export declare function rowToContextCheckpointRecord(row: AgentContextCheckpointRow): AgentContextCheckpointRecord;
|
|
64
74
|
export declare function queryAgentList<TRow>(input: {
|
|
65
75
|
readonly db: Database;
|
|
66
76
|
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,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/agents/rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EAEvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAIpD,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,MAAM,GAAG,IAAI,CAAA;IAC9B,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,C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AE,SAAS,IAAI,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAsBxF"}
|
package/dist/agents/runs.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { type AgentRunRecord, type AgentRunStore, type ConfirmAgentRunExecutionOwnershipInput, type CreateAgentRunInput, type FinishAgentRunInput, type FinishQueuedAgentRunInput, type ListAgentRunsInput, type ListAgentRunsResult, type ReclaimAgentRunInput, type StartAgentRunInput } from "@sixb/core/storage";
|
|
2
|
+
import { type AgentRunRecord, type AgentRunStore, type ConfirmAgentRunExecutionOwnershipInput, type CreateAgentRunInput, type ExecutionStorage, type FinishAgentRunInput, type FinishQueuedAgentRunInput, type ListAgentRunsInput, type ListAgentRunsResult, type ReclaimAgentRunInput, type StartAgentRunInput } from "@sixb/core/storage";
|
|
3
3
|
export declare class SqliteAgentRunStore implements AgentRunStore {
|
|
4
4
|
private readonly db;
|
|
5
|
-
|
|
5
|
+
private readonly executions;
|
|
6
|
+
constructor(db: Database, executions: ExecutionStorage);
|
|
6
7
|
create(input: CreateAgentRunInput): Promise<AgentRunRecord>;
|
|
7
8
|
start(input: StartAgentRunInput): Promise<AgentRunRecord>;
|
|
8
9
|
finishQueued(input: FinishQueuedAgentRunInput): Promise<AgentRunRecord>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/agents/runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/agents/runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAI1C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAA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OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,UAAU;CAcnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AiAccountingOverview, type AiCostStorage, type AiCostSummary, type AiModelCallCostRecord, type ListAiModelCallAccountingInput, type ListAiModelCallAccountingResult, type QueryAiAccountingOverviewInput, type SummarizeAiCostExecutionsInput } from "@sixb/core/storage";
|
|
2
|
+
import { type SqliteStoreConnection } from "./transactions";
|
|
3
|
+
/** SQLite-backed immutable valuations stored in one append-only table. */
|
|
4
|
+
export declare class SqliteAiCostStorage implements AiCostStorage {
|
|
5
|
+
private readonly connection;
|
|
6
|
+
constructor(connection: SqliteStoreConnection);
|
|
7
|
+
recordModelCallCost(input: AiModelCallCostRecord): Promise<void>;
|
|
8
|
+
summarizeExecutions(input: SummarizeAiCostExecutionsInput): Promise<readonly AiCostSummary[]>;
|
|
9
|
+
queryProjectOverview(input: QueryAiAccountingOverviewInput): Promise<AiAccountingOverview>;
|
|
10
|
+
listModelCalls(input: ListAiModelCallAccountingInput): Promise<ListAiModelCallAccountingResult>;
|
|
11
|
+
private insertCost;
|
|
12
|
+
private findCost;
|
|
13
|
+
private findUsage;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ai-cost-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-cost-storage.d.ts","sourceRoot":"","sources":["../src/ai-cost-storage.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAElB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAE1B,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEpF,0EAA0E;AAC1E,qBAAa,mBAAoB,YAAW,aAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,qBAAqB;IAExD,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBhE,mBAAmB,CACvB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC;IAuB9B,oBAAoB,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAiB1F,cAAc,CAClB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,+BAA+B,CAAC;IAkB3C,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,SAAS;CAMlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type AiUsageExecutionSummary, type AiUsageStorage, type RecordAiModelCallInput, type RecordAiModelCallResult, type SummarizeAiUsageExecutionInput, type SummarizeAiUsageExecutionsInput } from "@sixb/core/storage";
|
|
2
|
+
import { type SqliteStoreConnection } from "./transactions";
|
|
3
|
+
export interface SqliteAiUsageStorageOptions {
|
|
4
|
+
readonly path?: string;
|
|
5
|
+
readonly connection?: SqliteStoreConnection;
|
|
6
|
+
}
|
|
7
|
+
/** SQLite-backed append-only model-call usage ledger. */
|
|
8
|
+
export declare class SqliteAiUsageStorage implements AiUsageStorage {
|
|
9
|
+
private readonly connection;
|
|
10
|
+
constructor(options?: SqliteAiUsageStorageOptions);
|
|
11
|
+
recordModelCall(input: RecordAiModelCallInput): Promise<RecordAiModelCallResult>;
|
|
12
|
+
summarizeExecution(input: SummarizeAiUsageExecutionInput): Promise<AiUsageExecutionSummary>;
|
|
13
|
+
summarizeExecutions(input: SummarizeAiUsageExecutionsInput): Promise<readonly AiUsageExecutionSummary[]>;
|
|
14
|
+
close(): void;
|
|
15
|
+
private insertRecord;
|
|
16
|
+
private findByIdempotencyKey;
|
|
17
|
+
private requireById;
|
|
18
|
+
private rowToRecord;
|
|
19
|
+
private executionRows;
|
|
20
|
+
private assertExecutionExists;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ai-usage-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-usage-storage.d.ts","sourceRoot":"","sources":["../src/ai-usage-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EAKnB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EACrC,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAA;CAC5C;AAED,yDAAyD;AACzD,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;gBAEtC,OAAO,GAAE,2BAAgC;IAO/C,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoChF,kBAAkB,CACtB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,uBAAuB,CAAC;IAQ7B,mBAAmB,CACvB,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC;IAS9C,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,YAAY;IAwDpB,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,WAAW;IAmCnB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,qBAAqB;CAU9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-accounts.d.ts","sourceRoot":"","sources":["../../src/auth-storage/service-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AM,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA8B3E,IAAI,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,6BAA6B,CAAC;CAqCxF"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
2
|
import type { AuthSessionAudience } from "@sixb/core";
|
|
3
|
-
import type { CompleteAuthSessionInput, CreateAuthSessionInput, GroupMembershipRecord, InvitationRecord, MagicLinkRecord, OidcAuthorizationAttemptRecord, UpsertAuthGroupMembershipInput
|
|
3
|
+
import type { CompleteAuthSessionInput, CreateAuthSessionInput, GroupMembershipRecord, InvitationRecord, MagicLinkRecord, OidcAuthorizationAttemptRecord, UpsertAuthGroupMembershipInput } from "@sixb/core/storage";
|
|
4
4
|
import type { SqliteAuthMagicLinkRow, SqliteAuthOidcAttemptRow, SqliteAuthSessionRow, SqliteAuthUserIdentityRow, SqliteAuthUserRow } from "./rows";
|
|
5
5
|
import { rowToSessionRecord } from "./rows";
|
|
6
6
|
export type SqliteValue = string | number | null;
|
|
7
7
|
export declare function assertNonEmpty(value: string, label: string): string;
|
|
8
8
|
export declare function normalizeEmail(email: string): string;
|
|
9
9
|
export declare function normalizeGroupIds(groupIds: readonly string[] | undefined): readonly string[];
|
|
10
|
-
export declare function cloneRecord<T>(record: T): T;
|
|
11
10
|
export declare function dateOrNow(value: Date | undefined): Date;
|
|
12
11
|
export declare function toIso(value: Date): string;
|
|
13
12
|
export declare function hasEmptyFilter(values: readonly unknown[] | undefined): boolean;
|
|
@@ -19,18 +18,10 @@ export declare function getUserRowById(db: Database, params: {
|
|
|
19
18
|
readonly projectId: string;
|
|
20
19
|
readonly id: string;
|
|
21
20
|
}): SqliteAuthUserRow | null;
|
|
22
|
-
export declare function getUserById(db: Database, params: {
|
|
23
|
-
readonly projectId: string;
|
|
24
|
-
readonly id: string;
|
|
25
|
-
}): UserRecord | null;
|
|
26
21
|
export declare function getUserRowByEmail(db: Database, params: {
|
|
27
22
|
readonly projectId: string;
|
|
28
23
|
readonly email: string;
|
|
29
24
|
}): SqliteAuthUserRow | null;
|
|
30
|
-
export declare function getUserByEmail(db: Database, params: {
|
|
31
|
-
readonly projectId: string;
|
|
32
|
-
readonly email: string;
|
|
33
|
-
}): UserRecord | null;
|
|
34
25
|
export declare function getIdentityRowBySubject(db: Database, params: {
|
|
35
26
|
readonly projectId: string;
|
|
36
27
|
readonly strategyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/auth-storage/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,8BAA8B,EAC9B,8BAA8B,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/auth-storage/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAGV,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AACf,OAAO,EAKL,kBAAkB,EACnB,MAAM,QAAQ,CAAA;AAEf,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAEhD,wBAAgB,cAAc,CAAC,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orage } from "@sixb/core/internal/connector-connection-storage-provider";
|
|
2
|
+
import { type SqliteStoreConnection } from "./transactions";
|
|
3
|
+
export declare class SqliteConnectorConnectionStorage extends DurableConnectorConnectionStorage {
|
|
4
|
+
private readonly clock;
|
|
5
|
+
constructor(connection: SqliteStoreConnection);
|
|
6
|
+
/** Internal deterministic clock control used only by the provider contract suite. */
|
|
7
|
+
advanceTimeForTesting(durationMs: number): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=connector-connection-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-connection-storage.d.ts","sourceRoot":"","sources":["../src/connector-connection-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iCAAiC,EAClC,MAAM,2DAA2D,CAAA;AASlE,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEzF,qBAAa,gCAAiC,SAAQ,iCAAiC;IACrF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;gBAExC,UAAU,EAAE,qBAAqB;IAM7C,qFAAqF;IACrF,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAGhD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { CreateExecutionInput, ExecutionRecord, ExecutionStorage } from "@sixb/core/storage";
|
|
3
|
+
import type { SqliteAuthStorage } from "./auth-storage";
|
|
4
|
+
export declare class SqliteExecutionStorage implements ExecutionStorage {
|
|
5
|
+
private readonly db;
|
|
6
|
+
private readonly auth;
|
|
7
|
+
constructor(db: Database, auth: SqliteAuthStorage);
|
|
8
|
+
create(input: CreateExecutionInput): Promise<ExecutionRecord>;
|
|
9
|
+
getById(params: {
|
|
10
|
+
readonly projectId: string;
|
|
11
|
+
readonly id: string;
|
|
12
|
+
}): Promise<ExecutionRecord | null>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=execution-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-storage.d.ts","sourceRoot":"","sources":["../src/execution-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAQ1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAEjG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,qBAAa,sBAAuB,YAAW,gBAAgB;IAE3D,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,iBAAiB;IAGpC,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;IAsE7D,OAAO,CAAC,MAAM,EAAE;QACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KACpB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;CAapC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { MigrationCapableStorage, Storage, StorageMigrator, StorageTransactionOptions } from "@sixb/core";
|
|
2
|
+
import { type AiCostStorage, type AiUsageStorage } from "@sixb/core/storage";
|
|
2
3
|
import { SqliteActionRunStorage } from "./action-run-storage";
|
|
3
4
|
import { SqliteAgentStorage } from "./agents";
|
|
4
5
|
import { SqliteAuthStorage } from "./auth-storage";
|
|
6
|
+
import { SqliteConnectorConnectionStorage } from "./connector-connection-storage";
|
|
7
|
+
import { SqliteExecutionStorage } from "./execution-storage";
|
|
5
8
|
import { SqliteOntologyStorage } from "./ontology-storage";
|
|
6
9
|
import { SqlitePipelineRunStorage } from "./pipeline-run-storage";
|
|
7
10
|
import { SqliteProjectionRunStorage } from "./projection-run-storage";
|
|
8
11
|
import { SqliteRulesStorage } from "./rules-storage";
|
|
9
12
|
import { SqliteSyncRunStorage } from "./sync-run-storage";
|
|
10
|
-
import { SqliteWebhookDeliveryStorage } from "./webhook-delivery-storage";
|
|
11
13
|
import { SqliteWebhookRunStorage } from "./webhook-run-storage";
|
|
12
14
|
import { SqliteWorkflowInterventionStorage } from "./workflow-intervention-storage";
|
|
13
15
|
import { SqliteWorkflowRunStorage } from "./workflow-run-storage";
|
|
@@ -18,8 +20,8 @@ export interface SqliteStorageOptions {
|
|
|
18
20
|
/**
|
|
19
21
|
* SQLite storage provider for Sixb.
|
|
20
22
|
*
|
|
21
|
-
* Bundles object, timeseries, auth,
|
|
22
|
-
* run,
|
|
23
|
+
* Bundles object, timeseries, auth, execution, AI accounting, sync run, pipeline run, projection
|
|
24
|
+
* run, workflow run, webhook run, and connector connection storage backed by SQLite.
|
|
23
25
|
*
|
|
24
26
|
* Usage:
|
|
25
27
|
* ```ts
|
|
@@ -35,7 +37,10 @@ export declare class SqliteStorage implements MigrationCapableStorage {
|
|
|
35
37
|
readonly objects: Storage["objects"];
|
|
36
38
|
readonly ontology: SqliteOntologyStorage;
|
|
37
39
|
readonly auth: SqliteAuthStorage;
|
|
40
|
+
readonly executions: SqliteExecutionStorage;
|
|
38
41
|
readonly agents: SqliteAgentStorage;
|
|
42
|
+
readonly aiUsage: AiUsageStorage;
|
|
43
|
+
readonly aiCosts: AiCostStorage;
|
|
39
44
|
readonly actionRuns: SqliteActionRunStorage;
|
|
40
45
|
readonly pipelineRuns: SqlitePipelineRunStorage;
|
|
41
46
|
readonly syncRuns: SqliteSyncRunStorage;
|
|
@@ -43,21 +48,21 @@ export declare class SqliteStorage implements MigrationCapableStorage {
|
|
|
43
48
|
readonly workflowRuns: SqliteWorkflowRunStorage;
|
|
44
49
|
readonly workflowInterventions: SqliteWorkflowInterventionStorage;
|
|
45
50
|
readonly timeseries: Storage["timeseries"];
|
|
46
|
-
readonly webhookDeliveries: SqliteWebhookDeliveryStorage;
|
|
47
51
|
readonly webhookRuns: SqliteWebhookRunStorage;
|
|
48
52
|
readonly rules: SqliteRulesStorage;
|
|
53
|
+
readonly connectorConnections: SqliteConnectorConnectionStorage;
|
|
49
54
|
readonly migrators: readonly StorageMigrator[];
|
|
50
55
|
private readonly connection;
|
|
56
|
+
private readonly readConnection;
|
|
51
57
|
private readonly transactionScope;
|
|
52
58
|
private transactionTail;
|
|
53
59
|
constructor(options?: SqliteStorageOptions);
|
|
54
60
|
ping(): Promise<void>;
|
|
55
61
|
/**
|
|
56
|
-
* The `isolation` option is intentionally ignored. SQLite runs every transaction through
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* `isolation: "serializable"` translates to a real isolation level.
|
|
62
|
+
* The `isolation` option is intentionally ignored. SQLite runs every write transaction through
|
|
63
|
+
* one connection serialized by {@link withTransactionLock} and a `BEGIN IMMEDIATE`, so there is no
|
|
64
|
+
* concurrent writer to isolate against. File-backed object and timeseries reads use a separate WAL
|
|
65
|
+
* snapshot connection; Postgres is where `isolation: "serializable"` maps to a real isolation level.
|
|
61
66
|
*/
|
|
62
67
|
transaction<T>(run: (tx: Storage) => Promise<T> | T, _options?: StorageTransactionOptions): Promise<T>;
|
|
63
68
|
close(): void;
|
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;
|
|
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,aAAa,EAClB,KAAK,cAAc,EAIpB,MAAM,oB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