@automagik/omni 2.260617.2 → 2.260617.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/dist/commands/start.d.ts
CHANGED
|
@@ -4,5 +4,14 @@
|
|
|
4
4
|
* omni start — Start API and NATS via PM2 using ~/.omni/config.json
|
|
5
5
|
*/
|
|
6
6
|
import { Command } from 'commander';
|
|
7
|
+
/**
|
|
8
|
+
* A legacy embedded-pgserve install (created before the canonical cutover)
|
|
9
|
+
* cannot be served by this build — omni-api never spawns the embedded
|
|
10
|
+
* postmaster, so it crash-loops on "Database not ready". Legacy installs
|
|
11
|
+
* predate the `useCanonicalPgserve` flag, so they don't trip the API's
|
|
12
|
+
* PGSERVE_EMBEDDED=true guard. The signal: not committed to canonical AND an
|
|
13
|
+
* embedded data dir is present on disk.
|
|
14
|
+
*/
|
|
15
|
+
export declare function legacyEmbeddedNeedsMigration(useCanonicalPgserve: boolean | undefined, embeddedDataPresent?: boolean): boolean;
|
|
7
16
|
export declare function createStartCommand(): Command;
|
|
8
17
|
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBpC;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,mBAAmB,EAAE,OAAO,GAAG,SAAS,EACxC,mBAAmB,GAAE,OAAmE,GACvF,OAAO,CAET;AAwFD,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C"}
|
package/dist/index.js
CHANGED
|
@@ -124971,7 +124971,7 @@ import { fileURLToPath } from "url";
|
|
|
124971
124971
|
// package.json
|
|
124972
124972
|
var package_default = {
|
|
124973
124973
|
name: "@automagik/omni",
|
|
124974
|
-
version: "2.260617.
|
|
124974
|
+
version: "2.260617.4",
|
|
124975
124975
|
description: "LLM-optimized CLI for Omni",
|
|
124976
124976
|
type: "module",
|
|
124977
124977
|
bin: {
|
|
@@ -130142,6 +130142,19 @@ var OMNI_BACKUPS_DIR = join10(homedir6(), ".omni", "backups");
|
|
|
130142
130142
|
function getEmbeddedPgserveDataDir() {
|
|
130143
130143
|
return OMNI_EMBEDDED_PGSERVE_DATA_DIR;
|
|
130144
130144
|
}
|
|
130145
|
+
function embeddedServerMajor() {
|
|
130146
|
+
try {
|
|
130147
|
+
const v = Number.parseInt(readFileSync5(join10(getEmbeddedPgserveDataDir(), "PG_VERSION"), "utf8").trim(), 10);
|
|
130148
|
+
return Number.isFinite(v) ? v : null;
|
|
130149
|
+
} catch {
|
|
130150
|
+
return null;
|
|
130151
|
+
}
|
|
130152
|
+
}
|
|
130153
|
+
function clientToolHint(tool) {
|
|
130154
|
+
const major = embeddedServerMajor();
|
|
130155
|
+
const v = major ?? "<server-major>";
|
|
130156
|
+
return `${tool} not found in PATH (or older than the embedded server). The embedded cluster is PostgreSQL ${v}; you need a ${tool} of major >= ${v}. Debian/Ubuntu (PGDG): \`apt install postgresql-client-${v}\` \u2014 NOT the bare \`postgresql-client\`, which may be older and will fail with "server version is newer". macOS: \`brew install postgresql@${v}\`. Then re-run \`omni doctor --fix\`.`;
|
|
130157
|
+
}
|
|
130145
130158
|
function getCanonicalPgserveDataDir() {
|
|
130146
130159
|
if (!existsSync8(PGSERVE_CONFIG_PATH))
|
|
130147
130160
|
return PGSERVE_DEFAULT_DATA_DIR;
|
|
@@ -130191,7 +130204,7 @@ async function dumpEmbeddedDb(currentDatabaseUrl) {
|
|
|
130191
130204
|
return { status: "embedded-data-invalid", embeddedDir };
|
|
130192
130205
|
}
|
|
130193
130206
|
if (!commandIsAvailable("pg_dump")) {
|
|
130194
|
-
throw new Error("pg_dump
|
|
130207
|
+
throw new Error(clientToolHint("pg_dump"));
|
|
130195
130208
|
}
|
|
130196
130209
|
const snapshotPath = getSnapshotPath();
|
|
130197
130210
|
mkdirSync5(OMNI_BACKUPS_DIR, { recursive: true, mode: 448 });
|
|
@@ -130222,7 +130235,7 @@ async function restoreSnapshotToCanonical(dump, canonicalDatabaseUrl) {
|
|
|
130222
130235
|
return { status: "skipped" };
|
|
130223
130236
|
}
|
|
130224
130237
|
if (!commandIsAvailable("psql")) {
|
|
130225
|
-
throw new Error("psql
|
|
130238
|
+
throw new Error(clientToolHint("psql"));
|
|
130226
130239
|
}
|
|
130227
130240
|
raw(" Restoring snapshot into canonical pgserve via psql...");
|
|
130228
130241
|
raw(` snapshot: ${dump.snapshotPath}`);
|
|
@@ -130817,7 +130830,7 @@ async function fixPgserveCanonical(deps) {
|
|
|
130817
130830
|
try {
|
|
130818
130831
|
dumpResult = await deps.dumpEmbeddedDb(serverConfig.databaseUrl);
|
|
130819
130832
|
} catch (err) {
|
|
130820
|
-
throw new Error(`pg_dump of embedded omni DB failed (${err instanceof Error ? err.message : String(err)}); omni-api still running on embedded \u2014
|
|
130833
|
+
throw new Error(`pg_dump of embedded omni DB failed (${err instanceof Error ? err.message : String(err)}); omni-api still running on embedded \u2014 the dump hint above names the exact client major to install (the distro-default postgresql-client is often older than the embedded server and will fail), then re-run \`omni doctor --fix\``);
|
|
130821
130834
|
}
|
|
130822
130835
|
await deps.runPm2(["stop", PM2_PROCESSES.api]);
|
|
130823
130836
|
const url = await deps.setupCanonicalPgserve();
|
|
@@ -137074,8 +137087,12 @@ import { existsSync as existsSync18, mkdirSync as mkdirSync11 } from "fs";
|
|
|
137074
137087
|
import { homedir as homedir12 } from "os";
|
|
137075
137088
|
import { join as join17 } from "path";
|
|
137076
137089
|
init_config();
|
|
137090
|
+
init_embedded_canonical_migration();
|
|
137077
137091
|
init_output();
|
|
137078
137092
|
var START_HEALTH_TIMEOUT_MS = 1e4;
|
|
137093
|
+
function legacyEmbeddedNeedsMigration(useCanonicalPgserve, embeddedDataPresent = existsSync18(join17(EMBEDDED_PGSERVE_DATA_DIR, "PG_VERSION"))) {
|
|
137094
|
+
return useCanonicalPgserve !== true && embeddedDataPresent;
|
|
137095
|
+
}
|
|
137079
137096
|
async function runStart() {
|
|
137080
137097
|
if (!await isPm2Available()) {
|
|
137081
137098
|
pm2NotFoundError();
|
|
@@ -137086,6 +137103,14 @@ async function runStart() {
|
|
|
137086
137103
|
}
|
|
137087
137104
|
const serverConfig = loadServerConfig();
|
|
137088
137105
|
const apiPort = serverConfig.port;
|
|
137106
|
+
if (legacyEmbeddedNeedsMigration(serverConfig.useCanonicalPgserve)) {
|
|
137107
|
+
const major = readDataDirMajor(EMBEDDED_PGSERVE_DATA_DIR);
|
|
137108
|
+
error(`Legacy embedded pgserve detected \u2014 this omni build does not run an embedded Postgres.
|
|
137109
|
+
Embedded data dir: ${EMBEDDED_PGSERVE_DATA_DIR}${major ? ` (PostgreSQL ${major})` : ""}
|
|
137110
|
+
Your data is intact. Migrate to canonical pgserve first:
|
|
137111
|
+
omni doctor --fix
|
|
137112
|
+
(idempotent \u2014 preserves data; do not \`omni start\` until it completes).`, undefined, 1);
|
|
137113
|
+
}
|
|
137089
137114
|
mkdirSync11(getPm2LogDir(), { recursive: true });
|
|
137090
137115
|
info(`Starting ${PM2_PROCESSES.api} (port ${apiPort})...`);
|
|
137091
137116
|
const cliConfig = loadConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-pgserve.d.ts","sourceRoot":"","sources":["../../src/lib/canonical-pgserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA8OH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iCAAiC,CACrD,WAAW,EA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package/dist/server/index.js
CHANGED
|
@@ -225245,7 +225245,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
225245
225245
|
var require_package7 = __commonJS((exports, module) => {
|
|
225246
225246
|
module.exports = {
|
|
225247
225247
|
name: "@omni/api",
|
|
225248
|
-
version: "2.260617.
|
|
225248
|
+
version: "2.260617.4",
|
|
225249
225249
|
type: "module",
|
|
225250
225250
|
exports: {
|
|
225251
225251
|
".": {
|
|
@@ -350897,7 +350897,11 @@ var init_chats2 = __esm(() => {
|
|
|
350897
350897
|
const isAgentPaused = dbChat.settings?.agentPaused === true;
|
|
350898
350898
|
if (isAgentPaused) {
|
|
350899
350899
|
await services.chats.update(dbChat.id, {
|
|
350900
|
-
settings: {
|
|
350900
|
+
settings: {
|
|
350901
|
+
...dbChat.settings ?? {},
|
|
350902
|
+
agentPaused: false,
|
|
350903
|
+
agentResumedAt: new Date().toISOString()
|
|
350904
|
+
}
|
|
350901
350905
|
});
|
|
350902
350906
|
}
|
|
350903
350907
|
}
|
|
@@ -357382,8 +357386,9 @@ var init_messages5 = __esm(() => {
|
|
|
357382
357386
|
operation: "send handoff"
|
|
357383
357387
|
});
|
|
357384
357388
|
}
|
|
357389
|
+
const handoffChat = await services.chats.getById(data.chatId);
|
|
357385
357390
|
await services.chats.update(data.chatId, {
|
|
357386
|
-
settings: { agentPaused: true }
|
|
357391
|
+
settings: { ...handoffChat?.settings ?? {}, agentPaused: true }
|
|
357387
357392
|
});
|
|
357388
357393
|
await services.followUpLifecycle.disarm({
|
|
357389
357394
|
chatId: data.chatId,
|
|
@@ -357481,8 +357486,10 @@ var init_messages5 = __esm(() => {
|
|
|
357481
357486
|
const { terminal, escalated, closeUntil } = await computeCloseContactTerminalState(db2, data.chatId, outcome, auditRow?.id ?? null);
|
|
357482
357487
|
const shouldPauseAgent = outcome === "lost";
|
|
357483
357488
|
const closedAt = new Date;
|
|
357489
|
+
const closeChat = await services.chats.getById(data.chatId);
|
|
357484
357490
|
await services.chats.update(data.chatId, {
|
|
357485
357491
|
settings: {
|
|
357492
|
+
...closeChat?.settings ?? {},
|
|
357486
357493
|
...shouldPauseAgent ? { agentPaused: true } : {},
|
|
357487
357494
|
closed: terminal,
|
|
357488
357495
|
closeUntil: closeUntil?.toISOString() ?? null,
|
|
@@ -357501,7 +357508,7 @@ var init_messages5 = __esm(() => {
|
|
|
357501
357508
|
agentId: instance4.agentId ?? null,
|
|
357502
357509
|
outcome,
|
|
357503
357510
|
reason: data.reason ?? null,
|
|
357504
|
-
escalated
|
|
357511
|
+
escalated,
|
|
357505
357512
|
closedFields: data.closeFields ?? null,
|
|
357506
357513
|
closedAt: closedAt.toISOString()
|
|
357507
357514
|
};
|