pull/715/head
Travis Fischer 2025-05-25 18:17:40 +07:00
rodzic 195fff1e23
commit bf7f8f60f4
3 zmienionych plików z 66 dodań i 8 usunięć

Wyświetl plik

@ -9,14 +9,14 @@ export default defineConfig({
{ {
name: 'Basic', name: 'Basic',
slug: 'basic', slug: 'basic',
interval: 'month', // interval: 'month',
trialPeriodDays: 7, trialPeriodDays: 7,
lineItems: [ lineItems: [
{ {
slug: 'base', slug: 'base',
usageType: 'licensed', usageType: 'licensed',
amount: 490, amount: 490
interval: 'month' // interval: 'month'
} }
] ]
} }

Wyświetl plik

@ -2,6 +2,7 @@ import { z } from '@hono/zod-openapi'
import { import {
deploymentOriginAdapterSchema, deploymentOriginAdapterSchema,
pricingIntervalSchema,
type PricingPlan, type PricingPlan,
pricingPlanListSchema pricingPlanListSchema
} from './schemas' } from './schemas'
@ -29,24 +30,31 @@ export const freePricingPlan = {
} as const satisfies PricingPlan } as const satisfies PricingPlan
export const agenticProjectConfigSchema = z.object({ export const agenticProjectConfigSchema = z.object({
/** Required name of the project. */
name: z.string().describe('Name of the project.'), name: z.string().describe('Name of the project.'),
// Metadata /** Optional one-sentence description of the project. */
description: z description: z
.string() .string()
.describe('A one-sentence description of the project.') .describe('A one-sentence description of the project.')
.optional(), .optional(),
/** Optional readme documenting the project (supports GitHub-flavored markdown). */
readme: z readme: z
.string() .string()
.describe( .describe(
'A readme documenting the project (supports GitHub-flavored markdown).' 'A readme documenting the project (supports GitHub-flavored markdown).'
) )
.optional(), .optional(),
/** Optional URL to the source code for the project. */
sourceUrl: z sourceUrl: z
.string() .string()
.url() .url()
.optional() .optional()
.describe('Optional URL to the source code for the project.'), .describe('Optional URL to the source code for the project.'),
/** Optional logo image URL to use for the project. Logos should have a square aspect ratio. */
iconUrl: z iconUrl: z
.string() .string()
.url() .url()
@ -55,13 +63,13 @@ export const agenticProjectConfigSchema = z.object({
'Optional logo image URL to use for the project. Logos should have a square aspect ratio.' 'Optional logo image URL to use for the project. Logos should have a square aspect ratio.'
), ),
// Required origin API config /** Required origin API HTTPS base URL */
originUrl: z.string().url() originUrl: z.string().url()
.describe(`Required base URL of the externally hosted origin API server. Must be a valid \`https\` URL. .describe(`Required base URL of the externally hosted origin API server. Must be a valid \`https\` URL.
NOTE: Agentic currently only supports \`external\` API servers. If you'd like to host your API or MCP server on Agentic's infrastructure, please reach out to support@agentic.so.`), NOTE: Agentic currently only supports \`external\` API servers. If you'd like to host your API or MCP server on Agentic's infrastructure, please reach out to support@agentic.so.`),
// Optional origin API config /** Optional origin API config */
originAdapter: deploymentOriginAdapterSchema originAdapter: deploymentOriginAdapterSchema
.default({ .default({
location: 'external', location: 'external',
@ -69,13 +77,22 @@ NOTE: Agentic currently only supports \`external\` API servers. If you'd like to
}) })
.optional(), .optional(),
// Optional subscription pricing config /** Optional subscription pricing config */
pricingPlans: pricingPlanListSchema pricingPlans: pricingPlanListSchema
.describe( .describe(
'List of PricingPlans configuring which Stripe subscriptions should be available for the project. Defaults to a single free plan which is useful for developing and testing.your project.' 'List of PricingPlans configuring which Stripe subscriptions should be available for the project. Defaults to a single free plan which is useful for developing and testing.your project.'
) )
.default([freePricingPlan]) .default([freePricingPlan])
.optional() .optional(),
/**
* Optional list of billing intervals to enable in the pricingPlans.
*
* Defaults to a single monthly interval `['month']`.
*
* To add an annual plan, you can use `['month', 'year']`.
*/
pricingIntervals: z.array(pricingIntervalSchema).default(['month']).optional()
}) })
export type AgenticProjectConfigInput = z.input< export type AgenticProjectConfigInput = z.input<
typeof agenticProjectConfigSchema typeof agenticProjectConfigSchema

Wyświetl plik

@ -9,6 +9,9 @@ export const webhookSchema = z
.openapi('Webhook') .openapi('Webhook')
export type Webhook = z.infer<typeof webhookSchema> export type Webhook = z.infer<typeof webhookSchema>
/**
* Rate limit config for metered line-items.
*/
export const rateLimitSchema = z export const rateLimitSchema = z
.object({ .object({
interval: z.number(), // seconds interval: z.number(), // seconds
@ -17,6 +20,9 @@ export const rateLimitSchema = z
.openapi('RateLimit') .openapi('RateLimit')
export type RateLimit = z.infer<typeof rateLimitSchema> export type RateLimit = z.infer<typeof rateLimitSchema>
/**
* PricingPlanTier is a single tier in a tiered pricing plan.
*/
export const pricingPlanTierSchema = z export const pricingPlanTierSchema = z
.object({ .object({
unitAmount: z.number().optional(), unitAmount: z.number().optional(),
@ -33,6 +39,9 @@ export const pricingPlanTierSchema = z
.openapi('PricingPlanTier') .openapi('PricingPlanTier')
export type PricingPlanTier = z.infer<typeof pricingPlanTierSchema> export type PricingPlanTier = z.infer<typeof pricingPlanTierSchema>
/**
* The frequency at which a subscription is billed.
*/
export const pricingIntervalSchema = z export const pricingIntervalSchema = z
.union([ .union([
z.literal('day'), z.literal('day'),
@ -44,11 +53,19 @@ export const pricingIntervalSchema = z
.openapi('PricingInterval') .openapi('PricingInterval')
export type PricingInterval = z.infer<typeof pricingIntervalSchema> export type PricingInterval = z.infer<typeof pricingIntervalSchema>
/**
* Internal PricingPlanLineItem hash
*
* @internal
*/
export const pricingPlanLineItemHashSchema = z export const pricingPlanLineItemHashSchema = z
.string() .string()
.nonempty() .nonempty()
.describe('Internal PricingPlanLineItem hash') .describe('Internal PricingPlanLineItem hash')
/**
* PricingPlanLineItem slug which acts as a unique lookup key for LineItems across deployments. They must be lower and kebab-cased ("base", "requests", "image-transformations").
*/
export const pricingPlanLineItemSlugSchema = z export const pricingPlanLineItemSlugSchema = z
.string() .string()
.nonempty() .nonempty()
@ -56,6 +73,9 @@ export const pricingPlanLineItemSlugSchema = z
'PricingPlanLineItem slug which acts as a unique lookup key for LineItems across deployments. They must be lower and kebab-cased ("base", "requests", "image-transformations").' 'PricingPlanLineItem slug which acts as a unique lookup key for LineItems across deployments. They must be lower and kebab-cased ("base", "requests", "image-transformations").'
) )
/**
* PricingPlan slug which acts as a unique lookup key for PricingPlans across deployments. They must be lower and kebab-cased and should have the interval as a suffix ("free", "starter-monthly", "pro-annual").
*/
export const pricingPlanSlugSchema = z export const pricingPlanSlugSchema = z
.string() .string()
.nonempty() .nonempty()
@ -63,12 +83,18 @@ export const pricingPlanSlugSchema = z
'PricingPlan slug which acts as a unique lookup key for PricingPlans across deployments. They must be lower and kebab-cased and should have the interval as a suffix ("free", "starter-monthly", "pro-annual").' 'PricingPlan slug which acts as a unique lookup key for PricingPlans across deployments. They must be lower and kebab-cased and should have the interval as a suffix ("free", "starter-monthly", "pro-annual").'
) )
/**
* Map from internal PricingPlanLineItem **hash** to Stripe Price id
*/
export const stripePriceIdMapSchema = z export const stripePriceIdMapSchema = z
.record(pricingPlanLineItemHashSchema, z.string().describe('Stripe Price id')) .record(pricingPlanLineItemHashSchema, z.string().describe('Stripe Price id'))
.describe('Map from internal PricingPlanLineItem **hash** to Stripe Price id') .describe('Map from internal PricingPlanLineItem **hash** to Stripe Price id')
.openapi('StripePriceIdMap') .openapi('StripePriceIdMap')
export type StripePriceIdMap = z.infer<typeof stripePriceIdMapSchema> export type StripePriceIdMap = z.infer<typeof stripePriceIdMapSchema>
/**
* Map from internal PricingPlanLineItem **slug** to Stripe Meter id
*/
export const stripeMeterIdMapSchema = z export const stripeMeterIdMapSchema = z
.record(pricingPlanLineItemHashSchema, z.string().describe('Stripe Meter id')) .record(pricingPlanLineItemHashSchema, z.string().describe('Stripe Meter id'))
.describe('Map from internal PricingPlanLineItem **slug** to Stripe Meter id') .describe('Map from internal PricingPlanLineItem **slug** to Stripe Meter id')
@ -314,6 +340,9 @@ export const pricingPlanSchema = z
.openapi('PricingPlan') .openapi('PricingPlan')
export type PricingPlan = z.infer<typeof pricingPlanSchema> export type PricingPlan = z.infer<typeof pricingPlanSchema>
/**
* Map from PricingPlanLineItem **slug** to Stripe Product id
*/
export const stripeProductIdMapSchema = z export const stripeProductIdMapSchema = z
.record( .record(
pricingPlanLineItemSlugSchema, pricingPlanLineItemSlugSchema,
@ -323,6 +352,9 @@ export const stripeProductIdMapSchema = z
.openapi('StripeProductIdMap') .openapi('StripeProductIdMap')
export type StripeProductIdMap = z.infer<typeof stripeProductIdMapSchema> export type StripeProductIdMap = z.infer<typeof stripeProductIdMapSchema>
/**
* List of PricingPlans
*/
export const pricingPlanListSchema = z export const pricingPlanListSchema = z
.array(pricingPlanSchema) .array(pricingPlanSchema)
.nonempty({ .nonempty({
@ -374,6 +406,9 @@ export const pricingPlanListSchema = z
.describe('List of PricingPlans') .describe('List of PricingPlans')
export type PricingPlanList = z.infer<typeof pricingPlanListSchema> export type PricingPlanList = z.infer<typeof pricingPlanListSchema>
/**
* Map from internal PricingPlanLineItem **slug** to Stripe Subscription Item id
*/
export const stripeSubscriptionItemIdMapSchema = z export const stripeSubscriptionItemIdMapSchema = z
.record( .record(
pricingPlanLineItemSlugSchema, pricingPlanLineItemSlugSchema,
@ -442,6 +477,12 @@ export const commonDeploymentOriginAdapterSchema = z.object({
// - internal mcp // - internal mcp
// - internal http // - internal http
// - etc // - etc
/**
* Deployment origin API adapter is used to configure the origin API server downstream from Agentic's API gateway. It specifies whether the origin API server denoted by `originUrl` is hosted externally or deployed internally to Agentic's infrastructure. It also specifies the format for how origin tools / services are defined: either as an OpenAPI spec, an MCP server, or as a raw HTTP REST API.
NOTE: Agentic currently only supports `external` API servers. If you'd like to host your API or MCP server on Agentic's infrastructure, please reach out to support@agentic.so.
*/
export const deploymentOriginAdapterSchema = z export const deploymentOriginAdapterSchema = z
.discriminatedUnion('type', [ .discriminatedUnion('type', [
z z