@signetai/connector-claude-code 0.211.16 → 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
|
@@ -15733,6 +15733,319 @@ function up137(db) {
|
|
|
15733
15733
|
if (!cols.has(name))
|
|
15734
15734
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
15735
15735
|
}
|
|
15736
|
+
function hasColumn25(db, table, column) {
|
|
15737
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
15738
|
+
return rows.some((row) => row.name === column);
|
|
15739
|
+
}
|
|
15740
|
+
function addColumnIfMissing27(db, table, column, definition) {
|
|
15741
|
+
if (!hasColumn25(db, table, column))
|
|
15742
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
15743
|
+
}
|
|
15744
|
+
function up138(db) {
|
|
15745
|
+
addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
15746
|
+
db.exec(`
|
|
15747
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
15748
|
+
agent_id TEXT PRIMARY KEY,
|
|
15749
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
15750
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
15751
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
15752
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
15753
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
15754
|
+
oldest_pending_at TEXT,
|
|
15755
|
+
last_error TEXT,
|
|
15756
|
+
last_error_at TEXT
|
|
15757
|
+
);
|
|
15758
|
+
|
|
15759
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
15760
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
15761
|
+
|
|
15762
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
15763
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
15764
|
+
WHERE error IS NOT NULL;
|
|
15765
|
+
|
|
15766
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
15767
|
+
content_hash TEXT PRIMARY KEY,
|
|
15768
|
+
dup_count INTEGER NOT NULL
|
|
15769
|
+
);
|
|
15770
|
+
|
|
15771
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
15772
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
15773
|
+
WHERE dup_count > 1;
|
|
15774
|
+
|
|
15775
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
15776
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
15777
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
15778
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
15779
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
15780
|
+
);
|
|
15781
|
+
|
|
15782
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
15783
|
+
ON memories(content_hash)
|
|
15784
|
+
WHERE is_deleted = 0
|
|
15785
|
+
AND content_hash IS NOT NULL
|
|
15786
|
+
AND pinned = 0
|
|
15787
|
+
AND manual_override = 0;
|
|
15788
|
+
`);
|
|
15789
|
+
db.exec(`
|
|
15790
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
15791
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
15792
|
+
BEGIN
|
|
15793
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
15794
|
+
VALUES (NEW.agent_id)
|
|
15795
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
15796
|
+
|
|
15797
|
+
UPDATE transcript_capture_status
|
|
15798
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
15799
|
+
processing = processing + (NEW.status = 'processing'),
|
|
15800
|
+
completed = completed + (NEW.status = 'completed'),
|
|
15801
|
+
failed = failed + (NEW.status = 'failed'),
|
|
15802
|
+
dead = dead + (NEW.status = 'dead')
|
|
15803
|
+
WHERE agent_id = NEW.agent_id;
|
|
15804
|
+
|
|
15805
|
+
UPDATE transcript_capture_status
|
|
15806
|
+
SET oldest_pending_at = (
|
|
15807
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15808
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15809
|
+
)
|
|
15810
|
+
WHERE agent_id = NEW.agent_id;
|
|
15811
|
+
|
|
15812
|
+
UPDATE transcript_capture_status
|
|
15813
|
+
SET last_error = (
|
|
15814
|
+
SELECT error FROM transcript_capture_jobs
|
|
15815
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15816
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15817
|
+
),
|
|
15818
|
+
last_error_at = (
|
|
15819
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15820
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15821
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15822
|
+
)
|
|
15823
|
+
WHERE agent_id = NEW.agent_id
|
|
15824
|
+
AND NEW.error IS NOT NULL;
|
|
15825
|
+
END;
|
|
15826
|
+
|
|
15827
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
15828
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
15829
|
+
BEGIN
|
|
15830
|
+
UPDATE transcript_capture_status
|
|
15831
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
15832
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
15833
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
15834
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
15835
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
15836
|
+
WHERE agent_id = NEW.agent_id;
|
|
15837
|
+
|
|
15838
|
+
UPDATE transcript_capture_status
|
|
15839
|
+
SET oldest_pending_at = (
|
|
15840
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15841
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
15842
|
+
)
|
|
15843
|
+
WHERE agent_id = NEW.agent_id;
|
|
15844
|
+
|
|
15845
|
+
UPDATE transcript_capture_status
|
|
15846
|
+
SET last_error = (
|
|
15847
|
+
SELECT error FROM transcript_capture_jobs
|
|
15848
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15849
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15850
|
+
),
|
|
15851
|
+
last_error_at = (
|
|
15852
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15853
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
15854
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15855
|
+
)
|
|
15856
|
+
WHERE agent_id = NEW.agent_id
|
|
15857
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
15858
|
+
END;
|
|
15859
|
+
|
|
15860
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
15861
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
15862
|
+
BEGIN
|
|
15863
|
+
UPDATE transcript_capture_status
|
|
15864
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
15865
|
+
processing = processing - (OLD.status = 'processing'),
|
|
15866
|
+
completed = completed - (OLD.status = 'completed'),
|
|
15867
|
+
failed = failed - (OLD.status = 'failed'),
|
|
15868
|
+
dead = dead - (OLD.status = 'dead')
|
|
15869
|
+
WHERE agent_id = OLD.agent_id;
|
|
15870
|
+
|
|
15871
|
+
UPDATE transcript_capture_status
|
|
15872
|
+
SET oldest_pending_at = (
|
|
15873
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
15874
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
15875
|
+
)
|
|
15876
|
+
WHERE agent_id = OLD.agent_id;
|
|
15877
|
+
|
|
15878
|
+
UPDATE transcript_capture_status
|
|
15879
|
+
SET last_error = (
|
|
15880
|
+
SELECT error FROM transcript_capture_jobs
|
|
15881
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15882
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15883
|
+
),
|
|
15884
|
+
last_error_at = (
|
|
15885
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
15886
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
15887
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
15888
|
+
)
|
|
15889
|
+
WHERE agent_id = OLD.agent_id
|
|
15890
|
+
AND OLD.error IS NOT NULL;
|
|
15891
|
+
END;
|
|
15892
|
+
`);
|
|
15893
|
+
db.exec(`
|
|
15894
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
15895
|
+
AFTER INSERT ON memories
|
|
15896
|
+
BEGIN
|
|
15897
|
+
UPDATE memories_diagnostics_state
|
|
15898
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15899
|
+
exact_duplicates = exact_duplicates + CASE
|
|
15900
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15901
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15902
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15903
|
+
THEN 1 ELSE 0 END,
|
|
15904
|
+
exact_clusters = exact_clusters + CASE
|
|
15905
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15906
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15907
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15908
|
+
THEN 1 ELSE 0 END
|
|
15909
|
+
WHERE id = 1;
|
|
15910
|
+
|
|
15911
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15912
|
+
SELECT NEW.content_hash, 1
|
|
15913
|
+
WHERE NEW.is_deleted = 0
|
|
15914
|
+
AND NEW.content_hash IS NOT NULL
|
|
15915
|
+
AND NEW.pinned = 0
|
|
15916
|
+
AND NEW.manual_override = 0
|
|
15917
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15918
|
+
END;
|
|
15919
|
+
|
|
15920
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
15921
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
15922
|
+
BEGIN
|
|
15923
|
+
UPDATE memories_diagnostics_state
|
|
15924
|
+
SET total_active = total_active
|
|
15925
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
15926
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15927
|
+
exact_duplicates = exact_duplicates - CASE
|
|
15928
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15929
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15930
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
15931
|
+
THEN 1 ELSE 0 END,
|
|
15932
|
+
exact_clusters = exact_clusters - CASE
|
|
15933
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15934
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15935
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
15936
|
+
THEN 1 ELSE 0 END
|
|
15937
|
+
WHERE id = 1;
|
|
15938
|
+
|
|
15939
|
+
UPDATE memories_duplicate_hash_counts
|
|
15940
|
+
SET dup_count = dup_count - 1
|
|
15941
|
+
WHERE OLD.is_deleted = 0
|
|
15942
|
+
AND OLD.content_hash IS NOT NULL
|
|
15943
|
+
AND OLD.pinned = 0
|
|
15944
|
+
AND OLD.manual_override = 0
|
|
15945
|
+
AND content_hash = OLD.content_hash;
|
|
15946
|
+
|
|
15947
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
15948
|
+
WHERE content_hash = OLD.content_hash
|
|
15949
|
+
AND dup_count <= 0;
|
|
15950
|
+
|
|
15951
|
+
UPDATE memories_diagnostics_state
|
|
15952
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
15953
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15954
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15955
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
15956
|
+
THEN 1 ELSE 0 END,
|
|
15957
|
+
exact_clusters = exact_clusters + CASE
|
|
15958
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
15959
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
15960
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
15961
|
+
THEN 1 ELSE 0 END
|
|
15962
|
+
WHERE id = 1;
|
|
15963
|
+
|
|
15964
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
15965
|
+
SELECT NEW.content_hash, 1
|
|
15966
|
+
WHERE NEW.is_deleted = 0
|
|
15967
|
+
AND NEW.content_hash IS NOT NULL
|
|
15968
|
+
AND NEW.pinned = 0
|
|
15969
|
+
AND NEW.manual_override = 0
|
|
15970
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
15971
|
+
END;
|
|
15972
|
+
|
|
15973
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
15974
|
+
AFTER DELETE ON memories
|
|
15975
|
+
BEGIN
|
|
15976
|
+
UPDATE memories_diagnostics_state
|
|
15977
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
15978
|
+
exact_duplicates = exact_duplicates - CASE
|
|
15979
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15980
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15981
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
15982
|
+
THEN 1 ELSE 0 END,
|
|
15983
|
+
exact_clusters = exact_clusters - CASE
|
|
15984
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
15985
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
15986
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
15987
|
+
THEN 1 ELSE 0 END
|
|
15988
|
+
WHERE id = 1;
|
|
15989
|
+
|
|
15990
|
+
UPDATE memories_duplicate_hash_counts
|
|
15991
|
+
SET dup_count = dup_count - 1
|
|
15992
|
+
WHERE OLD.is_deleted = 0
|
|
15993
|
+
AND OLD.content_hash IS NOT NULL
|
|
15994
|
+
AND OLD.pinned = 0
|
|
15995
|
+
AND OLD.manual_override = 0
|
|
15996
|
+
AND content_hash = OLD.content_hash;
|
|
15997
|
+
|
|
15998
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
15999
|
+
WHERE content_hash = OLD.content_hash
|
|
16000
|
+
AND dup_count <= 0;
|
|
16001
|
+
END;
|
|
16002
|
+
`);
|
|
16003
|
+
db.exec(`
|
|
16004
|
+
DELETE FROM transcript_capture_status;
|
|
16005
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
16006
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
16007
|
+
SELECT content_hash, COUNT(*)
|
|
16008
|
+
FROM memories
|
|
16009
|
+
WHERE is_deleted = 0
|
|
16010
|
+
AND content_hash IS NOT NULL
|
|
16011
|
+
AND pinned = 0
|
|
16012
|
+
AND manual_override = 0
|
|
16013
|
+
GROUP BY content_hash;
|
|
16014
|
+
|
|
16015
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
16016
|
+
VALUES (
|
|
16017
|
+
1,
|
|
16018
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
16019
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
16020
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
16021
|
+
)
|
|
16022
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
16023
|
+
total_active = excluded.total_active,
|
|
16024
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
16025
|
+
exact_clusters = excluded.exact_clusters;
|
|
16026
|
+
|
|
16027
|
+
INSERT INTO transcript_capture_status (
|
|
16028
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
16029
|
+
oldest_pending_at, last_error, last_error_at
|
|
16030
|
+
)
|
|
16031
|
+
SELECT
|
|
16032
|
+
j.agent_id,
|
|
16033
|
+
SUM(j.status = 'pending'),
|
|
16034
|
+
SUM(j.status = 'processing'),
|
|
16035
|
+
SUM(j.status = 'completed'),
|
|
16036
|
+
SUM(j.status = 'failed'),
|
|
16037
|
+
SUM(j.status = 'dead'),
|
|
16038
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
16039
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
16040
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
16041
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
16042
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
16043
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
16044
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
16045
|
+
FROM transcript_capture_jobs j
|
|
16046
|
+
GROUP BY j.agent_id;
|
|
16047
|
+
`);
|
|
16048
|
+
}
|
|
15736
16049
|
var MIGRATIONS = [
|
|
15737
16050
|
{
|
|
15738
16051
|
version: 1,
|
|
@@ -16822,6 +17135,14 @@ var MIGRATIONS = [
|
|
|
16822
17135
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
16823
17136
|
]
|
|
16824
17137
|
}
|
|
17138
|
+
},
|
|
17139
|
+
{
|
|
17140
|
+
version: 138,
|
|
17141
|
+
name: "bounded-status-projections",
|
|
17142
|
+
up: up138,
|
|
17143
|
+
artifacts: {
|
|
17144
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
17145
|
+
}
|
|
16825
17146
|
}
|
|
16826
17147
|
];
|
|
16827
17148
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -28691,7 +29012,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
|
28691
29012
|
return true;
|
|
28692
29013
|
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
28693
29014
|
}
|
|
28694
|
-
function
|
|
29015
|
+
function up139(db) {
|
|
28695
29016
|
db.exec(`
|
|
28696
29017
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
28697
29018
|
version INTEGER PRIMARY KEY,
|
|
@@ -28780,31 +29101,31 @@ function up138(db) {
|
|
|
28780
29101
|
} catch {}
|
|
28781
29102
|
createMemoriesFts2(db);
|
|
28782
29103
|
}
|
|
28783
|
-
function
|
|
29104
|
+
function hasColumn26(db, table, column) {
|
|
28784
29105
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
28785
29106
|
return rows.some((r3) => r3.name === column);
|
|
28786
29107
|
}
|
|
28787
|
-
function
|
|
28788
|
-
if (!
|
|
29108
|
+
function addColumnIfMissing28(db, table, column, definition) {
|
|
29109
|
+
if (!hasColumn26(db, table, column)) {
|
|
28789
29110
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
28790
29111
|
}
|
|
28791
29112
|
}
|
|
28792
29113
|
function up210(db) {
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28796
|
-
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
|
|
28807
|
-
|
|
29114
|
+
addColumnIfMissing28(db, "memories", "content_hash", "TEXT");
|
|
29115
|
+
addColumnIfMissing28(db, "memories", "normalized_content", "TEXT");
|
|
29116
|
+
addColumnIfMissing28(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
|
|
29117
|
+
addColumnIfMissing28(db, "memories", "deleted_at", "TEXT");
|
|
29118
|
+
addColumnIfMissing28(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
|
|
29119
|
+
addColumnIfMissing28(db, "memories", "embedding_model", "TEXT");
|
|
29120
|
+
addColumnIfMissing28(db, "memories", "extraction_model", "TEXT");
|
|
29121
|
+
addColumnIfMissing28(db, "memories", "update_count", "INTEGER DEFAULT 0");
|
|
29122
|
+
addColumnIfMissing28(db, "memories", "who", "TEXT");
|
|
29123
|
+
addColumnIfMissing28(db, "memories", "why", "TEXT");
|
|
29124
|
+
addColumnIfMissing28(db, "memories", "project", "TEXT");
|
|
29125
|
+
addColumnIfMissing28(db, "memories", "pinned", "INTEGER DEFAULT 0");
|
|
29126
|
+
addColumnIfMissing28(db, "memories", "importance", "REAL DEFAULT 0.5");
|
|
29127
|
+
addColumnIfMissing28(db, "memories", "last_accessed", "TEXT");
|
|
29128
|
+
addColumnIfMissing28(db, "memories", "access_count", "INTEGER DEFAULT 0");
|
|
28808
29129
|
db.exec(`
|
|
28809
29130
|
CREATE TABLE IF NOT EXISTS memory_history (
|
|
28810
29131
|
id TEXT PRIMARY KEY,
|
|
@@ -28900,7 +29221,7 @@ function up210(db) {
|
|
|
28900
29221
|
ON memory_entity_mentions(entity_id);
|
|
28901
29222
|
`);
|
|
28902
29223
|
}
|
|
28903
|
-
function
|
|
29224
|
+
function addColumnIfMissing29(db, table, column, definition) {
|
|
28904
29225
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
28905
29226
|
if (rows.some((r3) => r3.name === column))
|
|
28906
29227
|
return false;
|
|
@@ -28908,8 +29229,8 @@ function addColumnIfMissing28(db, table, column, definition) {
|
|
|
28908
29229
|
return true;
|
|
28909
29230
|
}
|
|
28910
29231
|
function up310(db) {
|
|
28911
|
-
|
|
28912
|
-
|
|
29232
|
+
addColumnIfMissing29(db, "memories", "why", "TEXT");
|
|
29233
|
+
addColumnIfMissing29(db, "memories", "project", "TEXT");
|
|
28913
29234
|
db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
|
|
28914
29235
|
db.exec(`
|
|
28915
29236
|
UPDATE memories
|
|
@@ -28935,12 +29256,12 @@ function up310(db) {
|
|
|
28935
29256
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
28936
29257
|
`);
|
|
28937
29258
|
}
|
|
28938
|
-
function
|
|
29259
|
+
function hasColumn27(db, table, column) {
|
|
28939
29260
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
28940
29261
|
return rows.some((r3) => r3.name === column);
|
|
28941
29262
|
}
|
|
28942
29263
|
function addColumnIfMissing32(db, table, column, definition) {
|
|
28943
|
-
if (!
|
|
29264
|
+
if (!hasColumn27(db, table, column)) {
|
|
28944
29265
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
28945
29266
|
}
|
|
28946
29267
|
}
|
|
@@ -29175,7 +29496,7 @@ function addColumnIfMissing52(db, table, column, definition) {
|
|
|
29175
29496
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
29176
29497
|
}
|
|
29177
29498
|
}
|
|
29178
|
-
function
|
|
29499
|
+
function up1310(db) {
|
|
29179
29500
|
db.exec(`
|
|
29180
29501
|
CREATE TABLE IF NOT EXISTS ingestion_jobs (
|
|
29181
29502
|
id TEXT PRIMARY KEY,
|
|
@@ -33044,11 +33365,324 @@ function up1372(db) {
|
|
|
33044
33365
|
if (!cols.has(name))
|
|
33045
33366
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
33046
33367
|
}
|
|
33368
|
+
function hasColumn252(db, table, column) {
|
|
33369
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
33370
|
+
return rows.some((row) => row.name === column);
|
|
33371
|
+
}
|
|
33372
|
+
function addColumnIfMissing272(db, table, column, definition) {
|
|
33373
|
+
if (!hasColumn252(db, table, column))
|
|
33374
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
33375
|
+
}
|
|
33376
|
+
function up1382(db) {
|
|
33377
|
+
addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
|
|
33378
|
+
db.exec(`
|
|
33379
|
+
CREATE TABLE IF NOT EXISTS transcript_capture_status (
|
|
33380
|
+
agent_id TEXT PRIMARY KEY,
|
|
33381
|
+
pending INTEGER NOT NULL DEFAULT 0,
|
|
33382
|
+
processing INTEGER NOT NULL DEFAULT 0,
|
|
33383
|
+
completed INTEGER NOT NULL DEFAULT 0,
|
|
33384
|
+
failed INTEGER NOT NULL DEFAULT 0,
|
|
33385
|
+
dead INTEGER NOT NULL DEFAULT 0,
|
|
33386
|
+
oldest_pending_at TEXT,
|
|
33387
|
+
last_error TEXT,
|
|
33388
|
+
last_error_at TEXT
|
|
33389
|
+
);
|
|
33390
|
+
|
|
33391
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_status_created_at
|
|
33392
|
+
ON transcript_capture_jobs(agent_id, status, created_at);
|
|
33393
|
+
|
|
33394
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_error_updated_at
|
|
33395
|
+
ON transcript_capture_jobs(agent_id, updated_at DESC)
|
|
33396
|
+
WHERE error IS NOT NULL;
|
|
33397
|
+
|
|
33398
|
+
CREATE TABLE IF NOT EXISTS memories_duplicate_hash_counts (
|
|
33399
|
+
content_hash TEXT PRIMARY KEY,
|
|
33400
|
+
dup_count INTEGER NOT NULL
|
|
33401
|
+
);
|
|
33402
|
+
|
|
33403
|
+
CREATE INDEX IF NOT EXISTS idx_memories_dup_counts_active
|
|
33404
|
+
ON memories_duplicate_hash_counts(dup_count)
|
|
33405
|
+
WHERE dup_count > 1;
|
|
33406
|
+
|
|
33407
|
+
CREATE TABLE IF NOT EXISTS memories_diagnostics_state (
|
|
33408
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
33409
|
+
total_active INTEGER NOT NULL DEFAULT 0,
|
|
33410
|
+
exact_duplicates INTEGER NOT NULL DEFAULT 0,
|
|
33411
|
+
exact_clusters INTEGER NOT NULL DEFAULT 0
|
|
33412
|
+
);
|
|
33413
|
+
|
|
33414
|
+
CREATE INDEX IF NOT EXISTS idx_memories_active_hash_diagnostics
|
|
33415
|
+
ON memories(content_hash)
|
|
33416
|
+
WHERE is_deleted = 0
|
|
33417
|
+
AND content_hash IS NOT NULL
|
|
33418
|
+
AND pinned = 0
|
|
33419
|
+
AND manual_override = 0;
|
|
33420
|
+
`);
|
|
33421
|
+
db.exec(`
|
|
33422
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ai
|
|
33423
|
+
AFTER INSERT ON transcript_capture_jobs
|
|
33424
|
+
BEGIN
|
|
33425
|
+
INSERT INTO transcript_capture_status (agent_id)
|
|
33426
|
+
VALUES (NEW.agent_id)
|
|
33427
|
+
ON CONFLICT(agent_id) DO NOTHING;
|
|
33428
|
+
|
|
33429
|
+
UPDATE transcript_capture_status
|
|
33430
|
+
SET pending = pending + (NEW.status = 'pending'),
|
|
33431
|
+
processing = processing + (NEW.status = 'processing'),
|
|
33432
|
+
completed = completed + (NEW.status = 'completed'),
|
|
33433
|
+
failed = failed + (NEW.status = 'failed'),
|
|
33434
|
+
dead = dead + (NEW.status = 'dead')
|
|
33435
|
+
WHERE agent_id = NEW.agent_id;
|
|
33436
|
+
|
|
33437
|
+
UPDATE transcript_capture_status
|
|
33438
|
+
SET oldest_pending_at = (
|
|
33439
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33440
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
33441
|
+
)
|
|
33442
|
+
WHERE agent_id = NEW.agent_id;
|
|
33443
|
+
|
|
33444
|
+
UPDATE transcript_capture_status
|
|
33445
|
+
SET last_error = (
|
|
33446
|
+
SELECT error FROM transcript_capture_jobs
|
|
33447
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33448
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33449
|
+
),
|
|
33450
|
+
last_error_at = (
|
|
33451
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33452
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33453
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33454
|
+
)
|
|
33455
|
+
WHERE agent_id = NEW.agent_id
|
|
33456
|
+
AND NEW.error IS NOT NULL;
|
|
33457
|
+
END;
|
|
33458
|
+
|
|
33459
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_au
|
|
33460
|
+
AFTER UPDATE OF status, error, updated_at, created_at ON transcript_capture_jobs
|
|
33461
|
+
BEGIN
|
|
33462
|
+
UPDATE transcript_capture_status
|
|
33463
|
+
SET pending = pending + (NEW.status = 'pending') - (OLD.status = 'pending'),
|
|
33464
|
+
processing = processing + (NEW.status = 'processing') - (OLD.status = 'processing'),
|
|
33465
|
+
completed = completed + (NEW.status = 'completed') - (OLD.status = 'completed'),
|
|
33466
|
+
failed = failed + (NEW.status = 'failed') - (OLD.status = 'failed'),
|
|
33467
|
+
dead = dead + (NEW.status = 'dead') - (OLD.status = 'dead')
|
|
33468
|
+
WHERE agent_id = NEW.agent_id;
|
|
33469
|
+
|
|
33470
|
+
UPDATE transcript_capture_status
|
|
33471
|
+
SET oldest_pending_at = (
|
|
33472
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33473
|
+
WHERE agent_id = NEW.agent_id AND status = 'pending'
|
|
33474
|
+
)
|
|
33475
|
+
WHERE agent_id = NEW.agent_id;
|
|
33476
|
+
|
|
33477
|
+
UPDATE transcript_capture_status
|
|
33478
|
+
SET last_error = (
|
|
33479
|
+
SELECT error FROM transcript_capture_jobs
|
|
33480
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33481
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33482
|
+
),
|
|
33483
|
+
last_error_at = (
|
|
33484
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33485
|
+
WHERE agent_id = NEW.agent_id AND error IS NOT NULL
|
|
33486
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33487
|
+
)
|
|
33488
|
+
WHERE agent_id = NEW.agent_id
|
|
33489
|
+
AND (NEW.error IS NOT NULL OR OLD.error IS NOT NULL);
|
|
33490
|
+
END;
|
|
33491
|
+
|
|
33492
|
+
CREATE TRIGGER IF NOT EXISTS transcript_capture_status_ad
|
|
33493
|
+
AFTER DELETE ON transcript_capture_jobs
|
|
33494
|
+
BEGIN
|
|
33495
|
+
UPDATE transcript_capture_status
|
|
33496
|
+
SET pending = pending - (OLD.status = 'pending'),
|
|
33497
|
+
processing = processing - (OLD.status = 'processing'),
|
|
33498
|
+
completed = completed - (OLD.status = 'completed'),
|
|
33499
|
+
failed = failed - (OLD.status = 'failed'),
|
|
33500
|
+
dead = dead - (OLD.status = 'dead')
|
|
33501
|
+
WHERE agent_id = OLD.agent_id;
|
|
33502
|
+
|
|
33503
|
+
UPDATE transcript_capture_status
|
|
33504
|
+
SET oldest_pending_at = (
|
|
33505
|
+
SELECT MIN(created_at) FROM transcript_capture_jobs
|
|
33506
|
+
WHERE agent_id = OLD.agent_id AND status = 'pending'
|
|
33507
|
+
)
|
|
33508
|
+
WHERE agent_id = OLD.agent_id;
|
|
33509
|
+
|
|
33510
|
+
UPDATE transcript_capture_status
|
|
33511
|
+
SET last_error = (
|
|
33512
|
+
SELECT error FROM transcript_capture_jobs
|
|
33513
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
33514
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33515
|
+
),
|
|
33516
|
+
last_error_at = (
|
|
33517
|
+
SELECT updated_at FROM transcript_capture_jobs
|
|
33518
|
+
WHERE agent_id = OLD.agent_id AND error IS NOT NULL
|
|
33519
|
+
ORDER BY updated_at DESC LIMIT 1
|
|
33520
|
+
)
|
|
33521
|
+
WHERE agent_id = OLD.agent_id
|
|
33522
|
+
AND OLD.error IS NOT NULL;
|
|
33523
|
+
END;
|
|
33524
|
+
`);
|
|
33525
|
+
db.exec(`
|
|
33526
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ai
|
|
33527
|
+
AFTER INSERT ON memories
|
|
33528
|
+
BEGIN
|
|
33529
|
+
UPDATE memories_diagnostics_state
|
|
33530
|
+
SET total_active = total_active + CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33531
|
+
exact_duplicates = exact_duplicates + CASE
|
|
33532
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33533
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33534
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
33535
|
+
THEN 1 ELSE 0 END,
|
|
33536
|
+
exact_clusters = exact_clusters + CASE
|
|
33537
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33538
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33539
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
33540
|
+
THEN 1 ELSE 0 END
|
|
33541
|
+
WHERE id = 1;
|
|
33542
|
+
|
|
33543
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33544
|
+
SELECT NEW.content_hash, 1
|
|
33545
|
+
WHERE NEW.is_deleted = 0
|
|
33546
|
+
AND NEW.content_hash IS NOT NULL
|
|
33547
|
+
AND NEW.pinned = 0
|
|
33548
|
+
AND NEW.manual_override = 0
|
|
33549
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
33550
|
+
END;
|
|
33551
|
+
|
|
33552
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_au
|
|
33553
|
+
AFTER UPDATE OF is_deleted, content_hash, pinned, manual_override ON memories
|
|
33554
|
+
BEGIN
|
|
33555
|
+
UPDATE memories_diagnostics_state
|
|
33556
|
+
SET total_active = total_active
|
|
33557
|
+
+ CASE WHEN NEW.is_deleted = 0 THEN 1 ELSE 0 END
|
|
33558
|
+
- CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33559
|
+
exact_duplicates = exact_duplicates - CASE
|
|
33560
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33561
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33562
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
33563
|
+
THEN 1 ELSE 0 END,
|
|
33564
|
+
exact_clusters = exact_clusters - CASE
|
|
33565
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33566
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33567
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
33568
|
+
THEN 1 ELSE 0 END
|
|
33569
|
+
WHERE id = 1;
|
|
33570
|
+
|
|
33571
|
+
UPDATE memories_duplicate_hash_counts
|
|
33572
|
+
SET dup_count = dup_count - 1
|
|
33573
|
+
WHERE OLD.is_deleted = 0
|
|
33574
|
+
AND OLD.content_hash IS NOT NULL
|
|
33575
|
+
AND OLD.pinned = 0
|
|
33576
|
+
AND OLD.manual_override = 0
|
|
33577
|
+
AND content_hash = OLD.content_hash;
|
|
33578
|
+
|
|
33579
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
33580
|
+
WHERE content_hash = OLD.content_hash
|
|
33581
|
+
AND dup_count <= 0;
|
|
33582
|
+
|
|
33583
|
+
UPDATE memories_diagnostics_state
|
|
33584
|
+
SET exact_duplicates = exact_duplicates + CASE
|
|
33585
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33586
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33587
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) >= 1
|
|
33588
|
+
THEN 1 ELSE 0 END,
|
|
33589
|
+
exact_clusters = exact_clusters + CASE
|
|
33590
|
+
WHEN NEW.is_deleted = 0 AND NEW.content_hash IS NOT NULL
|
|
33591
|
+
AND NEW.pinned = 0 AND NEW.manual_override = 0
|
|
33592
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = NEW.content_hash), 0) = 1
|
|
33593
|
+
THEN 1 ELSE 0 END
|
|
33594
|
+
WHERE id = 1;
|
|
33595
|
+
|
|
33596
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33597
|
+
SELECT NEW.content_hash, 1
|
|
33598
|
+
WHERE NEW.is_deleted = 0
|
|
33599
|
+
AND NEW.content_hash IS NOT NULL
|
|
33600
|
+
AND NEW.pinned = 0
|
|
33601
|
+
AND NEW.manual_override = 0
|
|
33602
|
+
ON CONFLICT(content_hash) DO UPDATE SET dup_count = dup_count + 1;
|
|
33603
|
+
END;
|
|
33604
|
+
|
|
33605
|
+
CREATE TRIGGER IF NOT EXISTS memories_dup_projection_ad
|
|
33606
|
+
AFTER DELETE ON memories
|
|
33607
|
+
BEGIN
|
|
33608
|
+
UPDATE memories_diagnostics_state
|
|
33609
|
+
SET total_active = total_active - CASE WHEN OLD.is_deleted = 0 THEN 1 ELSE 0 END,
|
|
33610
|
+
exact_duplicates = exact_duplicates - CASE
|
|
33611
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33612
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33613
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) > 1
|
|
33614
|
+
THEN 1 ELSE 0 END,
|
|
33615
|
+
exact_clusters = exact_clusters - CASE
|
|
33616
|
+
WHEN OLD.is_deleted = 0 AND OLD.content_hash IS NOT NULL
|
|
33617
|
+
AND OLD.pinned = 0 AND OLD.manual_override = 0
|
|
33618
|
+
AND COALESCE((SELECT dup_count FROM memories_duplicate_hash_counts WHERE content_hash = OLD.content_hash), 0) = 2
|
|
33619
|
+
THEN 1 ELSE 0 END
|
|
33620
|
+
WHERE id = 1;
|
|
33621
|
+
|
|
33622
|
+
UPDATE memories_duplicate_hash_counts
|
|
33623
|
+
SET dup_count = dup_count - 1
|
|
33624
|
+
WHERE OLD.is_deleted = 0
|
|
33625
|
+
AND OLD.content_hash IS NOT NULL
|
|
33626
|
+
AND OLD.pinned = 0
|
|
33627
|
+
AND OLD.manual_override = 0
|
|
33628
|
+
AND content_hash = OLD.content_hash;
|
|
33629
|
+
|
|
33630
|
+
DELETE FROM memories_duplicate_hash_counts
|
|
33631
|
+
WHERE content_hash = OLD.content_hash
|
|
33632
|
+
AND dup_count <= 0;
|
|
33633
|
+
END;
|
|
33634
|
+
`);
|
|
33635
|
+
db.exec(`
|
|
33636
|
+
DELETE FROM transcript_capture_status;
|
|
33637
|
+
DELETE FROM memories_duplicate_hash_counts;
|
|
33638
|
+
INSERT INTO memories_duplicate_hash_counts (content_hash, dup_count)
|
|
33639
|
+
SELECT content_hash, COUNT(*)
|
|
33640
|
+
FROM memories
|
|
33641
|
+
WHERE is_deleted = 0
|
|
33642
|
+
AND content_hash IS NOT NULL
|
|
33643
|
+
AND pinned = 0
|
|
33644
|
+
AND manual_override = 0
|
|
33645
|
+
GROUP BY content_hash;
|
|
33646
|
+
|
|
33647
|
+
INSERT INTO memories_diagnostics_state (id, total_active, exact_duplicates, exact_clusters)
|
|
33648
|
+
VALUES (
|
|
33649
|
+
1,
|
|
33650
|
+
(SELECT COUNT(*) FROM memories WHERE is_deleted = 0),
|
|
33651
|
+
COALESCE((SELECT SUM(dup_count - 1) FROM memories_duplicate_hash_counts WHERE dup_count > 1), 0),
|
|
33652
|
+
(SELECT COUNT(*) FROM memories_duplicate_hash_counts WHERE dup_count > 1)
|
|
33653
|
+
)
|
|
33654
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
33655
|
+
total_active = excluded.total_active,
|
|
33656
|
+
exact_duplicates = excluded.exact_duplicates,
|
|
33657
|
+
exact_clusters = excluded.exact_clusters;
|
|
33658
|
+
|
|
33659
|
+
INSERT INTO transcript_capture_status (
|
|
33660
|
+
agent_id, pending, processing, completed, failed, dead,
|
|
33661
|
+
oldest_pending_at, last_error, last_error_at
|
|
33662
|
+
)
|
|
33663
|
+
SELECT
|
|
33664
|
+
j.agent_id,
|
|
33665
|
+
SUM(j.status = 'pending'),
|
|
33666
|
+
SUM(j.status = 'processing'),
|
|
33667
|
+
SUM(j.status = 'completed'),
|
|
33668
|
+
SUM(j.status = 'failed'),
|
|
33669
|
+
SUM(j.status = 'dead'),
|
|
33670
|
+
MIN(CASE WHEN j.status = 'pending' THEN j.created_at END),
|
|
33671
|
+
(SELECT e2.error FROM transcript_capture_jobs e2
|
|
33672
|
+
WHERE e2.agent_id = j.agent_id AND e2.error IS NOT NULL
|
|
33673
|
+
ORDER BY e2.updated_at DESC LIMIT 1),
|
|
33674
|
+
(SELECT e3.updated_at FROM transcript_capture_jobs e3
|
|
33675
|
+
WHERE e3.agent_id = j.agent_id AND e3.error IS NOT NULL
|
|
33676
|
+
ORDER BY e3.updated_at DESC LIMIT 1)
|
|
33677
|
+
FROM transcript_capture_jobs j
|
|
33678
|
+
GROUP BY j.agent_id;
|
|
33679
|
+
`);
|
|
33680
|
+
}
|
|
33047
33681
|
var MIGRATIONS2 = [
|
|
33048
33682
|
{
|
|
33049
33683
|
version: 1,
|
|
33050
33684
|
name: "baseline",
|
|
33051
|
-
up:
|
|
33685
|
+
up: up139,
|
|
33052
33686
|
artifacts: { tables: ["memories", "conversations", "embeddings"] }
|
|
33053
33687
|
},
|
|
33054
33688
|
{
|
|
@@ -33126,7 +33760,7 @@ var MIGRATIONS2 = [
|
|
|
33126
33760
|
{
|
|
33127
33761
|
version: 13,
|
|
33128
33762
|
name: "ingestion-tracking",
|
|
33129
|
-
up:
|
|
33763
|
+
up: up1310,
|
|
33130
33764
|
artifacts: {
|
|
33131
33765
|
columns: [
|
|
33132
33766
|
{ table: "memories", column: "source_path" },
|
|
@@ -34133,6 +34767,14 @@ var MIGRATIONS2 = [
|
|
|
34133
34767
|
{ table: "dreaming_passes", column: "head_hash" }
|
|
34134
34768
|
]
|
|
34135
34769
|
}
|
|
34770
|
+
},
|
|
34771
|
+
{
|
|
34772
|
+
version: 138,
|
|
34773
|
+
name: "bounded-status-projections",
|
|
34774
|
+
up: up1382,
|
|
34775
|
+
artifacts: {
|
|
34776
|
+
tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
|
|
34777
|
+
}
|
|
34136
34778
|
}
|
|
34137
34779
|
];
|
|
34138
34780
|
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-claude-code",
|
|
3
|
-
"version": "0.211.
|
|
3
|
+
"version": "0.211.20",
|
|
4
4
|
"description": "Signet connector for Claude Code (Anthropic 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",
|