├── .fernignore ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .npmignore ├── .prettierrc.yml ├── README.md ├── jest.config.js ├── package.json ├── src ├── Client.ts ├── api │ ├── errors │ │ ├── UnprocessableEntityError.ts │ │ └── index.ts │ ├── index.ts │ ├── resources │ │ ├── agent │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── AgentUpdate.ts │ │ │ │ │ ├── AppModelsRequestAgent.ts │ │ │ │ │ ├── AppModelsRequestAgentDatasource.ts │ │ │ │ │ ├── AppModelsRequestAgentInvoke.ts │ │ │ │ │ ├── AppModelsRequestAgentLlm.ts │ │ │ │ │ ├── AppModelsRequestAgentTool.ts │ │ │ │ │ ├── ListApiV1AgentsGetRequest.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── apiKey │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── apiUser │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── datasource │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── ListApiV1DatasourcesGetRequest.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── llm │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── tool │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── AppModelsRequestTool.ts │ │ │ │ │ ├── ListApiV1ToolsGetRequest.ts │ │ │ │ │ ├── ToolUpdate.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── vectorDatabase │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── workflow │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── ListApiV1WorkflowsGetRequest.ts │ │ │ │ │ ├── WorkflowInvoke.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ └── workflowConfig │ │ │ ├── client │ │ │ ├── Client.ts │ │ │ └── index.ts │ │ │ └── index.ts │ └── types │ │ ├── AgentDatasosurceList.ts │ │ ├── AgentList.ts │ │ ├── AgentToolList.ts │ │ ├── AgentType.ts │ │ ├── ApiKeyCreate.ts │ │ ├── ApiKeyCreateModel.ts │ │ ├── ApiKeyList.ts │ │ ├── AppModelsRequestApiKey.ts │ │ ├── AppModelsRequestApiUser.ts │ │ ├── AppModelsRequestDatasource.ts │ │ ├── AppModelsRequestLlm.ts │ │ ├── AppModelsRequestVectorDb.ts │ │ ├── AppModelsRequestWorkflow.ts │ │ ├── AppModelsRequestWorkflowStep.ts │ │ ├── AppModelsResponseAgent.ts │ │ ├── AppModelsResponseAgentInvoke.ts │ │ ├── AppModelsResponseApiKey.ts │ │ ├── AppModelsResponseApiUser.ts │ │ ├── AppModelsResponseDatasource.ts │ │ ├── AppModelsResponseLlm.ts │ │ ├── AppModelsResponseTool.ts │ │ ├── AppModelsResponseVectorDb.ts │ │ ├── AppModelsResponseWorkflow.ts │ │ ├── AppModelsResponseWorkflowStep.ts │ │ ├── DatasourceList.ts │ │ ├── DatasourceStatus.ts │ │ ├── DatasourceType.ts │ │ ├── EmbeddingsModelProvider.ts │ │ ├── FunctionDefinition.ts │ │ ├── HttpValidationError.ts │ │ ├── LlmList.ts │ │ ├── LlmModel.ts │ │ ├── LlmParams.ts │ │ ├── LlmProvider.ts │ │ ├── OpenAiAssistantParameters.ts │ │ ├── OpenAiAssistantParametersToolsItem.ts │ │ ├── PrismaModelsAgent.ts │ │ ├── PrismaModelsAgentDatasource.ts │ │ ├── PrismaModelsAgentLlm.ts │ │ ├── PrismaModelsAgentTool.ts │ │ ├── PrismaModelsApiKey.ts │ │ ├── PrismaModelsApiUser.ts │ │ ├── PrismaModelsDatasource.ts │ │ ├── PrismaModelsLlm.ts │ │ ├── PrismaModelsTool.ts │ │ ├── PrismaModelsVectorDb.ts │ │ ├── PrismaModelsWorkflow.ts │ │ ├── PrismaModelsWorkflowStep.ts │ │ ├── ToolAssistantToolsCode.ts │ │ ├── ToolAssistantToolsFunction.ts │ │ ├── ToolAssistantToolsRetrieval.ts │ │ ├── ToolList.ts │ │ ├── ToolType.ts │ │ ├── ValidationError.ts │ │ ├── ValidationErrorLocItem.ts │ │ ├── VectorDbList.ts │ │ ├── VectorDbProvider.ts │ │ ├── WorkflowConfig.ts │ │ ├── WorkflowList.ts │ │ ├── WorkflowStepList.ts │ │ └── index.ts ├── core │ ├── auth │ │ ├── BasicAuth.ts │ │ ├── BearerToken.ts │ │ └── index.ts │ ├── fetcher │ │ ├── APIResponse.ts │ │ ├── Fetcher.ts │ │ ├── Supplier.ts │ │ ├── getHeader.ts │ │ └── index.ts │ ├── index.ts │ ├── runtime │ │ ├── index.ts │ │ └── runtime.ts │ └── schemas │ │ ├── Schema.ts │ │ ├── builders │ │ ├── date │ │ │ ├── date.ts │ │ │ └── index.ts │ │ ├── enum │ │ │ ├── enum.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── lazy │ │ │ ├── index.ts │ │ │ ├── lazy.ts │ │ │ └── lazyObject.ts │ │ ├── list │ │ │ ├── index.ts │ │ │ └── list.ts │ │ ├── literals │ │ │ ├── booleanLiteral.ts │ │ │ ├── index.ts │ │ │ └── stringLiteral.ts │ │ ├── object-like │ │ │ ├── getObjectLikeUtils.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── object │ │ │ ├── index.ts │ │ │ ├── object.ts │ │ │ ├── objectWithoutOptionalProperties.ts │ │ │ ├── property.ts │ │ │ └── types.ts │ │ ├── primitives │ │ │ ├── any.ts │ │ │ ├── boolean.ts │ │ │ ├── index.ts │ │ │ ├── number.ts │ │ │ ├── string.ts │ │ │ └── unknown.ts │ │ ├── record │ │ │ ├── index.ts │ │ │ ├── record.ts │ │ │ └── types.ts │ │ ├── schema-utils │ │ │ ├── JsonError.ts │ │ │ ├── ParseError.ts │ │ │ ├── getSchemaUtils.ts │ │ │ ├── index.ts │ │ │ └── stringifyValidationErrors.ts │ │ ├── set │ │ │ ├── index.ts │ │ │ └── set.ts │ │ ├── undiscriminated-union │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── undiscriminatedUnion.ts │ │ └── union │ │ │ ├── discriminant.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── union.ts │ │ ├── index.ts │ │ └── utils │ │ ├── MaybePromise.ts │ │ ├── addQuestionMarksToNullableProperties.ts │ │ ├── createIdentitySchemaCreator.ts │ │ ├── entries.ts │ │ ├── filterObject.ts │ │ ├── getErrorMessageForIncorrectType.ts │ │ ├── isPlainObject.ts │ │ ├── keys.ts │ │ ├── maybeSkipValidation.ts │ │ └── partition.ts ├── environments.ts ├── errors │ ├── SuperAgentError.ts │ ├── SuperAgentTimeoutError.ts │ └── index.ts ├── index.ts └── serialization │ ├── index.ts │ ├── resources │ ├── agent │ │ ├── client │ │ │ ├── index.ts │ │ │ └── requests │ │ │ │ ├── AgentUpdate.ts │ │ │ │ ├── AppModelsRequestAgent.ts │ │ │ │ ├── AppModelsRequestAgentDatasource.ts │ │ │ │ ├── AppModelsRequestAgentInvoke.ts │ │ │ │ ├── AppModelsRequestAgentLlm.ts │ │ │ │ ├── AppModelsRequestAgentTool.ts │ │ │ │ └── index.ts │ │ └── index.ts │ ├── index.ts │ ├── tool │ │ ├── client │ │ │ ├── index.ts │ │ │ └── requests │ │ │ │ ├── AppModelsRequestTool.ts │ │ │ │ ├── ToolUpdate.ts │ │ │ │ └── index.ts │ │ └── index.ts │ └── workflow │ │ ├── client │ │ ├── index.ts │ │ └── requests │ │ │ ├── WorkflowInvoke.ts │ │ │ └── index.ts │ │ └── index.ts │ └── types │ ├── AgentDatasosurceList.ts │ ├── AgentList.ts │ ├── AgentToolList.ts │ ├── AgentType.ts │ ├── ApiKeyCreate.ts │ ├── ApiKeyCreateModel.ts │ ├── ApiKeyList.ts │ ├── AppModelsRequestApiKey.ts │ ├── AppModelsRequestApiUser.ts │ ├── AppModelsRequestDatasource.ts │ ├── AppModelsRequestLlm.ts │ ├── AppModelsRequestVectorDb.ts │ ├── AppModelsRequestWorkflow.ts │ ├── AppModelsRequestWorkflowStep.ts │ ├── AppModelsResponseAgent.ts │ ├── AppModelsResponseAgentInvoke.ts │ ├── AppModelsResponseApiKey.ts │ ├── AppModelsResponseApiUser.ts │ ├── AppModelsResponseDatasource.ts │ ├── AppModelsResponseLlm.ts │ ├── AppModelsResponseTool.ts │ ├── AppModelsResponseVectorDb.ts │ ├── AppModelsResponseWorkflow.ts │ ├── AppModelsResponseWorkflowStep.ts │ ├── DatasourceList.ts │ ├── DatasourceStatus.ts │ ├── DatasourceType.ts │ ├── EmbeddingsModelProvider.ts │ ├── FunctionDefinition.ts │ ├── HttpValidationError.ts │ ├── LlmList.ts │ ├── LlmModel.ts │ ├── LlmParams.ts │ ├── LlmProvider.ts │ ├── OpenAiAssistantParameters.ts │ ├── OpenAiAssistantParametersToolsItem.ts │ ├── PrismaModelsAgent.ts │ ├── PrismaModelsAgentDatasource.ts │ ├── PrismaModelsAgentLlm.ts │ ├── PrismaModelsAgentTool.ts │ ├── PrismaModelsApiKey.ts │ ├── PrismaModelsApiUser.ts │ ├── PrismaModelsDatasource.ts │ ├── PrismaModelsLlm.ts │ ├── PrismaModelsTool.ts │ ├── PrismaModelsVectorDb.ts │ ├── PrismaModelsWorkflow.ts │ ├── PrismaModelsWorkflowStep.ts │ ├── ToolAssistantToolsCode.ts │ ├── ToolAssistantToolsFunction.ts │ ├── ToolAssistantToolsRetrieval.ts │ ├── ToolList.ts │ ├── ToolType.ts │ ├── ValidationError.ts │ ├── ValidationErrorLocItem.ts │ ├── VectorDbList.ts │ ├── VectorDbProvider.ts │ ├── WorkflowConfig.ts │ ├── WorkflowList.ts │ ├── WorkflowStepList.ts │ └── index.ts ├── tests └── client.test.ts ├── tsconfig.json └── yarn.lock /.fernignore: -------------------------------------------------------------------------------- 1 | # Specify files that shouldn't be modified by Fern 2 | 3 | README.md 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: [push] 4 | 5 | jobs: 6 | compile: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout repo 11 | uses: actions/checkout@v3 12 | 13 | - name: Set up node 14 | uses: actions/setup-node@v3 15 | 16 | - name: Compile 17 | run: yarn && yarn build 18 | 19 | test: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - name: Checkout repo 24 | uses: actions/checkout@v3 25 | 26 | - name: Set up node 27 | uses: actions/setup-node@v3 28 | 29 | - name: Compile 30 | run: yarn && yarn test 31 | 32 | publish: 33 | needs: [ compile, test ] 34 | if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') 35 | runs-on: ubuntu-latest 36 | 37 | steps: 38 | - name: Checkout repo 39 | uses: actions/checkout@v3 40 | 41 | - name: Set up node 42 | uses: actions/setup-node@v3 43 | 44 | - name: Install dependencies 45 | run: yarn install 46 | 47 | - name: Build 48 | run: yarn build 49 | 50 | - name: Publish to npm 51 | run: | 52 | npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} 53 | npm publish --access public 54 | env: 55 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | /dist 4 | /Client.d.ts 5 | /Client.js 6 | /environments.d.ts 7 | /environments.js 8 | /index.d.ts 9 | /index.js 10 | /api 11 | /core 12 | /errors 13 | /serialization -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src 3 | .gitignore 4 | .github 5 | .fernignore 6 | .prettierrc.yml 7 | tsconfig.json 8 | yarn.lock -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | tabWidth: 4 2 | printWidth: 120 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # Superagent JavaScript SDK 🥷 4 | 5 | ### The open framework for building AI Assistants 6 | 7 |

