@signetai/connector-hermes-agent 0.236.1 → 0.237.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 +439 -361
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10391,99 +10391,6 @@ Object.defineProperty(execFileHiddenImpl, promisify.custom, {
|
|
|
10391
10391
|
value: (...args) => Reflect.apply(nodeExecFileAsync, undefined, withWindowsHideArgument(args, 1))
|
|
10392
10392
|
});
|
|
10393
10393
|
var execFileSyncHidden = (...args) => Reflect.apply(nodeExecFileSync, undefined, withWindowsHideArgument(args, 1));
|
|
10394
|
-
var MEMORY_CONTENT_SAFETY_POLICY_VERSION = "memory-content-safety-v1";
|
|
10395
|
-
var MEMORY_CONTENT_SAFETY_REASONS = [
|
|
10396
|
-
"prompt_injection",
|
|
10397
|
-
"exfiltration",
|
|
10398
|
-
"credential_harvesting",
|
|
10399
|
-
"malicious_shell",
|
|
10400
|
-
"tool_directive",
|
|
10401
|
-
"invisible_unicode"
|
|
10402
|
-
];
|
|
10403
|
-
var INVISIBLE_UNICODE_RE = /(?:\u034f|[\u00ad\u061c\u070f\u180e\u200b\u200c\u200e\u200f\u202a-\u202e\u2060\u2066-\u2069\u206a-\u206f\ufeff]|[\u{e0000}-\u{e007f}])/u;
|
|
10404
|
-
var STRONG_DEFENSIVE_CONTEXT_RE = /\b(?:security\s+(?:guidance|discussion|analysis)|threat\s+model|defensive)\b/i;
|
|
10405
|
-
var REPORTING_CONTEXT_RE = /\b(?:example|illustrat\w*|sample|quote|quoted|detector|scanner|classif\w*)\b/i;
|
|
10406
|
-
var REPORTING_BEFORE_RE = /\b(?:example|illustrat\w*|sample|quote|quoted|detector|scanner|classif\w*)\b[\s\S]{0,80}\b(?:say\w*|read\w*|show\w*|flag\w*|detect\w*|describ\w*|demonstrat\w*|contain\w*|match\w*|pattern)\b/i;
|
|
10407
|
-
var REPORTING_AFTER_RE = /\b(?:detector|scanner|classif\w*|flag\w*|pattern|dangerous|unsafe|malicious|hostile|should|would|must|never|do not|don't|avoid|quoted)\b/i;
|
|
10408
|
-
var NEGATED_DIRECTIVE_RE = /\b(?:never|do not|don't|should not|must not|cannot|can't|avoid|prevent|detect|mitigat\w*)\b[\s\S]{0,80}$/i;
|
|
10409
|
-
var PROMPT_INJECTION_RES = [
|
|
10410
|
-
/\b(?:ignore|disregard|override|forget|bypass)\b[\s\S]{0,100}\b(?:previous|prior|above|earlier|system|developer|assistant|safety|security)?\s*(?:instructions?|rules?|prompt|message)\b/i,
|
|
10411
|
-
/\b(?:new|following|these)\s+(?:(?:system|developer|assistant|hidden)\s+)?instructions?\b/i,
|
|
10412
|
-
/(?:^|\n)\s*(?:system|developer|instruction|prompt)\s*:/im,
|
|
10413
|
-
/<\s*(?:system|developer|assistant|instruction|prompt)\b[^>]*>/i,
|
|
10414
|
-
/\b(?:you are now|act as|roleplay as|pretend to be)\b[\s\S]{0,80}\b(?:system|admin|developer|unrestricted|jailbreak|different agent)\b/i
|
|
10415
|
-
];
|
|
10416
|
-
var TOOL_DIRECTIVE_RES = [
|
|
10417
|
-
/<\s*(?:tool[_-]?call|function[_-]?call|invoke|tool)\b/i,
|
|
10418
|
-
/\b(?:assistant|system)\s+to\s*=\s*[a-z0-9_.-]+/i,
|
|
10419
|
-
/\b(?:call|invoke|use|run|execute)\s+(?:the\s+)?[a-z0-9_.-]+\s+tool\b/i
|
|
10420
|
-
];
|
|
10421
|
-
var EXFILTRATION_RE = /\b(?:reveal|show|print|send|upload|exfiltrat\w*|dump|forward|leak|transmit|export)\b[\s\S]{0,120}(?:\b(?:system\s+prompt|hidden\s+instructions?|secret(?:s)?|credential(?:s)?|password(?:s)?|api\s*keys?|tokens?|private\s+keys?|environment\s+variables?)\b|\.env\b|~\/(?:\.ssh)\/\S+|\/etc\/(?:shadow|passwd)\b)/i;
|
|
10422
|
-
var EXFILTRATION_REVERSE = /(?:\b(?:system\s+prompt|hidden\s+instructions?|secret(?:s)?|credential(?:s)?|password(?:s)?|api\s*keys?|tokens?|private\s+keys?|environment\s+variables?)\b|\.env\b|~\/(?:\.ssh)\/\S+|\/etc\/(?:shadow|passwd)\b)[\s\S]{0,120}\b(?:reveal|show|print|send|upload|exfiltrat\w*|dump|forward|leak|transmit|export)\b/i;
|
|
10423
|
-
var CREDENTIAL_HARVESTING_RE = /\b(?:enter|paste|provide|share|send|give|submit|type|hand over)\b[\s\S]{0,80}\b(?:password|api\s*key|token|secret|credential|private\s+key)\b/i;
|
|
10424
|
-
var DANGEROUS_SHELL_RE = /\b(?:curl|wget)\b[^\n]{0,240}\|\s*(?:ba|z|fi)?sh\b|\brm\s+-rf\s+(?:\/|~|\.ssh)[^\n]{0,240}|\b(?:cat|head|tail)\s+~\/?\.ssh\/(?:id_[a-z]+|authorized_keys)\b|\b(?:printenv|env)\b[^\n]{0,120}\b(?:curl|wget|send|upload|post)\b/i;
|
|
10425
|
-
function matchHasDefensiveContext(content, match) {
|
|
10426
|
-
if (!match || !match[0])
|
|
10427
|
-
return false;
|
|
10428
|
-
const start = match.index ?? 0;
|
|
10429
|
-
const before = content.slice(Math.max(0, start - 120), start);
|
|
10430
|
-
const after = content.slice(start + match[0].length, start + match[0].length + 160);
|
|
10431
|
-
return STRONG_DEFENSIVE_CONTEXT_RE.test(match[0]) || NEGATED_DIRECTIVE_RE.test(before) || STRONG_DEFENSIVE_CONTEXT_RE.test(before) || STRONG_DEFENSIVE_CONTEXT_RE.test(after) || REPORTING_BEFORE_RE.test(before) || REPORTING_CONTEXT_RE.test(before) && REPORTING_AFTER_RE.test(after);
|
|
10432
|
-
}
|
|
10433
|
-
function hasActionableMatch(content, patterns) {
|
|
10434
|
-
return patterns.some((pattern) => {
|
|
10435
|
-
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
10436
|
-
const searchable = new RegExp(pattern.source, flags);
|
|
10437
|
-
let match;
|
|
10438
|
-
while ((match = searchable.exec(content)) !== null) {
|
|
10439
|
-
if (!matchHasDefensiveContext(content, match))
|
|
10440
|
-
return true;
|
|
10441
|
-
if (match[0].length === 0)
|
|
10442
|
-
searchable.lastIndex += 1;
|
|
10443
|
-
}
|
|
10444
|
-
return false;
|
|
10445
|
-
});
|
|
10446
|
-
}
|
|
10447
|
-
function hasDangerousShell(content) {
|
|
10448
|
-
const searchable = new RegExp(DANGEROUS_SHELL_RE.source, `${DANGEROUS_SHELL_RE.flags}g`);
|
|
10449
|
-
let match;
|
|
10450
|
-
while ((match = searchable.exec(content)) !== null) {
|
|
10451
|
-
if (matchHasDefensiveContext(content, match))
|
|
10452
|
-
continue;
|
|
10453
|
-
const end = (match.index ?? 0) + match[0].length;
|
|
10454
|
-
const after = content.slice(end, end + 160);
|
|
10455
|
-
if (!STRONG_DEFENSIVE_CONTEXT_RE.test(after) && !REPORTING_AFTER_RE.test(after))
|
|
10456
|
-
return true;
|
|
10457
|
-
if (match[0].length === 0)
|
|
10458
|
-
searchable.lastIndex += 1;
|
|
10459
|
-
}
|
|
10460
|
-
return false;
|
|
10461
|
-
}
|
|
10462
|
-
function scanMemoryContent(content) {
|
|
10463
|
-
const raw = typeof content === "string" ? content : String(content ?? "");
|
|
10464
|
-
const normalized = raw.normalize("NFKC");
|
|
10465
|
-
const reasons = new Set;
|
|
10466
|
-
if (INVISIBLE_UNICODE_RE.test(raw))
|
|
10467
|
-
reasons.add("invisible_unicode");
|
|
10468
|
-
if (hasActionableMatch(normalized, PROMPT_INJECTION_RES))
|
|
10469
|
-
reasons.add("prompt_injection");
|
|
10470
|
-
if (hasActionableMatch(normalized, TOOL_DIRECTIVE_RES))
|
|
10471
|
-
reasons.add("tool_directive");
|
|
10472
|
-
if (hasActionableMatch(normalized, [EXFILTRATION_RE, EXFILTRATION_REVERSE]))
|
|
10473
|
-
reasons.add("exfiltration");
|
|
10474
|
-
if (hasActionableMatch(normalized, [CREDENTIAL_HARVESTING_RE]))
|
|
10475
|
-
reasons.add("credential_harvesting");
|
|
10476
|
-
if (hasDangerousShell(normalized))
|
|
10477
|
-
reasons.add("malicious_shell");
|
|
10478
|
-
const orderedReasons = MEMORY_CONTENT_SAFETY_REASONS.filter((reason) => reasons.has(reason));
|
|
10479
|
-
const status = orderedReasons.length === 0 ? "clean" : orderedReasons.every((reason) => reason === "invisible_unicode") ? "tainted" : "blocked";
|
|
10480
|
-
return {
|
|
10481
|
-
status,
|
|
10482
|
-
contextEligible: status === "clean",
|
|
10483
|
-
reasons: orderedReasons,
|
|
10484
|
-
policyVersion: MEMORY_CONTENT_SAFETY_POLICY_VERSION
|
|
10485
|
-
};
|
|
10486
|
-
}
|
|
10487
10394
|
var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
|
|
10488
10395
|
"extract",
|
|
10489
10396
|
"aggregate-recall",
|
|
@@ -10606,7 +10513,7 @@ function up4(db) {
|
|
|
10606
10513
|
function up5(db) {
|
|
10607
10514
|
db.exec("DROP TABLE IF EXISTS mcp_invocations");
|
|
10608
10515
|
}
|
|
10609
|
-
var MEMORIES_FTS_TOKENIZER = "unicode61";
|
|
10516
|
+
var MEMORIES_FTS_TOKENIZER = "porter unicode61";
|
|
10610
10517
|
var FTS_STATE_TABLE = "memories_fts_state";
|
|
10611
10518
|
function normalizeSql(sql) {
|
|
10612
10519
|
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
@@ -10716,10 +10623,7 @@ function readMemoriesFtsSql(db) {
|
|
|
10716
10623
|
function memoriesFtsNeedsTokenizerRepair(sql) {
|
|
10717
10624
|
if (sql === null)
|
|
10718
10625
|
return false;
|
|
10719
|
-
|
|
10720
|
-
if (normalized.includes("porter unicode61"))
|
|
10721
|
-
return true;
|
|
10722
|
-
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
|
|
10626
|
+
return !normalizeSql(sql).includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
|
|
10723
10627
|
}
|
|
10724
10628
|
function up6(db) {
|
|
10725
10629
|
db.exec(`
|
|
@@ -14632,38 +14536,6 @@ function up129(db) {
|
|
|
14632
14536
|
ON imported_source_lifecycle(agent_id, status, updated_at DESC);
|
|
14633
14537
|
`);
|
|
14634
14538
|
}
|
|
14635
|
-
function tableExists2(db, table) {
|
|
14636
|
-
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
14637
|
-
}
|
|
14638
|
-
function hasColumn24(db, table, column) {
|
|
14639
|
-
return db.prepare(`PRAGMA table_info("${table}")`).all().some((row) => row.name === column);
|
|
14640
|
-
}
|
|
14641
|
-
function backfill(db, rows, sourceKind, scannedAt) {
|
|
14642
|
-
const statement = db.prepare(`INSERT INTO memory_content_safety
|
|
14643
|
-
(agent_id, source_kind, source_id, status, context_eligible, reasons_json, policy_version, scanned_at)
|
|
14644
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
14645
|
-
ON CONFLICT(agent_id, source_kind, source_id) DO UPDATE SET
|
|
14646
|
-
status = excluded.status,
|
|
14647
|
-
context_eligible = excluded.context_eligible,
|
|
14648
|
-
reasons_json = excluded.reasons_json,
|
|
14649
|
-
policy_version = excluded.policy_version,
|
|
14650
|
-
scanned_at = excluded.scanned_at`);
|
|
14651
|
-
for (const row of rows) {
|
|
14652
|
-
const sourceId = row.source_id?.trim();
|
|
14653
|
-
if (!sourceId)
|
|
14654
|
-
continue;
|
|
14655
|
-
const assessment = scanMemoryContent(row.content ?? "");
|
|
14656
|
-
statement.run(row.agent_id?.trim() || "default", sourceKind, sourceId, assessment.status, assessment.contextEligible ? 1 : 0, JSON.stringify(assessment.reasons), MEMORY_CONTENT_SAFETY_POLICY_VERSION, scannedAt);
|
|
14657
|
-
}
|
|
14658
|
-
}
|
|
14659
|
-
function backfillTable(db, params) {
|
|
14660
|
-
if (!tableExists2(db, params.table) || !hasColumn24(db, params.table, params.sourceIdColumn) || !hasColumn24(db, params.table, params.contentColumn))
|
|
14661
|
-
return;
|
|
14662
|
-
const agentColumn = hasColumn24(db, params.table, "agent_id") ? "COALESCE(NULLIF(TRIM(agent_id), ''), 'default')" : "'default'";
|
|
14663
|
-
const rows = db.prepare(`SELECT ${agentColumn} AS agent_id, ${params.sourceIdColumn} AS source_id, ${params.contentColumn} AS content
|
|
14664
|
-
FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
|
|
14665
|
-
backfill(db, rows, params.sourceKind, params.scannedAt);
|
|
14666
|
-
}
|
|
14667
14539
|
function up130(db) {
|
|
14668
14540
|
db.exec(`
|
|
14669
14541
|
CREATE TABLE IF NOT EXISTS memory_content_safety (
|
|
@@ -14683,43 +14555,6 @@ function up130(db) {
|
|
|
14683
14555
|
CREATE INDEX IF NOT EXISTS idx_memory_content_safety_eligibility
|
|
14684
14556
|
ON memory_content_safety(agent_id, source_kind, context_eligible);
|
|
14685
14557
|
`);
|
|
14686
|
-
const scannedAt = new Date().toISOString();
|
|
14687
|
-
backfillTable(db, {
|
|
14688
|
-
table: "memories",
|
|
14689
|
-
sourceKind: "memory",
|
|
14690
|
-
sourceIdColumn: "id",
|
|
14691
|
-
contentColumn: "content",
|
|
14692
|
-
scannedAt
|
|
14693
|
-
});
|
|
14694
|
-
backfillTable(db, {
|
|
14695
|
-
table: "memory_artifacts",
|
|
14696
|
-
sourceKind: "artifact",
|
|
14697
|
-
sourceIdColumn: "source_path",
|
|
14698
|
-
contentColumn: "content",
|
|
14699
|
-
scannedAt
|
|
14700
|
-
});
|
|
14701
|
-
backfillTable(db, {
|
|
14702
|
-
table: "session_transcripts",
|
|
14703
|
-
sourceKind: "transcript",
|
|
14704
|
-
sourceIdColumn: "session_key",
|
|
14705
|
-
contentColumn: "content",
|
|
14706
|
-
scannedAt
|
|
14707
|
-
});
|
|
14708
|
-
backfillTable(db, {
|
|
14709
|
-
table: "session_summaries",
|
|
14710
|
-
sourceKind: "summary",
|
|
14711
|
-
sourceIdColumn: "id",
|
|
14712
|
-
contentColumn: "content",
|
|
14713
|
-
scannedAt
|
|
14714
|
-
});
|
|
14715
|
-
backfillTable(db, {
|
|
14716
|
-
table: "embeddings",
|
|
14717
|
-
sourceKind: "source_chunk",
|
|
14718
|
-
sourceIdColumn: "id",
|
|
14719
|
-
contentColumn: "chunk_text",
|
|
14720
|
-
where: "source_type IN ('source_chunk', 'source_obsidian_chunk')",
|
|
14721
|
-
scannedAt
|
|
14722
|
-
});
|
|
14723
14558
|
}
|
|
14724
14559
|
function up131(db) {
|
|
14725
14560
|
const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
|
|
@@ -14823,13 +14658,13 @@ function up133(db) {
|
|
|
14823
14658
|
AND error IS NOT NULL;
|
|
14824
14659
|
`);
|
|
14825
14660
|
}
|
|
14826
|
-
function
|
|
14661
|
+
function tableExists2(db, table) {
|
|
14827
14662
|
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
14828
14663
|
}
|
|
14829
14664
|
function up134(db) {
|
|
14830
|
-
if (!
|
|
14665
|
+
if (!tableExists2(db, "memory_jobs"))
|
|
14831
14666
|
return;
|
|
14832
|
-
if (!
|
|
14667
|
+
if (!tableExists2(db, "job_cancellations")) {
|
|
14833
14668
|
throw new Error("job_cancellations table missing; cannot retire structural jobs without an audit trail");
|
|
14834
14669
|
}
|
|
14835
14670
|
db.prepare(`
|
|
@@ -15058,12 +14893,12 @@ function up142(db) {
|
|
|
15058
14893
|
if (!cols.has(name))
|
|
15059
14894
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
15060
14895
|
}
|
|
15061
|
-
function
|
|
14896
|
+
function hasColumn24(db, table, column) {
|
|
15062
14897
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
15063
14898
|
return rows.some((row) => row.name === column);
|
|
15064
14899
|
}
|
|
15065
14900
|
function addColumnIfMissing28(db, table, column, definition) {
|
|
15066
|
-
if (!
|
|
14901
|
+
if (!hasColumn24(db, table, column))
|
|
15067
14902
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
15068
14903
|
}
|
|
15069
14904
|
function up143(db) {
|
|
@@ -15935,6 +15770,138 @@ function up162(db) {
|
|
|
15935
15770
|
END;
|
|
15936
15771
|
`);
|
|
15937
15772
|
}
|
|
15773
|
+
function up163(db) {
|
|
15774
|
+
db.exec(`
|
|
15775
|
+
DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_ai;
|
|
15776
|
+
DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_au;
|
|
15777
|
+
DROP INDEX IF EXISTS idx_memory_content_safety_status;
|
|
15778
|
+
DROP INDEX IF EXISTS idx_memory_content_safety_eligibility;
|
|
15779
|
+
DROP TABLE IF EXISTS memory_content_safety;
|
|
15780
|
+
`);
|
|
15781
|
+
}
|
|
15782
|
+
var COLUMNS3 = ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"];
|
|
15783
|
+
function up164(db) {
|
|
15784
|
+
const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
|
|
15785
|
+
for (const column of COLUMNS3) {
|
|
15786
|
+
if (!cols.some((col) => col.name === column)) {
|
|
15787
|
+
db.exec(`ALTER TABLE entity_attributes ADD COLUMN ${column} TEXT`);
|
|
15788
|
+
}
|
|
15789
|
+
}
|
|
15790
|
+
}
|
|
15791
|
+
function up165(db) {
|
|
15792
|
+
const passColumns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
15793
|
+
if (!passColumns.some((column) => column.name === "scope_key")) {
|
|
15794
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN scope_key TEXT");
|
|
15795
|
+
}
|
|
15796
|
+
db.exec(`
|
|
15797
|
+
CREATE TABLE IF NOT EXISTS dreaming_history_nodes (
|
|
15798
|
+
agent_id TEXT NOT NULL,
|
|
15799
|
+
scope_key TEXT NOT NULL,
|
|
15800
|
+
level INTEGER NOT NULL,
|
|
15801
|
+
idx INTEGER NOT NULL,
|
|
15802
|
+
pass_id TEXT,
|
|
15803
|
+
text TEXT NOT NULL,
|
|
15804
|
+
tokens_input INTEGER,
|
|
15805
|
+
tokens_output INTEGER,
|
|
15806
|
+
tokens_cache_read INTEGER,
|
|
15807
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
15808
|
+
PRIMARY KEY (agent_id, scope_key, level, idx)
|
|
15809
|
+
);
|
|
15810
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_dreaming_history_nodes_pass
|
|
15811
|
+
ON dreaming_history_nodes(pass_id) WHERE pass_id IS NOT NULL;
|
|
15812
|
+
`);
|
|
15813
|
+
}
|
|
15814
|
+
function up166(db) {
|
|
15815
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
15816
|
+
if (!columns.some((column) => column.name === "tokens_peak_context")) {
|
|
15817
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN tokens_peak_context INTEGER");
|
|
15818
|
+
}
|
|
15819
|
+
}
|
|
15820
|
+
function up167(db) {
|
|
15821
|
+
const sql = readMemoriesFtsSql(db);
|
|
15822
|
+
if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
|
|
15823
|
+
return;
|
|
15824
|
+
recreateMemoriesFts(db);
|
|
15825
|
+
}
|
|
15826
|
+
function hasTable5(db, table) {
|
|
15827
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
15828
|
+
}
|
|
15829
|
+
function hasColumn25(db, table, column) {
|
|
15830
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
15831
|
+
}
|
|
15832
|
+
function up168(db) {
|
|
15833
|
+
if (!hasTable5(db, "entity_attributes") || !hasTable5(db, "entity_aspects") || !hasTable5(db, "entities") || !hasColumn25(db, "entity_attributes", "source_root") || !hasColumn25(db, "entities", "source_root")) {
|
|
15834
|
+
return;
|
|
15835
|
+
}
|
|
15836
|
+
const now = new Date().toISOString();
|
|
15837
|
+
db.exec(`
|
|
15838
|
+
CREATE TEMP TABLE retired_source_paragraphs AS
|
|
15839
|
+
SELECT attr.id, attr.memory_id, attr.agent_id, asp.entity_id
|
|
15840
|
+
FROM entity_attributes attr
|
|
15841
|
+
JOIN entity_aspects asp ON asp.id = attr.aspect_id
|
|
15842
|
+
JOIN entities e ON e.id = asp.entity_id
|
|
15843
|
+
WHERE e.entity_type IN ('source_document', 'source_document_reference')
|
|
15844
|
+
AND attr.source_root IS NOT NULL
|
|
15845
|
+
AND attr.source_root = e.source_root
|
|
15846
|
+
AND attr.source_id = e.source_id
|
|
15847
|
+
AND attr.source_root NOT IN ('dreaming', 'dreaming_attention')
|
|
15848
|
+
`);
|
|
15849
|
+
if (hasColumn25(db, "entity_attributes", "memory_id") && hasTable5(db, "memories")) {
|
|
15850
|
+
if (hasTable5(db, "memory_history")) {
|
|
15851
|
+
db.prepare(`INSERT INTO memory_history (id, memory_id, event, old_content, new_content, changed_by, reason, metadata, created_at)
|
|
15852
|
+
SELECT lower(hex(randomblob(16))), mem.id, 'deleted', mem.content, NULL, 'migration:168',
|
|
15853
|
+
'Source paragraph claims retired', '{"force":true}', ?
|
|
15854
|
+
FROM memories mem
|
|
15855
|
+
JOIN retired_source_paragraphs retired ON retired.memory_id = mem.id
|
|
15856
|
+
WHERE mem.is_deleted = 0`).run(now);
|
|
15857
|
+
}
|
|
15858
|
+
if (hasTable5(db, "derived_memory_sources") && hasColumn25(db, "memories", "stale_at")) {
|
|
15859
|
+
db.prepare(`UPDATE memories
|
|
15860
|
+
SET stale_at = ?
|
|
15861
|
+
WHERE stale_at IS NULL
|
|
15862
|
+
AND is_deleted = 0
|
|
15863
|
+
AND id IN (
|
|
15864
|
+
SELECT dms.derived_memory_id
|
|
15865
|
+
FROM derived_memory_sources dms
|
|
15866
|
+
JOIN retired_source_paragraphs retired ON retired.agent_id = dms.agent_id
|
|
15867
|
+
WHERE (dms.source_kind = 'memory' AND dms.source_id = retired.memory_id)
|
|
15868
|
+
OR (dms.source_kind = 'ontology_claim' AND dms.source_id = retired.id)
|
|
15869
|
+
)`).run(now);
|
|
15870
|
+
}
|
|
15871
|
+
const forget = [
|
|
15872
|
+
"is_deleted = 1",
|
|
15873
|
+
...["deleted_at", "updated_at"].filter((column) => hasColumn25(db, "memories", column)).map((column) => `${column} = $now`),
|
|
15874
|
+
...hasColumn25(db, "memories", "updated_by") ? ["updated_by = 'migration:168'"] : [],
|
|
15875
|
+
...hasColumn25(db, "memories", "version") ? ["version = version + 1"] : []
|
|
15876
|
+
];
|
|
15877
|
+
db.prepare(`UPDATE memories
|
|
15878
|
+
SET ${forget.join(", ")}
|
|
15879
|
+
WHERE is_deleted = 0
|
|
15880
|
+
AND id IN (SELECT memory_id FROM retired_source_paragraphs WHERE memory_id IS NOT NULL)`).run({ $now: now });
|
|
15881
|
+
if (hasTable5(db, "memory_entity_mentions")) {
|
|
15882
|
+
db.exec(`
|
|
15883
|
+
DELETE FROM memory_entity_mentions
|
|
15884
|
+
WHERE memory_id IN (SELECT memory_id FROM retired_source_paragraphs WHERE memory_id IS NOT NULL)
|
|
15885
|
+
`);
|
|
15886
|
+
}
|
|
15887
|
+
}
|
|
15888
|
+
if (hasTable5(db, "ontology_contradictions")) {
|
|
15889
|
+
db.prepare(`UPDATE ontology_contradictions
|
|
15890
|
+
SET status = 'resolved', resolved_at = ?, resolution_reason = 'source paragraph claims retired', updated_at = ?
|
|
15891
|
+
WHERE status = 'active'
|
|
15892
|
+
AND (left_attribute_id IN (SELECT id FROM retired_source_paragraphs)
|
|
15893
|
+
OR right_attribute_id IN (SELECT id FROM retired_source_paragraphs))`).run(now, now);
|
|
15894
|
+
}
|
|
15895
|
+
db.exec(`
|
|
15896
|
+
DELETE FROM entity_attributes WHERE id IN (SELECT id FROM retired_source_paragraphs);
|
|
15897
|
+
DELETE FROM entity_aspects
|
|
15898
|
+
WHERE entity_id IN (
|
|
15899
|
+
SELECT id FROM entities WHERE entity_type IN ('source_document', 'source_document_reference')
|
|
15900
|
+
)
|
|
15901
|
+
AND NOT EXISTS (SELECT 1 FROM entity_attributes attr WHERE attr.aspect_id = entity_aspects.id);
|
|
15902
|
+
DROP TABLE retired_source_paragraphs;
|
|
15903
|
+
`);
|
|
15904
|
+
}
|
|
15938
15905
|
var MIGRATIONS = [
|
|
15939
15906
|
{
|
|
15940
15907
|
version: 1,
|
|
@@ -16944,8 +16911,7 @@ var MIGRATIONS = [
|
|
|
16944
16911
|
{
|
|
16945
16912
|
version: 125,
|
|
16946
16913
|
name: "memory-content-safety",
|
|
16947
|
-
up: up130
|
|
16948
|
-
artifacts: { tables: ["memory_content_safety"] }
|
|
16914
|
+
up: up130
|
|
16949
16915
|
},
|
|
16950
16916
|
{
|
|
16951
16917
|
version: 126,
|
|
@@ -17247,6 +17213,48 @@ var MIGRATIONS = [
|
|
|
17247
17213
|
name: "generic-entity-prune-scan-generation",
|
|
17248
17214
|
up: up162,
|
|
17249
17215
|
artifacts: { tables: ["generic_entity_prune_scan_state"] }
|
|
17216
|
+
},
|
|
17217
|
+
{
|
|
17218
|
+
version: 163,
|
|
17219
|
+
name: "retire-memory-content-safety",
|
|
17220
|
+
up: up163
|
|
17221
|
+
},
|
|
17222
|
+
{
|
|
17223
|
+
version: 164,
|
|
17224
|
+
name: "claim-event-time",
|
|
17225
|
+
up: up164,
|
|
17226
|
+
artifacts: {
|
|
17227
|
+
columns: ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"].map((column) => ({
|
|
17228
|
+
table: "entity_attributes",
|
|
17229
|
+
column
|
|
17230
|
+
}))
|
|
17231
|
+
}
|
|
17232
|
+
},
|
|
17233
|
+
{
|
|
17234
|
+
version: 165,
|
|
17235
|
+
name: "dreaming-history",
|
|
17236
|
+
up: up165,
|
|
17237
|
+
artifacts: {
|
|
17238
|
+
tables: ["dreaming_history_nodes"],
|
|
17239
|
+
indexes: ["idx_dreaming_history_nodes_pass"],
|
|
17240
|
+
columns: [{ table: "dreaming_passes", column: "scope_key" }]
|
|
17241
|
+
}
|
|
17242
|
+
},
|
|
17243
|
+
{
|
|
17244
|
+
version: 166,
|
|
17245
|
+
name: "dreaming-pass-peak-context",
|
|
17246
|
+
up: up166,
|
|
17247
|
+
artifacts: { columns: [{ table: "dreaming_passes", column: "tokens_peak_context" }] }
|
|
17248
|
+
},
|
|
17249
|
+
{
|
|
17250
|
+
version: 167,
|
|
17251
|
+
name: "memories-fts-porter",
|
|
17252
|
+
up: up167
|
|
17253
|
+
},
|
|
17254
|
+
{
|
|
17255
|
+
version: 168,
|
|
17256
|
+
name: "retire-source-paragraph-claims",
|
|
17257
|
+
up: up168
|
|
17250
17258
|
}
|
|
17251
17259
|
];
|
|
17252
17260
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -17488,6 +17496,37 @@ var PIPELINE_PROVIDER_CHOICES = [
|
|
|
17488
17496
|
var SYNTHESIS_PROVIDER_CHOICES = PIPELINE_PROVIDER_CHOICES.filter((provider) => provider !== "command");
|
|
17489
17497
|
var PIPELINE_PROVIDER_SET = new Set(PIPELINE_PROVIDER_CHOICES);
|
|
17490
17498
|
var SYNTHESIS_PROVIDER_SET = new Set(SYNTHESIS_PROVIDER_CHOICES);
|
|
17499
|
+
var SECRET_NAMES = "(?:access[_-]?token|api[_-]?key|apikey|auth[_-]?token|client[_-]?secret|passw(?:or)?d|refresh[_-]?token|private[_-]?key|secret(?:[_-]?key)?|token)";
|
|
17500
|
+
var SECRET_VALUE = `(?=[^\\s"',;&<>()\\[\\]{}$]*\\d)[^\\s"',;&<>()\\[\\]{}$]{8,}`;
|
|
17501
|
+
var PATTERNS = [
|
|
17502
|
+
{
|
|
17503
|
+
kind: "private_key",
|
|
17504
|
+
pattern: /-----BEGIN (?:[A-Z]+ )*PRIVATE KEY-----[\s\S]*?-----END (?:[A-Z]+ )*PRIVATE KEY-----/g
|
|
17505
|
+
},
|
|
17506
|
+
{
|
|
17507
|
+
kind: "provider_key",
|
|
17508
|
+
pattern: /\b(?:(?:AKIA|ASIA)[0-9A-Z]{16}|github_pat_[A-Za-z0-9_]{20,}|gh[pousr]_[A-Za-z0-9]{20,}|sk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}|(?:sk|rk)_(?:live|test)_[0-9A-Za-z]{16,}|xox[abprs]-[A-Za-z0-9-]{10,}|AIza[0-9A-Za-z_-]{35}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\b/g
|
|
17509
|
+
},
|
|
17510
|
+
{
|
|
17511
|
+
kind: "jwt",
|
|
17512
|
+
pattern: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g
|
|
17513
|
+
},
|
|
17514
|
+
{
|
|
17515
|
+
kind: "bearer_token",
|
|
17516
|
+
pattern: /\bBearer\s+([A-Za-z0-9._~+/-]{16,}=*)/g,
|
|
17517
|
+
valueGroup: 1
|
|
17518
|
+
},
|
|
17519
|
+
{
|
|
17520
|
+
kind: "secret_assignment",
|
|
17521
|
+
pattern: new RegExp(`\\b${SECRET_NAMES}["']?\\s*[:=]\\s*["']?(${SECRET_VALUE})`, "gi"),
|
|
17522
|
+
valueGroup: 1
|
|
17523
|
+
},
|
|
17524
|
+
{
|
|
17525
|
+
kind: "secret_assignment",
|
|
17526
|
+
pattern: new RegExp(`\\b[A-Z][A-Z0-9_]*(?:API_KEY|TOKEN|SECRET|PASSWORD)\\s*=\\s*["']?(${SECRET_VALUE})`, "g"),
|
|
17527
|
+
valueGroup: 1
|
|
17528
|
+
}
|
|
17529
|
+
];
|
|
17491
17530
|
var LOOPBACK_HOST = "127.0.0.1";
|
|
17492
17531
|
var LOCAL_BINDS = new Set([LOOPBACK_HOST, "localhost", "::1", "::ffff:127.0.0.1"]);
|
|
17493
17532
|
var native = null;
|
|
@@ -28006,99 +28045,6 @@ var execFileHiddenImpl2 = (...args) => Reflect.apply(nodeExecFile2, undefined, w
|
|
|
28006
28045
|
Object.defineProperty(execFileHiddenImpl2, promisify2.custom, {
|
|
28007
28046
|
value: (...args) => Reflect.apply(nodeExecFileAsync2, undefined, withWindowsHideArgument2(args, 1))
|
|
28008
28047
|
});
|
|
28009
|
-
var MEMORY_CONTENT_SAFETY_POLICY_VERSION2 = "memory-content-safety-v1";
|
|
28010
|
-
var MEMORY_CONTENT_SAFETY_REASONS2 = [
|
|
28011
|
-
"prompt_injection",
|
|
28012
|
-
"exfiltration",
|
|
28013
|
-
"credential_harvesting",
|
|
28014
|
-
"malicious_shell",
|
|
28015
|
-
"tool_directive",
|
|
28016
|
-
"invisible_unicode"
|
|
28017
|
-
];
|
|
28018
|
-
var INVISIBLE_UNICODE_RE2 = /(?:\u034f|[\u00ad\u061c\u070f\u180e\u200b\u200c\u200e\u200f\u202a-\u202e\u2060\u2066-\u2069\u206a-\u206f\ufeff]|[\u{e0000}-\u{e007f}])/u;
|
|
28019
|
-
var STRONG_DEFENSIVE_CONTEXT_RE2 = /\b(?:security\s+(?:guidance|discussion|analysis)|threat\s+model|defensive)\b/i;
|
|
28020
|
-
var REPORTING_CONTEXT_RE2 = /\b(?:example|illustrat\w*|sample|quote|quoted|detector|scanner|classif\w*)\b/i;
|
|
28021
|
-
var REPORTING_BEFORE_RE2 = /\b(?:example|illustrat\w*|sample|quote|quoted|detector|scanner|classif\w*)\b[\s\S]{0,80}\b(?:say\w*|read\w*|show\w*|flag\w*|detect\w*|describ\w*|demonstrat\w*|contain\w*|match\w*|pattern)\b/i;
|
|
28022
|
-
var REPORTING_AFTER_RE2 = /\b(?:detector|scanner|classif\w*|flag\w*|pattern|dangerous|unsafe|malicious|hostile|should|would|must|never|do not|don't|avoid|quoted)\b/i;
|
|
28023
|
-
var NEGATED_DIRECTIVE_RE2 = /\b(?:never|do not|don't|should not|must not|cannot|can't|avoid|prevent|detect|mitigat\w*)\b[\s\S]{0,80}$/i;
|
|
28024
|
-
var PROMPT_INJECTION_RES2 = [
|
|
28025
|
-
/\b(?:ignore|disregard|override|forget|bypass)\b[\s\S]{0,100}\b(?:previous|prior|above|earlier|system|developer|assistant|safety|security)?\s*(?:instructions?|rules?|prompt|message)\b/i,
|
|
28026
|
-
/\b(?:new|following|these)\s+(?:(?:system|developer|assistant|hidden)\s+)?instructions?\b/i,
|
|
28027
|
-
/(?:^|\n)\s*(?:system|developer|instruction|prompt)\s*:/im,
|
|
28028
|
-
/<\s*(?:system|developer|assistant|instruction|prompt)\b[^>]*>/i,
|
|
28029
|
-
/\b(?:you are now|act as|roleplay as|pretend to be)\b[\s\S]{0,80}\b(?:system|admin|developer|unrestricted|jailbreak|different agent)\b/i
|
|
28030
|
-
];
|
|
28031
|
-
var TOOL_DIRECTIVE_RES2 = [
|
|
28032
|
-
/<\s*(?:tool[_-]?call|function[_-]?call|invoke|tool)\b/i,
|
|
28033
|
-
/\b(?:assistant|system)\s+to\s*=\s*[a-z0-9_.-]+/i,
|
|
28034
|
-
/\b(?:call|invoke|use|run|execute)\s+(?:the\s+)?[a-z0-9_.-]+\s+tool\b/i
|
|
28035
|
-
];
|
|
28036
|
-
var EXFILTRATION_RE2 = /\b(?:reveal|show|print|send|upload|exfiltrat\w*|dump|forward|leak|transmit|export)\b[\s\S]{0,120}(?:\b(?:system\s+prompt|hidden\s+instructions?|secret(?:s)?|credential(?:s)?|password(?:s)?|api\s*keys?|tokens?|private\s+keys?|environment\s+variables?)\b|\.env\b|~\/(?:\.ssh)\/\S+|\/etc\/(?:shadow|passwd)\b)/i;
|
|
28037
|
-
var EXFILTRATION_REVERSE2 = /(?:\b(?:system\s+prompt|hidden\s+instructions?|secret(?:s)?|credential(?:s)?|password(?:s)?|api\s*keys?|tokens?|private\s+keys?|environment\s+variables?)\b|\.env\b|~\/(?:\.ssh)\/\S+|\/etc\/(?:shadow|passwd)\b)[\s\S]{0,120}\b(?:reveal|show|print|send|upload|exfiltrat\w*|dump|forward|leak|transmit|export)\b/i;
|
|
28038
|
-
var CREDENTIAL_HARVESTING_RE2 = /\b(?:enter|paste|provide|share|send|give|submit|type|hand over)\b[\s\S]{0,80}\b(?:password|api\s*key|token|secret|credential|private\s+key)\b/i;
|
|
28039
|
-
var DANGEROUS_SHELL_RE2 = /\b(?:curl|wget)\b[^\n]{0,240}\|\s*(?:ba|z|fi)?sh\b|\brm\s+-rf\s+(?:\/|~|\.ssh)[^\n]{0,240}|\b(?:cat|head|tail)\s+~\/?\.ssh\/(?:id_[a-z]+|authorized_keys)\b|\b(?:printenv|env)\b[^\n]{0,120}\b(?:curl|wget|send|upload|post)\b/i;
|
|
28040
|
-
function matchHasDefensiveContext2(content, match) {
|
|
28041
|
-
if (!match || !match[0])
|
|
28042
|
-
return false;
|
|
28043
|
-
const start = match.index ?? 0;
|
|
28044
|
-
const before = content.slice(Math.max(0, start - 120), start);
|
|
28045
|
-
const after = content.slice(start + match[0].length, start + match[0].length + 160);
|
|
28046
|
-
return STRONG_DEFENSIVE_CONTEXT_RE2.test(match[0]) || NEGATED_DIRECTIVE_RE2.test(before) || STRONG_DEFENSIVE_CONTEXT_RE2.test(before) || STRONG_DEFENSIVE_CONTEXT_RE2.test(after) || REPORTING_BEFORE_RE2.test(before) || REPORTING_CONTEXT_RE2.test(before) && REPORTING_AFTER_RE2.test(after);
|
|
28047
|
-
}
|
|
28048
|
-
function hasActionableMatch2(content, patterns) {
|
|
28049
|
-
return patterns.some((pattern) => {
|
|
28050
|
-
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
28051
|
-
const searchable = new RegExp(pattern.source, flags);
|
|
28052
|
-
let match;
|
|
28053
|
-
while ((match = searchable.exec(content)) !== null) {
|
|
28054
|
-
if (!matchHasDefensiveContext2(content, match))
|
|
28055
|
-
return true;
|
|
28056
|
-
if (match[0].length === 0)
|
|
28057
|
-
searchable.lastIndex += 1;
|
|
28058
|
-
}
|
|
28059
|
-
return false;
|
|
28060
|
-
});
|
|
28061
|
-
}
|
|
28062
|
-
function hasDangerousShell2(content) {
|
|
28063
|
-
const searchable = new RegExp(DANGEROUS_SHELL_RE2.source, `${DANGEROUS_SHELL_RE2.flags}g`);
|
|
28064
|
-
let match;
|
|
28065
|
-
while ((match = searchable.exec(content)) !== null) {
|
|
28066
|
-
if (matchHasDefensiveContext2(content, match))
|
|
28067
|
-
continue;
|
|
28068
|
-
const end = (match.index ?? 0) + match[0].length;
|
|
28069
|
-
const after = content.slice(end, end + 160);
|
|
28070
|
-
if (!STRONG_DEFENSIVE_CONTEXT_RE2.test(after) && !REPORTING_AFTER_RE2.test(after))
|
|
28071
|
-
return true;
|
|
28072
|
-
if (match[0].length === 0)
|
|
28073
|
-
searchable.lastIndex += 1;
|
|
28074
|
-
}
|
|
28075
|
-
return false;
|
|
28076
|
-
}
|
|
28077
|
-
function scanMemoryContent2(content) {
|
|
28078
|
-
const raw = typeof content === "string" ? content : String(content ?? "");
|
|
28079
|
-
const normalized = raw.normalize("NFKC");
|
|
28080
|
-
const reasons = new Set;
|
|
28081
|
-
if (INVISIBLE_UNICODE_RE2.test(raw))
|
|
28082
|
-
reasons.add("invisible_unicode");
|
|
28083
|
-
if (hasActionableMatch2(normalized, PROMPT_INJECTION_RES2))
|
|
28084
|
-
reasons.add("prompt_injection");
|
|
28085
|
-
if (hasActionableMatch2(normalized, TOOL_DIRECTIVE_RES2))
|
|
28086
|
-
reasons.add("tool_directive");
|
|
28087
|
-
if (hasActionableMatch2(normalized, [EXFILTRATION_RE2, EXFILTRATION_REVERSE2]))
|
|
28088
|
-
reasons.add("exfiltration");
|
|
28089
|
-
if (hasActionableMatch2(normalized, [CREDENTIAL_HARVESTING_RE2]))
|
|
28090
|
-
reasons.add("credential_harvesting");
|
|
28091
|
-
if (hasDangerousShell2(normalized))
|
|
28092
|
-
reasons.add("malicious_shell");
|
|
28093
|
-
const orderedReasons = MEMORY_CONTENT_SAFETY_REASONS2.filter((reason) => reasons.has(reason));
|
|
28094
|
-
const status = orderedReasons.length === 0 ? "clean" : orderedReasons.every((reason) => reason === "invisible_unicode") ? "tainted" : "blocked";
|
|
28095
|
-
return {
|
|
28096
|
-
status,
|
|
28097
|
-
contextEligible: status === "clean",
|
|
28098
|
-
reasons: orderedReasons,
|
|
28099
|
-
policyVersion: MEMORY_CONTENT_SAFETY_POLICY_VERSION2
|
|
28100
|
-
};
|
|
28101
|
-
}
|
|
28102
28048
|
var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
|
|
28103
28049
|
"extract",
|
|
28104
28050
|
"aggregate-recall",
|
|
@@ -28106,7 +28052,7 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
|
|
|
28106
28052
|
"checkpoint",
|
|
28107
28053
|
"dreaming"
|
|
28108
28054
|
];
|
|
28109
|
-
function
|
|
28055
|
+
function up169(db) {
|
|
28110
28056
|
const hasColumn = (table, column) => {
|
|
28111
28057
|
const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
|
|
28112
28058
|
try {
|
|
@@ -28221,7 +28167,7 @@ function up410(db) {
|
|
|
28221
28167
|
function up510(db) {
|
|
28222
28168
|
db.exec("DROP TABLE IF EXISTS mcp_invocations");
|
|
28223
28169
|
}
|
|
28224
|
-
var MEMORIES_FTS_TOKENIZER2 = "unicode61";
|
|
28170
|
+
var MEMORIES_FTS_TOKENIZER2 = "porter unicode61";
|
|
28225
28171
|
var FTS_STATE_TABLE2 = "memories_fts_state";
|
|
28226
28172
|
function normalizeSql2(sql) {
|
|
28227
28173
|
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
@@ -28331,10 +28277,7 @@ function readMemoriesFtsSql2(db) {
|
|
|
28331
28277
|
function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
28332
28278
|
if (sql === null)
|
|
28333
28279
|
return false;
|
|
28334
|
-
|
|
28335
|
-
if (normalized.includes("porter unicode61"))
|
|
28336
|
-
return true;
|
|
28337
|
-
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
28280
|
+
return !normalizeSql2(sql).includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
28338
28281
|
}
|
|
28339
28282
|
function up610(db) {
|
|
28340
28283
|
db.exec(`
|
|
@@ -28759,7 +28702,7 @@ function up1510(db) {
|
|
|
28759
28702
|
)
|
|
28760
28703
|
`);
|
|
28761
28704
|
}
|
|
28762
|
-
function
|
|
28705
|
+
function up1610(db) {
|
|
28763
28706
|
db.exec(`
|
|
28764
28707
|
CREATE TABLE IF NOT EXISTS session_scores (
|
|
28765
28708
|
id TEXT PRIMARY KEY,
|
|
@@ -29980,7 +29923,7 @@ function up542(db) {
|
|
|
29980
29923
|
);
|
|
29981
29924
|
`);
|
|
29982
29925
|
}
|
|
29983
|
-
function
|
|
29926
|
+
function hasTable6(db, name) {
|
|
29984
29927
|
return db.prepare(`SELECT name
|
|
29985
29928
|
FROM sqlite_master
|
|
29986
29929
|
WHERE type = 'table' AND name = ?
|
|
@@ -30010,7 +29953,7 @@ function up552(db) {
|
|
|
30010
29953
|
CREATE INDEX IF NOT EXISTS idx_entity_dependency_history_created
|
|
30011
29954
|
ON entity_dependency_history(created_at DESC);
|
|
30012
29955
|
`);
|
|
30013
|
-
if (!
|
|
29956
|
+
if (!hasTable6(db, "entity_dependencies"))
|
|
30014
29957
|
return;
|
|
30015
29958
|
db.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_insert");
|
|
30016
29959
|
db.exec("DROP TRIGGER IF EXISTS trg_entity_dependencies_related_to_reason_update");
|
|
@@ -30989,9 +30932,9 @@ function hasColumn112(db, table, column) {
|
|
|
30989
30932
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
30990
30933
|
return rows.some((row) => row.name === column);
|
|
30991
30934
|
}
|
|
30992
|
-
var
|
|
30935
|
+
var COLUMNS4 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
|
|
30993
30936
|
function up872(db) {
|
|
30994
|
-
for (const column of
|
|
30937
|
+
for (const column of COLUMNS4) {
|
|
30995
30938
|
if (!hasColumn112(db, "skill_invocations", column)) {
|
|
30996
30939
|
db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
|
|
30997
30940
|
}
|
|
@@ -31555,7 +31498,7 @@ function up1082(db) {
|
|
|
31555
31498
|
)
|
|
31556
31499
|
`);
|
|
31557
31500
|
}
|
|
31558
|
-
function
|
|
31501
|
+
function tableExists3(db, table) {
|
|
31559
31502
|
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
|
|
31560
31503
|
}
|
|
31561
31504
|
function hasColumn162(db, table, column) {
|
|
@@ -31577,7 +31520,7 @@ function up1092(db) {
|
|
|
31577
31520
|
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_source
|
|
31578
31521
|
ON derived_memory_sources(agent_id, source_kind, source_id);
|
|
31579
31522
|
`);
|
|
31580
|
-
if (
|
|
31523
|
+
if (tableExists3(db, "aggregate_evidence_sources")) {
|
|
31581
31524
|
db.exec(`
|
|
31582
31525
|
INSERT OR IGNORE INTO derived_memory_sources
|
|
31583
31526
|
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
@@ -31585,7 +31528,7 @@ function up1092(db) {
|
|
|
31585
31528
|
FROM aggregate_evidence_sources
|
|
31586
31529
|
`);
|
|
31587
31530
|
}
|
|
31588
|
-
if (
|
|
31531
|
+
if (tableExists3(db, "aggregate_memory_sources")) {
|
|
31589
31532
|
db.exec(`
|
|
31590
31533
|
INSERT OR IGNORE INTO derived_memory_sources
|
|
31591
31534
|
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
@@ -31593,10 +31536,10 @@ function up1092(db) {
|
|
|
31593
31536
|
FROM aggregate_memory_sources
|
|
31594
31537
|
`);
|
|
31595
31538
|
}
|
|
31596
|
-
if (
|
|
31539
|
+
if (tableExists3(db, "memories") && !hasColumn162(db, "memories", "stale_at")) {
|
|
31597
31540
|
db.exec("ALTER TABLE memories ADD COLUMN stale_at TEXT");
|
|
31598
31541
|
}
|
|
31599
|
-
if (
|
|
31542
|
+
if (tableExists3(db, "memories")) {
|
|
31600
31543
|
db.exec(`
|
|
31601
31544
|
CREATE INDEX IF NOT EXISTS idx_memories_stale_derived
|
|
31602
31545
|
ON memories(agent_id, stale_at)
|
|
@@ -32247,38 +32190,6 @@ function up1292(db) {
|
|
|
32247
32190
|
ON imported_source_lifecycle(agent_id, status, updated_at DESC);
|
|
32248
32191
|
`);
|
|
32249
32192
|
}
|
|
32250
|
-
function tableExists22(db, table) {
|
|
32251
|
-
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
32252
|
-
}
|
|
32253
|
-
function hasColumn242(db, table, column) {
|
|
32254
|
-
return db.prepare(`PRAGMA table_info("${table}")`).all().some((row) => row.name === column);
|
|
32255
|
-
}
|
|
32256
|
-
function backfill2(db, rows, sourceKind, scannedAt) {
|
|
32257
|
-
const statement = db.prepare(`INSERT INTO memory_content_safety
|
|
32258
|
-
(agent_id, source_kind, source_id, status, context_eligible, reasons_json, policy_version, scanned_at)
|
|
32259
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
32260
|
-
ON CONFLICT(agent_id, source_kind, source_id) DO UPDATE SET
|
|
32261
|
-
status = excluded.status,
|
|
32262
|
-
context_eligible = excluded.context_eligible,
|
|
32263
|
-
reasons_json = excluded.reasons_json,
|
|
32264
|
-
policy_version = excluded.policy_version,
|
|
32265
|
-
scanned_at = excluded.scanned_at`);
|
|
32266
|
-
for (const row of rows) {
|
|
32267
|
-
const sourceId = row.source_id?.trim();
|
|
32268
|
-
if (!sourceId)
|
|
32269
|
-
continue;
|
|
32270
|
-
const assessment = scanMemoryContent2(row.content ?? "");
|
|
32271
|
-
statement.run(row.agent_id?.trim() || "default", sourceKind, sourceId, assessment.status, assessment.contextEligible ? 1 : 0, JSON.stringify(assessment.reasons), MEMORY_CONTENT_SAFETY_POLICY_VERSION2, scannedAt);
|
|
32272
|
-
}
|
|
32273
|
-
}
|
|
32274
|
-
function backfillTable2(db, params) {
|
|
32275
|
-
if (!tableExists22(db, params.table) || !hasColumn242(db, params.table, params.sourceIdColumn) || !hasColumn242(db, params.table, params.contentColumn))
|
|
32276
|
-
return;
|
|
32277
|
-
const agentColumn = hasColumn242(db, params.table, "agent_id") ? "COALESCE(NULLIF(TRIM(agent_id), ''), 'default')" : "'default'";
|
|
32278
|
-
const rows = db.prepare(`SELECT ${agentColumn} AS agent_id, ${params.sourceIdColumn} AS source_id, ${params.contentColumn} AS content
|
|
32279
|
-
FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
|
|
32280
|
-
backfill2(db, rows, params.sourceKind, params.scannedAt);
|
|
32281
|
-
}
|
|
32282
32193
|
function up1302(db) {
|
|
32283
32194
|
db.exec(`
|
|
32284
32195
|
CREATE TABLE IF NOT EXISTS memory_content_safety (
|
|
@@ -32298,43 +32209,6 @@ function up1302(db) {
|
|
|
32298
32209
|
CREATE INDEX IF NOT EXISTS idx_memory_content_safety_eligibility
|
|
32299
32210
|
ON memory_content_safety(agent_id, source_kind, context_eligible);
|
|
32300
32211
|
`);
|
|
32301
|
-
const scannedAt = new Date().toISOString();
|
|
32302
|
-
backfillTable2(db, {
|
|
32303
|
-
table: "memories",
|
|
32304
|
-
sourceKind: "memory",
|
|
32305
|
-
sourceIdColumn: "id",
|
|
32306
|
-
contentColumn: "content",
|
|
32307
|
-
scannedAt
|
|
32308
|
-
});
|
|
32309
|
-
backfillTable2(db, {
|
|
32310
|
-
table: "memory_artifacts",
|
|
32311
|
-
sourceKind: "artifact",
|
|
32312
|
-
sourceIdColumn: "source_path",
|
|
32313
|
-
contentColumn: "content",
|
|
32314
|
-
scannedAt
|
|
32315
|
-
});
|
|
32316
|
-
backfillTable2(db, {
|
|
32317
|
-
table: "session_transcripts",
|
|
32318
|
-
sourceKind: "transcript",
|
|
32319
|
-
sourceIdColumn: "session_key",
|
|
32320
|
-
contentColumn: "content",
|
|
32321
|
-
scannedAt
|
|
32322
|
-
});
|
|
32323
|
-
backfillTable2(db, {
|
|
32324
|
-
table: "session_summaries",
|
|
32325
|
-
sourceKind: "summary",
|
|
32326
|
-
sourceIdColumn: "id",
|
|
32327
|
-
contentColumn: "content",
|
|
32328
|
-
scannedAt
|
|
32329
|
-
});
|
|
32330
|
-
backfillTable2(db, {
|
|
32331
|
-
table: "embeddings",
|
|
32332
|
-
sourceKind: "source_chunk",
|
|
32333
|
-
sourceIdColumn: "id",
|
|
32334
|
-
contentColumn: "chunk_text",
|
|
32335
|
-
where: "source_type IN ('source_chunk', 'source_obsidian_chunk')",
|
|
32336
|
-
scannedAt
|
|
32337
|
-
});
|
|
32338
32212
|
}
|
|
32339
32213
|
function up1312(db) {
|
|
32340
32214
|
const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
|
|
@@ -32438,13 +32312,13 @@ function up1332(db) {
|
|
|
32438
32312
|
AND error IS NOT NULL;
|
|
32439
32313
|
`);
|
|
32440
32314
|
}
|
|
32441
|
-
function
|
|
32315
|
+
function tableExists22(db, table) {
|
|
32442
32316
|
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
32443
32317
|
}
|
|
32444
32318
|
function up1342(db) {
|
|
32445
|
-
if (!
|
|
32319
|
+
if (!tableExists22(db, "memory_jobs"))
|
|
32446
32320
|
return;
|
|
32447
|
-
if (!
|
|
32321
|
+
if (!tableExists22(db, "job_cancellations")) {
|
|
32448
32322
|
throw new Error("job_cancellations table missing; cannot retire structural jobs without an audit trail");
|
|
32449
32323
|
}
|
|
32450
32324
|
db.prepare(`
|
|
@@ -32673,12 +32547,12 @@ function up1422(db) {
|
|
|
32673
32547
|
if (!cols.has(name))
|
|
32674
32548
|
db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${name} ${type}`);
|
|
32675
32549
|
}
|
|
32676
|
-
function
|
|
32550
|
+
function hasColumn242(db, table, column) {
|
|
32677
32551
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
32678
32552
|
return rows.some((row) => row.name === column);
|
|
32679
32553
|
}
|
|
32680
32554
|
function addColumnIfMissing282(db, table, column, definition) {
|
|
32681
|
-
if (!
|
|
32555
|
+
if (!hasColumn242(db, table, column))
|
|
32682
32556
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
32683
32557
|
}
|
|
32684
32558
|
function up1432(db) {
|
|
@@ -33550,6 +33424,138 @@ function up1622(db) {
|
|
|
33550
33424
|
END;
|
|
33551
33425
|
`);
|
|
33552
33426
|
}
|
|
33427
|
+
function up1632(db) {
|
|
33428
|
+
db.exec(`
|
|
33429
|
+
DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_ai;
|
|
33430
|
+
DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_au;
|
|
33431
|
+
DROP INDEX IF EXISTS idx_memory_content_safety_status;
|
|
33432
|
+
DROP INDEX IF EXISTS idx_memory_content_safety_eligibility;
|
|
33433
|
+
DROP TABLE IF EXISTS memory_content_safety;
|
|
33434
|
+
`);
|
|
33435
|
+
}
|
|
33436
|
+
var COLUMNS32 = ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"];
|
|
33437
|
+
function up1642(db) {
|
|
33438
|
+
const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
|
|
33439
|
+
for (const column of COLUMNS32) {
|
|
33440
|
+
if (!cols.some((col) => col.name === column)) {
|
|
33441
|
+
db.exec(`ALTER TABLE entity_attributes ADD COLUMN ${column} TEXT`);
|
|
33442
|
+
}
|
|
33443
|
+
}
|
|
33444
|
+
}
|
|
33445
|
+
function up1652(db) {
|
|
33446
|
+
const passColumns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
33447
|
+
if (!passColumns.some((column) => column.name === "scope_key")) {
|
|
33448
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN scope_key TEXT");
|
|
33449
|
+
}
|
|
33450
|
+
db.exec(`
|
|
33451
|
+
CREATE TABLE IF NOT EXISTS dreaming_history_nodes (
|
|
33452
|
+
agent_id TEXT NOT NULL,
|
|
33453
|
+
scope_key TEXT NOT NULL,
|
|
33454
|
+
level INTEGER NOT NULL,
|
|
33455
|
+
idx INTEGER NOT NULL,
|
|
33456
|
+
pass_id TEXT,
|
|
33457
|
+
text TEXT NOT NULL,
|
|
33458
|
+
tokens_input INTEGER,
|
|
33459
|
+
tokens_output INTEGER,
|
|
33460
|
+
tokens_cache_read INTEGER,
|
|
33461
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
33462
|
+
PRIMARY KEY (agent_id, scope_key, level, idx)
|
|
33463
|
+
);
|
|
33464
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_dreaming_history_nodes_pass
|
|
33465
|
+
ON dreaming_history_nodes(pass_id) WHERE pass_id IS NOT NULL;
|
|
33466
|
+
`);
|
|
33467
|
+
}
|
|
33468
|
+
function up1662(db) {
|
|
33469
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
33470
|
+
if (!columns.some((column) => column.name === "tokens_peak_context")) {
|
|
33471
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN tokens_peak_context INTEGER");
|
|
33472
|
+
}
|
|
33473
|
+
}
|
|
33474
|
+
function up1672(db) {
|
|
33475
|
+
const sql = readMemoriesFtsSql2(db);
|
|
33476
|
+
if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
|
|
33477
|
+
return;
|
|
33478
|
+
recreateMemoriesFts2(db);
|
|
33479
|
+
}
|
|
33480
|
+
function hasTable52(db, table) {
|
|
33481
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
|
|
33482
|
+
}
|
|
33483
|
+
function hasColumn252(db, table, column) {
|
|
33484
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
33485
|
+
}
|
|
33486
|
+
function up1682(db) {
|
|
33487
|
+
if (!hasTable52(db, "entity_attributes") || !hasTable52(db, "entity_aspects") || !hasTable52(db, "entities") || !hasColumn252(db, "entity_attributes", "source_root") || !hasColumn252(db, "entities", "source_root")) {
|
|
33488
|
+
return;
|
|
33489
|
+
}
|
|
33490
|
+
const now = new Date().toISOString();
|
|
33491
|
+
db.exec(`
|
|
33492
|
+
CREATE TEMP TABLE retired_source_paragraphs AS
|
|
33493
|
+
SELECT attr.id, attr.memory_id, attr.agent_id, asp.entity_id
|
|
33494
|
+
FROM entity_attributes attr
|
|
33495
|
+
JOIN entity_aspects asp ON asp.id = attr.aspect_id
|
|
33496
|
+
JOIN entities e ON e.id = asp.entity_id
|
|
33497
|
+
WHERE e.entity_type IN ('source_document', 'source_document_reference')
|
|
33498
|
+
AND attr.source_root IS NOT NULL
|
|
33499
|
+
AND attr.source_root = e.source_root
|
|
33500
|
+
AND attr.source_id = e.source_id
|
|
33501
|
+
AND attr.source_root NOT IN ('dreaming', 'dreaming_attention')
|
|
33502
|
+
`);
|
|
33503
|
+
if (hasColumn252(db, "entity_attributes", "memory_id") && hasTable52(db, "memories")) {
|
|
33504
|
+
if (hasTable52(db, "memory_history")) {
|
|
33505
|
+
db.prepare(`INSERT INTO memory_history (id, memory_id, event, old_content, new_content, changed_by, reason, metadata, created_at)
|
|
33506
|
+
SELECT lower(hex(randomblob(16))), mem.id, 'deleted', mem.content, NULL, 'migration:168',
|
|
33507
|
+
'Source paragraph claims retired', '{"force":true}', ?
|
|
33508
|
+
FROM memories mem
|
|
33509
|
+
JOIN retired_source_paragraphs retired ON retired.memory_id = mem.id
|
|
33510
|
+
WHERE mem.is_deleted = 0`).run(now);
|
|
33511
|
+
}
|
|
33512
|
+
if (hasTable52(db, "derived_memory_sources") && hasColumn252(db, "memories", "stale_at")) {
|
|
33513
|
+
db.prepare(`UPDATE memories
|
|
33514
|
+
SET stale_at = ?
|
|
33515
|
+
WHERE stale_at IS NULL
|
|
33516
|
+
AND is_deleted = 0
|
|
33517
|
+
AND id IN (
|
|
33518
|
+
SELECT dms.derived_memory_id
|
|
33519
|
+
FROM derived_memory_sources dms
|
|
33520
|
+
JOIN retired_source_paragraphs retired ON retired.agent_id = dms.agent_id
|
|
33521
|
+
WHERE (dms.source_kind = 'memory' AND dms.source_id = retired.memory_id)
|
|
33522
|
+
OR (dms.source_kind = 'ontology_claim' AND dms.source_id = retired.id)
|
|
33523
|
+
)`).run(now);
|
|
33524
|
+
}
|
|
33525
|
+
const forget = [
|
|
33526
|
+
"is_deleted = 1",
|
|
33527
|
+
...["deleted_at", "updated_at"].filter((column) => hasColumn252(db, "memories", column)).map((column) => `${column} = $now`),
|
|
33528
|
+
...hasColumn252(db, "memories", "updated_by") ? ["updated_by = 'migration:168'"] : [],
|
|
33529
|
+
...hasColumn252(db, "memories", "version") ? ["version = version + 1"] : []
|
|
33530
|
+
];
|
|
33531
|
+
db.prepare(`UPDATE memories
|
|
33532
|
+
SET ${forget.join(", ")}
|
|
33533
|
+
WHERE is_deleted = 0
|
|
33534
|
+
AND id IN (SELECT memory_id FROM retired_source_paragraphs WHERE memory_id IS NOT NULL)`).run({ $now: now });
|
|
33535
|
+
if (hasTable52(db, "memory_entity_mentions")) {
|
|
33536
|
+
db.exec(`
|
|
33537
|
+
DELETE FROM memory_entity_mentions
|
|
33538
|
+
WHERE memory_id IN (SELECT memory_id FROM retired_source_paragraphs WHERE memory_id IS NOT NULL)
|
|
33539
|
+
`);
|
|
33540
|
+
}
|
|
33541
|
+
}
|
|
33542
|
+
if (hasTable52(db, "ontology_contradictions")) {
|
|
33543
|
+
db.prepare(`UPDATE ontology_contradictions
|
|
33544
|
+
SET status = 'resolved', resolved_at = ?, resolution_reason = 'source paragraph claims retired', updated_at = ?
|
|
33545
|
+
WHERE status = 'active'
|
|
33546
|
+
AND (left_attribute_id IN (SELECT id FROM retired_source_paragraphs)
|
|
33547
|
+
OR right_attribute_id IN (SELECT id FROM retired_source_paragraphs))`).run(now, now);
|
|
33548
|
+
}
|
|
33549
|
+
db.exec(`
|
|
33550
|
+
DELETE FROM entity_attributes WHERE id IN (SELECT id FROM retired_source_paragraphs);
|
|
33551
|
+
DELETE FROM entity_aspects
|
|
33552
|
+
WHERE entity_id IN (
|
|
33553
|
+
SELECT id FROM entities WHERE entity_type IN ('source_document', 'source_document_reference')
|
|
33554
|
+
)
|
|
33555
|
+
AND NOT EXISTS (SELECT 1 FROM entity_attributes attr WHERE attr.aspect_id = entity_aspects.id);
|
|
33556
|
+
DROP TABLE retired_source_paragraphs;
|
|
33557
|
+
`);
|
|
33558
|
+
}
|
|
33553
33559
|
var MIGRATIONS2 = [
|
|
33554
33560
|
{
|
|
33555
33561
|
version: 1,
|
|
@@ -33620,7 +33626,7 @@ var MIGRATIONS2 = [
|
|
|
33620
33626
|
{
|
|
33621
33627
|
version: 11,
|
|
33622
33628
|
name: "session-scores",
|
|
33623
|
-
up:
|
|
33629
|
+
up: up1610,
|
|
33624
33630
|
artifacts: { tables: ["session_scores"] }
|
|
33625
33631
|
},
|
|
33626
33632
|
{
|
|
@@ -34559,8 +34565,7 @@ var MIGRATIONS2 = [
|
|
|
34559
34565
|
{
|
|
34560
34566
|
version: 125,
|
|
34561
34567
|
name: "memory-content-safety",
|
|
34562
|
-
up: up1302
|
|
34563
|
-
artifacts: { tables: ["memory_content_safety"] }
|
|
34568
|
+
up: up1302
|
|
34564
34569
|
},
|
|
34565
34570
|
{
|
|
34566
34571
|
version: 126,
|
|
@@ -34754,7 +34759,7 @@ var MIGRATIONS2 = [
|
|
|
34754
34759
|
{
|
|
34755
34760
|
version: 151,
|
|
34756
34761
|
name: "transcript-import-bytes",
|
|
34757
|
-
up:
|
|
34762
|
+
up: up169,
|
|
34758
34763
|
artifacts: {
|
|
34759
34764
|
tables: [
|
|
34760
34765
|
"source_import_chunks",
|
|
@@ -34862,6 +34867,48 @@ var MIGRATIONS2 = [
|
|
|
34862
34867
|
name: "generic-entity-prune-scan-generation",
|
|
34863
34868
|
up: up1622,
|
|
34864
34869
|
artifacts: { tables: ["generic_entity_prune_scan_state"] }
|
|
34870
|
+
},
|
|
34871
|
+
{
|
|
34872
|
+
version: 163,
|
|
34873
|
+
name: "retire-memory-content-safety",
|
|
34874
|
+
up: up1632
|
|
34875
|
+
},
|
|
34876
|
+
{
|
|
34877
|
+
version: 164,
|
|
34878
|
+
name: "claim-event-time",
|
|
34879
|
+
up: up1642,
|
|
34880
|
+
artifacts: {
|
|
34881
|
+
columns: ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"].map((column) => ({
|
|
34882
|
+
table: "entity_attributes",
|
|
34883
|
+
column
|
|
34884
|
+
}))
|
|
34885
|
+
}
|
|
34886
|
+
},
|
|
34887
|
+
{
|
|
34888
|
+
version: 165,
|
|
34889
|
+
name: "dreaming-history",
|
|
34890
|
+
up: up1652,
|
|
34891
|
+
artifacts: {
|
|
34892
|
+
tables: ["dreaming_history_nodes"],
|
|
34893
|
+
indexes: ["idx_dreaming_history_nodes_pass"],
|
|
34894
|
+
columns: [{ table: "dreaming_passes", column: "scope_key" }]
|
|
34895
|
+
}
|
|
34896
|
+
},
|
|
34897
|
+
{
|
|
34898
|
+
version: 166,
|
|
34899
|
+
name: "dreaming-pass-peak-context",
|
|
34900
|
+
up: up1662,
|
|
34901
|
+
artifacts: { columns: [{ table: "dreaming_passes", column: "tokens_peak_context" }] }
|
|
34902
|
+
},
|
|
34903
|
+
{
|
|
34904
|
+
version: 167,
|
|
34905
|
+
name: "memories-fts-porter",
|
|
34906
|
+
up: up1672
|
|
34907
|
+
},
|
|
34908
|
+
{
|
|
34909
|
+
version: 168,
|
|
34910
|
+
name: "retire-source-paragraph-claims",
|
|
34911
|
+
up: up1682
|
|
34865
34912
|
}
|
|
34866
34913
|
];
|
|
34867
34914
|
var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;
|
|
@@ -35096,6 +35143,37 @@ var PIPELINE_PROVIDER_CHOICES2 = [
|
|
|
35096
35143
|
var SYNTHESIS_PROVIDER_CHOICES2 = PIPELINE_PROVIDER_CHOICES2.filter((provider) => provider !== "command");
|
|
35097
35144
|
var PIPELINE_PROVIDER_SET2 = new Set(PIPELINE_PROVIDER_CHOICES2);
|
|
35098
35145
|
var SYNTHESIS_PROVIDER_SET2 = new Set(SYNTHESIS_PROVIDER_CHOICES2);
|
|
35146
|
+
var SECRET_NAMES2 = "(?:access[_-]?token|api[_-]?key|apikey|auth[_-]?token|client[_-]?secret|passw(?:or)?d|refresh[_-]?token|private[_-]?key|secret(?:[_-]?key)?|token)";
|
|
35147
|
+
var SECRET_VALUE2 = `(?=[^\\s"',;&<>()\\[\\]{}$]*\\d)[^\\s"',;&<>()\\[\\]{}$]{8,}`;
|
|
35148
|
+
var PATTERNS2 = [
|
|
35149
|
+
{
|
|
35150
|
+
kind: "private_key",
|
|
35151
|
+
pattern: /-----BEGIN (?:[A-Z]+ )*PRIVATE KEY-----[\s\S]*?-----END (?:[A-Z]+ )*PRIVATE KEY-----/g
|
|
35152
|
+
},
|
|
35153
|
+
{
|
|
35154
|
+
kind: "provider_key",
|
|
35155
|
+
pattern: /\b(?:(?:AKIA|ASIA)[0-9A-Z]{16}|github_pat_[A-Za-z0-9_]{20,}|gh[pousr]_[A-Za-z0-9]{20,}|sk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}|(?:sk|rk)_(?:live|test)_[0-9A-Za-z]{16,}|xox[abprs]-[A-Za-z0-9-]{10,}|AIza[0-9A-Za-z_-]{35}|glpat-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36})\b/g
|
|
35156
|
+
},
|
|
35157
|
+
{
|
|
35158
|
+
kind: "jwt",
|
|
35159
|
+
pattern: /\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g
|
|
35160
|
+
},
|
|
35161
|
+
{
|
|
35162
|
+
kind: "bearer_token",
|
|
35163
|
+
pattern: /\bBearer\s+([A-Za-z0-9._~+/-]{16,}=*)/g,
|
|
35164
|
+
valueGroup: 1
|
|
35165
|
+
},
|
|
35166
|
+
{
|
|
35167
|
+
kind: "secret_assignment",
|
|
35168
|
+
pattern: new RegExp(`\\b${SECRET_NAMES2}["']?\\s*[:=]\\s*["']?(${SECRET_VALUE2})`, "gi"),
|
|
35169
|
+
valueGroup: 1
|
|
35170
|
+
},
|
|
35171
|
+
{
|
|
35172
|
+
kind: "secret_assignment",
|
|
35173
|
+
pattern: new RegExp(`\\b[A-Z][A-Z0-9_]*(?:API_KEY|TOKEN|SECRET|PASSWORD)\\s*=\\s*["']?(${SECRET_VALUE2})`, "g"),
|
|
35174
|
+
valueGroup: 1
|
|
35175
|
+
}
|
|
35176
|
+
];
|
|
35099
35177
|
var LOOPBACK_HOST2 = "127.0.0.1";
|
|
35100
35178
|
var LOCAL_BINDS2 = new Set([LOOPBACK_HOST2, "localhost", "::1", "::ffff:127.0.0.1"]);
|
|
35101
35179
|
var native2 = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-hermes-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.237.0",
|
|
4
4
|
"description": "Signet connector for Hermes Agent — installs Signet as a pluggable memory provider",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@signetai/connector-base": "0.
|
|
29
|
-
"@signetai/core": "0.
|
|
28
|
+
"@signetai/connector-base": "0.237.0",
|
|
29
|
+
"@signetai/core": "0.237.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|