116 Commits

Author SHA1 Message Date
Mark Rachapoom
c73acb731f fix: send image attachments to gateway and prefix attached file paths
Two issues with image handling in chat:

1. Images pasted/dropped in chat were uploaded to disk but only file
   paths were sent as plain text. The model never received actual image
   bytes. Now sends base64 image data as `attachments` in the chat.send
   RPC so vision-capable models can see images directly.

2. Attached file paths (e.g. assets/screenshot.png) were not prefixed
   with the workspace root, unlike [Context: workspace file '...'] paths.
   The agent couldn't resolve relative paths. Now both patterns get the
   workspace prefix.

Files changed:
- chat-panel.tsx: read images as base64 via FileReader, send as FileUIPart
- chat/route.ts: extract image file parts, prefix attached file paths
- gateway/chat/route.ts: accept attachments in request body
- active-runs.ts: thread attachments through startRun
- agent-runner.ts: forward attachments to chat.send RPC
- chat-message.tsx: render inline image previews in user messages

Made-with: Cursor
2026-03-20 21:39:07 -07:00
Mark Rachapoom
c38d1281d4 fix: send Origin header in gateway WebSocket connections
The Node.js ws library doesn't send an Origin header by default.
When the client identifies as openclaw-control-ui, the gateway
enforces origin checks and rejects connections with missing origin.

Pass the gateway URL as the Origin header so the gateway's
local-loopback check sees a valid loopback origin and allows it.

Bump to v2.3.20.

Made-with: Cursor
2026-03-20 19:26:09 -07:00
Mark Rachapoom
587dd6ae64 feat: make gateway client ID configurable via OPENCLAW_GATEWAY_CLIENT_ID
The desktop app runs in daemonless mode without device identity files.
The gateway clears operator scopes for "gateway-client" connections
that lack device identity. Allow the client ID to be overridden via
env var so the desktop can identify as "openclaw-control-ui" and
receive operator scopes with dangerouslyDisableDeviceAuth enabled.

Fallback to "gateway-client" preserves existing behavior for CLI
and web users.

Bump to v2.3.19.

Made-with: Cursor
2026-03-20 16:26:25 -07:00
kumarabhirup
065dc6aa9a
TEST: fix tests for v2.3.15 2026-03-20 10:30:41 -07:00
kumarabhirup
ecf0091b91
🐛 FIX: CodeQL 2026-03-20 09:59:16 -07:00
kumarabhirup
3b211eee04
👌 IMPROVE: responsiveness 2026-03-19 19:46:52 -07:00
kumarabhirup
5ebb752600
📦 NEW: Show channels 2026-03-19 19:39:07 -07:00
kumarabhirup
295f5c008d
fix(agent): lower thinking level to high, fix indentation, and handle terminated errors
- Change thinkingLevel from xhigh to high for session patches
- Fix indentation of event handler blocks in wireSubscribeOnlyProcess
  and wireChildProcess
- Add user-friendly message when agent run is terminated by the gateway
2026-03-18 16:56:13 -07:00
kumarabhirup
351b71fd05
feat(telemetry): add person identity support and enable session replay
Add optional name, email, avatar, and denchOrgId fields to
telemetry.json. When present, all telemetry layers (CLI, web server,
web client, OpenClaw plugin) call PostHog identify() with $name,
$email, $avatar, and dench_org_id person properties.

