memorix 1.9.2 → 1.9.4
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/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/cli/index.js +358 -146
- package/dist/index.js +281 -125
- package/dist/maintenance-runner.js +219 -97
- package/dist/media-audio-runner.js +219 -97
- package/dist/media-video-runner.js +219 -97
- package/dist/memcode-runtime/CHANGELOG.md +27 -0
- package/dist/sdk.js +280 -124
- package/dist/vector-backfill-runner.js +219 -97
- package/docs/AGENT_OPERATOR_PLAYBOOK.md +15 -0
- package/docs/ARCHITECTURE.md +23 -0
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/PERFORMANCE.md +50 -0
- package/docs/README.md +1 -1
- package/package.json +1 -1
- package/plugins/antigravity/memorix/plugin.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/hermes/memorix/plugin.yaml +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/doctor.ts +78 -17
- package/src/cli/commands/media.ts +2 -0
- package/src/media/minimax.ts +26 -2
- package/src/media/video-jobs.ts +9 -1
- package/src/server.ts +3 -1
- package/src/store/mini-skill-store.ts +31 -22
- package/src/store/obs-store.ts +46 -30
- package/src/store/session-store.ts +35 -21
- package/src/store/sqlite-db.ts +16 -7
- package/src/store/sqlite-reliability.ts +87 -0
- package/src/store/sqlite-store.ts +4 -1
package/dist/cli/index.js
CHANGED
|
@@ -3232,7 +3232,7 @@ ${import_picocolors.default.gray(m3)} ${s4}
|
|
|
3232
3232
|
|
|
3233
3233
|
// src/cli/version.ts
|
|
3234
3234
|
function getCliVersion() {
|
|
3235
|
-
return true ? "1.9.
|
|
3235
|
+
return true ? "1.9.4" : pkg.version;
|
|
3236
3236
|
}
|
|
3237
3237
|
var init_version = __esm({
|
|
3238
3238
|
"src/cli/version.ts"() {
|
|
@@ -9515,70 +9515,79 @@ function getDatabase(dataDir) {
|
|
|
9515
9515
|
loadBetterSqlite3();
|
|
9516
9516
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
9517
9517
|
const dbPath = path3.join(dataDir, "memorix.db");
|
|
9518
|
-
|
|
9519
|
-
db2.pragma("journal_mode = WAL");
|
|
9520
|
-
db2.pragma("busy_timeout = 5000");
|
|
9521
|
-
db2.pragma("foreign_keys = ON");
|
|
9522
|
-
db2.exec(CREATE_OBSERVATIONS_TABLE);
|
|
9523
|
-
db2.exec(CREATE_MINI_SKILLS_TABLE);
|
|
9524
|
-
db2.exec(CREATE_SESSIONS_TABLE);
|
|
9525
|
-
db2.exec(CREATE_META_TABLE);
|
|
9526
|
-
db2.exec(CREATE_TEAM_AGENTS_TABLE);
|
|
9527
|
-
db2.exec(CREATE_TEAM_TASKS_TABLE);
|
|
9528
|
-
db2.exec(CREATE_TEAM_TASK_DEPS_TABLE);
|
|
9529
|
-
db2.exec(CREATE_TEAM_MESSAGES_TABLE);
|
|
9530
|
-
db2.exec(CREATE_TEAM_LOCKS_TABLE);
|
|
9531
|
-
db2.exec(CREATE_TEAM_ROLES_TABLE);
|
|
9532
|
-
db2.exec(CREATE_GRAPH_ENTITIES_TABLE);
|
|
9533
|
-
db2.exec(CREATE_GRAPH_RELATIONS_TABLE);
|
|
9534
|
-
db2.exec(CREATE_CHAT_TRANSCRIPT_TABLE);
|
|
9535
|
-
db2.exec(CREATE_CODE_FILES_TABLE);
|
|
9536
|
-
db2.exec(CREATE_CODE_SYMBOLS_TABLE);
|
|
9537
|
-
db2.exec(CREATE_CODE_EDGES_TABLE);
|
|
9538
|
-
db2.exec(CREATE_OBSERVATION_CODE_REFS_TABLE);
|
|
9539
|
-
db2.exec(CREATE_MAINTENANCE_JOBS_TABLE);
|
|
9540
|
-
db2.exec(CREATE_MAINTENANCE_TARGETS_TABLE);
|
|
9541
|
-
db2.exec(CREATE_COMPACTION_CHECKPOINTS_TABLE);
|
|
9518
|
+
let db2;
|
|
9542
9519
|
try {
|
|
9543
|
-
db2
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
db2.exec(
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
db2.exec(
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
db2.exec(
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
db2.exec(
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
db2.exec(
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9520
|
+
db2 = createDatabase(dbPath);
|
|
9521
|
+
db2.pragma("busy_timeout = 5000");
|
|
9522
|
+
db2.pragma("journal_mode = WAL");
|
|
9523
|
+
db2.pragma("foreign_keys = ON");
|
|
9524
|
+
db2.exec(CREATE_OBSERVATIONS_TABLE);
|
|
9525
|
+
db2.exec(CREATE_MINI_SKILLS_TABLE);
|
|
9526
|
+
db2.exec(CREATE_SESSIONS_TABLE);
|
|
9527
|
+
db2.exec(CREATE_META_TABLE);
|
|
9528
|
+
db2.exec(CREATE_TEAM_AGENTS_TABLE);
|
|
9529
|
+
db2.exec(CREATE_TEAM_TASKS_TABLE);
|
|
9530
|
+
db2.exec(CREATE_TEAM_TASK_DEPS_TABLE);
|
|
9531
|
+
db2.exec(CREATE_TEAM_MESSAGES_TABLE);
|
|
9532
|
+
db2.exec(CREATE_TEAM_LOCKS_TABLE);
|
|
9533
|
+
db2.exec(CREATE_TEAM_ROLES_TABLE);
|
|
9534
|
+
db2.exec(CREATE_GRAPH_ENTITIES_TABLE);
|
|
9535
|
+
db2.exec(CREATE_GRAPH_RELATIONS_TABLE);
|
|
9536
|
+
db2.exec(CREATE_CHAT_TRANSCRIPT_TABLE);
|
|
9537
|
+
db2.exec(CREATE_CODE_FILES_TABLE);
|
|
9538
|
+
db2.exec(CREATE_CODE_SYMBOLS_TABLE);
|
|
9539
|
+
db2.exec(CREATE_CODE_EDGES_TABLE);
|
|
9540
|
+
db2.exec(CREATE_OBSERVATION_CODE_REFS_TABLE);
|
|
9541
|
+
db2.exec(CREATE_MAINTENANCE_JOBS_TABLE);
|
|
9542
|
+
db2.exec(CREATE_MAINTENANCE_TARGETS_TABLE);
|
|
9543
|
+
db2.exec(CREATE_COMPACTION_CHECKPOINTS_TABLE);
|
|
9544
|
+
try {
|
|
9545
|
+
db2.exec(`ALTER TABLE mini_skills ADD COLUMN sourceSnapshot TEXT NOT NULL DEFAULT ''`);
|
|
9546
|
+
} catch {
|
|
9547
|
+
}
|
|
9548
|
+
try {
|
|
9549
|
+
db2.exec(`ALTER TABLE mini_skills ADD COLUMN updatedAt TEXT`);
|
|
9550
|
+
} catch {
|
|
9551
|
+
}
|
|
9552
|
+
try {
|
|
9553
|
+
db2.exec(`ALTER TABLE observations ADD COLUMN createdByAgentId TEXT`);
|
|
9554
|
+
} catch {
|
|
9555
|
+
}
|
|
9556
|
+
try {
|
|
9557
|
+
db2.exec(`ALTER TABLE observations ADD COLUMN writeGeneration INTEGER DEFAULT 0`);
|
|
9558
|
+
} catch {
|
|
9559
|
+
}
|
|
9560
|
+
try {
|
|
9561
|
+
db2.exec(`ALTER TABLE team_tasks ADD COLUMN required_role TEXT`);
|
|
9562
|
+
} catch {
|
|
9563
|
+
}
|
|
9564
|
+
try {
|
|
9565
|
+
db2.exec(`ALTER TABLE team_tasks ADD COLUMN preferred_role TEXT`);
|
|
9566
|
+
} catch {
|
|
9567
|
+
}
|
|
9568
|
+
try {
|
|
9569
|
+
db2.exec(`ALTER TABLE team_messages ADD COLUMN to_role TEXT`);
|
|
9570
|
+
} catch {
|
|
9571
|
+
}
|
|
9572
|
+
try {
|
|
9573
|
+
db2.exec(`ALTER TABLE team_messages ADD COLUMN handoff_status TEXT`);
|
|
9574
|
+
} catch {
|
|
9575
|
+
}
|
|
9576
|
+
applySchemaMigrations(db2);
|
|
9577
|
+
db2.exec(CREATE_INDEXES);
|
|
9578
|
+
initializeObservationLexicalIndex(db2);
|
|
9579
|
+
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('storage_generation', '0')`).run();
|
|
9580
|
+
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('next_id', '1')`).run();
|
|
9581
|
+
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('mini_skills_generation', '0')`).run();
|
|
9582
|
+
_dbCache.set(normalized, db2);
|
|
9583
|
+
return db2;
|
|
9584
|
+
} catch (error40) {
|
|
9585
|
+
try {
|
|
9586
|
+
db2?.close();
|
|
9587
|
+
} catch {
|
|
9588
|
+
}
|
|
9589
|
+
throw error40;
|
|
9573
9590
|
}
|
|
9574
|
-
applySchemaMigrations(db2);
|
|
9575
|
-
db2.exec(CREATE_INDEXES);
|
|
9576
|
-
initializeObservationLexicalIndex(db2);
|
|
9577
|
-
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('storage_generation', '0')`).run();
|
|
9578
|
-
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('next_id', '1')`).run();
|
|
9579
|
-
db2.prepare(`INSERT OR IGNORE INTO meta (key, value) VALUES ('mini_skills_generation', '0')`).run();
|
|
9580
|
-
_dbCache.set(normalized, db2);
|
|
9581
|
-
return db2;
|
|
9582
9591
|
}
|
|
9583
9592
|
function closeAllDatabases() {
|
|
9584
9593
|
for (const [key, db2] of _dbCache) {
|
|
@@ -10568,6 +10577,74 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_maintenance_jobs_active_dedupe
|
|
|
10568
10577
|
}
|
|
10569
10578
|
});
|
|
10570
10579
|
|
|
10580
|
+
// src/store/sqlite-reliability.ts
|
|
10581
|
+
function isTransientSqliteError(error40) {
|
|
10582
|
+
const code = error40?.code;
|
|
10583
|
+
if (typeof code === "string") {
|
|
10584
|
+
return /^SQLITE_BUSY(?:_|$)/i.test(code);
|
|
10585
|
+
}
|
|
10586
|
+
return error40 instanceof Error && /\bdatabase is locked\b|\bdatabase is busy\b/i.test(error40.message);
|
|
10587
|
+
}
|
|
10588
|
+
function isSqliteUnavailableError(error40) {
|
|
10589
|
+
return error40 instanceof SqliteUnavailableError || error40 instanceof Error && /SQLite is not available|better-sqlite3.*failed|node:sqlite.*failed|bun:sqlite.*failed/i.test(error40.message);
|
|
10590
|
+
}
|
|
10591
|
+
function degradedReadError(storeName) {
|
|
10592
|
+
return new Error(`[memorix] Cannot read ${storeName}: SQLite backend unavailable (memory is not loaded)`);
|
|
10593
|
+
}
|
|
10594
|
+
function degradedWriteError(storeName) {
|
|
10595
|
+
return new Error(`[memorix] Cannot write ${storeName}: SQLite backend unavailable (degraded mode; read-only)`);
|
|
10596
|
+
}
|
|
10597
|
+
function formatSqliteFailure(error40) {
|
|
10598
|
+
return error40 instanceof Error && error40.message ? error40.message : String(error40);
|
|
10599
|
+
}
|
|
10600
|
+
function delay(ms2) {
|
|
10601
|
+
return new Promise((resolve9) => setTimeout(resolve9, ms2));
|
|
10602
|
+
}
|
|
10603
|
+
async function retrySqliteBusy(operation, label) {
|
|
10604
|
+
for (let attempt = 0; ; attempt++) {
|
|
10605
|
+
try {
|
|
10606
|
+
return await operation();
|
|
10607
|
+
} catch (error40) {
|
|
10608
|
+
if (!isTransientSqliteError(error40) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length) throw error40;
|
|
10609
|
+
const waitMs = SQLITE_BUSY_RETRY_DELAYS_MS[attempt];
|
|
10610
|
+
console.error(
|
|
10611
|
+
`[memorix] ${label} SQLite busy (attempt ${attempt + 1}/${SQLITE_BUSY_RETRY_DELAYS_MS.length + 1}), retrying in ${waitMs}ms`
|
|
10612
|
+
);
|
|
10613
|
+
await delay(waitMs);
|
|
10614
|
+
}
|
|
10615
|
+
}
|
|
10616
|
+
}
|
|
10617
|
+
async function initializeSqliteStore(factory, dataDir, label) {
|
|
10618
|
+
try {
|
|
10619
|
+
loadBetterSqlite3();
|
|
10620
|
+
} catch (error40) {
|
|
10621
|
+
throw new SqliteUnavailableError(error40);
|
|
10622
|
+
}
|
|
10623
|
+
return retrySqliteBusy(async () => {
|
|
10624
|
+
const store2 = factory();
|
|
10625
|
+
await store2.init(dataDir);
|
|
10626
|
+
return store2;
|
|
10627
|
+
}, label);
|
|
10628
|
+
}
|
|
10629
|
+
var SQLITE_BUSY_RETRY_DELAYS_MS, SqliteUnavailableError;
|
|
10630
|
+
var init_sqlite_reliability = __esm({
|
|
10631
|
+
"src/store/sqlite-reliability.ts"() {
|
|
10632
|
+
"use strict";
|
|
10633
|
+
init_esm_shims();
|
|
10634
|
+
init_sqlite_db();
|
|
10635
|
+
SQLITE_BUSY_RETRY_DELAYS_MS = [50, 150, 400, 1e3, 2500];
|
|
10636
|
+
SqliteUnavailableError = class extends Error {
|
|
10637
|
+
code = "MEMORIX_SQLITE_UNAVAILABLE";
|
|
10638
|
+
constructor(cause) {
|
|
10639
|
+
super(
|
|
10640
|
+
cause instanceof Error && cause.message ? cause.message : "[memorix] SQLite is unavailable (install a supported SQLite runtime)"
|
|
10641
|
+
);
|
|
10642
|
+
this.name = "SqliteUnavailableError";
|
|
10643
|
+
}
|
|
10644
|
+
};
|
|
10645
|
+
}
|
|
10646
|
+
});
|
|
10647
|
+
|
|
10571
10648
|
// src/store/file-lock.ts
|
|
10572
10649
|
import { promises as fs2 } from "fs";
|
|
10573
10650
|
import { randomUUID } from "crypto";
|
|
@@ -11065,16 +11142,18 @@ async function initMiniSkillStore(dataDir) {
|
|
|
11065
11142
|
if (_store && _storeDataDir === dataDir) return _store;
|
|
11066
11143
|
_store = null;
|
|
11067
11144
|
_storeDataDir = null;
|
|
11145
|
+
let degradedReason = "SQLite runtime unavailable";
|
|
11068
11146
|
try {
|
|
11069
|
-
const store3 = new MiniSkillSqliteStore();
|
|
11070
|
-
await store3.init(dataDir);
|
|
11147
|
+
const store3 = await initializeSqliteStore(() => new MiniSkillSqliteStore(), dataDir, "Mini-skill store");
|
|
11071
11148
|
_store = store3;
|
|
11072
11149
|
_storeDataDir = dataDir;
|
|
11073
11150
|
return store3;
|
|
11074
11151
|
} catch (err) {
|
|
11075
|
-
|
|
11152
|
+
if (!isSqliteUnavailableError(err)) throw err;
|
|
11153
|
+
degradedReason = err instanceof Error ? err.message : String(err);
|
|
11154
|
+
console.error(`[memorix] MiniSkillSqliteStore unavailable, running in degraded read-only mode: ${degradedReason}`);
|
|
11076
11155
|
}
|
|
11077
|
-
const store2 = new MiniSkillGracefulDegrade();
|
|
11156
|
+
const store2 = new MiniSkillGracefulDegrade(degradedReason);
|
|
11078
11157
|
await store2.init(dataDir);
|
|
11079
11158
|
_store = store2;
|
|
11080
11159
|
_storeDataDir = dataDir;
|
|
@@ -11086,6 +11165,7 @@ var init_mini_skill_store = __esm({
|
|
|
11086
11165
|
"use strict";
|
|
11087
11166
|
init_esm_shims();
|
|
11088
11167
|
init_sqlite_db();
|
|
11168
|
+
init_sqlite_reliability();
|
|
11089
11169
|
MiniSkillSqliteStore = class {
|
|
11090
11170
|
db = null;
|
|
11091
11171
|
dataDir = "";
|
|
@@ -11194,7 +11274,7 @@ var init_mini_skill_store = __esm({
|
|
|
11194
11274
|
* SQLite serializes write transactions, so concurrent calls are safely sequenced.
|
|
11195
11275
|
*/
|
|
11196
11276
|
async atomicInsertWithId(skillWithoutId) {
|
|
11197
|
-
|
|
11277
|
+
return retrySqliteBusy(async () => this.db.transaction(() => {
|
|
11198
11278
|
const row = this.stmtGetMeta.get("mini_skills_next_id");
|
|
11199
11279
|
const nextId2 = row ? parseInt(row.value, 10) : 1;
|
|
11200
11280
|
const skill2 = { ...skillWithoutId, id: nextId2 };
|
|
@@ -11203,8 +11283,7 @@ var init_mini_skill_store = __esm({
|
|
|
11203
11283
|
this.stmtBumpGeneration.run();
|
|
11204
11284
|
this.knownGeneration = this.readGeneration();
|
|
11205
11285
|
return skill2;
|
|
11206
|
-
})();
|
|
11207
|
-
return result;
|
|
11286
|
+
})(), "Mini-skill promotion");
|
|
11208
11287
|
}
|
|
11209
11288
|
// ── Freshness ────────────────────────────────────────────────────
|
|
11210
11289
|
async ensureFresh() {
|
|
@@ -11223,10 +11302,17 @@ var init_mini_skill_store = __esm({
|
|
|
11223
11302
|
}
|
|
11224
11303
|
};
|
|
11225
11304
|
MiniSkillGracefulDegrade = class {
|
|
11305
|
+
constructor(reason = "SQLite runtime unavailable") {
|
|
11306
|
+
this.reason = reason;
|
|
11307
|
+
}
|
|
11308
|
+
reason;
|
|
11226
11309
|
warned = false;
|
|
11310
|
+
unavailableRead() {
|
|
11311
|
+
return degradedReadError("mini-skills");
|
|
11312
|
+
}
|
|
11227
11313
|
warn() {
|
|
11228
11314
|
if (!this.warned) {
|
|
11229
|
-
console.error("[memorix] MiniSkillStore: SQLite unavailable \u2014 mini-skills
|
|
11315
|
+
console.error("[memorix] MiniSkillStore: SQLite unavailable \u2014 mini-skills cannot be read or written. Install a supported SQLite runtime.");
|
|
11230
11316
|
this.warned = true;
|
|
11231
11317
|
}
|
|
11232
11318
|
}
|
|
@@ -11234,28 +11320,33 @@ var init_mini_skill_store = __esm({
|
|
|
11234
11320
|
this.warn();
|
|
11235
11321
|
}
|
|
11236
11322
|
async loadAll() {
|
|
11237
|
-
|
|
11323
|
+
throw this.unavailableRead();
|
|
11238
11324
|
}
|
|
11239
11325
|
async loadByProject(_projectId) {
|
|
11240
|
-
|
|
11326
|
+
throw this.unavailableRead();
|
|
11241
11327
|
}
|
|
11242
11328
|
async loadIdCounter() {
|
|
11243
|
-
|
|
11329
|
+
throw this.unavailableRead();
|
|
11244
11330
|
}
|
|
11245
11331
|
async insert(_skill) {
|
|
11246
11332
|
this.warn();
|
|
11333
|
+
throw degradedWriteError("mini-skills");
|
|
11247
11334
|
}
|
|
11248
11335
|
async update(_skill) {
|
|
11249
11336
|
this.warn();
|
|
11337
|
+
throw degradedWriteError("mini-skills");
|
|
11250
11338
|
}
|
|
11251
11339
|
async remove(_id) {
|
|
11252
11340
|
this.warn();
|
|
11341
|
+
throw degradedWriteError("mini-skills");
|
|
11253
11342
|
}
|
|
11254
11343
|
async saveIdCounter(_nextId) {
|
|
11344
|
+
this.warn();
|
|
11345
|
+
throw degradedWriteError("mini-skills");
|
|
11255
11346
|
}
|
|
11256
11347
|
async atomicInsertWithId(skillWithoutId) {
|
|
11257
11348
|
this.warn();
|
|
11258
|
-
|
|
11349
|
+
throw degradedWriteError("mini-skills");
|
|
11259
11350
|
}
|
|
11260
11351
|
async ensureFresh() {
|
|
11261
11352
|
return false;
|
|
@@ -11266,6 +11357,9 @@ var init_mini_skill_store = __esm({
|
|
|
11266
11357
|
getBackendName() {
|
|
11267
11358
|
return "degraded";
|
|
11268
11359
|
}
|
|
11360
|
+
getBackendReason() {
|
|
11361
|
+
return this.reason;
|
|
11362
|
+
}
|
|
11269
11363
|
};
|
|
11270
11364
|
_store = null;
|
|
11271
11365
|
_storeDataDir = null;
|
|
@@ -23207,10 +23301,10 @@ async function fetchWithRetry(url2, apiKey, body, options = {}, attempt = 0, nat
|
|
|
23207
23301
|
);
|
|
23208
23302
|
}
|
|
23209
23303
|
if (options.retry !== false && (response.status === 429 || response.status >= 500) && attempt < MAX_RETRIES2) {
|
|
23210
|
-
const
|
|
23304
|
+
const delay3 = BASE_DELAY_MS * Math.pow(2, attempt);
|
|
23211
23305
|
const retryAfter = response.headers.get("retry-after");
|
|
23212
23306
|
const parsedRetryAfter = retryAfter ? parseInt(retryAfter, 10) * 1e3 : NaN;
|
|
23213
|
-
const waitMs = Number.isFinite(parsedRetryAfter) ? parsedRetryAfter :
|
|
23307
|
+
const waitMs = Number.isFinite(parsedRetryAfter) ? parsedRetryAfter : delay3;
|
|
23214
23308
|
console.error(`[memorix] Embedding API ${response.status}, retry ${attempt + 1}/${MAX_RETRIES2} in ${waitMs}ms`);
|
|
23215
23309
|
await waitForRetry(waitMs, options.signal);
|
|
23216
23310
|
return fetchWithRetry(url2, apiKey, body, options, attempt + 1, nativeGemini);
|
|
@@ -25242,6 +25336,7 @@ var init_sqlite_store = __esm({
|
|
|
25242
25336
|
"use strict";
|
|
25243
25337
|
init_esm_shims();
|
|
25244
25338
|
init_sqlite_db();
|
|
25339
|
+
init_sqlite_reliability();
|
|
25245
25340
|
init_sqlite_fts();
|
|
25246
25341
|
SqliteBackend = class {
|
|
25247
25342
|
db = null;
|
|
@@ -25519,7 +25614,9 @@ var init_sqlite_store = __esm({
|
|
|
25519
25614
|
// ── Compound atomic operation ────────────────────────────────────
|
|
25520
25615
|
async atomic(fn2) {
|
|
25521
25616
|
const run = this._atomicQueue.catch(() => void 0).then(async () => {
|
|
25522
|
-
|
|
25617
|
+
await retrySqliteBusy(async () => {
|
|
25618
|
+
this.db.prepare("BEGIN IMMEDIATE").run();
|
|
25619
|
+
}, "Observation atomic write");
|
|
25523
25620
|
try {
|
|
25524
25621
|
const tx = {
|
|
25525
25622
|
loadAll: async () => this.rawLoadAll(),
|
|
@@ -25618,15 +25715,15 @@ function resetObservationStore() {
|
|
|
25618
25715
|
async function createObservationStore(dataDir) {
|
|
25619
25716
|
try {
|
|
25620
25717
|
const { SqliteBackend: SqliteBackend2 } = await Promise.resolve().then(() => (init_sqlite_store(), sqlite_store_exports));
|
|
25621
|
-
|
|
25622
|
-
await store3.init(dataDir);
|
|
25623
|
-
return store3;
|
|
25718
|
+
return await initializeSqliteStore(() => new SqliteBackend2(), dataDir, "Observation store");
|
|
25624
25719
|
} catch (err) {
|
|
25625
|
-
|
|
25720
|
+
if (!isSqliteUnavailableError(err)) throw err;
|
|
25721
|
+
const reason = formatSqliteFailure(err);
|
|
25722
|
+
console.error(`[memorix] SQLite module unavailable \u2014 degraded mode (reads/writes disabled): ${reason}`);
|
|
25723
|
+
const degraded = new DegradedBackend(reason);
|
|
25724
|
+
await degraded.init(dataDir);
|
|
25725
|
+
return degraded;
|
|
25626
25726
|
}
|
|
25627
|
-
const store2 = new DegradedBackend();
|
|
25628
|
-
await store2.init(dataDir);
|
|
25629
|
-
return store2;
|
|
25630
25727
|
}
|
|
25631
25728
|
async function initObservationStore(dataDir) {
|
|
25632
25729
|
if (_store2 && _storeDataDir2 === dataDir) {
|
|
@@ -25650,36 +25747,44 @@ var init_obs_store = __esm({
|
|
|
25650
25747
|
"src/store/obs-store.ts"() {
|
|
25651
25748
|
"use strict";
|
|
25652
25749
|
init_esm_shims();
|
|
25750
|
+
init_sqlite_reliability();
|
|
25653
25751
|
_store2 = null;
|
|
25654
25752
|
_storeDataDir2 = null;
|
|
25655
25753
|
DegradedBackend = class {
|
|
25754
|
+
constructor(reason = "SQLite runtime unavailable") {
|
|
25755
|
+
this.reason = reason;
|
|
25756
|
+
}
|
|
25757
|
+
reason;
|
|
25656
25758
|
dataDir = "";
|
|
25759
|
+
unavailableRead() {
|
|
25760
|
+
return degradedReadError("observations");
|
|
25761
|
+
}
|
|
25657
25762
|
async init(dataDir) {
|
|
25658
25763
|
this.dataDir = dataDir;
|
|
25659
25764
|
}
|
|
25660
25765
|
async loadAll() {
|
|
25661
|
-
|
|
25766
|
+
throw this.unavailableRead();
|
|
25662
25767
|
}
|
|
25663
25768
|
async loadByProject(_projectId, _options) {
|
|
25664
|
-
|
|
25769
|
+
throw this.unavailableRead();
|
|
25665
25770
|
}
|
|
25666
25771
|
async countByProject(_projectId, _options) {
|
|
25667
|
-
|
|
25772
|
+
throw this.unavailableRead();
|
|
25668
25773
|
}
|
|
25669
25774
|
async getById(_id) {
|
|
25670
|
-
|
|
25775
|
+
throw this.unavailableRead();
|
|
25671
25776
|
}
|
|
25672
25777
|
async loadIdCounter() {
|
|
25673
|
-
|
|
25778
|
+
throw this.unavailableRead();
|
|
25674
25779
|
}
|
|
25675
25780
|
async countAll() {
|
|
25676
|
-
|
|
25781
|
+
throw this.unavailableRead();
|
|
25677
25782
|
}
|
|
25678
25783
|
async listProjectIds() {
|
|
25679
|
-
|
|
25784
|
+
throw this.unavailableRead();
|
|
25680
25785
|
}
|
|
25681
25786
|
async searchLexical(_options) {
|
|
25682
|
-
|
|
25787
|
+
throw this.unavailableRead();
|
|
25683
25788
|
}
|
|
25684
25789
|
hasLexicalIndex() {
|
|
25685
25790
|
return false;
|
|
@@ -25688,25 +25793,25 @@ var init_obs_store = __esm({
|
|
|
25688
25793
|
return false;
|
|
25689
25794
|
}
|
|
25690
25795
|
async insert(_obs) {
|
|
25691
|
-
throw
|
|
25796
|
+
throw degradedWriteError("observations");
|
|
25692
25797
|
}
|
|
25693
25798
|
async update(_obs) {
|
|
25694
|
-
throw
|
|
25799
|
+
throw degradedWriteError("observations");
|
|
25695
25800
|
}
|
|
25696
25801
|
async remove(_id) {
|
|
25697
|
-
throw
|
|
25802
|
+
throw degradedWriteError("observations");
|
|
25698
25803
|
}
|
|
25699
25804
|
async bulkReplace(_obs) {
|
|
25700
|
-
throw
|
|
25805
|
+
throw degradedWriteError("observations");
|
|
25701
25806
|
}
|
|
25702
25807
|
async bulkRemoveByIds(_ids) {
|
|
25703
|
-
throw
|
|
25808
|
+
throw degradedWriteError("observations");
|
|
25704
25809
|
}
|
|
25705
25810
|
async saveIdCounter(_nextId) {
|
|
25706
|
-
throw
|
|
25811
|
+
throw degradedWriteError("observations");
|
|
25707
25812
|
}
|
|
25708
25813
|
async atomic(_fn) {
|
|
25709
|
-
throw
|
|
25814
|
+
throw degradedWriteError("observations");
|
|
25710
25815
|
}
|
|
25711
25816
|
async ensureFresh() {
|
|
25712
25817
|
return false;
|
|
@@ -25719,6 +25824,9 @@ var init_obs_store = __esm({
|
|
|
25719
25824
|
getBackendName() {
|
|
25720
25825
|
return "degraded";
|
|
25721
25826
|
}
|
|
25827
|
+
getBackendReason() {
|
|
25828
|
+
return this.reason;
|
|
25829
|
+
}
|
|
25722
25830
|
};
|
|
25723
25831
|
}
|
|
25724
25832
|
});
|
|
@@ -73579,10 +73687,10 @@ var require_retry3 = __commonJS({
|
|
|
73579
73687
|
if (!await shouldRetryFn(err)) {
|
|
73580
73688
|
return { shouldRetry: false, config: err.config };
|
|
73581
73689
|
}
|
|
73582
|
-
const
|
|
73690
|
+
const delay3 = getNextRetryDelay(config2);
|
|
73583
73691
|
err.config.retryConfig.currentRetryAttempt += 1;
|
|
73584
|
-
const backoff = config2.retryBackoff ? config2.retryBackoff(err,
|
|
73585
|
-
setTimeout(resolve9,
|
|
73692
|
+
const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay3) : new Promise((resolve9) => {
|
|
73693
|
+
setTimeout(resolve9, delay3);
|
|
73586
73694
|
});
|
|
73587
73695
|
if (config2.onRetryAttempt) {
|
|
73588
73696
|
await config2.onRetryAttempt(err);
|
|
@@ -127107,7 +127215,7 @@ async function retryBackoff(fn2, strategy) {
|
|
|
127107
127215
|
retryInterval = initialInterval * Math.pow(x5, exponent) + Math.random() * 1e3;
|
|
127108
127216
|
}
|
|
127109
127217
|
const d4 = Math.min(retryInterval, maxInterval);
|
|
127110
|
-
await
|
|
127218
|
+
await delay2(d4);
|
|
127111
127219
|
x5++;
|
|
127112
127220
|
}
|
|
127113
127221
|
}
|
|
@@ -127128,8 +127236,8 @@ function retryIntervalFromResponse(res) {
|
|
|
127128
127236
|
}
|
|
127129
127237
|
return 0;
|
|
127130
127238
|
}
|
|
127131
|
-
async function
|
|
127132
|
-
return new Promise((resolve9) => setTimeout(resolve9,
|
|
127239
|
+
async function delay2(delay3) {
|
|
127240
|
+
return new Promise((resolve9) => setTimeout(resolve9, delay3));
|
|
127133
127241
|
}
|
|
127134
127242
|
var defaultBackoff, PermanentError, TemporaryError, codeRangeRE2;
|
|
127135
127243
|
var init_retries = __esm({
|
|
@@ -177559,7 +177667,20 @@ function normalizeMiniMaxVideoRequest(input) {
|
|
|
177559
177667
|
if (ratio !== "adaptive" && ratio !== "16:9" && ratio !== "9:16" && ratio !== "1:1") {
|
|
177560
177668
|
throw new Error("MiniMax video ratio must be adaptive, 16:9, 9:16, or 1:1");
|
|
177561
177669
|
}
|
|
177562
|
-
|
|
177670
|
+
let firstFrameImageUrl;
|
|
177671
|
+
if (input.firstFrameImageUrl !== void 0) {
|
|
177672
|
+
firstFrameImageUrl = input.firstFrameImageUrl.trim();
|
|
177673
|
+
let parsed;
|
|
177674
|
+
try {
|
|
177675
|
+
parsed = new URL(firstFrameImageUrl);
|
|
177676
|
+
} catch {
|
|
177677
|
+
throw new Error("MiniMax first-frame image must be a public HTTPS URL");
|
|
177678
|
+
}
|
|
177679
|
+
if (parsed.protocol !== "https:" || parsed.username || parsed.password || sanitizeCredentials(firstFrameImageUrl) !== firstFrameImageUrl) {
|
|
177680
|
+
throw new Error("MiniMax first-frame image must be an HTTPS URL without credentials");
|
|
177681
|
+
}
|
|
177682
|
+
}
|
|
177683
|
+
return { region, model, prompt: prompt2, resolution, duration: duration3, ratio, ...firstFrameImageUrl ? { firstFrameImageUrl } : {} };
|
|
177563
177684
|
}
|
|
177564
177685
|
function videoRequestConfig(input) {
|
|
177565
177686
|
const normalized = normalizeMiniMaxVideoRequest(input);
|
|
@@ -177636,7 +177757,14 @@ async function createMiniMaxVideoTask(input, dependencies = {}) {
|
|
|
177636
177757
|
headers: videoHeaders(config2.apiKey),
|
|
177637
177758
|
body: JSON.stringify({
|
|
177638
177759
|
model: config2.model,
|
|
177639
|
-
content: [
|
|
177760
|
+
content: [
|
|
177761
|
+
{ type: "text", text: config2.prompt },
|
|
177762
|
+
...config2.firstFrameImageUrl ? [{
|
|
177763
|
+
type: "image_url",
|
|
177764
|
+
image_url: { url: config2.firstFrameImageUrl },
|
|
177765
|
+
role: "first_frame"
|
|
177766
|
+
}] : []
|
|
177767
|
+
],
|
|
177640
177768
|
resolution: config2.resolution,
|
|
177641
177769
|
duration: config2.duration,
|
|
177642
177770
|
ratio: config2.ratio
|
|
@@ -177884,10 +178012,19 @@ function parseStoredRequest(value) {
|
|
|
177884
178012
|
const duration3 = value.duration;
|
|
177885
178013
|
const ratio = value.ratio;
|
|
177886
178014
|
const maxBytes = value.maxBytes;
|
|
177887
|
-
if (provider2 !== "minimax" && provider2 !== "minimax-cn" || region !== "global" && region !== "cn" || model !== "MiniMax-H3" || typeof prompt2 !== "string" || resolution !== "2K" || duration3 !== 5 && duration3 !== 10 || ratio !== "adaptive" && ratio !== "16:9" && ratio !== "9:16" && ratio !== "1:1" || typeof maxBytes !== "number" || !Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
178015
|
+
if (provider2 !== "minimax" && provider2 !== "minimax-cn" || region !== "global" && region !== "cn" || model !== "MiniMax-H3" || typeof prompt2 !== "string" || value.firstFrameImageUrl !== void 0 && typeof value.firstFrameImageUrl !== "string" || resolution !== "2K" || duration3 !== 5 && duration3 !== 10 || ratio !== "adaptive" && ratio !== "16:9" && ratio !== "9:16" && ratio !== "1:1" || typeof maxBytes !== "number" || !Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
177888
178016
|
throw new Error("Media video job has an invalid request payload");
|
|
177889
178017
|
}
|
|
177890
|
-
|
|
178018
|
+
const normalized = normalizeMiniMaxVideoRequest({
|
|
178019
|
+
region,
|
|
178020
|
+
model,
|
|
178021
|
+
prompt: prompt2,
|
|
178022
|
+
resolution,
|
|
178023
|
+
duration: duration3,
|
|
178024
|
+
ratio,
|
|
178025
|
+
firstFrameImageUrl: value.firstFrameImageUrl
|
|
178026
|
+
});
|
|
178027
|
+
return { provider: provider2, ...normalized, maxBytes };
|
|
177891
178028
|
}
|
|
177892
178029
|
function mediaJobIdFromMaintenance(job) {
|
|
177893
178030
|
const mediaJobId = job.payload.mediaJobId;
|
|
@@ -177899,6 +178036,7 @@ function mediaJobIdFromMaintenance(job) {
|
|
|
177899
178036
|
function toVideoRequest(request) {
|
|
177900
178037
|
return {
|
|
177901
178038
|
prompt: request.prompt,
|
|
178039
|
+
firstFrameImageUrl: request.firstFrameImageUrl,
|
|
177902
178040
|
model: request.model,
|
|
177903
178041
|
region: request.region,
|
|
177904
178042
|
resolution: request.resolution,
|
|
@@ -177990,6 +178128,7 @@ function queueMiniMaxVideoGeneration(input) {
|
|
|
177990
178128
|
region: normalized.region,
|
|
177991
178129
|
model: normalized.model,
|
|
177992
178130
|
prompt: normalized.prompt,
|
|
178131
|
+
...normalized.firstFrameImageUrl ? { firstFrameImageUrl: normalized.firstFrameImageUrl } : {},
|
|
177993
178132
|
resolution: normalized.resolution,
|
|
177994
178133
|
duration: normalized.duration,
|
|
177995
178134
|
ratio: normalized.ratio,
|
|
@@ -191552,16 +191691,18 @@ async function initSessionStore(dataDir) {
|
|
|
191552
191691
|
if (_store3 && _storeDataDir3 === dataDir) return _store3;
|
|
191553
191692
|
_store3 = null;
|
|
191554
191693
|
_storeDataDir3 = null;
|
|
191694
|
+
let degradedReason = "SQLite runtime unavailable";
|
|
191555
191695
|
try {
|
|
191556
|
-
const store3 = new SessionSqliteStore();
|
|
191557
|
-
await store3.init(dataDir);
|
|
191696
|
+
const store3 = await initializeSqliteStore(() => new SessionSqliteStore(), dataDir, "Session store");
|
|
191558
191697
|
_store3 = store3;
|
|
191559
191698
|
_storeDataDir3 = dataDir;
|
|
191560
191699
|
return store3;
|
|
191561
191700
|
} catch (err) {
|
|
191562
|
-
|
|
191701
|
+
if (!isSqliteUnavailableError(err)) throw err;
|
|
191702
|
+
degradedReason = formatSqliteFailure(err);
|
|
191703
|
+
console.error(`[memorix] SessionSqliteStore unavailable, running in degraded read-only mode: ${degradedReason}`);
|
|
191563
191704
|
}
|
|
191564
|
-
const store2 = new SessionGracefulDegrade();
|
|
191705
|
+
const store2 = new SessionGracefulDegrade(degradedReason);
|
|
191565
191706
|
await store2.init(dataDir);
|
|
191566
191707
|
_store3 = store2;
|
|
191567
191708
|
_storeDataDir3 = dataDir;
|
|
@@ -191573,6 +191714,7 @@ var init_session_store = __esm({
|
|
|
191573
191714
|
"use strict";
|
|
191574
191715
|
init_esm_shims();
|
|
191575
191716
|
init_sqlite_db();
|
|
191717
|
+
init_sqlite_reliability();
|
|
191576
191718
|
SessionSqliteStore = class {
|
|
191577
191719
|
db = null;
|
|
191578
191720
|
dataDir = "";
|
|
@@ -191661,7 +191803,7 @@ var init_session_store = __esm({
|
|
|
191661
191803
|
}
|
|
191662
191804
|
const stmtComplete = this._stmtCompleteActive;
|
|
191663
191805
|
const stmtIns = this.stmtInsert;
|
|
191664
|
-
|
|
191806
|
+
return retrySqliteBusy(async () => this.db.transaction(() => {
|
|
191665
191807
|
let completedCount = 0;
|
|
191666
191808
|
for (const pid of projectIds) {
|
|
191667
191809
|
const info2 = stmtComplete.run({ pid, now: now3 });
|
|
@@ -191669,18 +191811,24 @@ var init_session_store = __esm({
|
|
|
191669
191811
|
}
|
|
191670
191812
|
stmtIns.run(sessionToRow(newSession));
|
|
191671
191813
|
return completedCount;
|
|
191672
|
-
})();
|
|
191673
|
-
return result;
|
|
191814
|
+
})(), "Session rollover");
|
|
191674
191815
|
}
|
|
191675
191816
|
getBackendName() {
|
|
191676
191817
|
return "sqlite";
|
|
191677
191818
|
}
|
|
191678
191819
|
};
|
|
191679
191820
|
SessionGracefulDegrade = class {
|
|
191821
|
+
constructor(reason = "SQLite runtime unavailable") {
|
|
191822
|
+
this.reason = reason;
|
|
191823
|
+
}
|
|
191824
|
+
reason;
|
|
191680
191825
|
warned = false;
|
|
191826
|
+
unavailableRead() {
|
|
191827
|
+
return degradedReadError("sessions");
|
|
191828
|
+
}
|
|
191681
191829
|
warn() {
|
|
191682
191830
|
if (!this.warned) {
|
|
191683
|
-
console.error("[memorix] SessionStore: SQLite unavailable \u2014 sessions
|
|
191831
|
+
console.error("[memorix] SessionStore: SQLite unavailable \u2014 sessions cannot be read or written. Install a supported SQLite runtime.");
|
|
191684
191832
|
this.warned = true;
|
|
191685
191833
|
}
|
|
191686
191834
|
}
|
|
@@ -191688,33 +191836,39 @@ var init_session_store = __esm({
|
|
|
191688
191836
|
this.warn();
|
|
191689
191837
|
}
|
|
191690
191838
|
async loadAll() {
|
|
191691
|
-
|
|
191839
|
+
throw this.unavailableRead();
|
|
191692
191840
|
}
|
|
191693
191841
|
async getById(_id) {
|
|
191694
|
-
|
|
191842
|
+
throw this.unavailableRead();
|
|
191695
191843
|
}
|
|
191696
191844
|
async loadByProject(_projectId) {
|
|
191697
|
-
|
|
191845
|
+
throw this.unavailableRead();
|
|
191698
191846
|
}
|
|
191699
191847
|
async loadActive(_projectId) {
|
|
191700
|
-
|
|
191848
|
+
throw this.unavailableRead();
|
|
191701
191849
|
}
|
|
191702
191850
|
async insert(_session) {
|
|
191703
191851
|
this.warn();
|
|
191852
|
+
throw degradedWriteError("sessions");
|
|
191704
191853
|
}
|
|
191705
191854
|
async update(_session) {
|
|
191706
191855
|
this.warn();
|
|
191856
|
+
throw degradedWriteError("sessions");
|
|
191707
191857
|
}
|
|
191708
191858
|
async bulkUpdate(_sessions) {
|
|
191709
191859
|
this.warn();
|
|
191860
|
+
throw degradedWriteError("sessions");
|
|
191710
191861
|
}
|
|
191711
191862
|
async atomicRolloverInsert(_newSession, _projectIds, _now) {
|
|
191712
191863
|
this.warn();
|
|
191713
|
-
|
|
191864
|
+
throw degradedWriteError("sessions");
|
|
191714
191865
|
}
|
|
191715
191866
|
getBackendName() {
|
|
191716
191867
|
return "degraded";
|
|
191717
191868
|
}
|
|
191869
|
+
getBackendReason() {
|
|
191870
|
+
return this.reason;
|
|
191871
|
+
}
|
|
191718
191872
|
};
|
|
191719
191873
|
_store3 = null;
|
|
191720
191874
|
_storeDataDir3 = null;
|
|
@@ -207835,7 +207989,7 @@ var init_tool_profile = __esm({
|
|
|
207835
207989
|
function getMcpServerInfo() {
|
|
207836
207990
|
return {
|
|
207837
207991
|
name: "memorix",
|
|
207838
|
-
version: true ? "1.9.
|
|
207992
|
+
version: true ? "1.9.4" : "1.0.1"
|
|
207839
207993
|
};
|
|
207840
207994
|
}
|
|
207841
207995
|
function createMcpDiscoverResult(capabilities, serverInfo) {
|
|
@@ -268513,6 +268667,7 @@ ${lines.join("\n")}` }] };
|
|
|
268513
268667
|
} : {},
|
|
268514
268668
|
...mediaGenerationEnabled ? {
|
|
268515
268669
|
image: external_exports2.string().optional().describe("Base64-encoded reference image for image-to-image generation."),
|
|
268670
|
+
firstFrameImageUrl: external_exports2.string().optional().describe("Public HTTPS first-frame image URL for MiniMax video generation; stored with the queued job."),
|
|
268516
268671
|
region: external_exports2.enum(["global", "cn"]).optional().describe("MiniMax deployment region."),
|
|
268517
268672
|
n: external_exports2.number().int().min(1).max(4).optional().describe("Image output count."),
|
|
268518
268673
|
ratio: external_exports2.enum(["adaptive", "1:1", "16:9", "4:3", "3:2", "2:3", "3:4", "9:16", "21:9"]).optional().describe("Image or video aspect ratio."),
|
|
@@ -268522,7 +268677,7 @@ ${lines.join("\n")}` }] };
|
|
|
268522
268677
|
} : {}
|
|
268523
268678
|
}
|
|
268524
268679
|
},
|
|
268525
|
-
async ({ action, path: assetPath, assetId, jobId, kind, limit: limit2, title, narrative, prompt: prompt2, image, model, provider: provider2, language, region, n: n3, ratio, width, height, duration: duration3, maxPages, maxChars, attach }) => {
|
|
268680
|
+
async ({ action, path: assetPath, assetId, jobId, kind, limit: limit2, title, narrative, prompt: prompt2, image, firstFrameImageUrl, model, provider: provider2, language, region, n: n3, ratio, width, height, duration: duration3, maxPages, maxChars, attach }) => {
|
|
268526
268681
|
const unresolved = requireResolvedProject("manage controlled media");
|
|
268527
268682
|
if (unresolved) return unresolved;
|
|
268528
268683
|
const safeError4 = (error40) => sanitizeCredentials(
|
|
@@ -268692,6 +268847,7 @@ ${lines.join("\n")}` }] };
|
|
|
268692
268847
|
dataDir: projectDir2,
|
|
268693
268848
|
projectId: project.id,
|
|
268694
268849
|
prompt: prompt2,
|
|
268850
|
+
firstFrameImageUrl,
|
|
268695
268851
|
...model === "MiniMax-H3" ? { model } : {},
|
|
268696
268852
|
...region ? { region } : {},
|
|
268697
268853
|
...videoRatio ? { ratio: videoRatio } : {},
|
|
@@ -279167,6 +279323,7 @@ var init_media = __esm({
|
|
|
279167
279323
|
concepts: { type: "string", description: "Comma-separated concepts when attaching" },
|
|
279168
279324
|
visibility: { type: "string", description: "Observation visibility when attaching" },
|
|
279169
279325
|
prompt: { type: "string", description: "Generation prompt" },
|
|
279326
|
+
"first-frame-image-url": { type: "string", description: "Public HTTPS first-frame image URL for MiniMax video generation; stored with the queued job" },
|
|
279170
279327
|
image: { type: "string", description: "Path to a reference image for image-to-image generation" },
|
|
279171
279328
|
model: { type: "string", description: "Provider model" },
|
|
279172
279329
|
provider: { type: "string", description: "Audio transcription provider: openai or groq" },
|
|
@@ -279217,6 +279374,7 @@ var init_media = __esm({
|
|
|
279217
279374
|
dataDir,
|
|
279218
279375
|
projectId: project.id,
|
|
279219
279376
|
prompt: prompt2,
|
|
279377
|
+
firstFrameImageUrl: args["first-frame-image-url"],
|
|
279220
279378
|
model: parseMiniMaxVideoModel(args.model),
|
|
279221
279379
|
region: parseMiniMaxRegion(args.region),
|
|
279222
279380
|
duration: parseMiniMaxVideoDuration(args.duration),
|
|
@@ -281651,22 +281809,39 @@ var init_doctor = __esm({
|
|
|
281651
281809
|
let activeCount = 0;
|
|
281652
281810
|
let ranCount = 0;
|
|
281653
281811
|
let backendName = "unknown";
|
|
281812
|
+
let backendReason;
|
|
281813
|
+
let observationFailure;
|
|
281654
281814
|
try {
|
|
281655
281815
|
const { initObservationStore: initObservationStore2, getObservationStore: getObservationStore2 } = await Promise.resolve().then(() => (init_obs_store(), obs_store_exports));
|
|
281656
281816
|
await initObservationStore2(dataDir);
|
|
281657
281817
|
const store2 = getObservationStore2();
|
|
281658
281818
|
backendName = store2.getBackendName();
|
|
281819
|
+
backendReason = store2.getBackendReason?.();
|
|
281659
281820
|
const { filterReadableObservations: filterReadableObservations2 } = await Promise.resolve().then(() => (init_visibility(), visibility_exports));
|
|
281660
281821
|
projectObservations = projectId ? filterReadableObservations2(await store2.loadAll(), { projectId }) : [];
|
|
281661
281822
|
obsCount = projectObservations.length;
|
|
281662
281823
|
activeCount = projectObservations.filter((o4) => (o4.status ?? "active") === "active").length;
|
|
281663
281824
|
ranCount = projectObservations.filter((o4) => /^Ran:\s/i.test(o4.title ?? "")).length;
|
|
281664
|
-
} catch {
|
|
281665
|
-
|
|
281666
|
-
|
|
281667
|
-
|
|
281668
|
-
|
|
281825
|
+
} catch (error40) {
|
|
281826
|
+
observationFailure = error40 instanceof Error ? error40.message : String(error40);
|
|
281827
|
+
}
|
|
281828
|
+
if (observationFailure) {
|
|
281829
|
+
lines.push(fail2(`Observations: storage unavailable \u2014 ${observationFailure}`));
|
|
281830
|
+
issues.push(`Observation store could not be opened: ${observationFailure}`);
|
|
281831
|
+
report.data = {
|
|
281832
|
+
backend: "unavailable",
|
|
281833
|
+
observations: null,
|
|
281834
|
+
active: null,
|
|
281835
|
+
commandLogs: null,
|
|
281836
|
+
error: observationFailure
|
|
281837
|
+
};
|
|
281838
|
+
} else if (backendName === "degraded") {
|
|
281839
|
+
lines.push(fail2(`Backend: degraded (read-only; writes disabled${backendReason ? `; ${backendReason}` : ""})`));
|
|
281840
|
+
lines.push(fail2("Observations: unavailable \u2014 count not reported"));
|
|
281841
|
+
issues.push("SQLite backend unavailable \u2014 observation storage is in degraded read-only mode; observations are not being persisted.");
|
|
281842
|
+
report.data = { backend: "degraded", ...backendReason ? { backendReason } : {}, observations: null, active: null, commandLogs: null };
|
|
281669
281843
|
} else {
|
|
281844
|
+
lines.push(ok("Backend: sqlite (read-write)"));
|
|
281670
281845
|
lines.push(ok(`Observations: ${obsCount} total, ${activeCount} active`));
|
|
281671
281846
|
if (ranCount > 0) {
|
|
281672
281847
|
const pct = Math.round(ranCount / obsCount * 100);
|
|
@@ -281676,29 +281851,63 @@ var init_doctor = __esm({
|
|
|
281676
281851
|
}
|
|
281677
281852
|
}
|
|
281678
281853
|
}
|
|
281679
|
-
report.data
|
|
281854
|
+
if (!report.data) {
|
|
281855
|
+
report.data = { backend: backendName, observations: obsCount, active: activeCount, commandLogs: ranCount };
|
|
281856
|
+
} else if (!report.data.backend) {
|
|
281857
|
+
report.data.backend = backendName;
|
|
281858
|
+
}
|
|
281859
|
+
let sessionBackend = "unknown";
|
|
281860
|
+
let sessionReason;
|
|
281680
281861
|
try {
|
|
281681
281862
|
const { initSessionStore: initSessionStore2, getSessionStore: getSessionStore2 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
|
|
281682
281863
|
await initSessionStore2(dataDir);
|
|
281683
281864
|
const sessStore = getSessionStore2();
|
|
281684
|
-
|
|
281685
|
-
|
|
281686
|
-
|
|
281687
|
-
|
|
281688
|
-
|
|
281689
|
-
|
|
281865
|
+
sessionBackend = sessStore.getBackendName();
|
|
281866
|
+
sessionReason = sessStore.getBackendReason?.();
|
|
281867
|
+
if (sessionBackend === "degraded") {
|
|
281868
|
+
lines.push(fail2(`Sessions: unavailable \u2014 read-only degraded backend${sessionReason ? `; ${sessionReason}` : ""}`));
|
|
281869
|
+
issues.push("Session storage is in degraded read-only mode.");
|
|
281870
|
+
report.data.sessions = null;
|
|
281871
|
+
if (sessionReason) report.data.sessionBackendReason = sessionReason;
|
|
281872
|
+
} else {
|
|
281873
|
+
const sess = await sessStore.loadAll();
|
|
281874
|
+
const sessCount = sess.length;
|
|
281875
|
+
const activeSess = sess.filter((s4) => s4.status === "active").length;
|
|
281876
|
+
lines.push(ok(`Sessions: ${sessCount} total, ${activeSess} active`));
|
|
281877
|
+
report.data.sessions = sessCount;
|
|
281878
|
+
}
|
|
281879
|
+
} catch (error40) {
|
|
281880
|
+
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
281881
|
+
lines.push(fail2(`Sessions: unavailable (${message})`));
|
|
281882
|
+
issues.push(`Session storage is unavailable: ${message}`);
|
|
281883
|
+
report.data.sessions = null;
|
|
281690
281884
|
}
|
|
281885
|
+
let skillBackend = "unknown";
|
|
281886
|
+
let skillReason;
|
|
281691
281887
|
try {
|
|
281692
281888
|
const { initMiniSkillStore: initMiniSkillStore2, getMiniSkillStore: getMiniSkillStore2 } = await Promise.resolve().then(() => (init_mini_skill_store(), mini_skill_store_exports));
|
|
281693
281889
|
await initMiniSkillStore2(dataDir);
|
|
281694
281890
|
const skillStore = getMiniSkillStore2();
|
|
281695
|
-
|
|
281696
|
-
|
|
281697
|
-
if (
|
|
281698
|
-
lines.push(
|
|
281699
|
-
|
|
281891
|
+
skillBackend = skillStore.getBackendName();
|
|
281892
|
+
skillReason = skillStore.getBackendReason?.();
|
|
281893
|
+
if (skillBackend === "degraded") {
|
|
281894
|
+
lines.push(fail2(`Mini-skills: unavailable \u2014 read-only degraded backend${skillReason ? `; ${skillReason}` : ""}`));
|
|
281895
|
+
issues.push("Mini-skill storage is in degraded read-only mode.");
|
|
281896
|
+
report.data.miniSkills = null;
|
|
281897
|
+
if (skillReason) report.data.miniSkillBackendReason = skillReason;
|
|
281898
|
+
} else {
|
|
281899
|
+
const skills = await skillStore.loadAll();
|
|
281900
|
+
const skillCount = skills.length;
|
|
281901
|
+
if (skillCount > 0) {
|
|
281902
|
+
lines.push(ok(`Mini-skills: ${skillCount}`));
|
|
281903
|
+
report.data.miniSkills = skillCount;
|
|
281904
|
+
}
|
|
281700
281905
|
}
|
|
281701
|
-
} catch {
|
|
281906
|
+
} catch (error40) {
|
|
281907
|
+
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
281908
|
+
lines.push(fail2(`Mini-skills: unavailable (${message})`));
|
|
281909
|
+
issues.push(`Mini-skill storage is unavailable: ${message}`);
|
|
281910
|
+
report.data.miniSkills = null;
|
|
281702
281911
|
}
|
|
281703
281912
|
} else {
|
|
281704
281913
|
lines.push(warn2("No data directory found for current project"));
|
|
@@ -281946,6 +282155,9 @@ var init_doctor = __esm({
|
|
|
281946
282155
|
} else {
|
|
281947
282156
|
console.log(lines.join("\n"));
|
|
281948
282157
|
}
|
|
282158
|
+
if (issues.some((issue2) => /^(Observation store could not be opened|Observation storage |Session storage |Mini-skill storage |SQLite backend unavailable)/.test(issue2))) {
|
|
282159
|
+
process.exitCode = 1;
|
|
282160
|
+
}
|
|
281949
282161
|
}
|
|
281950
282162
|
});
|
|
281951
282163
|
}
|
|
@@ -284393,12 +284605,12 @@ function classifyError(ctx, taskId) {
|
|
|
284393
284605
|
if (taskId) backoffState.set(taskId, attempt);
|
|
284394
284606
|
const baseDelay = 2e3;
|
|
284395
284607
|
const maxDelay = 3e4;
|
|
284396
|
-
const
|
|
284397
|
-
const jitter =
|
|
284608
|
+
const delay3 = Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
|
|
284609
|
+
const jitter = delay3 * 0.25 * (Math.random() * 2 - 1);
|
|
284398
284610
|
return {
|
|
284399
284611
|
category: "transient",
|
|
284400
284612
|
strategy: "backoff_and_retry",
|
|
284401
|
-
delayMs: Math.round(
|
|
284613
|
+
delayMs: Math.round(delay3 + jitter),
|
|
284402
284614
|
reason: `Transient error detected (attempt ${attempt})`,
|
|
284403
284615
|
backoffAttempt: attempt
|
|
284404
284616
|
};
|