wa-mcp-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wa_mcp_sdk-0.1.0/.gitignore +32 -0
- wa_mcp_sdk-0.1.0/PKG-INFO +20 -0
- wa_mcp_sdk-0.1.0/hatch_build.py +14 -0
- wa_mcp_sdk-0.1.0/pyproject.toml +26 -0
- wa_mcp_sdk-0.1.0/tests/conftest.py +30 -0
- wa_mcp_sdk-0.1.0/tests/fake_keystore_cli.py +45 -0
- wa_mcp_sdk-0.1.0/tests/insight_data.py +211 -0
- wa_mcp_sdk-0.1.0/tests/synth.py +331 -0
- wa_mcp_sdk-0.1.0/tests/test_accounts.py +229 -0
- wa_mcp_sdk-0.1.0/tests/test_agent.py +466 -0
- wa_mcp_sdk-0.1.0/tests/test_ai.py +489 -0
- wa_mcp_sdk-0.1.0/tests/test_client_links_files.py +327 -0
- wa_mcp_sdk-0.1.0/tests/test_core.py +291 -0
- wa_mcp_sdk-0.1.0/tests/test_import_client.py +106 -0
- wa_mcp_sdk-0.1.0/tests/test_insight_analytics.py +209 -0
- wa_mcp_sdk-0.1.0/tests/test_insight_day.py +141 -0
- wa_mcp_sdk-0.1.0/tests/test_insight_review.py +313 -0
- wa_mcp_sdk-0.1.0/tests/test_insight_round2.py +236 -0
- wa_mcp_sdk-0.1.0/tests/test_insight_tasks.py +164 -0
- wa_mcp_sdk-0.1.0/tests/test_keystore.py +390 -0
- wa_mcp_sdk-0.1.0/tests/test_review_fixes.py +425 -0
- wa_mcp_sdk-0.1.0/tests/test_round2.py +435 -0
- wa_mcp_sdk-0.1.0/tests/test_round3.py +344 -0
- wa_mcp_sdk-0.1.0/tests/test_round4.py +145 -0
- wa_mcp_sdk-0.1.0/tests/test_transcribe.py +231 -0
- wa_mcp_sdk-0.1.0/tests/test_vision.py +386 -0
- wa_mcp_sdk-0.1.0/tests/vision_data.py +56 -0
- wa_mcp_sdk-0.1.0/wa_mcp/__init__.py +8 -0
- wa_mcp_sdk-0.1.0/wa_mcp/accounts.py +137 -0
- wa_mcp_sdk-0.1.0/wa_mcp/agent/__init__.py +61 -0
- wa_mcp_sdk-0.1.0/wa_mcp/agent/providers.py +246 -0
- wa_mcp_sdk-0.1.0/wa_mcp/agent/settings.py +76 -0
- wa_mcp_sdk-0.1.0/wa_mcp/agent/voice.py +105 -0
- wa_mcp_sdk-0.1.0/wa_mcp/agent/worker.py +494 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/__init__.py +64 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/anthropic.py +54 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/base.py +252 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/ollama.py +43 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/openai_compat.py +52 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/prompts.py +51 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/summaries.py +87 -0
- wa_mcp_sdk-0.1.0/wa_mcp/ai/usage.py +54 -0
- wa_mcp_sdk-0.1.0/wa_mcp/audio.py +197 -0
- wa_mcp_sdk-0.1.0/wa_mcp/client.py +315 -0
- wa_mcp_sdk-0.1.0/wa_mcp/config.py +730 -0
- wa_mcp_sdk-0.1.0/wa_mcp/console.py +10 -0
- wa_mcp_sdk-0.1.0/wa_mcp/crypt.py +145 -0
- wa_mcp_sdk-0.1.0/wa_mcp/db.py +969 -0
- wa_mcp_sdk-0.1.0/wa_mcp/export.py +143 -0
- wa_mcp_sdk-0.1.0/wa_mcp/files.py +491 -0
- wa_mcp_sdk-0.1.0/wa_mcp/fsutil.py +65 -0
- wa_mcp_sdk-0.1.0/wa_mcp/history.py +239 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/__init__.py +1 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/analytics.py +463 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/base.py +657 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/chat.py +170 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/mentions.py +121 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/my_day.py +371 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/pairing.py +89 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/projects.py +123 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/sections.py +478 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/state.py +208 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/style.py +353 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/tasks.py +282 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/tracker.py +671 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/when.py +301 -0
- wa_mcp_sdk-0.1.0/wa_mcp/insight/wordlists.py +164 -0
- wa_mcp_sdk-0.1.0/wa_mcp/keystore.py +246 -0
- wa_mcp_sdk-0.1.0/wa_mcp/links.py +295 -0
- wa_mcp_sdk-0.1.0/wa_mcp/media.py +123 -0
- wa_mcp_sdk-0.1.0/wa_mcp/outbound.py +94 -0
- wa_mcp_sdk-0.1.0/wa_mcp/people.py +445 -0
- wa_mcp_sdk-0.1.0/wa_mcp/prompts/agent-default.md +3 -0
- wa_mcp_sdk-0.1.0/wa_mcp/py.typed +0 -0
- wa_mcp_sdk-0.1.0/wa_mcp/secretfile.py +181 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/__init__.py +214 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/base.py +62 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/command.py +52 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/faster_whisper.py +62 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/http.py +86 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/openai_whisper.py +60 -0
- wa_mcp_sdk-0.1.0/wa_mcp/transcribe/whisper_cpp.py +55 -0
- wa_mcp_sdk-0.1.0/wa_mcp/vision.py +360 -0
- wa_mcp_sdk-0.1.0/wa_mcp/webhooks.py +88 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
.mypy_cache/
|
|
5
|
+
.ruff_cache/
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.coverage
|
|
8
|
+
htmlcov/
|
|
9
|
+
dist/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
/config.json
|
|
12
|
+
/store/
|
|
13
|
+
/downloads/
|
|
14
|
+
/exports/
|
|
15
|
+
store/
|
|
16
|
+
!bridge/internal/store/
|
|
17
|
+
*.db
|
|
18
|
+
*.db-wal
|
|
19
|
+
*.db-shm
|
|
20
|
+
.env
|
|
21
|
+
.env.*
|
|
22
|
+
api.token
|
|
23
|
+
*.dpapi
|
|
24
|
+
/wa-bridge
|
|
25
|
+
/wa-bridge.exe
|
|
26
|
+
# Local settings and secrets of deploy/docker
|
|
27
|
+
deploy/docker/config.json
|
|
28
|
+
deploy/docker/secrets/*
|
|
29
|
+
!deploy/docker/secrets/README.md
|
|
30
|
+
!deploy/docker/secrets/make-key.sh
|
|
31
|
+
*.key
|
|
32
|
+
*_key
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: wa-mcp-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python library for the wa-mcp WhatsApp bridge: local database, bridge API, transcription, exports
|
|
5
|
+
Author: tsahospital-beep
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: httpx>=0.27.0
|
|
9
|
+
Provides-Extra: encryption
|
|
10
|
+
Requires-Dist: argon2-cffi>=23.1.0; extra == 'encryption'
|
|
11
|
+
Requires-Dist: cryptography>=43.0.0; extra == 'encryption'
|
|
12
|
+
Provides-Extra: faster-whisper
|
|
13
|
+
Requires-Dist: faster-whisper>=1.1.0; extra == 'faster-whisper'
|
|
14
|
+
Provides-Extra: files
|
|
15
|
+
Requires-Dist: pypdf>=5.0.0; extra == 'files'
|
|
16
|
+
Requires-Dist: rarfile>=4.2; extra == 'files'
|
|
17
|
+
Provides-Extra: ocr
|
|
18
|
+
Requires-Dist: rapidocr-onnxruntime>=1.4.0; extra == 'ocr'
|
|
19
|
+
Provides-Extra: openai-whisper
|
|
20
|
+
Requires-Dist: openai-whisper>=20240930; extra == 'openai-whisper'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Include the repository's default prompt in SDK wheels and source archives."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CustomBuildHook(BuildHookInterface):
|
|
10
|
+
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
|
|
11
|
+
root = Path(self.root)
|
|
12
|
+
target = "wa_mcp/prompts/agent-default.md"
|
|
13
|
+
if not (root / target).is_file():
|
|
14
|
+
build_data["force_include"][str(root.parent.parent / "prompts" / "agent-default.md")] = target
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "wa-mcp-sdk"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python library for the wa-mcp WhatsApp bridge: local database, bridge API, transcription, exports"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
authors = [{ name = "tsahospital-beep" }]
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"httpx>=0.27.0",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[project.optional-dependencies]
|
|
13
|
+
encryption = ["cryptography>=43.0.0", "argon2-cffi>=23.1.0"]
|
|
14
|
+
faster-whisper = ["faster-whisper>=1.1.0"]
|
|
15
|
+
openai-whisper = ["openai-whisper>=20240930"]
|
|
16
|
+
files = ["pypdf>=5.0.0", "rarfile>=4.2"]
|
|
17
|
+
ocr = ["rapidocr-onnxruntime>=1.4.0"]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["hatchling>=1.25.0"]
|
|
21
|
+
build-backend = "hatchling.build"
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel]
|
|
24
|
+
packages = ["wa_mcp"]
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.hooks.custom]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from collections.abc import Iterator
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
10
|
+
|
|
11
|
+
import synth
|
|
12
|
+
|
|
13
|
+
from wa_mcp import config, db, people
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture
|
|
17
|
+
def cfg_path(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
|
18
|
+
for name in ("WA_MCP_CONFIG", "WA_MCP_STORE_DIR", "WA_MCP_API_TOKEN", "WA_MCP_SENDING_ENABLED"):
|
|
19
|
+
monkeypatch.delenv(name, raising=False)
|
|
20
|
+
path = synth.make_config(tmp_path, people={"aliases": {"15550100003": "Bob the Builder"}})
|
|
21
|
+
synth.build_wa_db(tmp_path / "store" / "wa.db")
|
|
22
|
+
synth.build_session_db(tmp_path / "store" / "session.db")
|
|
23
|
+
return path
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.fixture
|
|
27
|
+
def store(cfg_path: Path) -> Iterator[db.Store]:
|
|
28
|
+
s = db.connect(config.load(cfg_path))
|
|
29
|
+
people.connect(store=s)
|
|
30
|
+
yield s
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Fake `security` and `secret-tool` programs for test_keystore.py.
|
|
2
|
+
|
|
3
|
+
Run as: python fake_keystore_cli.py <program> <args...>. Items live in the JSON file named by
|
|
4
|
+
FAKE_KEYSTORE_DB ({"service/account": "hex value"}); every argument list is appended to
|
|
5
|
+
FAKE_KEYSTORE_DB + ".argv". FAKE_KEYSTORE_FAIL=1 makes the program fail like a missing D-Bus.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main() -> int:
|
|
17
|
+
program, args = sys.argv[1], sys.argv[2:]
|
|
18
|
+
db = Path(os.environ["FAKE_KEYSTORE_DB"])
|
|
19
|
+
with open(str(db) + ".argv", "a", encoding="utf-8") as log:
|
|
20
|
+
log.write(" ".join([program, *args]) + "\n")
|
|
21
|
+
items = json.loads(db.read_text(encoding="utf-8")) if db.is_file() else {}
|
|
22
|
+
if os.environ.get("FAKE_KEYSTORE_FAIL"):
|
|
23
|
+
sys.stderr.write(f"{program}: Cannot autolaunch D-Bus without X11 $DISPLAY\n")
|
|
24
|
+
return 1
|
|
25
|
+
if program == "security":
|
|
26
|
+
flags = dict(zip(args[1::2], args[2::2], strict=False))
|
|
27
|
+
key = f"{flags.get('-s')}/{flags.get('-a')}"
|
|
28
|
+
if args[:1] == ["find-generic-password"]:
|
|
29
|
+
if key not in items:
|
|
30
|
+
sys.stderr.write("security: The specified item could not be found in the keychain.\n")
|
|
31
|
+
return 44
|
|
32
|
+
sys.stdout.write(items[key] + "\n")
|
|
33
|
+
return 0
|
|
34
|
+
return 2
|
|
35
|
+
if args[:1] == ["lookup"] and len(args) == 5:
|
|
36
|
+
key = f"{args[2]}/{args[4]}"
|
|
37
|
+
if key not in items:
|
|
38
|
+
return 1
|
|
39
|
+
sys.stdout.write(items[key])
|
|
40
|
+
return 0
|
|
41
|
+
return 2
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"""Two weeks of synthetic chats for the insight tests: Alice and Bob (direct), Carol (LID only), group "Book club".
|
|
2
|
+
|
|
3
|
+
All people and numbers are fictional. The clock is fixed: NOW is Monday 2026-03-16 12:00 local time.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import sqlite3
|
|
10
|
+
from datetime import datetime, timedelta
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import synth
|
|
15
|
+
from synth import ALICE, BOB, CAROL_LID, GROUP, ME
|
|
16
|
+
|
|
17
|
+
NOW = datetime(2026, 3, 16, 12, 0)
|
|
18
|
+
NOW_TS = int(NOW.timestamp())
|
|
19
|
+
DAY0 = datetime(2026, 3, 2)
|
|
20
|
+
TITLES = {ALICE: "Alice", BOB: "Bob", CAROL_LID: "", GROUP: "Book club"}
|
|
21
|
+
GRIN = chr(0x1F600)
|
|
22
|
+
TEARS = chr(0x1F602)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def at(day: int, hour: int, minute: int = 0) -> datetime:
|
|
26
|
+
"""Local time on day N of the two weeks (day 0 is Monday 2026-03-02)."""
|
|
27
|
+
return DAY0 + timedelta(days=day, hours=hour, minutes=minute)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class Builder:
|
|
31
|
+
def __init__(self) -> None:
|
|
32
|
+
self.msgs: list[dict[str, Any]] = []
|
|
33
|
+
self.derived: list[tuple[str, str, str, str, float, str, int]] = []
|
|
34
|
+
self.calls: list[tuple[str, str, Any, int, int, int, Any, str]] = []
|
|
35
|
+
self.scheduled: list[tuple[str, str, int, str, int]] = []
|
|
36
|
+
self.n = 0
|
|
37
|
+
|
|
38
|
+
def add(
|
|
39
|
+
self, conv: str, who: str, when: datetime, body: str = "", kind: str = "text", **extra: Any
|
|
40
|
+
) -> str:
|
|
41
|
+
self.n += 1
|
|
42
|
+
mid = extra.pop("id", f"M{self.n:04d}")
|
|
43
|
+
self.msgs.append(
|
|
44
|
+
{
|
|
45
|
+
"conv": conv,
|
|
46
|
+
"msg_id": mid,
|
|
47
|
+
"author": who,
|
|
48
|
+
"outgoing": int(who == ME),
|
|
49
|
+
"sent_at": int(when.timestamp()),
|
|
50
|
+
"body": body,
|
|
51
|
+
"kind": kind,
|
|
52
|
+
**extra,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
return mid
|
|
56
|
+
|
|
57
|
+
def transcript(self, conv: str, mid: str, text: str, conf: float = 0.9) -> None:
|
|
58
|
+
self.derived.append((conv, mid, "transcript", "en", conf, text, NOW_TS - 3600))
|
|
59
|
+
|
|
60
|
+
def call(self, cid: str, peer: str, when: datetime, outcome: str, outgoing: bool = False) -> None:
|
|
61
|
+
start = int(when.timestamp())
|
|
62
|
+
self.calls.append((cid, peer, None, int(outgoing), 0, start, start + 60, outcome))
|
|
63
|
+
|
|
64
|
+
def schedule(self, target: str, body: str, when: datetime) -> None:
|
|
65
|
+
self.scheduled.append((target, body, int(when.timestamp()), "pending", NOW_TS - 86400))
|
|
66
|
+
|
|
67
|
+
def write(self, root: Path) -> Path:
|
|
68
|
+
store = root / "store"
|
|
69
|
+
store.mkdir(parents=True, exist_ok=True)
|
|
70
|
+
conn = sqlite3.connect(store / "wa.db")
|
|
71
|
+
for i, sql in enumerate(synth.go_migrations(), start=1):
|
|
72
|
+
conn.executescript(sql)
|
|
73
|
+
conn.execute(
|
|
74
|
+
"INSERT INTO meta (key, value) VALUES ('schema_version', ?) "
|
|
75
|
+
"ON CONFLICT (key) DO UPDATE SET value = excluded.value",
|
|
76
|
+
(str(i),),
|
|
77
|
+
)
|
|
78
|
+
last: dict[str, int] = {}
|
|
79
|
+
for m in self.msgs:
|
|
80
|
+
last[m["conv"]] = max(last.get(m["conv"], 0), m["sent_at"])
|
|
81
|
+
conn.executemany(
|
|
82
|
+
"INSERT INTO conversations VALUES (?, ?, ?, ?)",
|
|
83
|
+
[(c, TITLES.get(c, ""), int(c == GROUP), t) for c, t in last.items()],
|
|
84
|
+
)
|
|
85
|
+
for m in self.msgs:
|
|
86
|
+
conn.execute(
|
|
87
|
+
"INSERT INTO chat_messages (conv, msg_id, author, outgoing, sent_at, body, kind, attachment_name, "
|
|
88
|
+
"mime, byte_size, local_path, reply_to_id, reply_to_author, reply_preview, mentioned, read_at) "
|
|
89
|
+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
90
|
+
(
|
|
91
|
+
m["conv"], m["msg_id"], m["author"], m["outgoing"], m["sent_at"], m["body"], m["kind"],
|
|
92
|
+
m.get("attachment_name"), m.get("mime"), m.get("byte_size"), m.get("local_path"),
|
|
93
|
+
m.get("reply_to_id"), m.get("reply_to_author"), m.get("reply_preview"),
|
|
94
|
+
json.dumps(m["mentioned"]) if m.get("mentioned") else None, m.get("read_at"),
|
|
95
|
+
),
|
|
96
|
+
) # fmt: skip
|
|
97
|
+
conn.executemany("INSERT INTO derived_text VALUES (?, ?, ?, ?, ?, ?, ?)", self.derived)
|
|
98
|
+
conn.executemany(
|
|
99
|
+
"INSERT INTO call_log (call_id,peer,group_jid,outgoing,video,started_at,ended_at,outcome) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
100
|
+
self.calls,
|
|
101
|
+
)
|
|
102
|
+
conn.executemany(
|
|
103
|
+
"INSERT INTO scheduled_messages (target, body, next_run, status, created_at) VALUES (?, ?, ?, ?, ?)",
|
|
104
|
+
self.scheduled,
|
|
105
|
+
)
|
|
106
|
+
conn.commit()
|
|
107
|
+
conn.close()
|
|
108
|
+
synth.build_session_db(store / "session.db")
|
|
109
|
+
return store
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
IDS: dict[str, str] = {}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def two_weeks() -> Builder:
|
|
116
|
+
b = Builder()
|
|
117
|
+
lat = [2, 15, 90, 300]
|
|
118
|
+
for d in range(10):
|
|
119
|
+
laugh = " haha" if d % 3 == 0 else ""
|
|
120
|
+
face = f" {GRIN}" if d % 2 == 0 else ""
|
|
121
|
+
a = b.add(ALICE, ALICE, at(d, 9, d), f"Morning, I finished chapter {d + 1}{laugh}{face}")
|
|
122
|
+
b.msgs[-1]["read_at"] = int(at(d, 9, d + 1).timestamp())
|
|
123
|
+
b.add(
|
|
124
|
+
ALICE,
|
|
125
|
+
ME,
|
|
126
|
+
at(d, 9, d + lat[d % 4]),
|
|
127
|
+
"Nice, see you at the library",
|
|
128
|
+
reply_to_id=a if d == 4 else None,
|
|
129
|
+
)
|
|
130
|
+
if d % 2 == 1:
|
|
131
|
+
b.add(ALICE, ME, at(d, 15), "Did you like the ending?")
|
|
132
|
+
b.add(ALICE, ALICE, at(d, 15, 10), f"Yes, loved it {TEARS}")
|
|
133
|
+
b.add(ALICE, ALICE, at(3, 9, 30), "", "sticker", attachment_name="wave.webp", mime="image/webp")
|
|
134
|
+
b.add(ALICE, ME, at(5, 10), "", "sticker", attachment_name="thumbs.webp", mime="image/webp")
|
|
135
|
+
for d, text in (
|
|
136
|
+
(2, "I will bring the snacks on Saturday"),
|
|
137
|
+
(6, "Running late, start without me"),
|
|
138
|
+
(8, ""),
|
|
139
|
+
):
|
|
140
|
+
mid = b.add(ALICE, ALICE, at(d, 18), "", "voice", mime="audio/ogg", byte_size=24000)
|
|
141
|
+
if text:
|
|
142
|
+
b.transcript(ALICE, mid, text)
|
|
143
|
+
b.add(ALICE, ME, at(7, 20), "", "voice", mime="audio/ogg", byte_size=16000)
|
|
144
|
+
b.add(ALICE, ALICE, at(8, 2), "Cannot sleep, thinking about the plot")
|
|
145
|
+
b.add(ALICE, ME, at(8, 9, 30), "Same here, the twist was great")
|
|
146
|
+
IDS["cover"] = b.add(ALICE, ALICE, at(9, 11), "", "image", attachment_name="cover.jpg", mime="image/jpeg")
|
|
147
|
+
IDS["cover_words"] = b.add(ALICE, ALICE, at(9, 11, 1), "this one looks better for the poster")
|
|
148
|
+
|
|
149
|
+
# report: new -> in_progress -> follow-up -> done -> thanks -> fix by reply -> new
|
|
150
|
+
b.call("CA1", ALICE, at(10, 9, 30), "missed")
|
|
151
|
+
IDS["report"] = b.add(ALICE, ALICE, at(10, 10), "Can you please send me the updated report by Friday?")
|
|
152
|
+
IDS["report_ok"] = b.add(ALICE, ME, at(10, 10, 20), "Sure, will do")
|
|
153
|
+
IDS["report_ping"] = b.add(ALICE, ALICE, at(11, 9), "Any update on the report?")
|
|
154
|
+
IDS["report_file"] = b.add(
|
|
155
|
+
ALICE, ME, at(11, 11), "", "document", attachment_name="report.pdf", mime="application/pdf"
|
|
156
|
+
)
|
|
157
|
+
IDS["report_thanks"] = b.add(ALICE, ALICE, at(11, 11, 5), "Thanks, perfect")
|
|
158
|
+
IDS["promise_today"] = b.add(ALICE, ME, at(11, 18), "I will send the invoice on Monday")
|
|
159
|
+
IDS["report_fix"] = b.add(
|
|
160
|
+
ALICE,
|
|
161
|
+
ALICE,
|
|
162
|
+
at(12, 9),
|
|
163
|
+
"The report file is broken, the charts are missing",
|
|
164
|
+
reply_to_id=IDS["report_file"],
|
|
165
|
+
)
|
|
166
|
+
IDS["logo"] = b.add(ALICE, ALICE, at(13, 14), "The logo on the website looks broken, please fix it")
|
|
167
|
+
|
|
168
|
+
# Bob: overdue promise, a burst, waiting and answer, a missed call, a question at the end
|
|
169
|
+
b.add(BOB, BOB, at(7, 10), "Hi, how are you?")
|
|
170
|
+
b.add(BOB, ME, at(7, 10, 5), "Good, thanks")
|
|
171
|
+
IDS["promise_overdue"] = b.add(BOB, ME, at(8, 15), "I'll send you the contract on Friday")
|
|
172
|
+
IDS["banner"] = b.add(BOB, BOB, at(12, 10), "I need a new banner")
|
|
173
|
+
b.add(BOB, BOB, at(12, 10, 1), "for the website")
|
|
174
|
+
b.add(BOB, BOB, at(12, 10, 2), "asap please")
|
|
175
|
+
IDS["flyer"] = b.add(BOB, BOB, at(12, 10, 15), "and also the flyer for the event")
|
|
176
|
+
IDS["banner_q"] = b.add(BOB, ME, at(12, 10, 30), "Which size do you need?")
|
|
177
|
+
IDS["banner_answer"] = b.add(BOB, BOB, at(12, 11), "1200 by 400 pixels")
|
|
178
|
+
b.call("CB1", BOB, at(14, 8, 30), "missed")
|
|
179
|
+
IDS["bob_last"] = b.add(BOB, BOB, at(14, 9), "Did you get my email? Can you check it?")
|
|
180
|
+
|
|
181
|
+
# Carol: missed call returned by a call, last word is a thank-you
|
|
182
|
+
b.add(CAROL_LID, CAROL_LID, at(10, 12), "Are you coming to the meeting on Thursday?")
|
|
183
|
+
b.add(CAROL_LID, ME, at(10, 12, 5), "Yes")
|
|
184
|
+
b.call("CC1", CAROL_LID, at(13, 11), "missed")
|
|
185
|
+
b.call("CC2", CAROL_LID, at(13, 11, 30), "answered", outgoing=True)
|
|
186
|
+
b.add(CAROL_LID, CAROL_LID, at(13, 12), "ok thanks")
|
|
187
|
+
|
|
188
|
+
# Book club group
|
|
189
|
+
for d in range(0, 10, 2):
|
|
190
|
+
b.add(GROUP, ALICE, at(d, 19), f"Chapter {d + 1} was a page turner")
|
|
191
|
+
b.add(GROUP, BOB, at(d, 19, 3), "Agreed, the ending surprised me")
|
|
192
|
+
b.add(GROUP, CAROL_LID, at(d, 19, 6), "", "sticker", attachment_name="clap.webp", mime="image/webp")
|
|
193
|
+
if d % 4 == 0:
|
|
194
|
+
b.add(GROUP, ME, at(d, 19, 10), "Next one is my pick")
|
|
195
|
+
b.add(GROUP, CAROL_LID, at(9, 18), "Meet at the library on Thursday")
|
|
196
|
+
IDS["room"] = b.add(
|
|
197
|
+
GROUP, CAROL_LID, at(11, 19), "Can you book the room for Thursday please", mentioned=[ME]
|
|
198
|
+
)
|
|
199
|
+
IDS["handouts"] = b.add(GROUP, BOB, at(11, 19, 5), "Someone should print the handouts please")
|
|
200
|
+
IDS["room_done"] = b.add(GROUP, ME, at(11, 20), "Room is booked for Thursday, done")
|
|
201
|
+
b.schedule(GROUP, "Reading tonight at 7", at(14, 18))
|
|
202
|
+
b.schedule(GROUP, "Reminder for tomorrow", at(15, 18))
|
|
203
|
+
return b
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
CONFIG: dict[str, Any] = {
|
|
207
|
+
"tasks": {
|
|
208
|
+
"projects": [{"id": "club-site", "name": "Book club site", "keywords": ["website", "logo", "poster"]}]
|
|
209
|
+
},
|
|
210
|
+
"mentions": {"watch": ["updated report", {"label": "Library", "words": ["library"]}]},
|
|
211
|
+
}
|