Skip to content

Commit 2bd9fd9

Browse files
committed
X
1 parent 14223ba commit 2bd9fd9

File tree

19 files changed

+280
-111
lines changed

19 files changed

+280
-111
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ samconfig.toml
88
# Local marvain CLI config (may contain device tokens)
99
marvain.yaml
1010

11+
# Local SSL certificates for HTTPS development
12+
certs/
13+
1114
# C extensions
1215
*.so
1316

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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.
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.
22

33
use AWS_PROFILE=daylily and AWS_REGION=us-east-1 and AWS_DEFAULT_REGION=us-east-1
44

QUICKSTART.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@ If `AuditBucket` deletion fails due to Object Lock retention, the “from scratc
6767
### 2.1 Remove local config (this deletes your saved device token)
6868

6969
Config default path:
70-
- `${XDG_CONFIG_HOME:-~/.config}/marvain/marvain.yaml`
70+
- `${XDG_CONFIG_HOME:-~/.config}/marvain/marvain-config.yaml`
7171

7272
If you want to keep a copy of the token/config, back it up first.
7373

7474
<augment_code_snippet mode="EXCERPT">
7575
````sh
7676
# OPTIONAL backup
77-
cp -v "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
78-
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml.bak" 2>/dev/null || true
77+
cp -v "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml" \
78+
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml.bak" 2>/dev/null || true
7979

80-
# Delete config (XDG + legacy)
81-
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
80+
# Delete config (canonical + legacy)
81+
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml" \
82+
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
8283
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/config.yaml" \
8384
"$HOME/.marvain/config.yaml"
8485
````

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,12 @@ If `AuditBucket` deletion fails due to Object Lock retention, the practical “r
132132

133133
```sh
134134
# OPTIONAL: backup first
135-
cp -v "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
136-
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml.bak" 2>/dev/null || true
135+
cp -v "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml" \
136+
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml.bak" 2>/dev/null || true
137137

138-
# Delete config (XDG + legacy fallbacks)
139-
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
138+
# Delete config (canonical + legacy fallbacks)
139+
rm -f "${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain-config.yaml" \
140+
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/marvain.yaml" \
140141
"${XDG_CONFIG_HOME:-$HOME/.config}/marvain/config.yaml" \
141142
"$HOME/.marvain/config.yaml"
142143
```
@@ -186,7 +187,7 @@ Notes:
186187

187188
Notes:
188189

189-
- `marvain config init` writes to `${XDG_CONFIG_HOME:-~/.config}/marvain/marvain.yaml` by default.
190+
- `marvain config init` writes to `${XDG_CONFIG_HOME:-~/.config}/marvain/marvain-config.yaml` by default.
190191
- Treat that config as **secret** once you run `marvain bootstrap` (it will store a device token).
191192
- If you choose to write a repo-local config (e.g. `--write marvain.yaml`), it is gitignored.
192193

@@ -208,7 +209,7 @@ Notes:
208209
The GUI runs locally on your machine and connects to deployed AWS resources (Aurora, Cognito, S3).
209210

