@kenhkl/agent-gate 0.9.10 → 0.9.11

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
@@ -483,8 +483,7 @@ function hardenDbFiles(dbPath) {
483
483
  function mossTokenPath() {
484
484
  const root = env("AGENT_MOSS_DATA_DIR");
485
485
  if (root) return (0, import_node_path.join)(root, "auth_token");
486
- const home = process.env.SUDO_USER && existsDir(`/home/${process.env.SUDO_USER}`) ? `/home/${process.env.SUDO_USER}` : (0, import_node_os.homedir)();
487
- return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
486
+ return (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "agentmoss", "auth_token");
488
487
  }
489
488
  function resolveMossToken(force = false) {
490
489
  const now = performance.now() / 1e3;
@@ -502,9 +501,13 @@ function resolveMossToken(force = false) {
502
501
  }
503
502
  }
504
503
  if (!tok) {
504
+ const tokenPath = mossTokenPath();
505
505
  try {
506
- tok = (0, import_node_fs.readFileSync)(mossTokenPath(), "utf-8").trim();
506
+ tok = (0, import_node_fs.readFileSync)(tokenPath, "utf-8").trim();
507
507
  } catch {
508
+ console.warn(
509
+ `[AgentGate] AgentMoss \u9274\u6743 token \u672A\u627E\u5230\uFF08\u5C1D\u8BD5\u8DEF\u5F84: ${tokenPath}\uFF09\uFF1B\u8DE8\u7528\u6237/\u8DE8\u673A\u90E8\u7F72\u8BF7\u7528 AGENT_GATE_MOSS_TOKEN \u6216 AGENT_MOSS_AUTH_TOKEN_FILE \u663E\u5F0F\u6307\u5B9A`
510
+ );
508
511
  tok = "";
509
512
  }
510
513
  }
@@ -1803,7 +1806,7 @@ var init_version = __esm({
1803
1806
  "src/version.ts"() {
1804
1807
  "use strict";
1805
1808
  init_cjs_shims();
1806
- _version = true ? "0.9.10" : (() => {
1809
+ _version = true ? "0.9.11" : (() => {
1807
1810
  try {
1808
1811
  const require2 = createRequire(importMetaUrl);
1809
1812
  const pkg = require2("../package.json");
package/dist/v1/server.js CHANGED
@@ -478,8 +478,7 @@ function hardenFilesEnabled() {
478
478
  function mossTokenPath() {
479
479
  const root = env("AGENT_MOSS_DATA_DIR");
480
480
  if (root) return (0, import_node_path.join)(root, "auth_token");
481
- const home = process.env.SUDO_USER && existsDir(`/home/${process.env.SUDO_USER}`) ? `/home/${process.env.SUDO_USER}` : (0, import_node_os.homedir)();
482
- return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
481
+ return (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "agentmoss", "auth_token");
483
482
  }
484
483
  function resolveMossToken(force = false) {
485
484
  const now = performance.now() / 1e3;
@@ -497,9 +496,13 @@ function resolveMossToken(force = false) {
497
496
  }
498
497
  }
499
498
  if (!tok) {
499
+ const tokenPath = mossTokenPath();
500
500
  try {
501
- tok = (0, import_node_fs.readFileSync)(mossTokenPath(), "utf-8").trim();
501
+ tok = (0, import_node_fs.readFileSync)(tokenPath, "utf-8").trim();
502
502
  } catch {
503
+ console.warn(
504
+ `[AgentGate] AgentMoss \u9274\u6743 token \u672A\u627E\u5230\uFF08\u5C1D\u8BD5\u8DEF\u5F84: ${tokenPath}\uFF09\uFF1B\u8DE8\u7528\u6237/\u8DE8\u673A\u90E8\u7F72\u8BF7\u7528 AGENT_GATE_MOSS_TOKEN \u6216 AGENT_MOSS_AUTH_TOKEN_FILE \u663E\u5F0F\u6307\u5B9A`
505
+ );
503
506
  tok = "";
504
507
  }
505
508
  }
@@ -2271,7 +2274,7 @@ var import_zod = require("zod");
2271
2274
 
2272
2275
  // src/version.ts
2273
2276
  init_cjs_shims();
2274
- var _version = true ? "0.9.10" : (() => {
2277
+ var _version = true ? "0.9.11" : (() => {
2275
2278
  try {
2276
2279
  const require2 = createRequire(importMetaUrl);
2277
2280
  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.10" : (() => {
53
+ _version = true ? "0.9.11" : (() => {
54
54
  try {
55
55
  const require2 = createRequire(importMetaUrl);
56
56
  const pkg = require2("../package.json");
@@ -505,8 +505,7 @@ function hardenDbFiles(dbPath) {
505
505
  function mossTokenPath() {
506
506
  const root = env("AGENT_MOSS_DATA_DIR");
507
507
  if (root) return (0, import_node_path.join)(root, "auth_token");
508
- const home = process.env.SUDO_USER && existsDir(`/home/${process.env.SUDO_USER}`) ? `/home/${process.env.SUDO_USER}` : (0, import_node_os.homedir)();
509
- return (0, import_node_path.join)(home, ".config", "agentmoss", "auth_token");
508
+ return (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "agentmoss", "auth_token");
510
509
  }
511
510
  function resolveMossToken(force = false) {
512
511
  const now = performance.now() / 1e3;
@@ -524,9 +523,13 @@ function resolveMossToken(force = false) {
524
523
  }
525
524
  }
526
525
  if (!tok) {
526
+ const tokenPath = mossTokenPath();
527
527
  try {
528
- tok = (0, import_node_fs.readFileSync)(mossTokenPath(), "utf-8").trim();
528
+ tok = (0, import_node_fs.readFileSync)(tokenPath, "utf-8").trim();
529
529
  } catch {
530
+ console.warn(
531
+ `[AgentGate] AgentMoss \u9274\u6743 token \u672A\u627E\u5230\uFF08\u5C1D\u8BD5\u8DEF\u5F84: ${tokenPath}\uFF09\uFF1B\u8DE8\u7528\u6237/\u8DE8\u673A\u90E8\u7F72\u8BF7\u7528 AGENT_GATE_MOSS_TOKEN \u6216 AGENT_MOSS_AUTH_TOKEN_FILE \u663E\u5F0F\u6307\u5B9A`
532
+ );
530
533
  tok = "";
531
534
  }
532
535
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenhkl/agent-gate",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "AI Agent data collection & security analysis gateway (TypeScript)",
5
5
  "main": "dist/v1/server.js",
6
6
  "bin": {