@link-assistant/agent 0.8.14 → 0.8.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.8.14",
3
+ "version": "0.8.15",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -391,6 +391,8 @@ export async function runContinuousServerMode(
391
391
  waitForPending();
392
392
  }
393
393
  }, 100);
394
+ // Allow process to exit naturally when no other work remains
395
+ checkRunning.unref();
394
396
 
395
397
  // Also handle SIGINT
396
398
  process.on('SIGINT', () => {
@@ -608,6 +610,8 @@ export async function runContinuousDirectMode(
608
610
  waitForPending();
609
611
  }
610
612
  }, 100);
613
+ // Allow process to exit naturally when no other work remains
614
+ checkRunning.unref();
611
615
 
612
616
  // Also handle SIGINT
613
617
  process.on('SIGINT', () => {
package/src/flag/flag.ts CHANGED
@@ -63,6 +63,25 @@ export namespace Flag {
63
63
  'OPENCODE_DRY_RUN'
64
64
  );
65
65
 
66
+ // Stream timeout configuration
67
+ // chunkMs: timeout between stream chunks - detects stalled streams (default: 2 minutes)
68
+ // stepMs: timeout for each individual LLM step (default: 10 minutes)
69
+ export function STREAM_CHUNK_TIMEOUT_MS(): number {
70
+ const val = getEnv(
71
+ 'LINK_ASSISTANT_AGENT_STREAM_CHUNK_TIMEOUT_MS',
72
+ 'AGENT_STREAM_CHUNK_TIMEOUT_MS'
73
+ );
74
+ return val ? parseInt(val, 10) : 120_000;
75
+ }
76
+
77
+ export function STREAM_STEP_TIMEOUT_MS(): number {
78
+ const val = getEnv(
79
+ 'LINK_ASSISTANT_AGENT_STREAM_STEP_TIMEOUT_MS',
80
+ 'AGENT_STREAM_STEP_TIMEOUT_MS'
81
+ );
82
+ return val ? parseInt(val, 10) : 600_000;
83
+ }
84
+
66
85
  // Compact JSON mode - output JSON on single lines (NDJSON format)
67
86
  // Enabled by AGENT_CLI_COMPACT env var or --compact-json flag
68
87
  // Uses getter to check env var at runtime for tests
@@ -613,6 +613,10 @@ export namespace SessionPrompt {
613
613
 
614
614
  const result = await processor.process(() =>
615
615
  streamText({
616
+ timeout: {
617
+ chunkMs: Flag.STREAM_CHUNK_TIMEOUT_MS(),
618
+ stepMs: Flag.STREAM_STEP_TIMEOUT_MS(),
619
+ },
616
620
  onError(error) {
617
621
  log.error(() => ({ message: 'stream error', error }));
618
622
  },