Skip to content

Commit 5de7286

Browse files
thedotmackclaude
andcommitted
chore: bump version to 10.0.6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 64019ee commit 5de7286

9 files changed

Lines changed: 93 additions & 17 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"plugins": [
1111
{
1212
"name": "claude-mem",
13-
"version": "10.0.5",
13+
"version": "10.0.6",
1414
"source": "./plugin",
1515
"description": "Persistent memory system for Claude Code - context compression across sessions"
1616
}

openclaw/install.sh

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ run_openclaw() {
682682

683683
CLAUDE_MEM_REPO="https://github.com/thedotmack/claude-mem.git"
684684
CLAUDE_MEM_BRANCH="${CLI_BRANCH:-main}"
685+
PLUGIN_FRESHLY_INSTALLED=""
685686

686687
install_plugin() {
687688
# Check for git before attempting clone
@@ -796,6 +797,30 @@ install_plugin() {
796797
fi
797798

798799
success "claude-mem plugin installed and enabled"
800+
801+
# ── Copy core plugin files (worker, hooks, scripts) to extension directory ──
802+
# The OpenClaw extension only contains the gateway hook (dist/index.js).
803+
# The actual worker service and Claude Code hooks live in the plugin/ directory
804+
# of the main repo. We copy them so find_claude_mem_install_dir() can locate
805+
# the worker-service.cjs and the worker runs the updated version.
806+
local extension_dir="${HOME}/.openclaw/extensions/claude-mem"
807+
local repo_root="${build_dir}/claude-mem"
808+
809+
if [[ -d "$extension_dir" && -d "${repo_root}/plugin" ]]; then
810+
info "Copying core plugin files to ${extension_dir}..."
811+
812+
# Copy plugin/ directory (worker service, hooks, scripts, skills, UI)
813+
cp -R "${repo_root}/plugin" "${extension_dir}/"
814+
815+
# Copy root package.json (contains the canonical version number)
816+
cp "${repo_root}/package.json" "${extension_dir}/package.json"
817+
818+
success "Core plugin files updated at ${extension_dir}"
819+
else
820+
warn "Could not copy core plugin files — worker may need manual update"
821+
fi
822+
823+
PLUGIN_FRESHLY_INSTALLED="true"
799824
}
800825

801826
###############################################################################
@@ -1668,21 +1693,65 @@ main() {
16681693

16691694
local needs_restart=""
16701695

1696+
# If we just installed fresh plugin files, always restart the worker
1697+
# to pick up the new version — even if the old worker was healthy.
1698+
if [[ "$PLUGIN_FRESHLY_INSTALLED" == "true" ]]; then
1699+
if [[ -n "$WORKER_VERSION" && -n "$expected_version" && "$WORKER_VERSION" != "$expected_version" ]]; then
1700+
info "Upgrading worker from v${WORKER_VERSION} to v${expected_version}..."
1701+
else
1702+
info "Plugin files updated — restarting worker to load new code..."
1703+
fi
1704+
needs_restart="true"
1705+
fi
1706+
16711707
# Check if worker version is outdated compared to installed version
1672-
if [[ -n "$WORKER_VERSION" && -n "$expected_version" && "$WORKER_VERSION" != "$expected_version" ]]; then
1673-
warn "Existing worker is v${WORKER_VERSION} but installed v${expected_version} — restart recommended"
1674-
info " Run: curl -X POST http://127.0.0.1:37777/api/admin/restart"
1708+
if [[ "$needs_restart" != "true" && -n "$WORKER_VERSION" && -n "$expected_version" && "$WORKER_VERSION" != "$expected_version" ]]; then
1709+
info "Upgrading worker from v${WORKER_VERSION} to v${expected_version}..."
16751710
needs_restart="true"
16761711
fi
16771712

16781713
# Check if AI provider doesn't match current configuration
1679-
if [[ -n "$WORKER_AI_PROVIDER" && -n "$AI_PROVIDER" && "$WORKER_AI_PROVIDER" != "$AI_PROVIDER" ]]; then
1680-
warn "Worker is using ${WORKER_AI_PROVIDER} but you configured ${AI_PROVIDER}restart to apply changes"
1714+
if [[ "$needs_restart" != "true" && -n "$WORKER_AI_PROVIDER" && -n "$AI_PROVIDER" && "$WORKER_AI_PROVIDER" != "$AI_PROVIDER" ]]; then
1715+
warn "Worker is using ${WORKER_AI_PROVIDER} but you configured ${AI_PROVIDER}restarting to apply"
16811716
needs_restart="true"
16821717
fi
16831718

1684-
# If everything is current, show full healthy status
1685-
if [[ "$needs_restart" != "true" ]]; then
1719+
# Restart worker if needed: kill old process, start fresh
1720+
if [[ "$needs_restart" == "true" ]]; then
1721+
info "Stopping existing worker..."
1722+
# Try graceful shutdown via API first, fall back to SIGTERM
1723+
curl -s -X POST "http://127.0.0.1:37777/api/admin/shutdown" >/dev/null 2>&1 || true
1724+
sleep 2
1725+
1726+
# If still running, send SIGTERM to known PID
1727+
if check_port_37777; then
1728+
if [[ -n "$WORKER_REPORTED_PID" ]]; then
1729+
kill "$WORKER_REPORTED_PID" 2>/dev/null || true
1730+
sleep 1
1731+
fi
1732+
# Check PID file as fallback
1733+
local pid_file="${HOME}/.claude-mem/worker.pid"
1734+
if [[ -f "$pid_file" ]]; then
1735+
local file_pid
1736+
file_pid="$(INSTALLER_PID_FILE="$pid_file" node -e "
1737+
try { process.stdout.write(String(JSON.parse(require('fs').readFileSync(process.env.INSTALLER_PID_FILE, 'utf8')).pid || '')); }
1738+
catch(e) {}
1739+
" 2>/dev/null)" || true
1740+
if [[ -n "$file_pid" ]]; then
1741+
kill "$file_pid" 2>/dev/null || true
1742+
sleep 1
1743+
fi
1744+
fi
1745+
fi
1746+
1747+
# Start fresh worker
1748+
if start_worker; then
1749+
verify_health || true
1750+
else
1751+
warn "Worker restart failed — you can start it manually later"
1752+
fi
1753+
else
1754+
# No restart needed — show healthy status
16861755
local uptime_display=""
16871756
if [[ -n "$WORKER_UPTIME" && "$WORKER_UPTIME" =~ ^[0-9]+$ && "$WORKER_UPTIME" != "0" ]]; then
16881757
uptime_display="$(format_uptime_ms "$WORKER_UPTIME")"
@@ -1715,7 +1784,7 @@ main() {
17151784
verify_health || true
17161785
else
17171786
warn "Worker startup failed — you can start it manually later"
1718-
warn " cd ~/.claude/plugins/marketplaces/thedotmack && bun plugin/scripts/worker-service.cjs"
1787+
warn " cd ~/.openclaw/extensions/claude-mem && bun plugin/scripts/worker-service.cjs"
17191788
fi
17201789
fi
17211790

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-mem",
3-
"version": "10.0.5",
3+
"version": "10.0.6",
44
"description": "Memory compression system for Claude Code - persist context across sessions",
55
"keywords": [
66
"claude",

plugin/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-mem",
3-
"version": "10.0.5",
3+
"version": "10.0.6",
44
"description": "Persistent memory system for Claude Code - seamlessly preserve context across sessions",
55
"author": {
66
"name": "Alex Newman"

plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-mem-plugin",
3-
"version": "10.0.5",
3+
"version": "10.0.6",
44
"private": true,
55
"description": "Runtime dependencies for claude-mem bundled hooks",
66
"type": "module",

plugin/scripts/mcp-server.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

plugin/scripts/worker-service.cjs

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/services/worker-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ export class WorkerService {
500500
'CLAUDE_CODE_PATH',
501501
'ENOENT',
502502
'spawn',
503+
'Invalid API key',
503504
];
504505
if (unrecoverablePatterns.some(pattern => errorMessage.includes(pattern))) {
505506
hadUnrecoverableError = true;

src/services/worker/SDKAgent.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ export class SDKAgent {
246246
throw new Error('Claude session context overflow: prompt is too long');
247247
}
248248

249+
// Detect invalid API key — SDK returns this as response text, not an error.
250+
// Throw so it surfaces in health endpoint and prevents silent failures.
251+
if (typeof textContent === 'string' && textContent.includes('Invalid API key')) {
252+
throw new Error('Invalid API key: check your API key configuration in ~/.claude-mem/settings.json or ~/.claude-mem/.env');
253+
}
254+
249255
// Parse and process response using shared ResponseProcessor
250256
await processAgentResponse(
251257
textContent,

0 commit comments

Comments
 (0)