Remove $process_person_profile:false from all layers so every install
gets a PostHog person profile. Enable session replay with masking
controlled by privacy mode (all text/inputs masked when on, nothing
masked when off).
2026-03-18 00:08:23 -07:00
kumarabhirup
98e9c245a5
feat(identity): extract DenchClaw identity into runtime plugin
Move identity injection from static IDENTITY.md generation at workspace seed
time to a runtime `dench-identity` OpenClaw plugin that prepends the system
prompt via the `before_prompt_build` hook. This keeps identity always current
without re-seeding, encourages dynamic skill discovery, and positions
DenchClaw as a CEO orchestrator that delegates to specialist subagents.
2026-03-17 16:24:00 -07:00
kumarabhirup
748e46ff9e
🚀 RELEASE: v2.3.7 2026-03-17 14:52:14 -07:00
kumarabhirup
ea8bab6179
feat(apps): expand platform API with objects, chat, store, cron, and webhooks
Enables apps to access the full DenchClaw platform — CRUD on workspace objects, AI chat with streaming, inter-app messaging, KV store, HTTP proxy, webhooks, cron scheduling, and widget display mode.
2026-03-17 14:42:01 -07:00
kumarabhirup
786a729c83
fix(agent-runner): attach WS listeners before open and always use chat.send
Prevents listener-attachment race after handshake and ensures all runs are session-tracked for reliable abort.
2026-03-17 14:41:39 -07:00
kumarabhirup
8fa221554e
feat(agent-runner): per-session lanes, lifecycle error recovery, and slash command support
Use per-session gateway lanes (web:sessionId) so concurrent chat tabs
stream independently. Add a 15s recovery window after lifecycle errors
to accept continuation runIds. Route slash commands through chat.send
RPC and forward chat events to the UI.
2026-03-17 12:35:26 -07:00
kumarabhirup
11478c752e
refactor(workspace): remove chat-slot agent pool to prevent workspace pollution
Chat-slot agents were being persisted as durable entries in openclaw.json,
causing spurious workspace directories (e.g. chat-slot-main-1) to appear.
Only explicit workspace creation via init now creates durable agent entries.
Workspace discovery and session routing ignore chat-slot internals.
2026-03-17 12:35:18 -07:00
kumarabhirup
0f864fb0ef
fix(agent-runner): remove Origin header to fix pairing required error
Server-side WebSocket connections should not set Origin (a browser security
concept). The header caused the gateway to treat the web runtime as a browser
client, blocking silent local device pairing after device identity auth was
added.
2026-03-15 13:18:12 -07:00
kumarabhirup
aa97489785
👌 IMPROVE: feat(telemetry): add DenchClaw and OpenClaw version tracking
Integrate version tracking for DenchClaw and OpenClaw into the telemetry system. The versions are now read from the package.json and environment variables, and are included in the PostHog client initialization and telemetry events. This enhancement allows for better monitoring and analytics of the versions in use.
2026-03-15 04:33:44 -07:00
Kumar Abhirup
022e8db3e9
Merge pull request #108 from DenchHQ/bp/7-agent-runner-device-auth
feat(agent-runner): add device identity challenge-response auth
2026-03-15 04:20:36 -07:00
kumarabhirup
a27d4d28f8
feat(agent-runner): add device identity challenge-response auth
Gateway connections use Ed25519 device keypair for challenge-response auth and surface actionable error messages for scope failures.
2026-03-15 04:18:22 -07:00
kumarabhirup
acc80615c4
refactor(workspace): add unified path resolution with browse mode support
resolveFilesystemPath replaces ad-hoc path helpers with a single resolver for absolute, home-relative, and workspace-relative paths.
2026-03-15 04:16:40 -07:00
kumarabhirup
89289bb31d
feat(chat): multi-session chat tabs with stop controls UI
Tab-based multi-chat system supporting concurrent parent and subagent sessions, per-session stop controls, layout/scroll fixes, and attachment display improvements.
2026-03-15 00:31:55 -07:00
kumarabhirup
8838cc4e16
feat(chat): add runs API, subagent registry, and cascade stop
Backend support for multi-session chat: /api/chat/runs endpoint for parent/subagent run status, subagent registry for reading run state, and cascade stop to abort child sessions when stopping a parent.
2026-03-15 00:30:43 -07:00
kumarabhirup
46fe15df81
fix(workspace): repair managed workspace routing and block reserved names
Prevent workspace-main / agent-main collision by adding ensureManagedWorkspaceRouting() repair on chat create/send/switch, and reject reserved workspace names (main, default, chat-slot-*).
2026-03-15 00:29:57 -07:00
kumarabhirup
7052395b0e
fix(workspace): parse YAML list syntax in parseSimpleYaml
parseSimpleYaml only matched `key: value` lines (regex required `.+`
after the colon), so `permissions:` followed by indented `- database`
list items was never parsed. This caused app bridge methods like
db.query to always fail with "Unknown method or insufficient
permissions" even when the app manifest granted the database permission.

Change the regex to `.*` to also match keys with no inline value, then
collect subsequent indented `- item` lines into an array.

Closes #87
2026-03-10 13:29:50 -07:00
kumarabhirup
c084caf78c
feat(terminal): enhance WebSocket connection handling and port management
- Refactor WebSocket connection logic to dynamically fetch the port from the server, improving flexibility.
- Introduce global variables to manage WebSocket server state and port, allowing for better control and error handling.
- Update terminal drawer component to use the new port fetching mechanism, ensuring consistent connection behavior.
2026-03-09 10:54:40 -07:00
kumarabhirup
e49b74c990
fix(terminal): keep terminal drawer open when shell process exits
The terminal drawer was flickering closed immediately after opening because
the spawned shell process exited with code 1, triggering handleExited →
closeTerminal → onClose which unmounted the entire drawer within ~500ms.

- Stop auto-closing the drawer on process exit so users can see error output
- Extract URL param building into testable buildWorkspaceSyncParams function
  that correctly includes terminal state, preventing param stripping on navigation
