@kenhkl/agent-gate 0.9.3 → 0.9.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/v1/cli.js CHANGED
@@ -420,7 +420,7 @@ function agentInflight() {
420
420
  return envInt("AGENT_GATE_MAX_AGENT_INFLIGHT", 8);
421
421
  }
422
422
  function bump(kind, key, windowSec, extra) {
423
- const now = Date.now() / 1e3;
423
+ const now = performance.now() / 1e3;
424
424
  const k = `${kind}|${key}`;
425
425
  let b = counters.get(k);
426
426
  if (!b || now - b.start >= windowSec) {
@@ -487,7 +487,7 @@ function mossTokenPath() {
487
487
  return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
488
488
  }
489
489
  function resolveMossToken(force = false) {
490
- const now = Date.now() / 1e3;
490
+ const now = performance.now() / 1e3;
491
491
  if (!force && mossTokenCache.expires > now) return mossTokenCache.value;
492
492
  let tok = env("AGENT_GATE_MOSS_TOKEN");
493
493
  if (!tok) tok = env("AGENT_MOSS_AUTH_TOKEN");
@@ -572,7 +572,7 @@ var init_security = __esm({
572
572
  return this.qps > 0;
573
573
  }
574
574
  allow(key) {
575
- const now = Date.now() / 1e3;
575
+ const now = performance.now() / 1e3;
576
576
  const cur = this.buckets.get(key) ?? { tokens: this.burst, last: now };
577
577
  const tokens = Math.min(this.burst, cur.tokens + (now - cur.last) * this.qps);
578
578
  if (tokens < 1) {
@@ -1767,7 +1767,7 @@ var init_version = __esm({
1767
1767
  "src/version.ts"() {
1768
1768
  "use strict";
1769
1769
  init_cjs_shims();
1770
- _version = true ? "0.9.3" : (() => {
1770
+ _version = true ? "0.9.4" : (() => {
1771
1771
  try {
1772
1772
  const require2 = createRequire(importMetaUrl);
1773
1773
  const pkg = require2("../package.json");
package/dist/v1/server.js CHANGED
@@ -436,7 +436,7 @@ function agentInflight() {
436
436
  return envInt("AGENT_GATE_MAX_AGENT_INFLIGHT", 8);
437
437
  }
438
438
  function bump(kind, key, windowSec, extra) {
439
- const now = Date.now() / 1e3;
439
+ const now = performance.now() / 1e3;
440
440
  const k = `${kind}|${key}`;
441
441
  let b = counters.get(k);
442
442
  if (!b || now - b.start >= windowSec) {
@@ -482,7 +482,7 @@ function mossTokenPath() {
482
482
  return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
483
483
  }
484
484
  function resolveMossToken(force = false) {
485
- const now = Date.now() / 1e3;
485
+ const now = performance.now() / 1e3;
486
486
  if (!force && mossTokenCache.expires > now) return mossTokenCache.value;
487
487
  let tok = env("AGENT_GATE_MOSS_TOKEN");
488
488
  if (!tok) tok = env("AGENT_MOSS_AUTH_TOKEN");
@@ -544,7 +544,7 @@ var init_security = __esm({
544
544
  return this.qps > 0;
545
545
  }
546
546
  allow(key) {
547
- const now = Date.now() / 1e3;
547
+ const now = performance.now() / 1e3;
548
548
  const cur = this.buckets.get(key) ?? { tokens: this.burst, last: now };
549
549
  const tokens = Math.min(this.burst, cur.tokens + (now - cur.last) * this.qps);
550
550
  if (tokens < 1) {
@@ -1643,7 +1643,7 @@ var import_zod = require("zod");
1643
1643
 
1644
1644
  // src/version.ts
1645
1645
  init_cjs_shims();
1646
- var _version = true ? "0.9.3" : (() => {
1646
+ var _version = true ? "0.9.4" : (() => {
1647
1647
  try {
1648
1648
  const require2 = createRequire(importMetaUrl);
1649
1649
  const pkg = require2("../package.json");
package/dist/v3/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.9.3" : (() => {
53
+ _version = true ? "0.9.4" : (() => {
54
54
  try {
55
55
  const require2 = createRequire(importMetaUrl);
56
56
  const pkg = require2("../package.json");
@@ -442,7 +442,7 @@ function agentInflight() {
442
442
  return envInt("AGENT_GATE_MAX_AGENT_INFLIGHT", 8);
443
443
  }
444
444
  function bump(kind, key, windowSec, extra) {
445
- const now = Date.now() / 1e3;
445
+ const now = performance.now() / 1e3;
446
446
  const k = `${kind}|${key}`;
447
447
  let b = counters.get(k);
448
448
  if (!b || now - b.start >= windowSec) {
@@ -509,7 +509,7 @@ function mossTokenPath() {
509
509
  return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
510
510
  }
511
511
  function resolveMossToken(force = false) {
512
- const now = Date.now() / 1e3;
512
+ const now = performance.now() / 1e3;
513
513
  if (!force && mossTokenCache.expires > now) return mossTokenCache.value;
514
514
  let tok = env("AGENT_GATE_MOSS_TOKEN");
515
515
  if (!tok) tok = env("AGENT_MOSS_AUTH_TOKEN");
@@ -594,7 +594,7 @@ var init_security = __esm({
594
594
  return this.qps > 0;
595
595
  }
596
596
  allow(key) {
597
- const now = Date.now() / 1e3;
597
+ const now = performance.now() / 1e3;
598
598
  const cur = this.buckets.get(key) ?? { tokens: this.burst, last: now };
599
599
  const tokens = Math.min(this.burst, cur.tokens + (now - cur.last) * this.qps);
600
600
  if (tokens < 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenhkl/agent-gate",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "AI Agent data collection & security analysis gateway (TypeScript)",
5
5
  "main": "dist/v1/server.js",
6
6
  "bin": {