create-aixyz-app 0.0.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "create-aixyz-app",
3
- "version": "0.0.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
- "files": []
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/AgentlyHQ/aixyz.git"
8
+ },
9
+ "license": "MIT",
10
+ "author": "AgentlyHQ",
11
+ "bin": "dist/index.js",
12
+ "files": [
13
+ "dist",
14
+ "templates"
15
+ ],
16
+ "scripts": {
17
+ "build": "bun build src/index.ts --outfile dist/index.js --target node"
18
+ },
19
+ "dependencies": {
20
+ "@clack/prompts": "^1.0.1"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^22",
24
+ "typescript": "^5"
25
+ }
6
26
  }
@@ -0,0 +1,28 @@
1
+ import type { AixyzConfig } from "aixyz/config";
2
+
3
+ const config: AixyzConfig = {
4
+ name: "{{AGENT_NAME}}",
5
+ description: "AI agent created with create-aixyz-app.",
6
+ version: "0.0.0",
7
+ // You can use `process.env.YOUR_PAY_TO_ADDRESS` to conditionally set values based on the environment,
8
+ // For example, .env, .env.local, .env.production, .env.development are supported
9
+ x402: {
10
+ payTo: "0x0799872E07EA7a63c79357694504FE66EDfE4a0A",
11
+ network: process.env.NODE_ENV === "production" ? "eip155:8453" : "eip155:84532",
12
+ },
13
+ skills: [
14
+ {
15
+ id: "get-weather",
16
+ name: "Get Weather",
17
+ description: "Get current weather conditions for any city or location",
18
+ tags: ["weather", "temperature", "forecast"],
19
+ examples: [
20
+ "What's the weather in Tokyo?",
21
+ "Get me the current temperature in New York",
22
+ "How's the weather in London right now?",
23
+ ],
24
+ },
25
+ ],
26
+ };
27
+
28
+ export default config;
@@ -0,0 +1,31 @@
1
+ import { openai } from "@ai-sdk/openai";
2
+ import { stepCountIs, ToolLoopAgent } from "ai";
3
+ import type { Accepts } from "aixyz/accepts";
4
+
5
+ import weather from "./tools/weather";
6
+
7
+ // language=Markdown
8
+ const instructions = `
9
+ # Weather Agent
10
+
11
+ You are a helpful weather assistant that provides current weather information for any location worldwide.
12
+
13
+ ## Guidelines
14
+
15
+ - When a user asks about the weather, use the weather tool with the city name.
16
+ - Always ask for a location if none is provided.
17
+ - Include relevant details like temperature, feels like, humidity, wind speed, and conditions.
18
+ - Keep responses concise but informative.
19
+ `.trim();
20
+
21
+ export const accepts: Accepts = {
22
+ scheme: "exact",
23
+ price: "$0.005",
24
+ };
25
+
26
+ export default new ToolLoopAgent({
27
+ model: openai("gpt-4o-mini"),
28
+ instructions: instructions,
29
+ tools: { weather },
30
+ stopWhen: stepCountIs(10),
31
+ });
Binary file
@@ -0,0 +1,95 @@
1
+ import { tool } from "ai";
2
+ import { z } from "zod";
3
+ import { Accepts } from "aixyz/accepts";
4
+
5
+ interface GeocodingResponse {
6
+ results?: {
7
+ latitude: number;
8
+ longitude: number;
9
+ name: string;
10
+ }[];
11
+ }
12
+
13
+ interface WeatherResponse {
14
+ current: {
15
+ time: string;
16
+ temperature_2m: number;
17
+ apparent_temperature: number;
18
+ relative_humidity_2m: number;
19
+ wind_speed_10m: number;
20
+ wind_gusts_10m: number;
21
+ weather_code: number;
22
+ };
23
+ }
24
+
25
+ function getWeatherCondition(code: number): string {
26
+ const conditions: Record<number, string> = {
27
+ 0: "Clear sky",
28
+ 1: "Mainly clear",
29
+ 2: "Partly cloudy",
30
+ 3: "Overcast",
31
+ 45: "Foggy",
32
+ 48: "Depositing rime fog",
33
+ 51: "Light drizzle",
34
+ 53: "Moderate drizzle",
35
+ 55: "Dense drizzle",
36
+ 56: "Light freezing drizzle",
37
+ 57: "Dense freezing drizzle",
38
+ 61: "Slight rain",
39
+ 63: "Moderate rain",
40
+ 65: "Heavy rain",
41
+ 66: "Light freezing rain",
42
+ 67: "Heavy freezing rain",
43
+ 71: "Slight snow fall",
44
+ 73: "Moderate snow fall",
45
+ 75: "Heavy snow fall",
46
+ 77: "Snow grains",
47
+ 80: "Slight rain showers",
48
+ 81: "Moderate rain showers",
49
+ 82: "Violent rain showers",
50
+ 85: "Slight snow showers",
51
+ 86: "Heavy snow showers",
52
+ 95: "Thunderstorm",
53
+ 96: "Thunderstorm with slight hail",
54
+ 99: "Thunderstorm with heavy hail",
55
+ };
56
+ return conditions[code] ?? "Unknown";
57
+ }
58
+
59
+ export const accepts: Accepts = {
60
+ scheme: "exact",
61
+ price: "$0.0001",
62
+ };
63
+
64
+ export default tool({
65
+ description: "Get current weather conditions for a city or location.",
66
+ inputSchema: z.object({
67
+ location: z.string().describe("City name (e.g. 'Tokyo', 'New York', 'London')"),
68
+ }),
69
+ execute: async ({ location }) => {
70
+ const geocodingUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(location)}&count=1`;
71
+ const geocodingResponse = await fetch(geocodingUrl);
72
+ const geocodingData = (await geocodingResponse.json()) as GeocodingResponse;
73
+
74
+ if (!geocodingData.results?.[0]) {
75
+ throw new Error(`Location '${location}' not found`);
76
+ }
77
+
78
+ const { latitude, longitude, name } = geocodingData.results[0];
79
+
80
+ const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,wind_gusts_10m,weather_code`;
81
+ const response = await fetch(weatherUrl);
82
+ const data = (await response.json()) as WeatherResponse;
83
+
84
+ return {
85
+ location: name,
86
+ temperature: data.current.temperature_2m,
87
+ feelsLike: data.current.apparent_temperature,
88
+ humidity: data.current.relative_humidity_2m,
89
+ windSpeed: data.current.wind_speed_10m,
90
+ windGust: data.current.wind_gusts_10m,
91
+ conditions: getWeatherCondition(data.current.weather_code),
92
+ time: data.current.time,
93
+ };
94
+ },
95
+ });
@@ -0,0 +1 @@
1
+ OPENAI_API_KEY=
@@ -0,0 +1,12 @@
1
+ # dependencies
2
+ node_modules
3
+ .pnp
4
+ .pnp.js
5
+ .yarn*
6
+ pnpm-lock.yaml
7
+
8
+ # aixyz
9
+ .aixyz
10
+
11
+ # local env files
12
+ .env.local
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "{{PKG_NAME}}",
3
+ "private": true,
4
+ "scripts": {
5
+ "build": "aixyz build",
6
+ "dev": "aixyz dev"
7
+ },
8
+ "dependencies": {
9
+ "@ai-sdk/openai": "^3",
10
+ "ai": "^6",
11
+ "aixyz": "latest",
12
+ "zod": "^4"
13
+ },
14
+ "devDependencies": {
15
+ "@types/bun": "^1",
16
+ "typescript": "^5"
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "skipLibCheck": true,
8
+ "types": ["bun"]
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://openapi.vercel.sh/vercel.json",
3
+ "framework": null,
4
+ "buildCommand": "bunx aixyz build"
5
+ }