gm-kilo 2.0.169 → 2.0.170

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.
@@ -99,10 +99,11 @@ const run = () => {
99
99
  if (cwd) opts.cwd = cwd;
100
100
  if (input !== undefined) opts.input = input;
101
101
  const r = spawnSync(bin, args, opts);
102
- const out = stripFooter((r.stdout || '') + (r.stderr || ''));
103
- if (!out && r.error) return `[spawn error: ${r.error.message}]`;
104
- if (!out && r.status !== 0) return `[exit ${r.status}]`;
105
- return out;
102
+ if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
103
+ const stdout = (r.stdout || '').trimEnd();
104
+ const stderr = stripFooter(r.stderr || '').trimEnd();
105
+ if (stdout && stderr) return stdout + '\n[stderr]\n' + stderr;
106
+ return stripFooter(stdout || stderr);
106
107
  };
107
108
  try {
108
109
  let result;
@@ -123,9 +124,9 @@ const run = () => {
123
124
  } else {
124
125
  result = runExec(['x', 'gm-exec', 'exec', `--lang=${lang}`, ...(cwd ? [`--cwd=${cwd}`] : []), code]);
125
126
  }
126
- return { block: true, reason: `[exec intercepted]\n${result || '(no output)'}` };
127
+ return { block: true, reason: `exec ran successfully. Output:\n\n${result || '(no output)'}` };
127
128
  } catch (e) {
128
- return { block: true, reason: (e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)' };
129
+ return { block: true, reason: `exec ran. Error:\n\n${(e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)'}` };
129
130
  }
130
131
  }
131
132
 
@@ -140,13 +141,18 @@ const run = () => {
140
141
  const input = tool_input || {};
141
142
  const script = input.script || input.code || '';
142
143
  if (script && !input.url && !input.navigate) {
143
- const stripFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
144
+ const sFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
144
145
  try {
145
- const r = spawnSync('bun', ['x', 'gm-exec', 'exec', '--lang=nodejs', script], { encoding: 'utf-8', timeout: 65000 });
146
- const out = stripFooter((r.stdout || '') + (r.stderr || ''));
147
- return { block: true, reason: out || '(no output)' };
146
+ const tmpFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.mjs`);
147
+ fs.writeFileSync(tmpFile, script, 'utf-8');
148
+ const r = spawnSync('bun', ['run', tmpFile], { encoding: 'utf-8', timeout: 65000 });
149
+ try { fs.unlinkSync(tmpFile); } catch (e) {}
150
+ const stdout = (r.stdout || '').trimEnd();
151
+ const stderr = sFooter(r.stderr || '').trimEnd();
152
+ const out = stdout && stderr ? stdout + '\n[stderr]\n' + stderr : sFooter(stdout || stderr);
153
+ return { block: true, reason: `exec ran successfully. Output:\n\n${out || '(no output)'}` };
148
154
  } catch (e) {
149
- return { block: true, reason: (e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)' };
155
+ return { block: true, reason: `exec ran. Error:\n\n${(e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)'}` };
150
156
  }
151
157
  }
152
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-kilo",
3
- "version": "2.0.169",
3
+ "version": "2.0.170",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",