@signetai/connector-openclaw 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
|
@@ -15732,6 +15732,319 @@ function up137(db) {
|
|
|
15732
15732
|
if (!cols.has(name))
|
|
15733
15733
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
15734
15734
|
}
|
|
15735
|
+
function hasColumn25(db, table, column) {
|
|
15736
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
15737
|
+
return rows.some((row) => row.name === column);
|
|
15738
|
+
}
|
|
15739
|
+
function addColumnIfMissing27(db, table, column, definition) {
|
|
15740
|
+
if (!hasColumn25(db, table, column))
|
|
15741
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
15742
|
+
}
|
|
15743
|
+
function up138(db) {
|
|
15744
|
+
addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
15745
|
+
db.exec(`
|
|
15746
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
15747
|
+
agent_id TEXT PRIMARY KEY,
|
|
15748
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
15749
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
15750
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
15751
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
15752
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
15753
|
+
oldest_pending_at TEXT,
|
|
15754
|
+
last_error TEXT,
|
|
15755
|
+
last_error_at TEXT
|
|
15756
|
+
);
|
|
15757
|
+
|
|
15758
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
15759
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
15760
|
+
|
|
15761
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
15762
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
15763
|
+
WHERE error IS NOT NULL;
|
|
15764
|
+
|
|
15765
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
15766
|
+
content_hash TEXT PRIMARY KEY,
|
|
15767
|
+
dup_count INTEGER NOT NULL
|
|
15768
|
+
);
|
|
15769
|
+
|
|
15770
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
15771
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
15772
|
+
WHERE dup_count > 1;
|
|
15773
|
+
|
|
15774
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
15775
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
15776
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
15777
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
15778
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
15779
|
+
);
|
|
15780
|
+
|
|
15781
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
15782
|
+
ON memories(content_hash)
|
|
15783
|
+
WHERE is_deleted = 0
|
|
15784
|
+
AND content_hash IS NOT NULL
|
|
15785
|
+
AND pinned = 0
|
|
15786
|
+
AND manual_override = 0;
|
|
15787
|
+
`);
|
|
15788
|
+
db.exec(`
|
|
15789
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
15790
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
15791
|
+
BEGIN
|
|
15792
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
15793
|
+
VALUES (NEW.agent_id)
|
|
15794
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
15795
|
+
|
|
15796
|
+
UPDATE transcript_capture_status
|
|
15797
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
15798
|
+
processing = processing + (NEW.status = 'processing'),
|
|
15799
|
+
completed = completed + (NEW.status = 'completed'),
|
|
15800
|
+
failed = failed + (NEW.status = 'failed'),
|
|
15801
|
+
dead = dead + (NEW.status = 'dead')
|
|
15802
|
+
WHERE agent_id = NEW.agent_id;
|
|
15803
|
+
|
|
15804
|
+
UPDATE transcript_capture_status
|
|
15805
|
+
SET oldest_pending_at = (
|
|
15806
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15807
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15808
|
+
)
|
|
15809
|
+
WHERE agent_id = NEW.agent_id;
|
|
15810
|
+
|
|
15811
|
+
UPDATE transcript_capture_status
|
|
15812
|
+
SET last_error = (
|
|
15813
|
+
SELECT error FROM transcript_capture_jobs
|
|
15814
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15815
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15816
|
+
),
|
|
15817
|
+
last_error_at = (
|
|
15818
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15819
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15820
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15821
|
+
)
|
|
15822
|
+
WHERE agent_id = NEW.agent_id
|
|
15823
|
+
AND NEW.error IS NOT NULL;
|
|
15824
|
+
END;
|
|
15825
|
+
|
|
15826
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
15827
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
15828
|
+
BEGIN
|
|
15829
|
+
UPDATE transcript_capture_status
|
|
15830
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
15831
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
15832
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
15833
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
15834
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
15835
|
+
WHERE agent_id = NEW.agent_id;
|
|
15836
|
+
|
|
15837
|
+
UPDATE transcript_capture_status
|
|
15838
|
+
SET oldest_pending_at = (
|
|
15839
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15840
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15841
|
+
)
|
|
15842
|
+
WHERE agent_id = NEW.agent_id;
|
|
15843
|
+
|
|
15844
|
+
UPDATE transcript_capture_status
|
|
15845
|
+
SET last_error = (
|
|
15846
|
+
SELECT error FROM transcript_capture_jobs
|
|
15847
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15848
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15849
|
+
),
|
|
15850
|
+
last_error_at = (
|
|
15851
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15852
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15853
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15854
|
+
)
|
|
15855
|
+
WHERE agent_id = NEW.agent_id
|
|
15856
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
15857
|
+
END;
|
|
15858
|
+
|
|
15859
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
15860
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
15861
|
+
BEGIN
|
|
15862
|
+
UPDATE transcript_capture_status
|
|
15863
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
15864
|
+
processing = processing - (OLD.status = 'processing'),
|
|
15865
|
+
completed = completed - (OLD.status = 'completed'),
|
|
15866
|
+
failed = failed - (OLD.status = 'failed'),
|
|
15867
|
+
dead = dead - (OLD.status = 'dead')
|
|
15868
|
+
WHERE agent_id = OLD.agent_id;
|
|
15869
|
+
|
|
15870
|
+
UPDATE transcript_capture_status
|
|
15871
|
+
SET oldest_pending_at = (
|
|
15872
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15873
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
15874
|
+
)
|
|
15875
|
+
WHERE agent_id = OLD.agent_id;
|
|
15876
|
+
|
|
15877
|
+
UPDATE transcript_capture_status
|
|
15878
|
+
SET last_error = (
|
|
15879
|
+
SELECT error FROM transcript_capture_jobs
|
|
15880
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15881
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15882
|
+
),
|
|
15883
|
+
last_error_at = (
|
|
15884
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15885
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15886
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15887
|
+
)
|
|
15888
|
+
WHERE agent_id = OLD.agent_id
|
|
15889
|
+
AND OLD.error IS NOT NULL;
|
|
15890
|
+
END;
|
|
15891
|
+
`);
|
|
15892
|
+
db.exec(`
|
|
15893
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
15894
|
+
AFTER INSERT ON memories
|
|
15895
|
+
BEGIN
|
|
15896
|
+
UPDATE memories_diagnostics_state
|
|
15897
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15898
|
+
exact_duplicates = exact_duplicates + CASE
|
|
15899
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15900
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15901
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15902
|
+
THEN 1 ELSE 0 END,
|
|
15903
|
+
exact_clusters = exact_clusters + CASE
|
|
15904
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15905
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15906
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15907
|
+
THEN 1 ELSE 0 END
|
|
15908
|
+
WHERE id = 1;
|
|
15909
|
+
|
|
15910
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15911
|
+
SELECT NEW.content_hash, 1
|
|
15912
|
+
WHERE NEW.is_deleted = 0
|
|
15913
|
+
AND NEW.content_hash IS NOT NULL
|
|
15914
|
+
AND NEW.pinned = 0
|
|
15915
|
+
AND NEW.manual_override = 0
|
|
15916
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15917
|
+
END;
|
|
15918
|
+
|
|
15919
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
15920
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
15921
|
+
BEGIN
|
|
15922
|
+
UPDATE memories_diagnostics_state
|
|
15923
|
+
SET total_active = total_active
|
|
15924
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
15925
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15926
|
+
exact_duplicates = exact_duplicates - CASE
|
|
15927
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15928
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15929
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
15930
|
+
THEN 1 ELSE 0 END,
|
|
15931
|
+
exact_clusters = exact_clusters - CASE
|
|
15932
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15933
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15934
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
15935
|
+
THEN 1 ELSE 0 END
|
|
15936
|
+
WHERE id = 1;
|
|
15937
|
+
|
|
15938
|
+
UPDATE memories_duplicate_hash_counts
|
|
15939
|
+
SET dup_count = dup_count - 1
|
|
15940
|
+
WHERE OLD.is_deleted = 0
|
|
15941
|
+
AND OLD.content_hash IS NOT NULL
|
|
15942
|
+
AND OLD.pinned = 0
|
|
15943
|
+
AND OLD.manual_override = 0
|
|
15944
|
+
AND content_hash = OLD.content_hash;
|
|
15945
|
+
|
|
15946
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
15947
|
+
WHERE content_hash = OLD.content_hash
|
|
15948
|
+
AND dup_count <= 0;
|
|
15949
|
+
|
|
15950
|
+
UPDATE memories_diagnostics_state
|
|
15951
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
15952
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15953
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15954
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15955
|
+
THEN 1 ELSE 0 END,
|
|
15956
|
+
exact_clusters = exact_clusters + CASE
|
|
15957
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15958
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15959
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15960
|
+
THEN 1 ELSE 0 END
|
|
15961
|
+
WHERE id = 1;
|
|
15962
|
+
|
|
15963
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15964
|
+
SELECT NEW.content_hash, 1
|
|
15965
|
+
WHERE NEW.is_deleted = 0
|
|
15966
|
+
AND NEW.content_hash IS NOT NULL
|
|
15967
|
+
AND NEW.pinned = 0
|
|
15968
|
+
AND NEW.manual_override = 0
|
|
15969
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15970
|
+
END;
|
|
15971
|
+
|
|
15972
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
15973
|
+
AFTER DELETE ON memories
|
|
15974
|
+
BEGIN
|
|
15975
|
+
UPDATE memories_diagnostics_state
|
|
15976
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15977
|
+
exact_duplicates = exact_duplicates - CASE
|
|
15978
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15979
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15980
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
15981
|
+
THEN 1 ELSE 0 END,
|
|
15982
|
+
exact_clusters = exact_clusters - CASE
|
|
15983
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15984
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15985
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
15986
|
+
THEN 1 ELSE 0 END
|
|
15987
|
+
WHERE id = 1;
|
|
15988
|
+
|
|
15989
|
+
UPDATE memories_duplicate_hash_counts
|
|
15990
|
+
SET dup_count = dup_count - 1
|
|
15991
|
+
WHERE OLD.is_deleted = 0
|
|
15992
|
+
AND OLD.content_hash IS NOT NULL
|
|
15993
|
+
AND OLD.pinned = 0
|
|
15994
|
+
AND OLD.manual_override = 0
|
|
15995
|
+
AND content_hash = OLD.content_hash;
|
|
15996
|
+
|
|
15997
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
15998
|
+
WHERE content_hash = OLD.content_hash
|
|
15999
|
+
AND dup_count <= 0;
|
|
16000
|
+
END;
|
|
16001
|
+
`);
|
|
16002
|
+
db.exec(`
|
|
16003
|
+
DELETE FROM transcript_capture_status;
|
|
16004
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
16005
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
16006
|
+
SELECT content_hash, COUNT(*)
|
|
16007
|
+
FROM memories
|
|
16008
|
+
WHERE is_deleted = 0
|
|
16009
|
+
AND content_hash IS NOT NULL
|
|
16010
|
+
AND pinned = 0
|
|
16011
|
+
AND manual_override = 0
|
|
16012
|
+
GROUP BY content_hash;
|
|
16013
|
+
|
|
16014
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
16015
|
+
VALUES (
|
|
16016
|
+
1,
|
|
16017
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
16018
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
16019
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
16020
|
+
)
|
|
16021
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
16022
|
+
total_active = excluded.total_active,
|
|
16023
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
16024
|
+
exact_clusters = excluded.exact_clusters;
|
|
16025
|
+
|
|
16026
|
+
INSERT INTO transcript_capture_status (
|
|
16027
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
16028
|
+
oldest_pending_at, last_error, last_error_at
|
|
16029
|
+
)
|
|
16030
|
+
SELECT
|
|
16031
|
+
j.agent_id,
|
|
16032
|
+
SUM(j.status = 'pending'),
|
|
16033
|
+
SUM(j.status = 'processing'),
|
|
16034
|
+
SUM(j.status = 'completed'),
|
|
16035
|
+
SUM(j.status = 'failed'),
|
|
16036
|
+
SUM(j.status = 'dead'),
|
|
16037
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
16038
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
16039
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
16040
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
16041
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
16042
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
16043
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
16044
|
+
FROM transcript_capture_jobs j
|
|
16045
|
+
GROUP BY j.agent_id;
|
|
16046
|
+
`);
|
|
16047
|
+
}
|
|
15735
16048
|
var MIGRATIONS = [
|
|
15736
16049
|
{
|
|
15737
16050
|
version: 1,
|
|
@@ -16821,6 +17134,14 @@ var MIGRATIONS = [
|
|
|
16821
17134
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
16822
17135
|
]
|
|
16823
17136
|
}
|
|
17137
|
+
},
|
|
17138
|
+
{
|
|
17139
|
+
version: 138,
|
|
17140
|
+
name: "bounded-status-projections",
|
|
17141
|
+
up: up138,
|
|
17142
|
+
artifacts: {
|
|
17143
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
17144
|
+
}
|
|
16824
17145
|
}
|
|
16825
17146
|
];
|
|
16826
17147
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -30663,7 +30984,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
|
30663
30984
|
return true;
|
|
30664
30985
|
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
30665
30986
|
}
|
|
30666
|
-
function
|
|
30987
|
+
function up139(db) {
|
|
30667
30988
|
db.exec(`
|
|
30668
30989
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
30669
30990
|
version INTEGER PRIMARY KEY,
|
|
@@ -30752,31 +31073,31 @@ function up138(db) {
|
|
|
30752
31073
|
} catch {}
|
|
30753
31074
|
createMemoriesFts2(db);
|
|
30754
31075
|
}
|
|
30755
|
-
function
|
|
31076
|
+
function hasColumn26(db, table, column) {
|
|
30756
31077
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
30757
31078
|
return rows.some((r3) => r3.name === column);
|
|
30758
31079
|
}
|
|
30759
|
-
function
|
|
30760
|
-
if (!
|
|
31080
|
+
function addColumnIfMissing28(db, table, column, definition) {
|
|
31081
|
+
if (!hasColumn26(db, table, column)) {
|
|
30761
31082
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
30762
31083
|
}
|
|
30763
31084
|
}
|
|
30764
31085
|
function up210(db) {
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
|
|
30770
|
-
|
|
30771
|
-
|
|
30772
|
-
|
|
30773
|
-
|
|
30774
|
-
|
|
30775
|
-
|
|
30776
|
-
|
|
30777
|
-
|
|
30778
|
-
|
|
30779
|
-
|
|
31086
|
+
addColumnIfMissing28(db, "memories", "content_hash", "TEXT");
|
|
31087
|
+
addColumnIfMissing28(db, "memories", "normalized_content", "TEXT");
|
|
31088
|
+
addColumnIfMissing28(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
|
|
31089
|
+
addColumnIfMissing28(db, "memories", "deleted_at", "TEXT");
|
|
31090
|
+
addColumnIfMissing28(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
|
|
31091
|
+
addColumnIfMissing28(db, "memories", "embedding_model", "TEXT");
|
|
31092
|
+
addColumnIfMissing28(db, "memories", "extraction_model", "TEXT");
|
|
31093
|
+
addColumnIfMissing28(db, "memories", "update_count", "INTEGER DEFAULT 0");
|
|
31094
|
+
addColumnIfMissing28(db, "memories", "who", "TEXT");
|
|
31095
|
+
addColumnIfMissing28(db, "memories", "why", "TEXT");
|
|
31096
|
+
addColumnIfMissing28(db, "memories", "project", "TEXT");
|
|
31097
|
+
addColumnIfMissing28(db, "memories", "pinned", "INTEGER DEFAULT 0");
|
|
31098
|
+
addColumnIfMissing28(db, "memories", "importance", "REAL DEFAULT 0.5");
|
|
31099
|
+
addColumnIfMissing28(db, "memories", "last_accessed", "TEXT");
|
|
31100
|
+
addColumnIfMissing28(db, "memories", "access_count", "INTEGER DEFAULT 0");
|
|
30780
31101
|
db.exec(`
|
|
30781
31102
|
CREATE TABLE IF NOT EXISTS memory_history (
|
|
30782
31103
|
id TEXT PRIMARY KEY,
|
|
@@ -30872,7 +31193,7 @@ function up210(db) {
|
|
|
30872
31193
|
ON memory_entity_mentions(entity_id);
|
|
30873
31194
|
`);
|
|
30874
31195
|
}
|
|
30875
|
-
function
|
|
31196
|
+
function addColumnIfMissing29(db, table, column, definition) {
|
|
30876
31197
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
30877
31198
|
if (rows.some((r3) => r3.name === column))
|
|
30878
31199
|
return false;
|
|
@@ -30880,8 +31201,8 @@ function addColumnIfMissing28(db, table, column, definition) {
|
|
|
30880
31201
|
return true;
|
|
30881
31202
|
}
|
|
30882
31203
|
function up310(db) {
|
|
30883
|
-
|
|
30884
|
-
|
|
31204
|
+
addColumnIfMissing29(db, "memories", "why", "TEXT");
|
|
31205
|
+
addColumnIfMissing29(db, "memories", "project", "TEXT");
|
|
30885
31206
|
db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
|
|
30886
31207
|
db.exec(`
|
|
30887
31208
|
UPDATE memories
|
|
@@ -30907,12 +31228,12 @@ function up310(db) {
|
|
|
30907
31228
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
30908
31229
|
`);
|
|
30909
31230
|
}
|
|
30910
|
-
function
|
|
31231
|
+
function hasColumn27(db, table, column) {
|
|
30911
31232
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
30912
31233
|
return rows.some((r3) => r3.name === column);
|
|
30913
31234
|
}
|
|
30914
31235
|
function addColumnIfMissing32(db, table, column, definition) {
|
|
30915
|
-
if (!
|
|
31236
|
+
if (!hasColumn27(db, table, column)) {
|
|
30916
31237
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
30917
31238
|
}
|
|
30918
31239
|
}
|
|
@@ -31147,7 +31468,7 @@ function addColumnIfMissing52(db, table, column, definition) {
|
|
|
31147
31468
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
31148
31469
|
}
|
|
31149
31470
|
}
|
|
31150
|
-
function
|
|
31471
|
+
function up1310(db) {
|
|
31151
31472
|
db.exec(`
|
|
31152
31473
|
CREATE TABLE IF NOT EXISTS ingestion_jobs (
|
|
31153
31474
|
id TEXT PRIMARY KEY,
|
|
@@ -35016,11 +35337,324 @@ function up1372(db) {
|
|
|
35016
35337
|
if (!cols.has(name))
|
|
35017
35338
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
35018
35339
|
}
|
|
35340
|
+
function hasColumn252(db, table, column) {
|
|
35341
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
35342
|
+
return rows.some((row) => row.name === column);
|
|
35343
|
+
}
|
|
35344
|
+
function addColumnIfMissing272(db, table, column, definition) {
|
|
35345
|
+
if (!hasColumn252(db, table, column))
|
|
35346
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
35347
|
+
}
|
|
35348
|
+
function up1382(db) {
|
|
35349
|
+
addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
35350
|
+
db.exec(`
|
|
35351
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
35352
|
+
agent_id TEXT PRIMARY KEY,
|
|
35353
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
35354
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
35355
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
35356
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
35357
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
35358
|
+
oldest_pending_at TEXT,
|
|
35359
|
+
last_error TEXT,
|
|
35360
|
+
last_error_at TEXT
|
|
35361
|
+
);
|
|
35362
|
+
|
|
35363
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
35364
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
35365
|
+
|
|
35366
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
35367
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
35368
|
+
WHERE error IS NOT NULL;
|
|
35369
|
+
|
|
35370
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
35371
|
+
content_hash TEXT PRIMARY KEY,
|
|
35372
|
+
dup_count INTEGER NOT NULL
|
|
35373
|
+
);
|
|
35374
|
+
|
|
35375
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
35376
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
35377
|
+
WHERE dup_count > 1;
|
|
35378
|
+
|
|
35379
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
35380
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
35381
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
35382
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
35383
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
35384
|
+
);
|
|
35385
|
+
|
|
35386
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
35387
|
+
ON memories(content_hash)
|
|
35388
|
+
WHERE is_deleted = 0
|
|
35389
|
+
AND content_hash IS NOT NULL
|
|
35390
|
+
AND pinned = 0
|
|
35391
|
+
AND manual_override = 0;
|
|
35392
|
+
`);
|
|
35393
|
+
db.exec(`
|
|
35394
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
35395
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
35396
|
+
BEGIN
|
|
35397
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
35398
|
+
VALUES (NEW.agent_id)
|
|
35399
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
35400
|
+
|
|
35401
|
+
UPDATE transcript_capture_status
|
|
35402
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
35403
|
+
processing = processing + (NEW.status = 'processing'),
|
|
35404
|
+
completed = completed + (NEW.status = 'completed'),
|
|
35405
|
+
failed = failed + (NEW.status = 'failed'),
|
|
35406
|
+
dead = dead + (NEW.status = 'dead')
|
|
35407
|
+
WHERE agent_id = NEW.agent_id;
|
|
35408
|
+
|
|
35409
|
+
UPDATE transcript_capture_status
|
|
35410
|
+
SET oldest_pending_at = (
|
|
35411
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
35412
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
35413
|
+
)
|
|
35414
|
+
WHERE agent_id = NEW.agent_id;
|
|
35415
|
+
|
|
35416
|
+
UPDATE transcript_capture_status
|
|
35417
|
+
SET last_error = (
|
|
35418
|
+
SELECT error FROM transcript_capture_jobs
|
|
35419
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
35420
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35421
|
+
),
|
|
35422
|
+
last_error_at = (
|
|
35423
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
35424
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
35425
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35426
|
+
)
|
|
35427
|
+
WHERE agent_id = NEW.agent_id
|
|
35428
|
+
AND NEW.error IS NOT NULL;
|
|
35429
|
+
END;
|
|
35430
|
+
|
|
35431
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
35432
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
35433
|
+
BEGIN
|
|
35434
|
+
UPDATE transcript_capture_status
|
|
35435
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
35436
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
35437
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
35438
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
35439
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
35440
|
+
WHERE agent_id = NEW.agent_id;
|
|
35441
|
+
|
|
35442
|
+
UPDATE transcript_capture_status
|
|
35443
|
+
SET oldest_pending_at = (
|
|
35444
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
35445
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
35446
|
+
)
|
|
35447
|
+
WHERE agent_id = NEW.agent_id;
|
|
35448
|
+
|
|
35449
|
+
UPDATE transcript_capture_status
|
|
35450
|
+
SET last_error = (
|
|
35451
|
+
SELECT error FROM transcript_capture_jobs
|
|
35452
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
35453
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35454
|
+
),
|
|
35455
|
+
last_error_at = (
|
|
35456
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
35457
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
35458
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35459
|
+
)
|
|
35460
|
+
WHERE agent_id = NEW.agent_id
|
|
35461
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
35462
|
+
END;
|
|
35463
|
+
|
|
35464
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
35465
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
35466
|
+
BEGIN
|
|
35467
|
+
UPDATE transcript_capture_status
|
|
35468
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
35469
|
+
processing = processing - (OLD.status = 'processing'),
|
|
35470
|
+
completed = completed - (OLD.status = 'completed'),
|
|
35471
|
+
failed = failed - (OLD.status = 'failed'),
|
|
35472
|
+
dead = dead - (OLD.status = 'dead')
|
|
35473
|
+
WHERE agent_id = OLD.agent_id;
|
|
35474
|
+
|
|
35475
|
+
UPDATE transcript_capture_status
|
|
35476
|
+
SET oldest_pending_at = (
|
|
35477
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
35478
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
35479
|
+
)
|
|
35480
|
+
WHERE agent_id = OLD.agent_id;
|
|
35481
|
+
|
|
35482
|
+
UPDATE transcript_capture_status
|
|
35483
|
+
SET last_error = (
|
|
35484
|
+
SELECT error FROM transcript_capture_jobs
|
|
35485
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
35486
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35487
|
+
),
|
|
35488
|
+
last_error_at = (
|
|
35489
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
35490
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
35491
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
35492
|
+
)
|
|
35493
|
+
WHERE agent_id = OLD.agent_id
|
|
35494
|
+
AND OLD.error IS NOT NULL;
|
|
35495
|
+
END;
|
|
35496
|
+
`);
|
|
35497
|
+
db.exec(`
|
|
35498
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
35499
|
+
AFTER INSERT ON memories
|
|
35500
|
+
BEGIN
|
|
35501
|
+
UPDATE memories_diagnostics_state
|
|
35502
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
35503
|
+
exact_duplicates = exact_duplicates + CASE
|
|
35504
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
35505
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
35506
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
35507
|
+
THEN 1 ELSE 0 END,
|
|
35508
|
+
exact_clusters = exact_clusters + CASE
|
|
35509
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
35510
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
35511
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
35512
|
+
THEN 1 ELSE 0 END
|
|
35513
|
+
WHERE id = 1;
|
|
35514
|
+
|
|
35515
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
35516
|
+
SELECT NEW.content_hash, 1
|
|
35517
|
+
WHERE NEW.is_deleted = 0
|
|
35518
|
+
AND NEW.content_hash IS NOT NULL
|
|
35519
|
+
AND NEW.pinned = 0
|
|
35520
|
+
AND NEW.manual_override = 0
|
|
35521
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
35522
|
+
END;
|
|
35523
|
+
|
|
35524
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
35525
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
35526
|
+
BEGIN
|
|
35527
|
+
UPDATE memories_diagnostics_state
|
|
35528
|
+
SET total_active = total_active
|
|
35529
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
35530
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
35531
|
+
exact_duplicates = exact_duplicates - CASE
|
|
35532
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
35533
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
35534
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
35535
|
+
THEN 1 ELSE 0 END,
|
|
35536
|
+
exact_clusters = exact_clusters - CASE
|
|
35537
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
35538
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
35539
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
35540
|
+
THEN 1 ELSE 0 END
|
|
35541
|
+
WHERE id = 1;
|
|
35542
|
+
|
|
35543
|
+
UPDATE memories_duplicate_hash_counts
|
|
35544
|
+
SET dup_count = dup_count - 1
|
|
35545
|
+
WHERE OLD.is_deleted = 0
|
|
35546
|
+
AND OLD.content_hash IS NOT NULL
|
|
35547
|
+
AND OLD.pinned = 0
|
|
35548
|
+
AND OLD.manual_override = 0
|
|
35549
|
+
AND content_hash = OLD.content_hash;
|
|
35550
|
+
|
|
35551
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
35552
|
+
WHERE content_hash = OLD.content_hash
|
|
35553
|
+
AND dup_count <= 0;
|
|
35554
|
+
|
|
35555
|
+
UPDATE memories_diagnostics_state
|
|
35556
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
35557
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
35558
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
35559
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
35560
|
+
THEN 1 ELSE 0 END,
|
|
35561
|
+
exact_clusters = exact_clusters + CASE
|
|
35562
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
35563
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
35564
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
35565
|
+
THEN 1 ELSE 0 END
|
|
35566
|
+
WHERE id = 1;
|
|
35567
|
+
|
|
35568
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
35569
|
+
SELECT NEW.content_hash, 1
|
|
35570
|
+
WHERE NEW.is_deleted = 0
|
|
35571
|
+
AND NEW.content_hash IS NOT NULL
|
|
35572
|
+
AND NEW.pinned = 0
|
|
35573
|
+
AND NEW.manual_override = 0
|
|
35574
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
35575
|
+
END;
|
|
35576
|
+
|
|
35577
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
35578
|
+
AFTER DELETE ON memories
|
|
35579
|
+
BEGIN
|
|
35580
|
+
UPDATE memories_diagnostics_state
|
|
35581
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
35582
|
+
exact_duplicates = exact_duplicates - CASE
|
|
35583
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
35584
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
35585
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
35586
|
+
THEN 1 ELSE 0 END,
|
|
35587
|
+
exact_clusters = exact_clusters - CASE
|
|
35588
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
35589
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
35590
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
35591
|
+
THEN 1 ELSE 0 END
|
|
35592
|
+
WHERE id = 1;
|
|
35593
|
+
|
|
35594
|
+
UPDATE memories_duplicate_hash_counts
|
|
35595
|
+
SET dup_count = dup_count - 1
|
|
35596
|
+
WHERE OLD.is_deleted = 0
|
|
35597
|
+
AND OLD.content_hash IS NOT NULL
|
|
35598
|
+
AND OLD.pinned = 0
|
|
35599
|
+
AND OLD.manual_override = 0
|
|
35600
|
+
AND content_hash = OLD.content_hash;
|
|
35601
|
+
|
|
35602
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
35603
|
+
WHERE content_hash = OLD.content_hash
|
|
35604
|
+
AND dup_count <= 0;
|
|
35605
|
+
END;
|
|
35606
|
+
`);
|
|
35607
|
+
db.exec(`
|
|
35608
|
+
DELETE FROM transcript_capture_status;
|
|
35609
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
35610
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
35611
|
+
SELECT content_hash, COUNT(*)
|
|
35612
|
+
FROM memories
|
|
35613
|
+
WHERE is_deleted = 0
|
|
35614
|
+
AND content_hash IS NOT NULL
|
|
35615
|
+
AND pinned = 0
|
|
35616
|
+
AND manual_override = 0
|
|
35617
|
+
GROUP BY content_hash;
|
|
35618
|
+
|
|
35619
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
35620
|
+
VALUES (
|
|
35621
|
+
1,
|
|
35622
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
35623
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
35624
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
35625
|
+
)
|
|
35626
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
35627
|
+
total_active = excluded.total_active,
|
|
35628
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
35629
|
+
exact_clusters = excluded.exact_clusters;
|
|
35630
|
+
|
|
35631
|
+
INSERT INTO transcript_capture_status (
|
|
35632
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
35633
|
+
oldest_pending_at, last_error, last_error_at
|
|
35634
|
+
)
|
|
35635
|
+
SELECT
|
|
35636
|
+
j.agent_id,
|
|
35637
|
+
SUM(j.status = 'pending'),
|
|
35638
|
+
SUM(j.status = 'processing'),
|
|
35639
|
+
SUM(j.status = 'completed'),
|
|
35640
|
+
SUM(j.status = 'failed'),
|
|
35641
|
+
SUM(j.status = 'dead'),
|
|
35642
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
35643
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
35644
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
35645
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
35646
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
35647
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
35648
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
35649
|
+
FROM transcript_capture_jobs j
|
|
35650
|
+
GROUP BY j.agent_id;
|
|
35651
|
+
`);
|
|
35652
|
+
}
|
|
35019
35653
|
var MIGRATIONS2 = [
|
|
35020
35654
|
{
|
|
35021
35655
|
version: 1,
|
|
35022
35656
|
name: "baseline",
|
|
35023
|
-
up:
|
|
35657
|
+
up: up139,
|
|
35024
35658
|
artifacts: { tables: ["memories", "conversations", "embeddings"] }
|
|
35025
35659
|
},
|
|
35026
35660
|
{
|
|
@@ -35098,7 +35732,7 @@ var MIGRATIONS2 = [
|
|
|
35098
35732
|
{
|
|
35099
35733
|
version: 13,
|
|
35100
35734
|
name: "ingestion-tracking",
|
|
35101
|
-
up:
|
|
35735
|
+
up: up1310,
|
|
35102
35736
|
artifacts: {
|
|
35103
35737
|
columns: [
|
|
35104
35738
|
{ table: "memories", column: "source_path" },
|
|
@@ -36105,6 +36739,14 @@ var MIGRATIONS2 = [
|
|
|
36105
36739
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
36106
36740
|
]
|
|
36107
36741
|
}
|
|
36742
|
+
},
|
|
36743
|
+
{
|
|
36744
|
+
version: 138,
|
|
36745
|
+
name: "bounded-status-projections",
|
|
36746
|
+
up: up1382,
|
|
36747
|
+
artifacts: {
|
|
36748
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
36749
|
+
}
|
|
36108
36750
|
}
|
|
36109
36751
|
];
|
|
36110
36752
|
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-openclaw",
|
|
3
|
-
"version": "0.211.
|
|
3
|
+
"version": "0.211.20",
|
|
4
4
|
"description": "Signet connector for OpenClaw - configures workspace and memory hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"test": "bun test"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@signetai/connector-base": "0.211.
|
|
29
|
-
"@signetai/core": "0.211.
|
|
28
|
+
"@signetai/connector-base": "0.211.20",
|
|
29
|
+
"@signetai/core": "0.211.20"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|