ocuclaw 0.1.0 → 1.3.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.
Files changed (59) hide show
  1. package/README.md +63 -8
  2. package/dist/config/runtime-config.js +81 -3
  3. package/dist/domain/activity-status-adapter.js +138 -605
  4. package/dist/domain/activity-status-arbiter.js +109 -0
  5. package/dist/domain/activity-status-labels.js +906 -0
  6. package/dist/domain/code-span-regions.js +103 -0
  7. package/dist/domain/conversation-state.js +14 -1
  8. package/dist/domain/debug-store.js +41 -184
  9. package/dist/domain/glasses-ui-content-summary.js +62 -0
  10. package/dist/domain/glasses-ui-system-prompt.js +28 -0
  11. package/dist/domain/message-emoji-allowlist.js +16 -0
  12. package/dist/domain/message-emoji-filter.js +33 -55
  13. package/dist/domain/neural-emoji-reactor-system-prompt.js +43 -0
  14. package/dist/domain/neural-emoji-reactor-tag-config.js +56 -0
  15. package/dist/domain/neural-pace-modulator-system-prompt.js +32 -0
  16. package/dist/domain/neural-pace-modulator-tag-config.js +51 -0
  17. package/dist/domain/tagged-span-parser.js +121 -0
  18. package/dist/domain/tagged-span-strip.js +38 -0
  19. package/dist/even-ai/even-ai-endpoint.js +91 -0
  20. package/dist/even-ai/even-ai-run-waiter.js +14 -0
  21. package/dist/even-ai/even-ai-settings-store.js +14 -0
  22. package/dist/gateway/gateway-bridge.js +14 -2
  23. package/dist/gateway/gateway-timing-ledger.js +457 -0
  24. package/dist/gateway/openclaw-client.js +462 -38
  25. package/dist/index.js +28 -1
  26. package/dist/runtime/downstream-handler.js +909 -68
  27. package/dist/runtime/downstream-server.js +1004 -512
  28. package/dist/runtime/ocuclaw-settings-store.js +74 -31
  29. package/dist/runtime/plugin-update-service.js +216 -0
  30. package/dist/runtime/protocol-adapter.js +9 -0
  31. package/dist/runtime/provider-usage-select.js +168 -0
  32. package/dist/runtime/relay-client-nudge-controller.js +553 -0
  33. package/dist/runtime/relay-core.js +1357 -210
  34. package/dist/runtime/relay-health-monitor.js +172 -0
  35. package/dist/runtime/relay-operation-registry.js +263 -0
  36. package/dist/runtime/relay-service.js +201 -1
  37. package/dist/runtime/relay-worker-approval-replay-cache.js +68 -0
  38. package/dist/runtime/relay-worker-entry.js +32 -0
  39. package/dist/runtime/relay-worker-health.js +272 -0
  40. package/dist/runtime/relay-worker-protocol.js +285 -0
  41. package/dist/runtime/relay-worker-queue.js +202 -0
  42. package/dist/runtime/relay-worker-supervisor.js +1081 -0
  43. package/dist/runtime/relay-worker-transport.js +1051 -0
  44. package/dist/runtime/session-context-service.js +189 -0
  45. package/dist/runtime/session-service.js +656 -38
  46. package/dist/runtime/upstream-runtime.js +1167 -60
  47. package/dist/tools/device-info-tool.js +242 -0
  48. package/dist/tools/glasses-ui-cron.js +427 -0
  49. package/dist/tools/glasses-ui-descriptors.js +261 -0
  50. package/dist/tools/glasses-ui-limits.js +21 -0
  51. package/dist/tools/glasses-ui-paint-floor.js +99 -0
  52. package/dist/tools/glasses-ui-recipes.js +746 -0
  53. package/dist/tools/glasses-ui-surfaces.js +278 -0
  54. package/dist/tools/glasses-ui-template.js +182 -0
  55. package/dist/tools/glasses-ui-tool.js +1147 -0
  56. package/dist/tools/session-title-tool.js +209 -0
  57. package/dist/version.js +2 -0
  58. package/openclaw.plugin.json +163 -15
  59. package/package.json +12 -4
package/README.md CHANGED
@@ -1,25 +1,80 @@
1
1
  # OcuClaw
2
2
 
3
- OcuClaw is an OpenClaw plugin for Even G2 smart glasses.
3
+ OcuClaw is an OpenClaw plugin for Even G2 smart glasses. Use the OcuClaw application within Even Hub App Store to connect the client side.
4
+
5
+ ## Requirements
6
+
7
+ OpenClaw `>= 2026.5.20` (older versions have a known plugin-install bug). Upgrade with `npm install -g openclaw@latest`.
4
8
 
5
9
  ## Install
6
10
 
11
+ Install the plugin from the OpenClaw CLI:
12
+
7
13
  ```bash
8
14
  openclaw plugins install ocuclaw
9
- openclaw plugins enable ocuclaw
10
15
  ```
11
16
 
