cccc icon indicating copy to clipboard operation
cccc copied to clipboard

CLI: expose the existing actor_new_session op as `cccc actor new-session <actor>`

Open chriscoveries opened this issue 3 weeks ago • 2 comments

The daemon already implements actor_new_session (a fresh session for an actor, not a restart; crates/cccc-daemon/src/ops/actors.rs:45), and the Web UI uses it (POST /api/v1/groups/{group_id}/actors/{actor_id}/new_session), but the CLI has no verb for it. Scripts that need it today must speak the daemon socket protocol directly.

Use case: an operator script detects an actor whose context is full or whose turns keep timing out, and starts a fresh session for it unattended. cccc actor restart is not equivalent: it restarts the process but keeps the session (IPC spec, actor_restart vs actor_new_session).

Proposal: cccc actor new-session <actor_id> [--group G] [--by B], a thin wrapper over the op with the same argument names as cccc actor restart; exit 0 when the daemon answers ok, non-zero otherwise, printing the answer. Small, CLI-only, no new daemon behaviour. Happy to send the PR with a CLI test.

What it lets an operator drop: a small wrapper script (~50 lines) that talks to the daemon socket directly for this one call.

How this was checked

Read in source at v0.4.50 (fa04d0bc) and main (e81bbfc8): the op, its Web route, and the CLI's ActorAction set (no new-session verb). Duplicate search of issues and PRs found nothing asking for it.

chriscoveries avatar Nov 09 '26 03:11 chriscoveries

Thanks — confirmed. The daemon has actor_new_session, the Web and the MCP cccc_actor tool (action: new_session) already use it, and the CLI is the only port without it. We'd take the PR as proposed: cccc actor new-session <actor_id> [--group G] [--by B], reusing ActorTarget and the lifecycle path of cccc actor restart, so its arguments, output and exit status match restart.

Please keep the daemon's checks and errors as they are. Two limits remain for the unattended use case. An actor whose session is owned by its native runtime is refused with external_session_owned, because CCCC does not control that session. For a managed Claude actor, the result can report runtime_confirmation_required while a confirmation terminal is waiting, so an accepted call is not proof that the new session is ready. The command prints the full result, so a script can check that field.

Tests for argument parsing and forwarding, and for success and error output against a stand-in daemon, are enough; no real provider is needed. Please also add the verb where the CLI guide lists cccc actor restart (docs/guide/getting-started/cli.md). We can align the zh and ja copies if you'd rather not. We aren't working on a parallel implementation, so the PR is yours when you're ready.

ChesterRa avatar Nov 09 '26 09:11 ChesterRa

The requested CLI wrapper is now in #207. It reuses ActorTarget and the restart lifecycle path, preserves the full daemon result and existing errors, and adds forwarding/output tests plus the CLI guide entry. It does not relax external-session ownership checks or treat an accepted call as confirmation that a new session is ready. I'll keep follow-up changes on that PR.

chriscoveries avatar Nov 11 '26 13:11 chriscoveries