Commit Graph

39 Commits

Author SHA1 Message Date
EugeneTes
59b11eda14 Add Windows launcher script and Telegram setup guide
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 18:30:13 +02:00
EugeneTes
bf35eee736 Log crash stacks, warmer /start, correct command detection, and stricter fallbacks (Group D)
- main.ts: unhandledRejection/uncaughtException also print the stack (or
  message) via console.error so it is not lost when the logger only prints a
  single line; bot.start(...) is no longer fire-and-forget -- a polling
  failure is logged and exits the process instead of failing silently.
- bridge.ts: /start now greets before showing the same status block as
  /status (split back into two command handlers). Command detection now
  checks for a bot_command entity at offset 0 instead of a leading "/", so a
  message that merely starts with a slash (e.g. a path) reaches the agent
  instead of getting "Unknown command.". An unsupported media message with
  no text and no other notes (sticker, location, video note, ...) now gets
  an explicit "I can handle text, photos, voice notes, and files." reply
  instead of silently doing nothing.
- outbound.ts sendMarkdown: only falls back to plain text for Telegram's
  400 "can't parse entities" style errors; any other error (network, etc.)
  propagates instead of being masked as a silent plain-text resend.
- runner.ts resolveShell: added the per-user Git for Windows bash.exe under
  %LOCALAPPDATA% as a third candidate; README's Windows section now
  mentions SECRETARY_SHELL for that case.
- docker-compose.yml: added init: true, since Node does not reap zombies
  left by killed script process groups.

Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 18:09:21 +02:00
EugeneTes
9cf6f7385e Cap captured script output, scrub the bot token, and speed up scheduler tests (Group C)
- runner.ts: cap captured stdout/stderr at 64 KiB per stream via a new
  Capture helper, keeping the first 48 KiB and last 16 KiB once a stream
  exceeds the cap, joined by "\n...(truncated)...\n". Prevents a runaway
  watcher script from ballooning memory or a Telegram message.
- runner.ts runScript: delete TELEGRAM_BOT_TOKEN from the child environment
  before spawning, since model-written scripts must never be able to read
  and exfiltrate it. Spec section 6.2 updated to describe the exclusion.
- scheduler.test.ts: the "drain() gives up after its timeout" test no longer
  calls s.stop() at the end -- no timer is armed after the at job fires, and
  its delivery never resolves, so stop()'s 10s grace period would run out
  for nothing. Full suite now runs in ~1.5s.
- runner.test.ts: relax the timeout-kill elapsed-time assertion from 3000ms
  to 4000ms to reduce flakiness, per the review.

Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 18:07:12 +02:00
EugeneTes
efacd2b791 Check provider auth at startup and add current time to the prompt (Group B)
- pi-backend.ts start(): after confirming a model resolved, also confirm the
  provider has usable credentials via ModelRuntime.hasConfiguredAuth /
  checkAuth, so a missing-auth failure surfaces as a clear startup error
  instead of the first prompt failing later. checkAuth resolves to an
  AuthCheck object or undefined (not a boolean), so the existing
  `!(await mr.checkAuth(provider))` truthiness check already does the right
  thing with no further adaptation.
- The inline extension's before_agent_start handler now also appends the
  current date/time in the configured timezone, so the model knows "now"
  without a tool call. Extracted as system-prompt.ts's currentTimeLine(),
  unit tested with a fixed date.

Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 18:06:56 +02:00
EugeneTes
d2a0ec2cf1 Join every turn-final answer instead of only the last (Group A)
Pi drains queued follow-ups and steers inside the same run with no
agent_end/agent_start between them, so when a scheduled job's follow-up (or
a user steer) merges into a run, the model can answer twice before
agent_settled fires once. AgentHost.settle() used only the last assistant
message as finalText, so the first answer was lost (it only ever appeared
as progress-message narration, which gets deleted).

