mirror of
https://github.com/dtzp555-max/memory-continuity.git
synced 2026-07-19 09:42:42 +00:00
fix: resolve workspace path from openclaw.json for cross-machine compatibility (v2.5.0)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"id": "memory-continuity",
|
"id": "memory-continuity",
|
||||||
"name": "Memory Continuity",
|
"name": "Memory Continuity",
|
||||||
"description": "Preserves working state across /new, reset, compaction, and gateway restarts via a simple markdown checkpoint file.",
|
"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",
|
"source": "https://github.com/dtzp555-max/memory-continuity",
|
||||||
"configSchema": {
|
"configSchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@@ -124,11 +124,7 @@ for agent in agents:
|
|||||||
seen.add(agent_id)
|
seen.add(agent_id)
|
||||||
|
|
||||||
name = agent.get('name', agent_id)
|
name = agent.get('name', agent_id)
|
||||||
workspace = agent.get('workspace', default_ws if agent_id == 'main' else None)
|
workspace = agent.get('workspace', default_ws)
|
||||||
|
|
||||||
# Skip agents without a resolvable workspace
|
|
||||||
if not workspace:
|
|
||||||
workspace = os.path.join(openclaw_dir, 'workspaces', agent_id)
|
|
||||||
|
|
||||||
# Expand ~ in path
|
# Expand ~ in path
|
||||||
workspace = os.path.expanduser(workspace)
|
workspace = os.path.expanduser(workspace)
|
||||||
|
|||||||
+29
-1
@@ -31,13 +31,14 @@ header() { echo -e "\n${BOLD}$*${RESET}"; }
|
|||||||
# Argument parsing
|
# Argument parsing
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
WORKSPACE="${HOME}/.openclaw/workspace/main"
|
WORKSPACE="${HOME}/.openclaw/workspace/main"
|
||||||
|
WORKSPACE_EXPLICIT=false
|
||||||
SHOW_SAMPLE=false
|
SHOW_SAMPLE=false
|
||||||
ALL_AGENTS=false
|
ALL_AGENTS=false
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--workspace)
|
--workspace)
|
||||||
WORKSPACE="$2"; shift 2 ;;
|
WORKSPACE="$2"; WORKSPACE_EXPLICIT=true; shift 2 ;;
|
||||||
--sample)
|
--sample)
|
||||||
SHOW_SAMPLE=true; shift ;;
|
SHOW_SAMPLE=true; shift ;;
|
||||||
--all-agents)
|
--all-agents)
|
||||||
@@ -225,6 +226,33 @@ if $ALL_AGENTS; then
|
|||||||
[[ $TOTAL_FAIL -gt 0 ]] && exit 1 || exit 0
|
[[ $TOTAL_FAIL -gt 0 ]] && exit 1 || exit 0
|
||||||
fi
|
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
|
# Header
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user