Skip to content

Agent Zero AI framework

Open Launcher Host access from Core

Alessandrocfd0df4a62fb
diff --git a/plugins/_a0_connector/AGENTS.md b/plugins/_a0_connector/AGENTS.md
index efae2864b..64ad6e612 100644
--- a/plugins/_a0_connector/AGENTS.md
+++ b/plugins/_a0_connector/AGENTS.md
@@ -51,10 +51,12 @@
failures through the shared notification system. Use the standard WebUI
border-radius tokens for its controls and popover. After Disconnect is
acknowledged, keep the popover open and turn that same action into Reconnect;
- use only the narrow Launcher WebContents bridge so this also works in a
- detached Instance window. `/computer-use on` may use that same bounded bridge
- to request approval for the current lease, while `/computer-use off` disables
- only the gateway scope. Pausing remains the reversible master switch.
+ when Host access was turned off in Launcher settings, open that Launcher-owned
+ editor instead of silently re-granting access. Use only the narrow Launcher
+ WebContents bridge so both actions also work in a detached Instance window.
+ `/computer-use on` may use that same bounded bridge to request approval for
+ the current lease, while `/computer-use off` disables only the gateway scope.
+ Pausing remains the reversible master switch.
- File operation results may arrive as chunked JSON/base64
`connector_file_op_result` frames; resolve the pending file operation only
after all chunks for the `op_id` are assembled.
diff --git a/plugins/_a0_connector/extensions/webui/sync-status-end/launcher-gateway.html b/plugins/_a0_connector/extensions/webui/sync-status-end/launcher-gateway.html
index 5f0fca0a9..f2c5f23db 100644
--- a/plugins/_a0_connector/extensions/webui/sync-status-end/launcher-gateway.html
+++ b/plugins/_a0_connector/extensions/webui/sync-status-end/launcher-gateway.html
@@ -103,18 +103,20 @@
</template>
</div>
- <p class="launcher-gateway-empty" x-show="!$store.launcherGateway.gateway">
- Host access is not connected for this Launcher tab.
- </p>
+ <p
+ class="launcher-gateway-empty"
+ x-show="!$store.launcherGateway.gateway"
+ x-text="$store.launcherGateway.unavailableMessage"
+ ></p>
<button
type="button"
class="launcher-gateway-connection-action"
:class="{ 'is-reconnect': !$store.launcherGateway.gateway }"
- x-show="$store.launcherGateway.gateway || $store.launcherGateway.reconnectAvailable"
+ x-show="$store.launcherGateway.gateway || $store.launcherGateway.reconnectAvailable || $store.launcherGateway.canOpenSettings"
:disabled="$store.launcherGateway.saving"
- @click="$store.launcherGateway.gateway ? $store.launcherGateway.emergencyDisconnect() : $store.launcherGateway.reconnect()"
- x-text="$store.launcherGateway.saving ? ($store.launcherGateway.gateway ? 'Disconnecting…' : 'Reconnecting…') : ($store.launcherGateway.gateway ? 'Disconnect' : 'Reconnect')"
+ @click="$store.launcherGateway.gateway ? $store.launcherGateway.emergencyDisconnect() : ($store.launcherGateway.reconnectAvailable ? $store.launcherGateway.reconnect() : $store.launcherGateway.openSettings())"
+ x-text="$store.launcherGateway.saving ? ($store.launcherGateway.gateway ? 'Disconnecting…' : ($store.launcherGateway.reconnectAvailable ? 'Reconnecting…' : 'Opening…')) : ($store.launcherGateway.gateway ? 'Disconnect' : ($store.launcherGateway.reconnectAvailable ? 'Reconnect' : 'Open Host access'))"
></button>
</section>
</div>
diff --git a/plugins/_a0_connector/webui/launcher-gateway-store.js b/plugins/_a0_connector/webui/launcher-gateway-store.js
index 534bffd85..e7cf5ec81 100644
--- a/plugins/_a0_connector/webui/launcher-gateway-store.js
+++ b/plugins/_a0_connector/webui/launcher-gateway-store.js
@@ -21,6 +21,10 @@ const model = {
return typeof window.a0LauncherHost?.reconnect === "function";
},
+ get canOpenSettings() {
+ return typeof window.a0LauncherHost?.openSettings === "function";
+ },
+
get gateway() {
return this.state === "disconnected" ? null : this.status?.gateway || null;
},
@@ -59,6 +63,16 @@ const model = {
return [...new Set(messages)];
},
+ get unavailableMessage() {
+ if (this.reconnectAvailable) return "Host access was disconnected for this Launcher tab.";
+ if (this.state === "disconnected") {
+ return this.canOpenSettings
+ ? "Host access is off in A0 Launcher."
+ : "Host access is off. Use the computer icon beside Reload in the Launcher header to turn it on.";
+ }
+ return "Open Host access in A0 Launcher for connection details.";
+ },
+
onMount() {
if (!this.visible || this.intervalId) return;
void this.refresh();
@@ -167,6 +181,24 @@ const model = {
}
},
+ async openSettings() {
+ if (this.saving) return;
+ this.saving = true;
+ try {
+ const response = await window.a0LauncherHost?.openSettings?.();
+ if (!response?.ok) throw new Error(response?.message || "Host access settings could not open.");
+ this.open = false;
+ } catch (error) {
+ console.error("Failed to open Launcher host settings:", error);
+ void toastFrontendError(
+ error?.message || "Host access settings could not open.",
+ "Host access",
+ );
+ } finally {
+ this.saving = false;
+ }
+ },
+
async control(payload) {
if (this.saving) return;
this.saving = true;
diff --git a/tests/test_a0_connector_launcher_gateway.py b/tests/test_a0_connector_launcher_gateway.py
index 1db998b5a..0154247f4 100644
--- a/tests/test_a0_connector_launcher_gateway.py
+++ b/tests/test_a0_connector_launcher_gateway.py
@@ -78,8 +78,9 @@ def test_launcher_gateway_indicator_joins_sync_status_without_visual_noise() ->
assert "launcher-gateway-trigger-label" not in source
assert "launcher-gateway-dot" not in source
assert ":title=" not in source
- assert "'Disconnect' : 'Reconnect'" in source
- assert "$store.launcherGateway.gateway ? $store.launcherGateway.emergencyDisconnect() : $store.launcherGateway.reconnect()" in source
+ assert "'Disconnect' : ($store.launcherGateway.reconnectAvailable ? 'Reconnect' : 'Open Host access')" in source
+ assert "$store.launcherGateway.reconnectAvailable ? $store.launcherGateway.reconnect() : $store.launcherGateway.openSettings()" in source
+ assert "'Reconnect' : 'Open Host access'" in source
assert "Emergency disconnect" not in source
popover_css = source.split(".launcher-gateway-popover {", 1)[1].split("}", 1)[0]
assert "border-radius: var(--border-radius-sm);" in popover_css
@@ -95,7 +96,10 @@ def test_launcher_gateway_disconnect_becomes_reconnect_through_the_launcher_brid
).read_text(encoding="utf-8")
assert "window.a0LauncherHost?.getState?.()" in source
assert "window.a0LauncherHost?.reconnect?.()" in source
+ assert "window.a0LauncherHost?.openSettings?.()" in source
assert 'typeof window.a0LauncherHost?.reconnect === "function"' in source
+ assert 'typeof window.a0LauncherHost?.openSettings === "function"' in source
+ assert "Host access is off in A0 Launcher." in source
assert 'state: "disconnected", connected: false, gateway: null' in source
assert 'state: "connecting", connected: false, gateway: null' in source