@siftd/connect-agent 0.2.4 → 0.2.6

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/dist/heartbeat.js CHANGED
@@ -10,7 +10,7 @@ import { hostname } from 'os';
10
10
  import { createHash } from 'crypto';
11
11
  import { getServerUrl, getAgentToken, getUserId, isCloudMode } from './config.js';
12
12
  const HEARTBEAT_INTERVAL = 10000; // 10 seconds
13
- const VERSION = '0.2.4'; // Should match package.json
13
+ const VERSION = '0.2.6'; // Should match package.json
14
14
  const state = {
15
15
  intervalId: null,
16
16
  runnerId: null,
@@ -695,15 +695,19 @@ Be specific about what you want done.`,
695
695
  if (context) {
696
696
  prompt = `Context: ${context}\n\nTask: ${task}`;
697
697
  }
698
- // Add checkpoint instructions to prevent data loss on timeout
698
+ // Add checkpoint and logging instructions to prevent data loss
699
+ const logFile = `/tmp/worker-${id}-log.txt`;
699
700
  prompt += `
700
701
 
701
- IMPORTANT - Progress Saving:
702
- - Output your findings as you go, don't wait until the end
702
+ IMPORTANT - Progress & Logging:
703
+ - Output findings as you go, don't wait until the end
703
704
  - Print discoveries, file paths, and insights immediately as you find them
704
- - If you're exploring multiple files, report on each one before moving to the next
705
- - If you hit a timeout, the orchestrator should still have your partial findings
706
- - Keep responses concise but don't batch output until the very end`;
705
+ - Report on each file/step before moving to the next
706
+
707
+ REQUIRED - Log Export:
708
+ At the END of your work, create a final log file at: ${logFile}
709
+ Include: job_id=${id}, timestamp, summary of work done, files modified, key findings.
710
+ This ensures nothing is lost even if your output gets truncated.`;
707
711
  console.log(`[ORCHESTRATOR] Delegating to worker ${id}: ${task.slice(0, 80)}...`);
708
712
  return new Promise((resolve) => {
709
713
  const job = {
@@ -716,9 +720,9 @@ IMPORTANT - Progress Saving:
716
720
  // Escape single quotes in prompt for shell safety
717
721
  // Replace ' with '\'' (end quote, escaped quote, start quote)
718
722
  const escapedPrompt = prompt.replace(/'/g, "'\\''");
719
- // Spawn using bash -l -c to ensure proper PATH resolution (NVM, etc.)
720
- // This is more reliable than shell: true which has quote escaping issues
721
- const child = spawn('bash', ['-l', '-c', `claude -p '${escapedPrompt}' --dangerously-skip-permissions`], {
723
+ // Spawn using /bin/bash -l -c to ensure proper PATH resolution (NVM, etc.)
724
+ // Use absolute path to bash to avoid ENOENT errors in restricted environments
725
+ const child = spawn('/bin/bash', ['-l', '-c', `claude -p '${escapedPrompt}' --dangerously-skip-permissions`], {
722
726
  cwd,
723
727
  env: { ...process.env },
724
728
  stdio: ['pipe', 'pipe', 'pipe']
@@ -70,19 +70,24 @@ export class WorkerManager {
70
70
  this.saveJob(job);
71
71
  // Spawn Claude CLI process
72
72
  try {
73
- // Add checkpoint instructions to prevent data loss on timeout
73
+ // Add checkpoint and logging instructions to prevent data loss
74
+ const logFile = `/tmp/worker-${jobId}-log.txt`;
74
75
  const enhancedTask = `${task}
75
76
 
76
- IMPORTANT - Progress Saving:
77
+ IMPORTANT - Progress & Logging:
77
78
  - Output findings as you go, don't wait until the end
78
79
  - Print discoveries and insights immediately as you find them
79
80
  - Report on each file/step before moving to the next
80
- - Keep responses concise but don't batch output`;
81
+
82
+ REQUIRED - Log Export:
83
+ At the END of your work, create a final log file at: ${logFile}
84
+ Include: job_id=${jobId}, timestamp, summary of work done, files modified, key findings.
85
+ This ensures nothing is lost even if your output gets truncated.`;
81
86
  // Escape single quotes in task for shell safety
82
87
  const escapedTask = enhancedTask.replace(/'/g, "'\\''");
83
- // Spawn using bash -l -c to ensure proper PATH resolution (NVM, etc.)
84
- // This is more reliable than shell: true which has quote escaping issues
85
- const child = spawn('bash', ['-l', '-c', `claude -p '${escapedTask}' --output-format text --dangerously-skip-permissions`], {
88
+ // Spawn using /bin/bash -l -c to ensure proper PATH resolution (NVM, etc.)
89
+ // Use absolute path to bash to avoid ENOENT errors in restricted environments
90
+ const child = spawn('/bin/bash', ['-l', '-c', `claude -p '${escapedTask}' --output-format text --dangerously-skip-permissions`], {
86
91
  cwd: workspace,
87
92
  detached: true,
88
93
  stdio: ['ignore', 'pipe', 'pipe'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siftd/connect-agent",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Master orchestrator agent - control Claude Code remotely via web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",