@sixb/sqlite 0.1.11 → 0.1.12
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 +32 -0
- package/dist/agents/rows.d.ts +2 -0
- package/dist/agents/rows.d.ts.map +1 -1
- package/dist/agents/threads.d.ts +2 -1
- package/dist/agents/threads.d.ts.map +1 -1
- package/dist/index.js +676 -61
- package/dist/index.js.map +18 -14
- package/dist/migrations.d.ts.map +1 -1
- package/dist/objects/query-compiler.d.ts +9 -2
- package/dist/objects/query-compiler.d.ts.map +1 -1
- package/dist/objects/read-scope.d.ts +3 -0
- package/dist/objects/read-scope.d.ts.map +1 -1
- package/dist/objects/reader.d.ts +1 -0
- package/dist/objects/reader.d.ts.map +1 -1
- package/dist/objects/rows.d.ts +1 -0
- package/dist/objects/rows.d.ts.map +1 -1
- package/dist/objects/storage.d.ts.map +1 -1
- package/dist/objects/vector-extension.d.ts +4 -0
- package/dist/objects/vector-extension.d.ts.map +1 -0
- package/dist/ontology-storage/index.d.ts +4 -0
- package/dist/ontology-storage/index.d.ts.map +1 -1
- package/dist/ontology-storage/materializations.d.ts +1 -0
- package/dist/ontology-storage/materializations.d.ts.map +1 -1
- package/dist/ontology-storage/vector-indexing.d.ts +20 -0
- package/dist/ontology-storage/vector-indexing.d.ts.map +1 -0
- package/dist/ontology-storage/vectors.d.ts +16 -0
- package/dist/ontology-storage/vectors.d.ts.map +1 -0
- package/dist/vector-encoding.d.ts +3 -0
- package/dist/vector-encoding.d.ts.map +1 -0
- package/package.json +8 -4
- package/src/agents/rows.ts +12 -0
- package/src/agents/threads.ts +41 -2
- package/src/ai-cost-storage.ts +4 -0
- package/src/migrations/041-agent-thread-workspaces.sql +2 -0
- package/src/migrations/042-vector-profiles.sql +21 -0
- package/src/migrations/043-vector-indexing.sql +197 -0
- package/src/migrations/044-vector-batching.sql +3 -0
- package/src/migrations/045-agent-thread-sandbox-state.sql +2 -0
- package/src/migrations.ts +14 -0
- package/src/objects/query-compiler.ts +105 -7
- package/src/objects/read-scope.ts +34 -31
- package/src/objects/reader.ts +25 -1
- package/src/objects/rows.ts +5 -1
- package/src/objects/storage.ts +12 -1
- package/src/objects/vector-extension.ts +26 -0
- package/src/ontology-storage/index.ts +16 -0
- package/src/ontology-storage/materializations.ts +13 -0
- package/src/ontology-storage/vector-indexing.ts +196 -0
- package/src/ontology-storage/vectors.ts +182 -0
- package/src/vector-encoding.ts +9 -0
package/README.md
CHANGED
|
@@ -39,6 +39,38 @@ file when upgrading normally; incompatible or dirty history fails startup instea
|
|
|
39
39
|
rewriting an unknown schema. Before 1.0, an explicitly breaking migration may still require deleting
|
|
40
40
|
the database file and starting over.
|
|
41
41
|
|
|
42
|
+
## Vector profiles
|
|
43
|
+
|
|
44
|
+
Named `search.vectors` profiles persist outside object properties as float32 blobs with their
|
|
45
|
+
provenance. Writes and invalidation share the object's materialization transaction; stale model
|
|
46
|
+
results fail explicitly instead of overwriting newer vectors. No extension is needed to persist.
|
|
47
|
+
|
|
48
|
+
Search uses the bundled `sqlite-vec` 0.1.9 extension, loaded on the query connection when needed.
|
|
49
|
+
On macOS, install an extension-capable SQLite (`brew install sqlite`) and select its library
|
|
50
|
+
**before opening any database**:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { Database } from "bun:sqlite"
|
|
54
|
+
|
|
55
|
+
Database.setCustomSQLite("/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use the actual library path on your machine; the selection applies to the process. Linux and
|
|
59
|
+
Windows do not need this macOS setup. Unsupported native platforms fail with a diagnostic.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const result = await sixb.objects(Product).query()
|
|
63
|
+
.vector("content", "lightweight running shoes", { k: 10 }).list()
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Exact cosine search uses normalized vectors and applies filters and source permissions before
|
|
67
|
+
ranking. It rejects more than 10,000 eligible vectors or 16 million coordinates per search.
|
|
68
|
+
SQLite reads remain synchronous: these bounds limit scoring work, not wall-clock time;
|
|
69
|
+
`busy_timeout` only bounds lock waits. Existing numeric arrays are not promoted to profiles.
|
|
70
|
+
|
|
71
|
+
Run vector integration tests with `bun run test:e2e`. On macOS, set `SIXB_TEST_SQLITE_LIBRARY`
|
|
72
|
+
to the SQLite library path; tests use a separate process for library selection.
|
|
73
|
+
|
|
42
74
|
## Transactions
|
|
43
75
|
|
|
44
76
|
```ts
|
package/dist/agents/rows.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface AgentThreadRow {
|
|
|
8
8
|
owner_principal_type: Principal["type"];
|
|
9
9
|
owner_principal_id: string;
|
|
10
10
|
title: string | null;
|
|
11
|
+
sandbox_params: string | null;
|
|
12
|
+
sandbox_state: string | null;
|
|
11
13
|
status: AgentThreadRecord["status"];
|
|
12
14
|
active_run_id: string | null;
|
|
13
15
|
last_message_at: string | null;
|
|
@@ -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,KAAK,EAAoB,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
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;AAG7D,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EAEvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAMvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAIpD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAA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AAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,cAAc,CAgD/D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,GAAG,kBAAkB,CAiB3E;AAED,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,yBAAyB,GAC7B,4BAA4B,CAsB9B;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE;IAC1C,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAAA;IAClD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAsBxF"}
|
package/dist/agents/threads.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { type AgentThreadRecord, type AgentThreadStore, type CreateAgentThreadInput, type ListAgentThreadsInput, type ListAgentThreadsResult } from "@sixb/core/storage";
|
|
2
|
+
import { type AgentThreadRecord, type AgentThreadSandboxState, type AgentThreadStore, type CreateAgentThreadInput, type ListAgentThreadsInput, type ListAgentThreadsResult, type TransitionAgentThreadSandboxInput } from "@sixb/core/storage";
|
|
3
3
|
export declare class SqliteAgentThreadStore implements AgentThreadStore {
|
|
4
4
|
private readonly db;
|
|
5
5
|
constructor(db: Database);
|
|
6
|
+
transitionSandbox(input: TransitionAgentThreadSandboxInput): Promise<AgentThreadSandboxState>;
|
|
6
7
|
create(input: CreateAgentThreadInput): Promise<AgentThreadRecord>;
|
|
7
8
|
getById(params: {
|
|
8
9
|
projectId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/agents/threads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/agents/threads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAK1C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iCAAiC,EACvC,MAAM,oBAAoB,CAAA;AAW3B,qBAAa,sBAAuB,YAAW,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ;IAEnC,iBAAiB,CACrB,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,uBAAuB,CAAC;IAmB7B,MAAM,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqDjE,OAAO,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAQrF,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgCzE,OAAO,CAAC,aAAa;CActB"}
|