Skip to content

Commit 03cb3c4

Browse files
authored
Merge pull request #23 from Daylily-Informatics/ops/nuke-rebuild-dev-20260125-030810
Ops/nuke rebuild dev 20260125 030810
2 parents 6de9388 + 91fc927 commit 03cb3c4

25 files changed

+3709
-1322
lines changed

.augment/rules/default.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Marvain — repo-local Augment rules (default)
2+
3+
These rules are **repo-specific** and layer on top of the global rules in `~/.augment/rules/00_base_rules.md`.
4+
5+
## Environment
6+
- Primary environment manager is **Conda**.
7+
- Env name: `marvain`
8+
- Spec file: `config/marvain_conda.yaml`
9+
- Python: **3.11**
10+
- Prefer activating with:
11+
- `. ./marvain_activate`
12+
- Treat `MARVAIN_ALLOW_VENV=1` as an escape hatch only (use only if explicitly requested).
13+
14+
## Safety (AWS / destructive operations)
15+
- Do **not** run destructive or stateful AWS operations without explicit Major approval.
16+
- Examples: `sam deploy`, CloudFormation updates/deletes, S3 deletes, DB init against real stacks.
17+
- Prefer `--dry-run` modes whenever available (e.g., `./bin/marvain ... --dry-run`).
18+
19+
## Testing & verification (default)
20+
- Fast local signal:
21+
- `python -m pytest -q`
22+
- When changing CLI behavior, prefer adding/updating tests under `tests/`.
23+
24+
## Codebase conventions
25+
- Runtime/targets:
26+
- AWS SAM/CloudFormation stack in `template.yaml`
27+
- Lambda code in `functions/`
28+
- Shared library in `layers/shared/`
29+
- CLI in `marvain_cli/` and wrapper in `bin/marvain`
30+
- Prefer **stdlib / existing deps**; adding dependencies requires justification.
31+
32+
## Architecture: GUI vs API
33+
- **Hub API (deployed)**: REST API Lambda behind API Gateway for programmatic access (devices, CLI, satellites). Uses `api_app.py` via `lambda_handler.py`.
34+
- **GUI (local only)**: FastAPI app with Jinja2 templates + HTMX, runs on `localhost:8084`. Uses `app.py` which imports `api_app` and adds GUI routes.
35+
- GUI authenticates via Cognito Hosted UI and connects directly to deployed AWS resources (Aurora Data API, Cognito, S3, SQS).
36+
- **Never deploy GUI to Lambda** — keep GUI code out of `api_app.py`.
37+
38+
## Logging & determinism
39+
- Prefer explicit configuration (flags/config) over implicit shell state.
40+
- When wrapping external tools (AWS/SAM), log the exact command being run (unless quiet mode).
41+
42+
## Documentation updates
43+
- If behavior changes, update the nearest doc:
44+
- `README.md`, `QUICKSTART.md`, and/or `docs/ARCHITECTURE.md`.

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ALWAYS RUN THIS: source marvain_activate when in the repo root directory and when starting a new terminal so you have the cli tools available. AND try to source .env as well, if present.
2+

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ Prereqs:
179179

180180
Notes:
181181

182+
- `./bin/marvain deploy` defaults to **guided** (interactive) SAM deploy.
183+
- For a fully non-interactive deploy (no stdin prompts), use:
184+
- `./bin/marvain deploy --no-guided`
185+
- `deploy` runs a `sam build --clean` first so Lambda functions include vendored dependencies.
186+
187+
Notes:
188+
182189
- `marvain config init` writes to `${XDG_CONFIG_HOME:-~/.config}/marvain/marvain.yaml` by default.
183190
- Treat that config as **secret** once you run `marvain bootstrap` (it will store a device token).
184191
- If you choose to write a repo-local config (e.g. `--write marvain.yaml`), it is gitignored.
@@ -196,13 +203,59 @@ Notes:
196203
./bin/marvain bootstrap --dry-run --agent-name Forge --space-name home
197204
```
198205

199-
### 5) Open the deployed GUI
206+
### 5) Start the Local GUI
207+
208+
The GUI runs locally on your machine and connects to deployed AWS resources (Aurora, Cognito, S3).
200209

201210
```bash
202-
# Print the deployed GUI URL (HubRestApiBase) and open it in your browser.
211+
# Write stack outputs to .env.local config
212+
./bin/marvain monitor outputs --write-config
213+
214+
# Start the local GUI server (background mode, default)
215+
./bin/marvain gui start
216+
217+
# Or just `marvain gui` (defaults to start)
203218
./bin/marvain gui
204219
```
205220

221+
Visit `http://localhost:8084/` — you'll be redirected to Cognito for login.
222+
223+
#### GUI Lifecycle Commands
224+
225+
| Command | Description |
226+
|---------|-------------|
227+
| `marvain gui start` | Start GUI server (background by default) |
228+
| `marvain gui stop` | Stop the running GUI server |
229+
| `marvain gui restart` | Stop then start the GUI server |
230+
| `marvain gui status` | Show whether GUI is running, PID, port |
231+
| `marvain gui logs` | Show/tail GUI server logs |
232+
233+
**Options:**
234+
235+
```bash
236+
# Start in foreground (blocking, Ctrl+C to stop)
237+
./bin/marvain gui start --foreground
238+
239+
# Use different host/port
240+
./bin/marvain gui start --host 0.0.0.0 --port 8080
241+
242+
# Disable auto-reload
243+
./bin/marvain gui start --no-reload
244+
245+
# Force kill (SIGKILL instead of SIGTERM)
246+
./bin/marvain gui stop --force
247+
248+
# Follow logs in real-time
249+
./bin/marvain gui logs --follow
250+
251+
# Show last 100 lines of logs
252+
./bin/marvain gui logs --lines 100
253+
```
254+
255+
**Files:**
256+
- PID file: `.marvain-gui.pid` (in repo root)
257+
- Log file: `.marvain-gui.log` (in repo root)
258+
206259
## Run the realtime agent worker (local)
207260

