cliclaw 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -189,13 +189,12 @@ async function runConfigWizard() {
189
189
  console.log(`${c.gray} Leave empty to configure later.\n${c.reset}`)
190
190
  const forumId = await prompt('FORUM_GROUP_ID (Enter to skip)', existing.FORUM_GROUP_ID || '')
191
191
 
192
- console.log(`\n${c.bold}Permission mode${c.reset}`)
193
- console.log(` ${c.bold}1) auto${c.reset} — always skip prompts ${c.cyan}(recommended)${c.reset}`)
194
- console.log(` ${c.bold}2) session${c.reset} ask per /new session`)
195
- console.log(` ${c.bold}3) ask${c.reset} — prefix message with ! to allow\n`)
196
- const permChoice = await prompt('Choose [1/2/3]',
197
- existing.PERMISSION_MODE === 'session' ? '2' : existing.PERMISSION_MODE === 'ask' ? '3' : '1')
198
- const permMode = permChoice === '2' ? 'session' : permChoice === '3' ? 'ask' : 'auto'
192
+ console.log(`\n${c.bold}Aprovação de comandos${c.reset} ${c.gray}(todos os agentes)${c.reset}`)
193
+ console.log(` ${c.bold}1) ask${c.reset} — pergunta antes de executar cada comando ${c.cyan}(recomendado)${c.reset}`)
194
+ console.log(` ${c.bold}2) allow${c.reset} executa tudo automaticamente sem perguntar\n`)
195
+ const permChoice = await prompt('Escolha [1/2]',
196
+ (existing.PERMISSION_MODE || existing.CODEX_APPROVAL) === 'allow' ? '2' : '1')
197
+ const permMode = permChoice === '2' ? 'allow' : 'ask'
199
198
  ok(`Permission mode: ${permMode}`)
200
199
 
201
200
  const dataDir = existing.DATA_DIR || path.join(USER_DIR, 'data')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cliclaw",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Telegram bot bridging AI CLIs (Claude Code, Codex) to Forum Topics",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -14,8 +14,8 @@ const BASE_ENV = {
14
14
  LANG: 'en_US.UTF-8',
15
15
  }
16
16
 
17
- const SESSION_TTL_MS = 30 * 60 * 1000 // kill idle processes after 30 min
18
- const RESPONSE_TIMEOUT_MS = 120_000 // 2 min per message
17
+ const SESSION_TTL_MS = 30 * 60 * 1000 // kill idle processes after 30 min
18
+ const RESPONSE_TIMEOUT_MS = 10 * 60_000 // 10 min allows time for user approval clicks
19
19
 
20
20
  interface PendingReq {
21
21
  resolve: (r: { text: string; usage?: TokenUsage }) => void
package/src/config.ts CHANGED
@@ -4,8 +4,8 @@ import { join } from 'path'
4
4
  import { homedir } from 'os'
5
5
 
6
6
  export type AgentName = 'claude' | 'codex'
7
- export type PermissionMode = 'auto' | 'session' | 'ask'
8
- export type CodexApproval = 'ask' | 'allow'
7
+ /** ask = ask before each command | allow = auto-approve everything */
8
+ export type PermissionMode = 'ask' | 'allow'
9
9
 
10
10
  export interface Config {
11
11
  TELEGRAM_BOT_TOKEN: string
@@ -13,7 +13,6 @@ export interface Config {
13
13
  FORUM_GROUP_ID: string
14
14
  TELEGRAM_ADMIN_IDS: string[]
15
15
  PERMISSION_MODE: PermissionMode
16
- CODEX_APPROVAL: CodexApproval
17
16
  availableAgents: AgentName[]
18
17
  }
19
18
 
@@ -56,13 +55,9 @@ export function loadConfig(): Config {
56
55
  }
57
56
  }
58
57
 
59
- const rawMode = (process.env.PERMISSION_MODE || 'auto').toLowerCase()
60
- const permMode: PermissionMode =
61
- rawMode === 'session' ? 'session' :
62
- rawMode === 'ask' ? 'ask' : 'auto'
63
-
64
- const rawApproval = (process.env.CODEX_APPROVAL || 'ask').toLowerCase()
65
- const codexApproval: CodexApproval = rawApproval === 'allow' ? 'allow' : 'ask'
58
+ // Support both PERMISSION_MODE and legacy CODEX_APPROVAL
59
+ const rawMode = (process.env.PERMISSION_MODE || process.env.CODEX_APPROVAL || 'ask').toLowerCase()
60
+ const permMode: PermissionMode = rawMode === 'allow' ? 'allow' : 'ask'
66
61
 
67
62
  const config: Config = {
68
63
  TELEGRAM_BOT_TOKEN: process.env.TELEGRAM_BOT_TOKEN || '',
@@ -71,7 +66,6 @@ export function loadConfig(): Config {
71
66
  TELEGRAM_ADMIN_IDS: (process.env.TELEGRAM_ADMIN_IDS || '')
72
67
  .split(',').map(id => id.trim()).filter(Boolean),
73
68
  PERMISSION_MODE: permMode,
74
- CODEX_APPROVAL: codexApproval,
75
69
  availableAgents: checkAgents(),
76
70
  }
77
71
 
@@ -86,7 +80,7 @@ export function loadConfig(): Config {
86
80
  if (config.availableAgents.length === 0) {
87
81
  console.warn('\n⚠️ No AI CLIs found in PATH. Run /start in Telegram for setup instructions.\n')
88
82
  } else {
89
- console.log(`✅ Available agents: ${config.availableAgents.join(', ')} | Permission mode: ${config.PERMISSION_MODE}`)
83
+ console.log(`✅ Available agents: ${config.availableAgents.join(', ')} | Approval: ${config.PERMISSION_MODE}`)
90
84
  }
91
85
 
92
86
  return config
@@ -102,8 +102,8 @@ export function registerMessageHandler(bot: Bot<Context>, storage: Storage, conf
102
102
 
103
103
  storage.addMessage(chatId, session.id, 'user', text)
104
104
 
105
- // ── build codex approval handler (only if CODEX_APPROVAL=ask) ──────────
106
- const codexApprovalHandler = (session.model === 'codex' && config.CODEX_APPROVAL === 'ask')
105
+ // ── build codex approval handler (only if PERMISSION_MODE=ask) ─────────
106
+ const codexApprovalHandler = (session.model === 'codex' && config.PERMISSION_MODE === 'ask')
107
107
  ? (callId: string, cmdStr: string) => {
108
108
  const approvalId = randomUUID()
109
109
  ctx.api.sendMessage(chatId,