@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.mjs CHANGED
@@ -2968,7 +2968,7 @@ var AgentCardBuilder = class {
2968
2968
  name: config.name,
2969
2969
  description: config.personality.bio || `${config.name} - An autonomous AI agent`,
2970
2970
  protocolVersion: "0.3.0",
2971
- version: "0.1.24",
2971
+ version: "0.1.26",
2972
2972
  url: `${baseUrl}/a2a/jsonrpc`,
2973
2973
  skills,
2974
2974
  capabilities,
@@ -3417,8 +3417,9 @@ function createApp(agent, options = {}) {
3417
3417
  if (options.enableA2A !== false) {
3418
3418
  const port = options.port || parseInt(process.env.PORT || "3000", 10);
3419
3419
  const host = options.host || "0.0.0.0";
3420
- const protocol = host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" ? "http" : "https";
3421
- const baseUrl = options.a2aConfig?.baseUrl || `${protocol}://${host}:${port}`;
3420
+ const cardHost = host === "0.0.0.0" ? "localhost" : host;
3421
+ const protocol = cardHost === "localhost" || cardHost === "127.0.0.1" ? "http" : "https";
3422
+ const baseUrl = options.a2aConfig?.baseUrl || `${protocol}://${cardHost}:${port}`;
3422
3423
  const a2aIntegration = createA2AIntegration(agent, {
3423
3424
  a2aConfig: {
3424
3425
  enabled: true,
@@ -3441,18 +3442,22 @@ async function startServer(agent, options = {}) {
3441
3442
  const port = options.port || parseInt(process.env.PORT || "3000", 10);
3442
3443
  const host = options.host || "0.0.0.0";
3443
3444
  const app = createApp(agent, options);
3444
- await agent.start();
3445
- app.listen(port, host, () => {
3446
- logger10.info(`Agent "${agent.name}" running at http://${host}:${port}`);
3447
- if (options.enableA2A !== false) {
3448
- const protocol = host === "localhost" || host === "127.0.0.1" ? "http" : "https";
3449
- const baseUrl = `${protocol}://${host}:${port}`;
3450
- logger10.info("A2A Protocol Endpoints:");
3451
- logger10.info(` Agent Card: ${baseUrl}/.well-known/agent-card.json`);
3452
- logger10.info(` JSON-RPC: ${baseUrl}/a2a/jsonrpc`);
3453
- logger10.info(` HTTP+JSON: ${baseUrl}/a2a/rest`);
3454
- }
3445
+ await new Promise((resolve2) => {
3446
+ app.listen(port, host, () => {
3447
+ logger10.info(`Agent "${agent.name}" running at http://${host}:${port}`);
3448
+ if (options.enableA2A !== false) {
3449
+ const logHost = host === "0.0.0.0" ? "localhost" : host;
3450
+ const protocol = logHost === "localhost" || logHost === "127.0.0.1" ? "http" : "https";
3451
+ const baseUrl = `${protocol}://${logHost}:${port}`;
3452
+ logger10.info("A2A Protocol Endpoints:");
3453
+ logger10.info(` Agent Card: ${baseUrl}/.well-known/agent-card.json`);
3454
+ logger10.info(` JSON-RPC: ${baseUrl}/a2a/jsonrpc`);
3455
+ logger10.info(` HTTP+JSON: ${baseUrl}/a2a/rest`);
3456
+ }
3457
+ resolve2();
3458
+ });
3455
3459
  });
3460
+ await agent.start();
3456
3461
  const shutdown = async () => {
3457
3462
  logger10.info("Received shutdown signal");
3458
3463
  await agent.stop();