From e86d0d93dd50c474015e6aa73fc16e8c08fe7e18 Mon Sep 17 00:00:00 2001 From: gavrielc Date: Tue, 21 Apr 2026 18:45:19 +0300 Subject: [PATCH] feat(setup): wire CLI agent in setup:auto Chains `cli-agent` (wraps scripts/init-cli-agent.ts) between service and verify. Without this wiring, the socket at data/cli.sock accepts the connection but there's no agent group routed to `cli/local`, so `pnpm run chat` hangs waiting for a reply. Defaults: display name from NANOCLAW_DISPLAY_NAME env, falling back to \$USER then "Operator". Agent persona name from NANOCLAW_AGENT_NAME, defaulting to the display name. Co-Authored-By: Claude Opus 4.7 (1M context) --- setup/auto.ts | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/setup/auto.ts b/setup/auto.ts index 66d6880..bbe6326 100644 --- a/setup/auto.ts +++ b/setup/auto.ts @@ -7,9 +7,12 @@ * module check). This driver picks up from there. * * Config via env: - * NANOCLAW_TZ IANA zone override (skip autodetect) - * NANOCLAW_SKIP comma-separated step names to skip - * (environment|timezone|container|onecli|auth|mounts|service|verify) + * NANOCLAW_TZ IANA zone override (skip autodetect) + * NANOCLAW_DISPLAY_NAME operator name for the CLI agent (default: $USER) + * NANOCLAW_AGENT_NAME agent persona name (default: display name) + * NANOCLAW_SKIP comma-separated step names to skip + * (environment|timezone|container|onecli|auth| + * mounts|service|cli-agent|verify) * * Anthropic credential registration runs via setup/register-claude-token.sh * (the only step that truly requires human input — browser sign-in or a @@ -194,6 +197,24 @@ async function main(): Promise { } } + if (!skip.has('cli-agent')) { + const displayName = + process.env.NANOCLAW_DISPLAY_NAME?.trim() || + process.env.USER?.trim() || + 'Operator'; + const agentName = process.env.NANOCLAW_AGENT_NAME?.trim(); + const args = ['--display-name', displayName]; + if (agentName) args.push('--agent-name', agentName); + + const res = await runStep('cli-agent', args); + if (!res.ok) { + fail( + 'CLI agent wiring failed', + 'Re-run `pnpm exec tsx scripts/init-cli-agent.ts --display-name ""` to fix.', + ); + } + } + if (!skip.has('verify')) { const res = await runStep('verify'); if (!res.ok) { @@ -202,10 +223,10 @@ async function main(): Promise { console.log(' • Anthropic secret not detected — re-run `bash setup/register-claude-token.sh`'); } if (!res.fields.CONFIGURED_CHANNELS) { - console.log(' • Install a channel: `/add-discord`, `/add-slack`, `/add-telegram`, …'); - } - if (res.fields.REGISTERED_GROUPS === '0') { - console.log(' • Wire the channel to an agent group: `/manage-channels`'); + console.log( + ' • Optional: add a messaging channel — `/add-discord`, `/add-slack`, `/add-telegram`, …', + ); + console.log(' (CLI channel is already wired: `pnpm run chat hi`)'); } return; }