dify/web/service/sandbox.ts
Yansong Zhang f4e04fc872 feat(web): add Agent V2 frontend — app creation, node editor, sandbox settings
P0 — Agent App can be created and routed:
- Add AppModeEnum.AGENT to types/app.ts
- Add Agent card to create-app-modal (primary row, with RiRobot2Fill icon)
- Route Agent apps to /workflow editor (same as workflow/advanced-chat)
- Update layout-main.tsx mode guards

P1 — Agent V2 workflow node:
- Add BlockEnum.AgentV2 = 'agent-v2' to workflow types
- Create agent-v2/node.tsx: displays model, strategy, tool count
- Create agent-v2/panel.tsx: model selector, strategy picker, tool list,
  max iterations, memory config, vision toggle
- Register in NodeComponentMap and PanelComponentMap

P2 — Sandbox Provider settings:
- Create sandbox-provider-page: list/configure/activate/delete providers
  (Docker, E2B, SSH, AWS CodeInterpreter)
- Create service/sandbox.ts: API client for sandbox provider endpoints
- Add "Sandbox Providers" to settings menu

i18n: Add en-US and zh-Hans translations for agent V2 description.
Made-with: Cursor
2026-04-10 15:31:48 +08:00

41 lines
1.1 KiB
TypeScript

import { del, get, post } from './base'
export type SandboxProvider = {
provider_type: string
is_active: boolean
config?: Record<string, any>
config_schema?: Array<{
name: string
type: string
}>
}
export const listSandboxProviders = (): Promise<SandboxProvider[]> => {
return get<SandboxProvider[]>('workspaces/current/sandbox-providers')
}
export const saveSandboxProviderConfig = (
providerType: string,
config: Record<string, any>,
activate = false,
): Promise<{ result: string }> => {
return post<{ result: string }>(`workspaces/current/sandbox-provider/${providerType}/config`, {
body: { config, activate },
})
}
export const activateSandboxProvider = (
providerType: string,
type = 'user',
): Promise<{ result: string }> => {
return post<{ result: string }>(`workspaces/current/sandbox-provider/${providerType}/activate`, {
body: { type },
})
}
export const deleteSandboxProviderConfig = (
providerType: string,
): Promise<{ result: string }> => {
return del<{ result: string }>(`workspaces/current/sandbox-provider/${providerType}/config`)
}