-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconst.py
More file actions
154 lines (140 loc) · 4 KB
/
const.py
File metadata and controls
154 lines (140 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
"""Constants for the OpenClaw integration."""
DOMAIN = "openclaw"
# Addon
ADDON_SLUG = "openclaw_assistant_dev"
# The Supervisor prefixes a repo hash to the slug in the filesystem path
# e.g. /addon_configs/0bfc167e_openclaw_assistant
# We cannot hardcode this — it must be discovered at runtime.
ADDON_CONFIGS_ROOT = "/addon_configs"
ADDON_SLUG_FRAGMENTS = ("openclaw_assistant", "openclaw")
OPENCLAW_CONFIG_REL_PATH = ".openclaw/openclaw.json"
# Defaults
DEFAULT_GATEWAY_HOST = "127.0.0.1"
DEFAULT_GATEWAY_PORT = 18789
DEFAULT_SCAN_INTERVAL = 30 # seconds
# Config entry keys
CONF_GATEWAY_HOST = "gateway_host"
CONF_GATEWAY_PORT = "gateway_port"
CONF_GATEWAY_TOKEN = "gateway_token"
CONF_USE_SSL = "use_ssl"
CONF_VERIFY_SSL = "verify_ssl"
CONF_ADDON_CONFIG_PATH = "addon_config_path"
CONF_AGENT_ID = "agent_id"
CONF_VOICE_AGENT_ID = "voice_agent_id"
CONF_ASSIST_SESSION_ID = "assist_session_id"
# Options
CONF_INCLUDE_EXPOSED_CONTEXT = "include_exposed_context"
CONF_CONTEXT_MAX_CHARS = "context_max_chars"
CONF_CONTEXT_STRATEGY = "context_strategy"
CONF_ENABLE_TOOL_CALLS = "enable_tool_calls"
CONF_WAKE_WORD_ENABLED = "wake_word_enabled"
CONF_WAKE_WORD = "wake_word"
CONF_ALLOW_BRAVE_WEBSPEECH = "allow_brave_webspeech"
CONF_VOICE_PROVIDER = "voice_provider"
CONF_BROWSER_VOICE_LANGUAGE = "browser_voice_language"
CONF_THINKING_TIMEOUT = "thinking_timeout"
CONF_DEBUG_LOGGING = "debug_logging"
DEFAULT_AGENT_ID = "main"
DEFAULT_VOICE_AGENT_ID = ""
DEFAULT_ASSIST_SESSION_ID = ""
DEFAULT_INCLUDE_EXPOSED_CONTEXT = True
DEFAULT_CONTEXT_MAX_CHARS = 13000
DEFAULT_CONTEXT_STRATEGY = "truncate"
DEFAULT_ENABLE_TOOL_CALLS = False
DEFAULT_WAKE_WORD_ENABLED = False
DEFAULT_WAKE_WORD = "hey openclaw"
DEFAULT_ALLOW_BRAVE_WEBSPEECH = False
DEFAULT_VOICE_PROVIDER = "browser"
DEFAULT_BROWSER_VOICE_LANGUAGE = "auto"
DEFAULT_THINKING_TIMEOUT = 120
DEFAULT_DEBUG_LOGGING = False
BROWSER_VOICE_LANGUAGES: tuple[str, ...] = (
"auto",
"bg-BG",
"en-US",
"en-GB",
"de-DE",
"fr-FR",
"es-ES",
"it-IT",
"pt-PT",
"pt-BR",
"ru-RU",
"nl-NL",
"pl-PL",
"tr-TR",
"uk-UA",
"cs-CZ",
"ro-RO",
"el-GR",
"sv-SE",
"no-NO",
"da-DK",
"fi-FI",
"hu-HU",
"sk-SK",
"sl-SI",
"hr-HR",
"sr-RS",
"ja-JP",
"ko-KR",
"zh-CN",
"zh-TW",
"ar-SA",
"he-IL",
"hi-IN",
)
CONTEXT_STRATEGY_TRUNCATE = "truncate"
CONTEXT_STRATEGY_CLEAR = "clear"
# Coordinator data keys
DATA_STATUS = "status"
DATA_MODEL = "model"
DATA_SESSION_COUNT = "session_count"
DATA_SESSIONS = "sessions"
DATA_LAST_ACTIVITY = "last_activity"
DATA_CONNECTED = "connected"
DATA_GATEWAY_VERSION = "gateway_version"
DATA_UPTIME = "uptime"
DATA_PROVIDER = "provider"
DATA_CONTEXT_WINDOW = "context_window"
DATA_LAST_TOOL_NAME = "last_tool_name"
DATA_LAST_TOOL_STATUS = "last_tool_status"
DATA_LAST_TOOL_DURATION_MS = "last_tool_duration_ms"
DATA_LAST_TOOL_INVOKED_AT = "last_tool_invoked_at"
DATA_LAST_TOOL_ERROR = "last_tool_error"
DATA_LAST_TOOL_RESULT_PREVIEW = "last_tool_result_preview"
# Platforms
PLATFORMS = ["sensor", "binary_sensor", "conversation", "event", "button", "select"]
# Events
EVENT_MESSAGE_RECEIVED = f"{DOMAIN}_message_received"
EVENT_TOOL_INVOKED = f"{DOMAIN}_tool_invoked"
# Services
SERVICE_SEND_MESSAGE = "send_message"
SERVICE_CLEAR_HISTORY = "clear_history"
SERVICE_INVOKE_TOOL = "invoke_tool"
# Attributes
ATTR_MESSAGE = "message"
ATTR_SOURCE = "source"
ATTR_SESSION_ID = "session_id"
ATTR_ATTACHMENTS = "attachments"
ATTR_MODEL = "model"
ATTR_TIMESTAMP = "timestamp"
ATTR_TOOL = "tool"
ATTR_ACTION = "action"
ATTR_ARGS = "args"
ATTR_SESSION_KEY = "session_key"
ATTR_DRY_RUN = "dry_run"
ATTR_MESSAGE_CHANNEL = "message_channel"
ATTR_ACCOUNT_ID = "account_id"
ATTR_AGENT_ID = "agent_id"
ATTR_OK = "ok"
ATTR_RESULT = "result"
ATTR_ERROR = "error"
ATTR_DURATION_MS = "duration_ms"
# API endpoints
# The OpenClaw gateway exposes only the OpenAI-compatible endpoints.
# /api/status and /api/sessions do not exist — the gateway returns its SPA
# home page (text/html) for any unrecognised route.
API_MODELS = "/v1/models"
API_CHAT_COMPLETIONS = "/v1/chat/completions"
API_TOOLS_INVOKE = "/tools/invoke"