clawmonitor 1.0.0 → 1.0.1

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 CHANGED
@@ -6,6 +6,16 @@
6
6
 
7
7
  Real-time OpenClaw tool call monitor. Watch all agent sessions with readable names and sorted output.
8
8
 
9
+ ## Why?
10
+
11
+ OpenClaw is a powerful personal AI assistant, but it lacks a built-in way to observe what your agents are actually doing in real time. When debugging prompts, optimizing tool usage, or just understanding agent behavior, you're left guessing.
12
+
13
+ **ClawMonitor fills that gap.** It gives you a live, unified view of every tool call across all agents and sessions — something OpenClaw should have but doesn't.
14
+
15
+ - OpenClaw shows you the final response, but not the tool calls behind it
16
+ - OpenClaw's session logs exist, but they're raw JSONL — hard to read and not real-time
17
+ - ClawMonitor makes agent behavior transparent: what tools are called, with what arguments, across which sessions, all sorted chronologically
18
+
9
19
  ## Install
10
20
 
11
21
  ```bash
package/README.zh-CN.md CHANGED
@@ -6,6 +6,16 @@
6
6
 
7
7
  实时监控 OpenClaw 所有 agent 的 tool calls,跨 session、按时间排序。
8
8
 
9
+ ## 为什么需要它?
10
+
11
+ OpenClaw 是强大的个人 AI 助手,但缺少一个关键功能:**实时观察 agent 在做什么**。调试提示词、优化工具使用、理解 agent 行为时,你只能猜测。
12
+
13
+ **ClawMonitor 填补了这个空白。** 它提供跨所有 agent 和 session 的实时工具调用视图——这是 OpenClaw 应该有却没有的功能。
14
+
15
+ - OpenClaw 只显示最终回复,看不到背后的工具调用过程
16
+ - OpenClaw 的 session 日志是原始 JSONL,难以阅读,也不是实时的
17
+ - ClawMonitor 让 agent 行为透明化:调用了什么工具、传了什么参数、来自哪个 session,按时间排序一目了然
18
+
9
19
  ## 安装
10
20
 
11
21
  ```bash
package/README.zh-TW.md CHANGED
@@ -6,6 +6,16 @@
6
6
 
7
7
  即時監控 OpenClaw 所有 agent 的 tool calls,跨 session、按時間排序。
8
8
 
9
+ ## 為什麼需要它?
10
+
11
+ OpenClaw 是強大的個人 AI 助手,但缺少一個關鍵功能:**即時觀察 agent 在做什麼**。除錯提示詞、最佳化工具使用、理解 agent 行為時,你只能猜測。
12
+
13
+ **ClawMonitor 填補了這個空白。** 它提供跨所有 agent 和 session 的即時工具呼叫檢視——這是 OpenClaw 應該有卻沒有的功能。
14
+
15
+ - OpenClaw 只顯示最終回覆,看不到背後的工具呼叫過程
16
+ - OpenClaw 的 session 日誌是原始 JSONL,難以閱讀,也不是即時的
17
+ - ClawMonitor 讓 agent 行為透明化:呼叫了什麼工具、傳了什麼參數、來自哪個 session,按時間排序一目瞭然
18
+
9
19
  ## 安裝
10
20
 
11
21
  ```bash
@@ -259,14 +259,31 @@ get_session_label() {
259
259
  fi
260
260
  }
261
261
 
262
- declare -A SESSION_LABELS
262
+ # Session label store (portable: works on bash 3.2+ / macOS)
263
+ # Uses a temp file as key\0value pairs instead of associative arrays
264
+ LABEL_STORE=$(mktemp /tmp/clawmonitor-labels.XXXXXX)
265
+ trap 'rm -f "$LABEL_STORE"' EXIT
266
+
267
+ _label_set() {
268
+ local key="$1" val="$2"
269
+ grep -v "^${key}"$'\t' "$LABEL_STORE" > "${LABEL_STORE}.tmp" 2>/dev/null || true
270
+ printf '%s\t%s\n' "$key" "$val" >> "${LABEL_STORE}.tmp"
271
+ mv "${LABEL_STORE}.tmp" "$LABEL_STORE"
272
+ }
273
+
274
+ _label_get() {
275
+ local key="$1"
276
+ local result
277
+ result=$(grep "^${key}"$'\t' "$LABEL_STORE" 2>/dev/null | head -1 | cut -f2-)
278
+ echo "${result:-$2}"
279
+ }
263
280
 
264
281
  cache_labels() {
265
282
  local files="$1"
266
283
  for f in $files; do
267
284
  local key
268
285
  key=$(basename "$f")
269
- SESSION_LABELS["$key"]=$(get_session_label "$f")
286
+ _label_set "$key" "$(get_session_label "$f")"
270
287
  done
271
288
  }
272
289
 
@@ -294,7 +311,7 @@ format_tc() {
294
311
  local ts filename label
295
312
  ts=$(echo "$json" | jq -r '.ts // "???"')
296
313
  filename=$(echo "$json" | jq -r '.file // "?"')
297
- label="${SESSION_LABELS[$filename]:-${filename}}"
314
+ label=$(_label_get "$filename" "$filename")
298
315
 
299
316
  local time_str
300
317
  time_str=$(format_timestamp "$ts")
@@ -349,7 +366,7 @@ echo ""
349
366
  echo -e "${BLD}📋 Active sessions:${RST}"
350
367
  for f in $sessions; do
351
368
  filename=$(basename "$f")
352
- label="${SESSION_LABELS[$filename]}"
369
+ label=$(_label_get "$filename" "$filename")
353
370
  mod_time=$(get_mod_time "$f")
354
371
  printf " ${DIM}%-9s${RST} ${BLU}%-35s${RST} ${DIM}(last: %s)${RST}\n" \
355
372
  "$(echo "$filename" | cut -c1-8)" "${label:0:35}" "$mod_time"
@@ -413,10 +430,10 @@ tail -F -n 0 $SESSIONS_GLOB 2>/dev/null | {
413
430
 
414
431
  filename=$(basename "${current_file}")
415
432
  # Dynamic label lookup for new sessions
416
- if [[ -z "${SESSION_LABELS[$filename]:-}" ]]; then
417
- SESSION_LABELS["$filename"]=$(get_session_label "${current_file}")
433
+ if [[ -z "$(_label_get "$filename" "")" ]]; then
434
+ _label_set "$filename" "$(get_session_label "${current_file}")"
418
435
  fi
419
- label="${SESSION_LABELS[$filename]}"
436
+ label=$(_label_get "$filename" "$filename")
420
437
 
421
438
  ts=$(echo "$line" | jq -r '.timestamp // .message.timestamp // "???"' 2>/dev/null)
422
439
  time_str=$(format_timestamp "$ts")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmonitor",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Real-time OpenClaw tool call monitor — watch all agent sessions with readable names and sorted output",
5
5
  "bin": {
6
6
  "clawmonitor": "./bin/clawmonitor.sh"