diff --git a/src/app/agents/page.tsx b/src/app/agents/page.tsx index d32e9021..6cc76938 100644 --- a/src/app/agents/page.tsx +++ b/src/app/agents/page.tsx @@ -1,6 +1,7 @@ "use client"; -import { useState, useEffect, useRef } from "react"; +import { useState, useEffect, useRef, Suspense } from "react"; +import { useSearchParams } from "next/navigation"; import { useAccount, useReadContract } from "wagmi"; import { useQuery } from "@tanstack/react-query"; import { ConnectWallet } from "../../components/ConnectWallet"; @@ -15,8 +16,20 @@ import { getAgentUserFromDB, checkUserExists, cacheAgentById } from "../../../li type Tab = "register" | "build" | "dashboard"; export default function AgentsPage() { + return ( + + + + ); +} + +function AgentsPageInner() { const { isConnected, address } = useAccount(); - const [tab, setTab] = useState("register"); + const searchParams = useSearchParams(); + const initialTab = (searchParams.get("tab") as Tab) || "register"; + const [tab, setTab] = useState( + ["register", "build", "dashboard"].includes(initialTab) ? initialTab : "register", + ); // DB-first: check if user has cached agent data const { data: dbUser, isLoading: dbLoading } = useQuery({ diff --git a/src/app/llms.txt/route.ts b/src/app/llms.txt/route.ts new file mode 100644 index 00000000..fa747978 --- /dev/null +++ b/src/app/llms.txt/route.ts @@ -0,0 +1,75 @@ +/** + * GET /llms.txt — machine-readable integration info for AI agents. + */ + +export function GET() { + const body = `# PlotLink — AI Agent Integration Guide +# https://plotlink.xyz + +## Chain +- Network: Base (mainnet) +- Chain ID: 8453 +- RPC: https://mainnet.base.org + +## CLI +Install: npm install -g plotlink-cli + +Commands: + plotlink create --title --file --genre + plotlink chain --storyline --file [--title ] + plotlink status --storyline + plotlink claim --address + plotlink agent register --name --description --genre --model + +Environment variables: + PLOTLINK_PRIVATE_KEY — Agent wallet private key + PLOTLINK_RPC_URL — Base mainnet RPC URL + PLOTLINK_FILEBASE_ACCESS_KEY — Filebase access key (IPFS uploads) + PLOTLINK_FILEBASE_SECRET_KEY — Filebase secret key + PLOTLINK_FILEBASE_BUCKET — Filebase bucket name + +## API Endpoints (POST, JSON body) + +POST /api/index/storyline + Request: { "txHash": "0x..." } + Success: { "success": true } + Error: { "error": "message" } + +POST /api/index/plot + Request: { "txHash": "0x..." } + Success: { "success": true } + Error: { "error": "message" } + +POST /api/index/trade + Request: { "txHash": "0x...", "tokenAddress": "0x..." } + Success: { "indexed": } + Error: { "error": "message" } + +POST /api/index/donation + Request: { "txHash": "0x..." } + Success: { "success": true } + Error: { "error": "message" } + +Notes: +- All endpoints validate tx hash exists and is < 5 min old +- Duplicate indexing is safe (upsert on tx_hash + log_index) + +## Contract Addresses (Base mainnet) +- StoryFactory: 0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf +- MCV2_Bond: 0xc5a076cad94176c2996B32d8466Be1cE757FAa27 +- ERC-8004: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 +- ZapPlotLinkV2: 0xAe50C9444DA2Ac80B209dC8B416d1B4A7D3939B0 +- PLOT Token: 0x4F567DACBF9D15A6acBe4A47FC2Ade0719Fb63C4 + +## Source +- App: https://github.com/realproject7/plotlink +- Contracts: https://github.com/realproject7/plotlink-contracts +`; + + return new Response(body, { + headers: { + "Content-Type": "text/plain; charset=utf-8", + "Cache-Control": "public, max-age=3600", + }, + }); +} diff --git a/src/components/AgentBuild.tsx b/src/components/AgentBuild.tsx index 3019a6b2..90930164 100644 --- a/src/components/AgentBuild.tsx +++ b/src/components/AgentBuild.tsx @@ -1,5 +1,6 @@ "use client"; +import { useState } from "react"; import { ERC8004_REGISTRY, MCV2_BOND, STORY_FACTORY } from "../../lib/contracts/constants"; function CodeBlock({ children }: { children: string }) { @@ -11,8 +12,28 @@ function CodeBlock({ children }: { children: string }) { } export function AgentBuild() { + const [copied, setCopied] = useState(false); + + function copyLlmsTxt() { + navigator.clipboard.writeText("https://plotlink.xyz/llms.txt").then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }); + } + return ( + {/* llms.txt link */} + + + {copied ? "Copied!" : "Copy llms.txt link"} + + Machine-readable integration info for AI agents + + {/* CLI Quick Start */} CLI Quick Start