@moltium/core 0.1.24 → 0.1.26

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
@@ -3040,7 +3040,7 @@ var AgentCardBuilder = class {
3040
3040
  name: config.name,
3041
3041
  description: config.personality.bio || `${config.name} - An autonomous AI agent`,
3042
3042
  protocolVersion: "0.3.0",
3043
- version: "0.1.24",
3043
+ version: "0.1.26",
3044
3044
  url: `${baseUrl}/a2a/jsonrpc`,
3045
3045
  skills,
3046
3046
  capabilities,
@@ -3489,8 +3489,9 @@ function createApp(agent, options = {}) {
3489
3489
  if (options.enableA2A !== false) {
3490
3490
  const port = options.port || parseInt(process.env.PORT || "3000", 10);
3491
3491
  const host = options.host || "0.0.0.0";
3492
- const protocol = host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" ? "http" : "https";
3493
- const baseUrl = options.a2aConfig?.baseUrl || `${protocol}://${host}:${port}`;
3492
+ const cardHost = host === "0.0.0.0" ? "localhost" : host;
3493
+ const protocol = cardHost === "localhost" || cardHost === "127.0.0.1" ? "http" : "https";
3494
+ const baseUrl = options.a2aConfig?.baseUrl || `${protocol}://${cardHost}:${port}`;
3494
3495
  const a2aIntegration = createA2AIntegration(agent, {
3495
3496
  a2aConfig: {
3496
3497
  enabled: true,
@@ -3513,18 +3514,22 @@ async function startServer(agent, options = {}) {
3513
3514
  const port = options.port || parseInt(process.env.PORT || "3000", 10);
3514
3515
  const host = options.host || "0.0.0.0";
3515
3516
  const app = createApp(agent, options);
3516
- await agent.start();
3517
- app.listen(port, host, () => {
3518
- logger10.info(`Agent "${agent.name}" running at http://${host}:${port}`);
3519
- if (options.enableA2A !== false) {
3520
- const protocol = host === "localhost" || host === "127.0.0.1" ? "http" : "https";
3521
- const baseUrl = `${protocol}://${host}:${port}`;
3522
- logger10.info("A2A Protocol Endpoints:");
3523
- logger10.info(` Agent Card: ${baseUrl}/.well-known/agent-card.json`);
3524
- logger10.info(` JSON-RPC: ${baseUrl}/a2a/jsonrpc`);
3525
- logger10.info(` HTTP+JSON: ${baseUrl}/a2a/rest`);
3526
- }
3517
+ await new Promise((resolve2) => {
3518
+ app.listen(port, host, () => {
3519
+ logger10.info(`Agent "${agent.name}" running at http://${host}:${port}`);
3520
+ if (options.enableA2A !== false) {
3521
+ const logHost = host === "0.0.0.0" ? "localhost" : host;
3522
+ const protocol = logHost === "localhost" || logHost === "127.0.0.1" ? "http" : "https";
3523
+ const baseUrl = `${protocol}://${logHost}:${port}`;
3524
+ logger10.info("A2A Protocol Endpoints:");
3525
+ logger10.info(` Agent Card: ${baseUrl}/.well-known/agent-card.json`);
3526
+ logger10.info(` JSON-RPC: ${baseUrl}/a2a/jsonrpc`);
3527
+ logger10.info(` HTTP+JSON: ${baseUrl}/a2a/rest`);
3528
+ }
3529
+ resolve2();
3530
+ });
3527
3531
  });
3532
+ await agent.start();
3528
3533
  const shutdown = async () => {
3529
3534
  logger10.info("Received shutdown signal");
3530
3535
  await agent.stop();