12
17
  ## Configure
13
18
 
14
- Set the relay token before starting or restarting the OpenClaw gateway:
19
+ Required:
20
+
21
+ Set the OcuClaw relay token. This is a user-created password that must match the relay server token field in the OcuClaw application within Even Hub App Store.
22
+
23
+ ```bash
24
+ openclaw config set plugins.entries.ocuclaw.config.relayToken "your-relay-token"
25
+ ```
26
+
27
+ Recommended:
28
+
29
+ - `sonioxApiKey`: Enables Soniox speech-to-text for voice input.
30
+
31
+ ```bash
32
+ openclaw config set plugins.entries.ocuclaw.config.sonioxApiKey "your-soniox-api-key"
33
+ ```
34
+
35
+ - `evenAiEnabled`: Enables Even AI integration for OcuClaw.
36
+
37
+ ```bash
38
+ openclaw config set plugins.entries.ocuclaw.config.evenAiEnabled true --strict-json
39
+ ```
40
+
41
+ - `evenAiToken`: Sets the user-created password for Even AI requests. This must match the password set in the Even AI Agent Configure section within the Even Realities app.
15
42
 
16
43
  ```bash
17
- openclaw config set plugins.entries.ocuclaw.config.relayToken "<relay-token>"
44
+ openclaw config set plugins.entries.ocuclaw.config.evenAiToken "your-even-ai-token"
18
45
  ```
19
46
 
20
- Optional settings live under `plugins.entries.ocuclaw.config.*`.
47
+ > **Note:** When `evenAiEnabled` is `true`, `evenAiToken` is required. Config validation will reject the change if you enable Even AI without setting the token.
21
48
 
22
- ## Notes
49
+ Advanced optional settings:
23
50
 
24
- - Plugin id: `ocuclaw`
25
- - The WebUI is a separate artifact and is not bundled into this npm package.
51
+ ```bash
52
+ openclaw config set plugins.entries.ocuclaw.config.wsBind "127.0.0.1"
53
+ openclaw config set plugins.entries.ocuclaw.config.wsPort 9000 --strict-json
54
+ openclaw config set plugins.entries.ocuclaw.config.sessionLimit 10 --strict-json
55
+ openclaw config set plugins.entries.ocuclaw.config.externalDebugToolsEnabled true --strict-json
56
+ ```
57
+
58
+ Run `openclaw plugins inspect ocuclaw` to see all settings with their descriptions and defaults.
59
+
60
+ ## Enable
61
+
62
+ ```bash
63
+ openclaw plugins enable ocuclaw
64
+ ```
65
+
66
+ ## Restart
67
+
68
+ Restart the gateway so the plugin and config changes take effect:
69
+
70
+ ```bash
71
+ openclaw gateway restart
72
+ ```
73
+
74
+ ## Verify
75
+
76
+ ```bash
77
+ openclaw plugins inspect ocuclaw --runtime
78
+ openclaw plugins doctor
79
+ openclaw gateway status
80
+ ```
@@ -97,6 +97,56 @@ function resolveDebugNoisyPolicies(pluginValue, envValue) {
97
97
  return parseJsonOrUndefined(envValue, "debugNoisyPolicies");
98
98
  }
99
99
 