RunRecord now tracks `finals`: assistant texts whose stopReason is not
toolUse (and, as before, not error/aborted), collected alongside `texts`.
settle() joins `finals` with blank lines, falling back to `texts` and then
to the placeholder, matching the documented fallback chain.

Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 18:06:46 +02:00
EugeneTes
d8561748a7 Add README, Docker packaging, and workspace templates
Docker build verified locally (docker build -t volcanic-secretary .
succeeded on this machine). Step 6's manual end-to-end checklist
against a real Telegram bot was not run in this environment (no bot
token or owner id available); the checklist is kept in the README's
Tests section for the owner to run before relying on this in
production.

Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:43:58 +02:00
EugeneTes
f2fa755caa Bound shutdown and print single-line startup failures
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:37:51 +02:00
EugeneTes
6995685419 Wire daemon startup, shutdown, and polling
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:31:11 +02:00
EugeneTes
2aa3ef56f0 Add Telegram bridge with owner guard, commands, and event rendering
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:22:25 +02:00
EugeneTes
fcd07f418a Add Telegram outbound with progress message and HTML fallback
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:11:55 +02:00
EugeneTes
e0add6578e Make inbox saves race-safe and cap file name length
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:08:26 +02:00
EugeneTes
e91e0f24c5 Add Telegram inbound normalization for text, photos, voice, documents
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 17:01:08 +02:00
EugeneTes
52785df229 Add Pi backend, secretary system prompt, and workspace templates
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:54:56 +02:00
EugeneTes
4b7348a704 Settle in-flight run when the session is replaced or disposed
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:46:46 +02:00
EugeneTes
1e5b1b6f3e Add AgentHost with run event mapping
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:38:22 +02:00
EugeneTes
7e7fd473a5 Truncate tool summaries by code point
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:34:35 +02:00
EugeneTes
f1474e50c9 Add agent host event types and tool call summaries
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:29:37 +02:00
EugeneTes
887742282c Wrap transcription response parsing in a readable error
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:26:57 +02:00
EugeneTes
f7dc672e3c Add OpenAI transcription client
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:22:54 +02:00
EugeneTes
793c40e39f Reject timeoutSec on text jobs and add schedule tool prompt snippet
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:19:56 +02:00
EugeneTes
99af73b685 Add schedule tool for the agent
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:14:41 +02:00
EugeneTes
060786de6d Serialize job persistence and bound scheduler drain
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 16:07:56 +02:00
EugeneTes
cf0fdbd625 Add scheduler with firing rules and failure dedupe
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:53:16 +02:00
EugeneTes
c1914a650b Make script timeout resolve promptly and kill the process tree
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:47:53 +02:00
EugeneTes
5f100a330a Add script runner with stdout condition rule
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:40:48 +02:00
EugeneTes
2b76a18267 Add scheduler job types and JSON job store
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:35:51 +02:00
EugeneTes
d45f32a9e6 Rewrite chunker split loop to guarantee termination and restore fence tests
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:29:41 +02:00
EugeneTes
cb9f2f1eb9 Remove length cap from fence detection in chunker
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:19:30 +02:00
EugeneTes
8cb30e9361 Always reopen split fences with the original opener
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 15:12:54 +02:00
EugeneTes
3b879fe1bb Fix separator stripping, fence closer length, and guards in Markdown chunker
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:58:41 +02:00
EugeneTes
7d18c6be87 Add Markdown chunking with fence reopening
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:45:27 +02:00
EugeneTes
2e03203e00 Restore NUL placeholder sentinel in Markdown converter
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:39:47 +02:00
EugeneTes
23bd63b2c6 Fix link URL formatting and fence blank-line collapse in Markdown converter
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:34:35 +02:00
EugeneTes
9affcc1c03 Add Markdown to Telegram HTML converter
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:24:58 +02:00
EugeneTes
7373c51995 Scaffold project with logger and config
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:19:31 +02:00
EugeneTes
794580ee3a Ignore SDD scratch directory
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:17:09 +02:00
EugeneTes
9c44020252 Add implementation plan and align spec with it
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 14:14:22 +02:00
EugeneTes
0aacbcc4f7 Spec self-review: single terminal event per run, reuse PI_CODING_AGENT_DIR
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 13:39:55 +02:00
EugeneTes
20b84d7fdd Add Volcanic Secretary design spec
Claude-Session: https://claude.ai/code/session_01JtuZTCMW9TyogEmBgGf8JT
2026-09-06 13:38:46 +02:00