sam-coder-cli 1.0.64 → 1.0.65

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/bin/agi-cli.js +34 -0
  2. package/package.json +1 -1
package/bin/agi-cli.js CHANGED
@@ -429,6 +429,9 @@ const agentUtils = {
429
429
 
430
430
  async writeFile(filePath, content) {
431
431
  try {
432
+ // Ensure directory exists
433
+ const dir = path.dirname(filePath);
434
+ await fs.mkdir(dir, { recursive: true });
432
435
  await fs.writeFile(filePath, content, 'utf-8');
433
436
  return `Successfully wrote to ${filePath}`;
434
437
  } catch (error) {
@@ -1319,6 +1322,37 @@ async function chat(rl, useToolCalling, initialModel) {
1319
1322
  return;
1320
1323
  }
1321
1324
 
1325
+ // Direct Harmony tool-call execution from user input (bypass model)
1326
+ try {
1327
+ const seg = parseSegmentedTranscript(input);
1328
+ if (seg && seg.segmented && seg.recoveredToolCalls && seg.recoveredToolCalls.length) {
1329
+ const messages = [];
1330
+ if (useToolCalling) {
1331
+ messages.push({ role: 'system', content: TOOL_CALLING_PROMPT });
1332
+ } else {
1333
+ messages.push({ role: 'system', content: FUNCTION_CALLING_PROMPT });
1334
+ }
1335
+ messages.push({ role: 'user', content: input });
1336
+ ui.startThinking();
1337
+ const results = await handleToolCalls(seg.recoveredToolCalls, messages);
1338
+ ui.stopThinking();
1339
+ if (results.length === 1) {
1340
+ ui.showSuccess(`Tool '${results[0].name}' executed.`);
1341
+ } else {
1342
+ ui.showSuccess(`Executed ${results.length} tool calls.`);
1343
+ }
1344
+ // Show concise outputs
1345
+ results.forEach(r => {
1346
+ const preview = typeof r.content === 'string' ? r.content : JSON.stringify(r.content);
1347
+ ui.showInfo(`${r.name}: ${preview.length > 300 ? preview.slice(0, 300) + '...' : preview}`);
1348
+ });
1349
+ rl.prompt();
1350
+ return;
1351
+ }
1352
+ } catch (e) {
1353
+ // Fall through to normal processing if parsing/execution fails
1354
+ }
1355
+
1322
1356
  const result = useToolCalling
1323
1357
  ? await processQueryWithTools(input, conversation, currentModel)
1324
1358
  : await processQuery(input, conversation, currentModel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sam-coder-cli",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "SAM-CODER: An animated command-line AI assistant with agency capabilities.",
5
5
  "main": "bin/agi-cli.js",
6
6
  "bin": {