@crestal/nation-sdk 0.1.30 → 0.1.31
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/README.md +8 -7
- package/api.ts +134 -58
- package/base.ts +1 -1
- package/common.ts +1 -1
- package/configuration.ts +1 -1
- package/dist/api.d.ts +66 -33
- package/dist/api.js +152 -58
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/configuration.d.ts +1 -1
- package/dist/configuration.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/docs/AgentApi.md +3 -3
- package/docs/GeneratorApi.md +12 -12
- package/docs/LLMModelInfoWithProviderName.md +2 -2
- package/docs/OAuthApi.md +61 -8
- package/index.ts +1 -1
- package/package.json +1 -1
package/docs/AgentApi.md
CHANGED
|
@@ -18,7 +18,7 @@ All URIs are relative to *http://localhost*
|
|
|
18
18
|
# **createAgent**
|
|
19
19
|
> AgentResponse createAgent()
|
|
20
20
|
|
|
21
|
-
Create a new agent. **Request Body:** * `agent` - Agent configuration **Returns:** * `AgentResponse` - Created agent configuration with additional processed data **Raises:** * `HTTPException`: - 400: Invalid agent ID format or agent ID already exists - 500: Database error
|
|
21
|
+
Create a new agent. **Request Body:** * `agent` - Agent configuration **Returns:** * `AgentResponse` - Created agent configuration with additional processed data **Raises:** * `HTTPException`: - 400: Invalid agent ID format or agent ID already exists - 422: Invalid agent configuration from JSON schema validation - 500: Database error
|
|
22
22
|
|
|
23
23
|
### Example
|
|
24
24
|
|
|
@@ -343,7 +343,7 @@ const { status, data } = await apiInstance.importAgent(
|
|
|
343
343
|
# **overrideAgent**
|
|
344
344
|
> any overrideAgent()
|
|
345
345
|
|
|
346
|
-
Override an existing agent. Use input to override agent configuration. If some fields are not provided, they will be reset to default values. **Path Parameters:** * `agent_id` - ID of the agent to update **Request Body:** * `agent` - Agent update configuration **Returns:** * `AgentResponse` - Updated agent configuration with additional processed data **Raises:** * `HTTPException`: - 400: Invalid agent ID format - 404: Agent not found - 403: Permission denied (if owner mismatch) - 500: Database error
|
|
346
|
+
Override an existing agent. Use input to override agent configuration. If some fields are not provided, they will be reset to default values. **Path Parameters:** * `agent_id` - ID of the agent to update **Request Body:** * `agent` - Agent update configuration **Returns:** * `AgentResponse` - Updated agent configuration with additional processed data **Raises:** * `HTTPException`: - 400: Invalid agent ID format - 404: Agent not found - 403: Permission denied (if owner mismatch) - 422: Invalid agent configuration from JSON schema validation - 500: Database error
|
|
347
347
|
|
|
348
348
|
### Example
|
|
349
349
|
|
|
@@ -455,7 +455,7 @@ const { status, data } = await apiInstance.updateAgent(
|
|
|
455
455
|
# **validateAgentCreate**
|
|
456
456
|
> validateAgentCreate()
|
|
457
457
|
|
|
458
|
-
Validate agent configuration. **Request Body:** * `agent` - Agent configuration **Returns:** * `204 No Content` - Agent configuration is valid **Raises:** * `HTTPException`: - 400: Invalid agent configuration - 422: Invalid agent configuration from intentkit core - 500: Server error
|
|
458
|
+
Validate agent configuration. **Request Body:** * `agent` - Agent configuration **Returns:** * `204 No Content` - Agent configuration is valid **Raises:** * `HTTPException`: - 400: Invalid agent configuration - 422: Invalid agent configuration from intentkit core or JSON schema validation - 500: Server error
|
|
459
459
|
|
|
460
460
|
### Example
|
|
461
461
|
|
package/docs/GeneratorApi.md
CHANGED
|
@@ -4,12 +4,12 @@ All URIs are relative to *http://localhost*
|
|
|
4
4
|
|
|
5
5
|
|Method | HTTP request | Description|
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
|
-
|[**
|
|
8
|
-
|[**
|
|
9
|
-
|[**
|
|
7
|
+
|[**generateAgent**](#generateagent) | **POST** /generator/agent/generate | Generate Agent from Natural Language Prompt|
|
|
8
|
+
|[**getGenerationHistory**](#getgenerationhistory) | **GET** /generator/agent/generations/{project_id} | Get Generation Detail by Project ID|
|
|
9
|
+
|[**getGenerations**](#getgenerations) | **GET** /generator/agent/generations | Get Generations List by User|
|
|
10
10
|
|
|
11
|
-
# **
|
|
12
|
-
> AgentGenerateResponse
|
|
11
|
+
# **generateAgent**
|
|
12
|
+
> AgentGenerateResponse generateAgent(agentGenerateRequest)
|
|
13
13
|
|
|
14
14
|
Generate an agent schema from a natural language prompt. Converts plain English descriptions into complete, validated agent configurations. Automatically identifies required skills, sets up configurations, detects autonomous task patterns, and ensures everything works correctly with intelligent error correction. **Autonomous Task Detection:** The API can automatically detect scheduling patterns in prompts like: - \"Buy 0.1 ETH every hour\" → Creates 60-minute autonomous task with CDP trade skill - \"Check portfolio daily\" → Creates 24-hour autonomous task with portfolio skills - \"Post tweet every 30 minutes\" → Creates 30-minute autonomous task with Twitter skill **Request Body:** * `prompt` - Natural language description of the agent\'s desired capabilities and schedule * `existing_agent` - Optional existing agent to update (preserves current setup while adding capabilities) * `user_id` - Required user ID for logging and rate limiting * `project_id` - Optional project ID for conversation history **Returns:** * `AgentGenerateResponse` - Contains agent schema, autonomous tasks, activated skills, project ID, and summary **Response Fields:** * `agent` - Complete agent schema with skills and autonomous configurations * `autonomous_tasks` - List of autonomous tasks detected and configured * `activated_skills` - List of skills that were activated based on the prompt * `project_id` - Project ID for conversation tracking * `summary` - Human-readable summary of the generated agent * `tags` - Generated tags for categorization **Raises:** * `HTTPException`: - 400: Invalid request (missing user_id, invalid prompt format or length) - 500: Agent generation failed after retries
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ const apiInstance = new GeneratorApi(configuration);
|
|
|
27
27
|
|
|
28
28
|
let agentGenerateRequest: AgentGenerateRequest; //
|
|
29
29
|
|
|
30
|
-
const { status, data } = await apiInstance.
|
|
30
|
+
const { status, data } = await apiInstance.generateAgent(
|
|
31
31
|
agentGenerateRequest
|
|
32
32
|
);
|
|
33
33
|
```
|
|
@@ -61,8 +61,8 @@ const { status, data } = await apiInstance.generateAgentGeneratorAgentGeneratePo
|
|
|
61
61
|
|
|
62
62
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
63
63
|
|
|
64
|
-
# **
|
|
65
|
-
> GenerationDetailResponse
|
|
64
|
+
# **getGenerationHistory**
|
|
65
|
+
> GenerationDetailResponse getGenerationHistory()
|
|
66
66
|
|
|
67
67
|
Get specific project conversation history. **Path Parameters:** * `project_id` - Project ID to get conversation history for **Query Parameters:** * `user_id` - Optional user ID for access validation **Returns:** * `GenerationDetailResponse` - Contains full conversation history for the project **Raises:** * `HTTPException`: - 404: Project not found or access denied - 500: Failed to retrieve generation detail
|
|
68
68
|
|
|
@@ -79,7 +79,7 @@ const apiInstance = new GeneratorApi(configuration);
|
|
|
79
79
|
|
|
80
80
|
let projectId: string; // (default to undefined)
|
|
81
81
|
|
|
82
|
-
const { status, data } = await apiInstance.
|
|
82
|
+
const { status, data } = await apiInstance.getGenerationHistory(
|
|
83
83
|
projectId
|
|
84
84
|
);
|
|
85
85
|
```
|
|
@@ -113,8 +113,8 @@ const { status, data } = await apiInstance.getGenerationDetailGeneratorAgentGene
|
|
|
113
113
|
|
|
114
114
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
115
115
|
|
|
116
|
-
# **
|
|
117
|
-
> GenerationsListResponse
|
|
116
|
+
# **getGenerations**
|
|
117
|
+
> GenerationsListResponse getGenerations()
|
|
118
118
|
|
|
119
119
|
Get all projects/generations for a user. **Query Parameters:** * `user_id` - Optional user ID to filter projects * `limit` - Maximum number of recent projects to return (default: 50, max: 100) **Returns:** * `GenerationsListResponse` - Contains list of projects with their conversation history **Raises:** * `HTTPException`: - 400: Invalid parameters - 500: Failed to retrieve generations
|
|
120
120
|
|
|
@@ -131,7 +131,7 @@ const apiInstance = new GeneratorApi(configuration);
|
|
|
131
131
|
|
|
132
132
|
let limit: number; // (optional) (default to 50)
|
|
133
133
|
|
|
134
|
-
const { status, data } = await apiInstance.
|
|
134
|
+
const { status, data } = await apiInstance.getGenerations(
|
|
135
135
|
limit
|
|
136
136
|
);
|
|
137
137
|
```
|
|
@@ -27,8 +27,8 @@ Name | Type | Description | Notes
|
|
|
27
27
|
**supports_presence_penalty** | **boolean** | | [optional] [default to true]
|
|
28
28
|
**api_base** | **string** | | [optional] [default to undefined]
|
|
29
29
|
**timeout** | **number** | | [optional] [default to 180]
|
|
30
|
-
**created_at** | **string** | Timestamp when this data was created | [optional] [default to 2025-07-
|
|
31
|
-
**updated_at** | **string** | Timestamp when this data was updated | [optional] [default to 2025-07-
|
|
30
|
+
**created_at** | **string** | Timestamp when this data was created | [optional] [default to 2025-07-22T01:44:23.652+00:00]
|
|
31
|
+
**updated_at** | **string** | Timestamp when this data was updated | [optional] [default to 2025-07-22T01:44:23.652+00:00]
|
|
32
32
|
**provider_name** | **string** | | [default to undefined]
|
|
33
33
|
|
|
34
34
|
## Example
|
package/docs/OAuthApi.md
CHANGED
|
@@ -4,11 +4,12 @@ All URIs are relative to *http://localhost*
|
|
|
4
4
|
|
|
5
5
|
|Method | HTTP request | Description|
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
|
-
|[**
|
|
8
|
-
|[**
|
|
7
|
+
|[**getTwitterAuthUrl**](#gettwitterauthurl) | **GET** /oauth/twitter | Get Twitter Auth Url|
|
|
8
|
+
|[**twitterOauthCallback**](#twitteroauthcallback) | **GET** /oauth/twitter/callback | Twitter Oauth Callback|
|
|
9
|
+
|[**unlinkTwitter**](#unlinktwitter) | **PUT** /oauth/twitter/unlink | Unlink Twitter Endpoint|
|
|
9
10
|
|
|
10
|
-
# **
|
|
11
|
-
> TwitterAuthResponse
|
|
11
|
+
# **getTwitterAuthUrl**
|
|
12
|
+
> TwitterAuthResponse getTwitterAuthUrl()
|
|
12
13
|
|
|
13
14
|
Get Twitter OAuth2 authorization URL. **Query Parameters:** * `agent_id` - ID of the agent to authenticate * `redirect_uri` - DApp URI to redirect to after authorization from agentkit to DApp **Returns:** * Object containing agent_id and authorization URL
|
|
14
15
|
|
|
@@ -26,7 +27,7 @@ const apiInstance = new OAuthApi(configuration);
|
|
|
26
27
|
let agentId: string; // (default to undefined)
|
|
27
28
|
let redirectUri: string; // (default to undefined)
|
|
28
29
|
|
|
29
|
-
const { status, data } = await apiInstance.
|
|
30
|
+
const { status, data } = await apiInstance.getTwitterAuthUrl(
|
|
30
31
|
agentId,
|
|
31
32
|
redirectUri
|
|
32
33
|
);
|
|
@@ -62,8 +63,8 @@ const { status, data } = await apiInstance.getTwitterAuthUrlOauthTwitterGet(
|
|
|
62
63
|
|
|
63
64
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
64
65
|
|
|
65
|
-
# **
|
|
66
|
-
> any
|
|
66
|
+
# **twitterOauthCallback**
|
|
67
|
+
> any twitterOauthCallback()
|
|
67
68
|
|
|
68
69
|
Handle Twitter OAuth2 callback. This endpoint is called by Twitter after the user authorizes the application. It exchanges the authorization code for access and refresh tokens, then stores them in the database. **Query Parameters:** * `state` - URL-encoded state containing agent_id and redirect_uri * `code` - Authorization code from Twitter * `error` - Error message from Twitter (optional) **Returns:** * JSONResponse or RedirectResponse depending on redirect_uri
|
|
69
70
|
|
|
@@ -82,7 +83,7 @@ let state: string; // (default to undefined)
|
|
|
82
83
|
let code: string; // (optional) (default to undefined)
|
|
83
84
|
let error: string; // (optional) (default to undefined)
|
|
84
85
|
|
|
85
|
-
const { status, data } = await apiInstance.
|
|
86
|
+
const { status, data } = await apiInstance.twitterOauthCallback(
|
|
86
87
|
state,
|
|
87
88
|
code,
|
|
88
89
|
error
|
|
@@ -120,3 +121,55 @@ No authorization required
|
|
|
120
121
|
|
|
121
122
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
122
123
|
|
|
124
|
+
# **unlinkTwitter**
|
|
125
|
+
> unlinkTwitter()
|
|
126
|
+
|
|
127
|
+
Unlink X from an agent. **Path Parameters:** * `agent_id` - ID of the agent to unlink from X **Raises:** * `HTTPException`: - 404: Agent not found
|
|
128
|
+
|
|
129
|
+
### Example
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import {
|
|
133
|
+
OAuthApi,
|
|
134
|
+
Configuration
|
|
135
|
+
} from '@crestal/nation-sdk';
|
|
136
|
+
|
|
137
|
+
const configuration = new Configuration();
|
|
138
|
+
const apiInstance = new OAuthApi(configuration);
|
|
139
|
+
|
|
140
|
+
let agentId: string; //ID of the agent to unlink from X (default to undefined)
|
|
141
|
+
|
|
142
|
+
const { status, data } = await apiInstance.unlinkTwitter(
|
|
143
|
+
agentId
|
|
144
|
+
);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Parameters
|
|
148
|
+
|
|
149
|
+
|Name | Type | Description | Notes|
|
|
150
|
+
|------------- | ------------- | ------------- | -------------|
|
|
151
|
+
| **agentId** | [**string**] | ID of the agent to unlink from X | defaults to undefined|
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Return type
|
|
155
|
+
|
|
156
|
+
void (empty response body)
|
|
157
|
+
|
|
158
|
+
### Authorization
|
|
159
|
+
|
|
160
|
+
[HTTPBearer](../README.md#HTTPBearer)
|
|
161
|
+
|
|
162
|
+
### HTTP request headers
|
|
163
|
+
|
|
164
|
+
- **Content-Type**: Not defined
|
|
165
|
+
- **Accept**: application/json
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### HTTP response details
|
|
169
|
+
| Status code | Description | Response headers |
|
|
170
|
+
|-------------|-------------|------------------|
|
|
171
|
+
|**200** | Successful Response | - |
|
|
172
|
+
|**422** | Validation Error | - |
|
|
173
|
+
|
|
174
|
+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
|
175
|
+
|
package/index.ts
CHANGED