@signetai/connector-base 0.157.4 → 0.158.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 +381 -153
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -621,6 +621,8 @@ var require_Alias = __commonJS2((exports) => {
|
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
resolve(doc, ctx) {
|
|
624
|
+
if (ctx?.maxAliasCount === 0)
|
|
625
|
+
throw new ReferenceError("Alias resolution is disabled");
|
|
624
626
|
let nodes;
|
|
625
627
|
if (ctx?.aliasResolveCache) {
|
|
626
628
|
nodes = ctx.aliasResolveCache;
|
|
@@ -1650,18 +1652,18 @@ var require_merge = __commonJS2((exports) => {
|
|
|
1650
1652
|
};
|
|
1651
1653
|
var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
|
|
1652
1654
|
function addMergeToJSMap(ctx, map, value) {
|
|
1653
|
-
|
|
1654
|
-
if (identity.isSeq(
|
|
1655
|
-
for (const it of
|
|
1655
|
+
const source = resolveAliasValue(ctx, value);
|
|
1656
|
+
if (identity.isSeq(source))
|
|
1657
|
+
for (const it of source.items)
|
|
1656
1658
|
mergeValue(ctx, map, it);
|
|
1657
|
-
else if (Array.isArray(
|
|
1658
|
-
for (const it of
|
|
1659
|
+
else if (Array.isArray(source))
|
|
1660
|
+
for (const it of source)
|
|
1659
1661
|
mergeValue(ctx, map, it);
|
|
1660
1662
|
else
|
|
1661
|
-
mergeValue(ctx, map,
|
|
1663
|
+
mergeValue(ctx, map, source);
|
|
1662
1664
|
}
|
|
1663
1665
|
function mergeValue(ctx, map, value) {
|
|
1664
|
-
const source = ctx
|
|
1666
|
+
const source = resolveAliasValue(ctx, value);
|
|
1665
1667
|
if (!identity.isMap(source))
|
|
1666
1668
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1667
1669
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -1682,6 +1684,9 @@ var require_merge = __commonJS2((exports) => {
|
|
|
1682
1684
|
}
|
|
1683
1685
|
return map;
|
|
1684
1686
|
}
|
|
1687
|
+
function resolveAliasValue(ctx, value) {
|
|
1688
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
1689
|
+
}
|
|
1685
1690
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1686
1691
|
exports.isMergeKey = isMergeKey;
|
|
1687
1692
|
exports.merge = merge;
|
|
@@ -2235,7 +2240,7 @@ var require_stringifyNumber = __commonJS2((exports) => {
|
|
|
2235
2240
|
if (!isFinite(num))
|
|
2236
2241
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
2237
2242
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
2238
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
2243
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
2239
2244
|
let i = n.indexOf(".");
|
|
2240
2245
|
if (i < 0) {
|
|
2241
2246
|
i = n.length;
|
|
@@ -4403,7 +4408,7 @@ var require_resolve_flow_scalar = __commonJS2((exports) => {
|
|
|
4403
4408
|
while (next === " " || next === "\t")
|
|
4404
4409
|
next = source[++i + 1];
|
|
4405
4410
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
4406
|
-
const length =
|
|
4411
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
4407
4412
|
res += parseCharCode(source, i + 1, length, onError);
|
|
4408
4413
|
i += length;
|
|
4409
4414
|
} else {
|
|
@@ -4472,12 +4477,13 @@ var require_resolve_flow_scalar = __commonJS2((exports) => {
|
|
|
4472
4477
|
const cc = source.substr(offset, length);
|
|
4473
4478
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
4474
4479
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
4475
|
-
|
|
4480
|
+
try {
|
|
4481
|
+
return String.fromCodePoint(code);
|
|
4482
|
+
} catch {
|
|
4476
4483
|
const raw = source.substr(offset - 2, length + 2);
|
|
4477
4484
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
4478
4485
|
return raw;
|
|
4479
4486
|
}
|
|
4480
|
-
return String.fromCodePoint(code);
|
|
4481
4487
|
}
|
|
4482
4488
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4483
4489
|
});
|
|
@@ -4806,8 +4812,10 @@ ${cb}` : comment;
|
|
|
4806
4812
|
}
|
|
4807
4813
|
}
|
|
4808
4814
|
if (afterDoc) {
|
|
4809
|
-
|
|
4810
|
-
|
|
4815
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
4816
|
+
doc.errors.push(this.errors[i]);
|
|
4817
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
4818
|
+
doc.warnings.push(this.warnings[i]);
|
|
4811
4819
|
} else {
|
|
4812
4820
|
doc.errors = this.errors;
|
|
4813
4821
|
doc.warnings = this.warnings;
|
|
@@ -5509,7 +5517,7 @@ var require_lexer = __commonJS2((exports) => {
|
|
|
5509
5517
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
5510
5518
|
this.indentNext = this.indentValue + 1;
|
|
5511
5519
|
this.indentValue += n;
|
|
5512
|
-
return
|
|
5520
|
+
return "block-start";
|
|
5513
5521
|
}
|
|
5514
5522
|
return "doc";
|
|
5515
5523
|
}
|
|
@@ -5816,26 +5824,37 @@ var require_lexer = __commonJS2((exports) => {
|
|
|
5816
5824
|
return 0;
|
|
5817
5825
|
}
|
|
5818
5826
|
*pushIndicators() {
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5827
|
+
let n = 0;
|
|
5828
|
+
loop:
|
|
5829
|
+
while (true) {
|
|
5830
|
+
switch (this.charAt(0)) {
|
|
5831
|
+
case "!":
|
|
5832
|
+
n += yield* this.pushTag();
|
|
5833
|
+
n += yield* this.pushSpaces(true);
|
|
5834
|
+
continue loop;
|
|
5835
|
+
case "&":
|
|
5836
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
5837
|
+
n += yield* this.pushSpaces(true);
|
|
5838
|
+
continue loop;
|
|
5839
|
+
case "-":
|
|
5840
|
+
case "?":
|
|
5841
|
+
case ":": {
|
|
5842
|
+
const inFlow = this.flowLevel > 0;
|
|
5843
|
+
const ch1 = this.charAt(1);
|
|
5844
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
5845
|
+
if (!inFlow)
|
|
5846
|
+
this.indentNext = this.indentValue + 1;
|
|
5847
|
+
else if (this.flowKey)
|
|
5848
|
+
this.flowKey = false;
|
|
5849
|
+
n += yield* this.pushCount(1);
|
|
5850
|
+
n += yield* this.pushSpaces(true);
|
|
5851
|
+
continue loop;
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5835
5854
|
}
|
|
5855
|
+
break loop;
|
|
5836
5856
|
}
|
|
5837
|
-
|
|
5838
|
-
return 0;
|
|
5857
|
+
return n;
|
|
5839
5858
|
}
|
|
5840
5859
|
*pushTag() {
|
|
5841
5860
|
if (this.charAt(1) === "<") {
|
|
@@ -5986,6 +6005,13 @@ var require_parser = __commonJS2((exports) => {
|
|
|
5986
6005
|
while (prev[++i]?.type === "space") {}
|
|
5987
6006
|
return prev.splice(i, prev.length);
|
|
5988
6007
|
}
|
|
6008
|
+
function arrayPushArray(target, source) {
|
|
6009
|
+
if (source.length < 1e5)
|
|
6010
|
+
Array.prototype.push.apply(target, source);
|
|
6011
|
+
else
|
|
6012
|
+
for (let i = 0;i < source.length; ++i)
|
|
6013
|
+
target.push(source[i]);
|
|
6014
|
+
}
|
|
5989
6015
|
function fixFlowSeqItems(fc) {
|
|
5990
6016
|
if (fc.start.type === "flow-seq-start") {
|
|
5991
6017
|
for (const it of fc.items) {
|
|
@@ -5995,11 +6021,11 @@ var require_parser = __commonJS2((exports) => {
|
|
|
5995
6021
|
delete it.key;
|
|
5996
6022
|
if (isFlowToken(it.value)) {
|
|
5997
6023
|
if (it.value.end)
|
|
5998
|
-
|
|
6024
|
+
arrayPushArray(it.value.end, it.sep);
|
|
5999
6025
|
else
|
|
6000
6026
|
it.value.end = it.sep;
|
|
6001
6027
|
} else
|
|
6002
|
-
|
|
6028
|
+
arrayPushArray(it.start, it.sep);
|
|
6003
6029
|
delete it.sep;
|
|
6004
6030
|
}
|
|
6005
6031
|
}
|
|
@@ -6339,7 +6365,7 @@ var require_parser = __commonJS2((exports) => {
|
|
|
6339
6365
|
const prev = map.items[map.items.length - 2];
|
|
6340
6366
|
const end = prev?.value?.end;
|
|
6341
6367
|
if (Array.isArray(end)) {
|
|
6342
|
-
|
|
6368
|
+
arrayPushArray(end, it.start);
|
|
6343
6369
|
end.push(this.sourceToken);
|
|
6344
6370
|
map.items.pop();
|
|
6345
6371
|
return;
|
|
@@ -6527,7 +6553,7 @@ var require_parser = __commonJS2((exports) => {
|
|
|
6527
6553
|
const prev = seq.items[seq.items.length - 2];
|
|
6528
6554
|
const end = prev?.value?.end;
|
|
6529
6555
|
if (Array.isArray(end)) {
|
|
6530
|
-
|
|
6556
|
+
arrayPushArray(end, it.start);
|
|
6531
6557
|
end.push(this.sourceToken);
|
|
6532
6558
|
seq.items.pop();
|
|
6533
6559
|
return;
|
|
@@ -6921,6 +6947,7 @@ var PIPELINE_PROVIDER_CHOICES = [
|
|
|
6921
6947
|
var SYNTHESIS_PROVIDER_CHOICES = PIPELINE_PROVIDER_CHOICES.filter((provider) => provider !== "command");
|
|
6922
6948
|
var PIPELINE_PROVIDER_SET = new Set(PIPELINE_PROVIDER_CHOICES);
|
|
6923
6949
|
var SYNTHESIS_PROVIDER_SET = new Set(SYNTHESIS_PROVIDER_CHOICES);
|
|
6950
|
+
var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = ["extract", "aggregate-recall", "session_end", "checkpoint", "dreaming"];
|
|
6924
6951
|
var MEMORIES_FTS_TOKENIZER = "unicode61";
|
|
6925
6952
|
function normalizeSql(sql) {
|
|
6926
6953
|
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
@@ -10018,6 +10045,243 @@ function up92(db) {
|
|
|
10018
10045
|
ON embeddings_staging(agent_id, source_type, source_id);
|
|
10019
10046
|
`);
|
|
10020
10047
|
}
|
|
10048
|
+
function up93(db) {
|
|
10049
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
10050
|
+
if (!columns.some((column) => column.name === "evidence_cursor")) {
|
|
10051
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
10054
|
+
var DERIVED_SOURCE_TYPES = DAEMON_DERIVED_MEMORY_SOURCE_TYPES;
|
|
10055
|
+
function hasColumn13(db, table, column) {
|
|
10056
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
10057
|
+
return rows.some((r) => r.name === column);
|
|
10058
|
+
}
|
|
10059
|
+
function up94(db) {
|
|
10060
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
|
|
10061
|
+
if (tables.length === 0)
|
|
10062
|
+
return;
|
|
10063
|
+
if (!hasColumn13(db, "memories", "memory_kind")) {
|
|
10064
|
+
db.exec("ALTER TABLE memories ADD COLUMN memory_kind TEXT");
|
|
10065
|
+
}
|
|
10066
|
+
if (!hasColumn13(db, "memories", "evidence_meta")) {
|
|
10067
|
+
db.exec("ALTER TABLE memories ADD COLUMN evidence_meta TEXT");
|
|
10068
|
+
}
|
|
10069
|
+
if (hasColumn13(db, "memories", "source_type")) {
|
|
10070
|
+
const placeholders = DERIVED_SOURCE_TYPES.map(() => "?").join(", ");
|
|
10071
|
+
db.prepare(`UPDATE memories
|
|
10072
|
+
SET memory_kind = 'episodic'
|
|
10073
|
+
WHERE memory_kind IS NULL
|
|
10074
|
+
AND (source_type IS NULL OR source_type NOT IN (${placeholders}))`).run(...DERIVED_SOURCE_TYPES);
|
|
10075
|
+
} else {
|
|
10076
|
+
db.exec(`UPDATE memories
|
|
10077
|
+
SET memory_kind = 'episodic'
|
|
10078
|
+
WHERE memory_kind IS NULL`);
|
|
10079
|
+
}
|
|
10080
|
+
}
|
|
10081
|
+
function hasColumn14(db, table, column) {
|
|
10082
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10083
|
+
}
|
|
10084
|
+
function up95(db) {
|
|
10085
|
+
const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
|
|
10086
|
+
if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
|
|
10087
|
+
return;
|
|
10088
|
+
db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
|
|
10089
|
+
}
|
|
10090
|
+
function up96(db) {
|
|
10091
|
+
db.exec("DROP TABLE IF EXISTS ingestion_jobs");
|
|
10092
|
+
}
|
|
10093
|
+
function up97(db) {
|
|
10094
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
10095
|
+
if (!columns.some((column) => column.name === "last_failure_at")) {
|
|
10096
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
|
|
10097
|
+
}
|
|
10098
|
+
db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
|
|
10099
|
+
}
|
|
10100
|
+
function up98(db) {
|
|
10101
|
+
db.exec(`
|
|
10102
|
+
CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
|
|
10103
|
+
agent_id TEXT NOT NULL,
|
|
10104
|
+
source_kind TEXT NOT NULL CHECK (source_kind IN ('memory', 'artifact', 'transcript', 'summary')),
|
|
10105
|
+
source_id TEXT NOT NULL,
|
|
10106
|
+
reason TEXT NOT NULL,
|
|
10107
|
+
pass_id TEXT NOT NULL,
|
|
10108
|
+
excluded_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10109
|
+
requeue_requested_at TEXT,
|
|
10110
|
+
resolved_at TEXT,
|
|
10111
|
+
PRIMARY KEY (agent_id, source_kind, source_id)
|
|
10112
|
+
);
|
|
10113
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_evidence_exclusions_active
|
|
10114
|
+
ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
|
|
10115
|
+
`);
|
|
10116
|
+
}
|
|
10117
|
+
function up99(db) {
|
|
10118
|
+
db.exec(`
|
|
10119
|
+
CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
|
|
10120
|
+
id TEXT PRIMARY KEY,
|
|
10121
|
+
agent_id TEXT NOT NULL,
|
|
10122
|
+
pass_id TEXT NOT NULL,
|
|
10123
|
+
sequence INTEGER NOT NULL,
|
|
10124
|
+
tool_call_id TEXT,
|
|
10125
|
+
tool_name TEXT NOT NULL,
|
|
10126
|
+
input_json TEXT NOT NULL,
|
|
10127
|
+
output_json TEXT NOT NULL,
|
|
10128
|
+
success INTEGER NOT NULL,
|
|
10129
|
+
latency_ms INTEGER NOT NULL,
|
|
10130
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10131
|
+
UNIQUE(agent_id, pass_id, sequence)
|
|
10132
|
+
);
|
|
10133
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_tool_calls_pass
|
|
10134
|
+
ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
|
|
10135
|
+
`);
|
|
10136
|
+
}
|
|
10137
|
+
function up100(db) {
|
|
10138
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
10139
|
+
if (!columns.some((column) => column.name === "evidence_window_json")) {
|
|
10140
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
|
|
10141
|
+
}
|
|
10142
|
+
if (!columns.some((column) => column.name === "runbook_json")) {
|
|
10143
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
|
|
10144
|
+
}
|
|
10145
|
+
}
|
|
10146
|
+
function up101(db) {
|
|
10147
|
+
db.exec(`
|
|
10148
|
+
CREATE TABLE IF NOT EXISTS dreaming_attention (
|
|
10149
|
+
id TEXT PRIMARY KEY,
|
|
10150
|
+
agent_id TEXT NOT NULL,
|
|
10151
|
+
kind TEXT NOT NULL CHECK (kind IN ('review_due', 'hygiene', 'contested_claim', 'evidence_requeue')),
|
|
10152
|
+
subject_ref TEXT NOT NULL,
|
|
10153
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
10154
|
+
priority INTEGER NOT NULL DEFAULT 0 CHECK (priority >= 0 AND priority <= 100),
|
|
10155
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10156
|
+
generation INTEGER NOT NULL DEFAULT 0,
|
|
10157
|
+
resolved_at TEXT,
|
|
10158
|
+
resolved_by_pass_id TEXT,
|
|
10159
|
+
UNIQUE(agent_id, kind, subject_ref)
|
|
10160
|
+
);
|
|
10161
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_attention_pending
|
|
10162
|
+
ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
|
|
10163
|
+
`);
|
|
10164
|
+
}
|
|
10165
|
+
function hasColumn15(db, table, column) {
|
|
10166
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10167
|
+
}
|
|
10168
|
+
function up102(db) {
|
|
10169
|
+
const requiredMemoryColumns = [
|
|
10170
|
+
"content_hash",
|
|
10171
|
+
"normalized_content",
|
|
10172
|
+
"memory_kind",
|
|
10173
|
+
"source_type",
|
|
10174
|
+
"source_path",
|
|
10175
|
+
"agent_id",
|
|
10176
|
+
"visibility",
|
|
10177
|
+
"is_deleted",
|
|
10178
|
+
"extraction_status"
|
|
10179
|
+
];
|
|
10180
|
+
if (!hasColumn15(db, "entity_attributes", "memory_id") || !requiredMemoryColumns.every((column) => hasColumn15(db, "memories", column))) {
|
|
10181
|
+
return;
|
|
10182
|
+
}
|
|
10183
|
+
db.exec(`
|
|
10184
|
+
INSERT OR IGNORE INTO memories
|
|
10185
|
+
(id, content, normalized_content, content_hash, who, why, project,
|
|
10186
|
+
importance, type, tags, pinned, is_deleted, extraction_status,
|
|
10187
|
+
created_at, updated_at, updated_by, source_type, source_id, source_path,
|
|
10188
|
+
agent_id, visibility, memory_kind)
|
|
10189
|
+
SELECT attr.id, attr.content, attr.normalized_content,
|
|
10190
|
+
'semantic-attribute:' || attr.id, 'dreaming', 'Derived semantic attribute', NULL,
|
|
10191
|
+
attr.importance, 'semantic', 'semantic,attribute', 0,
|
|
10192
|
+
CASE WHEN attr.status = 'active' THEN 0 ELSE 1 END, 'completed',
|
|
10193
|
+
attr.created_at, attr.updated_at, 'dreaming', 'dreaming', attr.source_id, attr.source_path,
|
|
10194
|
+
attr.agent_id, 'global', 'derived'
|
|
10195
|
+
FROM entity_attributes attr
|
|
10196
|
+
WHERE attr.memory_id IS NULL
|
|
10197
|
+
`);
|
|
10198
|
+
db.exec(`
|
|
10199
|
+
UPDATE entity_attributes
|
|
10200
|
+
SET memory_id = id
|
|
10201
|
+
WHERE memory_id IS NULL
|
|
10202
|
+
AND EXISTS (SELECT 1 FROM memories WHERE memories.id = entity_attributes.id)
|
|
10203
|
+
`);
|
|
10204
|
+
db.exec(`
|
|
10205
|
+
INSERT OR IGNORE INTO memory_entity_mentions (memory_id, entity_id)
|
|
10206
|
+
SELECT attr.memory_id, aspect.entity_id
|
|
10207
|
+
FROM entity_attributes attr
|
|
10208
|
+
JOIN entity_aspects aspect ON aspect.id = attr.aspect_id AND aspect.agent_id = attr.agent_id
|
|
10209
|
+
WHERE attr.memory_id IS NOT NULL
|
|
10210
|
+
`);
|
|
10211
|
+
db.exec(`
|
|
10212
|
+
UPDATE entities
|
|
10213
|
+
SET mentions = (
|
|
10214
|
+
SELECT COUNT(*) FROM memory_entity_mentions WHERE entity_id = entities.id
|
|
10215
|
+
)
|
|
10216
|
+
WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
|
|
10217
|
+
`);
|
|
10218
|
+
}
|
|
10219
|
+
function up103(db) {
|
|
10220
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
|
|
10221
|
+
if (tables.length !== 2)
|
|
10222
|
+
return;
|
|
10223
|
+
const memoryColumns = db.prepare("PRAGMA table_info(memories)").all().map((row) => row.name);
|
|
10224
|
+
const attributeColumns = db.prepare("PRAGMA table_info(entity_attributes)").all().map((row) => row.name);
|
|
10225
|
+
if (!memoryColumns.includes("memory_kind") || !attributeColumns.includes("memory_id"))
|
|
10226
|
+
return;
|
|
10227
|
+
db.exec(`
|
|
10228
|
+
UPDATE memories
|
|
10229
|
+
SET memory_kind = 'derived'
|
|
10230
|
+
WHERE memory_kind IS NULL
|
|
10231
|
+
AND id IN (
|
|
10232
|
+
SELECT memory_id FROM entity_attributes WHERE memory_id IS NOT NULL
|
|
10233
|
+
)
|
|
10234
|
+
`);
|
|
10235
|
+
}
|
|
10236
|
+
function tableExists(db, table) {
|
|
10237
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
|
|
10238
|
+
}
|
|
10239
|
+
function hasColumn16(db, table, column) {
|
|
10240
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10241
|
+
}
|
|
10242
|
+
function up104(db) {
|
|
10243
|
+
db.exec(`
|
|
10244
|
+
CREATE TABLE IF NOT EXISTS derived_memory_sources (
|
|
10245
|
+
derived_memory_id TEXT NOT NULL,
|
|
10246
|
+
source_kind TEXT NOT NULL,
|
|
10247
|
+
source_id TEXT NOT NULL,
|
|
10248
|
+
source_path TEXT,
|
|
10249
|
+
agent_id TEXT NOT NULL,
|
|
10250
|
+
created_at TEXT NOT NULL,
|
|
10251
|
+
PRIMARY KEY (derived_memory_id, source_kind, source_id)
|
|
10252
|
+
);
|
|
10253
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_derived
|
|
10254
|
+
ON derived_memory_sources(agent_id, derived_memory_id);
|
|
10255
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_source
|
|
10256
|
+
ON derived_memory_sources(agent_id, source_kind, source_id);
|
|
10257
|
+
`);
|
|
10258
|
+
if (tableExists(db, "aggregate_evidence_sources")) {
|
|
10259
|
+
db.exec(`
|
|
10260
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
10261
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
10262
|
+
SELECT aggregate_memory_id, source_kind, source_id, source_path, agent_id, created_at
|
|
10263
|
+
FROM aggregate_evidence_sources
|
|
10264
|
+
`);
|
|
10265
|
+
}
|
|
10266
|
+
if (tableExists(db, "aggregate_memory_sources")) {
|
|
10267
|
+
db.exec(`
|
|
10268
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
10269
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
10270
|
+
SELECT aggregate_memory_id, 'memory', source_memory_id, NULL, agent_id, created_at
|
|
10271
|
+
FROM aggregate_memory_sources
|
|
10272
|
+
`);
|
|
10273
|
+
}
|
|
10274
|
+
if (tableExists(db, "memories") && !hasColumn16(db, "memories", "stale_at")) {
|
|
10275
|
+
db.exec("ALTER TABLE memories ADD COLUMN stale_at TEXT");
|
|
10276
|
+
}
|
|
10277
|
+
if (tableExists(db, "memories")) {
|
|
10278
|
+
db.exec(`
|
|
10279
|
+
CREATE INDEX IF NOT EXISTS idx_memories_stale_derived
|
|
10280
|
+
ON memories(agent_id, stale_at)
|
|
10281
|
+
WHERE stale_at IS NOT NULL AND is_deleted = 0
|
|
10282
|
+
`);
|
|
10283
|
+
}
|
|
10284
|
+
}
|
|
10021
10285
|
var MIGRATIONS = [
|
|
10022
10286
|
{
|
|
10023
10287
|
version: 1,
|
|
@@ -10102,7 +10366,6 @@ var MIGRATIONS = [
|
|
|
10102
10366
|
name: "ingestion-tracking",
|
|
10103
10367
|
up: up13,
|
|
10104
10368
|
artifacts: {
|
|
10105
|
-
tables: ["ingestion_jobs"],
|
|
10106
10369
|
columns: [
|
|
10107
10370
|
{ table: "memories", column: "source_path" },
|
|
10108
10371
|
{ table: "memories", column: "source_section" }
|
|
@@ -10765,6 +11028,87 @@ var MIGRATIONS = [
|
|
|
10765
11028
|
name: "embedding-staging-store",
|
|
10766
11029
|
up: up92,
|
|
10767
11030
|
artifacts: { tables: ["embeddings_staging"] }
|
|
11031
|
+
},
|
|
11032
|
+
{
|
|
11033
|
+
version: 93,
|
|
11034
|
+
name: "dreaming-evidence-cursor",
|
|
11035
|
+
up: up93,
|
|
11036
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
|
|
11037
|
+
},
|
|
11038
|
+
{
|
|
11039
|
+
version: 94,
|
|
11040
|
+
name: "memory-kind",
|
|
11041
|
+
up: up94,
|
|
11042
|
+
artifacts: {
|
|
11043
|
+
columns: [
|
|
11044
|
+
{ table: "memories", column: "memory_kind" },
|
|
11045
|
+
{ table: "memories", column: "evidence_meta" }
|
|
11046
|
+
]
|
|
11047
|
+
}
|
|
11048
|
+
},
|
|
11049
|
+
{
|
|
11050
|
+
version: 95,
|
|
11051
|
+
name: "compaction-recall-projections",
|
|
11052
|
+
up: up95
|
|
11053
|
+
},
|
|
11054
|
+
{
|
|
11055
|
+
version: 96,
|
|
11056
|
+
name: "retire-legacy-ingestion",
|
|
11057
|
+
up: up96
|
|
11058
|
+
},
|
|
11059
|
+
{
|
|
11060
|
+
version: 97,
|
|
11061
|
+
name: "dreaming-failure-backoff",
|
|
11062
|
+
up: up97,
|
|
11063
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
|
|
11064
|
+
},
|
|
11065
|
+
{
|
|
11066
|
+
version: 98,
|
|
11067
|
+
name: "dreaming-evidence-exclusions",
|
|
11068
|
+
up: up98,
|
|
11069
|
+
artifacts: { tables: ["dreaming_evidence_exclusions"] }
|
|
11070
|
+
},
|
|
11071
|
+
{
|
|
11072
|
+
version: 99,
|
|
11073
|
+
name: "dreaming-tool-calls",
|
|
11074
|
+
up: up99,
|
|
11075
|
+
artifacts: { tables: ["dreaming_tool_calls"] }
|
|
11076
|
+
},
|
|
11077
|
+
{
|
|
11078
|
+
version: 100,
|
|
11079
|
+
name: "dreaming-runbook",
|
|
11080
|
+
up: up100,
|
|
11081
|
+
artifacts: {
|
|
11082
|
+
columns: [
|
|
11083
|
+
{ table: "dreaming_passes", column: "evidence_window_json" },
|
|
11084
|
+
{ table: "dreaming_passes", column: "runbook_json" }
|
|
11085
|
+
]
|
|
11086
|
+
}
|
|
11087
|
+
},
|
|
11088
|
+
{
|
|
11089
|
+
version: 101,
|
|
11090
|
+
name: "dreaming-attention",
|
|
11091
|
+
up: up101,
|
|
11092
|
+
artifacts: { tables: ["dreaming_attention"] }
|
|
11093
|
+
},
|
|
11094
|
+
{
|
|
11095
|
+
version: 102,
|
|
11096
|
+
name: "attribute-semantic-memories",
|
|
11097
|
+
up: up102
|
|
11098
|
+
},
|
|
11099
|
+
{
|
|
11100
|
+
version: 103,
|
|
11101
|
+
name: "semantic-memory-kind",
|
|
11102
|
+
up: up103
|
|
11103
|
+
},
|
|
11104
|
+
{
|
|
11105
|
+
version: 104,
|
|
11106
|
+
name: "derived-memory-provenance",
|
|
11107
|
+
up: up104,
|
|
11108
|
+
artifacts: {
|
|
11109
|
+
tables: ["derived_memory_sources"],
|
|
11110
|
+
columns: [{ table: "memories", column: "stale_at" }]
|
|
11111
|
+
}
|
|
10768
11112
|
}
|
|
10769
11113
|
];
|
|
10770
11114
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -11175,122 +11519,6 @@ function stripSignetBlock(content) {
|
|
|
11175
11519
|
function escapeRegex(str) {
|
|
11176
11520
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11177
11521
|
}
|
|
11178
|
-
var SKIP_SUBTYPES = new Set([
|
|
11179
|
-
"channel_join",
|
|
11180
|
-
"channel_leave",
|
|
11181
|
-
"channel_topic",
|
|
11182
|
-
"channel_purpose",
|
|
11183
|
-
"channel_name",
|
|
11184
|
-
"channel_archive",
|
|
11185
|
-
"channel_unarchive",
|
|
11186
|
-
"group_join",
|
|
11187
|
-
"group_leave",
|
|
11188
|
-
"group_topic",
|
|
11189
|
-
"group_purpose",
|
|
11190
|
-
"group_name",
|
|
11191
|
-
"group_archive",
|
|
11192
|
-
"group_unarchive",
|
|
11193
|
-
"pinned_item",
|
|
11194
|
-
"unpinned_item",
|
|
11195
|
-
"bot_add",
|
|
11196
|
-
"bot_remove",
|
|
11197
|
-
"tombstone",
|
|
11198
|
-
"file_comment",
|
|
11199
|
-
"sh_room_created",
|
|
11200
|
-
"sh_room_shared"
|
|
11201
|
-
]);
|
|
11202
|
-
var SKIP_TYPES = new Set([
|
|
11203
|
-
"RecipientAdd",
|
|
11204
|
-
"RecipientRemove",
|
|
11205
|
-
"ChannelNameChange",
|
|
11206
|
-
"ChannelIconChange",
|
|
11207
|
-
"ChannelPinnedMessage",
|
|
11208
|
-
"GuildMemberJoin",
|
|
11209
|
-
"UserPremiumGuildSubscription",
|
|
11210
|
-
"UserPremiumGuildSubscriptionTier1",
|
|
11211
|
-
"UserPremiumGuildSubscriptionTier2",
|
|
11212
|
-
"UserPremiumGuildSubscriptionTier3",
|
|
11213
|
-
"ChannelFollowAdd",
|
|
11214
|
-
"GuildDiscoveryDisqualified",
|
|
11215
|
-
"GuildDiscoveryRequalified",
|
|
11216
|
-
"GuildDiscoveryGracePeriodInitialWarning",
|
|
11217
|
-
"GuildDiscoveryGracePeriodFinalWarning",
|
|
11218
|
-
"ThreadCreated",
|
|
11219
|
-
"ApplicationCommand"
|
|
11220
|
-
]);
|
|
11221
|
-
var SKIP_DIRS = new Set([
|
|
11222
|
-
"node_modules",
|
|
11223
|
-
".git",
|
|
11224
|
-
"dist",
|
|
11225
|
-
"build",
|
|
11226
|
-
"out",
|
|
11227
|
-
"target",
|
|
11228
|
-
".next",
|
|
11229
|
-
".nuxt",
|
|
11230
|
-
"__pycache__",
|
|
11231
|
-
".tox",
|
|
11232
|
-
".mypy_cache",
|
|
11233
|
-
".pytest_cache",
|
|
11234
|
-
"venv",
|
|
11235
|
-
".venv",
|
|
11236
|
-
"env",
|
|
11237
|
-
"vendor",
|
|
11238
|
-
"coverage",
|
|
11239
|
-
".cache",
|
|
11240
|
-
".turbo"
|
|
11241
|
-
]);
|
|
11242
|
-
var DOCUMENT_VALID_TYPES = new Set([
|
|
11243
|
-
"fact",
|
|
11244
|
-
"decision",
|
|
11245
|
-
"rationale",
|
|
11246
|
-
"preference",
|
|
11247
|
-
"procedural",
|
|
11248
|
-
"semantic",
|
|
11249
|
-
"system",
|
|
11250
|
-
"configuration",
|
|
11251
|
-
"architectural",
|
|
11252
|
-
"relationship",
|
|
11253
|
-
"episodic",
|
|
11254
|
-
"daily-log"
|
|
11255
|
-
]);
|
|
11256
|
-
var ENTIRE_VALID_TYPES = new Set(["skill", "preference", "decision", "rationale", "procedural", "semantic", "fact"]);
|
|
11257
|
-
var CHAT_VALID_TYPES = new Set(["fact", "decision", "rationale", "preference", "procedural", "semantic", "system"]);
|
|
11258
|
-
var MARKDOWN_EXTS = new Set([".md", ".mdx", ".markdown"]);
|
|
11259
|
-
var TXT_EXTS = new Set([".txt", ".text", ".log", ".rst"]);
|
|
11260
|
-
var PDF_EXTS = new Set([".pdf"]);
|
|
11261
|
-
var CODE_EXTS = new Set([
|
|
11262
|
-
".ts",
|
|
11263
|
-
".tsx",
|
|
11264
|
-
".js",
|
|
11265
|
-
".jsx",
|
|
11266
|
-
".py",
|
|
11267
|
-
".rs",
|
|
11268
|
-
".go",
|
|
11269
|
-
".java",
|
|
11270
|
-
".rb",
|
|
11271
|
-
".php",
|
|
11272
|
-
".swift",
|
|
11273
|
-
".kt",
|
|
11274
|
-
".scala",
|
|
11275
|
-
".c",
|
|
11276
|
-
".cpp",
|
|
11277
|
-
".h",
|
|
11278
|
-
".hpp",
|
|
11279
|
-
".sh",
|
|
11280
|
-
".bash",
|
|
11281
|
-
".zsh",
|
|
11282
|
-
".sql",
|
|
11283
|
-
".yaml",
|
|
11284
|
-
".yml",
|
|
11285
|
-
".toml",
|
|
11286
|
-
".json",
|
|
11287
|
-
".xml",
|
|
11288
|
-
".css",
|
|
11289
|
-
".scss",
|
|
11290
|
-
".html",
|
|
11291
|
-
".htm"
|
|
11292
|
-
]);
|
|
11293
|
-
var SKIP_FILES = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules", ".git", ".env", ".env.local"]);
|
|
11294
11522
|
|
|
11295
11523
|
// src/index.ts
|
|
11296
11524
|
class BaseConnector {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/connector-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.158.0",
|
|
4
4
|
"description": "Base class for Signet harness connectors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typecheck": "tsc --noEmit"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@signetai/core": "0.
|
|
29
|
+
"@signetai/core": "0.158.0",
|
|
30
30
|
"json5": "^2.2.3",
|
|
31
31
|
"jsonc-parser": "3.3.1"
|
|
32
32
|
},
|