Commit Graph

100 Commits

Author SHA1 Message Date
EugeneTes
98e1ed2613 Add pending-token API to InputDebouncer 2026-09-23 07:05:09 +00:00
EugeneTes
76bbac2df9 Add implementation plan for forwarded audio + comment merge
Three TDD tasks: pending-token API on the debouncer, bracket the
bridge message handler, and one manual E2E line in the README.
2026-09-23 07:02:09 +00:00
EugeneTes
483df6f528 Add spec for merging forwarded audio with its comment
Fixes the debouncer race where a fast comment message flushes on its
own before slow audio transcription completes, splitting a single
user turn into two.
2026-09-23 06:58:54 +00:00
EugeneTes
c35d0434ff Document reply / reply-with-quote support in the README 2026-09-22 08:53:01 +00:00
EugeneTes
bbc8c41118 Pass bot user id into normalizeMessage for reply labelling 2026-09-22 08:51:19 +00:00
EugeneTes
7a53ce379a Prepend reply header ahead of forward header in normalizeMessage 2026-09-22 08:47:37 +00:00
EugeneTes
38ca7cbfea Add buildReplyHeader helper with truncation and media descriptors 2026-09-22 08:42:59 +00:00
EugeneTes
0febacfee7 Add reply, quote, and botUserId types to inbound 2026-09-22 08:38:54 +00:00
EugeneTes
90bcb6fd1f Implementation plan for reply and reply-with-quote context 2026-09-22 08:15:37 +00:00
EugeneTes
99dc906d4e Design spec: surface reply and reply-with-quote context to the agent 2026-09-22 08:11:40 +00:00
EugeneTes
d1d8b26e22 Debounce inbound messages so forward + comment reach the agent as one turn
Telegram sends "forward with a comment" as two separate messages. Buffer
inputs for ~600ms after each arrival and flush a single merged AgentInput;
label forwarded content with its origin so the merged text is intelligible.
2026-09-22 07:51:13 +00:00
EugeneTes
4f2248e24c Default PLAYWRIGHT_BROWSER to chromium in the image
The Dockerfile installs Chromium via `playwright install chromium`, but
Playwright MCP defaults to Chrome (the branded Google build) when no
browser is specified. On a fresh container the launch fails and the
agent falls back to installing Chrome at runtime. Baking the env var
into the image keeps installed browser and default in sync.
2026-09-08 12:45:19 +00:00
EugeneTes
311bdb2eed Document the send tool in the README 2026-09-08 12:32:59 +00:00
EugeneTes
0a40a6b5fa Wire send tool into main.ts 2026-09-08 12:29:19 +00:00
EugeneTes
1bda8a2f16 Document the send tool in the system prompt 2026-09-08 12:26:12 +00:00
EugeneTes
f687c1b9a3 Test Pi tool wrapper for send 2026-09-08 12:23:43 +00:00
EugeneTes
202cb001e7 Test oversize photo/document rejection 2026-09-08 12:20:48 +00:00
EugeneTes
f98572b39e Test explicit kind override for send 2026-09-08 12:18:06 +00:00
EugeneTes
40cb4a8061 Test document routing for non-image extensions 2026-09-08 12:15:46 +00:00
EugeneTes
a6612edc1d Type send.test.ts mocks against SendBotApi 2026-09-08 12:05:09 +00:00
EugeneTes
c30fccb6d5 Send photos through sendPhoto with auto-detection 2026-09-08 12:03:17 +00:00
EugeneTes
7c806d2d57 Reject missing files and directory paths in send 2026-09-08 11:59:43 +00:00
EugeneTes
3db5844c86 Reject send paths that escape the workspace 2026-09-08 11:55:25 +00:00
EugeneTes
3039f85db8 Add send tool skeleton with schema and factory 2026-09-08 11:51:33 +00:00
EugeneTes
ec87e8dcfd Add implementation plan for send-attachments tool 2026-09-08 11:49:13 +00:00
EugeneTes
0b2ae39651 Draft design for send-attachments tool
Adds a `send` custom tool so the agent can push files and images from the
workspace to the owner as Telegram attachments, closing the gap where the
bot could receive files but only ever reply with text.
2026-09-08 11:40:30 +00:00
EugeneTes
8b22645df4 Pipe MCP subprocess stderr to logger and fix bin lookup key
Two review followups:
- Consume the piped stderr from @playwright/mcp so browser-launch
  failures surface in our own logs (was set to "pipe" but never read).
- Drop the wrong ["mcp-server-playwright"] lookup; the actual bin key
  is "playwright-mcp". Falling through Object.values worked but was
  dead code.
