Skip to content

Commit 41d85ac

Browse files
authored
Merge pull request #6 from Spchdt/new-actions
Fix lint
2 parents 9166eaf + ab811c1 commit 41d85ac

File tree

9 files changed

+39
-69
lines changed

9 files changed

+39
-69
lines changed

src/actions/client/echo.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/actions/server/copy_to_clipboard.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Copy text to the user's clipboard. Use this for phone numbers, confirmation codes, addresses, etc. """
1+
"""Copy text to the user's clipboard. Use this for phone numbers, confirmation codes, addresses, etc."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,7 +11,7 @@
1011

1112
@register_server_event("COPY_TO_CLIPBOARD")
1213
class CopyToClipboardEmitter(ServerEventEmitter):
13-
""" Copy text to the user's clipboard. """
14+
"""Copy text to the user's clipboard."""
1415

1516
event_type = "COPY_TO_CLIPBOARD"
1617
description = "Copy text to the user's clipboard. Use this for phone numbers, confirmation codes, addresses, etc."
@@ -23,11 +24,9 @@ class CopyToClipboardEmitter(ServerEventEmitter):
2324

2425
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
2526
text = kwargs.get("text")
26-
27+
2728
return OutboundFrame(
2829
type="COPY_TO_CLIPBOARD",
29-
payload={
30-
"text": text
31-
},
30+
payload={"text": text},
3231
session_id=ctx.session_id,
33-
)
32+
)
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Trigger the client to fetch and share their GPS location. ONLY use this AFTER you have verbally asked for the user's consent and they have explicitly answered Yes. """
1+
"""Trigger the client to fetch and share their GPS location. ONLY use this AFTER you have verbally asked for the user's consent and they have explicitly answered Yes."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,17 +11,17 @@
1011

1112
@register_server_event("FETCH_LOCATION")
1213
class FetchLocationEmitter(ServerEventEmitter):
13-
""" Trigger the client to fetch and share their GPS location. """
14+
"""Trigger the client to fetch and share their GPS location."""
1415

1516
event_type = "FETCH_LOCATION"
1617
description = "Trigger the client to fetch and share their GPS location. ONLY use this AFTER you have verbally asked for the user's consent and they have explicitly answered Yes."
1718
parameters = {
1819
# No parameters
1920
}
2021

21-
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
22+
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame: # noqa: ARG002
2223
return OutboundFrame(
2324
type="FETCH_LOCATION",
2425
payload={},
2526
session_id=ctx.session_id,
26-
)
27+
)

src/actions/server/open_url.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Open a website or Apple Maps link directly on the user's screen. """
1+
"""Open a website or Apple Maps link directly on the user's screen."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,7 +11,7 @@
1011

1112
@register_server_event("OPEN_URL")
1213
class OpenUrlEmitter(ServerEventEmitter):
13-
""" Open a website or Apple Maps link directly on the user's screen. """
14+
"""Open a website or Apple Maps link directly on the user's screen."""
1415

1516
event_type = "OPEN_URL"
1617
description = "Open a website or Apple Maps link directly on the user's screen."
@@ -23,11 +24,9 @@ class OpenUrlEmitter(ServerEventEmitter):
2324

2425
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
2526
url = kwargs.get("url")
26-
27+
2728
return OutboundFrame(
2829
type="OPEN_URL",
29-
payload={
30-
"url": url
31-
},
30+
payload={"url": url},
3231
session_id=ctx.session_id,
33-
)
32+
)
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Trigger the client to temporarily map hardware volume buttons to Yes/No answers. Use this immediately after asking a Yes/No question. """
1+
"""Trigger the client to temporarily map hardware volume buttons to Yes/No answers. Use this immediately after asking a Yes/No question."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,17 +11,17 @@
1011

1112
@register_server_event("REQUEST_BINARY_INPUT")
1213
class RequestBinaryInputEmitter(ServerEventEmitter):
13-
""" Trigger the client to temporarily map hardware volume buttons to Yes/No answers. """
14+
"""Trigger the client to temporarily map hardware volume buttons to Yes/No answers."""
1415

1516
event_type = "REQUEST_BINARY_INPUT"
1617
description = "Trigger the client to temporarily map hardware volume buttons to Yes/No answers. Use this immediately after asking a Yes/No question."
1718
parameters = {
1819
# No parameters
1920
}
2021

21-
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
22+
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame: # noqa: ARG002
2223
return OutboundFrame(
2324
type="REQUEST_BINARY_INPUT",
2425
payload={},
2526
session_id=ctx.session_id,
26-
)
27+
)

src/actions/server/request_camera_preview.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Request the user to take a photo using their camera. Use this when the user asks you to 'look at' something or take a picture. """
1+
"""Request the user to take a photo using their camera. Use this when the user asks you to 'look at' something or take a picture."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,15 +11,15 @@
1011

