Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(voice): point Jarvis at app actions and refuse misspelled parameters

rubenluetke10-beepabec6b83d005
diff --git a/jarvis/live/product.py b/jarvis/live/product.py
index ee9f0d72dc..ff7ab4e6cc 100644
--- a/jarvis/live/product.py
+++ b/jarvis/live/product.py
@@ -35,5 +35,8 @@ PRODUCT_BRIEF = (
"When asked what Jarvis is or can do, explain it from this brief in plain words and "
"offer an example; never describe yourself as a generic chatbot. For exact steps, "
"settings or troubleshooting, read the built-in guide with product_help instead of "
- "guessing."
+ "guessing. product_help only explains: to actually DO something the app's screens "
+ "offer (change a setting, theme, voice, skill, model, agent), search it with "
+ "find-app-action and run it with run-app-action; coding workspaces and their agents "
+ "go through workspace-orchestrate."
)
diff --git a/jarvis/plugins/tool/app_action.py b/jarvis/plugins/tool/app_action.py
index fa2633258f..2cd9129cc1 100644
--- a/jarvis/plugins/tool/app_action.py
+++ b/jarvis/plugins/tool/app_action.py
@@ -187,7 +187,26 @@ class RunAppActionTool:
query = {k: params.pop(k) for k in list(params) if k in entry.query_params}
body = params.pop("body", None)
if body is None and entry.has_body and params:
- body = params # a model that flattened the body still gets it through
+ body, params = params, {} # a model that flattened the body still gets it through
+ # A misspelled name used to be dropped and the action ran on defaults.
+ body_fields = (entry.parameters.get("properties", {}).get("body") or {}).get("properties")
+ unknown = sorted(params) + (
+ [f"body.{k}" for k in body if k not in body_fields]
+ if isinstance(body, dict) and body_fields
+ else []
+ )
+ if unknown:
+ valid = [*entry.path_params, *entry.query_params]
+ body_names = [f"body.{k}" for k in body_fields or ()]
+ valid += body_names or (["body"] if entry.has_body else [])
+ return ToolResult(
+ success=False,
+ output={"action_id": entry.id, "executed": False},
+ error=(
+ f"Unknown parameter(s) {', '.join(unknown)} for {entry.title}; nothing ran. "
+ f"Valid: {', '.join(valid) or 'none'}."
+ ),
+ )
status, data = await self._request(entry.method, path, query, body)
if status is None:
history.record(entry.id, "failed", str(data), via=self.name)
diff --git a/tests/unit/app_actions/test_app_actions.py b/tests/unit/app_actions/test_app_actions.py
index 697fa52587..6109d7febe 100644
--- a/tests/unit/app_actions/test_app_actions.py
+++ b/tests/unit/app_actions/test_app_actions.py
@@ -224,3 +224,13 @@ def test_actions_carrying_a_credential_are_never_offered() -> None:
assert ("POST", "/api/computers") not in routes
assert ("GET", "/api/usage") in routes
assert default_tier(routes[("PATCH", "/api/agent-chat/sessions/{sid}")]) == "ask"
+
+
+async def test_a_misspelled_parameter_is_refused_before_anything_runs(app: FastAPI) -> None:
+ action_id = _id(app, "/api/skills", "GET")
+ tool = RunAppActionTool(runtime=_Runtime(app))
+ result = await tool.execute({"action_id": action_id, "params": {"limt": 3}}, None)
+ assert not result.success and result.output["executed"] is False
+ assert "limt" in (result.error or "") and "limit" in (result.error or "")
+ ran = await tool.execute({"action_id": action_id, "params": {"limit": 3}}, None)
+ assert ran.success and ran.output["response"]["limit"] == 3