Commit Graph

155 Commits

Author SHA1 Message Date
EugeneTes
af714cc50b feat(telegram): trigger options and Jev client for OpenRouter systemone 2026-10-05 16:15:06 +00:00
EugeneTes
7520ff56a2 docs(spec): Telegram groups and Jev topic triggers 2026-10-05 15:42:19 +00:00
EugeneTes
92a0061fdd feat(telegram): ADMIN_USER_ID may /impersonate another user
While on, the admin's updates are routed as the target user's (allow-list,
chat, workspace, session, settings, jobs) and the target chat's output goes
to the admin's chat. The target's own updates are dropped with a notice that
an admin is working with their account. In memory; /impersonate 0 stops.
2026-10-05 07:24:07 +00:00
EugeneTes
64ea6f7fa1 feat(telegram): retry transient speech-to-text failures up to 3 attempts 2026-10-05 07:02:23 +00:00
EugeneTes
094d518827 fix(claude-code): disable built-in plugins and learn new ones from init
Claude Code 2.1.287 loads cc-plugin-* built-ins regardless of --setting-sources,
which tripped the fail-closed init check. Disable every known built-in in
--settings, and when init lists only built-ins that slipped through, disable them
process-wide and replay the request once. Other plugins still fail closed.
2026-10-02 10:08:23 +00:00
EugeneTes
39e7849039 fix(telegram): cut the voice transcript echo to 1024 characters 2026-10-02 09:51:57 +00:00
EugeneTes
3a57b81d88 feat(docker): trust every git repository through GIT_CONFIG_* in compose 2026-10-02 09:21:24 +00:00
EugeneTes
0cb791d529 fix(telegram): break the DI cycle through CalendarScriptEnvironment
ChatRegistry -> JobScheduler -> IScriptEnvironment -> ChatRegistry made the host
fail at startup. CalendarScriptEnvironment now takes TelegramOptions and computes
the workspace with the new static ChatRegistry.WorkspaceFor(options, chatId).
2026-10-02 08:45:48 +00:00
EugeneTes
d2fd7ffa02 feat(google-calendar): encrypt chat tokens and give watchers a short-lived access token
token.json is sealed with AES-256-GCM (key derived from the OAuth client secret,
bound to the chat), so the agent's processes can read the file but not the
refresh token. Plain files, including VolcanicSecretary's refresh_token format,
are rewritten sealed on first read.

The scheduler gains IScriptEnvironment: extra per-run variables set after the
process environment filter and redacted from the run's output. The Telegram
host uses it to pass GOOGLE_ACCESS_TOKEN, refreshed to cover the job's timeout;
the refresh token and client secret never reach the script.
2026-10-02 08:31:24 +00:00
EugeneTes
28bbfbc759 feat(scheduler): store jobs per chat and import VolcanicSecretary job files
Each chat's jobs live in <workspace>/.volcanic/scheduler/jobs.json. On start the
scheduler loads every chat's file, moves the retired shared
<agentDir>/scheduler/jobs.json into them and renames it .migrated-<ts>.
A VolcanicSecretary jobs.json (bare array) in a chat's folder is converted
in place for that chat; the original is kept as .secretary-<ts>.

