@hraness/oh 0.3.1 → 0.3.2
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 +38 -21
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/libsql-semantic-v2.d.ts +160 -0
- package/dist/libsql-semantic-v2.d.ts.map +1 -0
- package/dist/semantic-cloud.d.ts +1 -0
- package/dist/semantic-cloud.d.ts.map +1 -1
- package/dist/semantic-cloud.js +1543 -0
- package/package.json +1 -1
- package/skills/oh/SKILL.md +2 -2
- package/spec/README.md +8 -1
- package/spec/manifest.json +5 -1
- package/spec/v1/libsql-semantic-cache-schema-v1.sql +114 -0
- package/spec/v1/libsql-semantic-digest-fixture-v1.json +13 -0
- package/spec/v2/libsql-semantic-cache-schema-v2.sql +175 -0
- package/spec/v2/libsql-semantic-digest-fixture-v2.json +14 -0
- package/spec/v2/manifest.json +11 -0
- package/spec/v2/semantic-cloud.md +106 -0
- package/src/cli.ts +1 -1
- package/src/libsql-semantic-v2.test.ts +1114 -0
- package/src/libsql-semantic-v2.ts +1891 -0
- package/src/libsql-semantic.test.ts +50 -1
- package/src/semantic-cloud.ts +1 -0
|
@@ -147,7 +147,11 @@ function document(
|
|
|
147
147
|
async function bootstrapped(): Promise<SqliteCompatibleLibSqlClient> {
|
|
148
148
|
const client = new SqliteCompatibleLibSqlClient();
|
|
149
149
|
expect(await bootstrapOhLibSqlSemanticCacheV1(client, { appliedAt: instant1 }))
|
|
150
|
-
.
|
|
150
|
+
.toEqual({
|
|
151
|
+
schemaSha256: "d9903735e900e08a8c49c9ad36ea8f277b1689117ef88b9a2c6b906456dfbace" as Sha256Hex,
|
|
152
|
+
schemaVersion: 1,
|
|
153
|
+
v: 1,
|
|
154
|
+
});
|
|
151
155
|
return client;
|
|
152
156
|
}
|
|
153
157
|
|
|
@@ -167,6 +171,51 @@ function authority(
|
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
describe("libSQL derived semantic cache", () => {
|
|
174
|
+
test("reproduces the fixed released V1 digest fixture", async () => {
|
|
175
|
+
const fixture = await Bun.file(new URL(
|
|
176
|
+
"../spec/v1/libsql-semantic-digest-fixture-v1.json",
|
|
177
|
+
import.meta.url,
|
|
178
|
+
)).json() as Readonly<{
|
|
179
|
+
authorityId: string;
|
|
180
|
+
authoritySha256: Sha256Hex;
|
|
181
|
+
content: string;
|
|
182
|
+
generation: number;
|
|
183
|
+
generationSha256: Sha256Hex;
|
|
184
|
+
inputSha256: Sha256Hex;
|
|
185
|
+
membershipSha256: Sha256Hex;
|
|
186
|
+
recordKey: string;
|
|
187
|
+
recordSha256: Sha256Hex;
|
|
188
|
+
title: string;
|
|
189
|
+
v: 1;
|
|
190
|
+
}>;
|
|
191
|
+
const client = await bootstrapped();
|
|
192
|
+
const cache = await openOhLibSqlSemanticCacheV1(client);
|
|
193
|
+
const calls: string[][] = [];
|
|
194
|
+
const staged = await cache.stage({
|
|
195
|
+
authorityId: fixture.authorityId,
|
|
196
|
+
authoritySha256: fixture.authoritySha256,
|
|
197
|
+
createdAt: instant1,
|
|
198
|
+
documents: [{
|
|
199
|
+
content: fixture.content,
|
|
200
|
+
key: fixture.recordKey,
|
|
201
|
+
recordSha256: fixture.recordSha256,
|
|
202
|
+
title: fixture.title,
|
|
203
|
+
v: fixture.v,
|
|
204
|
+
}],
|
|
205
|
+
embeddingClient: embeddingClient(calls),
|
|
206
|
+
generation: fixture.generation,
|
|
207
|
+
});
|
|
208
|
+
expect(staged).toMatchObject({
|
|
209
|
+
generationSha256: fixture.generationSha256,
|
|
210
|
+
membershipSha256: fixture.membershipSha256,
|
|
211
|
+
v: 1,
|
|
212
|
+
});
|
|
213
|
+
expect(calls).toHaveLength(1);
|
|
214
|
+
expect(sha256Hex(calls[0]?.[0] ?? "")).toBe(fixture.inputSha256);
|
|
215
|
+
await cache.close();
|
|
216
|
+
client.close();
|
|
217
|
+
});
|
|
218
|
+
|
|
170
219
|
test("requires explicit bootstrap and refuses a partial or drifted schema", async () => {
|
|
171
220
|
const empty = new SqliteCompatibleLibSqlClient();
|
|
172
221
|
await expect(openOhLibSqlSemanticCacheV1(empty)).rejects.toMatchObject({
|
package/src/semantic-cloud.ts
CHANGED