shraga 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,23 +9,24 @@
9
9
 
10
10
  </div>
11
11
 
12
- Shraga is a self-hostable, multi-user web UI for running an AI coding agent (Claude Code out of
13
- the box, with a pluggable engine seam for other runtimes) that you can reach from anywhere: your
12
+ Shraga is a self-hostable, multi-user agent harness that joins your team as a teammate (Claude Code
13
+ out of the box, with a pluggable engine seam for other runtimes), reachable from anywhere: your
14
14
  laptop, a home server, or a VM.
15
15
 
16
16
  Give it its own machine, its own keys, its own identity. Onboard it once, then delegate.
17
17
 
18
18
  ## Why Shraga
19
19
 
20
- - ⭐ **Runs on your Claude subscription, not a metered API key.** Point it at Claude Code and it
21
- drives the agent through your exsiting plan (`claude auth login`). No per-token bill to watch.
20
+ - ⭐ **Runs on your Claude subscription, or via an API key.** Point it at Claude Code and it
21
+ drives the agent through your exsiting plan (`claude auth login`), or set `ANTHROPIC_API_KEY` to
22
+ pay per token if you prefer.
22
23
  - ⭐ **A real teammate, not a chat box.** It has its own machine, its own identity, and its own
23
24
  logins, so you delegate a task the way you would to a person and come back to the result.
24
25
  - ⭐ **Multi-user by design.** One Shraga serves a whole team, each with their own sessions,
25
26
  tools, and permissions.
26
27
  - ⭐ **A shared brain that compounds.** It onboards, learns your codebase and conventions, and
27
28
  carries that knowledge forward via skills and sessions. The full org-wide capture is the
28
- north star ([the shared brain](./docs/shared-brain.md)) it opens in stages.
29
+ north star ([the shared brain](./docs/shared-brain.md)); it opens in stages.
29
30
  - **Chat with an agent** that has your workspace, shell, and tools.
30
31
  - **Sessions** you can fork, resume, and revisit.
31
32
  - **Skills**: reusable procedures you teach it once (files in `data/skills/`).
@@ -35,39 +36,39 @@ Give it its own machine, its own keys, its own identity. Onboard it once, then d
35
36
 
36
37
  ## What's in the box
37
38
 
38
- Shraga ships as a small core (this repo, the `shraga` npm package — "CE") plus two ways to grow it.
39
- Capabilities fall into three tiers:
39
+ Shraga is a small core (this repo, the `shraga` npm package) plus two ways to grow it. Capabilities
40
+ fall into three groups:
40
41
 
41
- - **Built-in** ships and runs in CE. Nothing to install; some need credentials configured.
42
- - **Optional overlay** — an external add-on module loaded at startup via `SHRAGA_OVERLAY`. Not in
43
- this repo; you bring or build it.
44
- - **Bring-your-own** you extend the core yourself through its seams (MCP, engine, skills, features).
42
+ - **Built-in**: ships in this repo and runs out of the box. Nothing to install; some need
43
+ credentials configured.
44
+ - **Optional add-on**: an external module the core loads at startup when you set `SHRAGA_OVERLAY`
45
+ to point at it. These live outside this repo and attach through the same seams the built-ins use.
46
+ - **Bring-your-own**: you extend the core yourself through its seams (MCP, engine, skills, features).
45
47
 
46
- ### Built-in (ships in CE)
48
+ ### Built-in
47
49
 
48
50
  | Capability | What you get | Setup |
49
51
  |-----------|--------------|-------|
50
52
  | **Agent chat & sessions** | Chat with an agent that has your workspace, shell, and tools; fork, resume, and revisit sessions. | none |
