Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
93079e0
Initial plan
Copilot Feb 23, 2026
e286724
Initial plan for ecoBridge API integration
Copilot Feb 23, 2026
788b5e6
Add ecoBridge integration for cross-chain credit retirement payments
Copilot Feb 23, 2026
c54b7c1
Merge pull request #1 from ecoTokenJames/copilot/integrate-ecobridge-api
ecoTokenJames Feb 23, 2026
8f7bd6f
Merge pull request #1 from ecoTokenJames/main
CShear Feb 24, 2026
699d131
Fix ecoBridge registry parser to handle supportedTokens API format
Feb 24, 2026
fe7099c
Rename product from regen-compute-credits to regen-for-ai
Feb 24, 2026
32c47bc
feat: ship units 0-9 foundation, services, and tests
brawlaphant Feb 24, 2026
4c01fcc
feat: add protocol fee calculation to monthly batch retirements
brawlaphant Feb 24, 2026
48feaf2
feat: add REGEN acquisition adapter for protocol fee flow
brawlaphant Feb 24, 2026
128c24f
feat: add REGEN burn execution flow for monthly batches
brawlaphant Feb 24, 2026
b5cf28f
feat: add automated credit mix policy for monthly batches
brawlaphant Feb 24, 2026
8f0cc43
feat: add subscriber certificate frontend publishing tool
brawlaphant Feb 24, 2026
fe64a3a
feat: add subscriber dashboard frontend publishing tool
brawlaphant Feb 24, 2026
8023cd3
feat: complete unit 16 auth hardening and retire integration
brawlaphant Feb 24, 2026
8cdc244
feat: add idempotent Stripe invoice sync for pool accounting
brawlaphant Feb 24, 2026
6e1d06c
feat: add account-wide subscription invoice reconciliation tool
brawlaphant Feb 24, 2026
d8c7135
feat: add monthly reconciliation orchestration tool
brawlaphant Feb 24, 2026
e59dd32
feat: add monthly batch execution history query tool
brawlaphant Feb 24, 2026
e3f7489
feat: add monthly reconciliation status readiness tool
brawlaphant Feb 24, 2026
fe5b612
feat: harden reconciliation readiness and sync truncation reporting
brawlaphant Feb 24, 2026
86c1401
feat: block batch execution on truncated all-customer sync
brawlaphant Feb 24, 2026
0c908ca
feat: require dry-run preflight before live reconciliation
brawlaphant Feb 24, 2026
fe1d729
feat: block stale dry-run live reconciliation execution
brawlaphant Feb 24, 2026
645c09e
feat: add preflight-only mode for monthly reconciliation
brawlaphant Feb 24, 2026
9f6617e
feat: add single-flight lock for monthly reconciliation
brawlaphant Feb 24, 2026
b7f48ad
feat: add reconciliation sync and batch timeout controls
brawlaphant Feb 24, 2026
ba29c92
feat: persist and query monthly reconciliation run history
brawlaphant Feb 24, 2026
5414de4
fix: retain reconciliation lock until timed-out phase settles
brawlaphant Feb 24, 2026
12b0882
fix: surface reconciliation history write failures as warnings
brawlaphant Feb 24, 2026
2314b5b
feat: harden reconciliation lock and history store concurrency
brawlaphant Feb 24, 2026
7cc2383
feat: harden pool and batch stores with exclusive state writes
brawlaphant Feb 24, 2026
1a4aa75
feat(listing-gtm): ship coinstore gtm stack and review flow
brawlaphant Feb 24, 2026
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
96 changes: 90 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Regen Compute Credits - Environment Configuration
# Regen for AI - Environment Configuration
# Copy this file to .env and fill in your values

# Regen Network Indexer GraphQL endpoint
Expand All @@ -24,16 +24,100 @@ REGEN_RPC_URL=http://mainnet.regen.network:26657
# Regen chain ID (regen-1 for mainnet, regen-redwood-1 for testnet)
REGEN_CHAIN_ID=regen-1

# Payment provider: "crypto" (wallet balance) or "stripe" (coming soon)
# Payment provider: "crypto" (wallet balance) or "stripe" (card authorization + capture)
REGEN_PAYMENT_PROVIDER=crypto

# Default retirement jurisdiction (ISO 3166-1 alpha-2, e.g., US, DE, BR)
REGEN_DEFAULT_JURISDICTION=US

# Authentication (OAuth - for user identity on retirement certificates)
# OAUTH_CLIENT_ID=
# OAUTH_CLIENT_SECRET=
# Optional: protocol fee basis points for pooled monthly retirement budgets.
# Range: 800-1200 (8%-12%), default: 1000 (10%).
# REGEN_PROTOCOL_FEE_BPS=1000

