Skip to content

Commit

Permalink
feat: Agents setup started
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Nov 4, 2024
1 parent 932e5c2 commit cdad239
Show file tree
Hide file tree
Showing 17 changed files with 852 additions and 510 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ WALLET_CONNECT_PROJECT_ID=

# APIs
LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000
LTAI_AGENTS_API_URL=http://localhost:8001

# RPCs
SOLANA_RPC=
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/apis/agents
src/apis/subscriptions
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"scripts": {
"lint": "eslint --fix --ext .js,.ts,.vue ./",
"lint:check": "eslint --ext .js,.ts,.vue ./",
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
"format:check": "prettier --check \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\"",
"format:check": "prettier --check \"**/*.{js,ts,vue,scss,html,md,json}\"",
"dev": "quasar dev",
"build": "quasar build",
"generate-subscriptions-client": "openapi-ts --input http://localhost:8000/openapi.json --output ./src/apis/subscriptions --client @hey-api/client-axios"
"generate-clients": "npm run generate-subscriptions-client; npm run generate-agents-client",
"generate-subscriptions-client": "openapi-ts --input http://localhost:8000/openapi.json --output ./src/apis/subscriptions --client @hey-api/client-axios",
"generate-agents-client": "openapi-ts --input http://localhost:8001/openapi.json --output ./src/apis/agents --client @hey-api/client-axios"
},
"dependencies": {
"@aleph-sdk/base": "^1.2.0",
Expand Down
26 changes: 26 additions & 0 deletions public/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/apis/agents/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export * from './schemas.gen';
export * from './services.gen';
export * from './types.gen';
172 changes: 172 additions & 0 deletions src/apis/agents/schemas.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// This file is auto-generated by @hey-api/openapi-ts

export const Body_update_agent__agent_id__putSchema = {
properties: {
secret: {
type: 'string',
title: 'Secret'
},
code: {
type: 'string',
format: 'binary',
title: 'Code'
},
packages: {
type: 'string',
format: 'binary',
title: 'Packages'
}
},
type: 'object',
required: ['secret', 'code', 'packages'],
title: 'Body_update_agent__agent_id__put'
} as const;

export const DeleteAgentBodySchema = {
properties: {
subscription_id: {
type: 'string',
title: 'Subscription Id'
},
password: {
type: 'string',
title: 'Password'
}
},
type: 'object',
required: ['subscription_id', 'password'],
title: 'DeleteAgentBody'
} as const;

export const GetAgentResponseSchema = {
properties: {
id: {
type: 'string',
title: 'Id'
},
vm_hash: {
type: 'string',
title: 'Vm Hash'
},
last_update: {
type: 'integer',
title: 'Last Update'
}
},
type: 'object',
required: ['id', 'last_update'],
title: 'GetAgentResponse'
} as const;

export const GetAgentSecretResponseSchema = {
properties: {
secret: {
type: 'string',
title: 'Secret'
}
},
type: 'object',
required: ['secret'],
title: 'GetAgentSecretResponse'
} as const;

export const HTTPValidationErrorSchema = {
properties: {
detail: {
items: {
'$ref': '#/components/schemas/ValidationError'
},
type: 'array',
title: 'Detail'
}
},
type: 'object',
title: 'HTTPValidationError'
} as const;

export const SetupAgentBodySchema = {
properties: {
subscription_id: {
type: 'string',
title: 'Subscription Id'
},
password: {
type: 'string',
title: 'Password'
},
account: {
'$ref': '#/components/schemas/SubscriptionAccount'
}
},
type: 'object',
required: ['subscription_id', 'password', 'account'],
title: 'SetupAgentBody'
} as const;

export const SubscriptionAccountSchema = {
properties: {
address: {
type: 'string',
title: 'Address'
},
chain: {
'$ref': '#/components/schemas/SubscriptionChain'
}
},
type: 'object',
required: ['address', 'chain'],
title: 'SubscriptionAccount',
example: {
address: '0x0000000000000000000000000000000000000000',
chain: 'base'
}
} as const;

export const SubscriptionChainSchema = {
type: 'string',
enum: ['base', 'solana'],
title: 'SubscriptionChain',
description: 'An enumeration.'
} as const;

export const UpdateAgentResponseSchema = {
properties: {
vm_hash: {
type: 'string',
title: 'Vm Hash'
}
},
type: 'object',
required: ['vm_hash'],
title: 'UpdateAgentResponse'
} as const;

export const ValidationErrorSchema = {
properties: {
loc: {
items: {
anyOf: [
{
type: 'string'
},
{
type: 'integer'
}
]
},
type: 'array',
title: 'Location'
},
msg: {
type: 'string',
title: 'Message'
},
type: {
type: 'string',
title: 'Error Type'
}
},
type: 'object',
required: ['loc', 'msg', 'type'],
title: 'ValidationError'
} as const;
66 changes: 66 additions & 0 deletions src/apis/agents/services.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// This file is auto-generated by @hey-api/openapi-ts

import { createClient, createConfig, type Options, formDataBodySerializer } from '@hey-api/client-axios';
import type { SetupAgentPostData, SetupAgentPostError, SetupAgentPostResponse, DeleteAgentDeleteData, DeleteAgentDeleteError, DeleteAgentDeleteResponse, GetAgentPublicInfoAgentAgentIdGetData, GetAgentPublicInfoAgentAgentIdGetError, GetAgentPublicInfoAgentAgentIdGetResponse, UpdateAgentAgentIdPutData, UpdateAgentAgentIdPutError, UpdateAgentAgentIdPutResponse, GetAgentSecretAgentAgentIdSecretGetData, GetAgentSecretAgentAgentIdSecretGetError, GetAgentSecretAgentAgentIdSecretGetResponse } from './types.gen';

Check warning on line 4 in src/apis/agents/services.gen.ts

View workflow job for this annotation

GitHub Actions / lint

Missed spacing between "@hey-api/client-axios" and "./types.gen" imports

export const client = createClient(createConfig());

/**
* Setup
* Setup a new agent on subscription
*/
export const setupAgentPost = <ThrowOnError extends boolean = false>(options: Options<SetupAgentPostData, ThrowOnError>) => {
return (options?.client ?? client).post<SetupAgentPostResponse, SetupAgentPostError, ThrowOnError>({
...options,
url: '/agent'
});
};

/**
* Delete
* Remove an agent on subscription end
*/
export const deleteAgentDelete = <ThrowOnError extends boolean = false>(options: Options<DeleteAgentDeleteData, ThrowOnError>) => {
return (options?.client ?? client).delete<DeleteAgentDeleteResponse, DeleteAgentDeleteError, ThrowOnError>({
...options,
url: '/agent'
});
};

/**
* Get Agent Public Info
* Get an agent public information
*/
export const getAgentPublicInfoAgentAgentIdGet = <ThrowOnError extends boolean = false>(options: Options<GetAgentPublicInfoAgentAgentIdGetData, ThrowOnError>) => {
return (options?.client ?? client).get<GetAgentPublicInfoAgentAgentIdGetResponse, GetAgentPublicInfoAgentAgentIdGetError, ThrowOnError>({
...options,
url: '/agent/{agent_id}'
});
};

/**
* Update
* Deploy an agent or update it
*/
export const updateAgentAgentIdPut = <ThrowOnError extends boolean = false>(options: Options<UpdateAgentAgentIdPutData, ThrowOnError>) => {
return (options?.client ?? client).put<UpdateAgentAgentIdPutResponse, UpdateAgentAgentIdPutError, ThrowOnError>({
...options,
...formDataBodySerializer,
headers: {
'Content-Type': null,
...options?.headers
},
url: '/agent/{agent_id}'
});
};

/**
* Get Agent Secret
* Get an agent secret
*/
export const getAgentSecretAgentAgentIdSecretGet = <ThrowOnError extends boolean = false>(options: Options<GetAgentSecretAgentAgentIdSecretGetData, ThrowOnError>) => {
return (options?.client ?? client).get<GetAgentSecretAgentAgentIdSecretGetResponse, GetAgentSecretAgentAgentIdSecretGetError, ThrowOnError>({
...options,
url: '/agent/{agent_id}/secret'
});
};
Loading

0 comments on commit cdad239

Please sign in to comment.