@clwnt/clawnet 0.7.17 → 0.7.18

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/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
2
2
  import { registerClawnetCli, buildClawnetMapping, upsertMapping, buildStatusText } from "./src/cli.js";
3
3
  import { createClawnetService, getHooksUrl, getHooksToken } from "./src/service.js";
4
- import { parseConfig } from "./src/config.js";
4
+ import { parseConfig, resolveToken } from "./src/config.js";
5
5
  import { registerTools, loadToolDescriptions } from "./src/tools.js";
6
6
  import { migrateConfig, CURRENT_SETUP_VERSION } from "./src/migrate.js";
7
7
 
@@ -56,9 +56,7 @@ const plugin = {
56
56
  if (enabledAccounts.length > 0) {
57
57
  const issues: string[] = [];
58
58
  for (const account of enabledAccounts) {
59
- const tokenRef = account.token ?? "";
60
- const envMatch = tokenRef.match(/^\$\{(.+)\}$/);
61
- const token = envMatch ? process.env[envMatch[1]] || "" : tokenRef;
59
+ const token = resolveToken(typeof account.token === "string" ? account.token : "");
62
60
  if (!token) {
63
61
  issues.push(`${account.agentId}: no token resolved`);
64
62
  continue;
@@ -2,7 +2,7 @@
2
2
  "id": "clawnet",
3
3
  "name": "ClawNet",
4
4
  "description": "ClawNet integration — poll inbox, route messages to hooks",
5
- "version": "0.7.17",
5
+ "version": "0.7.18",
6
6
  "skills": ["skills"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clwnt/clawnet",
3
- "version": "0.7.17",
3
+ "version": "0.7.18",
4
4
  "type": "module",
5
5
  "description": "ClawNet integration for OpenClaw — poll inbox, route messages to hooks",
6
6
  "files": [
package/src/cli.ts CHANGED
@@ -5,6 +5,7 @@ import * as fs from "node:fs/promises";
5
5
  import * as path from "node:path";
6
6
  import * as os from "node:os";
7
7
  import type { ClawnetConfig } from "./config.js";
8
+ import { resolveToken } from "./config.js";
8
9
  import { PLUGIN_VERSION } from "./service.js";
9
10
 
10
11
  const API_BASE = "https://api.clwnt.com";
@@ -660,9 +661,7 @@ export function registerClawnetCli(params: { program: Command; api: any; cfg: Cl
660
661
  console.log("\n Connectivity:\n");
661
662
  const routingIssues: string[] = [];
662
663
  for (const account of pluginCfg.accounts) {
663
- const tokenRef = account.token;
664
- const match = tokenRef.match(/^\$\{(.+)\}$/);
665
- const resolvedToken = match ? process.env[match[1]] || "" : tokenRef;
664
+ const resolvedToken = resolveToken(typeof account.token === "string" ? account.token : "");
666
665
 
667
666
  if (!resolvedToken) {
668
667
  console.log(` ${account.id}: NO TOKEN (env var not set)`);
package/src/config.ts CHANGED
@@ -102,3 +102,7 @@ export function resolveToken(token: string): string {
102
102
  }
103
103
  return token.trim();
104
104
  }
105
+
106
+ export function resolveHooksToken(token: string): string {
107
+ return resolveToken(token) || process.env.OPENCLAW_HOOKS_TOKEN?.trim() || "";
108
+ }
package/src/service.ts CHANGED
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { dirname, join } from "node:path";
4
4
  import type { ClawnetConfig, ClawnetAccount } from "./config.js";
5
- import { parseConfig, resolveToken } from "./config.js";
5
+ import { parseConfig, resolveHooksToken, resolveToken } from "./config.js";
6
6
  import { reloadCapabilities } from "./tools.js";
7
7
  import { reloadHookTemplate, getHookTemplate } from "./cli.js";
8
8
 
@@ -41,7 +41,7 @@ export function getHooksUrl(api: any): string {
41
41
 
42
42
  export function getHooksToken(api: any): string {
43
43
  const rawToken = api.config?.hooks?.token ?? "";
44
- return resolveToken(rawToken) || process.env.OPENCLAW_HOOKS_TOKEN || "";
44
+ return resolveHooksToken(rawToken);
45
45
  }
46
46
 
47
47
  // --- Onboarding message (cached from server) ---