diff --git a/openclaw.plugin.json b/openclaw.plugin.json index ac51bf0..64b3a73 100644 --- a/openclaw.plugin.json +++ b/openclaw.plugin.json @@ -2,7 +2,7 @@ "id": "memory-continuity", "name": "Memory Continuity", "description": "Preserves working state across /new, reset, compaction, and gateway restarts via a simple markdown checkpoint file.", - "version": "2.4.2", + "version": "2.5.0", "source": "https://github.com/dtzp555-max/memory-continuity", "configSchema": { "type": "object", diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 402ba66..a592b07 100755 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -124,11 +124,7 @@ for agent in agents: seen.add(agent_id) name = agent.get('name', agent_id) - workspace = agent.get('workspace', default_ws if agent_id == 'main' else None) - - # Skip agents without a resolvable workspace - if not workspace: - workspace = os.path.join(openclaw_dir, 'workspaces', agent_id) + workspace = agent.get('workspace', default_ws) # Expand ~ in path workspace = os.path.expanduser(workspace) diff --git a/scripts/verify.sh b/scripts/verify.sh index 8e96fbd..22bde6f 100755 --- a/scripts/verify.sh +++ b/scripts/verify.sh @@ -31,13 +31,14 @@ header() { echo -e "\n${BOLD}$*${RESET}"; } # Argument parsing # --------------------------------------------------------------------------- WORKSPACE="${HOME}/.openclaw/workspace/main" +WORKSPACE_EXPLICIT=false SHOW_SAMPLE=false ALL_AGENTS=false while [[ $# -gt 0 ]]; do case "$1" in --workspace) - WORKSPACE="$2"; shift 2 ;; + WORKSPACE="$2"; WORKSPACE_EXPLICIT=true; shift 2 ;; --sample) SHOW_SAMPLE=true; shift ;; --all-agents) @@ -225,6 +226,33 @@ if $ALL_AGENTS; then [[ $TOTAL_FAIL -gt 0 ]] && exit 1 || exit 0 fi +# --------------------------------------------------------------------------- +# Resolve WORKSPACE from openclaw.json if not explicitly set via --workspace +# --------------------------------------------------------------------------- +# If not explicitly set, try to derive from the first alive agent in openclaw.json +if ! $WORKSPACE_EXPLICIT && [[ -f "$CONFIG_FILE" ]] && command -v python3 &>/dev/null; then + RESOLVED_WS=$(python3 - "$CONFIG_FILE" "$OPENCLAW_DIR" <<'PYEOF' +import json, sys, os +config_file = sys.argv[1] +openclaw_dir = sys.argv[2] +try: + with open(config_file) as f: + data = json.load(f) + default_ws = data.get('agents', {}).get('defaults', {}).get('workspace', '') + for agent in data.get('agents', {}).get('list', []): + ws = agent.get('workspace', default_ws) + if ws: + print(os.path.expanduser(ws)) + break +except Exception: + pass +PYEOF + ) + if [[ -n "$RESOLVED_WS" ]]; then + WORKSPACE="$RESOLVED_WS" + fi +fi + # --------------------------------------------------------------------------- # Header # ---------------------------------------------------------------------------