@signetai/connector-gemini 0.146.4 → 0.147.0
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 +595 -27
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9633,6 +9633,251 @@ function up82(db) {
|
|
|
9633
9633
|
`);
|
|
9634
9634
|
db.exec("CREATE INDEX IF NOT EXISTS idx_skill_inv_harness ON skill_invocations(harness, created_at)");
|
|
9635
9635
|
}
|
|
9636
|
+
var DEPENDENCY_TYPES = new Set([
|
|
9637
|
+
"uses",
|
|
9638
|
+
"requires",
|
|
9639
|
+
"owned_by",
|
|
9640
|
+
"owns",
|
|
9641
|
+
"blocks",
|
|
9642
|
+
"informs",
|
|
9643
|
+
"maintains",
|
|
9644
|
+
"implements",
|
|
9645
|
+
"built",
|
|
9646
|
+
"depends_on",
|
|
9647
|
+
"related_to",
|
|
9648
|
+
"learned_from",
|
|
9649
|
+
"teaches",
|
|
9650
|
+
"knows",
|
|
9651
|
+
"assumes",
|
|
9652
|
+
"supports_claim",
|
|
9653
|
+
"authored_by",
|
|
9654
|
+
"links_to",
|
|
9655
|
+
"contains",
|
|
9656
|
+
"contains_note",
|
|
9657
|
+
"contradicts",
|
|
9658
|
+
"supersedes",
|
|
9659
|
+
"part_of",
|
|
9660
|
+
"produced_artifact",
|
|
9661
|
+
"precedes",
|
|
9662
|
+
"follows",
|
|
9663
|
+
"triggers",
|
|
9664
|
+
"may_execute",
|
|
9665
|
+
"requires_approval_from",
|
|
9666
|
+
"impacts",
|
|
9667
|
+
"produces",
|
|
9668
|
+
"consumes"
|
|
9669
|
+
]);
|
|
9670
|
+
function sqlStringList(values) {
|
|
9671
|
+
return [...values].map((value) => `'${value}'`).join(", ");
|
|
9672
|
+
}
|
|
9673
|
+
function hasTable3(db, table) {
|
|
9674
|
+
return Boolean(db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(table));
|
|
9675
|
+
}
|
|
9676
|
+
function hasColumn12(db, table, column) {
|
|
9677
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
9678
|
+
return rows.some((row) => row.name === column);
|
|
9679
|
+
}
|
|
9680
|
+
function addColumnIfMissing20(db, table, column, definition) {
|
|
9681
|
+
if (!hasColumn12(db, table, column))
|
|
9682
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
9683
|
+
}
|
|
9684
|
+
function documentScopeColumnsPreservingExisting(db) {
|
|
9685
|
+
const preserveAgentId = hasColumn12(db, "documents", "agent_id");
|
|
9686
|
+
const preserveProject = hasColumn12(db, "documents", "project");
|
|
9687
|
+
if (preserveAgentId) {
|
|
9688
|
+
db.exec(`
|
|
9689
|
+
CREATE TEMP TABLE __signet_doc_agent_guard AS
|
|
9690
|
+
SELECT id, agent_id FROM documents
|
|
9691
|
+
WHERE NULLIF(TRIM(agent_id), '') IS NOT NULL
|
|
9692
|
+
AND NULLIF(TRIM(agent_id), '') <> 'default'
|
|
9693
|
+
`);
|
|
9694
|
+
}
|
|
9695
|
+
if (preserveProject) {
|
|
9696
|
+
db.exec(`
|
|
9697
|
+
CREATE TEMP TABLE __signet_doc_project_guard AS
|
|
9698
|
+
SELECT id, project FROM documents
|
|
9699
|
+
WHERE NULLIF(TRIM(project), '') IS NOT NULL
|
|
9700
|
+
`);
|
|
9701
|
+
}
|
|
9702
|
+
try {
|
|
9703
|
+
up80(db);
|
|
9704
|
+
if (preserveAgentId) {
|
|
9705
|
+
db.exec(`
|
|
9706
|
+
UPDATE documents
|
|
9707
|
+
SET agent_id = (SELECT agent_id FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
9708
|
+
WHERE EXISTS (SELECT 1 FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
9709
|
+
`);
|
|
9710
|
+
}
|
|
9711
|
+
if (preserveProject) {
|
|
9712
|
+
db.exec(`
|
|
9713
|
+
UPDATE documents
|
|
9714
|
+
SET project = (SELECT project FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
9715
|
+
WHERE EXISTS (SELECT 1 FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
9716
|
+
`);
|
|
9717
|
+
}
|
|
9718
|
+
} finally {
|
|
9719
|
+
db.exec("DROP TABLE IF EXISTS temp.__signet_doc_agent_guard");
|
|
9720
|
+
db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
function up83(db) {
|
|
9724
|
+
up79(db);
|
|
9725
|
+
if (hasTable3(db, "documents")) {
|
|
9726
|
+
documentScopeColumnsPreservingExisting(db);
|
|
9727
|
+
}
|
|
9728
|
+
up81(db);
|
|
9729
|
+
addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
|
|
9730
|
+
addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
|
|
9731
|
+
addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
|
|
9732
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_memories_superseded_by ON memories(superseded_by)");
|
|
9733
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_memories_active_supersession ON memories(is_deleted, superseded_by)");
|
|
9734
|
+
if (!hasTable3(db, "relations") || !hasTable3(db, "entity_dependencies"))
|
|
9735
|
+
return;
|
|
9736
|
+
addColumnIfMissing20(db, "entity_dependencies", "confidence", "REAL");
|
|
9737
|
+
addColumnIfMissing20(db, "entity_dependencies", "reason", "TEXT");
|
|
9738
|
+
addColumnIfMissing20(db, "entity_dependencies", "source_id", "TEXT");
|
|
9739
|
+
addColumnIfMissing20(db, "entity_dependencies", "source_kind", "TEXT");
|
|
9740
|
+
addColumnIfMissing20(db, "entity_dependencies", "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
|
|
9741
|
+
addColumnIfMissing20(db, "entity_dependencies", "status", "TEXT NOT NULL DEFAULT 'active'");
|
|
9742
|
+
const relationConfidence = hasColumn12(db, "relations", "confidence") ? "r.confidence" : "NULL";
|
|
9743
|
+
const relationUpdatedAt = hasColumn12(db, "relations", "updated_at") ? "r.updated_at" : "r.created_at";
|
|
9744
|
+
const sourceAgentId = hasColumn12(db, "entities", "agent_id") ? "COALESCE(NULLIF(TRIM(src.agent_id), ''), 'default')" : "'default'";
|
|
9745
|
+
const targetAgentId = hasColumn12(db, "entities", "agent_id") ? "COALESCE(NULLIF(TRIM(dst.agent_id), ''), 'default')" : "'default'";
|
|
9746
|
+
db.exec(`
|
|
9747
|
+
INSERT OR IGNORE INTO entity_dependencies (
|
|
9748
|
+
id,
|
|
9749
|
+
source_entity_id,
|
|
9750
|
+
target_entity_id,
|
|
9751
|
+
agent_id,
|
|
9752
|
+
dependency_type,
|
|
9753
|
+
strength,
|
|
9754
|
+
confidence,
|
|
9755
|
+
reason,
|
|
9756
|
+
created_at,
|
|
9757
|
+
updated_at,
|
|
9758
|
+
source_id,
|
|
9759
|
+
source_kind,
|
|
9760
|
+
proposal_evidence,
|
|
9761
|
+
status
|
|
9762
|
+
)
|
|
9763
|
+
SELECT
|
|
9764
|
+
'relation:' || r.id,
|
|
9765
|
+
r.source_entity_id,
|
|
9766
|
+
r.target_entity_id,
|
|
9767
|
+
COALESCE(${sourceAgentId}, ${targetAgentId}, 'default'),
|
|
9768
|
+
CASE WHEN r.relation_type IN (${sqlStringList(DEPENDENCY_TYPES)}) THEN r.relation_type ELSE 'related_to' END,
|
|
9769
|
+
MAX(0.1, MIN(1.0, COALESCE(r.strength, 0.5))),
|
|
9770
|
+
MAX(0.1, MIN(1.0, COALESCE(${relationConfidence}, 0.7))),
|
|
9771
|
+
'legacy relation backfill: ' || r.relation_type,
|
|
9772
|
+
COALESCE(r.created_at, datetime('now')),
|
|
9773
|
+
COALESCE(${relationUpdatedAt}, r.created_at, datetime('now')),
|
|
9774
|
+
r.id,
|
|
9775
|
+
'relation',
|
|
9776
|
+
'[]',
|
|
9777
|
+
'active'
|
|
9778
|
+
FROM relations r
|
|
9779
|
+
JOIN entities src ON src.id = r.source_entity_id
|
|
9780
|
+
JOIN entities dst ON dst.id = r.target_entity_id
|
|
9781
|
+
WHERE r.source_entity_id <> r.target_entity_id
|
|
9782
|
+
AND ${sourceAgentId} = ${targetAgentId}
|
|
9783
|
+
`);
|
|
9784
|
+
}
|
|
9785
|
+
function up84(db) {
|
|
9786
|
+
db.exec(`
|
|
9787
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
|
|
9788
|
+
path TEXT PRIMARY KEY,
|
|
9789
|
+
mtime_ms INTEGER NOT NULL,
|
|
9790
|
+
ctime_ms INTEGER NOT NULL,
|
|
9791
|
+
size INTEGER NOT NULL,
|
|
9792
|
+
content_hash TEXT NOT NULL,
|
|
9793
|
+
importer_version INTEGER NOT NULL,
|
|
9794
|
+
chunk_count INTEGER NOT NULL DEFAULT 0,
|
|
9795
|
+
last_imported_at TEXT NOT NULL,
|
|
9796
|
+
last_seen_at TEXT NOT NULL,
|
|
9797
|
+
status TEXT NOT NULL DEFAULT 'imported',
|
|
9798
|
+
error TEXT
|
|
9799
|
+
);
|
|
9800
|
+
|
|
9801
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_chunks (
|
|
9802
|
+
file_path TEXT NOT NULL,
|
|
9803
|
+
chunk_hash TEXT NOT NULL,
|
|
9804
|
+
chunk_index INTEGER NOT NULL,
|
|
9805
|
+
memory_id TEXT,
|
|
9806
|
+
source_id TEXT,
|
|
9807
|
+
created_at TEXT NOT NULL,
|
|
9808
|
+
PRIMARY KEY (file_path, chunk_hash)
|
|
9809
|
+
);
|
|
9810
|
+
|
|
9811
|
+
CREATE INDEX IF NOT EXISTS idx_legacy_markdown_chunks_memory_id
|
|
9812
|
+
ON legacy_markdown_chunks(memory_id);
|
|
9813
|
+
`);
|
|
9814
|
+
}
|
|
9815
|
+
function up85(db) {
|
|
9816
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
|
|
9817
|
+
const tableNames = new Set(tables.map((r) => String(r.name)));
|
|
9818
|
+
if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
|
|
9819
|
+
return;
|
|
9820
|
+
const relCols = db.prepare("PRAGMA table_info(relations)").all();
|
|
9821
|
+
const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
|
|
9822
|
+
const rel = new Set(relCols.map((c) => String(c.name)));
|
|
9823
|
+
const dep = new Set(depCols.map((c) => String(c.name)));
|
|
9824
|
+
if (!rel.has("source_entity_id") || !rel.has("relation_type"))
|
|
9825
|
+
return;
|
|
9826
|
+
if (!dep.has("source_entity_id") || !dep.has("dependency_type") || !dep.has("agent_id"))
|
|
9827
|
+
return;
|
|
9828
|
+
const hasRelConfidence = rel.has("confidence");
|
|
9829
|
+
const hasRelUpdated = rel.has("updated_at");
|
|
9830
|
+
const hasDepConfidence = dep.has("confidence");
|
|
9831
|
+
const hasDepReason = dep.has("reason");
|
|
9832
|
+
const hasDepStatus = dep.has("status");
|
|
9833
|
+
const selectParts = ["id", "source_entity_id", "target_entity_id"];
|
|
9834
|
+
const colParts = ["id", "source_entity_id", "target_entity_id"];
|
|
9835
|
+
selectParts.push("relation_type");
|
|
9836
|
+
colParts.push("dependency_type");
|
|
9837
|
+
selectParts.push("strength", "created_at");
|
|
9838
|
+
colParts.push("strength", "created_at");
|
|
9839
|
+
selectParts.push("'default'");
|
|
9840
|
+
colParts.push("agent_id");
|
|
9841
|
+
selectParts.push("NULL");
|
|
9842
|
+
colParts.push("aspect_id");
|
|
9843
|
+
if (hasRelConfidence && hasDepConfidence) {
|
|
9844
|
+
selectParts.push("confidence");
|
|
9845
|
+
colParts.push("confidence");
|
|
9846
|
+
}
|
|
9847
|
+
if (hasDepReason) {
|
|
9848
|
+
selectParts.push("'extracted'");
|
|
9849
|
+
colParts.push("reason");
|
|
9850
|
+
}
|
|
9851
|
+
if (hasDepStatus) {
|
|
9852
|
+
selectParts.push("'active'");
|
|
9853
|
+
colParts.push("status");
|
|
9854
|
+
}
|
|
9855
|
+
if (hasRelUpdated && dep.has("updated_at")) {
|
|
9856
|
+
selectParts.push("updated_at");
|
|
9857
|
+
colParts.push("updated_at");
|
|
9858
|
+
}
|
|
9859
|
+
const selectClause = selectParts.join(", ");
|
|
9860
|
+
const colsClause = colParts.join(", ");
|
|
9861
|
+
db.exec(`INSERT OR IGNORE INTO entity_dependencies (${colsClause})
|
|
9862
|
+
SELECT ${selectClause}
|
|
9863
|
+
FROM relations
|
|
9864
|
+
WHERE source_entity_id IS NOT NULL
|
|
9865
|
+
AND target_entity_id IS NOT NULL
|
|
9866
|
+
AND relation_type IS NOT NULL`);
|
|
9867
|
+
}
|
|
9868
|
+
function addColumnIfMissing21(db, table, column, definition) {
|
|
9869
|
+
const cols = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
9870
|
+
if (cols.some((col) => col.name === column))
|
|
9871
|
+
return;
|
|
9872
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
9873
|
+
}
|
|
9874
|
+
function up86(db) {
|
|
9875
|
+
addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
|
|
9876
|
+
db.exec(`
|
|
9877
|
+
CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
|
|
9878
|
+
ON summary_jobs(agent_id, session_key, content_hash)
|
|
9879
|
+
`);
|
|
9880
|
+
}
|
|
9636
9881
|
var MIGRATIONS = [
|
|
9637
9882
|
{
|
|
9638
9883
|
version: 1,
|
|
@@ -10297,6 +10542,45 @@ var MIGRATIONS = [
|
|
|
10297
10542
|
{ table: "skill_invocations", column: "tool_use_id" }
|
|
10298
10543
|
]
|
|
10299
10544
|
}
|
|
10545
|
+
},
|
|
10546
|
+
{
|
|
10547
|
+
version: 83,
|
|
10548
|
+
name: "memory-lifecycle-repair",
|
|
10549
|
+
up: up83,
|
|
10550
|
+
artifacts: {
|
|
10551
|
+
tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
|
|
10552
|
+
columns: [
|
|
10553
|
+
{ table: "documents", column: "agent_id" },
|
|
10554
|
+
{ table: "documents", column: "project" },
|
|
10555
|
+
{ table: "memories", column: "superseded_by" },
|
|
10556
|
+
{ table: "memories", column: "superseded_at" },
|
|
10557
|
+
{ table: "memories", column: "superseded_reason" }
|
|
10558
|
+
]
|
|
10559
|
+
}
|
|
10560
|
+
},
|
|
10561
|
+
{
|
|
10562
|
+
version: 84,
|
|
10563
|
+
name: "legacy-markdown-import-state",
|
|
10564
|
+
up: up84,
|
|
10565
|
+
artifacts: {
|
|
10566
|
+
tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
|
|
10567
|
+
}
|
|
10568
|
+
},
|
|
10569
|
+
{
|
|
10570
|
+
version: 85,
|
|
10571
|
+
name: "backfill-relations-to-dependencies",
|
|
10572
|
+
up: up85,
|
|
10573
|
+
artifacts: {
|
|
10574
|
+
tables: ["entity_dependencies"]
|
|
10575
|
+
}
|
|
10576
|
+
},
|
|
10577
|
+
{
|
|
10578
|
+
version: 86,
|
|
10579
|
+
name: "summary-jobs-content-hash",
|
|
10580
|
+
up: up86,
|
|
10581
|
+
artifacts: {
|
|
10582
|
+
columns: [{ table: "summary_jobs", column: "content_hash" }]
|
|
10583
|
+
}
|
|
10300
10584
|
}
|
|
10301
10585
|
];
|
|
10302
10586
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -17693,7 +17977,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
|
17693
17977
|
return true;
|
|
17694
17978
|
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
17695
17979
|
}
|
|
17696
|
-
function
|
|
17980
|
+
function up87(db) {
|
|
17697
17981
|
db.exec(`
|
|
17698
17982
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
17699
17983
|
version INTEGER PRIMARY KEY,
|
|
@@ -17782,31 +18066,31 @@ function up83(db) {
|
|
|
17782
18066
|
} catch {}
|
|
17783
18067
|
createMemoriesFts2(db);
|
|
17784
18068
|
}
|
|
17785
|
-
function
|
|
18069
|
+
function hasColumn13(db, table, column) {
|
|
17786
18070
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
17787
18071
|
return rows.some((r) => r.name === column);
|
|
17788
18072
|
}
|
|
17789
|
-
function
|
|
17790
|
-
if (!
|
|
18073
|
+
function addColumnIfMissing22(db, table, column, definition) {
|
|
18074
|
+
if (!hasColumn13(db, table, column)) {
|
|
17791
18075
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
17792
18076
|
}
|
|
17793
18077
|
}
|
|
17794
18078
|
function up210(db) {
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
18079
|
+
addColumnIfMissing22(db, "memories", "content_hash", "TEXT");
|
|
18080
|
+
addColumnIfMissing22(db, "memories", "normalized_content", "TEXT");
|
|
18081
|
+
addColumnIfMissing22(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
|
|
18082
|
+
addColumnIfMissing22(db, "memories", "deleted_at", "TEXT");
|
|
18083
|
+
addColumnIfMissing22(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
|
|
18084
|
+
addColumnIfMissing22(db, "memories", "embedding_model", "TEXT");
|
|
18085
|
+
addColumnIfMissing22(db, "memories", "extraction_model", "TEXT");
|
|
18086
|
+
addColumnIfMissing22(db, "memories", "update_count", "INTEGER DEFAULT 0");
|
|
18087
|
+
addColumnIfMissing22(db, "memories", "who", "TEXT");
|
|
18088
|
+
addColumnIfMissing22(db, "memories", "why", "TEXT");
|
|
18089
|
+
addColumnIfMissing22(db, "memories", "project", "TEXT");
|
|
18090
|
+
addColumnIfMissing22(db, "memories", "pinned", "INTEGER DEFAULT 0");
|
|
18091
|
+
addColumnIfMissing22(db, "memories", "importance", "REAL DEFAULT 0.5");
|
|
18092
|
+
addColumnIfMissing22(db, "memories", "last_accessed", "TEXT");
|
|
18093
|
+
addColumnIfMissing22(db, "memories", "access_count", "INTEGER DEFAULT 0");
|
|
17810
18094
|
db.exec(`
|
|
17811
18095
|
CREATE TABLE IF NOT EXISTS memory_history (
|
|
17812
18096
|
id TEXT PRIMARY KEY,
|
|
@@ -17902,7 +18186,7 @@ function up210(db) {
|
|
|
17902
18186
|
ON memory_entity_mentions(entity_id);
|
|
17903
18187
|
`);
|
|
17904
18188
|
}
|
|
17905
|
-
function
|
|
18189
|
+
function addColumnIfMissing23(db, table, column, definition) {
|
|
17906
18190
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
17907
18191
|
if (rows.some((r) => r.name === column))
|
|
17908
18192
|
return false;
|
|
@@ -17910,8 +18194,8 @@ function addColumnIfMissing22(db, table, column, definition) {
|
|
|
17910
18194
|
return true;
|
|
17911
18195
|
}
|
|
17912
18196
|
function up310(db) {
|
|
17913
|
-
|
|
17914
|
-
|
|
18197
|
+
addColumnIfMissing23(db, "memories", "why", "TEXT");
|
|
18198
|
+
addColumnIfMissing23(db, "memories", "project", "TEXT");
|
|
17915
18199
|
db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
|
|
17916
18200
|
db.exec(`
|
|
17917
18201
|
UPDATE memories
|
|
@@ -18068,7 +18352,7 @@ function up710(db) {
|
|
|
18068
18352
|
db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
|
|
18069
18353
|
}
|
|
18070
18354
|
}
|
|
18071
|
-
function
|
|
18355
|
+
function up88(db) {
|
|
18072
18356
|
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
|
|
18073
18357
|
if (tables.length === 0)
|
|
18074
18358
|
return;
|
|
@@ -19337,7 +19621,7 @@ function up492(db) {
|
|
|
19337
19621
|
);
|
|
19338
19622
|
`);
|
|
19339
19623
|
}
|
|
19340
|
-
function
|
|
19624
|
+
function hasTable4(db, name) {
|
|
19341
19625
|
return db.prepare(`SELECT name
|
|
19342
19626
|
FROM sqlite_master
|
|
19343
19627
|
WHERE type = 'table' AND name = ?
|
|
@@ -19367,7 +19651,7 @@ function up502(db) {
|
|
|
19367
19651
|
CREATE INDEX IF NOT EXISTS idx_entity_dependency_history_created
|
|
19368
19652
|
ON entity_dependency_history(created_at DESC);
|
|
19369
19653
|
`);
|
|
19370
|
-
if (!
|
|
19654
|
+
if (!hasTable4(db, "entity_dependencies"))
|
|
19371
19655
|
return;
|
|
19372
19656
|
db.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_insert");
|
|
19373
19657
|
db.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_update");
|
|
@@ -20377,11 +20661,256 @@ function up822(db) {
|
|
|
20377
20661
|
`);
|
|
20378
20662
|
db.exec("CREATE INDEX IF NOT EXISTS idx_skill_inv_harness ON skill_invocations(harness, created_at)");
|
|
20379
20663
|
}
|
|
20664
|
+
var DEPENDENCY_TYPES2 = new Set([
|
|
20665
|
+
"uses",
|
|
20666
|
+
"requires",
|
|
20667
|
+
"owned_by",
|
|
20668
|
+
"owns",
|
|
20669
|
+
"blocks",
|
|
20670
|
+
"informs",
|
|
20671
|
+
"maintains",
|
|
20672
|
+
"implements",
|
|
20673
|
+
"built",
|
|
20674
|
+
"depends_on",
|
|
20675
|
+
"related_to",
|
|
20676
|
+
"learned_from",
|
|
20677
|
+
"teaches",
|
|
20678
|
+
"knows",
|
|
20679
|
+
"assumes",
|
|
20680
|
+
"supports_claim",
|
|
20681
|
+
"authored_by",
|
|
20682
|
+
"links_to",
|
|
20683
|
+
"contains",
|
|
20684
|
+
"contains_note",
|
|
20685
|
+
"contradicts",
|
|
20686
|
+
"supersedes",
|
|
20687
|
+
"part_of",
|
|
20688
|
+
"produced_artifact",
|
|
20689
|
+
"precedes",
|
|
20690
|
+
"follows",
|
|
20691
|
+
"triggers",
|
|
20692
|
+
"may_execute",
|
|
20693
|
+
"requires_approval_from",
|
|
20694
|
+
"impacts",
|
|
20695
|
+
"produces",
|
|
20696
|
+
"consumes"
|
|
20697
|
+
]);
|
|
20698
|
+
function sqlStringList2(values) {
|
|
20699
|
+
return [...values].map((value) => `'${value}'`).join(", ");
|
|
20700
|
+
}
|
|
20701
|
+
function hasTable32(db, table) {
|
|
20702
|
+
return Boolean(db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(table));
|
|
20703
|
+
}
|
|
20704
|
+
function hasColumn122(db, table, column) {
|
|
20705
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
20706
|
+
return rows.some((row) => row.name === column);
|
|
20707
|
+
}
|
|
20708
|
+
function addColumnIfMissing202(db, table, column, definition) {
|
|
20709
|
+
if (!hasColumn122(db, table, column))
|
|
20710
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
20711
|
+
}
|
|
20712
|
+
function documentScopeColumnsPreservingExisting2(db) {
|
|
20713
|
+
const preserveAgentId = hasColumn122(db, "documents", "agent_id");
|
|
20714
|
+
const preserveProject = hasColumn122(db, "documents", "project");
|
|
20715
|
+
if (preserveAgentId) {
|
|
20716
|
+
db.exec(`
|
|
20717
|
+
CREATE TEMP TABLE __signet_doc_agent_guard AS
|
|
20718
|
+
SELECT id, agent_id FROM documents
|
|
20719
|
+
WHERE NULLIF(TRIM(agent_id), '') IS NOT NULL
|
|
20720
|
+
AND NULLIF(TRIM(agent_id), '') <> 'default'
|
|
20721
|
+
`);
|
|
20722
|
+
}
|
|
20723
|
+
if (preserveProject) {
|
|
20724
|
+
db.exec(`
|
|
20725
|
+
CREATE TEMP TABLE __signet_doc_project_guard AS
|
|
20726
|
+
SELECT id, project FROM documents
|
|
20727
|
+
WHERE NULLIF(TRIM(project), '') IS NOT NULL
|
|
20728
|
+
`);
|
|
20729
|
+
}
|
|
20730
|
+
try {
|
|
20731
|
+
up802(db);
|
|
20732
|
+
if (preserveAgentId) {
|
|
20733
|
+
db.exec(`
|
|
20734
|
+
UPDATE documents
|
|
20735
|
+
SET agent_id = (SELECT agent_id FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
20736
|
+
WHERE EXISTS (SELECT 1 FROM __signet_doc_agent_guard WHERE __signet_doc_agent_guard.id = documents.id)
|
|
20737
|
+
`);
|
|
20738
|
+
}
|
|
20739
|
+
if (preserveProject) {
|
|
20740
|
+
db.exec(`
|
|
20741
|
+
UPDATE documents
|
|
20742
|
+
SET project = (SELECT project FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
20743
|
+
WHERE EXISTS (SELECT 1 FROM __signet_doc_project_guard WHERE __signet_doc_project_guard.id = documents.id)
|
|
20744
|
+
`);
|
|
20745
|
+
}
|
|
20746
|
+
} finally {
|
|
20747
|
+
db.exec("DROP TABLE IF EXISTS temp.__signet_doc_agent_guard");
|
|
20748
|
+
db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
|
|
20749
|
+
}
|
|
20750
|
+
}
|
|
20751
|
+
function up832(db) {
|
|
20752
|
+
up792(db);
|
|
20753
|
+
if (hasTable32(db, "documents")) {
|
|
20754
|
+
documentScopeColumnsPreservingExisting2(db);
|
|
20755
|
+
}
|
|
20756
|
+
up812(db);
|
|
20757
|
+
addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
|
|
20758
|
+
addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
|
|
20759
|
+
addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
|
|
20760
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_memories_superseded_by ON memories(superseded_by)");
|
|
20761
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_memories_active_supersession ON memories(is_deleted, superseded_by)");
|
|
20762
|
+
if (!hasTable32(db, "relations") || !hasTable32(db, "entity_dependencies"))
|
|
20763
|
+
return;
|
|
20764
|
+
addColumnIfMissing202(db, "entity_dependencies", "confidence", "REAL");
|
|
20765
|
+
addColumnIfMissing202(db, "entity_dependencies", "reason", "TEXT");
|
|
20766
|
+
addColumnIfMissing202(db, "entity_dependencies", "source_id", "TEXT");
|
|
20767
|
+
addColumnIfMissing202(db, "entity_dependencies", "source_kind", "TEXT");
|
|
20768
|
+
addColumnIfMissing202(db, "entity_dependencies", "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
|
|
20769
|
+
addColumnIfMissing202(db, "entity_dependencies", "status", "TEXT NOT NULL DEFAULT 'active'");
|
|
20770
|
+
const relationConfidence = hasColumn122(db, "relations", "confidence") ? "r.confidence" : "NULL";
|
|
20771
|
+
const relationUpdatedAt = hasColumn122(db, "relations", "updated_at") ? "r.updated_at" : "r.created_at";
|
|
20772
|
+
const sourceAgentId = hasColumn122(db, "entities", "agent_id") ? "COALESCE(NULLIF(TRIM(src.agent_id), ''), 'default')" : "'default'";
|
|
20773
|
+
const targetAgentId = hasColumn122(db, "entities", "agent_id") ? "COALESCE(NULLIF(TRIM(dst.agent_id), ''), 'default')" : "'default'";
|
|
20774
|
+
db.exec(`
|
|
20775
|
+
INSERT OR IGNORE INTO entity_dependencies (
|
|
20776
|
+
id,
|
|
20777
|
+
source_entity_id,
|
|
20778
|
+
target_entity_id,
|
|
20779
|
+
agent_id,
|
|
20780
|
+
dependency_type,
|
|
20781
|
+
strength,
|
|
20782
|
+
confidence,
|
|
20783
|
+
reason,
|
|
20784
|
+
created_at,
|
|
20785
|
+
updated_at,
|
|
20786
|
+
source_id,
|
|
20787
|
+
source_kind,
|
|
20788
|
+
proposal_evidence,
|
|
20789
|
+
status
|
|
20790
|
+
)
|
|
20791
|
+
SELECT
|
|
20792
|
+
'relation:' || r.id,
|
|
20793
|
+
r.source_entity_id,
|
|
20794
|
+
r.target_entity_id,
|
|
20795
|
+
COALESCE(${sourceAgentId}, ${targetAgentId}, 'default'),
|
|
20796
|
+
CASE WHEN r.relation_type IN (${sqlStringList2(DEPENDENCY_TYPES2)}) THEN r.relation_type ELSE 'related_to' END,
|
|
20797
|
+
MAX(0.1, MIN(1.0, COALESCE(r.strength, 0.5))),
|
|
20798
|
+
MAX(0.1, MIN(1.0, COALESCE(${relationConfidence}, 0.7))),
|
|
20799
|
+
'legacy relation backfill: ' || r.relation_type,
|
|
20800
|
+
COALESCE(r.created_at, datetime('now')),
|
|
20801
|
+
COALESCE(${relationUpdatedAt}, r.created_at, datetime('now')),
|
|
20802
|
+
r.id,
|
|
20803
|
+
'relation',
|
|
20804
|
+
'[]',
|
|
20805
|
+
'active'
|
|
20806
|
+
FROM relations r
|
|
20807
|
+
JOIN entities src ON src.id = r.source_entity_id
|
|
20808
|
+
JOIN entities dst ON dst.id = r.target_entity_id
|
|
20809
|
+
WHERE r.source_entity_id <> r.target_entity_id
|
|
20810
|
+
AND ${sourceAgentId} = ${targetAgentId}
|
|
20811
|
+
`);
|
|
20812
|
+
}
|
|
20813
|
+
function up842(db) {
|
|
20814
|
+
db.exec(`
|
|
20815
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
|
|
20816
|
+
path TEXT PRIMARY KEY,
|
|
20817
|
+
mtime_ms INTEGER NOT NULL,
|
|
20818
|
+
ctime_ms INTEGER NOT NULL,
|
|
20819
|
+
size INTEGER NOT NULL,
|
|
20820
|
+
content_hash TEXT NOT NULL,
|
|
20821
|
+
importer_version INTEGER NOT NULL,
|
|
20822
|
+
chunk_count INTEGER NOT NULL DEFAULT 0,
|
|
20823
|
+
last_imported_at TEXT NOT NULL,
|
|
20824
|
+
last_seen_at TEXT NOT NULL,
|
|
20825
|
+
status TEXT NOT NULL DEFAULT 'imported',
|
|
20826
|
+
error TEXT
|
|
20827
|
+
);
|
|
20828
|
+
|
|
20829
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_chunks (
|
|
20830
|
+
file_path TEXT NOT NULL,
|
|
20831
|
+
chunk_hash TEXT NOT NULL,
|
|
20832
|
+
chunk_index INTEGER NOT NULL,
|
|
20833
|
+
memory_id TEXT,
|
|
20834
|
+
source_id TEXT,
|
|
20835
|
+
created_at TEXT NOT NULL,
|
|
20836
|
+
PRIMARY KEY (file_path, chunk_hash)
|
|
20837
|
+
);
|
|
20838
|
+
|
|
20839
|
+
CREATE INDEX IF NOT EXISTS idx_legacy_markdown_chunks_memory_id
|
|
20840
|
+
ON legacy_markdown_chunks(memory_id);
|
|
20841
|
+
`);
|
|
20842
|
+
}
|
|
20843
|
+
function up852(db) {
|
|
20844
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
|
|
20845
|
+
const tableNames = new Set(tables.map((r) => String(r.name)));
|
|
20846
|
+
if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
|
|
20847
|
+
return;
|
|
20848
|
+
const relCols = db.prepare("PRAGMA table_info(relations)").all();
|
|
20849
|
+
const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
|
|
20850
|
+
const rel = new Set(relCols.map((c) => String(c.name)));
|
|
20851
|
+
const dep = new Set(depCols.map((c) => String(c.name)));
|
|
20852
|
+
if (!rel.has("source_entity_id") || !rel.has("relation_type"))
|
|
20853
|
+
return;
|
|
20854
|
+
if (!dep.has("source_entity_id") || !dep.has("dependency_type") || !dep.has("agent_id"))
|
|
20855
|
+
return;
|
|
20856
|
+
const hasRelConfidence = rel.has("confidence");
|
|
20857
|
+
const hasRelUpdated = rel.has("updated_at");
|
|
20858
|
+
const hasDepConfidence = dep.has("confidence");
|
|
20859
|
+
const hasDepReason = dep.has("reason");
|
|
20860
|
+
const hasDepStatus = dep.has("status");
|
|
20861
|
+
const selectParts = ["id", "source_entity_id", "target_entity_id"];
|
|
20862
|
+
const colParts = ["id", "source_entity_id", "target_entity_id"];
|
|
20863
|
+
selectParts.push("relation_type");
|
|
20864
|
+
colParts.push("dependency_type");
|
|
20865
|
+
selectParts.push("strength", "created_at");
|
|
20866
|
+
colParts.push("strength", "created_at");
|
|
20867
|
+
selectParts.push("'default'");
|
|
20868
|
+
colParts.push("agent_id");
|
|
20869
|
+
selectParts.push("NULL");
|
|
20870
|
+
colParts.push("aspect_id");
|
|
20871
|
+
if (hasRelConfidence && hasDepConfidence) {
|
|
20872
|
+
selectParts.push("confidence");
|
|
20873
|
+
colParts.push("confidence");
|
|
20874
|
+
}
|
|
20875
|
+
if (hasDepReason) {
|
|
20876
|
+
selectParts.push("'extracted'");
|
|
20877
|
+
colParts.push("reason");
|
|
20878
|
+
}
|
|
20879
|
+
if (hasDepStatus) {
|
|
20880
|
+
selectParts.push("'active'");
|
|
20881
|
+
colParts.push("status");
|
|
20882
|
+
}
|
|
20883
|
+
if (hasRelUpdated && dep.has("updated_at")) {
|
|
20884
|
+
selectParts.push("updated_at");
|
|
20885
|
+
colParts.push("updated_at");
|
|
20886
|
+
}
|
|
20887
|
+
const selectClause = selectParts.join(", ");
|
|
20888
|
+
const colsClause = colParts.join(", ");
|
|
20889
|
+
db.exec(`INSERT OR IGNORE INTO entity_dependencies (${colsClause})
|
|
20890
|
+
SELECT ${selectClause}
|
|
20891
|
+
FROM relations
|
|
20892
|
+
WHERE source_entity_id IS NOT NULL
|
|
20893
|
+
AND target_entity_id IS NOT NULL
|
|
20894
|
+
AND relation_type IS NOT NULL`);
|
|
20895
|
+
}
|
|
20896
|
+
function addColumnIfMissing212(db, table, column, definition) {
|
|
20897
|
+
const cols = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
20898
|
+
if (cols.some((col) => col.name === column))
|
|
20899
|
+
return;
|
|
20900
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
20901
|
+
}
|
|
20902
|
+
function up862(db) {
|
|
20903
|
+
addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
|
|
20904
|
+
db.exec(`
|
|
20905
|
+
CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
|
|
20906
|
+
ON summary_jobs(agent_id, session_key, content_hash)
|
|
20907
|
+
`);
|
|
20908
|
+
}
|
|
20380
20909
|
var MIGRATIONS2 = [
|
|
20381
20910
|
{
|
|
20382
20911
|
version: 1,
|
|
20383
20912
|
name: "baseline",
|
|
20384
|
-
up:
|
|
20913
|
+
up: up87,
|
|
20385
20914
|
artifacts: { tables: ["memories", "conversations", "embeddings"] }
|
|
20386
20915
|
},
|
|
20387
20916
|
{
|
|
@@ -20430,7 +20959,7 @@ var MIGRATIONS2 = [
|
|
|
20430
20959
|
{
|
|
20431
20960
|
version: 8,
|
|
20432
20961
|
name: "embeddings-unique-hash",
|
|
20433
|
-
up:
|
|
20962
|
+
up: up88
|
|
20434
20963
|
},
|
|
20435
20964
|
{
|
|
20436
20965
|
version: 9,
|
|
@@ -21041,6 +21570,45 @@ var MIGRATIONS2 = [
|
|
|
21041
21570
|
{ table: "skill_invocations", column: "tool_use_id" }
|
|
21042
21571
|
]
|
|
21043
21572
|
}
|
|
21573
|
+
},
|
|
21574
|
+
{
|
|
21575
|
+
version: 83,
|
|
21576
|
+
name: "memory-lifecycle-repair",
|
|
21577
|
+
up: up832,
|
|
21578
|
+
artifacts: {
|
|
21579
|
+
tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
|
|
21580
|
+
columns: [
|
|
21581
|
+
{ table: "documents", column: "agent_id" },
|
|
21582
|
+
{ table: "documents", column: "project" },
|
|
21583
|
+
{ table: "memories", column: "superseded_by" },
|
|
21584
|
+
{ table: "memories", column: "superseded_at" },
|
|
21585
|
+
{ table: "memories", column: "superseded_reason" }
|
|
21586
|
+
]
|
|
21587
|
+
}
|
|
21588
|
+
},
|
|
21589
|
+
{
|
|
21590
|
+
version: 84,
|
|
21591
|
+
name: "legacy-markdown-import-state",
|
|
21592
|
+
up: up842,
|
|
21593
|
+
artifacts: {
|
|
21594
|
+
tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
|
|
21595
|
+
}
|
|
21596
|
+
},
|
|
21597
|
+
{
|
|
21598
|
+
version: 85,
|
|
21599
|
+
name: "backfill-relations-to-dependencies",
|
|
21600
|
+
up: up852,
|
|
21601
|
+
artifacts: {
|
|
21602
|
+
tables: ["entity_dependencies"]
|
|
21603
|
+
}
|
|
21604
|
+
},
|
|
21605
|
+
{
|
|
21606
|
+
version: 86,
|
|
21607
|
+
name: "summary-jobs-content-hash",
|
|
21608
|
+
up: up862,
|
|
21609
|
+
artifacts: {
|
|
21610
|
+
columns: [{ table: "summary_jobs", column: "content_hash" }]
|
|
21611
|
+
}
|
|
21044
21612
|
}
|
|
21045
21613
|
];
|
|
21046
21614
|
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.
|
|
3
|
+
"version": "0.147.0",
|
|
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.
|
|
28
|
-
"@signetai/core": "0.
|
|
27
|
+
"@signetai/connector-base": "0.147.0",
|
|
28
|
+
"@signetai/core": "0.147.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^22.0.0",
|