@automagik/omni 2.260421.6 → 2.260422.2

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 CHANGED
@@ -113804,7 +113804,7 @@ import { fileURLToPath } from "url";
113804
113804
  // package.json
113805
113805
  var package_default = {
113806
113806
  name: "@automagik/omni",
113807
- version: "2.260421.6",
113807
+ version: "2.260422.2",
113808
113808
  description: "LLM-optimized CLI for Omni",
113809
113809
  type: "module",
113810
113810
  bin: {
@@ -224451,7 +224451,7 @@ var init_sentry_scrub = __esm(() => {
224451
224451
  var require_package8 = __commonJS((exports, module) => {
224452
224452
  module.exports = {
224453
224453
  name: "@omni/api",
224454
- version: "2.260421.6",
224454
+ version: "2.260422.2",
224455
224455
  type: "module",
224456
224456
  exports: {
224457
224457
  ".": {
@@ -236782,7 +236782,7 @@ function validatePgserveDataDir(config4) {
236782
236782
  }
236783
236783
  function isAddressInUse(error2) {
236784
236784
  const msg = error2 instanceof Error ? error2.message : String(error2);
236785
- return msg.includes("EADDRINUSE") || msg.includes("address already in use") || msg.includes("Failed to listen on");
236785
+ return msg.includes("EADDRINUSE") || msg.includes("address already in use") || msg.includes("Failed to listen on") || msg.includes("Failed to listen at");
236786
236786
  }
236787
236787
  function buildDatabaseUrl(port) {
236788
236788
  return `postgresql://postgres:postgres@localhost:${port}/omni`;
@@ -347967,6 +347967,26 @@ var init_src7 = __esm(() => {
347967
347967
  init_pricing();
347968
347968
  });
347969
347969
 
347970
+ // ../api/src/services/batch-pricing.ts
347971
+ function computeEstimatedCostCents(counts, pricing = BATCH_PRICING_V1) {
347972
+ const audioUsd = counts.audioCount * pricing.audioAvgMinutes * pricing.audioPerMinuteUsd;
347973
+ const imageUsd = counts.imageCount / 1000 * pricing.imagePer1kUsd;
347974
+ const videoUsd = counts.videoCount / 1000 * pricing.videoPer1kUsd;
347975
+ const documentUsd = counts.documentCount / 1000 * pricing.documentPer1kUsd;
347976
+ const totalUsd = audioUsd + imageUsd + videoUsd + documentUsd;
347977
+ return Math.ceil(totalUsd * 100);
347978
+ }
347979
+ var BATCH_PRICING_V1;
347980
+ var init_batch_pricing = __esm(() => {
347981
+ BATCH_PRICING_V1 = {
347982
+ audioPerMinuteUsd: 0.04 / 60,
347983
+ audioAvgMinutes: 40 / 60,
347984
+ imagePer1kUsd: 0.15,
347985
+ videoPer1kUsd: 9,
347986
+ documentPer1kUsd: 0.5
347987
+ };
347988
+ });
347989
+
347970
347990
  // ../api/src/services/media-storage.ts
347971
347991
  import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync8, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
347972
347992
  import { dirname as dirname8, extname as extname2, join as join18, relative as relative2 } from "path";
@@ -348306,7 +348326,7 @@ class BatchJobService {
348306
348326
  else if (type === "document")
348307
348327
  counts.documentCount++;
348308
348328
  }
348309
- const estimatedCostCents = counts.audioCount * 10 + counts.imageCount * 1 + counts.videoCount * 2 + counts.documentCount * 0;
348329
+ const estimatedCostCents = computeEstimatedCostCents(counts);
348310
348330
  const avgDelayMs = (BatchJobService.DEFAULT_DELAY_MIN_MS + BatchJobService.DEFAULT_DELAY_MAX_MS) / 2;
348311
348331
  const estimatedDurationMinutes = Math.ceil(items.length * (BatchJobService.AVG_PROCESSING_TIME_MS + avgDelayMs) / 60000);
348312
348332
  return {
@@ -348667,6 +348687,7 @@ var init_batch_jobs = __esm(() => {
348667
348687
  init_src5();
348668
348688
  init_src7();
348669
348689
  init_drizzle_orm();
348690
+ init_batch_pricing();
348670
348691
  init_media_storage();
348671
348692
  log76 = createLogger("services:batch-jobs");
348672
348693
  PROCESSABLE_CONTENT_TYPES = new Set(["audio", "image", "video", "document"]);
@@ -363740,7 +363761,19 @@ function resolveContactName2(chat2, contactNames) {
363740
363761
  }
363741
363762
  return;
363742
363763
  }
363743
- var chatsRoutes, ChatTypeSchema, listQuerySchema6, createChatSchema, updateChatSchema, addParticipantSchema, updateParticipantRoleSchema, chatChannelActionSchema, muteActionSchema, labelBodySchema, markChatReadSchema, disappearingSchema, DISAPPEARING_DURATIONS, syncNamesSchema, clearSessionSchema;
363764
+ var chatsRoutes, ChatTypeSchema, listQuerySchema6, createChatSchema, updateChatSchema, addParticipantSchema, updateParticipantRoleSchema, chatChannelActionSchema, muteActionSchema, labelBodySchema, optionalDateParam = (paramName) => exports_external.string().optional().transform((v2, ctx) => {
363765
+ if (v2 === undefined || v2 === "")
363766
+ return;
363767
+ const parsed = new Date(v2);
363768
+ if (Number.isNaN(parsed.getTime())) {
363769
+ ctx.addIssue({
363770
+ code: exports_external.ZodIssueCode.custom,
363771
+ message: `invalid ${paramName} parameter: expected ISO 8601 date string, got "${v2}"`
363772
+ });
363773
+ return exports_external.NEVER;
363774
+ }
363775
+ return parsed;
363776
+ }), listMessagesQuerySchema, markChatReadSchema, disappearingSchema, DISAPPEARING_DURATIONS, syncNamesSchema, clearSessionSchema;
363744
363777
  var init_chats2 = __esm(() => {
363745
363778
  init_dist6();
363746
363779
  init_src();
@@ -363991,17 +364024,20 @@ var init_chats2 = __esm(() => {
363991
364024
  const participant = await services.chats.updateParticipantRole(chatId, platformUserId, role);
363992
364025
  return c.json({ data: participant });
363993
364026
  });
363994
- chatsRoutes.get("/:id/messages", async (c) => {
364027
+ listMessagesQuerySchema = exports_external.object({
364028
+ limit: exports_external.coerce.number().int().min(1).max(1000).default(100),
364029
+ before: optionalDateParam("before"),
364030
+ after: optionalDateParam("after"),
364031
+ mediaOnly: exports_external.string().optional().transform((v2) => v2 === "true")
364032
+ });
364033
+ chatsRoutes.get("/:id/messages", zValidator("query", listMessagesQuerySchema), async (c) => {
363995
364034
  const chatId = c.req.param("id");
363996
- const limit2 = Number.parseInt(c.req.query("limit") ?? "100", 10);
363997
- const before = c.req.query("before");
363998
- const after = c.req.query("after");
363999
- const mediaOnly = c.req.query("mediaOnly") === "true";
364035
+ const { limit: limit2, before, after, mediaOnly } = c.req.valid("query");
364000
364036
  const services = c.get("services");
364001
364037
  const messages4 = await services.messages.getChatMessages(chatId, {
364002
364038
  limit: limit2,
364003
- before: before ? new Date(before) : undefined,
364004
- after: after ? new Date(after) : undefined,
364039
+ before,
364040
+ after,
364005
364041
  mediaOnly
364006
364042
  });
364007
364043
  return c.json({ items: messages4 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260421.6",
3
+ "version": "2.260422.2",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,14 +36,14 @@
36
36
  "qrcode-terminal": "^0.12.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@omni/api": "2.260421.5",
40
- "@omni/channel-discord": "2.260421.5",
41
- "@omni/channel-sdk": "2.260421.5",
42
- "@omni/channel-slack": "2.260421.5",
43
- "@omni/channel-telegram": "2.260421.5",
44
- "@omni/channel-whatsapp": "2.260421.5",
45
- "@omni/core": "2.260421.5",
46
- "@omni/sdk": "2.260421.5",
39
+ "@omni/api": "2.260422.1",
40
+ "@omni/channel-discord": "2.260422.1",
41
+ "@omni/channel-sdk": "2.260422.1",
42
+ "@omni/channel-slack": "2.260422.1",
43
+ "@omni/channel-telegram": "2.260422.1",
44
+ "@omni/channel-whatsapp": "2.260422.1",
45
+ "@omni/core": "2.260422.1",
46
+ "@omni/sdk": "2.260422.1",
47
47
  "@types/node": "^22.10.3",
48
48
  "@types/qrcode-terminal": "^0.12.2",
49
49
  "typescript": "^5.7.3"