Also adds the VolcanicSecretary data migration plan.
2026-10-02 07:29:48 +00:00
EugeneTes
28c6f90d91 feat(docker): bind the data volumes to /media/disk1/containers/volcanic_secretary_core
The entrypoint chowns the three mount roots before dropping to app, since
Docker creates missing bind directories as root.
2026-09-29 09:40:28 +00:00
EugeneTes
8014a0e770 refactor(scheduler): drop the reminder job kind
Jobs are prompts or watchers. A reminder is a prompt the agent passes on, so
it lands in the transcript. Stored reminder jobs load as prompts
("Remind me: <text>"). Also records the Coolify deploy target in CLAUDE.md.
2026-09-29 09:30:40 +00:00
EugeneTes
c3a0cf234c feat(google-calendar): store each chat's token in its workspace
Tokens now live in <cwd>/.volcanic/google-calendar/token.json, as in the
VolcanicSecretary reference, instead of <agentDir>/google-calendar/<chat
key>/. GoogleCalendarOptions.TokenDirectory, when set, keeps the old
per-chat layout under that root. Spec, docs and CLAUDE.md updated.
2026-09-28 20:42:58 +02:00
EugeneTes
809261b29e Merge branch 'feat/docker-deployment' 2026-09-27 12:38:54 +02:00
EugeneTes
7bb41f0b5b fix(docker): address review findings
Entrypoint drops the capability bounding set and sets no_new_privs. Security docs
and spec no longer claim the agent can't reach the secrets; docker exec fallbacks
use a clean environment. PLAYWRIGHT_ENABLED drops the nested compose default.
Tests pin the Dockerfile's Playwright install step and the compose model fallback.
2026-09-27 12:34:58 +02:00
EugeneTes
b9a95a57c8 docs(docker): mark the deployment spec implemented
Status implemented, verification intro rewritten, and a verification record of the final checks (dotnet build/test, both image variants, offline probes of uid, /proc environ and the diagnostics socket, playwright-mcp --version offline, headless Chromium as app, docker compose config, compose start with a fake token -> 401 -> exit 1). Open question 2 (Playwright compose default) marked resolved.
2026-09-27 12:22:06 +02:00
EugeneTes
92c881377b docs(docker): link the container setup from the README, bot and MCP docs 2026-09-27 12:17:41 +02:00
EugeneTes
f0c511f953 docs(docker): Docker and Coolify deployment guide
Image contents, build arguments, the environment table with what the agent's processes can't see, volumes, Coolify steps, first Claude login, updating (the npm layer is cached: build without cache or pin CLAUDE_CODE_VERSION), extensions, troubleshooting and security.
2026-09-27 12:15:45 +02:00
EugeneTes
2461dfebce feat(docker): compose file and .env.example for Coolify
One bot service with init: true, 1 GB /dev/shm, three named volumes and every setting as an environment variable; PLAYWRIGHT_ENABLED follows INSTALL_PLAYWRIGHT. .env is git-ignored.
2026-09-27 12:12:49 +02:00
EugeneTes
9a9e55f783 feat(docker): optional Playwright MCP and Chromium in the image
INSTALL_PLAYWRIGHT=true installs @playwright/mcp@0.0.82 globally and runs its own playwright dependency's installer (install --with-deps chromium) into /opt/ms-playwright, readable by all users. The build fails if playwright-mcp --version does not run.
2026-09-27 12:09:52 +02:00
EugeneTes
4ed3758f9c feat(docker): Dockerfile for the Telegram host
Two-stage build, agent tools, Node 24, claude CLI, data dirs owned by app, DOTNET_EnableDiagnostics=0. Adds the MCP spec's deferred test that the Dockerfile's PLAYWRIGHT_MCP_VERSION equals PlaywrightPreset.DefaultPackage.

Spec change: the image keeps root as its user and the entrypoint drops to app with setpriv. With USER app, compose's docker-init (PID 1) runs as app and its /proc/1/environ exposes every secret to the agent's bash. The spec also lists the csprojs the restore layer copies (GoogleCalendar, Mcp, Scheduler included) and sets HOME=/home/app in the image.
2026-09-27 12:04:42 +02:00
EugeneTes
80358784ac docs(plan): docker-deployment implementation plan 2026-09-27 11:58:42 +02:00
EugeneTes
1353717ca0 test(telegram): relogin test deactivates host tools such as set_timezone
The fake claude never starts the proposal bridge, so the test needs a
session with no active tools. Since the scheduler spec every chat
registers set_timezone, which made the provider wait for the bridge and
fail with mcp_startup on Linux (the test returns early on Windows).
2026-09-27 11:07:56 +02:00
EugeneTes
7879969c5f Merge branch 'feat/scheduler' 2026-09-27 11:00:31 +02:00
EugeneTes
fd6b9027b6 fix(scheduler): address review findings
- JobScheduler: a stored job whose zone lookup throws no longer fails StartAsync; timer re-armed under the lock;
  a delivery cut off by shutdown isn't recorded (one-offs fire again after restart); CancelJobAsync in one step