210211
```bash
211-
# Write stack outputs to .env.local config
212+
# Write stack outputs to marvain-config.yaml
212213
./bin/marvain monitor outputs --write-config
213214

214215
# Start the local GUI server (background mode, default)

certs/.hold

Whitespace-only changes.

functions/hub_api/.env.local

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
# These values point to the deployed AWS resources
33

44
# 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
5+
DB_RESOURCE_ARN=arn:aws:rds:us-east-1:670484050738:cluster:marvain-john-major-dev-auroracluster-senbqqgdczo6
6+
DB_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/db-credentials-VGvfQ4
77
DB_NAME=agenthub
88

99
# Cognito
1010
COGNITO_REGION=us-east-1
11-
COGNITO_USER_POOL_ID=us-east-1_vGmWnreMU
12-
COGNITO_APP_CLIENT_ID=7njmj42lc6p2qf6mgsua05miua
11+
COGNITO_USER_POOL_ID=us-east-1_13G7tqlGg
12+
COGNITO_APP_CLIENT_ID=2uoaljh5qbj7ha9noc6h0bpv66
1313
COGNITO_DOMAIN=marvain-dev.auth.us-east-1.amazoncognito.com
14-
COGNITO_REDIRECT_URI=http://localhost:8084/auth/callback
14+
COGNITO_REDIRECT_URI=https://localhost:8084/auth/callback
1515

1616
# Session (for local dev, use a static key; in Lambda, SESSION_SECRET_ARN is used)
1717
SESSION_SECRET_KEY=local-dev-session-secret-key-change-in-production-123456
1818

1919
# 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
20+
ADMIN_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/admin-api-key-MJSw2D
21+
OPENAI_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/openai-4Clbx3
22+
LIVEKIT_SECRET_ARN=arn:aws:secretsmanager:us-east-1:670484050738:secret:marvain-john-major-dev/livekit-BsdyYY
2323

2424
# LiveKit
2525
LIVEKIT_URL=wss://marvain-dev-fo5ki513.livekit.cloud
@@ -29,8 +29,8 @@ TRANSCRIPT_QUEUE_URL=
2929
ACTION_QUEUE_URL=
3030

3131
# S3 Buckets
32-
AUDIT_BUCKET=marvain-john-major-dev-auditbucket-miz3vbanlu3i
33-
ARTIFACT_BUCKET=marvain-john-major-dev-artifactbucket-0mjzoilnzult
32+
AUDIT_BUCKET=marvain-john-major-dev-auditbucket-zobrgbyrmgjb
33+
ARTIFACT_BUCKET=marvain-john-major-dev-artifactbucket-zg3clkrefcko
3434

3535
# Logging
3636
LOG_LEVEL=DEBUG

functions/hub_api/run_local.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
#!/usr/bin/env python3
2-
"""Local development runner for Hub API with environment loading."""
2+
"""Local development runner for Hub API with environment loading.
3+
4+
DEPRECATED: Use `marvain gui start` or `marvain gui run` instead.
5+
Those commands read configuration from marvain-config.yaml and don't require
6+
a .env.local file.
7+
8+
This script is kept for backward compatibility and requires manual creation
9+
of a .env.local file in this directory.
10+
"""
311

412
import os
513
import sys
614
from pathlib import Path
715

816
# Load environment variables from .env.local BEFORE importing anything else
17+
# DEPRECATED: New code should use marvain-config.yaml via CLI
918
from dotenv import load_dotenv
1019

1120
env_file = Path(__file__).parent / ".env.local"
21+
if not env_file.exists():
22+
print("ERROR: .env.local not found.", file=sys.stderr)
23+
print("DEPRECATED: This script is deprecated.", file=sys.stderr)
24+
print("Use 'marvain gui start' instead (reads from marvain-config.yaml).", file=sys.stderr)
25+
sys.exit(1)
1226
load_dotenv(env_file)
1327

1428
# Ensure AWS_REGION is set for boto3

functions/hub_api/test_login_local.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
#!/usr/bin/env python3
2-
"""Test the login flow locally without needing full AWS infrastructure."""
2+
"""Test the login flow locally without needing full AWS infrastructure.
3+
4+
DEPRECATED: This script requires a .env.local file which is no longer the
5+
standard configuration approach. Configuration should be in marvain-config.yaml.
6+
Use `marvain gui start` for local development instead.
7+
"""
38

49
import os
510
import sys
611
from pathlib import Path
712
from dotenv import load_dotenv
813

9-
# Load environment variables
14+
# Load environment variables from .env.local
15+
# DEPRECATED: New code should use marvain-config.yaml via CLI
1016
env_file = Path(__file__).parent / ".env.local"
17+
if not env_file.exists():
18+
print("ERROR: .env.local not found.", file=sys.stderr)
19+
print("DEPRECATED: This script is deprecated.", file=sys.stderr)
20+
print("Use 'marvain gui start' instead (reads from marvain-config.yaml).", file=sys.stderr)
21+
sys.exit(1)
1122
load_dotenv(env_file)
1223

1324
# Set AWS region

layers/shared/python/agent_hub/cognito.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ def build_logout_url(cfg: HubConfig, redirect_uri: str | None = None) -> str:
119119
if not cfg.cognito_logout_url or not cfg.cognito_user_pool_client_id:
120120
raise CognitoAuthError("Cognito is not fully configured")
121121

122-
# Default to base URL (without /auth/callback)
122+
# Default to /logged-out page (must be registered in Cognito LogoutURLs)
123123
logout_target = redirect_uri
124124
if not logout_target and cfg.cognito_redirect_uri:
125-
logout_target = cfg.cognito_redirect_uri.replace("/auth/callback", "")
125+
# Replace /auth/callback with /logged-out
126+
logout_target = cfg.cognito_redirect_uri.replace("/auth/callback", "/logged-out")
126127

127128
params = {
128129
"client_id": cfg.cognito_user_pool_client_id,
130+
# Cognito logout endpoint accepts both 'logout_uri' and 'redirect_uri'
131+
# but some versions require 'redirect_uri', so we include both for compatibility
129132
"logout_uri": logout_target or "",
133+
"redirect_uri": logout_target or "",
130134
}
131135
return f"{cfg.cognito_logout_url}?{urlencode(params)}"
132136

marvain_activate

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,22 @@ fi
7474

7575
_MARVAIN_REPO_CFG="$_MARVAIN_ROOT/marvain.yaml"
7676
_MARVAIN_XDG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
77-
_MARVAIN_USER_CFG="$_MARVAIN_XDG_HOME/marvain/marvain.yaml"
77+
# Primary canonical config location
78+
_MARVAIN_USER_CFG="$_MARVAIN_XDG_HOME/marvain/marvain-config.yaml"
79+
# Legacy locations (backward compatibility)
80+
_MARVAIN_USER_CFG_OLD="$_MARVAIN_XDG_HOME/marvain/marvain.yaml"
7881
_MARVAIN_USER_CFG_LEGACY="$HOME/.marvain/config.yaml"
7982

8083
if [ -f "$_MARVAIN_REPO_CFG" ]; then
8184
_marvain_log INFO "Found repo config: $_MARVAIN_REPO_CFG"
8285
elif [ -f "$_MARVAIN_USER_CFG" ]; then
8386
_marvain_log INFO "Found user config: $_MARVAIN_USER_CFG"
87+
elif [ -f "$_MARVAIN_USER_CFG_OLD" ]; then
88+
_marvain_log INFO "Found user config (legacy): $_MARVAIN_USER_CFG_OLD"
89+
_marvain_log WARN "Consider migrating to: $_MARVAIN_USER_CFG"
8490
elif [ -f "$_MARVAIN_USER_CFG_LEGACY" ]; then
8591
_marvain_log INFO "Found user config (legacy): $_MARVAIN_USER_CFG_LEGACY"
92+
_marvain_log WARN "Consider migrating to: $_MARVAIN_USER_CFG"
8693
else
8794
_marvain_log INFO "No config found. Create one via: marvain config init"
8895
fi
@@ -103,4 +110,5 @@ unset _MARVAIN_CONDA_FILE
103110
unset _MARVAIN_REPO_CFG
104111
unset _MARVAIN_XDG_HOME
105112
unset _MARVAIN_USER_CFG
113+
unset _MARVAIN_USER_CFG_OLD
106114
unset _MARVAIN_USER_CFG_LEGACY

0 commit comments

Comments
 (0)