engine7 7.1.121 → 7.1.122
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/cli.mjs +174 -138
- package/dist/engine-startup.mjs +330 -148
- package/dist/main.mjs +330 -148
- package/dist/mem7-worker.mjs +15 -2
- package/package.json +1 -1
- package/templates/config.template.json +1 -1
package/dist/mem7-worker.mjs
CHANGED
|
@@ -764,7 +764,7 @@ var init_read_budget = __esm({
|
|
|
764
764
|
check(depth = 0) {
|
|
765
765
|
if (this.failure) throw this.failure;
|
|
766
766
|
const elapsed = this.elapsedMs + (this.started === void 0 ? 0 : this.now() - this.started);
|
|
767
|
-
const reason = depth > (this.limits.maxDepth ?? 256) ? "depth" : ++this.steps > (this.limits.maxSteps ??
|
|
767
|
+
const reason = depth > (this.limits.maxDepth ?? 256) ? "depth" : ++this.steps > (this.limits.maxSteps ?? 25e4) ? "work" : elapsed >= (this.limits.maxMs ?? 4e3) ? "time" : void 0;
|
|
768
768
|
if (reason) {
|
|
769
769
|
this.failure = new MemoryReadBudgetExceededError(reason);
|
|
770
770
|
throw this.failure;
|
|
@@ -2984,6 +2984,11 @@ CREATE TABLE memory_state_outbox (
|
|
|
2984
2984
|
payload_json TEXT NOT NULL, created_at TEXT NOT NULL,
|
|
2985
2985
|
PRIMARY KEY(scope_id,event_seq), FOREIGN KEY(scope_id) REFERENCES memory_scopes(scope_id)
|
|
2986
2986
|
);
|
|
2987
|
+
-- 1013\uFF1A\u6309 (scope_id,kind) \u53D6 MAX(aggregate_version) \u7684\u805A\u5408\u7248\u672C\u67E5\u8BE2\uFF0C\u9760 PK \u53EA\u80FD\u547D\u4E2D scope_id\uFF0C
|
|
2988
|
+
-- \u4E4B\u540E\u8981\u626B\u8BE5 scope \u4E0B\u5168\u90E8 outbox \u884C\u7B97 MAX\u3002\u8BE5\u67E5\u8BE2\u5728\u5355\u6B21 buildMemoryContext \u91CC\u88AB\u8C03\u7528\u6570\u767E\u6B21
|
|
2989
|
+
-- \uFF08\u59B9\u59B9 2015 \u884C\u5E93 \u2248 140 \u4E07\u884C\u8BBF\u95EE\uFF09\uFF0C\u5B9E\u6D4B\u628A\u5F53\u524D\u4E0A\u4E0B\u6587\u88C5\u914D\u4ECE 719ms \u63A8\u5230 2617ms\uFF0C\u76F4\u63A5\u51FB\u7A7F
|
|
2990
|
+
-- turnReadBudgetMs \u9ED8\u8BA4 1500ms \u2192 \u5168\u8F6E\u964D\u7EA7 \u2192 \u5360\u4F4D\u7B26\u4E8B\u6545\u3002\u8986\u76D6\u7D22\u5F15\u8BA9 MAX \u9000\u5316\u6210\u7D22\u5F15\u672B\u9879\u5B9A\u4F4D\u3002
|
|
2991
|
+
CREATE INDEX IF NOT EXISTS idx_outbox_scope_kind_version ON memory_state_outbox(scope_id,kind,aggregate_version);
|
|
2987
2992
|
`;
|
|
2988
2993
|
}
|
|
2989
2994
|
});
|
|
@@ -8226,6 +8231,14 @@ function migrateMem7(db, initializeLegacySchema) {
|
|
|
8226
8231
|
version: 29,
|
|
8227
8232
|
name: "idempotent-source-backed-chat-people-updates",
|
|
8228
8233
|
apply: (database) => database.exec(SOCIAL_WRITE_SCHEMA)
|
|
8234
|
+
}, {
|
|
8235
|
+
version: 30,
|
|
8236
|
+
name: "indexed-outbox-aggregate-revisions",
|
|
8237
|
+
// 存量库补索引:聚合版本查询此前要扫该 scope 下全部 outbox 行算 MAX,
|
|
8238
|
+
// 实测妹妹 182MB 库 buildMemoryContext 2617ms → 719ms(读预算默认 1500ms 本来必破)。
|
|
8239
|
+
apply: (database) => database.exec(
|
|
8240
|
+
"CREATE INDEX IF NOT EXISTS idx_outbox_scope_kind_version ON memory_state_outbox(scope_id,kind,aggregate_version)"
|
|
8241
|
+
)
|
|
8229
8242
|
}]);
|
|
8230
8243
|
} finally {
|
|
8231
8244
|
if (foreignKeys) db.exec("PRAGMA foreign_keys=ON");
|
|
@@ -8251,7 +8264,7 @@ var init_migrations = __esm({
|
|
|
8251
8264
|
init_relationship_cognition();
|
|
8252
8265
|
init_relationship_notices();
|
|
8253
8266
|
init_relationship_history();
|
|
8254
|
-
MEM7_SCHEMA_VERSION =
|
|
8267
|
+
MEM7_SCHEMA_VERSION = 30;
|
|
8255
8268
|
}
|
|
8256
8269
|
});
|
|
8257
8270
|
|
package/package.json
CHANGED