email.compose and tracking.check were hardcoded fakes (draft files / local JSON, no real service) that shadowed the authoring path for real skills. Remove them, delete their data fixtures and config keys, and ship a real starter integration instead: seeds/calendar/next_event, a Nextcloud CalDAV body in the SKILL.md folder format (PROPFIND calendar discovery + SemIf calendar choice, calendar-query REPORT with server-side recurrence expansion, all-day/TZID parsing, honest failures) with a hermetic skill.test.py. merge_seed_store loads seeds into every tree at startup; recorded config lands in gitignored data/skills/, and generated bodies replace seeds of the same name. Only service-free response.reject stays built-in.
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
from semif_agent.decisions import DecisionRequest, DecisionResult, Option, Request
|
|
|
|
|
|
def test_to_semif_row_shape():
|
|
request = DecisionRequest(
|
|
state="some state",
|
|
question="some question?",
|
|
options=[Option("a", "A."), Option("b", "B.")],
|
|
id="abc",
|
|
)
|
|
row = request.to_semif_row()
|
|
assert row["id"] == "abc"
|
|
assert row["state"] == "some state"
|
|
assert row["question"] == "some question?"
|
|
assert row["options"] == [
|
|
{"id": "a", "description": "A."},
|
|
{"id": "b", "description": "B."},
|
|
]
|
|
|
|
|
|
def test_result_selected_and_probs():
|
|
request = DecisionRequest(
|
|
state="s",
|
|
question="q",
|
|
options=[Option("a", "A."), Option("b", "B.")],
|
|
)
|
|
result = DecisionResult(
|
|
request=request, option_ids=["a", "b"], probabilities=[0.3, 0.7]
|
|
)
|
|
assert result.selected == "b"
|
|
assert result.probs == {"a": 0.3, "b": 0.7}
|
|
assert result.prob("a") == 0.3
|
|
|
|
|
|
def test_request_requeue_preserves_state():
|
|
original = Request(text="t", priority=0.7)
|
|
original.resume["from_skill"] = "response.reject"
|
|
updated = original.copy_for_requeue()
|
|
assert updated.id == original.id
|
|
assert updated.priority == original.priority
|
|
assert updated.resume["from_skill"] == "response.reject"
|
|
assert updated.reentries == original.reentries + 1
|
|
|
|
|
|
def test_request_user_input_defaults_none():
|
|
assert Request(text="t").user_input is None |