@signetai/core 0.168.0 → 0.169.1
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/index.js
CHANGED
|
@@ -11072,6 +11072,21 @@ function up107(db) {
|
|
|
11072
11072
|
}
|
|
11073
11073
|
}
|
|
11074
11074
|
|
|
11075
|
+
// src/migrations/108-embedding-usage.ts
|
|
11076
|
+
function up108(db) {
|
|
11077
|
+
db.exec(`
|
|
11078
|
+
CREATE TABLE IF NOT EXISTS embedding_usage (
|
|
11079
|
+
day TEXT NOT NULL,
|
|
11080
|
+
agent_id TEXT NOT NULL DEFAULT '',
|
|
11081
|
+
source_kind TEXT NOT NULL,
|
|
11082
|
+
provider TEXT NOT NULL,
|
|
11083
|
+
requests INTEGER NOT NULL DEFAULT 0,
|
|
11084
|
+
tokens INTEGER NOT NULL DEFAULT 0,
|
|
11085
|
+
PRIMARY KEY (day, agent_id, source_kind, provider)
|
|
11086
|
+
);
|
|
11087
|
+
`);
|
|
11088
|
+
}
|
|
11089
|
+
|
|
11075
11090
|
// src/migrations/index.ts
|
|
11076
11091
|
var MIGRATIONS = [
|
|
11077
11092
|
{
|
|
@@ -11927,6 +11942,14 @@ var MIGRATIONS = [
|
|
|
11927
11942
|
{ table: "dreaming_passes", column: "tokens_cost" }
|
|
11928
11943
|
]
|
|
11929
11944
|
}
|
|
11945
|
+
},
|
|
11946
|
+
{
|
|
11947
|
+
version: 108,
|
|
11948
|
+
name: "embedding-usage",
|
|
11949
|
+
up: up108,
|
|
11950
|
+
artifacts: {
|
|
11951
|
+
tables: ["embedding_usage"]
|
|
11952
|
+
}
|
|
11930
11953
|
}
|
|
11931
11954
|
];
|
|
11932
11955
|
function checksum(m) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MigrationDb } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Migration 108: daily-aggregate embedding token usage.
|
|
4
|
+
*
|
|
5
|
+
* Every embedding fetch through the shared boundary (Ollama, native ONNX,
|
|
6
|
+
* llama.cpp, OpenAI-compatible) records the token count of the text actually
|
|
7
|
+
* sent, using the real tokenizer (countTokens) rather than provider-reported
|
|
8
|
+
* usage (Ollama's /api/embeddings returns none). Rows aggregate by
|
|
9
|
+
* (day, agent_id, source_kind, provider) so the table stays bounded (one row
|
|
10
|
+
* per day per dimension) while still answering "how much did vault ingest
|
|
11
|
+
* cost in tokens vs. captures" and "Ollama/native throughput" questions.
|
|
12
|
+
*
|
|
13
|
+
* `agent_id` defaults to '' when the fetch boundary had no agent context
|
|
14
|
+
* (a real identity is never substituted with "default"). `requests` counts
|
|
15
|
+
* successful embedding fetches; `tokens` sums the tokenizer count of the
|
|
16
|
+
* text sent to the provider.
|
|
17
|
+
*/
|
|
18
|
+
export declare function up(db: MigrationDb): void;
|
|
19
|
+
//# sourceMappingURL=108-embedding-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"108-embedding-usage.d.ts","sourceRoot":"","sources":["../../src/migrations/108-embedding-usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAYxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiHH,MAAM,WAAW,WAAW;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACrB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC9B,GA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