Commit graph

23 commits

Author SHA1 Message Date
JerrettDavis
2edff08668 fix(openclaw): normalize engine messages for discord 2026-04-06 22:18:37 -05:00
Tejas Chopra
44493c92dd
Merge pull request #106 from JerrettDavis/fix/openclaw-local-install-hook
Fix OpenClaw local link installs for headroom plugin
2026-04-06 19:38:38 -07:00
JerrettDavis
746a1737c1 Select Headroom context engine on install 2026-04-06 21:35:58 -05:00
JerrettDavis
6e69c4ef2c Add OpenClaw hook shim for local link installs 2026-04-06 21:28:59 -05:00
JerrettDavis
95f7a0b74e Fix OpenClaw dist plugin installs 2026-04-06 21:21:23 -05:00
Tejas Chopra
f984021db1
Merge pull request #98 from JerrettDavis/hotfix/openclaw-toolcall-stream-linkage
fix(openclaw): preserve toolCall linkage for streaming tool outputs
2026-04-03 22:39:09 -07:00
JerrettDavis
c5e3686c89 feat(cli): add one-command OpenClaw wrap bootstrap 2026-04-03 23:08:13 -05:00
JerrettDavis
5f075dee81 fix(openclaw): preserve tool call linkage in converted history 2026-04-03 22:49:30 -05:00
JerrettDavis
3e368f13c8 refactor(openclaw): DRY up duplicate code across plugin
- Extract shared defaultLogger constant, use in both ProxyManager and
  HeadroomContextEngine (was duplicated inline in both constructors)
- Extract parseProxyUrl() helper, reused by normalizeAndValidateProxyUrl
  and withDefaultPort (eliminates redundant URL parsing)
- Add test helpers: stubProbeSuccess/NonHeadroom/Unreachable to replace
  6 identical inline fetch mock constructions
- Remove duplicate probe tests from engine.test.ts (already covered in
  proxy-manager.test.ts)
- Clean up unused probeHeadroomProxy import from engine.test.ts

Net: -26 lines, same coverage (28 tests)
2026-04-03 10:30:10 -05:00
JerrettDavis
89f3e5f01f fix(openclaw): proxyPort only applies to local URLs, consistency pass
- proxyPort default (8787) now only applied to local URLs; remote URLs
  use their protocol default (80/443) as expected
- Remove redundant localhost-only entries from network capabilities
  (covered by http://*:* and https://*:* wildcards)
- Sync package.json capabilities with openclaw.plugin.json
- Export isLocalProxyUrl from barrel index
- Fix JSDoc indentation in start() method
- Rename "Required Proxy Setup" to "Manual Proxy Setup" with accurate
  description for remote proxy users
- Clarify autoStart description: local-only, ignored for remote
- Add test: remote URL does not get proxyPort applied

Build: tsc clean, 30 tests passed
2026-04-03 10:30:10 -05:00
JerrettDavis
4c3d9c4e28 feat(openclaw): support remote Headroom proxy (connect-only)
Remove localhost-only restriction from proxyUrl validation. Remote URLs
are connect-only: the plugin probes and uses them but never attempts to
spawn a subprocess. Auto-start remains available for local addresses
(127.0.0.1/localhost) only.

- Accept http:// and https:// URLs for any hostname
- Add isLocalProxyUrl() helper to gate auto-start on local addresses
- Remote URLs that fail probe get a clear "Remote proxy not reachable"
  error instead of falling through to auto-start
- Update plugin.json schema, network capabilities, and UI hints
- Update plugin README with local vs remote proxy sections
- Add tests: remote connect, remote fail-fast, isLocalProxyUrl

Build: tsc --noEmit clean
Tests: 29 passed (0 skipped)
2026-04-03 10:30:09 -05:00
JerrettDavis
fa99ba785e docs: add OpenClaw plugin section to main README
Add dedicated OpenClaw plugin section with install instructions,
explanation of --dangerously-force-unsafe-install requirement (proxy
subprocess spawning), and quick config example. Links to plugin README
for full details. Update integration tables to reference new section.

Also fix proxy port handling: apply default proxyPort when explicit
proxyUrl omits port, and allow trailing slash in proxyUrl validation
pattern. Add test coverage for port defaulting behavior.
2026-04-03 10:30:09 -05:00
JerrettDavis
3e11dc6316 Remove skipped integration test registration 2026-04-02 22:51:13 -05:00
JerrettDavis
3569eabdbd Add comprehensive tests for proxy detection and launcher logic 2026-04-02 22:28:48 -05:00
JerrettDavis
593f1b7829 Restore pythonPath and proxyPort config support 2026-04-02 22:21:05 -05:00
JerrettDavis
536ef8b5e2 Clarify local npm install path for launcher detection 2026-04-02 22:12:53 -05:00
JerrettDavis
e4c7c47e34 Auto-detect proxyUrl by default and keep explicit override 2026-04-02 22:10:12 -05:00
JerrettDavis
74ca68888f Add ordered launcher fallback for headroom proxy startup 2026-04-02 21:52:26 -05:00
JerrettDavis
777ffeb716 Add controlled proxy autostart and unsafe-install guidance 2026-04-02 21:47:27 -05:00
JerrettDavis
205ec54df2 Harden openclaw plugin proxy handling and metadata 2026-04-02 21:27:12 -05:00
chopratejas
a1cd1c16dc Rename plugin to headroom-openclaw (npm scope not available) 2026-03-28 23:55:39 -07:00
chopratejas
a41c7f0c89 OpenClaw plugin fixes, telemetry fix, cost tracker improvement, tokenBudget support
OpenClaw plugin:
- Fix assistant content always returned as array (fixes flatMap crash)
- Clean up debug logging, restore clean plugin entry point
- Add test for text-only assistant round-trip
- Set headroom-ai dependency to npm (not local path)

Telemetry:
- Switch from sb_publishable_ to JWT anon key (PostgREST needs JWT for RLS)
- Switch from upsert to plain INSERT (anon role upsert was failing with 42501)
- Verified: full payload with all JSONB columns writes successfully (201)

Cost tracker:
- Use output_buffer instead of hardcoded 500 for cost estimation in client.py
- CostTracker counterfactual: value removed tokens at avg effective $/token
  (actual_spend / billed_tokens) instead of uncached list price — aligns
  savings with real billing mix (cache reads, writes, uncached)
- Add debug log for /stats summary payload
- Add 3 tests for new cost savings calculation

TypeScript SDK:
- Add tokenBudget param to compress(), HeadroomClient, CompressOptions
- Proxy /v1/compress accepts optional token_budget to override model limit
2026-03-28 23:46:03 -07:00
chopratejas
053c4a06af feat: add OpenClaw ContextEngine plugin (@headroom-ai/openclaw)
- HeadroomContextEngine: implements ContextEngine interface (bootstrap, ingest,
  assemble, compact, afterTurn, prepareSubagentSpawn, dispose)
- ProxyManager: auto-detects running proxy or spawns one as child process,
  health checks, restart on crash, graceful shutdown
- AgentMessage ↔ OpenAI format conversion (user, assistant/tool_use, toolResult)
- headroom_retrieve CCR tool: agent can retrieve original uncompressed content
- Plugin manifest (openclaw.plugin.json) with config schema
- 11 tests (6 unit + 5 integration), all passing
- Integration tested: 100 servers compressed, 3,735 tokens saved (82%)
2026-03-28 13:43:40 -07:00