@automagik/omni 2.260323.1 → 2.260325.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-routes.d.ts","sourceRoot":"","sources":["../../src/commands/agent-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkKpC,wBAAgB,mBAAmB,IAAI,OAAO,CAiM7C"}
1
+ {"version":3,"file":"agent-routes.d.ts","sourceRoot":"","sources":["../../src/commands/agent-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmKpC,wBAAgB,mBAAmB,IAAI,OAAO,CAmM7C"}
package/dist/index.js CHANGED
@@ -76643,7 +76643,7 @@ import { fileURLToPath } from "url";
76643
76643
  // package.json
76644
76644
  var package_default = {
76645
76645
  name: "@automagik/omni",
76646
- version: "2.260323.1",
76646
+ version: "2.260325.1",
76647
76647
  description: "LLM-optimized CLI for Omni v2",
76648
76648
  type: "module",
76649
76649
  bin: {
@@ -77174,6 +77174,24 @@ ${ids}`);
77174
77174
  }
77175
77175
  error(`No batch job found matching "${input}"`);
77176
77176
  }
77177
+ async function resolveRouteId(instanceId, input) {
77178
+ if (UUID_RE.test(input))
77179
+ return input;
77180
+ const client = getClient();
77181
+ const routes = await client.routes.list(instanceId, {});
77182
+ if (/^[0-9a-f]{2,}$/i.test(input)) {
77183
+ const matches = routes.filter((r) => r.id.toLowerCase().startsWith(input.toLowerCase()));
77184
+ if (matches.length === 1)
77185
+ return matches[0].id;
77186
+ if (matches.length > 1) {
77187
+ const ids = matches.map((r) => ` ${r.id} ${r.scope} (${r.isActive ? "active" : "inactive"})`).join(`
77188
+ `);
77189
+ error(`Ambiguous ID prefix "${input}" matches ${matches.length} routes:
77190
+ ${ids}`);
77191
+ }
77192
+ }
77193
+ error(`No route found matching "${input}"`);
77194
+ }
77177
77195
 
77178
77196
  // src/commands/agent-routes.ts
77179
77197
  function formatReplyFilter(f) {
@@ -77246,6 +77264,7 @@ async function updateAgentRouteAction(routeId, options) {
77246
77264
  return;
77247
77265
  }
77248
77266
  const instanceId = await resolveInstanceId(options.instance);
77267
+ const resolvedRouteId = await resolveRouteId(instanceId, routeId);
77249
77268
  const updates = {};
77250
77269
  if (options.agent)
77251
77270
  updates.agentId = options.agent;
@@ -77279,7 +77298,7 @@ async function updateAgentRouteAction(routeId, options) {
77279
77298
  error("No updates provided");
77280
77299
  return;
77281
77300
  }
77282
- const route = await client.routes.update(instanceId, routeId, updates);
77301
+ const route = await client.routes.update(instanceId, resolvedRouteId, updates);
77283
77302
  success("Route updated");
77284
77303
  data(route);
77285
77304
  } catch (err) {
@@ -77314,10 +77333,11 @@ function createRoutesCommand() {
77314
77333
  error(`Failed to list routes: ${message}`);
77315
77334
  }
77316
77335
  });
77317
- routes.command("get <routeId>").description("Get agent route details").requiredOption("--instance <id>", "Instance ID").action(async (routeId, options) => {
77336
+ routes.command("get <routeId>").description("Get agent route details").requiredOption("--instance <id>", "Instance ID").action(async (routeIdInput, options) => {
77318
77337
  const client = getClient();
77319
77338
  try {
77320
77339
  const instanceId = await resolveInstanceId(options.instance);
77340
+ const routeId = await resolveRouteId(instanceId, routeIdInput);
77321
77341
  const route = await client.routes.get(instanceId, routeId);
77322
77342
  data(route);
77323
77343
  } catch (err) {
@@ -77327,10 +77347,11 @@ function createRoutesCommand() {
77327
77347
  });
77328
77348
  routes.command("create").description("Create a new agent route").requiredOption("--instance <id>", "Instance ID").requiredOption("--scope <scope>", "Route scope: chat or user").option("--chat <chatId>", "Chat UUID (required when scope=chat)").option("--person <personId>", "Person UUID (required when scope=user)").requiredOption("--agent <agentId>", "Agent UUID (FK to agents table)").option("--timeout <seconds>", "Agent timeout in seconds", Number.parseInt).option("--stream", "Enable streaming responses").option("--no-stream", "Disable streaming responses").option("--prefix-sender", "Prefix messages with sender name").option("--no-prefix-sender", "Do not prefix messages with sender name").option("--wait-media", "Wait for media processing").option("--no-wait-media", "Do not wait for media processing").option("--send-media-path", "Include file path in media text").option("--no-send-media-path", "Do not include file path in media text").option("--gate", "Enable LLM response gate").option("--no-gate", "Disable LLM response gate").option("--gate-model <model>", "Response gate model").option("--gate-prompt <prompt>", "Response gate prompt").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--label <label>", "Human-readable label for this route").option("--priority <number>", "Priority (higher = higher priority)", Number.parseInt, 0).option("--inactive", "Create route as inactive").action(createAgentRouteAction);
77329
77349
  routes.command("update <routeId>").description("Update an existing agent route").requiredOption("--instance <id>", "Instance ID").option("--agent <agentId>", "Agent UUID (FK to agents table)").option("--timeout <seconds>", "Agent timeout in seconds", Number.parseInt).option("--stream", "Enable streaming responses").option("--no-stream", "Disable streaming responses (set to null)").option("--prefix-sender", "Prefix messages with sender name").option("--no-prefix-sender", "Do not prefix messages with sender name (set to null)").option("--wait-media", "Wait for media processing").option("--no-wait-media", "Do not wait for media processing (set to null)").option("--send-media-path", "Include file path in media text").option("--no-send-media-path", "Do not include file path in media text (set to null)").option("--gate", "Enable LLM response gate").option("--no-gate", "Disable LLM response gate (set to null)").option("--gate-model <model>", "Response gate model").option("--gate-prompt <prompt>", "Response gate prompt").option("--reply-filter-mode <mode>", "Reply filter: all or filtered").option("--label <label>", "Human-readable label for this route").option("--priority <number>", "Priority (higher = higher priority)", Number.parseInt).option("--active", "Activate route").option("--inactive", "Deactivate route").action(updateAgentRouteAction);
77330
- routes.command("delete <routeId>").description("Delete an agent route").requiredOption("--instance <id>", "Instance ID").action(async (routeId, options) => {
77350
+ routes.command("delete <routeId>").description("Delete an agent route").requiredOption("--instance <id>", "Instance ID").action(async (routeIdInput, options) => {
77331
77351
  const client = getClient();
77332
77352
  try {
77333
77353
  const instanceId = await resolveInstanceId(options.instance);
77354
+ const routeId = await resolveRouteId(instanceId, routeIdInput);
77334
77355
  await client.routes.delete(instanceId, routeId);
77335
77356
  success("Route deleted");
77336
77357
  } catch (err) {
package/dist/resolve.d.ts CHANGED
@@ -97,4 +97,18 @@ export declare function resolveAutomationId(input: string): Promise<string>;
97
97
  * Exits with error if no match or ambiguous.
98
98
  */
99
99
  export declare function resolveBatchJobId(input: string): Promise<string>;
100
+ /**
101
+ * Resolve an agent route identifier to a UUID.
102
+ *
103
+ * Routes are scoped to an instance, so instanceId must already be resolved.
104
+ *
105
+ * Matches in order:
106
+ * 1. Exact UUID match (skip API call)
107
+ * 2. UUID prefix match (minimum 2 hex chars)
108
+ *
109
+ * Routes don't have names, only IDs.
110
+ *
111
+ * Exits with error if no match or ambiguous.
112
+ */
113
+ export declare function resolveRouteId(instanceId: string, input: string): Promise<string>;
100
114
  //# sourceMappingURL=resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BtE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BlE;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYrE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwCtF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBpE;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,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AC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBvF"}
@@ -222965,7 +222965,7 @@ var init_sentry_scrub = __esm(() => {
222965
222965
  var require_package8 = __commonJS((exports, module) => {
222966
222966
  module.exports = {
222967
222967
  name: "@omni/api",
222968
- version: "2.260323.1",
222968
+ version: "2.260325.1",
222969
222969
  type: "module",
222970
222970
  exports: {
222971
222971
  ".": {
@@ -338105,7 +338105,7 @@ async function processMessageMedia(ctx, payload, metadata) {
338105
338105
  const processingType = result.processingType ?? inferProcessingType(content.type);
338106
338106
  const errorColumn = getContentFieldForType(processingType, content.type);
338107
338107
  if (errorColumn) {
338108
- const marker = `[media processing failed: ${reason}]`;
338108
+ const marker = `[error: media processing failed \u2014 ${reason}]`;
338109
338109
  await ctx.db.update(messages2).set({ [errorColumn]: marker }).where(eq(messages2.id, media.messageId));
338110
338110
  }
338111
338111
  await ctx.eventBus.publish("media.processing.failed", {
@@ -338197,9 +338197,24 @@ async function setupMediaProcessor(eventBus, db2, services) {
338197
338197
  try {
338198
338198
  const crashProcessingType = inferProcessingType(content.type);
338199
338199
  const crashReason = `unexpected: ${String(error2)}`;
338200
+ let crashMediaId = payload.externalId;
338201
+ try {
338202
+ const chat2 = await ctx.services.chats.findByExternalIdSmart(metadata.instanceId, payload.chatId);
338203
+ if (chat2) {
338204
+ const msg = await ctx.services.messages.getByExternalId(chat2.id, payload.externalId);
338205
+ if (msg)
338206
+ crashMediaId = msg.id;
338207
+ }
338208
+ } catch (lookupError) {
338209
+ log85.debug("Failed to resolve DB message UUID for crash handler, falling back to externalId", {
338210
+ error: String(lookupError),
338211
+ instanceId: metadata.instanceId,
338212
+ chatId: payload.chatId
338213
+ });
338214
+ }
338200
338215
  await ctx.eventBus.publish("media.processing.failed", {
338201
338216
  eventId: event.id,
338202
- mediaId: payload.externalId,
338217
+ mediaId: crashMediaId,
338203
338218
  processingType: crashProcessingType,
338204
338219
  error: crashReason,
338205
338220
  provider: "unknown",
@@ -338207,7 +338222,7 @@ async function setupMediaProcessor(eventBus, db2, services) {
338207
338222
  }, { instanceId: metadata.instanceId, channelType: metadata.channelType });
338208
338223
  await ctx.eventBus.publish("media.processed", {
338209
338224
  eventId: event.id,
338210
- mediaId: payload.externalId,
338225
+ mediaId: crashMediaId,
338211
338226
  processingType: crashProcessingType,
338212
338227
  content: "",
338213
338228
  error: crashReason
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,0DAA0D;AAC1D,wBAAgB,mBAAmB,IAAI,OAAO,CAc7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAqCrD;AA0DD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA4BrF;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAOpD"}
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwBH,0DAA0D;AAC1D,wBAAgB,mBAAmB,IAAI,OAAO,CAc7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAqCrD;AA0ED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA4BrF;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAOpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260323.1",
3
+ "version": "2.260325.1",
4
4
  "description": "LLM-optimized CLI for Omni v2",
5
5
  "type": "module",
6
6
  "bin": {