8422 Commits

Author SHA1 Message Date
kumarabhirup
7fe870fec0
👌 IMPROVE: caching 2026-03-18 17:23:49 -07:00
kumarabhirup
104628ed9c
fix(bootstrap): set agents.defaults.timeoutSeconds=86400 to prevent premature termination
OpenClaw's default agent timeout is 600s (10 min), which consistently kills
long-running agent responses — especially multi-file code generation and
complex multi-tool-call workflows. This triggers:

- 'terminated' errors mid-stream (webchat shows terminated banner)
- Retry storms: same runId retries ~60s apart, then new runIds also fail
- Follow-up messages silently dropped (shouldSkipMessageByAbortCutoff)

Set the default to 86400s (24 hours) during bootstrap so all DenchClaw
installations get a sane timeout out of the box. Note: the runtime code
supports timeoutSeconds=0 (no timeout) but the config schema validation
rejects 0 (exclusiveMinimum: 0), so 86400 is the practical maximum.

Also rename ensureSubagentDefaults -> ensureAgentDefaults since the function
now configures both agent-level and subagent-level settings.

Refs:
- https://github.com/openclaw/openclaw/issues/30487
- https://github.com/openclaw/openclaw/issues/46049
- https://github.com/openclaw/openclaw/issues/30083
2026-03-18 13:50:56 -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
Mark
f4ce923f5c fix(cli): add rollback safety net and crash diagnostics for web runtime updates
- Back up existing app dir before replacing (enables rollback on crash)
- Rollback to previous working runtime when new version fails readiness probe
- Early exit in waitForWebRuntime() when spawned process dies (saves 15s)
- Include web-app.err.log tail in probe failure reason for diagnostics
- Clean up backup after successful probe

