@automagik/omni 2.260405.1 → 2.260405.3
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/__tests__/mock-api.d.ts.map +1 -1
- package/dist/commands/connect.d.ts +1 -1
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/done.d.ts.map +1 -1
- package/dist/commands/history.d.ts +14 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/context.d.ts +8 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/index.js +154 -63
- package/dist/server/index.js +16 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-api.d.ts","sourceRoot":"","sources":["../../src/__tests__/mock-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"mock-api.d.ts","sourceRoot":"","sources":["../../src/__tests__/mock-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAgStD,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAID;;;;GAIG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CA2B3D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAIlC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 1. Discovers agent via `genie dir ls <agent-name> --json`
|
|
6
6
|
* 2. Creates/updates Omni provider with schema `nats-genie`
|
|
7
7
|
* 3. Creates Omni agent record linked to provider
|
|
8
|
-
* 4. Updates instance
|
|
8
|
+
* 4. Updates instance with agentId (FK), agentProviderId, agentReplyFilter, and triggerMode
|
|
9
9
|
*/
|
|
10
10
|
import { Command } from 'commander';
|
|
11
11
|
export declare function createConnectCommand(): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgFpC,wBAAgB,oBAAoB,IAAI,OAAO,CAyF9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/commands/done.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2HpC,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/commands/done.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2HpC,wBAAgB,iBAAiB,IAAI,OAAO,CA0C3C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History Command — Read conversation messages verb
|
|
3
|
+
*
|
|
4
|
+
* omni history — show last 10 messages in open chat
|
|
5
|
+
* omni history --limit 20 — show last 20 messages
|
|
6
|
+
* omni history --before <msg-id> — paginate backward
|
|
7
|
+
* omni history --full — show full content (no truncation)
|
|
8
|
+
* omni history --json — machine-readable output (global flag)
|
|
9
|
+
*
|
|
10
|
+
* Uses context resolution (env vars > PG context > config) for instance/chat.
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
export declare function createHistoryCommand(): Command;
|
|
14
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsFpC,wBAAgB,oBAAoB,IAAI,OAAO,CAkE9C"}
|
package/dist/context.d.ts
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* 3. PG-backed context (stored per API key via /context endpoint)
|
|
8
8
|
* 4. Config defaults (defaultInstance from ~/.omni/config.json)
|
|
9
9
|
* 5. Error — no context available
|
|
10
|
+
*
|
|
11
|
+
* Each field is resolved independently so that a single flag (e.g. --message)
|
|
12
|
+
* does not nullify other fields available from lower-priority sources.
|
|
10
13
|
*/
|
|
11
14
|
export interface ResolvedContext {
|
|
12
15
|
instanceId: string | null;
|
|
@@ -17,6 +20,11 @@ export interface ResolvedContext {
|
|
|
17
20
|
/**
|
|
18
21
|
* Resolve the current conversation context.
|
|
19
22
|
*
|
|
23
|
+
* Each field (instanceId, chatId, messageId) is resolved independently through
|
|
24
|
+
* the priority chain: CLI flags > env vars > PG context > config defaults.
|
|
25
|
+
* This prevents a single flag (e.g. --message) from nullifying other fields
|
|
26
|
+
* that are available from lower-priority sources (e.g. OMNI_INSTANCE env var).
|
|
27
|
+
*
|
|
20
28
|
* @param flags - Explicit CLI flags passed by the user
|
|
21
29
|
* @returns Resolved context with source indicator
|
|
22
30
|
*/
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,KAAK,CAAC,EAAE;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,eAAe,CAAC,CAiD3B;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS3F;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAevF"}
|
package/dist/index.js
CHANGED
|
@@ -33508,7 +33508,7 @@ var require_string = __commonJS((exports) => {
|
|
|
33508
33508
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
33509
33509
|
var is = require_is();
|
|
33510
33510
|
var stacktrace = require_stacktrace();
|
|
33511
|
-
function
|
|
33511
|
+
function truncate4(str, max = 0) {
|
|
33512
33512
|
if (typeof str !== "string" || max === 0) {
|
|
33513
33513
|
return str;
|
|
33514
33514
|
}
|
|
@@ -33581,7 +33581,7 @@ var require_string = __commonJS((exports) => {
|
|
|
33581
33581
|
exports.safeJoin = safeJoin;
|
|
33582
33582
|
exports.snipLine = snipLine;
|
|
33583
33583
|
exports.stringMatchesSomePattern = stringMatchesSomePattern;
|
|
33584
|
-
exports.truncate =
|
|
33584
|
+
exports.truncate = truncate4;
|
|
33585
33585
|
});
|
|
33586
33586
|
|
|
33587
33587
|
// ../../node_modules/.bun/@sentry+core@10.43.0/node_modules/@sentry/core/build/cjs/utils/misc.js
|
|
@@ -76887,7 +76887,7 @@ import { fileURLToPath } from "url";
|
|
|
76887
76887
|
// package.json
|
|
76888
76888
|
var package_default = {
|
|
76889
76889
|
name: "@automagik/omni",
|
|
76890
|
-
version: "2.260405.
|
|
76890
|
+
version: "2.260405.3",
|
|
76891
76891
|
description: "LLM-optimized CLI for Omni",
|
|
76892
76892
|
type: "module",
|
|
76893
76893
|
bin: {
|
|
@@ -79935,7 +79935,7 @@ async function findOrCreateAgent(client, agentName, providerId) {
|
|
|
79935
79935
|
}
|
|
79936
79936
|
}
|
|
79937
79937
|
function createConnectCommand() {
|
|
79938
|
-
return new Command("connect").description("Connect an Omni instance to a Genie agent via NATS").argument("<instance-id>", "Omni instance ID").argument("<agent-name>", "Genie agent name (from genie directory)").option("--nats-url <url>", "NATS server URL", "localhost:4222").action(async (instanceId, agentName, options) => {
|
|
79938
|
+
return new Command("connect").description("Connect an Omni instance to a Genie agent via NATS").argument("<instance-id>", "Omni instance ID").argument("<agent-name>", "Genie agent name (from genie directory)").option("--nats-url <url>", "NATS server URL", "localhost:4222").option("--mode <mode>", "Trigger mode: turn-based (round-trip) or fire-and-forget", "turn-based").option("--reply-filter <filter>", "Reply filter: all (reply to everything) or filtered", "all").action(async (instanceId, agentName, options) => {
|
|
79939
79939
|
const client = getClient();
|
|
79940
79940
|
info(`Discovering agent "${agentName}" from genie directory...`);
|
|
79941
79941
|
let agentEntry;
|
|
@@ -79967,20 +79967,33 @@ Make sure genie is installed and the agent is registered:
|
|
|
79967
79967
|
const agentId = await findOrCreateAgent(client, agentName, providerId);
|
|
79968
79968
|
if (!agentId)
|
|
79969
79969
|
return;
|
|
79970
|
+
const triggerMode = options.mode === "turn-based" ? "round-trip" : "fire-and-forget";
|
|
79971
|
+
const replyFilterMode = options.replyFilter;
|
|
79972
|
+
const agentReplyFilter = { mode: replyFilterMode, conditions: {} };
|
|
79970
79973
|
info("Updating instance agent assignment...");
|
|
79971
79974
|
try {
|
|
79972
|
-
await client.instances.update(instanceId, {
|
|
79975
|
+
await client.instances.update(instanceId, {
|
|
79976
|
+
agentId,
|
|
79977
|
+
agentProviderId: providerId,
|
|
79978
|
+
agentReplyFilter,
|
|
79979
|
+
triggerMode
|
|
79980
|
+
});
|
|
79973
79981
|
} catch {
|
|
79974
79982
|
warn("Could not update instance agent assignment automatically.");
|
|
79975
|
-
info(`Set manually: omni instances update ${instanceId} --agent-provider-id ${providerId}`);
|
|
79983
|
+
info(`Set manually: omni instances update ${instanceId} --agent-id ${agentId} --agent-provider-id ${providerId}`);
|
|
79984
|
+
return;
|
|
79976
79985
|
}
|
|
79977
|
-
success(`Connected instance "${instanceId}" to genie agent "${agentName}"
|
|
79978
|
-
|
|
79979
|
-
|
|
79980
|
-
|
|
79981
|
-
|
|
79982
|
-
|
|
79983
|
-
|
|
79986
|
+
success(`Connected instance "${instanceId}" to genie agent "${agentName}".`);
|
|
79987
|
+
header("Configuration Summary");
|
|
79988
|
+
keyValue("Agent ID", agentId);
|
|
79989
|
+
keyValue("Provider ID", providerId);
|
|
79990
|
+
keyValue("Reply Filter", replyFilterMode);
|
|
79991
|
+
keyValue("Trigger Mode", `${triggerMode} (--mode ${options.mode})`);
|
|
79992
|
+
header("NATS Topics");
|
|
79993
|
+
keyValue("Inbound", `omni.message.${instanceId}.*`);
|
|
79994
|
+
keyValue("Outbound", `omni.reply.${instanceId}.*`);
|
|
79995
|
+
header("Next Step");
|
|
79996
|
+
info("Start the genie bridge: genie omni start");
|
|
79984
79997
|
});
|
|
79985
79998
|
}
|
|
79986
79999
|
|
|
@@ -80081,52 +80094,29 @@ import { basename, extname } from "path";
|
|
|
80081
80094
|
// src/context.ts
|
|
80082
80095
|
init_config();
|
|
80083
80096
|
async function resolveContext(flags) {
|
|
80084
|
-
|
|
80085
|
-
|
|
80086
|
-
|
|
80087
|
-
chatId: flags.chat ?? null,
|
|
80088
|
-
messageId: flags.message ?? null,
|
|
80089
|
-
source: "flags"
|
|
80090
|
-
};
|
|
80091
|
-
}
|
|
80097
|
+
const flagInstance = flags?.instance;
|
|
80098
|
+
const flagChat = flags?.chat;
|
|
80099
|
+
const flagMessage = flags?.message;
|
|
80092
80100
|
const envInstance = process.env.OMNI_INSTANCE;
|
|
80093
80101
|
const envChat = process.env.OMNI_CHAT;
|
|
80094
80102
|
const envMessage = process.env.OMNI_MESSAGE;
|
|
80095
|
-
|
|
80096
|
-
|
|
80097
|
-
|
|
80098
|
-
chatId: envChat ?? null,
|
|
80099
|
-
messageId: envMessage ?? null,
|
|
80100
|
-
source: "env"
|
|
80101
|
-
};
|
|
80102
|
-
}
|
|
80103
|
+
let apiInstance;
|
|
80104
|
+
let apiChat;
|
|
80105
|
+
let apiMessage;
|
|
80103
80106
|
try {
|
|
80104
80107
|
const client = getClient();
|
|
80105
80108
|
const ctx = await client.context.get();
|
|
80106
|
-
|
|
80107
|
-
|
|
80108
|
-
|
|
80109
|
-
chatId: ctx.chatId,
|
|
80110
|
-
messageId: ctx.messageId,
|
|
80111
|
-
source: "api"
|
|
80112
|
-
};
|
|
80113
|
-
}
|
|
80109
|
+
apiInstance = ctx.instanceId ?? undefined;
|
|
80110
|
+
apiChat = ctx.chatId ?? undefined;
|
|
80111
|
+
apiMessage = ctx.messageId ?? undefined;
|
|
80114
80112
|
} catch {}
|
|
80115
80113
|
const config = loadConfig();
|
|
80116
|
-
|
|
80117
|
-
|
|
80118
|
-
|
|
80119
|
-
|
|
80120
|
-
|
|
80121
|
-
|
|
80122
|
-
};
|
|
80123
|
-
}
|
|
80124
|
-
return {
|
|
80125
|
-
instanceId: null,
|
|
80126
|
-
chatId: null,
|
|
80127
|
-
messageId: null,
|
|
80128
|
-
source: "none"
|
|
80129
|
-
};
|
|
80114
|
+
const configInstance = config.defaultInstance;
|
|
80115
|
+
const instanceId = flagInstance ?? envInstance ?? apiInstance ?? configInstance ?? null;
|
|
80116
|
+
const chatId = flagChat ?? envChat ?? apiChat ?? null;
|
|
80117
|
+
const messageId = flagMessage ?? envMessage ?? apiMessage ?? null;
|
|
80118
|
+
const source = flagInstance || flagChat || flagMessage ? "flags" : envInstance || envChat || envMessage ? "env" : apiInstance || apiChat || apiMessage ? "api" : configInstance ? "config" : "none";
|
|
80119
|
+
return { instanceId, chatId, messageId, source };
|
|
80130
80120
|
}
|
|
80131
80121
|
async function resolveInstanceFromContext(explicitInstance) {
|
|
80132
80122
|
if (explicitInstance)
|
|
@@ -80241,8 +80231,7 @@ function createDoneCommand() {
|
|
|
80241
80231
|
const client = getClient();
|
|
80242
80232
|
const ctx = await resolveContext({
|
|
80243
80233
|
instance: options.instance,
|
|
80244
|
-
chat: options.chat
|
|
80245
|
-
message: options.message
|
|
80234
|
+
chat: options.chat
|
|
80246
80235
|
});
|
|
80247
80236
|
if (!ctx.instanceId) {
|
|
80248
80237
|
return error("No instance in context. Set OMNI_INSTANCE, use --instance, or run: omni use <instance>");
|
|
@@ -80250,14 +80239,16 @@ function createDoneCommand() {
|
|
|
80250
80239
|
if (!ctx.chatId) {
|
|
80251
80240
|
return error("No chat in context. Set OMNI_CHAT, use --chat, or run: omni open <contact>");
|
|
80252
80241
|
}
|
|
80242
|
+
const messageId = await resolveReplyTo(options.message);
|
|
80243
|
+
const ctxWithMessage = { ...ctx, messageId };
|
|
80253
80244
|
if (options.skip)
|
|
80254
80245
|
return handleSkip(client, options.reason);
|
|
80255
80246
|
if (options.react)
|
|
80256
|
-
return handleReact(client,
|
|
80247
|
+
return handleReact(client, ctxWithMessage, options.react);
|
|
80257
80248
|
if (options.media)
|
|
80258
|
-
return handleMedia(client,
|
|
80249
|
+
return handleMedia(client, ctxWithMessage, options.media, options.caption);
|
|
80259
80250
|
if (text)
|
|
80260
|
-
return handleText(client,
|
|
80251
|
+
return handleText(client, ctxWithMessage, text);
|
|
80261
80252
|
error('Specify what to do: omni done "text", omni done --media <file>, omni done --react <emoji>, or omni done --skip');
|
|
80262
80253
|
});
|
|
80263
80254
|
}
|
|
@@ -81473,6 +81464,101 @@ function createFilmCommand() {
|
|
|
81473
81464
|
});
|
|
81474
81465
|
}
|
|
81475
81466
|
|
|
81467
|
+
// src/commands/history.ts
|
|
81468
|
+
init_output();
|
|
81469
|
+
function truncate2(str, maxLen) {
|
|
81470
|
+
if (str.length <= maxLen)
|
|
81471
|
+
return str;
|
|
81472
|
+
return `${str.slice(0, maxLen - 1)}\u2026`;
|
|
81473
|
+
}
|
|
81474
|
+
function formatTime2(ts) {
|
|
81475
|
+
try {
|
|
81476
|
+
const d = new Date(ts);
|
|
81477
|
+
return d.toLocaleString("en-US", {
|
|
81478
|
+
month: "short",
|
|
81479
|
+
day: "2-digit",
|
|
81480
|
+
hour: "2-digit",
|
|
81481
|
+
minute: "2-digit",
|
|
81482
|
+
hour12: false
|
|
81483
|
+
});
|
|
81484
|
+
} catch {
|
|
81485
|
+
return ts;
|
|
81486
|
+
}
|
|
81487
|
+
}
|
|
81488
|
+
function senderLabel(msg) {
|
|
81489
|
+
if (msg.senderDisplayName)
|
|
81490
|
+
return msg.senderDisplayName;
|
|
81491
|
+
if (msg.isFromMe)
|
|
81492
|
+
return "me";
|
|
81493
|
+
if (msg.senderPlatformUserId)
|
|
81494
|
+
return msg.senderPlatformUserId;
|
|
81495
|
+
return "unknown";
|
|
81496
|
+
}
|
|
81497
|
+
function contentPreview(msg, full) {
|
|
81498
|
+
const maxLen = full ? 0 : 80;
|
|
81499
|
+
const parts = [];
|
|
81500
|
+
if (msg.textContent) {
|
|
81501
|
+
parts.push(msg.textContent);
|
|
81502
|
+
}
|
|
81503
|
+
if (msg.transcription) {
|
|
81504
|
+
parts.push(`[transcription] ${msg.transcription}`);
|
|
81505
|
+
}
|
|
81506
|
+
if (msg.mediaLocalPath) {
|
|
81507
|
+
parts.push(`[file] ${msg.mediaLocalPath}`);
|
|
81508
|
+
} else if (msg.mediaUrl) {
|
|
81509
|
+
parts.push(`[media] ${msg.mediaUrl}`);
|
|
81510
|
+
}
|
|
81511
|
+
const combined = parts.join(" | ") || "-";
|
|
81512
|
+
return maxLen > 0 ? truncate2(combined, maxLen) : combined;
|
|
81513
|
+
}
|
|
81514
|
+
function createHistoryCommand() {
|
|
81515
|
+
return new Command("history").description("Show recent messages in the open chat").option("--limit <n>", "Number of messages to fetch (default: 10)").option("--before <msg-id>", "Fetch messages before this message ID (pagination)").option("--full", "Show full content without truncation").option("--instance <id>", "Override instance (default: from context)").option("--chat <id>", "Override chat (default: from context)").action(async (options) => {
|
|
81516
|
+
const client = getClient();
|
|
81517
|
+
const ctx = await resolveContext({
|
|
81518
|
+
instance: options.instance,
|
|
81519
|
+
chat: options.chat
|
|
81520
|
+
});
|
|
81521
|
+
if (!ctx.instanceId) {
|
|
81522
|
+
return error("No instance in context. Set OMNI_INSTANCE, use --instance, or run: omni use <instance>");
|
|
81523
|
+
}
|
|
81524
|
+
if (!ctx.chatId) {
|
|
81525
|
+
return error("No chat in context. Set OMNI_CHAT, use --chat, or run: omni open <contact>");
|
|
81526
|
+
}
|
|
81527
|
+
const limit = options.limit ? Number.parseInt(options.limit, 10) : 10;
|
|
81528
|
+
if (Number.isNaN(limit) || limit < 1) {
|
|
81529
|
+
return error("--limit must be a positive integer");
|
|
81530
|
+
}
|
|
81531
|
+
try {
|
|
81532
|
+
const messages = await client.chats.getMessages(ctx.chatId, {
|
|
81533
|
+
limit,
|
|
81534
|
+
before: options.before
|
|
81535
|
+
});
|
|
81536
|
+
if (messages.length === 0) {
|
|
81537
|
+
return info("No messages found.");
|
|
81538
|
+
}
|
|
81539
|
+
const format = getCurrentFormat();
|
|
81540
|
+
if (format === "json") {
|
|
81541
|
+
console.log(JSON.stringify(messages, null, 2));
|
|
81542
|
+
return;
|
|
81543
|
+
}
|
|
81544
|
+
if (options.full) {
|
|
81545
|
+
setMaxCellWidth(0);
|
|
81546
|
+
}
|
|
81547
|
+
const rows = messages.map((msg) => ({
|
|
81548
|
+
ID: msg.externalId,
|
|
81549
|
+
TIME: formatTime2(msg.platformTimestamp),
|
|
81550
|
+
SENDER: senderLabel(msg),
|
|
81551
|
+
TYPE: msg.messageType,
|
|
81552
|
+
CONTENT: contentPreview(msg, !!options.full)
|
|
81553
|
+
}));
|
|
81554
|
+
list(rows, { rawData: messages });
|
|
81555
|
+
} catch (err) {
|
|
81556
|
+
const message = err instanceof Error ? err.message : "Unknown error";
|
|
81557
|
+
error(`Failed to fetch history: ${message}`);
|
|
81558
|
+
}
|
|
81559
|
+
});
|
|
81560
|
+
}
|
|
81561
|
+
|
|
81476
81562
|
// src/commands/imagine.ts
|
|
81477
81563
|
import { writeFileSync as writeFileSync3 } from "fs";
|
|
81478
81564
|
import { basename as basename2, dirname as dirname2, extname as extname2, join as join3 } from "path";
|
|
@@ -83713,7 +83799,7 @@ function formatDate(date) {
|
|
|
83713
83799
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
83714
83800
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
83715
83801
|
}
|
|
83716
|
-
function
|
|
83802
|
+
function truncate3(text, maxLen) {
|
|
83717
83803
|
if (!text)
|
|
83718
83804
|
return "-";
|
|
83719
83805
|
const clean = text.replace(/\n/g, " ").trim();
|
|
@@ -83778,10 +83864,10 @@ function formatSearchResults(messages, chatMap) {
|
|
|
83778
83864
|
const chat = chatMap.get(m.chatId);
|
|
83779
83865
|
const chatName = chat?.name ?? chat?.externalId ?? m.chatId.slice(0, 8);
|
|
83780
83866
|
return {
|
|
83781
|
-
chat:
|
|
83867
|
+
chat: truncate3(chatName, 20),
|
|
83782
83868
|
time: formatDate(m.platformTimestamp),
|
|
83783
83869
|
type: m.messageType,
|
|
83784
|
-
content:
|
|
83870
|
+
content: truncate3(getContentPreview(m), 50)
|
|
83785
83871
|
};
|
|
83786
83872
|
});
|
|
83787
83873
|
}
|
|
@@ -84583,7 +84669,7 @@ var LEVEL_LABELS = {
|
|
|
84583
84669
|
warn: "WARN ",
|
|
84584
84670
|
error: "ERROR"
|
|
84585
84671
|
};
|
|
84586
|
-
function
|
|
84672
|
+
function formatTime3(timestamp) {
|
|
84587
84673
|
const date = new Date(timestamp);
|
|
84588
84674
|
const hours = date.getHours().toString().padStart(2, "0");
|
|
84589
84675
|
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
@@ -84634,7 +84720,7 @@ function formatData(data2) {
|
|
|
84634
84720
|
}
|
|
84635
84721
|
function formatPretty(entry) {
|
|
84636
84722
|
const { level, time, module, msg, ...data2 } = entry;
|
|
84637
|
-
const timeStr =
|
|
84723
|
+
const timeStr = formatTime3(time);
|
|
84638
84724
|
const levelColor = COLORS[level];
|
|
84639
84725
|
const levelStr = `${levelColor}${LEVEL_LABELS[level]}${COLORS.reset}`;
|
|
84640
84726
|
const moduleStr = formatModule(module);
|
|
@@ -93676,8 +93762,7 @@ function createReactCommand() {
|
|
|
93676
93762
|
const client = getClient();
|
|
93677
93763
|
const ctx = await resolveContext({
|
|
93678
93764
|
instance: options.instance,
|
|
93679
|
-
chat: options.chat
|
|
93680
|
-
message: options.message
|
|
93765
|
+
chat: options.chat
|
|
93681
93766
|
});
|
|
93682
93767
|
if (!ctx.instanceId) {
|
|
93683
93768
|
return error("No instance in context. Set OMNI_INSTANCE, use --instance, or run: omni use <instance>");
|
|
@@ -95505,6 +95590,12 @@ var COMMANDS = [
|
|
|
95505
95590
|
helpGroup: "Core",
|
|
95506
95591
|
helpDescription: "Describe an image or video via Gemini Vision (verb command)"
|
|
95507
95592
|
},
|
|
95593
|
+
{
|
|
95594
|
+
create: createHistoryCommand,
|
|
95595
|
+
category: "core",
|
|
95596
|
+
helpGroup: "Core",
|
|
95597
|
+
helpDescription: "Show recent messages in the open chat (verb command)"
|
|
95598
|
+
},
|
|
95508
95599
|
{ create: createChatsCommand, category: "core", helpGroup: "Core", helpDescription: "List and manage conversations" },
|
|
95509
95600
|
{
|
|
95510
95601
|
create: createMessagesCommand,
|
package/dist/server/index.js
CHANGED
|
@@ -196747,6 +196747,11 @@ var init_sdk2 = __esm(() => {
|
|
|
196747
196747
|
var init_esm4 = __esm(() => {
|
|
196748
196748
|
init_http3();
|
|
196749
196749
|
init_node_fetch2();
|
|
196750
|
+
init_postgres();
|
|
196751
|
+
init_hono();
|
|
196752
|
+
init_openai2();
|
|
196753
|
+
init_anthropic_ai2();
|
|
196754
|
+
init_google_genai2();
|
|
196750
196755
|
init_sdk2();
|
|
196751
196756
|
init_tracing3();
|
|
196752
196757
|
init_esm();
|
|
@@ -222788,7 +222793,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
222788
222793
|
var require_package8 = __commonJS((exports, module) => {
|
|
222789
222794
|
module.exports = {
|
|
222790
222795
|
name: "@omni/api",
|
|
222791
|
-
version: "2.260405.
|
|
222796
|
+
version: "2.260405.3",
|
|
222792
222797
|
type: "module",
|
|
222793
222798
|
exports: {
|
|
222794
222799
|
".": {
|
|
@@ -222871,7 +222876,12 @@ var init_instrument2 = __esm(() => {
|
|
|
222871
222876
|
query_string: false,
|
|
222872
222877
|
cookies: false
|
|
222873
222878
|
}
|
|
222874
|
-
})
|
|
222879
|
+
}),
|
|
222880
|
+
honoIntegration(),
|
|
222881
|
+
anthropicAIIntegration(),
|
|
222882
|
+
openAIIntegration(),
|
|
222883
|
+
googleGenAIIntegration(),
|
|
222884
|
+
postgresIntegration()
|
|
222875
222885
|
],
|
|
222876
222886
|
beforeSend(event) {
|
|
222877
222887
|
return scrubEvent(event);
|
|
@@ -487976,7 +487986,10 @@ function buildMessageContent2(message2, buildVCard) {
|
|
|
487976
487986
|
// ../channel-whatsapp/src/senders/contact.ts
|
|
487977
487987
|
function computeWaid(digits) {
|
|
487978
487988
|
if (digits.length === 13 && digits.startsWith("55") && digits.charAt(4) === "9") {
|
|
487979
|
-
|
|
487989
|
+
const ddd = Number(digits.slice(2, 4));
|
|
487990
|
+
if (ddd >= 31) {
|
|
487991
|
+
return digits.slice(0, 4) + digits.slice(5);
|
|
487992
|
+
}
|
|
487980
487993
|
}
|
|
487981
487994
|
return digits;
|
|
487982
487995
|
}
|