cliclaw 1.0.41 → 1.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cliclaw",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Telegram bot bridging AI CLIs (Claude Code, Codex) to Forum Topics",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -34,7 +34,7 @@ interface ClaudeResult {
34
34
  usage?: TokenUsage
35
35
  }
36
36
 
37
- function spawnClaude(args: string[]): Promise<ClaudeResult> {
37
+ function spawnClaude(args: string[], stdinText?: string): Promise<ClaudeResult> {
38
38
  return new Promise((resolve, reject) => {
39
39
  let stdout = ''
40
40
  let stderr = ''
@@ -43,8 +43,11 @@ function spawnClaude(args: string[]): Promise<ClaudeResult> {
43
43
  env: buildEnv(),
44
44
  shell: isWin,
45
45
  windowsHide: true,
46
- stdio: ['ignore', 'pipe', 'pipe'], // explicit: ignore stdin so headless PM2 doesn't hang
46
+ stdio: [stdinText !== undefined ? 'pipe' : 'ignore', 'pipe', 'pipe'],
47
47
  })
48
+ if (stdinText !== undefined) {
49
+ proc.stdin!.end(stdinText, 'utf8')
50
+ }
48
51
  proc.stdout.on('data', (d: Buffer) => { stdout += d.toString() })
49
52
  proc.stderr.on('data', (d: Buffer) => { stderr += d.toString() })
50
53
  proc.on('close', (code) => {
@@ -80,18 +83,18 @@ export async function askClaude(
80
83
  if (session.claudeSessionId) {
81
84
  return await spawnClaude([
82
85
  '--resume', session.claudeSessionId,
83
- '-p', userMessage,
86
+ '-p',
84
87
  '--output-format', 'json',
85
88
  '--dangerously-skip-permissions',
86
- ])
89
+ ], userMessage)
87
90
  } else {
88
91
  const newId = randomUUID()
89
92
  const result = await spawnClaude([
90
- '-p', userMessage,
93
+ '-p',
91
94
  '--output-format', 'json',
92
95
  '--session-id', newId,
93
96
  '--dangerously-skip-permissions',
94
- ])
97
+ ], userMessage)
95
98
  onNewSessionId?.(result.sessionId ?? newId)
96
99
  return result
97
100
  }