51
- | **Slack** | The agent is **active on Slack** it replies in threads, manages reactions, handles uploaded files, resolves `@mentions`, and runs polls. Via the public [`mcp-slack-use`](https://github.com/Livshitz/mcp-slack-use) package. | Slack app + tokens |
53
+ | **Slack** | The agent is **active on Slack**: it replies in threads, manages reactions, handles uploaded files, resolves `@mentions`, and runs polls. Via the public [`mcp-slack-use`](https://github.com/Livshitz/mcp-slack-use) package. | Slack app + tokens |
52
54
  | **Scheduler** | Cron schedules and event-triggered tasks that run agent jobs unattended. | none |
53
55
  | **Events** | Generic event-bus ingress (`POST /api/events/:source`) that fires matching schedules. | none |
54
56
  | **Push notifications** | Web and native push. | none |
55
- | **Artifacts** | Render HTML artifacts from a session. (PNG export is overlay-only see below.) | none |
56
- | **MCP both directions** | *Consume* external MCP servers to give the agent tools, **and** *expose* Shraga itself as an MCP endpoint (`POST /mcp`) so claude.ai and other clients can drive it. | per-server config |
57
+ | **Artifacts** | Render HTML artifacts from a session. (PNG export is an optional add-on, see below.) | none |
58
+ | **MCP (both directions)** | *Consume* external MCP servers to give the agent tools, **and** *expose* Shraga itself as an MCP endpoint (`POST /mcp`) so claude.ai and other clients can drive it. | per-server config |
57
59
  | **Engine seam** | Pluggable agent runtime. Claude Code is the built-in engine. | none |
58
60
  | **Auth** | Local username/password by default; Firebase optional (`AUTH_PROVIDER=firebase`). | none / Firebase config |
59
61
  | **CLI** | `shraga` server bin plus `shraga user add <email> <password>` to seed a local user. | none |
60
62
 
61
- ### Optional overlay (add-on module, not in CE)
63
+ ### Optional add-ons (plug in an external module)
62
64
 
63
- Loaded only when you point `SHRAGA_OVERLAY` at an external module. **None of these ship in this
64
- repo** a bare self-host does not get them out of the box:
65
+ Loaded only when you point `SHRAGA_OVERLAY` at an external module. **None of these ship in
66
+ this repo**, so a bare self-host does not get them out of the box:
65
67
 
66
68
  | Capability | Notes |
67
69
  |-----------|-------|
68
- | **Email / Gmail** | Inbound email agent sessions. **Not built-in** overlay only. |
70
+ | **Email / Gmail** | Inbound email to agent sessions. **Not built-in** (add-on only). |
69
71
  | **GitHub bot** | Issues/PRs → agent sessions with GH-native trust tiers. |
70
- | **Voice** | Voice input/output. |
71
72
  | **Fleet / multi-instance** | Blue-green and multi-instance orchestration. |
72
73
  | **PNG artifact export** | Puppeteer-rendered PNGs of artifacts. |
73
74
 
@@ -84,13 +85,13 @@ The core is deliberately small and grows through documented seams (see
84
85
  | **Server features** (`src/server/features.ts`) | Mount new server-side surfaces via `registerFeature`. |
85
86
  | **Client slots** (`src/client/lib/slots.tsx`) | Inject UI into typed render slots without touching core. |
86
87
  | **Route extensions** (`data/extensions/*.ext.ts`) | Drop-in public routes (webhooks, OAuth callbacks) per deployment. |
87
- | **`SHRAGA_OVERLAY`** | Load a whole external add-on module at startup (the overlay tier above). |
88
+ | **`SHRAGA_OVERLAY`** | Load a whole external add-on module at startup (the optional add-ons above). |
88
89
 
89
90
  ## Use as a library
90
91
 
91
92
  Shraga's first-class surface is the `createShraga` factory (the package `main`/`exports`). You
92
93
  `import` it, wire your registrations against the same seams the built-ins use, then own the
93
- lifecycle `start()` returns a handle you can `stop()`. The CLI and the run-from-source entry are
94
+ lifecycle. `start()` returns a handle you can `stop()`. The CLI and the run-from-source entry are
94
95
  thin wrappers over this exact call (`createShraga(fromEnv()).start()`).
95
96
 
96
97
  ```ts
@@ -129,18 +130,34 @@ registerExtension, registerWebhook, stop }`.
129
130
 
130
131
  **Runtime plug-and-play is opt-in.** `registerFeature`/`registerEngine`/`registerExtension`/
131
132
  `registerWebhook`/`on` are meant to run **before** `start()`. If you need to register *after* boot,
132
- set `runtimeRegistration: true` (or `SHRAGA_RUNTIME_REGISTRATION=1`) then the `ServerHandle`'s
133
+ set `runtimeRegistration: true` (or `SHRAGA_RUNTIME_REGISTRATION=1`), and then the `ServerHandle`'s
133
134
  `registerExtension`/`registerWebhook`/`on` mount onto the live extension Router / event bus.
134
135
  Default is **off**, and those handle methods throw until you enable it. Only extensions, webhooks
135
- and event subscriptions are runtime-registerable features and engines mount at boot and are never
136
+ and event subscriptions are runtime-registerable; features and engines mount at boot and are never
136
137
  runtime-registerable, on or off.
137
138
 
139
+ ## Spin one up with your coding agent
140
+
141
+ Hand this to Claude Code (or Cursor, Codex, any coding agent) and let it stand up your instance:
142
+
143
+ ```text
144
+ Set up a self-hosted Shraga instance for me (https://github.com/Livshitz/shraga).
145
+ - Runtime is Bun. Simplest run: `bunx shraga` (serves on :3032, state in ./data).
146
+ - To customize/extend, scaffold a tiny Bun app that depends on `shraga` and does:
147
+ import { createShraga } from 'shraga';
148
+ await createShraga({ port: 3032, authProvider: 'local' }).start();
149
+ Register any features/webhooks/engines before .start() (see the "Use as a library" section).
150
+ - Auth: run `claude auth login` to use my Claude subscription, or set ANTHROPIC_API_KEY.
151
+ - Create my first account (`shraga user add <email> <password>`), then tell me the URL to open.
152
+ Read the README + AGENTS.md for the seams before adding anything custom.
153
+ ```
154
+
138
155
  ## Quickstart (CLI)
139
156
 
140
- Requires [Bun](https://bun.sh) ≥ 1.0. Env-configured, no code this is the `createShraga(fromEnv())`
157
+ Requires [Bun](https://bun.sh) ≥ 1.0. Env-configured, no code; this is the `createShraga(fromEnv())`
141
158
  tier.
142
159
 
143
- **Fastest run from npm:**
160
+ **Fastest, run from npm:**
144
161
 
145
162
  ```bash
146
163
  bunx shraga # serve on http://localhost:3032, state in ./data/
@@ -189,6 +206,27 @@ common ones:
189
206
  | `AUTH_PROVIDER` | `local` | `local` (username/password) or `firebase` |
190
207
  | `OWNERS` | *(unset)* | Comma-separated list of admin emails |
191
208
 
209
+ ### The config file (`data/shraga.config.ts`)
210
+
211
+ Beyond env vars, a typed config module in your data dir declares **global MCP servers**: the tools
212
+ every user gets. (Per-user MCPs are added in the UI, and agent settings like model and engine live
213
+ in `agent-config.json`, editable from the UI.) Shraga seeds it from a template on first run and
214
+ gitignores it, so you just edit the seeded file:
215
+
216
+ ```ts
217
+ export default defineConfig({
218
+ mcps: {
219
+ // Full form: an explicit command.
220
+ 'stripe': { command: 'bunx', args: ['@stripe/mcp'], env: { STRIPE_KEY: '' } },
221
+ // Shorthand: a vendored MCP under vendor/<name>/, listing the env keys it needs.
222
+ 'mcp-example': { env: ['EXAMPLE_API_KEY'] },
223
+ },
224
+ });
225
+ ```
226
+
227
+ Values in `env` resolve from `process.env` (your `.env` or system env) at startup. The legacy
228
+ filename `unclaw.config.ts` is also accepted.
229
+
192
230
  ## Expose it (optional)
193
231
 
194
232
  Running on a home machine? Set `CLOUDFLARE_TUNNEL_TOKEN` for a public URL via Cloudflare Tunnel, or