8 | 9 | [![npm shield](https://img.shields.io/npm/v/superagentai-js)](https://www.npmjs.com/package/superagentai-js) 10 | 11 | Fern 12 | GitHub Contributors 13 | GitHub Last Commit 14 | 15 | GitHub Issues 16 | GitHub Pull Requests 17 | Github License 18 | Discord 19 |

20 | 21 |
22 | 23 | ----- 24 | 25 | Superagent is an open source framework that enables any developer to integrate production ready AI Assistants into any application in a matter of minutes. 26 | 27 | ----- 28 | 29 | ## Installation 30 | 31 | Add this dependency to your project's build file: 32 | 33 | ```bash 34 | npm install superagentai-js 35 | # or 36 | yarn add superagentai-js 37 | ``` 38 | 39 | ## Usage 40 | 41 | ```ts 42 | import { Superagent, SuperAgentClient } from "superagentai-js"; 43 | 44 | const client = new SuperAgentClient(token="API_TOKEN") 45 | const agent = await client.agent.create({ 46 | name: "My Agent", 47 | description: "My Awesome Agent", 48 | isActive: True, 49 | llmModel: "GPT_4_1106_PREVIEW", 50 | promprt: "You are a helpful assistant" 51 | }); 52 | 53 | output = await client.agent.invoke(agent.data.id, { 54 | input: "Hi there!", 55 | enableStreaming: false, 56 | sessionId: "123", 57 | }); 58 | 59 | console.log("Received response from superagent", agent.data) 60 | ``` 61 | 62 | 63 | ## Handling Exceptions 64 | 65 | All exceptions thrown by the SDK will sublcass [SuperAgentError](./src/errors/SuperAgentError.ts). 66 | 67 | ```ts 68 | improt { SuperAgentError } from "superagentai-js"; 69 | 70 | try { 71 | client.agent.invoke(...) 72 | } catch (err) { 73 | if (err instanceof SuperAgentError) { 74 | console.log(err.statusCode); 75 | console.log(err.message); 76 | } 77 | } 78 | ``` 79 | 80 | ## Acknowledgements 81 | 82 | A special thanks to the [Fern](https://buildwithfern.com/) team for all support with the Superagent libraries and SDKs ❤️. 83 | 84 | ## Beta status 85 | 86 | This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version. This way, you can install the 87 | same version each time without breaking changes unless you are intentionally looking for the latest version. 88 | 89 | ## Contributing 90 | 91 | While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved 92 | over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we 93 | will not be able to merge it as-is. We suggest opening an issue first to discuss with us! 94 | 95 | On the other hand, contributions to the README are always very welcome! 96 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('ts-jest').JestConfigWithTsJest} */ 2 | module.exports = { 3 | preset: "ts-jest", 4 | testEnvironment: "node", 5 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "superagentai-js", 3 | "version": "v0.2.40", 4 | "private": false, 5 | "repository": "https://github.com/homanp/superagent-js", 6 | "main": "./index.js", 7 | "types": "./index.d.ts", 8 | "scripts": { 9 | "format": "prettier --write 'src/**/*.ts'", 10 | "build": "tsc", 11 | "prepack": "cp -rv dist/. .", 12 | "test": "jest" 13 | }, 14 | "dependencies": { 15 | "url-join": "4.0.1", 16 | "form-data": "4.0.0", 17 | "node-fetch": "2.7.0", 18 | "qs": "6.11.2", 19 | "js-base64": "3.7.2" 20 | }, 21 | "devDependencies": { 22 | "@types/url-join": "4.0.1", 23 | "@types/qs": "6.9.8", 24 | "@types/node-fetch": "2.6.9", 25 | "jest": "^29.7.0", 26 | "@types/jest": "^29.5.5", 27 | "ts-jest": "^29.1.1", 28 | "@types/node": "17.0.33", 29 | "prettier": "2.7.1", 30 | "typescript": "4.6.4" 31 | } 32 | } -------------------------------------------------------------------------------- /src/Client.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as environments from "./environments"; 6 | import * as core from "./core"; 7 | import { Agent } from "./api/resources/agent/client/Client"; 8 | import { Llm } from "./api/resources/llm/client/Client"; 9 | import { ApiUser } from "./api/resources/apiUser/client/Client"; 10 | import { ApiKey } from "./api/resources/apiKey/client/Client"; 11 | import { Datasource } from "./api/resources/datasource/client/Client"; 12 | import { Tool } from "./api/resources/tool/client/Client"; 13 | import { Workflow } from "./api/resources/workflow/client/Client"; 14 | import { WorkflowConfig } from "./api/resources/workflowConfig/client/Client"; 15 | import { VectorDatabase } from "./api/resources/vectorDatabase/client/Client"; 16 | 17 | export declare namespace SuperAgentClient { 18 | interface Options { 19 | environment?: core.Supplier; 20 | token?: core.Supplier; 21 | } 22 | 23 | interface RequestOptions { 24 | timeoutInSeconds?: number; 25 | maxRetries?: number; 26 | } 27 | } 28 | 29 | export class SuperAgentClient { 30 | constructor(protected readonly _options: SuperAgentClient.Options = {}) {} 31 | 32 | protected _agent: Agent | undefined; 33 | 34 | public get agent(): Agent { 35 | return (this._agent ??= new Agent(this._options)); 36 | } 37 | 38 | protected _llm: Llm | undefined; 39 | 40 | public get llm(): Llm { 41 | return (this._llm ??= new Llm(this._options)); 42 | } 43 | 44 | protected _apiUser: ApiUser | undefined; 45 | 46 | public get apiUser(): ApiUser { 47 | return (this._apiUser ??= new ApiUser(this._options)); 48 | } 49 | 50 | protected _apiKey: ApiKey | undefined; 51 | 52 | public get apiKey(): ApiKey { 53 | return (this._apiKey ??= new ApiKey(this._options)); 54 | } 55 | 56 | protected _datasource: Datasource | undefined; 57 | 58 | public get datasource(): Datasource { 59 | return (this._datasource ??= new Datasource(this._options)); 60 | } 61 | 62 | protected _tool: Tool | undefined; 63 | 64 | public get tool(): Tool { 65 | return (this._tool ??= new Tool(this._options)); 66 | } 67 | 68 | protected _workflow: Workflow | undefined; 69 | 70 | public get workflow(): Workflow { 71 | return (this._workflow ??= new Workflow(this._options)); 72 | } 73 | 74 | protected _workflowConfig: WorkflowConfig | undefined; 75 | 76 | public get workflowConfig(): WorkflowConfig { 77 | return (this._workflowConfig ??= new WorkflowConfig(this._options)); 78 | } 79 | 80 | protected _vectorDatabase: VectorDatabase | undefined; 81 | 82 | public get vectorDatabase(): VectorDatabase { 83 | return (this._vectorDatabase ??= new VectorDatabase(this._options)); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/api/errors/UnprocessableEntityError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors"; 6 | import * as SuperAgent from ".."; 7 | 8 | export class UnprocessableEntityError extends errors.SuperAgentError { 9 | constructor(body: SuperAgent.HttpValidationError) { 10 | super({ 11 | message: "UnprocessableEntityError", 12 | statusCode: 422, 13 | body: body, 14 | }); 15 | Object.setPrototypeOf(this, UnprocessableEntityError.prototype); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/api/errors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./UnprocessableEntityError"; 2 | -------------------------------------------------------------------------------- /src/api/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./errors"; 3 | export * from "./resources"; 4 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AgentUpdate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface AgentUpdate { 10 | isActive?: boolean; 11 | name?: string; 12 | initialMessage?: string; 13 | prompt?: string; 14 | llmModel?: string; 15 | description?: string; 16 | avatar?: string; 17 | type?: string; 18 | metadata?: Record; 19 | outputSchema?: string; 20 | } 21 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AppModelsRequestAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from "../../../.."; 6 | 7 | /** 8 | * @example 9 | * { 10 | * name: "name" 11 | * } 12 | */ 13 | export interface AppModelsRequestAgent { 14 | isActive?: boolean; 15 | name: string; 16 | initialMessage?: string; 17 | prompt?: string; 18 | llmModel?: string; 19 | llmProvider?: SuperAgent.LlmProvider; 20 | description?: string; 21 | avatar?: string; 22 | type?: SuperAgent.AgentType; 23 | parameters?: SuperAgent.OpenAiAssistantParameters; 24 | metadata?: Record; 25 | outputSchema?: string; 26 | } 27 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AppModelsRequestAgentDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * datasourceId: "datasourceId" 9 | * } 10 | */ 11 | export interface AppModelsRequestAgentDatasource { 12 | datasourceId: string; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AppModelsRequestAgentInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from "../../../.."; 6 | 7 | /** 8 | * @example 9 | * { 10 | * input: "input", 11 | * enableStreaming: true 12 | * } 13 | */ 14 | export interface AppModelsRequestAgentInvoke { 15 | input: string; 16 | sessionId?: string; 17 | enableStreaming: boolean; 18 | outputSchema?: string; 19 | llmParams?: SuperAgent.LlmParams; 20 | } 21 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AppModelsRequestAgentLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * llmId: "llmId" 9 | * } 10 | */ 11 | export interface AppModelsRequestAgentLlm { 12 | llmId: string; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/AppModelsRequestAgentTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * toolId: "toolId" 9 | * } 10 | */ 11 | export interface AppModelsRequestAgentTool { 12 | toolId: string; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/ListApiV1AgentsGetRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ListApiV1AgentsGetRequest { 10 | skip?: number; 11 | take?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/resources/agent/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { ListApiV1AgentsGetRequest } from "./ListApiV1AgentsGetRequest"; 2 | export { AppModelsRequestAgent } from "./AppModelsRequestAgent"; 3 | export { AgentUpdate } from "./AgentUpdate"; 4 | export { AppModelsRequestAgentInvoke } from "./AppModelsRequestAgentInvoke"; 5 | export { AppModelsRequestAgentLlm } from "./AppModelsRequestAgentLlm"; 6 | export { AppModelsRequestAgentTool } from "./AppModelsRequestAgentTool"; 7 | export { AppModelsRequestAgentDatasource } from "./AppModelsRequestAgentDatasource"; 8 | -------------------------------------------------------------------------------- /src/api/resources/agent/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/apiKey/client/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/api/resources/apiKey/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/apiUser/client/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/api/resources/apiUser/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/datasource/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/datasource/client/requests/ListApiV1DatasourcesGetRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ListApiV1DatasourcesGetRequest { 10 | skip?: number; 11 | take?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/resources/datasource/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { ListApiV1DatasourcesGetRequest } from "./ListApiV1DatasourcesGetRequest"; 2 | -------------------------------------------------------------------------------- /src/api/resources/datasource/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as agent from "./agent"; 2 | export * as llm from "./llm"; 3 | export * as apiUser from "./apiUser"; 4 | export * as apiKey from "./apiKey"; 5 | export * as datasource from "./datasource"; 6 | export * as tool from "./tool"; 7 | export * as workflow from "./workflow"; 8 | export * as workflowConfig from "./workflowConfig"; 9 | export * as vectorDatabase from "./vectorDatabase"; 10 | export * from "./agent/client/requests"; 11 | export * from "./datasource/client/requests"; 12 | export * from "./tool/client/requests"; 13 | export * from "./workflow/client/requests"; 14 | -------------------------------------------------------------------------------- /src/api/resources/llm/client/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/api/resources/llm/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/tool/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/tool/client/requests/AppModelsRequestTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * name: "name", 9 | * type: "type" 10 | * } 11 | */ 12 | export interface AppModelsRequestTool { 13 | name: string; 14 | description?: string; 15 | type: string; 16 | metadata?: Record; 17 | returnDirect?: boolean; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/resources/tool/client/requests/ListApiV1ToolsGetRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ListApiV1ToolsGetRequest { 10 | skip?: number; 11 | take?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/resources/tool/client/requests/ToolUpdate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ToolUpdate { 10 | name?: string; 11 | description?: string; 12 | type?: string; 13 | metadata?: Record; 14 | returnDirect?: boolean; 15 | } 16 | -------------------------------------------------------------------------------- /src/api/resources/tool/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { ListApiV1ToolsGetRequest } from "./ListApiV1ToolsGetRequest"; 2 | export { AppModelsRequestTool } from "./AppModelsRequestTool"; 3 | export { ToolUpdate } from "./ToolUpdate"; 4 | -------------------------------------------------------------------------------- /src/api/resources/tool/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/vectorDatabase/client/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/api/resources/vectorDatabase/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/workflow/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/workflow/client/requests/ListApiV1WorkflowsGetRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ListApiV1WorkflowsGetRequest { 10 | skip?: number; 11 | take?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/resources/workflow/client/requests/WorkflowInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * input: "input", 9 | * enableStreaming: true 10 | * } 11 | */ 12 | export interface WorkflowInvoke { 13 | input: string; 14 | enableStreaming: boolean; 15 | sessionId?: string; 16 | outputSchemas?: Record; 17 | outputSchema?: string; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/resources/workflow/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { ListApiV1WorkflowsGetRequest } from "./ListApiV1WorkflowsGetRequest"; 2 | export { WorkflowInvoke } from "./WorkflowInvoke"; 3 | -------------------------------------------------------------------------------- /src/api/resources/workflow/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/workflowConfig/client/Client.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as environments from "../../../../environments"; 6 | import * as core from "../../../../core"; 7 | import urlJoin from "url-join"; 8 | import * as errors from "../../../../errors"; 9 | import * as SuperAgent from "../../.."; 10 | import * as serializers from "../../../../serialization"; 11 | 12 | export declare namespace WorkflowConfig { 13 | interface Options { 14 | environment?: core.Supplier; 15 | token?: core.Supplier; 16 | } 17 | 18 | interface RequestOptions { 19 | timeoutInSeconds?: number; 20 | maxRetries?: number; 21 | } 22 | } 23 | 24 | export class WorkflowConfig { 25 | constructor(protected readonly _options: WorkflowConfig.Options = {}) {} 26 | 27 | public async getSchema(requestOptions?: WorkflowConfig.RequestOptions): Promise { 28 | const _response = await core.fetcher({ 29 | url: urlJoin( 30 | (await core.Supplier.get(this._options.environment)) ?? environments.SuperAgentEnvironment.Default, 31 | "api/v1/workflows/config/schema" 32 | ), 33 | method: "GET", 34 | headers: { 35 | Authorization: await this._getAuthorizationHeader(), 36 | "X-Fern-Language": "JavaScript", 37 | "X-Fern-SDK-Name": "superagentai-js", 38 | "X-Fern-SDK-Version": "v0.2.40", 39 | "X-Fern-Runtime": core.RUNTIME.type, 40 | "X-Fern-Runtime-Version": core.RUNTIME.version, 41 | }, 42 | contentType: "application/json", 43 | timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, 44 | maxRetries: requestOptions?.maxRetries, 45 | }); 46 | if (_response.ok) { 47 | return _response.body; 48 | } 49 | 50 | if (_response.error.reason === "status-code") { 51 | throw new errors.SuperAgentError({ 52 | statusCode: _response.error.statusCode, 53 | body: _response.error.body, 54 | }); 55 | } 56 | 57 | switch (_response.error.reason) { 58 | case "non-json": 59 | throw new errors.SuperAgentError({ 60 | statusCode: _response.error.statusCode, 61 | body: _response.error.rawBody, 62 | }); 63 | case "timeout": 64 | throw new errors.SuperAgentTimeoutError(); 65 | case "unknown": 66 | throw new errors.SuperAgentError({ 67 | message: _response.error.errorMessage, 68 | }); 69 | } 70 | } 71 | 72 | /** 73 | * @throws {@link SuperAgent.UnprocessableEntityError} 74 | * 75 | * @example 76 | * await superAgent.workflowConfig.addConfig("workflow_id") 77 | */ 78 | public async addConfig(workflowId: string, requestOptions?: WorkflowConfig.RequestOptions): Promise { 79 | const _response = await core.fetcher({ 80 | url: urlJoin( 81 | (await core.Supplier.get(this._options.environment)) ?? environments.SuperAgentEnvironment.Default, 82 | `api/v1/workflows/${workflowId}/config` 83 | ), 84 | method: "POST", 85 | headers: { 86 | Authorization: await this._getAuthorizationHeader(), 87 | "X-Fern-Language": "JavaScript", 88 | "X-Fern-SDK-Name": "superagentai-js", 89 | "X-Fern-SDK-Version": "v0.2.40", 90 | "X-Fern-Runtime": core.RUNTIME.type, 91 | "X-Fern-Runtime-Version": core.RUNTIME.version, 92 | }, 93 | contentType: "application/json", 94 | timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, 95 | maxRetries: requestOptions?.maxRetries, 96 | }); 97 | if (_response.ok) { 98 | return _response.body; 99 | } 100 | 101 | if (_response.error.reason === "status-code") { 102 | switch (_response.error.statusCode) { 103 | case 422: 104 | throw new SuperAgent.UnprocessableEntityError( 105 | await serializers.HttpValidationError.parseOrThrow(_response.error.body, { 106 | unrecognizedObjectKeys: "passthrough", 107 | allowUnrecognizedUnionMembers: true, 108 | allowUnrecognizedEnumValues: true, 109 | breadcrumbsPrefix: ["response"], 110 | }) 111 | ); 112 | default: 113 | throw new errors.SuperAgentError({ 114 | statusCode: _response.error.statusCode, 115 | body: _response.error.body, 116 | }); 117 | } 118 | } 119 | 120 | switch (_response.error.reason) { 121 | case "non-json": 122 | throw new errors.SuperAgentError({ 123 | statusCode: _response.error.statusCode, 124 | body: _response.error.rawBody, 125 | }); 126 | case "timeout": 127 | throw new errors.SuperAgentTimeoutError(); 128 | case "unknown": 129 | throw new errors.SuperAgentError({ 130 | message: _response.error.errorMessage, 131 | }); 132 | } 133 | } 134 | 135 | protected async _getAuthorizationHeader() { 136 | const bearer = await core.Supplier.get(this._options.token); 137 | if (bearer != null) { 138 | return `Bearer ${bearer}`; 139 | } 140 | 141 | return undefined; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/api/resources/workflowConfig/client/index.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /src/api/resources/workflowConfig/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/types/AgentDatasosurceList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AgentDatasosurceList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsAgentDatasource[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AgentList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AgentList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsAgent[]; 10 | totalPages: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/AgentToolList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AgentToolList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsAgentTool[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AgentType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type AgentType = "SUPERAGENT" | "OPENAI_ASSISTANT" | "LLM"; 9 | 10 | export const AgentType = { 11 | Superagent: "SUPERAGENT", 12 | OpenaiAssistant: "OPENAI_ASSISTANT", 13 | Llm: "LLM", 14 | } as const; 15 | -------------------------------------------------------------------------------- /src/api/types/ApiKeyCreate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface ApiKeyCreate { 8 | success: boolean; 9 | data?: SuperAgent.ApiKeyCreateModel; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ApiKeyCreateModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a ApiKey record 9 | */ 10 | export interface ApiKeyCreateModel { 11 | id: string; 12 | name: string; 13 | displayApiKey: string; 14 | createdAt: Date; 15 | updatedAt: Date; 16 | apiUserId: string; 17 | apiUser?: SuperAgent.PrismaModelsApiUser; 18 | apiKey: string; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/types/ApiKeyList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface ApiKeyList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsApiKey[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsRequestApiKey { 6 | name: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsRequestApiUser { 6 | email: string; 7 | firstName?: string; 8 | lastName?: string; 9 | company?: string; 10 | anonymousId?: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsRequestDatasource { 8 | name: string; 9 | description?: string; 10 | type: string; 11 | content?: string; 12 | url?: string; 13 | metadata?: Record; 14 | vectorDbId?: string; 15 | embeddingsModelProvider?: SuperAgent.EmbeddingsModelProvider; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsRequestLlm { 6 | provider: string; 7 | apiKey: string; 8 | options?: Record; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsRequestVectorDb { 8 | provider: SuperAgent.VectorDbProvider; 9 | options: Record; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsRequestWorkflow { 6 | name: string; 7 | description: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/AppModelsRequestWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsRequestWorkflowStep { 6 | order: number; 7 | agentId: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseAgent { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsAgent; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseAgentInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface AppModelsResponseAgentInvoke { 6 | success: boolean; 7 | data?: unknown; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseApiKey { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsApiKey; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseApiUser { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsApiUser; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseDatasource { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsDatasource; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseLlm { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsLlm; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseTool { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsTool; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseVectorDb { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsVectorDb; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseWorkflow { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsWorkflow; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AppModelsResponseWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface AppModelsResponseWorkflowStep { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsWorkflowStep; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/DatasourceList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface DatasourceList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsDatasource[]; 10 | totalPages: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/DatasourceStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type DatasourceStatus = "IN_PROGRESS" | "DONE" | "FAILED"; 9 | 10 | export const DatasourceStatus = { 11 | InProgress: "IN_PROGRESS", 12 | Done: "DONE", 13 | Failed: "FAILED", 14 | } as const; 15 | -------------------------------------------------------------------------------- /src/api/types/DatasourceType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type DatasourceType = 9 | | "TXT" 10 | | "PDF" 11 | | "CSV" 12 | | "PPTX" 13 | | "XLSX" 14 | | "DOCX" 15 | | "GOOGLE_DOC" 16 | | "YOUTUBE" 17 | | "GITHUB_REPOSITORY" 18 | | "MARKDOWN" 19 | | "WEBPAGE" 20 | | "AIRTABLE" 21 | | "STRIPE" 22 | | "NOTION" 23 | | "SITEMAP" 24 | | "URL" 25 | | "FUNCTION"; 26 | 27 | export const DatasourceType = { 28 | Txt: "TXT", 29 | Pdf: "PDF", 30 | Csv: "CSV", 31 | Pptx: "PPTX", 32 | Xlsx: "XLSX", 33 | Docx: "DOCX", 34 | GoogleDoc: "GOOGLE_DOC", 35 | Youtube: "YOUTUBE", 36 | GithubRepository: "GITHUB_REPOSITORY", 37 | Markdown: "MARKDOWN", 38 | Webpage: "WEBPAGE", 39 | Airtable: "AIRTABLE", 40 | Stripe: "STRIPE", 41 | Notion: "NOTION", 42 | Sitemap: "SITEMAP", 43 | Url: "URL", 44 | Function: "FUNCTION", 45 | } as const; 46 | -------------------------------------------------------------------------------- /src/api/types/EmbeddingsModelProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type EmbeddingsModelProvider = "OPENAI" | "AZURE_OPENAI"; 9 | 10 | export const EmbeddingsModelProvider = { 11 | Openai: "OPENAI", 12 | AzureOpenai: "AZURE_OPENAI", 13 | } as const; 14 | -------------------------------------------------------------------------------- /src/api/types/FunctionDefinition.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface FunctionDefinition { 6 | name?: string; 7 | description?: string; 8 | parameters?: Record; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/HttpValidationError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface HttpValidationError { 8 | detail?: SuperAgent.ValidationError[]; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/LlmList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface LlmList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsLlm[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/LlmModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type LlmModel = 9 | | "GPT_3_5_TURBO" 10 | | "GPT_3_5_TURBO_16K_0613" 11 | | "GPT_3_5_TURBO_0613" 12 | | "GPT_3_5_TURBO_1106" 13 | | "GPT_3_5_TURBO_0125" 14 | | "GPT_4" 15 | | "GPT_4_0613" 16 | | "GPT_4_32K" 17 | | "GPT_4_32K_0613" 18 | | "GPT_4_1106_PREVIEW" 19 | | "GPT_4_0125_PREVIEW" 20 | | "GPT_4_TURBO" 21 | | "GPT_4_TURBO_PREVIEW" 22 | | "GPT_4_TURBO_2024_04_09" 23 | | "GPT_4_0" 24 | | "MISTRAL_7B_INSTRUCT_V01" 25 | | "MIXTRAL_8X7B_INSTRUCT_V01"; 26 | 27 | export const LlmModel = { 28 | Gpt35Turbo: "GPT_3_5_TURBO", 29 | Gpt35Turbo16K0613: "GPT_3_5_TURBO_16K_0613", 30 | Gpt35Turbo0613: "GPT_3_5_TURBO_0613", 31 | Gpt35Turbo1106: "GPT_3_5_TURBO_1106", 32 | Gpt35Turbo0125: "GPT_3_5_TURBO_0125", 33 | Gpt4: "GPT_4", 34 | Gpt40613: "GPT_4_0613", 35 | Gpt432K: "GPT_4_32K", 36 | Gpt432K0613: "GPT_4_32K_0613", 37 | Gpt41106Preview: "GPT_4_1106_PREVIEW", 38 | Gpt40125Preview: "GPT_4_0125_PREVIEW", 39 | Gpt4Turbo: "GPT_4_TURBO", 40 | Gpt4TurboPreview: "GPT_4_TURBO_PREVIEW", 41 | Gpt4Turbo20240409: "GPT_4_TURBO_2024_04_09", 42 | Gpt40: "GPT_4_0", 43 | Mistral7BInstructV01: "MISTRAL_7B_INSTRUCT_V01", 44 | Mixtral8X7BInstructV01: "MIXTRAL_8X7B_INSTRUCT_V01", 45 | } as const; 46 | -------------------------------------------------------------------------------- /src/api/types/LlmParams.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface LlmParams { 6 | maxTokens?: number; 7 | temperature?: number; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/LlmProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type LlmProvider = 9 | | "OPENAI" 10 | | "AZURE_OPENAI" 11 | | "HUGGINGFACE" 12 | | "PERPLEXITY" 13 | | "TOGETHER_AI" 14 | | "ANTHROPIC" 15 | | "BEDROCK" 16 | | "GROQ" 17 | | "MISTRAL" 18 | | "COHERE_CHAT"; 19 | 20 | export const LlmProvider = { 21 | Openai: "OPENAI", 22 | AzureOpenai: "AZURE_OPENAI", 23 | Huggingface: "HUGGINGFACE", 24 | Perplexity: "PERPLEXITY", 25 | TogetherAi: "TOGETHER_AI", 26 | Anthropic: "ANTHROPIC", 27 | Bedrock: "BEDROCK", 28 | Groq: "GROQ", 29 | Mistral: "MISTRAL", 30 | CohereChat: "COHERE_CHAT", 31 | } as const; 32 | -------------------------------------------------------------------------------- /src/api/types/OpenAiAssistantParameters.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface OpenAiAssistantParameters { 8 | metadata?: Record; 9 | fileIds?: string[]; 10 | tools?: SuperAgent.OpenAiAssistantParametersToolsItem[]; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/OpenAiAssistantParametersToolsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export type OpenAiAssistantParametersToolsItem = 8 | | SuperAgent.OpenAiAssistantParametersToolsItem.CodeInterpreter 9 | | SuperAgent.OpenAiAssistantParametersToolsItem.Retrieval 10 | | SuperAgent.OpenAiAssistantParametersToolsItem.Function; 11 | 12 | export declare namespace OpenAiAssistantParametersToolsItem { 13 | interface CodeInterpreter extends SuperAgent.ToolAssistantToolsCode { 14 | type: "code_interpreter"; 15 | } 16 | 17 | interface Retrieval extends SuperAgent.ToolAssistantToolsRetrieval { 18 | type: "retrieval"; 19 | } 20 | 21 | interface Function extends SuperAgent.ToolAssistantToolsFunction { 22 | type: "function"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a Agent record 9 | */ 10 | export interface PrismaModelsAgent { 11 | id: string; 12 | type: SuperAgent.AgentType; 13 | name: string; 14 | avatar?: string; 15 | initialMessage?: string; 16 | description: string; 17 | isActive: boolean; 18 | createdAt: Date; 19 | updatedAt: Date; 20 | llms?: SuperAgent.PrismaModelsAgentLlm[]; 21 | llmModel?: SuperAgent.LlmModel; 22 | prompt?: string; 23 | apiUserId: string; 24 | apiUser?: SuperAgent.PrismaModelsApiUser; 25 | datasources?: SuperAgent.PrismaModelsAgentDatasource[]; 26 | tools?: SuperAgent.PrismaModelsAgentTool[]; 27 | workflowSteps?: SuperAgent.PrismaModelsWorkflowStep[]; 28 | metadata?: unknown; 29 | outputSchema?: string; 30 | } 31 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsAgentDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a AgentDatasource record 9 | */ 10 | export interface PrismaModelsAgentDatasource { 11 | agentId: string; 12 | datasourceId: string; 13 | agent?: SuperAgent.PrismaModelsAgent; 14 | datasource?: SuperAgent.PrismaModelsDatasource; 15 | createdAt: Date; 16 | updatedAt: Date; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsAgentLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a AgentLLM record 9 | */ 10 | export interface PrismaModelsAgentLlm { 11 | agentId: string; 12 | llmId: string; 13 | agent?: SuperAgent.PrismaModelsAgent; 14 | llm?: SuperAgent.PrismaModelsLlm; 15 | createdAt: Date; 16 | updatedAt: Date; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsAgentTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a AgentTool record 9 | */ 10 | export interface PrismaModelsAgentTool { 11 | agentId: string; 12 | toolId: string; 13 | agent?: SuperAgent.PrismaModelsAgent; 14 | tool?: SuperAgent.PrismaModelsTool; 15 | createdAt: Date; 16 | updatedAt: Date; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a ApiKey record 9 | */ 10 | export interface PrismaModelsApiKey { 11 | id: string; 12 | name: string; 13 | displayApiKey: string; 14 | createdAt: Date; 15 | updatedAt: Date; 16 | apiUserId: string; 17 | apiUser?: SuperAgent.PrismaModelsApiUser; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a ApiUser record 9 | */ 10 | export interface PrismaModelsApiUser { 11 | id: string; 12 | token?: string; 13 | email?: string; 14 | createdAt: Date; 15 | updatedAt: Date; 16 | agents?: SuperAgent.PrismaModelsAgent[]; 17 | llms?: SuperAgent.PrismaModelsLlm[]; 18 | datasources?: SuperAgent.PrismaModelsDatasource[]; 19 | tools?: SuperAgent.PrismaModelsTool[]; 20 | workflows?: SuperAgent.PrismaModelsWorkflow[]; 21 | vectorDb?: SuperAgent.PrismaModelsVectorDb[]; 22 | workflowConfigs?: SuperAgent.WorkflowConfig[]; 23 | apiKeys?: SuperAgent.PrismaModelsApiKey[]; 24 | } 25 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a Datasource record 9 | */ 10 | export interface PrismaModelsDatasource { 11 | id: string; 12 | name: string; 13 | content?: string; 14 | description?: string; 15 | url?: string; 16 | type: SuperAgent.DatasourceType; 17 | apiUserId: string; 18 | apiUser?: SuperAgent.PrismaModelsApiUser; 19 | createdAt: Date; 20 | updatedAt: Date; 21 | metadata?: string; 22 | status: SuperAgent.DatasourceStatus; 23 | datasources?: SuperAgent.PrismaModelsAgentDatasource[]; 24 | vectorDb?: SuperAgent.PrismaModelsVectorDb; 25 | vectorDbId?: string; 26 | } 27 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a LLM record 9 | */ 10 | export interface PrismaModelsLlm { 11 | id: string; 12 | provider: SuperAgent.LlmProvider; 13 | apiKey: string; 14 | options?: unknown; 15 | agents?: SuperAgent.PrismaModelsAgentLlm[]; 16 | createdAt: Date; 17 | updatedAt: Date; 18 | apiUserId: string; 19 | apiUser?: SuperAgent.PrismaModelsApiUser; 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a Tool record 9 | */ 10 | export interface PrismaModelsTool { 11 | id: string; 12 | name: string; 13 | description: string; 14 | type: SuperAgent.ToolType; 15 | returnDirect: boolean; 16 | metadata?: string; 17 | createdAt: Date; 18 | updatedAt: Date; 19 | apiUserId: string; 20 | apiUser?: SuperAgent.PrismaModelsApiUser; 21 | tools?: SuperAgent.PrismaModelsAgentTool[]; 22 | toolConfig?: unknown; 23 | } 24 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a VectorDb record 9 | */ 10 | export interface PrismaModelsVectorDb { 11 | id: string; 12 | provider: SuperAgent.VectorDbProvider; 13 | options?: unknown; 14 | datasources?: SuperAgent.PrismaModelsDatasource[]; 15 | createdAt: Date; 16 | updatedAt: Date; 17 | apiUserId: string; 18 | apiUser?: SuperAgent.PrismaModelsApiUser; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a Workflow record 9 | */ 10 | export interface PrismaModelsWorkflow { 11 | id: string; 12 | name: string; 13 | description?: string; 14 | createdAt: Date; 15 | updatedAt: Date; 16 | steps?: SuperAgent.PrismaModelsWorkflowStep[]; 17 | apiUserId: string; 18 | apiUser?: SuperAgent.PrismaModelsApiUser; 19 | workflowConfigs?: SuperAgent.WorkflowConfig[]; 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/PrismaModelsWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a WorkflowStep record 9 | */ 10 | export interface PrismaModelsWorkflowStep { 11 | id: string; 12 | order: number; 13 | workflowId: string; 14 | workflow?: SuperAgent.PrismaModelsWorkflow; 15 | createdAt: Date; 16 | updatedAt: Date; 17 | input?: string; 18 | output?: string; 19 | agentId: string; 20 | agent?: SuperAgent.PrismaModelsAgent; 21 | } 22 | -------------------------------------------------------------------------------- /src/api/types/ToolAssistantToolsCode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ToolAssistantToolsCode {} 6 | -------------------------------------------------------------------------------- /src/api/types/ToolAssistantToolsFunction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface ToolAssistantToolsFunction { 8 | function?: SuperAgent.FunctionDefinition; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ToolAssistantToolsRetrieval.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ToolAssistantToolsRetrieval {} 6 | -------------------------------------------------------------------------------- /src/api/types/ToolList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface ToolList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsTool[]; 10 | totalPages: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ToolType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type ToolType = 9 | | "ALGOLIA" 10 | | "BROWSER" 11 | | "BING_SEARCH" 12 | | "REPLICATE" 13 | | "WOLFRAM_ALPHA" 14 | | "ZAPIER_NLA" 15 | | "AGENT" 16 | | "OPENAPI" 17 | | "CHATGPT_PLUGIN" 18 | | "METAPHOR" 19 | | "PUBMED" 20 | | "CODE_EXECUTOR" 21 | | "OPENBB" 22 | | "GPT_VISION" 23 | | "TTS_1" 24 | | "HAND_OFF" 25 | | "FUNCTION" 26 | | "HTTP" 27 | | "SUPERRAG" 28 | | "RESEARCH" 29 | | "GITHUB" 30 | | "SCRAPER" 31 | | "ADVANCED_SCRAPER" 32 | | "GOOGLE_SEARCH" 33 | | "SEC"; 34 | 35 | export const ToolType = { 36 | Algolia: "ALGOLIA", 37 | Browser: "BROWSER", 38 | BingSearch: "BING_SEARCH", 39 | Replicate: "REPLICATE", 40 | WolframAlpha: "WOLFRAM_ALPHA", 41 | ZapierNla: "ZAPIER_NLA", 42 | Agent: "AGENT", 43 | Openapi: "OPENAPI", 44 | ChatgptPlugin: "CHATGPT_PLUGIN", 45 | Metaphor: "METAPHOR", 46 | Pubmed: "PUBMED", 47 | CodeExecutor: "CODE_EXECUTOR", 48 | Openbb: "OPENBB", 49 | GptVision: "GPT_VISION", 50 | Tts1: "TTS_1", 51 | HandOff: "HAND_OFF", 52 | Function: "FUNCTION", 53 | Http: "HTTP", 54 | Superrag: "SUPERRAG", 55 | Research: "RESEARCH", 56 | Github: "GITHUB", 57 | Scraper: "SCRAPER", 58 | AdvancedScraper: "ADVANCED_SCRAPER", 59 | GoogleSearch: "GOOGLE_SEARCH", 60 | Sec: "SEC", 61 | } as const; 62 | -------------------------------------------------------------------------------- /src/api/types/ValidationError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface ValidationError { 8 | loc: SuperAgent.ValidationErrorLocItem[]; 9 | msg: string; 10 | type: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ValidationErrorLocItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export type ValidationErrorLocItem = string | number; 6 | -------------------------------------------------------------------------------- /src/api/types/VectorDbList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface VectorDbList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsVectorDb[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/VectorDbProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * An enumeration. 7 | */ 8 | export type VectorDbProvider = "PINECONE" | "ASTRA_DB" | "WEAVIATE" | "QDRANT" | "SUPABASE"; 9 | 10 | export const VectorDbProvider = { 11 | Pinecone: "PINECONE", 12 | AstraDb: "ASTRA_DB", 13 | Weaviate: "WEAVIATE", 14 | Qdrant: "QDRANT", 15 | Supabase: "SUPABASE", 16 | } as const; 17 | -------------------------------------------------------------------------------- /src/api/types/WorkflowConfig.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | /** 8 | * Represents a WorkflowConfig record 9 | */ 10 | export interface WorkflowConfig { 11 | id: string; 12 | config?: unknown; 13 | createdAt: Date; 14 | updatedAt: Date; 15 | workflowId: string; 16 | workflow?: SuperAgent.PrismaModelsWorkflow; 17 | apiUser?: SuperAgent.PrismaModelsApiUser; 18 | apiUserId?: string; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/types/WorkflowList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface WorkflowList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsWorkflow[]; 10 | totalPages: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/WorkflowStepList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as SuperAgent from ".."; 6 | 7 | export interface WorkflowStepList { 8 | success: boolean; 9 | data?: SuperAgent.PrismaModelsWorkflowStep[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./AgentDatasosurceList"; 2 | export * from "./AgentList"; 3 | export * from "./AgentToolList"; 4 | export * from "./AgentType"; 5 | export * from "./ApiKeyCreate"; 6 | export * from "./ApiKeyList"; 7 | export * from "./DatasourceList"; 8 | export * from "./DatasourceStatus"; 9 | export * from "./DatasourceType"; 10 | export * from "./EmbeddingsModelProvider"; 11 | export * from "./FunctionDefinition"; 12 | export * from "./HttpValidationError"; 13 | export * from "./LlmList"; 14 | export * from "./LlmModel"; 15 | export * from "./LlmParams"; 16 | export * from "./LlmProvider"; 17 | export * from "./OpenAiAssistantParametersToolsItem"; 18 | export * from "./OpenAiAssistantParameters"; 19 | export * from "./ToolAssistantToolsCode"; 20 | export * from "./ToolAssistantToolsFunction"; 21 | export * from "./ToolAssistantToolsRetrieval"; 22 | export * from "./ToolList"; 23 | export * from "./ToolType"; 24 | export * from "./ValidationErrorLocItem"; 25 | export * from "./ValidationError"; 26 | export * from "./VectorDbList"; 27 | export * from "./VectorDbProvider"; 28 | export * from "./WorkflowConfig"; 29 | export * from "./WorkflowList"; 30 | export * from "./WorkflowStepList"; 31 | export * from "./ApiKeyCreateModel"; 32 | export * from "./AppModelsRequestApiKey"; 33 | export * from "./AppModelsRequestApiUser"; 34 | export * from "./AppModelsRequestDatasource"; 35 | export * from "./AppModelsRequestLlm"; 36 | export * from "./AppModelsRequestVectorDb"; 37 | export * from "./AppModelsRequestWorkflow"; 38 | export * from "./AppModelsRequestWorkflowStep"; 39 | export * from "./AppModelsResponseAgent"; 40 | export * from "./AppModelsResponseAgentInvoke"; 41 | export * from "./AppModelsResponseApiKey"; 42 | export * from "./AppModelsResponseApiUser"; 43 | export * from "./AppModelsResponseDatasource"; 44 | export * from "./AppModelsResponseLlm"; 45 | export * from "./AppModelsResponseTool"; 46 | export * from "./AppModelsResponseVectorDb"; 47 | export * from "./AppModelsResponseWorkflow"; 48 | export * from "./AppModelsResponseWorkflowStep"; 49 | export * from "./PrismaModelsAgent"; 50 | export * from "./PrismaModelsAgentDatasource"; 51 | export * from "./PrismaModelsAgentLlm"; 52 | export * from "./PrismaModelsAgentTool"; 53 | export * from "./PrismaModelsApiKey"; 54 | export * from "./PrismaModelsApiUser"; 55 | export * from "./PrismaModelsDatasource"; 56 | export * from "./PrismaModelsLlm"; 57 | export * from "./PrismaModelsTool"; 58 | export * from "./PrismaModelsVectorDb"; 59 | export * from "./PrismaModelsWorkflow"; 60 | export * from "./PrismaModelsWorkflowStep"; 61 | -------------------------------------------------------------------------------- /src/core/auth/BasicAuth.ts: -------------------------------------------------------------------------------- 1 | import { Base64 } from "js-base64"; 2 | 3 | export interface BasicAuth { 4 | username: string; 5 | password: string; 6 | } 7 | 8 | const BASIC_AUTH_HEADER_PREFIX = /^Basic /i; 9 | 10 | export const BasicAuth = { 11 | toAuthorizationHeader: (basicAuth: BasicAuth | undefined): string | undefined => { 12 | if (basicAuth == null) { 13 | return undefined; 14 | } 15 | const token = Base64.encode(`${basicAuth.username}:${basicAuth.password}`); 16 | return `Basic ${token}`; 17 | }, 18 | fromAuthorizationHeader: (header: string): BasicAuth => { 19 | const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, ""); 20 | const decoded = Base64.decode(credentials); 21 | const [username, password] = decoded.split(":", 2); 22 | 23 | if (username == null || password == null) { 24 | throw new Error("Invalid basic auth"); 25 | } 26 | return { 27 | username, 28 | password, 29 | }; 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /src/core/auth/BearerToken.ts: -------------------------------------------------------------------------------- 1 | export type BearerToken = string; 2 | 3 | const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; 4 | 5 | export const BearerToken = { 6 | toAuthorizationHeader: (token: BearerToken | undefined): string | undefined => { 7 | if (token == null) { 8 | return undefined; 9 | } 10 | return `Bearer ${token}`; 11 | }, 12 | fromAuthorizationHeader: (header: string): BearerToken => { 13 | return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /src/core/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { BasicAuth } from "./BasicAuth"; 2 | export { BearerToken } from "./BearerToken"; 3 | -------------------------------------------------------------------------------- /src/core/fetcher/APIResponse.ts: -------------------------------------------------------------------------------- 1 | export type APIResponse = SuccessfulResponse | FailedResponse; 2 | 3 | export interface SuccessfulResponse { 4 | ok: true; 5 | body: T; 6 | headers?: Record; 7 | } 8 | 9 | export interface FailedResponse { 10 | ok: false; 11 | error: T; 12 | } 13 | -------------------------------------------------------------------------------- /src/core/fetcher/Supplier.ts: -------------------------------------------------------------------------------- 1 | export type Supplier = T | Promise | (() => T | Promise); 2 | 3 | export const Supplier = { 4 | get: async (supplier: Supplier): Promise => { 5 | if (typeof supplier === "function") { 6 | return (supplier as () => T)(); 7 | } else { 8 | return supplier; 9 | } 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /src/core/fetcher/getHeader.ts: -------------------------------------------------------------------------------- 1 | export function getHeader(headers: Record, header: string): string | undefined { 2 | for (const [headerKey, headerValue] of Object.entries(headers)) { 3 | if (headerKey.toLowerCase() === header.toLowerCase()) { 4 | return headerValue; 5 | } 6 | } 7 | return undefined; 8 | } 9 | -------------------------------------------------------------------------------- /src/core/fetcher/index.ts: -------------------------------------------------------------------------------- 1 | export type { APIResponse } from "./APIResponse"; 2 | export { fetcher } from "./Fetcher"; 3 | export type { Fetcher, FetchFunction } from "./Fetcher"; 4 | export { getHeader } from "./getHeader"; 5 | export { Supplier } from "./Supplier"; 6 | -------------------------------------------------------------------------------- /src/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./fetcher"; 2 | export * from "./auth"; 3 | export * from "./runtime"; 4 | export * as serialization from "./schemas"; 5 | -------------------------------------------------------------------------------- /src/core/runtime/index.ts: -------------------------------------------------------------------------------- 1 | export { RUNTIME } from "./runtime"; 2 | -------------------------------------------------------------------------------- /src/core/runtime/runtime.ts: -------------------------------------------------------------------------------- 1 | interface DenoGlobal { 2 | version: { 3 | deno: string; 4 | }; 5 | } 6 | 7 | interface BunGlobal { 8 | version: string; 9 | } 10 | 11 | declare const Deno: DenoGlobal; 12 | declare const Bun: BunGlobal; 13 | 14 | /** 15 | * A constant that indicates whether the environment the code is running is a Web Browser. 16 | */ 17 | const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; 18 | 19 | /** 20 | * A constant that indicates whether the environment the code is running is a Web Worker. 21 | */ 22 | const isWebWorker = 23 | typeof self === "object" && 24 | // @ts-ignore 25 | typeof self?.importScripts === "function" && 26 | (self.constructor?.name === "DedicatedWorkerGlobalScope" || 27 | self.constructor?.name === "ServiceWorkerGlobalScope" || 28 | self.constructor?.name === "SharedWorkerGlobalScope"); 29 | 30 | /** 31 | * A constant that indicates whether the environment the code is running is Deno. 32 | */ 33 | const isDeno = 34 | typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; 35 | 36 | /** 37 | * A constant that indicates whether the environment the code is running is Bun.sh. 38 | */ 39 | const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; 40 | 41 | /** 42 | * A constant that indicates whether the environment the code is running is Node.JS. 43 | */ 44 | const isNode = 45 | typeof process !== "undefined" && 46 | Boolean(process.version) && 47 | Boolean(process.versions?.node) && 48 | // Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions 49 | !isDeno && 50 | !isBun; 51 | 52 | /** 53 | * A constant that indicates whether the environment the code is running is in React-Native. 54 | * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js 55 | */ 56 | const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; 57 | 58 | /** 59 | * A constant that indicates which environment and version the SDK is running in. 60 | */ 61 | export const RUNTIME: Runtime = evaluateRuntime(); 62 | 63 | export interface Runtime { 64 | type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown"; 65 | version?: string; 66 | } 67 | 68 | function evaluateRuntime(): Runtime { 69 | if (isBrowser) { 70 | return { 71 | type: "browser", 72 | version: window.navigator.userAgent, 73 | }; 74 | } 75 | 76 | if (isWebWorker) { 77 | return { 78 | type: "web-worker", 79 | }; 80 | } 81 | 82 | if (isDeno) { 83 | return { 84 | type: "deno", 85 | version: Deno.version.deno, 86 | }; 87 | } 88 | 89 | if (isBun) { 90 | return { 91 | type: "bun", 92 | version: Bun.version, 93 | }; 94 | } 95 | 96 | if (isNode) { 97 | return { 98 | type: "node", 99 | version: process.versions.node, 100 | }; 101 | } 102 | 103 | if (isReactNative) { 104 | return { 105 | type: "react-native", 106 | }; 107 | } 108 | 109 | return { 110 | type: "unknown", 111 | }; 112 | } 113 | -------------------------------------------------------------------------------- /src/core/schemas/Schema.ts: -------------------------------------------------------------------------------- 1 | import { SchemaUtils } from "./builders"; 2 | import { MaybePromise } from "./utils/MaybePromise"; 3 | 4 | export type Schema = BaseSchema & SchemaUtils; 5 | 6 | export type inferRaw = S extends Schema ? Raw : never; 7 | export type inferParsed = S extends Schema ? Parsed : never; 8 | 9 | export interface BaseSchema { 10 | parse: (raw: unknown, opts?: SchemaOptions) => MaybePromise>; 11 | json: (parsed: unknown, opts?: SchemaOptions) => MaybePromise>; 12 | getType: () => SchemaType | Promise; 13 | } 14 | 15 | export const SchemaType = { 16 | DATE: "date", 17 | ENUM: "enum", 18 | LIST: "list", 19 | STRING_LITERAL: "stringLiteral", 20 | BOOLEAN_LITERAL: "booleanLiteral", 21 | OBJECT: "object", 22 | ANY: "any", 23 | BOOLEAN: "boolean", 24 | NUMBER: "number", 25 | STRING: "string", 26 | UNKNOWN: "unknown", 27 | RECORD: "record", 28 | SET: "set", 29 | UNION: "union", 30 | UNDISCRIMINATED_UNION: "undiscriminatedUnion", 31 | OPTIONAL: "optional", 32 | } as const; 33 | export type SchemaType = typeof SchemaType[keyof typeof SchemaType]; 34 | 35 | export type MaybeValid = Valid | Invalid; 36 | 37 | export interface Valid { 38 | ok: true; 39 | value: T; 40 | } 41 | 42 | export interface Invalid { 43 | ok: false; 44 | errors: ValidationError[]; 45 | } 46 | 47 | export interface ValidationError { 48 | path: string[]; 49 | message: string; 50 | } 51 | 52 | export interface SchemaOptions { 53 | /** 54 | * how to handle unrecognized keys in objects 55 | * 56 | * @default "fail" 57 | */ 58 | unrecognizedObjectKeys?: "fail" | "passthrough" | "strip"; 59 | 60 | /** 61 | * whether to fail when an unrecognized discriminant value is 62 | * encountered in a union 63 | * 64 | * @default false 65 | */ 66 | allowUnrecognizedUnionMembers?: boolean; 67 | 68 | /** 69 | * whether to fail when an unrecognized enum value is encountered 70 | * 71 | * @default false 72 | */ 73 | allowUnrecognizedEnumValues?: boolean; 74 | 75 | /** 76 | * whether to allow data that doesn't conform to the schema. 77 | * invalid data is passed through without transformation. 78 | * 79 | * when this is enabled, .parse() and .json() will always 80 | * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()` 81 | * will never fail. 82 | * 83 | * @default false 84 | */ 85 | skipValidation?: boolean; 86 | 87 | /** 88 | * each validation failure contains a "path" property, which is 89 | * the breadcrumbs to the offending node in the JSON. you can supply 90 | * a prefix that is prepended to all the errors' paths. this can be 91 | * helpful for zurg's internal debug logging. 92 | */ 93 | breadcrumbsPrefix?: string[]; 94 | } 95 | -------------------------------------------------------------------------------- /src/core/schemas/builders/date/date.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema, SchemaType } from "../../Schema"; 2 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 3 | import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; 4 | import { getSchemaUtils } from "../schema-utils"; 5 | 6 | // https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime 7 | const ISO_8601_REGEX = 8 | /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; 9 | 10 | export function date(): Schema { 11 | const baseSchema: BaseSchema = { 12 | parse: (raw, { breadcrumbsPrefix = [] } = {}) => { 13 | if (typeof raw !== "string") { 14 | return { 15 | ok: false, 16 | errors: [ 17 | { 18 | path: breadcrumbsPrefix, 19 | message: getErrorMessageForIncorrectType(raw, "string"), 20 | }, 21 | ], 22 | }; 23 | } 24 | if (!ISO_8601_REGEX.test(raw)) { 25 | return { 26 | ok: false, 27 | errors: [ 28 | { 29 | path: breadcrumbsPrefix, 30 | message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"), 31 | }, 32 | ], 33 | }; 34 | } 35 | return { 36 | ok: true, 37 | value: new Date(raw), 38 | }; 39 | }, 40 | json: (date, { breadcrumbsPrefix = [] } = {}) => { 41 | if (date instanceof Date) { 42 | return { 43 | ok: true, 44 | value: date.toISOString(), 45 | }; 46 | } else { 47 | return { 48 | ok: false, 49 | errors: [ 50 | { 51 | path: breadcrumbsPrefix, 52 | message: getErrorMessageForIncorrectType(date, "Date object"), 53 | }, 54 | ], 55 | }; 56 | } 57 | }, 58 | getType: () => SchemaType.DATE, 59 | }; 60 | 61 | return { 62 | ...maybeSkipValidation(baseSchema), 63 | ...getSchemaUtils(baseSchema), 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /src/core/schemas/builders/date/index.ts: -------------------------------------------------------------------------------- 1 | export { date } from "./date"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/enum/enum.ts: -------------------------------------------------------------------------------- 1 | import { Schema, SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export function enum_(values: E): Schema { 6 | const validValues = new Set(values); 7 | 8 | const schemaCreator = createIdentitySchemaCreator( 9 | SchemaType.ENUM, 10 | (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => { 11 | if (typeof value !== "string") { 12 | return { 13 | ok: false, 14 | errors: [ 15 | { 16 | path: breadcrumbsPrefix, 17 | message: getErrorMessageForIncorrectType(value, "string"), 18 | }, 19 | ], 20 | }; 21 | } 22 | 23 | if (!validValues.has(value) && !allowUnrecognizedEnumValues) { 24 | return { 25 | ok: false, 26 | errors: [ 27 | { 28 | path: breadcrumbsPrefix, 29 | message: getErrorMessageForIncorrectType(value, "enum"), 30 | }, 31 | ], 32 | }; 33 | } 34 | 35 | return { 36 | ok: true, 37 | value: value as U, 38 | }; 39 | } 40 | ); 41 | 42 | return schemaCreator(); 43 | } 44 | -------------------------------------------------------------------------------- /src/core/schemas/builders/enum/index.ts: -------------------------------------------------------------------------------- 1 | export { enum_ } from "./enum"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./date"; 2 | export * from "./enum"; 3 | export * from "./lazy"; 4 | export * from "./list"; 5 | export * from "./literals"; 6 | export * from "./object"; 7 | export * from "./object-like"; 8 | export * from "./primitives"; 9 | export * from "./record"; 10 | export * from "./schema-utils"; 11 | export * from "./set"; 12 | export * from "./undiscriminated-union"; 13 | export * from "./union"; 14 | -------------------------------------------------------------------------------- /src/core/schemas/builders/lazy/index.ts: -------------------------------------------------------------------------------- 1 | export { lazy } from "./lazy"; 2 | export type { SchemaGetter } from "./lazy"; 3 | export { lazyObject } from "./lazyObject"; 4 | -------------------------------------------------------------------------------- /src/core/schemas/builders/lazy/lazy.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema } from "../../Schema"; 2 | import { getSchemaUtils } from "../schema-utils"; 3 | 4 | export type SchemaGetter> = () => SchemaType | Promise; 5 | 6 | export function lazy(getter: SchemaGetter>): Schema { 7 | const baseSchema = constructLazyBaseSchema(getter); 8 | return { 9 | ...baseSchema, 10 | ...getSchemaUtils(baseSchema), 11 | }; 12 | } 13 | 14 | export function constructLazyBaseSchema( 15 | getter: SchemaGetter> 16 | ): BaseSchema { 17 | return { 18 | parse: async (raw, opts) => (await getMemoizedSchema(getter)).parse(raw, opts), 19 | json: async (parsed, opts) => (await getMemoizedSchema(getter)).json(parsed, opts), 20 | getType: async () => (await getMemoizedSchema(getter)).getType(), 21 | }; 22 | } 23 | 24 | type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; 25 | 26 | export async function getMemoizedSchema>( 27 | getter: SchemaGetter 28 | ): Promise { 29 | const castedGetter = getter as MemoizedGetter; 30 | if (castedGetter.__zurg_memoized == null) { 31 | castedGetter.__zurg_memoized = await getter(); 32 | } 33 | return castedGetter.__zurg_memoized; 34 | } 35 | -------------------------------------------------------------------------------- /src/core/schemas/builders/lazy/lazyObject.ts: -------------------------------------------------------------------------------- 1 | import { getObjectUtils } from "../object"; 2 | import { getObjectLikeUtils } from "../object-like"; 3 | import { BaseObjectSchema, ObjectSchema } from "../object/types"; 4 | import { getSchemaUtils } from "../schema-utils"; 5 | import { constructLazyBaseSchema, getMemoizedSchema, SchemaGetter } from "./lazy"; 6 | 7 | export function lazyObject(getter: SchemaGetter>): ObjectSchema { 8 | const baseSchema: BaseObjectSchema = { 9 | ...constructLazyBaseSchema(getter), 10 | _getRawProperties: async () => (await getMemoizedSchema(getter))._getRawProperties(), 11 | _getParsedProperties: async () => (await getMemoizedSchema(getter))._getParsedProperties(), 12 | }; 13 | 14 | return { 15 | ...baseSchema, 16 | ...getSchemaUtils(baseSchema), 17 | ...getObjectLikeUtils(baseSchema), 18 | ...getObjectUtils(baseSchema), 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /src/core/schemas/builders/list/index.ts: -------------------------------------------------------------------------------- 1 | export { list } from "./list"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/list/list.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; 2 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 3 | import { MaybePromise } from "../../utils/MaybePromise"; 4 | import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; 5 | import { getSchemaUtils } from "../schema-utils"; 6 | 7 | export function list(schema: Schema): Schema { 8 | const baseSchema: BaseSchema = { 9 | parse: async (raw, opts) => 10 | validateAndTransformArray(raw, (item, index) => 11 | schema.parse(item, { 12 | ...opts, 13 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], 14 | }) 15 | ), 16 | json: (parsed, opts) => 17 | validateAndTransformArray(parsed, (item, index) => 18 | schema.json(item, { 19 | ...opts, 20 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], 21 | }) 22 | ), 23 | getType: () => SchemaType.LIST, 24 | }; 25 | 26 | return { 27 | ...maybeSkipValidation(baseSchema), 28 | ...getSchemaUtils(baseSchema), 29 | }; 30 | } 31 | 32 | async function validateAndTransformArray( 33 | value: unknown, 34 | transformItem: (item: Raw, index: number) => MaybePromise> 35 | ): Promise> { 36 | if (!Array.isArray(value)) { 37 | return { 38 | ok: false, 39 | errors: [ 40 | { 41 | message: getErrorMessageForIncorrectType(value, "list"), 42 | path: [], 43 | }, 44 | ], 45 | }; 46 | } 47 | 48 | const maybeValidItems = await Promise.all(value.map((item, index) => transformItem(item, index))); 49 | 50 | return maybeValidItems.reduce>( 51 | (acc, item) => { 52 | if (acc.ok && item.ok) { 53 | return { 54 | ok: true, 55 | value: [...acc.value, item.value], 56 | }; 57 | } 58 | 59 | const errors: ValidationError[] = []; 60 | if (!acc.ok) { 61 | errors.push(...acc.errors); 62 | } 63 | if (!item.ok) { 64 | errors.push(...item.errors); 65 | } 66 | 67 | return { 68 | ok: false, 69 | errors, 70 | }; 71 | }, 72 | { ok: true, value: [] } 73 | ); 74 | } 75 | -------------------------------------------------------------------------------- /src/core/schemas/builders/literals/booleanLiteral.ts: -------------------------------------------------------------------------------- 1 | import { Schema, SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export function booleanLiteral(literal: V): Schema { 6 | const schemaCreator = createIdentitySchemaCreator( 7 | SchemaType.BOOLEAN_LITERAL, 8 | (value, { breadcrumbsPrefix = [] } = {}) => { 9 | if (value === literal) { 10 | return { 11 | ok: true, 12 | value: literal, 13 | }; 14 | } else { 15 | return { 16 | ok: false, 17 | errors: [ 18 | { 19 | path: breadcrumbsPrefix, 20 | message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), 21 | }, 22 | ], 23 | }; 24 | } 25 | } 26 | ); 27 | 28 | return schemaCreator(); 29 | } 30 | -------------------------------------------------------------------------------- /src/core/schemas/builders/literals/index.ts: -------------------------------------------------------------------------------- 1 | export { stringLiteral } from "./stringLiteral"; 2 | export { booleanLiteral } from "./booleanLiteral"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/literals/stringLiteral.ts: -------------------------------------------------------------------------------- 1 | import { Schema, SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export function stringLiteral(literal: V): Schema { 6 | const schemaCreator = createIdentitySchemaCreator( 7 | SchemaType.STRING_LITERAL, 8 | (value, { breadcrumbsPrefix = [] } = {}) => { 9 | if (value === literal) { 10 | return { 11 | ok: true, 12 | value: literal, 13 | }; 14 | } else { 15 | return { 16 | ok: false, 17 | errors: [ 18 | { 19 | path: breadcrumbsPrefix, 20 | message: getErrorMessageForIncorrectType(value, `"${literal}"`), 21 | }, 22 | ], 23 | }; 24 | } 25 | } 26 | ); 27 | 28 | return schemaCreator(); 29 | } 30 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object-like/getObjectLikeUtils.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from "../../Schema"; 2 | import { filterObject } from "../../utils/filterObject"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | import { isPlainObject } from "../../utils/isPlainObject"; 5 | import { getSchemaUtils } from "../schema-utils"; 6 | import { ObjectLikeSchema, ObjectLikeUtils } from "./types"; 7 | 8 | export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { 9 | return { 10 | withParsedProperties: (properties) => withParsedProperties(schema, properties), 11 | }; 12 | } 13 | 14 | /** 15 | * object-like utils are defined in one file to resolve issues with circular imports 16 | */ 17 | 18 | export function withParsedProperties( 19 | objectLike: BaseSchema, 20 | properties: { [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]) } 21 | ): ObjectLikeSchema { 22 | const objectSchema: BaseSchema = { 23 | parse: async (raw, opts) => { 24 | const parsedObject = await objectLike.parse(raw, opts); 25 | if (!parsedObject.ok) { 26 | return parsedObject; 27 | } 28 | 29 | const additionalProperties = Object.entries(properties).reduce>( 30 | (processed, [key, value]) => { 31 | return { 32 | ...processed, 33 | [key]: typeof value === "function" ? value(parsedObject.value) : value, 34 | }; 35 | }, 36 | {} 37 | ); 38 | 39 | return { 40 | ok: true, 41 | value: { 42 | ...parsedObject.value, 43 | ...(additionalProperties as Properties), 44 | }, 45 | }; 46 | }, 47 | 48 | json: (parsed, opts) => { 49 | if (!isPlainObject(parsed)) { 50 | return { 51 | ok: false, 52 | errors: [ 53 | { 54 | path: opts?.breadcrumbsPrefix ?? [], 55 | message: getErrorMessageForIncorrectType(parsed, "object"), 56 | }, 57 | ], 58 | }; 59 | } 60 | 61 | // strip out added properties 62 | const addedPropertyKeys = new Set(Object.keys(properties)); 63 | const parsedWithoutAddedProperties = filterObject( 64 | parsed, 65 | Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)) 66 | ); 67 | 68 | return objectLike.json(parsedWithoutAddedProperties as ParsedObjectShape, opts); 69 | }, 70 | 71 | getType: () => objectLike.getType(), 72 | }; 73 | 74 | return { 75 | ...objectSchema, 76 | ...getSchemaUtils(objectSchema), 77 | ...getObjectLikeUtils(objectSchema), 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object-like/index.ts: -------------------------------------------------------------------------------- 1 | export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; 2 | export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object-like/types.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema } from "../../Schema"; 2 | 3 | export type ObjectLikeSchema = Schema & 4 | BaseSchema & 5 | ObjectLikeUtils; 6 | 7 | export interface ObjectLikeUtils { 8 | withParsedProperties: >(properties: { 9 | [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); 10 | }) => ObjectLikeSchema; 11 | } 12 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object/index.ts: -------------------------------------------------------------------------------- 1 | export { getObjectUtils, object } from "./object"; 2 | export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; 3 | export type { 4 | inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, 5 | inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, 6 | } from "./objectWithoutOptionalProperties"; 7 | export { isProperty, property } from "./property"; 8 | export type { Property } from "./property"; 9 | export type { 10 | BaseObjectSchema, 11 | inferObjectSchemaFromPropertySchemas, 12 | inferParsedObject, 13 | inferParsedObjectFromPropertySchemas, 14 | inferParsedPropertySchema, 15 | inferRawKey, 16 | inferRawObject, 17 | inferRawObjectFromPropertySchemas, 18 | inferRawPropertySchema, 19 | ObjectSchema, 20 | ObjectUtils, 21 | PropertySchemas, 22 | } from "./types"; 23 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object/objectWithoutOptionalProperties.ts: -------------------------------------------------------------------------------- 1 | import { object } from "./object"; 2 | import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types"; 3 | 4 | export function objectWithoutOptionalProperties>( 5 | schemas: T 6 | ): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { 7 | return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; 8 | } 9 | 10 | export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = 11 | ObjectSchema< 12 | inferRawObjectFromPropertySchemas, 13 | inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas 14 | >; 15 | 16 | export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { 17 | [K in keyof T]: inferParsedPropertySchema; 18 | }; 19 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object/property.ts: -------------------------------------------------------------------------------- 1 | import { Schema } from "../../Schema"; 2 | 3 | export function property( 4 | rawKey: RawKey, 5 | valueSchema: Schema 6 | ): Property { 7 | return { 8 | rawKey, 9 | valueSchema, 10 | isProperty: true, 11 | }; 12 | } 13 | 14 | export interface Property { 15 | rawKey: RawKey; 16 | valueSchema: Schema; 17 | isProperty: true; 18 | } 19 | 20 | export function isProperty>(maybeProperty: unknown): maybeProperty is O { 21 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition 22 | return (maybeProperty as O).isProperty; 23 | } 24 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object/types.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema"; 2 | import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties"; 3 | import { ObjectLikeUtils } from "../object-like"; 4 | import { SchemaUtils } from "../schema-utils"; 5 | import { Property } from "./property"; 6 | 7 | export type ObjectSchema = BaseObjectSchema & 8 | ObjectLikeUtils & 9 | ObjectUtils & 10 | SchemaUtils; 11 | 12 | export interface BaseObjectSchema extends BaseSchema { 13 | _getRawProperties: () => Promise<(keyof Raw)[]>; 14 | _getParsedProperties: () => Promise<(keyof Parsed)[]>; 15 | } 16 | 17 | export interface ObjectUtils { 18 | extend: ( 19 | schemas: ObjectSchema 20 | ) => ObjectSchema; 21 | } 22 | 23 | export type inferRawObject> = O extends ObjectSchema ? Raw : never; 24 | 25 | export type inferParsedObject> = O extends ObjectSchema 26 | ? Parsed 27 | : never; 28 | 29 | export type inferObjectSchemaFromPropertySchemas> = ObjectSchema< 30 | inferRawObjectFromPropertySchemas, 31 | inferParsedObjectFromPropertySchemas 32 | >; 33 | 34 | export type inferRawObjectFromPropertySchemas> = 35 | addQuestionMarksToNullableProperties<{ 36 | [ParsedKey in keyof T as inferRawKey]: inferRawPropertySchema; 37 | }>; 38 | 39 | export type inferParsedObjectFromPropertySchemas> = 40 | addQuestionMarksToNullableProperties<{ 41 | [K in keyof T]: inferParsedPropertySchema; 42 | }>; 43 | 44 | export type PropertySchemas = Record< 45 | ParsedKeys, 46 | Property | Schema 47 | >; 48 | 49 | export type inferRawPropertySchema

| Schema> = P extends Property< 50 | any, 51 | infer Raw, 52 | any 53 | > 54 | ? Raw 55 | : P extends Schema 56 | ? inferRaw

57 | : never; 58 | 59 | export type inferParsedPropertySchema

| Schema> = P extends Property< 60 | any, 61 | any, 62 | infer Parsed 63 | > 64 | ? Parsed 65 | : P extends Schema 66 | ? inferParsed

67 | : never; 68 | 69 | export type inferRawKey< 70 | ParsedKey extends string | number | symbol, 71 | P extends Property | Schema 72 | > = P extends Property ? Raw : ParsedKey; 73 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/any.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | 4 | export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/boolean.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export const boolean = createIdentitySchemaCreator( 6 | SchemaType.BOOLEAN, 7 | (value, { breadcrumbsPrefix = [] } = {}) => { 8 | if (typeof value === "boolean") { 9 | return { 10 | ok: true, 11 | value, 12 | }; 13 | } else { 14 | return { 15 | ok: false, 16 | errors: [ 17 | { 18 | path: breadcrumbsPrefix, 19 | message: getErrorMessageForIncorrectType(value, "boolean"), 20 | }, 21 | ], 22 | }; 23 | } 24 | } 25 | ); 26 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/index.ts: -------------------------------------------------------------------------------- 1 | export { any } from "./any"; 2 | export { boolean } from "./boolean"; 3 | export { number } from "./number"; 4 | export { string } from "./string"; 5 | export { unknown } from "./unknown"; 6 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/number.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export const number = createIdentitySchemaCreator( 6 | SchemaType.NUMBER, 7 | (value, { breadcrumbsPrefix = [] } = {}) => { 8 | if (typeof value === "number") { 9 | return { 10 | ok: true, 11 | value, 12 | }; 13 | } else { 14 | return { 15 | ok: false, 16 | errors: [ 17 | { 18 | path: breadcrumbsPrefix, 19 | message: getErrorMessageForIncorrectType(value, "number"), 20 | }, 21 | ], 22 | }; 23 | } 24 | } 25 | ); 26 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/string.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | 5 | export const string = createIdentitySchemaCreator( 6 | SchemaType.STRING, 7 | (value, { breadcrumbsPrefix = [] } = {}) => { 8 | if (typeof value === "string") { 9 | return { 10 | ok: true, 11 | value, 12 | }; 13 | } else { 14 | return { 15 | ok: false, 16 | errors: [ 17 | { 18 | path: breadcrumbsPrefix, 19 | message: getErrorMessageForIncorrectType(value, "string"), 20 | }, 21 | ], 22 | }; 23 | } 24 | } 25 | ); 26 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/unknown.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | 4 | export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/record/index.ts: -------------------------------------------------------------------------------- 1 | export { record } from "./record"; 2 | export type { BaseRecordSchema, RecordSchema } from "./types"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/record/record.ts: -------------------------------------------------------------------------------- 1 | import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; 2 | import { entries } from "../../utils/entries"; 3 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 4 | import { isPlainObject } from "../../utils/isPlainObject"; 5 | import { MaybePromise } from "../../utils/MaybePromise"; 6 | import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; 7 | import { getSchemaUtils } from "../schema-utils"; 8 | import { BaseRecordSchema, RecordSchema } from "./types"; 9 | 10 | export function record( 11 | keySchema: Schema, 12 | valueSchema: Schema 13 | ): RecordSchema { 14 | const baseSchema: BaseRecordSchema = { 15 | parse: async (raw, opts) => { 16 | return validateAndTransformRecord({ 17 | value: raw, 18 | isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, 19 | transformKey: (key) => 20 | keySchema.parse(key, { 21 | ...opts, 22 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], 23 | }), 24 | transformValue: (value, key) => 25 | valueSchema.parse(value, { 26 | ...opts, 27 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], 28 | }), 29 | breadcrumbsPrefix: opts?.breadcrumbsPrefix, 30 | }); 31 | }, 32 | json: async (parsed, opts) => { 33 | return validateAndTransformRecord({ 34 | value: parsed, 35 | isKeyNumeric: (await keySchema.getType()) === SchemaType.NUMBER, 36 | transformKey: (key) => 37 | keySchema.json(key, { 38 | ...opts, 39 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], 40 | }), 41 | transformValue: (value, key) => 42 | valueSchema.json(value, { 43 | ...opts, 44 | breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], 45 | }), 46 | breadcrumbsPrefix: opts?.breadcrumbsPrefix, 47 | }); 48 | }, 49 | getType: () => SchemaType.RECORD, 50 | }; 51 | 52 | return { 53 | ...maybeSkipValidation(baseSchema), 54 | ...getSchemaUtils(baseSchema), 55 | }; 56 | } 57 | 58 | async function validateAndTransformRecord({ 59 | value, 60 | isKeyNumeric, 61 | transformKey, 62 | transformValue, 63 | breadcrumbsPrefix = [], 64 | }: { 65 | value: unknown; 66 | isKeyNumeric: boolean; 67 | transformKey: (key: string | number) => MaybePromise>; 68 | transformValue: (value: unknown, key: string | number) => MaybePromise>; 69 | breadcrumbsPrefix: string[] | undefined; 70 | }): Promise>> { 71 | if (!isPlainObject(value)) { 72 | return { 73 | ok: false, 74 | errors: [ 75 | { 76 | path: breadcrumbsPrefix, 77 | message: getErrorMessageForIncorrectType(value, "object"), 78 | }, 79 | ], 80 | }; 81 | } 82 | 83 | return entries(value).reduce>>>( 84 | async (accPromise, [stringKey, value]) => { 85 | // skip nullish keys 86 | if (value == null) { 87 | return accPromise; 88 | } 89 | 90 | const acc = await accPromise; 91 | 92 | let key: string | number = stringKey; 93 | if (isKeyNumeric) { 94 | const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; 95 | if (!isNaN(numberKey)) { 96 | key = numberKey; 97 | } 98 | } 99 | const transformedKey = await transformKey(key); 100 | 101 | const transformedValue = await transformValue(value, key); 102 | 103 | if (acc.ok && transformedKey.ok && transformedValue.ok) { 104 | return { 105 | ok: true, 106 | value: { 107 | ...acc.value, 108 | [transformedKey.value]: transformedValue.value, 109 | }, 110 | }; 111 | } 112 | 113 | const errors: ValidationError[] = []; 114 | if (!acc.ok) { 115 | errors.push(...acc.errors); 116 | } 117 | if (!transformedKey.ok) { 118 | errors.push(...transformedKey.errors); 119 | } 120 | if (!transformedValue.ok) { 121 | errors.push(...transformedValue.errors); 122 | } 123 | 124 | return { 125 | ok: false, 126 | errors, 127 | }; 128 | }, 129 | Promise.resolve({ ok: true, value: {} as Record }) 130 | ); 131 | } 132 | -------------------------------------------------------------------------------- /src/core/schemas/builders/record/types.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from "../../Schema"; 2 | import { SchemaUtils } from "../schema-utils"; 3 | 4 | export type RecordSchema< 5 | RawKey extends string | number, 6 | RawValue, 7 | ParsedKey extends string | number, 8 | ParsedValue 9 | > = BaseRecordSchema & 10 | SchemaUtils, Record>; 11 | 12 | export type BaseRecordSchema< 13 | RawKey extends string | number, 14 | RawValue, 15 | ParsedKey extends string | number, 16 | ParsedValue 17 | > = BaseSchema, Record>; 18 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/JsonError.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | import { stringifyValidationError } from "./stringifyValidationErrors"; 3 | 4 | export class JsonError extends Error { 5 | constructor(public readonly errors: ValidationError[]) { 6 | super(errors.map(stringifyValidationError).join("; ")); 7 | Object.setPrototypeOf(this, JsonError.prototype); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/ParseError.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | import { stringifyValidationError } from "./stringifyValidationErrors"; 3 | 4 | export class ParseError extends Error { 5 | constructor(public readonly errors: ValidationError[]) { 6 | super(errors.map(stringifyValidationError).join("; ")); 7 | Object.setPrototypeOf(this, ParseError.prototype); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/getSchemaUtils.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema"; 2 | import { JsonError } from "./JsonError"; 3 | import { ParseError } from "./ParseError"; 4 | 5 | export interface SchemaUtils { 6 | optional: () => Schema; 7 | transform: (transformer: SchemaTransformer) => Schema; 8 | parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; 9 | jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Promise; 10 | } 11 | 12 | export interface SchemaTransformer { 13 | transform: (parsed: Parsed) => Transformed; 14 | untransform: (transformed: any) => Parsed; 15 | } 16 | 17 | export function getSchemaUtils(schema: BaseSchema): SchemaUtils { 18 | return { 19 | optional: () => optional(schema), 20 | transform: (transformer) => transform(schema, transformer), 21 | parseOrThrow: async (raw, opts) => { 22 | const parsed = await schema.parse(raw, opts); 23 | if (parsed.ok) { 24 | return parsed.value; 25 | } 26 | throw new ParseError(parsed.errors); 27 | }, 28 | jsonOrThrow: async (parsed, opts) => { 29 | const raw = await schema.json(parsed, opts); 30 | if (raw.ok) { 31 | return raw.value; 32 | } 33 | throw new JsonError(raw.errors); 34 | }, 35 | }; 36 | } 37 | 38 | /** 39 | * schema utils are defined in one file to resolve issues with circular imports 40 | */ 41 | 42 | export function optional( 43 | schema: BaseSchema 44 | ): Schema { 45 | const baseSchema: BaseSchema = { 46 | parse: (raw, opts) => { 47 | if (raw == null) { 48 | return { 49 | ok: true, 50 | value: undefined, 51 | }; 52 | } 53 | return schema.parse(raw, opts); 54 | }, 55 | json: (parsed, opts) => { 56 | if (parsed == null) { 57 | return { 58 | ok: true, 59 | value: null, 60 | }; 61 | } 62 | return schema.json(parsed, opts); 63 | }, 64 | getType: () => SchemaType.OPTIONAL, 65 | }; 66 | 67 | return { 68 | ...baseSchema, 69 | ...getSchemaUtils(baseSchema), 70 | }; 71 | } 72 | 73 | export function transform( 74 | schema: BaseSchema, 75 | transformer: SchemaTransformer 76 | ): Schema { 77 | const baseSchema: BaseSchema = { 78 | parse: async (raw, opts) => { 79 | const parsed = await schema.parse(raw, opts); 80 | if (!parsed.ok) { 81 | return parsed; 82 | } 83 | return { 84 | ok: true, 85 | value: transformer.transform(parsed.value), 86 | }; 87 | }, 88 | json: async (transformed, opts) => { 89 | const parsed = await transformer.untransform(transformed); 90 | return schema.json(parsed, opts); 91 | }, 92 | getType: () => schema.getType(), 93 | }; 94 | 95 | return { 96 | ...baseSchema, 97 | ...getSchemaUtils(baseSchema), 98 | }; 99 | } 100 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/index.ts: -------------------------------------------------------------------------------- 1 | export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; 2 | export type { SchemaUtils } from "./getSchemaUtils"; 3 | export { JsonError } from "./JsonError"; 4 | export { ParseError } from "./ParseError"; 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | 3 | export function stringifyValidationError(error: ValidationError): string { 4 | if (error.path.length === 0) { 5 | return error.message; 6 | } 7 | return `${error.path.join(" -> ")}: ${error.message}`; 8 | } 9 | -------------------------------------------------------------------------------- /src/core/schemas/builders/set/index.ts: -------------------------------------------------------------------------------- 1 | export { set } from "./set"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/set/set.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema, SchemaType } from "../../Schema"; 2 | import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; 3 | import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; 4 | import { list } from "../list"; 5 | import { getSchemaUtils } from "../schema-utils"; 6 | 7 | export function set(schema: Schema): Schema> { 8 | const listSchema = list(schema); 9 | const baseSchema: BaseSchema> = { 10 | parse: async (raw, opts) => { 11 | const parsedList = await listSchema.parse(raw, opts); 12 | if (parsedList.ok) { 13 | return { 14 | ok: true, 15 | value: new Set(parsedList.value), 16 | }; 17 | } else { 18 | return parsedList; 19 | } 20 | }, 21 | json: async (parsed, opts) => { 22 | if (!(parsed instanceof Set)) { 23 | return { 24 | ok: false, 25 | errors: [ 26 | { 27 | path: opts?.breadcrumbsPrefix ?? [], 28 | message: getErrorMessageForIncorrectType(parsed, "Set"), 29 | }, 30 | ], 31 | }; 32 | } 33 | const jsonList = await listSchema.json([...parsed], opts); 34 | return jsonList; 35 | }, 36 | getType: () => SchemaType.SET, 37 | }; 38 | 39 | return { 40 | ...maybeSkipValidation(baseSchema), 41 | ...getSchemaUtils(baseSchema), 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /src/core/schemas/builders/undiscriminated-union/index.ts: -------------------------------------------------------------------------------- 1 | export type { 2 | inferParsedUnidiscriminatedUnionSchema, 3 | inferRawUnidiscriminatedUnionSchema, 4 | UndiscriminatedUnionSchema, 5 | } from "./types"; 6 | export { undiscriminatedUnion } from "./undiscriminatedUnion"; 7 | -------------------------------------------------------------------------------- /src/core/schemas/builders/undiscriminated-union/types.ts: -------------------------------------------------------------------------------- 1 | import { inferParsed, inferRaw, Schema } from "../../Schema"; 2 | 3 | export type UndiscriminatedUnionSchema = Schema< 4 | inferRawUnidiscriminatedUnionSchema, 5 | inferParsedUnidiscriminatedUnionSchema 6 | >; 7 | 8 | export type inferRawUnidiscriminatedUnionSchema = inferRaw; 9 | 10 | export type inferParsedUnidiscriminatedUnionSchema = inferParsed; 11 | -------------------------------------------------------------------------------- /src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; 2 | import { MaybePromise } from "../../utils/MaybePromise"; 3 | import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; 4 | import { getSchemaUtils } from "../schema-utils"; 5 | import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; 6 | 7 | export function undiscriminatedUnion, ...Schema[]]>( 8 | schemas: Schemas 9 | ): Schema, inferParsedUnidiscriminatedUnionSchema> { 10 | const baseSchema: BaseSchema< 11 | inferRawUnidiscriminatedUnionSchema, 12 | inferParsedUnidiscriminatedUnionSchema 13 | > = { 14 | parse: async (raw, opts) => { 15 | return validateAndTransformUndiscriminatedUnion>( 16 | (schema, opts) => schema.parse(raw, opts), 17 | schemas, 18 | opts 19 | ); 20 | }, 21 | json: async (parsed, opts) => { 22 | return validateAndTransformUndiscriminatedUnion>( 23 | (schema, opts) => schema.json(parsed, opts), 24 | schemas, 25 | opts 26 | ); 27 | }, 28 | getType: () => SchemaType.UNDISCRIMINATED_UNION, 29 | }; 30 | 31 | return { 32 | ...maybeSkipValidation(baseSchema), 33 | ...getSchemaUtils(baseSchema), 34 | }; 35 | } 36 | 37 | async function validateAndTransformUndiscriminatedUnion( 38 | transform: (schema: Schema, opts: SchemaOptions) => MaybePromise>, 39 | schemas: Schema[], 40 | opts: SchemaOptions | undefined 41 | ): Promise> { 42 | const errors: ValidationError[] = []; 43 | for (const [index, schema] of schemas.entries()) { 44 | const transformed = await transform(schema, { ...opts, skipValidation: false }); 45 | if (transformed.ok) { 46 | return transformed; 47 | } else { 48 | for (const error of transformed.errors) { 49 | errors.push({ 50 | path: error.path, 51 | message: `[Variant ${index}] ${error.message}`, 52 | }); 53 | } 54 | } 55 | } 56 | 57 | return { 58 | ok: false, 59 | errors, 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /src/core/schemas/builders/union/discriminant.ts: -------------------------------------------------------------------------------- 1 | export function discriminant( 2 | parsedDiscriminant: ParsedDiscriminant, 3 | rawDiscriminant: RawDiscriminant 4 | ): Discriminant { 5 | return { 6 | parsedDiscriminant, 7 | rawDiscriminant, 8 | }; 9 | } 10 | 11 | export interface Discriminant { 12 | parsedDiscriminant: ParsedDiscriminant; 13 | rawDiscriminant: RawDiscriminant; 14 | } 15 | -------------------------------------------------------------------------------- /src/core/schemas/builders/union/index.ts: -------------------------------------------------------------------------------- 1 | export { discriminant } from "./discriminant"; 2 | export type { Discriminant } from "./discriminant"; 3 | export type { 4 | inferParsedDiscriminant, 5 | inferParsedUnion, 6 | inferRawDiscriminant, 7 | inferRawUnion, 8 | UnionSubtypes, 9 | } from "./types"; 10 | export { union } from "./union"; 11 | -------------------------------------------------------------------------------- /src/core/schemas/builders/union/types.ts: -------------------------------------------------------------------------------- 1 | import { inferParsedObject, inferRawObject, ObjectSchema } from "../object"; 2 | import { Discriminant } from "./discriminant"; 3 | 4 | export type UnionSubtypes = { 5 | [K in DiscriminantValues]: ObjectSchema; 6 | }; 7 | 8 | export type inferRawUnion, U extends UnionSubtypes> = { 9 | [K in keyof U]: Record, K> & inferRawObject; 10 | }[keyof U]; 11 | 12 | export type inferParsedUnion, U extends UnionSubtypes> = { 13 | [K in keyof U]: Record, K> & inferParsedObject; 14 | }[keyof U]; 15 | 16 | export type inferRawDiscriminant> = D extends string 17 | ? D 18 | : D extends Discriminant 19 | ? Raw 20 | : never; 21 | 22 | export type inferParsedDiscriminant> = D extends string 23 | ? D 24 | : D extends Discriminant 25 | ? Parsed 26 | : never; 27 | -------------------------------------------------------------------------------- /src/core/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./builders"; 2 | export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/utils/MaybePromise.ts: -------------------------------------------------------------------------------- 1 | export type MaybePromise = T | Promise; 2 | -------------------------------------------------------------------------------- /src/core/schemas/utils/addQuestionMarksToNullableProperties.ts: -------------------------------------------------------------------------------- 1 | export type addQuestionMarksToNullableProperties = { 2 | [K in OptionalKeys]?: T[K]; 3 | } & Pick>; 4 | 5 | export type OptionalKeys = { 6 | [K in keyof T]-?: undefined extends T[K] 7 | ? K 8 | : null extends T[K] 9 | ? K 10 | : 1 extends (any extends T[K] ? 0 : 1) 11 | ? never 12 | : K; 13 | }[keyof T]; 14 | 15 | export type RequiredKeys = Exclude>; 16 | -------------------------------------------------------------------------------- /src/core/schemas/utils/createIdentitySchemaCreator.ts: -------------------------------------------------------------------------------- 1 | import { getSchemaUtils } from "../builders/schema-utils"; 2 | import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; 3 | import { maybeSkipValidation } from "./maybeSkipValidation"; 4 | 5 | export function createIdentitySchemaCreator( 6 | schemaType: SchemaType, 7 | validate: (value: unknown, opts?: SchemaOptions) => MaybeValid 8 | ): () => Schema { 9 | return () => { 10 | const baseSchema: BaseSchema = { 11 | parse: validate, 12 | json: validate, 13 | getType: () => schemaType, 14 | }; 15 | 16 | return { 17 | ...maybeSkipValidation(baseSchema), 18 | ...getSchemaUtils(baseSchema), 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /src/core/schemas/utils/entries.ts: -------------------------------------------------------------------------------- 1 | export function entries(object: T): [keyof T, T[keyof T]][] { 2 | return Object.entries(object) as [keyof T, T[keyof T]][]; 3 | } 4 | -------------------------------------------------------------------------------- /src/core/schemas/utils/filterObject.ts: -------------------------------------------------------------------------------- 1 | export function filterObject(obj: T, keysToInclude: K[]): Pick { 2 | const keysToIncludeSet = new Set(keysToInclude); 3 | return Object.entries(obj).reduce((acc, [key, value]) => { 4 | if (keysToIncludeSet.has(key as K)) { 5 | acc[key as K] = value; 6 | } 7 | return acc; 8 | // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter 9 | }, {} as Pick); 10 | } 11 | -------------------------------------------------------------------------------- /src/core/schemas/utils/getErrorMessageForIncorrectType.ts: -------------------------------------------------------------------------------- 1 | export function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string { 2 | return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`; 3 | } 4 | 5 | function getTypeAsString(value: unknown): string { 6 | if (Array.isArray(value)) { 7 | return "list"; 8 | } 9 | if (value === null) { 10 | return "null"; 11 | } 12 | switch (typeof value) { 13 | case "string": 14 | return `"${value}"`; 15 | case "number": 16 | case "boolean": 17 | case "undefined": 18 | return `${value}`; 19 | } 20 | return typeof value; 21 | } 22 | -------------------------------------------------------------------------------- /src/core/schemas/utils/isPlainObject.ts: -------------------------------------------------------------------------------- 1 | // borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js 2 | export function isPlainObject(value: unknown): value is Record { 3 | if (typeof value !== "object" || value === null) { 4 | return false; 5 | } 6 | 7 | if (Object.getPrototypeOf(value) === null) { 8 | return true; 9 | } 10 | 11 | let proto = value; 12 | while (Object.getPrototypeOf(proto) !== null) { 13 | proto = Object.getPrototypeOf(proto); 14 | } 15 | 16 | return Object.getPrototypeOf(value) === proto; 17 | } 18 | -------------------------------------------------------------------------------- /src/core/schemas/utils/keys.ts: -------------------------------------------------------------------------------- 1 | export function keys(object: T): (keyof T)[] { 2 | return Object.keys(object) as (keyof T)[]; 3 | } 4 | -------------------------------------------------------------------------------- /src/core/schemas/utils/maybeSkipValidation.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; 2 | import { MaybePromise } from "./MaybePromise"; 3 | 4 | export function maybeSkipValidation, Raw, Parsed>(schema: S): S { 5 | return { 6 | ...schema, 7 | json: transformAndMaybeSkipValidation(schema.json), 8 | parse: transformAndMaybeSkipValidation(schema.parse), 9 | }; 10 | } 11 | 12 | function transformAndMaybeSkipValidation( 13 | transform: (value: unknown, opts?: SchemaOptions) => MaybePromise> 14 | ): (value: unknown, opts?: SchemaOptions) => MaybePromise> { 15 | return async (value, opts): Promise> => { 16 | const transformed = await transform(value, opts); 17 | const { skipValidation = false } = opts ?? {}; 18 | if (!transformed.ok && skipValidation) { 19 | // eslint-disable-next-line no-console 20 | console.warn( 21 | [ 22 | "Failed to validate.", 23 | ...transformed.errors.map( 24 | (error) => 25 | " - " + 26 | (error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message) 27 | ), 28 | ].join("\n") 29 | ); 30 | 31 | return { 32 | ok: true, 33 | value: value as T, 34 | }; 35 | } else { 36 | return transformed; 37 | } 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /src/core/schemas/utils/partition.ts: -------------------------------------------------------------------------------- 1 | export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { 2 | const trueItems: T[] = [], 3 | falseItems: T[] = []; 4 | for (const item of items) { 5 | if (predicate(item)) { 6 | trueItems.push(item); 7 | } else { 8 | falseItems.push(item); 9 | } 10 | } 11 | return [trueItems, falseItems]; 12 | } 13 | -------------------------------------------------------------------------------- /src/environments.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export const SuperAgentEnvironment = { 6 | Default: "https://api.beta.superagent.sh", 7 | } as const; 8 | 9 | export type SuperAgentEnvironment = typeof SuperAgentEnvironment.Default; 10 | -------------------------------------------------------------------------------- /src/errors/SuperAgentError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export class SuperAgentError extends Error { 6 | readonly statusCode?: number; 7 | readonly body?: unknown; 8 | 9 | constructor({ message, statusCode, body }: { message?: string; statusCode?: number; body?: unknown }) { 10 | super(buildMessage({ message, statusCode, body })); 11 | Object.setPrototypeOf(this, SuperAgentError.prototype); 12 | if (statusCode != null) { 13 | this.statusCode = statusCode; 14 | } 15 | 16 | if (body !== undefined) { 17 | this.body = body; 18 | } 19 | } 20 | } 21 | 22 | function buildMessage({ 23 | message, 24 | statusCode, 25 | body, 26 | }: { 27 | message: string | undefined; 28 | statusCode: number | undefined; 29 | body: unknown | undefined; 30 | }): string { 31 | let lines: string[] = []; 32 | if (message != null) { 33 | lines.push(message); 34 | } 35 | 36 | if (statusCode != null) { 37 | lines.push(`Status code: ${statusCode.toString()}`); 38 | } 39 | 40 | if (body != null) { 41 | lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); 42 | } 43 | 44 | return lines.join("\n"); 45 | } 46 | -------------------------------------------------------------------------------- /src/errors/SuperAgentTimeoutError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export class SuperAgentTimeoutError extends Error { 6 | constructor() { 7 | super("Timeout"); 8 | Object.setPrototypeOf(this, SuperAgentTimeoutError.prototype); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/errors/index.ts: -------------------------------------------------------------------------------- 1 | export { SuperAgentError } from "./SuperAgentError"; 2 | export { SuperAgentTimeoutError } from "./SuperAgentTimeoutError"; 3 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * as SuperAgent from "./api"; 2 | export { SuperAgentClient } from "./Client"; 3 | export { SuperAgentEnvironment } from "./environments"; 4 | export { SuperAgentError, SuperAgentTimeoutError } from "./errors"; 5 | -------------------------------------------------------------------------------- /src/serialization/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./resources"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AgentUpdate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AgentUpdate: core.serialization.Schema = 10 | core.serialization.object({ 11 | isActive: core.serialization.boolean().optional(), 12 | name: core.serialization.string().optional(), 13 | initialMessage: core.serialization.string().optional(), 14 | prompt: core.serialization.string().optional(), 15 | llmModel: core.serialization.string().optional(), 16 | description: core.serialization.string().optional(), 17 | avatar: core.serialization.string().optional(), 18 | type: core.serialization.string().optional(), 19 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 20 | outputSchema: core.serialization.string().optional(), 21 | }); 22 | 23 | export declare namespace AgentUpdate { 24 | interface Raw { 25 | isActive?: boolean | null; 26 | name?: string | null; 27 | initialMessage?: string | null; 28 | prompt?: string | null; 29 | llmModel?: string | null; 30 | description?: string | null; 31 | avatar?: string | null; 32 | type?: string | null; 33 | metadata?: Record | null; 34 | outputSchema?: string | null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AppModelsRequestAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestAgent: core.serialization.Schema< 10 | serializers.AppModelsRequestAgent.Raw, 11 | SuperAgent.AppModelsRequestAgent 12 | > = core.serialization.object({ 13 | isActive: core.serialization.boolean().optional(), 14 | name: core.serialization.string(), 15 | initialMessage: core.serialization.string().optional(), 16 | prompt: core.serialization.string().optional(), 17 | llmModel: core.serialization.string().optional(), 18 | llmProvider: core.serialization.lazy(async () => (await import("../../../..")).LlmProvider).optional(), 19 | description: core.serialization.string().optional(), 20 | avatar: core.serialization.string().optional(), 21 | type: core.serialization.lazy(async () => (await import("../../../..")).AgentType).optional(), 22 | parameters: core.serialization 23 | .lazyObject(async () => (await import("../../../..")).OpenAiAssistantParameters) 24 | .optional(), 25 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 26 | outputSchema: core.serialization.string().optional(), 27 | }); 28 | 29 | export declare namespace AppModelsRequestAgent { 30 | interface Raw { 31 | isActive?: boolean | null; 32 | name: string; 33 | initialMessage?: string | null; 34 | prompt?: string | null; 35 | llmModel?: string | null; 36 | llmProvider?: serializers.LlmProvider.Raw | null; 37 | description?: string | null; 38 | avatar?: string | null; 39 | type?: serializers.AgentType.Raw | null; 40 | parameters?: serializers.OpenAiAssistantParameters.Raw | null; 41 | metadata?: Record | null; 42 | outputSchema?: string | null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AppModelsRequestAgentDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestAgentDatasource: core.serialization.Schema< 10 | serializers.AppModelsRequestAgentDatasource.Raw, 11 | SuperAgent.AppModelsRequestAgentDatasource 12 | > = core.serialization.object({ 13 | datasourceId: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace AppModelsRequestAgentDatasource { 17 | interface Raw { 18 | datasourceId: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AppModelsRequestAgentInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestAgentInvoke: core.serialization.Schema< 10 | serializers.AppModelsRequestAgentInvoke.Raw, 11 | SuperAgent.AppModelsRequestAgentInvoke 12 | > = core.serialization.object({ 13 | input: core.serialization.string(), 14 | sessionId: core.serialization.string().optional(), 15 | enableStreaming: core.serialization.boolean(), 16 | outputSchema: core.serialization.string().optional(), 17 | llmParams: core.serialization.property( 18 | "llm_params", 19 | core.serialization.lazyObject(async () => (await import("../../../..")).LlmParams).optional() 20 | ), 21 | }); 22 | 23 | export declare namespace AppModelsRequestAgentInvoke { 24 | interface Raw { 25 | input: string; 26 | sessionId?: string | null; 27 | enableStreaming: boolean; 28 | outputSchema?: string | null; 29 | llm_params?: serializers.LlmParams.Raw | null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AppModelsRequestAgentLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestAgentLlm: core.serialization.Schema< 10 | serializers.AppModelsRequestAgentLlm.Raw, 11 | SuperAgent.AppModelsRequestAgentLlm 12 | > = core.serialization.object({ 13 | llmId: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace AppModelsRequestAgentLlm { 17 | interface Raw { 18 | llmId: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/AppModelsRequestAgentTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestAgentTool: core.serialization.Schema< 10 | serializers.AppModelsRequestAgentTool.Raw, 11 | SuperAgent.AppModelsRequestAgentTool 12 | > = core.serialization.object({ 13 | toolId: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace AppModelsRequestAgentTool { 17 | interface Raw { 18 | toolId: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { AppModelsRequestAgent } from "./AppModelsRequestAgent"; 2 | export { AgentUpdate } from "./AgentUpdate"; 3 | export { AppModelsRequestAgentInvoke } from "./AppModelsRequestAgentInvoke"; 4 | export { AppModelsRequestAgentLlm } from "./AppModelsRequestAgentLlm"; 5 | export { AppModelsRequestAgentTool } from "./AppModelsRequestAgentTool"; 6 | export { AppModelsRequestAgentDatasource } from "./AppModelsRequestAgentDatasource"; 7 | -------------------------------------------------------------------------------- /src/serialization/resources/agent/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as agent from "./agent"; 2 | export * from "./agent/client/requests"; 3 | export * as tool from "./tool"; 4 | export * from "./tool/client/requests"; 5 | export * as workflow from "./workflow"; 6 | export * from "./workflow/client/requests"; 7 | -------------------------------------------------------------------------------- /src/serialization/resources/tool/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/tool/client/requests/AppModelsRequestTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const AppModelsRequestTool: core.serialization.Schema< 10 | serializers.AppModelsRequestTool.Raw, 11 | SuperAgent.AppModelsRequestTool 12 | > = core.serialization.object({ 13 | name: core.serialization.string(), 14 | description: core.serialization.string().optional(), 15 | type: core.serialization.string(), 16 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 17 | returnDirect: core.serialization.boolean().optional(), 18 | }); 19 | 20 | export declare namespace AppModelsRequestTool { 21 | interface Raw { 22 | name: string; 23 | description?: string | null; 24 | type: string; 25 | metadata?: Record | null; 26 | returnDirect?: boolean | null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/serialization/resources/tool/client/requests/ToolUpdate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const ToolUpdate: core.serialization.Schema = 10 | core.serialization.object({ 11 | name: core.serialization.string().optional(), 12 | description: core.serialization.string().optional(), 13 | type: core.serialization.string().optional(), 14 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 15 | returnDirect: core.serialization.boolean().optional(), 16 | }); 17 | 18 | export declare namespace ToolUpdate { 19 | interface Raw { 20 | name?: string | null; 21 | description?: string | null; 22 | type?: string | null; 23 | metadata?: Record | null; 24 | returnDirect?: boolean | null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/serialization/resources/tool/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { AppModelsRequestTool } from "./AppModelsRequestTool"; 2 | export { ToolUpdate } from "./ToolUpdate"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/tool/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/workflow/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/workflow/client/requests/WorkflowInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../.."; 6 | import * as SuperAgent from "../../../../../api"; 7 | import * as core from "../../../../../core"; 8 | 9 | export const WorkflowInvoke: core.serialization.Schema = 10 | core.serialization.object({ 11 | input: core.serialization.string(), 12 | enableStreaming: core.serialization.boolean(), 13 | sessionId: core.serialization.string().optional(), 14 | outputSchemas: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), 15 | outputSchema: core.serialization.string().optional(), 16 | }); 17 | 18 | export declare namespace WorkflowInvoke { 19 | interface Raw { 20 | input: string; 21 | enableStreaming: boolean; 22 | sessionId?: string | null; 23 | outputSchemas?: Record | null; 24 | outputSchema?: string | null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/serialization/resources/workflow/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { WorkflowInvoke } from "./WorkflowInvoke"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/workflow/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/serialization/types/AgentDatasosurceList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AgentDatasosurceList: core.serialization.ObjectSchema< 10 | serializers.AgentDatasosurceList.Raw, 11 | SuperAgent.AgentDatasosurceList 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization 15 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentDatasource)) 16 | .optional(), 17 | }); 18 | 19 | export declare namespace AgentDatasosurceList { 20 | interface Raw { 21 | success: boolean; 22 | data?: serializers.PrismaModelsAgentDatasource.Raw[] | null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/AgentList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AgentList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent)) 14 | .optional(), 15 | totalPages: core.serialization.property("total_pages", core.serialization.number()), 16 | }); 17 | 18 | export declare namespace AgentList { 19 | interface Raw { 20 | success: boolean; 21 | data?: serializers.PrismaModelsAgent.Raw[] | null; 22 | total_pages: number; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/AgentToolList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AgentToolList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentTool)) 14 | .optional(), 15 | }); 16 | 17 | export declare namespace AgentToolList { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsAgentTool.Raw[] | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AgentType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AgentType: core.serialization.Schema = 10 | core.serialization.enum_(["SUPERAGENT", "OPENAI_ASSISTANT", "LLM"]); 11 | 12 | export declare namespace AgentType { 13 | type Raw = "SUPERAGENT" | "OPENAI_ASSISTANT" | "LLM"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ApiKeyCreate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ApiKeyCreate: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization.lazyObject(async () => (await import("..")).ApiKeyCreateModel).optional(), 13 | }); 14 | 15 | export declare namespace ApiKeyCreate { 16 | interface Raw { 17 | success: boolean; 18 | data?: serializers.ApiKeyCreateModel.Raw | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ApiKeyCreateModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ApiKeyCreateModel: core.serialization.ObjectSchema< 10 | serializers.ApiKeyCreateModel.Raw, 11 | SuperAgent.ApiKeyCreateModel 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | name: core.serialization.string(), 15 | displayApiKey: core.serialization.string(), 16 | createdAt: core.serialization.date(), 17 | updatedAt: core.serialization.date(), 18 | apiUserId: core.serialization.string(), 19 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 20 | apiKey: core.serialization.string(), 21 | }); 22 | 23 | export declare namespace ApiKeyCreateModel { 24 | interface Raw { 25 | id: string; 26 | name: string; 27 | displayApiKey: string; 28 | createdAt: string; 29 | updatedAt: string; 30 | apiUserId: string; 31 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 32 | apiKey: string; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/serialization/types/ApiKeyList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ApiKeyList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiKey)) 14 | .optional(), 15 | }); 16 | 17 | export declare namespace ApiKeyList { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsApiKey.Raw[] | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestApiKey: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestApiKey.Raw, 11 | SuperAgent.AppModelsRequestApiKey 12 | > = core.serialization.object({ 13 | name: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace AppModelsRequestApiKey { 17 | interface Raw { 18 | name: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestApiUser: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestApiUser.Raw, 11 | SuperAgent.AppModelsRequestApiUser 12 | > = core.serialization.object({ 13 | email: core.serialization.string(), 14 | firstName: core.serialization.string().optional(), 15 | lastName: core.serialization.string().optional(), 16 | company: core.serialization.string().optional(), 17 | anonymousId: core.serialization.string().optional(), 18 | }); 19 | 20 | export declare namespace AppModelsRequestApiUser { 21 | interface Raw { 22 | email: string; 23 | firstName?: string | null; 24 | lastName?: string | null; 25 | company?: string | null; 26 | anonymousId?: string | null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestDatasource: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestDatasource.Raw, 11 | SuperAgent.AppModelsRequestDatasource 12 | > = core.serialization.object({ 13 | name: core.serialization.string(), 14 | description: core.serialization.string().optional(), 15 | type: core.serialization.string(), 16 | content: core.serialization.string().optional(), 17 | url: core.serialization.string().optional(), 18 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 19 | vectorDbId: core.serialization.string().optional(), 20 | embeddingsModelProvider: core.serialization 21 | .lazy(async () => (await import("..")).EmbeddingsModelProvider) 22 | .optional(), 23 | }); 24 | 25 | export declare namespace AppModelsRequestDatasource { 26 | interface Raw { 27 | name: string; 28 | description?: string | null; 29 | type: string; 30 | content?: string | null; 31 | url?: string | null; 32 | metadata?: Record | null; 33 | vectorDbId?: string | null; 34 | embeddingsModelProvider?: serializers.EmbeddingsModelProvider.Raw | null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestLlm: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestLlm.Raw, 11 | SuperAgent.AppModelsRequestLlm 12 | > = core.serialization.object({ 13 | provider: core.serialization.string(), 14 | apiKey: core.serialization.string(), 15 | options: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 16 | }); 17 | 18 | export declare namespace AppModelsRequestLlm { 19 | interface Raw { 20 | provider: string; 21 | apiKey: string; 22 | options?: Record | null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestVectorDb: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestVectorDb.Raw, 11 | SuperAgent.AppModelsRequestVectorDb 12 | > = core.serialization.object({ 13 | provider: core.serialization.lazy(async () => (await import("..")).VectorDbProvider), 14 | options: core.serialization.record(core.serialization.string(), core.serialization.unknown()), 15 | }); 16 | 17 | export declare namespace AppModelsRequestVectorDb { 18 | interface Raw { 19 | provider: serializers.VectorDbProvider.Raw; 20 | options: Record; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestWorkflow: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestWorkflow.Raw, 11 | SuperAgent.AppModelsRequestWorkflow 12 | > = core.serialization.object({ 13 | name: core.serialization.string(), 14 | description: core.serialization.string(), 15 | }); 16 | 17 | export declare namespace AppModelsRequestWorkflow { 18 | interface Raw { 19 | name: string; 20 | description: string; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsRequestWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsRequestWorkflowStep: core.serialization.ObjectSchema< 10 | serializers.AppModelsRequestWorkflowStep.Raw, 11 | SuperAgent.AppModelsRequestWorkflowStep 12 | > = core.serialization.object({ 13 | order: core.serialization.number(), 14 | agentId: core.serialization.string(), 15 | }); 16 | 17 | export declare namespace AppModelsRequestWorkflowStep { 18 | interface Raw { 19 | order: number; 20 | agentId: string; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseAgent: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseAgent.Raw, 11 | SuperAgent.AppModelsResponseAgent 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseAgent { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsAgent.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseAgentInvoke.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseAgentInvoke: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseAgentInvoke.Raw, 11 | SuperAgent.AppModelsResponseAgentInvoke 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.unknown().optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseAgentInvoke { 18 | interface Raw { 19 | success: boolean; 20 | data?: unknown | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseApiKey: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseApiKey.Raw, 11 | SuperAgent.AppModelsResponseApiKey 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiKey).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseApiKey { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsApiKey.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseApiUser: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseApiUser.Raw, 11 | SuperAgent.AppModelsResponseApiUser 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseApiUser { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsApiUser.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseDatasource: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseDatasource.Raw, 11 | SuperAgent.AppModelsResponseDatasource 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsDatasource).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseDatasource { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsDatasource.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseLlm: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseLlm.Raw, 11 | SuperAgent.AppModelsResponseLlm 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsLlm).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseLlm { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsLlm.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseTool: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseTool.Raw, 11 | SuperAgent.AppModelsResponseTool 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsTool).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseTool { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsTool.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseVectorDb: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseVectorDb.Raw, 11 | SuperAgent.AppModelsResponseVectorDb 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsVectorDb).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseVectorDb { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsVectorDb.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseWorkflow: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseWorkflow.Raw, 11 | SuperAgent.AppModelsResponseWorkflow 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflow).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseWorkflow { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsWorkflow.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/AppModelsResponseWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const AppModelsResponseWorkflowStep: core.serialization.ObjectSchema< 10 | serializers.AppModelsResponseWorkflowStep.Raw, 11 | SuperAgent.AppModelsResponseWorkflowStep 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflowStep).optional(), 15 | }); 16 | 17 | export declare namespace AppModelsResponseWorkflowStep { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsWorkflowStep.Raw | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/DatasourceList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const DatasourceList: core.serialization.ObjectSchema< 10 | serializers.DatasourceList.Raw, 11 | SuperAgent.DatasourceList 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization 15 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsDatasource)) 16 | .optional(), 17 | totalPages: core.serialization.property("total_pages", core.serialization.number()), 18 | }); 19 | 20 | export declare namespace DatasourceList { 21 | interface Raw { 22 | success: boolean; 23 | data?: serializers.PrismaModelsDatasource.Raw[] | null; 24 | total_pages: number; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/serialization/types/DatasourceStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const DatasourceStatus: core.serialization.Schema< 10 | serializers.DatasourceStatus.Raw, 11 | SuperAgent.DatasourceStatus 12 | > = core.serialization.enum_(["IN_PROGRESS", "DONE", "FAILED"]); 13 | 14 | export declare namespace DatasourceStatus { 15 | type Raw = "IN_PROGRESS" | "DONE" | "FAILED"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/DatasourceType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const DatasourceType: core.serialization.Schema = 10 | core.serialization.enum_([ 11 | "TXT", 12 | "PDF", 13 | "CSV", 14 | "PPTX", 15 | "XLSX", 16 | "DOCX", 17 | "GOOGLE_DOC", 18 | "YOUTUBE", 19 | "GITHUB_REPOSITORY", 20 | "MARKDOWN", 21 | "WEBPAGE", 22 | "AIRTABLE", 23 | "STRIPE", 24 | "NOTION", 25 | "SITEMAP", 26 | "URL", 27 | "FUNCTION", 28 | ]); 29 | 30 | export declare namespace DatasourceType { 31 | type Raw = 32 | | "TXT" 33 | | "PDF" 34 | | "CSV" 35 | | "PPTX" 36 | | "XLSX" 37 | | "DOCX" 38 | | "GOOGLE_DOC" 39 | | "YOUTUBE" 40 | | "GITHUB_REPOSITORY" 41 | | "MARKDOWN" 42 | | "WEBPAGE" 43 | | "AIRTABLE" 44 | | "STRIPE" 45 | | "NOTION" 46 | | "SITEMAP" 47 | | "URL" 48 | | "FUNCTION"; 49 | } 50 | -------------------------------------------------------------------------------- /src/serialization/types/EmbeddingsModelProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbeddingsModelProvider: core.serialization.Schema< 10 | serializers.EmbeddingsModelProvider.Raw, 11 | SuperAgent.EmbeddingsModelProvider 12 | > = core.serialization.enum_(["OPENAI", "AZURE_OPENAI"]); 13 | 14 | export declare namespace EmbeddingsModelProvider { 15 | type Raw = "OPENAI" | "AZURE_OPENAI"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/FunctionDefinition.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const FunctionDefinition: core.serialization.ObjectSchema< 10 | serializers.FunctionDefinition.Raw, 11 | SuperAgent.FunctionDefinition 12 | > = core.serialization.object({ 13 | name: core.serialization.string().optional(), 14 | description: core.serialization.string().optional(), 15 | parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 16 | }); 17 | 18 | export declare namespace FunctionDefinition { 19 | interface Raw { 20 | name?: string | null; 21 | description?: string | null; 22 | parameters?: Record | null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/HttpValidationError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const HttpValidationError: core.serialization.ObjectSchema< 10 | serializers.HttpValidationError.Raw, 11 | SuperAgent.HttpValidationError 12 | > = core.serialization.object({ 13 | detail: core.serialization 14 | .list(core.serialization.lazyObject(async () => (await import("..")).ValidationError)) 15 | .optional(), 16 | }); 17 | 18 | export declare namespace HttpValidationError { 19 | interface Raw { 20 | detail?: serializers.ValidationError.Raw[] | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/LlmList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const LlmList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsLlm)) 14 | .optional(), 15 | }); 16 | 17 | export declare namespace LlmList { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsLlm.Raw[] | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/LlmModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const LlmModel: core.serialization.Schema = 10 | core.serialization.enum_([ 11 | "GPT_3_5_TURBO", 12 | "GPT_3_5_TURBO_16K_0613", 13 | "GPT_3_5_TURBO_0613", 14 | "GPT_3_5_TURBO_1106", 15 | "GPT_3_5_TURBO_0125", 16 | "GPT_4", 17 | "GPT_4_0613", 18 | "GPT_4_32K", 19 | "GPT_4_32K_0613", 20 | "GPT_4_1106_PREVIEW", 21 | "GPT_4_0125_PREVIEW", 22 | "GPT_4_TURBO", 23 | "GPT_4_TURBO_PREVIEW", 24 | "GPT_4_TURBO_2024_04_09", 25 | "GPT_4_0", 26 | "MISTRAL_7B_INSTRUCT_V01", 27 | "MIXTRAL_8X7B_INSTRUCT_V01", 28 | ]); 29 | 30 | export declare namespace LlmModel { 31 | type Raw = 32 | | "GPT_3_5_TURBO" 33 | | "GPT_3_5_TURBO_16K_0613" 34 | | "GPT_3_5_TURBO_0613" 35 | | "GPT_3_5_TURBO_1106" 36 | | "GPT_3_5_TURBO_0125" 37 | | "GPT_4" 38 | | "GPT_4_0613" 39 | | "GPT_4_32K" 40 | | "GPT_4_32K_0613" 41 | | "GPT_4_1106_PREVIEW" 42 | | "GPT_4_0125_PREVIEW" 43 | | "GPT_4_TURBO" 44 | | "GPT_4_TURBO_PREVIEW" 45 | | "GPT_4_TURBO_2024_04_09" 46 | | "GPT_4_0" 47 | | "MISTRAL_7B_INSTRUCT_V01" 48 | | "MIXTRAL_8X7B_INSTRUCT_V01"; 49 | } 50 | -------------------------------------------------------------------------------- /src/serialization/types/LlmParams.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const LlmParams: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | maxTokens: core.serialization.property("max_tokens", core.serialization.number().optional()), 12 | temperature: core.serialization.number().optional(), 13 | }); 14 | 15 | export declare namespace LlmParams { 16 | interface Raw { 17 | max_tokens?: number | null; 18 | temperature?: number | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/LlmProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const LlmProvider: core.serialization.Schema = 10 | core.serialization.enum_([ 11 | "OPENAI", 12 | "AZURE_OPENAI", 13 | "HUGGINGFACE", 14 | "PERPLEXITY", 15 | "TOGETHER_AI", 16 | "ANTHROPIC", 17 | "BEDROCK", 18 | "GROQ", 19 | "MISTRAL", 20 | "COHERE_CHAT", 21 | ]); 22 | 23 | export declare namespace LlmProvider { 24 | type Raw = 25 | | "OPENAI" 26 | | "AZURE_OPENAI" 27 | | "HUGGINGFACE" 28 | | "PERPLEXITY" 29 | | "TOGETHER_AI" 30 | | "ANTHROPIC" 31 | | "BEDROCK" 32 | | "GROQ" 33 | | "MISTRAL" 34 | | "COHERE_CHAT"; 35 | } 36 | -------------------------------------------------------------------------------- /src/serialization/types/OpenAiAssistantParameters.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const OpenAiAssistantParameters: core.serialization.ObjectSchema< 10 | serializers.OpenAiAssistantParameters.Raw, 11 | SuperAgent.OpenAiAssistantParameters 12 | > = core.serialization.object({ 13 | metadata: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 14 | fileIds: core.serialization.list(core.serialization.string()).optional(), 15 | tools: core.serialization 16 | .list(core.serialization.lazy(async () => (await import("..")).OpenAiAssistantParametersToolsItem)) 17 | .optional(), 18 | }); 19 | 20 | export declare namespace OpenAiAssistantParameters { 21 | interface Raw { 22 | metadata?: Record | null; 23 | fileIds?: string[] | null; 24 | tools?: serializers.OpenAiAssistantParametersToolsItem.Raw[] | null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/serialization/types/OpenAiAssistantParametersToolsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const OpenAiAssistantParametersToolsItem: core.serialization.Schema< 10 | serializers.OpenAiAssistantParametersToolsItem.Raw, 11 | SuperAgent.OpenAiAssistantParametersToolsItem 12 | > = core.serialization 13 | .union("type", { 14 | code_interpreter: core.serialization.lazyObject(async () => (await import("..")).ToolAssistantToolsCode), 15 | retrieval: core.serialization.lazyObject(async () => (await import("..")).ToolAssistantToolsRetrieval), 16 | function: core.serialization.lazyObject(async () => (await import("..")).ToolAssistantToolsFunction), 17 | }) 18 | .transform({ 19 | transform: (value) => value, 20 | untransform: (value) => value, 21 | }); 22 | 23 | export declare namespace OpenAiAssistantParametersToolsItem { 24 | type Raw = 25 | | OpenAiAssistantParametersToolsItem.CodeInterpreter 26 | | OpenAiAssistantParametersToolsItem.Retrieval 27 | | OpenAiAssistantParametersToolsItem.Function; 28 | 29 | interface CodeInterpreter extends serializers.ToolAssistantToolsCode.Raw { 30 | type: "code_interpreter"; 31 | } 32 | 33 | interface Retrieval extends serializers.ToolAssistantToolsRetrieval.Raw { 34 | type: "retrieval"; 35 | } 36 | 37 | interface Function extends serializers.ToolAssistantToolsFunction.Raw { 38 | type: "function"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsAgent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsAgent: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsAgent.Raw, 11 | SuperAgent.PrismaModelsAgent 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | type: core.serialization.lazy(async () => (await import("..")).AgentType), 15 | name: core.serialization.string(), 16 | avatar: core.serialization.string().optional(), 17 | initialMessage: core.serialization.string().optional(), 18 | description: core.serialization.string(), 19 | isActive: core.serialization.boolean(), 20 | createdAt: core.serialization.date(), 21 | updatedAt: core.serialization.date(), 22 | llms: core.serialization 23 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentLlm)) 24 | .optional(), 25 | llmModel: core.serialization.lazy(async () => (await import("..")).LlmModel).optional(), 26 | prompt: core.serialization.string().optional(), 27 | apiUserId: core.serialization.string(), 28 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 29 | datasources: core.serialization 30 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentDatasource)) 31 | .optional(), 32 | tools: core.serialization 33 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentTool)) 34 | .optional(), 35 | workflowSteps: core.serialization 36 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflowStep)) 37 | .optional(), 38 | metadata: core.serialization.unknown().optional(), 39 | outputSchema: core.serialization.string().optional(), 40 | }); 41 | 42 | export declare namespace PrismaModelsAgent { 43 | interface Raw { 44 | id: string; 45 | type: serializers.AgentType.Raw; 46 | name: string; 47 | avatar?: string | null; 48 | initialMessage?: string | null; 49 | description: string; 50 | isActive: boolean; 51 | createdAt: string; 52 | updatedAt: string; 53 | llms?: serializers.PrismaModelsAgentLlm.Raw[] | null; 54 | llmModel?: serializers.LlmModel.Raw | null; 55 | prompt?: string | null; 56 | apiUserId: string; 57 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 58 | datasources?: serializers.PrismaModelsAgentDatasource.Raw[] | null; 59 | tools?: serializers.PrismaModelsAgentTool.Raw[] | null; 60 | workflowSteps?: serializers.PrismaModelsWorkflowStep.Raw[] | null; 61 | metadata?: unknown | null; 62 | outputSchema?: string | null; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsAgentDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsAgentDatasource: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsAgentDatasource.Raw, 11 | SuperAgent.PrismaModelsAgentDatasource 12 | > = core.serialization.object({ 13 | agentId: core.serialization.string(), 14 | datasourceId: core.serialization.string(), 15 | agent: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent).optional(), 16 | datasource: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsDatasource).optional(), 17 | createdAt: core.serialization.date(), 18 | updatedAt: core.serialization.date(), 19 | }); 20 | 21 | export declare namespace PrismaModelsAgentDatasource { 22 | interface Raw { 23 | agentId: string; 24 | datasourceId: string; 25 | agent?: serializers.PrismaModelsAgent.Raw | null; 26 | datasource?: serializers.PrismaModelsDatasource.Raw | null; 27 | createdAt: string; 28 | updatedAt: string; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsAgentLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsAgentLlm: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsAgentLlm.Raw, 11 | SuperAgent.PrismaModelsAgentLlm 12 | > = core.serialization.object({ 13 | agentId: core.serialization.string(), 14 | llmId: core.serialization.string(), 15 | agent: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent).optional(), 16 | llm: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsLlm).optional(), 17 | createdAt: core.serialization.date(), 18 | updatedAt: core.serialization.date(), 19 | }); 20 | 21 | export declare namespace PrismaModelsAgentLlm { 22 | interface Raw { 23 | agentId: string; 24 | llmId: string; 25 | agent?: serializers.PrismaModelsAgent.Raw | null; 26 | llm?: serializers.PrismaModelsLlm.Raw | null; 27 | createdAt: string; 28 | updatedAt: string; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsAgentTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsAgentTool: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsAgentTool.Raw, 11 | SuperAgent.PrismaModelsAgentTool 12 | > = core.serialization.object({ 13 | agentId: core.serialization.string(), 14 | toolId: core.serialization.string(), 15 | agent: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent).optional(), 16 | tool: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsTool).optional(), 17 | createdAt: core.serialization.date(), 18 | updatedAt: core.serialization.date(), 19 | }); 20 | 21 | export declare namespace PrismaModelsAgentTool { 22 | interface Raw { 23 | agentId: string; 24 | toolId: string; 25 | agent?: serializers.PrismaModelsAgent.Raw | null; 26 | tool?: serializers.PrismaModelsTool.Raw | null; 27 | createdAt: string; 28 | updatedAt: string; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsApiKey.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsApiKey: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsApiKey.Raw, 11 | SuperAgent.PrismaModelsApiKey 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | name: core.serialization.string(), 15 | displayApiKey: core.serialization.string(), 16 | createdAt: core.serialization.date(), 17 | updatedAt: core.serialization.date(), 18 | apiUserId: core.serialization.string(), 19 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 20 | }); 21 | 22 | export declare namespace PrismaModelsApiKey { 23 | interface Raw { 24 | id: string; 25 | name: string; 26 | displayApiKey: string; 27 | createdAt: string; 28 | updatedAt: string; 29 | apiUserId: string; 30 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsApiUser.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsApiUser: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsApiUser.Raw, 11 | SuperAgent.PrismaModelsApiUser 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | token: core.serialization.string().optional(), 15 | email: core.serialization.string().optional(), 16 | createdAt: core.serialization.date(), 17 | updatedAt: core.serialization.date(), 18 | agents: core.serialization 19 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent)) 20 | .optional(), 21 | llms: core.serialization 22 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsLlm)) 23 | .optional(), 24 | datasources: core.serialization 25 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsDatasource)) 26 | .optional(), 27 | tools: core.serialization 28 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsTool)) 29 | .optional(), 30 | workflows: core.serialization 31 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflow)) 32 | .optional(), 33 | vectorDb: core.serialization 34 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsVectorDb)) 35 | .optional(), 36 | workflowConfigs: core.serialization 37 | .list(core.serialization.lazyObject(async () => (await import("..")).WorkflowConfig)) 38 | .optional(), 39 | apiKeys: core.serialization 40 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiKey)) 41 | .optional(), 42 | }); 43 | 44 | export declare namespace PrismaModelsApiUser { 45 | interface Raw { 46 | id: string; 47 | token?: string | null; 48 | email?: string | null; 49 | createdAt: string; 50 | updatedAt: string; 51 | agents?: serializers.PrismaModelsAgent.Raw[] | null; 52 | llms?: serializers.PrismaModelsLlm.Raw[] | null; 53 | datasources?: serializers.PrismaModelsDatasource.Raw[] | null; 54 | tools?: serializers.PrismaModelsTool.Raw[] | null; 55 | workflows?: serializers.PrismaModelsWorkflow.Raw[] | null; 56 | vectorDb?: serializers.PrismaModelsVectorDb.Raw[] | null; 57 | workflowConfigs?: serializers.WorkflowConfig.Raw[] | null; 58 | apiKeys?: serializers.PrismaModelsApiKey.Raw[] | null; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsDatasource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsDatasource: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsDatasource.Raw, 11 | SuperAgent.PrismaModelsDatasource 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | name: core.serialization.string(), 15 | content: core.serialization.string().optional(), 16 | description: core.serialization.string().optional(), 17 | url: core.serialization.string().optional(), 18 | type: core.serialization.lazy(async () => (await import("..")).DatasourceType), 19 | apiUserId: core.serialization.string(), 20 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 21 | createdAt: core.serialization.date(), 22 | updatedAt: core.serialization.date(), 23 | metadata: core.serialization.string().optional(), 24 | status: core.serialization.lazy(async () => (await import("..")).DatasourceStatus), 25 | datasources: core.serialization 26 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentDatasource)) 27 | .optional(), 28 | vectorDb: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsVectorDb).optional(), 29 | vectorDbId: core.serialization.string().optional(), 30 | }); 31 | 32 | export declare namespace PrismaModelsDatasource { 33 | interface Raw { 34 | id: string; 35 | name: string; 36 | content?: string | null; 37 | description?: string | null; 38 | url?: string | null; 39 | type: serializers.DatasourceType.Raw; 40 | apiUserId: string; 41 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 42 | createdAt: string; 43 | updatedAt: string; 44 | metadata?: string | null; 45 | status: serializers.DatasourceStatus.Raw; 46 | datasources?: serializers.PrismaModelsAgentDatasource.Raw[] | null; 47 | vectorDb?: serializers.PrismaModelsVectorDb.Raw | null; 48 | vectorDbId?: string | null; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsLlm.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsLlm: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsLlm.Raw, 11 | SuperAgent.PrismaModelsLlm 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | provider: core.serialization.lazy(async () => (await import("..")).LlmProvider), 15 | apiKey: core.serialization.string(), 16 | options: core.serialization.unknown().optional(), 17 | agents: core.serialization 18 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentLlm)) 19 | .optional(), 20 | createdAt: core.serialization.date(), 21 | updatedAt: core.serialization.date(), 22 | apiUserId: core.serialization.string(), 23 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 24 | }); 25 | 26 | export declare namespace PrismaModelsLlm { 27 | interface Raw { 28 | id: string; 29 | provider: serializers.LlmProvider.Raw; 30 | apiKey: string; 31 | options?: unknown | null; 32 | agents?: serializers.PrismaModelsAgentLlm.Raw[] | null; 33 | createdAt: string; 34 | updatedAt: string; 35 | apiUserId: string; 36 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsTool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsTool: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsTool.Raw, 11 | SuperAgent.PrismaModelsTool 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | name: core.serialization.string(), 15 | description: core.serialization.string(), 16 | type: core.serialization.lazy(async () => (await import("..")).ToolType), 17 | returnDirect: core.serialization.boolean(), 18 | metadata: core.serialization.string().optional(), 19 | createdAt: core.serialization.date(), 20 | updatedAt: core.serialization.date(), 21 | apiUserId: core.serialization.string(), 22 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 23 | tools: core.serialization 24 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgentTool)) 25 | .optional(), 26 | toolConfig: core.serialization.unknown().optional(), 27 | }); 28 | 29 | export declare namespace PrismaModelsTool { 30 | interface Raw { 31 | id: string; 32 | name: string; 33 | description: string; 34 | type: serializers.ToolType.Raw; 35 | returnDirect: boolean; 36 | metadata?: string | null; 37 | createdAt: string; 38 | updatedAt: string; 39 | apiUserId: string; 40 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 41 | tools?: serializers.PrismaModelsAgentTool.Raw[] | null; 42 | toolConfig?: unknown | null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsVectorDb.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsVectorDb: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsVectorDb.Raw, 11 | SuperAgent.PrismaModelsVectorDb 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | provider: core.serialization.lazy(async () => (await import("..")).VectorDbProvider), 15 | options: core.serialization.unknown().optional(), 16 | datasources: core.serialization 17 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsDatasource)) 18 | .optional(), 19 | createdAt: core.serialization.date(), 20 | updatedAt: core.serialization.date(), 21 | apiUserId: core.serialization.string(), 22 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 23 | }); 24 | 25 | export declare namespace PrismaModelsVectorDb { 26 | interface Raw { 27 | id: string; 28 | provider: serializers.VectorDbProvider.Raw; 29 | options?: unknown | null; 30 | datasources?: serializers.PrismaModelsDatasource.Raw[] | null; 31 | createdAt: string; 32 | updatedAt: string; 33 | apiUserId: string; 34 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsWorkflow.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsWorkflow: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsWorkflow.Raw, 11 | SuperAgent.PrismaModelsWorkflow 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | name: core.serialization.string(), 15 | description: core.serialization.string().optional(), 16 | createdAt: core.serialization.date(), 17 | updatedAt: core.serialization.date(), 18 | steps: core.serialization 19 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflowStep)) 20 | .optional(), 21 | apiUserId: core.serialization.string(), 22 | apiUser: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional(), 23 | workflowConfigs: core.serialization 24 | .list(core.serialization.lazyObject(async () => (await import("..")).WorkflowConfig)) 25 | .optional(), 26 | }); 27 | 28 | export declare namespace PrismaModelsWorkflow { 29 | interface Raw { 30 | id: string; 31 | name: string; 32 | description?: string | null; 33 | createdAt: string; 34 | updatedAt: string; 35 | steps?: serializers.PrismaModelsWorkflowStep.Raw[] | null; 36 | apiUserId: string; 37 | apiUser?: serializers.PrismaModelsApiUser.Raw | null; 38 | workflowConfigs?: serializers.WorkflowConfig.Raw[] | null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/serialization/types/PrismaModelsWorkflowStep.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const PrismaModelsWorkflowStep: core.serialization.ObjectSchema< 10 | serializers.PrismaModelsWorkflowStep.Raw, 11 | SuperAgent.PrismaModelsWorkflowStep 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | order: core.serialization.number(), 15 | workflowId: core.serialization.string(), 16 | workflow: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflow).optional(), 17 | createdAt: core.serialization.date(), 18 | updatedAt: core.serialization.date(), 19 | input: core.serialization.string().optional(), 20 | output: core.serialization.string().optional(), 21 | agentId: core.serialization.string(), 22 | agent: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsAgent).optional(), 23 | }); 24 | 25 | export declare namespace PrismaModelsWorkflowStep { 26 | interface Raw { 27 | id: string; 28 | order: number; 29 | workflowId: string; 30 | workflow?: serializers.PrismaModelsWorkflow.Raw | null; 31 | createdAt: string; 32 | updatedAt: string; 33 | input?: string | null; 34 | output?: string | null; 35 | agentId: string; 36 | agent?: serializers.PrismaModelsAgent.Raw | null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/serialization/types/ToolAssistantToolsCode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolAssistantToolsCode: core.serialization.ObjectSchema< 10 | serializers.ToolAssistantToolsCode.Raw, 11 | SuperAgent.ToolAssistantToolsCode 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace ToolAssistantToolsCode { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ToolAssistantToolsFunction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolAssistantToolsFunction: core.serialization.ObjectSchema< 10 | serializers.ToolAssistantToolsFunction.Raw, 11 | SuperAgent.ToolAssistantToolsFunction 12 | > = core.serialization.object({ 13 | function: core.serialization.lazyObject(async () => (await import("..")).FunctionDefinition).optional(), 14 | }); 15 | 16 | export declare namespace ToolAssistantToolsFunction { 17 | interface Raw { 18 | function?: serializers.FunctionDefinition.Raw | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ToolAssistantToolsRetrieval.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolAssistantToolsRetrieval: core.serialization.ObjectSchema< 10 | serializers.ToolAssistantToolsRetrieval.Raw, 11 | SuperAgent.ToolAssistantToolsRetrieval 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace ToolAssistantToolsRetrieval { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ToolList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsTool)) 14 | .optional(), 15 | totalPages: core.serialization.property("total_pages", core.serialization.number()), 16 | }); 17 | 18 | export declare namespace ToolList { 19 | interface Raw { 20 | success: boolean; 21 | data?: serializers.PrismaModelsTool.Raw[] | null; 22 | total_pages: number; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/ToolType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolType: core.serialization.Schema = 10 | core.serialization.enum_([ 11 | "ALGOLIA", 12 | "BROWSER", 13 | "BING_SEARCH", 14 | "REPLICATE", 15 | "WOLFRAM_ALPHA", 16 | "ZAPIER_NLA", 17 | "AGENT", 18 | "OPENAPI", 19 | "CHATGPT_PLUGIN", 20 | "METAPHOR", 21 | "PUBMED", 22 | "CODE_EXECUTOR", 23 | "OPENBB", 24 | "GPT_VISION", 25 | "TTS_1", 26 | "HAND_OFF", 27 | "FUNCTION", 28 | "HTTP", 29 | "SUPERRAG", 30 | "RESEARCH", 31 | "GITHUB", 32 | "SCRAPER", 33 | "ADVANCED_SCRAPER", 34 | "GOOGLE_SEARCH", 35 | "SEC", 36 | ]); 37 | 38 | export declare namespace ToolType { 39 | type Raw = 40 | | "ALGOLIA" 41 | | "BROWSER" 42 | | "BING_SEARCH" 43 | | "REPLICATE" 44 | | "WOLFRAM_ALPHA" 45 | | "ZAPIER_NLA" 46 | | "AGENT" 47 | | "OPENAPI" 48 | | "CHATGPT_PLUGIN" 49 | | "METAPHOR" 50 | | "PUBMED" 51 | | "CODE_EXECUTOR" 52 | | "OPENBB" 53 | | "GPT_VISION" 54 | | "TTS_1" 55 | | "HAND_OFF" 56 | | "FUNCTION" 57 | | "HTTP" 58 | | "SUPERRAG" 59 | | "RESEARCH" 60 | | "GITHUB" 61 | | "SCRAPER" 62 | | "ADVANCED_SCRAPER" 63 | | "GOOGLE_SEARCH" 64 | | "SEC"; 65 | } 66 | -------------------------------------------------------------------------------- /src/serialization/types/ValidationError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ValidationError: core.serialization.ObjectSchema< 10 | serializers.ValidationError.Raw, 11 | SuperAgent.ValidationError 12 | > = core.serialization.object({ 13 | loc: core.serialization.list(core.serialization.lazy(async () => (await import("..")).ValidationErrorLocItem)), 14 | msg: core.serialization.string(), 15 | type: core.serialization.string(), 16 | }); 17 | 18 | export declare namespace ValidationError { 19 | interface Raw { 20 | loc: serializers.ValidationErrorLocItem.Raw[]; 21 | msg: string; 22 | type: string; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/ValidationErrorLocItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const ValidationErrorLocItem: core.serialization.Schema< 10 | serializers.ValidationErrorLocItem.Raw, 11 | SuperAgent.ValidationErrorLocItem 12 | > = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.number()]); 13 | 14 | export declare namespace ValidationErrorLocItem { 15 | type Raw = string | number; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/VectorDbList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const VectorDbList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsVectorDb)) 14 | .optional(), 15 | }); 16 | 17 | export declare namespace VectorDbList { 18 | interface Raw { 19 | success: boolean; 20 | data?: serializers.PrismaModelsVectorDb.Raw[] | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/VectorDbProvider.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const VectorDbProvider: core.serialization.Schema< 10 | serializers.VectorDbProvider.Raw, 11 | SuperAgent.VectorDbProvider 12 | > = core.serialization.enum_(["PINECONE", "ASTRA_DB", "WEAVIATE", "QDRANT", "SUPABASE"]); 13 | 14 | export declare namespace VectorDbProvider { 15 | type Raw = "PINECONE" | "ASTRA_DB" | "WEAVIATE" | "QDRANT" | "SUPABASE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/WorkflowConfig.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const WorkflowConfig: core.serialization.ObjectSchema< 10 | serializers.WorkflowConfig.Raw, 11 | SuperAgent.WorkflowConfig 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | config: core.serialization.unknown().optional(), 15 | createdAt: core.serialization.date(), 16 | updatedAt: core.serialization.date(), 17 | workflowId: core.serialization.string(), 18 | workflow: core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflow).optional(), 19 | apiUser: core.serialization.property( 20 | "ApiUser", 21 | core.serialization.lazyObject(async () => (await import("..")).PrismaModelsApiUser).optional() 22 | ), 23 | apiUserId: core.serialization.string().optional(), 24 | }); 25 | 26 | export declare namespace WorkflowConfig { 27 | interface Raw { 28 | id: string; 29 | config?: unknown | null; 30 | createdAt: string; 31 | updatedAt: string; 32 | workflowId: string; 33 | workflow?: serializers.PrismaModelsWorkflow.Raw | null; 34 | ApiUser?: serializers.PrismaModelsApiUser.Raw | null; 35 | apiUserId?: string | null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/serialization/types/WorkflowList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const WorkflowList: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | success: core.serialization.boolean(), 12 | data: core.serialization 13 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflow)) 14 | .optional(), 15 | totalPages: core.serialization.property("total_pages", core.serialization.number()), 16 | }); 17 | 18 | export declare namespace WorkflowList { 19 | interface Raw { 20 | success: boolean; 21 | data?: serializers.PrismaModelsWorkflow.Raw[] | null; 22 | total_pages: number; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/WorkflowStepList.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from ".."; 6 | import * as SuperAgent from "../../api"; 7 | import * as core from "../../core"; 8 | 9 | export const WorkflowStepList: core.serialization.ObjectSchema< 10 | serializers.WorkflowStepList.Raw, 11 | SuperAgent.WorkflowStepList 12 | > = core.serialization.object({ 13 | success: core.serialization.boolean(), 14 | data: core.serialization 15 | .list(core.serialization.lazyObject(async () => (await import("..")).PrismaModelsWorkflowStep)) 16 | .optional(), 17 | }); 18 | 19 | export declare namespace WorkflowStepList { 20 | interface Raw { 21 | success: boolean; 22 | data?: serializers.PrismaModelsWorkflowStep.Raw[] | null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/serialization/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./AgentDatasosurceList"; 2 | export * from "./AgentList"; 3 | export * from "./AgentToolList"; 4 | export * from "./AgentType"; 5 | export * from "./ApiKeyCreate"; 6 | export * from "./ApiKeyList"; 7 | export * from "./DatasourceList"; 8 | export * from "./DatasourceStatus"; 9 | export * from "./DatasourceType"; 10 | export * from "./EmbeddingsModelProvider"; 11 | export * from "./FunctionDefinition"; 12 | export * from "./HttpValidationError"; 13 | export * from "./LlmList"; 14 | export * from "./LlmModel"; 15 | export * from "./LlmParams"; 16 | export * from "./LlmProvider"; 17 | export * from "./OpenAiAssistantParametersToolsItem"; 18 | export * from "./OpenAiAssistantParameters"; 19 | export * from "./ToolAssistantToolsCode"; 20 | export * from "./ToolAssistantToolsFunction"; 21 | export * from "./ToolAssistantToolsRetrieval"; 22 | export * from "./ToolList"; 23 | export * from "./ToolType"; 24 | export * from "./ValidationErrorLocItem"; 25 | export * from "./ValidationError"; 26 | export * from "./VectorDbList"; 27 | export * from "./VectorDbProvider"; 28 | export * from "./WorkflowConfig"; 29 | export * from "./WorkflowList"; 30 | export * from "./WorkflowStepList"; 31 | export * from "./ApiKeyCreateModel"; 32 | export * from "./AppModelsRequestApiKey"; 33 | export * from "./AppModelsRequestApiUser"; 34 | export * from "./AppModelsRequestDatasource"; 35 | export * from "./AppModelsRequestLlm"; 36 | export * from "./AppModelsRequestVectorDb"; 37 | export * from "./AppModelsRequestWorkflow"; 38 | export * from "./AppModelsRequestWorkflowStep"; 39 | export * from "./AppModelsResponseAgent"; 40 | export * from "./AppModelsResponseAgentInvoke"; 41 | export * from "./AppModelsResponseApiKey"; 42 | export * from "./AppModelsResponseApiUser"; 43 | export * from "./AppModelsResponseDatasource"; 44 | export * from "./AppModelsResponseLlm"; 45 | export * from "./AppModelsResponseTool"; 46 | export * from "./AppModelsResponseVectorDb"; 47 | export * from "./AppModelsResponseWorkflow"; 48 | export * from "./AppModelsResponseWorkflowStep"; 49 | export * from "./PrismaModelsAgent"; 50 | export * from "./PrismaModelsAgentDatasource"; 51 | export * from "./PrismaModelsAgentLlm"; 52 | export * from "./PrismaModelsAgentTool"; 53 | export * from "./PrismaModelsApiKey"; 54 | export * from "./PrismaModelsApiUser"; 55 | export * from "./PrismaModelsDatasource"; 56 | export * from "./PrismaModelsLlm"; 57 | export * from "./PrismaModelsTool"; 58 | export * from "./PrismaModelsVectorDb"; 59 | export * from "./PrismaModelsWorkflow"; 60 | export * from "./PrismaModelsWorkflowStep"; 61 | -------------------------------------------------------------------------------- /tests/client.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a test file for the SDK. 3 | * 4 | * Add any tests here and make sure to mark this file 5 | * in `.fernignore`. 6 | */ 7 | describe("test", () => { 8 | it("default", () => { 9 | expect(true).toBe(true); 10 | }); 11 | }); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "extendedDiagnostics": true, 4 | "strict": true, 5 | "target": "ES6", 6 | "module": "CommonJS", 7 | "moduleResolution": "node", 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "declaration": true, 11 | "outDir": "dist", 12 | "rootDir": "src", 13 | "baseUrl": "src" 14 | }, 15 | "include": [ 16 | "src" 17 | ], 18 | "exclude": [] 19 | } --------------------------------------------------------------------------------