@link-assistant/agent 0.8.14 → 0.8.16
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 +63 -4
- package/package.json +1 -1
- package/src/cli/continuous-mode.js +4 -0
- package/src/flag/flag.ts +19 -0
- package/src/session/prompt.ts +4 -0
package/README.md
CHANGED
|
@@ -46,18 +46,77 @@ This is an MVP implementation of an OpenCode-compatible CLI agent, focused on ma
|
|
|
46
46
|
|
|
47
47
|
## Installation
|
|
48
48
|
|
|
49
|
+
### Step-by-step (recommended for first-time users)
|
|
50
|
+
|
|
49
51
|
```bash
|
|
50
|
-
# Install Bun
|
|
52
|
+
# Step 1: Install Bun (skip if already installed)
|
|
51
53
|
curl -fsSL https://bun.sh/install | bash
|
|
52
54
|
|
|
53
|
-
#
|
|
55
|
+
# Step 2: Apply PATH changes (IMPORTANT — required before using bun)
|
|
56
|
+
source ~/.bashrc # For Bash (default on most Linux systems)
|
|
57
|
+
# source ~/.zshrc # For Zsh (default on macOS)
|
|
58
|
+
|
|
59
|
+
# Step 3: Verify Bun is installed
|
|
60
|
+
bun --version
|
|
61
|
+
|
|
62
|
+
# Step 4: Install the agent globally
|
|
63
|
+
bun install -g @link-assistant/agent
|
|
64
|
+
|
|
65
|
+
# Step 5: Verify the agent is installed
|
|
66
|
+
agent --version
|
|
67
|
+
|
|
68
|
+
# Step 6: Run for a test
|
|
69
|
+
echo "hi" | agent
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Quick install (if you already have Bun)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
54
75
|
bun install -g @link-assistant/agent
|
|
76
|
+
```
|
|
55
77
|
|
|
56
|
-
|
|
78
|
+
### Local install (in your project)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
57
81
|
bun add @link-assistant/agent
|
|
58
82
|
```
|
|
59
83
|
|
|
60
|
-
After installation, the `agent` command will be available
|
|
84
|
+
After global installation, the `agent` command will be available in any terminal session.
|
|
85
|
+
|
|
86
|
+
### Troubleshooting
|
|
87
|
+
|
|
88
|
+
**`bun: command not found` after installation:**
|
|
89
|
+
|
|
90
|
+
The Bun installer adds `~/.bun/bin` to your shell configuration file, but the change only takes effect after reloading it. Run:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
source ~/.bashrc # or source ~/.zshrc for Zsh
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Or restart your terminal.
|
|
97
|
+
|
|
98
|
+
**`agent: command not found` after `bun install -g`:**
|
|
99
|
+
|
|
100
|
+
Global packages installed by Bun are placed in `~/.bun/bin`. If this directory is not in your PATH, the `agent` command won't be found. Ensure your shell configuration includes:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
export BUN_INSTALL="$HOME/.bun"
|
|
104
|
+
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then reload with `source ~/.bashrc` (or `~/.zshrc`), or restart your terminal.
|
|
108
|
+
|
|
109
|
+
**Still not working?**
|
|
110
|
+
|
|
111
|
+
Try reinstalling Bun from scratch:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
rm -rf ~/.bun
|
|
115
|
+
curl -fsSL https://bun.sh/install | bash
|
|
116
|
+
source ~/.bashrc
|
|
117
|
+
bun install -g @link-assistant/agent
|
|
118
|
+
agent --version
|
|
119
|
+
```
|
|
61
120
|
|
|
62
121
|
## Uninstallation
|
|
63
122
|
|
package/package.json
CHANGED
|
@@ -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
|
package/src/session/prompt.ts
CHANGED
|
@@ -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
|
},
|