100
+ // Supported live-refresh LLM backends. codex-cli was removed because the
101
+ // Codex CLI's read-only sandbox still permits filesystem reads — agents
102
+ // could exfil ~/.aws/credentials, ~/.ssh/*, etc. via stdout into the
103
+ // glasses surface. Claude CLI is kept because --tools "" structurally
104
+ // disables file access; operators who want Codex use openai-compat
105
+ // pointed at the Codex API endpoint (tool-less).
106
+ const GLASSES_UI_LIVE_BACKENDS = new Set([
107
+ "claude-cli",
108
+ "anthropic-api",
109
+ "openai-compat",
110
+ ]);
111
+
112
+ const GLASSES_UI_LIVE_DEFAULT_MODEL = {
113
+ "claude-cli": "claude-haiku-4-5-20251001",
114
+ "anthropic-api": "anthropic/claude-haiku-4-5-20251001",
115
+ "openai-compat": "gpt-4o-mini",
116
+ };
117
+
118
+ function resolveGlassesUiLive(value) {
119
+ const raw = isObject(value) ? value : {};
120
+ const tickBackend = GLASSES_UI_LIVE_BACKENDS.has(raw.tickBackend)
121
+ ? raw.tickBackend
122
+ : "claude-cli";
123
+ const tickModel = pickString(raw.tickModel) || GLASSES_UI_LIVE_DEFAULT_MODEL[tickBackend];
124
+ const tickApiBaseUrl = pickString(raw.tickApiBaseUrl) || "https://api.openai.com";
125
+ return {
126
+ enabled: parseBool(raw.enabled, true),
127
+ tickBackend,
128
+ tickModel,
129
+ tickApiBaseUrl,
130
+ allowAgentModelOverride: parseBool(raw.allowAgentModelOverride, false),
131
+ tickMaxOutputTokens: parseIntOrDefault(raw.tickMaxOutputTokens, 200),
132
+ // Shell recipes run agent-supplied commands on a schedule as the plugin
133
+ // user. Default to disabled — operators must explicitly opt in via
134
+ // plugins.entries.ocuclaw.config.glassesUiLive.shellEnabled = true.
135
+ shellEnabled: parseBool(raw.shellEnabled, false),
136
+ // http recipes issue agent-influenced outbound network requests on a
137
+ // schedule. The recipe executor blocks loopback/RFC1918/link-local
138
+ // destinations and resolves hostnames through an SSRF-safe dispatcher,
139
+ // but the capability — "the plugin's gateway host can fetch arbitrary
140
+ // public URLs the agent chooses" — is itself worth an operator opt-in.
141
+ // Mirrors the shellEnabled default above; set
142
+ // plugins.entries.ocuclaw.config.glassesUiLive.httpEnabled = true to
143
+ // enable. The dispatcher protection still applies once enabled.
144
+ httpEnabled: parseBool(raw.httpEnabled, false),
145
+ llmEnabled: parseBool(raw.llmEnabled, true),
146
+ maxConcurrentSurfacesPerHost: parseIntOrDefault(raw.maxConcurrentSurfacesPerHost, 4),
147
+ };
148
+ }
149
+
100
150
  export function createRuntimeConfig(opts = {}) {
101
151
  const pluginConfig = isObject(opts.pluginConfig) ? opts.pluginConfig : {};
102
152
  const openclawConfig = isObject(opts.openclawConfig) ? opts.openclawConfig : {};
@@ -106,7 +156,13 @@ export function createRuntimeConfig(opts = {}) {
106
156
 
107
157
  if (!relayToken) {
108
158
  throw new Error(
109
- "OcuClaw relayToken is required. Set plugins.entries.ocuclaw.config.relayToken.",
159
+ [
160
+ "OcuClaw relayToken is required.",
161
+ "Set the plugin config with:",
162
+ ' openclaw config set plugins.entries.ocuclaw.config.relayToken "your-token"',
163
+ "The same token must be entered in the OcuClaw app's relay server token field within Even Hub.",
164
+ "Then restart the gateway: openclaw gateway restart",
165
+ ].join("\n"),
110
166
  );
111
167
  }
112
168
  if (!gatewayUrl) {
@@ -120,6 +176,22 @@ export function createRuntimeConfig(opts = {}) {
120
176
  );
121
177
  }
122
178
 
179
+ const evenAiEnabled = parseBool(pluginConfig.evenAiEnabled, false);
180
+ const evenAiToken = pickString(pluginConfig.evenAiToken);
181
+ if (evenAiEnabled && !evenAiToken) {
182
+ throw new Error(
183
+ [
184
+ "OcuClaw evenAiToken is required when evenAiEnabled is true.",
185
+ "Set the plugin config with:",
186
+ ' openclaw config set plugins.entries.ocuclaw.config.evenAiToken "your-token"',
187
+ "The same token must be entered as the password in the Even AI Agent Configure section of the Even Realities app.",
188
+ "To disable Even AI instead, run:",
189
+ " openclaw config set plugins.entries.ocuclaw.config.evenAiEnabled false --strict-json",
190
+ "Then restart the gateway: openclaw gateway restart",
191
+ ].join("\n"),
192
+ );
193
+ }
194
+
123
195
  return {
124
196
  gatewayUrl,
125
197
  gatewayToken,
@@ -140,8 +212,8 @@ export function createRuntimeConfig(opts = {}) {
140
212
  pluginConfig.externalDebugToolsEnabled,
141
213
  false,
142
214
  ),
143
- evenAiEnabled: parseBool(pluginConfig.evenAiEnabled, false),
144
- evenAiToken: pickString(pluginConfig.evenAiToken),
215
+ evenAiEnabled,
216
+ evenAiToken,
145
217
  evenAiSystemPrompt: pickString(pluginConfig.evenAiSystemPrompt),
146
218
  evenAiRequestTimeoutMs: parseIntOrDefault(
147
219
  pluginConfig.evenAiRequestTimeoutMs,
@@ -159,6 +231,12 @@ export function createRuntimeConfig(opts = {}) {
159
231
  evenAiDedicatedSessionKey: parseEvenAiDedicatedSessionKey(
160
232
  pluginConfig.evenAiDedicatedSessionKey,
161
233
  ),
234
+ renderGlassesUiTimeoutMs: parseIntOrDefault(
235
+ pluginConfig.renderGlassesUiTimeoutMs,
236
+ 30 * 60 * 1000,
237
+ ),
238
+ glassesUiLive: resolveGlassesUiLive(pluginConfig.glassesUiLive),
239
+ freshnessWindowMs: parseIntOrDefault(pluginConfig.freshnessWindowMs, 5000),
162
240
  };
163
241
  }
164
242