# Optional: Stripe (future - requires Regen team integration)
# Optional: monthly batch credit-mix policy when credit_type is omitted.
# - balanced (default): auto split carbon+biodiversity using availability + relative price
# - off: disable policy and use single-pass selection across all eligible credits
# REGEN_BATCH_CREDIT_MIX_POLICY=balanced

# Optional: protocol fee REGEN acquisition provider.
# - disabled (default): no REGEN acquisition step is executed
# - simulated: uses fixed rate conversion for planning/testing flows
# REGEN_ACQUISITION_PROVIDER=disabled

# Optional: simulated provider conversion rate in micro-REGEN per 1 USDC.
# default: 2000000 (2.0 REGEN per 1 USDC)
# REGEN_ACQUISITION_RATE_UREGEN_PER_USDC=2000000

# Optional: REGEN burn execution provider.
# - disabled (default): no burn transaction is attempted
# - simulated: emits simulated burn metadata for local testing
# - onchain: broadcasts a MsgSend burn transfer to REGEN_BURN_ADDRESS
# REGEN_BURN_PROVIDER=disabled

# Required when REGEN_BURN_PROVIDER=onchain
# REGEN_BURN_ADDRESS=regen1...

# Identity auth hardening (email/OAuth verification sessions + recovery)
# Optional: auth state JSON file path (default: ./data/auth-state.json)
# REGEN_AUTH_STORE_PATH=./data/auth-state.json
# Strongly recommended: shared secret used for hashing/signing auth codes/state/tokens
# REGEN_AUTH_SECRET=replace-with-long-random-secret
# Optional: auth session TTL in seconds (default: 900)
# REGEN_AUTH_SESSION_TTL_SECONDS=900
# Optional: max verification attempts per session before lock (default: 5)
# REGEN_AUTH_MAX_ATTEMPTS=5
# Optional: recovery token TTL in seconds (default: 86400)
# REGEN_AUTH_RECOVERY_TTL_SECONDS=86400
# Optional: allowed OAuth providers CSV (default: google,github)
# REGEN_AUTH_ALLOWED_OAUTH_PROVIDERS=google,github

# Optional: Stripe payment intent settings (required if REGEN_PAYMENT_PROVIDER=stripe)
# STRIPE_SECRET_KEY=
# STRIPE_PAYMENT_METHOD_ID=
# STRIPE_CUSTOMER_ID=
# STRIPE_WEBHOOK_SECRET=

# Optional: Stripe recurring subscription price IDs for $1/$3/$5 tiers
# (required for manage_subscription action=subscribe)
# STRIPE_PRICE_ID_STARTER=price_...
# STRIPE_PRICE_ID_GROWTH=price_...
# STRIPE_PRICE_ID_IMPACT=price_...

# Optional: ecoBridge integration
# ECOBRIDGE_API_URL=https://api.bridge.eco
# ECOBRIDGE_ENABLED=true
# ECOBRIDGE_CACHE_TTL_MS=60000

# Optional: pool accounting ledger file path (default: ./data/pool-accounting-ledger.json)
# REGEN_POOL_ACCOUNTING_PATH=./data/pool-accounting-ledger.json
# Optional: pool accounting store lock tuning (defaults shown)
# REGEN_POOL_ACCOUNTING_LOCK_WAIT_MS=10000
# REGEN_POOL_ACCOUNTING_LOCK_RETRY_MS=25
# REGEN_POOL_ACCOUNTING_LOCK_STALE_MS=60000

# Optional: monthly batch execution history file path (default: ./data/monthly-batch-executions.json)
# REGEN_BATCH_EXECUTIONS_PATH=./data/monthly-batch-executions.json
# Optional: monthly batch execution store lock tuning (defaults shown)
# REGEN_BATCH_EXECUTIONS_LOCK_WAIT_MS=10000
# REGEN_BATCH_EXECUTIONS_LOCK_RETRY_MS=25
# REGEN_BATCH_EXECUTIONS_LOCK_STALE_MS=60000

# Optional: monthly reconciliation orchestration history file path (default: ./data/monthly-reconciliation-runs.json)
# REGEN_RECONCILIATION_RUNS_PATH=./data/monthly-reconciliation-runs.json
# Optional: reconciliation single-flight lock directory + stale-lock TTL
# REGEN_RECONCILIATION_LOCKS_DIR=./data/monthly-reconciliation-locks
# REGEN_RECONCILIATION_LOCK_TTL_MS=1800000
# Optional: monthly reconciliation history store lock tuning (defaults shown)
# REGEN_RECONCILIATION_RUNS_LOCK_WAIT_MS=10000
# REGEN_RECONCILIATION_RUNS_LOCK_RETRY_MS=25
# REGEN_RECONCILIATION_RUNS_LOCK_STALE_MS=60000

