@signetai/connector-gemini 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 +770 -314
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -602,6 +602,8 @@ var require_Alias = __commonJS2((exports) => {
|
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
resolve(doc, ctx) {
|
|
605
|
+
if (ctx?.maxAliasCount === 0)
|
|
606
|
+
throw new ReferenceError("Alias resolution is disabled");
|
|
605
607
|
let nodes;
|
|
606
608
|
if (ctx?.aliasResolveCache) {
|
|
607
609
|
nodes = ctx.aliasResolveCache;
|
|
@@ -1631,18 +1633,18 @@ var require_merge = __commonJS2((exports) => {
|
|
|
1631
1633
|
};
|
|
1632
1634
|
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);
|
|
1633
1635
|
function addMergeToJSMap(ctx, map, value) {
|
|
1634
|
-
|
|
1635
|
-
if (identity.isSeq(
|
|
1636
|
-
for (const it of
|
|
1636
|
+
const source = resolveAliasValue(ctx, value);
|
|
1637
|
+
if (identity.isSeq(source))
|
|
1638
|
+
for (const it of source.items)
|
|
1637
1639
|
mergeValue(ctx, map, it);
|
|
1638
|
-
else if (Array.isArray(
|
|
1639
|
-
for (const it of
|
|
1640
|
+
else if (Array.isArray(source))
|
|
1641
|
+
for (const it of source)
|
|
1640
1642
|
mergeValue(ctx, map, it);
|
|
1641
1643
|
else
|
|
1642
|
-
mergeValue(ctx, map,
|
|
1644
|
+
mergeValue(ctx, map, source);
|
|
1643
1645
|
}
|
|
1644
1646
|
function mergeValue(ctx, map, value) {
|
|
1645
|
-
const source = ctx
|
|
1647
|
+
const source = resolveAliasValue(ctx, value);
|
|
1646
1648
|
if (!identity.isMap(source))
|
|
1647
1649
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1648
1650
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -1663,6 +1665,9 @@ var require_merge = __commonJS2((exports) => {
|
|
|
1663
1665
|
}
|
|
1664
1666
|
return map;
|
|
1665
1667
|
}
|
|
1668
|
+
function resolveAliasValue(ctx, value) {
|
|
1669
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
1670
|
+
}
|
|
1666
1671
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1667
1672
|
exports.isMergeKey = isMergeKey;
|
|
1668
1673
|
exports.merge = merge;
|
|
@@ -2216,7 +2221,7 @@ var require_stringifyNumber = __commonJS2((exports) => {
|
|
|
2216
2221
|
if (!isFinite(num))
|
|
2217
2222
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
2218
2223
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
2219
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
2224
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
2220
2225
|
let i = n.indexOf(".");
|
|
2221
2226
|
if (i < 0) {
|
|
2222
2227
|
i = n.length;
|
|
@@ -4384,7 +4389,7 @@ var require_resolve_flow_scalar = __commonJS2((exports) => {
|
|
|
4384
4389
|
while (next === " " || next === "\t")
|
|
4385
4390
|
next = source[++i + 1];
|
|
4386
4391
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
4387
|
-
const length =
|
|
4392
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
4388
4393
|
res += parseCharCode(source, i + 1, length, onError);
|
|
4389
4394
|
i += length;
|
|
4390
4395
|
} else {
|
|
@@ -4453,12 +4458,13 @@ var require_resolve_flow_scalar = __commonJS2((exports) => {
|
|
|
4453
4458
|
const cc = source.substr(offset, length);
|
|
4454
4459
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
4455
4460
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
4456
|
-
|
|
4461
|
+
try {
|
|
4462
|
+
return String.fromCodePoint(code);
|
|
4463
|
+
} catch {
|
|
4457
4464
|
const raw = source.substr(offset - 2, length + 2);
|
|
4458
4465
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
4459
4466
|
return raw;
|
|
4460
4467
|
}
|
|
4461
|
-
return String.fromCodePoint(code);
|
|
4462
4468
|
}
|
|
4463
4469
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4464
4470
|
});
|
|
@@ -4787,8 +4793,10 @@ ${cb}` : comment;
|
|
|
4787
4793
|
}
|
|
4788
4794
|
}
|
|
4789
4795
|
if (afterDoc) {
|
|
4790
|
-
|
|
4791
|
-
|
|
4796
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
4797
|
+
doc.errors.push(this.errors[i]);
|
|
4798
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
4799
|
+
doc.warnings.push(this.warnings[i]);
|
|
4792
4800
|
} else {
|
|
4793
4801
|
doc.errors = this.errors;
|
|
4794
4802
|
doc.warnings = this.warnings;
|
|
@@ -5490,7 +5498,7 @@ var require_lexer = __commonJS2((exports) => {
|
|
|
5490
5498
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
5491
5499
|
this.indentNext = this.indentValue + 1;
|
|
5492
5500
|
this.indentValue += n;
|
|
5493
|
-
return
|
|
5501
|
+
return "block-start";
|
|
5494
5502
|
}
|
|
5495
5503
|
return "doc";
|
|
5496
5504
|
}
|
|
@@ -5797,26 +5805,37 @@ var require_lexer = __commonJS2((exports) => {
|
|
|
5797
5805
|
return 0;
|
|
5798
5806
|
}
|
|
5799
5807
|
*pushIndicators() {
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5808
|
+
let n = 0;
|
|
5809
|
+
loop:
|
|
5810
|
+
while (true) {
|
|
5811
|
+
switch (this.charAt(0)) {
|
|
5812
|
+
case "!":
|
|
5813
|
+
n += yield* this.pushTag();
|
|
5814
|
+
n += yield* this.pushSpaces(true);
|
|
5815
|
+
continue loop;
|
|
5816
|
+
case "&":
|
|
5817
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
5818
|
+
n += yield* this.pushSpaces(true);
|
|
5819
|
+
continue loop;
|
|
5820
|
+
case "-":
|
|
5821
|
+
case "?":
|
|
5822
|
+
case ":": {
|
|
5823
|
+
const inFlow = this.flowLevel > 0;
|
|
5824
|
+
const ch1 = this.charAt(1);
|
|
5825
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
5826
|
+
if (!inFlow)
|
|
5827
|
+
this.indentNext = this.indentValue + 1;
|
|
5828
|
+
else if (this.flowKey)
|
|
5829
|
+
this.flowKey = false;
|
|
5830
|
+
n += yield* this.pushCount(1);
|
|
5831
|
+
n += yield* this.pushSpaces(true);
|
|
5832
|
+
continue loop;
|
|
5833
|
+
}
|
|
5834
|
+
}
|
|
5816
5835
|
}
|
|
5836
|
+
break loop;
|
|
5817
5837
|
}
|
|
5818
|
-
|
|
5819
|
-
return 0;
|
|
5838
|
+
return n;
|
|
5820
5839
|
}
|
|
5821
5840
|
*pushTag() {
|
|
5822
5841
|
if (this.charAt(1) === "<") {
|
|
@@ -5967,6 +5986,13 @@ var require_parser = __commonJS2((exports) => {
|
|
|
5967
5986
|
while (prev[++i]?.type === "space") {}
|
|
5968
5987
|
return prev.splice(i, prev.length);
|
|
5969
5988
|
}
|
|
5989
|
+
function arrayPushArray(target, source) {
|
|
5990
|
+
if (source.length < 1e5)
|
|
5991
|
+
Array.prototype.push.apply(target, source);
|
|
5992
|
+
else
|
|
5993
|
+
for (let i = 0;i < source.length; ++i)
|
|
5994
|
+
target.push(source[i]);
|
|
5995
|
+
}
|
|
5970
5996
|
function fixFlowSeqItems(fc) {
|
|
5971
5997
|
if (fc.start.type === "flow-seq-start") {
|
|
5972
5998
|
for (const it of fc.items) {
|
|
@@ -5976,11 +6002,11 @@ var require_parser = __commonJS2((exports) => {
|
|
|
5976
6002
|
delete it.key;
|
|
5977
6003
|
if (isFlowToken(it.value)) {
|
|
5978
6004
|
if (it.value.end)
|
|
5979
|
-
|
|
6005
|
+
arrayPushArray(it.value.end, it.sep);
|
|
5980
6006
|
else
|
|
5981
6007
|
it.value.end = it.sep;
|
|
5982
6008
|
} else
|
|
5983
|
-
|
|
6009
|
+
arrayPushArray(it.start, it.sep);
|
|
5984
6010
|
delete it.sep;
|
|
5985
6011
|
}
|
|
5986
6012
|
}
|
|
@@ -6320,7 +6346,7 @@ var require_parser = __commonJS2((exports) => {
|
|
|
6320
6346
|
const prev = map.items[map.items.length - 2];
|
|
6321
6347
|
const end = prev?.value?.end;
|
|
6322
6348
|
if (Array.isArray(end)) {
|
|
6323
|
-
|
|
6349
|
+
arrayPushArray(end, it.start);
|
|
6324
6350
|
end.push(this.sourceToken);
|
|
6325
6351
|
map.items.pop();
|
|
6326
6352
|
return;
|
|
@@ -6508,7 +6534,7 @@ var require_parser = __commonJS2((exports) => {
|
|
|
6508
6534
|
const prev = seq.items[seq.items.length - 2];
|
|
6509
6535
|
const end = prev?.value?.end;
|
|
6510
6536
|
if (Array.isArray(end)) {
|
|
6511
|
-
|
|
6537
|
+
arrayPushArray(end, it.start);
|
|
6512
6538
|
end.push(this.sourceToken);
|
|
6513
6539
|
seq.items.pop();
|
|
6514
6540
|
return;
|
|
@@ -6902,6 +6928,7 @@ var PIPELINE_PROVIDER_CHOICES = [
|
|
|
6902
6928
|
var SYNTHESIS_PROVIDER_CHOICES = PIPELINE_PROVIDER_CHOICES.filter((provider) => provider !== "command");
|
|
6903
6929
|
var PIPELINE_PROVIDER_SET = new Set(PIPELINE_PROVIDER_CHOICES);
|
|
6904
6930
|
var SYNTHESIS_PROVIDER_SET = new Set(SYNTHESIS_PROVIDER_CHOICES);
|
|
6931
|
+
var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = ["extract", "aggregate-recall", "session_end", "checkpoint", "dreaming"];
|
|
6905
6932
|
var MEMORIES_FTS_TOKENIZER = "unicode61";
|
|
6906
6933
|
function normalizeSql(sql) {
|
|
6907
6934
|
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
@@ -9999,6 +10026,243 @@ function up92(db) {
|
|
|
9999
10026
|
ON embeddings_staging(agent_id, source_type, source_id);
|
|
10000
10027
|
`);
|
|
10001
10028
|
}
|
|
10029
|
+
function up93(db) {
|
|
10030
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
10031
|
+
if (!columns.some((column) => column.name === "evidence_cursor")) {
|
|
10032
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
|
|
10033
|
+
}
|
|
10034
|
+
}
|
|
10035
|
+
var DERIVED_SOURCE_TYPES = DAEMON_DERIVED_MEMORY_SOURCE_TYPES;
|
|
10036
|
+
function hasColumn13(db, table, column) {
|
|
10037
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
10038
|
+
return rows.some((r) => r.name === column);
|
|
10039
|
+
}
|
|
10040
|
+
function up94(db) {
|
|
10041
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
|
|
10042
|
+
if (tables.length === 0)
|
|
10043
|
+
return;
|
|
10044
|
+
if (!hasColumn13(db, "memories", "memory_kind")) {
|
|
10045
|
+
db.exec("ALTER TABLE memories ADD COLUMN memory_kind TEXT");
|
|
10046
|
+
}
|
|
10047
|
+
if (!hasColumn13(db, "memories", "evidence_meta")) {
|
|
10048
|
+
db.exec("ALTER TABLE memories ADD COLUMN evidence_meta TEXT");
|
|
10049
|
+
}
|
|
10050
|
+
if (hasColumn13(db, "memories", "source_type")) {
|
|
10051
|
+
const placeholders = DERIVED_SOURCE_TYPES.map(() => "?").join(", ");
|
|
10052
|
+
db.prepare(`UPDATE memories
|
|
10053
|
+
SET memory_kind = 'episodic'
|
|
10054
|
+
WHERE memory_kind IS NULL
|
|
10055
|
+
AND (source_type IS NULL OR source_type NOT IN (${placeholders}))`).run(...DERIVED_SOURCE_TYPES);
|
|
10056
|
+
} else {
|
|
10057
|
+
db.exec(`UPDATE memories
|
|
10058
|
+
SET memory_kind = 'episodic'
|
|
10059
|
+
WHERE memory_kind IS NULL`);
|
|
10060
|
+
}
|
|
10061
|
+
}
|
|
10062
|
+
function hasColumn14(db, table, column) {
|
|
10063
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10064
|
+
}
|
|
10065
|
+
function up95(db) {
|
|
10066
|
+
const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
|
|
10067
|
+
if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
|
|
10068
|
+
return;
|
|
10069
|
+
db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
|
|
10070
|
+
}
|
|
10071
|
+
function up96(db) {
|
|
10072
|
+
db.exec("DROP TABLE IF EXISTS ingestion_jobs");
|
|
10073
|
+
}
|
|
10074
|
+
function up97(db) {
|
|
10075
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
10076
|
+
if (!columns.some((column) => column.name === "last_failure_at")) {
|
|
10077
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
|
|
10078
|
+
}
|
|
10079
|
+
db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
|
|
10080
|
+
}
|
|
10081
|
+
function up98(db) {
|
|
10082
|
+
db.exec(`
|
|
10083
|
+
CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
|
|
10084
|
+
agent_id TEXT NOT NULL,
|
|
10085
|
+
source_kind TEXT NOT NULL CHECK (source_kind IN ('memory', 'artifact', 'transcript', 'summary')),
|
|
10086
|
+
source_id TEXT NOT NULL,
|
|
10087
|
+
reason TEXT NOT NULL,
|
|
10088
|
+
pass_id TEXT NOT NULL,
|
|
10089
|
+
excluded_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10090
|
+
requeue_requested_at TEXT,
|
|
10091
|
+
resolved_at TEXT,
|
|
10092
|
+
PRIMARY KEY (agent_id, source_kind, source_id)
|
|
10093
|
+
);
|
|
10094
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_evidence_exclusions_active
|
|
10095
|
+
ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
|
|
10096
|
+
`);
|
|
10097
|
+
}
|
|
10098
|
+
function up99(db) {
|
|
10099
|
+
db.exec(`
|
|
10100
|
+
CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
|
|
10101
|
+
id TEXT PRIMARY KEY,
|
|
10102
|
+
agent_id TEXT NOT NULL,
|
|
10103
|
+
pass_id TEXT NOT NULL,
|
|
10104
|
+
sequence INTEGER NOT NULL,
|
|
10105
|
+
tool_call_id TEXT,
|
|
10106
|
+
tool_name TEXT NOT NULL,
|
|
10107
|
+
input_json TEXT NOT NULL,
|
|
10108
|
+
output_json TEXT NOT NULL,
|
|
10109
|
+
success INTEGER NOT NULL,
|
|
10110
|
+
latency_ms INTEGER NOT NULL,
|
|
10111
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10112
|
+
UNIQUE(agent_id, pass_id, sequence)
|
|
10113
|
+
);
|
|
10114
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_tool_calls_pass
|
|
10115
|
+
ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
|
|
10116
|
+
`);
|
|
10117
|
+
}
|
|
10118
|
+
function up100(db) {
|
|
10119
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
10120
|
+
if (!columns.some((column) => column.name === "evidence_window_json")) {
|
|
10121
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
|
|
10122
|
+
}
|
|
10123
|
+
if (!columns.some((column) => column.name === "runbook_json")) {
|
|
10124
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
|
|
10125
|
+
}
|
|
10126
|
+
}
|
|
10127
|
+
function up101(db) {
|
|
10128
|
+
db.exec(`
|
|
10129
|
+
CREATE TABLE IF NOT EXISTS dreaming_attention (
|
|
10130
|
+
id TEXT PRIMARY KEY,
|
|
10131
|
+
agent_id TEXT NOT NULL,
|
|
10132
|
+
kind TEXT NOT NULL CHECK (kind IN ('review_due', 'hygiene', 'contested_claim', 'evidence_requeue')),
|
|
10133
|
+
subject_ref TEXT NOT NULL,
|
|
10134
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
10135
|
+
priority INTEGER NOT NULL DEFAULT 0 CHECK (priority >= 0 AND priority <= 100),
|
|
10136
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10137
|
+
generation INTEGER NOT NULL DEFAULT 0,
|
|
10138
|
+
resolved_at TEXT,
|
|
10139
|
+
resolved_by_pass_id TEXT,
|
|
10140
|
+
UNIQUE(agent_id, kind, subject_ref)
|
|
10141
|
+
);
|
|
10142
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_attention_pending
|
|
10143
|
+
ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
|
|
10144
|
+
`);
|
|
10145
|
+
}
|
|
10146
|
+
function hasColumn15(db, table, column) {
|
|
10147
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10148
|
+
}
|
|
10149
|
+
function up102(db) {
|
|
10150
|
+
const requiredMemoryColumns = [
|
|
10151
|
+
"content_hash",
|
|
10152
|
+
"normalized_content",
|
|
10153
|
+
"memory_kind",
|
|
10154
|
+
"source_type",
|
|
10155
|
+
"source_path",
|
|
10156
|
+
"agent_id",
|
|
10157
|
+
"visibility",
|
|
10158
|
+
"is_deleted",
|
|
10159
|
+
"extraction_status"
|
|
10160
|
+
];
|
|
10161
|
+
if (!hasColumn15(db, "entity_attributes", "memory_id") || !requiredMemoryColumns.every((column) => hasColumn15(db, "memories", column))) {
|
|
10162
|
+
return;
|
|
10163
|
+
}
|
|
10164
|
+
db.exec(`
|
|
10165
|
+
INSERT OR IGNORE INTO memories
|
|
10166
|
+
(id, content, normalized_content, content_hash, who, why, project,
|
|
10167
|
+
importance, type, tags, pinned, is_deleted, extraction_status,
|
|
10168
|
+
created_at, updated_at, updated_by, source_type, source_id, source_path,
|
|
10169
|
+
agent_id, visibility, memory_kind)
|
|
10170
|
+
SELECT attr.id, attr.content, attr.normalized_content,
|
|
10171
|
+
'semantic-attribute:' || attr.id, 'dreaming', 'Derived semantic attribute', NULL,
|
|
10172
|
+
attr.importance, 'semantic', 'semantic,attribute', 0,
|
|
10173
|
+
CASE WHEN attr.status = 'active' THEN 0 ELSE 1 END, 'completed',
|
|
10174
|
+
attr.created_at, attr.updated_at, 'dreaming', 'dreaming', attr.source_id, attr.source_path,
|
|
10175
|
+
attr.agent_id, 'global', 'derived'
|
|
10176
|
+
FROM entity_attributes attr
|
|
10177
|
+
WHERE attr.memory_id IS NULL
|
|
10178
|
+
`);
|
|
10179
|
+
db.exec(`
|
|
10180
|
+
UPDATE entity_attributes
|
|
10181
|
+
SET memory_id = id
|
|
10182
|
+
WHERE memory_id IS NULL
|
|
10183
|
+
AND EXISTS (SELECT 1 FROM memories WHERE memories.id = entity_attributes.id)
|
|
10184
|
+
`);
|
|
10185
|
+
db.exec(`
|
|
10186
|
+
INSERT OR IGNORE INTO memory_entity_mentions (memory_id, entity_id)
|
|
10187
|
+
SELECT attr.memory_id, aspect.entity_id
|
|
10188
|
+
FROM entity_attributes attr
|
|
10189
|
+
JOIN entity_aspects aspect ON aspect.id = attr.aspect_id AND aspect.agent_id = attr.agent_id
|
|
10190
|
+
WHERE attr.memory_id IS NOT NULL
|
|
10191
|
+
`);
|
|
10192
|
+
db.exec(`
|
|
10193
|
+
UPDATE entities
|
|
10194
|
+
SET mentions = (
|
|
10195
|
+
SELECT COUNT(*) FROM memory_entity_mentions WHERE entity_id = entities.id
|
|
10196
|
+
)
|
|
10197
|
+
WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
|
|
10198
|
+
`);
|
|
10199
|
+
}
|
|
10200
|
+
function up103(db) {
|
|
10201
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
|
|
10202
|
+
if (tables.length !== 2)
|
|
10203
|
+
return;
|
|
10204
|
+
const memoryColumns = db.prepare("PRAGMA table_info(memories)").all().map((row) => row.name);
|
|
10205
|
+
const attributeColumns = db.prepare("PRAGMA table_info(entity_attributes)").all().map((row) => row.name);
|
|
10206
|
+
if (!memoryColumns.includes("memory_kind") || !attributeColumns.includes("memory_id"))
|
|
10207
|
+
return;
|
|
10208
|
+
db.exec(`
|
|
10209
|
+
UPDATE memories
|
|
10210
|
+
SET memory_kind = 'derived'
|
|
10211
|
+
WHERE memory_kind IS NULL
|
|
10212
|
+
AND id IN (
|
|
10213
|
+
SELECT memory_id FROM entity_attributes WHERE memory_id IS NOT NULL
|
|
10214
|
+
)
|
|
10215
|
+
`);
|
|
10216
|
+
}
|
|
10217
|
+
function tableExists(db, table) {
|
|
10218
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
|
|
10219
|
+
}
|
|
10220
|
+
function hasColumn16(db, table, column) {
|
|
10221
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
10222
|
+
}
|
|
10223
|
+
function up104(db) {
|
|
10224
|
+
db.exec(`
|
|
10225
|
+
CREATE TABLE IF NOT EXISTS derived_memory_sources (
|
|
10226
|
+
derived_memory_id TEXT NOT NULL,
|
|
10227
|
+
source_kind TEXT NOT NULL,
|
|
10228
|
+
source_id TEXT NOT NULL,
|
|
10229
|
+
source_path TEXT,
|
|
10230
|
+
agent_id TEXT NOT NULL,
|
|
10231
|
+
created_at TEXT NOT NULL,
|
|
10232
|
+
PRIMARY KEY (derived_memory_id, source_kind, source_id)
|
|
10233
|
+
);
|
|
10234
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_derived
|
|
10235
|
+
ON derived_memory_sources(agent_id, derived_memory_id);
|
|
10236
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_source
|
|
10237
|
+
ON derived_memory_sources(agent_id, source_kind, source_id);
|
|
10238
|
+
`);
|
|
10239
|
+
if (tableExists(db, "aggregate_evidence_sources")) {
|
|
10240
|
+
db.exec(`
|
|
10241
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
10242
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
10243
|
+
SELECT aggregate_memory_id, source_kind, source_id, source_path, agent_id, created_at
|
|
10244
|
+
FROM aggregate_evidence_sources
|
|
10245
|
+
`);
|
|
10246
|
+
}
|
|
10247
|
+
if (tableExists(db, "aggregate_memory_sources")) {
|
|
10248
|
+
db.exec(`
|
|
10249
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
10250
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
10251
|
+
SELECT aggregate_memory_id, 'memory', source_memory_id, NULL, agent_id, created_at
|
|
10252
|
+
FROM aggregate_memory_sources
|
|
10253
|
+
`);
|
|
10254
|
+
}
|
|
10255
|
+
if (tableExists(db, "memories") && !hasColumn16(db, "memories", "stale_at")) {
|
|
10256
|
+
db.exec("ALTER TABLE memories ADD COLUMN stale_at TEXT");
|
|
10257
|
+
}
|
|
10258
|
+
if (tableExists(db, "memories")) {
|
|
10259
|
+
db.exec(`
|
|
10260
|
+
CREATE INDEX IF NOT EXISTS idx_memories_stale_derived
|
|
10261
|
+
ON memories(agent_id, stale_at)
|
|
10262
|
+
WHERE stale_at IS NOT NULL AND is_deleted = 0
|
|
10263
|
+
`);
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10002
10266
|
var MIGRATIONS = [
|
|
10003
10267
|
{
|
|
10004
10268
|
version: 1,
|
|
@@ -10083,7 +10347,6 @@ var MIGRATIONS = [
|
|
|
10083
10347
|
name: "ingestion-tracking",
|
|
10084
10348
|
up: up13,
|
|
10085
10349
|
artifacts: {
|
|
10086
|
-
tables: ["ingestion_jobs"],
|
|
10087
10350
|
columns: [
|
|
10088
10351
|
{ table: "memories", column: "source_path" },
|
|
10089
10352
|
{ table: "memories", column: "source_section" }
|
|
@@ -10746,6 +11009,87 @@ var MIGRATIONS = [
|
|
|
10746
11009
|
name: "embedding-staging-store",
|
|
10747
11010
|
up: up92,
|
|
10748
11011
|
artifacts: { tables: ["embeddings_staging"] }
|
|
11012
|
+
},
|
|
11013
|
+
{
|
|
11014
|
+
version: 93,
|
|
11015
|
+
name: "dreaming-evidence-cursor",
|
|
11016
|
+
up: up93,
|
|
11017
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
|
|
11018
|
+
},
|
|
11019
|
+
{
|
|
11020
|
+
version: 94,
|
|
11021
|
+
name: "memory-kind",
|
|
11022
|
+
up: up94,
|
|
11023
|
+
artifacts: {
|
|
11024
|
+
columns: [
|
|
11025
|
+
{ table: "memories", column: "memory_kind" },
|
|
11026
|
+
{ table: "memories", column: "evidence_meta" }
|
|
11027
|
+
]
|
|
11028
|
+
}
|
|
11029
|
+
},
|
|
11030
|
+
{
|
|
11031
|
+
version: 95,
|
|
11032
|
+
name: "compaction-recall-projections",
|
|
11033
|
+
up: up95
|
|
11034
|
+
},
|
|
11035
|
+
{
|
|
11036
|
+
version: 96,
|
|
11037
|
+
name: "retire-legacy-ingestion",
|
|
11038
|
+
up: up96
|
|
11039
|
+
},
|
|
11040
|
+
{
|
|
11041
|
+
version: 97,
|
|
11042
|
+
name: "dreaming-failure-backoff",
|
|
11043
|
+
up: up97,
|
|
11044
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
|
|
11045
|
+
},
|
|
11046
|
+
{
|
|
11047
|
+
version: 98,
|
|
11048
|
+
name: "dreaming-evidence-exclusions",
|
|
11049
|
+
up: up98,
|
|
11050
|
+
artifacts: { tables: ["dreaming_evidence_exclusions"] }
|
|
11051
|
+
},
|
|
11052
|
+
{
|
|
11053
|
+
version: 99,
|
|
11054
|
+
name: "dreaming-tool-calls",
|
|
11055
|
+
up: up99,
|
|
11056
|
+
artifacts: { tables: ["dreaming_tool_calls"] }
|
|
11057
|
+
},
|
|
11058
|
+
{
|
|
11059
|
+
version: 100,
|
|
11060
|
+
name: "dreaming-runbook",
|
|
11061
|
+
up: up100,
|
|
11062
|
+
artifacts: {
|
|
11063
|
+
columns: [
|
|
11064
|
+
{ table: "dreaming_passes", column: "evidence_window_json" },
|
|
11065
|
+
{ table: "dreaming_passes", column: "runbook_json" }
|
|
11066
|
+
]
|
|
11067
|
+
}
|
|
11068
|
+
},
|
|
11069
|
+
{
|
|
11070
|
+
version: 101,
|
|
11071
|
+
name: "dreaming-attention",
|
|
11072
|
+
up: up101,
|
|
11073
|
+
artifacts: { tables: ["dreaming_attention"] }
|
|
11074
|
+
},
|
|
11075
|
+
{
|
|
11076
|
+
version: 102,
|
|
11077
|
+
name: "attribute-semantic-memories",
|
|
11078
|
+
up: up102
|
|
11079
|
+
},
|
|
11080
|
+
{
|
|
11081
|
+
version: 103,
|
|
11082
|
+
name: "semantic-memory-kind",
|
|
11083
|
+
up: up103
|
|
11084
|
+
},
|
|
11085
|
+
{
|
|
11086
|
+
version: 104,
|
|
11087
|
+
name: "derived-memory-provenance",
|
|
11088
|
+
up: up104,
|
|
11089
|
+
artifacts: {
|
|
11090
|
+
tables: ["derived_memory_sources"],
|
|
11091
|
+
columns: [{ table: "memories", column: "stale_at" }]
|
|
11092
|
+
}
|
|
10749
11093
|
}
|
|
10750
11094
|
];
|
|
10751
11095
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -11083,122 +11427,6 @@ function stripSignetBlock(content) {
|
|
|
11083
11427
|
function escapeRegex(str) {
|
|
11084
11428
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11085
11429
|
}
|
|
11086
|
-
var SKIP_SUBTYPES = new Set([
|
|
11087
|
-
"channel_join",
|
|
11088
|
-
"channel_leave",
|
|
11089
|
-
"channel_topic",
|
|
11090
|
-
"channel_purpose",
|
|
11091
|
-
"channel_name",
|
|
11092
|
-
"channel_archive",
|
|
11093
|
-
"channel_unarchive",
|
|
11094
|
-
"group_join",
|
|
11095
|
-
"group_leave",
|
|
11096
|
-
"group_topic",
|
|
11097
|
-
"group_purpose",
|
|
11098
|
-
"group_name",
|
|
11099
|
-
"group_archive",
|
|
11100
|
-
"group_unarchive",
|
|
11101
|
-
"pinned_item",
|
|
11102
|
-
"unpinned_item",
|
|
11103
|
-
"bot_add",
|
|
11104
|
-
"bot_remove",
|
|
11105
|
-
"tombstone",
|
|
11106
|
-
"file_comment",
|
|
11107
|
-
"sh_room_created",
|
|
11108
|
-
"sh_room_shared"
|
|
11109
|
-
]);
|
|
11110
|
-
var SKIP_TYPES = new Set([
|
|
11111
|
-
"RecipientAdd",
|
|
11112
|
-
"RecipientRemove",
|
|
11113
|
-
"ChannelNameChange",
|
|
11114
|
-
"ChannelIconChange",
|
|
11115
|
-
"ChannelPinnedMessage",
|
|
11116
|
-
"GuildMemberJoin",
|
|
11117
|
-
"UserPremiumGuildSubscription",
|
|
11118
|
-
"UserPremiumGuildSubscriptionTier1",
|
|
11119
|
-
"UserPremiumGuildSubscriptionTier2",
|
|
11120
|
-
"UserPremiumGuildSubscriptionTier3",
|
|
11121
|
-
"ChannelFollowAdd",
|
|
11122
|
-
"GuildDiscoveryDisqualified",
|
|
11123
|
-
"GuildDiscoveryRequalified",
|
|
11124
|
-
"GuildDiscoveryGracePeriodInitialWarning",
|
|
11125
|
-
"GuildDiscoveryGracePeriodFinalWarning",
|
|
11126
|
-
"ThreadCreated",
|
|
11127
|
-
"ApplicationCommand"
|
|
11128
|
-
]);
|
|
11129
|
-
var SKIP_DIRS = new Set([
|
|
11130
|
-
"node_modules",
|
|
11131
|
-
".git",
|
|
11132
|
-
"dist",
|
|
11133
|
-
"build",
|
|
11134
|
-
"out",
|
|
11135
|
-
"target",
|
|
11136
|
-
".next",
|
|
11137
|
-
".nuxt",
|
|
11138
|
-
"__pycache__",
|
|
11139
|
-
".tox",
|
|
11140
|
-
".mypy_cache",
|
|
11141
|
-
".pytest_cache",
|
|
11142
|
-
"venv",
|
|
11143
|
-
".venv",
|
|
11144
|
-
"env",
|
|
11145
|
-
"vendor",
|
|
11146
|
-
"coverage",
|
|
11147
|
-
".cache",
|
|
11148
|
-
".turbo"
|
|
11149
|
-
]);
|
|
11150
|
-
var DOCUMENT_VALID_TYPES = new Set([
|
|
11151
|
-
"fact",
|
|
11152
|
-
"decision",
|
|
11153
|
-
"rationale",
|
|
11154
|
-
"preference",
|
|
11155
|
-
"procedural",
|
|
11156
|
-
"semantic",
|
|
11157
|
-
"system",
|
|
11158
|
-
"configuration",
|
|
11159
|
-
"architectural",
|
|
11160
|
-
"relationship",
|
|
11161
|
-
"episodic",
|
|
11162
|
-
"daily-log"
|
|
11163
|
-
]);
|
|
11164
|
-
var ENTIRE_VALID_TYPES = new Set(["skill", "preference", "decision", "rationale", "procedural", "semantic", "fact"]);
|
|
11165
|
-
var CHAT_VALID_TYPES = new Set(["fact", "decision", "rationale", "preference", "procedural", "semantic", "system"]);
|
|
11166
|
-
var MARKDOWN_EXTS = new Set([".md", ".mdx", ".markdown"]);
|
|
11167
|
-
var TXT_EXTS = new Set([".txt", ".text", ".log", ".rst"]);
|
|
11168
|
-
var PDF_EXTS = new Set([".pdf"]);
|
|
11169
|
-
var CODE_EXTS = new Set([
|
|
11170
|
-
".ts",
|
|
11171
|
-
".tsx",
|
|
11172
|
-
".js",
|
|
11173
|
-
".jsx",
|
|
11174
|
-
".py",
|
|
11175
|
-
".rs",
|
|
11176
|
-
".go",
|
|
11177
|
-
".java",
|
|
11178
|
-
".rb",
|
|
11179
|
-
".php",
|
|
11180
|
-
".swift",
|
|
11181
|
-
".kt",
|
|
11182
|
-
".scala",
|
|
11183
|
-
".c",
|
|
11184
|
-
".cpp",
|
|
11185
|
-
".h",
|
|
11186
|
-
".hpp",
|
|
11187
|
-
".sh",
|
|
11188
|
-
".bash",
|
|
11189
|
-
".zsh",
|
|
11190
|
-
".sql",
|
|
11191
|
-
".yaml",
|
|
11192
|
-
".yml",
|
|
11193
|
-
".toml",
|
|
11194
|
-
".json",
|
|
11195
|
-
".xml",
|
|
11196
|
-
".css",
|
|
11197
|
-
".scss",
|
|
11198
|
-
".html",
|
|
11199
|
-
".htm"
|
|
11200
|
-
]);
|
|
11201
|
-
var SKIP_FILES = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules", ".git", ".env", ".env.local"]);
|
|
11202
11430
|
|
|
11203
11431
|
class BaseConnector {
|
|
11204
11432
|
stripSignetBlock(content) {
|
|
@@ -11874,6 +12102,8 @@ var require_Alias2 = __commonJS((exports) => {
|
|
|
11874
12102
|
});
|
|
11875
12103
|
}
|
|
11876
12104
|
resolve(doc, ctx) {
|
|
12105
|
+
if (ctx?.maxAliasCount === 0)
|
|
12106
|
+
throw new ReferenceError("Alias resolution is disabled");
|
|
11877
12107
|
let nodes;
|
|
11878
12108
|
if (ctx?.aliasResolveCache) {
|
|
11879
12109
|
nodes = ctx.aliasResolveCache;
|
|
@@ -12903,18 +13133,18 @@ var require_merge2 = __commonJS((exports) => {
|
|
|
12903
13133
|
};
|
|
12904
13134
|
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);
|
|
12905
13135
|
function addMergeToJSMap(ctx, map, value) {
|
|
12906
|
-
|
|
12907
|
-
if (identity.isSeq(
|
|
12908
|
-
for (const it of
|
|
13136
|
+
const source = resolveAliasValue(ctx, value);
|
|
13137
|
+
if (identity.isSeq(source))
|
|
13138
|
+
for (const it of source.items)
|
|
12909
13139
|
mergeValue(ctx, map, it);
|
|
12910
|
-
else if (Array.isArray(
|
|
12911
|
-
for (const it of
|
|
13140
|
+
else if (Array.isArray(source))
|
|
13141
|
+
for (const it of source)
|
|
12912
13142
|
mergeValue(ctx, map, it);
|
|
12913
13143
|
else
|
|
12914
|
-
mergeValue(ctx, map,
|
|
13144
|
+
mergeValue(ctx, map, source);
|
|
12915
13145
|
}
|
|
12916
13146
|
function mergeValue(ctx, map, value) {
|
|
12917
|
-
const source = ctx
|
|
13147
|
+
const source = resolveAliasValue(ctx, value);
|
|
12918
13148
|
if (!identity.isMap(source))
|
|
12919
13149
|
throw new Error("Merge sources must be maps or map aliases");
|
|
12920
13150
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -12935,6 +13165,9 @@ var require_merge2 = __commonJS((exports) => {
|
|
|
12935
13165
|
}
|
|
12936
13166
|
return map;
|
|
12937
13167
|
}
|
|
13168
|
+
function resolveAliasValue(ctx, value) {
|
|
13169
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
13170
|
+
}
|
|
12938
13171
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
12939
13172
|
exports.isMergeKey = isMergeKey;
|
|
12940
13173
|
exports.merge = merge;
|
|
@@ -13488,7 +13721,7 @@ var require_stringifyNumber2 = __commonJS((exports) => {
|
|
|
13488
13721
|
if (!isFinite(num))
|
|
13489
13722
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
13490
13723
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
13491
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
13724
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
13492
13725
|
let i = n.indexOf(".");
|
|
13493
13726
|
if (i < 0) {
|
|
13494
13727
|
i = n.length;
|
|
@@ -15656,7 +15889,7 @@ var require_resolve_flow_scalar2 = __commonJS((exports) => {
|
|
|
15656
15889
|
while (next === " " || next === "\t")
|
|
15657
15890
|
next = source[++i + 1];
|
|
15658
15891
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
15659
|
-
const length =
|
|
15892
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
15660
15893
|
res += parseCharCode(source, i + 1, length, onError);
|
|
15661
15894
|
i += length;
|
|
15662
15895
|
} else {
|
|
@@ -15725,12 +15958,13 @@ var require_resolve_flow_scalar2 = __commonJS((exports) => {
|
|
|
15725
15958
|
const cc = source.substr(offset, length);
|
|
15726
15959
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
15727
15960
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
15728
|
-
|
|
15961
|
+
try {
|
|
15962
|
+
return String.fromCodePoint(code);
|
|
15963
|
+
} catch {
|
|
15729
15964
|
const raw = source.substr(offset - 2, length + 2);
|
|
15730
15965
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
15731
15966
|
return raw;
|
|
15732
15967
|
}
|
|
15733
|
-
return String.fromCodePoint(code);
|
|
15734
15968
|
}
|
|
15735
15969
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
15736
15970
|
});
|
|
@@ -16059,8 +16293,10 @@ ${cb}` : comment;
|
|
|
16059
16293
|
}
|
|
16060
16294
|
}
|
|
16061
16295
|
if (afterDoc) {
|
|
16062
|
-
|
|
16063
|
-
|
|
16296
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
16297
|
+
doc.errors.push(this.errors[i]);
|
|
16298
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
16299
|
+
doc.warnings.push(this.warnings[i]);
|
|
16064
16300
|
} else {
|
|
16065
16301
|
doc.errors = this.errors;
|
|
16066
16302
|
doc.warnings = this.warnings;
|
|
@@ -16762,7 +16998,7 @@ var require_lexer2 = __commonJS((exports) => {
|
|
|
16762
16998
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
16763
16999
|
this.indentNext = this.indentValue + 1;
|
|
16764
17000
|
this.indentValue += n;
|
|
16765
|
-
return
|
|
17001
|
+
return "block-start";
|
|
16766
17002
|
}
|
|
16767
17003
|
return "doc";
|
|
16768
17004
|
}
|
|
@@ -17069,26 +17305,37 @@ var require_lexer2 = __commonJS((exports) => {
|
|
|
17069
17305
|
return 0;
|
|
17070
17306
|
}
|
|
17071
17307
|
*pushIndicators() {
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17308
|
+
let n = 0;
|
|
17309
|
+
loop:
|
|
17310
|
+
while (true) {
|
|
17311
|
+
switch (this.charAt(0)) {
|
|
17312
|
+
case "!":
|
|
17313
|
+
n += yield* this.pushTag();
|
|
17314
|
+
n += yield* this.pushSpaces(true);
|
|
17315
|
+
continue loop;
|
|
17316
|
+
case "&":
|
|
17317
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
17318
|
+
n += yield* this.pushSpaces(true);
|
|
17319
|
+
continue loop;
|
|
17320
|
+
case "-":
|
|
17321
|
+
case "?":
|
|
17322
|
+
case ":": {
|
|
17323
|
+
const inFlow = this.flowLevel > 0;
|
|
17324
|
+
const ch1 = this.charAt(1);
|
|
17325
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
17326
|
+
if (!inFlow)
|
|
17327
|
+
this.indentNext = this.indentValue + 1;
|
|
17328
|
+
else if (this.flowKey)
|
|
17329
|
+
this.flowKey = false;
|
|
17330
|
+
n += yield* this.pushCount(1);
|
|
17331
|
+
n += yield* this.pushSpaces(true);
|
|
17332
|
+
continue loop;
|
|
17333
|
+
}
|
|
17334
|
+
}
|
|
17088
17335
|
}
|
|
17336
|
+
break loop;
|
|
17089
17337
|
}
|
|
17090
|
-
|
|
17091
|
-
return 0;
|
|
17338
|
+
return n;
|
|
17092
17339
|
}
|
|
17093
17340
|
*pushTag() {
|
|
17094
17341
|
if (this.charAt(1) === "<") {
|
|
@@ -17239,6 +17486,13 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
17239
17486
|
while (prev[++i]?.type === "space") {}
|
|
17240
17487
|
return prev.splice(i, prev.length);
|
|
17241
17488
|
}
|
|
17489
|
+
function arrayPushArray(target, source) {
|
|
17490
|
+
if (source.length < 1e5)
|
|
17491
|
+
Array.prototype.push.apply(target, source);
|
|
17492
|
+
else
|
|
17493
|
+
for (let i = 0;i < source.length; ++i)
|
|
17494
|
+
target.push(source[i]);
|
|
17495
|
+
}
|
|
17242
17496
|
function fixFlowSeqItems(fc) {
|
|
17243
17497
|
if (fc.start.type === "flow-seq-start") {
|
|
17244
17498
|
for (const it of fc.items) {
|
|
@@ -17248,11 +17502,11 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
17248
17502
|
delete it.key;
|
|
17249
17503
|
if (isFlowToken(it.value)) {
|
|
17250
17504
|
if (it.value.end)
|
|
17251
|
-
|
|
17505
|
+
arrayPushArray(it.value.end, it.sep);
|
|
17252
17506
|
else
|
|
17253
17507
|
it.value.end = it.sep;
|
|
17254
17508
|
} else
|
|
17255
|
-
|
|
17509
|
+
arrayPushArray(it.start, it.sep);
|
|
17256
17510
|
delete it.sep;
|
|
17257
17511
|
}
|
|
17258
17512
|
}
|
|
@@ -17592,7 +17846,7 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
17592
17846
|
const prev = map.items[map.items.length - 2];
|
|
17593
17847
|
const end = prev?.value?.end;
|
|
17594
17848
|
if (Array.isArray(end)) {
|
|
17595
|
-
|
|
17849
|
+
arrayPushArray(end, it.start);
|
|
17596
17850
|
end.push(this.sourceToken);
|
|
17597
17851
|
map.items.pop();
|
|
17598
17852
|
return;
|
|
@@ -17780,7 +18034,7 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
17780
18034
|
const prev = seq.items[seq.items.length - 2];
|
|
17781
18035
|
const end = prev?.value?.end;
|
|
17782
18036
|
if (Array.isArray(end)) {
|
|
17783
|
-
|
|
18037
|
+
arrayPushArray(end, it.start);
|
|
17784
18038
|
end.push(this.sourceToken);
|
|
17785
18039
|
seq.items.pop();
|
|
17786
18040
|
return;
|
|
@@ -18174,6 +18428,7 @@ var PIPELINE_PROVIDER_CHOICES2 = [
|
|
|
18174
18428
|
var SYNTHESIS_PROVIDER_CHOICES2 = PIPELINE_PROVIDER_CHOICES2.filter((provider) => provider !== "command");
|
|
18175
18429
|
var PIPELINE_PROVIDER_SET2 = new Set(PIPELINE_PROVIDER_CHOICES2);
|
|
18176
18430
|
var SYNTHESIS_PROVIDER_SET2 = new Set(SYNTHESIS_PROVIDER_CHOICES2);
|
|
18431
|
+
var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = ["extract", "aggregate-recall", "session_end", "checkpoint", "dreaming"];
|
|
18177
18432
|
var MEMORIES_FTS_TOKENIZER2 = "unicode61";
|
|
18178
18433
|
function normalizeSql2(sql) {
|
|
18179
18434
|
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
@@ -18224,7 +18479,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
|
|
|
18224
18479
|
return true;
|
|
18225
18480
|
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
|
|
18226
18481
|
}
|
|
18227
|
-
function
|
|
18482
|
+
function up105(db) {
|
|
18228
18483
|
db.exec(`
|
|
18229
18484
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
18230
18485
|
version INTEGER PRIMARY KEY,
|
|
@@ -18313,12 +18568,12 @@ function up93(db) {
|
|
|
18313
18568
|
} catch {}
|
|
18314
18569
|
createMemoriesFts2(db);
|
|
18315
18570
|
}
|
|
18316
|
-
function
|
|
18571
|
+
function hasColumn17(db, table, column) {
|
|
18317
18572
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
18318
18573
|
return rows.some((r) => r.name === column);
|
|
18319
18574
|
}
|
|
18320
18575
|
function addColumnIfMissing23(db, table, column, definition) {
|
|
18321
|
-
if (!
|
|
18576
|
+
if (!hasColumn17(db, table, column)) {
|
|
18322
18577
|
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
18323
18578
|
}
|
|
18324
18579
|
}
|
|
@@ -18616,7 +18871,7 @@ function up810(db) {
|
|
|
18616
18871
|
ON embeddings(content_hash)
|
|
18617
18872
|
`);
|
|
18618
18873
|
}
|
|
18619
|
-
function
|
|
18874
|
+
function up910(db) {
|
|
18620
18875
|
db.exec(`
|
|
18621
18876
|
CREATE TABLE IF NOT EXISTS summary_jobs (
|
|
18622
18877
|
id TEXT PRIMARY KEY,
|
|
@@ -18636,7 +18891,7 @@ function up94(db) {
|
|
|
18636
18891
|
db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
|
|
18637
18892
|
ON summary_jobs(status)`);
|
|
18638
18893
|
}
|
|
18639
|
-
function
|
|
18894
|
+
function up106(db) {
|
|
18640
18895
|
db.exec(`
|
|
18641
18896
|
CREATE TABLE IF NOT EXISTS umap_cache (
|
|
18642
18897
|
id INTEGER PRIMARY KEY,
|
|
@@ -21271,11 +21526,248 @@ function up922(db) {
|
|
|
21271
21526
|
ON embeddings_staging(agent_id, source_type, source_id);
|
|
21272
21527
|
`);
|
|
21273
21528
|
}
|
|
21529
|
+
function up932(db) {
|
|
21530
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
21531
|
+
if (!columns.some((column) => column.name === "evidence_cursor")) {
|
|
21532
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
|
|
21533
|
+
}
|
|
21534
|
+
}
|
|
21535
|
+
var DERIVED_SOURCE_TYPES2 = DAEMON_DERIVED_MEMORY_SOURCE_TYPES2;
|
|
21536
|
+
function hasColumn132(db, table, column) {
|
|
21537
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
21538
|
+
return rows.some((r) => r.name === column);
|
|
21539
|
+
}
|
|
21540
|
+
function up942(db) {
|
|
21541
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
|
|
21542
|
+
if (tables.length === 0)
|
|
21543
|
+
return;
|
|
21544
|
+
if (!hasColumn132(db, "memories", "memory_kind")) {
|
|
21545
|
+
db.exec("ALTER TABLE memories ADD COLUMN memory_kind TEXT");
|
|
21546
|
+
}
|
|
21547
|
+
if (!hasColumn132(db, "memories", "evidence_meta")) {
|
|
21548
|
+
db.exec("ALTER TABLE memories ADD COLUMN evidence_meta TEXT");
|
|
21549
|
+
}
|
|
21550
|
+
if (hasColumn132(db, "memories", "source_type")) {
|
|
21551
|
+
const placeholders = DERIVED_SOURCE_TYPES2.map(() => "?").join(", ");
|
|
21552
|
+
db.prepare(`UPDATE memories
|
|
21553
|
+
SET memory_kind = 'episodic'
|
|
21554
|
+
WHERE memory_kind IS NULL
|
|
21555
|
+
AND (source_type IS NULL OR source_type NOT IN (${placeholders}))`).run(...DERIVED_SOURCE_TYPES2);
|
|
21556
|
+
} else {
|
|
21557
|
+
db.exec(`UPDATE memories
|
|
21558
|
+
SET memory_kind = 'episodic'
|
|
21559
|
+
WHERE memory_kind IS NULL`);
|
|
21560
|
+
}
|
|
21561
|
+
}
|
|
21562
|
+
function hasColumn142(db, table, column) {
|
|
21563
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
21564
|
+
}
|
|
21565
|
+
function up952(db) {
|
|
21566
|
+
const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
|
|
21567
|
+
if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
|
|
21568
|
+
return;
|
|
21569
|
+
db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
|
|
21570
|
+
}
|
|
21571
|
+
function up962(db) {
|
|
21572
|
+
db.exec("DROP TABLE IF EXISTS ingestion_jobs");
|
|
21573
|
+
}
|
|
21574
|
+
function up972(db) {
|
|
21575
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
|
|
21576
|
+
if (!columns.some((column) => column.name === "last_failure_at")) {
|
|
21577
|
+
db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
|
|
21578
|
+
}
|
|
21579
|
+
db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
|
|
21580
|
+
}
|
|
21581
|
+
function up982(db) {
|
|
21582
|
+
db.exec(`
|
|
21583
|
+
CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
|
|
21584
|
+
agent_id TEXT NOT NULL,
|
|
21585
|
+
source_kind TEXT NOT NULL CHECK (source_kind IN ('memory', 'artifact', 'transcript', 'summary')),
|
|
21586
|
+
source_id TEXT NOT NULL,
|
|
21587
|
+
reason TEXT NOT NULL,
|
|
21588
|
+
pass_id TEXT NOT NULL,
|
|
21589
|
+
excluded_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
21590
|
+
requeue_requested_at TEXT,
|
|
21591
|
+
resolved_at TEXT,
|
|
21592
|
+
PRIMARY KEY (agent_id, source_kind, source_id)
|
|
21593
|
+
);
|
|
21594
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_evidence_exclusions_active
|
|
21595
|
+
ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
|
|
21596
|
+
`);
|
|
21597
|
+
}
|
|
21598
|
+
function up992(db) {
|
|
21599
|
+
db.exec(`
|
|
21600
|
+
CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
|
|
21601
|
+
id TEXT PRIMARY KEY,
|
|
21602
|
+
agent_id TEXT NOT NULL,
|
|
21603
|
+
pass_id TEXT NOT NULL,
|
|
21604
|
+
sequence INTEGER NOT NULL,
|
|
21605
|
+
tool_call_id TEXT,
|
|
21606
|
+
tool_name TEXT NOT NULL,
|
|
21607
|
+
input_json TEXT NOT NULL,
|
|
21608
|
+
output_json TEXT NOT NULL,
|
|
21609
|
+
success INTEGER NOT NULL,
|
|
21610
|
+
latency_ms INTEGER NOT NULL,
|
|
21611
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
21612
|
+
UNIQUE(agent_id, pass_id, sequence)
|
|
21613
|
+
);
|
|
21614
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_tool_calls_pass
|
|
21615
|
+
ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
|
|
21616
|
+
`);
|
|
21617
|
+
}
|
|
21618
|
+
function up1002(db) {
|
|
21619
|
+
const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
|
|
21620
|
+
if (!columns.some((column) => column.name === "evidence_window_json")) {
|
|
21621
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
|
|
21622
|
+
}
|
|
21623
|
+
if (!columns.some((column) => column.name === "runbook_json")) {
|
|
21624
|
+
db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
|
|
21625
|
+
}
|
|
21626
|
+
}
|
|
21627
|
+
function up1012(db) {
|
|
21628
|
+
db.exec(`
|
|
21629
|
+
CREATE TABLE IF NOT EXISTS dreaming_attention (
|
|
21630
|
+
id TEXT PRIMARY KEY,
|
|
21631
|
+
agent_id TEXT NOT NULL,
|
|
21632
|
+
kind TEXT NOT NULL CHECK (kind IN ('review_due', 'hygiene', 'contested_claim', 'evidence_requeue')),
|
|
21633
|
+
subject_ref TEXT NOT NULL,
|
|
21634
|
+
details_json TEXT NOT NULL DEFAULT '{}',
|
|
21635
|
+
priority INTEGER NOT NULL DEFAULT 0 CHECK (priority >= 0 AND priority <= 100),
|
|
21636
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
21637
|
+
generation INTEGER NOT NULL DEFAULT 0,
|
|
21638
|
+
resolved_at TEXT,
|
|
21639
|
+
resolved_by_pass_id TEXT,
|
|
21640
|
+
UNIQUE(agent_id, kind, subject_ref)
|
|
21641
|
+
);
|
|
21642
|
+
CREATE INDEX IF NOT EXISTS idx_dreaming_attention_pending
|
|
21643
|
+
ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
|
|
21644
|
+
`);
|
|
21645
|
+
}
|
|
21646
|
+
function hasColumn152(db, table, column) {
|
|
21647
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
21648
|
+
}
|
|
21649
|
+
function up1022(db) {
|
|
21650
|
+
const requiredMemoryColumns = [
|
|
21651
|
+
"content_hash",
|
|
21652
|
+
"normalized_content",
|
|
21653
|
+
"memory_kind",
|
|
21654
|
+
"source_type",
|
|
21655
|
+
"source_path",
|
|
21656
|
+
"agent_id",
|
|
21657
|
+
"visibility",
|
|
21658
|
+
"is_deleted",
|
|
21659
|
+
"extraction_status"
|
|
21660
|
+
];
|
|
21661
|
+
if (!hasColumn152(db, "entity_attributes", "memory_id") || !requiredMemoryColumns.every((column) => hasColumn152(db, "memories", column))) {
|
|
21662
|
+
return;
|
|
21663
|
+
}
|
|
21664
|
+
db.exec(`
|
|
21665
|
+
INSERT OR IGNORE INTO memories
|
|
21666
|
+
(id, content, normalized_content, content_hash, who, why, project,
|
|
21667
|
+
importance, type, tags, pinned, is_deleted, extraction_status,
|
|
21668
|
+
created_at, updated_at, updated_by, source_type, source_id, source_path,
|
|
21669
|
+
agent_id, visibility, memory_kind)
|
|
21670
|
+
SELECT attr.id, attr.content, attr.normalized_content,
|
|
21671
|
+
'semantic-attribute:' || attr.id, 'dreaming', 'Derived semantic attribute', NULL,
|
|
21672
|
+
attr.importance, 'semantic', 'semantic,attribute', 0,
|
|
21673
|
+
CASE WHEN attr.status = 'active' THEN 0 ELSE 1 END, 'completed',
|
|
21674
|
+
attr.created_at, attr.updated_at, 'dreaming', 'dreaming', attr.source_id, attr.source_path,
|
|
21675
|
+
attr.agent_id, 'global', 'derived'
|
|
21676
|
+
FROM entity_attributes attr
|
|
21677
|
+
WHERE attr.memory_id IS NULL
|
|
21678
|
+
`);
|
|
21679
|
+
db.exec(`
|
|
21680
|
+
UPDATE entity_attributes
|
|
21681
|
+
SET memory_id = id
|
|
21682
|
+
WHERE memory_id IS NULL
|
|
21683
|
+
AND EXISTS (SELECT 1 FROM memories WHERE memories.id = entity_attributes.id)
|
|
21684
|
+
`);
|
|
21685
|
+
db.exec(`
|
|
21686
|
+
INSERT OR IGNORE INTO memory_entity_mentions (memory_id, entity_id)
|
|
21687
|
+
SELECT attr.memory_id, aspect.entity_id
|
|
21688
|
+
FROM entity_attributes attr
|
|
21689
|
+
JOIN entity_aspects aspect ON aspect.id = attr.aspect_id AND aspect.agent_id = attr.agent_id
|
|
21690
|
+
WHERE attr.memory_id IS NOT NULL
|
|
21691
|
+
`);
|
|
21692
|
+
db.exec(`
|
|
21693
|
+
UPDATE entities
|
|
21694
|
+
SET mentions = (
|
|
21695
|
+
SELECT COUNT(*) FROM memory_entity_mentions WHERE entity_id = entities.id
|
|
21696
|
+
)
|
|
21697
|
+
WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
|
|
21698
|
+
`);
|
|
21699
|
+
}
|
|
21700
|
+
function up1032(db) {
|
|
21701
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
|
|
21702
|
+
if (tables.length !== 2)
|
|
21703
|
+
return;
|
|
21704
|
+
const memoryColumns = db.prepare("PRAGMA table_info(memories)").all().map((row) => row.name);
|
|
21705
|
+
const attributeColumns = db.prepare("PRAGMA table_info(entity_attributes)").all().map((row) => row.name);
|
|
21706
|
+
if (!memoryColumns.includes("memory_kind") || !attributeColumns.includes("memory_id"))
|
|
21707
|
+
return;
|
|
21708
|
+
db.exec(`
|
|
21709
|
+
UPDATE memories
|
|
21710
|
+
SET memory_kind = 'derived'
|
|
21711
|
+
WHERE memory_kind IS NULL
|
|
21712
|
+
AND id IN (
|
|
21713
|
+
SELECT memory_id FROM entity_attributes WHERE memory_id IS NOT NULL
|
|
21714
|
+
)
|
|
21715
|
+
`);
|
|
21716
|
+
}
|
|
21717
|
+
function tableExists2(db, table) {
|
|
21718
|
+
return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
|
|
21719
|
+
}
|
|
21720
|
+
function hasColumn162(db, table, column) {
|
|
21721
|
+
return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
|
|
21722
|
+
}
|
|
21723
|
+
function up1042(db) {
|
|
21724
|
+
db.exec(`
|
|
21725
|
+
CREATE TABLE IF NOT EXISTS derived_memory_sources (
|
|
21726
|
+
derived_memory_id TEXT NOT NULL,
|
|
21727
|
+
source_kind TEXT NOT NULL,
|
|
21728
|
+
source_id TEXT NOT NULL,
|
|
21729
|
+
source_path TEXT,
|
|
21730
|
+
agent_id TEXT NOT NULL,
|
|
21731
|
+
created_at TEXT NOT NULL,
|
|
21732
|
+
PRIMARY KEY (derived_memory_id, source_kind, source_id)
|
|
21733
|
+
);
|
|
21734
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_derived
|
|
21735
|
+
ON derived_memory_sources(agent_id, derived_memory_id);
|
|
21736
|
+
CREATE INDEX IF NOT EXISTS idx_derived_memory_sources_source
|
|
21737
|
+
ON derived_memory_sources(agent_id, source_kind, source_id);
|
|
21738
|
+
`);
|
|
21739
|
+
if (tableExists2(db, "aggregate_evidence_sources")) {
|
|
21740
|
+
db.exec(`
|
|
21741
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
21742
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
21743
|
+
SELECT aggregate_memory_id, source_kind, source_id, source_path, agent_id, created_at
|
|
21744
|
+
FROM aggregate_evidence_sources
|
|
21745
|
+
`);
|
|
21746
|
+
}
|
|
21747
|
+
if (tableExists2(db, "aggregate_memory_sources")) {
|
|
21748
|
+
db.exec(`
|
|
21749
|
+
INSERT OR IGNORE INTO derived_memory_sources
|
|
21750
|
+
(derived_memory_id, source_kind, source_id, source_path, agent_id, created_at)
|
|
21751
|
+
SELECT aggregate_memory_id, 'memory', source_memory_id, NULL, agent_id, created_at
|
|
21752
|
+
FROM aggregate_memory_sources
|
|
21753
|
+
`);
|
|
21754
|
+
}
|
|
21755
|
+
if (tableExists2(db, "memories") && !hasColumn162(db, "memories", "stale_at")) {
|
|
21756
|
+
db.exec("ALTER TABLE memories ADD COLUMN stale_at TEXT");
|
|
21757
|
+
}
|
|
21758
|
+
if (tableExists2(db, "memories")) {
|
|
21759
|
+
db.exec(`
|
|
21760
|
+
CREATE INDEX IF NOT EXISTS idx_memories_stale_derived
|
|
21761
|
+
ON memories(agent_id, stale_at)
|
|
21762
|
+
WHERE stale_at IS NOT NULL AND is_deleted = 0
|
|
21763
|
+
`);
|
|
21764
|
+
}
|
|
21765
|
+
}
|
|
21274
21766
|
var MIGRATIONS2 = [
|
|
21275
21767
|
{
|
|
21276
21768
|
version: 1,
|
|
21277
21769
|
name: "baseline",
|
|
21278
|
-
up:
|
|
21770
|
+
up: up105,
|
|
21279
21771
|
artifacts: { tables: ["memories", "conversations", "embeddings"] }
|
|
21280
21772
|
},
|
|
21281
21773
|
{
|
|
@@ -21329,13 +21821,13 @@ var MIGRATIONS2 = [
|
|
|
21329
21821
|
{
|
|
21330
21822
|
version: 9,
|
|
21331
21823
|
name: "summary-jobs",
|
|
21332
|
-
up:
|
|
21824
|
+
up: up910,
|
|
21333
21825
|
artifacts: { tables: ["summary_jobs"] }
|
|
21334
21826
|
},
|
|
21335
21827
|
{
|
|
21336
21828
|
version: 10,
|
|
21337
21829
|
name: "umap-cache",
|
|
21338
|
-
up:
|
|
21830
|
+
up: up106,
|
|
21339
21831
|
artifacts: { tables: ["umap_cache"] }
|
|
21340
21832
|
},
|
|
21341
21833
|
{
|
|
@@ -21355,7 +21847,6 @@ var MIGRATIONS2 = [
|
|
|
21355
21847
|
name: "ingestion-tracking",
|
|
21356
21848
|
up: up132,
|
|
21357
21849
|
artifacts: {
|
|
21358
|
-
tables: ["ingestion_jobs"],
|
|
21359
21850
|
columns: [
|
|
21360
21851
|
{ table: "memories", column: "source_path" },
|
|
21361
21852
|
{ table: "memories", column: "source_section" }
|
|
@@ -22018,6 +22509,87 @@ var MIGRATIONS2 = [
|
|
|
22018
22509
|
name: "embedding-staging-store",
|
|
22019
22510
|
up: up922,
|
|
22020
22511
|
artifacts: { tables: ["embeddings_staging"] }
|
|
22512
|
+
},
|
|
22513
|
+
{
|
|
22514
|
+
version: 93,
|
|
22515
|
+
name: "dreaming-evidence-cursor",
|
|
22516
|
+
up: up932,
|
|
22517
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
|
|
22518
|
+
},
|
|
22519
|
+
{
|
|
22520
|
+
version: 94,
|
|
22521
|
+
name: "memory-kind",
|
|
22522
|
+
up: up942,
|
|
22523
|
+
artifacts: {
|
|
22524
|
+
columns: [
|
|
22525
|
+
{ table: "memories", column: "memory_kind" },
|
|
22526
|
+
{ table: "memories", column: "evidence_meta" }
|
|
22527
|
+
]
|
|
22528
|
+
}
|
|
22529
|
+
},
|
|
22530
|
+
{
|
|
22531
|
+
version: 95,
|
|
22532
|
+
name: "compaction-recall-projections",
|
|
22533
|
+
up: up952
|
|
22534
|
+
},
|
|
22535
|
+
{
|
|
22536
|
+
version: 96,
|
|
22537
|
+
name: "retire-legacy-ingestion",
|
|
22538
|
+
up: up962
|
|
22539
|
+
},
|
|
22540
|
+
{
|
|
22541
|
+
version: 97,
|
|
22542
|
+
name: "dreaming-failure-backoff",
|
|
22543
|
+
up: up972,
|
|
22544
|
+
artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
|
|
22545
|
+
},
|
|
22546
|
+
{
|
|
22547
|
+
version: 98,
|
|
22548
|
+
name: "dreaming-evidence-exclusions",
|
|
22549
|
+
up: up982,
|
|
22550
|
+
artifacts: { tables: ["dreaming_evidence_exclusions"] }
|
|
22551
|
+
},
|
|
22552
|
+
{
|
|
22553
|
+
version: 99,
|
|
22554
|
+
name: "dreaming-tool-calls",
|
|
22555
|
+
up: up992,
|
|
22556
|
+
artifacts: { tables: ["dreaming_tool_calls"] }
|
|
22557
|
+
},
|
|
22558
|
+
{
|
|
22559
|
+
version: 100,
|
|
22560
|
+
name: "dreaming-runbook",
|
|
22561
|
+
up: up1002,
|
|
22562
|
+
artifacts: {
|
|
22563
|
+
columns: [
|
|
22564
|
+
{ table: "dreaming_passes", column: "evidence_window_json" },
|
|
22565
|
+
{ table: "dreaming_passes", column: "runbook_json" }
|
|
22566
|
+
]
|
|
22567
|
+
}
|
|
22568
|
+
},
|
|
22569
|
+
{
|
|
22570
|
+
version: 101,
|
|
22571
|
+
name: "dreaming-attention",
|
|
22572
|
+
up: up1012,
|
|
22573
|
+
artifacts: { tables: ["dreaming_attention"] }
|
|
22574
|
+
},
|
|
22575
|
+
{
|
|
22576
|
+
version: 102,
|
|
22577
|
+
name: "attribute-semantic-memories",
|
|
22578
|
+
up: up1022
|
|
22579
|
+
},
|
|
22580
|
+
{
|
|
22581
|
+
version: 103,
|
|
22582
|
+
name: "semantic-memory-kind",
|
|
22583
|
+
up: up1032
|
|
22584
|
+
},
|
|
22585
|
+
{
|
|
22586
|
+
version: 104,
|
|
22587
|
+
name: "derived-memory-provenance",
|
|
22588
|
+
up: up1042,
|
|
22589
|
+
artifacts: {
|
|
22590
|
+
tables: ["derived_memory_sources"],
|
|
22591
|
+
columns: [{ table: "memories", column: "stale_at" }]
|
|
22592
|
+
}
|
|
22021
22593
|
}
|
|
22022
22594
|
];
|
|
22023
22595
|
var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;
|
|
@@ -22223,122 +22795,6 @@ function loadIdentityMode(agentsDir) {
|
|
|
22223
22795
|
}
|
|
22224
22796
|
}
|
|
22225
22797
|
var home2 = homedir82();
|
|
22226
|
-
var SKIP_SUBTYPES2 = new Set([
|
|
22227
|
-
"channel_join",
|
|
22228
|
-
"channel_leave",
|
|
22229
|
-
"channel_topic",
|
|
22230
|
-
"channel_purpose",
|
|
22231
|
-
"channel_name",
|
|
22232
|
-
"channel_archive",
|
|
22233
|
-
"channel_unarchive",
|
|
22234
|
-
"group_join",
|
|
22235
|
-
"group_leave",
|
|
22236
|
-
"group_topic",
|
|
22237
|
-
"group_purpose",
|
|
22238
|
-
"group_name",
|
|
22239
|
-
"group_archive",
|
|
22240
|
-
"group_unarchive",
|
|
22241
|
-
"pinned_item",
|
|
22242
|
-
"unpinned_item",
|
|
22243
|
-
"bot_add",
|
|
22244
|
-
"bot_remove",
|
|
22245
|
-
"tombstone",
|
|
22246
|
-
"file_comment",
|
|
22247
|
-
"sh_room_created",
|
|
22248
|
-
"sh_room_shared"
|
|
22249
|
-
]);
|
|
22250
|
-
var SKIP_TYPES2 = new Set([
|
|
22251
|
-
"RecipientAdd",
|
|
22252
|
-
"RecipientRemove",
|
|
22253
|
-
"ChannelNameChange",
|
|
22254
|
-
"ChannelIconChange",
|
|
22255
|
-
"ChannelPinnedMessage",
|
|
22256
|
-
"GuildMemberJoin",
|
|
22257
|
-
"UserPremiumGuildSubscription",
|
|
22258
|
-
"UserPremiumGuildSubscriptionTier1",
|
|
22259
|
-
"UserPremiumGuildSubscriptionTier2",
|
|
22260
|
-
"UserPremiumGuildSubscriptionTier3",
|
|
22261
|
-
"ChannelFollowAdd",
|
|
22262
|
-
"GuildDiscoveryDisqualified",
|
|
22263
|
-
"GuildDiscoveryRequalified",
|
|
22264
|
-
"GuildDiscoveryGracePeriodInitialWarning",
|
|
22265
|
-
"GuildDiscoveryGracePeriodFinalWarning",
|
|
22266
|
-
"ThreadCreated",
|
|
22267
|
-
"ApplicationCommand"
|
|
22268
|
-
]);
|
|
22269
|
-
var SKIP_DIRS2 = new Set([
|
|
22270
|
-
"node_modules",
|
|
22271
|
-
".git",
|
|
22272
|
-
"dist",
|
|
22273
|
-
"build",
|
|
22274
|
-
"out",
|
|
22275
|
-
"target",
|
|
22276
|
-
".next",
|
|
22277
|
-
".nuxt",
|
|
22278
|
-
"__pycache__",
|
|
22279
|
-
".tox",
|
|
22280
|
-
".mypy_cache",
|
|
22281
|
-
".pytest_cache",
|
|
22282
|
-
"venv",
|
|
22283
|
-
".venv",
|
|
22284
|
-
"env",
|
|
22285
|
-
"vendor",
|
|
22286
|
-
"coverage",
|
|
22287
|
-
".cache",
|
|
22288
|
-
".turbo"
|
|
22289
|
-
]);
|
|
22290
|
-
var DOCUMENT_VALID_TYPES2 = new Set([
|
|
22291
|
-
"fact",
|
|
22292
|
-
"decision",
|
|
22293
|
-
"rationale",
|
|
22294
|
-
"preference",
|
|
22295
|
-
"procedural",
|
|
22296
|
-
"semantic",
|
|
22297
|
-
"system",
|
|
22298
|
-
"configuration",
|
|
22299
|
-
"architectural",
|
|
22300
|
-
"relationship",
|
|
22301
|
-
"episodic",
|
|
22302
|
-
"daily-log"
|
|
22303
|
-
]);
|
|
22304
|
-
var ENTIRE_VALID_TYPES2 = new Set(["skill", "preference", "decision", "rationale", "procedural", "semantic", "fact"]);
|
|
22305
|
-
var CHAT_VALID_TYPES2 = new Set(["fact", "decision", "rationale", "preference", "procedural", "semantic", "system"]);
|
|
22306
|
-
var MARKDOWN_EXTS2 = new Set([".md", ".mdx", ".markdown"]);
|
|
22307
|
-
var TXT_EXTS2 = new Set([".txt", ".text", ".log", ".rst"]);
|
|
22308
|
-
var PDF_EXTS2 = new Set([".pdf"]);
|
|
22309
|
-
var CODE_EXTS2 = new Set([
|
|
22310
|
-
".ts",
|
|
22311
|
-
".tsx",
|
|
22312
|
-
".js",
|
|
22313
|
-
".jsx",
|
|
22314
|
-
".py",
|
|
22315
|
-
".rs",
|
|
22316
|
-
".go",
|
|
22317
|
-
".java",
|
|
22318
|
-
".rb",
|
|
22319
|
-
".php",
|
|
22320
|
-
".swift",
|
|
22321
|
-
".kt",
|
|
22322
|
-
".scala",
|
|
22323
|
-
".c",
|
|
22324
|
-
".cpp",
|
|
22325
|
-
".h",
|
|
22326
|
-
".hpp",
|
|
22327
|
-
".sh",
|
|
22328
|
-
".bash",
|
|
22329
|
-
".zsh",
|
|
22330
|
-
".sql",
|
|
22331
|
-
".yaml",
|
|
22332
|
-
".yml",
|
|
22333
|
-
".toml",
|
|
22334
|
-
".json",
|
|
22335
|
-
".xml",
|
|
22336
|
-
".css",
|
|
22337
|
-
".scss",
|
|
22338
|
-
".html",
|
|
22339
|
-
".htm"
|
|
22340
|
-
]);
|
|
22341
|
-
var SKIP_FILES2 = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules", ".git", ".env", ".env.local"]);
|
|
22342
22798
|
|
|
22343
22799
|
// src/index.ts
|
|
22344
22800
|
function isJsonObject(value) {
|