feat: replace session commands with a natural-language stop
Remove the /compact, /clear and /stop session commands. They were gated to the main room or SESSION_COMMAND_ALLOWED_SENDERS, neither of which exists in this deployment, so nobody could use them. The agent-runner /compact passthrough goes with them. Instead, a short human message whose whole intent is "stop" (그만, 멈춰, 중단해, 하지 마, 취소, stop, cancel, ...; see src/stop-intent.ts) stops the room when it has something to stop: a running or queued run, an open paired task, or unprocessed human messages before it. The message loop then - advances the room cursors past the stop message (memory + router_state) - completes the open paired task as user_stopped, cancels its open turns and drops its execution lease - closes stdin with a user-stop reason and kills the agent through the existing GroupQueue.closeStdin/killProcess - replies "진행 중이던 작업을 중단했습니다." once When nothing is running the message is handled as a normal message. The user-stop close reason is treated like a human interruption, so the killed paired turn releases its lease without counting a failure and queues no follow-up, and the turn controller does not post the generic failure text on top of the stop reply. advanceLastAgentCursor no longer moves a cursor backwards, so a run that finishes after the stop cannot rewind the cursor and re-dispatch the stop message (the respawn seen when an agent was only killed). Stale SESSION_COMMAND_* keys in .env are now ignored instead of failing startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,8 +17,8 @@ description: Customize Discord-only EJClaw behavior, routing, integrations, prom
|
||||
## 자주 보는 수정 지점
|
||||
|
||||
- `src/channels/discord.ts` - 디스코드 메시지 파싱, 멘션 규칙, 첨부파일 처리, 음성 전사
|
||||
- `src/index.ts` - 오케스트레이션, 세션 명령, 라우팅, 상태 갱신
|
||||
- `src/session-commands.ts` - `/compact`, `/clear` 같은 세션 명령
|
||||
- `src/index.ts` - 오케스트레이션, 라우팅, 상태 갱신
|
||||
- `src/stop-intent.ts`, `src/room-stop.ts` - "그만"/"stop" 같은 자연어 작업 중단
|
||||
- `src/db.ts` - 등록 그룹, 세션, 스케줄, 마이그레이션
|
||||
- `src/config.ts` - 서비스 식별값, 디렉터리, 타임아웃, 기능 플래그
|
||||
- `src/agent-runner.ts` - 에이전트 실행과 환경 변수 전달
|
||||
@@ -32,7 +32,7 @@ description: Customize Discord-only EJClaw behavior, routing, integrations, prom
|
||||
### 동작을 바꾸고 싶을 때
|
||||
|
||||
- 응답 조건, 멘션 처리, 첨부파일 처리: `src/channels/discord.ts`
|
||||
- 세션 명령, 상태머신, 런루프: `src/index.ts`, `src/session-commands.ts`
|
||||
- 작업 중단, 상태머신, 런루프: `src/index.ts`, `src/message-runtime-dispatch.ts`, `src/room-stop.ts`
|
||||
- 페르소나/응답 스타일: `groups/global/CLAUDE.md`
|
||||
|
||||
### 도구나 MCP를 붙일 때
|
||||
@@ -43,8 +43,7 @@ description: Customize Discord-only EJClaw behavior, routing, integrations, prom
|
||||
|
||||
### 새 명령을 만들 때
|
||||
|
||||
- 먼저 슬래시 명령인지, 자연어 규칙인지 구분합니다.
|
||||
- 슬래시/예약 명령이면 `src/session-commands.ts`와 `src/index.ts` 경로를 봅니다.
|
||||
- 슬래시 세션 명령은 없습니다. 런타임이 직접 처리해야 하는 짧은 자연어 명령이면 `src/room-stop.ts`처럼 메시지 루프(`src/message-runtime-dispatch.ts`)에서 가로챕니다.
|
||||
- 자연어 지시만으로 충분하면 프롬프트 문서만 수정합니다.
|
||||
|
||||
### 등록/배포 흐름을 바꿀 때
|
||||
|
||||
@@ -81,7 +81,7 @@ bun -e "import {Database} from 'bun:sqlite'; const db=new Database('store/messag
|
||||
|
||||
- `chat_jid`는 `dc:<channel_id>` 형식이어야 합니다. tribunal 방인데 `work_dir`가 비어 있으면 첫 턴에 자동 복구됩니다.
|
||||
- `folder`는 `discord_main` 또는 `discord_<name>` 형태를 유지합니다.
|
||||
- 세션 명령 문제면 `src/session-commands.ts`와 `src/index.ts` 호출부를 같이 봅니다.
|
||||
- 작업 중단("그만", "stop")이 안 먹으면 로그의 `Stopped room work on user request`와 `src/stop-intent.ts` 판정 규칙을 같이 봅니다.
|
||||
|
||||
## 원칙
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ USAGE_DASHBOARD=true
|
||||
|
||||
# 고급 설정
|
||||
MAX_CONCURRENT_AGENTS=5
|
||||
SESSION_COMMAND_ALLOWED_SENDERS=... # 세션 명령 허용 유저 ID (쉼표 구분)
|
||||
```
|
||||
|
||||
## 4. 러너 빌드
|
||||
|
||||
Reference in New Issue
Block a user