Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules/
.wrangler/
*.log
web/dist/
47 changes: 47 additions & 0 deletions SAMANTHA_GCP_HOSTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Samantha GCP Hosting Plan

Owner: `bryan@norcalcarbmobile.com`
Operator agent: Samantha
Project: `samantha-gumption`

## Split

- `web/` deploys the static Vite build to Firebase Hosting.
- `api/` deploys `gumption-api` to Cloud Run for provider calls and server-side keys.
- Firebase Hosting rewrites `/api/**` to Cloud Run in `us-west1`.
- Vertex AI Gemini uses project-scoped Cloud Run service account auth.
- Anthropic, OpenAI, and xAI keys belong in Secret Manager and are attached as Cloud Run env vars.
- SMS/voice progress alerts are sent from `gumption-api`; Bryan's destination phone stays in `ALERT_TO_PHONE`.

## One-time setup

```bash
gcloud auth login
gcloud config set account bryan@norcalcarbmobile.com
gcloud projects create samantha-gumption --name="Gumption by Silverback AI"
gcloud config set project samantha-gumption
gcloud services enable run.googleapis.com firebase.googleapis.com aiplatform.googleapis.com secretmanager.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com
```

## Alert secrets

For "progress does not stop" alerts, add these secrets before enabling live SMS/voice:

```bash
printf "+15555550199" | gcloud secrets create ALERT_TO_PHONE --data-file=-
printf "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | gcloud secrets create TWILIO_ACCOUNT_SID --data-file=-
printf "twilio-auth-token" | gcloud secrets create TWILIO_AUTH_TOKEN --data-file=-
printf "+15555550200" | gcloud secrets create TWILIO_FROM --data-file=-
```

Use your real phone or a receiving Google Voice number for `ALERT_TO_PHONE`. Google Voice can receive or forward alerts, but it is not a supported outbound SMS API; use Twilio for the sending number.

## Deploy

From the repo root:

```powershell
.\scripts\deploy-gcp.ps1
```

The script deploys `api/` to Cloud Run, builds `web/`, then deploys Firebase Hosting.
4 changes: 4 additions & 0 deletions api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
node_modules
npm-debug.log
README.md
10 changes: 10 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:22-alpine

WORKDIR /app
ENV NODE_ENV=production

COPY package.json ./
COPY server.js ./

EXPOSE 8080
CMD ["node", "server.js"]
30 changes: 30 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Gumption API

Cloud Run provider proxy for Samantha's Brain Trust app.

## Responsibilities

- Keeps Anthropic, OpenAI, and xAI keys server-side.
- Uses Vertex AI Gemini from `samantha-gumption` instead of a browser Gemini key.
- Sends SMS or voice escalation alerts to Bryan when agent progress is blocked.
- Exposes `/api/health`, `/api/providers`, `/api/chat`, `/api/alerts/status`, and `/api/alerts`.
- Returns local handoff responses when secrets or Cloud Run metadata are not available.

## Secrets

Create these Secret Manager secrets when each provider is ready:

- `ANTHROPIC_API_KEY`
- `OPENAI_API_KEY`
- `XAI_API_KEY`
- `ALERT_TO_PHONE`
- `TWILIO_ACCOUNT_SID`
- `TWILIO_AUTH_TOKEN`
- `TWILIO_SMS_FROM` or `TWILIO_FROM`
- `TWILIO_VOICE_FROM` or `TWILIO_FROM`

Attach them to Cloud Run as environment variables when deploying `gumption-api`.

## Google Voice note

Google Voice numbers can receive alerts if you set `ALERT_TO_PHONE` to that number or forward it to your real phone. Google Voice is not a supported outbound SMS API, so the sending side should be a Twilio number unless the Google Voice number is ported to a provider with an API.
14 changes: 14 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "gumption-api",
"private": true,
"version": "1.0.0",
"type": "module",
"description": "Cloud Run API proxy for Brain Trust provider calls.",
"scripts": {
"start": "node server.js",
"check": "node --check server.js"
},
"engines": {
"node": ">=20"
}
}
Loading