Claus Ibsen created CAMEL-26961:
-----------------------------------
Summary: camel-jbang - an opt-in resident CLI daemon, so the short
commands run without a JVM start
Key: CAMEL-26961
URL: https://issues.apache.org/jira/browse/CAMEL-26961
Project: Camel
Issue Type: New Feature
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.25.0
An opt-in resident Camel CLI daemon, so the short commands of the Camel CLI
(version, ps, get, log, doc, catalog, the cmd actions, ...) run without a JVM
start. This is the design merged in CAMEL-26942: design/cli-short-commands.adoc
(https://github.com/apache/camel/pull/29890).
A prototype daemon answered in 26-73 ms, where a new JVM takes 0.15-0.42 s.
With a Java client a command takes 50-65 ms, under the 0.1 s at which a
response feels instant. The gain to look for is not the seconds but how agents
work: a CLI that answers at once gets called after every step (camel validate
after every edit, camel doc instead of guessing an option, camel status after
every reload).
*Before:* CAMEL-26937 (faster startup of the short commands) and CAMEL-26940
(JDK 25 AOT cache) first, then measure the agent loop again.
*Stages, each its own pull request:*
# The protocol over a Unix domain socket, the Java client in camel.sh and
camel.bat, the lifecycle (camel daemon start/status/stop, a start lock, idle
stop, version and plugin check), and the read-only commands that take no files.
The tests run each served command with and without the daemon and compare the
output, JSON and exit code.
# The directory, environment and terminal of each request, streaming and
cancel: validate, --watch and --follow.
# Child processes (run --background, restart) with the client's directory,
environment and JVM options, and readiness pushed over the WebSocket transport.
*Rules:*
* Opt-in: without the daemon nothing changes. CAMEL_CLI_DAEMON=false runs a
call in a new JVM.
* When the daemon cannot be reached, is busy, or does not serve a command, the
client runs it in a new JVM, so the daemon can only make a call faster.
* The socket lives in a directory only its user can open (mode 0700) under
~/.camel, with a fallback for long paths (104 bytes on macOS).
* Tell the agents: the Camel CLI pages, the MCP server instructions and the AI
panel prompt say the short commands are cheap, so look options up and validate
every snippet.
* Measure with a benchmark that drives camel through a shell. The daemon
becomes the default only after a release as opt-in, and when that benchmark
shows the gain.
*Not in scope:* the GraalVM native front (the design recommends against it). A
native client is optional, later.
*Open questions (from the design):* a setting in ~/.camel-cli.properties
besides camel daemon start; the socket location; the idle time (30 minutes
proposed); whether the TUI and camel mcp answer on the socket too.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)