Commit Graph

44 Commits

Author SHA1 Message Date
Асель
f958777e11 PEP-65: archive OpenSpec change pep-65-egov-login
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:14:11 +05:00
Асель
ed49767c31 PEP-65: eGov QR login through the KazEDS relay (sign.aitu.uz)
Login page and Settings → eGov: relay session with a server-side challenge/nonce, QR + eGov Mobile
deep link, polling, one-shot completion; IIN from the signer's certificate (own DER reader),
users.egov_iin. The relay is trusted (PM decision): no own XMLDSig check. CLI peppa user egov,
mock-kazeds-relay, tests. Dev mode: /_next/static is no-store (Cloudflare cached stale chunks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:14:10 +05:00
Асель
969ad886a8 PEP-18: archive OpenSpec change pep-18-peppa-prod
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:02:16 +05:00
Асель
03aee432fb PEP-18: separate Peppa prod — release dir, PM button, DB backup, auto-rollback
- scripts/peppa-release.sh: ~/peppa/{repo.git,releases/<sha>,current,shared/.env};
  install → next build → checked DB backup → migrate → switch current → kickstart →
  health (/api/health commit + fresh heartbeats) → rollback; --queue, --check, --no-restart
- runner/platform-release.ts: deployProd for the platform project (PEPPA_PLATFORM_KEY=PEP)
  queues a request for launchd quest.telecom.peppa.release; offer after green main
- CLI: peppa db backup [file], peppa release report; backupDb verifies the copy
- install-launchd.sh: wait for unload after bootout (no "Bootstrap failed: 5"),
  release agent (QueueDirectories), PEPPA_ROOT in agents
- bin wrappers: logical root so hooks/credential.helper point at ~/peppa/current
- mock-launchctl, mock-pnpm; e2e platform-release.test.ts; OpenSpec pep-18-peppa-prod

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 17:58:34 +05:00
Асель
3a282b8054 PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres
- packages/db: schema on sqlite-core (timestamps as epoch ms → Date, JSON as text,
  booleans 0/1), one baseline migration; node:sqlite client under drizzle's
  better-sqlite3 session (busy_timeout first, WAL, BEGIN IMMEDIATE, retries on
  SQLITE_BUSY, lazy open, async transaction callbacks refused); PEPPA_DB
  (default ~/.peppa/peppa.db)
- live updates: notify() pokes the bot over a unix socket; the bot also watches
  PRAGMA data_version every second (writes by other processes)
- Postgres specifics ported: createTask transaction is synchronous, no
  `for update skip locked`, `count(*)`, json_extract instead of ->>, json_each
  instead of @>
- `peppa db migrate` and `peppa db migrate-to-sqlite <file>` (read-only
  snapshot of Postgres, FK order from the schema, row count + foreign key
  checks, file appears only when they pass); old Postgres schema kept in
  packages/cli/legacy-pg-migrations for the migration and its test
- daily VACUUM INTO backup from the watchdog (7 copies, admin alert on failure)
- tests: a temp SQLite file per test file; storage.test.ts (20 processes,
  per-project numbering across processes, socket/data_version, migration from
  Postgres incl. a dangling foreign key, backups); two test races fixed
- CI: no per-run Postgres database; PEPPA_TEST_PG only for the migration test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 17:23:24 +05:00
Асель
ae37ba90d5 PEP-57: archive OpenSpec change pep-57-ci-cd (spec delivery-pipeline)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:59:04 +05:00
Асель
5120b97a0b PEP-57: Peppa on its own pipeline — CI via project checks and peppa-check.sh; 4.2 moved to PEP-18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:59:04 +05:00
Асель
8dc82859c7 PEP-36 stage 1: run Peppa with Node 26 type stripping instead of tsx
- tsconfig: erasableSyntaxOnly + verbatimModuleSyntax; parameter properties
  rewritten (BugsinkError, GiteaError, GiteaClient, OAuthError, TelegramError,
  TelegramApi, MockGitea)
- bin wrappers (peppa, peppa-mcp, peppa-hook, peppa-bot, testkit mocks,
  peppa-dev): `node --import scripts/lib/require-node.mjs` (clear error on
  Node < 26, PEPPA_NODE overrides the binary); package scripts and tests on
  `node` / `node --test`; tsx removed
- install-launchd.sh pins PEPPA_NODE (checked absolute path) in the plists
- fix a race the faster hooks exposed: the prompt hook answered every pending
  question, including a PM question raised after Peppa itself pasted text
  into the terminal; sendToSession now logs `input_sent` and the hook only
  answers questions older than that input
- change pep-36-lightweight-stack: stage 1 done, hook start numbers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:51:22 +05:00
Асель
4c4b3a482f PEP-38: archive OpenSpec change pep-38-factory-console
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:44:58 +05:00
Асель
d3a54fc845 PEP-38: runners console — filter counters, search, limit resume time, details panel
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:40:27 +05:00
cb6832f967 Merge pull request 'PEP-36 (этап 1): замер и change — Node 26 + node:sqlite' (#23) from task/PEP-36-bench into main 2026-11-13 16:36:13 +05:00
Асель
eeb326cc4f PEP-36: PM decision — Node 26 + node:sqlite; drizzle shim and check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:28:59 +05:00
Асель
50b1d1afec PEP-36: benchmark SQLite vs Postgres and propose Bun + SQLite stack
bench/sqlite (outside the workspace): Peppa-like load with 10/20 runners,
a hook process per event, MCP, bot, web and watchdog; bun:sqlite,
node:sqlite, better-sqlite3, a single-writer service and Postgres; notify
replacements (cursor polling, fs.watch on WAL, unix-socket push); a
ceiling test; a schema port to sqlite with a data copy from Postgres and
a check of drizzle transactions.

openspec/changes/pep-36-lightweight-stack: proposal, design with the
numbers, specs (platform-storage, service-monitoring), phased tasks.
No product code changes; the move waits for the PM's decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:28:59 +05:00
Асель
c03b679a1d PEP-38: all pages on the console components, globals.css removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:21:44 +05:00
Асель
28fbde4add PEP-38: console foundation — Tailwind v4, shadcn/ui components, dark theme, three-panel layout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:21:43 +05:00
Асель
d1c555a038 PEP-22: read a zombie agent's exit code from /proc when tmux never reaps it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:00:29 +05:00
Асель
83b222b9e2 PEP-22: docs and spec reflect the real Actions workflow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:00:29 +05:00
Асель
93f38bbcba PEP-22: harden timing-sensitive e2e steps, archive change
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:00:28 +05:00
Асель
56a7756e71 PEP-22: scripts/ci.sh, PR status peppa/ci, mock-act-runner
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:00:28 +05:00
Асель
59c3b583de PEP-57: CD — deploy workflow, preview/staging/prod, health check and rollback, releases
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:49:24 +05:00
Асель
cae49d5b54 PEP-57: CI feedback — check runs, red checks back to the agent, review/merge gates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:37:10 +05:00
Асель
498013472f PEP-58: Bugsink — production errors become Peppa incidents and tasks
- infra: Bugsink 2.6.3 in docker (infra/bugsink, scripts/bugsink-up.sh), database
  bugsink in Peppa's Postgres, Traefik route bugsink.telecom.quest
- packages/bugsink: REST API client + custom-webhook payload parsing
- incidents (migration 0011): incident_settings, error_sources, incidents; ingest from
  webhook POST /api/hooks/bugsink/<secret> and a 2-minute poll in the watchdog
- incident policy per project: notify / backlog (default) / start / ask (Telegram
  buttons) / triage (claude -p with the owner's token, falls back to ask)
- daily task cap, environments, ignore pattern; manual "fixed" until PEP-57;
  REGRESSED returns the task to the backlog
- web «Ошибки» section, bot buttons, MCP tools for agents and the PM, help, RULES.md
- testkit: mock-bugsink, mock-triage, incidents.test.ts (one test per scenario,
  plus a live run against the real Bugsink with PEPPA_LIVE_BUGSINK=1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:31:32 +05:00
Асель
3ab408eb70 PEP-57: CI for factory projects — act_runner, template workflow, connect CI
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:19:11 +05:00
Асель
c24b9b83be PEP-15: where the project's repo is in Gitea — link, visibility, namespace
- New project form: namespace (personal/org) and visibility (private/public) with hints
- provisionProject creates the repo with the chosen visibility (existing repo keeps its own)
- After creation: notice with "Открыть в Gitea"; project page "Репозиторий" block:
  path, namespace kind, visibility, who can see it (read live from Gitea, cached 60 s)
- Members without repo access are marked; owner can grant access to all members
- MCP create_project takes visibility and returns repo URL + who sees it; list_projects shows URLs
- CLI --public, /help, mock-gitea (visibility, /orgs, collaborators), e2e repo-visibility

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:12:07 +05:00
4215160d3a Merge pull request 'PEP-20: мониторинг сервисов — health, heartbeat, алерты админу' (#17) from task/PEP-20 into main 2026-11-13 14:10:05 +05:00
Асель
1085474c78 PEP-20: service monitoring — health, heartbeats, alerts to platform admins
- web/bot/watchdog heartbeats in settings (heartbeat:<service>)
- watchdog checks bot+web, bot checks watchdog+web; quiet > 5 min → Telegram alert
  to platform admins via outbox (platform.admins, default allowlist), recovery message,
  hourly reminder, 15 min cooldown, deterministic dedupe; watchdog sends directly
  when the bot is down
- GET /api/health (DB, version, services; 503 without DB)
- peppa status, peppa platform admins
- OpenSpec change pep-20-monitoring (archived), e2e monitor.test.ts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:06:54 +05:00
Асель
412f5f05ce PEP-61: top menu — Home instead of Inbox, Runners and Projects pages
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:02:37 +05:00
Асель
3916ac9bc9 PEP-57, PEP-58: PM decisions recorded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:01:34 +05:00
Асель
685810eb80 PEP-56: runner continues on its own after the usage limit resets
- parseResetTime: 'resets 5pm', 'resets at 3:10 AM', 'resets in 2h 15m',
  'try again at 23:30'; nearest future time, local clock
- recordLimit (hook StopFailure and the watchdog's banner path): status
  rate_limited, resume_at = reset + 60 s, or probes 30 → 60 → 120 min when
  unknown or the limit came back right after a resume; cap 6/day;
  PEPPA_LIMIT_AUTORESUME=off; PM is told 'continues at HH:MM'
- watchdog: at resume_at nudges the live agent or relaunches it with
  resume (vanished/dead rate-limited runners wait instead of failing); the
  limit message is closed as resolved; tick(db, { now }) for tests
- mocks: limit with resetInSec / unknown reset (claude and codex)
- tests: one per spec scenario + Codex (82 e2e total, green)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:50:58 +05:00
Асель
824ba56b74 PEP-2: Telegram per user — pairing from Settings, delivery by project access
- users.telegram_* replace the single global binding; one-time /start code
  per user (web Settings → Telegram, or peppa telegram pair <login>);
  a chat belongs to one user
- agent questions go to the project's owner and members who paired; an
  answer (button or reply) is accepted only from someone with access to
  the project; messages are closed for every recipient; /status is scoped
- CLI: telegram pair|status|unpair <login>, user ensure mock-<name>;
  dev stand pairs its test PM per user
- tests: several-users journey (bob without access, then as a member);
  70 e2e total, green
- BREAKING: the old global binding is removed; users pair again in Settings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:44:30 +05:00
Асель
73966e7e99 PEP-16: only allowlisted people can log into Peppa
- platform.allowed_logins (default asel, 7601978, dana): allowlisted logins,
  project invitees and members, and local CLI accounts may log in
- enforced in the Gitea OAuth callback, on every web request (removal takes
  effect at once) and on every remote MCP request (401)
- CLI: peppa platform allowlist | allow <login> | deny <login>
- tests: one per spec scenario (69 e2e total, green)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:38:08 +05:00
Асель
ead62e2c5f PEP-59: version and commit in the web footer; plans for PEP-60, PEP-61
- root package.json carries the Peppa version (0.15.0); next.config.ts
  stamps version, short/full commit, commit date and a dirty flag at build
- Footer on every app page and on the login page, commit linked to Gitea
- OpenSpec: pep-59 archived (web-workspace); new planned changes
  pep-60-platform-channel-digest (Telegram channel of the platform,
  releases/restarts/digests, superadmin settings) and pep-61-top-menu
  (Home instead of Inbox, Runners and Projects pages)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:24:08 +05:00
Асель
67f13848d3 Plans for PEP-56 (limit auto-resume), PEP-57 (CI/CD), PEP-58 (Bugsink) and handoff notes
OpenSpec changes with proposals, designs, Gherkin specs and task lists,
ready for apply; docs/HANDOFF.md with the current state and agreed order.
Planning only — no code changes.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-12 23:05:45 +05:00
Асель
1fefaa2e83 PEP-51: Gherkin scenarios in specs — shared rules and OpenSpec config
- template/RULES.md: scenarios as GIVEN / WHEN / THEN / AND steps with an
  example, Scenario Outline, one WHEN, concrete values; loaded into every
  agent session of every project
- rules.specs in the template's and Peppa's openspec/config.yaml (quoted:
  an unquoted ': ' made OpenSpec ignore the rules)
- verified: openspec validate accepts GIVEN/AND and Scenario Outline, and
  the rules reach 'openspec instructions specs'

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-12 22:54:27 +05:00
Асель
56b6224587 PEP-12: share projects with other users
- project_members / project_invites; owner adds people by Gitea login,
  invitations are applied at first login; members get the owner's access
  except member management; a member can leave
- access everywhere via projectForUser / userProjectIds (owner or member):
  web inbox, sessions, project pages, MCP
- shareProject / unshareProject: login checked in Gitea, repo collaborator
  (write) added by the owner's client or peppa-bot; missing admin rights
  don't block membership (repoAccess flag)
- web: Members block on the project page, 'shared' badge; MCP:
  list_members, add_member, remove_member; Help updated
- tests: 5 sharing journeys on mock-gitea (64 e2e total, green); test DB
  now also clears users and OAuth clients between files
- OpenSpec: pep-12 archived (project-sharing, web-auth)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-12 22:35:56 +05:00
Асель
cf43669ce8 PEP-14: full PM toolkit over MCP and a Help page
- MCP: create_goal, update_goal (title, description, open/done/archived),
  create_project (same provisioning as the web, as the user), update_task
  goal_id (move between goals / detach); server instructions explain the
  project → goals → tasks → board model and good habits
- web: /help — concepts, connecting ChatGPT/Codex/other MCP clients,
  scenarios with example phrases, tool reference; links in menu/settings
- PEPPA_TEMPLATE_URL override for provisioning (tests)
- 3 new tests (59 e2e total, green); prod tools/list and /help verified
- OpenSpec: pep-14 archived (remote-mcp, web-workspace)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:24:05 +05:00
Асель
3f55248150 PEP-13: connect Claude from the web for remote users
- Settings → Claude: Peppa runs 'claude setup-token' in tmux, shows the
  claude.com sign-in link, the user pastes the code into the form; the
  1-year token is stored encrypted on the user (users.claude_token_enc)
- Claude sessions of the owner's projects get CLAUDE_CODE_OAUTH_TOKEN;
  projects without an owner token keep using the machine login
- disconnect / reconnect; setup times out after 10 min and its tmux
  session (and scrollback with the token) is killed right after saving
- mock-claude setup-token; 2 new tests (56 e2e total, green)
- verified on prod: the button yields the real claude.com authorize URL
- OpenSpec: pep-13 archived into spec agent-credentials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:06:37 +05:00
Асель
4e20f76767 PEP-11: update_task in the remote MCP
- edit a task's title and/or description by key through the owner-scoped
  manager tools; goal, status and other fields kept, no agent started;
  uses core updateTask (event log, NOTIFY) and returns the updated card
- test: title only, description only, both; goal/status/sessions intact;
  empty call and another user's task refused (54 e2e total, green)
- verified on prod: tools/list over HTTPS includes update_task
- OpenSpec: pep-11 archived into spec remote-mcp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:52:46 +05:00
Асель
39367b1d82 PEP-8: remote MCP for ChatGPT with Peppa as OAuth 2.1 server
- OAuth: RFC 8414/9728 metadata, RFC 7591 dynamic registration,
  authorization code + PKCE S256 with a consent screen after Gitea login,
  refresh token rotation; tokens and codes stored hashed; revoke in web
- /mcp: stateless Streamable HTTP, Bearer → user; PM tools from
  @peppa/mcp/manager: projects, goals, tasks, create, move (board
  semantics, starts agents), inbox, answer/accept — owner-scoped
- login keeps ?next= through Gitea OAuth; Settings page with MCP URL and
  connected apps
- 5 new tests (53 e2e total, green); verified on prod as a client:
  DCR → consent → token → MCP over HTTPS → revoke → 401
- OpenSpec: pep-8 archived into spec remote-mcp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:38:09 +05:00
Асель
00c8f79a36 PEP-7: autonomous mode — board moves start agents, PM only for stoppers
- web board (Backlog / In progress / Review / Done) with drag-and-drop and
  buttons; moveTask starts an agent on In progress, stops on Backlog/Done
- routine proposals go straight to apply; request_approval/ask_pm only for
  architectural stoppers (RULES.md, MCP hints, template pushed to Gitea)
- Stop hook keeps the agent going (decision: block, max 2 in a row,
  sessions.auto_nudges reset by a human answer) instead of pinging the PM
- review: ready-for-review message with Accept (acceptTask → done, session
  stopped) in Telegram and web; a text reply goes back to the agent
- mock-claude honours Stop-hook block; 6 new e2e tests (48 total, green)
- OpenSpec: pep-7 archived (task-autonomy, web-workspace board)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:21:11 +05:00
Асель
112c08b063 PEP-6: dev stand with mock Telegram so agents can play the PM
- mock-telegram as a standalone server with /_mock/* inspection and PM
  actions (messages, send, click, callbacks)
- peppa-dev up|down|status|peppa|tg: isolated DB peppa_dev, tmux -L
  peppa-dev, ~/.peppa-dev, the real bot against mock-telegram, mock agents;
  test PM paired automatically via /start
- verified: question from a mock session answered with a button on the
  stand, delivered to the session; prod sessions/tmux/Telegram untouched
- OpenSpec: pep-6 archived into spec dev-sandbox

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 21:10:37 +05:00
Асель
2b0f2fd984 PEP-1: web platform with Gitea login, projects, goals, tasks, sessions
- web: Gitea OAuth2 login, signed session cookie, everything behind login;
  inbox with answers, project board (goals → tasks), task page with
  OpenSpec artifacts, questions and session controls; new project form;
  auto-refresh, light/dark, mobile
- users + projects.owner_id; tokens AES-256-GCM encrypted; owner-only access
- provisionProject (runner): new or existing Gitea repo, peppa-bot
  collaborator, template + openspec init, push, rollback; used by web and
  peppa project create (replaces scripts/bootstrap-project.sh)
- peppa web login-link, peppa project owner; Gitea OAuth app script
- bins/template resolved via PEPPA_ROOT (works inside the Next build)
- testkit: mock-gitea + 10 tests (42 e2e total, all green)
- OpenSpec: pep-1-web-platform archived into specs web-auth,
  project-provisioning, web-workspace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 20:55:02 +05:00
Асель
f53b3447cf PEP: manage Peppa through Peppa; OpenSpec change for PEP-1
- Peppa registered as project PEP (.peppa/project.json, .mcp.json)
- goals #2/#3 and tasks PEP-1..PEP-5 created in Peppa
- openspec/changes/pep-1-web-platform: proposal, specs (web-auth,
  project-provisioning, web-workspace), design, tasks — awaiting PM approval
- packages/mcp/scripts/call.ts: call a peppa MCP tool from the shell

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 20:40:09 +05:00
Асель
4168e8c867 Bootstrap Peppa monorepo, DB schema, OpenSpec and project template
- pnpm workspace: apps/web (Next.js), apps/bot, packages/{db,shared,mcp,runner}
- Drizzle schema: projects, goals, tasks, sessions, questions, events
- Postgres via infra/docker-compose.yml
- template/: AGENTS.md workflow on OpenSpec, Claude hooks, peppa MCP config
- scripts to push template and bootstrap projects in Gitea

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 19:13:16 +05:00