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.

feat(copy-trade): store first-copy path progress for the steps that leave no other trace

nirholas48583d259d9f
diff --git a/api/_lib/migrations/20260925120000_copy_path_progress.sql b/api/_lib/migrations/20260925120000_copy_path_progress.sql
new file mode 100644
index 000000000..7b78071f2
--- /dev/null
+++ b/api/_lib/migrations/20260925120000_copy_path_progress.sql
@@ -0,0 +1,23 @@
+-- First-copy path: the steps a signed-in user has taken toward their first
+-- copy-trade (/first-copy). Only the steps that leave no other durable trace are
+-- stored here: 'watch' (opened a verified trade's receipt) and 'ghost' (ran a
+-- ghost-copy replay, which is otherwise stateless). The later steps are read
+-- live from the tables that already prove them (pump_agent_trades,
+-- agent_custody_events, copy_subscriptions), with one exception: a verified
+-- self-signed buy of a coin that was not launched on three.ws has no
+-- pump_agent_trades row (mint_id is NOT NULL), so buy-confirm records it here
+-- as 'trade' with the signature in context.
+-- api/_lib/copy-path.js owns reads and writes.
+
+CREATE TABLE IF NOT EXISTS copy_path_progress (
+ user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+ step text NOT NULL CHECK (step IN ('watch', 'ghost', 'trade')),
+ context jsonb,
+ completed_at timestamptz NOT NULL DEFAULT now(),
+ PRIMARY KEY (user_id, step)
+);
+
+COMMENT ON TABLE copy_path_progress IS
+ 'First-copy path steps with no other durable trace. One row per user per step; the first completion wins.';
+COMMENT ON COLUMN copy_path_progress.context IS
+ 'What completed the step: the receipt position id, the ghost-copied leader and result, or the verified buy signature.';