autoresearcher 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -55,7 +55,7 @@ The `init` command creates `.autoresearcher/config.json`:
55
55
  ```
56
56
 
57
57
  `agentMode: "internal"` is the default. For a fully custom step command, set `agentMode` to `"command"` and edit `agentCommand`.
58
- In internal mode, backend output is streamed through a white-labeled, status-focused relay so users only see clean `autoresearcher` loop logs.
58
+ In internal mode, backend output is streamed through a status-focused relay so users only see clean `autoresearcher` loop logs.
59
59
 
60
60
  ## Example Configs
61
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoresearcher",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Benchmark-driven autonomous research CLI for post-quantum and blockchain R&D",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -61,7 +61,7 @@ Key config fields:
61
61
  agentMode "internal" (default) or "command"
62
62
  agentPromptFile Markdown objective file (default: program.md)
63
63
  agentPrompt Iteration objective for internal headless agent backend
64
- streamAgentOutput Stream loop output (internal stream is white-labeled)
64
+ streamAgentOutput Stream loop output from the internal backend relay
65
65
  backendAgent Optional backend agent override (amp/codex/claude-code/...)
66
66
  backendModel Optional backend model override (provider-specific)
67
67
  agentCommand Shell command when agentMode is "command"
package/src/run-loop.js CHANGED
@@ -52,11 +52,21 @@ const INTERNAL_OUTPUT_STATUS_PATTERNS = [
52
52
  /\bcircuit breaker\b/i,
53
53
  ];
54
54
  const UNSUPPORTED_RALPH_FLAG_PATTERN = /unknown option\s+['"]--(?:headless|no-auto-skills)['"]/i;
55
+ const NON_FATAL_MAX_ITERATIONS_PATTERN = /(?:\berror:\s*)?max_iterations\b/i;
55
56
 
56
57
  function stripRalphHeadlessFlags(command) {
57
58
  return command.replace(/\s--headless\b/g, '').replace(/\s--no-auto-skills\b/g, '');
58
59
  }
59
60
 
61
+ function isNonFatalInternalMaxIterations(agentMode, result) {
62
+ if (agentMode !== 'internal' || result.code === 0) {
63
+ return false;
64
+ }
65
+
66
+ const combined = `${result.stdout}\n${result.stderr}`;
67
+ return NON_FATAL_MAX_ITERATIONS_PATTERN.test(combined);
68
+ }
69
+
60
70
  function isLikelyGlyphNoise(text) {
61
71
  const alnumCount = (text.match(/[A-Za-z0-9]/g) || []).length;
62
72
  const nonAsciiCount = (text.match(/[^\x20-\x7E]/g) || []).length;
@@ -284,18 +294,14 @@ export async function runResearchLoop(config, cliOverrides = {}) {
284
294
  const agentStep = getAgentStepCommand(merged, cwd, i, runId, iterationAgentPrompt);
285
295
  const shouldStreamRawCommandOutput =
286
296
  agentStep.agentMode === 'command' && merged.streamAgentOutput === true;
287
- const shouldStreamWhiteLabeledInternalOutput =
297
+ const shouldStreamInternalOutput =
288
298
  agentStep.agentMode === 'internal' && merged.streamAgentOutput === true;
289
299
 
290
300
  if (agentStep.agentMode === 'internal') {
291
- if (shouldStreamWhiteLabeledInternalOutput) {
292
- console.log('Agent step: running (white-labeled stream)...');
293
- } else {
294
- console.log('Agent step: running...');
295
- }
301
+ console.log('Agent step: running...');
296
302
  }
297
303
 
298
- const internalStdoutRelay = shouldStreamWhiteLabeledInternalOutput
304
+ const internalStdoutRelay = shouldStreamInternalOutput
299
305
  ? createChunkLineRelay((line) => {
300
306
  const normalized = normalizeInternalBackendLine(line, 'stdout');
301
307
  if (normalized) {
@@ -303,7 +309,7 @@ export async function runResearchLoop(config, cliOverrides = {}) {
303
309
  }
304
310
  })
305
311
  : null;
306
- const internalStderrRelay = shouldStreamWhiteLabeledInternalOutput
312
+ const internalStderrRelay = shouldStreamInternalOutput
307
313
  ? createChunkLineRelay((line) => {
308
314
  const normalized = normalizeInternalBackendLine(line, 'stderr');
309
315
  if (normalized) {
@@ -347,7 +353,13 @@ export async function runResearchLoop(config, cliOverrides = {}) {
347
353
  console.log('Agent step: complete');
348
354
  }
349
355
 
350
- if (agentResult.code !== 0) {
356
+ const nonFatalInternalMaxIterations = isNonFatalInternalMaxIterations(agentStep.agentMode, agentResult);
357
+
358
+ if (nonFatalInternalMaxIterations) {
359
+ console.log('Agent step reached backend max iterations; continuing to benchmark...');
360
+ }
361
+
362
+ if (agentResult.code !== 0 && !nonFatalInternalMaxIterations) {
351
363
  console.log(`Agent step failed with code ${agentResult.code}`);
352
364
  if (merged.stopOnAgentFailure !== false) {
353
365
  await appendRunLog(cwd, runId, {