Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

1.9 KB
Raw Blame
-- Unstoppable Agent tables
-- Provisions treasury, activity log, and daily reflection log for the
-- self-sustaining agent that funds itself through x402 micropayments.
--
-- Folded into the api/_lib/migrations runner path so a single `npm run db:migrate`
-- provisions these tables. (Previously orphaned under data/migrations/, applied by
-- no script — which left unstoppable_treasury / unstoppable_activity missing in
-- production and the /api/agents/* + treasury/earnings routes erroring on every tick.)

-- Treasury snapshot — single row, upserted on each tick
CREATE TABLE IF NOT EXISTS unstoppable_treasury (
  id INTEGER PRIMARY KEY DEFAULT 1 CHECK (id = 1),
  balance_usdc_atomics BIGINT NOT NULL DEFAULT 0,
  lifetime_earned_atomics BIGINT NOT NULL DEFAULT 0,
  lifetime_spent_atomics BIGINT NOT NULL DEFAULT 0,
  runway_days NUMERIC(6,2) NOT NULL DEFAULT 0,
  mode TEXT NOT NULL DEFAULT 'normal',  -- 'normal'|'conservation'|'halted'
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- Activity log — one row per agent action
CREATE TABLE IF NOT EXISTS unstoppable_activity (
  id BIGSERIAL PRIMARY KEY,
  tick_id TEXT NOT NULL,
  action_type TEXT NOT NULL,  -- 'think'|'search'|'earn'|'reflect'|'status_check'|'idle'|'post_status'
  description TEXT NOT NULL,
  cost_atomics BIGINT NOT NULL DEFAULT 0,
  revenue_atomics BIGINT NOT NULL DEFAULT 0,
  metadata JSONB,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE INDEX IF NOT EXISTS unstoppable_activity_created_at
  ON unstoppable_activity (created_at DESC);

-- Reflection log — one row per calendar day
CREATE TABLE IF NOT EXISTS unstoppable_reflections (
  id BIGSERIAL PRIMARY KEY,
  date DATE NOT NULL UNIQUE,
  summary TEXT NOT NULL,
  earnings_24h_atomics BIGINT NOT NULL DEFAULT 0,
  costs_24h_atomics BIGINT NOT NULL DEFAULT 0,
  actions_count INTEGER NOT NULL DEFAULT 0,
  strategy_notes TEXT,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);