@dainprotocol/cli 1.0.10 → 1.0.11

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.
@@ -1,8 +1,10 @@
1
+ //File: example/example-node.ts
2
+
1
3
  import { z } from "zod";
2
4
 
3
- import { DAINService } from "@dainprotocol/service-sdk";
5
+ import {defineDAINService, ToolConfig, ServiceConfig, ToolboxConfig} from "@dainprotocol/service-sdk";
4
6
 
5
- const getWeatherConfig: DAINService.ToolConfig = {
7
+ const getWeatherConfig: ToolConfig = {
6
8
  id: "get-weather",
7
9
  name: "Get Weather",
8
10
  description: "Fetches current weather for a city",
@@ -21,7 +23,12 @@ const getWeatherConfig: DAINService.ToolConfig = {
21
23
  .describe("Weather information for the requested city"),
22
24
  pricing: { pricePerUse: 0.01, currency: "USD" },
23
25
  handler: async ({ city }, agentInfo) => {
26
+
27
+
24
28
  console.log(`Agent ${agentInfo.agentId} requested weather for ${city}`);
29
+
30
+
31
+
25
32
  return {
26
33
  text: `The current weather in ${city} is 22°C and Sunny`,
27
34
  data: { temperature: 22, condition: "Sunny" },
@@ -33,7 +40,7 @@ const getWeatherConfig: DAINService.ToolConfig = {
33
40
  },
34
41
  };
35
42
 
36
- const getWeatherForecastConfig: DAINService.ToolConfig = {
43
+ const getWeatherForecastConfig: ToolConfig = {
37
44
  id: "get-weather-forecast",
38
45
  name: "Get Weather Forecast",
39
46
  description: "Fetches a 5-day weather forecast for a city",
@@ -70,7 +77,7 @@ const getWeatherForecastConfig: DAINService.ToolConfig = {
70
77
  },
71
78
  };
72
79
 
73
- const getAirQualityConfig: DAINService.ToolConfig = {
80
+ const getAirQualityConfig: ToolConfig = {
74
81
  id: "get-air-quality",
75
82
  name: "Get Air Quality",
76
83
  description: "Fetches air quality information for a city",
@@ -99,7 +106,7 @@ const getAirQualityConfig: DAINService.ToolConfig = {
99
106
  },
100
107
  };
101
108
 
102
- const getHistoricalWeatherConfig: DAINService.ToolConfig = {
109
+ const getHistoricalWeatherConfig: ToolConfig = {
103
110
  id: "get-historical-weather",
104
111
  name: "Get Historical Weather",
105
112
  description: "Retrieves historical weather data for a specific date and city",
@@ -129,7 +136,7 @@ const getHistoricalWeatherConfig: DAINService.ToolConfig = {
129
136
  },
130
137
  };
131
138
 
132
- const weatherServiceConfig: DAINService.ServiceConfig = {
139
+ const weatherServiceConfig: ServiceConfig = {
133
140
  id: "weather-service",
134
141
  name: "Weather Service",
135
142
  description: "Provides comprehensive weather information",
@@ -152,7 +159,7 @@ const weatherServiceConfig: DAINService.ServiceConfig = {
152
159
  ],
153
160
  };
154
161
 
155
- const weatherToolboxConfig: DAINService.ToolboxConfig = {
162
+ const weatherToolboxConfig: ToolboxConfig = {
156
163
  id: "weather-toolbox",
157
164
  name: "Weather Toolbox",
158
165
  description: "Collection of weather-related tools",
@@ -170,7 +177,7 @@ const weatherToolboxConfig: DAINService.ToolboxConfig = {
170
177
  "Use these tools for various weather-related tasks and analyses",
171
178
  };
172
179
 
173
- const dainService = DAINService.defineDAINService({
180
+ const dainService = defineDAINService({
174
181
  metadata: {
175
182
  title: "Comprehensive Weather DAIN Service",
176
183
  description:
@@ -181,7 +188,7 @@ const dainService = DAINService.defineDAINService({
181
188
  },
182
189
  identity: {
183
190
  apiKey:
184
- "sk_agent_3_0_49bhyNKMYYH3TtjqycgKQCBhUuTu4bnYvKzStv3bBmKaY55LMBmLVQR1wAtkizdGPM3wBAA2X6rfYpfpEuisx5Cc",
191
+ process.env.DAIN_API_KEY,
185
192
  },
186
193
  services: [weatherServiceConfig],
187
194
  tools: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "CLI for Dain Protocol",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,8 +1,10 @@
1
+ //File: example/example-node.ts
2
+
1
3
  import { z } from "zod";
2
4
 
3
- import { DAINService } from "@dainprotocol/service-sdk";
5
+ import {defineDAINService, ToolConfig, ServiceConfig, ToolboxConfig} from "@dainprotocol/service-sdk";
4
6
 
5
- const getWeatherConfig: DAINService.ToolConfig = {
7
+ const getWeatherConfig: ToolConfig = {
6
8
  id: "get-weather",
7
9
  name: "Get Weather",
8
10
  description: "Fetches current weather for a city",
@@ -21,7 +23,12 @@ const getWeatherConfig: DAINService.ToolConfig = {
21
23
  .describe("Weather information for the requested city"),
22
24
  pricing: { pricePerUse: 0.01, currency: "USD" },
23
25
  handler: async ({ city }, agentInfo) => {
26
+
27
+
24
28
  console.log(`Agent ${agentInfo.agentId} requested weather for ${city}`);
29
+
30
+
31
+
25
32
  return {
26
33
  text: `The current weather in ${city} is 22°C and Sunny`,
27
34
  data: { temperature: 22, condition: "Sunny" },
@@ -33,7 +40,7 @@ const getWeatherConfig: DAINService.ToolConfig = {
33
40
  },
34
41
  };
35
42
 
36
- const getWeatherForecastConfig: DAINService.ToolConfig = {
43
+ const getWeatherForecastConfig: ToolConfig = {
37
44
  id: "get-weather-forecast",
38
45
  name: "Get Weather Forecast",
39
46
  description: "Fetches a 5-day weather forecast for a city",
@@ -70,7 +77,7 @@ const getWeatherForecastConfig: DAINService.ToolConfig = {
70
77
  },
71
78
  };
72
79
 
73
- const getAirQualityConfig: DAINService.ToolConfig = {
80
+ const getAirQualityConfig: ToolConfig = {
74
81
  id: "get-air-quality",
75
82
  name: "Get Air Quality",
76
83
  description: "Fetches air quality information for a city",
@@ -99,7 +106,7 @@ const getAirQualityConfig: DAINService.ToolConfig = {
99
106
  },
100
107
  };
101
108
 
102
- const getHistoricalWeatherConfig: DAINService.ToolConfig = {
109
+ const getHistoricalWeatherConfig: ToolConfig = {
103
110
  id: "get-historical-weather",
104
111
  name: "Get Historical Weather",
105
112
  description: "Retrieves historical weather data for a specific date and city",
@@ -129,7 +136,7 @@ const getHistoricalWeatherConfig: DAINService.ToolConfig = {
129
136
  },
130
137
  };
131
138
 
132
- const weatherServiceConfig: DAINService.ServiceConfig = {
139
+ const weatherServiceConfig: ServiceConfig = {
133
140
  id: "weather-service",
134
141
  name: "Weather Service",
135
142
  description: "Provides comprehensive weather information",
@@ -152,7 +159,7 @@ const weatherServiceConfig: DAINService.ServiceConfig = {
152
159
  ],
153
160
  };
154
161
 
155
- const weatherToolboxConfig: DAINService.ToolboxConfig = {
162
+ const weatherToolboxConfig: ToolboxConfig = {
156
163
  id: "weather-toolbox",
157
164
  name: "Weather Toolbox",
158
165
  description: "Collection of weather-related tools",
@@ -170,7 +177,7 @@ const weatherToolboxConfig: DAINService.ToolboxConfig = {
170
177
  "Use these tools for various weather-related tasks and analyses",
171
178
  };
172
179
 
173
- const dainService = DAINService.defineDAINService({
180
+ const dainService = defineDAINService({
174
181
  metadata: {
175
182
  title: "Comprehensive Weather DAIN Service",
176
183
  description:
@@ -181,7 +188,7 @@ const dainService = DAINService.defineDAINService({
181
188
  },
182
189
  identity: {
183
190
  apiKey:
184
- "sk_agent_3_0_49bhyNKMYYH3TtjqycgKQCBhUuTu4bnYvKzStv3bBmKaY55LMBmLVQR1wAtkizdGPM3wBAA2X6rfYpfpEuisx5Cc",
191
+ process.env.DAIN_API_KEY,
185
192
  },
186
193
  services: [weatherServiceConfig],
187
194
  tools: [