- Add 21 tests covering terminal param preservation across navigation scenarios
2026-03-09 10:06:25 -07:00
kumarabhirup
2c52012d1e
feat(chat): fix infinite loading and enable concurrent sessions
Chat panel froze because `thinking: "xhigh"` silently killed gateway runs, sessions used mutable global agent state, and OpenClaw's one-run-per-agent limit blocked concurrent chats.
2026-03-09 08:58:50 -07:00
kumarabhirup
8deeccf646
feat(web): add workspace app tabs and embedded runtime
This makes Dench apps behave like first-class workspace views with persistent tabs and embedded app loading instead of exposing raw folders.
2026-03-08 21:47:41 -07:00
kumarabhirup
1af9d75396
fix(terminal): add try/catch around PTY spawn to prevent silent hangs
Without error handling, if node-pty require or pty.spawn throws (bad
permissions, missing cwd, stale server), the client gets no response and
the terminal hangs with a blinking cursor. Now sends an exit event back.
2026-03-08 21:45:17 -07:00
kumarabhirup
e1fc698f2e
feat(web): add in-browser terminal panel (Cmd+J)
xterm.js frontend + node-pty WebSocket server spawning the user's real shell,
with drag-to-resize drawer, multi-terminal tabs, live theme sync, and URL state.
2026-03-08 20:45:10 -07:00
kumarabhirup
039cbe6a43
feat: async I/O, tags field type, rich chat messages, deploy verification
- Convert sync filesystem and DuckDB operations to async across API routes,
  workspace lib, and active-runs to prevent event loop blocking during tree
  discovery, object lookups, and database queries
- Add "tags" field type for free-form string arrays with parse-tags utility,
  TagsBadges/TagsInput UI components, filter operators, and CRM skill docs
- Preserve rich text formatting (bold, italic, code, @mentions) in user chat
  messages by sending HTML alongside plain text through the transport layer
- Detect empty-stream errors, improve agent error emission, and add file
  mutation queues for concurrent write safety in active-runs
- Add pre-publish standalone node_modules verification in deploy script
  checking serverExternalPackages are present
- Extract syncManagedSkills and discoverWorkspaceDirs for multi-workspace
  skill syncing, add ensureSeedAssets for runtime app dir
- Bump version 2.1.1 → 2.1.4
2026-03-08 19:53:18 -07:00
kumarabhirup
36e9cf9517
fix(agent-runner): ensure tool events stream on first chat message
sessions.patch for verboseLevel=full was called before the agent RPC
created the session, so it silently failed on new chats. Tool events
were never emitted and the frontend only showed brief text responses.

Now patches both before (for existing sessions) and after the agent RPC
(for newly created sessions). Also adds SSE keepalive to the POST /api/chat
stream to prevent connection drops during long tool executions, and removes
the unused legacy CLI spawn codepath.
2026-03-06 23:30:31 -08:00
kumarabhirup
eaef8df20b
fix(telemetry): prevent anonymousId from leaking via npm package
The root layout called getOrCreateAnonymousId() in a Server Component
without marking the route as dynamic. Next.js treated it as static,
pre-rendering the developer's UUID into the standalone build shipped
via npm — so every `npx denchclaw` user shared the same PostHog identity.

- Add `export const dynamic = "force-dynamic"` to root layout
- Replace `process.env.HOME || "~"` fallback with `homedir()` in web
  telemetry and posthog-analytics plugin (Node.js path.join doesn't
  expand "~", creating a relative path under cwd instead)
2026-03-06 23:30:31 -08:00
kumarabhirup
7cf895a3c7
fix(workspace): recursively search for nested object directories in findObjectDir
findObjectDir only searched the workspace root and one level deep, so objects
nested inside category folders (e.g. marketing/influencer/) were not discovered
by the views API. This caused saved views, active_view, and view_settings to
silently return empty for any object beyond depth 1.

Replace the single-level scan with a depth-limited recursive search (max 4
levels), skipping known heavy directories (node_modules, .git, .next, etc.).

