@kenhkl/agent-gate 0.5.3 → 0.5.4

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/cli.js CHANGED
@@ -50,7 +50,7 @@ var init_version = __esm({
50
50
  "src/version.ts"() {
51
51
  "use strict";
52
52
  init_cjs_shims();
53
- _version = true ? "0.5.3" : (() => {
53
+ _version = true ? "0.5.4" : (() => {
54
54
  try {
55
55
  const require2 = createRequire(importMetaUrl);
56
56
  const pkg = require2("../package.json");
@@ -613,11 +613,11 @@ function setMossUrl(url) {
613
613
  }
614
614
  async function callAgentMoss(request) {
615
615
  try {
616
- const resp = await fetch(`${mossUrl}/api/v1/analyze`, {
616
+ const resp = await (0, import_node_fetch.default)(`${mossUrl}/api/v1/analyze`, {
617
617
  method: "POST",
618
618
  headers: { "Content-Type": "application/json" },
619
619
  body: JSON.stringify(request),
620
- signal: AbortSignal.timeout(3e4)
620
+ timeout: 3e4
621
621
  });
622
622
  if (!resp.ok) {
623
623
  console.error(`[AgentGate] AgentMoss HTTP ${resp.status}: ${resp.statusText}`);
@@ -631,8 +631,8 @@ async function callAgentMoss(request) {
631
631
  }
632
632
  async function fetchMossHealth() {
633
633
  try {
634
- const resp = await fetch(`${mossUrl}/api/v1/health`, {
635
- signal: AbortSignal.timeout(3e3)
634
+ const resp = await (0, import_node_fetch.default)(`${mossUrl}/api/v1/health`, {
635
+ timeout: 3e3
636
636
  });
637
637
  if (!resp.ok) {
638
638
  return { moss_version: "N/A", moss_status: "error" };
@@ -656,11 +656,12 @@ function failClosedResponse(reason) {
656
656
  confidence: 100
657
657
  };
658
658
  }
659
- var DEFAULT_MOSS_URL, mossUrl;
659
+ var import_node_fetch, DEFAULT_MOSS_URL, mossUrl;
660
660
  var init_moss_client = __esm({
661
661
  "src/shared/moss-client.ts"() {
662
662
  "use strict";
663
663
  init_cjs_shims();
664
+ import_node_fetch = __toESM(require("node-fetch"));
664
665
  DEFAULT_MOSS_URL = "http://127.0.0.1:9090";
665
666
  mossUrl = DEFAULT_MOSS_URL;
666
667
  }
@@ -29434,6 +29435,7 @@ init_cjs_shims();
29434
29435
  var import_node_fs4 = require("fs");
29435
29436
  var import_yaml3 = require("yaml");
29436
29437
  init_version();
29438
+ var import_node_fetch2 = __toESM(require("node-fetch"));
29437
29439
  async function main() {
29438
29440
  const args = process.argv.slice(2);
29439
29441
  const command = args[0];
@@ -29835,7 +29837,7 @@ Run options:
29835
29837
  const mossUrl2 = process.env.AGENT_MOSS_URL || "http://127.0.0.1:9090";
29836
29838
  let mossConnected = false;
29837
29839
  try {
29838
- const resp = await fetch(`${mossUrl2}/api/v1/health`, { signal: AbortSignal.timeout(3e3) });
29840
+ const resp = await (0, import_node_fetch2.default)(`${mossUrl2}/api/v1/health`, { timeout: 3e3 });
29839
29841
  if (resp.status === 200) {
29840
29842
  mossConnected = true;
29841
29843
  console.log(`[AgentGate] AgentMoss connected: ${mossUrl2}`);