diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 36b5564..1820040 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -6,6 +6,6 @@ contact_links: - name: User support url: mailto:support@sentrabot.com about: Questions about using Sentra Bot or self-hosting help. - - name: Maintainer - url: mailto:elie@sentrabot.com - about: Reach the maintainer directly. + - name: Sentra Artificial Intelligence + url: https://sentrahai.com + about: Programme site, privacy, and terms. diff --git a/AGENTS.md b/AGENTS.md index 63e2c44..a59cd84 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,6 +4,7 @@ - Sentra Bot is one product across web, Electron desktop, and Expo mobile; Electron hosts the web UI. Put shared behavior, contracts, API logic, and reusable UI in packages. Keep only genuinely native navigation, storage, permissions, and interactions platform-specific. Core workflows must cover every applicable surface or degrade safely for an explicit reason. - No hosted vendor is required to run the core product. Keep LLMs, sandboxes, memory, voice, integrations, and future external services optional and behind provider-neutral interfaces. Vendor SDKs, configuration, and translation belong only in adapters and composition roots. New providers must reuse shared contracts and deterministic offline conformance tests. - Keep UI and copy minimal. Show advanced capability progressively and only when it becomes relevant; do not add explainer text that repeats the interface. Frontends express intent and render state; the backend owns orchestration, authorization, validation, retries, recovery, and provider translation. Give controls concise accessible names when needed. +- Product requirements live in `docs/requirements/` (ISO/IEC/IEEE 29148). Runtime topology lives in `docs/architecture.md`. Do not restate either in plans. - Keep code simple: reuse existing primitives and one source of truth, remove duplication and unused flexibility, and avoid speculative abstractions. Add an interface when it protects a real external or platform boundary, not for its own sake. - Treat auth, secret handling, sandbox boundaries, host commands, and integrations as security-sensitive. Keep tests deterministic and offline by default. - After creating a pull request, stay with it until CI and automated review bots have finished. Poll checks, reviews, review threads, and PR comments at roughly 60-second intervals; passing checks alone do not mean the review is complete. Address every actionable issue, push the fixes, and repeat the review cycle until no actionable feedback remains. Do not merge while review bots are still pending or review issues remain unresolved. diff --git a/CHANGELOG.md b/CHANGELOG.md index d911ad3..2e3d9e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Changed -- Model picker includes Grok 4.6 (xAI) and Ox Alpha Free / GLM-5.3 (OpenCode Go). +- Documentation: ISO/IEC/IEEE 29148 requirements package under `docs/requirements/`; README, architecture, and contributor files aligned to `@sentrabot/*` and the as-built surfaces. ### Added diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..005f301 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,67 @@ +# Contributor Covenant Code of Conduct + +## Our pledge + +We as members, contributors, and leaders pledge to make participation in the Sentra Bot community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, colour, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our standards + +Examples of behaviour that contributes to a positive environment: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Taking responsibility and apologising to those affected by our mistakes +- Focusing on what is best for the community + +Examples of unacceptable behaviour: + +- The use of sexualised language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others’ private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement responsibilities + +Community leaders are responsible for clarifying and enforcing our standards and will take appropriate and fair corrective action in response to any behaviour they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all community spaces for this project, and also applies when an individual is officially representing the project in public spaces. + +## Enforcement + +Report incidents to **support@sentrabot.com**. Vulnerability reports go to **security@sentrabot.com** and must follow [SECURITY.md](SECURITY.md) — do not use public issues. + +All complaints will be reviewed and investigated promptly and fairly. Community leaders are obligated to respect the privacy and security of the reporter. + +## Enforcement guidelines + +Community leaders will follow these Community Impact Guidelines: + +### 1. Correction + +**Community impact:** Use of inappropriate language or other behaviour deemed unprofessional. +**Consequence:** A private, written warning, providing clarity around the nature of the violation and an explanation of why the behaviour was inappropriate. + +### 2. Warning + +**Community impact:** A violation through a single incident or series of actions. +**Consequence:** A warning with consequences for continued behaviour. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. + +### 3. Temporary ban + +**Community impact:** A serious violation of community standards, including sustained inappropriate behaviour. +**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. + +### 4. Permanent ban + +**Community impact:** Demonstrating a pattern of violation, or an egregious violation of community standards. +**Consequence:** A permanent ban from any public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f41291..dfb25fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,6 +40,8 @@ CI runs `pnpm lint`, `pnpm check`, production builds (including Electron preload The product path is **Pi + Docker + Graphile**. Emulator settings (`AGENT_RUNTIME=scripted`, `SANDBOX_PROVIDER=fake`, `WAKEUP_DRIVER=memory`) are for tests only. +Engineering requirements: [docs/requirements/](docs/requirements/). Runtime topology: [docs/architecture.md](docs/architecture.md). Conduct: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). + **Integrations** can use [Composio](https://composio.dev/) or Pipedream Connect as optional managed app catalogs. Users can also install HTTPS MCP servers (including Treg) and bounded OpenAPI tool sources. Connector tests must stay deterministic and offline. Never put connector credentials in @@ -58,4 +60,5 @@ capability config, fixtures, logs, or snapshots; use the encrypted secret store | --- | --- | | [security@sentrabot.com](mailto:security@sentrabot.com) | Vulnerabilities only — see [SECURITY.md](SECURITY.md) | | [support@sentrabot.com](mailto:support@sentrabot.com) | User and support questions | -| [elie@sentrabot.com](mailto:elie@sentrabot.com) | Maintainer | +| [GitHub issues](https://github.com/drferdii/sentrabot/issues) | Product bugs and self-host reports (use the templates) | +| [sentrahai.com](https://sentrahai.com) | Programme and public site | diff --git a/LICENSE b/LICENSE index 1b8162d..cd749a3 100644 --- a/LICENSE +++ b/LICENSE @@ -14,4 +14,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -Copyright 2026 Rakazo contributors +Copyright 2026 PT Adianda Putri Iskandar +Portions Copyright 2026 Rakazo contributors diff --git a/NOTICE b/NOTICE index a6e4917..f88b9df 100644 --- a/NOTICE +++ b/NOTICE @@ -3,5 +3,9 @@ D:/DEV/Sentraverse/sentrabot, requested at commit d17a138. The source project includes Apache-2.0 licensed material attributed to Rakazo contributors. That attribution is retained for provenance and legal -compliance. Sentra Bot migration changes include architecture, naming, -security controls, dependency integration, and repository topology changes. +compliance. Sentra Bot changes include architecture, naming, security +controls, dependency integration, repository topology, and the requirements +baseline under docs/requirements/. + +Product identity: Sentra Bot, programme Sentra Artificial Intelligence, +legal entity PT Adianda Putri Iskandar. Package namespace: @sentrabot/*. diff --git a/README.md b/README.md index 208ba0b..91c0754 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The autonomous intelligence layer of Sentra Artificial Intelligence. **[Sentra Bot](https://sentrahai.com/)** is the operating layer for persistent, composable AI teammates you actually own — agents that can hold memory, execute routines, use computers, and work against your own models, your own data, and your own machines. -The repository is not a single chatbot and not a thin model wrapper. It contains the full runtime surface: API, web and desktop clients, background worker, job orchestration, memory, computer providers, connectors, artifacts, realtime infrastructure, and a deliberately read-only clinical reconnaissance bridge. +The repository is not a single chatbot and not a thin model wrapper. It contains the full runtime surface: API, web, desktop, and mobile clients, background worker, job orchestration, memory, computer providers, connectors, artifacts, realtime infrastructure, and a role-template catalog. Clinical write access is out of scope. The objective is precise: **make autonomous intelligence useful without making authority invisible.** @@ -233,7 +233,10 @@ flowchart TB - `apps/api` — HTTP API, auth, typed orchestration - `apps/web` — React + Vite client - `apps/desktop` — Electron shell for Sentra Bot +- `apps/mobile` — Expo client (same API contracts) - `apps/worker` — routines, wakeups, jobs, run continuation +- `apps/site` — marketing site (npm package name `cora`) +- `apps/docs` — public Mintlify documentation @@ -246,6 +249,7 @@ flowchart TB - `core` — pure domain logic - `db` — Prisma schema, migrations, repositories - `memory` — per-bot markdown memory +- `bot-templates` — 66 Chief-of-Staff role packages @@ -267,6 +271,7 @@ flowchart TB - `infra/compose` — Docker Compose topologies, Caddy, deployment assets - `infra/sandboxes` — bot computer images + supervisor +- `infra/updater` — Compose updater sidecar - `scripts` — backup / restore utilities @@ -277,16 +282,20 @@ flowchart TB REPOSITORY MAP // CANONICAL LAYOUT ```text -sentra-agent/ +sentrabot/ ├── apps/ │ ├── api/ # HTTP API + auth + orchestration (Hono, port 3100) │ ├── web/ # React + Vite client (port 5173) │ ├── desktop/ # Electron shell hosting the web client -│ └── worker/ # Background worker: routines, wakeups, jobs +│ ├── mobile/ # Expo client +│ ├── worker/ # Background worker: routines, wakeups, jobs +│ ├── site/ # Marketing site +│ └── docs/ # Public Mintlify docs ├── packages/ │ ├── adapter-kit/ # Shared ports & interfaces │ ├── adapters/ # Sandboxes, executors, realtime, connectors, secrets │ ├── auth/ # Better Auth wiring +│ ├── bot-templates/# Role catalog (66 packages) │ ├── chat-ui/ # Cross-platform markdown rendering │ ├── contracts/ # Shared typed RPC / service contracts │ ├── core/ # Pure domain logic @@ -297,7 +306,9 @@ sentra-agent/ │ └── ui-web/ # Shared React UI components ├── infra/ │ ├── compose/ # Compose topologies + Dockerfile + Caddy + DEPLOY.md -│ └── sandboxes/ # Computer, desktop, supervisor images +│ ├── sandboxes/ # Computer, desktop, supervisor images +│ └── updater/ # Product-update sidecar +├── docs/ # Architecture, operator docs, requirements package └── scripts/ # backup.sh / restore.sh ``` @@ -503,7 +514,7 @@ Production uses `backup-prod.sh` with a systemd timer, seven-day rotation, and m | `OPENROUTER_API_KEY` / `PI_DEFAULT_PROVIDER` / `PI_DEFAULT_MODEL` | Model provider configuration and defaults. | | `E2B_API_KEY` / `DAYTONA_API_KEY` / `DAYTONA_API_URL` / `DAYTONA_TARGET` / `BOX_API_KEY` / `BOX_API_URL` | Computer-provider credentials. | | `COMPOSIO_API_KEY` | Optional plugins / connectors. | -| `EXPO_PUBLIC_API_URL` / `RAKAZO_WEB_URL` | Client overrides for a central origin. | +| `EXPO_PUBLIC_API_URL` / `SENTRABOT_WEB_URL` | Mobile production origin and Electron web-URL override. | | `SMTP_URL` / `VAPID_*` | Optional email and push. | | `OTEL_EXPORTER_OTLP_ENDPOINT` / `LOG_LEVEL` | Observability. | @@ -581,7 +592,7 @@ curl --fail https://app.example.com/health 3. Start `docker-compose.supabase.yml`. ```bash -pnpm --filter @rakazo/db exec prisma migrate deploy +pnpm --filter @sentrabot/db exec prisma migrate deploy docker compose --env-file .env \ -f infra/compose/docker-compose.supabase.yml \ @@ -599,7 +610,7 @@ pnpm db:generate pnpm db:migrate # production alternative -pnpm --filter @rakazo/db exec prisma migrate deploy +pnpm --filter @sentrabot/db exec prisma migrate deploy ``` --- @@ -671,11 +682,11 @@ flowchart TB ### `10 / CLINICAL BOUNDARY` > [!CAUTION] -> **The RME bridge is read-only clinical reconnaissance. It is not a clinical write path.** +> **Sentra Bot is not a hospital information system and has no clinical write path.** -The v0.1 adapter opens the RME in a headed Chromium browser, reads **one patient**, and produces structured, validated JSON. +This repository does not ship an electronic medical record (RME) adapter. Healthcare role templates in `packages/bot-templates` are operating-layer prompts and policies, not access to a patient record. -The boundary is deliberate: +The product doctrine for any future clinical integration remains: ```text MANUAL LOGIN @@ -691,12 +702,10 @@ MANUAL VERIFICATION NO WRITE ``` -- Credentials are never requested, stored, or committed. -- Login remains manual. -- The adapter does not write to the patient record. -- Scope does not expand to all patients or clinical AI until one-patient read behavior is manually verified end to end. +- Clinical credentials are never requested, stored, or committed in this baseline. +- Do not document a shipped RME bridge until the adapter exists in code and is verified end to end. -**Clinical autonomy does not begin by granting write access. It begins by proving the read path.** +**Clinical autonomy does not begin by granting write access. It begins by proving a read path — and that path is not in this repository yet.** --- @@ -752,9 +761,11 @@ Typed contracts, deterministic tests, topology checks, canaries, runtime health, The product is **Sentra Bot**. -Internal package identifiers historically retain the `@rakazo/*` namespace from the upstream codebase. This is intentional: user-facing branding changes what the product is called; compatibility-sensitive internal identifiers are not renamed without a technical reason. +Internal packages use the **`@sentrabot/*`** namespace. Historical `@rakazo/*` identifiers from the upstream codebase **do not exist** in this repository. -**License:** Apache 2.0 — see `LICENSE`. +Engineering requirements (ISO/IEC/IEEE 29148) live in [`docs/requirements/`](docs/requirements/). Runtime topology lives in [`docs/architecture.md`](docs/architecture.md). + +**License:** Apache 2.0 — see `LICENSE` and `NOTICE`. Operational contracts and security boundaries live in: diff --git a/SECURITY.md b/SECURITY.md index 3a9aad0..b6a3321 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,7 +15,8 @@ We will acknowledge your report and work on a fix. Please do not file a public i ## Other contact - General support: **support@sentrabot.com** -- Maintainer: **elie@sentrabot.com** +- Public site: **https://sentrahai.com** +- Product issues: **https://github.com/drferdii/sentrabot/issues** (not for unfixed vulnerabilities) ## Scope diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 0000000..e7c5145 --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,9 @@ +# Support + +- **Product and self-hosting questions:** [support@sentrabot.com](mailto:support@sentrabot.com) +- **Security vulnerabilities:** [security@sentrabot.com](mailto:security@sentrabot.com) — see [SECURITY.md](SECURITY.md) +- **Bugs:** [GitHub issues](https://github.com/drferdii/sentrabot/issues) using the templates +- **Programme site:** [sentrahai.com](https://sentrahai.com) + +Operator documentation: [docs/self-host.md](docs/self-host.md). +Requirements baseline: [docs/requirements/](docs/requirements/). diff --git a/apps/docs/README.md b/apps/docs/README.md index 2e45325..c7e4252 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -45,6 +45,8 @@ Isi `docs/` berikut **tidak** dimasukkan karena bersifat internal. Jangan menamb | `docs/plans/*` | Spesifikasi MVP internal | | `docs/2026-agent-best-practices-brief.md` | Brief internal | | `docs/mobile-release.md` | Proses rilis internal | +| `docs/requirements/*` | Paket persyaratan ISO/IEC/IEEE 29148 (internal) | +| `docs/architecture.md` | Topologi runtime (internal; ringkasan operator ada di halaman pasang) | `docs/product/paket-free-batas-v1.md` **tidak** disalin utuh — halaman `mulai/paket.mdx` hanya mengambil bagian yang layak publik. Target COGS internal (Rp4.000/user/bulan), catatan pajak, diff --git a/apps/docs/mulai/paket.mdx b/apps/docs/mulai/paket.mdx index 2a77cc1..982de65 100644 --- a/apps/docs/mulai/paket.mdx +++ b/apps/docs/mulai/paket.mdx @@ -23,7 +23,6 @@ Bot di atas batas **tidak dihapus** — hanya dijeda sampai paket dinaikkan kemb | Harga | Rp0 | | Bot aktif | **3** | | Managed AI | Termasuk, *fair-use* | -| Target COGS AI internal | ≤ Rp4.000 / active user / bulan | | Pencarian web | 10 / hari | | Unggah berkas | 5 / hari | | Penyimpanan aktif | 250 MB | @@ -40,6 +39,9 @@ Bot di atas batas **tidak dihapus** — hanya dijeda sampai paket dinaikkan kemb Sesi computer-agent dikunci di **3**, bukan rentang 3–5, agar kontraknya tegas. +Angka paket selengkapnya dan aturan penurunan paket ada di sumber internal +`docs/product/paket-free-batas-v1.md`. Halaman ini **tidak** memuat target biaya internal. + --- ## Saat turun dari paket berbayar ke Free diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..d26be44 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,46 @@ +# Documentation map + +This directory is the controlled documentation set for **Sentra Bot**. + +Public product copy lives in `apps/docs` (Mintlify) and `apps/site`. Implementation plans live under `docs/superpowers/` and `docs/plans/`. They are not the requirements baseline. + +## Start here + +| Audience | Read first | +| --- | --- | +| New contributor | [CONTRIBUTING.md](../CONTRIBUTING.md), then [architecture.md](architecture.md) | +| Product / programme | [requirements/README.md](requirements/README.md) | +| Operator / self-host | [self-host.md](self-host.md) | +| Security reviewer | [SECURITY.md](../SECURITY.md), [requirements/08-security-and-privacy-requirements.md](requirements/08-security-and-privacy-requirements.md) | +| Legal / policy (draft) | [legal/](legal/) | + +## Baseline (as-built) + +| Document | Role | +| --- | --- | +| [architecture.md](architecture.md) | Runtime topology and decision log. Single source of truth for *how the system is wired today*. | +| [requirements/](requirements/) | ISO/IEC/IEEE 29148 requirements package. Single source of truth for *what the product must do*. | +| [self-host.md](self-host.md) | Operator runbook for local, Compose, published images, and production. | +| [computer-runtime.md](computer-runtime.md) | Sandbox provider contract and workspace durability. | +| [performance.md](performance.md) | Desktop performance measurement. | +| [mobile-release.md](mobile-release.md) | Mobile store-release process (no production identifiers in git). | +| [product/paket-free-batas-v1.md](product/paket-free-batas-v1.md) | Locked Free-plan limits (Chief, 2026-09-01). | + +## Brand, legal, and internal plans + +| Path | Status | +| --- | --- | +| [brand/](brand/) | Brand assets and guidelines | +| [legal/](legal/) | Draft privacy, terms, and about copy — **not legal-reviewed** | +| [plans/](plans/) | Internal product strategy notes | +| [superpowers/](superpowers/) | Implementation specs and plans; some items are frozen or superseded by `architecture.md` | + +## Document language + +- Requirements, architecture, operator, and contributor documents are **English** (international project language). +- Public Indonesian user-facing copy lives in `apps/docs` and `apps/site`. +- When numbers disagree, the English requirements package and `architecture.md` win for engineering; `docs/product/paket-free-batas-v1.md` wins for commercial plan limits. + +## Verification date + +This map was reconciled against the repository on **2026-09-03**. diff --git a/docs/architecture.md b/docs/architecture.md index 44a7536..ca4309c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,8 +1,9 @@ # Sentra Bot runtime architecture This document describes what the repository does today, verified against the code on -2026-09-02. It is the single source of truth for the runtime topology; other documents link here -instead of restating it. The assessment behind it lives in +2026-09-03. It is the single source of truth for the runtime topology; other documents link here +instead of restating it. Product *requirements* (what the system must do) live in +`docs/requirements/`. The assessment behind the 2026-09-02 topology decisions lives in `docs/superpowers/plans/2026-09-02-convergence-directive.md`. ## Topology @@ -14,9 +15,9 @@ Web (Vite 127.0.0.1:5173, proxies /api and /rpc) Mobile (Expo) Desktop (Elec ▼ apps/api — Hono on API_HOST:API_PORT (default 127.0.0.1:3100) ← the harness / public runtime boundary ├─ auth/session (Better Auth), workspace actor (requireMembership) - ├─ router.ts (oRPC): bots, threads, runs, routines, computers, integrations, deployment + ├─ router.ts + apps/api/src/routes/* (oRPC): bots, threads, runs, routines, computers, integrations, deployment ├─ platform, billing, managed-AI, and webhook Hono routes - ├─ composition root: executor + sandbox + connectors + memory + thread events + ├─ composition root: composeAgentRuntime (executor + sandbox + connectors + memory + thread events) │ (job handlers are built here but only started when WAKEUP_DRIVER=memory) └─ PostgresRealtimeFanout (LISTEN sentrabot_events; wakes readers, carries no data) ▼ @@ -30,6 +31,9 @@ SandboxProvider ── docker ──▶ infra/sandboxes/supervisor (127.0.0.1:70 ── e2b | daytona | box (remote) ── fake | none (verification / no computers) ── desktop ("This Mac"): trusted host execution on the API/worker host DATA_DIR: agent homes, artifacts, push tokens + +Adjacent (not on the runtime path): apps/site (marketing), apps/docs (Mintlify), +packages/bot-templates (66 role packages), infra/updater (Compose sidecar). ``` ## Process ownership @@ -195,6 +199,17 @@ boundary is needed. revisited when the hybrid work resumes. - Migration consequence: none. +### 2026-09-03 — requirements package is the product baseline + +- Problem: operator docs, plans, README, and Mintlify pages disagreed on namespace, surfaces, + clinical claims, and commercial numbers. +- Decision: `docs/requirements/` (ISO/IEC/IEEE 29148 set) plus this architecture file are the + engineering baseline. README and contributor files must not claim `@rakazo/*`, `RAKAZO_WEB_URL`, + or a shipped RME adapter. Locked plan limits remain `docs/product/paket-free-batas-v1.md`. +- Evidence: `pnpm-workspace.yaml` and every `package.json` use `@sentrabot/*`; grep found no + RME adapter; 66 templates in `packages/bot-templates/CATALOG.md`. +- Migration consequence: none. + ### 2026-09-03 — sentrabot is a standalone workspace, not a Monorepo member - Problem: the Monorepo root glob `projects/*/*/apps/*` absorbed sentrabot's apps into the root diff --git a/docs/legal/kebijakan-privasi.md b/docs/legal/kebijakan-privasi.md index 5a03c2c..fffba5a 100644 --- a/docs/legal/kebijakan-privasi.md +++ b/docs/legal/kebijakan-privasi.md @@ -36,7 +36,8 @@ infrastruktur produk berjalan pada basis data, kredensial, dan kendali akses yan Menjadi pengguna SentraBot tidak menjadikan seseorang bagian dari sistem informasi rumah sakit, dan data pasien maupun rekam medis tidak bersinggungan dengan SentraBot. -**[ISI: alamat terdaftar dan alamat surel kontak privasi.]** +**[Alamat terdaftar belum dipublikasikan di repositori ini. Jangan memakai alamat fiktif.]** +Kontak privasi: lihat `SUPPORT.md`. Draf ini belum ditinjau penasihat hukum. *(Identitas dikonfirmasi Chief, 1 September 2026.)* diff --git a/docs/legal/ketentuan-layanan.md b/docs/legal/ketentuan-layanan.md index 8f021e9..d02fae3 100644 --- a/docs/legal/ketentuan-layanan.md +++ b/docs/legal/ketentuan-layanan.md @@ -16,7 +16,8 @@ Pihak yang terikat kontrak dengan pengguna adalah **PT Adianda Putri Iskandar**. Dengan memasang atau memakai SentraBot, Anda menyetujui ketentuan ini. Bila Anda memakainya atas nama organisasi, Anda menyatakan berwenang mengikat organisasi tersebut. -**[ISI: alamat terdaftar dan alamat surel kontak.]** +**[Alamat terdaftar belum dipublikasikan di repositori ini. Jangan memakai alamat fiktif.]** +Kontak: lihat `SUPPORT.md`. Draf ini belum ditinjau penasihat hukum. *(Identitas dikonfirmasi Chief, 1 September 2026.)* diff --git a/docs/legal/tentang-sentra-ai.md b/docs/legal/tentang-sentra-ai.md index d8732f8..bb023d6 100644 --- a/docs/legal/tentang-sentra-ai.md +++ b/docs/legal/tentang-sentra-ai.md @@ -69,9 +69,13 @@ terisolasi, bukan langsung di sistem Anda. ## Kontak -**[ISI: nama badan hukum, alamat, surel umum, dan tautan ke kanal resmi.]** +**Pengendali:** PT Adianda Putri Iskandar +**Program:** Sentra Artificial Intelligence +**Situs:** [sentrahai.com](https://sentrahai.com) -Situs: [sentrahai.com](https://sentrahai.com) +Alamat terdaftar dan surel privasi khusus belum dipublikasikan di repositori ini. Jangan mengisi alamat atau surel fiktif pada halaman pelanggan. + +Dukungan produk: lihat `SUPPORT.md` di akar repositori. --- @@ -82,7 +86,7 @@ Dokumen ini disusun dari bukti di dalam repositori. Bagian yang **terverifikasi | Klaim | Bukti | |---|---| | Data lokal & terenkripsi | `packages/db/prisma/schema.prisma` (48 model), `ENCRYPTION_KEY`, model `Secret` | -| Izin ditegakkan di lapisan sistem | `packages/bot-templates/source/core/30_APPROVAL_POLICY.md` | +| Izin ditegakkan di lapisan sistem | `packages/bot-templates/core/30_APPROVAL_POLICY.md` | | Jejak tindakan keluar tercatat | model `ExternalEffect`, `ActionApprovalRule` | | Sandbox | `infra/sandboxes/`, dukungan Docker / E2B / Daytona | | WhatsApp | `WHATSAPP_*` di `.env.example`, termasuk `WHATSAPP_TEMPLATE_LANGUAGE=id` | @@ -91,13 +95,10 @@ Dokumen ini disusun dari bukti di dalam repositori. Bagian yang **terverifikasi ### Yang TIDAK terverifikasi — perlu keputusan sebelum dipakai publik -**1. Kesembilan bot Indonesia tidak ada di repositori ini.** -Halaman pemasaran menyebut sembilan bot — Sentra Study, Work, Rumah, Uang, UMKM, Warga, Aman, -Creator, Care — dengan total 37 berkas. Yang ada di `packages/bot-templates` adalah **sekitar -50 template korporat** dengan struktur berbeda: `customer-success`, `growth-marketing`, -`treasury`, `internal-audit`, `legal-affairs`, `privacy-data-governance`, -`clinical-operations`, dan seterusnya. Masing-masing berisi `ROLE.md`, `template.json`, dan -`evals.json` — **bukan** `SYSTEM_PROMPT.md` dan `manifest.json` seperti yang diklaim halaman. +**1. Katalog bot yang di-ship di repositori ini adalah 66 paket peran** +di `packages/bot-templates` (lihat `CATALOG.md`), bukan sembilan bot konsumen +(Sentra Study, Work, Rumah, Uang, UMKM, Warga, Aman, Creator, Care) yang disebut +halaman pemasaran. Klaim "9 bot production-ready" **bukan** fakta repositori ini. Artinya salah satu dari tiga hal berikut benar, dan Chief perlu memastikan yang mana: - kesembilan bot itu ada di repositori lain yang belum disambungkan ke sesi ini; diff --git "a/docs/plans/CLAUDE CODE \342\200\224 SENTRABOT CONVERGENCE DIRECTIVE.md" "b/docs/plans/CLAUDE CODE \342\200\224 SENTRABOT CONVERGENCE DIRECTIVE.md" index 5fc0c49..16bb47e 100644 --- "a/docs/plans/CLAUDE CODE \342\200\224 SENTRABOT CONVERGENCE DIRECTIVE.md" +++ "b/docs/plans/CLAUDE CODE \342\200\224 SENTRABOT CONVERGENCE DIRECTIVE.md" @@ -1,5 +1,11 @@ # CLAUDE CODE — SENTRABOT CONVERGENCE DIRECTIVE +> **Superseded as an engineering baseline (2026-09-03).** +> Use [`docs/architecture.md`](../architecture.md) for as-built topology and +> [`docs/requirements/`](../requirements/) for ISO/IEC/IEEE 29148 requirements. +> Namespace `@sentrabot/*` is canonical; `@rakazo/*` does not exist in this repository. +> This file is retained as historical planning notes only. + ## Mission You are working on **SentraBot**, a local-first, self-hosted, persistent multi-agent platform. diff --git a/docs/requirements/00-document-control.md b/docs/requirements/00-document-control.md new file mode 100644 index 0000000..f823152 --- /dev/null +++ b/docs/requirements/00-document-control.md @@ -0,0 +1,81 @@ +# Document control + +**Document ID:** SENTRA-BOT-DOC-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Owner:** Product owner (Chief) +**Maintainer:** Engineering +**Review cycle:** On every material product change, and at least once per public release +**Standard:** ISO/IEC/IEEE 29148:2018 §6 (requirements information item) + +## 1. Purpose + +This file controls the Sentra Bot requirements package. It defines ownership, status, numbering, and the rule for resolving conflicts between documents. + +## 2. Identification + +| Field | Value | +| --- | --- | +| Product name | Sentra Bot | +| Programme | Sentra Artificial Intelligence | +| Legal entity | PT Adianda Putri Iskandar | +| Repository | `https://github.com/drferdii/sentrabot` | +| License | Apache-2.0 (see `LICENSE` and `NOTICE`) | +| Product version described | 0.1.0 (Unreleased / public beta lineage) | +| Baseline date | 2026-09-03 | + +## 3. Authority + +| Role | Authority | +| --- | --- | +| Chief / product owner | Accepts, rejects, or locks requirements. Only this role may change commercial plan limits. | +| Engineering | Maintains as-built mapping, tests, and architecture decision log. | +| Security contact | `security@sentrabot.com` — vulnerability intake only. | +| Legal counsel | Required before publishing `docs/legal/*` as customer-facing terms. **Not yet completed.** | + +## 4. Requirement numbering + +``` +- +``` + +Examples: `FR-AUTH-001`, `NFR-SEC-004`, `UC-07`. + +IDs are stable. Retired requirements keep their ID and are marked **Withdrawn**. New work gets the next unused number in that area. + +## 5. Conflict resolution + +| Conflict | Winner | +| --- | --- | +| This package vs `docs/superpowers/*` or `docs/plans/*` | This package + `docs/architecture.md` | +| Engineering behaviour vs commercial limits | `docs/product/paket-free-batas-v1.md` for plan numbers; this package for system behaviour | +| README marketing prose vs architecture | `docs/architecture.md` | +| Indonesian public docs vs this package | This package for engineering facts; public docs for user language | + +## 6. Change control + +1. Edit the affected requirement file. +2. Update the traceability matrix if IDs, status, or verification method change. +3. Record the change in this document's revision history. +4. Do not silently rewrite locked commercial numbers (`paket-free-batas-v1.md`). + +## 7. Master document list + +See [README.md](README.md). Companion project files outside this folder: + +| File | Role | +| --- | --- | +| `/README.md` | Public repository overview | +| `/AGENTS.md` | Contributor and agent operating rules | +| `/CONTRIBUTING.md` | Contribution process | +| `/CODE_OF_CONDUCT.md` | Community conduct | +| `/SECURITY.md` | Vulnerability reporting | +| `/LICENSE` | Apache-2.0 | +| `/CHANGELOG.md` | Keep a Changelog product notes | +| `/docs/architecture.md` | As-built runtime | + +## 8. Revision history + +| Version | Date | Description | +| --- | --- | --- | +| 1.0 | 2026-09-03 | Initial international baseline, reconciled to the repository as of commit lineage `main` 2026-09-03. | diff --git a/docs/requirements/01-project-charter.md b/docs/requirements/01-project-charter.md new file mode 100644 index 0000000..fca9fff --- /dev/null +++ b/docs/requirements/01-project-charter.md @@ -0,0 +1,78 @@ +# Project charter + +**Document ID:** SENTRA-BOT-CHAR-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** aligned with ISO 21500 / PMBOK charter content, scoped to a software product + +## 1. Project title + +Sentra Bot — persistent, operator-owned AI teammates with explicit human authority. + +## 2. Sponsor and owner + +| Role | Party | +| --- | --- | +| Sponsor / owner | Dr. Ferdi Iskandar, Chief, Sentra Artificial Intelligence | +| Legal entity | PT Adianda Putri Iskandar | +| Programme home | Sentra Artificial Intelligence (sentrahai.com) | +| Product | Sentra Bot (this repository) | + +## 3. Problem statement + +Most AI assistants are a single hosted chat box. Conversation history, credentials, and tool access live on a vendor's infrastructure. Autonomy is implied by prompt wording rather than enforced by the runtime. + +Operators who need durable agents — memory, routines, computers, integrations — also need: + +- data and secrets that stay on infrastructure they control; +- a replaceable model and computer provider; +- a hard stop before irreversible action; +- clients on web, desktop, and mobile against one API. + +## 4. Project purpose + +Deliver a self-hostable agent runtime and clients so a person or organisation can run persistent bots that perceive, reason, wait for human authority, and then act — without binding the core product to a single hosted vendor. + +## 5. In scope (charter) + +- One product across web, Electron desktop, and Expo mobile, with shared contracts in packages. +- API (`apps/api`) as the public runtime boundary; worker as the execution lane. +- Optional providers (models, sandboxes, connectors, voice, billing, phone) behind interfaces. +- Human approval for consequential tools. +- Self-host and published-image deployment paths. + +## 6. Out of scope (charter) + +- A hosted vendor as a requirement to run the core product. +- Clinical write access to patient records. +- Treating prompt text as an access-control mechanism. +- Publishing legal terms without counsel review. +- The experimental hybrid control-plane relay as the current golden path (`SENTRABOT_CONTROL_PLANE_RELAY`). + +## 7. Success criteria + +The charter is met when an operator can: + +1. Install from source or published images and complete first-run signup. +2. Create a bot, send a message, and receive a model reply when a model is connected. +3. Run a computer task on the configured sandbox provider, with workspace state checkpointed to `DATA_DIR`. +4. See an approval card for a consequential tool and allow or deny it. +5. Exercise web, and where packaged, desktop and mobile, against the same API. +6. Pass the repository verification gate (`pnpm check`, `pnpm lint`, `pnpm test`, and Docker-backed integration/e2e as documented). + +## 8. High-level risks + +See [13-risk-register.md](13-risk-register.md). Charter-level risks: secret handling, sandbox escape, optional-vendor lock-in, overstated clinical claims, and unpublished legal drafts. + +## 9. Constraints + +- Public repository: no secrets, production data, or private URLs in git. +- Apache-2.0 with retained Rakazo provenance (`NOTICE`). +- Node.js 22+ / 24+ / 26+, pnpm 9.15, PostgreSQL 16. +- Tests deterministic and offline by default. + +## 10. Related documents + +- [02-vision-and-scope.md](02-vision-and-scope.md) +- [docs/architecture.md](../architecture.md) +- [AGENTS.md](../../AGENTS.md) diff --git a/docs/requirements/02-vision-and-scope.md b/docs/requirements/02-vision-and-scope.md new file mode 100644 index 0000000..f37087a --- /dev/null +++ b/docs/requirements/02-vision-and-scope.md @@ -0,0 +1,105 @@ +# Vision and scope + +**Document ID:** SENTRA-BOT-VIS-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC/IEEE 29148:2018 (system overview and boundaries) + +## 1. Product vision + +Sentra Bot is the operating layer for persistent, composable AI teammates that the operator owns. A bot can hold memory, run routines, use a computer, and call tools — against the operator's models, data, and machines. + +Autonomy is a capability. Authority is a boundary. + +``` +PERCEIVE → REASON → VERIFY → HUMAN AUTHORITY → ACT +``` + +## 2. Positioning + +Sentra Bot is not a thin model wrapper and not a single chatbot. This repository contains the runtime: API, clients, worker, jobs, memory, computer providers, connectors, artifacts, and realtime. + +Upstream lineage is Rakazo (Apache-2.0). User-facing product identity is Sentra Bot. Internal packages use the `@sentrabot/*` namespace. + +## 3. Intended users + +| Persona | Need | +| --- | --- | +| Individual operator | Self-host or point a client at a deployment; own memory and secrets | +| Small-business owner (Indonesia-first) | WhatsApp as a daily channel; simple approval; affordable BYOK | +| Knowledge worker / student | Routines, documents, computer use, search | +| Deployment owner | Signup policy, computer host choice, updates, backups | +| Healthcare / regulated operator | Role templates and read-only doctrine; **no clinical write path in this baseline** | +| Contributor | Deterministic tests, typed contracts, documented topology | + +## 4. Product surfaces + +| Surface | Path | Role | +| --- | --- | --- | +| API | `apps/api` | Public runtime boundary: Better Auth, oRPC, health | +| Worker | `apps/worker` | Graphile jobs, run continuation, routines, reconciler | +| Web | `apps/web` | React + Vite client (default `127.0.0.1:5173`) | +| Desktop | `apps/desktop` | Electron shell of the web UI | +| Mobile | `apps/mobile` | Expo client; custom server at sign-in | +| Marketing site | `apps/site` (npm name `cora`) | Public landing and static legal pages | +| Public docs | `apps/docs` | Mintlify user documentation (Indonesian) | +| Role catalog | `packages/bot-templates` | 66 Chief-of-Staff production role packages | + +## 5. Context diagram + +```text + Operator ── web / desktop / mobile / WhatsApp (optional) + │ + ▼ + apps/api :3100 + (auth, oRPC, SSE) + │ + ┌───────────┼───────────┐ + ▼ ▼ ▼ + PostgreSQL Graphile DATA_DIR + │ Worker │ + └────── apps/worker ────┘ + │ + ▼ + SandboxProvider + docker | e2b | daytona | box | desktop | fake +``` + +## 6. Scope of this baseline + +### In scope — Implemented + +- Workspace membership, bots, groups, threads, runs, artifacts, memory, routines, scratchpad. +- Computer lifecycle and human takeover. +- Approval rules and host-execution policy on trusted desktop computers. +- Optional model BYOK and selected OAuth model sign-in. +- Optional connectors (Composio, Pipedream), HTTPS MCP, OpenAPI tools. +- Optional WhatsApp Cloud API pairing and voice-note transcription. +- Voice providers behind a `VoiceProvider` interface. +- Self-host Compose topologies and published GHCR images. + +### In scope — Specified (commercial) + +- Free / Plus / Pro / Business active-bot ladder and Free limits in `docs/product/paket-free-batas-v1.md`. +- Entitlement principle: pause, do not delete, when a workspace exceeds plan limits. + +### In scope — Experimental / frozen + +- Hybrid control-plane relay (`/v1/relay/events`), off unless `SENTRABOT_CONTROL_PLANE_RELAY=enabled`. +- Trusted host execution (`SANDBOX_PROVIDER=desktop` / `computerHost=this-mac`), owner-only. + +### Out of scope + +- Clinical write to any patient record or hospital information system. +- A dedicated RME (electronic medical record) adapter in this repository — **not present in code**; do not document it as shipped. +- Prompt-only “safety”. +- Requiring OpenRouter, E2B, Composio, Xendit, or any other hosted vendor to boot the core stack. +- Nine consumer Indonesia bots (Study, Work, Rumah, …) as a shipped catalog — the shipped catalog is the 66 role packages in `packages/bot-templates`. + +## 7. Operating principles (normative for design) + +1. No hosted vendor is required to run the core product. +2. Frontends express intent and render state; the backend owns orchestration, authorization, validation, retries, and provider translation. +3. Shared behaviour lives in packages; only native navigation, storage, permissions, and interactions are platform-specific. +4. Sandboxes are runtime cache. Durable state is PostgreSQL and `DATA_DIR`. +5. Secrets never enter git, capability config, fixtures, logs, or snapshots. diff --git a/docs/requirements/03-stakeholder-requirements.md b/docs/requirements/03-stakeholder-requirements.md new file mode 100644 index 0000000..62acd49 --- /dev/null +++ b/docs/requirements/03-stakeholder-requirements.md @@ -0,0 +1,51 @@ +# Stakeholder requirements specification (StRS) + +**Document ID:** SENTRA-BOT-StRS-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC/IEEE 29148:2018 (stakeholder requirements) + +Stakeholder requirements are needs in the language of people who use, operate, or govern the product. Software requirements in SRS-001 refine these. + +## 1. Stakeholders + +| ID | Stakeholder | Interest | +| --- | --- | --- | +| SH-01 | End user / operator | Talk to bots, approve actions, keep data local | +| SH-02 | Deployment owner | First-run policy, computer host, updates, backups, signup control | +| SH-03 | Workspace member | Shared bots and computers under membership rules | +| SH-04 | Indonesia user | Bahasa Indonesia UI copy, WhatsApp channel, phone locale `id` | +| SH-05 | Self-host operator | Compose/images, loopback Postgres, no required cloud vendor | +| SH-06 | Security reviewer | Authn/z, encryption, sandbox isolation, disclosure process | +| SH-07 | Contributor | Tests, typed contracts, documented architecture | +| SH-08 | Legal / compliance | Accurate privacy and terms; clinical non-write | +| SH-09 | Upstream Rakazo authors | License attribution retained | + +## 2. Stakeholder requirements + +| ID | Requirement | Stakeholder | Status | +| --- | --- | --- | --- | +| StR-001 | The operator shall run the product on infrastructure they control, with optional remote providers. | SH-01, SH-05 | Implemented | +| StR-002 | Consequential actions shall wait for explicit human allow/deny (or a stored always-allow rule). | SH-01, SH-06 | Implemented | +| StR-003 | The first registered user shall become the deployment owner. | SH-02 | Implemented | +| StR-004 | The operator shall connect their own model credentials (BYOK) or a deployment-wide key. | SH-01, SH-05 | Implemented | +| StR-005 | Bots shall persist memory independently of an ephemeral sandbox. | SH-01 | Implemented | +| StR-006 | The operator shall schedule recurring or one-shot work in ordinary language or cron. | SH-01 | Implemented | +| StR-007 | The operator shall watch and, when allowed, take control of a bot computer. | SH-01 | Implemented | +| StR-008 | Web, desktop, and mobile shall speak the same API contracts. | SH-01, SH-07 | Implemented | +| StR-009 | WhatsApp shall be an optional daily channel, not a required control plane. | SH-04 | Partial (Cloud API pairing implemented; group-agent UX is planned) | +| StR-010 | Free-plan limits shall pause excess capacity rather than delete user data. | SH-01, SH-08 | Specified (limits locked; pause-not-delete is the product rule) | +| StR-011 | Clinical integrations, if any, shall not write to a patient record in this baseline. | SH-08 | Implemented as absence of a write path; no RME adapter ships in this repo | +| StR-012 | Vulnerabilities shall be reported privately, not via public issues. | SH-06 | Implemented (`SECURITY.md`) | +| StR-013 | Optional analytics shall not be required to run the product. | SH-01, SH-08 | Implemented (`PUBLIC_POSTHOG_*` optional) | +| StR-014 | Indonesian locale shall be the default for deployment phone-channel copy. | SH-04 | Implemented (`PHONE_LOCALE=id`) | +| StR-015 | Role templates shall be available for professional domains including healthcare and Indonesian public sector. | SH-01 | Implemented (66 packages) | + +## 3. Stakeholder constraints + +| ID | Constraint | +| --- | --- | +| StC-001 | Public git must not contain secrets or production identifiers. | +| StC-002 | Legal drafts in `docs/legal/` must not be treated as in-force customer contracts until counsel review. | +| StC-003 | Marketing must not promise token counts; Managed AI is fair-use. | +| StC-004 | Testimonials and unshipped consumer bot names must not be presented as product facts. | diff --git a/docs/requirements/04-software-requirements-specification.md b/docs/requirements/04-software-requirements-specification.md new file mode 100644 index 0000000..68f2517 --- /dev/null +++ b/docs/requirements/04-software-requirements-specification.md @@ -0,0 +1,182 @@ +# Software requirements specification + +**Document ID:** SENTRA-BOT-SRS-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC/IEEE 29148:2018 (software requirements specification) +**Normative references:** `packages/contracts/src/rpc.ts`, `packages/db/prisma/schema.prisma`, `docs/architecture.md` + +## 1. Introduction + +### 1.1 Purpose + +This SRS specifies functional requirements for Sentra Bot as implemented in this repository. Each requirement is atomic, testable, and status-coded. + +### 1.2 Product perspective + +Clients call `apps/api` over Better Auth (`/api/auth/*`) and typed oRPC (`/rpc/*`). Thread events are durable rows (`events.threadId`, `events.seq`) and are pushed over `threads.subscribe`. Agent execution runs in `apps/worker` when `WAKEUP_DRIVER=graphile` (product path) or in-process when `WAKEUP_DRIVER=memory` (tests). + +### 1.3 Definitions + +See [12-glossary.md](12-glossary.md). + +### 1.4 Overview of requirement areas + +`FR-SYS`, `FR-AUTH`, `FR-BOT`, `FR-THR`, `FR-RUN`, `FR-CMP`, `FR-MEM`, `FR-RTN`, `FR-INT`, `FR-APP`, `FR-MDL`, `FR-PHN`, `FR-VOI`, `FR-BIL`, `FR-OPS`, `FR-CLI`. + +--- + +## 2. System services + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-SYS-001 | The API shall listen on `API_HOST:API_PORT` (default `127.0.0.1:3100`) and expose `/health`. | Implemented | `apps/api`, `.env.example` | +| FR-SYS-002 | The API shall expose the oRPC contract defined in `packages/contracts`. | Implemented | `packages/contracts/src/rpc.ts` | +| FR-SYS-003 | The worker shall consume keyed Graphile jobs (`run.continue`, `routine.wakeup`, `phone.deliver`, `computer.*`, `skill.*`, `history.compact`). | Implemented | `docs/architecture.md` | +| FR-SYS-004 | Job redelivery shall replace by `jobKey` rather than duplicate work. | Implemented | `packages/adapter-kit/src/background-jobs.ts` | +| FR-SYS-005 | A reconciler under a Postgres advisory lock shall re-enqueue queued runs, expired leases, and near-due routines. | Implemented | `apps/worker` | +| FR-SYS-006 | Core product startup shall not require any third-party API key. | Implemented | `.env.example` optional keys | +| FR-SYS-007 | `composeAgentRuntime` shall be the single composition of executor, sandbox, connectors, and job handlers for API and worker. | Implemented | `packages/adapters/src/agent-runtime-composition.ts` | + +--- + +## 3. Authentication, identity, and tenancy + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-AUTH-001 | The system shall authenticate users with Better Auth sessions. | Implemented | `packages/auth` | +| FR-AUTH-002 | The first registered user on a fresh deployment shall become the deployment owner. | Implemented | self-host / onboarding | +| FR-AUTH-003 | Signup shall honour deployment settings (`signupsEnabled`, `signupAllowlist`) after initialization. | Implemented | `deployment.update` | +| FR-AUTH-004 | Every workspace-scoped RPC shall require membership (`requireMembership`). | Implemented | `apps/api/src/authed.ts` | +| FR-AUTH-005 | Users shall belong to an organization (workspace) with roles via Better Auth organization plugin tables. | Implemented | Prisma `Organization`, `Member` | +| FR-AUTH-006 | `BETTER_AUTH_SECRET` shall be at least 32 characters; cookies and CORS shall follow `BETTER_AUTH_URL` / `WEB_ORIGIN` / `API_URL`. | Implemented | `.env.example`, self-host doc | + +--- + +## 4. Bots, groups, and onboarding + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-BOT-001 | A member shall create, update, duplicate, reorder, archive, restore, and remove bots. | Implemented | `bots.*` RPC | +| FR-BOT-002 | Removing a bot shall not delete memories unless `deleteMemories` is true. | Implemented | `bots.remove` | +| FR-BOT-003 | A bot shall be assignable to Team or Private computer mode. | Implemented | `bots.setComputer` | +| FR-BOT-004 | Members shall create groups that share a thread among multiple bots. | Implemented | `groups.*` | +| FR-BOT-005 | First-run onboarding shall seed a conversational flow and let the user choose a focus. | Implemented | `onboarding.*` | +| FR-BOT-006 | The product shall ship a catalog of 66 role templates for bot creation. | Implemented | `packages/bot-templates/CATALOG.md` | +| FR-BOT-007 | A bot may spawn a peer bot (own thread and computer) or a short-lived in-thread subagent. | Implemented | CHANGELOG; events `bot.spawned`, `thread.subagent` | + +--- + +## 5. Threads, messages, and realtime + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-THR-001 | A thread shall be addressed by exactly one of `botId` or `groupId`. | Implemented | contract `threadTarget` | +| FR-THR-002 | `threads.send` shall accept text and/or attachments, optional mentions, reply-to, and `clientNonce`. | Implemented | `rpc.ts` | +| FR-THR-003 | Clients shall resume event streams from the last durable `seq`. | Implemented | `threads.subscribe` | +| FR-THR-004 | SSE shall propagate events; the `events` table is the source of truth. | Implemented | architecture.md | +| FR-THR-005 | A user shall stop an in-flight run, follow up, clear a thread, and answer an ask. | Implemented | `threads.stop/followUp/clear/answer` | +| FR-THR-006 | Workspace search shall query threads and related objects from a single `search.query` RPC. | Implemented | `search.query` | + +--- + +## 6. Runs and authority + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-RUN-001 | Run status shall follow `queued → leased → running → (waiting_input \| waiting_takeover \| completed \| failed \| cancelled)` and reject illegal transitions. | Implemented | `packages/core/src/run-state.ts` | +| FR-RUN-002 | Leases shall be fenced (`leaseFence`) and renewed; durable writes shall be conditioned on the fence. | Implemented | architecture.md | +| FR-RUN-003 | Consequential tool calls shall be recorded in `external_effects` with a unique `idempotencyKey` before execution. | Implemented | executor | +| FR-RUN-004 | An interrupted external call shall be left `ambiguous` and shall not be replayed blindly. | Implemented | executor | +| FR-RUN-005 | The tool gate shall evaluate `toolRequiresApproval` then workspace `action_approval_rules` then optional auto-review, then ALLOW or ASK. | Implemented | architecture.md | +| FR-RUN-006 | ASK shall park the run in `waiting_input` until the user answers `allow`, `always`, or `deny`. | Implemented | `threads.answer`, Ask cards | +| FR-RUN-007 | On a trusted host computer, `shell`, `write_file`, `launch_app`, and `open_path` shall ASK unless an always-allow rule matches. | Implemented | `applyHostExecutionPolicy` | +| FR-RUN-008 | Structured run logs shall emit identifiers and enums only — never prompts, arguments, or message text. | Implemented | `packages/core/src/run-log.ts` | + +--- + +## 7. Computers and sandboxes + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-CMP-001 | `SandboxProvider` shall support lifecycle, desktop, execution, and file operations as defined in `docs/computer-runtime.md`. | Implemented | adapters | +| FR-CMP-002 | Supported providers shall include `docker`, `e2b`, `daytona`, `box`, `desktop`, `fake`, and `none`. | Implemented | `.env.example`, factory | +| FR-CMP-003 | Docker computers shall be managed by the sandbox supervisor (not an unrestricted Docker socket on the API). | Implemented | `infra/sandboxes/supervisor` | +| FR-CMP-004 | Workspace state shall checkpoint to `DATA_DIR` independently of the cloud sandbox lifetime. | Implemented | `AgentHomeStore` | +| FR-CMP-005 | A user shall boot, stop, recover, reset, update, take over, and release a bot computer. | Implemented | `computer.*` | +| FR-CMP-006 | Takeover of a Team bot with a live execution lease shall fail unless the run is `waiting_takeover`. | Implemented | computer-runtime.md | +| FR-CMP-007 | Trusted host execution shall be off by default and enableable only by the deployment owner when the configured provider is `docker`. | Implemented | CHANGELOG, deployment settings | +| FR-CMP-008 | `desktop` provider shall treat host execution as trusted, not isolated. | Implemented | architecture.md | +| FR-CMP-009 | Graphical tools shall return `MULTI_SCREEN_UNAVAILABLE` when a provider cannot allocate another Team display. | Implemented | computer-runtime.md | + +--- + +## 8. Memory, artifacts, skills, routines + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-MEM-001 | Each bot shall have markdown memory documents listable and editable by members. | Implemented | `memory.*` | +| FR-MEM-002 | Memory shall export as markdown. | Implemented | `memory.exportMarkdown` | +| FR-MEM-003 | An optional semantic memory provider (Supermemory) may be connected; it is not required. | Implemented | `memory.connectProvider` | +| FR-MEM-004 | Artifacts shall upload with a size limit defined in the contracts package. | Implemented | `artifacts.*` | +| FR-RTN-001 | Routines shall support cron schedules, timezone, notify, webhook trigger, and one-shot `runAt`. | Implemented | `routines.*` | +| FR-RTN-002 | A routine without any schedule and with webhook disabled shall be rejected. | Implemented | contract superRefine | +| FR-SKL-001 | A user shall teach a skill by recording computer actions and save a playbook. | Implemented | `skills.*` | +| FR-SKL-002 | Workspace Agent Skills (`SKILL.md`) shall be persistable and injectable into the Pi runtime. | Implemented | `agentSkills.*` | +| FR-SKL-003 | Scratchpad items shall track bot tasks with status and notes. | Implemented | `scratchpad.*` | + +--- + +## 9. Models, voice, integrations, phone + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-MDL-001 | Users shall connect model credentials and set a default model. | Implemented | `models.*` | +| FR-MDL-002 | Users shall probe OpenAI-compatible endpoints; public hostnames require an explicit allow flag. | Implemented | `SENTRABOT_OPENAI_COMPAT_ALLOW_PUBLIC` | +| FR-MDL-003 | Device-code OAuth shall support ChatGPT Plus/Pro, GitHub Copilot, and SuperGrok / X Premium as implemented by Pi. | Implemented | CHANGELOG | +| FR-MDL-004 | Claude Pro browser login shall not be offered (localhost callback incompatible with the web app). | Implemented | CHANGELOG (explicit omission) | +| FR-VOI-001 | Speech shall sit behind a `VoiceProvider` interface (ElevenLabs, OpenAI, Cartesia). Keys remain on the server. | Implemented | CHANGELOG, `voice.*` | +| FR-INT-001 | Managed app catalogs (Composio, Pipedream Connect) shall be optional. | Implemented | `connections.*` | +| FR-INT-002 | Users shall install HTTPS MCP servers (including OAuth) and bound OpenAPI sources. Credentials shall use the secret store. | Implemented | `mcp.*`, `capabilities.*` | +| FR-INT-003 | Connector tests shall remain deterministic and offline. | Implemented | CONTRIBUTING.md, testkit | +| FR-PHN-001 | WhatsApp Cloud API shall enable pairing when all required env vars are set. | Implemented | `phone.whatsapp.*` | +| FR-PHN-002 | Inbound WhatsApp voice notes shall transcribe when `PHONE_TRANSCRIBE_*` is configured; otherwise reply that voice is not supported — not drop silently. | Implemented | `.env.example` | +| FR-PHN-003 | Phone-channel system copy locale shall default to `id`. Agent replies shall follow the user's language. | Implemented | `PHONE_LOCALE` | + +--- + +## 10. Billing, plans, operations + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-BIL-001 | Plan limits for Free shall match `docs/product/paket-free-batas-v1.md` (3 active bots, quotas listed there). | Specified | `packages/core/src/platform-policy.ts` `freePlanLimits` | +| FR-BIL-002 | Subscription states shall include `free`, `checkout_pending`, `active_plus`, `past_due`, `grace_period`. | Implemented | `platform-policy.ts` | +| FR-BIL-003 | Payment grace shall be 7 calendar days; then the workspace returns to Free without deleting data. | Specified | product doc; Xendit path partial | +| FR-BIL-004 | Exceeding active-bot (or other) limits shall pause excess items, not delete them. | Specified | product doc | +| FR-BIL-005 | Customer-facing copy shall not promise token counts. | Specified | product doc | +| FR-OPS-001 | Deployment owner shall check and apply product updates via the updater sidecar when present. Rollback stays ops-only. | Implemented | `updater.*` | +| FR-OPS-002 | Health shall optionally report `GIT_SHA` as `revision`. | Implemented | `.env.example` | +| FR-OPS-003 | Backup and restore scripts shall exist for operator use. | Implemented | `scripts/backup.sh`, `restore.sh` | + +--- + +## 11. Clients + +| ID | Requirement | Status | Verification | +| --- | --- | --- | --- | +| FR-CLI-001 | Web shall proxy `/api` and `/rpc` to the API in development. | Implemented | `apps/web` | +| FR-CLI-002 | Desktop shall host the web UI and support `SENTRABOT_WEB_URL` override for tests. | Implemented | `apps/desktop` | +| FR-CLI-003 | Mobile shall allow a custom HTTPS API origin at sign-in. | Implemented | `apps/mobile` | +| FR-CLI-004 | Production mobile builds shall require `EXPO_PUBLIC_API_URL` as HTTPS. | Implemented | `apps/mobile/app.config.ts` | +| FR-CLI-005 | Store identifiers and EAS secrets shall not be committed. | Implemented | `docs/mobile-release.md` | + +--- + +## 12. Explicit non-requirements + +| ID | Statement | +| --- | --- | +| FR-NX-001 | This repository shall not ship a clinical write adapter. | +| FR-NX-002 | This repository does not contain an RME reconnaissance adapter; README doctrine must not claim one is shipped. | +| FR-NX-003 | The hybrid relay at `/v1/relay/events` is not part of the golden path. | +| FR-NX-004 | `outbox_events` is write-only debt (billing writer, no drain) until hybrid work resumes. | diff --git a/docs/requirements/05-product-requirements.md b/docs/requirements/05-product-requirements.md new file mode 100644 index 0000000..cacd2c7 --- /dev/null +++ b/docs/requirements/05-product-requirements.md @@ -0,0 +1,98 @@ +# Product requirements document + +**Document ID:** SENTRA-BOT-PRD-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Audience:** Product, design, engineering +**Companion:** SRS-001 (normative functional), `docs/product/paket-free-batas-v1.md` (locked commercial numbers) + +## 1. Summary + +Sentra Bot is a self-hostable persistent-agent product. The operator installs it, creates bots from role templates, connects a model, and works in a thread. The bot may use a computer, memory, routines, and integrations. Irreversible actions stop for an Allow / Deny card. + +Indonesia is the primary market language and WhatsApp is a first-class *optional* channel. The control plane remains the Sentra Bot clients (web, desktop, mobile). + +## 2. Goals + +| Priority | Goal | +| --- | --- | +| P0 | Operator-owned runtime with durable state and explicit authority | +| P0 | Web + API + worker + Docker computer path works without cloud vendors | +| P0 | Same contracts on desktop and mobile | +| P1 | WhatsApp pairing, voice notes, Indonesian phone copy | +| P1 | Plan limits that pause rather than delete | +| P2 | Hybrid multi-device E2EE control plane (frozen experimental) | +| P2 | Broader Indonesian consumer bot names on the marketing site (not in this catalog) | + +## 3. Personas and jobs-to-be-done + +| Persona | Job | +| --- | --- | +| Solo operator | “Install, sign up, talk to one bot, see it use a computer.” | +| UMKM owner | “Message the bot on WhatsApp; approve anything that sends or pays.” | +| Team lead | “Several role bots on a Team computer, shared browser, distinct screens when the provider allows.” | +| Deployment owner | “Lock signups, pick Docker vs this Mac, apply an update, restore a backup.” | + +## 4. Product capabilities (user-visible) + +1. **Bots** — named teammates with model, memory, computer mode, skills, routines. +2. **Thread** — primary work surface; groups for multi-bot coordination. +3. **Ask cards** — Allow / Always / Deny for gated tools. +4. **Computer pane** — live desktop, takeover, files. +5. **Routines** — scheduled or webhook-triggered work; notify when configured. +6. **Memory** — editable documents; optional semantic provider. +7. **Integrations** — managed catalogs plus user-installed MCP/OpenAPI. +8. **Voice** — speak replies, dictation, calls when a voice provider is connected. +9. **Phone** — pair WhatsApp; iMessage channel membership where configured. +10. **Settings** — models, voice, plugins, MCP, approval rules, account, memory, phone. +11. **Brief** — product narrative of twice-daily summary (keep copy consistent; do not over-claim automation that is not scheduled as a built-in system routine unless verified in UI). + +## 5. Commercial packaging + +Locked by Chief on 2026-09-01. Do not change numbers here; change `docs/product/paket-free-batas-v1.md` first. + +| Plan | Active bots | +| --- | --- | +| Free | 3 | +| Plus | 10 | +| Pro | 30 | +| Business | 100 | + +Free quotas (summary): 10 web searches/day, 5 uploads/day, 250 MB active storage, 30-day active memory window, 3 active schedules, 20 agent actions/month, 1 connected integration, 15 voice minutes/month, 3 computer-agent sessions/month. Managed AI is included on fair-use. BYOK is allowed. Downgrade pauses excess; it does not delete. + +Internal COGS targets are **not** customer-facing. Public Mintlify pages must not print them. + +Billing provider in code is Xendit-oriented (`Subscription.provider` default `xendit`). Treat live payment operations as **Partial** until a production billing runbook is published. + +## 6. UX principles + +From `AGENTS.md`: + +- Minimal copy. No explainer text that repeats the interface. +- Progressive disclosure of advanced capability. +- Concise accessible names on controls. +- Beautiful UI primitives in `apps/web/src/components/beautiful-ui/` before inventing new ones. + +## 7. Internationalisation + +- Engineering and requirements: English. +- Default phone-channel system copy: Indonesian (`PHONE_LOCALE=id`). +- Agent replies: follow the user's language. +- Public docs and marketing: Indonesian (`apps/docs`, `apps/site`). + +## 8. Release channels + +| Channel | Notes | +| --- | --- | +| Git `main` | Source of truth; CI on PR and push | +| GHCR `edge` | Published images, amd64-oriented; see self-host.md | +| Desktop | Electron; GitHub release workflow | +| Mobile | Private EAS/store config; not in git | +| Marketing | `apps/site` on Vercel (standalone npm package `cora`) | + +## 9. Open product issues (do not hide) + +1. Legal drafts are not counsel-reviewed. +2. Hybrid E2EE multi-device sync is experimental and incomplete (`outbox_events` undrained). +3. Marketing “nine Indonesia consumer bots” are not this repo’s template catalog. +4. Clinical RME adapter is not in this repository. diff --git a/docs/requirements/06-use-cases.md b/docs/requirements/06-use-cases.md new file mode 100644 index 0000000..586de07 --- /dev/null +++ b/docs/requirements/06-use-cases.md @@ -0,0 +1,133 @@ +# Use-case specification + +**Document ID:** SENTRA-BOT-UCS-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** use-case form consistent with ISO/IEC 29148 operational scenarios + +Actors: **User**, **Owner** (deployment owner), **Bot**, **Worker**, **Provider** (optional vendor). + +--- + +## UC-01 First-run self-host + +**Goal:** A new operator reaches a signed-in web UI on a local stack. +**Preconditions:** Docker or `pnpm dev` dependencies available; `.env` created from `.env.example`. +**Main flow:** + +1. Operator starts Postgres, API, worker, web (Compose or turbo). +2. Operator opens `http://127.0.0.1:5173`. +3. Operator registers. System makes them Owner. +4. Operator completes onboarding and optionally connects a model. + +**Success:** Health is ok; a session cookie is set; a workspace exists. +**Status:** Implemented. + +--- + +## UC-02 Send a message and receive a reply + +**Preconditions:** Authenticated member; model credential or deployment key present. +**Main flow:** User sends text on a bot thread → API creates task/run → Worker leases run → Pi runtime calls the model → assistant message persisted → SSE updates the client. +**Extensions:** Attachments via `artifacts.create`; mentions of bots/groups/routines/connectors. +**Status:** Implemented. + +--- + +## UC-03 Consequential tool approval + +**Preconditions:** Run in progress; tool is gated. +**Main flow:** Executor records `external_effects` as `intended` → posts ask → run `waiting_input` → User Allow / Always / Deny → `run.continue`. +**Success:** Deny never executes the effect; Always stores a workspace rule. +**Status:** Implemented. + +--- + +## UC-04 Use a Docker computer + +**Preconditions:** `SANDBOX_PROVIDER=docker`; supervisor token set; computer image built. +**Main flow:** User or agent boots computer → supervisor spawns container → tools observe/act/shell/files → checkpoint to `DATA_DIR` on completion/stop/idle. +**Status:** Implemented. + +--- + +## UC-05 Take control of a desktop + +**Preconditions:** Computer running; for Team bots, no conflicting execution lease (or run is `waiting_takeover`). +**Main flow:** User takeover → exclusive control lease → input events → release. +**Failure:** HTTP 409 if the bot still holds an execution lease. +**Status:** Implemented. + +--- + +## UC-06 Schedule a routine + +**Main flow:** User creates a routine with cron or `runAt` → Worker wakes at due time → new run on the bot thread → optional notify. +**Failure:** Empty crons and webhook disabled. +**Status:** Implemented. + +--- + +## UC-07 Pair WhatsApp + +**Preconditions:** All `WHATSAPP_*` required variables set. +**Main flow:** User begins pairing for a bot → receives code and `waLink` → messages the business number → inbound messages create/continue the thread. +**Voice notes:** Transcribe if configured; otherwise honest “not supported” copy. +**Status:** Partial (pairing implemented; WhatsApp group-agent is planned). + +--- + +## UC-08 Connect a managed integration + +**Main flow:** User picks a catalog item → OAuth URL → complete → tools available to the executor under approval policy. +**Revoke:** `connections.revoke`. +**Status:** Implemented (optional keys). + +--- + +## UC-09 Trusted host “This Mac” + +**Preconditions:** Owner; `SANDBOX_PROVIDER=docker`; owner sets `computerHost=this-mac`. +**Main flow:** Commands run on the API/worker host with bot home and user home as allowed roots; host-affecting tools ASK. +**Status:** Implemented (experimental, owner-only). + +--- + +## UC-10 Apply a server update + +**Preconditions:** Updater sidecar reachable; caller is Owner. +**Main flow:** `updater.check` → `updater.apply`. Rollback is not exposed on this RPC. +**Status:** Implemented. + +--- + +## UC-11 Downgrade from Plus to Free + +**Main flow:** Grace elapses or user leaves paid plan → entitlements become Free limits → extra bots/schedules/integrations pause → data retained. +**Status:** Specified (policy locked; confirm UX pause states in clients when changing billing UI). + +--- + +## UC-12 Report a vulnerability + +**Main flow:** Reporter emails `security@sentrabot.com` with repro and impact. No public GitHub issue. +**Status:** Implemented (process). + +--- + +## Use-case to requirement map + +| Use case | Primary SRS IDs | +| --- | --- | +| UC-01 | FR-SYS-001, FR-AUTH-002, FR-BOT-005 | +| UC-02 | FR-THR-002, FR-RUN-001, FR-MDL-001 | +| UC-03 | FR-RUN-003, FR-RUN-005, FR-RUN-006 | +| UC-04 | FR-CMP-001, FR-CMP-003, FR-CMP-004 | +| UC-05 | FR-CMP-005, FR-CMP-006 | +| UC-06 | FR-RTN-001, FR-RTN-002 | +| UC-07 | FR-PHN-001, FR-PHN-002 | +| UC-08 | FR-INT-001 | +| UC-09 | FR-CMP-007, FR-RUN-007 | +| UC-10 | FR-OPS-001 | +| UC-11 | FR-BIL-001, FR-BIL-003, FR-BIL-004 | +| UC-12 | StR-012 | diff --git a/docs/requirements/07-non-functional-requirements.md b/docs/requirements/07-non-functional-requirements.md new file mode 100644 index 0000000..68b71dc --- /dev/null +++ b/docs/requirements/07-non-functional-requirements.md @@ -0,0 +1,73 @@ +# Non-functional requirements + +**Document ID:** SENTRA-BOT-NFR-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC 25010:2023 quality model, expressed as testable requirements + +## 1. Functional suitability + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-FIT-001 | Core journeys (signup, send, approve, computer boot) shall be covered by automated tests that do not call live vendors. | Implemented | +| NFR-FIT-002 | Product-path defaults shall be `AGENT_RUNTIME=pi`, `WAKEUP_DRIVER=graphile`, `SANDBOX_PROVIDER=docker`. Test-only values (`scripted`, `memory`, `fake`) shall not be documented as production. | Implemented | + +## 2. Performance efficiency + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-PERF-001 | Desktop performance shall be measurable with `pnpm perf:desktop` against scripted runtime and fake sandbox. | Implemented | +| NFR-PERF-002 | Run leases shall renew every 60 s; stalled work is bounded by lease expiry plus `SANDBOX_COMMAND_TIMEOUT_MS` (default 300000). | Implemented | +| NFR-PERF-003 | Sandbox idle pause default shall be `SANDBOX_IDLE_MS=600000` (minimum 30000). | Implemented | +| NFR-PERF-004 | SSE fan-out shall not carry event payloads on Postgres NOTIFY; durable rows are the truth. | Implemented | + +## 3. Compatibility and portability + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-PRT-001 | Runtime shall support Node.js `^22.22.2 \|\| ^24.0.0 \|\| >=26.0.0` and pnpm 9.15. | Implemented | +| NFR-PRT-002 | Database shall be PostgreSQL 16 via Prisma. | Implemented | +| NFR-PRT-003 | Computer providers shall be replaceable through `SandboxProvider` without rewriting agent tools. | Implemented | +| NFR-PRT-004 | Published images shall document amd64 `edge` vs multi-arch release tags; operators must not assume `latest`. | Implemented | + +## 4. Usability and accessibility + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-USE-001 | Interactive controls shall use semantic HTML (`button`, `a`) with accessible names where the UI is non-text. | Partial (convention in AGENTS.md / coding standard; not fully audited) | +| NFR-USE-002 | Approval UX shall be Allow / Deny (and Always where offered), not prompt-engineering instructions. | Implemented | +| NFR-USE-003 | Public documentation for Indonesian users shall exist in `apps/docs`. | Implemented | + +## 5. Reliability + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-REL-001 | Worker death shall recover via keyed re-enqueue without waiting Graphile’s 4-hour stale-lock window. | Implemented | +| NFR-REL-002 | Illegal run-state transitions shall throw rather than persist. | Implemented | +| NFR-REL-003 | Compose production files shall include health checks and `no-new-privileges` posture as documented. | Implemented | + +## 6. Security (quality view) + +Detailed controls: [08-security-and-privacy-requirements.md](08-security-and-privacy-requirements.md). + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-SEC-001 | Secrets in git are forbidden. `.env` is gitignored and excluded from Docker context. | Implemented | +| NFR-SEC-002 | Stored credentials shall use versioned AES-GCM with per-record salt and row-bound AAD. | Implemented | +| NFR-SEC-003 | Postgres in local Compose shall bind loopback only (`127.0.0.1:5433`). | Implemented | + +## 7. Maintainability + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-MNT-001 | Shared domain logic shall live in `packages/core`; RPC contracts in `packages/contracts`. | Implemented | +| NFR-MNT-002 | CI shall run lint, typecheck, production build, unit, integration, and Playwright e2e on pull requests. | Implemented | +| NFR-MNT-003 | Architecture decisions shall be appended to `docs/architecture.md` rather than restated in plans. | Implemented | + +## 8. Operability + +| ID | Requirement | Status | +| --- | --- | --- | +| NFR-OPS-001 | Optional OpenTelemetry export via `OTEL_EXPORTER_OTLP_ENDPOINT`. | Implemented | +| NFR-OPS-002 | Log level via `LOG_LEVEL`. Run logs are structured JSON lines. | Implemented | +| NFR-OPS-003 | Operators shall have backup/restore and a documented single-VM production Compose path. | Implemented | diff --git a/docs/requirements/08-security-and-privacy-requirements.md b/docs/requirements/08-security-and-privacy-requirements.md new file mode 100644 index 0000000..ebe8a27 --- /dev/null +++ b/docs/requirements/08-security-and-privacy-requirements.md @@ -0,0 +1,87 @@ +# Security and privacy requirements + +**Document ID:** SENTRA-BOT-SEC-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standards:** OWASP ASVS v5.0 (selected), ISO/IEC 27001:2022 control themes, HIPAA Security Rule technical safeguards **as design doctrine for PHI — this product is not a hospital information system** + +## 1. Scope and non-scope + +This document covers the Sentra Bot self-hosted product in this repository. + +Out of scope for the vulnerability programme: third-party model APIs, Composio/E2B/etc., and operator misconfiguration (`SECURITY.md`). + +Sentra Bot is legally separated from RSIA Melinda DHAI information systems (`docs/legal/kebijakan-privasi.md`). It shall not mix patient-record operational data with product accounts. + +## 2. Disclosure + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-DIS-001 | Vulnerabilities shall be reported to `security@sentrabot.com`, not public issues. | Implemented | +| SEC-DIS-002 | Supported versions: current `main` and latest release (beta). No bug bounty. | Implemented | + +## 3. Authentication and session + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-AUTH-001 | Session tokens shall be server-issued (Better Auth); RPC handlers shall not trust client-supplied identity fields. | Implemented | +| SEC-AUTH-002 | CORS and cookies shall be origin-bound to configured public URLs. | Implemented | +| SEC-AUTH-003 | Signup can be disabled or allowlisted by the Owner after init. | Implemented | + +## 4. Authorisation + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-AZN-001 | Workspace membership is required for workspace data access. | Implemented | +| SEC-AZN-002 | Thread/bot access shall resolve through ownership/membership, not unguessable-but-unchecked IDs alone. | Implemented | +| SEC-AZN-003 | Prompt text is not an access-control mechanism. Enforcement is capability, connector, credential, policy, and tool-gate layers. | Implemented | +| SEC-AZN-004 | Trusted host tools that affect the machine shall ASK by default. | Implemented | + +## 5. Cryptography and secrets + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-CRY-001 | `ENCRYPTION_KEY` (64 hex) protects stored credentials; rotation must consider existing ciphertext. | Implemented | +| SEC-CRY-002 | `BETTER_AUTH_SECRET`, `SANDBOX_SUPERVISOR_TOKEN`, and `SCREEN_PROXY_SECRET` shall be distinct. | Implemented | +| SEC-CRY-003 | Supervisor API shall require a bearer token; default bind is loopback. | Implemented | +| SEC-CRY-004 | Screen URLs shall use a signed capability proxy so vendor desktop secrets are not exposed in the browser. | Implemented | +| SEC-CRY-005 | Connector credentials shall not appear in capability config, fixtures, logs, or snapshots. | Implemented | + +## 6. Sandbox and host + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-SND-001 | The API shall not receive an unrestricted Docker socket; the supervisor owns lifecycle. | Implemented | +| SEC-SND-002 | Path containment shall apply inside sandboxes; Windows host containment uses Win32 handle identity (see architecture.md). | Implemented | +| SEC-SND-003 | `desktop` provider is trusted host execution, experimental, owner-only. | Implemented | +| SEC-SND-004 | Production Compose shall drop capabilities, prevent new privileges, and keep Postgres off the public interface. | Implemented | + +## 7. Privacy and data minimisation + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-PRI-001 | Transcripts, memory, files, audit events, and locally managed credentials stay in the operator’s PostgreSQL and `DATA_DIR` unless an optional provider is enabled. | Implemented | +| SEC-PRI-002 | Optional providers receive only what architecture.md lists for that key. | Implemented | +| SEC-PRI-003 | PostHog, when configured, shall carry anonymous product metadata only. | Implemented | +| SEC-PRI-004 | Run logs shall not include prompts, tool arguments, message text, or stack traces. | Implemented | +| SEC-PRI-005 | Conversation content shall not be used to train Sentra-owned models (product policy; legal draft). | Specified | +| SEC-PRI-006 | PHI/PII shall not appear in logs, analytics, or URLs. | Specified (engineering rule; operator still responsible for what they paste into threads) | + +## 8. Clinical boundary + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-CLN-001 | This baseline shall not provide a write path to a patient record or hospital EMR. | Implemented (no such adapter) | +| SEC-CLN-002 | Documentation shall not claim a shipped RME reconnaissance adapter unless code exists. | Implemented by this package (README corrected) | +| SEC-CLN-003 | Future clinical adapters, if approved, start read-only, one-patient, manual login, no stored clinical credentials. | Planned (doctrine) | + +## 9. Supply chain + +| ID | Requirement | Status | +| --- | --- | --- | +| SEC-SUP-001 | UI components shall not be installed from the live shadcn registry (`AGENTS.md`). | Implemented (process) | +| SEC-SUP-002 | Lockfile (`pnpm-lock.yaml`) is committed; CI uses `--frozen-lockfile`. | Implemented | + +## 10. Legal drafts + +Privacy and terms under `docs/legal/` are **drafts**. They must not be treated as in-force until counsel review. Public site HTML is a publication surface, not a substitute for that review. diff --git a/docs/requirements/09-interface-and-data-requirements.md b/docs/requirements/09-interface-and-data-requirements.md new file mode 100644 index 0000000..5ca127c --- /dev/null +++ b/docs/requirements/09-interface-and-data-requirements.md @@ -0,0 +1,110 @@ +# Interface and data requirements + +**Document ID:** SENTRA-BOT-IRS-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standards:** ISO/IEC/IEEE 29148 (interface requirements); document-relational data design as implemented in Prisma + +## 1. External interfaces + +### 1.1 Client ↔ API + +| Interface | Protocol | Notes | +| --- | --- | --- | +| Auth | HTTP ` /api/auth/* ` | Better Auth | +| Commands | HTTP oRPC `/rpc/*` | Contract: `packages/contracts/src/rpc.ts` | +| Events | oRPC event iterator SSE `threads.subscribe` | Resume by `seq` | +| Health | `GET /health` | `{ ok: true, version }` plus sandbox/revision fields as implemented | +| Screen proxy | Signed capability URLs | `SCREEN_PROXY_SECRET` | + +### 1.2 API/worker ↔ Postgres + +Prisma client. Application URL may be pooled (`DATABASE_URL`); migrations use `DIRECT_URL` on 5432. PgBouncer is not the migration surface. + +### 1.3 Worker ↔ job queue + +Graphile Worker in Postgres (`WAKEUP_DRIVER=graphile`). In-memory driver is test-only. + +### 1.4 Supervisor + +Sandbox supervisor HTTP API (default `127.0.0.1:7091`) with bearer token. Owns the Docker socket. + +### 1.5 Optional provider interfaces + +Enablement is “key present” unless noted. Data leaving the deployment is listed in `docs/architecture.md` § Optional remote providers. + +| Provider | Env / setting | Data sent | +| --- | --- | --- | +| Model APIs | `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`, user BYOK | Prompts, tool results, memory context | +| Managed AI | `OPENAI_API_KEY` + budget micros | Same, via deployment key | +| E2B / Daytona / Box | respective keys | Workspace, files, screenshots, commands | +| Composio / Pipedream | respective keys | OAuth, tool args/results | +| Supermemory | `SUPERMEMORY_API_KEY` | Memory documents | +| SendBlue / WhatsApp | complete key sets | Phone numbers, bodies, media | +| Xendit | `XENDIT_API_KEY` | Billing references and amounts | +| PostHog | `PUBLIC_POSTHOG_*` | Anonymous product metadata | +| SMTP / VAPID | optional | Email / web push | + +### 1.6 Experimental relay + +`/v1/relay/events` mounts only when `SENTRABOT_CONTROL_PLANE_RELAY=enabled`. No golden-path client consumes it. The `/v1/events` alias was removed. + +### 1.7 Desktop and mobile configuration + +| Variable | Consumer | +| --- | --- | +| `SENTRABOT_WEB_URL` | Electron (tests/overrides) | +| `EXPO_PUBLIC_API_URL` | Mobile production builds | + +There is no `RAKAZO_WEB_URL` in this repository. + +## 2. User interface requirements + +| ID | Requirement | Status | +| --- | --- | --- | +| IRS-UI-001 | Web is the canonical UI; Electron hosts it; mobile is a native client of the same RPC. | Implemented | +| IRS-UI-002 | Marketing site (`apps/site`) is not the signed-in product. | Implemented | +| IRS-UI-003 | Public docs (`apps/docs`) publish only user-safe pages; internal plans stay in `docs/`. | Implemented | + +## 3. Data requirements + +### 3.1 System of record + +| Store | Contents | +| --- | --- | +| PostgreSQL | Users, sessions, workspaces, bots, threads, messages, events, runs, routines, computers, leases, artifacts metadata, secrets ciphertext, credentials, connections, usage, subscriptions, platform devices | +| `DATA_DIR` | Agent homes, browser profiles, artifacts bytes, push material as implemented | +| Sandbox disk | Ephemeral; not the source of truth | + +### 3.2 Core entities (logical) + +Mapped from `packages/db/prisma/schema.prisma` (not exhaustive): + +- Identity: `User`, `Session`, `Account`, `Verification` +- Tenancy: `Organization`, `Member`, `Invitation` +- Product: `Bot`, `ChatGroup`, `Thread`, `Event`, `Run`, `Task`, `Routine`, `ScratchpadItem` +- Authority: `ActionApprovalRule`, `ExternalEffect`, `ActionAutoReviewPreference` +- Compute: `Computer`, execution leases +- Knowledge: `MemoryDocument`, `TaughtSkill`, `AgentSkill`, `Artifact` +- Integrations: `Connection`, `CapabilityInstall`, `McpServer`, `Secret` +- Platform (experimental hybrid): `Device`, `Runtime`, `KeyEnvelope` +- Billing: `Subscription`, `PaymentEvent`, `UsageReservation`, `UsageLedger` + +### 3.3 Data rules + +| ID | Requirement | Status | +| --- | --- | --- | +| DRS-001 | Documents remain relatively flat; relationships use IDs (no unbounded nested arrays as source of truth). | Implemented | +| DRS-002 | Foreign keys used in queries shall have indexes (Prisma schema). | Implemented | +| DRS-003 | Event ordering per thread is `seq` (integer), not wall-clock in queries. | Implemented | +| DRS-004 | Queries shall not use `Date.now()` internally (Convex-style rule does not apply here; still, API query handlers that need “now” take it from the request or worker clock, not cached query identity). Postgres worker/reconciler may use server time. | N/A to Convex; workers use real time by design | +| DRS-005 | `outbox_events.sentAt` is unused (no drain). Rows may accumulate. | Experimental debt | +| DRS-006 | Plan-limit enforcement must not delete bots, files, or memory; pause or archive. | Specified | + +### 3.4 Retention and export + +| ID | Requirement | Status | +| --- | --- | --- | +| DRS-007 | Bot export exists (`export.bot`). | Implemented | +| DRS-008 | Operator backup/restore covers database and documented file paths. | Implemented | +| DRS-009 | Account deletion for store review is an operator/process requirement for mobile submission (`docs/mobile-release.md`). | Specified | diff --git a/docs/requirements/10-requirements-traceability-matrix.md b/docs/requirements/10-requirements-traceability-matrix.md new file mode 100644 index 0000000..f74764c --- /dev/null +++ b/docs/requirements/10-requirements-traceability-matrix.md @@ -0,0 +1,53 @@ +# Requirements traceability matrix + +**Document ID:** SENTRA-BOT-RTM-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC/IEEE 29148 (traceability) + +Columns: stakeholder → software/NFR/SEC → use case → primary evidence in the repository. + +| Stakeholder | Requirement | Use case | Evidence | +| --- | --- | --- | --- | +| StR-001 | FR-SYS-006, FR-CMP-002 | UC-01 | `.env.example`, Compose files | +| StR-002 | FR-RUN-005, FR-RUN-006, SEC-AZN-003 | UC-03 | executor, Ask cards, `external_effects` | +| StR-003 | FR-AUTH-002 | UC-01 | onboarding / self-host.md | +| StR-004 | FR-MDL-001, FR-MDL-003 | UC-02 | `models.*` | +| StR-005 | FR-MEM-001, FR-CMP-004 | UC-04 | memory package, `DATA_DIR` | +| StR-006 | FR-RTN-001 | UC-06 | `routines.*` | +| StR-007 | FR-CMP-005, FR-CMP-006 | UC-05 | `computer.*` | +| StR-008 | FR-CLI-001–004, NFR-MNT-001 | UC-01 | `packages/contracts`, clients | +| StR-009 | FR-PHN-001, FR-PHN-002 | UC-07 | `phone.whatsapp.*` | +| StR-010 | FR-BIL-001, FR-BIL-004 | UC-11 | `platform-policy.ts`, paket-free-batas-v1.md | +| StR-011 | SEC-CLN-001, FR-NX-001 | — | no EMR write adapter in repo | +| StR-012 | SEC-DIS-001 | UC-12 | `SECURITY.md` | +| StR-013 | SEC-PRI-003 | — | optional PostHog | +| StR-014 | FR-PHN-003 | UC-07 | `PHONE_LOCALE` | +| StR-015 | FR-BOT-006 | UC-01 | `packages/bot-templates` (66) | +| — | FR-SYS-001–007 | UC-01, UC-02 | architecture.md, api, worker | +| — | FR-AUTH-001–006 | UC-01 | auth package | +| — | FR-BOT-001–007 | UC-01 | `bots.*`, `groups.*` | +| — | FR-THR-001–006 | UC-02 | `threads.*`, `search.query` | +| — | FR-RUN-001–008 | UC-02, UC-03 | `run-state.ts`, executor | +| — | FR-CMP-001–009 | UC-04, UC-05, UC-09 | computer-runtime.md | +| — | FR-MEM-*, FR-SKL-*, FR-RTN-* | UC-06 | rpc.ts | +| — | FR-INT-001–003 | UC-08 | connections, mcp | +| — | FR-VOI-001 | — | `voice.*` | +| — | FR-OPS-001–003 | UC-10 | updater, scripts | +| — | FR-NX-002–004 | — | this package, architecture decision log | +| — | NFR-REL-001 | UC-02 | graphile-restart tests | +| — | NFR-SEC-001–003 | UC-01 | gitignore, Compose | +| — | SEC-CRY-001–005 | UC-04, UC-08 | self-host.md | +| — | SEC-SND-001–004 | UC-04, UC-09 | supervisor, architecture.md | +| — | IRS-UI-001–003 | UC-01 | apps/* | +| — | DRS-001–009 | — | schema.prisma, export.bot | + +## Coverage notes + +- Every StR maps to at least one SRS/SEC item. +- Planned items (WhatsApp group agent, clinical read adapter) are **not** in this matrix as Implemented. +- Experimental hybrid relay is traced only as FR-NX-003 / DRS-005. + +## Maintenance + +Update this matrix in the same change as any new FR/NFR/SEC ID. Do not add IDs only in the SRS. diff --git a/docs/requirements/11-verification-and-validation.md b/docs/requirements/11-verification-and-validation.md new file mode 100644 index 0000000..8b12692 --- /dev/null +++ b/docs/requirements/11-verification-and-validation.md @@ -0,0 +1,73 @@ +# Verification and validation plan + +**Document ID:** SENTRA-BOT-VV-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Standard:** ISO/IEC/IEEE 29148 (verification provisions); ISO/IEC/IEEE 12207 (verification and validation processes) + +## 1. Purpose + +Define how Sentra Bot demonstrates that implemented behaviour matches this requirements package (verification) and that the product is usable for the charter success criteria (validation). + +## 2. Principles + +- Default tests are **deterministic and offline**. +- Live vendor canaries are **not** pull-request gates. +- The product path is Pi + Docker + Graphile. Emulators are for tests. + +## 3. Verification levels + +| Level | Command | What it proves | PR CI | +| --- | --- | --- | --- | +| Static | `pnpm lint` | Biome lint/format | Yes | +| Types | `pnpm check` | TypeScript across the workspace | Yes | +| Build | `pnpm build` + Electron preload smoke | Production compile | Yes | +| Unit | `pnpm test` | Domain, contracts, adapters with fakes | Yes | +| Integration | `pnpm test:integration` | Postgres Testcontainers journeys, authz, Graphile, LISTEN/NOTIFY | Yes | +| E2E | `pnpm test:e2e` | Playwright vs emulated API | Yes | +| Topology | `pnpm test:topology` | Docker computer + worker recovery | No | +| Canary | `pnpm test:canary` | Live OpenRouter / E2B | No | +| Computer vision | `pnpm test:computer` | Real vision model + E2B | No | +| Performance | `pnpm perf:desktop` | Packaged renderer metrics | No | +| Nightly | `.github/workflows/nightly-verification.yml` | Longer path | Scheduled | + +CI workflow: `.github/workflows/ci.yml`. + +## 4. Requirement-to-method mapping (summary) + +| Class | Method | +| --- | --- | +| FR-SYS, FR-AUTH, FR-BOT, FR-THR, FR-RUN | Unit + integration journeys (`packages/testkit`) | +| FR-CMP | Provider conformance tests + topology/computer e2e | +| FR-INT | Offline fakes; never live OAuth in PR CI | +| FR-PHN | Unit/contract; live WhatsApp out of CI | +| FR-BIL | `platform-policy` unit tests; commercial numbers reviewed against product doc | +| NFR-REL-001 | `packages/adapters/src/graphile-restart.postgres.test.ts` | +| SEC-* | Code review, architecture decision log, absence tests where applicable | + +## 5. Validation (human) + +Charter success criteria (CHAR-001 §7) are validated by an operator or agent following `SETUP_PROMPT.md` and `docs/self-host.md`: + +1. Health endpoint ok with expected sandbox provider. +2. Signup and first-run. +3. Harmless test message if a model is connected. +4. Computer pane reaches `running` on Docker path. + +UI changes that affect layout or client state require exercising the flow in a browser (project rule), not a screenshot only. + +## 6. Independence + +There is no separate independent V&V organisation. Independence is approximated by: + +- CI on every PR; +- architecture decision log with evidence; +- this requirements package as a baseline distinct from implementation plans. + +## 7. Exit criteria for a change + +A requirements-affecting change is verified when: + +1. Automated PR jobs listed above pass; +2. New behaviour has a test or an explicit reason it cannot (live vendor); +3. RTM and SRS status codes are updated if the world changed. diff --git a/docs/requirements/12-glossary.md b/docs/requirements/12-glossary.md new file mode 100644 index 0000000..1b92b70 --- /dev/null +++ b/docs/requirements/12-glossary.md @@ -0,0 +1,36 @@ +# Glossary + +**Document ID:** SENTRA-BOT-GLO-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 + +| Term | Definition | +| --- | --- | +| **Sentra Bot** | The product in this repository: persistent-agent runtime and clients. | +| **Sentra Artificial Intelligence** | Programme / ecosystem brand (sentrahai.com). | +| **PT Adianda Putri Iskandar** | Legal entity. | +| **Owner** | First registered user; controls deployment settings, trusted host, updater. | +| **Workspace** | Prisma `Organization`; tenancy boundary for bots, threads, secrets. | +| **Bot** | Persistent agent with memory, computer mode, routines, and a thread. | +| **Group** | Shared thread across multiple bots. | +| **Run** | One execution attempt of the agent runtime, with fenced lease. | +| **Ask** | Human approval stop (`waiting_input`) for a gated tool. | +| **Computer / sandbox** | Execution surface implementing `SandboxProvider`. | +| **Team computer** | Shared machine; bots have folders, not security isolation from each other. | +| **Private computer** | Computer whose workspace is that bot’s home. | +| **DATA_DIR** | Durable file root owned by the deployment. | +| **Pi runtime** | Production agent runtime (`AGENT_RUNTIME=pi`). | +| **Scripted runtime** | Test-only agent runtime. | +| **Graphile** | Postgres job queue used in the product path. | +| **oRPC** | Typed RPC layer (`/rpc/*`). | +| **seq** | Monotonic event cursor per thread. | +| **BYOK** | Bring your own model key; calls do not use Sentra’s managed key. | +| **Managed AI** | Deployment-provided model access under fair-use / budget routing. | +| **Capability** | Installed skill, plugin, MCP, or API source. | +| **External effect** | Durable record of a consequential tool intent/result. | +| **Fence** | Monotonic lease generation preventing stale workers from committing. | +| **Hybrid control plane** | Experimental device/runtime/E2EE relay work; frozen, off by default. | +| **Rakazo** | Upstream Apache-2.0 project; provenance retained in `NOTICE`. | +| **`@sentrabot/*`** | Canonical package namespace in this repository. | +| **RME** | Rekam medis elektronik (EMR). Not implemented as an adapter here. | +| **Pause not delete** | Entitlement rule when plan limits are exceeded. | diff --git a/docs/requirements/13-risk-register.md b/docs/requirements/13-risk-register.md new file mode 100644 index 0000000..2b0d991 --- /dev/null +++ b/docs/requirements/13-risk-register.md @@ -0,0 +1,26 @@ +# Requirements and delivery risk register + +**Document ID:** SENTRA-BOT-RSK-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 +**Method:** qualitative likelihood × impact (Low / Medium / High) + +| ID | Risk | L | I | Mitigation | Status | +| --- | --- | --- | --- | --- | --- | +| R-01 | Secrets committed to the public repository | L | H | gitignore, review rule in AGENTS.md, no force-add | Open (process) | +| R-02 | Sandbox escape or Docker socket exposure | M | H | Supervisor owns socket; production hardening docs | Open | +| R-03 | Trusted host (`this-mac`) treated as isolated | M | H | Owner-only, ASK on host tools, architecture warnings | Open | +| R-04 | Optional vendor outage (model, E2B, WhatsApp) | H | M | Core runs without those keys; degrade honestly | Open | +| R-05 | Overstated clinical / RME claims | M | H | SRS FR-NX-002; README doctrine without shipped-adapter claim | Mitigated in this baseline | +| R-06 | Legal drafts published as binding terms | M | H | Draft banners in `docs/legal/*`; counsel review required | Open | +| R-07 | Two control planes (API vs hybrid relay) | M | M | Relay off by default; frozen until golden path passes | Mitigated | +| R-08 | `outbox_events` unbounded growth | L | L | Documented debt; local-only until hybrid resumes | Open | +| R-09 | Plan limits specified but UX pause states incomplete | M | M | `freePlanLimits` in code; client pause UX to verify when billing ships | Open | +| R-10 | Marketing catalog vs 66 role templates mismatch | M | M | Vision doc states shipped catalog; legal about-doc flags it | Open | +| R-11 | Supply-chain install from live component registries | L | H | AGENTS.md forbids `shadcn add` from live registry | Open (process) | +| R-12 | PHI pasted into threads and sent to a model provider | H | H | Policy + BYOK warning; cannot prevent operator paste | Open | +| R-13 | WhatsApp 24h template window drops routine notifies | M | M | Documented `WHATSAPP_TEMPLATE_*`; still lands in web thread | Mitigated | +| R-14 | Arm64 hosts pulling amd64-only `edge` computer image | M | M | self-host.md tag guidance | Open | +| R-15 | Maintainer contact still pointing at upstream Rakazo personal mail | H | L | Removed `elie@sentrabot.com` from project files in this baseline | Mitigated | + +Likelihood and impact are engineering judgements, not a quantitative risk model. diff --git a/docs/requirements/14-assumptions-constraints-dependencies.md b/docs/requirements/14-assumptions-constraints-dependencies.md new file mode 100644 index 0000000..62de8c1 --- /dev/null +++ b/docs/requirements/14-assumptions-constraints-dependencies.md @@ -0,0 +1,54 @@ +# Assumptions, constraints, and dependencies + +**Document ID:** SENTRA-BOT-ACD-001 +**Version:** 1.0 +**Effective date:** 2026-09-03 + +## 1. Assumptions + +| ID | Assumption | If false | +| --- | --- | --- | +| A-01 | Operators can run Docker or a supported sandbox provider. | Computer features degrade; `SANDBOX_PROVIDER=none` / `fake`. | +| A-02 | A model endpoint (local or remote) will be connected before expecting answers. | UI and API still run; bots cannot usefully reply. | +| A-03 | PostgreSQL 16 is available (Compose or hosted). | Product does not run. | +| A-04 | The public repository remains Apache-2.0 and secret-free. | Release process stops. | +| A-05 | Indonesian is the default locale for phone-channel *system* copy, not a hard constraint on agent language. | Set `PHONE_LOCALE`. | +| A-06 | Counsel will review legal drafts before they are treated as contracts. | Keep draft banners. | +| A-07 | Hybrid control plane is not required for v0.1 operator success. | Do not enable the relay in production. | + +## 2. Constraints + +| ID | Constraint | +| --- | --- | +| C-01 | Public git: no secrets, `.env`, private URLs, personal/customer or production data. | +| C-02 | No hosted vendor required for core. | +| C-03 | Node/pnpm/engine versions in root `package.json`. | +| C-04 | Prisma migrations use `DIRECT_URL`, not a pooled connection. | +| C-05 | Tests default offline; live keys are canary-only. | +| C-06 | Clinical write is forbidden in this baseline. | +| C-07 | Customer copy must not promise token counts. | +| C-08 | `apps/site` is a standalone-ish Vite app (`name: cora`) deployed with npm on Vercel; it is not the API. | +| C-09 | Package namespace is `@sentrabot/*`. Historical `@rakazo/*` does not exist in this capsule. | + +## 3. Dependencies + +| ID | Dependency | Type | Required to boot core? | +| --- | --- | --- | --- | +| D-01 | PostgreSQL 16 | Data | Yes | +| D-02 | Node.js 22+ and pnpm 9.15 | Build | Yes (source path) | +| D-03 | Docker Engine + Compose | Computers / images path | For Docker computers and published-image install | +| D-04 | Pi agent runtime | Execution | Yes for product path | +| D-05 | Graphile Worker | Jobs | Yes for product path | +| D-06 | Better Auth | Identity | Yes | +| D-07 | OpenRouter / Anthropic / other models | Optional | No | +| D-08 | E2B / Daytona / Box | Optional computers | No | +| D-09 | Composio / Pipedream | Optional integrations | No | +| D-10 | WhatsApp Cloud API / SendBlue | Optional phone | No | +| D-11 | Xendit | Optional billing | No | +| D-12 | Supermemory | Optional memory | No | +| D-13 | Expo / EAS / app stores | Mobile distribution | No for self-host web | +| D-14 | Rakazo upstream (license) | Legal provenance | Attribution only | + +## 4. Environment variables (normative pointer) + +The authoritative list is `.env.example`. Requirements shall not duplicate every key. Material groups: database, auth, encryption, `DATA_DIR`, sandbox, runtime/jobs, model, optional providers, phone, observability, image tags. diff --git a/docs/requirements/README.md b/docs/requirements/README.md new file mode 100644 index 0000000..ebcf89d --- /dev/null +++ b/docs/requirements/README.md @@ -0,0 +1,50 @@ +# Sentra Bot — Requirements package + +**Document ID:** SENTRA-BOT-REQ-PKG-001 +**Standard:** ISO/IEC/IEEE 29148:2018 (Requirements engineering) +**Related:** ISO/IEC/IEEE 12207:2017 (software life cycle), ISO/IEC 25010:2023 (quality), ISO/IEC 27001:2022 (information security), OWASP ASVS v5.0 +**Status:** Baseline, as-built 2026-09-03 +**Classification:** Internal engineering baseline (not published to Mintlify) +**Language:** English + +This package is the controlled requirements set for Sentra Bot. It describes the product as implemented in this repository, and it labels planned, experimental, and out-of-scope items explicitly. It does not invent features that are not in the code or in a locked product decision. + +## How to use this package + +1. Read [00-document-control.md](00-document-control.md) for ownership, status codes, and change control. +2. Read [01-project-charter.md](01-project-charter.md) and [02-vision-and-scope.md](02-vision-and-scope.md) for why the product exists. +3. Use [04-software-requirements-specification.md](04-software-requirements-specification.md) as the functional baseline. +4. Trace any change through [10-requirements-traceability-matrix.md](10-requirements-traceability-matrix.md). + +When this package and a plan under `docs/superpowers/` disagree, **this package plus `docs/architecture.md` win** unless the Chief records a new decision. + +## Document set + +| ID | File | ISO / professional equivalent | +| --- | --- | --- | +| DOC-001 | [00-document-control.md](00-document-control.md) | Document control, master list | +| CHAR-001 | [01-project-charter.md](01-project-charter.md) | Project charter | +| VIS-001 | [02-vision-and-scope.md](02-vision-and-scope.md) | Vision and scope | +| StRS-001 | [03-stakeholder-requirements.md](03-stakeholder-requirements.md) | Stakeholder requirements specification | +| SRS-001 | [04-software-requirements-specification.md](04-software-requirements-specification.md) | Software requirements specification (IEEE 29148) | +| PRD-001 | [05-product-requirements.md](05-product-requirements.md) | Product requirements document | +| UCS-001 | [06-use-cases.md](06-use-cases.md) | Use-case specification | +| NFR-001 | [07-non-functional-requirements.md](07-non-functional-requirements.md) | Quality / NFR specification (ISO 25010) | +| SEC-001 | [08-security-and-privacy-requirements.md](08-security-and-privacy-requirements.md) | Security and privacy requirements | +| IRS-001 | [09-interface-and-data-requirements.md](09-interface-and-data-requirements.md) | Interface and data requirements | +| RTM-001 | [10-requirements-traceability-matrix.md](10-requirements-traceability-matrix.md) | Requirements traceability matrix | +| VV-001 | [11-verification-and-validation.md](11-verification-and-validation.md) | Verification and validation plan | +| GLO-001 | [12-glossary.md](12-glossary.md) | Glossary | +| RSK-001 | [13-risk-register.md](13-risk-register.md) | Requirements and delivery risk register | +| ACD-001 | [14-assumptions-constraints-dependencies.md](14-assumptions-constraints-dependencies.md) | Assumptions, constraints, dependencies | + +## Status codes used in requirement IDs + +| Code | Meaning | +| --- | --- | +| **Implemented** | Present in this repository and covered by code, tests, or operator docs | +| **Partial** | Core path exists; limits, packaging, or a client surface are incomplete | +| **Experimental** | Code exists but is frozen or off by default | +| **Specified** | Locked product decision; enforcement or UX may still be incomplete | +| **Planned** | Accepted direction; not the current golden path | +| **Out of scope** | Explicitly excluded from this baseline | diff --git a/docs/superpowers/plans/2026-09-02-convergence-directive.md b/docs/superpowers/plans/2026-09-02-convergence-directive.md index ee24fc1..5cff41d 100644 --- a/docs/superpowers/plans/2026-09-02-convergence-directive.md +++ b/docs/superpowers/plans/2026-09-02-convergence-directive.md @@ -8,7 +8,7 @@ **Tech Stack:** TypeScript strict, Hono, oRPC, Better Auth, Prisma/PostgreSQL, Graphile Worker, Vitest, Playwright, testcontainers (integration harness). -**Governing document:** `docs/plans/CLAUDE CODE — SENTRABOT CONVERGENCE DIRECTIVE.md` +**Governing documents:** [`docs/architecture.md`](../../architecture.md) (as-built topology) and [`docs/requirements/`](../../requirements/) (requirements baseline). The 2026-09-01 file `docs/plans/CLAUDE CODE — SENTRABOT CONVERGENCE DIRECTIVE.md` is historical. ## Global Constraints