From aac5db54a62fd27bf94f1959953655b3f636637e Mon Sep 17 00:00:00 2001 From: namtranii Date: Mon, 6 Apr 2026 07:53:46 +0000 Subject: [PATCH] feat: integrate ii-claw-runtime into II-Agent System --- frontend/src/app/router.tsx | 15 + frontend/src/app/routes/ii-claw.tsx | 226 +++ frontend/src/components/home-mobile.tsx | 7 + frontend/src/components/ii-claw/agents.tsx | 905 ++++++++++ .../src/components/ii-claw/channel-defs.ts | 48 + frontend/src/components/ii-claw/channels.tsx | 1126 ++++++++++++ frontend/src/components/ii-claw/cron-jobs.tsx | 1532 +++++++++++++++++ frontend/src/components/sidebar.tsx | 26 + frontend/src/components/ui/select.tsx | 4 +- frontend/src/i18n/locales/en.json | 233 +++ frontend/src/i18n/locales/hi.json | 233 +++ frontend/src/i18n/locales/ja.json | 233 +++ frontend/src/i18n/locales/vi.json | 233 +++ frontend/src/services/ii-claw.service.ts | 430 +++++ .../20260404_000000_add_user_agents_table.py | 81 + src/ii_agent/agents/factory/tools.py | 49 + src/ii_agent/agents/prompts/agent_prompts.py | 55 + src/ii_agent/agents/types.py | 1 + src/ii_agent/app/routers.py | 6 + src/ii_agent/core/config/settings.py | 15 + src/ii_agent/ii_claw/__init__.py | 19 + src/ii_agent/ii_claw/ai_processor.py | 169 ++ src/ii_agent/ii_claw/api/__init__.py | 3 + src/ii_agent/ii_claw/api/client.py | 116 ++ src/ii_agent/ii_claw/api/router.py | 727 ++++++++ src/ii_agent/ii_claw/api/user_agent_router.py | 123 ++ src/ii_agent/ii_claw/call_agent.py | 667 +++++++ src/ii_agent/ii_claw/custom_agent/__init__.py | 20 + src/ii_agent/ii_claw/custom_agent/factory.py | 166 ++ src/ii_agent/ii_claw/custom_agent/loader.py | 64 + src/ii_agent/ii_claw/custom_agent/models.py | 94 + src/ii_agent/ii_claw/custom_agent/service.py | 210 +++ src/ii_agent/ii_claw/models.py | 35 + src/ii_agent/ii_claw/run.py | 187 ++ src/ii_agent/ii_claw/run_args.py | 198 +++ src/ii_agent/users/models.py | 66 +- 36 files changed, 8318 insertions(+), 4 deletions(-) create mode 100644 frontend/src/app/routes/ii-claw.tsx create mode 100644 frontend/src/components/ii-claw/agents.tsx create mode 100644 frontend/src/components/ii-claw/channel-defs.ts create mode 100644 frontend/src/components/ii-claw/channels.tsx create mode 100644 frontend/src/components/ii-claw/cron-jobs.tsx create mode 100644 frontend/src/services/ii-claw.service.ts create mode 100644 migrations/versions/20260404_000000_add_user_agents_table.py create mode 100644 src/ii_agent/ii_claw/__init__.py create mode 100644 src/ii_agent/ii_claw/ai_processor.py create mode 100644 src/ii_agent/ii_claw/api/__init__.py create mode 100644 src/ii_agent/ii_claw/api/client.py create mode 100644 src/ii_agent/ii_claw/api/router.py create mode 100644 src/ii_agent/ii_claw/api/user_agent_router.py create mode 100644 src/ii_agent/ii_claw/call_agent.py create mode 100644 src/ii_agent/ii_claw/custom_agent/__init__.py create mode 100644 src/ii_agent/ii_claw/custom_agent/factory.py create mode 100644 src/ii_agent/ii_claw/custom_agent/loader.py create mode 100644 src/ii_agent/ii_claw/custom_agent/models.py create mode 100644 src/ii_agent/ii_claw/custom_agent/service.py create mode 100644 src/ii_agent/ii_claw/models.py create mode 100644 src/ii_agent/ii_claw/run.py create mode 100644 src/ii_agent/ii_claw/run_args.py diff --git a/frontend/src/app/router.tsx b/frontend/src/app/router.tsx index 8e9392cc5..ca4f5a195 100644 --- a/frontend/src/app/router.tsx +++ b/frontend/src/app/router.tsx @@ -225,6 +225,21 @@ const createAppRouter = () => } } }, + { + path: 'ii-claw', + async lazy() { + const { Component } = await import( + '@/app/routes/ii-claw' + ) + return { + Component: () => ( + + + + ) + } + } + }, { path: 'share/:sessionId', async lazy() { diff --git a/frontend/src/app/routes/ii-claw.tsx b/frontend/src/app/routes/ii-claw.tsx new file mode 100644 index 000000000..98d2b8a1d --- /dev/null +++ b/frontend/src/app/routes/ii-claw.tsx @@ -0,0 +1,226 @@ +'use client' + +import { useState } from 'react' +import { useNavigate } from 'react-router' +import { useTranslation } from 'react-i18next' +import clsx from 'clsx' + +import { Logo } from '@/components/logo' +import { Icon } from '@/components/ui/icon' +import { + SidebarProvider, + SidebarTrigger +} from '@/components/ui/sidebar' +import Sidebar from '@/components/sidebar' +import { useIsSageTheme } from '@/hooks/use-is-sage-theme' +import { useIsMobile } from '@/hooks/use-mobile' +import { ChannelsPanel } from '@/components/ii-claw/channels' +import { CronJobsPanel } from '@/components/ii-claw/cron-jobs' +import { AgentsPanel } from '@/components/ii-claw/agents' + +type ClawTab = 'agents' | 'channels' | 'cronjobs' + +const CLAW_SIDEBAR_ITEMS: { + key: ClawTab + label: string + iconName: string + i18nKey: string +}[] = [ + { key: 'agents', label: 'Agents', iconName: 'agent', i18nKey: 'iiClaw.agents.title' }, + { key: 'channels', label: 'Channels', iconName: 'connector', i18nKey: 'iiClaw.channels.title' }, + { key: 'cronjobs', label: 'Cron Jobs', iconName: 'clock', i18nKey: 'iiClaw.cronJobs.title' }, +] + +// --------------------------------------------------------------------------- +// Desktop Sidebar +// --------------------------------------------------------------------------- + +const ClawDesktopSidebar = ({ + activeTab, + setActiveTab, + handleBack, + isSage +}: { + activeTab: ClawTab + setActiveTab: (tab: ClawTab) => void + handleBack: () => void + isSage: boolean +}) => { + const { t } = useTranslation() + + return ( +
+
+
+ + +
+
+ + + +
+

+ {t('iiClaw.version')} +

+
+
+ ) +} + +// --------------------------------------------------------------------------- +// Mobile Layout +// --------------------------------------------------------------------------- + +const IIClawMobile = ({ + activeTab, + setActiveTab, + renderContent, + handleBack +}: { + activeTab: ClawTab + setActiveTab: (tab: ClawTab) => void + renderContent: () => React.ReactNode + handleBack: () => void +}) => { + const { t } = useTranslation() + + return ( + + +
+
+
+ + + {t('iiClaw.title')} + +
+ +
+ +
+ {CLAW_SIDEBAR_ITEMS.map((item) => ( + + ))} +
+ +
{renderContent()}
+
+
+ ) +} + +// --------------------------------------------------------------------------- +// Main Component +// --------------------------------------------------------------------------- + +const IIClaw = () => { + const navigate = useNavigate() + const isSage = useIsSageTheme() + const isMobile = useIsMobile() + const [activeTab, setActiveTab] = useState('agents') + + const handleBack = () => { + navigate(-1) + } + + const renderContent = () => { + switch (activeTab) { + case 'agents': + return + case 'channels': + return + case 'cronjobs': + return + default: + return null + } + } + + if (isMobile) { + return ( + + ) + } + + return ( +
+ +
+ {renderContent()} +
+
+ ) +} + +export { IIClaw as Component } diff --git a/frontend/src/components/home-mobile.tsx b/frontend/src/components/home-mobile.tsx index 3e07cd24b..e2b287dd6 100644 --- a/frontend/src/components/home-mobile.tsx +++ b/frontend/src/components/home-mobile.tsx @@ -20,6 +20,7 @@ import { } from '@/state' import { AGENT_TYPE, QUESTION_MODE } from '@/typings/agent' import { SidebarTrigger } from './ui/sidebar' +import { Link } from 'react-router' import { useTranslation } from 'react-i18next' import QuestionInput from './question-input' import type { @@ -347,6 +348,12 @@ const HomeMobile = ({
+ + +