mirror of
https://github.com/budelius/stoz3n-workflow-movies.git
synced 2026-11-21 16:15:55 +00:00
feat: add movie research workflow manifest
This commit is contained in:
1 parent
b6de16f482
commit
ab49d8d110
4 files changed
+178
-1
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
name: Validate workflow manifest
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Validate manifest
|
||||||
|
run: python3 scripts/validate_manifest.py
|
||||||
@@ -1,3 +1,53 @@
|
|||||||
# stoz3n-workflow-movies
|
# stoz3n-workflow-movies
|
||||||
|
|
||||||
Example repository-backed movie research workflow for stoz3n
|
An example **repository-backed workflow** for
|
||||||
|
[`stoz3n-chat-agent`](https://git-dev.obachan.dev/stozn/stoz3n-chat-agent).
|
||||||
|
It is declarative: the repository supplies a reviewed manifest and prompt while
|
||||||
|
the chat agent supplies the LLM, Matrix/API/MCP routing, and a small set of
|
||||||
|
host-controlled research capabilities. Repository workflows cannot execute
|
||||||
|
arbitrary code inside the bot.
|
||||||
|
|
||||||
|
## What it does
|
||||||
|
|
||||||
|
Use `/movie`, `/movies`, `@movie`, or a natural-language request routed to the
|
||||||
|
`movies` workflow. The workflow researches a film and returns:
|
||||||
|
|
||||||
|
- a spoiler-light summary;
|
||||||
|
- director(s);
|
||||||
|
- principal actors and character names when reliable;
|
||||||
|
- current streaming, rental, and purchase options for the requested country;
|
||||||
|
- clickable IMDb/TMDB, availability, and provider links.
|
||||||
|
|
||||||
|
Movie identity and credits are checked against sources such as IMDb and TMDB.
|
||||||
|
Streaming availability is treated as region- and date-sensitive and checked
|
||||||
|
against JustWatch, Watchmode, Reelgood, and official provider pages.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/movie Where can I stream Arrival (2016) in Austria? Include the director and main cast.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repository contract
|
||||||
|
|
||||||
|
[`stoz3n-workflow.json`](./stoz3n-workflow.json) is the complete workflow.
|
||||||
|
The host validates and pins it by Git commit and canonical SHA-256 digest in its
|
||||||
|
`src/workflows/_repository/repository_workflows.lock.json` file. Updating this
|
||||||
|
repository does not silently change a running bot: the host lock must be
|
||||||
|
explicitly refreshed and reviewed.
|
||||||
|
|
||||||
|
Supported capabilities are intentionally narrow:
|
||||||
|
|
||||||
|
- `web_search` — Tavily search restricted to the manifest's domain allow-list;
|
||||||
|
- `web_extract` — page extraction restricted to URLs on the same allow-list.
|
||||||
|
|
||||||
|
The host owns provider credentials. No API key belongs in this repository.
|
||||||
|
|
||||||
|
## Validate
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python scripts/validate_manifest.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The validator uses only Python's standard library and prints the canonical
|
||||||
|
manifest digest consumed by the host lock.
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Validate this repository's stoz3n workflow manifest without dependencies."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
MANIFEST_PATH = ROOT / "stoz3n-workflow.json"
|
||||||
|
NAME_RE = re.compile(r"^[a-z0-9][a-z0-9-]*$")
|
||||||
|
DOMAIN_RE = re.compile(r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$")
|
||||||
|
CAPABILITIES = {"web_search", "web_extract"}
|
||||||
|
|
||||||
|
|
||||||
|
def require(condition: bool, message: str) -> None:
|
||||||
|
if not condition:
|
||||||
|
raise SystemExit(f"manifest invalid: {message}")
|
||||||
|
|
||||||
|
|
||||||
|
def string_list(data: dict[str, Any], key: str) -> list[str]:
|
||||||
|
value = data.get(key)
|
||||||
|
require(isinstance(value, list) and value, f"{key} must be a non-empty list")
|
||||||
|
require(all(isinstance(item, str) and item for item in value), f"{key} must contain strings")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
data = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
|
||||||
|
require(isinstance(data, dict), "root must be an object")
|
||||||
|
require(data.get("schema_version") == 1, "schema_version must be 1")
|
||||||
|
require(isinstance(data.get("name"), str) and NAME_RE.fullmatch(data["name"]), "invalid name")
|
||||||
|
require(bool(str(data.get("routing_description", "")).strip()), "routing_description is required")
|
||||||
|
require(bool(str(data.get("system_prompt", "")).strip()), "system_prompt is required")
|
||||||
|
|
||||||
|
for key in ("slash_commands", "mention_handles"):
|
||||||
|
values = string_list(data, key)
|
||||||
|
require(len(values) == len(set(values)), f"{key} contains duplicates")
|
||||||
|
require(all(NAME_RE.fullmatch(value) for value in values), f"{key} contains an invalid name")
|
||||||
|
|
||||||
|
capabilities = set(string_list(data, "capabilities"))
|
||||||
|
require(capabilities <= CAPABILITIES, f"unsupported capabilities: {sorted(capabilities - CAPABILITIES)}")
|
||||||
|
|
||||||
|
domains = string_list(data, "allowed_domains")
|
||||||
|
require(len(domains) <= 30, "allowed_domains exceeds 30 entries")
|
||||||
|
require(all(DOMAIN_RE.fullmatch(domain) for domain in domains), "allowed_domains contains an invalid host")
|
||||||
|
|
||||||
|
require(1 <= int(data.get("max_search_results", 0)) <= 10, "max_search_results must be 1..10")
|
||||||
|
require(1 <= int(data.get("max_tool_rounds", 0)) <= 8, "max_tool_rounds must be 1..8")
|
||||||
|
require(
|
||||||
|
1 <= int(data.get("max_concurrent_invocations", 0)) <= 20,
|
||||||
|
"max_concurrent_invocations must be 1..20",
|
||||||
|
)
|
||||||
|
|
||||||
|
canonical = json.dumps(data, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
|
||||||
|
digest = hashlib.sha256(canonical.encode()).hexdigest()
|
||||||
|
print(f"valid workflow={data['name']} sha256={digest}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"schema_version": 1,
|
||||||
|
"name": "movies",
|
||||||
|
"display_name": "Movie Research",
|
||||||
|
"slash_commands": [
|
||||||
|
"movie",
|
||||||
|
"movies"
|
||||||
|
],
|
||||||
|
"mention_handles": [
|
||||||
|
"movie",
|
||||||
|
"movies"
|
||||||
|
],
|
||||||
|
"routing_description": "Research a movie or film: identify the correct title, summarize it, list directors and principal actors, and find current region-specific streaming, rental, or purchase options with direct source links.",
|
||||||
|
"system_prompt": "You are a careful movie-research agent. Research the requested film using live web sources before answering. First disambiguate remakes and same-title films by year, director, cast, or other context. Use IMDb and TMDB for canonical identity, credits, release year, and synopsis; corroborate important facts with another reputable source. Return a concise spoiler-light summary unless the user asks for a full plot. List the director or directors and the principal cast with character names when reliable. Streaming availability is time-sensitive and country-specific: use current JustWatch, Watchmode, Reelgood, and official provider pages; state the country/region and the date checked; distinguish subscription, free/ad-supported, rent, and buy. If the user gives no region, ask for it when availability cannot be established confidently, or clearly label the region you found instead of guessing. Every availability claim must include a clickable source or provider URL. Never invent a movie, credit, provider, availability claim, or URL. If sources disagree, say so. Format the result with headings for Summary, Director, Principal cast, Where to stream, and Sources.",
|
||||||
|
"capabilities": [
|
||||||
|
"web_search",
|
||||||
|
"web_extract"
|
||||||
|
],
|
||||||
|
"allowed_domains": [
|
||||||
|
"imdb.com",
|
||||||
|
"themoviedb.org",
|
||||||
|
"justwatch.com",
|
||||||
|
"watchmode.com",
|
||||||
|
"reelgood.com",
|
||||||
|
"rottentomatoes.com",
|
||||||
|
"letterboxd.com",
|
||||||
|
"wikipedia.org",
|
||||||
|
"netflix.com",
|
||||||
|
"primevideo.com",
|
||||||
|
"amazon.com",
|
||||||
|
"disneyplus.com",
|
||||||
|
"max.com",
|
||||||
|
"hulu.com",
|
||||||
|
"apple.com",
|
||||||
|
"paramountplus.com",
|
||||||
|
"peacocktv.com",
|
||||||
|
"mubi.com"
|
||||||
|
],
|
||||||
|
"max_search_results": 8,
|
||||||
|
"max_tool_rounds": 6,
|
||||||
|
"max_concurrent_invocations": 3,
|
||||||
|
"router_selectable": true
|
||||||
|
}
|
||||||
Reference in new issue
Block a user