1112
@register_server_event("REQUEST_CAMERA_PREVIEW")
1213
class RequestCameraPreviewEmitter(ServerEventEmitter):
13-
""" Request the user to take a photo using their camera. Use this when the user asks you to 'look at' something or take a picture. """
14+
"""Request the user to take a photo using their camera. Use this when the user asks you to 'look at' something or take a picture."""
1415

1516
event_type = "REQUEST_CAMERA_PREVIEW"
1617
description = "Request the user to take a photo using their camera. Use this when the user asks you to 'look at' something or take a picture."
1718
parameters = {
1819
# No parameters
1920
}
2021

21-
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
22+
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame: # noqa: ARG002
2223
# No payload extraction
2324
return OutboundFrame(
2425
type="REQUEST_CAMERA_PREVIEW",

src/actions/server/set_reminder.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Create a local notification/reminder on the user's device. """
1+
"""Create a local notification/reminder on the user's device."""
2+
23
from typing import TYPE_CHECKING, Any
34

45
from src.actions.base import ServerEventEmitter, register_server_event
@@ -10,7 +11,7 @@
1011

1112
@register_server_event("SET_REMINDER")
1213
class SetReminderEmitter(ServerEventEmitter):
13-
""" Create a local notification/reminder on the user's device. """
14+
"""Create a local notification/reminder on the user's device."""
1415

1516
event_type = "SET_REMINDER"
1617
description = "Create a local notification/reminder on the user's device. Parse relative time to an absolute ISO 8601 timestamp."
@@ -22,18 +23,15 @@ class SetReminderEmitter(ServerEventEmitter):
2223
"time_iso": {
2324
"type": "string",
2425
"description": "The exact ISO 8601 timestamp for when the reminder should trigger.",
25-
}
26+
},
2627
}
2728

2829
async def tool_fn(self, ctx: "ConnectionContext", **kwargs: Any) -> OutboundFrame:
2930
message = kwargs.get("message")
3031
time_iso = kwargs.get("time_iso")
31-
32+
3233
return OutboundFrame(
3334
type="SET_REMINDER",
34-
payload={
35-
"message": message,
36-
"time_iso": time_iso
37-
},
35+
payload={"message": message, "time_iso": time_iso},
3836
session_id=ctx.session_id,
39-
)
37+
)

src/prompts/jemmie.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
1818
1. **Camera/Photos (REQUEST_CAMERA_PREVIEW)**:
1919
- When the user asks you to "look at" something, "help me see", or take a picture, say a quick verbal acknowledgment (e.g., "Sure, pull the phone away from your ear and snap a pic"), then IMMEDIATELY invoke the `request_camera_preview` tool.
20-
20+
2121
2. **Location (FETCH_LOCATION)**:
2222
- **Consent-gated**: Never try to track their location passively. If you need their location (for local recommendations, weather, navigation), you MUST ask them verbally: "Can I use your current location?"
2323
- Once the user explicitly says "Yes", execute the `fetch_location` tool to retrieve it.
24-
24+
2525
3. **Silent Answers (REQUEST_BINARY_INPUT)**:
2626
- If you ask a Yes/No question and want to let the user answer silently using their volume buttons, immediately invoke the `request_binary_input` tool right after you ask the question.
2727
- Example: "Should I book the table? Use your volume up to say yes, volume down for no." -> (Trigger Tool)
28-
28+
2929
4. **Clipboard (COPY_TO_CLIPBOARD)**:
3030
- If you read out a phone number, address, URL, or confirmation code, ALWAYS use `copy_to_clipboard` to save it to their phone automatically. Let them know you did it: "I've copied that to your clipboard."
31-
31+
3232
5. **Browsing & Navigation (OPEN_URL)**:
3333
- If you recommend a specific restaurant, location, or website, invoke `open_url` to pop it up straight onto their screen while continuing the chat. Provide standard https:// or maps:// links.
34-
34+
3535
6. **Reminders (SET_REMINDER)**:
3636
- When asked to remind the user about something later, calculate the absolute ISO 8601 timestamp accurately based on their request and current time, then invoke `set_reminder`. Let them know "Got it, I'll remind you then."
3737

tests/test_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22

33
import pytest
4+
from src.actions.client.echo import EchoActionHandler
45

56
from src.actions import (
67
get_all_client_actions,
@@ -9,7 +10,6 @@
910
get_client_handler,
1011
get_server_event_emitter,
1112
)
12-
from src.actions.client.echo import EchoActionHandler
1313
from src.actions.server.set_timer import SetTimerEmitter
1414
from src.engine.connection_context import ConnectionContext
1515
from src.pipelines.action import ActionPipeline

0 commit comments

Comments
 (0)