marona 2.0.1 → 2.3.0

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
@@ -1,8 +1,12 @@
1
+ export { B2A, B2ARunner, B2AConnection } from "./b2a-runner.js";
2
+ export { B2ACodec } from "./b2a-codec.js";
1
3
  import { matchesSchema } from "./schema.js";
4
+ import { B2AClient } from "./b2a.js";
5
+ export { B2AClient, B2AIntent, B2AMessage, B2AProtocolError, B2A_VERSION } from "./b2a.js";
2
6
  import { A2ATaskStore, AgentCardResolver, A2AProtocolError, A2ASecurityError, A2ATaskError, a2aParts, parseA2ATask, parseA2AEvent, readA2AResponse, readA2AStream, unwrapA2A, validateA2AHost } from "./a2a.js";
3
7
  export { A2ATaskStore, AgentCardResolver, A2AError, A2ADiscoveryError, A2AProtocolError, A2ASecurityError, A2ATaskError } from "./a2a.js";
4
8
  export { A2AServer } from "./a2a-server.js";
5
- export const packageVersion = "2.0.1";
9
+ export const packageVersion = "2.3.0";
6
10
  const maronaApiKeyRequired = "Marona Developer Key is required.\n\n" +
7
11
  "Provide it through the SDK configuration or set the MARONA_API_KEY environment variable.\n\n" +
8
12
  "Create/manage developer keys from the Marona Developer Portal.";
@@ -896,6 +900,7 @@ export function handoff(targetAgent, options = {}) {
896
900
  let activeRuntime;
897
901
  const supportedModalities = new Set(["text", "image", "audio", "video", "file"]);
898
902
  export class Agent {
903
+ b2a;
899
904
  name;
900
905
  description;
901
906
  model;
@@ -919,6 +924,7 @@ export class Agent {
919
924
  metadata;
920
925
  /** @internal */ runtime;
921
926
  constructor(options) {
927
+ this.b2a = options.b2a;
922
928
  this.name = options.name.trim();
923
929
  this.description = cleanString(options.description);
924
930
  this.model = validateModelNamespace(options.model);
@@ -3011,6 +3017,10 @@ class RuntimeTransport {
3011
3017
  throw new EdgeRuntimeError("A fetch implementation is required.");
3012
3018
  }
3013
3019
  }
3020
+ /** @internal Native B2A uses the same authenticated transport as other runtime APIs. */
3021
+ b2aRequest(method, path, body) {
3022
+ return this.requestJson(method, path, { body });
3023
+ }
3014
3024
  async sync(options = {}) {
3015
3025
  const payload = await this.requestJson("POST", "/runtime/sync", {
3016
3026
  body: omitEmpty({
@@ -3719,6 +3729,7 @@ export class Marona {
3719
3729
  responses;
3720
3730
  skills;
3721
3731
  apps;
3732
+ b2a;
3722
3733
  runtime;
3723
3734
  constructor(options = {}) {
3724
3735
  this.runtime = new RuntimeEngine(options);
@@ -3726,6 +3737,7 @@ export class Marona {
3726
3737
  this.responses = new ResponsesClient(this.runtime);
3727
3738
  this.skills = this.runtime.skills;
3728
3739
  this.apps = new Apps(this.runtime);
3740
+ this.b2a = new B2AClient((method, path, body) => this.runtime.b2aRequest(method, path, body));
3729
3741
  activeRuntime = this.runtime;
3730
3742
  }
3731
3743
  }
@@ -4935,4 +4947,40 @@ function base64Encode(bytes) {
4935
4947
  }
4936
4948
  return btoa(binary);
4937
4949
  }
4950
+ /** @internal Shared Agent serialization for native B2A execution. */
4951
+ export function b2aBinding(agent, options) {
4952
+ const seen = new Set(), connections = [];
4953
+ const visit = (current) => {
4954
+ if (seen.has(current))
4955
+ return;
4956
+ seen.add(current);
4957
+ if (current.hooks || current.inputGuardrails.length || current.outputGuardrails.length || current.peers.length || typeof current.instructions === 'function')
4958
+ throw new EdgeRuntimeError('Native B2A requires server-hosted agent capabilities; SDK callbacks are unsupported');
4959
+ for (const tool of agentTools(current)) {
4960
+ if (tool instanceof MCPConnection)
4961
+ connections.push(tool);
4962
+ else if (tool instanceof AgentTool)
4963
+ visit(tool.targetAgent);
4964
+ else
4965
+ throw new EdgeRuntimeError('Native B2A requires server-hosted tools');
4966
+ }
4967
+ for (const handoff of agentHandoffs(current)) {
4968
+ if (handoff.inputFilter)
4969
+ throw new EdgeRuntimeError('Native B2A cannot execute local input filters');
4970
+ visit(handoff.targetAgent);
4971
+ }
4972
+ };
4973
+ visit(agent);
4974
+ const runtime = agentConnection(agent)?.agentRuntime() ?? agent.runtime ?? activeRuntime;
4975
+ if (!runtime)
4976
+ throw new EdgeRuntimeError('Create Marona before connecting B2A');
4977
+ const scopes = connections.map(connection => connection.realtimeScope());
4978
+ const configuration = { name: agent.name, model: agent.model, instructions: agent.instructions,
4979
+ tool_choice: agent.toolChoice, tools_enabled: agentHasTools(agent), max_turns: agent.maxTurns ?? 20,
4980
+ model_settings: agent.modelSettings ?? {}, multi_agent: agentGraph(agent, agentContext(agent, options.userId, options.sessionId)),
4981
+ output: normalizeAgentOutputRequest(agent), ...(agent.routing ? { routing: agent.routing } : {}),
4982
+ connection_scope: { all_apps: scopes.some(s => s.all_apps === true),
4983
+ apps: [...new Set(scopes.flatMap(s => (s.apps ?? [])))], skills: [...new Set(scopes.flatMap(s => (s.skills ?? [])))] } };
4984
+ return { client: new B2AClient((method, path, body) => runtime.b2aRequest(method, path, body)), configuration: JSON.parse(JSON.stringify(configuration)) };
4985
+ }
4938
4986
  //# sourceMappingURL=index.js.map