@annals/agent-mesh 0.12.0
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/LICENSE +21 -0
- package/README.md +92 -0
- package/dist/chunk-GIEYJIVW.js +936 -0
- package/dist/chunk-W24WCWEC.js +86 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4106 -0
- package/dist/list-6CHWMM3O.js +9 -0
- package/dist/openclaw-config-OFFNWVDK.js +11 -0
- package/package.json +37 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/utils/openclaw-config.ts
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
|
|
8
|
+
// src/utils/logger.ts
|
|
9
|
+
var RESET = "\x1B[0m";
|
|
10
|
+
var RED = "\x1B[31m";
|
|
11
|
+
var GREEN = "\x1B[32m";
|
|
12
|
+
var YELLOW = "\x1B[33m";
|
|
13
|
+
var BLUE = "\x1B[34m";
|
|
14
|
+
var GRAY = "\x1B[90m";
|
|
15
|
+
var BOLD = "\x1B[1m";
|
|
16
|
+
function timestamp() {
|
|
17
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
18
|
+
}
|
|
19
|
+
var log = {
|
|
20
|
+
info(msg, ...args) {
|
|
21
|
+
console.log(`${GRAY}${timestamp()}${RESET} ${BLUE}INFO${RESET} ${msg}`, ...args);
|
|
22
|
+
},
|
|
23
|
+
success(msg, ...args) {
|
|
24
|
+
console.log(`${GRAY}${timestamp()}${RESET} ${GREEN}OK${RESET} ${msg}`, ...args);
|
|
25
|
+
},
|
|
26
|
+
warn(msg, ...args) {
|
|
27
|
+
console.warn(`${GRAY}${timestamp()}${RESET} ${YELLOW}WARN${RESET} ${msg}`, ...args);
|
|
28
|
+
},
|
|
29
|
+
error(msg, ...args) {
|
|
30
|
+
console.error(`${GRAY}${timestamp()}${RESET} ${RED}ERROR${RESET} ${msg}`, ...args);
|
|
31
|
+
},
|
|
32
|
+
debug(msg, ...args) {
|
|
33
|
+
if (process.env.DEBUG) {
|
|
34
|
+
console.log(`${GRAY}${timestamp()} DEBUG ${msg}${RESET}`, ...args);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
banner(text) {
|
|
38
|
+
console.log(`
|
|
39
|
+
${BOLD}${text}${RESET}
|
|
40
|
+
`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/utils/openclaw-config.ts
|
|
45
|
+
var OPENCLAW_CONFIG_PATH = join(homedir(), ".openclaw", "openclaw.json");
|
|
46
|
+
function readOpenClawConfig(configPath) {
|
|
47
|
+
const path = configPath || OPENCLAW_CONFIG_PATH;
|
|
48
|
+
try {
|
|
49
|
+
const raw = readFileSync(path, "utf-8");
|
|
50
|
+
return JSON.parse(raw);
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isChatCompletionsEnabled(configPath) {
|
|
56
|
+
const config = readOpenClawConfig(configPath);
|
|
57
|
+
if (!config) return false;
|
|
58
|
+
try {
|
|
59
|
+
const enabled = config?.gateway?.http?.endpoints?.chatCompletions?.enabled;
|
|
60
|
+
return enabled === true;
|
|
61
|
+
} catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function readOpenClawToken(configPath) {
|
|
66
|
+
const path = configPath || OPENCLAW_CONFIG_PATH;
|
|
67
|
+
try {
|
|
68
|
+
const raw = readFileSync(path, "utf-8");
|
|
69
|
+
const config = JSON.parse(raw);
|
|
70
|
+
const token = config?.gateway?.auth?.token;
|
|
71
|
+
if (typeof token === "string" && token.length > 0) {
|
|
72
|
+
return token;
|
|
73
|
+
}
|
|
74
|
+
log.warn("OpenClaw config found but gateway.auth.token is missing or empty");
|
|
75
|
+
return null;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
log,
|
|
83
|
+
readOpenClawConfig,
|
|
84
|
+
isChatCompletionsEnabled,
|
|
85
|
+
readOpenClawToken
|
|
86
|
+
};
|
package/dist/index.d.ts
ADDED