cliclaw 1.0.10 → 1.0.12
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/ecosystem.config.js +9 -1
- package/package.json +1 -1
- package/src/agents/claude.ts +2 -1
- package/src/agents/codex.ts +2 -0
- package/src/telegram.ts +14 -3
package/ecosystem.config.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const HOME = process.env.HOME || process.env.USERPROFILE || '/root'
|
|
3
|
+
const SEP = process.platform === 'win32' ? ';' : ':'
|
|
4
|
+
// Always include npm global bin so spawned CLIs (claude, codex) are found
|
|
5
|
+
const NPM_BIN = process.platform === 'win32'
|
|
6
|
+
? path.join(process.env.APPDATA || path.join(HOME, 'AppData', 'Roaming'), 'npm')
|
|
7
|
+
: `${HOME}/.npm-global/bin:/usr/local/bin:/usr/bin:/bin`
|
|
8
|
+
const FULL_PATH = [process.env.PATH || '', NPM_BIN].filter(Boolean).join(SEP)
|
|
3
9
|
|
|
4
10
|
module.exports = {
|
|
5
11
|
apps: [{
|
|
@@ -12,8 +18,10 @@ module.exports = {
|
|
|
12
18
|
cwd: __dirname,
|
|
13
19
|
env: {
|
|
14
20
|
NODE_ENV: 'production',
|
|
15
|
-
PATH:
|
|
21
|
+
PATH: FULL_PATH,
|
|
16
22
|
HOME,
|
|
23
|
+
APPDATA: process.env.APPDATA || path.join(HOME, 'AppData', 'Roaming'),
|
|
24
|
+
USERPROFILE: process.env.USERPROFILE || HOME,
|
|
17
25
|
},
|
|
18
26
|
watch: false,
|
|
19
27
|
autorestart: true,
|
package/package.json
CHANGED
package/src/agents/claude.ts
CHANGED
|
@@ -38,7 +38,8 @@ function spawnClaude(args: string[]): Promise<ClaudeResult> {
|
|
|
38
38
|
return new Promise((resolve, reject) => {
|
|
39
39
|
let stdout = ''
|
|
40
40
|
let stderr = ''
|
|
41
|
-
|
|
41
|
+
// On Windows, npm binaries are .cmd files — shell:true is required to find them
|
|
42
|
+
const proc = spawn('claude', args, { env: buildEnv(), shell: process.platform === 'win32' })
|
|
42
43
|
proc.stdout.on('data', (d: Buffer) => { stdout += d.toString() })
|
|
43
44
|
proc.stderr.on('data', (d: Buffer) => { stderr += d.toString() })
|
|
44
45
|
proc.on('close', (code) => {
|
package/src/agents/codex.ts
CHANGED
|
@@ -18,9 +18,11 @@ const BASE_ENV = {
|
|
|
18
18
|
function spawnCodex(args: string[]): Promise<{ text: string; threadId: string | null; usage?: TokenUsage }> {
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
20
20
|
let stdout = ''
|
|
21
|
+
// On Windows, npm binaries are .cmd files — shell:true is required to find them
|
|
21
22
|
const proc = spawn('codex', args, {
|
|
22
23
|
env: { ...process.env, ...BASE_ENV },
|
|
23
24
|
cwd: process.cwd(),
|
|
25
|
+
shell: process.platform === 'win32',
|
|
24
26
|
})
|
|
25
27
|
proc.stdout.on('data', (d: Buffer) => { stdout += d.toString() })
|
|
26
28
|
proc.stderr.on('data', (d: Buffer) => {
|
package/src/telegram.ts
CHANGED
|
@@ -36,10 +36,21 @@ export function formatTelegramMarkdown(text: string): string {
|
|
|
36
36
|
(_match, label = '', url = '') => `[${escapeTelegramMarkdownV2(label)}](${url.replace(/\\/g, '\\\\').replace(/\)/g, '\\)')})`
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
// Headings and bold must use protectSegments so their *markers* aren't
|
|
40
|
+
// escaped again by the global escapeTelegramMarkdownV2 call below.
|
|
41
|
+
protectSegments(
|
|
42
|
+
/^#{1,6}[ \t]+(.+)$/gm,
|
|
43
|
+
(_match, title = '') => `*${escapeTelegramMarkdownV2(title.trim())}*`
|
|
44
|
+
)
|
|
40
45
|
formatted = formatted.replace(/^(?:[ \t]*)([-*])[ \t]+/gm, '• ')
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
protectSegments(
|
|
47
|
+
/\*\*([^*\n]+)\*\*/g,
|
|
48
|
+
(_match, bold = '') => `*${escapeTelegramMarkdownV2(bold)}*`
|
|
49
|
+
)
|
|
50
|
+
protectSegments(
|
|
51
|
+
/__([^_\n]+)__/g,
|
|
52
|
+
(_match, bold = '') => `*${escapeTelegramMarkdownV2(bold)}*`
|
|
53
|
+
)
|
|
43
54
|
|
|
44
55
|
formatted = escapeTelegramMarkdownV2(formatted)
|
|
45
56
|
|