# Optional: subscriber certificate frontend settings
# Base URL prefix returned by publish_subscriber_certificate_page
# REGEN_CERTIFICATE_BASE_URL=https://regen.network/certificate
# Output directory for generated certificate HTML pages
# REGEN_CERTIFICATE_OUTPUT_DIR=./data/certificates
# Base URL prefix returned by publish_subscriber_dashboard_page
# REGEN_DASHBOARD_BASE_URL=https://regen.network/dashboard
# Output directory for generated dashboard HTML pages
# REGEN_DASHBOARD_OUTPUT_DIR=./data/dashboards
6 changes: 4 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Contributing to Regen Compute Credits
# Contributing to Regen for AI

Thank you for your interest in contributing! This project connects AI compute usage to verified ecological regeneration through Regen Network.

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/regen-compute-credits.git`
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/regen-for-ai.git`
3. Install dependencies: `npm install`
4. Copy environment config: `cp .env.example .env`
5. Start development: `npm run dev`
Expand Down Expand Up @@ -46,6 +46,8 @@ This project includes a `CLAUDE.md` file that gives Claude Code full context abo
- Include a clear description of what changed and why
- Update relevant documentation if behavior changes
- Add tests for new functionality (when test infrastructure is set up)
- Use the repo PR template (`.github/pull_request_template.md`) and complete the `pr_context` block for fast human/agent handoff
- Assign explicit `owner`, `approver`, and `publisher` in the PR body before requesting final review

## Key Design Principles

Expand Down
65 changes: 65 additions & 0 deletions .github/pr-context.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Pull Request Context",
"description": "Machine-readable context embedded in PR body under `pr_context`.",
"type": "object",
"additionalProperties": false,
"required": [
"version",
"change_type",
"scope",
"release_blocking",
"risk_level",
"breaking_change",
"db_migration",
"requires_follow_up",
"owner",
"approver",
"publisher"
],
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"change_type": {
"type": "string",
"enum": ["feat", "fix", "docs", "refactor", "test", "chore"]
},
"scope": {
"type": "string",
"minLength": 1
},
"linked_issue": {
"type": "string"
},
"release_blocking": {
"type": "boolean"
},
"risk_level": {
"type": "string",
"enum": ["low", "medium", "high"]
},
"breaking_change": {
"type": "boolean"
},
"db_migration": {
"type": "boolean"
},
"requires_follow_up": {
"type": "boolean"
},
"owner": {
"type": "string",
"minLength": 1
},
"approver": {
"type": "string",
"minLength": 1
},
"publisher": {
"type": "string",
"minLength": 1
}
}
}
47 changes: 47 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## PR Context (for humans + agents)

```yaml
pr_context:
version: 1
change_type: feat # feat|fix|docs|refactor|test|chore
scope: "" # short scope, e.g. listing-gtm/proof-page
linked_issue: "" # optional issue/ticket URL or ID
release_blocking: false
risk_level: low # low|medium|high
breaking_change: false
db_migration: false
requires_follow_up: false
owner: "" # DRI for this PR
approver: "" # final signoff owner
publisher: "" # who deploys/ships
```

## Summary
- What changed?
- Why now?

## Change Set
- Main files/areas touched:
- User-visible behavior changes:
- Non-goals (what this PR does not do):

## Test Plan
- Commands run:
- Results:
- Manual checks (if any):

## Risk and Rollback
- Main risks:
- Rollback or mitigation plan:

## Handoff Notes
- Open follow-ups:
- Decisions needed:
- Deployment/publish steps:

## Checklist
- [ ] Scope is focused and reviewable.
- [ ] Docs updated (if behavior changed).
- [ ] Tests added/updated where appropriate.
- [ ] No secrets or sensitive data included.
- [ ] Owner/Approver/Publisher set in `pr_context`.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
pull_request:

jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm

- name: Install dependencies
run: npm ci

- name: Run typecheck
run: npm run typecheck

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
47 changes: 47 additions & 0 deletions .github/workflows/pr-template-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PR Template Check

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
validate-pr-body:
name: Validate PR Body Format
runs-on: ubuntu-latest
steps:
- name: Check required PR template sections
uses: actions/github-script@v7
with:
script: |
const body = context.payload.pull_request?.body || "";

const requiredTokens = [
"pr_context:",
"change_type:",
"scope:",
"release_blocking:",
"risk_level:",
"breaking_change:",
"db_migration:",
"requires_follow_up:",
"owner:",
"approver:",
"publisher:",
"## Summary",
"## Change Set",
"## Test Plan",
"## Risk and Rollback",
"## Handoff Notes",
"## Checklist"
];

const missing = requiredTokens.filter((token) => !body.includes(token));

if (missing.length > 0) {
core.setFailed(
"PR body is missing required template content: " + missing.join(", ")
);
return;
}

core.notice("PR template sections detected.");
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dist/
.DS_Store
.vscode/
.idea/
data/
docs/listing-gtm/release/
Loading
Loading