2026-09-08 11:00:42 +00:00
EugeneTes
3a43391eb0 Document Playwright MCP env vars and manual E2E steps 2026-09-08 10:56:54 +00:00
EugeneTes
d69d01124d Install Chromium + deps in image for Playwright MCP 2026-09-08 10:55:34 +00:00
EugeneTes
8106c55e46 Wire Playwright MCP bridge into main.ts startup 2026-09-08 10:52:03 +00:00
EugeneTes
a3ce614171 Plan: fix fakeClient fixture to use live getters 2026-09-08 10:49:55 +00:00
EugeneTes
e190d1c714 Add Playwright MCP bridge module 2026-09-08 10:49:09 +00:00
EugeneTes
a4b50617cc Parse PLAYWRIGHT_* env vars into config.playwright 2026-09-08 10:44:39 +00:00
EugeneTes
82fdef8317 Add @modelcontextprotocol/sdk and @playwright/mcp deps 2026-09-08 10:41:03 +00:00
EugeneTes
9b0a90458c Add implementation plan for Playwright MCP bridge
Seven-task plan: deps → config parsing (TDD) → bridge module (TDD w/
fake MCP client) → main.ts wiring → Dockerfile Chromium install →
docs → verification.
2026-09-08 10:37:50 +00:00
EugeneTes
5b7d344207 Draft design for Playwright MCP bridge
Bridge @playwright/mcp as a stdio subprocess and re-export its tools
as Pi custom tools, gated on PLAYWRIGHT_ENABLED. Uses Type.Unsafe to
pass MCP inputSchema through to the model without hand-mapping.
2026-09-08 10:24:07 +00:00
EugeneTes
d889bd33f5 Ignore scope on plain single events per spec 2026-09-08 08:53:30 +00:00
EugeneTes
ae6485d3f4 Document recurring-event manual E2E check 2026-09-08 08:50:14 +00:00
EugeneTes
e0001ac9d2 Add list_instances action for recurring series 2026-09-08 08:46:02 +00:00
EugeneTes
a657c96664 Scope delete to instance or series 2026-09-08 08:41:09 +00:00
EugeneTes
7738b96558 Resolve update scope from event id and guard recurrence-on-instance 2026-09-08 08:35:29 +00:00
EugeneTes
4cb877df04 Add list_mode=series and recurring marker on list output 2026-09-08 08:30:32 +00:00
EugeneTes
737389bcf7 Support recurrence in create and RFC 5545 validation 2026-09-08 08:18:12 +00:00
EugeneTes
c5e2c51fd3 Extend calendar schema and types for recurring events 2026-09-08 08:06:33 +00:00
EugeneTes
160a615713 Add implementation plan for recurring calendar events 2026-09-08 08:00:59 +00:00
EugeneTes
30695cb121 Add design for recurring Google Calendar events
Extends the calendar tool to create, modify, and delete recurring events
via raw RFC 5545 recurrence lines, with instance vs. series scope on
update/delete and a list_instances action to fetch a series' occurrences.
2026-09-08 07:56:24 +00:00
EugeneTes
dbbecce36d Rename Telegram .oga voice files to .ogg for OpenAI transcription
Telegram delivers voice messages with a .oga extension (audio-only OGG),
which OpenAI's transcription API rejects even though the container bytes
are identical to .ogg.
2026-09-07 08:54:21 +00:00
EugeneTes
f876d1cfdf Set container timezone to Europe/Warsaw
Install tzdata so TZ resolves, default SECRETARY_TIMEZONE to
Europe/Warsaw, and pass it through as the container-wide TZ so OS
timestamps (logs, date, cron) match the app's scheduling zone.
2026-09-07 06:34:37 +00:00
EugeneTes
9fc348f0e2 Add Google Calendar as a native Pi custom tool
pi-claude-code-provider fences off Claude Code's MCP servers by design,
so managed MCPs like Google Calendar can't reach the bot through that
provider. Implement calendar access as a first-class Pi tool instead —
it lives alongside `schedule` and calls Google Calendar API v3 directly
with a subscription-free refresh-token grant.

Config: three new optional env vars (GOOGLE_CLIENT_ID,
GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN) — set all three to enable
the tool, leave all three blank to disable. Partial config raises a
ConfigError at startup so mis-set env is caught early.

Tool: list / create / update / delete on any calendar (default
'primary'). Access tokens are cached until expiry and refreshed on
demand from the long-lived refresh token. Invalid_grant surfaces a
clear "re-run device flow" error.
2026-09-06 20:51:00 +00:00
EugeneTes
dacebf9329 Revert MCP-passthrough patch to pi-claude-code-provider
The provider validates on every session init that Claude launched with
exactly its 10 mcp__pi__* proposal tools. Removing --tools "" and
--setting-sources "" made Claude Code load its built-ins plus every
extension/skill/managed-MCP tool on the user's account, which trips
the "unexpected tool set" isolation check and refuses the session.

Bump the install marker to .installed.v2 and rm -rf the package dir
before install so bind-mounted volumes carrying the previously-patched
copy get a clean reinstall. Google Calendar access via MCP through
this provider is not viable — the provider is adversarially designed
against exactly this. Implement calendar as a native Pi custom tool
if we want it in the bot.
2026-09-06 20:22:18 +00:00