-
Notifications
You must be signed in to change notification settings - Fork 7
feat: MLX auto-detection, stall detection, current_context fix #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>Label</key> | ||
| <string>com.brainlayer.enrich</string> | ||
|
|
||
| <key>ProgramArguments</key> | ||
| <array> | ||
| <string>__BRAINLAYER_BIN__</string> | ||
| <string>enrich</string> | ||
| <string>--batch-size</string> | ||
| <string>50</string> | ||
| <string>--max</string> | ||
| <string>500</string> | ||
| </array> | ||
|
|
||
| <key>StartInterval</key> | ||
| <integer>3600</integer> | ||
|
|
||
| <key>StandardOutPath</key> | ||
| <string>__HOME__/.local/share/brainlayer/logs/enrich.log</string> | ||
| <key>StandardErrorPath</key> | ||
| <string>__HOME__/.local/share/brainlayer/logs/enrich.err</string> | ||
|
|
||
| <key>EnvironmentVariables</key> | ||
| <dict> | ||
| <key>PATH</key> | ||
| <string>/usr/local/bin:/usr/bin:/bin:__HOME__/.local/bin</string> | ||
| <key>PYTHONUNBUFFERED</key> | ||
| <string>1</string> | ||
| <key>BRAINLAYER_STALL_TIMEOUT</key> | ||
| <string>300</string> | ||
| </dict> | ||
|
|
||
| <key>RunAtLoad</key> | ||
| <false/> | ||
|
|
||
| <key>Nice</key> | ||
| <integer>15</integer> | ||
|
|
||
| <key>ProcessType</key> | ||
| <string>Background</string> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>Label</key> | ||
| <string>com.brainlayer.index</string> | ||
|
|
||
| <key>ProgramArguments</key> | ||
| <array> | ||
| <string>__BRAINLAYER_BIN__</string> | ||
| <string>index</string> | ||
| </array> | ||
|
|
||
| <key>StartInterval</key> | ||
| <integer>1800</integer> | ||
|
|
||
| <key>StandardOutPath</key> | ||
| <string>__HOME__/.local/share/brainlayer/logs/index.log</string> | ||
| <key>StandardErrorPath</key> | ||
| <string>__HOME__/.local/share/brainlayer/logs/index.err</string> | ||
|
|
||
| <key>EnvironmentVariables</key> | ||
| <dict> | ||
| <key>PATH</key> | ||
| <string>/usr/local/bin:/usr/bin:/bin:__HOME__/.local/bin</string> | ||
| <key>PYTHONUNBUFFERED</key> | ||
| <string>1</string> | ||
| </dict> | ||
|
|
||
| <key>RunAtLoad</key> | ||
| <true/> | ||
|
|
||
| <key>Nice</key> | ||
| <integer>10</integer> | ||
| </dict> | ||
| </plist> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/usr/bin/env bash | ||
| # Install BrainLayer launchd plists for auto-indexing and enrichment. | ||
| # | ||
| # Usage: | ||
| # ./scripts/launchd/install.sh # Install both | ||
| # ./scripts/launchd/install.sh index # Install indexing only | ||
| # ./scripts/launchd/install.sh enrich # Install enrichment only | ||
| # ./scripts/launchd/install.sh remove # Unload and remove all | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| LAUNCH_DIR="$HOME/Library/LaunchAgents" | ||
| LOG_DIR="$HOME/.local/share/brainlayer/logs" | ||
| BRAINLAYER_BIN="${BRAINLAYER_BIN:-$(which brainlayer 2>/dev/null || echo "$HOME/.local/bin/brainlayer")}" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| if [ ! -x "$BRAINLAYER_BIN" ]; then | ||
| echo "ERROR: brainlayer binary not found at $BRAINLAYER_BIN" | ||
| echo "Install with: pip install -e . (from brainlayer repo)" | ||
| echo "Or set BRAINLAYER_BIN=/path/to/brainlayer" | ||
| exit 1 | ||
| fi | ||
|
|
||
| mkdir -p "$LAUNCH_DIR" "$LOG_DIR" | ||
|
|
||
| install_plist() { | ||
| local name="$1" | ||
| local src="$SCRIPT_DIR/com.brainlayer.${name}.plist" | ||
| local dst="$LAUNCH_DIR/com.brainlayer.${name}.plist" | ||
|
|
||
| if [ ! -f "$src" ]; then | ||
| echo "ERROR: $src not found" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Replace placeholders | ||
| sed \ | ||
| -e "s|__HOME__|$HOME|g" \ | ||
| -e "s|__BRAINLAYER_BIN__|$BRAINLAYER_BIN|g" \ | ||
| "$src" > "$dst" | ||
|
Comment on lines
+36
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Sed delimiter collision if paths contain The 🤖 Prompt for AI Agents |
||
|
|
||
| echo "Installed: $dst" | ||
| echo " Binary: $BRAINLAYER_BIN" | ||
| echo " Logs: $LOG_DIR/" | ||
|
|
||
| # Unload if already loaded, then load | ||
| launchctl bootout "gui/$(id -u)/com.brainlayer.${name}" 2>/dev/null || true | ||
| launchctl bootstrap "gui/$(id -u)" "$dst" | ||
| echo " Loaded: com.brainlayer.${name}" | ||
| } | ||
|
|
||
| remove_plist() { | ||
| local name="$1" | ||
| local dst="$LAUNCH_DIR/com.brainlayer.${name}.plist" | ||
| launchctl bootout "gui/$(id -u)/com.brainlayer.${name}" 2>/dev/null || true | ||
| rm -f "$dst" | ||
| echo "Removed: com.brainlayer.${name}" | ||
| } | ||
|
|
||
| case "${1:-all}" in | ||
| index) | ||
| install_plist index | ||
| ;; | ||
| enrich) | ||
| install_plist enrich | ||
| ;; | ||
| all) | ||
| install_plist index | ||
| install_plist enrich | ||
| ;; | ||
| remove) | ||
| remove_plist index | ||
| remove_plist enrich | ||
| ;; | ||
| *) | ||
| echo "Usage: $0 [index|enrich|all|remove]" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "" | ||
| echo "Done. Check logs at: $LOG_DIR/" | ||
| echo "Status: launchctl list | grep brainlayer" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Log files will grow unbounded — consider rotation.
StandardOutPathandStandardErrorPathare append-only with no built-in rotation in launchd. Over time,index.logandindex.errwill grow without limit. Consider either rotating logs within thebrainlayerCLI itself (e.g.,logging.handlers.RotatingFileHandler) or adding a periodic cleanup step ininstall.sh/ a separate launchd job.🤖 Prompt for AI Agents