208261
This repo does not ship a full satellite app yet; it ships a worker skeleton.

config/marvain_conda.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010

1111
# Tooling
1212
- awscli
13-
- pytest
13+
- pytest
1414
- typer
1515
- click
1616
- pyyaml
@@ -30,8 +30,10 @@ dependencies:
3030

3131
# Packages not consistently available via conda (or with extras)
3232
- pip:
33-
# awscli v2 requires awscrt crypto EC support (needs awscrt >= 0.28.4)
34-
- "awscrt>=0.28.4"
33+
- awscli # v2 requires awscrt crypto EC support (needs awscrt >= 0.28.4)
34+
- awscrt
3535
- amazon-transcribe
36-
- "livekit-agents[openai]~=1.3"
37-
- "livekit-plugins-noise-cancellation~=0.2"
36+
- livekit-agents[openai]
37+
- livekit-plugins-noise-cancellation
38+
- python-jose[cryptography] # JWT validation for Cognito auth
39+
- itsdangerous # Session signing for SessionMiddleware

functions/hub_api/.env.local

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Local development environment for Hub API
2+
# These values point to the deployed AWS resources
3+
4+
# Database (Aurora Serverless v2 with Data API)
5+
DB_RESOURCE_ARN=arn:aws:rds:us-east-1:670484050738:cluster:marvain-john-major-dev-auroracluster-58dmuasoghuv
6+
DB_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/db-credentials-zoY5wV
7+
DB_NAME=agenthub
8+
9+
# Cognito
10+
COGNITO_REGION=us-east-1
11+
COGNITO_USER_POOL_ID=us-east-1_vGmWnreMU
12+
COGNITO_APP_CLIENT_ID=7njmj42lc6p2qf6mgsua05miua
13+
COGNITO_DOMAIN=marvain-dev.auth.us-east-1.amazoncognito.com
14+
COGNITO_REDIRECT_URI=http://localhost:8084/auth/callback
15+
16+
# Session (for local dev, use a static key; in Lambda, SESSION_SECRET_ARN is used)
17+
SESSION_SECRET_KEY=local-dev-session-secret-key-change-in-production-123456
18+
19+
# Secrets Manager
20+
ADMIN_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/admin-api-key-rRWQF7
21+
OPENAI_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/openai-JNurv6
22+
LIVEKIT_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/livekit-3qohPq
23+
24+
# LiveKit
25+
LIVEKIT_URL=wss://marvain-dev-fo5ki513.livekit.cloud
26+
27+
# SQS Queues (URLs not exported - optional for local dev)
28+
TRANSCRIPT_QUEUE_URL=
29+
ACTION_QUEUE_URL=
30+
31+
# S3 Buckets
32+
AUDIT_BUCKET=marvain-john-major-dev-auditbucket-miz3vbanlu3i
33+
ARTIFACT_BUCKET=marvain-john-major-dev-artifactbucket-0mjzoilnzult
34+
35+
# Logging
36+
LOG_LEVEL=DEBUG
37+
38+
# Environment
39+
ENVIRONMENT=local
40+
41+
# AWS
42+
AWS_PROFILE=daylily
43+
AWS_REGION=us-east-1
44+

0 commit comments

Comments
 (0)