Made-with: Cursor
2026-03-17 13:10:47 -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
76f8838362
feat(cli): add daemonless mode for container/cloud environments
Support DENCHCLAW_DAEMONLESS=1 env var and --skip-daemon-install flag
across all commands (bootstrap, update, start, restart, stop) to skip
gateway daemon management and LaunchAgent registration in environments
without systemd/launchd.
2026-03-15 21:25:25 -07:00
kumarabhirup
4436e57d9a
fix(bootstrap): eliminate gateway probe race and pre-onboard config failures
Pre-onboard config (gateway.mode, gateway.port, plugin trust) used to call
`openclaw config set` before `openclaw onboard` created the profile, causing
"Failed to set ..." errors on fresh installs (#101). All pre-onboard config is
now staged via raw JSON writes. Hidden gateway restarts inside syncBundledPlugins
are removed; one explicit restart happens after all post-onboard config, followed
by retried health probes so bootstrap no longer falsely reports "gateway closed"
while the gateway is simply finishing startup.
2026-03-15 17:16:05 -07:00
kumarabhirup
fc04de7eb8
🚀 RELEASE: v2.3.3 2026-03-15 14:52:23 -07:00
kumarabhirup
8fd2fe396a
🚀 RELEASE: v2.3.2 2026-03-15 13:53:53 -07:00
kumarabhirup
c16ecb899f
🐛 FIX: model context 2026-03-15 13:27:09 -07:00
kumarabhirup
45acfbb493
fix(telemetry): emit per-turn cost instead of cumulative session total
extractUsageFromMessages was summing ALL assistant messages, so each
$ai_generation event reported a growing cumulative total — PostHog's
sum() then massively over-counted costs (e.g. $634 reported vs $73 actual).
2026-03-15 13:09:54 -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
kumarabhirup
1c92aaf5d7
fix(bootstrap): create workspace dir before setting openclaw config
On fresh Linux installs (e.g. running as root), `openclaw config set
agents.defaults.workspace` fails because the target directory doesn't
exist yet — some OpenClaw builds validate the path on disk before
accepting the value. Create the directory eagerly with mkdirSync before
the config set call.

Also surface the exit code in runOpenClawOrThrow errors when stderr is
empty, so silent failures are easier to diagnose.

Fixes #101
2026-03-15 04:29:07 -07:00
Kumar Abhirup
c89c3d8be2
Merge pull request #104 from DenchHQ/bp/3-dench-cloud-bootstrap
feat(cli): integrate Dench Cloud setup into bootstrap flow
2026-03-15 04:20:42 -07:00
kumarabhirup
9a784d275e
feat(cli): integrate Dench Cloud setup into bootstrap flow
Bootstrap now prompts for Dench Cloud API key and model, syncs bundled plugins generically, and migrates legacy dench-cloud-provider.
2026-03-15 04:16:01 -07:00
kumarabhirup
1af869f64b
feat(cli): add dench-cloud model catalog and config helpers
Shared module for Dench Cloud catalog fetching, API key validation, and OpenClaw config patching.
2026-03-15 04:15:29 -07:00
Kumar Abhirup
e490380d01
Merge pull request #90 from alexanderwcheney/fix/bootstrap-gateway-mode-ordering
fix(bootstrap): set gateway.mode before onboard to prevent crash loop
2026-03-15 02:16:57 -07:00
kumarabhirup
2efe2ecf41
fix(bootstrap): preserve gateway config around onboarding
Set gateway mode and port before onboarding so the first daemon start succeeds, then reapply them after onboarding so wizard defaults cannot drift DenchClaw off its expected local gateway.
2026-03-15 01:05:43 -07:00
kumarabhirup
557cff6a52
feat(cli): persist web UI across reboots via macOS LaunchAgent
The gateway auto-starts on boot but the web runtime dies; this adds an
equivalent LaunchAgent so the web UI also survives reboots.
2026-03-11 21:11:41 -07:00
Alex Cheney
13cdeba7e3 fix(bootstrap): set gateway.mode before onboard to prevent crash loop
During bootstrap, `onboard --install-daemon` starts the gateway daemon
immediately. The gateway's startup guard requires `gateway.mode=local`
but this was only set *after* onboard completed, causing the daemon to
block with "Gateway start blocked: set gateway.mode=local" and enter a
crash loop. The web UI then fails with "Gateway WebSocket connection
failed".

Move `ensureGatewayModeLocal()` and `ensureGatewayPort()` to run before
the onboard command so the config is in place when the daemon first
starts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:37:24 -07:00
kumarabhirup
0681c4ad23
fix(bootstrap): strip npm_config_* env vars from npm global commands
When denchclaw is launched via `npx`, npm injects environment variables
(most critically `npm_config_prefix`) that redirect `npm install -g` and
`npm ls -g` to a temporary npx-managed prefix instead of the user's real
global npm directory. This causes openclaw to be installed to a location
that doesn't persist on PATH, so subsequent commands like `denchclaw
restart` fail with "openclaw CLI not found".

Strip `npm_config_*`, `npm_package_*`, and npm lifecycle variables from
the environment passed to npm global commands (`npm ls -g`, `npm install
-g`, `npm prefix -g`) so they use the user's actual npm configuration.
2026-03-10 14:08:37 -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
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
ec73141a01
chore: bump version to 2.0.16 and enhance feedback API message handling
Update package versions for denchclaw and dench to 2.0.16. Refactor feedback API to convert chat lines into PostHog-compatible messages, preserving chronological order and including tool calls and results. Improve test cases to reflect changes in message handling.
2026-03-05 21:38:55 -08:00
kumarabhirup
83f6b69f82
feat(telemetry): use session key as trace ID and improve AI event inputs
Use the session key directly as the PostHog trace ID so feedback and generation events share the same trace. Extract non-assistant messages from conversations for $ai_input.
2026-03-05 19:09:13 -08:00
kumarabhirup
a0853ec83c
feat(telemetry): unified identity for PostHog plugin with key fallback
Plugin reads the same persisted install ID from telemetry.json and falls back to a build-time baked PostHog key when no config-level key is set.
2026-03-05 19:09:05 -08:00
kumarabhirup
1e21185d47
feat(telemetry): replace hostname hash with persisted install-scoped anonymous ID
A random UUID is generated on first run and stored in ~/.openclaw-dench/telemetry.json, replacing the SHA-256 hostname hash that could theoretically be reversed.
2026-03-05 19:09:00 -08:00
kumarabhirup
261f49de9b
feat(telemetry): add trace conversation state and improve tool extraction
Populates $ai_input_state/$ai_output_state on traces for full conversation view in PostHog, and handles toolCall content blocks.
2026-03-05 15:35:57 -08:00
kumarabhirup
6b794dac4e
feat(telemetry): add structure-preserving privacy redaction
Redacts text content and tool arguments while keeping roles, tool names, and message ordering visible in PostHog.
2026-03-05 15:35:51 -08:00
kumarabhirup
ddac5c777b
fix(cli): restart gateway after bundled plugin install
Ensures newly installed or updated plugins are loaded without manual restart.
2026-03-05 15:35:46 -08:00
kumarabhirup
113b1ffb17
docs: use npx prefix in telemetry CLI commands
Users run via npx, not a global install — fix all examples and output messages.
2026-03-05 15:35:42 -08:00
kumarabhirup
251ad368a7
feat: add noOpen option to web runtime commands and prompt for browser opening
Introduce a `noOpen` option across various web runtime commands to control automatic browser opening. Implement a prompt to ask users if they want to open the web UI, enhancing user experience and flexibility during command execution.
2026-03-05 14:04:15 -08:00
kumarabhirup
136d3049b7
feat: add configuration for plugin load paths in OpenClaw
Enhance the installBundledPlugins function to set the plugins.load.paths configuration for posthog-analytics using OpenClaw. This addition allows for dynamic loading of plugin paths, improving plugin management during the bootstrap process.
2026-03-05 13:57:38 -08:00
kumarabhirup
8755c509f8
feat: extract real token usage from messages and auto-restart gateway on web runtime updates
Add extractUsageFromMessages and normalizeOutputForPostHog to pull actual
token counts and cost from OpenClaw per-message usage metadata, and convert
Anthropic-style tool call blocks to OpenAI format for PostHog AI observability.

Integrate gateway daemon restart (stop → install → start) into both the
update and start web runtime commands so the gateway stays in sync with
runtime upgrades.
2026-03-05 13:46:51 -08:00
kumarabhirup
460bf6bf6e
fix: resolve PostHog trace linkage, cost display, and tool capture
Switch TraceContextManager from runId to sessionId-based indexing so
tool spans share the same trace_id as their parent generation. Extract
tool names from agent_end messages for the PostHog Tools tab. Guard
against sending $0 cost and null token counts.
2026-03-05 12:58:24 -08:00
kumarabhirup
fdd89b4e6f
feat: add PostHog AI observability, feedback UI, and telemetry privacy mode
Integrate PostHog LLM Analytics via a bundled OpenClaw plugin that captures
$ai_generation, $ai_span, and $ai_trace events with configurable privacy
mode (content redaction on by default). Add like/dislike feedback buttons
to the web chat UI backed by a /api/feedback route. Extend the CLI with
`telemetry privacy on|off` subcommands and fix command delegation so
telemetry subcommands aren't forwarded to OpenClaw. Harden the web runtime
installer to auto-flatten pnpm standalone deps and dereference dangling
symlinks, preventing "Cannot find module 'next'" crashes in dev. Move
plugin installation before onboard in bootstrap so the gateway starts
with plugins.allow already configured.
2026-03-05 12:28:08 -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
4bcd47b848
fix: prevent DenchClaw gateway from hijacking OpenClaw's port 18789
The bootstrap port selection logic tried OpenClaw's default port (18789)
before the DenchClaw range (19001+). If OpenClaw was temporarily down
during bootstrap, DenchClaw would claim 18789 and persist it to config
and the LaunchAgent plist, killing OpenClaw on every subsequent restart.

- Remove the DEFAULT_GATEWAY_PORT (18789) branch from bootstrap; always
  start from DENCHCLAW_GATEWAY_PORT_START (19001)
- Read previously persisted config port and reuse it (unless it is 18789)
- Extract isPersistedPortAcceptable guard to reject corrupted 18789 state
- Add DENCHCLAW_DEFAULT_GATEWAY_PORT constant and make resolveGatewayPort
  profile-aware so the "dench" profile falls back to 19001
- Fix hardcoded 18789 fallback in web-runtime-command.ts
2026-03-05 10:46:03 -08:00
kumarabhirup
8847e44854
feat(cli): add flatten-standalone-deps for pnpm standalone builds
pnpm's standalone output uses symlinks that npm pack silently drops, breaking require('next') on user machines. This flattens the virtual store into a standard node_modules layout.
2026-03-04 19:06:50 -08:00
kumarabhirup
ec973f40d3
fix(cli): update bootstrap onboard test for accept-risk and skip-ui flags
Onboard command now passes --accept-risk and --skip-ui by default; align test expectations.
2026-03-04 19:06:44 -08:00
kumarabhirup
b4b644a726
fix(cli): dereference symlinks during web runtime installation
pnpm standalone output contains symlinks that break after npm pack; dereference ensures real files are copied.
2026-03-04 19:06:40 -08:00
kumarabhirup
78e04e20b8
fix(cli): improve bootstrap onboard UX and fix command references
Always pass --skip-ui and --accept-risk to openclaw onboard so the
wizard never prompts for TUI/Web UI selection — bootstrap manages the
web UI lifecycle itself. Add a post-onboard spinner to eliminate the
silent gap while config-set calls, gateway probing, and web runtime
startup run. Fix remediation messages to use `npx denchclaw`.
2026-03-04 18:33:17 -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
286d0fdb48
delete em all 2026-03-04 16:34:45 -08:00
kumarabhirup
af45d4d17b
CLI: add managed web runtime with start/stop/update commands and major-version gating
Refactor bootstrap to use a managed web runtime lifecycle instead of
ad-hoc standalone server spawning. The managed runtime copies packaged
Next.js assets into ~/.openclaw-dench/web-runtime/, tracks deployment
state via manifest/process metadata, and cleanly separates Dench-owned
processes from foreign listeners on the target port.

- Fix false-negative web readiness when /api/profiles returns null
  activeProfile (first-run regression).
- Add `dench start` (start without updating assets), `dench stop`
  (terminate only Dench-managed web server), and `dench update`
  (refresh web runtime with major-version OpenClaw update gate).
- Major-version transitions (e.g. v2->v3) require mandatory OpenClaw
  update; non-interactive mode fails closed without --yes.
- All lifecycle commands show the ASCII banner/logo animation.
- Deploy smoke checks now verify update/stop/start --help paths.
2026-03-04 16:32:58 -08:00
kumarabhirup
4d6eec741d
npx denchclaw 2026-03-04 13:23:34 -08:00
kumarabhirup
1c93a3b525
fix(cli): enforce full tool profile in dench bootstrap 2026-03-04 13:18:39 -08:00
kumarabhirup
7fa49f58ce
feat(cli): add ensureSubagentDefaults function to set default subagent configurations
This commit introduces the ensureSubagentDefaults function, which sets various default configurations for subagents, including max concurrent agents, max spawn depth, and run timeout settings. The function is called during the bootstrap process to ensure these defaults are applied for the specified profile.
2026-03-03 16:34:03 -08:00
kumarabhirup
33589ca5ca
delete: remove debug log file and update Ironclaw identity in workspace seed
This commit deletes the debug.log file, which contained subagent session logs, and updates the Ironclaw identity in workspace-seed.ts to reflect the new author, changing from Kumar Abhirup to Dench.
2026-03-03 16:29:12 -08:00