diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json index e05e08b..c68248b 100644 --- a/.agents/plugins/marketplace.json +++ b/.agents/plugins/marketplace.json @@ -14,7 +14,7 @@ "installation": "AVAILABLE", "authentication": "ON_INSTALL" }, - "version": "0.4.0", + "version": "0.4.1", "category": "productivity", "tags": ["notifications", "terminal", "warp"] }, @@ -26,7 +26,7 @@ "installation": "AVAILABLE", "authentication": "ON_INSTALL" }, - "version": "0.4.0", + "version": "0.4.1", "category": "productivity", "tags": ["terminal", "warp", "oz"] } diff --git a/README.md b/README.md index 000240a..c4b1c9a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ tests/test-hooks.sh Shell tests ## Plugins - `warp`: `SessionStart`, `Stop`, `PermissionRequest`, `UserPromptSubmit`, `PostToolUse` notifications for Warp. - `orchestration`: `SessionStart`, `UserPromptSubmit`, `PostToolUse`, `Stop`, `SessionEnd` parent-message delivery for Codex child runs, plus Oz skills. -Hook commands use `${PLUGIN_ROOT}/scripts/...`. +Hook commands use `${CLAUDE_PLUGIN_ROOT}/scripts/...`, the plugin root provided by +Codex. ## Local install ```sh codex plugin marketplace add . @@ -33,7 +34,7 @@ This uses a fake `oz` CLI and a temp `CODEX_HOME`. It validates parent-message staging/drain/blocking and plugin manifests. ## Versioning `plugins/warp/scripts/on-session-start.sh` emits `PLUGIN_VERSION`. -Current plugin version: `0.4.0`. +Current plugin version: `0.4.1`. Keep it in sync with Warp's Codex plugin manager minimum version. ## Skills diff --git a/plugins/orchestration/.codex-plugin/plugin.json b/plugins/orchestration/.codex-plugin/plugin.json index d97c805..0f09daf 100644 --- a/plugins/orchestration/.codex-plugin/plugin.json +++ b/plugins/orchestration/.codex-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "orchestration", "description": "Warp integration for Codex in Oz cloud agent environments, including parent-message delivery hooks and skills", - "version": "0.4.0", + "version": "0.4.1", "author": { "name": "Warp", "url": "https://warp.dev" diff --git a/plugins/orchestration/hooks/hooks.json b/plugins/orchestration/hooks/hooks.json index 165b7cf..a7e6014 100644 --- a/plugins/orchestration/hooks/hooks.json +++ b/plugins/orchestration/hooks/hooks.json @@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-session-start.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-session-start.sh\"" } ] } @@ -15,7 +15,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/drain-mailbox.sh UserPromptSubmit" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/drain-mailbox.sh\" UserPromptSubmit" } ] } @@ -26,7 +26,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/drain-mailbox.sh PostToolUse" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/drain-mailbox.sh\" PostToolUse" } ] } @@ -36,7 +36,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-stop.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-stop.sh\"" } ] } @@ -46,7 +46,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-session-end.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-session-end.sh\"" } ] } diff --git a/plugins/warp/.codex-plugin/plugin.json b/plugins/warp/.codex-plugin/plugin.json index ebe510d..4020360 100644 --- a/plugins/warp/.codex-plugin/plugin.json +++ b/plugins/warp/.codex-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "warp", "description": "Warp terminal integration for Codex - native notifications, and more to come", - "version": "0.4.0", + "version": "0.4.1", "author": { "name": "Warp", "url": "https://warp.dev" diff --git a/plugins/warp/hooks/hooks.json b/plugins/warp/hooks/hooks.json index ce26297..ebcd3aa 100644 --- a/plugins/warp/hooks/hooks.json +++ b/plugins/warp/hooks/hooks.json @@ -5,7 +5,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-session-start.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-session-start.sh\"" } ] } @@ -15,7 +15,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-stop.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-stop.sh\"" } ] } @@ -25,7 +25,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-permission-request.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-permission-request.sh\"" } ] } @@ -35,7 +35,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-prompt-submit.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-prompt-submit.sh\"" } ] } @@ -45,7 +45,7 @@ "hooks": [ { "type": "command", - "command": "${PLUGIN_ROOT}/scripts/on-post-tool-use.sh" + "command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh\"" } ] } diff --git a/plugins/warp/scripts/on-session-start.sh b/plugins/warp/scripts/on-session-start.sh index af5fb59..cf72380 100755 --- a/plugins/warp/scripts/on-session-start.sh +++ b/plugins/warp/scripts/on-session-start.sh @@ -5,7 +5,7 @@ set -euo pipefail # Bump on every release; keep in sync with Warp's Codex plugin manager. -PLUGIN_VERSION="0.4.0" +PLUGIN_VERSION="0.4.1" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/should-use-structured.sh" diff --git a/tests/test-hooks.sh b/tests/test-hooks.sh index e54738c..8805cb3 100755 --- a/tests/test-hooks.sh +++ b/tests/test-hooks.sh @@ -228,11 +228,51 @@ assert_file_exists "github workflow exists" "$REPO_ROOT/.github/workflows/test.y assert_json_field "marketplace name" "$(cat "$REPO_ROOT/.agents/plugins/marketplace.json")" ".name" "codex-warp" assert_json_field "warp plugin name" "$(cat "$REPO_ROOT/plugins/warp/.codex-plugin/plugin.json")" ".name" "warp" assert_json_field "oz plugin name" "$(cat "$REPO_ROOT/plugins/orchestration/.codex-plugin/plugin.json")" ".name" "orchestration" -assert_contains "warp hooks use PLUGIN_ROOT" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${PLUGIN_ROOT}/scripts/on-session-start.sh' -assert_contains "warp hooks include prompt submit" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${PLUGIN_ROOT}/scripts/on-prompt-submit.sh' -assert_contains "warp hooks include post tool use" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${PLUGIN_ROOT}/scripts/on-post-tool-use.sh' -assert_contains "oz hooks use PLUGIN_ROOT" "$(cat "$REPO_ROOT/plugins/orchestration/hooks/hooks.json")" '${PLUGIN_ROOT}/scripts/drain-mailbox.sh UserPromptSubmit' -assert_contains "oz hooks include session end" "$(cat "$REPO_ROOT/plugins/orchestration/hooks/hooks.json")" '${PLUGIN_ROOT}/scripts/on-session-end.sh' +assert_contains "warp hooks use CLAUDE_PLUGIN_ROOT" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${CLAUDE_PLUGIN_ROOT}/scripts/on-session-start.sh' +assert_contains "warp hooks include prompt submit" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${CLAUDE_PLUGIN_ROOT}/scripts/on-prompt-submit.sh' +assert_contains "warp hooks include post tool use" "$(cat "$REPO_ROOT/plugins/warp/hooks/hooks.json")" '${CLAUDE_PLUGIN_ROOT}/scripts/on-post-tool-use.sh' +assert_contains "oz hooks use CLAUDE_PLUGIN_ROOT" "$(cat "$REPO_ROOT/plugins/orchestration/hooks/hooks.json")" '${CLAUDE_PLUGIN_ROOT}/scripts/drain-mailbox.sh' +assert_contains "oz hooks include session end" "$(cat "$REPO_ROOT/plugins/orchestration/hooks/hooks.json")" '${CLAUDE_PLUGIN_ROOT}/scripts/on-session-end.sh' + +echo "" +echo "=== Codex plugin root contract ===" +unset OZ_PARENT_RUN_ID +WARP_PLUGIN_ROOT="$TEST_TMP/warp plugin with spaces" +ORCHESTRATION_PLUGIN_ROOT="$TEST_TMP/orchestration plugin with spaces" +ln -s "$REPO_ROOT/plugins/warp" "$WARP_PLUGIN_ROOT" +ln -s "$REPO_ROOT/plugins/orchestration" "$ORCHESTRATION_PLUGIN_ROOT" +WARP_HOOKS="$WARP_PLUGIN_ROOT/hooks/hooks.json" +ORCHESTRATION_HOOKS="$ORCHESTRATION_PLUGIN_ROOT/hooks/hooks.json" +SESSION_START_COMMAND=$(jq -r '.hooks.SessionStart[0].hooks[0].command' "$WARP_HOOKS") +STOP_COMMAND=$(jq -r '.hooks.Stop[0].hooks[0].command' "$WARP_HOOKS") +ORCHESTRATION_START_COMMAND=$(jq -r '.hooks.SessionStart[0].hooks[0].command' "$ORCHESTRATION_HOOKS") +ORCHESTRATION_STOP_COMMAND=$(jq -r '.hooks.Stop[0].hooks[0].command' "$ORCHESTRATION_HOOKS") + +OUTPUT=$(printf '%s' "$HOOK_INPUT" | env -u PLUGIN_ROOT \ + -u WARP_CLI_AGENT_PROTOCOL_VERSION -u WARP_CLIENT_VERSION \ + CLAUDE_PLUGIN_ROOT="$WARP_PLUGIN_ROOT" sh -c "$SESSION_START_COMMAND") +STATUS=$? +assert_eq "session start resolves CLAUDE_PLUGIN_ROOT" "0" "$STATUS" +assert_eq "session start stays silent outside Warp" "" "$OUTPUT" + +OUTPUT=$(printf '%s' "$HOOK_INPUT" | env -u PLUGIN_ROOT \ + -u WARP_CLI_AGENT_PROTOCOL_VERSION -u WARP_CLIENT_VERSION \ + CLAUDE_PLUGIN_ROOT="$WARP_PLUGIN_ROOT" sh -c "$STOP_COMMAND") +STATUS=$? +assert_eq "stop resolves CLAUDE_PLUGIN_ROOT" "0" "$STATUS" +assert_eq "stop stays silent outside Warp" "" "$OUTPUT" + +OUTPUT=$(printf '%s' "$HOOK_INPUT" | env -u PLUGIN_ROOT -u OZ_PARENT_RUN_ID \ + CLAUDE_PLUGIN_ROOT="$ORCHESTRATION_PLUGIN_ROOT" sh -c "$ORCHESTRATION_START_COMMAND") +STATUS=$? +assert_eq "orchestration start resolves CLAUDE_PLUGIN_ROOT" "0" "$STATUS" +assert_eq "orchestration start stays silent outside Oz" "" "$OUTPUT" + +OUTPUT=$(printf '%s' "$HOOK_INPUT" | env -u PLUGIN_ROOT -u OZ_PARENT_RUN_ID \ + CLAUDE_PLUGIN_ROOT="$ORCHESTRATION_PLUGIN_ROOT" sh -c "$ORCHESTRATION_STOP_COMMAND") +STATUS=$? +assert_eq "orchestration stop resolves CLAUDE_PLUGIN_ROOT" "0" "$STATUS" +assert_eq "orchestration stop stays silent outside Oz" "" "$OUTPUT" echo ""