refactor(macOS): overhaul handlers to support dynamic OS routing via listen feature

This commit is contained in:
Haitao Pan 2026-06-21 18:52:37 +08:00
parent 68206296f4
commit 3f1ece8601
9 changed files with 57 additions and 16 deletions

View File

@ -3,13 +3,14 @@
ansible.builtin.service:
name: caddy
state: reloaded
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
- name: Restart acp codex
- name: Restart acp codex on Linux
ansible.builtin.service:
name: "{{ acp_codex_service_name }}"
state: restarted
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
listen: Restart acp codex
- name: Restart acp codex on macOS
ansible.builtin.command: "launchctl unload {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"
@ -17,7 +18,16 @@
failed_when: false
changed_when: false
notify: Start acp codex on macOS
when: ansible_system == 'Darwin'
listen: Restart acp codex
- name: Start acp codex on macOS
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"
changed_when: false
when: ansible_system == 'Darwin'
- name: Restart acp codex on Windows
ansible.builtin.debug:
msg: "Windows restart for codex is not yet implemented"
when: ansible_os_family == 'Windows'
listen: Restart acp codex

View File

@ -4,7 +4,7 @@
src: codex.plist.j2
dest: "{{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"
mode: "0644"
notify: Restart acp codex on macOS
notify: Restart acp codex
- name: Reload launchd agent for Codex ACP
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.codex.plist"

View File

@ -3,13 +3,14 @@
ansible.builtin.service:
name: caddy
state: reloaded
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
- name: Restart acp gemini
- name: Restart acp gemini on Linux
ansible.builtin.service:
name: "{{ acp_gemini_service_name }}"
state: restarted
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
listen: Restart acp gemini
- name: Restart acp gemini on macOS
ansible.builtin.command: "launchctl unload {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.gemini.plist"
@ -17,7 +18,16 @@
failed_when: false
changed_when: false
notify: Start acp gemini on macOS
when: ansible_system == 'Darwin'
listen: Restart acp gemini
- name: Start acp gemini on macOS
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.gemini.plist"
changed_when: false
when: ansible_system == 'Darwin'
- name: Restart acp gemini on Windows
ansible.builtin.debug:
msg: "Windows restart for gemini is not yet implemented"
when: ansible_os_family == 'Windows'
listen: Restart acp gemini

View File

@ -4,7 +4,7 @@
src: gemini.plist.j2
dest: "{{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.gemini.plist"
mode: "0644"
notify: Restart acp gemini on macOS
notify: Restart acp gemini
- name: Reload launchd agent for Gemini ACP
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.gemini.plist"

View File

@ -3,13 +3,14 @@
ansible.builtin.service:
name: caddy
state: reloaded
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
- name: Restart acp hermes
- name: Restart acp hermes on Linux
ansible.builtin.service:
name: "{{ acp_hermes_service_name }}"
state: restarted
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
listen: Restart acp hermes
- name: Restart acp hermes on macOS
ansible.builtin.command: "launchctl unload {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.hermes.plist"
@ -17,7 +18,16 @@
failed_when: false
changed_when: false
notify: Start acp hermes on macOS
when: ansible_system == 'Darwin'
listen: Restart acp hermes
- name: Start acp hermes on macOS
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.hermes.plist"
changed_when: false
when: ansible_system == 'Darwin'
- name: Restart acp hermes on Windows
ansible.builtin.debug:
msg: "Windows restart for hermes is not yet implemented"
when: ansible_os_family == 'Windows'
listen: Restart acp hermes

View File

@ -4,7 +4,7 @@
src: hermes.plist.j2
dest: "{{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.hermes.plist"
mode: "0644"
notify: Restart acp hermes on macOS
notify: Restart acp hermes
- name: Reload launchd agent for Hermes ACP
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.hermes.plist"

View File

@ -3,13 +3,14 @@
ansible.builtin.service:
name: caddy
state: reloaded
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
- name: Restart acp opencode
- name: Restart acp opencode on Linux
ansible.builtin.service:
name: "{{ acp_opencode_service_name }}"
state: restarted
when: ansible_os_family != 'Darwin'
when: ansible_system == 'Linux'
listen: Restart acp opencode
- name: Restart acp opencode on macOS
ansible.builtin.command: "launchctl unload {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.opencode.plist"
@ -17,7 +18,16 @@
failed_when: false
changed_when: false
notify: Start acp opencode on macOS
when: ansible_system == 'Darwin'
listen: Restart acp opencode
- name: Start acp opencode on macOS
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.opencode.plist"
changed_when: false
when: ansible_system == 'Darwin'
- name: Restart acp opencode on Windows
ansible.builtin.debug:
msg: "Windows restart for opencode is not yet implemented"
when: ansible_os_family == 'Windows'
listen: Restart acp opencode

View File

@ -4,7 +4,7 @@
src: opencode.plist.j2
dest: "{{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.opencode.plist"
mode: "0644"
notify: Restart acp opencode on macOS
notify: Restart acp opencode
- name: Reload launchd agent for OpenCode ACP
ansible.builtin.command: "launchctl load -w {{ ansible_env.HOME }}/Library/LaunchAgents/plus.svc.xworkspace.acp.opencode.plist"

View File

@ -17,6 +17,7 @@
shell: /bin/bash
create_home: true
state: present
when: ansible_os_family != 'Darwin'
- name: Ensure xworkmate-bridge base directory exists
ansible.builtin.file: