feat: recognize CutOS agent runtime

This commit is contained in:
yankun
2026-08-02 12:54:17 +08:00
parent 7de0777748
commit 586b978f81
9 changed files with 113 additions and 29 deletions
+21
View File
@@ -0,0 +1,21 @@
'use strict';
const OPENCLAW = 'openclaw';
const CUTOS_AGENT = 'cutos-agent';
const SUPPORTED_AGENT_TYPES = new Set([OPENCLAW, CUTOS_AGENT]);
function resolveAgentType(raw = process.env.AGENT_TYPE) {
const value = String(raw ?? '').trim().toLowerCase();
const agentType = value || OPENCLAW;
if (!SUPPORTED_AGENT_TYPES.has(agentType)) {
throw new Error(`AGENT_TYPE must be one of: ${[...SUPPORTED_AGENT_TYPES].join(', ')}; received: ${raw}`);
}
return agentType;
}
module.exports = {
OPENCLAW,
CUTOS_AGENT,
SUPPORTED_AGENT_TYPES,
resolveAgentType,
};