@automagik/omni 2.260520.20 → 2.260524.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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A2A Commands
3
+ *
4
+ * omni a2a list [--include-unconfigured]
5
+ * omni a2a card <agent-id>
6
+ * omni a2a send <instance-id> --text <message> [--context <id>] [--task <id>] [--wait]
7
+ */
8
+ import { Command } from 'commander';
9
+ export declare function createA2ACommand(): Command;
10
+ //# sourceMappingURL=a2a.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../src/commands/a2a.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,gBAAgB,IAAI,OAAO,CAmE1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/commands/instances.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgMpC,wBAAgB,sBAAsB,IAAI,OAAO,CAkuChD"}
1
+ {"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/commands/instances.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiMpC,wBAAgB,sBAAsB,IAAI,OAAO,CAkuChD"}
package/dist/index.js CHANGED
@@ -24083,11 +24083,13 @@ async function getStreamInfo(jsm) {
24083
24083
  }
24084
24084
  return result;
24085
24085
  }
24086
- var import_nats, log, STREAM_NAMES, daysToNs = (days) => days * 24 * 60 * 60 * 1e9, STREAM_CONFIGS;
24086
+ var nats, log, NATS_STORAGE_FILE, NATS_RETENTION_LIMITS, STREAM_NAMES, daysToNs = (days) => days * 24 * 60 * 60 * 1e9, STREAM_CONFIGS;
24087
24087
  var init_streams = __esm(() => {
24088
24088
  init_logger();
24089
- import_nats = __toESM(require_mod4(), 1);
24089
+ nats = __toESM(require_mod4(), 1);
24090
24090
  log = createLogger("nats:streams");
24091
+ NATS_STORAGE_FILE = nats.StorageType.File;
24092
+ NATS_RETENTION_LIMITS = nats.RetentionPolicy.Limits;
24091
24093
  STREAM_NAMES = {
24092
24094
  MESSAGE: "MESSAGE",
24093
24095
  REACTION: "REACTION",
@@ -24105,80 +24107,80 @@ var init_streams = __esm(() => {
24105
24107
  name: STREAM_NAMES.MESSAGE,
24106
24108
  subjects: ["message.>"],
24107
24109
  max_age: daysToNs(30),
24108
- storage: import_nats.StorageType.File,
24109
- retention: import_nats.RetentionPolicy.Limits,
24110
+ storage: NATS_STORAGE_FILE,
24111
+ retention: NATS_RETENTION_LIMITS,
24110
24112
  description: "All message lifecycle events (received, sent, delivered, read, failed)"
24111
24113
  },
24112
24114
  [STREAM_NAMES.REACTION]: {
24113
24115
  name: STREAM_NAMES.REACTION,
24114
24116
  subjects: ["reaction.>"],
24115
24117
  max_age: daysToNs(7),
24116
- storage: import_nats.StorageType.File,
24117
- retention: import_nats.RetentionPolicy.Limits,
24118
+ storage: NATS_STORAGE_FILE,
24119
+ retention: NATS_RETENTION_LIMITS,
24118
24120
  description: "Reaction events (received, removed)"
24119
24121
  },
24120
24122
  [STREAM_NAMES.INSTANCE]: {
24121
24123
  name: STREAM_NAMES.INSTANCE,
24122
24124
  subjects: ["instance.>"],
24123
24125
  max_age: daysToNs(7),
24124
- storage: import_nats.StorageType.File,
24125
- retention: import_nats.RetentionPolicy.Limits,
24126
+ storage: NATS_STORAGE_FILE,
24127
+ retention: NATS_RETENTION_LIMITS,
24126
24128
  description: "Instance lifecycle events (connected, disconnected, qr_code)"
24127
24129
  },
24128
24130
  [STREAM_NAMES.IDENTITY]: {
24129
24131
  name: STREAM_NAMES.IDENTITY,
24130
24132
  subjects: ["identity.>"],
24131
24133
  max_age: daysToNs(90),
24132
- storage: import_nats.StorageType.File,
24133
- retention: import_nats.RetentionPolicy.Limits,
24134
+ storage: NATS_STORAGE_FILE,
24135
+ retention: NATS_RETENTION_LIMITS,
24134
24136
  description: "Identity management events (created, linked, merged, unlinked)"
24135
24137
  },
24136
24138
  [STREAM_NAMES.MEDIA]: {
24137
24139
  name: STREAM_NAMES.MEDIA,
24138
24140
  subjects: ["media.>"],
24139
24141
  max_age: daysToNs(7),
24140
- storage: import_nats.StorageType.File,
24141
- retention: import_nats.RetentionPolicy.Limits,
24142
+ storage: NATS_STORAGE_FILE,
24143
+ retention: NATS_RETENTION_LIMITS,
24142
24144
  description: "Media processing events (received, processed)"
24143
24145
  },
24144
24146
  [STREAM_NAMES.ACCESS]: {
24145
24147
  name: STREAM_NAMES.ACCESS,
24146
24148
  subjects: ["access.>"],
24147
24149
  max_age: daysToNs(30),
24148
- storage: import_nats.StorageType.File,
24149
- retention: import_nats.RetentionPolicy.Limits,
24150
+ storage: NATS_STORAGE_FILE,
24151
+ retention: NATS_RETENTION_LIMITS,
24150
24152
  description: "Access control events (allowed, denied)"
24151
24153
  },
24152
24154
  [STREAM_NAMES.SESSION]: {
24153
24155
  name: STREAM_NAMES.SESSION,
24154
24156
  subjects: ["session.>"],
24155
24157
  max_age: daysToNs(7),
24156
- storage: import_nats.StorageType.File,
24157
- retention: import_nats.RetentionPolicy.Limits,
24158
+ storage: NATS_STORAGE_FILE,
24159
+ retention: NATS_RETENTION_LIMITS,
24158
24160
  description: "Session lifecycle events (reset)"
24159
24161
  },
24160
24162
  [STREAM_NAMES.CUSTOM]: {
24161
24163
  name: STREAM_NAMES.CUSTOM,
24162
24164
  subjects: ["custom.>"],
24163
24165
  max_age: daysToNs(7),
24164
- storage: import_nats.StorageType.File,
24165
- retention: import_nats.RetentionPolicy.Limits,
24166
+ storage: NATS_STORAGE_FILE,
24167
+ retention: NATS_RETENTION_LIMITS,
24166
24168
  description: "User-defined custom events (webhooks, triggers, etc.)"
24167
24169
  },
24168
24170
  [STREAM_NAMES.SYSTEM]: {
24169
24171
  name: STREAM_NAMES.SYSTEM,
24170
24172
  subjects: ["system.>", "sync.>", "batch-job.>", "presence.>", "chat.>", "follow_up.>"],
24171
24173
  max_age: daysToNs(7),
24172
- storage: import_nats.StorageType.File,
24173
- retention: import_nats.RetentionPolicy.Limits,
24174
+ storage: NATS_STORAGE_FILE,
24175
+ retention: NATS_RETENTION_LIMITS,
24174
24176
  description: "Internal system events (dead_letter, replay, health, sync, batch-job, presence, chat, follow_up)"
24175
24177
  },
24176
24178
  [STREAM_NAMES.AGENT]: {
24177
24179
  name: STREAM_NAMES.AGENT,
24178
24180
  subjects: ["agent.>"],
24179
24181
  max_age: daysToNs(30),
24180
- storage: import_nats.StorageType.File,
24181
- retention: import_nats.RetentionPolicy.Limits,
24182
+ storage: NATS_STORAGE_FILE,
24183
+ retention: NATS_RETENTION_LIMITS,
24182
24184
  description: "Agent lifecycle events (state, tasks, A2A, internal routing)"
24183
24185
  }
24184
24186
  };
@@ -24195,7 +24197,7 @@ function buildConsumerConfig(pattern, options = {}) {
24195
24197
  } = options;
24196
24198
  const config2 = {
24197
24199
  filter_subject: pattern,
24198
- ack_policy: import_nats2.AckPolicy.Explicit,
24200
+ ack_policy: nats2.AckPolicy.Explicit,
24199
24201
  ack_wait: ackWaitMs * 1e6,
24200
24202
  max_deliver: maxRetries + 1,
24201
24203
  max_ack_pending: DEFAULT_CONSUMER_CONFIG.maxAckPending,
@@ -24213,15 +24215,15 @@ function buildConsumerConfig(pattern, options = {}) {
24213
24215
  }
24214
24216
  function mapStartFrom(startFrom) {
24215
24217
  if (startFrom instanceof Date) {
24216
- return import_nats2.DeliverPolicy.StartTime;
24218
+ return nats2.DeliverPolicy.StartTime;
24217
24219
  }
24218
24220
  switch (startFrom) {
24219
24221
  case "first":
24220
- return import_nats2.DeliverPolicy.All;
24222
+ return nats2.DeliverPolicy.All;
24221
24223
  case "last":
24222
- return import_nats2.DeliverPolicy.Last;
24224
+ return nats2.DeliverPolicy.Last;
24223
24225
  default:
24224
- return import_nats2.DeliverPolicy.New;
24226
+ return nats2.DeliverPolicy.New;
24225
24227
  }
24226
24228
  }
24227
24229
  function generateConsumerName(pattern) {
@@ -24244,10 +24246,10 @@ function calculateBackoffDelay(retryCount, baseDelayMs = DEFAULT_CONSUMER_CONFIG
24244
24246
  const jitter = delay * 0.1 * (Math.random() * 2 - 1);
24245
24247
  return Math.floor(Math.min(delay + jitter, maxDelayMs));
24246
24248
  }
24247
- var import_nats2, DEFAULT_CONSUMER_CONFIG;
24249
+ var nats2, DEFAULT_CONSUMER_CONFIG;
24248
24250
  var init_consumer = __esm(() => {
24249
24251
  init_streams();
24250
- import_nats2 = __toESM(require_mod4(), 1);
24252
+ nats2 = __toESM(require_mod4(), 1);
24251
24253
  DEFAULT_CONSUMER_CONFIG = {
24252
24254
  maxRetries: 3,
24253
24255
  retryDelayMs: 1000,
@@ -28633,7 +28635,7 @@ function buildTraceHeaders() {
28633
28635
  return null;
28634
28636
  const flags = (ctx.traceFlags ?? 0).toString(16).padStart(2, "0");
28635
28637
  const traceparent = `00-${ctx.traceId}-${ctx.spanId}-${flags}`;
28636
- const h = import_nats3.headers();
28638
+ const h = import_nats.headers();
28637
28639
  h.set("traceparent", traceparent);
28638
28640
  h.set("x-trace-id", ctx.traceId);
28639
28641
  h.set("x-span-id", ctx.spanId);
@@ -28648,7 +28650,7 @@ class NatsEventBus {
28648
28650
  js = null;
28649
28651
  jsm = null;
28650
28652
  config;
28651
- sc = import_nats3.StringCodec();
28653
+ sc = import_nats.StringCodec();
28652
28654
  subscriptionManager = new SubscriptionManager;
28653
28655
  connectionAttempts = 0;
28654
28656
  isClosing = false;
@@ -28681,7 +28683,7 @@ class NatsEventBus {
28681
28683
  }
28682
28684
  try {
28683
28685
  this.connectionAttempts++;
28684
- this.nc = await import_nats3.connect(connectionOptions);
28686
+ this.nc = await import_nats.connect(connectionOptions);
28685
28687
  this.setupConnectionHandlers();
28686
28688
  this.js = this.nc.jetstream();
28687
28689
  this.jsm = await this.nc.jetstreamManager();
@@ -28956,7 +28958,7 @@ async function connectEventBus(config2) {
28956
28958
  await bus.connect();
28957
28959
  return bus;
28958
28960
  }
28959
- var import_api2, import_nats3, log4, DEFAULTS;
28961
+ var import_api2, import_nats, log4, DEFAULTS;
28960
28962
  var init_client = __esm(() => {
28961
28963
  init_logger();
28962
28964
  init_consumer();
@@ -28964,7 +28966,7 @@ var init_client = __esm(() => {
28964
28966
  init_streams();
28965
28967
  init_subscription();
28966
28968
  import_api2 = __toESM(require_src(), 1);
28967
- import_nats3 = __toESM(require_mod4(), 1);
28969
+ import_nats = __toESM(require_mod4(), 1);
28968
28970
  log4 = createLogger("nats");
28969
28971
  DEFAULTS = {
28970
28972
  url: "nats://localhost:4222",
@@ -29214,8 +29216,10 @@ var init_common = __esm(() => {
29214
29216
  "discord",
29215
29217
  "slack",
29216
29218
  "telegram",
29219
+ "a2a",
29217
29220
  "gupshup",
29218
- "twilio-whatsapp"
29221
+ "twilio-whatsapp",
29222
+ "internal"
29219
29223
  ]);
29220
29224
  ContentTypeSchema = exports_external.enum([
29221
29225
  "text",
@@ -29244,6 +29248,7 @@ var init_agent2 = __esm(() => {
29244
29248
  AgentCardSchema = exports_external.object({
29245
29249
  name: exports_external.string(),
29246
29250
  url: exports_external.string().optional(),
29251
+ supportedInterfaces: exports_external.array(exports_external.unknown()).optional(),
29247
29252
  version: exports_external.string().optional(),
29248
29253
  skills: exports_external.array(exports_external.unknown()).optional()
29249
29254
  }).passthrough();
@@ -29277,7 +29282,8 @@ var init_agent2 = __esm(() => {
29277
29282
  configPath: exports_external.string().optional(),
29278
29283
  isInternal: exports_external.boolean().default(false),
29279
29284
  isActive: exports_external.boolean().default(true),
29280
- metadata: MetadataSchema.optional()
29285
+ metadata: MetadataSchema.optional(),
29286
+ agentCard: AgentCardSchema.optional()
29281
29287
  });
29282
29288
  UpdateAgentSchema = CreateAgentSchema.partial();
29283
29289
  });
@@ -61849,7 +61855,7 @@ class A2AClient {
61849
61855
  }
61850
61856
  async run(request) {
61851
61857
  const startMs = Date.now();
61852
- const body = this.buildJsonRpcRequest("message/send", request);
61858
+ const body = this.buildJsonRpcRequest("SendMessage", request);
61853
61859
  const response = await this.post(body, request.timeoutMs ?? this.defaultTimeoutMs);
61854
61860
  if (!response.ok) {
61855
61861
  throw new ProviderError(`A2A request failed: ${response.status}`, "SERVER_ERROR", response.status);
@@ -61866,13 +61872,13 @@ class A2AClient {
61866
61872
  throw new ProviderError("A2A response missing task.id", "INVALID_RESPONSE");
61867
61873
  }
61868
61874
  const state = task?.status?.state;
61869
- if (state === "completed" || state === "failed") {
61875
+ if (isTerminalState(state)) {
61870
61876
  return this.taskToProviderResponse(task, taskId, startMs);
61871
61877
  }
61872
61878
  return this.pollUntilComplete(taskId, startMs, request.timeoutMs ?? this.defaultTimeoutMs);
61873
61879
  }
61874
61880
  async* stream(request) {
61875
- const body = this.buildJsonRpcRequest("message/stream", request);
61881
+ const body = this.buildJsonRpcRequest("SendStreamingMessage", request);
61876
61882
  const controller = new AbortController;
61877
61883
  const timeoutMs = request.timeoutMs ?? this.defaultTimeoutMs;
61878
61884
  const timer = setTimeout(() => controller.abort(), timeoutMs);
@@ -61909,16 +61915,18 @@ class A2AClient {
61909
61915
  const response = await fetch(this.baseUrl, {
61910
61916
  method: "POST",
61911
61917
  headers: this.headers({ "Content-Type": "application/json" }),
61912
- body: JSON.stringify({ jsonrpc: "2.0", id: "health", method: "tasks/get", params: { id: "ping" } }),
61918
+ body: JSON.stringify({ jsonrpc: "2.0", id: "health", method: "GetTask", params: { id: "ping" } }),
61913
61919
  signal: AbortSignal.timeout(5000)
61914
61920
  });
61915
- return { healthy: response.ok, latencyMs: Date.now() - start };
61921
+ const healthy = response.status < 500 && response.status !== 401 && response.status !== 403;
61922
+ return { healthy, latencyMs: Date.now() - start, error: healthy ? undefined : `HTTP ${response.status}` };
61916
61923
  } catch (error2) {
61917
61924
  return { healthy: false, latencyMs: Date.now() - start, error: String(error2) };
61918
61925
  }
61919
61926
  }
61920
61927
  headers(extra) {
61921
61928
  return {
61929
+ "A2A-Version": "1.0",
61922
61930
  ...this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {},
61923
61931
  ...extra
61924
61932
  };
@@ -61950,12 +61958,13 @@ class A2AClient {
61950
61958
  method,
61951
61959
  params: {
61952
61960
  message: {
61953
- role: "user",
61954
- parts: [{ type: "text", text: request.message }],
61961
+ role: "ROLE_USER",
61962
+ parts: [{ text: request.message, mediaType: "text/plain" }],
61955
61963
  messageId: `msg-${crypto.randomUUID()}`
61956
61964
  },
61957
61965
  configuration: {
61958
- acceptedOutputModes: ["text"]
61966
+ acceptedOutputModes: ["text/plain"],
61967
+ returnImmediately: true
61959
61968
  },
61960
61969
  contextId: request.sessionId
61961
61970
  }
@@ -61998,13 +62007,49 @@ class A2AClient {
61998
62007
  }
61999
62008
  }
62000
62009
  parseSSEEvent(event) {
62010
+ const result = event.result ?? event;
62011
+ return this.parseArtifactUpdate(result) ?? this.parseStatusUpdate(result) ?? this.parseLegacySSEEvent(event);
62012
+ }
62013
+ parseArtifactUpdate(result) {
62014
+ const artifactUpdate = result.taskArtifactUpdate ?? result.artifactUpdate ?? result.artifact_update;
62015
+ if (artifactUpdate) {
62016
+ const artifact = artifactUpdate.artifact;
62017
+ if (!artifact)
62018
+ return null;
62019
+ const text = extractTextFromParts(artifact.parts ?? []);
62020
+ if (!text)
62021
+ return null;
62022
+ return {
62023
+ event: "artifact",
62024
+ content: text,
62025
+ isComplete: false,
62026
+ runId: artifactUpdate.taskId
62027
+ };
62028
+ }
62029
+ return null;
62030
+ }
62031
+ parseStatusUpdate(result) {
62032
+ const statusUpdate = result.taskStatusUpdate ?? result.statusUpdate ?? result.status_update;
62033
+ if (statusUpdate) {
62034
+ const status = statusUpdate.status;
62035
+ const state = status?.state;
62036
+ if (isTerminalState(state)) {
62037
+ return {
62038
+ event: "final",
62039
+ isComplete: true,
62040
+ runId: statusUpdate.taskId
62041
+ };
62042
+ }
62043
+ }
62044
+ return null;
62045
+ }
62046
+ parseLegacySSEEvent(event) {
62001
62047
  const type = event.type;
62002
62048
  if (type === "taskArtifactUpdateEvent") {
62003
62049
  const artifact = event.artifact;
62004
62050
  if (!artifact)
62005
62051
  return null;
62006
- const parts = artifact.parts ?? [];
62007
- const textParts = parts.filter((p11) => p11.type === "text").map((p11) => p11.text).join("");
62052
+ const textParts = extractTextFromParts(artifact.parts ?? []);
62008
62053
  if (!textParts)
62009
62054
  return null;
62010
62055
  return {
@@ -62017,7 +62062,7 @@ class A2AClient {
62017
62062
  if (type === "taskStatusUpdateEvent") {
62018
62063
  const status = event.status;
62019
62064
  const state = status?.state;
62020
- const isFinal = event.final === true || state === "completed" || state === "failed";
62065
+ const isFinal = event.final === true || isTerminalState(state);
62021
62066
  if (isFinal) {
62022
62067
  return {
62023
62068
  event: "final",
@@ -62033,11 +62078,9 @@ class A2AClient {
62033
62078
  const textParts = [];
62034
62079
  for (const artifact of artifacts) {
62035
62080
  const parts = artifact.parts ?? [];
62036
- for (const part of parts) {
62037
- if (part.type === "text" && part.text) {
62038
- textParts.push(part.text);
62039
- }
62040
- }
62081
+ const text = extractTextFromParts(parts);
62082
+ if (text)
62083
+ textParts.push(text);
62041
62084
  }
62042
62085
  const status = task?.status;
62043
62086
  const state = status?.state;
@@ -62046,7 +62089,7 @@ class A2AClient {
62046
62089
  `),
62047
62090
  runId: taskId,
62048
62091
  sessionId: task?.contextId ?? taskId,
62049
- status: state === "failed" ? "failed" : "completed",
62092
+ status: state === "TASK_STATE_COMPLETED" || state === "completed" ? "completed" : "failed",
62050
62093
  metrics: {
62051
62094
  inputTokens: 0,
62052
62095
  outputTokens: 0,
@@ -62063,7 +62106,7 @@ class A2AClient {
62063
62106
  const body = {
62064
62107
  jsonrpc: "2.0",
62065
62108
  id: `poll-${attempt}`,
62066
- method: "tasks/get",
62109
+ method: "GetTask",
62067
62110
  params: { id: taskId }
62068
62111
  };
62069
62112
  const response = await this.post(body, Math.min(1e4, Math.max(0, deadline - Date.now())));
@@ -62082,7 +62125,7 @@ class A2AClient {
62082
62125
  const task = taskResult?.task;
62083
62126
  const status = task?.status;
62084
62127
  const state = status?.state;
62085
- if (state === "completed" || state === "failed") {
62128
+ if (isTerminalState(state)) {
62086
62129
  return this.taskToProviderResponse(task, taskId, startMs);
62087
62130
  }
62088
62131
  await sleep3(POLL_INTERVAL_MS);
@@ -62093,6 +62136,12 @@ class A2AClient {
62093
62136
  function sleep3(ms) {
62094
62137
  return new Promise((resolve2) => setTimeout(resolve2, ms));
62095
62138
  }
62139
+ function isTerminalState(state) {
62140
+ return state === "TASK_STATE_COMPLETED" || state === "TASK_STATE_FAILED" || state === "TASK_STATE_CANCELED" || state === "TASK_STATE_REJECTED" || state === "TASK_STATE_INPUT_REQUIRED" || state === "TASK_STATE_AUTH_REQUIRED" || state === "completed" || state === "failed" || state === "canceled";
62141
+ }
62142
+ function extractTextFromParts(parts) {
62143
+ return parts.filter((part) => typeof part.text === "string").map((part) => part.text).join("");
62144
+ }
62096
62145
  function createA2AClient(config2) {
62097
62146
  return new A2AClient(config2);
62098
62147
  }
@@ -62228,7 +62277,7 @@ class NatsGenieProvider {
62228
62277
  schema = "nats-genie";
62229
62278
  mode;
62230
62279
  nc = null;
62231
- sc = import_nats4.StringCodec();
62280
+ sc = import_nats2.StringCodec();
62232
62281
  replySubscription = null;
62233
62282
  constructor(id, name, config2) {
62234
62283
  this.id = id;
@@ -62386,7 +62435,7 @@ class NatsGenieProvider {
62386
62435
  async ensureConnected() {
62387
62436
  if (this.nc)
62388
62437
  return;
62389
- this.nc = await import_nats4.connect({
62438
+ this.nc = await import_nats2.connect({
62390
62439
  servers: this.config.natsUrl,
62391
62440
  name: `omni-nats-genie-${this.config.instanceId}`,
62392
62441
  reconnect: true,
@@ -62425,10 +62474,10 @@ class NatsGenieProvider {
62425
62474
  }
62426
62475
  }
62427
62476
  }
62428
- var import_nats4, log17;
62477
+ var import_nats2, log17;
62429
62478
  var init_nats_genie_provider = __esm(() => {
62430
62479
  init_logger();
62431
- import_nats4 = __toESM(require_mod4(), 1);
62480
+ import_nats2 = __toESM(require_mod4(), 1);
62432
62481
  log17 = createLogger("provider:nats-genie");
62433
62482
  });
62434
62483
 
@@ -122557,13 +122606,23 @@ function createOmniClient(config) {
122557
122606
  throw new OmniConfigError("apiKey is required");
122558
122607
  }
122559
122608
  const baseUrl = config.baseUrl.replace(/\/$/, "");
122609
+ const authHeader = config.authHeader ?? "x-api-key";
122610
+ const applyAuthHeaders = (headers) => {
122611
+ if (authHeader === "bearer") {
122612
+ headers.set("Authorization", `Bearer ${config.apiKey}`);
122613
+ headers.delete("x-api-key");
122614
+ } else {
122615
+ headers.set("x-api-key", config.apiKey);
122616
+ headers.delete("Authorization");
122617
+ }
122618
+ headers.set("Accept-Encoding", "identity");
122619
+ if (config.cliVersion) {
122620
+ headers.set("x-omni-cli-version", config.cliVersion);
122621
+ }
122622
+ };
122560
122623
  const authMiddleware = {
122561
122624
  async onRequest({ request }) {
122562
- request.headers.set("x-api-key", config.apiKey);
122563
- request.headers.set("Accept-Encoding", "identity");
122564
- if (config.cliVersion) {
122565
- request.headers.set("x-omni-cli-version", config.cliVersion);
122566
- }
122625
+ applyAuthHeaders(request.headers);
122567
122626
  if (config.signRequest) {
122568
122627
  const url = new URL(request.url);
122569
122628
  const path = `${url.pathname}${url.search}`;
@@ -122582,11 +122641,7 @@ function createOmniClient(config) {
122582
122641
  };
122583
122642
  const apiFetch = (url, init) => {
122584
122643
  const headers = new Headers(init?.headers);
122585
- headers.set("x-api-key", config.apiKey);
122586
- headers.set("Accept-Encoding", "identity");
122587
- if (config.cliVersion) {
122588
- headers.set("x-omni-cli-version", config.cliVersion);
122589
- }
122644
+ applyAuthHeaders(headers);
122590
122645
  if (config.signRequest) {
122591
122646
  const u = new URL(url);
122592
122647
  const path = `${u.pathname}${u.search}`;
@@ -124129,6 +124184,57 @@ function createOmniClient(config) {
124129
124184
  return json.data;
124130
124185
  }
124131
124186
  },
124187
+ a2a: {
124188
+ async listAgents(params) {
124189
+ const search = new URLSearchParams;
124190
+ if (params?.includeUnconfigured !== undefined) {
124191
+ search.set("includeUnconfigured", String(params.includeUnconfigured));
124192
+ }
124193
+ const suffix = search.toString() ? `?${search.toString()}` : "";
124194
+ const resp = await apiFetch(`${baseUrl}/api/v2/a2a/agents${suffix}`);
124195
+ const json = await resp.json();
124196
+ if (!resp.ok)
124197
+ throw OmniApiError.from(json, resp.status);
124198
+ return json.items ?? [];
124199
+ },
124200
+ async getAgentCard(agentId) {
124201
+ const resp = await apiFetch(`${baseUrl}/api/v2/a2a/agents/${agentId}/card`);
124202
+ const json = await resp.json();
124203
+ if (!resp.ok)
124204
+ throw OmniApiError.from(json, resp.status);
124205
+ if (!json.data)
124206
+ throw new OmniApiError("Agent Card not found", "NOT_FOUND", undefined, resp.status);
124207
+ return json.data;
124208
+ },
124209
+ async sendMessage(instanceId, text, options) {
124210
+ const body = {
124211
+ jsonrpc: "2.0",
124212
+ id: `sdk-${Date.now()}`,
124213
+ method: "SendMessage",
124214
+ params: {
124215
+ ...options?.taskId ? { taskId: options.taskId } : {},
124216
+ ...options?.contextId ? { contextId: options.contextId } : {},
124217
+ message: {
124218
+ role: "ROLE_USER",
124219
+ parts: [{ text, mediaType: "text/plain" }]
124220
+ },
124221
+ configuration: {
124222
+ returnImmediately: options?.returnImmediately ?? true
124223
+ }
124224
+ }
124225
+ };
124226
+ const resp = await apiFetch(`${baseUrl}/a2a/${instanceId}`, {
124227
+ method: "POST",
124228
+ headers: { "Content-Type": "application/json", "A2A-Version": "1.0" },
124229
+ body: JSON.stringify(body)
124230
+ });
124231
+ const json = await resp.json();
124232
+ if (!resp.ok || json.error) {
124233
+ throw new OmniApiError(json.error?.message ?? "A2A request failed", String(json.error?.code ?? "A2A_ERROR"), { data: json.error?.data }, resp.status);
124234
+ }
124235
+ return json.result;
124236
+ }
124237
+ },
124132
124238
  agents: {
124133
124239
  async list(params) {
124134
124240
  const { data, error, response } = await client.GET("/agents", {
@@ -124354,7 +124460,7 @@ import { fileURLToPath } from "url";
124354
124460
  // package.json
124355
124461
  var package_default = {
124356
124462
  name: "@automagik/omni",
124357
- version: "2.260520.20",
124463
+ version: "2.260524.1",
124358
124464
  description: "LLM-optimized CLI for Omni",
124359
124465
  type: "module",
124360
124466
  bin: {
@@ -124557,6 +124663,55 @@ function signRequestIfHandshook() {
124557
124663
  return (method, path, body) => ctx.signRequest(method, path, body);
124558
124664
  }
124559
124665
 
124666
+ // src/commands/a2a.ts
124667
+ init_output();
124668
+ function createA2ACommand() {
124669
+ const a2a = new Command("a2a").description("A2A agent registry and JSON-RPC helpers");
124670
+ a2a.command("list").description("List agents discoverable through A2A").option("--include-unconfigured", "Include active agents that do not have an active A2A instance").action(async (options) => {
124671
+ const client = getClient();
124672
+ try {
124673
+ const agents = await client.a2a.listAgents({ includeUnconfigured: options.includeUnconfigured });
124674
+ const rows = agents.map((agent) => ({
124675
+ id: agent.agentId,
124676
+ name: agent.name,
124677
+ configured: agent.configured ? "yes" : "no",
124678
+ instance: agent.instanceId ?? "-",
124679
+ provider: agent.providerSchema ?? agent.provider ?? "-",
124680
+ model: agent.model ?? "-"
124681
+ }));
124682
+ list(rows, { emptyMessage: "No A2A agents found.", rawData: agents });
124683
+ } catch (err) {
124684
+ const message = err instanceof Error ? err.message : "Unknown error";
124685
+ error(`Failed to list A2A agents: ${message}`);
124686
+ }
124687
+ });
124688
+ a2a.command("card <agent-id>").description("Get the extended A2A Agent Card for an agent").action(async (agentId) => {
124689
+ const client = getClient();
124690
+ try {
124691
+ const card = await client.a2a.getAgentCard(agentId);
124692
+ data(card);
124693
+ } catch (err) {
124694
+ const message = err instanceof Error ? err.message : "Unknown error";
124695
+ error(`Failed to get A2A Agent Card: ${message}`);
124696
+ }
124697
+ });
124698
+ a2a.command("send <instance-id>").description("Send a text message to an A2A instance").requiredOption("--text <message>", "Text message to send").option("--context <id>", "A2A context id").option("--task <id>", "A2A task id").option("--wait", "Wait for completion instead of returning immediately").action(async (instanceId, options) => {
124699
+ const client = getClient();
124700
+ try {
124701
+ const result = await client.a2a.sendMessage(instanceId, options.text, {
124702
+ contextId: options.context,
124703
+ taskId: options.task,
124704
+ returnImmediately: !options.wait
124705
+ });
124706
+ data(result);
124707
+ } catch (err) {
124708
+ const message = err instanceof Error ? err.message : "Unknown error";
124709
+ error(`Failed to send A2A message: ${message}`);
124710
+ }
124711
+ });
124712
+ return a2a;
124713
+ }
124714
+
124560
124715
  // src/commands/access.ts
124561
124716
  init_output();
124562
124717
  function createAccessCommand() {
@@ -131663,6 +131818,7 @@ var VALID_CHANNELS2 = [
131663
131818
  "discord",
131664
131819
  "slack",
131665
131820
  "telegram",
131821
+ "a2a",
131666
131822
  "gupshup",
131667
131823
  "twilio-whatsapp"
131668
131824
  ];
@@ -138173,6 +138329,12 @@ var COMMANDS = [
138173
138329
  helpGroup: "Core",
138174
138330
  helpDescription: "Voice channel operations (join, stream, sessions)"
138175
138331
  },
138332
+ {
138333
+ create: createA2ACommand,
138334
+ category: "standard",
138335
+ helpGroup: "Core",
138336
+ helpDescription: "A2A agent registry and JSON-RPC helpers"
138337
+ },
138176
138338
  {
138177
138339
  create: createChannelsCommand,
138178
138340
  category: "core",