Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions web/oss/src/components/DrillInView/OSSdrillInUIProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@

import {useMemo, type ReactNode} from "react"

import {DrillInUIProvider, type GatewayToolsBridge} from "@agenta/entity-ui/drill-in"
import {EditorProvider} from "@agenta/ui/editor"
import {SharedEditor} from "@agenta/ui/shared-editor"
import {useSetAtom} from "jotai"

import {
buildToolSlug,
catalogDrawerOpenAtom,
fetchActionDetail as fetchToolActionDetail,
useCatalogActions,
useConnectionsQuery,
useIntegrationDetail,
} from "@/oss/features/gateway-tools"
} from "@agenta/entities/gatewayTool"
import {DrillInUIProvider, type GatewayToolsBridge} from "@agenta/entity-ui/drill-in"
import {EditorProvider} from "@agenta/ui/editor"
import {SharedEditor} from "@agenta/ui/shared-editor"
import {useSetAtom} from "jotai"

import {useLLMProviderConfig} from "@/oss/hooks/useLLMProviderConfig"
import {isToolsEnabled} from "@/oss/lib/helpers/isEE"
import {fetchActionDetail as fetchToolActionDetail} from "@/oss/services/tools/api"

interface OSSdrillInUIProviderProps {
children: ReactNode
Expand Down Expand Up @@ -121,27 +121,40 @@ function GatewayToolsEnabledProvider({
const gatewayTools = useMemo<GatewayToolsBridge>(
() => ({
enabled: true,
connections: connections.map((connection) => ({
id: connection.id,
slug: connection.slug,
name: connection.name,
integration_key: connection.integration_key,
provider_key: connection.provider_key,
flags: connection.flags,
})),
connections: connections
.filter((c) => typeof c.id === "string" && typeof c.slug === "string")
.map((connection) => ({
id: connection.id as string,
slug: connection.slug as string,
name: connection.name ?? undefined,
integration_key: connection.integration_key,
provider_key: connection.provider_key,
flags: (connection.flags ?? undefined) as
| Record<string, unknown>
| undefined,
})),
connectionsLoading: isLoading,
onOpenCatalog: () => setCatalogDrawerOpen(true),
useIntegrationInfo: useGatewayToolsIntegrationInfo,
useIntegrationInfo: (integrationKey: string) => {
const info = useGatewayToolsIntegrationInfo(integrationKey)
return {
name: info.name,
logo: info.logo ?? undefined,
isLoading: info.isLoading,
}
},
useActions: useGatewayToolsCatalogActions,
buildToolSlug,
fetchActionDetail: async (provider: string, integration: string, action: string) => {
const detail = await fetchToolActionDetail(provider, integration, action)
const detailedAction =
detail.action && "schemas" in detail.action ? detail.action : null
return {
action: {
description: detail.action?.description,
schemas: {
inputs: detail.action?.schemas?.inputs,
},
description: detailedAction?.description ?? undefined,
schemas: detailedAction?.schemas
? {inputs: detailedAction.schemas.inputs}
: undefined,
},
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React, {useEffect, useMemo, useState} from "react"

import {
PROVIDER_KINDS,
PROVIDER_LABELS,
STANDARD_PROVIDER_KINDS,
useVaultSecret,
} from "@agenta/entities/secret"
import type {LlmProvider} from "@agenta/shared/types"
import {SelectLLMProviderBase, type ProviderGroup} from "@agenta/ui/select-llm-provider"
import {capitalize} from "@agenta/ui/select-llm-provider"
import {Plus, WarningCircle} from "@phosphor-icons/react"
import {Button, Form, Input, Typography} from "antd"
import {useWatch} from "antd/lib/form/Form"

import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"
import {isSlugInputValid} from "@/oss/lib/helpers/utils"
import {PROVIDER_KINDS, PROVIDER_LABELS, SecretDTOProvider} from "@/oss/lib/Types"

import LabelInput from "../../../assets/LabelInput"

Expand Down Expand Up @@ -103,7 +107,7 @@ const ConfigureProviderDrawerContent = ({
const [errorMessage, setErrorMessage] = useState("")
const {handleModifyCustomVaultSecret} = useVaultSecret()

const standardProviders = useMemo(() => [...Object.values(SecretDTOProvider)], [])
const standardProviders = useMemo(() => [...STANDARD_PROVIDER_KINDS], [])
const customProviders = useMemo(() => ["azure", "bedrock", "vertex_ai", "custom"], [])
const validProviders = useMemo(
() => [...customProviders, ...standardProviders],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"
import {SecretDTOProvider} from "@/oss/lib/Types"
import {STANDARD_PROVIDER_KINDS} from "@agenta/entities/secret"
import type {LlmProvider} from "@agenta/shared/types"

export const PROVIDER_FIELDS: {
key: keyof LlmProvider
Expand All @@ -21,7 +21,7 @@ export const PROVIDER_FIELDS: {
label: "API key",
placeholder: "Enter API key",
note: "This secret will be encrypted in transit and at rest.",
model: ["azure", "custom", ...Object.values(SecretDTOProvider)],
model: ["azure", "custom", ...STANDARD_PROVIDER_KINDS],
required: false,
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {LlmProvider} from "@agenta/shared/types"
import {DrawerProps, FormInstance, InputProps} from "antd"

import {LlmProvider} from "@/oss/lib/helpers/llmProviders"

export interface ConfigureProviderDrawerProps extends DrawerProps {
selectedProvider?: LlmProvider | null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {LlmProvider} from "@agenta/shared/types"
import {InputProps, ModalProps} from "antd"

import {LlmProvider} from "@/oss/lib/helpers/llmProviders"

export interface ConfigureProviderModalProps extends ModalProps {
selectedProvider: LlmProvider | null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {useEffect, useState} from "react"

import {useVaultSecret} from "@agenta/entities/secret"
import {message} from "@agenta/ui/app-message"
import dynamic from "next/dynamic"

import EnhancedModal from "@/oss/components/EnhancedUIs/Modal"
import {useVaultSecret} from "@/oss/hooks/useVaultSecret"

import {ConfigureProviderModalProps} from "./assets/types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {LlmProvider} from "@agenta/shared/types"
import {ModalProps} from "antd"

import {LlmProvider} from "@/oss/lib/helpers/llmProviders"

export interface DeleteProviderModalProps extends ModalProps {
selectedProvider: LlmProvider | null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {useState} from "react"

import {useVaultSecret} from "@agenta/entities/secret"
import type {LlmProvider} from "@agenta/shared/types"
import {Trash} from "@phosphor-icons/react"
import dynamic from "next/dynamic"

import EnhancedModal from "@/oss/components/EnhancedUIs/Modal"
import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"

import {DeleteProviderModalProps} from "./assets/types"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, {useCallback, useState} from "react"

import {executeToolCall} from "@agenta/entities/gatewayTool"
import {CaretDown, Lightning} from "@phosphor-icons/react"
import {Dropdown, message as antMessage} from "antd"
import {v4 as uuidv4} from "uuid"

import {executeToolCall} from "@/oss/services/tools/api"

// Gateway tool function name format: tools__{provider}__{integration}__{action}__{connection}
// Double-underscore is used because LLM providers forbid dots in function names.
// The /tools/call API normalises __ → . before parsing.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import {useMemo} from "react"

import {Play, Plus} from "@phosphor-icons/react"
import {Button, Collapse, Empty, Spin, Tag, Tooltip, Typography} from "antd"
import {useSetAtom} from "jotai"
import Image from "next/image"

import ConnectionStatusBadge from "@/oss/components/pages/settings/Tools/components/ConnectionStatusBadge"
import {
useConnectionsQuery,
catalogDrawerOpenAtom,
executionDrawerAtom,
useIntegrationDetail,
} from "@/oss/features/gateway-tools"
import CatalogDrawer from "@/oss/features/gateway-tools/drawers/CatalogDrawer"
import ToolExecutionDrawer from "@/oss/features/gateway-tools/drawers/ToolExecutionDrawer"
import type {ConnectionItem} from "@/oss/services/tools/api/types"
type ToolConnection,
} from "@agenta/entities/gatewayTool"
import {
CatalogDrawer,
ConnectionStatusBadge,
ToolExecutionDrawer,
} from "@agenta/entity-ui/gatewayTool"
import {Play, Plus} from "@phosphor-icons/react"
import {Button, Collapse, Empty, Spin, Tag, Tooltip, Typography} from "antd"
import {useSetAtom} from "jotai"
import Image from "next/image"

interface GatewayToolsPanelProps {
mountDrawers?: boolean
Expand All @@ -27,7 +28,7 @@ export default function GatewayToolsPanel({mountDrawers = false}: GatewayToolsPa

// Group connections by integration
const grouped = useMemo(() => {
const map: Record<string, ConnectionItem[]> = {}
const map: Record<string, ToolConnection[]> = {}
for (const conn of connections) {
const key = conn.integration_key
if (!map[key]) map[key] = []
Expand Down Expand Up @@ -82,15 +83,16 @@ export default function GatewayToolsPanel({mountDrawers = false}: GatewayToolsPa
<div className="flex flex-col gap-1">
{grouped[integrationKey].map((conn) => (
<ConnectionRow
key={conn.id}
key={conn.id ?? conn.slug ?? ""}
connection={conn}
onTest={() =>
onTest={() => {
if (!conn.id || !conn.slug) return
setExecutionDrawer({
connectionId: conn.id,
connectionSlug: conn.slug,
integrationKey: conn.integration_key,
})
}
}}
/>
))}
</div>
Expand Down Expand Up @@ -132,7 +134,7 @@ function IntegrationSectionLabel({integrationKey}: {integrationKey: string}) {
)
}

function ConnectionRow({connection, onTest}: {connection: ConnectionItem; onTest: () => void}) {
function ConnectionRow({connection, onTest}: {connection: ToolConnection; onTest: () => void}) {
const isReady = connection.flags?.is_active && connection.flags?.is_valid
const {integration} = useIntegrationDetail(connection.integration_key)
const label = integration?.name || connection.integration_key.replace(/_/g, " ")
Expand Down
4 changes: 2 additions & 2 deletions web/oss/src/components/Playground/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {type FC, useCallback, useEffect, useMemo} from "react"

import {executeToolCall} from "@agenta/entities/gatewayTool"
import {loadableController} from "@agenta/entities/loadable"
import {testcaseMolecule} from "@agenta/entities/testcase"
import {CatalogDrawer} from "@agenta/entity-ui/gatewayTool"
import {GatewayToolAssistantActions, type PlaygroundUIProviders} from "@agenta/playground-ui"
import {useLocalDraftWarning} from "@agenta/playground-ui/hooks"
import {preloadEditorPlugins, SyncStateTag} from "@agenta/ui"
import {useAtomValue, useSetAtom} from "jotai"

import SimpleSharedEditor from "@/oss/components/EditorViews/SimpleSharedEditor"
import SharedGenerationResultUtils from "@/oss/components/SharedGenerationResultUtils"
import CatalogDrawer from "@/oss/features/gateway-tools/drawers/CatalogDrawer"
import {executeToolCall} from "@/oss/services/tools/api"
import {playgroundSyncAtom} from "@/oss/state/url/playground"

import PlaygroundMainView from "./Components/MainLayout"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Org, OrgDetails, User} from "@/oss/lib/Types"
import type {User} from "@agenta/shared/types"

import {Org, OrgDetails} from "@/oss/lib/Types"
import {ProjectsResponse} from "@/oss/services/project/types"

export interface UseDropdownItemsProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {useCallback} from "react"

import {useVaultSecret} from "@agenta/entities/secret"
import type {LlmProvider} from "@agenta/shared/types"
import {removeTrailingSlash} from "@agenta/shared/utils"
import {useQueryClient} from "@tanstack/react-query"
import {useSetAtom, useStore} from "jotai"

import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {usePostHogAg} from "@/oss/lib/helpers/analytics/hooks/usePostHogAg"
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"
import {isDemo} from "@/oss/lib/helpers/utils"
import {createAppWithTemplate, ServiceType} from "@/oss/services/app-selector/api"
import {useAppsData} from "@/oss/state/app"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {useCallback, memo, useEffect, useLayoutEffect, useMemo, useRef, useState} from "react"

import {useVaultSecret} from "@agenta/entities/secret"
import {extractSourceIdFromDraft, isLocalDraftId, isValidUUID} from "@agenta/entities/shared"
import {
workflowMolecule,
Expand Down Expand Up @@ -29,7 +30,6 @@ import {
import {FIRST_EVALUATION_TOUR_ID} from "@/oss/components/Onboarding/tours/firstEvaluationTour"
import {registryWorkflowIdOverrideAtom} from "@/oss/components/VariantsComponents/store/registryStore"
import useURL from "@/oss/hooks/useURL"
import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {resolveEvaluatorKey} from "@/oss/lib/evaluators/utils"
import {redirectIfNoLLMKeys} from "@/oss/lib/helpers/utils"
import usePreviewEvaluations from "@/oss/lib/hooks/usePreviewEvaluations"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {useMemo, useState} from "react"

import {useVaultSecret} from "@agenta/entities/secret"
import type {LlmProvider} from "@agenta/shared/types"
import {LLMIconMap} from "@agenta/ui"
import {GearSix, PencilSimpleLine, Plus, Trash} from "@phosphor-icons/react"
import {Button, Table, Tag, Typography} from "antd"
Expand All @@ -8,9 +10,7 @@ import {ColumnsType} from "antd/es/table"
import ConfigureProviderDrawer from "@/oss/components/ModelRegistry/Drawers/ConfigureProviderDrawer"
import ConfigureProviderModal from "@/oss/components/ModelRegistry/Modals/ConfigureProviderModal"
import DeleteProviderModal from "@/oss/components/ModelRegistry/Modals/DeleteProviderModal"
import {useVaultSecret} from "@/oss/hooks/useVaultSecret"
import {formatDay} from "@/oss/lib/helpers/dateTimeHelper"
import {LlmProvider} from "@/oss/lib/helpers/llmProviders"

const SecretProviderTable = ({type}: {type: "standard" | "custom"}) => {
const {customRowSecrets, secrets, loading} = useVaultSecret()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import {useMemo} from "react"

import type {ToolCatalogAction} from "@agenta/entities/gatewayTool"
import {Table, Tag, Typography} from "antd"
import type {ColumnsType} from "antd/es/table"

import type {ActionItem} from "@/oss/services/tools/api/types"

interface Props {
actions: ActionItem[]
actions: ToolCatalogAction[]
}

export default function ActionsList({actions}: Props) {
const columns: ColumnsType<ActionItem> = useMemo(
const columns: ColumnsType<ToolCatalogAction> = useMemo(
() => [
{
title: "Name",
Expand Down Expand Up @@ -43,7 +42,7 @@ export default function ActionsList({actions}: Props) {
)

return (
<Table<ActionItem>
<Table<ToolCatalogAction>
dataSource={actions}
columns={columns}
rowKey="key"
Expand Down
Loading
Loading