Skip to content

Commit f0ac3a1

Browse files
committed
rename max to current
1 parent e29c64c commit f0ac3a1

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

plugins/warp/scripts/build-payload.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
# The function extracts common fields (session_id, cwd, project) from the
1414
# hook's stdin JSON (passed as $1), then merges any extra jq args you pass.
1515

16-
# The maximum protocol version this plugin knows how to produce.
17-
PLUGIN_MAX_PROTOCOL_VERSION=1
16+
# The current protocol version this plugin knows how to produce.
17+
PLUGIN_CURRENT_PROTOCOL_VERSION=1
1818

1919
# Negotiate the protocol version with Warp.
20-
# Uses min(plugin_max, warp_declared), falling back to 1 if Warp doesn't advertise a version.
20+
# Uses min(plugin_current, warp_declared), falling back to 1 if Warp doesn't advertise a version.
2121
negotiate_protocol_version() {
2222
local warp_version="${WARP_CLI_AGENT_PROTOCOL_VERSION:-1}"
23-
if [ "$warp_version" -lt "$PLUGIN_MAX_PROTOCOL_VERSION" ] 2>/dev/null; then
23+
if [ "$warp_version" -lt "$PLUGIN_CURRENT_PROTOCOL_VERSION" ] 2>/dev/null; then
2424
echo "$warp_version"
2525
else
26-
echo "$PLUGIN_MAX_PROTOCOL_VERSION"
26+
echo "$PLUGIN_CURRENT_PROTOCOL_VERSION"
2727
fi
2828
}
2929

plugins/warp/tests/test-hooks.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ export WARP_CLI_AGENT_PROTOCOL_VERSION=1
125125
PAYLOAD=$(build_payload '{"session_id":"s1","cwd":"/tmp"}' "stop")
126126
assert_json_field "v1 when warp declares 1" "$PAYLOAD" ".v" "1"
127127

128-
# Warp declares a higher version than the plugin knows → capped to plugin max
128+
# Warp declares a higher version than the plugin knows → capped to plugin current
129129
export WARP_CLI_AGENT_PROTOCOL_VERSION=99
130130
PAYLOAD=$(build_payload '{"session_id":"s1","cwd":"/tmp"}' "stop")
131-
assert_json_field "capped to plugin max when warp is ahead" "$PAYLOAD" ".v" "1"
131+
assert_json_field "capped to plugin current when warp is ahead" "$PAYLOAD" ".v" "1"
132132

133133
# Warp declares a lower version than the plugin knows → use warp's version
134134
# (not testable with PLUGIN_MAX=1 since there's no v0, but we verify the min logic
135135
# by temporarily overriding the variable)
136-
PLUGIN_MAX_PROTOCOL_VERSION=5
136+
PLUGIN_CURRENT_PROTOCOL_VERSION=5
137137
export WARP_CLI_AGENT_PROTOCOL_VERSION=3
138138
PAYLOAD=$(build_payload '{"session_id":"s1","cwd":"/tmp"}' "stop")
139139
assert_json_field "uses warp version when plugin is ahead" "$PAYLOAD" ".v" "3"
140-
PLUGIN_MAX_PROTOCOL_VERSION=1
140+
PLUGIN_CURRENT_PROTOCOL_VERSION=1
141141

142142
# Clean up
143143
unset WARP_CLI_AGENT_PROTOCOL_VERSION

0 commit comments

Comments
 (0)