@signetai/connector-gemini 0.211.17 → 0.211.20
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 +669 -27
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15759,6 +15759,319 @@ function up137(db) {
|
|
|
15759
15759
|
if (!cols.has(name))
|
|
15760
15760
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
15761
15761
|
}
|
|
15762
|
+
function hasColumn25(db, table, column) {
|
|
15763
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
15764
|
+
return rows.some((row) => row.name === column);
|
|
15765
|
+
}
|
|
15766
|
+
function addColumnIfMissing27(db, table, column, definition) {
|
|
15767
|
+
if (!hasColumn25(db, table, column))
|
|
15768
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
15769
|
+
}
|
|
15770
|
+
function up138(db) {
|
|
15771
|
+
addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
15772
|
+
db.exec(`
|
|
15773
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
15774
|
+
agent_id TEXT PRIMARY KEY,
|
|
15775
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
15776
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
15777
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
15778
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
15779
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
15780
|
+
oldest_pending_at TEXT,
|
|
15781
|
+
last_error TEXT,
|
|
15782
|
+
last_error_at TEXT
|
|
15783
|
+
);
|
|
15784
|
+
|
|
15785
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
15786
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
15787
|
+
|
|
15788
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
15789
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
15790
|
+
WHERE error IS NOT NULL;
|
|
15791
|
+
|
|
15792
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
15793
|
+
content_hash TEXT PRIMARY KEY,
|
|
15794
|
+
dup_count INTEGER NOT NULL
|
|
15795
|
+
);
|
|
15796
|
+
|
|
15797
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
15798
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
15799
|
+
WHERE dup_count > 1;
|
|
15800
|
+
|
|
15801
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
15802
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
15803
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
15804
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
15805
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
15806
|
+
);
|
|
15807
|
+
|
|
15808
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
15809
|
+
ON memories(content_hash)
|
|
15810
|
+
WHERE is_deleted = 0
|
|
15811
|
+
AND content_hash IS NOT NULL
|
|
15812
|
+
AND pinned = 0
|
|
15813
|
+
AND manual_override = 0;
|
|
15814
|
+
`);
|
|
15815
|
+
db.exec(`
|
|
15816
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
15817
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
15818
|
+
BEGIN
|
|
15819
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
15820
|
+
VALUES (NEW.agent_id)
|
|
15821
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
15822
|
+
|
|
15823
|
+
UPDATE transcript_capture_status
|
|
15824
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
15825
|
+
processing = processing + (NEW.status = 'processing'),
|
|
15826
|
+
completed = completed + (NEW.status = 'completed'),
|
|
15827
|
+
failed = failed + (NEW.status = 'failed'),
|
|
15828
|
+
dead = dead + (NEW.status = 'dead')
|
|
15829
|
+
WHERE agent_id = NEW.agent_id;
|
|
15830
|
+
|
|
15831
|
+
UPDATE transcript_capture_status
|
|
15832
|
+
SET oldest_pending_at = (
|
|
15833
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15834
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15835
|
+
)
|
|
15836
|
+
WHERE agent_id = NEW.agent_id;
|
|
15837
|
+
|
|
15838
|
+
UPDATE transcript_capture_status
|
|
15839
|
+
SET last_error = (
|
|
15840
|
+
SELECT error FROM transcript_capture_jobs
|
|
15841
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15842
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15843
|
+
),
|
|
15844
|
+
last_error_at = (
|
|
15845
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15846
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15847
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15848
|
+
)
|
|
15849
|
+
WHERE agent_id = NEW.agent_id
|
|
15850
|
+
AND NEW.error IS NOT NULL;
|
|
15851
|
+
END;
|
|
15852
|
+
|
|
15853
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
15854
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
15855
|
+
BEGIN
|
|
15856
|
+
UPDATE transcript_capture_status
|
|
15857
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
15858
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
15859
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
15860
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
15861
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
15862
|
+
WHERE agent_id = NEW.agent_id;
|
|
15863
|
+
|
|
15864
|
+
UPDATE transcript_capture_status
|
|
15865
|
+
SET oldest_pending_at = (
|
|
15866
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15867
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15868
|
+
)
|
|
15869
|
+
WHERE agent_id = NEW.agent_id;
|
|
15870
|
+
|
|
15871
|
+
UPDATE transcript_capture_status
|
|
15872
|
+
SET last_error = (
|
|
15873
|
+
SELECT error FROM transcript_capture_jobs
|
|
15874
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15875
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15876
|
+
),
|
|
15877
|
+
last_error_at = (
|
|
15878
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15879
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15880
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15881
|
+
)
|
|
15882
|
+
WHERE agent_id = NEW.agent_id
|
|
15883
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
15884
|
+
END;
|
|
15885
|
+
|
|
15886
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
15887
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
15888
|
+
BEGIN
|
|
15889
|
+
UPDATE transcript_capture_status
|
|
15890
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
15891
|
+
processing = processing - (OLD.status = 'processing'),
|
|
15892
|
+
completed = completed - (OLD.status = 'completed'),
|
|
15893
|
+
failed = failed - (OLD.status = 'failed'),
|
|
15894
|
+
dead = dead - (OLD.status = 'dead')
|
|
15895
|
+
WHERE agent_id = OLD.agent_id;
|
|
15896
|
+
|
|
15897
|
+
UPDATE transcript_capture_status
|
|
15898
|
+
SET oldest_pending_at = (
|
|
15899
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15900
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
15901
|
+
)
|
|
15902
|
+
WHERE agent_id = OLD.agent_id;
|
|
15903
|
+
|
|
15904
|
+
UPDATE transcript_capture_status
|
|
15905
|
+
SET last_error = (
|
|
15906
|
+
SELECT error FROM transcript_capture_jobs
|
|
15907
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15908
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15909
|
+
),
|
|
15910
|
+
last_error_at = (
|
|
15911
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15912
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15913
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15914
|
+
)
|
|
15915
|
+
WHERE agent_id = OLD.agent_id
|
|
15916
|
+
AND OLD.error IS NOT NULL;
|
|
15917
|
+
END;
|
|
15918
|
+
`);
|
|
15919
|
+
db.exec(`
|
|
15920
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
15921
|
+
AFTER INSERT ON memories
|
|
15922
|
+
BEGIN
|
|
15923
|
+
UPDATE memories_diagnostics_state
|
|
15924
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15925
|
+
exact_duplicates = exact_duplicates + CASE
|
|
15926
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15927
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15928
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15929
|
+
THEN 1 ELSE 0 END,
|
|
15930
|
+
exact_clusters = exact_clusters + CASE
|
|
15931
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15932
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15933
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15934
|
+
THEN 1 ELSE 0 END
|
|
15935
|
+
WHERE id = 1;
|
|
15936
|
+
|
|
15937
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15938
|
+
SELECT NEW.content_hash, 1
|
|
15939
|
+
WHERE NEW.is_deleted = 0
|
|
15940
|
+
AND NEW.content_hash IS NOT NULL
|
|
15941
|
+
AND NEW.pinned = 0
|
|
15942
|
+
AND NEW.manual_override = 0
|
|
15943
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15944
|
+
END;
|
|
15945
|
+
|
|
15946
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
15947
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
15948
|
+
BEGIN
|
|
15949
|
+
UPDATE memories_diagnostics_state
|
|
15950
|
+
SET total_active = total_active
|
|
15951
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
15952
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15953
|
+
exact_duplicates = exact_duplicates - CASE
|
|
15954
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15955
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15956
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
15957
|
+
THEN 1 ELSE 0 END,
|
|
15958
|
+
exact_clusters = exact_clusters - CASE
|
|
15959
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15960
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15961
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
15962
|
+
THEN 1 ELSE 0 END
|
|
15963
|
+
WHERE id = 1;
|
|
15964
|
+
|
|
15965
|
+
UPDATE memories_duplicate_hash_counts
|
|
15966
|
+
SET dup_count = dup_count - 1
|
|
15967
|
+
WHERE OLD.is_deleted = 0
|
|
15968
|
+
AND OLD.content_hash IS NOT NULL
|
|
15969
|
+
AND OLD.pinned = 0
|
|
15970
|
+
AND OLD.manual_override = 0
|
|
15971
|
+
AND content_hash = OLD.content_hash;
|
|
15972
|
+
|
|
15973
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
15974
|
+
WHERE content_hash = OLD.content_hash
|
|
15975
|
+
AND dup_count <= 0;
|
|
15976
|
+
|
|
15977
|
+
UPDATE memories_diagnostics_state
|
|
15978
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
15979
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15980
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15981
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15982
|
+
THEN 1 ELSE 0 END,
|
|
15983
|
+
exact_clusters = exact_clusters + CASE
|
|
15984
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15985
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15986
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15987
|
+
THEN 1 ELSE 0 END
|
|
15988
|
+
WHERE id = 1;
|
|
15989
|
+
|
|
15990
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15991
|
+
SELECT NEW.content_hash, 1
|
|
15992
|
+
WHERE NEW.is_deleted = 0
|
|
15993
|
+
AND NEW.content_hash IS NOT NULL
|
|
15994
|
+
AND NEW.pinned = 0
|
|
15995
|
+
AND NEW.manual_override = 0
|
|
15996
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15997
|
+
END;
|
|
15998
|
+
|
|
15999
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
16000
|
+
AFTER DELETE ON memories
|
|
16001
|
+
BEGIN
|
|
16002
|
+
UPDATE memories_diagnostics_state
|
|
16003
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
16004
|
+
exact_duplicates = exact_duplicates - CASE
|
|
16005
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
16006
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
16007
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
16008
|
+
THEN 1 ELSE 0 END,
|
|
16009
|
+
exact_clusters = exact_clusters - CASE
|
|
16010
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
16011
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
16012
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
16013
|
+
THEN 1 ELSE 0 END
|
|
16014
|
+
WHERE id = 1;
|
|
16015
|
+
|
|
16016
|
+
UPDATE memories_duplicate_hash_counts
|
|
16017
|
+
SET dup_count = dup_count - 1
|
|
16018
|
+
WHERE OLD.is_deleted = 0
|
|
16019
|
+
AND OLD.content_hash IS NOT NULL
|
|
16020
|
+
AND OLD.pinned = 0
|
|
16021
|
+
AND OLD.manual_override = 0
|
|
16022
|
+
AND content_hash = OLD.content_hash;
|
|
16023
|
+
|
|
16024
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
16025
|
+
WHERE content_hash = OLD.content_hash
|
|
16026
|
+
AND dup_count <= 0;
|
|
16027
|
+
END;
|
|
16028
|
+
`);
|
|
16029
|
+
db.exec(`
|
|
16030
|
+
DELETE FROM transcript_capture_status;
|
|
16031
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
16032
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
16033
|
+
SELECT content_hash, COUNT(*)
|
|
16034
|
+
FROM memories
|
|
16035
|
+
WHERE is_deleted = 0
|
|
16036
|
+
AND content_hash IS NOT NULL
|
|
16037
|
+
AND pinned = 0
|
|
16038
|
+
AND manual_override = 0
|
|
16039
|
+
GROUP BY content_hash;
|
|
16040
|
+
|
|
16041
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
16042
|
+
VALUES (
|
|
16043
|
+
1,
|
|
16044
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
16045
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
16046
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
16047
|
+
)
|
|
16048
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
16049
|
+
total_active = excluded.total_active,
|
|
16050
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
16051
|
+
exact_clusters = excluded.exact_clusters;
|
|
16052
|
+
|
|
16053
|
+
INSERT INTO transcript_capture_status (
|
|
16054
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
16055
|
+
oldest_pending_at, last_error, last_error_at
|
|
16056
|
+
)
|
|
16057
|
+
SELECT
|
|
16058
|
+
j.agent_id,
|
|
16059
|
+
SUM(j.status = 'pending'),
|
|
16060
|
+
SUM(j.status = 'processing'),
|
|
16061
|
+
SUM(j.status = 'completed'),
|
|
16062
|
+
SUM(j.status = 'failed'),
|
|
16063
|
+
SUM(j.status = 'dead'),
|
|
16064
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
16065
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
16066
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
16067
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
16068
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
16069
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
16070
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
16071
|
+
FROM transcript_capture_jobs j
|
|
16072
|
+
GROUP BY j.agent_id;
|
|
16073
|
+
`);
|
|
16074
|
+
}
|
|
15762
16075
|
var MIGRATIONS = [
|
|
15763
16076
|
{
|
|
15764
16077
|
version: 1,
|
|
@@ -16848,6 +17161,14 @@ var MIGRATIONS = [
|
|
|
16848
17161
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
16849
17162
|
]
|
|
16850
17163
|
}
|
|
17164
|
+
},
|
|
17165
|
+
{
|
|
17166
|
+
version: 138,
|
|
17167
|
+
name: "bounded-status-projections",
|
|
17168
|
+
up: up138,
|
|
17169
|
+
artifacts: {
|
|
17170
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
17171
|
+
}
|
|
16851
17172
|
}
|
|
16852
17173
|
];
|
|
16853
17174
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -28823,7 +29144,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
|
28823
29144
|
return true;
|
|
28824
29145
|
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
28825
29146
|
}
|
|
28826
|
-
function
|
|
29147
|
+
function up139(db) {
|
|
28827
29148
|
db.exec(`
|
|
28828
29149
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
28829
29150
|
version INTEGER PRIMARY KEY,
|
|
@@ -28912,31 +29233,31 @@ function up138(db) {
|
|
|
28912
29233
|
} catch {}
|
|
28913
29234
|
createMemoriesFts2(db);
|
|
28914
29235
|
}
|
|
28915
|
-
function
|
|
29236
|
+
function hasColumn26(db, table, column) {
|
|
28916
29237
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
28917
29238
|
return rows.some((r3) => r3.name === column);
|
|
28918
29239
|
}
|
|
28919
|
-
function
|
|
28920
|
-
if (!
|
|
29240
|
+
function addColumnIfMissing28(db, table, column, definition) {
|
|
29241
|
+
if (!hasColumn26(db, table, column)) {
|
|
28921
29242
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
28922
29243
|
}
|
|
28923
29244
|
}
|
|
28924
29245
|
function up210(db) {
|
|
28925
|
-
|
|
28926
|
-
|
|
28927
|
-
|
|
28928
|
-
|
|
28929
|
-
|
|
28930
|
-
|
|
28931
|
-
|
|
28932
|
-
|
|
28933
|
-
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
29246
|
+
addColumnIfMissing28(db, "memories", "content_hash", "TEXT");
|
|
29247
|
+
addColumnIfMissing28(db, "memories", "normalized_content", "TEXT");
|
|
29248
|
+
addColumnIfMissing28(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
|
|
29249
|
+
addColumnIfMissing28(db, "memories", "deleted_at", "TEXT");
|
|
29250
|
+
addColumnIfMissing28(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
|
|
29251
|
+
addColumnIfMissing28(db, "memories", "embedding_model", "TEXT");
|
|
29252
|
+
addColumnIfMissing28(db, "memories", "extraction_model", "TEXT");
|
|
29253
|
+
addColumnIfMissing28(db, "memories", "update_count", "INTEGER DEFAULT 0");
|
|
29254
|
+
addColumnIfMissing28(db, "memories", "who", "TEXT");
|
|
29255
|
+
addColumnIfMissing28(db, "memories", "why", "TEXT");
|
|
29256
|
+
addColumnIfMissing28(db, "memories", "project", "TEXT");
|
|
29257
|
+
addColumnIfMissing28(db, "memories", "pinned", "INTEGER DEFAULT 0");
|
|
29258
|
+
addColumnIfMissing28(db, "memories", "importance", "REAL DEFAULT 0.5");
|
|
29259
|
+
addColumnIfMissing28(db, "memories", "last_accessed", "TEXT");
|
|
29260
|
+
addColumnIfMissing28(db, "memories", "access_count", "INTEGER DEFAULT 0");
|
|
28940
29261
|
db.exec(`
|
|
28941
29262
|
CREATE TABLE IF NOT EXISTS memory_history (
|
|
28942
29263
|
id TEXT PRIMARY KEY,
|
|
@@ -29032,7 +29353,7 @@ function up210(db) {
|
|
|
29032
29353
|
ON memory_entity_mentions(entity_id);
|
|
29033
29354
|
`);
|
|
29034
29355
|
}
|
|
29035
|
-
function
|
|
29356
|
+
function addColumnIfMissing29(db, table, column, definition) {
|
|
29036
29357
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
29037
29358
|
if (rows.some((r3) => r3.name === column))
|
|
29038
29359
|
return false;
|
|
@@ -29040,8 +29361,8 @@ function addColumnIfMissing28(db, table, column, definition) {
|
|
|
29040
29361
|
return true;
|
|
29041
29362
|
}
|
|
29042
29363
|
function up310(db) {
|
|
29043
|
-
|
|
29044
|
-
|
|
29364
|
+
addColumnIfMissing29(db, "memories", "why", "TEXT");
|
|
29365
|
+
addColumnIfMissing29(db, "memories", "project", "TEXT");
|
|
29045
29366
|
db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
|
|
29046
29367
|
db.exec(`
|
|
29047
29368
|
UPDATE memories
|
|
@@ -29067,12 +29388,12 @@ function up310(db) {
|
|
|
29067
29388
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
29068
29389
|
`);
|
|
29069
29390
|
}
|
|
29070
|
-
function
|
|
29391
|
+
function hasColumn27(db, table, column) {
|
|
29071
29392
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
29072
29393
|
return rows.some((r3) => r3.name === column);
|
|
29073
29394
|
}
|
|
29074
29395
|
function addColumnIfMissing32(db, table, column, definition) {
|
|
29075
|
-
if (!
|
|
29396
|
+
if (!hasColumn27(db, table, column)) {
|
|
29076
29397
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
29077
29398
|
}
|
|
29078
29399
|
}
|
|
@@ -29307,7 +29628,7 @@ function addColumnIfMissing52(db, table, column, definition) {
|
|
|
29307
29628
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
29308
29629
|
}
|
|
29309
29630
|
}
|
|
29310
|
-
function
|
|
29631
|
+
function up1310(db) {
|
|
29311
29632
|
db.exec(`
|
|
29312
29633
|
CREATE TABLE IF NOT EXISTS ingestion_jobs (
|
|
29313
29634
|
id TEXT PRIMARY KEY,
|
|
@@ -33176,11 +33497,324 @@ function up1372(db) {
|
|
|
33176
33497
|
if (!cols.has(name))
|
|
33177
33498
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
33178
33499
|
}
|
|
33500
|
+
function hasColumn252(db, table, column) {
|
|
33501
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
33502
|
+
return rows.some((row) => row.name === column);
|
|
33503
|
+
}
|
|
33504
|
+
function addColumnIfMissing272(db, table, column, definition) {
|
|
33505
|
+
if (!hasColumn252(db, table, column))
|
|
33506
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
33507
|
+
}
|
|
33508
|
+
function up1382(db) {
|
|
33509
|
+
addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
33510
|
+
db.exec(`
|
|
33511
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
33512
|
+
agent_id TEXT PRIMARY KEY,
|
|
33513
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
33514
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
33515
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
33516
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
33517
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
33518
|
+
oldest_pending_at TEXT,
|
|
33519
|
+
last_error TEXT,
|
|
33520
|
+
last_error_at TEXT
|
|
33521
|
+
);
|
|
33522
|
+
|
|
33523
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
33524
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
33525
|
+
|
|
33526
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
33527
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
33528
|
+
WHERE error IS NOT NULL;
|
|
33529
|
+
|
|
33530
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
33531
|
+
content_hash TEXT PRIMARY KEY,
|
|
33532
|
+
dup_count INTEGER NOT NULL
|
|
33533
|
+
);
|
|
33534
|
+
|
|
33535
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
33536
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
33537
|
+
WHERE dup_count > 1;
|
|
33538
|
+
|
|
33539
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
33540
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
33541
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
33542
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
33543
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
33544
|
+
);
|
|
33545
|
+
|
|
33546
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
33547
|
+
ON memories(content_hash)
|
|
33548
|
+
WHERE is_deleted = 0
|
|
33549
|
+
AND content_hash IS NOT NULL
|
|
33550
|
+
AND pinned = 0
|
|
33551
|
+
AND manual_override = 0;
|
|
33552
|
+
`);
|
|
33553
|
+
db.exec(`
|
|
33554
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
33555
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
33556
|
+
BEGIN
|
|
33557
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
33558
|
+
VALUES (NEW.agent_id)
|
|
33559
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
33560
|
+
|
|
33561
|
+
UPDATE transcript_capture_status
|
|
33562
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
33563
|
+
processing = processing + (NEW.status = 'processing'),
|
|
33564
|
+
completed = completed + (NEW.status = 'completed'),
|
|
33565
|
+
failed = failed + (NEW.status = 'failed'),
|
|
33566
|
+
dead = dead + (NEW.status = 'dead')
|
|
33567
|
+
WHERE agent_id = NEW.agent_id;
|
|
33568
|
+
|
|
33569
|
+
UPDATE transcript_capture_status
|
|
33570
|
+
SET oldest_pending_at = (
|
|
33571
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33572
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
33573
|
+
)
|
|
33574
|
+
WHERE agent_id = NEW.agent_id;
|
|
33575
|
+
|
|
33576
|
+
UPDATE transcript_capture_status
|
|
33577
|
+
SET last_error = (
|
|
33578
|
+
SELECT error FROM transcript_capture_jobs
|
|
33579
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33580
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33581
|
+
),
|
|
33582
|
+
last_error_at = (
|
|
33583
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33584
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33585
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33586
|
+
)
|
|
33587
|
+
WHERE agent_id = NEW.agent_id
|
|
33588
|
+
AND NEW.error IS NOT NULL;
|
|
33589
|
+
END;
|
|
33590
|
+
|
|
33591
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
33592
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
33593
|
+
BEGIN
|
|
33594
|
+
UPDATE transcript_capture_status
|
|
33595
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
33596
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
33597
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
33598
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
33599
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
33600
|
+
WHERE agent_id = NEW.agent_id;
|
|
33601
|
+
|
|
33602
|
+
UPDATE transcript_capture_status
|
|
33603
|
+
SET oldest_pending_at = (
|
|
33604
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33605
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
33606
|
+
)
|
|
33607
|
+
WHERE agent_id = NEW.agent_id;
|
|
33608
|
+
|
|
33609
|
+
UPDATE transcript_capture_status
|
|
33610
|
+
SET last_error = (
|
|
33611
|
+
SELECT error FROM transcript_capture_jobs
|
|
33612
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33613
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33614
|
+
),
|
|
33615
|
+
last_error_at = (
|
|
33616
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33617
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33618
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33619
|
+
)
|
|
33620
|
+
WHERE agent_id = NEW.agent_id
|
|
33621
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
33622
|
+
END;
|
|
33623
|
+
|
|
33624
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
33625
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
33626
|
+
BEGIN
|
|
33627
|
+
UPDATE transcript_capture_status
|
|
33628
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
33629
|
+
processing = processing - (OLD.status = 'processing'),
|
|
33630
|
+
completed = completed - (OLD.status = 'completed'),
|
|
33631
|
+
failed = failed - (OLD.status = 'failed'),
|
|
33632
|
+
dead = dead - (OLD.status = 'dead')
|
|
33633
|
+
WHERE agent_id = OLD.agent_id;
|
|
33634
|
+
|
|
33635
|
+
UPDATE transcript_capture_status
|
|
33636
|
+
SET oldest_pending_at = (
|
|
33637
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33638
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
33639
|
+
)
|
|
33640
|
+
WHERE agent_id = OLD.agent_id;
|
|
33641
|
+
|
|
33642
|
+
UPDATE transcript_capture_status
|
|
33643
|
+
SET last_error = (
|
|
33644
|
+
SELECT error FROM transcript_capture_jobs
|
|
33645
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
33646
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33647
|
+
),
|
|
33648
|
+
last_error_at = (
|
|
33649
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33650
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
33651
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33652
|
+
)
|
|
33653
|
+
WHERE agent_id = OLD.agent_id
|
|
33654
|
+
AND OLD.error IS NOT NULL;
|
|
33655
|
+
END;
|
|
33656
|
+
`);
|
|
33657
|
+
db.exec(`
|
|
33658
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
33659
|
+
AFTER INSERT ON memories
|
|
33660
|
+
BEGIN
|
|
33661
|
+
UPDATE memories_diagnostics_state
|
|
33662
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33663
|
+
exact_duplicates = exact_duplicates + CASE
|
|
33664
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33665
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33666
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
33667
|
+
THEN 1 ELSE 0 END,
|
|
33668
|
+
exact_clusters = exact_clusters + CASE
|
|
33669
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33670
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33671
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
33672
|
+
THEN 1 ELSE 0 END
|
|
33673
|
+
WHERE id = 1;
|
|
33674
|
+
|
|
33675
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33676
|
+
SELECT NEW.content_hash, 1
|
|
33677
|
+
WHERE NEW.is_deleted = 0
|
|
33678
|
+
AND NEW.content_hash IS NOT NULL
|
|
33679
|
+
AND NEW.pinned = 0
|
|
33680
|
+
AND NEW.manual_override = 0
|
|
33681
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
33682
|
+
END;
|
|
33683
|
+
|
|
33684
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
33685
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
33686
|
+
BEGIN
|
|
33687
|
+
UPDATE memories_diagnostics_state
|
|
33688
|
+
SET total_active = total_active
|
|
33689
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
33690
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33691
|
+
exact_duplicates = exact_duplicates - CASE
|
|
33692
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33693
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33694
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
33695
|
+
THEN 1 ELSE 0 END,
|
|
33696
|
+
exact_clusters = exact_clusters - CASE
|
|
33697
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33698
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33699
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
33700
|
+
THEN 1 ELSE 0 END
|
|
33701
|
+
WHERE id = 1;
|
|
33702
|
+
|
|
33703
|
+
UPDATE memories_duplicate_hash_counts
|
|
33704
|
+
SET dup_count = dup_count - 1
|
|
33705
|
+
WHERE OLD.is_deleted = 0
|
|
33706
|
+
AND OLD.content_hash IS NOT NULL
|
|
33707
|
+
AND OLD.pinned = 0
|
|
33708
|
+
AND OLD.manual_override = 0
|
|
33709
|
+
AND content_hash = OLD.content_hash;
|
|
33710
|
+
|
|
33711
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
33712
|
+
WHERE content_hash = OLD.content_hash
|
|
33713
|
+
AND dup_count <= 0;
|
|
33714
|
+
|
|
33715
|
+
UPDATE memories_diagnostics_state
|
|
33716
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
33717
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33718
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33719
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
33720
|
+
THEN 1 ELSE 0 END,
|
|
33721
|
+
exact_clusters = exact_clusters + CASE
|
|
33722
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33723
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33724
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
33725
|
+
THEN 1 ELSE 0 END
|
|
33726
|
+
WHERE id = 1;
|
|
33727
|
+
|
|
33728
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33729
|
+
SELECT NEW.content_hash, 1
|
|
33730
|
+
WHERE NEW.is_deleted = 0
|
|
33731
|
+
AND NEW.content_hash IS NOT NULL
|
|
33732
|
+
AND NEW.pinned = 0
|
|
33733
|
+
AND NEW.manual_override = 0
|
|
33734
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
33735
|
+
END;
|
|
33736
|
+
|
|
33737
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
33738
|
+
AFTER DELETE ON memories
|
|
33739
|
+
BEGIN
|
|
33740
|
+
UPDATE memories_diagnostics_state
|
|
33741
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33742
|
+
exact_duplicates = exact_duplicates - CASE
|
|
33743
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33744
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33745
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
33746
|
+
THEN 1 ELSE 0 END,
|
|
33747
|
+
exact_clusters = exact_clusters - CASE
|
|
33748
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33749
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33750
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
33751
|
+
THEN 1 ELSE 0 END
|
|
33752
|
+
WHERE id = 1;
|
|
33753
|
+
|
|
33754
|
+
UPDATE memories_duplicate_hash_counts
|
|
33755
|
+
SET dup_count = dup_count - 1
|
|
33756
|
+
WHERE OLD.is_deleted = 0
|
|
33757
|
+
AND OLD.content_hash IS NOT NULL
|
|
33758
|
+
AND OLD.pinned = 0
|
|
33759
|
+
AND OLD.manual_override = 0
|
|
33760
|
+
AND content_hash = OLD.content_hash;
|
|
33761
|
+
|
|
33762
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
33763
|
+
WHERE content_hash = OLD.content_hash
|
|
33764
|
+
AND dup_count <= 0;
|
|
33765
|
+
END;
|
|
33766
|
+
`);
|
|
33767
|
+
db.exec(`
|
|
33768
|
+
DELETE FROM transcript_capture_status;
|
|
33769
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
33770
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33771
|
+
SELECT content_hash, COUNT(*)
|
|
33772
|
+
FROM memories
|
|
33773
|
+
WHERE is_deleted = 0
|
|
33774
|
+
AND content_hash IS NOT NULL
|
|
33775
|
+
AND pinned = 0
|
|
33776
|
+
AND manual_override = 0
|
|
33777
|
+
GROUP BY content_hash;
|
|
33778
|
+
|
|
33779
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
33780
|
+
VALUES (
|
|
33781
|
+
1,
|
|
33782
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
33783
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
33784
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
33785
|
+
)
|
|
33786
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
33787
|
+
total_active = excluded.total_active,
|
|
33788
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
33789
|
+
exact_clusters = excluded.exact_clusters;
|
|
33790
|
+
|
|
33791
|
+
INSERT INTO transcript_capture_status (
|
|
33792
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
33793
|
+
oldest_pending_at, last_error, last_error_at
|
|
33794
|
+
)
|
|
33795
|
+
SELECT
|
|
33796
|
+
j.agent_id,
|
|
33797
|
+
SUM(j.status = 'pending'),
|
|
33798
|
+
SUM(j.status = 'processing'),
|
|
33799
|
+
SUM(j.status = 'completed'),
|
|
33800
|
+
SUM(j.status = 'failed'),
|
|
33801
|
+
SUM(j.status = 'dead'),
|
|
33802
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
33803
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
33804
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
33805
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
33806
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
33807
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
33808
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
33809
|
+
FROM transcript_capture_jobs j
|
|
33810
|
+
GROUP BY j.agent_id;
|
|
33811
|
+
`);
|
|
33812
|
+
}
|
|
33179
33813
|
var MIGRATIONS2 = [
|
|
33180
33814
|
{
|
|
33181
33815
|
version: 1,
|
|
33182
33816
|
name: "baseline",
|
|
33183
|
-
up:
|
|
33817
|
+
up: up139,
|
|
33184
33818
|
artifacts: { tables: ["memories", "conversations", "embeddings"] }
|
|
33185
33819
|
},
|
|
33186
33820
|
{
|
|
@@ -33258,7 +33892,7 @@ var MIGRATIONS2 = [
|
|
|
33258
33892
|
{
|
|
33259
33893
|
version: 13,
|
|
33260
33894
|
name: "ingestion-tracking",
|
|
33261
|
-
up:
|
|
33895
|
+
up: up1310,
|
|
33262
33896
|
artifacts: {
|
|
33263
33897
|
columns: [
|
|
33264
33898
|
{ table: "memories", column: "source_path" },
|
|
@@ -34265,6 +34899,14 @@ var MIGRATIONS2 = [
|
|
|
34265
34899
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
34266
34900
|
]
|
|
34267
34901
|
}
|
|
34902
|
+
},
|
|
34903
|
+
{
|
|
34904
|
+
version: 138,
|
|
34905
|
+
name: "bounded-status-projections",
|
|
34906
|
+
up: up1382,
|
|
34907
|
+
artifacts: {
|
|
34908
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
34909
|
+
}
|
|
34268
34910
|
}
|
|
34269
34911
|
];
|
|
34270
34912
|
var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-gemini",
|
|
3
|
-
"version": "0.211.
|
|
3
|
+
"version": "0.211.20",
|
|
4
4
|
"description": "Signet connector for Gemini CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typecheck": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@signetai/connector-base": "0.211.
|
|
28
|
-
"@signetai/core": "0.211.
|
|
27
|
+
"@signetai/connector-base": "0.211.20",
|
|
28
|
+
"@signetai/core": "0.211.20"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|