- Schedules.ParseAt: ISO 8601 with a date only (no machine-clock date for a bare 09:00)
- core: a FollowUp prompt that loses the race to a starting run joins it as a follow-up, not steering
- Telegram: TimeZoneFor tolerates non-numeric targets; RunPromptAsync waits only when queued; one agent dir
- ScriptRunner: bad workspace paths are Failed, not exceptions; zone id helpers share TimeZoneIds.ToIana's rule
- tests: no wall-clock sleeps in scheduler tests; transcript-entry, disabled-scheduler and failing-prompt coverage
- docs: spec notes for the above; README row for the scheduler
2026-09-27 10:56:45 +02:00
EugeneTes
126d3afff1 docs(scheduler): scheduling, per-chat time zones and the session zone 2026-09-27 10:40:43 +02:00
EugeneTes
709b2d2513 test(telegram): scheduled prompts, watcher matches, restart and zone changes end to end 2026-09-27 10:36:27 +02:00
EugeneTes
8dd874a83f feat(telegram): scheduler delivery, hosted service, /jobs and /cancel
Spec: /jobs and /cancel explain when scheduling is off; Scheduler options validation.
2026-09-27 10:33:38 +02:00
EugeneTes
5b780fac36 feat(telegram): per-chat time zones with /timezone, set_timezone and Telegram:DefaultTimeZone
ChatSettingsStore keeps each chat's IANA zone in <AgentDir>/telegram/chat-settings.json;
ChatTimeZoneService is the one path for a change (store, live session, scheduler re-evaluation,
reply text). ChatRegistry.TimeZoneFor now reads the store and new sessions start in the chat's zone.
/timezone, the set_timezone tool (ChatSettingsExtension), /status zone line, DEFAULT_TIMEZONE.

The store updates its cache under the write gate so the last file written is the newest state.
2026-09-27 10:29:29 +02:00
EugeneTes
a0d886eef3 feat(scheduler): schedule tool and per-session SchedulerExtension 2026-09-27 10:23:10 +02:00
EugeneTes
4bf99dc57c feat(scheduler): JobScheduler on TimeProvider with watcher, reminder and prompt firing
Spec: a skipped one-off fires after the next start; the late note's placement and no-exit-code failure wording are pinned down; IsDeliverable is part of the watcher invariant and must not create a session; saves snapshot inside a serialising gate.
2026-09-27 10:20:22 +02:00
EugeneTes
51bc0cedf1 feat(scheduler): ScriptRunner through the process spawn policy
Spec: on Windows the command goes through Arguments like the bash tool, since cmd.exe doesn't parse ArgumentList quoting; the workspace is created if missing, and a timeout vs cancellation outcome is spelled out.
2026-09-27 10:14:33 +02:00
EugeneTes
1cc60267f9 feat(scheduler): atomic JSON job store
jobs.json is { "version": 1, "jobs": [...] } in VolcanicJson camelCase,
written to jobs.json.<pid>.tmp and moved into place through one semaphore.
A corrupt file is renamed jobs.json.corrupt-<timestamp> and loading starts
empty. Each entry is deserialised on its own, so an entry with an unknown
kind or a missing required field is dropped with a warning like any other
invalid job instead of setting the whole file aside.
2026-09-27 10:10:33 +02:00
EugeneTes
8b642885f0 test(claude-code): guard SetUnixFileMode in the TZ test (CA1416) 2026-09-27 10:10:33 +02:00
EugeneTes
d699593458 feat(scheduler): extension project, job model, cron and at parsing, validation 2026-09-27 10:07:28 +02:00
EugeneTes
96a6a5518b feat(claude-code): pass the session time zone to claude -p as TZ 2026-09-27 10:03:25 +02:00
EugeneTes
64e67b00d7 feat(core): session SetTimeZone and the date and zone in the system prompt 2026-09-27 09:58:26 +02:00
EugeneTes
da60ddb536 docs(plan): scheduler implementation plan 2026-09-27 09:54:10 +02:00
EugeneTes
b49b3eea00 Merge branch 'feat/telegram-attachments' 2026-09-26 22:37:40 +02:00
EugeneTes
6ab98a8155 fix(telegram): address review findings
- A speech or download timeout (TaskCanceledException nobody asked for) is a failure
  with the user notice, not a silent shutdown; OpenAiSpeechToText maps it to
  "the request timed out."; UpdateRouter only treats the caller's cancellation as shutdown.
- send: WorkspacePaths resolves the real path component by component (realpath),
  closing the directory-link-inside-target bypass; `.` reports a directory.
- Image documents are attached inline only when their magic bytes are JPEG/PNG/GIF/WebP,
  under the detected type.
- Audio goes to STT as an ASCII audio.<ext> name.
- MCP Browser section mentions send only when it is active.
- RunInOrderAsync takes a cancellation token; queued work is skipped once disposal gives up;
  SendReplyAsync stays private behind ReplyInOrderAsync.
