@qwen-code/arena-agent 0.0.9-dev.1 → 0.0.9-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +29 -0
- package/README.md +126 -11
- package/dist/agent.d.ts +4 -2
- package/dist/agent.js +116 -15
- package/dist/agent.js.map +1 -1
- package/dist/ask-user.d.ts +20 -0
- package/dist/ask-user.js +388 -0
- package/dist/ask-user.js.map +1 -0
- package/dist/canonical-data.d.ts +1 -0
- package/dist/canonical-data.js +1 -0
- package/dist/canonical-data.js.map +1 -1
- package/dist/cli.js +29 -10
- package/dist/cli.js.map +1 -1
- package/dist/code-cli.d.ts +2 -0
- package/dist/code-cli.js +12 -0
- package/dist/code-cli.js.map +1 -0
- package/dist/code-tools.d.ts +73 -0
- package/dist/code-tools.js +2106 -0
- package/dist/code-tools.js.map +1 -0
- package/dist/config.d.ts +12 -1
- package/dist/config.js +66 -3
- package/dist/config.js.map +1 -1
- package/dist/document-reader.js +9 -0
- package/dist/document-reader.js.map +1 -1
- package/dist/fetch-page.d.ts +2 -0
- package/dist/fetch-page.js +50 -21
- package/dist/fetch-page.js.map +1 -1
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/history.js.map +1 -1
- package/dist/mode.d.ts +6 -0
- package/dist/mode.js +33 -0
- package/dist/mode.js.map +1 -0
- package/dist/model-capabilities.d.ts +20 -0
- package/dist/model-capabilities.js +98 -0
- package/dist/model-capabilities.js.map +1 -0
- package/dist/model-diagnostics.d.ts +32 -0
- package/dist/model-diagnostics.js +365 -0
- package/dist/model-diagnostics.js.map +1 -0
- package/dist/provider.d.ts +16 -0
- package/dist/provider.js +328 -37
- package/dist/provider.js.map +1 -1
- package/dist/sdk.d.ts +26 -1
- package/dist/sdk.js +1 -0
- package/dist/sdk.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +11 -2
- package/dist/server.js.map +1 -1
- package/dist/spec.d.ts +11 -8
- package/dist/spec.js +105 -13
- package/dist/spec.js.map +1 -1
- package/dist/tools.d.ts +11 -28
- package/dist/tools.js +60 -11
- package/dist/tools.js.map +1 -1
- package/dist/tui.d.ts +2 -0
- package/dist/tui.js +8 -2
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/workspace.d.ts +12 -0
- package/dist/workspace.js +165 -0
- package/dist/workspace.js.map +1 -0
- package/docs/BINARY_DISTRIBUTION.md +224 -0
- package/docs/MODES_AND_RELEASES.md +119 -0
- package/modes/code-arena/full-stack/system-prompt.txt +77 -0
- package/modes/code-arena/full-stack/template/.env +1 -0
- package/modes/code-arena/full-stack/template/drizzle.config.json +7 -0
- package/modes/code-arena/full-stack/template/eslint.config.mjs +9 -0
- package/modes/code-arena/full-stack/template/next.config.ts +5 -0
- package/modes/code-arena/full-stack/template/package.json +32 -0
- package/modes/code-arena/full-stack/template/postcss.config.mjs +7 -0
- package/modes/code-arena/full-stack/template/src/app/api/health/route.ts +13 -0
- package/modes/code-arena/full-stack/template/src/app/globals.css +1 -0
- package/modes/code-arena/full-stack/template/src/app/layout.tsx +16 -0
- package/modes/code-arena/full-stack/template/src/app/page.tsx +22 -0
- package/modes/code-arena/full-stack/template/src/db/index.ts +24 -0
- package/modes/code-arena/full-stack/template/src/db/schema.ts +3 -0
- package/modes/code-arena/full-stack/template/tsconfig.json +24 -0
- package/modes/code-arena/full-stack/tools.json +446 -0
- package/modes/code-arena/html/system-prompt.txt +36 -0
- package/modes/code-arena/html/tools.json +284 -0
- package/modes/code-arena/model.json +10 -0
- package/modes/code-arena/react/system-prompt.txt +33 -0
- package/modes/code-arena/react/template/index.html +12 -0
- package/modes/code-arena/react/template/package.json +28 -0
- package/modes/code-arena/react/template/src/App.tsx +28 -0
- package/modes/code-arena/react/template/src/index.css +1 -0
- package/modes/code-arena/react/template/src/main.tsx +10 -0
- package/modes/code-arena/react/template/src/utils/cn.ts +6 -0
- package/modes/code-arena/react/template/tsconfig.json +25 -0
- package/modes/code-arena/react/template/vite.config.ts +18 -0
- package/modes/code-arena/react/tools.json +410 -0
- package/package.json +18 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
You are an expert fullstack developer building web applications with Next.js (App Router) and PostgreSQL via Drizzle ORM. You will use the provided tools to view, create, and edit files in the project.
|
|
2
|
+
For any user prompt, always try to generate a working fullstack web application. Always just update the code instead of asking the user to confirm details.
|
|
3
|
+
|
|
4
|
+
## Critical File Operations
|
|
5
|
+
|
|
6
|
+
All file operations must be done exclusively through the provided tools. After using a tool, provide only a brief summary of what you did - DO NOT output the actual code content in your response text.
|
|
7
|
+
You can use 'list_files', 'grep_files', 'glob_files', and 'bash' to explore the project, search file contents by regex, and discover files by name pattern.
|
|
8
|
+
|
|
9
|
+
## Web Research
|
|
10
|
+
|
|
11
|
+
You have access to 'web_search' and 'web_fetch' tools for researching information on the internet.
|
|
12
|
+
- Use 'web_search' to find documentation, API references, examples, or any facts you need. This is especially useful when the user asks you to integrate a third-party API or library you're not fully familiar with.
|
|
13
|
+
- Use 'web_fetch' to read the content of a specific web page, such as documentation or API reference pages found via search.
|
|
14
|
+
- When the user's request involves a specific API, service, or library, proactively search for its documentation to ensure you use the correct endpoints, parameters, and authentication methods rather than guessing.
|
|
15
|
+
|
|
16
|
+
## Task Planning
|
|
17
|
+
|
|
18
|
+
You have a maximum of 50 sequential tool-calling steps to complete the task. Plan your approach carefully and prioritize the most critical changes first to work within this limit.
|
|
19
|
+
|
|
20
|
+
For each file you create or edit, you must first explain what you are about to do, then call the tool, then confirm the result.
|
|
21
|
+
|
|
22
|
+
Do not ask me for anything. Go with your recommendation.
|
|
23
|
+
|
|
24
|
+
## Database
|
|
25
|
+
|
|
26
|
+
The project connects to a local PostgreSQL instance via Drizzle ORM.
|
|
27
|
+
- The database connection is configured in `src/db/index.ts` and reads `DATABASE_URL` from the `.env` file.
|
|
28
|
+
- Use Drizzle ORM for all database interactions. Import the `db` client from `@/db`.
|
|
29
|
+
- Tailwind CSS is already installed and wired through `src/app/globals.css`, so you can use Tailwind utility classes immediately.
|
|
30
|
+
- When defining new tables, edit `src/db/schema.ts` and use `drizzle-orm/pg-core`.
|
|
31
|
+
- If you need to apply schema changes in a fresh sandbox, call `build_and_start` first so the environment is bootstrapped and dependencies are installed.
|
|
32
|
+
- After `build_and_start` has prepared the environment, you may use the `bash` tool to run `npx drizzle-kit push` to apply schema changes directly without migration files.
|
|
33
|
+
- If you apply schema changes after a previously passing validation run, rerun the full validation sequence and end with `build_and_start` again.
|
|
34
|
+
- You can also run raw SQL via the bash tool: `psql postgresql://postgres:postgres@127.0.0.1:5432/app_db -c "YOUR SQL"`
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
The platform builds and starts the preview after your tool calls complete.
|
|
39
|
+
Do not assume there is a running app server while you edit files.
|
|
40
|
+
Do not leave behind long-lived `next dev` or `next start` processes unless you are debugging a blocker.
|
|
41
|
+
ALWAYS create complete, functional fullstack web applications.
|
|
42
|
+
NEVER edit package.json directly. Use the 'install_npm_packages' tool to install new packages.
|
|
43
|
+
|
|
44
|
+
## Final Validation
|
|
45
|
+
|
|
46
|
+
Before you finish, you MUST use the `bash` tool to run all of these commands from the project root:
|
|
47
|
+
- `bash -lc 'set -o pipefail; npx next typegen 2>&1 | tee /tmp/next-typegen.log'`
|
|
48
|
+
- `bash -lc 'set -o pipefail; npm exec tsc -- --noEmit --pretty false 2>&1 | tee /tmp/tsc.log'`
|
|
49
|
+
- `bash -lc 'set -o pipefail; npm run build 2>&1 | tee /tmp/build.log'`
|
|
50
|
+
|
|
51
|
+
After those commands pass, you MUST call the `build_and_start` tool. This tool bootstraps the database, builds the app, starts the production server, and verifies `/api/health`.
|
|
52
|
+
|
|
53
|
+
Do not run `npm run start` or `next start` directly via `bash` as your final validation step.
|
|
54
|
+
Do not finish until type generation, TypeScript, production build, and `build_and_start` all pass.
|
|
55
|
+
Do not treat `npm run typecheck` as sufficient final validation.
|
|
56
|
+
If any validation command fails, immediately inspect the matching log before fixing the code:
|
|
57
|
+
- `cat /tmp/next-typegen.log`
|
|
58
|
+
- `cat /tmp/tsc.log`
|
|
59
|
+
- `cat /tmp/build.log`
|
|
60
|
+
If `build_and_start` fails, carefully inspect the returned `stage` and `logTail` before fixing the code.
|
|
61
|
+
If any validation step fails, keep fixing the project and do not finish yet.
|
|
62
|
+
If you make any code, package, or schema change after a passing validation run, rerun the full validation sequence before finishing.
|
|
63
|
+
Do not rely on the platform's post-turn preview build as proof the task is done; you must confirm the build yourself during the turn.
|
|
64
|
+
|
|
65
|
+
## Environment Variables
|
|
66
|
+
|
|
67
|
+
The user may have configured environment variable secrets (API keys, tokens, etc.) for this sandbox.
|
|
68
|
+
- Server-side code (API routes, server components, route handlers): access via `process.env.KEY_NAME`
|
|
69
|
+
- Client-side code: only `NEXT_PUBLIC_*` prefixed vars are exposed to the browser bundle
|
|
70
|
+
- For external API calls that require secrets, create an API route under `app/api/` that reads `process.env.KEY_NAME` and proxies the request — this keeps secrets server-side
|
|
71
|
+
- Do NOT hardcode API keys or secrets — always read from `process.env`
|
|
72
|
+
|
|
73
|
+
## Remember
|
|
74
|
+
|
|
75
|
+
Use tools for all file creation and editing. Never output code directly in your response text.
|
|
76
|
+
Feel free to use multiple files in your implementation.
|
|
77
|
+
The preview is rebuilt and restarted after you finish your edits for the turn.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/app_db
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
+
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
3
|
+
import nextTs from "eslint-config-next/typescript";
|
|
4
|
+
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
...nextVitals,
|
|
7
|
+
...nextTs,
|
|
8
|
+
globalIgnores([".next/**", "out/**", "build/**", "next-env.d.ts"]),
|
|
9
|
+
]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nextjs-postgresql-template",
|
|
3
|
+
"private": true,
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "next dev",
|
|
6
|
+
"build": "next build",
|
|
7
|
+
"start": "next start",
|
|
8
|
+
"lint": "eslint .",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"dotenv": "17.3.1",
|
|
13
|
+
"drizzle-orm": "0.45.2",
|
|
14
|
+
"next": "16.2.6",
|
|
15
|
+
"pg": "8.20.0",
|
|
16
|
+
"react": "19.2.6",
|
|
17
|
+
"react-dom": "19.2.6"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@tailwindcss/postcss": "4.1.17",
|
|
21
|
+
"@types/node": "22.19.15",
|
|
22
|
+
"@types/pg": "8.18.0",
|
|
23
|
+
"@types/react": "19.2.14",
|
|
24
|
+
"@types/react-dom": "19.2.3",
|
|
25
|
+
"drizzle-kit": "0.31.10",
|
|
26
|
+
"eslint": "9.39.4",
|
|
27
|
+
"eslint-config-next": "16.2.6",
|
|
28
|
+
"postcss": "8.5.8",
|
|
29
|
+
"tailwindcss": "4.1.17",
|
|
30
|
+
"typescript": "5.9.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { db } from "@/db";
|
|
2
|
+
import { sql } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
export async function GET() {
|
|
7
|
+
try {
|
|
8
|
+
await db.execute(sql`select 1`);
|
|
9
|
+
return Response.json({ ok: true });
|
|
10
|
+
} catch {
|
|
11
|
+
return Response.json({ ok: false }, { status: 500 });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import "./globals.css";
|
|
4
|
+
|
|
5
|
+
export const metadata: Metadata = {
|
|
6
|
+
title: "Arena Next.js PostgreSQL Starter",
|
|
7
|
+
description: "Starter template with Next.js, Drizzle, and PostgreSQL.",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<html lang="en">
|
|
13
|
+
<body className="bg-slate-100 text-slate-900 antialiased">{children}</body>
|
|
14
|
+
</html>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { db } from "@/db";
|
|
2
|
+
import { sql } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
export default async function HomePage() {
|
|
7
|
+
await db.execute(sql`select 1`);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<main className="grid min-h-screen place-items-center px-6 py-12">
|
|
11
|
+
<section className="w-full max-w-2xl rounded-3xl bg-white p-10 shadow-[0_24px_60px_rgba(16,24,40,0.12)]">
|
|
12
|
+
<p className="m-0 text-sm uppercase tracking-[0.08em] text-slate-600">Starter template</p>
|
|
13
|
+
<h1 className="mt-4 text-[clamp(2rem,5vw,3.25rem)] font-semibold leading-[1.05] text-slate-950">
|
|
14
|
+
Arena Next.js PostgreSQL Starter
|
|
15
|
+
</h1>
|
|
16
|
+
<p className="mt-4 text-base text-slate-700">
|
|
17
|
+
Server-rendered with Next.js after a successful PostgreSQL query through Drizzle.
|
|
18
|
+
</p>
|
|
19
|
+
</section>
|
|
20
|
+
</main>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
|
2
|
+
import { Pool } from "pg";
|
|
3
|
+
|
|
4
|
+
const databaseUrl = process.env.DATABASE_URL;
|
|
5
|
+
|
|
6
|
+
if (!databaseUrl) {
|
|
7
|
+
throw new Error("DATABASE_URL is required");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const globalForDb = globalThis as typeof globalThis & {
|
|
11
|
+
__arenaNextJsPostgresqlPool?: Pool;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const pool =
|
|
15
|
+
globalForDb.__arenaNextJsPostgresqlPool ??
|
|
16
|
+
new Pool({
|
|
17
|
+
connectionString: databaseUrl,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (process.env.NODE_ENV !== "production") {
|
|
21
|
+
globalForDb.__arenaNextJsPostgresqlPool = pool;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const db = drizzle(pool);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": false,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"baseUrl": ".",
|
|
17
|
+
"paths": {
|
|
18
|
+
"@/*": ["./src/*"]
|
|
19
|
+
},
|
|
20
|
+
"plugins": [{ "name": "next" }]
|
|
21
|
+
},
|
|
22
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
23
|
+
"exclude": ["node_modules"]
|
|
24
|
+
}
|