@itz4blitz/agentful 1.0.1 → 1.0.2

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/bin/cli.js CHANGED
@@ -1041,13 +1041,19 @@ async function startDaemon(args, config) {
1041
1041
  // Prepare args for child process (remove --daemon flag)
1042
1042
  const childArgs = args.filter(arg => !arg.startsWith('--daemon') && arg !== '-d');
1043
1043
 
1044
+ // Create log files for daemon output
1045
+ const logFile = path.join(agentfulDir, 'server.log');
1046
+ const errLogFile = path.join(agentfulDir, 'server.err.log');
1047
+ const out = fs.openSync(logFile, 'a');
1048
+ const err = fs.openSync(errLogFile, 'a');
1049
+
1044
1050
  // Spawn detached child process
1045
1051
  const child = spawn(
1046
1052
  process.argv[0], // node executable
1047
1053
  [process.argv[1], 'serve', ...childArgs], // script path and args
1048
1054
  {
1049
1055
  detached: true,
1050
- stdio: 'ignore',
1056
+ stdio: ['ignore', out, err],
1051
1057
  cwd: process.cwd(),
1052
1058
  env: {
1053
1059
  ...process.env,
@@ -1056,18 +1062,40 @@ async function startDaemon(args, config) {
1056
1062
  }
1057
1063
  );
1058
1064
 
1059
- // Write PID file
1060
- fs.writeFileSync(pidFile, child.pid.toString(), 'utf-8');
1061
-
1062
- // Unref to allow parent to exit
1065
+ // Unref immediately to allow parent to exit independently
1063
1066
  child.unref();
1064
1067
 
1068
+ // Wait for server to start (check health endpoint)
1069
+ const maxAttempts = 10;
1070
+ let started = false;
1071
+ for (let i = 0; i < maxAttempts; i++) {
1072
+ await new Promise(resolve => setTimeout(resolve, 500));
1073
+ try {
1074
+ const response = await fetch(`http://localhost:${config.port}/health`);
1075
+ if (response.ok) {
1076
+ started = true;
1077
+ break;
1078
+ }
1079
+ } catch {
1080
+ // Server not ready yet
1081
+ }
1082
+ }
1083
+
1084
+ if (!started) {
1085
+ log(colors.yellow, 'Warning: Server may not have started successfully');
1086
+ log(colors.dim, `Check logs: ${logFile}`);
1087
+ }
1088
+
1089
+ // Write PID file after confirming server started
1090
+ fs.writeFileSync(pidFile, child.pid.toString(), 'utf-8');
1091
+
1065
1092
  // Show success message
1066
1093
  log(colors.green, `Server started in background (PID: ${child.pid})`);
1067
1094
  console.log('');
1068
1095
  log(colors.dim, `PID file: ${pidFile}`);
1069
1096
  log(colors.dim, `Port: ${config.port}`);
1070
1097
  log(colors.dim, `Auth: ${config.auth}`);
1098
+ log(colors.dim, `Logs: ${logFile}`);
1071
1099
  console.log('');
1072
1100
  log(colors.dim, 'Commands:');
1073
1101
  log(colors.dim, ' agentful serve --stop Stop the daemon');
@@ -194,24 +194,8 @@ export function createAuthMiddleware(mode, config = {}) {
194
194
  };
195
195
 
196
196
  case 'none':
197
- // None mode: Only allow localhost connections
197
+ // None mode: Allow all connections (use with SSH tunnel for security)
198
198
  return (req, res, next) => {
199
- const clientIP = req.socket.remoteAddress;
200
- const isLocalhost =
201
- clientIP === '127.0.0.1' ||
202
- clientIP === '::1' ||
203
- clientIP === '::ffff:127.0.0.1';
204
-
205
- if (!isLocalhost) {
206
- res.writeHead(403, { 'Content-Type': 'application/json' });
207
- return res.end(
208
- JSON.stringify({
209
- error: 'Forbidden',
210
- message: 'Server is in localhost-only mode. Use SSH tunnel or switch to tailscale/hmac mode.',
211
- })
212
- );
213
- }
214
-
215
199
  next();
216
200
  };
217
201
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itz4blitz/agentful",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Human-in-the-loop development kit for Claude Code with smart product analysis and natural conversation",
5
5
  "type": "module",
6
6
  "bin": {
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "1.0.0"
2
+ "version": "1.0.1"
3
3
  }