old-agentic
Travis Fischer 2025-06-19 21:54:59 -05:00
rodzic b72a9dacce
commit 66c4040fa5
1 zmienionych plików z 0 dodań i 484 usunięć

Wyświetl plik

@ -2579,341 +2579,6 @@ export class NotionClient extends AIFunctionsProvider {
"
`;
exports[`openapi-to-ts > open-meteo.yaml 1`] = `
"/**
* This file was auto-generated from an OpenAPI spec.
*/
import { z } from 'zod'
export namespace openmeteo {
// -----------------------------------------------------------------------------
// Component schemas
// -----------------------------------------------------------------------------
/** For each selected weather variable, data will be returned as a floating point array. Additionally a \`time\` array will be returned with ISO8601 timestamps. */
export const HourlyResponseSchema = z
.object({
time: z.array(z.string()),
temperature_2m: z.array(z.number()).optional(),
relative_humidity_2m: z.array(z.number()).optional(),
dew_point_2m: z.array(z.number()).optional(),
apparent_temperature: z.array(z.number()).optional(),
pressure_msl: z.array(z.number()).optional(),
cloud_cover: z.array(z.number()).optional(),
cloud_cover_low: z.array(z.number()).optional(),
cloud_cover_mid: z.array(z.number()).optional(),
cloud_cover_high: z.array(z.number()).optional(),
wind_speed_10m: z.array(z.number()).optional(),
wind_speed_80m: z.array(z.number()).optional(),
wind_speed_120m: z.array(z.number()).optional(),
wind_speed_180m: z.array(z.number()).optional(),
wind_direction_10m: z.array(z.number()).optional(),
wind_direction_80m: z.array(z.number()).optional(),
wind_direction_120m: z.array(z.number()).optional(),
wind_direction_180m: z.array(z.number()).optional(),
wind_gusts_10m: z.array(z.number()).optional(),
shortwave_radiation: z.array(z.number()).optional(),
direct_radiation: z.array(z.number()).optional(),
direct_normal_irradiance: z.array(z.number()).optional(),
diffuse_radiation: z.array(z.number()).optional(),
vapour_pressure_deficit: z.array(z.number()).optional(),
evapotranspiration: z.array(z.number()).optional(),
precipitation: z.array(z.number()).optional(),
weather_code: z.array(z.number()).optional(),
snow_height: z.array(z.number()).optional(),
freezing_level_height: z.array(z.number()).optional(),
soil_temperature_0cm: z.array(z.number()).optional(),
soil_temperature_6cm: z.array(z.number()).optional(),
soil_temperature_18cm: z.array(z.number()).optional(),
soil_temperature_54cm: z.array(z.number()).optional(),
soil_moisture_0_1cm: z.array(z.number()).optional(),
soil_moisture_1_3cm: z.array(z.number()).optional(),
soil_moisture_3_9cm: z.array(z.number()).optional(),
soil_moisture_9_27cm: z.array(z.number()).optional(),
soil_moisture_27_81cm: z.array(z.number()).optional()
})
.describe(
'For each selected weather variable, data will be returned as a floating point array. Additionally a \`time\` array will be returned with ISO8601 timestamps.'
)
export type HourlyResponse = z.infer<typeof HourlyResponseSchema>
/** For each selected daily weather variable, data will be returned as a floating point array. Additionally a \`time\` array will be returned with ISO8601 timestamps. */
export const DailyResponseSchema = z
.object({
time: z.array(z.string()),
temperature_2m_max: z.array(z.number()).optional(),
temperature_2m_min: z.array(z.number()).optional(),
apparent_temperature_max: z.array(z.number()).optional(),
apparent_temperature_min: z.array(z.number()).optional(),
precipitation_sum: z.array(z.number()).optional(),
precipitation_hours: z.array(z.number()).optional(),
weather_code: z.array(z.number()).optional(),
sunrise: z.array(z.number()).optional(),
sunset: z.array(z.number()).optional(),
wind_speed_10m_max: z.array(z.number()).optional(),
wind_gusts_10m_max: z.array(z.number()).optional(),
wind_direction_10m_dominant: z.array(z.number()).optional(),
shortwave_radiation_sum: z.array(z.number()).optional(),
uv_index_max: z.array(z.number()).optional(),
uv_index_clear_sky_max: z.array(z.number()).optional(),
et0_fao_evapotranspiration: z.array(z.number()).optional()
})
.describe(
'For each selected daily weather variable, data will be returned as a floating point array. Additionally a \`time\` array will be returned with ISO8601 timestamps.'
)
export type DailyResponse = z.infer<typeof DailyResponseSchema>
/** Current weather conditions with the attributes: time, temperature, wind_speed, wind_direction and weather_code */
export const CurrentWeatherSchema = z
.object({
time: z.string(),
temperature: z.number(),
wind_speed: z.number(),
wind_direction: z.number(),
weather_code: z.number().int()
})
.describe(
'Current weather conditions with the attributes: time, temperature, wind_speed, wind_direction and weather_code'
)
export type CurrentWeather = z.infer<typeof CurrentWeatherSchema>
// -----------------------------------------------------------------------------
// Operation schemas
// -----------------------------------------------------------------------------
export const GetV1ForecastParamsSchema = z.object({
hourly: z
.array(
z.enum([
'temperature_2m',
'relative_humidity_2m',
'dew_point_2m',
'apparent_temperature',
'pressure_msl',
'cloud_cover',
'cloud_cover_low',
'cloud_cover_mid',
'cloud_cover_high',
'wind_speed_10m',
'wind_speed_80m',
'wind_speed_120m',
'wind_speed_180m',
'wind_direction_10m',
'wind_direction_80m',
'wind_direction_120m',
'wind_direction_180m',
'wind_gusts_10m',
'shortwave_radiation',
'direct_radiation',
'direct_normal_irradiance',
'diffuse_radiation',
'vapour_pressure_deficit',
'evapotranspiration',
'precipitation',
'weather_code',
'snow_height',
'freezing_level_height',
'soil_temperature_0cm',
'soil_temperature_6cm',
'soil_temperature_18cm',
'soil_temperature_54cm',
'soil_moisture_0_1cm',
'soil_moisture_1_3cm',
'soil_moisture_3_9cm',
'soil_moisture_9_27cm',
'soil_moisture_27_81cm'
])
)
.optional(),
daily: z
.array(
z.enum([
'temperature_2m_max',
'temperature_2m_min',
'apparent_temperature_max',
'apparent_temperature_min',
'precipitation_sum',
'precipitation_hours',
'weather_code',
'sunrise',
'sunset',
'wind_speed_10m_max',
'wind_gusts_10m_max',
'wind_direction_10m_dominant',
'shortwave_radiation_sum',
'uv_index_max',
'uv_index_clear_sky_max',
'et0_fao_evapotranspiration'
])
)
.optional(),
/** WGS84 coordinate */
latitude: z.number().describe('WGS84 coordinate'),
/** WGS84 coordinate */
longitude: z.number().describe('WGS84 coordinate'),
current_weather: z.boolean().optional(),
temperature_unit: z.enum(['celsius', 'fahrenheit']).default('celsius'),
wind_speed_unit: z.enum(['kmh', 'ms', 'mph', 'kn']).default('kmh'),
/** If format \`unixtime\` is selected, all time values are returned in UNIX epoch time in seconds. Please not that all time is then in GMT+0! For daily values with unix timestamp, please apply \`utc_offset_seconds\` again to get the correct date. */
timeformat: z
.enum(['iso8601', 'unixtime'])
.describe(
'If format \`unixtime\` is selected, all time values are returned in UNIX epoch time in seconds. Please not that all time is then in GMT+0! For daily values with unix timestamp, please apply \`utc_offset_seconds\` again to get the correct date.'
)
.default('iso8601'),
/** If \`timezone\` is set, all timestamps are returned as local-time and data is returned starting at 0:00 local-time. Any time zone name from the [time zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) is supported. */
timezone: z
.string()
.describe(
'If \`timezone\` is set, all timestamps are returned as local-time and data is returned starting at 0:00 local-time. Any time zone name from the [time zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) is supported.'
)
.optional(),
/** If \`past_days\` is set, yesterdays or the day before yesterdays data are also returned. */
past_days: z
.union([z.literal(1), z.literal(2)])
.describe(
'If \`past_days\` is set, yesterdays or the day before yesterdays data are also returned.'
)
.optional()
})
export type GetV1ForecastParams = z.infer<typeof GetV1ForecastParamsSchema>
export const GetV1ForecastResponseSchema = z.object({
/** WGS84 of the center of the weather grid-cell which was used to generate this forecast. This coordinate might be up to 5 km away. */
latitude: z
.number()
.describe(
'WGS84 of the center of the weather grid-cell which was used to generate this forecast. This coordinate might be up to 5 km away.'
)
.optional(),
/** WGS84 of the center of the weather grid-cell which was used to generate this forecast. This coordinate might be up to 5 km away. */
longitude: z
.number()
.describe(
'WGS84 of the center of the weather grid-cell which was used to generate this forecast. This coordinate might be up to 5 km away.'
)
.optional(),
/** The elevation in meters of the selected weather grid-cell. In mountain terrain it might differ from the location you would expect. */
elevation: z
.number()
.describe(
'The elevation in meters of the selected weather grid-cell. In mountain terrain it might differ from the location you would expect.'
)
.optional(),
/** Generation time of the weather forecast in milli seconds. This is mainly used for performance monitoring and improvements. */
generationtime_ms: z
.number()
.describe(
'Generation time of the weather forecast in milli seconds. This is mainly used for performance monitoring and improvements.'
)
.optional(),
/** Applied timezone offset from the &timezone= parameter. */
utc_offset_seconds: z
.number()
.int()
.describe('Applied timezone offset from the &timezone= parameter.')
.optional(),
hourly: HourlyResponseSchema.optional(),
/** For each selected weather variable, the unit will be listed here. */
hourly_units: z
.record(z.string())
.describe(
'For each selected weather variable, the unit will be listed here.'
)
.optional(),
daily: DailyResponseSchema.optional(),
/** For each selected daily weather variable, the unit will be listed here. */
daily_units: z
.record(z.string())
.describe(
'For each selected daily weather variable, the unit will be listed here.'
)
.optional(),
current_weather: CurrentWeatherSchema.optional()
})
export type GetV1ForecastResponse = z.infer<
typeof GetV1ForecastResponseSchema
>
}
/**
* This file was auto-generated from an OpenAPI spec.
*/
import {
AIFunctionsProvider,
aiFunction,
pick,
sanitizeSearchParams
} from '@agentic/core'
import defaultKy, { type KyInstance } from 'ky'
import { openmeteo } from './open-meteo'
/**
* Agentic OpenMeteo client.
*
* Open-Meteo offers free weather forecast APIs for open-source developers and non-commercial use. No API key is required.
*/
export class OpenMeteoClient extends AIFunctionsProvider {
protected readonly ky: KyInstance
protected readonly apiBaseUrl: string
constructor({
apiBaseUrl,
ky = defaultKy
}: {
apiKey?: string
apiBaseUrl?: string
ky?: KyInstance
} = {}) {
super()
this.apiBaseUrl = apiBaseUrl
this.ky = ky.extend({
prefixUrl: apiBaseUrl
})
}
/**
* 7 day weather variables in hourly and daily resolution for given WGS84 latitude and longitude coordinates. Available worldwide.
*/
@aiFunction({
name: 'open_meteo_get_v1_forecast',
description: \`7 day weather variables in hourly and daily resolution for given WGS84 latitude and longitude coordinates. Available worldwide.\`,
inputSchema: openmeteo.GetV1ForecastParamsSchema,
tags: ['Weather Forecast APIs']
})
async getV1Forecast(
params: openmeteo.GetV1ForecastParams
): Promise<openmeteo.GetV1ForecastResponse> {
return this.ky
.get('/v1/forecast', {
searchParams: sanitizeSearchParams(
pick(
params,
'hourly',
'daily',
'latitude',
'longitude',
'current_weather',
'temperature_unit',
'wind_speed_unit',
'timeformat',
'timezone',
'past_days'
)
)
})
.json<openmeteo.GetV1ForecastResponse>()
}
}
"
`;
exports[`openapi-to-ts > pet-store.json 1`] = `
"/**
* This file was auto-generated from an OpenAPI spec.
@ -3716,152 +3381,3 @@ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securit
}
"
`;
exports[`openapi-to-ts > tic-tac-toe.json 1`] = `
"/**
* 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>
}
/**
* 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.
*
* This API allows writing down marks on a Tic Tac Toe board
and requesting the state of the board or of individual squares.
.
*/
export class TicTacToeClient extends AIFunctionsProvider {
protected readonly ky: KyInstance
protected readonly apiBaseUrl: string
constructor({
apiBaseUrl,
ky = defaultKy
}: {
apiKey?: string
apiBaseUrl?: string
ky?: KyInstance
} = {}) {
super()
this.apiBaseUrl = apiBaseUrl
this.ky = ky.extend({
prefixUrl: apiBaseUrl
})
}
/**
* Retrieves the current state of the board and the winner.
*/
@aiFunction({
name: 'tic_tac_toe_get_board',
description: \`Retrieves the current state of the board and the winner.\`,
inputSchema: tictactoe.GetBoardParamsSchema,
tags: ['Gameplay']
})
async getBoard(
_params: tictactoe.GetBoardParams
): Promise<tictactoe.GetBoardResponse> {
return this.ky.get('/board').json<tictactoe.GetBoardResponse>()
}
/**
* Retrieves the requested square.
*/
@aiFunction({
name: 'tic_tac_toe_get_square',
description: \`Retrieves the requested square.\`,
inputSchema: tictactoe.GetSquareParamsSchema,
tags: ['Gameplay']
})
async getSquare(
_params: tictactoe.GetSquareParams
): Promise<tictactoe.GetSquareResponse> {
return this.ky
.get('/board/{row}/{column}')
.json<tictactoe.GetSquareResponse>()
}
/**
* Places a mark on the board and retrieves the whole board and the winner (if any).
*/
@aiFunction({
name: 'tic_tac_toe_put_square',
description: \`Places a mark on the board and retrieves the whole board and the winner (if any).\`,
inputSchema: tictactoe.PutSquareParamsSchema,
tags: ['Gameplay']
})
async putSquare(
_params: tictactoe.PutSquareParams
): Promise<tictactoe.PutSquareResponse> {
return this.ky
.put('/board/{row}/{column}')
.json<tictactoe.PutSquareResponse>()
}
}
"
`;