pull/715/head
Travis Fischer 2025-05-19 16:16:02 +07:00
rodzic e2d2303275
commit 1faf1b707a
6 zmienionych plików z 28 dodań i 13 usunięć

Wyświetl plik

@ -3,12 +3,12 @@ import { createRoute, type OpenAPIHono } from '@hono/zod-openapi'
import type { AuthenticatedEnv } from '@/lib/types'
import { schema } from '@/db'
import { acl } from '@/lib/acl'
import { tryGetDeployment } from '@/lib/deployments/try-get-deployment'
import {
openapiAuthenticatedSecuritySchemas,
openapiErrorResponse404,
openapiErrorResponses
} from '@/lib/openapi-utils'
import { tryGetDeployment } from '@/lib/try-get-deployment'
import { assert, parseZodSchema } from '@/lib/utils'
import { deploymentIdParamsSchema, populateDeploymentSchema } from './schemas'

Wyświetl plik

@ -4,12 +4,12 @@ import type { AuthenticatedEnv } from '@/lib/types'
import { schema } from '@/db'
import { acl } from '@/lib/acl'
import { publishDeployment } from '@/lib/deployments/publish-deployment'
import { tryGetDeployment } from '@/lib/deployments/try-get-deployment'
import {
openapiAuthenticatedSecuritySchemas,
openapiErrorResponse404,
openapiErrorResponses
} from '@/lib/openapi-utils'
import { tryGetDeployment } from '@/lib/try-get-deployment'
import { assert, parseZodSchema } from '@/lib/utils'
import { deploymentIdParamsSchema } from './schemas'

Wyświetl plik

@ -3,12 +3,12 @@ import { createRoute, type OpenAPIHono } from '@hono/zod-openapi'
import type { AuthenticatedEnv } from '@/lib/types'
import { db, eq, schema } from '@/db'
import { acl } from '@/lib/acl'
import { tryGetDeployment } from '@/lib/deployments/try-get-deployment'
import {
openapiAuthenticatedSecuritySchemas,
openapiErrorResponse404,
openapiErrorResponses
} from '@/lib/openapi-utils'
import { tryGetDeployment } from '@/lib/try-get-deployment'
import { assert, parseZodSchema } from '@/lib/utils'
import { deploymentIdParamsSchema } from './schemas'

Wyświetl plik

@ -176,7 +176,11 @@ NOTE: Agentic currently only supports \`external\` API servers. If you'd like to
pricingPlans: pricingPlanListSchema.describe(
'List of PricingPlans should be available as subscriptions for this deployment.'
),
originAdapter: deploymentOriginAdapterSchema.optional()
originAdapter: deploymentOriginAdapterSchema.default({
location: 'external',
type: 'raw'
})
// .optional()
// TODO
// coupons: z.array(couponSchema).optional()

Wyświetl plik

@ -452,11 +452,25 @@ export const commonDeploymentOriginAdapterSchema = z.object({
// internalType: deploymentOriginAdapterInternalTypeSchema.optional()
})
const jsonLiteralSchema = z.union([
z.string(),
z.number(),
z.boolean(),
z.null()
])
type JsonLiteral = z.infer<typeof jsonLiteralSchema>
type Json = JsonLiteral | { [key: string]: Json } | Json[]
const jsonSchema: z.ZodType<Json> = z.lazy(() =>
z.union([jsonLiteralSchema, z.array(jsonSchema), z.record(jsonSchema)])
)
const jsonObjectSchema = z.record(jsonSchema)
// TODO: add future support for:
// - external mcp
// - internal docker
// - internal mcp
// - internal http
// - etc
export const deploymentOriginAdapterSchema = z
.discriminatedUnion('type', [
z
@ -464,7 +478,9 @@ export const deploymentOriginAdapterSchema = z
type: z.literal('openapi'),
version: z.enum(['3.0', '3.1']),
// TODO: Make sure origin API servers are hidden in this embedded OpenAPI spec
spec: z.any().describe('JSON OpenAPI spec for the origin API server.')
spec: jsonObjectSchema.describe(
'JSON OpenAPI spec for the origin API server.'
)
})
.merge(commonDeploymentOriginAdapterSchema),
@ -474,10 +490,6 @@ export const deploymentOriginAdapterSchema = z
})
.merge(commonDeploymentOriginAdapterSchema)
])
.default({
location: 'external',
type: 'raw'
})
.describe(
`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.

Wyświetl plik

@ -1,10 +1,9 @@
import { parseFaasIdentifier } from '@agentic/validators'
import type { AuthenticatedContext } from '@/lib/types'
import { db, eq, type RawDeployment, schema } from '@/db'
import type { AuthenticatedContext } from './types'
import { ensureAuthUser } from './ensure-auth-user'
import { assert } from './utils'
import { ensureAuthUser } from '@/lib/ensure-auth-user'
import { assert } from '@/lib/utils'
/**
* Attempts to find the Deployment matching the given identifier.