The sidebar tree builder (buildTree in tree/route.ts) already walks recursively,
so this brings findObjectDir in line with the rest of the workspace discovery.
2026-03-06 00:41:26 -08:00
kumarabhirup
38b062a71e
chore: fix test mocks, suppress cron pageview tracking, and minor docs
Add workspace mock to agent-runner tests, skip PostHog pageviews on cron paths to reduce noise, document web-chat storage path in CRM skill, and include cursor plans and build info.
2026-03-05 21:20:35 -08:00
kumarabhirup
6044372614
feat(cron): add URL-backed view state for cron dashboard and job detail
Persist cronView, cronCalMode, cronDate, cronRunFilter, and cronRun in URL params so cron UI state survives navigation and refresh.
2026-03-05 21:19:58 -08:00
kumarabhirup
1c21b039fc
refactor(web): consolidate workspace onto root route with URL state machine
Move the workspace shell from /workspace to / and introduce a typed URL state codec (parseUrlState/serializeUrlState) for deep-linkable workspace params. Legacy /workspace URLs are still recognized for backward compatibility.
2026-03-05 19:09:29 -08:00
kumarabhirup
f9d454f5c7
feat(web): forward client identity to server and improve feedback traces
Bootstrap posthog-js with the persisted install ID from the server, forward distinctId to API routes, and restructure feedback traces to use chronological conversation order.
2026-03-05 19:09:19 -08:00
kumarabhirup
00c04f89d3
refactor(telemetry): remove server-side anonymous ID in favor of PostHog native tracking
Let PostHog generate its own distinct ID client-side instead of deriving one from hostname/username.
2026-03-05 16:09:06 -08:00
kumarabhirup
a771ab7259
fix: unify PostHog distinctId across client and server
Client-side posthog-js was using a random anonymous ID (reset every
page load) while server-side posthog-node used a deterministic
SHA256(hostname:username) hash. Bootstrap the client with the server's
anonymous ID so both sides share the same per-machine-per-user identity.
2026-03-05 10:47:36 -08:00
kumarabhirup
f41c0411eb
test: add port isolation tests for DenchClaw gateway fix
- New src/config/paths.test.ts: 11 tests covering resolveGatewayPort
  profile-aware precedence (env > config > profile > global default)
- Extend bootstrap-external.test.ts: 15 new tests for
  readExistingGatewayPort (config reading, fallback, edge cases) and
  isPersistedPortAcceptable (18789 rejection guard, end-to-end composition)
- Extend web-runtime-command.test.ts: 2 new tests verifying the fallback
  returns 19001 when manifest has no lastGatewayPort or is null
- Update test fixtures across all test files to expect port 19001

All 5 critical mutations verified: removing profile check, removing
18789 guard, reverting fallback, changing constant, breaking config
reader -- each caught by at least 2 tests.
2026-03-05 10:46:16 -08:00
kumarabhirup
912e7711bb
fix tests, add telemetry, deploy v2.0.4
- Fix bootstrap-command test: mock ensureManagedWebRuntime to probe
  directly instead of requiring standalone build on disk
- Add PostHog telemetry to CLI and web app with opt-out support
- Add dench alias package (npm rejects name; kept for future use)
- Bump version to 2.0.4 and publish to npm
2026-03-04 17:33:27 -08:00
kumarabhirup
ee6f3c6df3
chore: update package versions and add posthog dependencies
- Bump version of denchclaw to 2.0.2 in package.json.
- Add posthog-node and posthog-js dependencies with specified versions.
- Update chokidar dependency in web package.json.
- Modify deploy script to publish an alias package (dench) alongside denchclaw.
2026-03-04 17:09:22 -08:00
kumarabhirup
286d0fdb48
delete em all 2026-03-04 16:34:45 -08:00
kumarabhirup
4d6eec741d
npx denchclaw 2026-03-04 13:23:34 -08:00
kumarabhirup
b2c946b08d
test(web): cover multi-view resolution and scheduling interactions 2026-03-04 11:07:54 -08:00
kumarabhirup
b5987e931c
feat(web): add multi-view schema and settings persistence 2026-03-04 11:03:27 -08:00
kumarabhirup
68015d6c14
refactor(web): enhance entry detail and object table components for improved data handling
This commit introduces several enhancements across the EntryDetailModal and ObjectTable components. Key changes include the addition of a FormattedFieldValue component for consistent display of various field types, improved handling of entry metadata, and the introduction of input type resolution for fields. Additionally, navigation callbacks for entries have been refined to support better interaction within the object table. These updates aim to streamline data presentation and enhance user experience.
2026-03-03 22:54:12 -08:00
kumarabhirup
0820d7211f
fix(web): fall back to profile gateway WS target 2026-03-03 20:30:29 -08:00
kumarabhirup
a1cb0b8372
refactor(web): streamline subagent session enrichment and tool event handling
This commit refactors the handling of subagent sessions by removing the enrichSubagentMessages function and integrating its functionality into the GET request handler. It also introduces the enrichSubagentSessionFromTranscript function to enhance session data retrieval. Additionally, the persistSubscribeUserMessage function is updated to ensure user messages are saved to the session JSONL file, improving message persistence across page reloads. These changes enhance the clarity and efficiency of subagent session management.
2026-03-03 17:35:34 -08:00