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.

fix(sniper): database refuses to move a settled position back to open

nirholas5b620c33e694
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3ec4eaf4..6f02005e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,9 +9,12 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **3D generations that run long now hand back a handle instead of an error** — A detailed model can take several minutes, longer than an assistant will wait inside a single tool call. Those generations used to look like failures even though the GPU finished the model minutes later. The ChatGPT 3D Studio now returns a live handle with a countdown of how much time is left, and a new check_job tool collects the finished model when it lands. Poll responses carry elapsed time and a remaining estimate that counts down, the assistant sees progress instead of identical waiting frames, and the inline viewer shows a real "still rendering" panel rather than an empty one. A generation whose GPU worker dies mid-job is now automatically retried on a healthy engine instead of being written off, including when nobody is watching the page. (`/docs/mcp-studio`) `[improvement, fix]`
- **Every 3D service we sell to other agents now ships parameters and a worked example** — The service catalog three.ws publishes to the OKX.AI agent marketplace describes all eleven 3D services the same way: what it does, exactly what you provide numbered one by one, and a concrete example of a real request. Buying agents (and the humans reading over their shoulder) can now tell what a service takes before spending anything, and the free catalog endpoint serves the same text the marketplace listing shows. (`/docs/okx-marketplace`) `[improvement, docs]`
- **Hats and shoes now sit where they belong** — Generated caps could come out with brims jutting past the face, and sneakers could hover away from the feet, because the forge sized those pieces by width alone: a deep-brimmed cap or a photographed pair of shoes standing close together gave the sizing step no useful signal. Caps are now scaled to fit the head on every dimension, and shoes are sized by foot length and placed onto each foot individually. Measured on a walking avatar, the worst-case gap between shoe and foot dropped from 34cm to 3cm, and cap overhang from 21cm to 8cm. Every piece in the catalog is now checked automatically: it must load, match its published fingerprint, and bind correctly onto four different avatar skeletons before it counts as good, with the pieces that failed the new bar replaced. A daily check also watches the live catalog for anything that breaks after the fact. `[improvement, fix]`
+- **Solana name registration works again, and embeds stop crashing on older phones** — Claiming a .sol domain for an agent, and claiming your own name under threews.sol, both ran against a Solana naming library so old that the functions doing the registering had been renamed out from under us: the calls resolved to nothing and the whole attempt failed. The library is now current, every naming path has been re-checked against the live Solana mainnet, and handing a fresh subdomain to its new owner no longer trips over an account that the same transaction is still creating. Looking up a wallet's primary name also stops reporting a name the wallet no longer owns. Separately, the embeddable 3D avatar used a newer JavaScript feature than some older Android browsers ship, so the avatar page went blank instead of loading; the missing piece is now included in the embed, which matters because the embed is designed to run on other people's sites where we do not get to pick the browser. (`/embed`) `[fix]`
- **The 3D forge accepts all six reference photos again** — The photo composer advertised six reference views but only built four slots, so filling the last one threw an error and stopped the upload. All six slots are now real and usable, which is the full set the generator accepts, and more views produce a sharper mesh. Text prompts also retry once when the concept-image step returns an empty result, instead of falling back to a lower-quality image lane. (`/forge`) `[fix, improvement]`
+- **The walkaround world now has a real time of day and /play's radar** — Walk your avatar into the park at dusk and it actually looks like dusk. The sun rises, arcs overhead and sets, the sky graduates from night through dawn to day, and the lights and reflections follow it, all driven by the same shared world clock the coin worlds run on, so everyone standing in the same world sees the same sky at the same moment. Indoor stages keep their authored lighting and the cycle steps aside while the camera passthrough is on. The corner map was also replaced with the rotating radar from the coin worlds: it turns under a fixed player arrow, keeps a compass and the world boundary in view, and now shows other players in their nameplate colours alongside companions, live agent desks, the named landmarks your guide walks to, and the scenery around you. Click or tap the radar to send your avatar walking there. Press M to hide or show it and it remembers your choice. (`/temporary`) `[feature, improvement]`
- **The x402 payment lanes now stop when the treasury runs dry** — When the wallets funding the agent payment economy ran low, the tip seeder kept firing 60 payments a minute that could never settle, turning the public dance-tip endpoint into a wall of errors and burning network calls for nothing. It now reads both wallet balances once before each round and simply sits the round out when a payment cannot succeed, with the reason stated plainly in the response. When the payer holds enough for some but not all of a round, it now sends exactly the number it can afford instead of overshooting. An unreadable balance is treated as unknown rather than empty, so a momentary network hiccup can never stall the economy on its own. `[fix, infra]`
- **Trading agents can no longer earn a bigger bet while losing money** — The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money. (`/blog/autonomous-trading-experiment`) `[improvement]`
+- **Trading agents no longer lose slots to settled trades** — A trade that sold successfully but whose confirmation timed out could get stuck: the agent kept treating the finished position as live, which used up one of its limited slots for new trades. Five positions were stuck at once, one for over 40 hours, leaving parts of the fleet unable to trade. Finished trades are now recognised from their on-chain record, a stuck position is released automatically instead of waiting forever, and the database itself now refuses to move a settled trade back to open. (`/sniper/experiments`) `[fix]`
## 2026-07-26
@@ -32,6 +35,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **The Wardrobe opens: browse the garment catalog and forge your own pieces** — A new public page, three.ws/wardrobe, shows every wearable in the garment catalog with search, slot filters, and an inline 3D viewer for any piece. It is also the first place anyone can generate a garment: type a description, pick a slot, and watch the real pipeline stages as the piece is built, rigged, validated, and published for everyone. Your avatar cards also gained a Customize button that opens the editor where outfits are worn and saved. (`/wardrobe`) `[feature]`
- **The Worlds lobby stays live through market-data outages** — The coin-worlds lobby used to go dark when both of its external trending feeds (Birdeye and pump.fun) were down or rate-limited at the same time. It now falls back to the platform's own launch recorder, which ingests thousands of new pump.fun coins per hour, so the lobby keeps showing real, current coins even when every outside feed fails. (`/worlds`) `[improvement, infra]`
- **Trading fleet: no more stuck positions blocking an agent from trading** — Some completed sells close their token account on-chain to reclaim rent, and the fleet could not see those exits: the position looked open forever and quietly blocked its agent from taking any new trades (four agents sat idle up to 34 hours). The reconciler now reads the full on-chain history even for closed accounts, books the real proceeds, and frees the agent immediately. (`/sniper/experiments`) `[fix]`
+- **Your agents can buy assets and coins from their own wallets** — Following the payment-method work in checkout, agents with their own funds can now also buy whole marketplace assets (avatars, agents, plugins) and trade coins in the in-world coin widget. The asset purchase window lists your agents with their USDC balances, and the coin widget gets a "Pay with" selector for SOL-priced coins. Both settle from the agent wallet server-side with no browser extension. One daily purchase limit now covers skills and assets together, so a budget spent on one is not quietly available again for the other. (`/marketplace`) `[feature]`
## 2026-07-25
diff --git a/api/_lib/migrations/20260727174500_sniper_no_resurrect_closed.sql b/api/_lib/migrations/20260727174500_sniper_no_resurrect_closed.sql
new file mode 100644
index 000000000..41c34caa4
--- /dev/null
+++ b/api/_lib/migrations/20260727174500_sniper_no_resurrect_closed.sql
@@ -0,0 +1,67 @@
+-- A settled position can never return to 'open'. Enforced in the database.
+--
+-- The worker's reconcile park wrote `SET status = 'open', error =
+-- 'reconcile_pending'` with no status guard, so it also resurrected rows that
+-- had been CLOSED concurrently — by a reconcile that landed in another sweep, or
+-- by an operator clearing a wedge. A resurrected row keeps its sell_sig,
+-- closed_at, exit_reason and realized P&L while reading status='open': the trade
+-- is settled and its proceeds are already booked, yet it counts as live risk,
+-- renders as an open position on trader pages, and permanently holds one of its
+-- arm's max_concurrent_positions slots. Observed twice in production on the same
+-- rows within 24 hours.
+--
+-- The code-side guard ships in the worker (executor.js), but the worker is a
+-- separately deployed service and the invariant is not code-specific: nothing
+-- should ever move a settled position back to open, whatever is running. So the
+-- rule lives here, where every writer is subject to it and no deploy is needed.
+--
+-- Coerce rather than raise: a resurrection attempt is a bug in the caller, not a
+-- reason to fail its transaction and abandon the rest of the sweep. The row
+-- keeps its settled status, every other column in the UPDATE still applies, and
+-- the attempt is visible in the sniper_resurrect_attempts counter below.
+--
+-- Idempotent, safe to re-run.
+
+CREATE TABLE IF NOT EXISTS sniper_resurrect_attempts (
+ id BIGSERIAL PRIMARY KEY,
+ position_id UUID NOT NULL,
+ attempted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
+ from_status TEXT,
+ to_status TEXT
+);
+
+COMMENT ON TABLE sniper_resurrect_attempts IS
+ 'Audit of blocked attempts to move a settled (closed) position back to an open state. A non-empty recent window means some writer still carries the unguarded reconcile park.';
+
+CREATE INDEX IF NOT EXISTS idx_sniper_resurrect_attempts_at
+ ON sniper_resurrect_attempts (attempted_at DESC);
+
+CREATE OR REPLACE FUNCTION sniper_block_resurrect() RETURNS TRIGGER AS $$
+BEGIN
+ -- Only a genuinely settled row is protected: closed AND stamped with when it
+ -- closed. A row merely marked 'closed' with no closed_at is mid-write and left
+ -- alone, so no legitimate close path is affected.
+ IF OLD.status = 'closed' AND OLD.closed_at IS NOT NULL AND NEW.status <> 'closed' THEN
+ INSERT INTO sniper_resurrect_attempts (position_id, from_status, to_status)
+ VALUES (OLD.id, OLD.status, NEW.status);
+ NEW.status := 'closed';
+ NEW.closed_at := OLD.closed_at;
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE plpgsql;
+
+DROP TRIGGER IF EXISTS trg_sniper_block_resurrect ON agent_sniper_positions;
+CREATE TRIGGER trg_sniper_block_resurrect
+ BEFORE UPDATE ON agent_sniper_positions
+ FOR EACH ROW
+ EXECUTE FUNCTION sniper_block_resurrect();
+
+-- Repair anything already resurrected: a row carrying a real exit is settled,
+-- whatever overwrote its status.
+UPDATE agent_sniper_positions
+SET status = 'closed'
+WHERE status <> 'closed'
+ AND closed_at IS NOT NULL
+ AND sell_sig IS NOT NULL
+ AND realized_pnl_lamports IS NOT NULL;
diff --git a/data/changelog.json b/data/changelog.json
index 299968c9e..f01deb94f 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,25 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-27",
+ "title": "Solana name registration works again, and embeds stop crashing on older phones",
+ "summary": "Claiming a .sol domain for an agent, and claiming your own name under threews.sol, both ran against a Solana naming library so old that the functions doing the registering had been renamed out from under us: the calls resolved to nothing and the whole attempt failed. The library is now current, every naming path has been re-checked against the live Solana mainnet, and handing a fresh subdomain to its new owner no longer trips over an account that the same transaction is still creating. Looking up a wallet's primary name also stops reporting a name the wallet no longer owns. Separately, the embeddable 3D avatar used a newer JavaScript feature than some older Android browsers ship, so the avatar page went blank instead of loading; the missing piece is now included in the embed, which matters because the embed is designed to run on other people's sites where we do not get to pick the browser.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/embed"
+ },
+ {
+ "date": "2026-07-27",
+ "title": "The walkaround world now has a real time of day and /play's radar",
+ "summary": "Walk your avatar into the park at dusk and it actually looks like dusk. The sun rises, arcs overhead and sets, the sky graduates from night through dawn to day, and the lights and reflections follow it, all driven by the same shared world clock the coin worlds run on, so everyone standing in the same world sees the same sky at the same moment. Indoor stages keep their authored lighting and the cycle steps aside while the camera passthrough is on. The corner map was also replaced with the rotating radar from the coin worlds: it turns under a fixed player arrow, keeps a compass and the world boundary in view, and now shows other players in their nameplate colours alongside companions, live agent desks, the named landmarks your guide walks to, and the scenery around you. Click or tap the radar to send your avatar walking there. Press M to hide or show it and it remembers your choice.",
+ "tags": [
+ "feature",
+ "improvement"
+ ],
+ "link": "/temporary"
+ },
{
"date": "2026-07-27",
"title": "3D generations that run long now hand back a handle instead of an error",
@@ -16189,6 +16208,24 @@
"improvement"
],
"link": "/create/selfie"
+ },
+ {
+ "date": "2026-07-26",
+ "title": "Your agents can buy assets and coins from their own wallets",
+ "summary": "Following the payment-method work in checkout, agents with their own funds can now also buy whole marketplace assets (avatars, agents, plugins) and trade coins in the in-world coin widget. The asset purchase window lists your agents with their USDC balances, and the coin widget gets a \"Pay with\" selector for SOL-priced coins. Both settle from the agent wallet server-side with no browser extension. One daily purchase limit now covers skills and assets together, so a budget spent on one is not quietly available again for the other.",
+ "tags": [
+ "feature"
+ ],
+ "link": "/marketplace"
+ },
+ {
+ "date": "2026-07-27",
+ "title": "Trading agents no longer lose slots to settled trades",
+ "summary": "A trade that sold successfully but whose confirmation timed out could get stuck: the agent kept treating the finished position as live, which used up one of its limited slots for new trades. Five positions were stuck at once, one for over 40 hours, leaving parts of the fleet unable to trade. Finished trades are now recognised from their on-chain record, a stuck position is released automatically instead of waiting forever, and the database itself now refuses to move a settled trade back to open.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/sniper/experiments"
}
]
}
diff --git a/public/changelog.json b/public/changelog.json
index e113d3e46..d66b7c9e0 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-27T17:19:41.445Z",
+ "generated_at": "2026-07-27T17:29:58.394Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -39,6 +39,16 @@
"fix"
]
},
+ {
+ "date": "2026-07-27",
+ "type": "update",
+ "title": "Solana name registration works again, and embeds stop crashing on older phones",
+ "summary": "Claiming a .sol domain for an agent, and claiming your own name under threews.sol, both ran against a Solana naming library so old that the functions doing the registering had been renamed out from under us: the calls resolved to nothing and the whole attempt failed. The library is now current, every naming path has been re-checked against the live Solana mainnet, and handing a fresh subdomain to its new owner no longer trips over an account that the same transaction is still creating. Looking up a wallet's primary name also stops reporting a name the wallet no longer owns. Separately, the embeddable 3D avatar used a newer JavaScript feature than some older Android browsers ship, so the avatar page went blank instead of loading; the missing piece is now included in the embed, which matters because the embed is designed to run on other people's sites where we do not get to pick the browser.",
+ "link": "/embed",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-07-27",
"type": "update",
@@ -50,6 +60,17 @@
"improvement"
]
},
+ {
+ "date": "2026-07-27",
+ "type": "update",
+ "title": "The walkaround world now has a real time of day and /play's radar",
+ "summary": "Walk your avatar into the park at dusk and it actually looks like dusk. The sun rises, arcs overhead and sets, the sky graduates from night through dawn to day, and the lights and reflections follow it, all driven by the same shared world clock the coin worlds run on, so everyone standing in the same world sees the same sky at the same moment. Indoor stages keep their authored lighting and the cycle steps aside while the camera passthrough is on. The corner map was also replaced with the rotating radar from the coin worlds: it turns under a fixed player arrow, keeps a compass and the world boundary in view, and now shows other players in their nameplate colours alongside companions, live agent desks, the named landmarks your guide walks to, and the scenery around you. Click or tap the radar to send your avatar walking there. Press M to hide or show it and it remembers your choice.",
+ "link": "/temporary",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-27",
"type": "update",
@@ -71,6 +92,16 @@
"improvement"
]
},
+ {
+ "date": "2026-07-27",
+ "type": "update",
+ "title": "Trading agents no longer lose slots to settled trades",
+ "summary": "A trade that sold successfully but whose confirmation timed out could get stuck: the agent kept treating the finished position as live, which used up one of its limited slots for new trades. Five positions were stuck at once, one for over 40 hours, leaving parts of the fleet unable to trade. Finished trades are now recognised from their on-chain record, a stuck position is released automatically instead of waiting forever, and the database itself now refuses to move a settled trade back to open.",
+ "link": "/sniper/experiments",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-07-26",
"type": "launch",
@@ -250,6 +281,16 @@
"fix"
]
},
+ {
+ "date": "2026-07-26",
+ "type": "update",
+ "title": "Your agents can buy assets and coins from their own wallets",
+ "summary": "Following the payment-method work in checkout, agents with their own funds can now also buy whole marketplace assets (avatars, agents, plugins) and trade coins in the in-world coin widget. The asset purchase window lists your agents with their USDC balances, and the coin widget gets a \"Pay with\" selector for SOL-priced coins. Both settle from the agent wallet server-side with no browser extension. One daily purchase limit now covers skills and assets together, so a budget spent on one is not quietly available again for the other.",
+ "link": "/marketplace",
+ "tags": [
+ "feature"
+ ]
+ },
{
"date": "2026-07-25",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index 7c539ac5c..9cfe81d29 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -30,6 +30,14 @@
<category>improvement</category>
<description>Generated caps could come out with brims jutting past the face, and sneakers could hover away from the feet, because the forge sized those pieces by width alone: a deep-brimmed cap or a photographed pair of shoes standing close together gave the sizing step no useful signal. Caps are now scaled to fit the head on every dimension, and shoes are sized by foot length and placed onto each foot individually. Measured on a walking avatar, the worst-case gap between shoe and foot dropped from 34cm to 3cm, and cap overhang from 21cm to 8cm. Every piece in the catalog is now checked automatically: it must load, match its published fingerprint, and bind correctly onto four different avatar skeletons before it counts as good, with the pieces that failed the new bar replaced. A daily check also watches the live catalog for anything that breaks after the fact.</description>
</item>
+ <item>
+ <title>Solana name registration works again, and embeds stop crashing on older phones</title>
+ <link>https://three.ws/embed</link>
+ <guid isPermaLink="false">2026-07-27:Solana name registration works again, and embeds stop crashing on older phones</guid>
+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Claiming a .sol domain for an agent, and claiming your own name under threews.sol, both ran against a Solana naming library so old that the functions doing the registering had been renamed out from under us: the calls resolved to nothing and the whole attempt failed. The library is now current, every naming path has been re-checked against the live Solana mainnet, and handing a fresh subdomain to its new owner no longer trips over an account that the same transaction is still creating. Looking up a wallet's primary name also stops reporting a name the wallet no longer owns. Separately, the embeddable 3D avatar used a newer JavaScript feature than some older Android browsers ship, so the avatar page went blank instead of loading; the missing piece is now included in the embed, which matters because the embed is designed to run on other people's sites where we do not get to pick the browser.</description>
+ </item>
<item>
<title>The 3D forge accepts all six reference photos again</title>
<link>https://three.ws/forge</link>
@@ -38,6 +46,14 @@
<category>fix</category>
<description>The photo composer advertised six reference views but only built four slots, so filling the last one threw an error and stopped the upload. All six slots are now real and usable, which is the full set the generator accepts, and more views produce a sharper mesh. Text prompts also retry once when the concept-image step returns an empty result, instead of falling back to a lower-quality image lane.</description>
</item>
+ <item>
+ <title>The walkaround world now has a real time of day and /play's radar</title>
+ <link>https://three.ws/temporary</link>
+ <guid isPermaLink="false">2026-07-27:The walkaround world now has a real time of day and /play's radar</guid>
+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Walk your avatar into the park at dusk and it actually looks like dusk. The sun rises, arcs overhead and sets, the sky graduates from night through dawn to day, and the lights and reflections follow it, all driven by the same shared world clock the coin worlds run on, so everyone standing in the same world sees the same sky at the same moment. Indoor stages keep their authored lighting and the cycle steps aside while the camera passthrough is on. The corner map was also replaced with the rotating radar from the coin worlds: it turns under a fixed player arrow, keeps a compass and the world boundary in view, and now shows other players in their nameplate colours alongside companions, live agent desks, the named landmarks your guide walks to, and the scenery around you. Click or tap the radar to send your avatar walking there. Press M to hide or show it and it remembers your choice.</description>
+ </item>
<item>
<title>The x402 payment lanes now stop when the treasury runs dry</title>
<link>https://three.ws/changelog</link>
@@ -54,6 +70,14 @@
<category>improvement</category>
<description>The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money.</description>
</item>
+ <item>
+ <title>Trading agents no longer lose slots to settled trades</title>
+ <link>https://three.ws/sniper/experiments</link>
+ <guid isPermaLink="false">2026-07-27:Trading agents no longer lose slots to settled trades</guid>
+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>A trade that sold successfully but whose confirmation timed out could get stuck: the agent kept treating the finished position as live, which used up one of its limited slots for new trades. Five positions were stuck at once, one for over 40 hours, leaving parts of the fleet unable to trade. Finished trades are now recognised from their on-chain record, a stuck position is released automatically instead of waiting forever, and the database itself now refuses to move a settled trade back to open.</description>
+ </item>
<item>
<title>Wardrobe</title>
<link>https://three.ws/wardrobe</link>
@@ -190,6 +214,14 @@
<category>fix</category>
<description>Some completed sells close their token account on-chain to reclaim rent, and the fleet could not see those exits: the position looked open forever and quietly blocked its agent from taking any new trades (four agents sat idle up to 34 hours). The reconciler now reads the full on-chain history even for closed accounts, books the real proceeds, and frees the agent immediately.</description>
</item>
+ <item>
+ <title>Your agents can buy assets and coins from their own wallets</title>
+ <link>https://three.ws/marketplace</link>
+ <guid isPermaLink="false">2026-07-26:Your agents can buy assets and coins from their own wallets</guid>
+ <pubDate>Sun, 26 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>Following the payment-method work in checkout, agents with their own funds can now also buy whole marketplace assets (avatars, agents, plugins) and trade coins in the in-world coin widget. The asset purchase window lists your agents with their USDC balances, and the coin widget gets a &quot;Pay with&quot; selector for SOL-priced coins. Both settle from the agent wallet server-side with no browser extension. One daily purchase limit now covers skills and assets together, so a budget spent on one is not quietly available again for the other.</description>
+ </item>
<item>
<title>Agent-Forged Gallery</title>
<link>https://three.ws/forged</link>
diff --git a/scripts/sniper-reconcile-wedged.mjs b/scripts/sniper-reconcile-wedged.mjs
new file mode 100644
index 000000000..0de4ac7c3
--- /dev/null
+++ b/scripts/sniper-reconcile-wedged.mjs
@@ -0,0 +1,80 @@
+// Recover sniper positions wedged in `reconcile_pending`.
+//
+// A sell whose confirmation timed out may still have LANDED. The worker detects
+// that (real wallet balance 0) and looks for the transaction that emptied the
+// bag so it can book the real proceeds. When that search comes up empty the
+// position parks as `reconcile_pending` — and a parked position still counts
+// against its arm's max_concurrent_positions, so a park that never resolves
+// silently costs the arm a trading slot.
+//
+// The worker's own search missed one case: a sell usually CLOSES the token
+// account in the same transaction to reclaim rent, so looking only at live token
+// accounts finds nothing to search. Deriving the associated-token address (for
+// both token programs) recovers the history regardless, because a closed
+// account's address keeps its signatures. That fix ships in
+// workers/agent-sniper/reconcile.js; this script is the same logic runnable
+// against the database on demand, for clearing a wedge without waiting on a
+// worker deploy.
+//
+// Safe by construction: it re-reads each position's real on-chain balance first
+// and skips anything still holding tokens, so a live position is never closed.
+// Proceeds come from the emptying transaction's actual SOL delta — never
+// estimated. A position whose emptying tx cannot be found is reported and left
+// untouched.
+//
+// node scripts/sniper-reconcile-wedged.mjs
+//
+// Requires DATABASE_URL (and optionally SOLANA_RPC_URL) in .env.
+
+import { neon } from '@neondatabase/serverless';
+import * as web3 from '@solana/web3.js';
+import 'dotenv/config';
+const sql = neon(process.env.DATABASE_URL);
+const conn = new web3.Connection(process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com', 'confirmed');
+const ATP = new web3.PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
+const PROGS = ['TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA','TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'].map(p => new web3.PublicKey(p));
+
+const pos = await sql`SELECT id, symbol, mint, wallet, buy_sig, entry_quote_lamports, realized_pnl_lamports
+ FROM agent_sniper_positions
+ WHERE status IN ('open','closing') AND error = 'reconcile_pending'`;
+if (!pos.length) console.log('nothing wedged');
+for (const p of pos) {
+ const ownerPk = new web3.PublicKey(p.wallet), mintPk = new web3.PublicKey(p.mint);
+ let bal = 0n;
+ try {
+ const acc = await conn.getParsedTokenAccountsByOwner(ownerPk, { mint: mintPk });
+ for (const { account } of acc.value) bal += BigInt(account.data.parsed.info.tokenAmount.amount);
+ } catch { console.log(p.symbol, '| balance read failed, left alone'); continue; }
+ if (bal > 0n) { console.log(p.symbol, '| STILL HOLDS tokens, left open (real position)'); continue; }
+ let done = false;
+ for (const tp of PROGS) {
+ if (done) break;
+ const [ata] = web3.PublicKey.findProgramAddressSync([ownerPk.toBuffer(), tp.toBuffer(), mintPk.toBuffer()], ATP);
+ const sigs = await conn.getSignaturesForAddress(ata, { limit: 20 }).catch(() => []);
+ for (const s of sigs) {
+ if (s.err || s.signature === p.buy_sig) continue;
+ const tx = await conn.getParsedTransaction(s.signature, { maxSupportedTransactionVersion: 0 }).catch(() => null);
+ if (!tx || tx.meta?.err) continue;
+ const pre = (tx.meta?.preTokenBalances || []).find(b => b.owner === p.wallet && b.mint === p.mint);
+ const post = (tx.meta?.postTokenBalances || []).find(b => b.owner === p.wallet && b.mint === p.mint);
+ const preAmt = pre ? BigInt(pre.uiTokenAmount.amount) : 0n;
+ const postAmt = post ? BigInt(post.uiTokenAmount.amount) : 0n;
+ if (preAmt > 0n && postAmt === 0n) {
+ const keys = tx.transaction.message.accountKeys || [];
+ const idx = keys.findIndex(k => (k.pubkey?.toBase58?.() || String(k.pubkey)) === p.wallet);
+ const delta = idx >= 0 ? BigInt(tx.meta.postBalances[idx]) - BigInt(tx.meta.preBalances[idx]) : 0n;
+ const proceeds = delta > 0n ? delta : 0n;
+ const entry = BigInt(p.entry_quote_lamports || '0');
+ const realized = BigInt(p.realized_pnl_lamports || '0') + proceeds - entry;
+ const pct = entry > 0n ? (Number(realized) / Number(entry)) * 100 : 0;
+ await sql`UPDATE agent_sniper_positions SET status='closed', exit_reason='timeout', sell_sig=${s.signature},
+ exit_quote_lamports=${proceeds.toString()}, realized_pnl_lamports=${realized.toString()},
+ realized_pnl_pct=${pct}, error='reconciled_onchain', reconcile_pending_since=NULL, closed_at=now()
+ WHERE id=${p.id} AND status <> 'closed'`;
+ console.log('RECONCILED', p.symbol, (Number(realized)/1e9).toFixed(4), 'SOL (' + pct.toFixed(1) + '%)');
+ done = true; break;
+ }
+ }
+ }
+ if (!done) console.log('UNRESOLVED', p.symbol, '(bag gone, emptying tx not found)');
+}