- Speech HttpClient handler recycles pooled connections; BuiltInTools.Send();
  IExtensionHost.Channel is abstract; WorkspacePaths in its own file.
- Tests: timeouts, symlink chains (Linux), sniffing, channel delivery failures,
  queued-work cancellation, gated voice ordering. Spec and docs updated.
2026-09-26 22:35:20 +02:00
EugeneTes
c5ecd017a0 docs(telegram): attachments, voice, send and IChatChannel
telegram-bot.md: what you can send, files from the agent, speech settings, security notes. ui-integration.md: document/voice input rows and a new section 5 on IChatChannel. architecture, extensions and CLAUDE.md list IChatChannel. Drop the interim paragraph from the message-context spec; mark the attachments spec implemented with resolved questions.
2026-09-26 22:16:29 +02:00
EugeneTes
f90731baf0 feat(telegram): transcribe voice notes and audio with an echo
Content step 3 (InboundMedia.AddSpeechAsync): voice and audio go through ISpeechToText, the transcript is echoed as '🎤 …' and prompted as '[Voice message] …'. Spec §4 edited: audio is transcribed from the file step 2 saved (one download); an oversize or undownloadable voice note sends its notice and isn't prompted.
2026-09-26 22:13:10 +02:00
EugeneTes
a0cd2975b8 feat(telegram): save documents, videos and audio to the chat inbox
Content step 2 (InboundMedia.AddFilesAsync, InboxFiles): files land in <cwd>/inbox/<date>-<safe name>[-N], image documents within Telegram:InlineImageMaxBytes are attached inline, oversize files and failed downloads get a notice and no run. Documents, videos, audio and voice are accepted; the unsupported reply is now 'I can read text, photos, files and voice messages.'

Spec: Updates helpers are named DocumentMessage/VideoMessage/VoiceMessage/AudioMessage; the getFile 'file is too big' notice reads 'over 20 MB'; the too-large inline note is a parenthesised suffix after the size; size formats spelled out.
2026-09-26 22:09:16 +02:00
EugeneTes
8758f4b3d1 feat(telegram): OpenAI speech to text service and speech options
Spec 5: the HttpClient registration is named as AddHttpClient<ISpeechToText, OpenAiSpeechToText>() (package Microsoft.Extensions.Http), which is how Program.cs registers it.
2026-09-26 22:04:27 +02:00
EugeneTes
ee3049e47a feat(telegram): TelegramChatChannel delivers send files and scheduler texts in order
Add TelegramLimits, TelegramChatChannel (every delivery through
ChatRenderer.RunInOrderAsync, auto photo falls back to a document on a 400)
and wire it into ChatRegistry as AgentSessionOptions.Channel and
ChatContext.Channel. Spec: SendTextAsync names its failure text
("Telegram did not accept the message.") and throws when any chunk fails.
2026-09-26 22:00:16 +02:00
EugeneTes
1eed03e851 feat(telegram): ordered renderer work items and file uploads 2026-09-26 21:56:05 +02:00
EugeneTes
b22d0d159e feat(core): register send for sessions with a chat channel 2026-09-26 21:52:22 +02:00
EugeneTes
7dce84ddc5 feat(core): send tool delivers workspace files through IChatChannel
SendTool (Tool<SendArgs>, sequential) confines the path to the workspace including symlinked files and parent directories (WorkspacePaths), checks caption, photo and document limits before sending, and picks Document for non-photo extensions (.gif included) or oversized images under kind auto. Not registered yet; that is the next task.
2026-09-26 21:49:02 +02:00
EugeneTes
f2d6b7e5dc feat(core): IChatChannel contract and AgentSessionOptions.Channel
Adds the host-agnostic IChatChannel contract (ChatFile, ChatDelivery, ChatChannelLimits, ChatDeliveryException) to Abstractions/Ui, AgentSessionOptions.Channel, AgentSession.Channel and IExtensionContext.Channel. IExtensionHost.Channel is an internal plumbing default member that ExtensionContext forwards. Test support: FakeChatChannel and the TestHost builder's Channel.
2026-09-26 21:45:57 +02:00
EugeneTes
a21f3be733 docs(plan): telegram-attachments implementation plan 2026-09-26 21:43:04 +02:00