kernelbot 1.0.18 → 1.0.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/coder.js +22 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kernelbot",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "KernelBot — AI engineering agent with full OS control",
5
5
  "type": "module",
6
6
  "author": "Abdullah Al-Taheri <abdullah@altaheri.me>",
package/src/coder.js CHANGED
@@ -146,23 +146,25 @@ export class ClaudeCodeSpawner {
146
146
 
147
147
  ensureClaudeCodeSetup();
148
148
 
149
- logger.info(`Spawning Claude Code in ${workingDirectory}${this.model ? ` (model: ${this.model})` : ''}`);
150
- if (onOutput) onOutput(`⏳ Starting Claude Code...`).catch(() => {});
149
+ const args = [
150
+ '-p', prompt,
151
+ '--max-turns', String(turns),
152
+ '--output-format', 'stream-json',
153
+ '--dangerously-skip-permissions',
154
+ ];
155
+ if (this.model) {
156
+ args.push('--model', this.model);
157
+ }
151
158
 
152
- return new Promise((resolve, reject) => {
153
- const args = [
154
- '-p', prompt,
155
- '--max-turns', String(turns),
156
- '--output-format', 'stream-json',
157
- '--dangerously-skip-permissions',
158
- ];
159
- if (this.model) {
160
- args.push('--model', this.model);
161
- }
159
+ const cmd = `claude ${args.map((a) => a.includes(' ') ? `"${a}"` : a).join(' ')}`;
160
+ logger.info(`Spawning: ${cmd.slice(0, 300)}`);
161
+ logger.info(`CWD: ${workingDirectory}`);
162
+ if (onOutput) onOutput(`⏳ Starting Claude Code...\n\`${cmd.slice(0, 200)}\``).catch(() => {});
162
163
 
164
+ return new Promise((resolve, reject) => {
163
165
  const child = spawn('claude', args, {
164
166
  cwd: workingDirectory,
165
- env: { ...process.env },
167
+ env: { ...process.env, IS_SANDBOX: '1' },
166
168
  stdio: ['ignore', 'pipe', 'pipe'],
167
169
  });
168
170
 
@@ -183,7 +185,6 @@ export class ClaudeCodeSpawner {
183
185
 
184
186
  fullOutput += trimmed + '\n';
185
187
 
186
- // Try to extract result text
187
188
  try {
188
189
  const event = JSON.parse(trimmed);
189
190
  if (event.type === 'result') {
@@ -196,10 +197,13 @@ export class ClaudeCodeSpawner {
196
197
  });
197
198
 
198
199
  child.stderr.on('data', (data) => {
199
- const chunk = data.toString();
200
- stderr += chunk;
201
- // Forward stderr too — might contain useful info
202
- logger.warn(`Claude Code stderr: ${chunk.trim().slice(0, 200)}`);
200
+ const chunk = data.toString().trim();
201
+ stderr += chunk + '\n';
202
+ logger.warn(`Claude Code stderr: ${chunk.slice(0, 300)}`);
203
+ // Forward ALL stderr to Telegram immediately
204
+ if (onOutput && chunk) {
205
+ onOutput(`⚠️ Claude Code: ${chunk.slice(0, 400)}`).catch(() => {});
206
+ }
203
207
  });
204
208
 
205
209
  const timer = setTimeout(() => {