@quantiya/codevibe-claude-plugin 1.0.7 → 1.0.8
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/.claude-plugin/plugin.json +1 -1
- package/hooks/permission-request.sh +6 -3
- package/hooks/stop.sh +15 -10
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codevibe-claude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Sync Claude Code sessions with iOS mobile app via AWS backend. Control Claude Code from your iPhone with real-time bidirectional synchronization.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodeVibe Team"
|
|
@@ -71,16 +71,19 @@ if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
|
|
|
71
71
|
text: ([.message.content[]? | select(.type == "text") | .text // empty] | join(" "))
|
|
72
72
|
} |
|
|
73
73
|
select(.text | length > 0) |
|
|
74
|
-
"\(.uuid)\t\(.text)"
|
|
74
|
+
"\(.uuid)\t\(.text | @base64)"
|
|
75
75
|
end
|
|
76
76
|
' "$TRANSCRIPT_PATH" 2>/dev/null)
|
|
77
77
|
|
|
78
78
|
if [ -n "$ASSISTANT_MESSAGES" ]; then
|
|
79
|
-
while IFS=$'\t' read -r MSG_UUID
|
|
80
|
-
if [ -z "$MSG_UUID" ] || [ -z "$
|
|
79
|
+
while IFS=$'\t' read -r MSG_UUID MSG_TEXT_B64; do
|
|
80
|
+
if [ -z "$MSG_UUID" ] || [ -z "$MSG_TEXT_B64" ]; then
|
|
81
81
|
continue
|
|
82
82
|
fi
|
|
83
83
|
|
|
84
|
+
# Decode base64-encoded text content (preserves newlines in markdown)
|
|
85
|
+
MSG_TEXT=$(echo "$MSG_TEXT_B64" | base64 -d 2>/dev/null || echo "$MSG_TEXT_B64")
|
|
86
|
+
|
|
84
87
|
ASSISTANT_PAYLOAD=$(jq -n \
|
|
85
88
|
--arg session_id "$SESSION_ID" \
|
|
86
89
|
--arg content "$MSG_TEXT" \
|
package/hooks/stop.sh
CHANGED
|
@@ -47,7 +47,8 @@ fi
|
|
|
47
47
|
# Single jq invocation: find last user UUID, build chain, extract assistant messages
|
|
48
48
|
# This replaces two slow bash while-loops that spawned jq per line (O(n) jq processes → 1)
|
|
49
49
|
# Output format: tab-separated lines: uuid\ttype\tcontent
|
|
50
|
-
# type is "text" for assistant text, "tool_use" for tool uses
|
|
50
|
+
# type is "text" for base64-encoded assistant text, "tool_use" for JSON tool uses
|
|
51
|
+
# Text is base64-encoded because it may contain newlines which break line-by-line read
|
|
51
52
|
TRANSCRIPT_EVENTS=$(jq -r --slurp --arg sent "$SENT_UUIDS_CONTENT" '
|
|
52
53
|
# Find last user prompt UUID
|
|
53
54
|
(map(select(.type == "user")) | last | .uuid // empty) as $lastUserUuid |
|
|
@@ -67,24 +68,23 @@ TRANSCRIPT_EVENTS=$(jq -r --slurp --arg sent "$SENT_UUIDS_CONTENT" '
|
|
|
67
68
|
select(.type == "assistant") |
|
|
68
69
|
select(.uuid as $u | $chain | any(. == $u)) |
|
|
69
70
|
. as $msg |
|
|
70
|
-
# Emit text content
|
|
71
|
+
# Emit text content (base64-encoded to preserve newlines)
|
|
71
72
|
(
|
|
72
73
|
($msg.uuid) as $uuid |
|
|
73
74
|
($sentList | any(. == $uuid)) as $alreadySent |
|
|
74
75
|
if $alreadySent then
|
|
75
76
|
"\($uuid)\talready_sent\t"
|
|
76
77
|
else
|
|
77
|
-
# Text content
|
|
78
78
|
([$msg.message.content[]? | select(.type == "text") | .text // empty] | join(" ")) as $text |
|
|
79
79
|
if ($text | length) > 0 then
|
|
80
|
-
"\($uuid)\ttext\t\($text)"
|
|
80
|
+
"\($uuid)\ttext\t\($text | @base64)"
|
|
81
81
|
else empty end
|
|
82
82
|
end
|
|
83
83
|
),
|
|
84
|
-
# Emit tool_use content (
|
|
84
|
+
# Emit tool_use content as JSON (tojson escapes newlines, safe for line read)
|
|
85
85
|
(
|
|
86
86
|
$msg.message.content[]? | select(.type == "tool_use") |
|
|
87
|
-
"\($msg.uuid)\ttool_use\t\(. | tojson)"
|
|
87
|
+
"\($msg.uuid)\ttool_use\t\(. | tojson | @base64)"
|
|
88
88
|
)
|
|
89
89
|
end
|
|
90
90
|
' "$TRANSCRIPT_PATH" 2>/dev/null)
|
|
@@ -104,9 +104,12 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
|
|
|
104
104
|
fi
|
|
105
105
|
|
|
106
106
|
if [ "$MSG_TYPE" = "text" ] && [ -n "$MSG_CONTENT" ]; then
|
|
107
|
+
# Decode base64-encoded text content
|
|
108
|
+
DECODED_CONTENT=$(echo "$MSG_CONTENT" | base64 -d 2>/dev/null || echo "$MSG_CONTENT")
|
|
109
|
+
|
|
107
110
|
EVENT_PAYLOAD=$(jq -n \
|
|
108
111
|
--arg session_id "$SESSION_ID" \
|
|
109
|
-
--arg content "$
|
|
112
|
+
--arg content "$DECODED_CONTENT" \
|
|
110
113
|
--arg hook_event_name "Stop" \
|
|
111
114
|
--arg type "ASSISTANT_RESPONSE" \
|
|
112
115
|
'{
|
|
@@ -116,7 +119,7 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
|
|
|
116
119
|
content: $content
|
|
117
120
|
}')
|
|
118
121
|
|
|
119
|
-
log "DEBUG" "Sending assistant response: ${
|
|
122
|
+
log "DEBUG" "Sending assistant response: ${DECODED_CONTENT:0:100}..."
|
|
120
123
|
|
|
121
124
|
send_to_mcp "event" "$EVENT_PAYLOAD" "$SESSION_ID"
|
|
122
125
|
|
|
@@ -130,8 +133,10 @@ if [ -n "$TRANSCRIPT_EVENTS" ]; then
|
|
|
130
133
|
fi
|
|
131
134
|
|
|
132
135
|
if [ "$MSG_TYPE" = "tool_use" ] && [ -n "$MSG_CONTENT" ]; then
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
# Decode base64-encoded tool_use JSON
|
|
137
|
+
DECODED_TOOL=$(echo "$MSG_CONTENT" | base64 -d 2>/dev/null || echo "$MSG_CONTENT")
|
|
138
|
+
TOOL_NAME=$(echo "$DECODED_TOOL" | jq -r '.name // empty')
|
|
139
|
+
TOOL_INPUT=$(echo "$DECODED_TOOL" | jq -c '.input // {}')
|
|
135
140
|
|
|
136
141
|
if [ -n "$TOOL_NAME" ]; then
|
|
137
142
|
# Check if this is an interactive prompt (AskUserQuestion)
|
package/package.json
CHANGED