kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: improvements to openai-to-ts
rodzic
6e03cf975e
commit
0d8f59eef8
|
@ -58,6 +58,7 @@
|
||||||
"tools/apollo",
|
"tools/apollo",
|
||||||
"tools/arxiv",
|
"tools/arxiv",
|
||||||
"tools/bing",
|
"tools/bing",
|
||||||
|
"tools/brave-search",
|
||||||
"tools/calculator",
|
"tools/calculator",
|
||||||
"tools/clearbit",
|
"tools/clearbit",
|
||||||
"tools/dexa",
|
"tools/dexa",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type * as types from './types.ts'
|
import type * as types from './types.ts'
|
||||||
|
import type { AIFunction } from './types.ts'
|
||||||
import { AIFunctionsProvider } from './fns'
|
import { AIFunctionsProvider } from './fns'
|
||||||
import { isAIFunction } from './utils'
|
import { isAIFunction } from './utils'
|
||||||
|
|
||||||
|
@ -132,6 +133,25 @@ export class AIFunctionSet implements Iterable<types.AIFunction> {
|
||||||
return [...this.entries].map(fn)
|
return [...this.entries].map(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new AIFunctionSet containing only the AIFunctions in this set
|
||||||
|
* matching the given tags.
|
||||||
|
*/
|
||||||
|
getFilteredByTags(...tags: string[]): AIFunctionSet {
|
||||||
|
const tagsSet = new Set(tags)
|
||||||
|
return this.getFilteredBy((fn) => fn.tags?.some((t) => tagsSet.has(t)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new AIFunctionSet containing only the AIFunctions in this set
|
||||||
|
* matching a custom filter function.
|
||||||
|
*/
|
||||||
|
getFilteredBy(
|
||||||
|
filterFn: (fn: AIFunction) => boolean | undefined
|
||||||
|
): AIFunctionSet {
|
||||||
|
return new AIFunctionSet(Array.from(this).filter((fn) => filterFn(fn)))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the functions in this set as an array compatible with OpenAI's
|
* Returns the functions in this set as an array compatible with OpenAI's
|
||||||
* chat completions `functions`.
|
* chat completions `functions`.
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { asAgenticSchema } from './schema'
|
||||||
import { assert } from './utils'
|
import { assert } from './utils'
|
||||||
|
|
||||||
export type CreateAIFunctionArgs<
|
export type CreateAIFunctionArgs<
|
||||||
InputSchema extends types.AIFunctionInputSchema
|
InputSchema extends types.AIFunctionInputSchema = types.AIFunctionInputSchema
|
||||||
> = {
|
> = {
|
||||||
/** Name of the function. */
|
/** Name of the function. */
|
||||||
name: string
|
name: string
|
||||||
|
|
||||||
/** Description of the function. */
|
/** Description of the function. */
|
||||||
description?: string
|
description: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zod schema or AgenticSchema for the function parameters.
|
* Zod schema or AgenticSchema for the function parameters.
|
||||||
|
@ -26,6 +26,11 @@ export type CreateAIFunctionArgs<
|
||||||
* Defaults to `true`.
|
* Defaults to `true`.
|
||||||
*/
|
*/
|
||||||
strict?: boolean
|
strict?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional tags to help organize functions.
|
||||||
|
*/
|
||||||
|
tags?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AIFunctionImplementation<
|
export type AIFunctionImplementation<
|
||||||
|
@ -65,9 +70,10 @@ export function createAIFunction<
|
||||||
>(
|
>(
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
description = '',
|
description,
|
||||||
inputSchema,
|
inputSchema,
|
||||||
strict = true,
|
strict = true,
|
||||||
|
tags,
|
||||||
execute
|
execute
|
||||||
}: CreateAIFunctionArgs<InputSchema> & {
|
}: CreateAIFunctionArgs<InputSchema> & {
|
||||||
/** Underlying function implementation. */
|
/** Underlying function implementation. */
|
||||||
|
@ -132,6 +138,7 @@ export function createAIFunction<
|
||||||
aiFunction.inputSchema = inputSchema
|
aiFunction.inputSchema = inputSchema
|
||||||
aiFunction.parseInput = parseInput
|
aiFunction.parseInput = parseInput
|
||||||
aiFunction.execute = execute
|
aiFunction.execute = execute
|
||||||
|
aiFunction.tags = tags
|
||||||
aiFunction.spec = {
|
aiFunction.spec = {
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import type * as types from './types'
|
import type * as types from './types'
|
||||||
|
import type { AIFunction } from './types'
|
||||||
import { AIFunctionSet } from './ai-function-set'
|
import { AIFunctionSet } from './ai-function-set'
|
||||||
import { createAIFunction } from './create-ai-function'
|
import {
|
||||||
|
createAIFunction,
|
||||||
|
type CreateAIFunctionArgs
|
||||||
|
} from './create-ai-function'
|
||||||
import { assert } from './utils'
|
import { assert } from './utils'
|
||||||
|
|
||||||
export interface PrivateAIFunctionMetadata {
|
export type PrivateAIFunctionMetadata = CreateAIFunctionArgs & {
|
||||||
name: string
|
|
||||||
description: string
|
|
||||||
inputSchema: types.AIFunctionInputSchema
|
|
||||||
methodName: string
|
methodName: string
|
||||||
strict?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polyfill for `Symbol.metadata`
|
// Polyfill for `Symbol.metadata`
|
||||||
|
@ -64,6 +64,23 @@ export abstract class AIFunctionsProvider {
|
||||||
|
|
||||||
return this._functions
|
return this._functions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the AIFunctions provided by this class filtered by the given tags.
|
||||||
|
*/
|
||||||
|
getFunctionsFilteredByTags(...tags: string[]): AIFunctionSet {
|
||||||
|
return this.functions.getFilteredByTags(...tags)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the AIFunctions provided by this class which match a custom filter
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
getFunctionsFilteredBy(
|
||||||
|
filterFn: (fn: AIFunction) => boolean | undefined
|
||||||
|
): AIFunctionSet {
|
||||||
|
return this.functions.getFilteredBy(filterFn)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function aiFunction<
|
export function aiFunction<
|
||||||
|
@ -71,17 +88,7 @@ export function aiFunction<
|
||||||
InputSchema extends types.AIFunctionInputSchema,
|
InputSchema extends types.AIFunctionInputSchema,
|
||||||
OptionalArgs extends Array<undefined>,
|
OptionalArgs extends Array<undefined>,
|
||||||
Return extends types.MaybePromise<any>
|
Return extends types.MaybePromise<any>
|
||||||
>({
|
>(args: CreateAIFunctionArgs<InputSchema>) {
|
||||||
name,
|
|
||||||
description,
|
|
||||||
inputSchema,
|
|
||||||
strict
|
|
||||||
}: {
|
|
||||||
name?: string
|
|
||||||
description: string
|
|
||||||
inputSchema: InputSchema
|
|
||||||
strict?: boolean
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
_targetMethod: (
|
_targetMethod: (
|
||||||
this: This,
|
this: This,
|
||||||
|
@ -102,12 +109,10 @@ export function aiFunction<
|
||||||
context.metadata.invocables = []
|
context.metadata.invocables = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(args.name, 'aiFunction requires a non-empty "name" argument')
|
||||||
;(context.metadata.invocables as PrivateAIFunctionMetadata[]).push({
|
;(context.metadata.invocables as PrivateAIFunctionMetadata[]).push({
|
||||||
name: name ?? methodName,
|
...args,
|
||||||
description,
|
methodName
|
||||||
inputSchema,
|
|
||||||
methodName,
|
|
||||||
strict
|
|
||||||
})
|
})
|
||||||
|
|
||||||
context.addInitializer(function () {
|
context.addInitializer(function () {
|
||||||
|
|
|
@ -114,6 +114,9 @@ export interface AIFunction<
|
||||||
*/
|
*/
|
||||||
// TODO: this `any` shouldn't be necessary, but it is for `createAIFunction` results to be assignable to `AIFunctionLike`
|
// TODO: this `any` shouldn't be necessary, but it is for `createAIFunction` results to be assignable to `AIFunctionLike`
|
||||||
execute: (params: inferInput<InputSchema> | any) => MaybePromise<Output>
|
execute: (params: inferInput<InputSchema> | any) => MaybePromise<Output>
|
||||||
|
|
||||||
|
/** Optional tags to help organize functions. */
|
||||||
|
tags?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SafeParseResult<TData> =
|
export type SafeParseResult<TData> =
|
||||||
|
|
|
@ -40,7 +40,7 @@ export namespace github {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic GitHub API wrapper.
|
* Agentic GitHub client.
|
||||||
*/
|
*/
|
||||||
export class GitHubClient extends AIFunctionsProvider {
|
export class GitHubClient extends AIFunctionsProvider {
|
||||||
protected readonly apiKey: string
|
protected readonly apiKey: string
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class McpTools extends AIFunctionsProvider {
|
||||||
return createAIFunction(
|
return createAIFunction(
|
||||||
{
|
{
|
||||||
name: `${this.name}_${tool.name}`,
|
name: `${this.name}_${tool.name}`,
|
||||||
description: tool.description,
|
description: tool.description ?? `${this.name} ${tool.name}`,
|
||||||
inputSchema: createJsonSchema(tool.inputSchema),
|
inputSchema: createJsonSchema(tool.inputSchema),
|
||||||
strict: true
|
strict: true
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,7 +37,7 @@ async function main() {
|
||||||
description: 'Disables eslint formatting',
|
description: 'Disables eslint formatting',
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
noZodSchemaJsDocs: {
|
noZodJsDocs: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
description: 'Disables js docs for zod schemas',
|
description: 'Disables js docs for zod schemas',
|
||||||
default: false
|
default: false
|
||||||
|
@ -57,13 +57,24 @@ async function main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Object.keys(args.unknownFlags).length) {
|
||||||
|
console.error(
|
||||||
|
'Unknown flags:',
|
||||||
|
Object.keys(args.unknownFlags).join(', '),
|
||||||
|
'\n'
|
||||||
|
)
|
||||||
|
args.showHelp()
|
||||||
|
gracefulExit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const output = await generateTSFromOpenAPI({
|
const output = await generateTSFromOpenAPI({
|
||||||
openapiFilePath,
|
openapiFilePath,
|
||||||
outputDir: args.flags.outputDir || process.cwd(),
|
outputDir: args.flags.outputDir || process.cwd(),
|
||||||
dryRun: args.flags.dryRun,
|
dryRun: args.flags.dryRun,
|
||||||
prettier: !args.flags.noPrettier,
|
prettier: !args.flags.noPrettier,
|
||||||
eslint: !args.flags.noEslint,
|
eslint: !args.flags.noEslint,
|
||||||
zodSchemaJsDocs: !args.flags.noZodSchemaJsDocs
|
zodSchemaJsDocs: !args.flags.noZodJsDocs
|
||||||
})
|
})
|
||||||
|
|
||||||
if (args.flags.dryRun) {
|
if (args.flags.dryRun) {
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
@ -13,476 +10,8 @@ import {
|
||||||
pick
|
pick
|
||||||
} from '@agentic/core'
|
} from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'
|
|
||||||
|
|
||||||
export namespace firecrawl {
|
import { firecrawl } from './firecrawl'
|
||||||
export const apiBaseUrl = 'https://api.firecrawl.dev/v0'
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Component schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const ScrapeResponseSchema = z.object({
|
|
||||||
success: z.boolean().optional(),
|
|
||||||
/** Warning message to let you know of any issues. */
|
|
||||||
warning: z
|
|
||||||
.string()
|
|
||||||
.describe('Warning message to let you know of any issues.')
|
|
||||||
.optional(),
|
|
||||||
data: z
|
|
||||||
.object({
|
|
||||||
/** Markdown content of the page if the `markdown` format was specified (default) */
|
|
||||||
markdown: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'Markdown content of the page if the `markdown` format was specified (default)'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** HTML version of the content on page if the `html` format was specified */
|
|
||||||
html: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'HTML version of the content on page if the `html` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Raw HTML content of the page if the `rawHtml` format was specified */
|
|
||||||
rawHtml: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'Raw HTML content of the page if the `rawHtml` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Links on the page if the `links` format was specified */
|
|
||||||
links: z
|
|
||||||
.array(z.string().url())
|
|
||||||
.describe('Links on the page if the `links` format was specified')
|
|
||||||
.optional(),
|
|
||||||
/** URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified */
|
|
||||||
screenshot: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
metadata: z
|
|
||||||
.object({
|
|
||||||
title: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
language: z.string().optional(),
|
|
||||||
sourceURL: z.string().url().optional(),
|
|
||||||
'<any other metadata> ': z.string().optional(),
|
|
||||||
/** The status code of the page */
|
|
||||||
statusCode: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('The status code of the page')
|
|
||||||
.optional(),
|
|
||||||
/** The error message of the page */
|
|
||||||
error: z
|
|
||||||
.string()
|
|
||||||
.describe('The error message of the page')
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type ScrapeResponse = z.infer<typeof ScrapeResponseSchema>
|
|
||||||
|
|
||||||
export const CrawlResponseSchema = z.object({
|
|
||||||
success: z.boolean().optional(),
|
|
||||||
id: z.string().optional(),
|
|
||||||
url: z.string().url().optional()
|
|
||||||
})
|
|
||||||
export type CrawlResponse = z.infer<typeof CrawlResponseSchema>
|
|
||||||
|
|
||||||
export const SearchResponseSchema = z.object({
|
|
||||||
success: z.boolean().optional(),
|
|
||||||
data: z.array(z.any()).optional()
|
|
||||||
})
|
|
||||||
export type SearchResponse = z.infer<typeof SearchResponseSchema>
|
|
||||||
|
|
||||||
export const CrawlStatusResponseObjSchema = z.object({
|
|
||||||
/** Markdown content of the page if the `markdown` format was specified (default) */
|
|
||||||
markdown: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'Markdown content of the page if the `markdown` format was specified (default)'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** HTML version of the content on page if the `html` format was specified */
|
|
||||||
html: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'HTML version of the content on page if the `html` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Raw HTML content of the page if the `rawHtml` format was specified */
|
|
||||||
rawHtml: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'Raw HTML content of the page if the `rawHtml` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Links on the page if the `links` format was specified */
|
|
||||||
links: z
|
|
||||||
.array(z.string().url())
|
|
||||||
.describe('Links on the page if the `links` format was specified')
|
|
||||||
.optional(),
|
|
||||||
/** URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified */
|
|
||||||
screenshot: z
|
|
||||||
.string()
|
|
||||||
.describe(
|
|
||||||
'URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
metadata: z
|
|
||||||
.object({
|
|
||||||
title: z.string().optional(),
|
|
||||||
description: z.string().optional(),
|
|
||||||
language: z.string().optional(),
|
|
||||||
sourceURL: z.string().url().optional(),
|
|
||||||
'<any other metadata> ': z.string().optional(),
|
|
||||||
/** The status code of the page */
|
|
||||||
statusCode: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('The status code of the page')
|
|
||||||
.optional(),
|
|
||||||
/** The error message of the page */
|
|
||||||
error: z.string().describe('The error message of the page').optional()
|
|
||||||
})
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type CrawlStatusResponseObj = z.infer<
|
|
||||||
typeof CrawlStatusResponseObjSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Operation schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const ScrapeParamsSchema = z.object({
|
|
||||||
/** The URL to scrape */
|
|
||||||
url: z.string().url().describe('The URL to scrape'),
|
|
||||||
/**
|
|
||||||
* Specific formats to return.
|
|
||||||
*
|
|
||||||
* - markdown: The page in Markdown format.
|
|
||||||
* - html: The page's HTML, trimmed to include only meaningful content.
|
|
||||||
* - rawHtml: The page's original HTML.
|
|
||||||
* - links: The links on the page.
|
|
||||||
* - screenshot: A screenshot of the top of the page.
|
|
||||||
* - screenshot@fullPage: A screenshot of the full page. (overridden by screenshot if present)
|
|
||||||
*/
|
|
||||||
formats: z
|
|
||||||
.array(
|
|
||||||
z.enum([
|
|
||||||
'markdown',
|
|
||||||
'html',
|
|
||||||
'rawHtml',
|
|
||||||
'links',
|
|
||||||
'screenshot',
|
|
||||||
'screenshot@fullPage'
|
|
||||||
])
|
|
||||||
)
|
|
||||||
.describe(
|
|
||||||
"Specific formats to return.\n\n - markdown: The page in Markdown format.\n - html: The page's HTML, trimmed to include only meaningful content.\n - rawHtml: The page's original HTML.\n - links: The links on the page.\n - screenshot: A screenshot of the top of the page.\n - screenshot@fullPage: A screenshot of the full page. (overridden by screenshot if present)"
|
|
||||||
)
|
|
||||||
.default(['markdown']),
|
|
||||||
/** Headers to send with the request. Can be used to send cookies, user-agent, etc. */
|
|
||||||
headers: z
|
|
||||||
.record(z.any())
|
|
||||||
.describe(
|
|
||||||
'Headers to send with the request. Can be used to send cookies, user-agent, etc.'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer' */
|
|
||||||
includeTags: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe(
|
|
||||||
"Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer'"
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer' */
|
|
||||||
excludeTags: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe(
|
|
||||||
"Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer'"
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
|
||||||
onlyMainContent: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
|
||||||
)
|
|
||||||
.default(true),
|
|
||||||
/** Timeout in milliseconds for the request */
|
|
||||||
timeout: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('Timeout in milliseconds for the request')
|
|
||||||
.default(30_000),
|
|
||||||
/** Wait x amount of milliseconds for the page to load to fetch content */
|
|
||||||
waitFor: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe(
|
|
||||||
'Wait x amount of milliseconds for the page to load to fetch content'
|
|
||||||
)
|
|
||||||
.default(0)
|
|
||||||
})
|
|
||||||
export type ScrapeParams = z.infer<typeof ScrapeParamsSchema>
|
|
||||||
|
|
||||||
export const CrawlUrlsParamsSchema = z.object({
|
|
||||||
/** The base URL to start crawling from */
|
|
||||||
url: z.string().url().describe('The base URL to start crawling from'),
|
|
||||||
crawlerOptions: z
|
|
||||||
.object({
|
|
||||||
/** URL patterns to include */
|
|
||||||
includes: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe('URL patterns to include')
|
|
||||||
.optional(),
|
|
||||||
/** URL patterns to exclude */
|
|
||||||
excludes: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe('URL patterns to exclude')
|
|
||||||
.optional(),
|
|
||||||
/** Generate alt text for images using LLMs (must have a paid plan) */
|
|
||||||
generateImgAltText: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Generate alt text for images using LLMs (must have a paid plan)'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** If true, returns only the URLs as a list on the crawl status. Attention: the return response will be a list of URLs inside the data, not a list of documents. */
|
|
||||||
returnOnlyUrls: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'If true, returns only the URLs as a list on the crawl status. Attention: the return response will be a list of URLs inside the data, not a list of documents.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Maximum depth to crawl relative to the entered URL. A maxDepth of 0 scrapes only the entered URL. A maxDepth of 1 scrapes the entered URL and all pages one level deep. A maxDepth of 2 scrapes the entered URL and all pages up to two levels deep. Higher values follow the same pattern. */
|
|
||||||
maxDepth: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe(
|
|
||||||
'Maximum depth to crawl relative to the entered URL. A maxDepth of 0 scrapes only the entered URL. A maxDepth of 1 scrapes the entered URL and all pages one level deep. A maxDepth of 2 scrapes the entered URL and all pages up to two levels deep. Higher values follow the same pattern.'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** The crawling mode to use. Fast mode crawls 4x faster websites without sitemap, but may not be as accurate and shouldn't be used in heavy js-rendered websites. */
|
|
||||||
mode: z
|
|
||||||
.enum(['default', 'fast'])
|
|
||||||
.describe(
|
|
||||||
"The crawling mode to use. Fast mode crawls 4x faster websites without sitemap, but may not be as accurate and shouldn't be used in heavy js-rendered websites."
|
|
||||||
)
|
|
||||||
.default('default'),
|
|
||||||
/** Ignore the website sitemap when crawling */
|
|
||||||
ignoreSitemap: z
|
|
||||||
.boolean()
|
|
||||||
.describe('Ignore the website sitemap when crawling')
|
|
||||||
.default(false),
|
|
||||||
/** Maximum number of pages to crawl */
|
|
||||||
limit: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('Maximum number of pages to crawl')
|
|
||||||
.default(10_000),
|
|
||||||
/** Enables the crawler to navigate from a specific URL to previously linked pages. For instance, from 'example.com/product/123' back to 'example.com/product' */
|
|
||||||
allowBackwardCrawling: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
"Enables the crawler to navigate from a specific URL to previously linked pages. For instance, from 'example.com/product/123' back to 'example.com/product'"
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Allows the crawler to follow links to external websites. */
|
|
||||||
allowExternalContentLinks: z
|
|
||||||
.boolean()
|
|
||||||
.describe('Allows the crawler to follow links to external websites.')
|
|
||||||
.default(false)
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
pageOptions: z
|
|
||||||
.object({
|
|
||||||
/** Headers to send with the request. Can be used to send cookies, user-agent, etc. */
|
|
||||||
headers: z
|
|
||||||
.record(z.any())
|
|
||||||
.describe(
|
|
||||||
'Headers to send with the request. Can be used to send cookies, user-agent, etc.'
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Include the HTML version of the content on page. Will output a html key in the response. */
|
|
||||||
includeHtml: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include the HTML version of the content on page. Will output a html key in the response.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Include the raw HTML content of the page. Will output a rawHtml key in the response. */
|
|
||||||
includeRawHtml: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include the raw HTML content of the page. Will output a rawHtml key in the response.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer' */
|
|
||||||
onlyIncludeTags: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe(
|
|
||||||
"Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer'"
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
|
||||||
onlyMainContent: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer' */
|
|
||||||
removeTags: z
|
|
||||||
.array(z.string())
|
|
||||||
.describe(
|
|
||||||
"Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer'"
|
|
||||||
)
|
|
||||||
.optional(),
|
|
||||||
/** Replace all relative paths with absolute paths for images and links */
|
|
||||||
replaceAllPathsWithAbsolutePaths: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Replace all relative paths with absolute paths for images and links'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Include a screenshot of the top of the page that you are scraping. */
|
|
||||||
screenshot: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include a screenshot of the top of the page that you are scraping.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Include a full page screenshot of the page that you are scraping. */
|
|
||||||
fullPageScreenshot: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include a full page screenshot of the page that you are scraping.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Wait x amount of milliseconds for the page to load to fetch content */
|
|
||||||
waitFor: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe(
|
|
||||||
'Wait x amount of milliseconds for the page to load to fetch content'
|
|
||||||
)
|
|
||||||
.default(0)
|
|
||||||
})
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type CrawlUrlsParams = z.infer<typeof CrawlUrlsParamsSchema>
|
|
||||||
|
|
||||||
export const CrawlUrlsResponseSchema = CrawlResponseSchema
|
|
||||||
export type CrawlUrlsResponse = z.infer<typeof CrawlUrlsResponseSchema>
|
|
||||||
|
|
||||||
export const SearchGoogleParamsSchema = z.object({
|
|
||||||
/** The query to search for */
|
|
||||||
query: z.string().url().describe('The query to search for'),
|
|
||||||
pageOptions: z
|
|
||||||
.object({
|
|
||||||
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
|
||||||
onlyMainContent: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Fetch the content of each page. If false, defaults to a basic fast serp API. */
|
|
||||||
fetchPageContent: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Fetch the content of each page. If false, defaults to a basic fast serp API.'
|
|
||||||
)
|
|
||||||
.default(true),
|
|
||||||
/** Include the HTML version of the content on page. Will output a html key in the response. */
|
|
||||||
includeHtml: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include the HTML version of the content on page. Will output a html key in the response.'
|
|
||||||
)
|
|
||||||
.default(false),
|
|
||||||
/** Include the raw HTML content of the page. Will output a rawHtml key in the response. */
|
|
||||||
includeRawHtml: z
|
|
||||||
.boolean()
|
|
||||||
.describe(
|
|
||||||
'Include the raw HTML content of the page. Will output a rawHtml key in the response.'
|
|
||||||
)
|
|
||||||
.default(false)
|
|
||||||
})
|
|
||||||
.optional(),
|
|
||||||
searchOptions: z
|
|
||||||
.object({
|
|
||||||
/** Maximum number of results. Max is 20 during beta. */
|
|
||||||
limit: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('Maximum number of results. Max is 20 during beta.')
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type SearchGoogleParams = z.infer<typeof SearchGoogleParamsSchema>
|
|
||||||
|
|
||||||
export const SearchGoogleResponseSchema = SearchResponseSchema
|
|
||||||
export type SearchGoogleResponse = z.infer<typeof SearchGoogleResponseSchema>
|
|
||||||
|
|
||||||
export const GetCrawlStatusParamsSchema = z.object({
|
|
||||||
/** ID of the crawl job */
|
|
||||||
jobId: z.string().describe('ID of the crawl job')
|
|
||||||
})
|
|
||||||
export type GetCrawlStatusParams = z.infer<typeof GetCrawlStatusParamsSchema>
|
|
||||||
|
|
||||||
export const GetCrawlStatusResponseSchema = z.object({
|
|
||||||
/** Status of the job (completed, active, failed, paused) */
|
|
||||||
status: z
|
|
||||||
.string()
|
|
||||||
.describe('Status of the job (completed, active, failed, paused)')
|
|
||||||
.optional(),
|
|
||||||
/** Current page number */
|
|
||||||
current: z.number().int().describe('Current page number').optional(),
|
|
||||||
/** Total number of pages */
|
|
||||||
total: z.number().int().describe('Total number of pages').optional(),
|
|
||||||
/** Data returned from the job (null when it is in progress) */
|
|
||||||
data: z
|
|
||||||
.array(CrawlStatusResponseObjSchema)
|
|
||||||
.describe('Data returned from the job (null when it is in progress)')
|
|
||||||
.optional(),
|
|
||||||
/** Partial documents returned as it is being crawled (streaming). **This feature is currently in alpha - expect breaking changes** When a page is ready, it will append to the partial_data array, so there is no need to wait for the entire website to be crawled. When the crawl is done, partial_data will become empty and the result will be available in `data`. There is a max of 50 items in the array response. The oldest item (top of the array) will be removed when the new item is added to the array. */
|
|
||||||
partial_data: z
|
|
||||||
.array(CrawlStatusResponseObjSchema)
|
|
||||||
.describe(
|
|
||||||
'Partial documents returned as it is being crawled (streaming). **This feature is currently in alpha - expect breaking changes** When a page is ready, it will append to the partial_data array, so there is no need to wait for the entire website to be crawled. When the crawl is done, partial_data will become empty and the result will be available in `data`. There is a max of 50 items in the array response. The oldest item (top of the array) will be removed when the new item is added to the array.'
|
|
||||||
)
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type GetCrawlStatusResponse = z.infer<
|
|
||||||
typeof GetCrawlStatusResponseSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export const CancelCrawlJobParamsSchema = z.object({
|
|
||||||
/** ID of the crawl job */
|
|
||||||
jobId: z.string().describe('ID of the crawl job')
|
|
||||||
})
|
|
||||||
export type CancelCrawlJobParams = z.infer<typeof CancelCrawlJobParamsSchema>
|
|
||||||
|
|
||||||
export const CancelCrawlJobResponseSchema = z.object({
|
|
||||||
/** Returns cancelled. */
|
|
||||||
status: z.string().describe('Returns cancelled.').optional()
|
|
||||||
})
|
|
||||||
export type CancelCrawlJobResponse = z.infer<
|
|
||||||
typeof CancelCrawlJobResponseSchema
|
|
||||||
>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic Firecrawl client.
|
* Agentic Firecrawl client.
|
||||||
|
@ -526,7 +55,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_scrape',
|
name: 'firecrawl_scrape',
|
||||||
description: `Scrape a single URL.`,
|
description: `Scrape a single URL.`,
|
||||||
inputSchema: firecrawl.ScrapeParamsSchema
|
inputSchema: firecrawl.ScrapeParamsSchema,
|
||||||
|
tags: ['Scraping']
|
||||||
})
|
})
|
||||||
async scrape(
|
async scrape(
|
||||||
params: firecrawl.ScrapeParams
|
params: firecrawl.ScrapeParams
|
||||||
|
@ -554,7 +84,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_crawl_urls',
|
name: 'firecrawl_crawl_urls',
|
||||||
description: `Crawl multiple URLs based on options.`,
|
description: `Crawl multiple URLs based on options.`,
|
||||||
inputSchema: firecrawl.CrawlUrlsParamsSchema
|
inputSchema: firecrawl.CrawlUrlsParamsSchema,
|
||||||
|
tags: ['Crawling']
|
||||||
})
|
})
|
||||||
async crawlUrls(
|
async crawlUrls(
|
||||||
params: firecrawl.CrawlUrlsParams
|
params: firecrawl.CrawlUrlsParams
|
||||||
|
@ -572,7 +103,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_search_google',
|
name: 'firecrawl_search_google',
|
||||||
description: `Search for a keyword in Google, returns top page results with markdown content for each page.`,
|
description: `Search for a keyword in Google, returns top page results with markdown content for each page.`,
|
||||||
inputSchema: firecrawl.SearchGoogleParamsSchema
|
inputSchema: firecrawl.SearchGoogleParamsSchema,
|
||||||
|
tags: ['Search']
|
||||||
})
|
})
|
||||||
async searchGoogle(
|
async searchGoogle(
|
||||||
params: firecrawl.SearchGoogleParams
|
params: firecrawl.SearchGoogleParams
|
||||||
|
@ -590,7 +122,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_get_crawl_status',
|
name: 'firecrawl_get_crawl_status',
|
||||||
description: `Get the status of a crawl job.`,
|
description: `Get the status of a crawl job.`,
|
||||||
inputSchema: firecrawl.GetCrawlStatusParamsSchema
|
inputSchema: firecrawl.GetCrawlStatusParamsSchema,
|
||||||
|
tags: ['Crawl']
|
||||||
})
|
})
|
||||||
async getCrawlStatus(
|
async getCrawlStatus(
|
||||||
params: firecrawl.GetCrawlStatusParams
|
params: firecrawl.GetCrawlStatusParams
|
||||||
|
@ -606,7 +139,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_cancel_crawl_job',
|
name: 'firecrawl_cancel_crawl_job',
|
||||||
description: `Cancel a crawl job.`,
|
description: `Cancel a crawl job.`,
|
||||||
inputSchema: firecrawl.CancelCrawlJobParamsSchema
|
inputSchema: firecrawl.CancelCrawlJobParamsSchema,
|
||||||
|
tags: ['Crawl']
|
||||||
})
|
})
|
||||||
async cancelCrawlJob(
|
async cancelCrawlJob(
|
||||||
params: firecrawl.CancelCrawlJobParams
|
params: firecrawl.CancelCrawlJobParams
|
||||||
|
|
|
@ -0,0 +1,474 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
export namespace firecrawl {
|
||||||
|
export const apiBaseUrl = 'https://api.firecrawl.dev/v0'
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Component schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const ScrapeResponseSchema = z.object({
|
||||||
|
success: z.boolean().optional(),
|
||||||
|
/** Warning message to let you know of any issues. */
|
||||||
|
warning: z
|
||||||
|
.string()
|
||||||
|
.describe('Warning message to let you know of any issues.')
|
||||||
|
.optional(),
|
||||||
|
data: z
|
||||||
|
.object({
|
||||||
|
/** Markdown content of the page if the `markdown` format was specified (default) */
|
||||||
|
markdown: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'Markdown content of the page if the `markdown` format was specified (default)'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** HTML version of the content on page if the `html` format was specified */
|
||||||
|
html: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'HTML version of the content on page if the `html` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Raw HTML content of the page if the `rawHtml` format was specified */
|
||||||
|
rawHtml: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'Raw HTML content of the page if the `rawHtml` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Links on the page if the `links` format was specified */
|
||||||
|
links: z
|
||||||
|
.array(z.string().url())
|
||||||
|
.describe('Links on the page if the `links` format was specified')
|
||||||
|
.optional(),
|
||||||
|
/** URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified */
|
||||||
|
screenshot: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
metadata: z
|
||||||
|
.object({
|
||||||
|
title: z.string().optional(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
language: z.string().optional(),
|
||||||
|
sourceURL: z.string().url().optional(),
|
||||||
|
'<any other metadata> ': z.string().optional(),
|
||||||
|
/** The status code of the page */
|
||||||
|
statusCode: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('The status code of the page')
|
||||||
|
.optional(),
|
||||||
|
/** The error message of the page */
|
||||||
|
error: z
|
||||||
|
.string()
|
||||||
|
.describe('The error message of the page')
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type ScrapeResponse = z.infer<typeof ScrapeResponseSchema>
|
||||||
|
|
||||||
|
export const CrawlResponseSchema = z.object({
|
||||||
|
success: z.boolean().optional(),
|
||||||
|
id: z.string().optional(),
|
||||||
|
url: z.string().url().optional()
|
||||||
|
})
|
||||||
|
export type CrawlResponse = z.infer<typeof CrawlResponseSchema>
|
||||||
|
|
||||||
|
export const SearchResponseSchema = z.object({
|
||||||
|
success: z.boolean().optional(),
|
||||||
|
data: z.array(z.any()).optional()
|
||||||
|
})
|
||||||
|
export type SearchResponse = z.infer<typeof SearchResponseSchema>
|
||||||
|
|
||||||
|
export const CrawlStatusResponseObjSchema = z.object({
|
||||||
|
/** Markdown content of the page if the `markdown` format was specified (default) */
|
||||||
|
markdown: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'Markdown content of the page if the `markdown` format was specified (default)'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** HTML version of the content on page if the `html` format was specified */
|
||||||
|
html: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'HTML version of the content on page if the `html` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Raw HTML content of the page if the `rawHtml` format was specified */
|
||||||
|
rawHtml: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'Raw HTML content of the page if the `rawHtml` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Links on the page if the `links` format was specified */
|
||||||
|
links: z
|
||||||
|
.array(z.string().url())
|
||||||
|
.describe('Links on the page if the `links` format was specified')
|
||||||
|
.optional(),
|
||||||
|
/** URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified */
|
||||||
|
screenshot: z
|
||||||
|
.string()
|
||||||
|
.describe(
|
||||||
|
'URL of the screenshot of the page if the `screenshot` or `screenshot@fullSize` format was specified'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
metadata: z
|
||||||
|
.object({
|
||||||
|
title: z.string().optional(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
language: z.string().optional(),
|
||||||
|
sourceURL: z.string().url().optional(),
|
||||||
|
'<any other metadata> ': z.string().optional(),
|
||||||
|
/** The status code of the page */
|
||||||
|
statusCode: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('The status code of the page')
|
||||||
|
.optional(),
|
||||||
|
/** The error message of the page */
|
||||||
|
error: z.string().describe('The error message of the page').optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type CrawlStatusResponseObj = z.infer<
|
||||||
|
typeof CrawlStatusResponseObjSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Operation schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const ScrapeParamsSchema = z.object({
|
||||||
|
/** The URL to scrape */
|
||||||
|
url: z.string().url().describe('The URL to scrape'),
|
||||||
|
/**
|
||||||
|
* Specific formats to return.
|
||||||
|
*
|
||||||
|
* - markdown: The page in Markdown format.
|
||||||
|
* - html: The page's HTML, trimmed to include only meaningful content.
|
||||||
|
* - rawHtml: The page's original HTML.
|
||||||
|
* - links: The links on the page.
|
||||||
|
* - screenshot: A screenshot of the top of the page.
|
||||||
|
* - screenshot@fullPage: A screenshot of the full page. (overridden by screenshot if present)
|
||||||
|
*/
|
||||||
|
formats: z
|
||||||
|
.array(
|
||||||
|
z.enum([
|
||||||
|
'markdown',
|
||||||
|
'html',
|
||||||
|
'rawHtml',
|
||||||
|
'links',
|
||||||
|
'screenshot',
|
||||||
|
'screenshot@fullPage'
|
||||||
|
])
|
||||||
|
)
|
||||||
|
.describe(
|
||||||
|
"Specific formats to return.\n\n - markdown: The page in Markdown format.\n - html: The page's HTML, trimmed to include only meaningful content.\n - rawHtml: The page's original HTML.\n - links: The links on the page.\n - screenshot: A screenshot of the top of the page.\n - screenshot@fullPage: A screenshot of the full page. (overridden by screenshot if present)"
|
||||||
|
)
|
||||||
|
.default(['markdown']),
|
||||||
|
/** Headers to send with the request. Can be used to send cookies, user-agent, etc. */
|
||||||
|
headers: z
|
||||||
|
.record(z.any())
|
||||||
|
.describe(
|
||||||
|
'Headers to send with the request. Can be used to send cookies, user-agent, etc.'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer' */
|
||||||
|
includeTags: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe(
|
||||||
|
"Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer'"
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer' */
|
||||||
|
excludeTags: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe(
|
||||||
|
"Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer'"
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
||||||
|
onlyMainContent: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
||||||
|
)
|
||||||
|
.default(true),
|
||||||
|
/** Timeout in milliseconds for the request */
|
||||||
|
timeout: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('Timeout in milliseconds for the request')
|
||||||
|
.default(30_000),
|
||||||
|
/** Wait x amount of milliseconds for the page to load to fetch content */
|
||||||
|
waitFor: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe(
|
||||||
|
'Wait x amount of milliseconds for the page to load to fetch content'
|
||||||
|
)
|
||||||
|
.default(0)
|
||||||
|
})
|
||||||
|
export type ScrapeParams = z.infer<typeof ScrapeParamsSchema>
|
||||||
|
|
||||||
|
export const CrawlUrlsParamsSchema = z.object({
|
||||||
|
/** The base URL to start crawling from */
|
||||||
|
url: z.string().url().describe('The base URL to start crawling from'),
|
||||||
|
crawlerOptions: z
|
||||||
|
.object({
|
||||||
|
/** URL patterns to include */
|
||||||
|
includes: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe('URL patterns to include')
|
||||||
|
.optional(),
|
||||||
|
/** URL patterns to exclude */
|
||||||
|
excludes: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe('URL patterns to exclude')
|
||||||
|
.optional(),
|
||||||
|
/** Generate alt text for images using LLMs (must have a paid plan) */
|
||||||
|
generateImgAltText: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Generate alt text for images using LLMs (must have a paid plan)'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** If true, returns only the URLs as a list on the crawl status. Attention: the return response will be a list of URLs inside the data, not a list of documents. */
|
||||||
|
returnOnlyUrls: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'If true, returns only the URLs as a list on the crawl status. Attention: the return response will be a list of URLs inside the data, not a list of documents.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Maximum depth to crawl relative to the entered URL. A maxDepth of 0 scrapes only the entered URL. A maxDepth of 1 scrapes the entered URL and all pages one level deep. A maxDepth of 2 scrapes the entered URL and all pages up to two levels deep. Higher values follow the same pattern. */
|
||||||
|
maxDepth: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe(
|
||||||
|
'Maximum depth to crawl relative to the entered URL. A maxDepth of 0 scrapes only the entered URL. A maxDepth of 1 scrapes the entered URL and all pages one level deep. A maxDepth of 2 scrapes the entered URL and all pages up to two levels deep. Higher values follow the same pattern.'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** The crawling mode to use. Fast mode crawls 4x faster websites without sitemap, but may not be as accurate and shouldn't be used in heavy js-rendered websites. */
|
||||||
|
mode: z
|
||||||
|
.enum(['default', 'fast'])
|
||||||
|
.describe(
|
||||||
|
"The crawling mode to use. Fast mode crawls 4x faster websites without sitemap, but may not be as accurate and shouldn't be used in heavy js-rendered websites."
|
||||||
|
)
|
||||||
|
.default('default'),
|
||||||
|
/** Ignore the website sitemap when crawling */
|
||||||
|
ignoreSitemap: z
|
||||||
|
.boolean()
|
||||||
|
.describe('Ignore the website sitemap when crawling')
|
||||||
|
.default(false),
|
||||||
|
/** Maximum number of pages to crawl */
|
||||||
|
limit: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('Maximum number of pages to crawl')
|
||||||
|
.default(10_000),
|
||||||
|
/** Enables the crawler to navigate from a specific URL to previously linked pages. For instance, from 'example.com/product/123' back to 'example.com/product' */
|
||||||
|
allowBackwardCrawling: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
"Enables the crawler to navigate from a specific URL to previously linked pages. For instance, from 'example.com/product/123' back to 'example.com/product'"
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Allows the crawler to follow links to external websites. */
|
||||||
|
allowExternalContentLinks: z
|
||||||
|
.boolean()
|
||||||
|
.describe('Allows the crawler to follow links to external websites.')
|
||||||
|
.default(false)
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
|
pageOptions: z
|
||||||
|
.object({
|
||||||
|
/** Headers to send with the request. Can be used to send cookies, user-agent, etc. */
|
||||||
|
headers: z
|
||||||
|
.record(z.any())
|
||||||
|
.describe(
|
||||||
|
'Headers to send with the request. Can be used to send cookies, user-agent, etc.'
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Include the HTML version of the content on page. Will output a html key in the response. */
|
||||||
|
includeHtml: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include the HTML version of the content on page. Will output a html key in the response.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Include the raw HTML content of the page. Will output a rawHtml key in the response. */
|
||||||
|
includeRawHtml: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include the raw HTML content of the page. Will output a rawHtml key in the response.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer' */
|
||||||
|
onlyIncludeTags: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe(
|
||||||
|
"Only include tags, classes and ids from the page in the final output. Use comma separated values. Example: 'script, .ad, #footer'"
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
||||||
|
onlyMainContent: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer' */
|
||||||
|
removeTags: z
|
||||||
|
.array(z.string())
|
||||||
|
.describe(
|
||||||
|
"Tags, classes and ids to remove from the page. Use comma separated values. Example: 'script, .ad, #footer'"
|
||||||
|
)
|
||||||
|
.optional(),
|
||||||
|
/** Replace all relative paths with absolute paths for images and links */
|
||||||
|
replaceAllPathsWithAbsolutePaths: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Replace all relative paths with absolute paths for images and links'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Include a screenshot of the top of the page that you are scraping. */
|
||||||
|
screenshot: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include a screenshot of the top of the page that you are scraping.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Include a full page screenshot of the page that you are scraping. */
|
||||||
|
fullPageScreenshot: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include a full page screenshot of the page that you are scraping.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Wait x amount of milliseconds for the page to load to fetch content */
|
||||||
|
waitFor: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe(
|
||||||
|
'Wait x amount of milliseconds for the page to load to fetch content'
|
||||||
|
)
|
||||||
|
.default(0)
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type CrawlUrlsParams = z.infer<typeof CrawlUrlsParamsSchema>
|
||||||
|
|
||||||
|
export const CrawlUrlsResponseSchema = CrawlResponseSchema
|
||||||
|
export type CrawlUrlsResponse = z.infer<typeof CrawlUrlsResponseSchema>
|
||||||
|
|
||||||
|
export const SearchGoogleParamsSchema = z.object({
|
||||||
|
/** The query to search for */
|
||||||
|
query: z.string().url().describe('The query to search for'),
|
||||||
|
pageOptions: z
|
||||||
|
.object({
|
||||||
|
/** Only return the main content of the page excluding headers, navs, footers, etc. */
|
||||||
|
onlyMainContent: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Only return the main content of the page excluding headers, navs, footers, etc.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Fetch the content of each page. If false, defaults to a basic fast serp API. */
|
||||||
|
fetchPageContent: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Fetch the content of each page. If false, defaults to a basic fast serp API.'
|
||||||
|
)
|
||||||
|
.default(true),
|
||||||
|
/** Include the HTML version of the content on page. Will output a html key in the response. */
|
||||||
|
includeHtml: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include the HTML version of the content on page. Will output a html key in the response.'
|
||||||
|
)
|
||||||
|
.default(false),
|
||||||
|
/** Include the raw HTML content of the page. Will output a rawHtml key in the response. */
|
||||||
|
includeRawHtml: z
|
||||||
|
.boolean()
|
||||||
|
.describe(
|
||||||
|
'Include the raw HTML content of the page. Will output a rawHtml key in the response.'
|
||||||
|
)
|
||||||
|
.default(false)
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
|
searchOptions: z
|
||||||
|
.object({
|
||||||
|
/** Maximum number of results. Max is 20 during beta. */
|
||||||
|
limit: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('Maximum number of results. Max is 20 during beta.')
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type SearchGoogleParams = z.infer<typeof SearchGoogleParamsSchema>
|
||||||
|
|
||||||
|
export const SearchGoogleResponseSchema = SearchResponseSchema
|
||||||
|
export type SearchGoogleResponse = z.infer<typeof SearchGoogleResponseSchema>
|
||||||
|
|
||||||
|
export const GetCrawlStatusParamsSchema = z.object({
|
||||||
|
/** ID of the crawl job */
|
||||||
|
jobId: z.string().describe('ID of the crawl job')
|
||||||
|
})
|
||||||
|
export type GetCrawlStatusParams = z.infer<typeof GetCrawlStatusParamsSchema>
|
||||||
|
|
||||||
|
export const GetCrawlStatusResponseSchema = z.object({
|
||||||
|
/** Status of the job (completed, active, failed, paused) */
|
||||||
|
status: z
|
||||||
|
.string()
|
||||||
|
.describe('Status of the job (completed, active, failed, paused)')
|
||||||
|
.optional(),
|
||||||
|
/** Current page number */
|
||||||
|
current: z.number().int().describe('Current page number').optional(),
|
||||||
|
/** Total number of pages */
|
||||||
|
total: z.number().int().describe('Total number of pages').optional(),
|
||||||
|
/** Data returned from the job (null when it is in progress) */
|
||||||
|
data: z
|
||||||
|
.array(CrawlStatusResponseObjSchema)
|
||||||
|
.describe('Data returned from the job (null when it is in progress)')
|
||||||
|
.optional(),
|
||||||
|
/** Partial documents returned as it is being crawled (streaming). **This feature is currently in alpha - expect breaking changes** When a page is ready, it will append to the partial_data array, so there is no need to wait for the entire website to be crawled. When the crawl is done, partial_data will become empty and the result will be available in `data`. There is a max of 50 items in the array response. The oldest item (top of the array) will be removed when the new item is added to the array. */
|
||||||
|
partial_data: z
|
||||||
|
.array(CrawlStatusResponseObjSchema)
|
||||||
|
.describe(
|
||||||
|
'Partial documents returned as it is being crawled (streaming). **This feature is currently in alpha - expect breaking changes** When a page is ready, it will append to the partial_data array, so there is no need to wait for the entire website to be crawled. When the crawl is done, partial_data will become empty and the result will be available in `data`. There is a max of 50 items in the array response. The oldest item (top of the array) will be removed when the new item is added to the array.'
|
||||||
|
)
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type GetCrawlStatusResponse = z.infer<
|
||||||
|
typeof GetCrawlStatusResponseSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export const CancelCrawlJobParamsSchema = z.object({
|
||||||
|
/** ID of the crawl job */
|
||||||
|
jobId: z.string().describe('ID of the crawl job')
|
||||||
|
})
|
||||||
|
export type CancelCrawlJobParams = z.infer<typeof CancelCrawlJobParamsSchema>
|
||||||
|
|
||||||
|
export const CancelCrawlJobResponseSchema = z.object({
|
||||||
|
/** Returns cancelled. */
|
||||||
|
status: z.string().describe('Returns cancelled.').optional()
|
||||||
|
})
|
||||||
|
export type CancelCrawlJobResponse = z.infer<
|
||||||
|
typeof CancelCrawlJobResponseSchema
|
||||||
|
>
|
||||||
|
}
|
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
Plik diff jest za duży
Load Diff
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
@ -12,57 +9,8 @@ import {
|
||||||
sanitizeSearchParams
|
sanitizeSearchParams
|
||||||
} from '@agentic/core'
|
} from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'
|
|
||||||
|
|
||||||
export namespace petstore {
|
import { petstore } from './pet-store'
|
||||||
export const apiBaseUrl = 'http://petstore.swagger.io/v1'
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Component schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const PetSchema = z.object({
|
|
||||||
id: z.number().int(),
|
|
||||||
name: z.string(),
|
|
||||||
tag: z.string().optional()
|
|
||||||
})
|
|
||||||
export type Pet = z.infer<typeof PetSchema>
|
|
||||||
|
|
||||||
export const PetsSchema = z.array(PetSchema).max(100)
|
|
||||||
export type Pets = z.infer<typeof PetsSchema>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Operation schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const ListPetsParamsSchema = z.object({
|
|
||||||
/** How many items to return at one time (max 100) */
|
|
||||||
limit: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.lte(100)
|
|
||||||
.describe('How many items to return at one time (max 100)')
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type ListPetsParams = z.infer<typeof ListPetsParamsSchema>
|
|
||||||
|
|
||||||
export const ListPetsResponseSchema = PetsSchema
|
|
||||||
export type ListPetsResponse = z.infer<typeof ListPetsResponseSchema>
|
|
||||||
|
|
||||||
export const CreatePetsParamsSchema = PetSchema
|
|
||||||
export type CreatePetsParams = z.infer<typeof CreatePetsParamsSchema>
|
|
||||||
|
|
||||||
export type CreatePetsResponse = undefined
|
|
||||||
|
|
||||||
export const ShowPetByIdParamsSchema = z.object({
|
|
||||||
/** The id of the pet to retrieve */
|
|
||||||
petId: z.string().describe('The id of the pet to retrieve')
|
|
||||||
})
|
|
||||||
export type ShowPetByIdParams = z.infer<typeof ShowPetByIdParamsSchema>
|
|
||||||
|
|
||||||
export const ShowPetByIdResponseSchema = PetSchema
|
|
||||||
export type ShowPetByIdResponse = z.infer<typeof ShowPetByIdResponseSchema>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic PetStore client.
|
* Agentic PetStore client.
|
||||||
|
@ -95,7 +43,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_list_pets',
|
name: 'pet_store_list_pets',
|
||||||
description: `List all pets.`,
|
description: `List all pets.`,
|
||||||
inputSchema: petstore.ListPetsParamsSchema
|
inputSchema: petstore.ListPetsParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async listPets(
|
async listPets(
|
||||||
params: petstore.ListPetsParams
|
params: petstore.ListPetsParams
|
||||||
|
@ -113,7 +62,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_create_pets',
|
name: 'pet_store_create_pets',
|
||||||
description: `Create a pet.`,
|
description: `Create a pet.`,
|
||||||
inputSchema: petstore.CreatePetsParamsSchema
|
inputSchema: petstore.CreatePetsParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async createPets(
|
async createPets(
|
||||||
params: petstore.CreatePetsParams
|
params: petstore.CreatePetsParams
|
||||||
|
@ -131,7 +81,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_show_pet_by_id',
|
name: 'pet_store_show_pet_by_id',
|
||||||
description: `Info for a specific pet.`,
|
description: `Info for a specific pet.`,
|
||||||
inputSchema: petstore.ShowPetByIdParamsSchema
|
inputSchema: petstore.ShowPetByIdParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async showPetById(
|
async showPetById(
|
||||||
params: petstore.ShowPetByIdParams
|
params: petstore.ShowPetByIdParams
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
export namespace petstore {
|
||||||
|
export const apiBaseUrl = 'http://petstore.swagger.io/v1'
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Component schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const PetSchema = z.object({
|
||||||
|
id: z.number().int(),
|
||||||
|
name: z.string(),
|
||||||
|
tag: z.string().optional()
|
||||||
|
})
|
||||||
|
export type Pet = z.infer<typeof PetSchema>
|
||||||
|
|
||||||
|
export const PetsSchema = z.array(PetSchema).max(100)
|
||||||
|
export type Pets = z.infer<typeof PetsSchema>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Operation schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const ListPetsParamsSchema = z.object({
|
||||||
|
/** How many items to return at one time (max 100) */
|
||||||
|
limit: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.lte(100)
|
||||||
|
.describe('How many items to return at one time (max 100)')
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type ListPetsParams = z.infer<typeof ListPetsParamsSchema>
|
||||||
|
|
||||||
|
export const ListPetsResponseSchema = PetsSchema
|
||||||
|
export type ListPetsResponse = z.infer<typeof ListPetsResponseSchema>
|
||||||
|
|
||||||
|
export const CreatePetsParamsSchema = PetSchema
|
||||||
|
export type CreatePetsParams = z.infer<typeof CreatePetsParamsSchema>
|
||||||
|
|
||||||
|
export type CreatePetsResponse = undefined
|
||||||
|
|
||||||
|
export const ShowPetByIdParamsSchema = z.object({
|
||||||
|
/** The id of the pet to retrieve */
|
||||||
|
petId: z.string().describe('The id of the pet to retrieve')
|
||||||
|
})
|
||||||
|
export type ShowPetByIdParams = z.infer<typeof ShowPetByIdParamsSchema>
|
||||||
|
|
||||||
|
export const ShowPetByIdResponseSchema = PetSchema
|
||||||
|
export type ShowPetByIdResponse = z.infer<typeof ShowPetByIdResponseSchema>
|
||||||
|
}
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
@ -12,69 +9,8 @@ import {
|
||||||
sanitizeSearchParams
|
sanitizeSearchParams
|
||||||
} from '@agentic/core'
|
} from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'
|
|
||||||
|
|
||||||
export namespace petstoreexpanded {
|
import { petstoreexpanded } from './petstore-expanded'
|
||||||
export const apiBaseUrl = 'http://petstore.swagger.io/api'
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Component schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const NewPetSchema = z.object({
|
|
||||||
name: z.string(),
|
|
||||||
tag: z.string().optional()
|
|
||||||
})
|
|
||||||
export type NewPet = z.infer<typeof NewPetSchema>
|
|
||||||
|
|
||||||
export const PetSchema = z.intersection(
|
|
||||||
NewPetSchema,
|
|
||||||
z.object({ id: z.number().int() })
|
|
||||||
)
|
|
||||||
export type Pet = z.infer<typeof PetSchema>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Operation schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const FindPetsParamsSchema = z.object({
|
|
||||||
/** tags to filter by */
|
|
||||||
tags: z.array(z.string()).describe('tags to filter by').optional(),
|
|
||||||
/** maximum number of results to return */
|
|
||||||
limit: z
|
|
||||||
.number()
|
|
||||||
.int()
|
|
||||||
.describe('maximum number of results to return')
|
|
||||||
.optional()
|
|
||||||
})
|
|
||||||
export type FindPetsParams = z.infer<typeof FindPetsParamsSchema>
|
|
||||||
|
|
||||||
export const FindPetsResponseSchema = z.array(PetSchema)
|
|
||||||
export type FindPetsResponse = z.infer<typeof FindPetsResponseSchema>
|
|
||||||
|
|
||||||
export const AddPetParamsSchema = NewPetSchema
|
|
||||||
export type AddPetParams = z.infer<typeof AddPetParamsSchema>
|
|
||||||
|
|
||||||
export const AddPetResponseSchema = PetSchema
|
|
||||||
export type AddPetResponse = z.infer<typeof AddPetResponseSchema>
|
|
||||||
|
|
||||||
export const FindPetByIdParamsSchema = z.object({
|
|
||||||
/** ID of pet to fetch */
|
|
||||||
id: z.number().int().describe('ID of pet to fetch')
|
|
||||||
})
|
|
||||||
export type FindPetByIdParams = z.infer<typeof FindPetByIdParamsSchema>
|
|
||||||
|
|
||||||
export const FindPetByIdResponseSchema = PetSchema
|
|
||||||
export type FindPetByIdResponse = z.infer<typeof FindPetByIdResponseSchema>
|
|
||||||
|
|
||||||
export const DeletePetParamsSchema = z.object({
|
|
||||||
/** ID of pet to delete */
|
|
||||||
id: z.number().int().describe('ID of pet to delete')
|
|
||||||
})
|
|
||||||
export type DeletePetParams = z.infer<typeof DeletePetParamsSchema>
|
|
||||||
|
|
||||||
export type DeletePetResponse = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic PetstoreExpanded client.
|
* Agentic PetstoreExpanded client.
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
export namespace petstoreexpanded {
|
||||||
|
export const apiBaseUrl = 'http://petstore.swagger.io/api'
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Component schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const NewPetSchema = z.object({
|
||||||
|
name: z.string(),
|
||||||
|
tag: z.string().optional()
|
||||||
|
})
|
||||||
|
export type NewPet = z.infer<typeof NewPetSchema>
|
||||||
|
|
||||||
|
export const PetSchema = z.intersection(
|
||||||
|
NewPetSchema,
|
||||||
|
z.object({ id: z.number().int() })
|
||||||
|
)
|
||||||
|
export type Pet = z.infer<typeof PetSchema>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Operation schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const FindPetsParamsSchema = z.object({
|
||||||
|
/** tags to filter by */
|
||||||
|
tags: z.array(z.string()).describe('tags to filter by').optional(),
|
||||||
|
/** maximum number of results to return */
|
||||||
|
limit: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
.describe('maximum number of results to return')
|
||||||
|
.optional()
|
||||||
|
})
|
||||||
|
export type FindPetsParams = z.infer<typeof FindPetsParamsSchema>
|
||||||
|
|
||||||
|
export const FindPetsResponseSchema = z.array(PetSchema)
|
||||||
|
export type FindPetsResponse = z.infer<typeof FindPetsResponseSchema>
|
||||||
|
|
||||||
|
export const AddPetParamsSchema = NewPetSchema
|
||||||
|
export type AddPetParams = z.infer<typeof AddPetParamsSchema>
|
||||||
|
|
||||||
|
export const AddPetResponseSchema = PetSchema
|
||||||
|
export type AddPetResponse = z.infer<typeof AddPetResponseSchema>
|
||||||
|
|
||||||
|
export const FindPetByIdParamsSchema = z.object({
|
||||||
|
/** ID of pet to fetch */
|
||||||
|
id: z.number().int().describe('ID of pet to fetch')
|
||||||
|
})
|
||||||
|
export type FindPetByIdParams = z.infer<typeof FindPetByIdParamsSchema>
|
||||||
|
|
||||||
|
export const FindPetByIdResponseSchema = PetSchema
|
||||||
|
export type FindPetByIdResponse = z.infer<typeof FindPetByIdResponseSchema>
|
||||||
|
|
||||||
|
export const DeletePetParamsSchema = z.object({
|
||||||
|
/** ID of pet to delete */
|
||||||
|
id: z.number().int().describe('ID of pet to delete')
|
||||||
|
})
|
||||||
|
export type DeletePetParams = z.infer<typeof DeletePetParamsSchema>
|
||||||
|
|
||||||
|
export type DeletePetResponse = undefined
|
||||||
|
}
|
|
@ -1,124 +1,11 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { aiFunction,AIFunctionsProvider } from '@agentic/core'
|
import { aiFunction,AIFunctionsProvider } from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'
|
|
||||||
|
|
||||||
export namespace security {
|
import { security } from './security'
|
||||||
export const apiBaseUrl = 'https://httpbin.org'
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Operation schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const GetAnythingApiKeyParamsSchema = z.object({})
|
|
||||||
export type GetAnythingApiKeyParams = z.infer<
|
|
||||||
typeof GetAnythingApiKeyParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type GetAnythingApiKeyResponse = undefined
|
|
||||||
|
|
||||||
export const PostAnythingApiKeyParamsSchema = z.object({})
|
|
||||||
export type PostAnythingApiKeyParams = z.infer<
|
|
||||||
typeof PostAnythingApiKeyParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingApiKeyResponse = undefined
|
|
||||||
|
|
||||||
export const PutAnythingApiKeyParamsSchema = z.object({})
|
|
||||||
export type PutAnythingApiKeyParams = z.infer<
|
|
||||||
typeof PutAnythingApiKeyParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PutAnythingApiKeyResponse = undefined
|
|
||||||
|
|
||||||
export const PostAnythingBasicParamsSchema = z.object({})
|
|
||||||
export type PostAnythingBasicParams = z.infer<
|
|
||||||
typeof PostAnythingBasicParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingBasicResponse = undefined
|
|
||||||
|
|
||||||
export const PostAnythingBearerParamsSchema = z.object({})
|
|
||||||
export type PostAnythingBearerParams = z.infer<
|
|
||||||
typeof PostAnythingBearerParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingBearerResponse = undefined
|
|
||||||
|
|
||||||
export const PutAnythingBearerParamsSchema = z.object({})
|
|
||||||
export type PutAnythingBearerParams = z.infer<
|
|
||||||
typeof PutAnythingBearerParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PutAnythingBearerResponse = undefined
|
|
||||||
|
|
||||||
export const GetAnythingOauth2ParamsSchema = z.object({})
|
|
||||||
export type GetAnythingOauth2Params = z.infer<
|
|
||||||
typeof GetAnythingOauth2ParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type GetAnythingOauth2Response = undefined
|
|
||||||
|
|
||||||
export const PostAnythingOauth2ParamsSchema = z.object({})
|
|
||||||
export type PostAnythingOauth2Params = z.infer<
|
|
||||||
typeof PostAnythingOauth2ParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingOauth2Response = undefined
|
|
||||||
|
|
||||||
export const PutAnythingOauth2ParamsSchema = z.object({})
|
|
||||||
export type PutAnythingOauth2Params = z.infer<
|
|
||||||
typeof PutAnythingOauth2ParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PutAnythingOauth2Response = undefined
|
|
||||||
|
|
||||||
export const DeleteAnythingOauth2ParamsSchema = z.object({})
|
|
||||||
export type DeleteAnythingOauth2Params = z.infer<
|
|
||||||
typeof DeleteAnythingOauth2ParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type DeleteAnythingOauth2Response = undefined
|
|
||||||
|
|
||||||
export const PatchAnythingOauth2ParamsSchema = z.object({})
|
|
||||||
export type PatchAnythingOauth2Params = z.infer<
|
|
||||||
typeof PatchAnythingOauth2ParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PatchAnythingOauth2Response = undefined
|
|
||||||
|
|
||||||
export const PostAnythingOpenIdConnectParamsSchema = z.object({})
|
|
||||||
export type PostAnythingOpenIdConnectParams = z.infer<
|
|
||||||
typeof PostAnythingOpenIdConnectParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingOpenIdConnectResponse = undefined
|
|
||||||
|
|
||||||
export const PostAnythingNoAuthParamsSchema = z.object({})
|
|
||||||
export type PostAnythingNoAuthParams = z.infer<
|
|
||||||
typeof PostAnythingNoAuthParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type PostAnythingNoAuthResponse = undefined
|
|
||||||
|
|
||||||
export const GetAnythingOptionalAuthParamsSchema = z.object({})
|
|
||||||
export type GetAnythingOptionalAuthParams = z.infer<
|
|
||||||
typeof GetAnythingOptionalAuthParamsSchema
|
|
||||||
>
|
|
||||||
|
|
||||||
export type GetAnythingOptionalAuthResponse = undefined
|
|
||||||
|
|
||||||
export const PostStatus401ParamsSchema = z.object({})
|
|
||||||
export type PostStatus401Params = z.infer<typeof PostStatus401ParamsSchema>
|
|
||||||
|
|
||||||
export type PostStatus401Response = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic Security client.
|
* Agentic Security client.
|
||||||
|
@ -153,7 +40,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_get_anything_api_key',
|
name: 'security_get_anything_api_key',
|
||||||
description: `\`apiKey\` auth will be supplied within an \`apiKey\` query parameter.`,
|
description: `\`apiKey\` auth will be supplied within an \`apiKey\` query parameter.`,
|
||||||
inputSchema: security.GetAnythingApiKeyParamsSchema
|
inputSchema: security.GetAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async getAnythingApiKey(
|
async getAnythingApiKey(
|
||||||
_params: security.GetAnythingApiKeyParams
|
_params: security.GetAnythingApiKeyParams
|
||||||
|
@ -169,7 +57,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_api_key',
|
name: 'security_post_anything_api_key',
|
||||||
description: `\`apiKey\` auth will be supplied within an \`api_key\` cookie.`,
|
description: `\`apiKey\` auth will be supplied within an \`api_key\` cookie.`,
|
||||||
inputSchema: security.PostAnythingApiKeyParamsSchema
|
inputSchema: security.PostAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async postAnythingApiKey(
|
async postAnythingApiKey(
|
||||||
_params: security.PostAnythingApiKeyParams
|
_params: security.PostAnythingApiKeyParams
|
||||||
|
@ -185,7 +74,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_put_anything_api_key',
|
name: 'security_put_anything_api_key',
|
||||||
description: `\`apiKey\` auth will be supplied within an \`X-API-KEY\` header.`,
|
description: `\`apiKey\` auth will be supplied within an \`X-API-KEY\` header.`,
|
||||||
inputSchema: security.PutAnythingApiKeyParamsSchema
|
inputSchema: security.PutAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async putAnythingApiKey(
|
async putAnythingApiKey(
|
||||||
_params: security.PutAnythingApiKeyParams
|
_params: security.PutAnythingApiKeyParams
|
||||||
|
@ -205,7 +95,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
description: `Authentication credentials will be supplied within a \`Basic\` \`Authorization\` header.
|
description: `Authentication credentials will be supplied within a \`Basic\` \`Authorization\` header.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.`,
|
||||||
inputSchema: security.PostAnythingBasicParamsSchema
|
inputSchema: security.PostAnythingBasicParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async postAnythingBasic(
|
async postAnythingBasic(
|
||||||
_params: security.PostAnythingBasicParams
|
_params: security.PostAnythingBasicParams
|
||||||
|
@ -225,7 +116,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
description: `Authentication credentials will be supplied within a \`Bearer\` \`Authorization\` header.
|
description: `Authentication credentials will be supplied within a \`Bearer\` \`Authorization\` header.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.`,
|
||||||
inputSchema: security.PostAnythingBearerParamsSchema
|
inputSchema: security.PostAnythingBearerParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async postAnythingBearer(
|
async postAnythingBearer(
|
||||||
_params: security.PostAnythingBearerParams
|
_params: security.PostAnythingBearerParams
|
||||||
|
@ -251,7 +143,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
|
|
||||||
> ℹ️
|
> ℹ️
|
||||||
> We currently do not support any special handling for this so they're handled as a standard \`Bearer\` authentication token.`,
|
> We currently do not support any special handling for this so they're handled as a standard \`Bearer\` authentication token.`,
|
||||||
inputSchema: security.PutAnythingBearerParamsSchema
|
inputSchema: security.PutAnythingBearerParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async putAnythingBearer(
|
async putAnythingBearer(
|
||||||
_params: security.PutAnythingBearerParams
|
_params: security.PutAnythingBearerParams
|
||||||
|
@ -273,7 +166,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
||||||
inputSchema: security.GetAnythingOauth2ParamsSchema
|
inputSchema: security.GetAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async getAnythingOauth2(
|
async getAnythingOauth2(
|
||||||
_params: security.GetAnythingOauth2Params
|
_params: security.GetAnythingOauth2Params
|
||||||
|
@ -295,7 +189,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
||||||
inputSchema: security.PostAnythingOauth2ParamsSchema
|
inputSchema: security.PostAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async postAnythingOauth2(
|
async postAnythingOauth2(
|
||||||
_params: security.PostAnythingOauth2Params
|
_params: security.PostAnythingOauth2Params
|
||||||
|
@ -317,7 +212,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
||||||
inputSchema: security.PutAnythingOauth2ParamsSchema
|
inputSchema: security.PutAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async putAnythingOauth2(
|
async putAnythingOauth2(
|
||||||
_params: security.PutAnythingOauth2Params
|
_params: security.PutAnythingOauth2Params
|
||||||
|
@ -339,7 +235,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
||||||
inputSchema: security.DeleteAnythingOauth2ParamsSchema
|
inputSchema: security.DeleteAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async deleteAnythingOauth2(
|
async deleteAnythingOauth2(
|
||||||
_params: security.DeleteAnythingOauth2Params
|
_params: security.DeleteAnythingOauth2Params
|
||||||
|
@ -361,7 +258,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \`oauth2\` requirement we assume that the user, or the projects JWT, has a qualified \`bearer\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.`,
|
||||||
inputSchema: security.PatchAnythingOauth2ParamsSchema
|
inputSchema: security.PatchAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async patchAnythingOauth2(
|
async patchAnythingOauth2(
|
||||||
_params: security.PatchAnythingOauth2Params
|
_params: security.PatchAnythingOauth2Params
|
||||||
|
@ -377,7 +275,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_open_id_connect',
|
name: 'security_post_anything_open_id_connect',
|
||||||
description: `🚧 This is not supported.`,
|
description: `🚧 This is not supported.`,
|
||||||
inputSchema: security.PostAnythingOpenIdConnectParamsSchema
|
inputSchema: security.PostAnythingOpenIdConnectParamsSchema,
|
||||||
|
tags: ['OpenID Connect']
|
||||||
})
|
})
|
||||||
async postAnythingOpenIdConnect(
|
async postAnythingOpenIdConnect(
|
||||||
_params: security.PostAnythingOpenIdConnectParams
|
_params: security.PostAnythingOpenIdConnectParams
|
||||||
|
@ -393,7 +292,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_no_auth',
|
name: 'security_post_anything_no_auth',
|
||||||
description: `This operation does not have any authentication requirements.`,
|
description: `This operation does not have any authentication requirements.`,
|
||||||
inputSchema: security.PostAnythingNoAuthParamsSchema
|
inputSchema: security.PostAnythingNoAuthParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async postAnythingNoAuth(
|
async postAnythingNoAuth(
|
||||||
_params: security.PostAnythingNoAuthParams
|
_params: security.PostAnythingNoAuthParams
|
||||||
|
@ -413,7 +313,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
|
||||||
description: `The \`apiKey\` query parameter auth on this operation is optional.
|
description: `The \`apiKey\` query parameter auth on this operation is optional.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object.`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object.`,
|
||||||
inputSchema: security.GetAnythingOptionalAuthParamsSchema
|
inputSchema: security.GetAnythingOptionalAuthParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async getAnythingOptionalAuth(
|
async getAnythingOptionalAuth(
|
||||||
_params: security.GetAnythingOptionalAuthParams
|
_params: security.GetAnythingOptionalAuthParams
|
||||||
|
@ -429,7 +330,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_status401',
|
name: 'security_post_status401',
|
||||||
description: `This endpoint requires an authentication header but making any request to it will forcefully return a 401 status code for invalid auth.`,
|
description: `This endpoint requires an authentication header but making any request to it will forcefully return a 401 status code for invalid auth.`,
|
||||||
inputSchema: security.PostStatus401ParamsSchema
|
inputSchema: security.PostStatus401ParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async postStatus401(
|
async postStatus401(
|
||||||
_params: security.PostStatus401Params
|
_params: security.PostStatus401Params
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
export namespace security {
|
||||||
|
export const apiBaseUrl = 'https://httpbin.org'
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Operation schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const GetAnythingApiKeyParamsSchema = z.object({})
|
||||||
|
export type GetAnythingApiKeyParams = z.infer<
|
||||||
|
typeof GetAnythingApiKeyParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type GetAnythingApiKeyResponse = undefined
|
||||||
|
|
||||||
|
export const PostAnythingApiKeyParamsSchema = z.object({})
|
||||||
|
export type PostAnythingApiKeyParams = z.infer<
|
||||||
|
typeof PostAnythingApiKeyParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingApiKeyResponse = undefined
|
||||||
|
|
||||||
|
export const PutAnythingApiKeyParamsSchema = z.object({})
|
||||||
|
export type PutAnythingApiKeyParams = z.infer<
|
||||||
|
typeof PutAnythingApiKeyParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PutAnythingApiKeyResponse = undefined
|
||||||
|
|
||||||
|
export const PostAnythingBasicParamsSchema = z.object({})
|
||||||
|
export type PostAnythingBasicParams = z.infer<
|
||||||
|
typeof PostAnythingBasicParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingBasicResponse = undefined
|
||||||
|
|
||||||
|
export const PostAnythingBearerParamsSchema = z.object({})
|
||||||
|
export type PostAnythingBearerParams = z.infer<
|
||||||
|
typeof PostAnythingBearerParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingBearerResponse = undefined
|
||||||
|
|
||||||
|
export const PutAnythingBearerParamsSchema = z.object({})
|
||||||
|
export type PutAnythingBearerParams = z.infer<
|
||||||
|
typeof PutAnythingBearerParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PutAnythingBearerResponse = undefined
|
||||||
|
|
||||||
|
export const GetAnythingOauth2ParamsSchema = z.object({})
|
||||||
|
export type GetAnythingOauth2Params = z.infer<
|
||||||
|
typeof GetAnythingOauth2ParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type GetAnythingOauth2Response = undefined
|
||||||
|
|
||||||
|
export const PostAnythingOauth2ParamsSchema = z.object({})
|
||||||
|
export type PostAnythingOauth2Params = z.infer<
|
||||||
|
typeof PostAnythingOauth2ParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingOauth2Response = undefined
|
||||||
|
|
||||||
|
export const PutAnythingOauth2ParamsSchema = z.object({})
|
||||||
|
export type PutAnythingOauth2Params = z.infer<
|
||||||
|
typeof PutAnythingOauth2ParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PutAnythingOauth2Response = undefined
|
||||||
|
|
||||||
|
export const DeleteAnythingOauth2ParamsSchema = z.object({})
|
||||||
|
export type DeleteAnythingOauth2Params = z.infer<
|
||||||
|
typeof DeleteAnythingOauth2ParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type DeleteAnythingOauth2Response = undefined
|
||||||
|
|
||||||
|
export const PatchAnythingOauth2ParamsSchema = z.object({})
|
||||||
|
export type PatchAnythingOauth2Params = z.infer<
|
||||||
|
typeof PatchAnythingOauth2ParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PatchAnythingOauth2Response = undefined
|
||||||
|
|
||||||
|
export const PostAnythingOpenIdConnectParamsSchema = z.object({})
|
||||||
|
export type PostAnythingOpenIdConnectParams = z.infer<
|
||||||
|
typeof PostAnythingOpenIdConnectParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingOpenIdConnectResponse = undefined
|
||||||
|
|
||||||
|
export const PostAnythingNoAuthParamsSchema = z.object({})
|
||||||
|
export type PostAnythingNoAuthParams = z.infer<
|
||||||
|
typeof PostAnythingNoAuthParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type PostAnythingNoAuthResponse = undefined
|
||||||
|
|
||||||
|
export const GetAnythingOptionalAuthParamsSchema = z.object({})
|
||||||
|
export type GetAnythingOptionalAuthParams = z.infer<
|
||||||
|
typeof GetAnythingOptionalAuthParamsSchema
|
||||||
|
>
|
||||||
|
|
||||||
|
export type GetAnythingOptionalAuthResponse = undefined
|
||||||
|
|
||||||
|
export const PostStatus401ParamsSchema = z.object({})
|
||||||
|
export type PostStatus401Params = z.infer<typeof PostStatus401ParamsSchema>
|
||||||
|
|
||||||
|
export type PostStatus401Response = undefined
|
||||||
|
}
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,65 +1,11 @@
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { aiFunction,AIFunctionsProvider } from '@agentic/core'
|
import { aiFunction,AIFunctionsProvider } from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'
|
|
||||||
|
|
||||||
export namespace tictactoe {
|
import { tictactoe } from './tic-tac-toe'
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Component schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Winner of the game. `.` means nobody has won yet. */
|
|
||||||
export const WinnerSchema = z
|
|
||||||
.enum(['.', 'X', 'O'])
|
|
||||||
.describe('Winner of the game. `.` means nobody has won yet.')
|
|
||||||
export type Winner = z.infer<typeof WinnerSchema>
|
|
||||||
|
|
||||||
/** Possible values for a board square. `.` means empty square. */
|
|
||||||
export const MarkSchema = z
|
|
||||||
.enum(['.', 'X', 'O'])
|
|
||||||
.describe('Possible values for a board square. `.` means empty square.')
|
|
||||||
export type Mark = z.infer<typeof MarkSchema>
|
|
||||||
|
|
||||||
export const BoardSchema = z
|
|
||||||
.array(z.array(MarkSchema).min(3).max(3))
|
|
||||||
.min(3)
|
|
||||||
.max(3)
|
|
||||||
export type Board = z.infer<typeof BoardSchema>
|
|
||||||
|
|
||||||
export const StatusSchema = z.object({
|
|
||||||
winner: WinnerSchema.optional(),
|
|
||||||
board: BoardSchema.optional()
|
|
||||||
})
|
|
||||||
export type Status = z.infer<typeof StatusSchema>
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Operation schemas
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export const GetBoardParamsSchema = z.object({})
|
|
||||||
export type GetBoardParams = z.infer<typeof GetBoardParamsSchema>
|
|
||||||
|
|
||||||
export const GetBoardResponseSchema = StatusSchema
|
|
||||||
export type GetBoardResponse = z.infer<typeof GetBoardResponseSchema>
|
|
||||||
|
|
||||||
export const GetSquareParamsSchema = z.object({})
|
|
||||||
export type GetSquareParams = z.infer<typeof GetSquareParamsSchema>
|
|
||||||
|
|
||||||
export const GetSquareResponseSchema = MarkSchema
|
|
||||||
export type GetSquareResponse = z.infer<typeof GetSquareResponseSchema>
|
|
||||||
|
|
||||||
export const PutSquareParamsSchema = MarkSchema
|
|
||||||
export type PutSquareParams = z.infer<typeof PutSquareParamsSchema>
|
|
||||||
|
|
||||||
export const PutSquareResponseSchema = StatusSchema
|
|
||||||
export type PutSquareResponse = z.infer<typeof PutSquareResponseSchema>
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic TicTacToe client.
|
* Agentic TicTacToe client.
|
||||||
|
@ -96,7 +42,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_get_board',
|
name: 'tic_tac_toe_get_board',
|
||||||
description: `Retrieves the current state of the board and the winner.`,
|
description: `Retrieves the current state of the board and the winner.`,
|
||||||
inputSchema: tictactoe.GetBoardParamsSchema
|
inputSchema: tictactoe.GetBoardParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async getBoard(
|
async getBoard(
|
||||||
_params: tictactoe.GetBoardParams
|
_params: tictactoe.GetBoardParams
|
||||||
|
@ -110,7 +57,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_get_square',
|
name: 'tic_tac_toe_get_square',
|
||||||
description: `Retrieves the requested square.`,
|
description: `Retrieves the requested square.`,
|
||||||
inputSchema: tictactoe.GetSquareParamsSchema
|
inputSchema: tictactoe.GetSquareParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async getSquare(
|
async getSquare(
|
||||||
_params: tictactoe.GetSquareParams
|
_params: tictactoe.GetSquareParams
|
||||||
|
@ -126,7 +74,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_put_square',
|
name: 'tic_tac_toe_put_square',
|
||||||
description: `Places a mark on the board and retrieves the whole board and the winner (if any).`,
|
description: `Places a mark on the board and retrieves the whole board and the winner (if any).`,
|
||||||
inputSchema: tictactoe.PutSquareParamsSchema
|
inputSchema: tictactoe.PutSquareParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async putSquare(
|
async putSquare(
|
||||||
_params: tictactoe.PutSquareParams
|
_params: tictactoe.PutSquareParams
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'
|
||||||
|
|
||||||
|
export namespace tictactoe {
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Component schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Winner of the game. `.` means nobody has won yet. */
|
||||||
|
export const WinnerSchema = z
|
||||||
|
.enum(['.', 'X', 'O'])
|
||||||
|
.describe('Winner of the game. `.` means nobody has won yet.')
|
||||||
|
export type Winner = z.infer<typeof WinnerSchema>
|
||||||
|
|
||||||
|
/** Possible values for a board square. `.` means empty square. */
|
||||||
|
export const MarkSchema = z
|
||||||
|
.enum(['.', 'X', 'O'])
|
||||||
|
.describe('Possible values for a board square. `.` means empty square.')
|
||||||
|
export type Mark = z.infer<typeof MarkSchema>
|
||||||
|
|
||||||
|
export const BoardSchema = z
|
||||||
|
.array(z.array(MarkSchema).min(3).max(3))
|
||||||
|
.min(3)
|
||||||
|
.max(3)
|
||||||
|
export type Board = z.infer<typeof BoardSchema>
|
||||||
|
|
||||||
|
export const StatusSchema = z.object({
|
||||||
|
winner: WinnerSchema.optional(),
|
||||||
|
board: BoardSchema.optional()
|
||||||
|
})
|
||||||
|
export type Status = z.infer<typeof StatusSchema>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Operation schemas
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export const GetBoardParamsSchema = z.object({})
|
||||||
|
export type GetBoardParams = z.infer<typeof GetBoardParamsSchema>
|
||||||
|
|
||||||
|
export const GetBoardResponseSchema = StatusSchema
|
||||||
|
export type GetBoardResponse = z.infer<typeof GetBoardResponseSchema>
|
||||||
|
|
||||||
|
export const GetSquareParamsSchema = z.object({})
|
||||||
|
export type GetSquareParams = z.infer<typeof GetSquareParamsSchema>
|
||||||
|
|
||||||
|
export const GetSquareResponseSchema = MarkSchema
|
||||||
|
export type GetSquareResponse = z.infer<typeof GetSquareResponseSchema>
|
||||||
|
|
||||||
|
export const PutSquareParamsSchema = MarkSchema
|
||||||
|
export type PutSquareParams = z.infer<typeof PutSquareParamsSchema>
|
||||||
|
|
||||||
|
export const PutSquareResponseSchema = StatusSchema
|
||||||
|
export type PutSquareResponse = z.infer<typeof PutSquareResponseSchema>
|
||||||
|
}
|
|
@ -1,21 +1,10 @@
|
||||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
exports[`openapi-to-ts > firecrawl.json 1`] = `
|
exports[`openapi-to-ts > firecrawl.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
AIFunctionsProvider,
|
|
||||||
aiFunction,
|
|
||||||
assert,
|
|
||||||
getEnv,
|
|
||||||
pick
|
|
||||||
} from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace firecrawl {
|
export namespace firecrawl {
|
||||||
|
@ -487,6 +476,21 @@ export namespace firecrawl {
|
||||||
>
|
>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
AIFunctionsProvider,
|
||||||
|
aiFunction,
|
||||||
|
assert,
|
||||||
|
getEnv,
|
||||||
|
pick
|
||||||
|
} from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { firecrawl } from './firecrawl'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic Firecrawl client.
|
* Agentic Firecrawl client.
|
||||||
*
|
*
|
||||||
|
@ -529,7 +533,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_scrape',
|
name: 'firecrawl_scrape',
|
||||||
description: \`Scrape a single URL.\`,
|
description: \`Scrape a single URL.\`,
|
||||||
inputSchema: firecrawl.ScrapeParamsSchema
|
inputSchema: firecrawl.ScrapeParamsSchema,
|
||||||
|
tags: ['Scraping']
|
||||||
})
|
})
|
||||||
async scrape(
|
async scrape(
|
||||||
params: firecrawl.ScrapeParams
|
params: firecrawl.ScrapeParams
|
||||||
|
@ -557,7 +562,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_crawl_urls',
|
name: 'firecrawl_crawl_urls',
|
||||||
description: \`Crawl multiple URLs based on options.\`,
|
description: \`Crawl multiple URLs based on options.\`,
|
||||||
inputSchema: firecrawl.CrawlUrlsParamsSchema
|
inputSchema: firecrawl.CrawlUrlsParamsSchema,
|
||||||
|
tags: ['Crawling']
|
||||||
})
|
})
|
||||||
async crawlUrls(
|
async crawlUrls(
|
||||||
params: firecrawl.CrawlUrlsParams
|
params: firecrawl.CrawlUrlsParams
|
||||||
|
@ -575,7 +581,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_search_google',
|
name: 'firecrawl_search_google',
|
||||||
description: \`Search for a keyword in Google, returns top page results with markdown content for each page.\`,
|
description: \`Search for a keyword in Google, returns top page results with markdown content for each page.\`,
|
||||||
inputSchema: firecrawl.SearchGoogleParamsSchema
|
inputSchema: firecrawl.SearchGoogleParamsSchema,
|
||||||
|
tags: ['Search']
|
||||||
})
|
})
|
||||||
async searchGoogle(
|
async searchGoogle(
|
||||||
params: firecrawl.SearchGoogleParams
|
params: firecrawl.SearchGoogleParams
|
||||||
|
@ -593,7 +600,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_get_crawl_status',
|
name: 'firecrawl_get_crawl_status',
|
||||||
description: \`Get the status of a crawl job.\`,
|
description: \`Get the status of a crawl job.\`,
|
||||||
inputSchema: firecrawl.GetCrawlStatusParamsSchema
|
inputSchema: firecrawl.GetCrawlStatusParamsSchema,
|
||||||
|
tags: ['Crawl']
|
||||||
})
|
})
|
||||||
async getCrawlStatus(
|
async getCrawlStatus(
|
||||||
params: firecrawl.GetCrawlStatusParams
|
params: firecrawl.GetCrawlStatusParams
|
||||||
|
@ -609,7 +617,8 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'firecrawl_cancel_crawl_job',
|
name: 'firecrawl_cancel_crawl_job',
|
||||||
description: \`Cancel a crawl job.\`,
|
description: \`Cancel a crawl job.\`,
|
||||||
inputSchema: firecrawl.CancelCrawlJobParamsSchema
|
inputSchema: firecrawl.CancelCrawlJobParamsSchema,
|
||||||
|
tags: ['Crawl']
|
||||||
})
|
})
|
||||||
async cancelCrawlJob(
|
async cancelCrawlJob(
|
||||||
params: firecrawl.CancelCrawlJobParams
|
params: firecrawl.CancelCrawlJobParams
|
||||||
|
@ -623,22 +632,10 @@ export class FirecrawlClient extends AIFunctionsProvider {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`openapi-to-ts > notion.json 1`] = `
|
exports[`openapi-to-ts > notion.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
AIFunctionsProvider,
|
|
||||||
aiFunction,
|
|
||||||
assert,
|
|
||||||
getEnv,
|
|
||||||
pick,
|
|
||||||
sanitizeSearchParams
|
|
||||||
} from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace notion {
|
export namespace notion {
|
||||||
|
@ -2090,6 +2087,22 @@ export namespace notion {
|
||||||
export type OauthTokenParams = z.infer<typeof OauthTokenParamsSchema>
|
export type OauthTokenParams = z.infer<typeof OauthTokenParamsSchema>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
AIFunctionsProvider,
|
||||||
|
aiFunction,
|
||||||
|
assert,
|
||||||
|
getEnv,
|
||||||
|
pick,
|
||||||
|
sanitizeSearchParams
|
||||||
|
} from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { notion } from './notion'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic Notion client.
|
* Agentic Notion client.
|
||||||
*
|
*
|
||||||
|
@ -2567,20 +2580,10 @@ export class NotionClient extends AIFunctionsProvider {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`openapi-to-ts > pet-store.json 1`] = `
|
exports[`openapi-to-ts > pet-store.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
AIFunctionsProvider,
|
|
||||||
aiFunction,
|
|
||||||
pick,
|
|
||||||
sanitizeSearchParams
|
|
||||||
} from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace petstore {
|
export namespace petstore {
|
||||||
|
@ -2633,6 +2636,20 @@ export namespace petstore {
|
||||||
export type ShowPetByIdResponse = z.infer<typeof ShowPetByIdResponseSchema>
|
export type ShowPetByIdResponse = z.infer<typeof ShowPetByIdResponseSchema>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
AIFunctionsProvider,
|
||||||
|
aiFunction,
|
||||||
|
pick,
|
||||||
|
sanitizeSearchParams
|
||||||
|
} from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { petstore } from './pet-store'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic PetStore client.
|
* Agentic PetStore client.
|
||||||
*/
|
*/
|
||||||
|
@ -2664,7 +2681,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_list_pets',
|
name: 'pet_store_list_pets',
|
||||||
description: \`List all pets.\`,
|
description: \`List all pets.\`,
|
||||||
inputSchema: petstore.ListPetsParamsSchema
|
inputSchema: petstore.ListPetsParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async listPets(
|
async listPets(
|
||||||
params: petstore.ListPetsParams
|
params: petstore.ListPetsParams
|
||||||
|
@ -2682,7 +2700,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_create_pets',
|
name: 'pet_store_create_pets',
|
||||||
description: \`Create a pet.\`,
|
description: \`Create a pet.\`,
|
||||||
inputSchema: petstore.CreatePetsParamsSchema
|
inputSchema: petstore.CreatePetsParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async createPets(
|
async createPets(
|
||||||
params: petstore.CreatePetsParams
|
params: petstore.CreatePetsParams
|
||||||
|
@ -2700,7 +2719,8 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'pet_store_show_pet_by_id',
|
name: 'pet_store_show_pet_by_id',
|
||||||
description: \`Info for a specific pet.\`,
|
description: \`Info for a specific pet.\`,
|
||||||
inputSchema: petstore.ShowPetByIdParamsSchema
|
inputSchema: petstore.ShowPetByIdParamsSchema,
|
||||||
|
tags: ['pets']
|
||||||
})
|
})
|
||||||
async showPetById(
|
async showPetById(
|
||||||
params: petstore.ShowPetByIdParams
|
params: petstore.ShowPetByIdParams
|
||||||
|
@ -2714,20 +2734,10 @@ export class PetStoreClient extends AIFunctionsProvider {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`openapi-to-ts > petstore-expanded.json 1`] = `
|
exports[`openapi-to-ts > petstore-expanded.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
AIFunctionsProvider,
|
|
||||||
aiFunction,
|
|
||||||
pick,
|
|
||||||
sanitizeSearchParams
|
|
||||||
} from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace petstoreexpanded {
|
export namespace petstoreexpanded {
|
||||||
|
@ -2792,6 +2802,20 @@ export namespace petstoreexpanded {
|
||||||
export type DeletePetResponse = undefined
|
export type DeletePetResponse = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
AIFunctionsProvider,
|
||||||
|
aiFunction,
|
||||||
|
pick,
|
||||||
|
sanitizeSearchParams
|
||||||
|
} from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { petstoreexpanded } from './petstore-expanded'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic PetstoreExpanded client.
|
* Agentic PetstoreExpanded client.
|
||||||
*
|
*
|
||||||
|
@ -2897,15 +2921,10 @@ Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condime
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`openapi-to-ts > security.json 1`] = `
|
exports[`openapi-to-ts > security.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AIFunctionsProvider, aiFunction } from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace security {
|
export namespace security {
|
||||||
|
@ -3019,6 +3038,15 @@ export namespace security {
|
||||||
export type PostStatus401Response = undefined
|
export type PostStatus401Response = undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AIFunctionsProvider, aiFunction } from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { security } from './security'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic Security client.
|
* Agentic Security client.
|
||||||
*
|
*
|
||||||
|
@ -3052,7 +3080,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_get_anything_api_key',
|
name: 'security_get_anything_api_key',
|
||||||
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`apiKey\\\` query parameter.\`,
|
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`apiKey\\\` query parameter.\`,
|
||||||
inputSchema: security.GetAnythingApiKeyParamsSchema
|
inputSchema: security.GetAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async getAnythingApiKey(
|
async getAnythingApiKey(
|
||||||
_params: security.GetAnythingApiKeyParams
|
_params: security.GetAnythingApiKeyParams
|
||||||
|
@ -3068,7 +3097,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_api_key',
|
name: 'security_post_anything_api_key',
|
||||||
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`api_key\\\` cookie.\`,
|
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`api_key\\\` cookie.\`,
|
||||||
inputSchema: security.PostAnythingApiKeyParamsSchema
|
inputSchema: security.PostAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async postAnythingApiKey(
|
async postAnythingApiKey(
|
||||||
_params: security.PostAnythingApiKeyParams
|
_params: security.PostAnythingApiKeyParams
|
||||||
|
@ -3084,7 +3114,8 @@ export class SecurityClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_put_anything_api_key',
|
name: 'security_put_anything_api_key',
|
||||||
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`X-API-KEY\\\` header.\`,
|
description: \`\\\`apiKey\\\` auth will be supplied within an \\\`X-API-KEY\\\` header.\`,
|
||||||
inputSchema: security.PutAnythingApiKeyParamsSchema
|
inputSchema: security.PutAnythingApiKeyParamsSchema,
|
||||||
|
tags: ['API Key']
|
||||||
})
|
})
|
||||||
async putAnythingApiKey(
|
async putAnythingApiKey(
|
||||||
_params: security.PutAnythingApiKeyParams
|
_params: security.PutAnythingApiKeyParams
|
||||||
|
@ -3104,7 +3135,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
description: \`Authentication credentials will be supplied within a \\\`Basic\\\` \\\`Authorization\\\` header.
|
description: \`Authentication credentials will be supplied within a \\\`Basic\\\` \\\`Authorization\\\` header.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.\`,
|
||||||
inputSchema: security.PostAnythingBasicParamsSchema
|
inputSchema: security.PostAnythingBasicParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async postAnythingBasic(
|
async postAnythingBasic(
|
||||||
_params: security.PostAnythingBasicParams
|
_params: security.PostAnythingBasicParams
|
||||||
|
@ -3124,7 +3156,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
description: \`Authentication credentials will be supplied within a \\\`Bearer\\\` \\\`Authorization\\\` header.
|
description: \`Authentication credentials will be supplied within a \\\`Bearer\\\` \\\`Authorization\\\` header.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-authentication-sample.\`,
|
||||||
inputSchema: security.PostAnythingBearerParamsSchema
|
inputSchema: security.PostAnythingBearerParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async postAnythingBearer(
|
async postAnythingBearer(
|
||||||
_params: security.PostAnythingBearerParams
|
_params: security.PostAnythingBearerParams
|
||||||
|
@ -3150,7 +3183,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#basic-a
|
||||||
|
|
||||||
> ℹ️
|
> ℹ️
|
||||||
> We currently do not support any special handling for this so they're handled as a standard \\\`Bearer\\\` authentication token.\`,
|
> We currently do not support any special handling for this so they're handled as a standard \\\`Bearer\\\` authentication token.\`,
|
||||||
inputSchema: security.PutAnythingBearerParamsSchema
|
inputSchema: security.PutAnythingBearerParamsSchema,
|
||||||
|
tags: ['HTTP']
|
||||||
})
|
})
|
||||||
async putAnythingBearer(
|
async putAnythingBearer(
|
||||||
_params: security.PutAnythingBearerParams
|
_params: security.PutAnythingBearerParams
|
||||||
|
@ -3172,7 +3206,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
||||||
inputSchema: security.GetAnythingOauth2ParamsSchema
|
inputSchema: security.GetAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async getAnythingOauth2(
|
async getAnythingOauth2(
|
||||||
_params: security.GetAnythingOauth2Params
|
_params: security.GetAnythingOauth2Params
|
||||||
|
@ -3194,7 +3229,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
||||||
inputSchema: security.PostAnythingOauth2ParamsSchema
|
inputSchema: security.PostAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async postAnythingOauth2(
|
async postAnythingOauth2(
|
||||||
_params: security.PostAnythingOauth2Params
|
_params: security.PostAnythingOauth2Params
|
||||||
|
@ -3216,7 +3252,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
||||||
inputSchema: security.PutAnythingOauth2ParamsSchema
|
inputSchema: security.PutAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async putAnythingOauth2(
|
async putAnythingOauth2(
|
||||||
_params: security.PutAnythingOauth2Params
|
_params: security.PutAnythingOauth2Params
|
||||||
|
@ -3238,7 +3275,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
||||||
inputSchema: security.DeleteAnythingOauth2ParamsSchema
|
inputSchema: security.DeleteAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async deleteAnythingOauth2(
|
async deleteAnythingOauth2(
|
||||||
_params: security.DeleteAnythingOauth2Params
|
_params: security.DeleteAnythingOauth2Params
|
||||||
|
@ -3260,7 +3298,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
> We currently do not handle OAuth 2 authentication flows so if an operation has an \\\`oauth2\\\` requirement we assume that the user, or the projects JWT, has a qualified \\\`bearer\\\` token and will use that.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-23.\`,
|
||||||
inputSchema: security.PatchAnythingOauth2ParamsSchema
|
inputSchema: security.PatchAnythingOauth2ParamsSchema,
|
||||||
|
tags: ['OAuth 2']
|
||||||
})
|
})
|
||||||
async patchAnythingOauth2(
|
async patchAnythingOauth2(
|
||||||
_params: security.PatchAnythingOauth2Params
|
_params: security.PatchAnythingOauth2Params
|
||||||
|
@ -3276,7 +3315,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_open_id_connect',
|
name: 'security_post_anything_open_id_connect',
|
||||||
description: \`🚧 This is not supported.\`,
|
description: \`🚧 This is not supported.\`,
|
||||||
inputSchema: security.PostAnythingOpenIdConnectParamsSchema
|
inputSchema: security.PostAnythingOpenIdConnectParamsSchema,
|
||||||
|
tags: ['OpenID Connect']
|
||||||
})
|
})
|
||||||
async postAnythingOpenIdConnect(
|
async postAnythingOpenIdConnect(
|
||||||
_params: security.PostAnythingOpenIdConnectParams
|
_params: security.PostAnythingOpenIdConnectParams
|
||||||
|
@ -3292,7 +3332,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-f
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_anything_no_auth',
|
name: 'security_post_anything_no_auth',
|
||||||
description: \`This operation does not have any authentication requirements.\`,
|
description: \`This operation does not have any authentication requirements.\`,
|
||||||
inputSchema: security.PostAnythingNoAuthParamsSchema
|
inputSchema: security.PostAnythingNoAuthParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async postAnythingNoAuth(
|
async postAnythingNoAuth(
|
||||||
_params: security.PostAnythingNoAuthParams
|
_params: security.PostAnythingNoAuthParams
|
||||||
|
@ -3312,7 +3353,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
|
||||||
description: \`The \\\`apiKey\\\` query parameter auth on this operation is optional.
|
description: \`The \\\`apiKey\\\` query parameter auth on this operation is optional.
|
||||||
|
|
||||||
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object.\`,
|
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object.\`,
|
||||||
inputSchema: security.GetAnythingOptionalAuthParamsSchema
|
inputSchema: security.GetAnythingOptionalAuthParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async getAnythingOptionalAuth(
|
async getAnythingOptionalAuth(
|
||||||
_params: security.GetAnythingOptionalAuthParams
|
_params: security.GetAnythingOptionalAuthParams
|
||||||
|
@ -3328,7 +3370,8 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'security_post_status401',
|
name: 'security_post_status401',
|
||||||
description: \`This endpoint requires an authentication header but making any request to it will forcefully return a 401 status code for invalid auth.\`,
|
description: \`This endpoint requires an authentication header but making any request to it will forcefully return a 401 status code for invalid auth.\`,
|
||||||
inputSchema: security.PostStatus401ParamsSchema
|
inputSchema: security.PostStatus401ParamsSchema,
|
||||||
|
tags: ['Other']
|
||||||
})
|
})
|
||||||
async postStatus401(
|
async postStatus401(
|
||||||
_params: security.PostStatus401Params
|
_params: security.PostStatus401Params
|
||||||
|
@ -3340,15 +3383,10 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`openapi-to-ts > tic-tac-toe.json 1`] = `
|
exports[`openapi-to-ts > tic-tac-toe.json 1`] = `
|
||||||
"/* eslint-disable unicorn/no-unreadable-iife */
|
"/**
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AIFunctionsProvider, aiFunction } from '@agentic/core'
|
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export namespace tictactoe {
|
export namespace tictactoe {
|
||||||
|
@ -3403,6 +3441,15 @@ export namespace tictactoe {
|
||||||
export type PutSquareResponse = z.infer<typeof PutSquareResponseSchema>
|
export type PutSquareResponse = z.infer<typeof PutSquareResponseSchema>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AIFunctionsProvider, aiFunction } from '@agentic/core'
|
||||||
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
|
import { tictactoe } from './tic-tac-toe'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agentic TicTacToe client.
|
* Agentic TicTacToe client.
|
||||||
*
|
*
|
||||||
|
@ -3438,7 +3485,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_get_board',
|
name: 'tic_tac_toe_get_board',
|
||||||
description: \`Retrieves the current state of the board and the winner.\`,
|
description: \`Retrieves the current state of the board and the winner.\`,
|
||||||
inputSchema: tictactoe.GetBoardParamsSchema
|
inputSchema: tictactoe.GetBoardParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async getBoard(
|
async getBoard(
|
||||||
_params: tictactoe.GetBoardParams
|
_params: tictactoe.GetBoardParams
|
||||||
|
@ -3452,7 +3500,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_get_square',
|
name: 'tic_tac_toe_get_square',
|
||||||
description: \`Retrieves the requested square.\`,
|
description: \`Retrieves the requested square.\`,
|
||||||
inputSchema: tictactoe.GetSquareParamsSchema
|
inputSchema: tictactoe.GetSquareParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async getSquare(
|
async getSquare(
|
||||||
_params: tictactoe.GetSquareParams
|
_params: tictactoe.GetSquareParams
|
||||||
|
@ -3468,7 +3517,8 @@ export class TicTacToeClient extends AIFunctionsProvider {
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: 'tic_tac_toe_put_square',
|
name: 'tic_tac_toe_put_square',
|
||||||
description: \`Places a mark on the board and retrieves the whole board and the winner (if any).\`,
|
description: \`Places a mark on the board and retrieves the whole board and the winner (if any).\`,
|
||||||
inputSchema: tictactoe.PutSquareParamsSchema
|
inputSchema: tictactoe.PutSquareParamsSchema,
|
||||||
|
tags: ['Gameplay']
|
||||||
})
|
})
|
||||||
async putSquare(
|
async putSquare(
|
||||||
_params: tictactoe.PutSquareParams
|
_params: tictactoe.PutSquareParams
|
||||||
|
|
|
@ -75,6 +75,7 @@ export async function generateTSFromOpenAPI({
|
||||||
const namespaceName = nameLowerCase
|
const namespaceName = nameLowerCase
|
||||||
|
|
||||||
const destFileClient = path.join(outputDir, `${nameKebabCase}-client.ts`)
|
const destFileClient = path.join(outputDir, `${nameKebabCase}-client.ts`)
|
||||||
|
const destFileTypes = path.join(outputDir, `${nameKebabCase}.ts`)
|
||||||
const apiBaseUrl = spec.servers?.[0]?.url
|
const apiBaseUrl = spec.servers?.[0]?.url
|
||||||
|
|
||||||
const securitySchemes = spec.components?.securitySchemes
|
const securitySchemes = spec.components?.securitySchemes
|
||||||
|
@ -515,12 +516,15 @@ export async function generateTSFromOpenAPI({
|
||||||
operation.description || operation.summary
|
operation.description || operation.summary
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const { tags } = operation
|
||||||
|
const hasTags = !!tags?.length
|
||||||
|
|
||||||
const aiClientMethod = `
|
const aiClientMethod = `
|
||||||
${description ? `/**\n * ${description}\n */` : ''}
|
${description ? `/**\n * ${description}\n */` : ''}
|
||||||
@aiFunction({
|
@aiFunction({
|
||||||
name: '${operationNameSnakeCase}',
|
name: '${operationNameSnakeCase}',
|
||||||
${description ? `description: \`${description.replaceAll('`', '\\`')}\`,` : ''}${hasUnionParams ? '\n// TODO: Improve handling of union params' : ''}
|
${description ? `description: \`${description.replaceAll('`', '\\`')}\`,` : ''}${hasUnionParams ? '\n// TODO: Improve handling of union params' : ''}
|
||||||
inputSchema: ${namespaceName}.${operationParamsName}Schema${hasUnionParams ? ' as any' : ''},
|
inputSchema: ${namespaceName}.${operationParamsName}Schema${hasUnionParams ? ' as any' : ''}, ${hasTags ? `tags: [ '${tags.join("', '")}' ]` : ''}
|
||||||
})
|
})
|
||||||
async ${operationName}(${!hasParams ? '_' : ''}params: ${namespaceName}.${operationParamsName}): Promise<${namespaceName}.${operationResponseName}> {
|
async ${operationName}(${!hasParams ? '_' : ''}params: ${namespaceName}.${operationParamsName}): Promise<${namespaceName}.${operationResponseName}> {
|
||||||
return this.ky.${method}(${pathTemplate}${
|
return this.ky.${method}(${pathTemplate}${
|
||||||
|
@ -613,10 +617,24 @@ export async function generateTSFromOpenAPI({
|
||||||
|
|
||||||
const aiClientMethodsString = aiClientMethods.join('\n\n')
|
const aiClientMethodsString = aiClientMethods.join('\n\n')
|
||||||
|
|
||||||
const header = `
|
const prettifyImpl = async (code: string) => {
|
||||||
/* eslint-disable unicorn/no-unreadable-iife */
|
if (prettier) {
|
||||||
/* eslint-disable unicorn/no-array-reduce */
|
code = await prettify(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
return code
|
||||||
|
.replaceAll(/z\s*\.object\({}\)\s*\.merge\(([^)]*)\)/gm, '$1')
|
||||||
|
.replaceAll(/\/\*\*(\S.*\S)\*\//g, '/** $1 */')
|
||||||
|
}
|
||||||
|
|
||||||
|
const typesHeader = `
|
||||||
|
/**
|
||||||
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { z } from 'zod'`.trim()
|
||||||
|
|
||||||
|
const clientHeader = `
|
||||||
/**
|
/**
|
||||||
* This file was auto-generated from an OpenAPI spec.
|
* This file was auto-generated from an OpenAPI spec.
|
||||||
*/
|
*/
|
||||||
|
@ -630,11 +648,12 @@ import {
|
||||||
${aiClientMethodsString.includes('sanitizeSearchParams(') ? 'sanitizeSearchParams,' : ''}
|
${aiClientMethodsString.includes('sanitizeSearchParams(') ? 'sanitizeSearchParams,' : ''}
|
||||||
} from '@agentic/core'
|
} from '@agentic/core'
|
||||||
import defaultKy, { type KyInstance } from 'ky'
|
import defaultKy, { type KyInstance } from 'ky'
|
||||||
import { z } from 'zod'`.trim()
|
import { ${namespaceName} } from './${nameKebabCase}'`.trim()
|
||||||
|
|
||||||
const commentLine = `// ${'-'.repeat(77)}`
|
const commentLine = `// ${'-'.repeat(77)}`
|
||||||
const outputTypes = [
|
const typesOutput = await prettifyImpl(
|
||||||
header,
|
[
|
||||||
|
typesHeader,
|
||||||
`export namespace ${namespaceName} {`,
|
`export namespace ${namespaceName} {`,
|
||||||
apiBaseUrl ? `export const apiBaseUrl = '${apiBaseUrl}'` : undefined,
|
apiBaseUrl ? `export const apiBaseUrl = '${apiBaseUrl}'` : undefined,
|
||||||
Object.values(componentSchemas).length
|
Object.values(componentSchemas).length
|
||||||
|
@ -649,14 +668,13 @@ import { z } from 'zod'`.trim()
|
||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join('\n\n')
|
.join('\n\n')
|
||||||
|
)
|
||||||
|
|
||||||
const description = getDescription(spec.info?.description)
|
const description = getDescription(spec.info?.description)
|
||||||
const prettifyImpl = prettier ? prettify : (code: string) => code
|
|
||||||
|
|
||||||
const output = (
|
const clientOutput = await prettifyImpl(
|
||||||
await prettifyImpl(
|
|
||||||
[
|
[
|
||||||
outputTypes,
|
clientHeader,
|
||||||
`
|
`
|
||||||
/**
|
/**
|
||||||
* Agentic ${name} client.${description ? `\n *\n * ${description}` : ''}
|
* Agentic ${name} client.${description ? `\n *\n * ${description}` : ''}
|
||||||
|
@ -704,19 +722,24 @@ export class ${clientName} extends AIFunctionsProvider {
|
||||||
'}'
|
'}'
|
||||||
].join('\n\n')
|
].join('\n\n')
|
||||||
)
|
)
|
||||||
)
|
|
||||||
.replaceAll(/z\s*\.object\({}\)\s*\.merge\(([^)]*)\)/gm, '$1')
|
|
||||||
.replaceAll(/\/\*\*(\S.*\S)\*\//g, '/** $1 */')
|
|
||||||
|
|
||||||
|
const output = [typesOutput, clientOutput].join('\n\n')
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
await fs.mkdir(outputDir, { recursive: true })
|
await fs.mkdir(outputDir, { recursive: true })
|
||||||
await fs.writeFile(destFileClient, output)
|
await fs.writeFile(destFileTypes, typesOutput)
|
||||||
|
await fs.writeFile(destFileClient, clientOutput)
|
||||||
|
|
||||||
if (eslint) {
|
if (eslint) {
|
||||||
await execa('npx', ['eslint', '--fix', '--no-ignore', destFileClient])
|
await execa('npx', [
|
||||||
|
'eslint',
|
||||||
|
'--fix',
|
||||||
|
'--no-ignore',
|
||||||
|
destFileClient,
|
||||||
|
destFileTypes
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"@agentic/apollo": "workspace:*",
|
"@agentic/apollo": "workspace:*",
|
||||||
"@agentic/arxiv": "workspace:*",
|
"@agentic/arxiv": "workspace:*",
|
||||||
"@agentic/bing": "workspace:*",
|
"@agentic/bing": "workspace:*",
|
||||||
|
"@agentic/brave-search": "workspace:*",
|
||||||
"@agentic/calculator": "workspace:*",
|
"@agentic/calculator": "workspace:*",
|
||||||
"@agentic/clearbit": "workspace:*",
|
"@agentic/clearbit": "workspace:*",
|
||||||
"@agentic/core": "workspace:*",
|
"@agentic/core": "workspace:*",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export * from '@agentic/apollo'
|
export * from '@agentic/apollo'
|
||||||
export * from '@agentic/arxiv'
|
export * from '@agentic/arxiv'
|
||||||
export * from '@agentic/bing'
|
export * from '@agentic/bing'
|
||||||
|
export * from '@agentic/brave-search'
|
||||||
export * from '@agentic/calculator'
|
export * from '@agentic/calculator'
|
||||||
export * from '@agentic/clearbit'
|
export * from '@agentic/clearbit'
|
||||||
export * from '@agentic/dexa'
|
export * from '@agentic/dexa'
|
||||||
|
|
|
@ -541,6 +541,22 @@ importers:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../tsconfig
|
version: link:../tsconfig
|
||||||
|
|
||||||
|
packages/brave-search:
|
||||||
|
dependencies:
|
||||||
|
'@agentic/core':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../core
|
||||||
|
ky:
|
||||||
|
specifier: 'catalog:'
|
||||||
|
version: 1.7.5
|
||||||
|
zod:
|
||||||
|
specifier: 'catalog:'
|
||||||
|
version: 3.24.2
|
||||||
|
devDependencies:
|
||||||
|
'@agentic/tsconfig':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../tsconfig
|
||||||
|
|
||||||
packages/calculator:
|
packages/calculator:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@agentic/core':
|
'@agentic/core':
|
||||||
|
@ -1222,6 +1238,9 @@ importers:
|
||||||
'@agentic/bing':
|
'@agentic/bing':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../bing
|
version: link:../bing
|
||||||
|
'@agentic/brave-search':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../brave-search
|
||||||
'@agentic/calculator':
|
'@agentic/calculator':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../calculator
|
version: link:../calculator
|
||||||
|
|
|
@ -183,6 +183,7 @@ Full docs are available at [agentic.so](https://agentic.so).
|
||||||
| [Apollo](https://docs.apollo.io) | `@agentic/apollo` | [docs](https://agentic.so/tools/apollo) | B2B person and company enrichment API. |
|
| [Apollo](https://docs.apollo.io) | `@agentic/apollo` | [docs](https://agentic.so/tools/apollo) | B2B person and company enrichment API. |
|
||||||
| [ArXiv](https://arxiv.org) | `@agentic/arxiv` | [docs](https://agentic.so/tools/arxiv) | Search for research articles. |
|
| [ArXiv](https://arxiv.org) | `@agentic/arxiv` | [docs](https://agentic.so/tools/arxiv) | Search for research articles. |
|
||||||
| [Bing](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) | `@agentic/bing` | [docs](https://agentic.so/tools/bing) | Bing web search. |
|
| [Bing](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) | `@agentic/bing` | [docs](https://agentic.so/tools/bing) | Bing web search. |
|
||||||
|
| [Brave Search](https://brave.com/search/api) | `@agentic/brave-search` | [docs](https://agentic.so/tools/brave-search) | Brave web search and local places search. |
|
||||||
| [Calculator](https://github.com/josdejong/mathjs) | `@agentic/calculator` | [docs](https://agentic.so/tools/calculator) | Basic calculator for simple mathematical expressions. |
|
| [Calculator](https://github.com/josdejong/mathjs) | `@agentic/calculator` | [docs](https://agentic.so/tools/calculator) | Basic calculator for simple mathematical expressions. |
|
||||||
| [Clearbit](https://dashboard.clearbit.com/docs) | `@agentic/clearbit` | [docs](https://agentic.so/tools/clearbit) | Resolving and enriching people and company data. |
|
| [Clearbit](https://dashboard.clearbit.com/docs) | `@agentic/clearbit` | [docs](https://agentic.so/tools/clearbit) | Resolving and enriching people and company data. |
|
||||||
| [Dexa](https://dexa.ai) | `@agentic/dexa` | [docs](https://agentic.so/tools/dexa) | Answers questions from the world's best podcasters. |
|
| [Dexa](https://dexa.ai) | `@agentic/dexa` | [docs](https://agentic.so/tools/dexa) | Answers questions from the world's best podcasters. |
|
||||||
|
|
Ładowanie…
Reference in New Issue