pull/715/head
Travis Fischer 2025-05-23 01:33:15 +07:00
rodzic 02343674b5
commit 1c49528fb5
6 zmienionych plików z 98 dodań i 4 usunięć

Wyświetl plik

@ -0,0 +1,87 @@
import 'dotenv/config'
import { z } from '@hono/zod-openapi'
import restoreCursor from 'restore-cursor'
import { zodToJsonSchema } from 'zod-to-json-schema'
import { deploymentOriginAdapterSchema, pricingPlanListSchema } from '@/db'
// TODO:
// - **service / tool definitions**
// - optional per-service config (PricingPlanServiceConfigMap)
// - optional external auth provider config (google, github, twitter, etc)
// - origin adapter openapi schema path, url, or in-place definition
// - optional stripe webhooks
// - optional response header config (custom headers, immutability for caching, etc)
const publicSchema = z.object({
name: z.string().describe('The name of the project.'),
// Metadata
description: z
.string()
.describe('A one-sentence description of the project.')
.optional(),
readme: z
.string()
.describe(
'A readme documenting the project (supports GitHub-flavored markdown).'
)
.optional(),
sourceUrl: z
.string()
.url()
.optional()
.describe('Optional URL to the source code for this project.'),
iconUrl: z
.string()
.url()
.optional()
.describe(
'Optional logo image URL to use for this project. Logos should have a square aspect ratio.'
),
// Required origin API config
originUrl: z.string().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.`),
// Optional origin API config
originAdapter: deploymentOriginAdapterSchema
.default({
location: 'external',
type: 'raw'
})
.optional(),
// Optional subscription pricing config
pricingPlans: pricingPlanListSchema
.describe(
'List of PricingPlans to enable subscriptions for this project. Defaults to a single free tier.'
)
.default([
{
name: 'Free',
slug: 'free',
lineItems: [
{
slug: 'base',
usageType: 'licensed',
amount: 0
}
]
}
])
})
async function main() {
restoreCursor()
const publicJsonSchema = zodToJsonSchema(publicSchema)
// eslint-disable-next-line no-console
console.log(JSON.stringify(publicJsonSchema, null, 2))
}
await main()

Wyświetl plik

@ -55,6 +55,7 @@
"@types/semver": "^7.7.0",
"drizzle-kit": "^0.31.1",
"drizzle-orm": "^0.43.1",
"openapi-typescript": "^7.8.0"
"openapi-typescript": "^7.8.0",
"zod-to-json-schema": "^3.24.5"
}
}

Wyświetl plik

@ -53,6 +53,7 @@ export const deployments = pgTable(
description: text().default('').notNull(),
readme: text().default('').notNull(),
iconUrl: text(),
sourceUrl: text(),
userId: userId()
.notNull()
@ -164,9 +165,11 @@ export const deploymentInsertSchema = createInsertSchema(deployments, {
schema
.url()
.describe(
'Logo image URL to use for this delpoyment. Logos should have a square aspect ratio.'
'Logo image URL to use for this deployment. Logos should have a square aspect ratio.'
),
sourceUrl: (schema) => schema.url(),
originUrl: (schema) =>
schema.url().describe(`Base URL of the externally hosted origin API server.

Wyświetl plik

@ -296,7 +296,7 @@ export const pricingPlanSchema = z
interval: pricingIntervalSchema.optional(),
desc: z.string().optional(),
features: z.array(z.string()),
features: z.array(z.string()).optional(),
// TODO?
trialPeriodDays: z.number().nonnegative().optional(),

Wyświetl plik

@ -6,6 +6,6 @@
"@/*": ["src/*"]
}
},
"include": ["src", "*.config.ts", "../../packages/core/src/errors.ts"],
"include": ["src", "*.config.ts", "bin/*"],
"exclude": ["node_modules", "dist"]
}

Wyświetl plik

@ -213,6 +213,9 @@ importers:
openapi-typescript:
specifier: ^7.8.0
version: 7.8.0(typescript@5.8.3)
zod-to-json-schema:
specifier: ^3.24.5
version: 3.24.5(zod@3.24.4)
packages/api-client:
dependencies: