feat: recognize CutOS agent runtime
This commit is contained in:
@@ -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,
|
||||
};
|
||||
Reference in New Issue
Block a user